Posts

Showing posts from June, 2014

Why do android docs want me to import play services as a project and not as a lib? -

i going use google play services in android application. have no problem there, have theoretical question... in google docs api says must import project source sdk, , not *.jar file lib ( google play services setup docs ). this fine, find more natural add reference *.jar file in there. my question therefore is: there reason google says must this? if not i'd rather reference *.jar file. thanks, jason google play service contains resources (layout, images, etc.) cannot included in jar file. linked way framework compute xml resources of project give them unique ids. this why have import library project instead of including jar dependency.

search page that allow user to select between three types using php mysql -

i have search page include 3 types of search , want filter search upon selecting types type 1 : newest members type 2 : specialization type 3 : name specialization table: specialization_id specialization_name members table : user_id first_name last_name specialization registered_date but problem first type work fine second show members not selected specialization the first query specialization selecting secialization drop list the second join between sepcialization table , members tables can me ???? search.php //************for specialization droplist***************************// function specializationquery(){ $specdata = mysql_query("select * specialization"); while($recordjob = mysql_fetch_array($specdata)){ echo'<option value="' . $recordjob['specialization_id'] . '">' . $recordjob['specialization_name'] . '</option>'; } } $outputlist = ""; //*****

perl - Attributes exchange using Net::OpenID::Consumer -

my $csr = net::openid::consumer->new( ua => lwp::useragent->new, consumer_secret => '123456xxx', required_root => "http://www.myopenidsample.net/", ); $openid = "https://me.yahoo.com"; $claimed_id = $csr->claimed_identity($openid); if ($claimed_id){ $check_url = $claimed_id->check_url( delayed_return => 1, return_to => "http://www.myopenidsample.net/response.cgi", trust_root => "http://www.myopenidsample.net/", ); print $q->redirect($check_url); } how attributes such email, firstname, lastname, , country? how append following parameters url? openid.ext1.mode fetch_request openid.ext1.required country,email,firstname,lastname,language openid.ext1.type.country http://axschema.org/contact/country/home openid.ext1.type.email http://axschema.org/contact/email openid.ext1.type.firstname http://axsch

objective c - Strange Bug in iOS 6 UINavigationController -

Image
i have found strange bug in ios. when use uinavigationcontroller , push other controllers, titleview shifted right how many controllers pushed it's looks this: my code simple: self.navigationitem.title = @"test title"; in second case, controller has 5th in viewcontrollers stack. controller in cases same. i using appearance uibarbuttonitem , in appdelegate. [[uibarbuttonitem appearance] setbackbuttontitlepositionadjustment:uioffsetmake(-1000, 0) forbarmetrics:uibarmetricsdefault]; i fix trick =) [[uibarbuttonitem appearancewhencontainedin:[uinavigationbar class], nil] settitletextattributes:@{uitextattributefont: [uifont systemfontofsize:0.1]} forstate:uicontrolstatenormal];

java - Is it possible to use MathML to describe data tables? -

i'm using jeuclid library rendering mathml script. want display data tables using mathml . i googled results describe mtable examples showing describing matrices. so, i'm puzzled whether possible. in our current framework, it's not possible use other resources except graphics object of jpanel or mathml script. so, please point me in right direction. links examples highly appreciated. mtable not matrices (in particular not add parenthesis around data) used vertical alignment layouts such tables , aligned equations.

java - Converting Vertex[] to graph -

i making pacman game , working on ghosts ai. planning on using dijkstra's algorithm pathfinding. problem when game loaded vertexes graph stored in matrix. trying assign each vertex of edges this for(int x = 0; x<40; x++) { for(int y = 0; y<40; y++) { vertex vertex = map[x][y]; vertex.adjacencies = new edge[]{new edge(map[x-1][y], 1), new edge(map[x+1][y], 1), new edge(map[x][y-1], 1), new edge(map[x][y+1], 1)}; } } the problem throws array out of bounds exception. how fix without putting in tons of if statements check if current vertex on edge of graph. one easy way include non-traversable border around edges. for example, if actual map 40x40, can declare 42x42 array. rows 0 , n non-traversable, columns 0 , n. you'd still need handle cylindrical travel of pacman between left , right sides.

objective c - Is it possible single Box App to authenticate different iOS apps? -

the whole idea authenticate app , app lite , app iphone , app iphone lite single box.com app id , return user right app redirected user authorization/authentication web site. my conclusion till leads using different app id, because of lack of option add different redirect url's , respectively possibility [box-api] recognize right caller application. will work if try embed auth url in uiwebview , handle response webview? we don't support use case, , you'll need separate app ids

java - Jena Result set to String -

i'm using jena query dbpedia , return resultset, how can make resultset returned java string? don't want in json format. take @ apache jena resultsetformatter documentation - "astext" method may you're looking for: resultset results = ... string resultsasstring = resultsetformatter.astext(results);

android - ClassCastException in Parcelable, but perhaps deeper problems? -

i have field looks in class called game private arraylist<question>[] questions; i writing in this public void writetoparcel(parcel parcel, int flags){ ... parcel.writearray(questions); ... } and retrieving this private game(parcel in) { ... questions = (arraylist<question>[]) in.readarray(question.class.getclassloader()); ... } for reason, works when know activity's ondestroyed() called (when orientation changed portrait landscape or vice versa), works fine , data passed. however, when app has been paused while (i.e. user hits home , moves on random things), dies later being "unable cast object[] arraylist[]". logcat: 05-18 02:52:40.967 i/activitymanager(401): start u0 {act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=com.example.app/.ui.mainactivity} pid 649 05-18 02:52:51.053 w/activitymanager(401): activity idle timeout activityrecord{412389c8 u0 com.example.app/.ui.main

php - How do I get only the new tweets per request using Twitter API? -

i'm trying new tweets containing hashtag twitter api. thing i'm interested in number of new tweets each time request results. this: 10:20 am: 100 tweets containing #google 10:22 am: 130 tweets containing #google but right somehow results stay same. code: php (tweets.php): <?php $json = file_get_contents('http://search.twitter.com/search.json?q=%23apple:)&include_entities=true&rpp=100', true); echo $json; ?> javascript: function gettweets() { var tweets = 0; $.ajax({ url: "tweets.php", crossdomain: true, datatype: 'json' }).done(function(data) { $.each( data.results, function( key, value ) { console.log(value.entities); tweets++; }); }); } $(document).ready(function() { setinterval("gettweets()", 5000); }); how can updates? edit: code works, results not updates. same results on , on again. $

How to return to user menu at the end of a function in PowerShell -

i writing powershell script gives user number of options select from. once option selected, function executed , user returned original menu. in code below, user given options, , functions executed, when complete, script ends. want instead @ end of function return original user menu. can tell me how this? thanks! function firstfunction { write-host "you chose option 1" return } write-host "welcome" [int]$usermenuchoice = 0 while ( $usermenuchoice -lt 1 -or $usermenuchoice -gt 4){ write-host "1. menu option 1" write-host "2. menu option 2" write-host "3. menu option 3" write-host "4. quit , exit" [int]$usermenuchoice = read-host "please choose option"} switch ($usermenuchoice) { 1{firstfunction} 2{write-host "you chose option 2"} 3{write-host "you chose option 3"} default {write-host "nothing selected"} } put menu code outer loop does

json - BaseX GUI and MongoDB -

basex focuses on storing, querying, , visualizing large xml , json documents , collections. is there way query mongodb documents , use basex visualizing ability? let me try help, information comes from: http://docs.basex.org/wiki/json example: converts json string simple objects , arrays query: json:parse('{ "title": "talk on travel pool", "link": "http://www.flickr.com/groups/talkontravel/pool/", "description": "travel , vacation photos around world.", "modified": "2014-02-02t11:10:27z", "generator": "http://www.flickr.com/" }') result: <json type="object"> <title>talk on travel pool</title> <link>http://www.flickr.com/groups/talkontravel/pool/</link> <description>travel , vacation photos around world. </description> <modified>2014-02-02t11:10:27z</modified> <gene

c# - dropdown initializing input type="text" on postback -

i have several text boxes <input type="text"> a dropdownlist <asp:dropdownlist> prefer use asp control want bind data. thing every time make selection text boxes re-initializes due post back. <asp:dropdownlist id="drppleaseselect" runat="server" onselectedindexchanged="drppleaseselect_selectedindexchanged" autopostback="true" > <asp:listitem>[please select yes or no]</asp:listitem> <asp:listitem>yes</asp:listitem> <asp:listitem>no</asp:listitem> </asp:dropdownlist> <input type="text" runat="server" id="txtlastname" onkeyup="checktextboxes()" onfocus="checktextboxes()" /> protected void drppleaseselect_selectedindexchanged(object sender, eventargs e) { var valuedropdown = drppleaseselect.selectedvalue.tostring(); if (valuedropdown

sql - How can I connect a jQuery slideshow with a database in ASP.net? -

so i'm using jquery plug-in called coin slider. slideshow seems working fine want connect database have created in app_date folder in visual studio 2010. when clicked on picture, want system search table in database using description of particular image in slideshow keyword. if item exists in database, go website mentioned in href. otherwise, display "item not found". all i've done make slideshow. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="js/jquery-1.9.1.js" type="text/javascript"></script> <script src="css/coin-slider/coin-slider.min.js" type="text/javascript"></script> <link href="css/coin-slider/coin-slider-styles.css" rel

How to call a Java function via JNI from a signal handler function in Android -

my objective send signal kernel android service running in userspace.on receiving signal, service should make ioctl call kernel. after gets data kernel through ioctl call,it has display user. this, call native method java service, registers sigaction structure, includes handler function signal. handler function make ioctl call , call java function pass string java service. here signal.java class public class signal { static{ system.loadlibrary("signal"); } public native string hello(); public string messageme(string s) { if(null != mainactivity.muihandler) { message msgtoactivity = new message(); msgtoactivity.what = 0; msgtoactivity.obj = s; // can put message here mainactivity.muihandler.sendmessage(msgtoactivity); } system.out.println(s); return s; } } i need call "messageme" function signal handler. here native hello() function registers sigaction structure. jniexport jstring jnic

python - Explain this inconsistency -

this question has answer here: in python, why can function modify arguments perceived caller, not others? 8 answers here 2 methods. 1 modifies variable x, other not. can please explain me why is? x = [1,2,3,4] def switch(a,b,x): x[a], x[b] = x[b], x[a] switch(0,1,x) print(x) [2,1,3,4] def swatch(x): x = [0,0,0,0] swatch(x) print(x) [2,1,3,4] the function definition def swatch(x): defines x local variable. x = [0, 0, 0, 0] reassigns local variable x new list. not affect global variable x of same name. you remove x arguments of swatch : def swatch(): x = [0, 0, 0, 0] but when python encounters assignment inside function definition like x = [0, 0, 0, 0] python consider x local variable default. assigning values x not affect global variable, x . to tell python wish x global variable, need use global declaration:

ios - Objective C: “Property implementation must have its declaration in interface” -

i keep getting error above not sure why. imported required classes , declared properties. appreciated. have included code below: // newmoduleviewcontroller.h #import <uikit/uikit.h> @interface newmoduleviewcontroller : uiviewcontroller { uitextfield *textmodulecode; uitextfield *textmoduletitle; } @property (strong, nonatomic) iboutlet uitextfield *textmodulecode; @property (strong, nonatomic) iboutlet uitextfield *textmodueltitle; @end // newmoduleviewcontroller.m #import "newmoduleviewcontroller.h" #import "appdelegate.h" @interface newmoduleviewcontroller () @end @implementation newmoduleviewcontroller @synthesize textmodulecode, textmoduletitle; .... because wrote textmodueltitle instead of textmoduletitle in .h

mobile - jQuery to make the input text field readonly -

i'm using jquery mobile , have input text field auto selected when tapped/clicked using following code: $(document).ready(function() { $('.highlight').click(function(){ var input = this; input.focus(); input.setselectionrange(0,999); }); }); i add prevent changes field because tried adding readonly="readonly" html stopped auto highlight (on mobiles). any suggestions?

multithreading - thread getting stuck (python) -

basically have program starts new thread, tries stuff in new thread. however, new thread seems stuck until main thread reaches end of program. here working example of problem i'm experiencing. seems gtk.main() has there problem occur. if use input() instead, problem doesn't appear. import threading,sys class mythread(threading.thread): def run(self): import time print('before') time.sleep(3) print('after') mythread().start() gi.repository import gtk gtk class my_window: def __init__(self): self.window = gtk.window() self.window.connect("delete_event", gtk.main_quit) self.button = gtk.button("hello world") self.window.add(self.button) self.button.show() self.window.show() my_window() gtk.main() what should happens: window appears, word before appears, , 3 seconds later word after appears what happens: window appears, word before appears, not

nasm - How can ndisasm use packsswb in 16-bit mode? -

consider file generated following bash shell code: echo -n "\x0f\x63\x42\xac" > binarydata now run ndisasm on file see instructions represent: ndisasm -b 16 binarydata and get 00000000 0f6342ac packsswb mm0,[bp+si-0x54] according an x86 reference , not available on pentium, implements x86-32 superset of 16-bit instruction set. how can ndisasm use in 16-bit mode? mmx-istructions can used within 16 bit mode , within realmode (using pentium mmx). and 1 difference between 16 bit mode , 32 bit mode (using intel 80386+) meaning , usage of address-size- , operand-size- prefixes inside of our code segment. dirk

knockout.js with checkbox checked bind when checked ,will trigger the update method in custom binging why -

var viewmodel={ ischecked:ko.observable(false); showmessage:ko.observable(); }; ko.bindinghandlers.dosomeing=function(){ update:function(element, valueaccessor, allbindingsaccessor, viewmodel, bindingcontext){ if(viewmodel.ischecked){ } } }; <pre> <input type="checkbox" data-bind="checked:ischecked"></input> <input type="text" data-bind="dosomeing:showmessage"></input> </pre> when clicked checkbox trigger update method in custom binging dosomeing,why? but remove if(viewmodel.ischecked) scope , not trigger update method . the update method in ko binding executed within computed observable. so, observables have value accessed (like viewmodel.ischecked() in case, doing viewmodel.ischecked not access value, might have typo in question), become dependency , cause binding's update function run again. just note: bindings on element run within single computed,

whitespace - jquery. get text() to preserve blanks/spaces -

how jquery text() preserve blanks? want $("#ele").text("a a"); to show spaces in between. i have created jsfiddle illustrate problem. http://jsfiddle.net/zx4x9/ .html() works, i'd have convert other entities first ( <, >, " etc.). and, seems text() should able this. the problem not .text() . if want consecutive , other stray spaces show up, can use white-space: pre <li> s: ul li { white-space: pre; } see this

linux - How do I time execution duration of a program or script from the command line? -

i'm learning c , sense how faster of c code python equivalent. i'm running ubuntu 12.04 from command line can use "time" command. give execution time of program in 3 separate mode (by default) - a. real time; b. user time; c. system time. a. real time indicates how time took overall; b. user time indicates how time took executing @ userspace c. system time indicates how time took executing @ kernel space. above way measure time commnad line. can measure program execution time in program - using system call gettimeofday().

css - A good default background image type and size -

i'm using set background image. body{ background: url('path_to_image'); background-size: 100%; } i'm happy how background-size handles small differences in screen size. i'm designing background image in gimp blue abstract image. size handle common screen size ( in pixel width , height ), , image format export in? here example of 1 background image tested with: http://dooid.me/images/uploads/1334771136brentreader.gif most common screen size reported ( link here ) browsers appears be: 1366x768 1366x768 sounds if that's common screen resolution these days. file type should .jpg if image has many gradients , subtle details, or .png (or .gif) if image solid shapes no anti-aliasing, such pixel-art. keep in mind both quality , file size when exporting image ! it's you're using abstract image background, using background-size:100% can lead stretching in unintended resolutions (which silly more figurative pictures !).

How to create a simple animation in android -

i want know best when want create simple animation in android , example if have character face , want move eyes fron right left , on. i suggest yo use animationdrawable , practice ? at same time have 1 animation. example ,, cat face smiling when touch occurs. have many different animations, @ same time 1 or 2 animations

unix - posix shell script: recursively remove all files starting with a certain prefix -

i want use shell script remove recursively files starting prefix ._ (matching pattern ._* ) in directory, embarrassing thing barely know shell scripting except basic. kind enough write 1 me? thanks. $ find <dirname> -type f -name '._*' -delete <dirname> -- root directory. -type f -- regular files, not directories (if that's want). -delete -- files (delete them) (if omitted, print file names)

JQuery security check -

i'm using jquery add lot of functionality sas html output files. i'll adding static html tables, ability highlight rows, re-sort, sum subgroups, etc. the catch no 1 outside of organization can see data in these tables. files not online, saved on our secure drives. i'm worried doing inadvertently expose pieces of data external servers or attackers. i've read several articles , questions jquery security, is jquery secure? , jquery ajax security , want know if there's need avoid in case nothing surprising happen. so given won't using ajax or plugins hosted online, have 1 main question: are there non-obvious things in jquery create chance of data leaking, relative displaying data in javascript-free html? my apologies if seems question have answered on own. while think should fine, i'm not security expert, , want before potentially awesome project brings company down in flames. --edit: in response phillip's comments, should clarify accessing

android - Print opencv matrix content in Java -

i have opencv matrix in java , print out content of it.i tried tostring() function follows descriptor.tostring() achieve form "[[1,2,3,4],[4,5,6,7],[7,8,9,10]]" where each array ith row in matrix got following result. tried remove tostring still same problem. mat [ 3*4*cv_8uc1, iscont=true, issubmat=false, nativeobj=0x5dc93a48, dataaddr=0x5d5d35f0] where 3 number of rows , 4 number of columns. any how can matrix content?! code: int[][] testarray = new int[][]{{1,2,3,4},{4,5,6,7},{7,8,9,10}}; mat matarray = new mat(3,4,cvtype.cv_8uc1); for(int row=0;row<3;row++){ for(int col=0;col<4;col++) matarray.put(row, col, testarray[row][col]); } system.out.println("printing matrix dump"); system.out.println(matarray.dump()); output: printing matrix dump [1, 2, 3, 4; 4, 5, 6, 7; 7, 8, 9, 10]

How to code a very simple login system with java -

i need create system checks file username , password , if correct, says whether or not in label. far have been able make 1 username , password equal variable, need link file somehow. noob programmer lots of appreciated. here have under authenticate button. string pass; string user; user = txtuser.gettext(); pass = txtpass.gettext(); if(pass.equals("blue") && user.equals("bob") ){ lbldisplay.settext("credentials accepted."); } else{ lbldisplay.settext("please try again."); } you need use java.util.scanner issue. here login program console: import java.util.scanner; // use scanner because it's command line. public class login { public void run() { scanner scan = new scanner (new file("the\\dir\\myfile.extension")); scanner keyboard = new scanner (system.in); string user = scan.nextline(); string pass = scan.nextline(); // looks @ selected file in scan string inpuser = key

Bash array variables: [@] or [*]? -

bash-3.2$ echo astr | sed 'hah' | sed 's/s/z/' sed: 1: "hah": characters @ end of h command bash-3.2$ echo ${pipestatus[*]} 0 1 0 bash-3.2$ echo astr | sed 'hah' | sed 's/s/z/' sed: 1: "hah": characters @ end of h command bash-3.2$ piperet=("${pipestatus[*]}") bash-3.2$ echo ${piperet[*]} 0 1 0 bash-3.2$ this indicates [*] works fine. this tut mentions use [@] instead. are both equally valid? the difference matters when array elements contain spaces etc. , multiple spaces, , manifest when expressions enclosed in double quotes: $ x=( ' b c ' 'd e f' ) $ printf "[%s]\n" "${x[*]}" [ b c d e f] $ printf "[%s]\n" "${x[@]}" [ b c ] [d e f] $ printf "[%s]\n" ${x[@]} [a] [b] [c] [d] [e] [f] $ printf "[%s]\n" ${x[*]} [a] [b] [c] [d] [e] [f] $ outside double quotes, there's no difference. inside double quot

javascript - jQuery submit form multiple times -

i have following bootstrap contact form: <form id="contactform" class="form-horizontal" data-async data-target="#contact" action="/contact.php" method="post"> (...) <button class="btn btn-primary pull-right" type="submit">send</button> </form> and jquery code: $('form[data-async]').on('submit', function(event) { var $form = $(this); var $target = $($form.attr('data-target')); $.ajax({ type: $form.attr('method'), url: $form.attr('action'), data: $form.serialize(), success: function(data, status) { $target.html(data); } }); event.preventdefault(); }); i can submit form , ajax response once second time try it loads contact.php in navigator. don't because event.preventdefault() should prevent this. how can make multiple ajax calls work?

c++ - How to find the center of the palm of hand -

hi guys iam new here.i able detect hand , finger tips using opencv.. iam stuck in getting center of palm of hand..need guidance.. thanx in advance. you gap between middle finger , ring finger. than, assuming know inclination of hand (if not should method determine it, example tracing line between index finger , medium finger gap between middle finger , little finger), trace line perpendicular hand's inclination. gap between thumb , index , trace line parallel hand's inclination. intersection between 2 lines reasonably near center of hand.

Million decimal places in Python -

we delve infinite series in calculus , being said, i'm having fun it. derived own inverse tan infinte series in python , set 1 pi/4*4 pi. know it's not fastest algorithm, please let's not discuss algorithm. discuss how represent very small numbers in python. notice programs iterate series, stops somewhere @ 20 decimal places (give or take). tried using decimal module , pushed 509. want infinite (almost) representation. is there way such thing? reckon no data type able handle such immensity, if can show me way around that, appreciate much. python's decimal module requires specify "context," affects how precise representation be. i might recommend gmpy2 type of thing - can calculation on rational numbers (arbitrary precision) , convert decimal @ last step. here's example - substitute own algorithm needed: import gmpy2 # see https://gmpy2.readthedocs.org/en/latest/mpfr.html gmpy2.get_context().precision = 10000 pi = 0 n in range(10000

php - insert string variable into echo -

this seems simple question, i've been searching through google , can't find solution. function showjqueryalert() { echo '<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script src="functions.js"></script> <script type="text/javascript"> $(document).ready(function() { jqueryalert("insert message here!", 120, false); }); </script>'; outputs popup message "insert message here!". but function showjqueryalert($message) { echo '<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="

libsvm - What is cross validation rate in grid.py indicate? -

i know cross validation , grid.py does. i know parameter g , g supposed used while training have no idea third parameter rate? i cross-validation rate 95.32 % . signify ?? or bad ?? that cross-validation rate percentage of samples has been correctly classified during cross-validation step (with best c , g parameters found), having 95% success great result. parameters of grid.py following: -log2c : c regularization parameter -log2g : set gamma in kernel function exp(-gamma*|u-v|^2) -v n : n -fold cross validation -svmtrain pathname : set svm executable path , name -gnuplot pathname : set gnuplot executable path , name -out pathname : set output file path , name -png pathname : set graphic output file path , name (default dataset.png )

java - Designing an app to be deployed with AND without Google App Engine -

after finish developing app using google app engine, how easy distribute if ever need without app engine? thing i've thought of gae has proprietary api using datastore. so, if need deliver app .war file (for example) not deployed app engine, need first refactor code getting/storing data, before building .war, right? i don't know standard way deliver finished web app product - i've ever used gae, i'm starting project requirements final deliverables unsure @ time. so i'm wondering, if develop gae, how easy convert? also, there can or consider while writing gae optimize project whatever packaging options may have in end? so long app not have elements dependent of google app engines should able deploy anywhere long location can support tomcat or glassfish server. requires manually install server must read on that. there lots of youtubes on subject try break down issue lowest steps possible. i suggest using framework spring , hibernate lessen headac

checkbox - jquery unchecked checkboxes changes images -

some details first: i have 4 image place holders. have several checkboxes. each checkbox associated image. user allowed check off 4 boxes. when user clicks on checkbox replaces 1 of image place holders image assoicated checkbox. after user checks off 4 of check boxes, rest of chexkboxes become disabled. so have 4 image place holders populated images checked check boxes. here issue comes play. if user decides uncheck box, need correct place holder image go it's generic place holder image. so if 4 checkboxes user checked 1: hammer 2: screwdriver 3: nails 4: saw. 4 place holder images populated hammer, screwdrive, nails , saw. if decide uncheck screwdriver checkbox placeholder image screwdrive should switch generic place holder image. i'm having hard time figuring out how that. thanks in advance! function countchecked() { var radiocandycount = document.getelementsbyname('howmanycandies'); (var = 0, length = radiocandycount.leng

file - Parent Directory is not Writable Error Android Emulator -

getting "parent directory of file not writable" when trying create temp file. using eclipse , emulator. using permission in manifest: <uses-permission android:name="android.permission.write_external_storage"/> here code: @suppresswarnings("static-access") public void sendemail() { calendar today = new gregoriancalendar(); log.d(tag, "path:" + environment .getexternalstoragedirectory().getabsolutepath() + "/gpstracking/" + maketextdate(today) + ".csv"); file tempfile = null; try { tempfile.createtempfile(maketextdate(today), ".csv"); filewriter out = formatemail(tempfile); } catch (ioexception e) { // error log.d(tag, "create temp file:" + e.tostring()); } try { intent emailintent = new intent(android.content.intent.action_send); emailintent.putextra(android.content.intent.extra_subje

Setup PHPUnit for netbeans and xampp -

i'm struggling setup phpunit (3.7.20) in netbeans (7.3) , xampp. when create new project code under c:\xampp\htdocs, can run test in netbeans without problems. however use virtual hosts code. code under d:\path\to. when run c:\xampp\php>phpunit.bat --bootstrap d:\path\to\tests\bootstrap.php d :\path\to\tests\module\application\src\mycontrollertest.php in windows console test executes fine. when try use netbeans same task, skeleton generator works fine. if want test file "perhaps error occurred, verify in output window." test result. the output window gives "das system kann den angegebenen pfad nicht finden." ("the system cannot find given path"). do know how can fix problem? can see what's going wrong?

asp.net - How to parse nested JSON string using .NET -

i'm trying parse nested json string returned gcm (google messaging) server using vb.net. json string looks this: { "multicast_id": 216, "success": 3, "failure": 3, "canonical_ids": 1, "results": [ { "message_id": "1:0408" }, { "error": "unavailable" }, { "error": "invalidregistration" }, { "message_id": "1:1516" }, { "message_id": "1:2342", "registration_id": "32" }, { "error": "notregistered"} ] } i results array in above string. i found following example helpful, example not show how nested parts, message_id , error , registration_id inside results array. thanks i'll give answer using c# , json.net var jobj = jsonconvert.deserializeobject<response>(json); you can use javascriptserializer var jobj2 = new javascriptseri

Expire rails session variable -

based on answer: rails cookies, set start date , expire date i attempted same session variable: session[:token] = { :value => @ticket.token, :expires => 1.minute.from_now } however, variable continues available after 1 minute. ideas? where storing session? check below guidance on choosing store session, not session stores implement expiry. http://guides.rubyonrails.org/action_controller_overview.html#session setting session timeout in rails 3

javascript - Object doesn't support this property or method IE8 Jquery -

i getting error "object doesn't support property or method" in explorer 8, piece of code, can't see problem. jquery('.block_right h3').click(function(){ jquery(this).parent().find(".respuesta").slidetoggle('slow').find(".block_right h3 span").toogle(); }); thanks in advance. .toogle misspelling of .toggle

c++ - error: no matching function for call to...(std::string&) -

i'm getting following compiler error error: no matching function call 'infxtree(std::string&)' for bit of code. int main(){ string infxstr; cout << "enter infix string: " << endl; cin >> infxstr; prefixoutput(infxtree(infxstr)); postorderoutput(infxtree(infxstr), ' '); displaytree(infxtree(infxstr), infxstr.size()); return 0; } i error on last 3 lines. here's function: template <typename t> tnode<t> infxtree(const string& iexp); any ideas i'm doing wrong? thanks! you have give template parameter explicitly: infxtree<foo>(infxstr) where foo class type provided templated tnode class.

html - google custom search positioning in firefox -

im having issue adding in custom google search engine website working on. positioning of search bar causing problems me in chrome , ie. supposed in center div, , infact show in center show after every other div before loaded. it gave me huge white space instead of starting in center div. managed working in chrome , ie, still doesn't work on firefox. #searchbar{ width:620px; margin: 22px 160px; position:relative; clear:both; max-height:500px; overflow:auto; } chrome picture firefox picture also absolute positioning doesn't work out because if stretch screen go on wrap div. are making use of css reset tool like: erik meyer's css reset ? these resets typically more consistency between way different browsers render css effects onto markup. start there, if doesnt directly fix position, set appearance both browsers rendering search bar similarly. can accurately decide how adjust it, without having play tug of war between different browsers

How can I feed a server side Django string array into a client side JavaScript array? -

on server array appears follows: data = [u'data1', u'data2', u'data3'] in django, send data through client using: render(..., {'data': data}) on client side try render in javascript using: {{data}} and get: [u&#39;data1b&#39;, u&#39;data2&#39;, u&#39;data3&#39;] how can fix encoding issue? you need safe escape string inorder work fine {{data|safe|escape}}

javascript - Using two $.get in one. Trying to use as a variable -

this question has answer here: how return response asynchronous call? 21 answers this code $(function () { $.get('/viewonline', function (data) { data = $(data); var members = data.find('.userdata'); (var j = 0; j < members.length; j++) { var membername = $(members[j]).find('.username').text(); var memberurl = $(members[j]).find('.username').attr('href'); var memberava = $.get(memberurl, function(data) { data = $(data); data.find('#profile-advanced-right img:eq[0]').attr('src'); }); $('.user_info_on').append('<div class="on_name"><a href="' + memberurl + '" title="'+ membername +'"><img src="' + memberava + '"/></a></div>'

javascript - How can I exclude "[" and "]" in a match like "[abc]"? -

i have following string: [a] [abc] test [zzzz] i'm trying array so: [0] => [1] => abc [2] => zzzz i've tried following code: var string = '[a] [abc] test [zzzz]'; var matches = string.match(/\[(.*?)\]/g); for(var = 0; < matches.length; i++) console.log(matches[i]); but console output shows: [a] [abc] [zzzz] i tried adding 2 non-capturing groups ( ?: ), so: var matches = string.match(/(?:\[)(.*?)(?:\])/g); but see same matches, unchanged. what's going wrong, , how can array want? match doesn't capture groups in global matches. made little helper purpose. string.prototype.gmatch = function(regex) { var result = []; this.replace(regex, function() { var matches = [].slice.call(arguments,1,-2); result.push.apply(result, matches); }); return result; }; and use like: var matches = string.gmatch(/\[(.*?)\])/g);

applescript - iTunes -- making a script for copying album play counts -

i'm trying write script let me copy playcounts of 1 version of album based on title of tracks. basically, scenario have album on computer along playcounts. rerip original cd higher quality (previously quality preference low). now want automatically copy playcounts of old crappy quality rips new high quality ones. i adopted script doug adams try this, when try run it gives me "a descriptor type mismatch occurred." without indication line problem is. i've never used apple script before; know problem be? global thismany tell application "itunes" if selection not {} set sel selection repeat t in sel set t contents of t if class of t file track or class of t url track if played count of t 0 set thismany 0 repeat t2 in sel set t2 contents of t2 if class of t2 file track or class of t2 url track

c# - TFS Project List is not updated after adding a new project -

i created new project (it 5th project in account) in tfs account @ * .visualstudio.com. launched visual studio 2010, clicked team->connect tfs , logged in login , password. created new project (console application). when right click , choose "add solution source control" , shows me window 4 projects instead of 5 (i.e. doesn't show new tfs project). tried restart visual studio 2010 , reboot computer. neither helped. may cause such problem? visual studio has issues caching info tfs. i’d suggest refresh several times , restart vs. if doesn’t work should check if user has enough permission see project.

objective c - Facebook SDK for iOS - Questions about ID's -

just beginning work facebook sdk ios, , have few questions. can display list of friends, using code found here: facebook ios sdk - friends list . see each freind has id, , have following questions: if signed fb account a, , see friend b has id 123, if sign fb account c, friend b still have id of 123? assuming answer question 1 yes, lead me believe each account has unique id. if so, how find current fb account's id shown other friends? all user ids unique , not change (and public information). if want find out id of current user that's logged in, make graph request "/me", or use method: https://developers.facebook.com/docs/reference/ios/3.5/class/fbrequestconnection#startformewithcompletionhandler%3a and "id" property in result.

c# - Is a string reference equality check guaranteed to be static? -

i have function signature: public void dosomething(string name); the string name special in application. can either arbitrary string, or special known value. because non-empty string value valid input means need use object reference equality empty strings, so: public class foo { public const string specialvalue1 = ""; public const string specialvalue2 = ""; public void dosomething(string name) { if( object.referenceequals( name, specialvalue1 ) ) { } else if( object.referenceequals( name, specialvalue2 ) { } else { } } public void usageexample() { dosomething( specialvalue1 ); dosomething( "some arbitrary value" ); } } i want know if technique, using empty strings , object reference equality safe, respect string interning. antimony right reasons not work . i suggest define type argument. let's call exampleargument . public class exampleargument

postgresql - Get all procedural , user defined functions -

how list of user defined functions via sql query ? i find code here select p.proname, p.pronargs, t.typname pg_proc p, pg_language l, pg_type t p.prolang = l.oid , p.prorettype = t.oid , l.lanname = 'c' order proname; but gets c-functions how user defined, procedural language functions, writen example in plpgsql language? consider: select pp.proname, pl.lanname, pn.nspname, pg_get_functiondef(pp.oid) pg_proc pp inner join pg_namespace pn on (pp.pronamespace = pn.oid) inner join pg_language pl on (pp.prolang = pl.oid) pl.lanname not in ('c','internal') , pn.nspname not 'pg_%' , pn.nspname <> 'information_schema'; see also: what command find script of existing function in postgresql? use pg_get_functiondef or prosrc column pg_proc directly. key idea join on pg_namespace , filter out postgresql catalog functions, adequate purposes: from pg_proc pp inner join pg_namespace on (pp.pr

arrays - Retrieving multiple string values from localstorage in javascript -

i attempting pull string of data localstorage in javascript , combine multiple values multiple strings. example may have following 2 strings bob;companya;6141692120;email1@email.com;1 john st;;bellevue;6056;;6;10;20.00;52.800000000000004;72.80;7.28;80.08; jane;companyb;6157692120;email2@email.com;1 jack st;;bellevue;6056;;6;10;20.00;52.800000000000004;72.80;7.28;80.08; i want ignore first few , add last 5 or 6 each, value [13] in string + value [13] in string b = x, there doens of strings , have random numbers, have attached javascript code below , hoping can point me in right direction. windows.onload= getallitems(); function getallitems(){ var = []; for(var = 0, j = localstorage.length; < j; i++) { all[i] = localstorage[i].split(';'); } var sum = 0; for(var = 0, j = all.length; < j; i++) { sum += all[i][12]; } var bags = all[9]; var distance = all[10]; var hdelivery_fee = all[11]; var hprice = all[12]; var htotal_notax = all[13]; var hgst = all[14];

jquery - How to select a specific tag content inside li tag? -

<ul id="listq"> <li><txt>part01</txt><from>part02</from></li> <li><txt>part01</txt><from>part02</from></li> </ul> $(document).ready(function() { var list = $('#listq li'); $('#tv').html($(list).eq(0).text()); }); so, place "part01part02" inside #tv. how can txt content inside #tv (part01 in case) ? try jsfiddle $('#tv').html($("#listq li:first txt").text());

php - jQuery.ajax response data giving null -

i trying insert data mysql database using jquery , ajax. have written query parameters in add.php file. show form data immediatly beneath form. jquery: jquery("#addstockinform").submit(function(e){ e.preventdefault(); datastring = jquery("#addstockinform").serialize(); jquery.ajax({ type: "post", url: "add.php", data: datastring, datatype: "json", success: function(data) { //$("div#showinstant").html(data); alert(data); } }); }); add.php file require 'foo.config.php'; if(isset($_post['addstockin'])) { $query = "insert stockin ( serialno, project_id, ...... etc. ) values (`:serialno, :project_id, ....... etc. )"; add-stockin.php file <form class="form-horizontal" id="addstockinform" method="post"> ..... </form> you should return data php code frontend require 'foo.config.php';

javascript - OpenTok Api Broadcasted video placement in web page -

i using opentok , connected broadcast service , getting object of flash player @ bottom of page. how can place in particular div.. this code using connect opentol api function initiatecall() { if (session != undefined) { if (!iscalled) { session.addeventlistener("sessionconnected", sessionconnectedhandler); session.addeventlistener("streamcreated", streamcreatedhandler); session.connect("21457612", token_id); // replace api key , token. see https://dashboard.tokbox.com/projects // , https://dashboard.tokbox.com/projects iscalled = true; $.ajax({ data: '{"chatid":"' + chat_id + '","nurseid":"' + nurse_id + '","devicetype":"browser"}', type: "post",

ajax - jQuery Multiple .ajaxSuccess, load different functions specifically for each ajaxSuccess -

i need load different functions different ajaxsuccess in 1 page. i have multiple ajax in 1 page , cannot figure away more specific on ajaxsuccess happen. at moment using: $(document).ajaxsuccess(function(){ func1(); }); // ajax1 success => load func1() // ajax 2 success => load func2() // ajax 3 success => load func3() you can attach separate successs methods each call using $.ajax({ type : "post", url : "url", data:"{}", contenttype : "application/json; charset=utf-8;", datatype: "json", success : function(response){}, error : function(response){} }); using approach can call specific success method attached each ajax call. don't need bind every call 1 common ajaxsuccess. , if want so, need send kind of id in response call specific function. e.g $(document).ajaxsuccess(function(response){ if (response.id==1) func1(); else if (response.id==2)

What is the best way to listen to a lot of channels and events using Pusher -

i have 40 categories , each category has 10-100 subcategories. default, user listens categories , subcategories. want give each user ablity select unbind whole category or specific subcategory. so, right have each category channel, , each subcategory event. now, have each user bound 2000-3000 events, , know wrong, right way let user filter between 3000 events? okay bind many events? it's important remember when subscribe channel events channel sent client (pusher - clients), if have not bound event. with information above in mind, i'd recommend using channels filter data. overhead when subscribing channels isn't great. example, subscribing 40 channels wouldn't represent significant resource usage. need consider if channels public (anybody can subscribe) or private each call pusher.subscribe( 'private-channel-x' ); result in authentication request server. there multi-auth plugin allows batching of authentication requests take place. one sol

java - Experimenting with String creation -

i found interesting case while testing string creation , checking hashcode. in first case created string using copy constructor: public class test { /** * @param args */ public static void main(string[] args) { string s1 = new string("myteststring"); string s3 = s1.intern(); system.out.println("s1: " + system.identityhashcode(s1) + " s3:" + system.identityhashcode(s3)); } } output of above code is: s1: 816115710 s3:478684581 this expected output interned string picks reference string pool whereas s1 picks reference of new object. identity hash code different. now if create string using char array see strange behavior: public class test { /** * @param args */ public static void main(string[] args) { char[] c1 = { 'm', 'y', 't', 'e', 's', 't', 's', 't', 'r', 'i'