Posts

Showing posts from June, 2014

objective c - How to overwrite parent properties (redeclaration of parent property as a static variable)? -

it possible have type in parent class subclass overwrites? the idea here have shape class, subclasses of rectangles, square, circles, etc. wondering if it's possible overwrite definition of 'shapetype' int property in parent class. this? e.g. in globals.h #define kshapetype_rectangle = 1 #define kshapetype_square = 2 #define kshapetype_triskaidecagon = 13 // try pronouncing this! in shape.h @interface shape : nsobject @property int shapetype; @property int shapeid; @property uicolor shapecolor; @end .... in rectangle.h #import globals.h @interface rectangle : shape @property static (nonatomic, readonly) int shapetype = kshapetype_rectangle; // how working? @end so 2 questions: 1) such thing possible - i.e. redeclaration of parent property static variable 2) yes or no (1), best coding style sort of thing? i'm not experienced in obj-c patterns, if 1 exists, suggest source me @ please? thanks lot! there no concept of objec

javascript - link not appearing on hover using jquery -

i want make div visible when hovering div. now, know can implemented using jquery not working. populating list using javascript given below : function coachinglink(data, list) { list = list + '<div class="**coachinglinkdisplay**"><p class="coachinglink" align="left" style="color:#cd3700;">' + data.coachingname + '</p><br/>' + '<p class="title" style="color:black;font-size:14pt;">subjects : ' + subjects + '</p><br/><p class="content" align="left"></b>' + data.description + '</p></div></a><a href="batch.html?coachingid=' + data.coachingid + '" class="**batchbutton**"><b>view batches</b></a>'; return list; } now want when hovering on coachinglinkdisplay, batchbutton should appear (whose display none in

c# - Polymorphism - What am I not getting? -

i having issue polymorphism in c#. have object implements interface, cannot represent collection of objects collection of interfaces. flies in face of understanding of polymorphism. wondering have gone wrong. [testfixture] class tester { [test] public void polymorphism() { var list = new list<foo> {new foo {name = "item"}}; assert.that(list, is.instanceof<ilist>()); assert.that(list[0], is.instanceof<foo>()); assert.that(list[0], is.instanceof<ibar>()); // why rest true false? assert.that(list, is.instanceof<ilist<ibar>>()); } } internal interface ibar { } internal class foo : ibar { public string name { get; set; } } this question of variance, not polymorphism. if list-of-foo ilist-of-ibar, following work: class : ibar {} ilist<ibar> list = new list<foo>(); list.add(new another()); then we've added list of foo. error. compiler stopp

jquery ui - Gmail like listview item removing - jquerymobile -

i'm building phonegap mobile app jqm 1.3. have listview element, each list item have 2 actions, rename when swipe right, , delete when swipe left. want achieve behavior in gmail mobile application. when list item dragged aside (more threshold), "layer" shown related buttons. i'm using code jquery mobile swipe list demo , popup on swipe event, not fulfill needs. how stuff can implemented ? there plugin achieve functionality? i tried make this. working demo here - http://jsfiddle.net/q9htn/19/ first html: <ul id="list" data-role="listview"></ul> then css. not happy having define row height way , sure there must better ways how dynamically, should ok purpose. makes sure row stays during animations happen. .row { height: 1em; } .item { position: absolute; display: inline-block; width: 100%; right: -1em; /* makes item fly out right */ } .menu { width: 100%; display: inline-block; text-

c# - What is the fastest way to check a type? -

instead of overloading function 100 times or creating 100 different comparers different types i've decided check type within 1 function. for example i'm using default comparer compare values of set of types (primitives , strings) within 2 objects. contains following code: public class defcomparer : icomparer<object> { public int compare(object a, object b) { .... // = a.gettype().getfield(field).getvalue(a); - not important question i'm showing a&b below different references switch (a.gettype().name) { case "byte": if ((byte)a == (byte)b) return 0; else if ((byte)a > (byte)b) return 1; else return -1; case "uint16": if ((ushort)a == (ushort)b) return 0; else if ((ushort)a > (ushort)b) return 1; else return -1; case "sbyte": if ((sbyte)a == (sbyte)b) return

html - My javascript function in the code given below is getting called twice -

the below code simple number guessing game. function guess() getting called twice. @ loss of logic why it's happening. <!doctypte html> <html> <head><title>number guessing game version 1.0</title></head> <body> <form onsubmit="guess();return false;"> <p><h2>i host, human. thinking of number between 0 , 100, including both</h2></p> <p><input type="text" id="inputid" autocomplete="off"></input><button id="submitbutton" onclick="guess()">guess!!</button></p> <p><span id="msgid"></span></p> <p>guesses remaining:<span id="guessid"></span></p> </body> </form> <script language="javascript"> var doublerandom = math.random(); var guessesleft = par

plone - Version conflict when using buildout.plonetest 4.3.x -

i wrote small module extends https://raw.github.com/collective/buildout.plonetest/master/test-4.2.x.cfg . if change version 4.2 4.3 throws error when running bin/buildout : ... while: installing. getting section test. initializing section test. installing recipe zc.recipe.testrunner. error: there version conflict. have: zc.recipe.egg 2.0.0 i suppose error produced because packages listed in buildout.plonetest have conflicting versions , bug in 4.3 version set. i'm right or i'm making mistake in buildout.cfg file? the buildout i'm using is: [buildout] extends = https://raw.github.com/collective/buildout.plonetest/master/test-4.2.x.cfg package-name = conaride.theme package-extras = [test] [instance] eggs += pillow [test] defaults = ['-s', '${buildout:package-name}', '--auto-color', '--auto-progress'] there no bug in 4.3 version set; need fix version conflict. try or of following approaches very-common pr

c# - Check if Windows built-in local guest account is turned on -

Image
i'm trying check determine if local windows guest account turned on or off. (please note different enabled/disabled, can check for). as far can tell place the on/off setting has impact in local security policy setting "deny log on locally". an acceptable workaround check can determine if built-in guest account capable of being displayed during log-in screen. question thing method needs know. in advance. edit clarification: this question answered averagejoeoftoronto on @ technet : since i'm trying determine status of setting (as opposed editing it), solution provided export security policy using secedit. secedit.exe /export /cfg %temp%\userrights.inf /areas user_rights /log %temp%\userrights.log produces cfg contain line relevant "deny log on locally" list: sedenyinteractivelogonright = guest for lot of domain computers include aspnet (i recall seeing people looking same solution filter out aspnet). when aspnet or other a

php - getJson not working on webhosting -

i have slight problem. connecting web service provides json results , trying parse results. code working fine on localhost (wamp server) code doesn't run on of web hosting accounts tried. here url providing json http://mohamedbadr.com/webservice/list.php and here file trying fetch results: http://contestlancer.com/web/getlist.php here code of getlist file: <!doctype html> <html> <head> <title>hotel promotion list</title> <script type="text/javascript" src="jquery.js"></script> <link rel="stylesheet" type="text/css" href="style.css"/> <script type="text/javascript"> function getlist() { var i=0; var ntable="<table><thead><tr><th>image</th><th>name</th><th>rating</th><th>highlights</th></tr></thead><tbody>"; $.getjson("http://mohamedbadr.com/webservice/li

bioinformatics - Partially Merging Data Sets in R -

i have 2 data files this: bin chrom chromstart chromend name score strand 23 chr1 119537649 119537708 a_14_p109202 1000 + 109 chr1 37879762 37879821 a_16_p15088121 1000 + 129 chr1 59113425 59113484 a_16_p00074945 1000 + 138 chr1 68288459 68288517 a_16_p00088142 1000 + and hybridization ref tcga-02-0001-01c-01d-0185-02 composite element ref normalizedlog2ratio a_14_p112718 0.034472223 a_16_p15000916 -0.038733669 a_16_p15001074 -0.498562753 a_16_p00000012 -0.269915751 . using names first column of second file, need extract additional data data table in first file. however, not every name in second file appears in first. having problems getting files merge properly. appreciated. if place all.x=true in merge command; of records first data frame in merged dataframe, if don't have match in second. problem encountering? in example gave none of rownames matc

php - Code to submit the email form without refreshing the page and without validation -

i have created contact form using requires attribute. want submit email form without refreshing page. when googled it, got validation code, don't need validation because used required attribute in html. want function can add page wont refreshed after submitting , email should go.. index.html <!doctype html> <html> <head> <meta charset="utf-8"> <title>html5 contact form</title> <link rel="stylesheet" media="screen" href="styles.css"> </head> <body> <div id="contact"> <form class="contact_form" action="contact.php" method="post" name="contact_form"> <ul> <li> <h2>contact us</h2> <span class="required_notification">* denotes required fiel

php - POST data through AJAX and set as variable -

i not familiar javascript especialy when comes functions , ajax. trying data php page , have put div. when ever load page nothing comes up. my ultimate goal data php or javascript first need figure out how / receive data. here php code of feedupdate.php <?php require "dbc.php"; $function = $_post['function']; switch($function) case('initiate'): $search="select * feedtest order id desc"; $request = mysql_query($search); $mostrecent= mysql_fetch_array($request); $mostrecentid = $mostrecent['id'] echo json_encode($mostrecentid); break; case('update'): $search="select * feedtest order id desc"; $request = mysql_query($search); $update= mysql_fetch_array($request); $updateid = $update['id']; echo json_encode($updateid); break; ?> here ajax <div id="datacheck"></div> <script> $(document)

preg split - Php preg_split for forwardslash? -

i've text wish parse $str = "text1<br/>text2<br/>text3 i've tried using print_r( preg_split("<br/>", $str)); but not giving me desired output try following: $str = "text1<br/>text2<br/>text3"; print_r(preg_split("/<br\/>/", $str)); i'm assuming missing closing quote " @ end of $str = "text1<br/>text2<br/>text3" typo. take @ page on how specify string $pattern parameter: http://php.net/manual/en/function.preg-split.php

using the PHP mail function -

i using php mail function send users emails new features , updates. can send email , message no problem. control message from, more email client says from. for example: <?php $to = "someone@gmail.com"; $subject = "test"; $msg = "hello there!"; $headers = "from: someone@shareit.me"; mail($to,$subject,$msg, $headers); ?> in mail client (ie. gmail) user see: someone test - hello there i control name of sender via headers. possible? so email someone@shareit.me name of sender shareit. thanks use following headers: ( link docs ) $headers = "from: shareit <someone@shareit.me>";

ios - Masking CALayer with Lines -

i'm trying find efficient way perform following clipping operation on cashapelayer have. what i'm trying do i have cashapelayer circular path consists of uibezierpath has been constructed using method [uibezierpath bezierpathwitharccenter:] (this full circle 0 2pi radians), , inside of circle, want cut out multiple lines drawn @ different angles, making area below cut out lines transparent on circle. want these lines begin , end @ points on outside of circle aka edges of cashapelayer's path. i'm wondering whether there way use mask property on cashapelayer accomplish this, or whether should abandon idea of cutting out full circle , draw each arced triangle separately different cashapelayers . thank help! i ended solving forgetting using masks. instead, constructed uibezierpath using movetopoint: , addlinetopoint: methods in order draw desired portions of circle.

objective c - How to retrieve the list of selecetd files, from finder, efficiently, in a cocoa app? -

from within cocoa app, trying retrieve list of files have been selected in finder window. have found following way it, unbearably slow. finderapplication * finder = [sbapplication applicationwithbundleidentifier:@"com.apple.finder"]; sbelementarray * selection = [[finder selection] get]; nsuinteger count = [selection count]; nsarray * items = [selection arraybyapplyingselector:@selector(url)]; nsmutablearray *filepaths =[[nsmutablearray alloc] init]; (nsstring * item in items) { nsurl * url = [nsurl urlwithstring:item]; [filepaths addobject:[url path]]; } the expensive call, time wise, sbelementarray * selection = [[finder selection] get]; the method literally hangs long times when selection made on large number of files, doesnt perform when working small selection either. is there better way urls of selected files in foremost finder window? i need have file urls can perform actions on/with files. any appreciated! t

c++ - How to determine when at the bottom / end of a QListView? -

i'm using qlistview wraps simple list model. try implementing similar "infinite scroll" seen in web pages. currently model updated method adds @ 100 items (they're taken external web api takes @ 100 items per call). goal: when user moves last element of list view (in case, scrolling down) start call 100 more items, , on. to simplify in example: populate list 100 items view scrolled down (by user) bottom other 100 items fetched. is there in qlistview tells me when i'm @ end of visible view? qlistview subclass of qabstractscrollarea , 1 way of finding out if vertical scroll bar's position @ 1 of extremes to: get qscrollbar object used qlistview calling verticalscrollbar() . connect slidermoved(int value) signal of scroll bar slot of choice. in slot, fetch min/max values of scroll bar , compare them value given in signal.

Assertion: 13111:wrong type for field 3 != 4 - MongoDB C++ driver -

in mongodb database have documents of form: { "timestamp" : "2012-01-15t17:56:14.85", "event" : [ { "id" : "1851236846", "qualifier_id" : "209" }, { "id" : "378258775", "qualifier_id" : "57", "value" : "1" } ] } { "timestamp" : "2012-01-15t16:06:09.378" } some of them contain array event don't. when i'm trying process data using c++ mongodb driver 2.4: while (cursor->more()) { bsonobj bo = cursor->next(); cout << "timestamp: " << bo.getstringfield("timestamp") << std::endl; if(bo.haselement("event")) { cout<<"here"<< endl; std::vector<bsonelement> = bo.getfiel

HTML/CSS Center DIV inside DIV, absolute/relative problems -

i've been searching hours now, can't seem figure out. i want center menu @ bottom of header div, seems either center keep @ top or keep @ bottom not center it. it has position:relative/absolute, believe. this html: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>transport2000</title> <meta http-equiv="content-language" content="en-us" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="mssmarttagspreventparsing" content="true" /> <meta name="description" content="transport, mobilier, moloz etc." /> <meta name="keywords" content="transport, chican, marfa, duba, bucur

php - How to make my site use clean urls? -

the code have below makes links such "site.com/image.php?id=12", have tips on making make links such "site.com/image/12" or similar, without manually making page each individual id? $result = mysqli_query($con,"select * tabl1 name '%$s%'"); while($row = mysqli_fetch_array($result)) { echo "<a href='image.php?id=" . $row['id'] . "'>" . $row['name'] . "</a>"; echo "<br>"; } i have code on image.php page looks like $result = mysqli_query($con,"select * celeb id '$id'"); that uses id ?id=12 part on website, i'm not sure how work if did change clean urls. any useful, kind of newbie php here. edit: rewriteengine on rewriterule ^image/id/([^/]*)\.php$ /image.php?id=$1 [l] i created .htaccess file , put in it, yet when click on link still goes image.php?id=12 doing wrong? there else must do? this

c++ - How to pause this opengl program? -

i managed code compile in qtcreator on ubuntu. when run it, runs fast , window closes immediately. there warnings no errors in when compile. advice me on how see if program crashes or runs fast. here code: this main function // two-dimensional sierpinski gasket // generated using randomly selected vertices , bisection #include "angel.h" const int numpoints = 5000; //---------------------------------------------------------------------------- void init( void ) { vec2 points[numpoints]; // specifiy vertices triangle vec2 vertices[3] = { vec2( -1.0, -1.0 ), vec2( 0.0, 1.0 ), vec2( 1.0, -1.0 ) }; // select arbitrary initial point inside of triangle points[0] = vec2( 0.25, 0.50 ); // compute , store n-1 new points ( int = 1; < numpoints; ++i ) { int j = rand() % 3; // pick vertex @ random // compute point halfway between selected vertex // , previous point points[i] = ( points[i - 1]

php - Remove quotes from Json output -

i need remove double quotes in json output, exlain more. obtain result: [{"id":"1","nom":"magasin jardins 2","ville":"paris","latlng":["36.85715,10.127245"]} i need remove quotes @ value of latlng want obtain latlng": [36.85715,10.127245] this code $qry = "select *from magasin"; $result = mysql_query($qry); // $promotions = array(); $response = array(); while($row = mysql_fetch_assoc($result)) { // $promotions[]= $row; $magasin = array(); $magasin["id"] = $row["id"]; $magasin["nom"] = $row["nom"]; $magasin["ville"] = $row["ville"]; $lat = $row[latitude]; $long = $row[longitude]; $magasin["latlng"][] =floatval($lat).",".floatval($long);; // push single product final response array array_push($response, $magasin); }

database - ETL script I/O can cause disk damage? -

i have php script load data csv files (more 600 mb of csv files) every day on oracle database , remark i/o high on server when script running because files exists on same oracle server , wonder if i/o can cause disk damage. there nothing inherently bad doing this. using disk through normal methods cannot cause damage it, apart normal usage wear , tear. hard drives wear out on time, , heavy usage can cause them wear out faster, not call damage. flash based ssd's wear out after number of writes, more writes wear them out faster, again normal wear , not damage. it may faster read files , perform , queries machine, doing on 1 machine not damage anything.

Updating SQLite table with Python function using table columns as arguments -

i trying update records of table results of function uses other rows of table arguments. however, result of operation records repeated first record. can explain why might case? def fun(a,b,c,d): return + b + c + d cur = conn.cursor() cur.execute("select field1, field2, field3, field4 table1") row in cur: cur.execute("update table1 set field5 = ?", (fun(row[0],row[1],row[2],row[3]),)) the completed table looks this: field1, field2, field3, field4, field5 4, 3, 2, 1, 10 7, 3, 1, 0, 10 8, 5, 2, 0, 10 when should this: field1, field2, field3, field4, field5 4, 3, 2, 1, 10 7, 3, 1, 0, 11 8, 5, 2, 0, 15 first, select of rows: select field1, field2, field3, field4 table1 this yields result set in cur : 4, 3, 2, 1 7, 3, 1, 0 8, 5, 2, 0 you begin iterate through rows. start first row: 4, 3, 2, 1 you add columns together, correctly yielding result 10 . execute sql statement: update table1 set field5 = 10 whoa, there! ther

regex - Ruby regular expressions for movie titles and ratings -

the quiz problem: you given following short list of movies exported excel comma-separated values (csv) file. each entry single string contains movie name in double quotes, 0 or more spaces, , movie rating in double quotes. example, here list 3 entries: movies = [ %q{"aladdin", "g"}, %q{"i, robot", "pg-13"}, %q{"star wars","pg"} ] your job create regular expression parse list: movies.each |movie| movie.match(regexp) title,rating = $1,$2 end # => first entry, title should aladdin, rating should g, # => without double quotes you may assume movie titles , ratings never contain double-quote marks. within single entry, variable number of spaces (including 0) may appear between comma after title , opening quote of rating. which of following regular expressions accomplish this? check apply. regexp = /"([^"]+)",\s*"([^"]+)"/ regexp = /"(.*)&q

php - What's different in App Engine SDK vs App Engine Production -

Image
i using appengine sdk developing php based project. project using pagespeed optimisations [1]. when compare "page speed" results using chrome developer toolbar [2] , find results different. results in development sdk results in production so question why there significant difference in page optimisation? shouldn't sdk behave identical (or at-least close) production environment? other differences should need aware of during development. hard test page optimisations if development , production behave differently. [1] https://developers.google.com/speed/pagespeed/ [2] https://chrome.google.com/webstore/detail/gplegfbjlmmehdoakndmohflojccocli the 2 environments have same apis, 1 running on computer , other running on hundreds of servers , serving millions of users. you able profile app in development though. profiling can understand why "page speeds" slow in production, , show need improve code.

VBA excel compile error : Expected Sub,Function, or property -

i trying run rungenkutta differential problem in excel vba program follows sub rungenkutta() dim noofitrations integer dim n integer dim ii integer noofitrations = cells(2, 10) n = cells(3, 10) h = cells(3, 4) col = 8 x0 = cells(col, 9) y0 = cells(col, 10) = 1 noofitrations cells(7, 3) = x0 cells(7, 4) = y0 xn = x0 + h yn = y0 + cells(18, 3) ii mod n if ii = 0 col = col + 1 cells(col, 9) = xn cells(col, 10) = yn end if x0 = xn y0 = yn next end sub but while running getting "vba excel compile error : expected sub,function, or property" i not understanding shall run program your problem mod operator. vba doesn't recognize syntax provided. here documentation mod operator - http://msdn.microsoft.com/en-us/library/se0w9esz.aspx th mod operator binary operator , requires 1 left , 1 right argument. you need change ii mod n to ii = mod n here revised example provided. sub rungenkutta() dim noofitrations intege

node.js - cannot find module express, how to install it to make it globally available? -

i want experiment node.js stuff , installed yesterday following someone's instructions on web got , running, , got standard hello world web page on screen. i went move onto example, in order not clutter home directory, created directory off of (~/node) , created files needed in there. low , behold, when came time run service, got no joy stating express module couldn't found. the instructions told me install express using -g flag, didn't help. ran again without luck. now i've found this: cannot find module `express` | socket.io [node.js] and appears have install again under current directory. have done , works. case has installed under each directory want services running from? seems unnecessary duplication. edit: not knowing js thought go digging , found app.use(express['static'](__dirname )); and have realised cause of problem. further research has found this: http://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders ,

How do you display a keyboard using Trigger.io on iOS without requiring user action? -

i keyboard automatically displayed when call $('#elementid').focus() on input text box. there anyway accomplish this? just using .focus() on element restricted due browser security limitations. however, write trigger.io native plugin disables limitation ios 6 , above. use app , want release on github soon. now, should going: nsstring *reqsysver = @"6.0"; nsstring *currsysver = [[uidevice currentdevice] systemversion]; // check if on >= ios 6 if ([currsysver compare:reqsysver options:nsnumericsearch] != nsorderedascending) { [forgeapp sharedapp].webview.keyboarddisplayrequiresuseraction = no; [task success:nil]; } else { [task error:@"invalid ios version"]; } after called plugin method once in app, able use normal .focus() on input element.

c# - How do I get run R-tree index on SQLite database using fluent hibernate interface -

is there possibility set r-tree on sqlite database using fluent nhibernate? , read there new table created r-tree index have table of data , table of index. how reach situation query search in index table first , result join data table?

java - This code datasource configurarion in tomme is running without eclipse fine but when i run in eclipse then its giving error -

i using apache tomee datasource connecting mysql java.this work without eclipse(juno) fine when running using eclipse giving error. error can view in url: http://www.docdroid.net/2xuj/errro.txt.html this tomme.xml file <?xml version="1.0" encoding="utf-8"?> <tomee> <resource id="jdbc/mydb" type="datasource"> jdbcdriver com.mysql.jdbc.driver jdbcurl jdbc:mysql://localhost:3306/ops username root password jtamanaged true </resource> </tomee> and web.xml <resource-ref> <description>mysql datasource example</description> <res-ref-name>jdbc/mydb</res-ref-name> <res-type>javax.sql.datasource</res-type> <res-auth>container</res-auth>

asp.net mvc - Claim based authentication in webrequest -

Image
how webrequest can make between these twi applications... sample code: httpwebrequest webrqst = (httpwebrequest)webrequest.create(endpoint); webrqst.usedefaultcredentials = true; webrqst.method = "get"; webrqst.accept = "*/*"; webrqst.keepalive = true; using (webresponse response = request.getresponse()) { using (stream stream = response.getresponsestream()) { using (streamreader reader = new streamreader(stream)) { console.writeline(reader.readtoend()); } } } while making request looking login page. response login form in sts. thank you. is trying do? http://www.cloudidentity.com/blog/2013/01/09/using-the-jwt-handler-for-implementing-poor-man-s-delegation-actas/

jquery ui - Datepicker returning uncaught typeError: undefined 'currentDay' -

i've been using jquery ui bootstrap , seem run problem haven't had before. i'm not sure has changed; i've tried setting different version of jquery , didn't update jquery ui in meanwhile. i'm not sure broke. the error console when click on date in datepicker returns: uncaught typeerror: cannot set property 'currentday' of undefined the code straightforward 1 expect datepicker: $(".datepicker").datepicker({ dateformat: 'dd-mm-yy' }); with following html: <input type="text" class="datepicker" /> is bug should reported (since no other google matches turn up) or else i've missed? i've found solution. after long time of debugging figured out there <div> had exact same id , lying higher input field. therefore script took first instance contained id , picked div instead of input field. i removed/renamed div , worked fine again.

ios - How to save video from document directory to gallery? -

this question has answer here: how save recorded video photo album? 3 answers how save video in document directory gallery in ios,here downloaded video server , saved in document directory , want move gallery. uisavevideoatpathtosavedphotosalbum(sourcepath,nil,nil,nil); you can pass sourcepath nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; append path or file name sourcepath. nsstring *sourcepath = [documentsdirectory stringbyappendingpathcomponent:@"youvideo.mp4"];

java - invokeAndWait seems to cause the application to freeze intermittently -

a process occurs in background fires callbacks ask various questions. in case question "is okay migrate data?", have ask user. since have swing work on edt, ends looking (i removed comments, reference our own convenience methods , parameters allowmigration() - other that, else same): public class usermigrationacceptor implements migrationacceptor { private final window ownerwindow; public usermigrationacceptor(window ownerwindow) { this.ownerwindow = ownerwindow; } // called on background worker thread @override public boolean allowmigration() { final atomicboolean result = new atomicboolean(); try { swingutilities.invokeandwait(new runnable() { @override public void run() { result.set(askuser()); } }); } catch (interruptedexception e) { thread.currentthread.interrupt(); return false; } ca

java - Unit Testing a controller -

there project turnover me, task make unit test controller. i've tried search tutorials net, method controller found: 1. http://developer.teradata.com/viewpoint/reference/viewpoint-pdk-cookbook/how-to-create-unit-tests-for-controllers 2. http://www.java-tutorial.ch/software-testing/easymock-tutorial links above doesn't fill glass. i'm new unit testing , below method controller controller: private boolean insertnewuser( string name, string username, string password, string email, string usertype, string team, string[] projectid,httpsession session ) { usersdao usersdao = new usersdao(); arraylist<integer> projects = new arraylist<integer>(); boolean insert; string sessiontype = ( string ) session.getattribute( sessionutility.session_type ); if( sessiontype.equalsignorecase( sessionutility.type_superadmin ) ) { if( usertype.equalsignorecase( sessionu

xml - assign mutiple variable in for-each loop -

i want set multiple variable value in loop using xslt. xml example is, <details> <person> <name>abcd</name> <age>24</age> </person> <person> <age>27</age> <name>xyz</name> </person> i want store name , age in 2 different variable e.g <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="details"> <xsl:variable name="name"/> <xsl:variable name="age"/> <xsl:for-each select="./person"> // want store name , age in 2 different variable later use after for-each loop </xsl:for-each> </xsl:template> </xsl:stylesheet> it's example xml , xslt. know, how ? q.: "is know, how ?" short answer: not possible change value of variable after declaration

java - Trying to use simple authentication in Play Framework, but my action is called twice -

i used samples add simple authentication app. annotation of: @security.authenticated(shlangauthenticator.class) public static result processshlangcommand() and class shlangauthenticator based on sample: public class shlangauthenticator extends security.authenticator { @override public string getusername(context ctx) { string s = ctx.session().get("email"); system.err.println("getusernamecalled: " + s); return s; } @override public result onunauthorized(context ctx) { system.err.println("onunauthorized called"); return redirect("http://localhost/#/login"); } } the problem getting every call action (processshlangcommand() ) being called twice play (play 2.1.1), printed stack trace , seems identical. on appreciated. perhaps it's because you're using system.err log, instead of default logger in play? regardless, authentication, i'm using module: https://github.com/joscha/play-authenticate

objective c - Confusing LLDB output -

there's hole in c knowledge here, i'm little confused why happening. (lldb) p linegroup (nsinteger) $17 = -1 (lldb) p (linegroup > 4) (bool) $18 = true (lldb) p (linegroup < 0 ) (bool) $19 = false (lldb) p (-1 < 0) (bool) $20 = true (lldb) p ((int)linegroup < 0 ) (bool) $21 = false (lldb) p ((int)linegroup > 4) (bool) $22 = true (lldb) the linegroup variable assigned follows: - (void)gotlinegroupinformation:(nsstring *)linegroupstring { nsinteger linegroup = [linegroupstring integervalue]; if(linegroup >= 0) { // gets called } else { // never gets called } } thanks, andy the lldb issue seem exact same in objective c integer comparison error : carl norum said in response : confirmed - it's bug in lldb ir interpreter. here's link patch fixes it: http://lists.cs.uiuc.edu/pipermail/lldb-commits/week-of-mon-20130520/008569.html concerning code, tried reproduce bug without s

xslt - Delete section based on search condition -

my requirenament delete relation tag @guid match 1 of relation's @relationobj <rolecode tc=32> or <rolecode tc=31> or <rolecode tc=8> only. above logic applicable @relationobj should match 1 of relation's @relationobj <rolecode tc=32> or <rolecode tc=31> or <rolecode tc=8> only. basically want search @guid , @relationobj looking other relation tags @relationobj belongs <rolecode tc=32> or <rolecode tc=31> or <rolecode tc=8> . if condition true delete section. below xml : <relations> <relation guid="abcd1234" relationobj="1234"> <rolecode tc="20"/> </relation> <relation guid="xyz123" relationobj="1111"> <rolecode tc="32"/> </relation> <relation guid="def123" relationobj="2222"> <rolecode tc="31"/> </relation> <relation guid="1111&q

javascript - Error when using angular.copy() to copy data returned from ngResource -

i have following code: getcontents: function ($scope, entitytype, action, subjectid, contenttypeid, contentstatusid) { entityservice.getcontents(entitytype, action, subjectid, contenttypeid, contentstatusid) .then(function (result) { $scope.grid.data = result; angular.copy($scope.grid.data, $scope.grid.originaldata); $scope.grid.newbuttonenabled = true; }, function (result) { alert("error: no data returned"); $scope.grid.newbuttonenabled = false; }); }, and following function in entityservice: getcontents: function (entitytype, action, subjectid, contenttypeid, contentstatusid) { var deferred = $q.defer(); entityresource.getentities({ entitytype: entitytype, subjectid: subjectid, contenttypeid: contenttypeid, contentstatusid: contentstatusid }, fu

How to click links one by one with Selenium webdriver and Python -

site has top menu 6 links. can list of links this: links = browser.find_elements_by_css_selector(menu_links_css_selector) after need click links 1 one. if this: for link in links: link.click() i following error: selenium.common.exceptions.staleelementreferenceexception: message: u'element not found in cache - perhaps page has changed since looked up' . understand, error raises beacause of connection betweeb webelement instances , dom of web-page broken after reloading page (clicking on link). here should notice top menu same on pages. so, wrong? how fix this? tia! i don't know selenium should select links again - for in range(0,6): links = browser.find_elements_by_css_selector(menu_links_css_selector) links[i].click()

windows - How to call Git from ASP.net -

for company, created software build system based on bunch of powershell scripts , asp.net web interface. this build system run every night scheduled task, can run through web interface. source code hosted our cvs server , works. now, working on moving our source code external git hosting service. made changes powershell scripts , web interface, goal scm switch must not change way people use build system. , created ssh keys no passphrase recommended run automatic scripting. it works , that's problem. if run build script manually, or through overnight scheduled task, no trouble. if run through web interface, doesn't work. i checked twice asp.net web server run impersonation use needed user account. no way, script stays blocked on git process never ends. think there security or authentication issue in there, fails catch git output. the repository folder created, , there ".git" folder, nothing more. output catch "cloning ...". i tried run posh-gi

c# - Uniquely identifying contacts in a Windows Phone Address Book -

consider following situation: i save data random contact x address book iso storage i leave application , modify contact x in address book coming application, how can identify contact x iso storage same contact x modified in address book? my intention periodically copy user's address book data iso storage , sync server. i'm doing read operations, permitted, if given authorization. the problem contact id private field, , cannot use contact stores (which have public ids). also, wp contacts don't have content rules, meaning can have contact no name, 10 phone numbers, no phone numbers, etc, taking piece of content unique identifier not work since consistency not guaranteed. hash codes not work since modified object results in modified has code. any appreciated. found answer - related question posted here. i decompiled microsoft.phone dll , seems contact.gethashcode returns contact.id value. behavior has been confirmed work expected on various devi