Posts

Showing posts from March, 2015

.net - resources.ApplyResources() causes ambiguous match error -

Image
ok, work in company multiple developers using vs2013 linked tfs. when run our application, runs fine until open window. when form loads, hits line in designer of form: resources.applyresources(me.tcpersonnel, "tcpersonnel") 'tcpersonnel being tabcontrol when hits line, error saying there "ambiguous match found". if continue anyway (ignoring error), form , control works fine. the weird part when colleagues map branch computers , latest version (my stuff being checked in), , run it, works without errors. me points there may wrong computer rather bad code. the relevant resx elements below: <data name="&gt;&gt;tcpersonnel.name" xml:space="preserve"> <value>tcpersonnel</value> </data> <data name="&gt;&gt;tcpersonnel.type" xml:space="preserve"> <value>system.windows.forms.tabcontrol, system.windows.forms, version=1.0.0.0, culture=neutra

sql - how to store a mutually exclusive value in a table -

based on social networking design, need store whether person has liked or disliked something. there other actions can take such share well. what need make sure when person like s something, value stored true . if change mind , dislike same thing, like 'd value set null , dislike value set true . initial approach table this: userid (int) | itemid (int) | (bit) | dislike (bit) | share (bit) | ... 1 1 1 null null 1 2 null 1 null 1 3 1 null 1 the problem here if more actions can taken on item e.g. 'favourited' have add these columns table. breaking normalisation rules work. important business rule cannot like , dislike same item @ same time. 1 or other. guess have logical processing on application end rather db end if there's better way please let me know! the other approach have table stores user actions this

How can access session variable from controller to model in Ruby on Rails -

i used session variable session[:parent] on controller , want these variable pass model. how pass params controller model? here controller.rb file def new @child = child.new @child.pickup_people.build @classes = [['infant', 0], ['toddlers', 1], ['early learners', 2], ['pre school', 3], ['pre kindergarten', 4]] @parent_types = [['father', 'father'], ['mother', 'mother'], ['other', 'other']] @martial_status = [['married', 'married'], ['single', 'single'], ['divorced', 'divorced'], ['separated', 'separated'], ['widowed', 'widowed'], ['other', 'other']] @parent = parent.new #parents mapped child, here mentioned show in form page after creation if session[:parent_id] != nil @parent_sessions = parent.where(:id => session[:parent_id]) end end def create logger.debug "\03

Joining method from another class in java -

i'm trying understand java trying several things out. i'm using 2 classes in same package. 1 called box , other 1 called testbox . want calculate area of company box using calculatearea() . function in class testbox . function calculatearea in box not respond function in testbox . i'm missing link between these 2 classes. seems simple problem, have not found solution yet. can please me out? package box; public class box { int length; int width; public static void main(string[] args) { box company = new box(); company.length = 3; company.width = 4; int area = company.calculatearea(); } } package box; public class testbox { int length; int width; int calculatearea(){ int area = length * width; system.out.println("area= " + area); return area; } } i think have clarify bit design, mean classes box , testbox should do, advice use use ide such eclipse or intel

Meteor: How do I adjust iron router return data based on search query? -

i have app users can take notes. in html page iterate on each note so: <div id="notes-container" class="notes"> {{each notes}} {{> note}} {{/each}} </div> and in router file return data so: @route: 'notes'. path: '/notes/:_id', data: -> notes = notes.find threadid: @params._id trash: $exists: false , sort: date: -1 all typical meteor stuff far. confused how adjust data iterated on in html page. each notes has array field tags tags: ['apple' ,'red', 'green'] what if user wants return notes tag 'red'. there input box on site user enters tag , presses enter. how can adjust data sent page queries mongodb return notes tag red? know how write query not sure how set though in meteor. one way tried called same route query paramters like: '/notes/326363235474?tags=apple' and in iron router can quer

ruby on rails - instantclick slim-lang syntax -

i trying add instantclick rails app , have slim-lang question. how convert code acceptable slim-lang syntax? <script src="instantclick.min.js" data-no-instant></script> <script data-no-instant>instantclick.init();</script> right working this: script[src="/assets/javascripts/plugins/instantclick.min.js" data-no-instant] |<script data-no-instant>instantclick.init();</script> thoughts? it can this: script data-no-instant="" src="/assets/javascripts/plugins/instantclick.min.js" script data-no-instant="" instantclick.init(); or: script data-no-instant="" src="/assets/javascripts/plugins/instantclick.min.js" script data-no-instant="" | instantclick.init();

css - Background height in html -

i'm trying setup new bg on website, can't make work. have picture (size 50x2000 px) , want create repeated background. in css used : #test{ width: 50px; height: 100%; background:url(images/bg.png); background-repeat:repeat-x; min-width: 100%; position: absolute; } and it's partly working, can see bg repeated there problem hight. web browser should squeeze hight of picture fit whole picture in website, , right can see top of picture, it's because picture hight big 2000 px. have change in css code make bg fit in website ? thanks update css as #test { width: 50px; height: 100%; background:url(images/bg.png); background-repeat:repeat-x; min-width: 100%; position: absolute; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }

python - Timer, countdown, time -

i want, on def 'usecaps', repeat 5 seconds. example, after 5 seconds repeats def 'usecaps' after 5 seconds repeats def again , on... here code: def mobber(self): global mobber if mobber == 0: mobber = 1 self.enablemobber() #jump enablemobber else: mobber = 0 self.disablemobber() def enablemobber(self): self.mobberbutton.settext("deactivate") self.time.editlinedelaytime.gettext()) self.usecape() def usecape(self): in xrange(player.inventory_page_size*3): braverycape = player.getitemindex(i) if braverycape == 70038: net.senditemusepacket(i) break i have tried using time.sleep. i wrote class has function every 5 seconds. used while loop , modular arithmetic. import time class the_class(): def __init__(self): self.counter=0; def some_function(self,counter): x="i function, doing things!"

uiview - Xcode scaling image to 0 and then returning to original size. -

i new objective-c , coding in general , having difficult time trying figure out code trying write program. want image scale 0 when push button , return original size. far able scale 0 have no idea how return original size. -(void)rotate_imageview { [uiview animatewithduration: 0.5 delay:0.0 options:uiviewanimateoptioncurvelinear animations:^{ cgaffinetransform scale = cgaffinetransformmakescale(0, 0); cgaffinetransform translate = cgafffinetransformmaketranslation(10.0, 10.0); self.imageview.transform = cgaffinetransformconcat(scale, translate); } completion:^(bool finished) { }];

java - PowerMock - Suppress constructor but set private final field -

when suppressing constructor of class using powermock, how can set value of private final field? suppressing constructor: suppress(constructor(abc.class, mytype.class)); abc abc = spy(new abc(null)); // using correct value doesn't work abc.somemethod(); the class tested: class abc { private final mytype test; public abc(mytype test) { this.test = test; // executes code suppressed } public void somemethod() { test.dosomethingelse(); } } as would, using reflection: field f = abc.class.getdeclaredfield("test"); f.setaccessible(true); f.set(abc, new mytype()); this not related mocking , therefore nothing mocking framework target in api. should consider refactor testing.

php - How does a reference in a for-each loop change an element of an array? -

this question has answer here: php pass reference error after using same var 3 answers $arr=array('a'=>'first','b'=>'second','c'=>'third'); foreach($arr &$a); foreach($arr $a); print_r($arr); the above code changes last element of $arr ['c'=>'second'] . how that? you creating references in first loop. @ end of loop $a still reference last value in array: $arr = ['a','b','c']; foreach($arr &$a); debug_zval_dump($arr,$a); array(3) refcount(2){ [0]=> string(1) "a" refcount(1) [1]=> string(1) "b" refcount(1) [2]=> &string(1) "c" refcount(2) } so, assigning $a change value: //... previous code, , then: $a = 'i still reference'; debug_zval_dump($arr); array(3) refcount(2){ [0]=

c# - How to bind array to dropdownlist with condition -

this might duplicate question, not able find helpful answer query. i have array of class leveldetails getting web service. each array item has property named "level". every employee has level assigned him. if level value 3, need bind dropdownlist array items having level less 3. i know how bind dropdownlist array. not able figure out how specify condition. list<bo.testclass> list = new list<bo.testclass>(); bo.testclass c1 = new bo.testclass(); c1.level = 4; list.add(c1); bo.testclass c2 = new bo.testclass(); c2.level = 3; list.add(c2); bo.testclass c3 = new bo.testclass(); c3.level = 9; list.add(c3); bo.testclass c4 = new bo.testclass(); c4.level = 2; list.add(c4); bo.testclass c5 = new bo.testclass(); c5.level = 1; list.add(c5); bo.testclass c6 = new bo.testclass(); c6.level = 8; list.add

How to run coffeescript via StrongLoop controller -

i'm making loopback application , wonder how can use coffeescript on serverside, use slc run ? i've used loopback recently, , wrote backend code in coffeescript. catch can't use slc run command run it. instead, after generating initial application skeleton slc , rewrite main server file in coffeescript. quickest way convert js2coffee : npm install -g js2coffee js2coffee server/server.js > server/server.coffee rm server/server.js then kickoff loopback server using coffee instead of slc run npm install -g coffee-script coffee server/server.coffee this starts server other node.js app, , write of server files in coffeescript, without needing precompile them first grunt , etc. if feel you're missing out on of bonus features of slc run clustering , process monitoring, try pm2 generalized alternative. supports coffeescript out of box. in future (hint hint, strongloop), slc tool will, too.

machine learning - When encoding weights in a neural network as a chromosome in a genetic algorithm, can a binary string be too long to function properly? -

i have feedforward neural network want train using genetic algorithm. have read best option use binary string of weights represented grey codes. in case, 65 weights each chromosome, result in string of length 2080 (65*32 bits). understand complex problem, take longer reach optimal solution having smaller number of bits in string, 2080 long ga work @ all? there better way encode such large number of weights? i don't think size of string of problem, may problem-dependent. if worried size of strings, perhaps reduce precision lower number of bits per weight , observe effects has on learning performance. have stated, grey codes best representation of weights. i've used ga's in other application areas gene sizes around same length , have evolved well. of course, need ensure population size , number of generations sufficient enough problem , fitness function.

Rails summary with sub-totals by date -

i'm writing first rails view summarizes data date. want 1 row each date columns summarized date. i have been able make work. but, it's awkward coding. have: <h3>carwings daily summary</h3> <table class="display datatable table table-striped table-bordered" id="datatable2"> <thead> <tr> <th>date</th> <th># trips</th> <th>e consumption (kwh)</th> <th>e regeneration (kwh)</th> <th>e total (kwh)</th> <th>distance (miles)</th> <th>energy economy (miles/kwh)</th> <th>co2 emission reduction (lbs)</th> </tr> </thead> <tbody> <% trips = 0 %> <% consumption = 0 %> <% regen = 0 %> <% total = 0 %> <% distance = 0 %> <% economy = 0 %> <% emissions = 0 %> <% sumdate = nil %> <% @carwings.each.with_index |ca

javascript - Change background image by month -

i'm trying change background image of element, according season is. i'm getting following error: typeerror: document.getelementsbyclassname(...).style undefined var currenttime = new date(); var month = currenttime.getmonth() + 1; var total = month; // summer if (total >= 6 && total <= 8) { document.getelementsbyclassname("banner-container").style.backgroundimage = "url('images/homepage-banners/winter-banner.jpg')"; } // autumn else if (total >= 9 && total <= 11) { document.getelementsbyclassname("banner-container").style.backgroundimage = "url('images/homepage-banners/fall-banner.jpg')"; } // winter else if (total == 12 || total == 1 || total == 2) { document.getelementsbyclassname("banner-container").style.backgroundimage = "url('images/homepage-banners/winter-banner.jpg')"; } // spring else if (total >= 2 && total <= 6) { document.getelements

java - Starting off with JavaFX : Can not set javafx.scene.control.Label field application.SceneController.myLabel to javafx.scene.text.Text -

i'm starting off javafx. the error occurs when execute program, before attempted this, worked fine , button clicks worked, before intention make button click change text. <?import javafx.scene.text.*?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.layout.anchorpane?> <anchorpane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.scenecontroller"> <children> <anchorpane layoutx="-100.0" layouty="-224.0" prefheight="572.0" prefwidth="430.0"> <children> <button layoutx="205.0" layouty="253.0" mnemonicparsing="false" onaction="#handleactionbutton1" text="do want swag?" /> <text fx:id="mylabel" layoutx="280.0" layouty="

google maps - How to add info window for clustering marker in android? -

i referred this google map android . want show info window image markers in android. myitem class import com.google.android.gms.maps.model.latlng; import com.google.maps.android.clustering.clusteritem; public class myitem implements clusteritem { private latlng mposition; private string mlatitude = ""; private string mstorelogo = ""; private string mlongitude = ""; @override public latlng getposition() { return mposition; } public void setposition(latlng mposition) { this.mposition = mposition; } public latlng getmposition() { return mposition; } public void setmposition(latlng mposition) { this.mposition = mposition; } public string getmlatitude() { return mlatitude; } public void setmlatitude(string mlatitude) { this.mlatitude = mlatitude; } public string getmlongitude() { return mlongitude; } public void setmlongitude(string mlongitude) { this.mlongitude = mlongitude; } public string getmstore

c# - Redirect the user back to the source page from where it has come after succesfull login in asp.net -

hello guys working on small asp.net project final year project, making online shopping site. have 3 pages in site login.aspx, detail.aspx , mobile.aspx in mobile.aspx when user click on detail button redirect user detail.aspx page using response.redirect();(no problem in step). in detail.aspx page when user click on addtocart button page first check if user logged in or not(using session["authenticated"]!=null method) if logged in every thing goes ok according me problem comes when user not logged in , click on addtocart button redirect user login.aspx page in login page when user click on login button checks if user redirected detail page(using session["productid"]!=null) if yes should redirect user detail.aspx page not doing here code please me login.aspx protected void login1_authenticate(object sender, authenticateeventargs e) { sqlconnection connection = new sqlconnection(conn); connection.open(); cmd = new sqlcommand("select count(*) c

Leaked window with dialog and wevView in Android -

i have bug in code when working multiple webviews java class receives reference of activity object. this code: try { mactivity.runonuithread(new runnable() { @suppresslint("newapi") public void run() { if (webview == null) return; if (visibility) { webview.setvisibility(view.visible); webview.requestfocus(); if (dialog != null && !dialog.isshowing()) { system.out.println("case1: " + dialog + " , activity: " + mactivity + ", mview " + webview); } else { dialog = webviewutils.showwebview(mactivity, webview); system.out.println("case2 " + dialog + " , activity: " + mactivity + ", mview " + webview);

c# webdriver - how can I verify 'disabled' attribute exists for a button -

i'm trying verify button loacted within test page has 'disabled' attribute applied it. here code: <button type="button" class="btn-1" data-type="plus" data-field="quantity" disabled="disabled"> how go getting handle on 'disabled' attribute? many help i not using c# think can use getattribute() method webdriver api. c# getattribute so should that: iwebelement button = locator button; button.getattribute("disabled"); and can assert value etc.

mysql - How to explode user id from a database column? -

Image
i have table name messages. there column name receiver_id need fetch record receiver_id = 4 getting null output. see table screenshot- above screenshot there 3rows. second , third rows exist 4 along other ids need explode , show second , third record. how write mysql query? storing comma separated values bad design should normalize first storing association of receiver in junction table,if not able alter schema current situation can use find_in_set() search values in comma separated list select * table find_in_set(4,receiver_id ) >0

scala - Changing default log config in a scalatra app -

i trying configure own configuration file sl4j logging in scalatra web app. achieve pass -dlogback.configurationfile=my-logback.groovy sbt session run container. have tested , approach working setting system variables normally. somewhere system variable getting changed ../myproject/src/main/resources/logback.xml. have no idea why getting changed? thanks des

javascript - Asyncronous knockout observableArray select options loading -

i hava selectoptions ajax-based asincronous loader; accepts remote address , returns observable array, correctly populated descriptions , keyvalues accepted following binding <select data-bind="value: selectedval, options: opts, optionstext: 'desc', optionsvalue:'key', optionscaption: ''"/></div> the fact that, being asincronous, when trigger select options change, based on user actions, assign model observable array, not select popuated, remains empty. mymodel.opts = loadoptions("<remoteaddress>"); i know when second line called anwer not arrived yet, returned value observablearray, should respond correctly whenever populated, having been assigned observable array binded ui. if hardcode returned object ajax call (when returns) taking console.log in firefox, or if pass observable array opts loadoptions, , change build opts inside it, works, need use loadoptions is, asincronous. tried append mymodel.opts.value

java - how do I flip this ruler up side down? -

this question exact duplicate of: i'm trying print ruler horizontally in java 2 answers so i'm scratching head on how flip output ruler....upside down idea ? if run code you'll see output can't/don't how post sample here public class ruler { private static void drawminorticks(int line, int ticks) { if (ticks > 1) { drawminorticks(line, ticks - 1); } if (line <= ticks) { system.out.print('|'); } else { system.out.print(' '); } if (ticks > 1) { drawminorticks(line, ticks - 1); } } private static void drawsinglemajortick(int line, int ticks, int label) { if (line <= ticks) { system.out.print('|'); } else { system.out.print(label); } } private static void drawmajorticks(int inches, int line, int ticks) { drawsingle

asp.net mvc - Principal.Identity.Name in Task ran from Controller Action -

in controller action i'm running public actionresult myaction() { task.factory.startnew( () => { myservice.executemethod( someargs ); } ); } the service call other class methods call others, , somewhere down line, iprincipal injected constructor of class. the iprincipal created doing httpcontext.current.user . since code in task , runs on different thread, , action has returned httpcontext.current null . if try doing thread.currentprincipal , exists, set other httpcontext.current.user was. also, if try accessing thread.currentprincipal.identity.name , objectdisposedexception thrown. i'm using ninject ioc container. iprincipal binding looks this bind<iprincipal>().tomethod( x => httpcontext.current.user ); is there way correct or usable iprincipal in code ran task in controller action? the httpcontext.current.user temporary threadlocal . such, you'll need retrieve it's value before starting task run in

gem - GooglePlus::RequestError: Invalid Credentials -

i`m getting 'googleplus::requesterror: invalid credentials' google plus rails gem. can't understand since when use sign in user works fine, im using credentials retrieved display info user, then, if works temporarily, after day or 2 error: 'googleplus::requesterror: invalid credentials' my helper code: def google_friends(user) auth = user.social_auths.where(provider: 'google').first if auth begin googleplus.api_key = env['google_key'] client = googleplus::person.get(auth.uid, :access_token => auth.token) client.emails.first["value"] rescue '' end else '' end end thanks in advance. you have give access_type=offline while authorization. , need use refreshtoken refresh new access token operation.the access token have expiery time. if want use acess token have refresh it.otherwise invalid token after expiry.

windows - AppEngine project error -

i trying run default program made when making appengine project , logs give me error 2014-09-22 21:19:08 running command: "['c:\\python34\\pythonw.exe', 'c:\\program files (x86)\\google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=10080', '--admin_port=8002', 'c:\\users\\eriel\\documents\\web\\southawnings']" traceback (most recent call last): file "c:\program files (x86)\google\google_appengine\dev_appserver.py", line 82, in <module> _run_file(__file__, globals()) file "c:\program files (x86)\google\google_appengine\dev_appserver.py", line 78, in _run_file execfile(_paths.script_file(script_name), globals_) nameerror: name 'execfile' not defined 2014-09-22 21:19:08 (process exited code 1) i using windows 8.0 , last update of appengine if have python 2.7 installed try opening google app engine launcher. edit -> preferences , check c

module - Perl library path/s -

i need find location of perl library/libraries how can this? similar gives python... python -c "import sys; print sys.path" thanks print contents of @inc variable: perl -e 'print "@inc\n";' @inc contains paths perl search find module.

php - Passing information using post method without session variables -

i admit homework. here last resort after cannot find suitable answer elsewhere. assignment having me pass information between posts without using session variable or cookies in php. user continues guess hidden variable carries on past guesses point. trying build string variable holds them , assign post variable cannot read off of guesscounter variable either undefined index error @ line of code should adding string variable or im not getting passed on @ all. here code appreciated have been @ awhile now. <?php if(isset($_post['playerguess'])) { echo "<pre>"; print_r($_post) ; echo "</pre>"; } ?> <?php $wordchoices = array("grape", "apple", "orange", "banana", "plum", "grapefruit"); $texttoplayer = "<font color = 'red'>it's time play guessing game!(1)</font>"; $therightanswer= array_rand($wordchoices, 1);

uitextfield - UISearchBar Custom InputView Crash in iOS8 -

i have uisearchbar custom inputview. can't set custom inputview uisearchbar in ios8 . it's crashing. here how set custom inputview uisearchbar for(int =0; i<[[[self.sbar.subviews objectatindex:0] subviews] count]; i++) { if([[[[self.sbar.subviews objectatindex:0] subviews] objectatindex:i] iskindofclass:[uitextfield class]]) { [[[(uitextfield*)[sbar.subviews objectatindex:0] subviews] objectatindex:i] setfont:[uifont fontwithname:@"customfont" size:15]]; uitextfield* search=[[(uitextfield*)[sbar.subviews objectatindex:0]subviews] objectatindex:i]; search.delegate = self; [[[(uitextfield*)[self.sbar.subviews objectatindex:0] subviews] objectatindex:i] setinputview:mykeyboard]; } here crash log. could not load "" image referenced nib in bundle identifier "com.company.myapp" 2014-09-23 13:34:13.816 myapp[1651:61729] not load ""

javascript - Gridster not working correctly:Override and Drag Issue -

currently developing example using gridster. new in gridster unable figure out doing wrong. these issues facing in gridster:- 1) when dragging grid, it's speed slow , when automatically moves bottom of page. 2) when page loads, grid overrides each other. i tried everything, fails. here link check:- and function used page load:- loadlayout()

Why does Java 8 Nashorn (JavaScript) modulo returns 0.0 (double) instead of 0 (integer)? -

consider following code sample: import javax.script.scriptengine; import javax.script.scriptenginemanager; public class tester { public static void main( string[] args ) throws exception { scriptengine se = new scriptenginemanager().getenginebyname( "nashorn" ); object eval = se.eval( "5%5" ); system.out.println( "eval = " + eval ); system.out.println( "eval.getclass() = " + eval.getclass() ); } } why produces following output? eval = 0.0 eval.getclass() = class java.lang.double the result type java.lang.double weird . in case remainder different 0 correctly returns java.lang.integer , e.g. 5%2 returns java.lang.integer' value 1`. only 0 somehow special . trying same javascript expression in firefox 32.0.2 (findbugs console) works fine , returns plain 0. is there way force nashorn return integer type instead of double? there no integers in javascript. start ecmascript s

create xml using data from excel using macro -

here requirement - 1) have xml , corresponding xsd document 2) it's complex xml multiple elements , hierarchy. there elements/fields important 3) want create excel these fields user can enter data across multiple rows 4) when user clicks on create xml, separate xml should created each row 5) xml created should contain elements (user entered + many more in original xml) this sample- <a> <a1/> <a2/> </a> <b> <b1>*user entered value*</b1> <b2>*user entered value*</b2> </b> <c> <c1/> <c2/> </c> i found references on msxml2.domdocument60 1 can create xml using api , validate against schema through excel macro. in case there 1000s of tags. below options have in mind- use domdocument60 api , construct xml line line using macro. since there 1000s of tags, approach gulp 1000s of lines of code , make maintenance cumbersome task ! since have sample xml, can empty existing values

php - Fatal error: Can't use function return value in write context in -

i have code check if isset mysql data , check int : <input type="radio" name="lang" value="1" <?php if(isset(filter_var($__sql__[0]['lang'], filter_validate_int))){ echo ($__sql__[0]['lang'] == 1 ? ' checked="checked"' : '');}?> /> but see error: fatal error: can't use function return value in write context in c:\xampp\htdocs\user\modules\editnews.php on line 56 how can fix error? it's limitation of php. using isset() , not function, language construct . can use on simple variables, in php versions prior 5.5. see documentation : prior php 5.5, empty() supports variables; else result in parse error. in other words, following not work: empty(trim($name)) . instead, use trim($name) == false . that means need this: // we'll check if $__sql__[0]['lang'] exists , // filter_var succeeds. if (isset($__sql__[0]['lang']) && filter_va

how to assign xml value to javascript variable -

how assign xml value javascript variable. data.xml: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="webdata.xslt"?> <information> <personal_info> <accountname>john doe</accountname> <accountnumber>987654321</accountnumber> <mobileuser>nathan 'nath' smith</mobileuser> <mobileno>8755559876</mobileno> </personal_info> </information> mobileno value want use in javascript this may you: http://www.w3schools.com/dom/dom_nodes_get.asp the load function: http://www.w3schools.com/dom/dom_loadxmldoc.asp

javascript - Listen for keydown events in iframe with cross-domain -

i want listen keydown events in iframe stop backspace being executed. works long page in iframe comes same domain, when comes domain fails when contents() method called. the error is: ie: "0x80070005 - javascript runtime error: access denied." chrome: "uncaught securityerror: failed read 'contentdocument' property 'htmliframeelement': blocked frame origin "domain_a" accessing frame origin "domain_b". protocols, domains, , ports must match." is there way listen keydown events on iframes domain? i use angularjs code setup listener: keydownservice.prefilterkeydown($(this).contents()); ... angular.module('portal.services.keyhandlers.keydownservice', []) .service('keydownservice', function () { //prevents shortcut keys (for instance backspace) in being executed in iframe or document. this.prefilterkeydown = function ($document) { $document.keydown(function (e) { var preventk

mysql - Order one field both ASC and DESC -

i've got table events i'd show. want sort events in future ascending, , past in descending order. how can 1 query? my current order dec 23 nov 10 nov 04 sep 12 aug 01 jul 23 the order want nov 4 ** changed place nov 10 dec 23 ** changed place sep 12 aug 01 jul 23 many in advance. you asking sort distance current date: select * table order if(date_field >= now()),0,1), abs(datediff(now(), date_field))

c# - ListView present in BlockUIContatiner not splitting up in pages in Flow Document when it is paginated -

i using blockuicontainer , displaying listview in it. when document paginated, list view not splitting in pages , instead moving new page. want list view displayed continously , splitting in pages when large. enter code here <flowdocumentreader x:class="tmsss.trapper.modules.mailmerge.views.pdfcescheckview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:resources="clr-namespace:tmsss.trapper.resources;assembly=tmsss.trapper.resources" xmlns:viewmodels="clr-namespace:tmsss.trapper.modules.mailmerge.viewmodels" mc:ignorable="d" d:designheight="300" d:designwidth="300

objective c - How to Upload file to google drive only if it is not exist? -

i use xcode develope iphone application. i upload database files google drive code. - (void)uploaddb{ gtldrivefile *file = [gtldrivefile object]; file.title = [nsstring stringwithformat:@"user:%@db.sqlite",username]; file.descriptionproperty = @"uploaded ios "; file.mimetype = @"application/x-sqlite3"; // attach db file email nsarray *paths = nssearchpathfordirectoriesindomains (nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; //make file name write data using documents directory: nsstring *filename = [nsstring stringwithformat:@"%@/%@", documentsdirectory,db_file]; nsdata *data = [nsdata datawithcontentsoffile:filename]; gtluploadparameters *uploadparameters = [gtluploadparameters uploadparameterswithdata:data mimetype:file.mimetype]; gtlquerydrive *query = [gtlquerydrive queryforfilesinsertwithobje

wrapper - OpenCV in Go without SWIG and third-parties lib -

main goal: make opencv work in go without swig , third party lib (an application compare image in linux using go) i new in kits (opencv go , linux) can image detection (feature2d etc) can done c-api only? there no convenient way call c++ code , c-api not updated(?) i have followed how use c++ in go? failed. when make, got following errors makefile:5: /usr/local/go/bin/src/make.amd64: no such file or directory makefile:6: /usr/local/go/bin/src/make.pkg: no such file or directory makefile:8: * missing separator. stop. the makefile followed goroot=/usr/local/go/bin goarch=amd64 targ=foo cgofiles=foo.go include $(goroot)/src/make.$(goarch) include $(goroot)/src/make.pkg foo.o:foo.cpp g++ $(_cgo_cflags_$(goarch)) -fpic -o2 -o $@ -c $(cgo_cflags) $< cfoo.o:cfoo.cpp g++ $(_cgo_cflags_$(goarch)) -fpic -o2 -o $@ -c $(cgo_cflags) $< cgo_ldflags+=-lstdc++ $(elem)_foo.so: foo.cgo4.o foo.o cfoo.o

c++ - How to stop char variables from being overwritten? -

im making 2 player tic tac toe game in c++ , im fixing couple problems had it. program complete except 1 tiny detail, players can overwrite other players moves. if have player 1 ("x") , player 2 ("o"), player 1 can place "x" on "o" eliminating player 2s move! i'm wondering if there way stop happening, used 2d array "board": game.cpp #include "game.h" #include <iostream> #include <cstdlib> using namespace std; game::game() { char b[3][3]= { {'.','.','.'},{'.','.','.'},{'.','.','.'}}; for(x=0;x<3;x++) { for(y=0;y<3;y++) { board[x][y]=b[x][y]; } } counter = 1; printboard2(); } void game::printboard2() { for(x=0; x < 3; x++) { for(y =0; y<3; y++) { cout << board[x][y] << " " ; } cout << endl;

android - Using phone's unique device identification number instead of account -

i have idea mobile app not use traditional account account username , password. instead use device's unique identification number anonymous account. i have questions. i have never developed mobile device before possible unique identification number on platforms ios , android? can assume devices in world have unique identification number , nobody change theirs similar other number? will there legal or technical ramifications using identification number instead of old-fashioned way of using account username , password? it possible unique identification number on platforms ios , android? yes, it's possible uniquely identify device installation. refer this article starting point can assume devices in world have unique identification number , nobody change theirs similar other number? no. there's no such thing super-unique-id-which-is-used-in-all-devices-in-the-world. although each mobile phone has it's unique id (imei, meid, or esn),