Posts

Showing posts from April, 2011

javascript - jQuery .prop('checked', false) does not work -

html: <form class="form"> <input type="checkbox" id="box" /> check me! </form> js: $( window ).load( function() { var myfunc = function() { if( $( '#box' ).prop( 'checked', false ) ) { $( '.form' ).append( '<p>checkbox not checked.</p>' ); } } $( '#box' ).on( 'change', myfunc ); } ); here jsfiddle http://jsfiddle.net/3pym7/ when use $( '#box' ).prop( 'checked', false ) condition if statement not work, ! $( '#box' ).prop( 'checked' ) works fine! the statement $('#box').prop('checked', false) not return boolean rather set checked property false should not used in condition , normal behaviour if($('#box').prop('checked', false)) could changed test using is() :checked selector. if($('#box').is(':checked')) or i

c# - Calling functions from Unmanaged DLL -

i have unmanaged dll following functions: readlatch( handle cyhandle, lpword lplatch); writelatch(handle cyhandle, word mask, word latch); getpartnumber(handle cyhandle, lpbyte lpbpartnum); getdeviceproductstring(handle cyhandle, lpvoid lpproduct, lpbyte lpblength, bool bconverttoascii = true ); getdeviceserialnumber(handle cyhandle, lpvoid lpserialnumber, lpbyte lpblength, bool bconverttoascii = true ); getdeviceinterfacestring(handle cyhandle, lpvoid lpinterfacestring, lpbyte lpblength, bool bconverttoascii); i'm trying import these functions haven't had likl

python - Regular Expression to extract CSV data, some fields are quoted and contain commas -

i have following types of input data (for splunk) svr28pr,linux file system-all,success,32.87,2638.259,26/06/14 19:00,26/06/14 21:03,avamar xxxxx1.network.local,activity completed exceptions.,26/06/14 19:00 svr44pr:staging_syncdb,incr,success,1271,1271,27/06/14 11:28,27/06/14 11:28,sql,,,1/01/70 09:59 i need break out fields - following expression worked well. (?<client>[^,]+),(?<backuptype>[^,]+),(?<status>[^,]+),(?<size>[^,]+),(?<dump>[^,]+),(?<start>[^,]+),(?<complete>[^,]+),(?<application>[^,]+),(?<server>[^,]+),(?<comment>[^,]+) however, due change in names of backuptypes, second field may quoted , contain commas e.g. svr08ts,"windows vss-all,all",success,0.067,39.627,26/06/14 21:32,26/06/14 21:38,avamar,xxxxxxx2.network.local,activity completed exceptions.,26/06/14 20:00 is there way using regex determine whether field uses quotes , if copy data between quotes named group? you can use m

hashtable - Hash table: why buckets? -

as far know, point of hash function distribute data out evenly possible, when have collision have several choices: look next empty slot generate different hash , try stick somewhere else put in overflow container (could list, hash table or whatever) put in next free bucket slot the last 1 bothers me because, if you're going make hash table 2 slots each address, why not make twice bigger hash table? unless buckets dynamically allocated. in case, data of table sits on disk mean disk access + managing variable length data. seems me though buckets still favored option, why that? missing? as evident discussion in comments on question, there many different ways can implement hash table. each has own tradeoffs. your question why want use bucketing system (closed addressing, or hashing chaining) versus dropping object next free slot (linear probing). point out having buckets stored in external memory requires lookup in spot in memory, isn't idea if you're s

android - Language Change with respect to Location -

i have scenario wherein application should automatically select language basing on region. example, if application used in germany, entire application's labels , alerts should changed german! there api or jar may sort out problem? please me out , in advance.

subprocess - Interact with executables over server in Python? -

i want run executable on tcp server , take input socket connections interactively , send output client until executable terminated. trying piping through popen class of subprocess not helping interaction executable ( take input 1 time want input taken time until program exits ). suppose send "1" input server server must send stdout corresponding "1" input client , ask next input , till executable exits in continuation . just provide socket standard input, output, , error of subprocess. e.g.: import socket import subprocess listener = socket.socket(socket.af_inet, socket.sock_stream) listener.setsockopt(socket.sol_socket, socket.so_reuseaddr, true) listener.bind(('0.0.0.0', 0)) listener.listen(5) print(listener.getsockname()) try: while true: client, addr = listener.accept() subprocess.popen(['cat'], stdin=client, stdout=client, stderr=client) client.close() except keyboardinterrupt: pass finally:

git - Deploying Bitbucket to Azure -

i have bitbucket repository i'd link windows azure. i'm able click "set deployment source control", grant access azure, , view screen displays repositories , asks branch deploy. everytime select repository , tell deploy "master" branch, fails could not link bitbucket repository 'xxx' windows azure web site 'xxxx'. this application asp.net web form application written in .net 2.0. not see errors logs in azure ftp. i've attempted revoke azure authentication in bitbucket , retry no luck. any thoughts? there known issue when site running .net 2.0/3.5. fix should available sometime in next few weeks.

sql server - SQL query to retrieve all table's un-unique identifiers (indexes) -

is there way count every table in database, number of unique , number of un-unique identifiers (indexes) i using sql server 2012 database select object_name(object_id), sum(case when type = 1 1 else 0 end) 'primary_count', sum(case when type = 2 1 else 0 end) 'unique_count' sys.indexes m group object_id,is_unique_constraint sys.indexes contain column type if 1 means unique , if 2 means non unique constraint , if 0 means heap particular object_id.

android - Splash screen with loading implementation in worklight 6.2 -

i need implement splash screen loading in worklight 6.2 . dont have reference . can route me correct way. what you're looking accomplish cannot done using javascript. need implement native code in objective-c , java. see this user documentation topic creating customized splash screen in ios , android. based on documentation, add native code display busy indicator on top of splash image. while app loading, worklight framework handle showing , hiding of splash image. for example, take following code snippet , insert in native code (ios) per documentation add busy indicator. google similar code android. how display activity indicator uiviewactivityindicatorview related question: splash screen loading in 4 environment(android,ios,blackberry , windows) using html coding or common plugin hybrid apps you create else entirely.

css - Bootstrap, fixed left offcanvas sidebar with scrollable content in the center -

Image
i want create template project working on using bootstrap , have problem behavior of offcanvas sidebar. want sidebar take space below header , not scrollable. have found 2 templates, combined want have problem merging them not css. have tried lot can't figure how it. here picture showing desired functionality/behavior of template want make: here 2 templates have found: dashboard dashboard (with off-canvas sidebar) and here code (html+css) of each template (stripped down) can figure out how work: dashboard - fixed sidebar html <div class="row"> <div class="col-sm-3 col-md-2 sidebar"> <ul class="nav nav-sidebar"> <li class="active"><a href="#">overview</a></li> <li><a href="#">reports</a></li> <li><a href="#">analytics</a></li> <li><a h

sql - FIFO Allocation between Sales and Sales Order Table based on Schedule -

it's order processing related query. there sales order have different products specific quantity. each qty have schedule delivery. in case, 55 nos has schedule 10, 15, 30. same way has once more set of schedule. in sales details table detail of material sold against each item. details sale order no , item line no. need take schedule qty in fifo basis , allocate required qty. need result set shown , have update sales order detail table. please me screenshot

haskell - Control.Concurrent.Async.race and runInteractiveProcess -

i'm using race function async package, exported control.concurrent.async . the subtasks fire off using race invoke runinteractiveprocess run (non-haskell) executables. idea run different external programs , take result of first 1 finish. in sense, haskell "orchestrates" bunch of external programs. what i'm observing while race works correctly killing haskell level "slower" thread; sub-processes spawned slow thread continue run. i suspect expecting race kill processes spawned way bit unrealistic, become zombies , inherited init. purposes however, keeping external processes running defeats whole purpose of using race in first place. is there alternative way of using race subprocesses created way killed well? while don't have use case yet, it'd best if entire chain of processes created race d tasks killed; 1 can imagine external programs creating bunch of processes well. as mentioned in comments, use combination of onexcepti

c# - UnauthorizedAccessException in Microsoft.Phone.ni.dll -

i'm trying device_id in windows phone 8. tried doing this: byte[] mydeviceid = (byte[])microsoft.phone.info.deviceextendedproperties.getvalue("deviceuniqueid"); string deviceidasstring = convert.tobase64string(mydeviceid); and this: deviceextendedproperties.getvalue("deviceuniqueid").tostring(); both resulted in following exception: an exception of type 'system.unauthorizedaccessexception' occurred in microsoft.phone.ni.dll not handled in user code additional information: access denied. (exception hresult: 0x80070005 (e_accessdenied)) how can solve issue? you need add required capabilities in app manifest file. particularly, try add capability : id_cap_identity_device for reference : msdn : how modify app manifest file windows phone 8 msdn : app capabilities , hardware requirements windows phone 8

printing - Print only jQuery UI Dialog Content -

i have modal form, opens on click of button. contains text want print. i have hidden every other elements in print.css except div contains print data. when press ctrl + p shows data wanna print, wanted be, not fit printing a4 page. text positioned in left top corner of paper , part of (right side) hidden. i tried every possible style in print.css make content fit printable area, nothing changes :( please help? use like: @media screen { .printable { display: none; } .non-printable { display: block; } } @media print { .printable { display: block; } .non-printable { display: none; } } and set margin page in print state. also check answer , jsfiddle here

Linux Kernel - Data definition has no type or storage class -

i working on linux kernel 3.4, , have following code: /* proximity sensor calibration values */ unsigned int als_kadc; export_symbol(als_kadc); static int __init parse_tag_als_calibration(const struct tag *tag) { als_kadc = tag->u.als_kadc.kadc; return 0; } __tagtable(atag_als, parse_tag_als_calibration); but when build it, gives me following error: warning: data definition has no type or storage class [enabled default] yes, warning, forbidden warning, , being treated error. warning point following line in code: export_symbol(als_kadc); can me solve problem? thank you. ok. figured out problem: missing include module.h so, added code file: #include <linux/module.h> this fixed problem, because export_symbol defined in header file.

version control - Can I work with my repository during git filter-branch -

i checked in big binary files git repository. noticed got slow. 4-5 seconds respond git status . in root directory. decided clean repository git filter-branch --tree-filter "rm -f web/libs/*.*jar" head , similar commands. take hours complete. can still work repository, while commands running? don't try work in repository during filter-branch you possibly continue working in repo during filter-branch sending filter-branch process background of shell session, or open terminal , continue working repo way, but highly recommend against that, cause lot of problems in repo if tried. then again, git might lock files during filter-branch (such index), might throw bunch of errors if tried non-filter-branch operations during filter-branch anyways. solution 1: use index-filter don't use tree-filter this, you've seen, it's slow, because has checkout each commit working copy. use index-filter instead, recommended in filter-branch documentation , be

python - Returning a Numpy Array as a CSV from Flask -

i have part of api in flask returns numpy array in json, need offer option return csv rather json. the way have done save numpy array csv using numpy.savetxt serve file. have found can not leave file behind how can generate file on fly , delete after download? still feels 'kludgy' is there way return numpy array csv without going via file? well, if want use numpy.savetxt function, can use cstringio: from cstringio import stringio output = stringio() numpy.savetxt(output, numpy_array) csv_string = output.getvalue() for python 3 import stringio or bytesio io module instead.

Starting with Email-ext plug-in -

problems using email-ext using groovy/jelly script(default) fail send emails attachment pattern doesn't work solution above problems: 1.create new job in jenkins , make note of job workspace plays important role. email-ext comes ready made default scripts can use send emails attachments. place scriptname using inside defalut contents use pattern below {script,template="nameofthetemplate} 2.make note there no commiters option in plug-in infact use triggers , send emails recipents list selecting 1 of options a.developers b.culprits c.recipentslist d.requestors 3.this critical point because attachment section in jenkins use ant script.so ant script work on realtive addressing rather absolute addressing. content in attachment pattern should thing this **/foldername/*.txt (anyextension) note:make sure floder exists in job workspace hope helps extent

ruby - acts_as_messagable doesn't work on rails 4.1 -

i using 'acts_as_messagable' gem private messaging between users. my model: class user < activerecord::base acts_as_messageable :table_name => "messages" .. end i have error on start application: `method_missing': protected method `default_scope' called #<class:0x007f84d7870da8> (nomethoderror) current rails version 4.1, migrations done. what root of problem? it's not compatible docs: the gem compatible rails 2.3, upgrade rails 3 planned

sql - Updating customer's address works in Observer.php, fails in custom PHP file -

i've connected ajax call event on changing customer's address in checkout. supposed update 1 field in customer's address. require('../../../../mage.php'); umask(0); mage::app(); $newcontactologyclientid = $_post['contactologyclientid']; $customerdefaultaddressid = mage::getsingleton('customer/session')->getcustomer()->getdefaultshipping(); $customeraddress = mage::getmodel('customer/address'); $customeraddress = $customeraddress->load($customerdefaultaddressid); $_new_address = array ( 'contactology_client_id' => "$newcontactologyclientid" ); $customeraddress->adddata($_new_address); $customeraddress->implodestreetaddress()->save(); on javascript side ok, won't include here. posted code responsible database update works when fired in module's observer.php on magento event ( sales_quote_save_after ), when run via ajax error: uncaught exception 'pdoexception' message

java ee - EJB 2.1 and EJB 3.1 components in the same application -

so migrating project written in ejb 2.1 ejb 3.1 in parts. start with, have picked 1 ejb , incorporating 3.1 changes in it, without touching other exisitng 2.1 beans. apart other ejb 3.1 changes, changed version of existing ejb-jar.xml version="3.1" without changing it, ejb 3.1 beans not binding. however, after version has been changed 3.1, ejb beans written in 2.1 cannot looked , exception : "javax.naming.namenotfoundexception: name "ejb/ejb/gov/michigan/access/business/services/abtransactionmanagedejblocalhome" not found in context "local:"". is possible have both 2.1 & 3.1 components in application? if yes, configurations have make support it? have read lot of material online , tried lot of stuffs, nothing seems work. the answer first question clear: yes, can use them within 1 application. have ourselves application quite years old , still has parts written in j2ee , newer ones in java ee, both within 1 ear file. conce

Problems when calling a c++ program from java using JNI -

i doing sample demonstration program call c++ program java. have gone through java jni framework , followed samples. implementing sample in aix 5 powerpc system. here java code snippet. public class helloworld { public native void hellocpp(); public native int getempid(); public static void main(string[] args) { //system.loadlibrary("occidml"); system.loadlibrary("javatocpp"); // shared object file. helloworld hello=new helloworld(); system.out.println("calling c++ methods java"); hello.hellocpp(); system.out.println("retrieve value c++"); int i_perf_obj=hello.getperfobj(); system.out.println("i_perf_obj value c++ program"+i_perf_obj); } } generated header file above compiling. below c++ program occi database connection implementation calling java #include <iostream> #include "helloworld.h" #include <occi.h> using namespace oracle::occi; using namespace std; jnie

Optaplanner : Which score value should I trust? -

which score value actual solution score : score value returned method scoredirector.calculatescore() or value returned solution.getscore()? i'm asking because noticed return different values every new best solution found. they shouldn't. implies have score corruption, bad. turn on: <solver> <environmentmode>fast_assert</environmentmode> and <solver> <environmentmode>full_assert</environmentmode> to find out where.

licensing - Multicast encryption for a file download -

i have program has paid addons, updated frequently. users have buy subscription able use addons (i.e pay monthly free). the main reason chose subscription based model addons simple, updates selling point addons must updated frequently. long story short, these addons basically useless without updates because software works gets updated , things will beak. now file download. allow paid users use these addons. normally central server , database rather trivial, not when can not have central server database. (i have no influence on this.) this efficient solution came with: user gets random aes256 key. we encrypt paid addon random aes256 key. we encrypt addon's key users key. rinse , repeat above users , addons , create 1 monolithic keyfile. upload encrypted addon file, , monolithic keyfile filesharing service. the above solution has following characteristics: ability revoke keys in subsequent versions. (very important) no security obscurity. can download add

java - SAX Parser ignoring parent elements? Same named elements grouped as a result -

i'm not if how sax parser supposed work or if missing something. this sort of xml pulling down server: <data> <item id="1"> <group> <name>question one</name> <type>true</type> <selection> <name>answer 1</name> </selection> </group> </item> <item id="2"> <group> <name>question two</name> <type>true</type> <selection> <name>answer 2</name> </selection> </group> </item> </data> as can see, there element called "name" showing twice under different parents, containing different data. trying collect "question one" , "question two" in arraylist have getter , setter of setname getname. title suggest result means answers be

javascript - Avoiding use of eval in raphael.sketchpad function -

i have following code works expected: var svg_height = $("#svg-container").height(); var svg_width = $("#svg-container").width(); var name = "sketchpad"; eval("window." + name + "= raphael.sketchpad('" + "svg-container" + "',{" + " width:" + svg_width + "," + "height: " + svg_height + "," + "editing: true," + " });"); however want avoid using eval security reasons. tried following not work window.sketchpad = raphael.sketchpad("'svg-container',{width:"+ svg_width +",height:"+ svg_height +", editing: true}"); can solved using json. if yes, how? appreciated. disclaimer: know nothing raphael, translating eval code. window[name] = raphael

Use array in mysql query java -

i have 2 questions java mysql first, have array containing either 1 or 0. if want if statement how can check if opt[0] = 1? like: if (options[0] == 1 { sqlbuilder.append("and a.value1 = val[1]") } next question. have array containing different values, how can use them in mysql query. right got stringbuilder sqlbuilder = new stringbuilder() .append("select * ") .append("from `table1` ") .append("cross join `table2` b ") .append("cross join ` table3` c ") .append("cross join `table4` d") .append("where c.`id` =" . val[0] ); so need c.id = val[0] basically, code correct. the thing incorrect java syntax. coming php? strings concatenated + in java, last line should .append("where c.`id` =" + val[0] ); in addition, seem mess types; if option array string[] need compare strings or cast value int , first if must this: if("1".equals(options[0])) or if(integer.parse

php - Search and pagination, how to get search term after form has been submitted -

i'm creating search feature pagination. i have form , it's post value. use search database , return set of results. the results broken in pages , user can click page links in view. my question is, how can persist search on multiple pages? should first page post value , on subsequent pages should put search term url, eg. www.example.com/search/various-keywords/p2 then term , query database again, splitting results whatever page is, p2, p3, p4 etc. is there cleaner way this? also, unsafe include users input in url? should encode in way? and if user click after going through number of pages 'confirm form resubmission' error. how can prevent this? the best way making search term get variable can retrieve , add url want. as long escape search query should fine user security, remove re-submission of form error.

php - Javascript is not working on ajax call -

i've multiple select on code onchange function ajax call,when value passed through ajax gets data database , plot chart highcharts script,my problem javascript not worrking on ajax call,please suggest best,thanks in advance source.php <script> function something(str) { if (str=="") { document.getelementbyid("div1").innerhtml=""; return; } if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } else { xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("div1").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","destination.php?q="+str,true); xml

android - How to parse nested array through GSON -

i want parse json response through gson in android, example { "adult": false, "budget": 63000000, "spoken_languages": [ { "iso_639_1": "en", "name": "english" } ], } first class this public detail parsedetailresponse(inputstream json) { gson gson = new gson(); reader reader=new inputstreamreader(json); detail handle = gson.fromjson(reader, detail.class); return handle; } class parsing this public class detail implements serializable{ private static final long serialversionuid = -6814886315783830255l; @serializedname("adult") public boolean adult; @serializedname("spoken_languages") public lang[] languages; } my lang class public class lang implements serializable{ private static final long serialversionuid = -6814886315783830255l; @serializedname("name") public string name; } now want value of lang.name, gives null pointer ex

php - How to save image position after drag -

i new jquery have design custom shape image frame image dragging. able retrieve values of "top" , "left" positions. not able store position permanent after image draging. don't know how posibble without using database. below code test.php <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <script> $(function() { $(".headerimage").css('cursor', 'pointer'); var y1 = $('.picturecontainer').height(); var y2 = $('.headerimage').height(); var x1 = $('.picturecontainer').width(); var x2 = $('.headerimage').width(); $(".headerimage").draggable({ scroll: false, containment: "#picturecontainer", drag: function(event, ui) { document.getelementbyid("img_top").value = ui.position.top; docume

regex - Angular is returning "TypeError: Cannot read property" when using regular expressions -

i trying extract youtube id form input provided. output fine receiving error typeerror: cannot read property '2' of null $scope.message.color = 'green'; $scope.message.content = 'sss'; $scope.videos.youtubeadd=true; $scope.$watch('item.url', function() { var re = /(\?v=|\/\d\/|\/embed\/|\/v\/|\.be\/)([a-za-z0-9\-\_]+)/; value = $scope.item.url; value = value.match(re)[2]; $scope.item.url = value; }); please see here http://jsfiddle.net/k39du/ should helps. can check if matches before take second element array var app = angular.module('app', []); app.controller('myctrl', function ($scope) { $scope.url = 'https://www.youtube.com/watch?v=i38q5ad5gam'; var re = /(\?v=|\/\d\/|\/embed\/|\/v\/|\.be\/)([a-za-z0-9\-\_]+)/; value = $scope.url; $scope.arrays = value.match(re); if ($scope.arrays && $scope.arrays.length > 1) { $scope.id = $scope.arrays[2]; }

Date comparison error with javascript -

i'm trying compare dates in javascript. why happend? var strdate = "28/06/2014"; var arraydate = strdate.split("/"); var fechaturno = new date(arraydate[2], arraydate[1] - 1, arraydate[0]); var fechaactual = new date(); var fechalimite = new date(); fechalimite.setdate(fechaactual.getdate() + 10); console.log(fechaturno); // date {sat jun 28 2014 00:00:00 gmt-0300} console.log(fechaactual); // date {fri jun 27 2014 08:36:24 gmt-0300} console.log(fechalimite); // date {mon jul 07 2014 08:36:24 gmt-0300} alert(fechaactual.getdate() <= fechaturno.getdate()); // true alert(fechaturno.getdate() <= fechalimite.getdate()); // false why last line false? should true. doing wrong? in code don't see error getdate return day of month alert(fechaactual.getdate() <= fechaturno.getdate()); // true because 27 < 28 alert(fechaturno.getdate() <= fechalimite.getdate()); // false because 28 > 7 to compare whole date try just

javascript - Create with inline in Django -

i have 2 related models train , passenger in django 1.7. the passenger model has foreignkey train. i want make view create passengers , choose in train passenger should placed. problem train exists , other times needs created. how can in same view? i think both need <select> element choose train , input elements create train. if option selected in <select> element input fields createing train disabled javascript. is best approach problem? i make form creating train in view , select train list, updating select train list if new train created aswell inputs/dropdowns/checkboxes passangers. note creating train form should ajax call.

php - nginx 301 redirect loop -

i'm having problem nginx , php-fpm setup. seo friendly url's not working, , when try using direct route 301 redirect loop browser. here nginx config # redirect non-www www server { listen 8081; server_name mysiteurl.com; rewrite ^(.*) http://www.mysiteurl.com$1 permanent; } server { listen 8081; server_name www.mysiteurl.com; rewrite_log on; access_log /var/www/vhosts/mysiteurl.com/statistics/logs/access_log.nginx combined; error_log /var/www/vhosts/mysiteurl.com/statistics/logs/error_log.nginx warn; root /var/www/vhosts/mysiteurl.com/httpdocs; index index.php index.html index.htm default.html default.htm; if (!-e $request_filename) { rewrite ^(.+)$ /navigation.php?q=$1 last; } location / { try_files $uri $uri/ /navigation.php?q=$uri&$args; } # deny running scripts inside writable directories location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error

angularjs - Angular.js: Cannot read cookie in http.post response -

i'm aware issues similar have been covered elsewhere i'm still unable working in code. i cannot read http post response cookie value using angular.js though cookie present in (successful) post response. cookie can viewed using chrome devtools in response headers (in 'set-cookies') , in 'response cookies' in 'cookies' tab. the following factory makes http post (coffeescript): .factory "authpost", ($http) -> url = 'http://10.x.y.z/api/authentication/authenticate' login: (credentials) -> $http.post( url, $.param(credentials), headers: 'content-type': 'application/x-www-form-urlencoded' ) it's called in controller function: authpost.login(credentials).success(success).error error in 'success' function in controller, $cookies undefined though: success = (data, status, headers, config) -> $timeout (-> console.log ('after timeout $cookies='

java - Why does my XML parser not work -

i got following xml file named test2.xml in assets folder: <?xml version="1.0" encoding="utf-8"?> <map version="1.0" orientation="orthogonal" width="32" height="32" tilewidth="16" tileheight="16"> <tileset firstgid="1" name="terrain" tilewidth="16" tileheight="16"> <image source="terrain.png" width="256" height="256"/> </tileset> <layer name="kachelebene 2" width="32" height="32"> <data encoding="csv"> 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

using phonegap-facebook-plugin in simple cordova android app -

i trying facebook-plugin on this link working on android emulator after building using cordova i have used below login function (given example on github documentation page) after viewready has been fired. facebookconnectplugin.getloginstatus( function(response) { alert(json.stringify(response)); }, function(response) { alert(json.stringify(response)); }); my app crashes message "unfortunately app has stopped working". have done following steps till : -- create new cordova project --add android platform it --add phonegap plugin cordova project below command cordova -d plugin add /users/your/path/here/phonegap-facebook-plugin --variable app_id="123456789" --variable app_name="myapplication" --added keyhash facebook developer account well --added faceboook-android-sdk reference using below command inside platforms/android android update project --target 3 --

arrays - Quick File to Hashtable in PowerShell -

given array of key-value pairs (for example read in through convertfrom-stringdata), there streamlined way of turning hashtable or similar allow quick lookup? i.e. way not requiring me loop through array , manually build hashtable myself. example data 10.0.0.1=alice.example.com 10.0.0.2=bob.example.com example usage $names = gc .\data.txt | convertfrom-stringdata // $names object[] $map = ? // $map should hashtable or equivalent echo $map['10.0.0.2'] // output should bob.example.com basically i'm looking a, preferably, built-in file-to-hashtable function. or array-to-hashtable function. note: @mjolnior explained, got hash tables, array of single value ones. fixed reading file -raw , hence didn't require array hashtable conversion. updated question title match that. convertfrom-stringdata create hash table. you need give key-value pairs single multi-line string (not string array) $map = get-content -raw .\data.txt | convertfrom-stringda

php - How to Display the set of series not from the array? -

i have following array: array ( [0] => 3 [1] => 6 [2] => 3 [3] => 4 [4] => 5 [5] => 7 [6] => 6 [7] => 7 ) we have split array (order should 3,4,5,6,7 ) output should be array 1: 3,4,5,6,7 (3 taken [0],4 taken [3],5 taken [4],6 taken [6],7 taken [7]) array 2: 3,-,-,-,- (3 taken [2] nd position) array 3: -,-,-,6,7 (6 taken [1] nd position,7 taken [5] nd position) basically youre asking this... $array = array(3,6,3,4,5,7,6,7); $array1 = array($array[0],$array[3],$array[4],$array[6],$array[7]); $array2 = array($array[2],"-","-","-","-"); $array3 = array("-","-","-",$array[1],$array[5]);

windows - Stopping the execution of threads in Python. The thread is blocked before join method -

i'm writing program execute child programs in new process , read stdout of these programs in separate thread , write in styledtextctrl control. faced problem of stopping execution of threads. have following code: import subprocess threading import thread, lock import wx import wx.stc import logging logging.basicconfig(level=logging.debug, format='[%(levelname)s] (%(threadname)-10s) %(module)10s:%(funcname)-15s %(message)s', ) class readthread(thread): def __init__(self, subp, fd, append_text_callback): thread.__init__(self) self.killed = false self.subp = subp self.fd = fd self.append_text_callback = append_text_callback def run(self): chunk = none while chunk != '' , not self.killed: self.subp.poll() chunk = self.fd.readline() if chunk: self.append_text_callback('%d: ' % self.subp.pid + chunk)

html5 - How to delete TD's using id in jquery -

i'm having table generating dynamically using jquery each loop, each td having unique id, my aim is: when click on delete button out side loop, has delete particular td's , empty data particular td. html code : <a class='class_removebutton' id="removeunsupportedfiles" href='javascript:undefined;'>remove unsupported files</a> jquery code working fine individual delete, how delete tds ids : var upfiles = [{ name: "name1" }, { name: "name2" }, { name: "name3" }, { name: "name4" }, { name: "name5" }, { name: "name6" }, { name: "name7" } ]; var int_loop = 1; var flag_tr = 1; $('#total').append("<table width=100%>"); $(upfiles).each(function (index, file) { display_removebutton = "<img width='20px' style='cursor:pointer;' height='20px' class='class_remove' data-i

sql - How do I get the last file from a hot folder using PowerShell? -

this question has answer here: count items in folder powershell 5 answers we have client uploads 1 .pkg file each hour specified folder on our ftp. want create sql server agent job grab file, import data table in sql server db, move , rename file. i successful in doing (using code below) except when there 1 file left. when there 1 file left not import... , moves actual folder file in (renaming folder this). have provided errors below. script: function autoimportcommaflatfilestopone($location, $server, $database) { $connection = new-object system.data.sqlclient.sqlconnection $connection.connectionstring = "data source=" + $server + ";database=" + $database + ";integrated security=true" $files = get-childitem $location $filename = $files[0] $full = $location + $filename $table = "rawusps"

Opencv Write an image with two channel -

how write cv::mat type cv_32fc2 . is possible write 2 channels in tiff file ? or write each channel separately ? if can live (large!) textfile, use filestorage : mat m; // cv_32fc2 filestorage fs("my.yml",filestorage::write); fs << "mat1" << m; // key, value store fs.release(); // flush. filestorage fs1("my.yml",filestorage::read); fs1["mat1"] >> m;

knockout.js - Column name condition when dynamically binding grid in knockout -

i having following tbody dynamic rows , columns: <tbody data-bind="foreach: clientlistingdata"> <tr> <!-- ko foreach: $parent.orderedcolumns --> <!-- if: $parent[orderedcolumns] == 'clientid' --> <td class="greenbg"> <span data-bind="text: $parent[$data]"></span> </td> <!-- /ko --> <!-- if: $parent != 'clientid' --> <td> <span data-bind="text: $parent[$data]"></span> </td> <!-- /ko --> <!-- /ko --> </tr> </tbody> clientlistingdata contains entire grid data in json format , orderedcolumns array object containing column name [clientid,clientname..etc] usng dynamically bind grid. requirement when column name clientid want td have different cs

javascript - How can I fix my JS and jQuery to properly validate input? -

i brand new js , jquery. have written basic html form calculate values , wanting validate each input , test see if contains non-zero value can't figure out. have spent time searching before posting this. remember new take easy on me, please. here script test inputs. $('#ppm_pt').on('change', function () { var input = $(this); var is_num = input.val(); if (is_num) { $('#calculate').prop("disabled", false) } else { $('#calculate').prop("disabled", true) } }); i can work check if there input ppm_pt, instead wanting check inputs of type number in html form , instead of checking value want test against nulls , 0 values. know there way. have tried using each() method unsuccessful. please help. thanks. you doing id selection on element if form like: $('#ppm_pt').on('change', 'input', function () { var input = $(this); var is_num = inpu

java - Web service client class works; but deployment error when used in a servlet -

i using jdeveloper 12c generate 'web client , proxy' wsdl file. worked fine , generated client class test out invocation of service. client works fine. i generated test servlet , ensured worked. i pasted same web service invocation code servlet, , @ deploy time getting exception: caused by: java.lang.noclassdeffounderror: not initialize class weblogic.wsee.jaxws.spi.wlsprovider @ weblogic.wsee.jaxws.servicerefprocessorimpl.parseannotations(servicerefprocessorimpl.java:199) @ weblogic.wsee.jaxws.servicerefprocessorimpl.parseannotations(servicerefprocessorimpl.java:150) @ weblogic.wsee.jaxws.servicerefprocessorimpl.createtargetref(servicerefprocessorimpl.java:106) @ weblogic.wsee.jaxws.servicerefprocessorimpl.bindserviceref(servicerefprocessorimpl.java:385) @ weblogic.application.naming.environmentbuilder.bindserviceref(environmentbuilder.java:1109) @ weblogic.application.naming.environmentbuilder.bindservicereferences(environmentbuilder.java:1073) @ weblogic.applic