Posts

Showing posts from June, 2010

osx - trouble understanding shell control structures -

i'm writing shell script run on mac osx terminal. here's simplified example of i'm trying do: list="../../data/fixed_data/test_games_subjects.csv" sed 1d $list | while ifs="," read f1 f2 f3 f4 if [ "$f4" != "na" ] echo "do stuff" fi done < $list test_games_subjects.csv has list of names , associated ids, f4 long string of characters, unless reads "na". file saved "windows comma separated (.csv) file. made excel. no matter value of f4, body of if statement executed. idea i'm doing wrong?

MySQL to SQLite converter -

i have 2 tables regions(id, name) countries(id, name, region_id) which in mysql format , want convert sqlite database. have tried few softwares not able convert. is there easy wat convert them considering simple tables. i had @ following links http://www.sqlite.org/cvstrac/wiki?p=convertertools http://dbconvert.com/convert-sqlite-to-mysql-pro.php either software paid or not able them work. see this gist . works on linux.

c++ - Using stringstream precision to format floats but discarding zero-padding -

i'm trying set precision (i.e. number of decimal places) of floats , long doubles 10, don't want them 0 padded. i.e., 123456.789123456789 should give 123456.7891234568, 123456 should not give 123456.0000000000, rather 123456 so far i've narrowed down to: long double mynumber; string mystring; ostringstream mystream; mystream.setf(ios::fixed,ios::floatfield); mystream.precision(10); mystream << mynumber; mystring = mystream.str(); i've tried fiddling setfill(' ') , std::ws can't hang of it. suggestions? don't use ios::fixed ios::floatfield . that's causes padding. use setprecision .

asp.net mvc - DotnetHighcharts ajax load data? -

custom_scripts_graph.js (ajax post) $.ajax({ type: "post", url: app_base_url + 'graph/_irregularchart', contenttype: 'application/json; charset=utf-8', datatype: "json", data: chartparams, success: function (result) { $("#chart").html(result); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert(thrownerror); } }); controller public actionresult _irregularchart(irregularchartparams chartparams) { ienumerable<meterreadingschartdata> irregularchartdata = meterreadingsmanager.getmeterreadingsirregularchartdata(chartparams); series[] series = chartdatamanager.getirregularchartdata(irregularchartdata).toarray(); highcharts chart = new highcharts("irregularchart") .initchart(new chart { defaultseriestype = charttypes.line, zoomtype = zoomtypes.xy, height = 300 }) .setoptions(new globaloptions { global = new g

PHP Exception message thrown with different charset -

i use utf-8 default charset. set in both in php.ini , header. require redisent library , catch exception throws. , when display error message in windows-1251 (it's windows default russian cyrillic charset). tried save redisent's source file redis.php in utf-8 doesn't help.

haskell - Haddock numbered list continuation -

Image
how continue numbered list haddock documentation tool? following lines in haddock -- 1. first line. -- -- 2. second line instructions -- -- >>> command-linecmd param -- -- 3. third line.. -- generate next html: </p><ol><li> first line. </li><li> second line instructions </li></ol><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>command-linecmd param </code></strong></pre><ol><li> third line.. </li></ol> this breaks numbering. there way make haddock continue third-number in html or should try other (>>> gives nice formatting, why i'd use it)? you can't. you're using >>> . in order have rendered example, needs @ beginning of paragraph. what's considered beginning of paragraph? anything @ start of haddock

mongodb - Deploying meteor application throws MongoError: Authentication failed -

the meteor app i'm working on should deployed on in-house redhat server. i used meteor build <outputdir> --architecture os.linux.86_64 create bundle , uploaded target server, has mongodb 3.2 , nodejs 0.10.40 installed. the server runs local mongodb on port 27017 user meteor , database myapp . user , db created in following manner. use myapp db.createuser( { user: "meteor", pwd: "meteor", roles: [ "readwrite" ] } ) continuing, did readme asked me , ran following commands in untared app bundle. $ (cd programs/server && npm install) $ export mongo_url='mongodb://meteor:meteor@127.0.0.1:27017/myapp' when first exported mongo_url typed port wrong , got mongo error: auth error exception after running node main.js . after correcting mistake exception changed mongo error: authentication failed. yet, possible connect without problem mongo shell typing mongo -u meteor -p meteor --host 127.0.0.1 --port 270

vb.net - How do I make it so that when a variable is true in "Form1," it does something in "Form2?" -

so, i'm trying make when user clicks login button on login form, sets variable true, makes activate on main form. pseudo code placed in form 2: if form1.button = clicked end if thanks help! by way, i'm complete noob vb.net. sorry. on button click event write below if form1.button = clicked dim myform new form2 if loggedin = true myform.usergroupbox.visible = true me.close myform.show() end if end if

sql - alter table then update in single statement -

i have requirement need alter (add 2 columns) , update same table. here query tried: alter table add c1 int,c2 varchar(10) update set c1 = 23, c2 = 'zzxx' i need run above 2 queries @ time. i using talend etl tool, in have component tmssqlrow, allow run multiple queries (i using 10 15 update queries in single component). but above query not working. i tested in database microsoft sql. getting below error : msg 207, level 16, state 1, line 5 invalid column name 'c1'. msg 207, level 16, state 1, line 5 invalid column name 'c2'. can 1 me resolve problem. you can't exactly in single statement (or batch) , seems tool using not support go batch delimiter. you can use exec run in child batch though. alter table add c1 int, c2 varchar(10); exec(' update set c1 = 23, c2 = ''zzxx''; '); nb: single quotes in query need doubled above escape them inside string literal.

time - C - Timing my program in seconds with microsecond precision on -

i'm trying find out user time (on linux machine) of c program i've written. i'm calling gettimeofday() once @ beginning of code , once @ end. i'm using timeval struct , difftime(stop.tv_sec,start.tv_sec) number of seconds elapsed. returns whole seconds, "1.000000". however, project requires program timed in seconds microsecond precision, example "1.234567". how can find value? know gettimeofday() records microseconds in .tv_usec, i'm not sure how use value , format correctly. use timersub function. takes 3 arguments: first initial time, second final one, , third result (the diference). of 3 arguments pointers timeval struct.

interface - implementing listener for background activity android -

i using data droid library speed asynchronous tasks. in data droid there method similar onpostexecute of async task.i performing async task using data droid pre fetching of data. want implement listener notifying background process completion activity.can explain how achieve interface.i have gone through many stackoverflow questions still unclear how implement interface this. public abstract class baseactivity extends activity implements completionlistener { completionlistener completionlistener; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); completionlistener=this; } class mytask extends asynctask<void, void, void>{ @override protected void doinbackground(void... params) { // todo auto-generated method stub return null; } @override protected void onpostexecute(void result) { super.onpostexecute(result); completionlistener.oncompletion(); } } }

php - Same SQL query works in Heidi, doesn't via mysql_query -

i've got piece of code (connection db not included): $query = "select ....... name='name1'"; echo $query; $result = mysql_query($query); when run script, mysql_num_rows($result) says 0 rows found. copy $query browser heidi, run it, 1 row found (as expected). copy $query browser directly mysql_query , run script, 1 row found. if change name1 other entry, script works well! example of problem name has no special characters: uniwersalna  praline Бордюр 2,3x60 it's windows-1251 encoding. script , database encoded in it. why mysql_query couldn't find row? our lead-dev couldn't me... update: moved mysqli_* - same result. i getting name external file. in text editor , in browser (even in source code viewer) space characters looking normally, in fact other special characters. rendered in source code viewer of browser normally, that's why query executed in heidi.

php - Woocommerce Get Product Values by ID -

trying product data on custom template product id, right have code product title. $productid = 164; echo $p_title = get_the_title( $productid ); looking short description, price, product image, product url, product brand. or might loop better loop should work product static id. thanks in advance. you better served creating new product object. $productid = 164; $product = wc_get_product( $productid ); echo $product->get_title(); echo $product->get_price_html(); note, short description merely post's post_excerpt . if using outside of loop (where $post automatically defined) need post directly. $post = get_post( $productid ); echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); or alternatively, if you've defined product object do echo apply_filters( 'woocommerce_short_description', $product->post->post_excerpt ); since woocommerce product class automatically define $product->post property g

php - Show category names for each post inside a loop in Wordpress -

i'm modifying pre-built theme display 3 'featured posts' before main grid of posts on index.php home page. thought best way loop before main loop queries posts category 'featured'. need display title of post post categories in front of background image of post thumbnail. however, when use the_category(); background image no longer clickable , seems anchor tag duplicates , closes around every element in loop. code follows: <?php $query = array( 'posts_per_page' => 3, 'post_type' => 'post', 'category_name' => 'featured', 'orderby' => 'date', 'order' => 'desc' ); $featured_home = new wp_query( $query ); if( $featured_home->have_posts() ) { ?> <div class="container featured-home"> <?php while ( $featured_home->have_posts() ) : $featured_home->the_post();?> <div class="featured-home-box">

excel - Update Bloomberg API static data -

i want copy , paste data 1 sheet sheet. original data bloomberg api function. found bloomberg data cell updates after macro finishes running. tried build private function let static data update before copy it. here code: private sub procesdata() application.run call application.ontime(now + timevalue("00:00:01"), "processdata") end sub sub macro3() dim integer = 1 until > 2 sheets("sheet1").activate cells(1, 3).value = cells(i, 1) = + 1 call application.ontime(now + timevalue("00:00:01"), "processdata") range("c4:e181").select selection.copy sheets("sheet2").select range("a1").select lmaxrows = cells(rows.count, "a").end(xlup).row range("a" & lmaxrows + 1).select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false loop end sub ah, bloomberg api... ma

mysql - count number of sales for each ID -

i have sales_log database itemid status 250 completed 251 completed 260 completed 251 completed i want query number of sales of each item id itemid sales 250 1 251 2 260 1 so presumably need select item ids where status completed, group by item id, making sure count grouped rows. those italicised keywords should more enough solve problem, provided invest time in learning tools.

node.js - Node Server, is a database necessary for basic authentication if using oauth? -

i'm learning node, doing authentication stuff @ moment passport. server has 2 pages, public home page various login options, super-secret page(and perhaps more) accessible after authenticating. if i'm going using 3rd party strategies, there reason have database? know you'd need 1 local user's id , pass, if server exclusively relies on 3rd party authentication, session persistence enough things work? or there still various things need save reason (apart logging) ? could without database, sure... in case point in authenticating @ all? proving user has google account can set free in matter of minutes. if content super secret chances want have database of users (email addresses , like) have permission see content. authenticating through oauth given access token allow fetch authenticated users email address. can looked against user table see if user registered , if app enforces it, check whether user has access page requested. oauth proving person owner of

c++ - Boolean operator problems -

simple code here, i'm trying write code can pick on specific keywords, i'm not having lot of luck. here's code: #include <iostream> int main(){ std::string input; bool isunique = true; std::cout<<"please type word: "; std::cin>>input; if(input == "the" || "me" || "it"){ isunique = false; } if(isunique){ std::cout<<"unique!!"<<std::endl; } else std::cout<<"common"<<std::endl; } if type in of 3 words (in if statement), you'll proper output program ("common"). however, if type else, you'll same exact output. if limit program search 1 word (ie: "the") , test it, works should, there 2 or more keywords, program lists "common". i've tried replacing or statements commas didn't anything. code i'm trying implement going have 50+ keywords i'm trying find efficien

RobotFramework is unable to import modules mentioned in python file -

i have .robot file imports .py file(my python file has modules import statements) when trying run robot file getting below error. how make sure modules imported in python class file imported? [ error ] error in file 'c:\users\admin\documents\pythondemo\src\framework\tests\login_box.robot': importing test library 'createcampaign.py' failed: importerror: no module named framework.page_object_model.home_page traceback (most recent call last): file "c:\users\admin\documents\pythondemo\src\framework\tests\createcampaign.py", line 1, in <module> framework.page_object_model.home_page import homepage pythonpath: c:\users\admin\documents\pythondemo\src\framework c:\windows\system32\python27.zip c:\python27\dlls c:\python27\lib c:\python27\lib\plat-win c:\python27\lib\lib-tk c:\python27 c:\python27\lib\site-packages ============================================================================== login box :: tests login box.com ==============

Azure Active Directory B2C -

Image
i implement azure ad b2c , user's first name , last name not figure out way job title or street address, office number. follow following code [policyauthorize(policy = "b2c_1_sign_in")] public actionresult claims() { claim displayname = claimsprincipal.current.findfirst(claimsprincipal.current.identities.first().nameclaimtype); viewbag.displayname = displayname != null ? displayname.value : string.empty; return view(); } it comes tutorial https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-devquickstarts-web-dotnet/ when debug program, not find job title or street address. may need use ad graph or something. check claim profile on azure portal. looks correct. there suggestion? you need select user attributes - job title,street address, office number in signup or signin profile available in access token.

ios - UITextFields inside UITableViewCells - text disappears when cells go out of view -

i have uitableview bunch of uitableviewcell s. these uitableviewcell s have multiple uitextfield s inside them. now every time scroll , down, , uitableviewcell s go out of view, , come in, whatever text had entered inside uitextfield disappears. best way make work? static nsstring *cellidentifier = @"cell"; complaintscustomcell *cell=(complaintscustomcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if(cell==nil){ nsarray *toplevelobjects = [[nsbundle mainbundle] loadnibnamed:@"complaintscustomcell" owner:self options:nil]; for(id currentobject in toplevelobjects){ if([currentobject iskindofclass:[uitableviewcell class]]){ cell = (complaintscustomcell *) currentobject; break; } } } cell.durationfld.text=[dict valueforkey:@"duration"]; [cell.durationfld settag:indexpath.row + 5000]; your code seems have 2 issues: you're setting cells' text fields exact s

jquery - How do you update a django template context variable after an AJAX call? -

i have table product shows information of group of products. <table id="item_table" class="table table-sm table-hover table-bordered"> <thead class="thead-inverse"> <tr> <th colspan="2">date</th> <th colspan="6">product name</th> <th colspan="2">category</th> <th colspan="2">amount</th> </tr> </thead> <tbody> {% item in product_list %} <tr> <td colspan="2">{{ item.date }}</td> <td id="item_name_format" colspan="6">{{ item.name }}</td> {% if item.category_id %} <td id="item_name_format" colspan="2">{{ item.category_id.level1_desc }}</td> {% endif

regex - JSON.NET: Get Specific JSON Date Value -

in vb.net project, using json.net, i've got json web api has value representing date in yyyy-mm-ddthh:mm:ss format, , i'd value. here's more or less json looks like: { "req_date": "2016-01-17t12:27:57", "req_type": "vacation", "hours": 500.0, "leave_time": "8:00 am", "leave_date": "2016-01-23t00:00:00", "due_time": "8:00 am", "due_date": "2016-01-24t00:00:00", } so should serialize , value, right? however, when put key-value in variable, date format automatically changed! dim temp string = myjsonresult("req_date") ' temp = "1/17/2016 12:27:57 pm" i need have date retrieved json. see 2 ways go problem: converting yyyy-mm-ddthh:mm:ss manually, or using regex directly grab key-value pair - both of have had no success with. my attempt convert datetime: dim tempdatetime datetime =

doc - How to change duplicate rows to unique values in mysql databse -

i have database table 1m records. need find duplicate names in table , make them unique. id name 1 2 3 b 4 c 5 c should changed to... id name 1 2 a-1 3 b 4 c 5 c-1 there effective way of doing mysql query or procedure? thanks in advance! i needed similar table working on. needed unique url field previous keepers of data did not keep these constraints. key create temp table. i used response here help: mysql error 1093 - can't specify target table update in clause take note doesn't perform well, again if need run once on database clean table shouldn't bad. update `new_article` `upd` set `upd`.`url` = concat(`upd`.`url`, '-', `upd`.`id`) `upd`.`url` in( select `url` ( select `sel`.`url` `new_article` `sel` group `sel`.`url` having count(`sel`.`id`) > 1 ) `temp_table` );

memory management - java jvm maximum and minimum heap options -

two jvm options can provide -xms , -xmx minimum , maximum heap size jvm respectively. in lot of applications, have noticed both these values same. there specific or reason why developers chose have both minimum , maximum possible heap same? thanks one answer avoid memory fragmentation, vm start max allowed allocating size

robotframework - Robot Framework using proxy -

i have curl call: curl -k -i -x -h "cache-control: no-cache" --proxy1.0 "localhost:7070" "https://www.google.com" i trying make call robot framework can test same elements. got far: ***settings*** library collections library requestslibrary ***variables*** ${url} http://www.google.com ${proxy} localhost:7070 ${headers}= create dictionary cache-control no-cache ***test cases*** requests create session google ${url} ${headers} ${proxy} ${resp}= request google / should equal strings ${resp.status_code} 200 i still error: valueerror: need more 1 value unpack any idea going wrong? the problem here: ***variables*** ... ${headers}= create dictionary cache-control no-cache you cannot call keywords create dictionary in variables table. above code setting ${headers} string &qu

game engine - Alternatives to playN -

i want create games multiple platforms. want code games 1 against common api/framework , framework compile game multiple platforms. want game work html game in browsers , can complied native app android, ios. based on these requirements landed on playn , exploring capabilities stuck because of poor documentation , tutorials. though implemented samples help. is there other such frameworks more mature playn above said capabilities. thanks, responses appreciated. libgdx java solution, although what alternatives playn? page shows other alternatives too. post compares playn , libgdx: libgdx or playn?

jquery - Not able to render the request to another html from controller using angularjs + spring MVC 3.0 -

logon.jsp <!doctype html> <html ng-app="angularspring"> <head> </head> <body ng-controller="logoncontroller"> <form> <div> textbox : <input type="text" ng-model="person.username" /> </div> <div> password : <input type="password" ng-model="person.password" /> </div> <div ng-view></div> <button type="submit" ng-click="login(person)"> submit </button> </form> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="js/jquery.i18n.properties-min-1.0.9.js"></script> <script type="text/javascript" src=&q

How to auto import missing class in the latest android studio? -

i following basic tutorials in android developer official site. , there's part cant work. the instruction said if want import missing class use alt + enter on top part of class. when wont import missing classes. instead viewing create test option only. i'm new in android development hope can me. auto import work if missing class in question underlined. if see class in red, click on screen somewhere close class adjust cursor position , try alt + enter once class name underlined. another option auto complete when typing class name (which can accomplished via enter or tab , sorry muscle memory makes me forget which...) automatically import appropriate class. if using third party library , isn't appearing properly, make sure add compile statement library in gradle build file.

json - Check if Gson JsonArray is empty -

i using httpurlconnection retrieve json string. looks this: { "status":"ok", "testsuites":[ { // possibly 1 object in here } ] } i want know if array empty. there @ 1 object in array. tried following: jsonparser parser = new jsonparser(); jsonobject obj = parser.parse(json).getasjsonobject(); jsonarray testsuites = obj.getasjsonarray("testsuites"); and checked if testsuites null , doesn't work, because it's not null . empty! i figured out. can use size() method determine number of elements in array. if (testsuites.size() == 0)

java - substring in hashmap -

i trying create map , use map later. creating map this. string line = "0010020 027071040yn address line 1"; map.put(line.substring(0,8).tostring(), line.substring(8).tostring()); so map looks "0010020=027071040yn address line 1" . and working fine.but when trying retrieve entry map, not able it. trying retrieve this:- string temp= map.get("0010020").tostring(); the same thing working fine if don't use substring while putting data map. need use substring. please let me know how proceed the issue space comes after 0010020 in 0010020 027071040yn... ^ you including space in substring(0,8) not in lookup. in other words, key in map "0010020 " whereas you're looking "0010020" .

ios - Access device camera exposure value before taking a picture -

i'm using wonderful gpuimage framework brad larson , have @ point instance of avcapturedevice (property inputcamera gpuimagevideocamera class) want read actual exposure value before taking picture, in metadata information created after picture taken. there way value live? set avcapturesession, can exposure data in real time from: - (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection{ lightsamp++; if(lightsamp>30){ cfdictionaryref metadatadictionary = cmgetattachment(samplebuffer, kcgimagepropertyexifdictionary, null); nsdictionary *metadict= (__bridge nsdictionary*)metadatadictionary; nslog(@"exposure %@",metadict ); lightsamp=0; } } }

ios - Transition to GameScene from GameOverScene -

i'm trying transition gamescene gameoverscene. have following touchesbegan function when press 'replay game' button not transition. override func touchesbegan(touches: set<uitouch>, withevent event: uievent?) { let touch = touches.first! uitouch let touchlocation = touch.locationinnode(self) let touchednode = self.nodeatpoint(touchlocation) if let name = touchednode.name { if name == "replay"{ print("touching replay") let reveal : sktransition = sktransition.fliphorizontalwithduration(0.5) let scene = gamescene(size: self.size) scene.scalemode = .aspectfill self.view?.presentscene(scene, transition: reveal) } } } i have following used create replay node: let replaymessage = "replay game" var replaybutton = sklabelnode(fontnamed: "chalkduster") replaybutton.text = replaymessage replaybutton.fontcolor = skcolor.blackcolor()

javascript - Track domain from subdomain (Google analytics) -

i've added code on subdomain of domain track pages don't know why doesn't work. i mention tracked pages on domain, not on subdomain. <script type="text/javascript"> window.onload = function () { var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-15318659-1']); _gaq.push(['_setdomainname', 'savoyhotel.ro']); var hdstep = parseint(document.getelementbyid('hdstep').value); switch (hdstep) { case 1: { _gaq.push(['_trackpageview', '/alege-data']); if(document.location.hash == '#test-lucian-20130401') { alert('alege-data') } break; } case 2: { _gaq.push(['_trackpageview', '/alege-camera']); if(document.location.hash == '#test-lucian-20130401') { alert('alege-camera') } break; } case 3: { _gaq.push(['_trackpageview', '/date-personale']); if(document.location.hash == '#test-lucian-20130

unicode - UTF-8 coding in Python -

i have utf-8 character encoded `_' in between, e.g., '_ea_b4_80'. i'm trying convert utf-8 character using replace method, can't correct encoding. this code example: import sys reload(sys) sys.setdefaultencoding('utf8') r = '_ea_b4_80' r2 = '\xea\xb4\x80' r = r.replace('_', '\\x') print r print r.encode("utf-8") print r2 in example, r not same r2; output. \xea\xb4\x80 \xea\xb4\x80 ê´€ <-- correctly shown what might wrong? \x meaningful in string literals, you're can't use replace add it. to desired result, convert bytes, decode: import binascii r = '_ea_b4_80' rhexonly = r.replace('_', '') # returns 'eab480' rbytes = binascii.unhexlify(rhexonly) # returns b'\xea\xb4\x80' rtext = rbytes.decode('utf-8') # returns 'ê´€' (unicode if py2, str py3) print(rtext) which should ê´€ desire. if you're usi

passing array of ints to functions which expects chars in C -

how can pass buffer of unsigned ints, function expecting buffer of unsigned chars? function operate , update buffer. next pseudo-code of trying achieve. unsigned int* inputbuffer = (unsigned int*)malloc(buffersize); function(inputbuffer); <- how perform correctly? bool function(unsigned char *buffer) { ...operate , update values of buffer } it depends on function does. if operates on bytes in buffer (like memcpy , memcmp etc. do), cast pointer: function((unsigned char *)inputbuffer); if function operates on elements (integers) in buffer, you'll have copy entire contents temporary buffer: size_t nelems = buffersize / sizeof(unsigned int); unsigned char *temp = malloc(nelems); if (temp == null) // handle error (size_t i=0; < nelems; i++) temp[i] = (unsigned char)(inputbuffer[i]); function(temp); // copy results inputbuffer free(temp); however, if find need this, there's design flaw somewhere in program. shouldn't have this, ever, u

jsf - Application does not render "PrimeFaces" components -

my jsf application not render "primefaces components". have seen many topics these problem none helped me. here artefacts: pom.xml <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.jsf.wcanatto.loja_games</groupid> <artifactid>loja_games</artifactid> <packaging>war</packaging> <version>1.0-snapshot</version> <name>loja_games maven webapp</name> <url>http://maven.apache.org</url> <repositories> <repository> <id>prime-repo</id> <name>primefaces maven repository</name> <url>http://repository.primefaces.org</url> <

gruntjs - How to automate grunt tasks on file changes in asp.net core -

i using grunt minify less,css , js through task runner explorer. there simple way automate these tasks. want grunt create & minify css files when less file changed. , minify javascript files when of js files modified. there visual studio extension bundler & minifier want. when install extension, can right click file want minify , select "minify file". on task runner explorer right click "all files" option , add binding before build

audio - Change voice in android -

i using media recorder record voice want play voice in female tone or vice versa. have media player sound , when play it, runs fine have recorded voice using media recorder , want play female tone? how can change male voice female voice or female voice male voice? have tried use soundpool class increases or decreases frequency. not change tone or pitch of voice. you are changing pitch when change frequency. however, increasing or decreasing playback frequency unlikely make male voice sound female or vice versa. it'll sound distorted version of original voice. a female voice contain more energy in higher end of speech frequency spectrum, , less in lower end. opposite case male voice. you're doing in effect move all energy upwards or downwards in spectrum, not sound natural. the theory of human speech broad subject cover @ q&a site stackoverflow. recommendation book on subject, or use search engine find research papers or scientific articles.

Android: <include/> layout crashes application on landscape -

i tried use include tag reuse layout code activity_main.xml , contact_details.xml during landscape mode. display activity_main on left , contact_details on right. application crashes when switch landscape mode. this coding activity_main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <listview android:id="@+id/list_data" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" /> <button android:id="@+id/btnaddcontact" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="5dp" android:layout_weight="0" android:text="add contact" /> </linearlayout> this codi

cocoa - Adding more number of View and NSOpenGLView in NSWindow -

Image
i need add more number of nsview along more number of customised nsopenglview in window , wants shuffle array of views. if set base view setwantslayer:yes initially, can't draw openglview if set setwantslayer:no, can draw openglview nsview goes beyond openglview. like, in myopenglview.m myopenglview = [ [ myopenglview alloc ] initwithframe:frame_ colorbits:16 depthbits:16 fullscreen:false ]; [self addsubview: myopenglview]; then try add 1 more view on window customview = [[customview alloc] initwithframe:[self bounds]]; [self addsubview:customview]; now custom view goes beyond myopenglview. how fix this? edit : screenshot of problem

java - Fetch value of a node's attribute in XML -

i have xml document, snippet of below: <item name="entrydataitem" type="dataview" caption="__entry_data_item" id="208" formitem="selectbox"> <properties> <property name="caption" value="task type"/> <property name="name" value="task_type"/> </properties> </item> <item name="entrydataitem" type="dataview" caption="__entry_data_item" id="211" formitem="text"> <properties> <property name="caption" value="time spent (min)"/> <property name="name" value="time_spent_min"/> </properties> </item> etc. there other "properties" well. value of "task_type" other properties stored in database. when iterate through document, properties fetched , document prepared "caption" , "value" xml.

vba - Import A CSV File into Excel (Requires Login/Pass) -

i've looked @ dozens of similar topics here without finding i'm looking for. if doing manually, navigate url, given parameters: https://the.website.com/mobile/rest/reportservice/exportreport?name=shared%2fmv+report.ppr&format=csv&showtotals=false&valuedate=today when go there, requests username , password in pop-up box, enter, , downloads csv. this python code works perfectly: import requests requests.auth import httpbasicauth username = "i_cant_tell_you_guys" password = "definitely_cant_share_this" auth = httpbasicauth(username, password) url = "https://the.website.com/mobile/rest/reportservice/exportreport?name=shared%2fmv+report.ppr&format=csv&showtotals=false&valuedate=today" resp = requests.get(url.format(username, password), auth=auth, verify=false) print resp.content but can't seem replicate in vba. possible? if not, have excel , python work somehow? thanks! edit: several people suggeste

linux - How do I troubleshoot a Python script that should log into a Windows server when there are no error messages? -

my ansible playbooks not working windows servers (2012). they've never worked correctly. installed pywinrm (0.1.1) on centos 7 server. have python 2.7.5. have basic python script imports winrm. have hardcoded credentials of local account (not domain account) windows server. script should connect windows server, there no error messages, , appears fail. import winrm session = winrm.session('nameofwindowsserver', auth=('localuser', 'password')) i ran powershell script prepares server used winrm. see no activity in windows server event log. how python script log windows server? seems silently failing. expect activity in event viewer of windows server. update: failure silent, added 2 line script. added third line of python code: remotecom = session.run_cmd('ipconfig', ['/all']) i got error: traceback (most recent call last) ... file "/usr/lib/python2.7/site-ackages/winrm/ init .py", line 29, in run_cmd .

amazon web services - How to add files for the ec2 instance which is launched with autoscaling group? -

i see can add files ec2 instance metadata cloudformation:init follows. "resources": { "myinstance": { "type": "aws::ec2::instance", "metadata" : { "aws::cloudformation::init" : { "config" : { "packages" : { : }, "groups" : { : }, "users" : { : }, "sources" : { : }, "files" : { : }, "commands" : { : }, "services" : { : } } } } } } but when want launch instance autoscaling group, how can it? have tried add metadata under launch configuration ec2. include metadata structure in aws::autoscaling::launchconfiguration resource used auto scaling group. "launchconfig" : { "type" : "aws::autoscaling::launchconfiguration", "metadata" : {

python - How do I check if the list contains empty elements? -

suppose have empty string, split: >>>''.split(',') [''] the result of split [''] . use bool check whether or not it's empty. return true . >>>bool(['']) true how check split result empty? with bool(['']) you're checking if list [''] has contents, which does , contents happen empty string '' . if want check whether all elements in list aren't 'empty' (so if list contains string '' return false ) can use built-in function all() : all(v v in l) this takes every element v in list l , checks if has true value; if all elements returns true if @ least 1 doesn't returns false . example: l = ''.split(',') all(v v in l) out[75]: false you can substitute any() perform partial check , see if any of items in list l have value of true . a more comprehensive example* both uses: l = [1, 2, 3, ''] all(l) # ''

c# - Reading file in reverse -

because bmp files written bottom top (in terms of pixels), need read bmp file in reverse (and rid of 54-byte header). code far: public string createnoheaderbmp(string curbmp) //copies header curbmp tempbmp { string tempbmp = "c:\\temp.bmp"; stream instream = file.openread(curbmp); binaryreader br = new binaryreader(instream); byte[] fullbmp = new byte[(width * height * 3) + 138]; byte[] buffer = new byte[1]; long bytesread; long totalbytes = 0; while ((bytesread = br.read(buffer, 0, 1)) > 0) { fullbmp[fullbmp.length - 1 - totalbytes] = buffer[0]; totalbytes++; } filestream fs = new filestream(tempbmp, filemode.create, fileaccess.write); fs.write(fullbmp, 54, fullbmp.length - 54); fs.close(); fs.dispose(); return tempbmp; } for reason fails job completely, , results in image part of right side placed on lef

Issues with jQuery/CSS Nav not hiding and horizontal position -

Image
update: horizontal positioning has been resolved, still having issues menus not disappearing. updated jsfiddle: http://jsfiddle.net/trevoray/crpdk/7/ i've come across 2 issues nav can't past. can take , me out? horizontal position. page centered, don't know exact position. made absolute , thought absolute based upon it's parent element, it's not working. need horizontal position same regardless of how wide user's browser is. menus not "hiding" after onmouseout. can't seem figure out how menus go away consistantly. here's jsfiddle: http://jsfiddle.net/trevoray/crpdk/2/ #nav-about { z-index:4000; position:absolute; left:186px; display:none;} #nav-meetings { z-index:4000; position:absolute; left:357px; display:none;} #nav-journal { z-index:4000; position:absolute; left:528px; display:none;} #nav-goodstuff { z-index:4000; position:absolute; left:699px; display:none;} #nav-members { z-index:4000; position:absolute; left:81

java - Are Immutable objects immune to improper publication? -

it example jcip . public class unsafe { // unsafe publication public holder holder; public void initialize() { holder = new holder(42); } } public class holder { private int n; public holder(int n) { this.n = n; } public void assertsanity() { if (n != n) { throw new assertionerror("this statement false."); } } } on page 34: [15] problem here not holder class itself, holder not published. however, holder can made immune improper publication declaring n field final, make holder immutable; and this answer : the specification final (see @andersoj's answer) guarantees when constructor returns, final field have been initialized (as visible threads). from wiki : for example, in java if call constructor has been inlined shared variable may updated once storage has been allocated before inlined constructor initializes object my question is: because