Posts

Showing posts from January, 2012

php - set language in html dom parser -

i scrpping data site, default in french , have english version well. problem when scrap data it, return html in french, there not paramter set english in url, can add that. have tried in html tag <html xmlns="http://www.w3.org/tr/html5/" lang="en" itemscope="" itemtype="http://schema.org/localbusiness"> and <body id="lang-en" class="site-duproprio prov-qc"> but no luck. here website want scrap data. http://duproprio.com/search/?hash=/g-re=13/s-filter=forsale/pa-ge=1/ any appreciated :) this site keeps language in session. before want scrape data in english must visit http://duproprio.com/gotoen if use curl relevant question curl - cookies , sessions .

jquery checkbox check not working -

i have small script,with straight function. if checkbox not checked, if user clicked on show div otherwise hide div when user clicks in it. script (its inside php code ): echo '<script> $(document).ready(function(){ if($("#chk_id'.$bank_name.'").is(":checked")) { $("#chk_id'.$bank_name.'").click(function(){ $("#form_show'.$bank_name.'").hide(300); }); } else { $("#chk_id'.$bank_name.'").click(function(){ //alert("ddd"); $("#form_show'.$bank_name.'").show(300); }); } }); </script>'; but problem although show div working, unable hide div ! whats wrong? javascript library : <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> try this: $(document).ready(function(){ $('body').on('click', "#chk_id'.$bank_name.'",

android - Can't find whats wrong in the syntax to delete a row in sqlite -

im trying delete row table given name value in row using following line of code: db.delete(table, column_name+"="+ col_value, null); created table using: db.execsql("create table"+ table+"("+column_name+" text," +id+" integer primary key)"); logcat shows npe @ line of deleting row. whats wrong there in it? logcat: 07-31 18:00:13.267: e/androidruntime(1264): java.lang.illegalstateexception: not execute method of activity 07-31 18:00:13.267: e/androidruntime(1264): @ android.view.view$1.onclick(view.java:2072) 07-31 18:00:13.267: e/androidruntime(1264): @ android.view.view.performclick(view.java:2408) 07-31 18:00:13.267: e/androidruntime(1264): @ android.view.view$performclick.run(view.java:8816) 07-31 18:00:13.267: e/androidruntime(1264): @ android.os.handler.handlecallback(handler.java:587) 07-31 18:00:13.267: e/androidruntime(1264): @ android.os.handler.dispatchmessage(handler.java:92) 07-31 18:00:13

facebook graph feed some fields by some users a missing -

very strange. feed group valid token. users 1 or more fields missing. field "picture" sometime field status. in normal view of group shown. is bug fields in graph feed missing? can't explain myself. thanks help!

java - Create Excel Chart within Excel File -

i exporting data system. want visualize these datasets in excel chart. have found , old, closed question, solution missing. charts should redraw when change datafield, excel standard, guess. i think may work way: export data create manually chart ms-excel save , load template in other future exports do know how poi using java? import of chart template? till apache poi limitation saying "you can not create charts. can create chart in excel, modify chart data values using hssf , write new spreadsheet out. possible because poi attempts keep existing records intact far possible". however in case, have created chart manually on excel sheet using named ranges, , using java, updating named ranges per requirement. since chart based on named ranges updated. for updation please check here

android - AsyncTask not show progress dialog immediate -

i used suggestion in this have same problem yet. friend suggestion using asynctask not worked me. what? code : dbasynctask dba = new dbasynctask(this, xmlcommand); dba.inprocess = true; dba.execute(""); while (dba.inprocess) { try { thread.sleep(200); println("wwwwait"); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } public class dbasynctask extends asynctask<string, void, string> { public boolean inprocess; public dbasynctask(exircommandrunner commandrunner,xmlnode xmlcommand) { this.commandrunner = commandrunner; this.xmlcommand = xmlcommand; } @override protected void onpostexecute(string result) { exirdebugger.println("onpostexecute"); } @override protected void onpreexecute() { showprogress(); } @override protected stri

ruby 1.9.3 - Rspec test issue not producing proper response -

i receive following response when try run rspec tests. user.respond_to?(:name) should "true" following error instead (added) **nameerror: undefined local variable or method `user' main:object (irb):2 /users/mwsage/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start' /users/mwsage/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start' /users/mwsage/.rvm/gems/ruby-1.9.3-p429@rails3tutorial2nded/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>' script/rails:6:in `require' script/rails:6:in `<main>' instead of receiving "true" or "false" response. ideas? from gemfile gem 'rails', '3.2.13' gem 'rspec-rails', '2.11.0' ruby '1.9.3' here exact test , erro hartl tutorial 6.2.2 validating presence user = user.new(name: &qu

objective c - Error while running ios device from xcode -

this question has answer here: the identity 'iphone developer' doesn't match valid, non-expired certificate/private key pair in keychains 1 answer i creating app in ios cordova(2.1.0) framework. when build app device selected in xcode, gives me following error: **the identity 'iphone developer: balh-blah (xxxxxxxx)' doesn't match valid, non-expired certificate/private key pair in keychains.** can me on urgently becoming bottleneck. have tried deleting derived data project, doesn't solve issue. also, provisioning profile select in build settings has not expired. in advance. the same issue discussed under following post: xcode - iphone - profile doesn't match valid certificate-/private-key pair in default keychain must point out of may 1st application submitted app store cordova version less 2.5.0 rejected( http://phonegap

amazon ec2 - Syntax issue with sending email via mutt on EC2 -

i'm trying send email amazon ec2 node using mutt , i'm getting error i'm assuming syntax can't see i'm doing wrong. i'm trying send email txt attachment echo "sending test" | mutt -a test.txt -s "test email" name@emaildomain.com however following errors: can't stat name@emaildomain.com: no such file or directory name@emaildomain.com: unable attach file it trying attach file name of email don't understand why. appreciated in recent versions of mutt -a option designed allow multiple arguments can -a *.txt attach number of files match pattern. because of must last option used , separated recipients -- : echo sending test | mutt -s "test email" -a test.txt -- name@example.com

c# - How do I check if WebClient download is completed before I execute a function? -

i trying json files different urls. how make sure both files downloaded before try execute else. my code looks this: webclient url1 = new webclient(); url1.downloadstringcompleted += new downloadstringcompletedeventhandler(url1_downloadstringcompleted); url1.downloadstringasync(new uri("http://example.com")); webclient url2 = new webclient(); url2.downloadstringcompleted += new downloadstringcompletedeventhandler(url2_downloadstringcompleted); url2.downloadstringasync(new uri("http://anotherexample.com")); dosomethingwithjson(); void url1_downloadstringcompleted(object sender, downloadstringcompletedeventargs e) { if (e.error != null) return; json1 = jobject.parse(e.result); } void url2_downloadstringcompleted(object sender, downloadstringcompletedeventargs e) { if (e.error != null) return; json2 = jobject.parse(e.result); } right now, happens json1 , json2 returns null values whenever try display them in messagebox i

Cross platform mobile framework -

i looking building intranet based app can support different mobile platforms. i have looked phonegap, sencha touch , jquery mobile. confused how business logic can incorporated on client side ? input appreciated. phonegap web browser has access native apis. can use more or less technology normal web browser can interpret. with in mind, business logic have general options: 1) create api somewhere on server , make ajax calls application and/or 2) use javascript. language can used business logic inside phonegap (beside native java, objective-c , etc).

java - How to attach() and detach() instead of add() and remove() to save fragment view -

i have following code actionbar : private class mytablistener implements actionbar.tablistener { private fragment mfragment; private final activity mactivity; private final string mfrag; public mytablistener( activity activity, string fragname ) { mactivity = activity; mfrag = fragname; } @override public void ontabreselected( tab tab, fragmenttransaction ft ) { // todo auto-generated method stub } @override public void ontabselected( tab tab, fragmenttransaction ft ) { mfragment = fragment.instantiate( mactivity, mfrag ); ft.add( android.r.id.content, mfragment ); } @override public void ontabunselected( tab tab, fragmenttransaction ft ) { ft.remove( mfragment ); mfragment = null; } } i have textboxes within tab fragments , switching between tabs forces app lose data added textbox. instead of add , remove , use attach , detach saves fragment

C (cpp) extension in Python works on one machine but does not on the other -

sorry if question bit vague, , might not appropriate @ stackoverflow, giving shot, maybe have clue reason or give ways test, problem is. i have c (cpp?) extension works fine on 13.04 lubuntu gcc 4.7.3, python 2.7.4, numpy 1.7.1 not work in 12.04 ubuntu gcc 4.6.3, python 2.7.3, numpy 1.6.1 on machine. seems build/install fine, when try run thing, gives me error: typeerror: array type 7 didn't match expected type -1 i not want spam build codes, include 2 codes, think main. first cpp file #define py_array_unique_symbol j_sad_pyarray #include "common/jassert.h" #include "python.h" #include "numpy/arrayobject.h" #include "common/jpythoncommon.h" extern "c" pyobject *sad_correlation(pyobject *self, pyobject *args) { // inputs pyarrayobject *a, *b; // list of coordinates input polygons (2d double numpy array) // parse input arrays *args if (!pyarg_parsetuple(ar

performance - Heroku web dynos often slowing down but never getting more than 20% load? -

Image
a couple of times day see response time of 1 of our heroku web dynos increase tremendously. have been analyzing little success far. one strange thing see, however, following. @ "instances running" graph new relic: you see we've played around number of web dyno's, majority of time have had 2 dynos 4 unicorn processes each. never ever these instances seem "full load". how should interpret this? @ time sum of cpu usage of instances never exceeds approx. 20%? , if so, seems we're underutilizing our dynos. can optimize here? for clarity: average memory usage constant between 110mb , 120mb, not seem bottleneck. have seen http://news.rapgenius.com/james-somers-herokus-ugly-secret-lyrics ? heroku has worked on addressing this, you'll need talk them further recommendations.

null - "Value does not fall within the expected range" on C# for adding a bug on HPQC -

this function supposed add new defect on hpqc. gives "value not fall within expected range" when null in .additem(). know might problem? public static void addbug() { string qcurl = "link hpqc"; string qcdomain = "domain"; string qcproject = "project"; string qcloginname = "name"; string qcpassword = "pass"; tdconnection connection = new tdconnection(); connection.initconnectionex(qcurl); connection.connectprojectex(qcdomain, qcproject, qcloginname, qcpassword); bugfactory bugfactory = connection.bugfactory; bug bug = bugfactory.additem(null); bug.status = "new"; bug.project = "qcintegration"; bug.summary = "short description of bug"; bug.detectedby = "aaron evans"; bug.assignedto = "nobody";

php - combine rows from fgetcsv arrays -

basically have csv file order information on it, ordered website, containing invoice number, name, address, etc. i've used php turn invoices. looks pretty i'm stuck on 1 bit. here's opening bit using fgetcsv; <?php $file_handle = fopen("orders.csv", "r"); while (!feof($file_handle) ) { $csvline = fgetcsv($file_handle, 1024); ?> in csv file, if has ordered more 1 item appears on new row same invoice number row before, doesn't show product in first row of invoice number: 100001,bradley manning,email1@address.com,address,product a, 100002,mr snowden,email2@address.com,address,product a, 100003,dr dre,email3@address.com,address,,, 100003,,,,,,,,,,"product a", 100003,,,,,,,,,,"product b", 100003,,,,,,,,,"product c", the php takes these values (eg. $csvline[0] invoice number) , puts them in nice printable html file. need able rows beginning same invoice number onto same html table (in cell below first order

testing - how to use jacoco.exec report -

i generated code coverage report jacoco, jacoco.exec . don't know how use ... the way generated through command line: java -javaagent:/path/to/jacocoagent.jar=include=some.package.*,output=file org.junit.runner.junitcore some.package.classtest then got jacoco.exec report. need number of percentage, , using command line only. there way convert report readable txt file? thanks all per this thread can't use generated jacoco.exec directly produce report. can download jacoco's sample build.xml , use produce report, instead. you'll need make these changes build.xml: set the paths to your downloaded jacocoant.jar your jacoco.exec your project source code your compiled project class files i changed default target "report". run typing "ant" , reports generated.

How to convert money to decimal in SQL Server stored procedure -

i have stored procedure want convert money type decimal type. @money = 513.9010 type money i want convert decimal - how that? select convert(decimal(7,4),@money)

Filter out similar data SQL Server 2008 -

i using sql server 2008 , navicat . need filter search results in next way: 1. data - id 2. 24 - 1 3. 24 - 3 4. 50 - 5 5. 50 - 8 i need leave 1 data max id value (distinct inside query doesn't work because data i'm looking not unique), result should be: 1. data - id 3. 24 - 3 5. 50 8 all rest similar data values should filtered out. in advance! select data,max(id) tablename group data

objective c - NSDate timeIntervalSinceNow and local timezone? -

i'm doing calculation find nstimeinterval between known futuredate (which in gmt/utc) , current time (and timezone) device resides. nstimeinterval approachinterval = [futuredate timeintervalsincenow]; i know nsdate not store timezone specific data, rather being calculated when date needs displaying on device. my question initial tests (i'm in gmt+0001) seems nstimeinterval returned not account local timezone. have manually calculate timezone offset , remove interval, , best way of doing given can't supply nsdate correct timezone (using timeintervalsincedate: example) nsdate represents single point in time. not have (and not need!!) time zone. "a known futuredate (which in gmt/utc)" or "i can't supply nsdate correct timezone" not make sense. [futuredate timeintervalsincenow] returns time interval between futuredate , current date , time , independent of time zones. if not expected result, perhaps calculation of future

validation - XHTML strict validate colour and text formatting -

i'm meant create page qualify xhtml strict , can't seem create page effects want satisfy criteria. i'd top part reads "encycopedia galactica" white background , black text , subsequent lower text retain gradient yellow green background purple text- can't seem quite right! perhaps 1 of kind enough point me in correct direction. <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <!-- s. mathieu english july 29, 2013 tutorial 9 --> <title>tutorial project 9</title> <style type="text/css"> body { /* ie10 consumer preview */ background-image: -ms-radial-gradient(left center, ellipse farthest-corner, #fff596 0%, #a8ef92 100%); /* mozilla firefox */ background-image: -moz-radial-gradient(left center, ellipse farthest-corner, #fff596 0%, #a8ef92 100%); /* opera */ background-image: -o-radial-gr

Passing a null DateTime to php function -

i have function in php want accept either datetime object or null. e.g. function foo(datetime $adate){ if ($adate == null){ echo "you passed null variable"; } else { echo "you passed date " . $adate->format('y-m-d'); } } trouble is, because function expects datetime object flips out when pass null , gives error: catchable fatal error: argument 1 passed foo() must instance of datetime, null given,... how can pass null function , avoid error? change this: function foo(datetime $adate){ to this: function foo($adate){ but if still want make sure object passed datetime object can this: function foo(datetime $adate = null){ see here more examples of type hinting.

Django exception when trying to show a DateTimeField on an admin form -

i have model defines datetimefield: dateadded = models.datetimefield("date added", auto_now_add=true) in modeladmin subclass i'm trying show field in following field set: fieldsets = ( (none, { 'fields': ( ("modelid", "altmodelids", "modelname", "dateadded"), ("manufacturer", "protocol", "category"), ("versionadded", "proonly", "published", "discontinued"), "notes" ) }), but following error: fielderror: unknown field(s) (dateadded) specified device interestingly, though, when add list_display: list_display = ("modelname", "published", "modelid", "altmodelids", "manufacturer", "protocol", "category", "dateadded") it works fine. i'm sure i'm doing stupid (i've been aw

URL checking function returns false? PHP -

first of all, not sure @ all, of sql injections, xss attacks etc, occurs via url, using parameters. so wondered, if clean them , detect if there illegal word, if yes, exit 404 page. so function: private static function cleanpath() { if (isset($_get)) { $count = 0; $illegal = array ( '<?', '<?php', '?>', '(', ')', '{', '}', 'select', '*', 'from', 'where', 'select', 'from', 'where', 'delete', 'delete', 'echo', 'print', 'html', 'div', 'class', 'function', 'prepare', 'query', 'execute', 'exec_', '_', '++', 'bindvalue', 'static', '$'

php curl cookie_session and relocation -

situation: when entering site, sets session cookie , redirects itself. problem: when using curl follow_relocation , cookie_session , not apply cookie after redirect , ends maximum redirection limit reached error. code: curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_cookiesession, 1); curl_setopt($ch, curlopt_interface, $ip); curl_setopt($ch, curlopt_verbose, 1); verbose output: * connect() www.thesite.org port 80 (#0) * trying x.x.x.254... * name 'x.x.29.61' family 2 resolved 'x.x.29.61' family 2 * local port: 0 * connected * connected www.thesite.org (x.x.x.254) port 80 (#0) > / http/1.1 host: www.thesite.org accept: */* < http/1.1 302 moved temporarily < date: wed, 31 jul 2013 15:14:05 gmt < server: apache < cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 < pragma: no-cache < expires: mon, 17 j

php - CURL Error while making request: SSL connect error (error code: 35) -

when try connect bigcommerce's webdav server php, following error message: curl error while making request: ssl connect error (error code: 35) i using sabredav client library php wrapper around curl. i same error if use curl command line. i using centos 6.3, php 5.3.3, curl 7.19.7. i tried on several different machines: curl -v https://www.example.com/ on machines got ssl error 35, , on worked no error message. suspected there difference in curl version being used, or else related packages ssl certs. tried updating packages on server needed. turned out updating network security services (nss) package fixed problem. yum update nss

wpf - How to connect ICommand and VisualStateManager together -

how can let controls on window know states should changed. have use icommand , since controls can have different states (enable/disable , checked/unchecked ...) have handle them visualstatemanager. this possible scenario: when record button clicked(checked) other controls in window should uncheckable , once recording finished should checkable , many other scenarios. any appreciated. thanks. you can achieve of interaction , interactivity. see if helps. add below references in xaml xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" you can bind icommand , provide visualstate name applied when button clicked <button> <i:interaction.triggers> <i:eventtrigger eventname="click"> <i:invokecommandaction command="{binding youricommand}" /> <ei:gotostateaction statename="yo

c# - Nuget creates specificly versioned references to assemblies in projects -

my team experiencing issue when using nuget package management creates references in project specific versions of dll. there way stop nuget creating these tightly coupled references? a bit of background. we using nuget manage our internal shared libraries. packages installed using vs ui. nuget packages created using nuget.exe spec , nuget.exe pack on .csproj file. we use standard branching strategy of mainline dev done on trunk , release off rc branch. we didn't want enter versioning hell naming of our packages x.y.z-build123 because dev may need local build away our ci system , use test downstream solutions. our answer simplify our package versioning saying trunk builds x.y.z-staging , rc build named x.y.z enable dev local build , of nuget.exe install pointing repository on dev's machine use build in downstream solutions. without having update packages etc. the problem seeing while works fine @ package level. builds failing references in projects specific file ve

sql - mysql date range ignores end date in result -

i not getting result till '2013-07-31' instead 1 day before enddate. how can add 1 day in '2013-07-31' select * employee admissiondate>='2013-01-01' , admissiondate<='2013-07-31' 2013-07-31 12:00:00 neither smaller nor equal 2013-07-31 . to fix either strip off time part datetime column using date() select * employee date(admissiondate) between '2013-01-01' , '2013-07-31' but won't make use of indexes. or add time part this select * employee admissiondate >= '2013-01-01' , admissiondate <= '2013-07-31 23:59:59' sqlfiddle demo

python - Rename deseralized fields in Colander -

i'm using colander convert json strings python objects , vice versa in pyramid/cornice based project. is there way can serialize/deserialize different names/keys ? here colander schema: class commentschema(mappingschema): resource_id = schemanode(int(), name="resourceid", location="body") text = schemanode(string(), name="text", location="body") and here input json {"text":"hello!", "resourceid":12} it being converted : {u'text': u'hello!', u'resourceid': 12} here question, can have same input json converted following? {u'full_text': u'hello!', u'resource_id': 12} thanks help. i had manually. whatever received json used construct data object. object have custom function map data desired output format, , pass output serializer: data_schema = dataschema().deserialize(self.request.json) data_obj = dataobject(data_schema**) //

sql - Retrieve only the first row with ORDER BY -

i have table contains salary increase history (oracle) emp_id - employee identification, inc_date - date salary changed , inc_amount - amount of change in salary. inc_amount last inc_date. emp_pay_inc: ============================== emp_id | inc_date | inc_amount ============================== 625 | 1/1/2002 | 0 625 | 5/6/2003 | 12000 625 | 1/7/2004 | 35000 625 | 8/1/2009 | -5000 pseudo code query do: select epi.inc_amt emp_pay_inc epi epi.inc_date = max(epi.inc_date) -- know won't work, illustration what have tried (i didn't want use sub-query in event there duplicate inc_date same emp_id : select epi.inc_amt emp_pay_inc epi rownum = 1 order epi.inc_date but doesn't work. returns inc_amount 0 inc_date 1/1/2002. apparently oracle stores rownum appear in original table not data set returned query. you should able use subquery this: select * (select epi.inc_amt emp_pay_inc epi order epi.inc_date desc) rownum = 1;

how does u-boot maps peripheral memory? -

i confused how registers(for ex: uart controller) mapped in u-boot? memory mapped in ddr? if yes how? if not meaning of "peripheral addresses memory mapped" in u-boot? welcome stackoverflow. the registers mapped ram memory address space @ hardware level using different type of interconnects in soc. e.g lets take example of omap 35x series , see how uart registers mapped ram memory address space of soc , how may access them in u-boot. in technical reference manual omap 35x , table 2-3. l4-core memory space mapping , see base address uart1 0x4806a000 , size (of ram occupies) 4kb. it means registers uart1 mapped ram memory space in 4kb region starting @ address. to access register of uart1, need know offset base address actual address. these offsets can found in table 17-39 uart irda cir register summary . once know actual address make pointer register using unsigned int * (base_address + offset) once have pointer can de-reference read/write regis

Opening a file produces a java.lang.NullPointerException -

i have jframe , on frame have jbutton, want when file clicked user can load file using java jfilechooser. i declare filechooser this. jfilechooser fc; and here code in action listener button. jbutton btnload = new jbutton("load .txt"); btnload.addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { int returnval = fc.showopendialog(openfile.this); if (returnval == jfilechooser.approve_option) { file file = fc.getselectedfile(); //this real application open file. system.out.println("opening: " + file.getname() + "."); } else { system.out.println("open command cancelled user."); } } }); the error producing me is exception in thread "awt-eventqueue-0" java.lang.nullpointerexception @ maple.netflix$2.actionperformed(netflix.java:73) @ javax.sw

Going through Google Maps API tutorial, stuck at first step, example has problems -

i experimenting google maps api because need integrate them in website. i copied , pasted code here in page: https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple . i took code javascript , html tab , copied blank html file. doing so, input text box , geocode button appear. it not browser issue because tried more one. got no obvious errors on page checking firefly in opera. i put alert @ end of every function , seem called when expected. alerts have been removed in case wants take @ code in page. i not able more specific, because have started @ map api today , don't know way around much. my page copied , pasted code here: http://velositeraptor.com/gymfit/trainer/geotest.html it helpful if helped me through first step take there. thanks! on viewing source code, seems your path reference stylesheet wrong . <link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet"> ch

How to name a Matlab output file using input from a text file -

i trying take input text file in format: processed_kplr010074716-2009131105131_llc.fits.txt processed_kplr010074716-2009166043257_llc.fits.txt processed_kplr010074716-2009259160929_llc.fits.txt etc.... (there several hundred lines) and use input name output files matlab loop. each time loop ends, process results , save them file such as: matlab_processed_kplr010074716-2009131105131_llc.fits.txt this make identifying object has been processed easier can id number , not of sort through list of random saved filenames. need save plots generated in each loop in similar fashion. have far: filenames = fopen('file_list_1.txt', 'rt'); intext = textscan(filenames, '%s'); outtext = [intext]'; fclose(filenames) j:numel(data) %do stuff save(strcat('matlab_',outtext(j),'.txt')) print(plot, '-djpeg', strcat(outtext(j),'.txt')) end any appreciated, thanks. if want use save command save text file, need use -ascii ta

FadeIn Div at Mouse Cursor on Keypress [Javascript/JQuery] -

i'm trying make dynamic javascript menu (contained in div) appear @ visitor's mouse coordinates when press ctrl+m on keyboard (m signifying menu, , ctrl+m not being bound in browsers far i'm aware). way, wherever on site , wherever mouse is, can pull menu pressing combination , return wherever wish go. @ same time, having menu not shown until press key allows me control design experience without having worry nav menu. i've pulled 2 different pieces of code found on here in attempt myself, i'm running unexpected issue. i'm not sure how denote ctrl+m key combination in event handler. i'm getting couple of errors on code checker i'm not sure how fix myself. i'm not sure how make menu appears on ctrl+m, , stays there until ctrl+m pressed again (a toggle switch). i'm still learning how javascript works. here's link progress i've made far: http://jsfiddle.net/nrz4z/ in example, you're binding mousemove handler

node.js - Node Express parses request body with JSON incorrectly -

i sending json object web client, looks this: {"audioencoder":{"settings":{"1":{"audio_bitrate":"16000"}}}} and in request req.body.myvalue : {"audioencoder":{"settings":[null,{"audio_bitrate":"16000"}]}} in network panel of browser see correct value though: myvalue[audioencoder][settings][1][audio_bitrate]:16000 error expecting object key {1:... [null:... . any ideas why happen? i suspect browser isn't sending json, it's sending application/x-www-form-urlencoded . not correct value if trying have browser send json: myvalue[audioencoder][settings][1][audio_bitrate]:16000 . that's not json. check request headers content-type , @ raw body of request verify this. if post browser js that's sending ajax, can fix that. jquery makes little tricky specify options correctly send json.

javascript - Value of the variable becomes empty when accessed outside the function in node js -

i have following code : for(var index in workload.elements) { var arr = []; var resourceidentifiers = {}; var elementinfo = {}; var metadatamodified = {}; elementinfo = workload.elements[index]; arr[index] = workload.elements[index].uri; if(workload.elements[index].parameters.imageuri) { arr.push(workload.elements[index].parameters.imageuri); } resourceidentifiers = arr.join(','); console.log('uri' + resourceidentifiers); // connects mysql , fetch data mysql.elementlevelpricing(resourceidentifiers, function(result){ elementlevelpricingsummary = json.stringify(result,null,2); console.log('resultin' + elementlevelpricingsummary); }); console.log('resultout' + json.stringify(elementlevelpricingsummary,null,2)) } the value of variable elementlevelpricingsummary becomes

python - Need more than 1 value to unpack -

i writing following code create dictionary: for a,b,c in foo: d=float(a or 0)-float(b or 0) bar[c]=d print bar this works gives me bar on , over. when try use bar outside loop, following error; valueerror: need more 1 value unpack that error message means trying store 1 value in tuple requires more 1 value. >>>(x,y,z) = [5] valueerror: need more 1 value unpack you should somewhere in code assigning tuple. seems foo list of tuples. maybe trying assign element of foo

java - Failed to execute MAVEN goal using netbeans 7.3.1, JDK 7x64 does not work on Win 8 64-bit -

i'm new , i'm starting maven using netbeans install 7.3.1, jdk 7x64, formatted win 8 64-bit machine have problems netbeans or maven've tried everything, create variables java_home, installed maven netbeans matter , have same error. i've used virtualbox win xp , perfect running maven, have no connection error not use proxy, in win 8 not work, turned off antivirus, firewall mvn.bat -darchetypegroupid=org.codehaus.mojo.archetypes -darchetypeartifactid=webapp-javaee6 -darchetypeversion=1.5 -darchetyperepository=http://repo.maven.apache.org/maven2 -dgroupid=com.mycompany -dartifactid=mavenproject1 -dversion=1.0-snapshot -dpackage=com.mycompany.mavenproject1 -dbasedir=c:\\users\\jaime\\documents\\netbeansprojects -darchetype.interactive=false --batch-mode archetype:generate -x -e downloading: http://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar downloading: http://repo.maven.apache.org/maven2/org/apache/ant/ant/1.8.1/ant-1.8.1.j

html - Creating mobile different look than existing site? -

looking bit of advice more anything. i have desktop version of site here, want mobile version of. charlesregionalcareers.org i've built sites in responsive manners before, thing layout desiring in mobile version looks different desktop make sense create mobile template of page... possible have if visited site in mobile device, bring mobile page that's redirected desktop version? any guidance appreciated your best bet use css media queries. if use user agent based redirection, may lower sites rankings in google. for example if every page redirects mobile sites homepage on mobiles, decrease rankings on google.

Unregister and register again in java NIO -

is possible unregister , register again later on same selector ? have limit amount of connection accept , key.cancel() stop receiving op_accept events. server.register(selector, selectionkey.op_accept); ... key.cancel() ... if connection closed, cant run register(..) again, getting java.nio.channels.cancelledkeyexception javadoc register(..) : throw cancelledkeyexception if channel registered given selector corresponding key has been cancelled what way achieve trying ? just clear bits want clear in key's interestops : example key.interestops(0) .

c# - Linq query where clause returning null -

this xml file trying tag element posted_status posted_status has ready <?xml version="1.0" encoding="utf-8"?> <server> <network> <---network parent element <posted_status id="10">ready</posted_status> <timed_on id="10">7/28/2013 9:32:10 am</timed_on> <timed_off id="10">8/28/2013 9:32:10 am</timed_off> </network> </server> i having problem linq query returning null. trying query xml element. element name posted_status . tag value "ready". trying tag posted_status posted_status equal "ready". // query's tag tag equals ready ienumerable<xelement> expiration = exp in main.elements("posted_status") (string)exp.element("posted_status").value == "ready" select exp; this execute or calls query action , display values posted_status x

jquery animate - Move the background image of the div element with purely CSS -

i'm trying move background image of div element purely css. here i'm taking input background-image url user, thats why can't declare in css. cannot declare image position fixed or absolute affect rest of css. there way write css background of div element? fiddle- jsfiddle.net/ztsg9 html: <div class="view" style="background-image: url('http://css3slideshow.remabledesigns.com/1.jpg')">according new report anandtech, samsung might fibbing way more favorable galaxy s4 benchmarks. has device come crawl? of course hasn’t; benchmarks shouldn’t change perception of flagship powerful s4. still, it’s embarrassing samsung resort such technical tactics, allegedly using code dubbed “benchmarkbooster.” yes, device takes steroids.</div> css: .view { position:relative; height:100%; width:100%; top:0; left:0; animation:mymove 5s infinite; -webkit-animation:mymove 5s infinite; /* safari , chrome */ } @keyfr

Android Preferences screen appears underneath subscreen -

Image
in android, have screen preferences (see first screen shot). user clicks on "choose balls" , sub screen displayed (see 2nd screen shot). however, first screen still displayed underneath 2nd screen, e.g. can see "choose balls" when subscreen displayed. how prevent this? <?xml version="1.0" encoding="utf-8"?> <preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" > android:title="@string/livewallpaper_settings"> <preferencescreen android:key="ball_color_category_key" android:persistent="false" android:title="@string/ballcolor" > <preferencecategory android:title="@string/livewallpaper_settings" > <checkboxpreference android:defaultvalue="true" android:key="redball" android:summary="display red ball."

mapreduce - XML data via API to Land in Hadoop -

we receiving huge amounts of xml data via api. in-order handle large data set, planning in hadoop. needed in understanding how efficiently bring data hadoop. tools available ? there possibility of bringing data real-time ? please provide inputs. thanks help. since receiving huge amounts of data, appropriate way, imho, use aggregation tool flume . flume distributed, reliable, , available service efficiently collecting, aggregating, , moving large amounts of data hadoop cluster different types of sources. you can write custom sources based on needs collect data. might fins link helpful started. presents custom flume source designed connect twitter streaming api , ingest tweets in raw json format hdfs. try similar xml data. you might wanna have @ apache chukwa same thing. hth

java - Running JUnit tests that depend on resources defined in WebSphere -

i've written unit tests reference classes reference other classes have dependencies on jdbc resources defined in websphere. unit tests in question don't trigger database reads or writes, classes refer created spring , spring config file tries inject jdbc resources them. spring fails, error message: 2013-07-31 13:46:17,008:could not load application context org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource' defined in class path resource [myapplication.xml]: invocation of init method failed; nested exception javax.naming.serviceunavailableexception: not obtain initial context due communication failure. since no provider url specified, default provider url of "corbaloc:iiop:1.0@mymachinename.mycompany.com:2809/nameservice" used. make sure bootstrap address information in url correct , target name server running. possible causes other incorrect bootstrap address or unavailable name server include network enviro

http - URL parameters and backbone routing -

backbone.js maintains routing information in url after hash mark, e.g.: http://localhost:3000#page/hardware/table/?action=details&actiontargetid=5&actiontargetname=10.3.177.185&actiontarget=host even though routing information in format ?p1=v1&p2=v2&p3=v3, portion not technically part of url query string since comes after hash mark. my question if add actual query string our app's urls this: http://localhost:3000?newparam=newvalue#page/hardware/table/?action=details&actiontargetid=5&actiontargetname=10.3.177.185&actiontarget=host is there possibility of "newparam" url parameter interfering backbone portion? the problem not creating legit query string. mixing route parameters. your example formatted as: domain ? param # route ? other params as questionmark appears in url after interpreted query string. (in case) route. personally suggest using html5 pushstate. backbone.history.start({pushstate: true}) this gi