Posts

Showing posts from May, 2012

Python selenium error when trying to launch firefox -

i getting error when trying open firefox using selenium in ipython notebook. i've looked around , have found similar errors nothing matches error i'm getting. know problem might , how fix it? i'm using firefox 22. the code typed in follows: from selenium import webdriver driver = webdriver.firefox() the error code returns follows: windowserror traceback (most recent call last) <ipython-input-7-fd567e24185f> in <module>() ----> 1 driver = webdriver.firefox() c:\anaconda\lib\site-packages\selenium\webdriver\firefox\webdriver.pyc in __init__(self, firefox_profile, firefox_binary, timeout, capabilities, proxy) 56 remotewebdriver.__init__(self, 57 command_executor=extensionconnection("127.0.0.1", self.profile, ---> 58 self.binary, timeout), 59 desired_capabilities=capabilities) 60 self._is_remote = false c:\anaconda\lib\site-packages\

ruby - NameError: uninitialized constant when trying to execute rails tests -

in rails 3.2.13 app i'm writing right have model called business . model getting fatter , fatter, decided split in two, extracting code related availability rails concern named availability , stored @ models/concerns/business class business module availability extend activesupport::concern availability_open = 1 availability_closed = -1 availability_complete = -2 ... as concerns not enabled in rails default, i've put following line in config/application.rb in order autoload them: config.autoload_paths += %w(#{config.root}/app/models/concerns) the problem that, after split, tests have stopped working, returning nameerror: uninitialized constant availability error. suppose need require concern somehow in tests, haven't managed yet, , don't understand why concern needed in tests doesn't make use of it. the following stack trace returned after running tests: nameerror: uninitialized constant availability (erb):9:i

java - Webservices invocation exception -- where am I going wrong I have this class in classpath -

this webservice. service working fine through java application when make jar , run web project getting exception "severe: exception occurred during processing request: null java.lang.reflect.invocationtargetexception" , @ end caused by: java.lang.noclassdeffounderror: com/oracle/ccpayment

android - Image for item menu action bar sherlock -

Image
i adding 2 images in menu action bar sherlock. image2 big normal size. image appear correctly in device: for recent device (like s4) have problem image appear small. doesn't ok. i using action bar sherlock library if have large number of images displayed app, creating different versions mdpi, hdpi etc may take space , create unacceptable maintenance overhead you. in case suggest resize images dynamically. use following code resize 320 x 200 png , jpg images tablets , fine ... // method display image (tablets only) ... private void display_image(string imagename){ if (istablet(getactivity())){ // tablets debuglog( "display tablet image="+imagename); int resid = getresources().getidentifier(imagename,"drawable", getactivity().getpackagename()); // corresponding resource id if (resid != 0) { bitmap bmp=bitmapfactory.decoderesource(getresources(), resid);

Why might Google Fusion Tables sqlGet queries stop working after Google+ sign-in through gapi.auth? -

i'm writing page uses oauth 2.0 via gapi.auth.authorize authenticate google+ user , gapi.client.request run google fusion tables sqlget queries. find queries run fine before authentication, fail 403 "insufficient permission" error when run more 30 seconds after authentication. the problem demonstrated page: https://googledrive.com/host/0b5urq1jzb1myswlou3nty2m4qnc/test3b.htm please follow these steps: click "query" run gapi.client.request google fusion table sql-get query returning count of rows. run until oauth used in steps 2 , 3. click "start oauth" run immediate:true authorization against google+. if signed google+, user name , id displayed in third button. if google+ user name not displayed in third button, click button ("authorize") , sign google+. click "query" button again. query run without error when pressed within 30 seconds of oauth authorization. after that, query fails 403 error. why? here source dem

Widgets inside Dojo dgrid OnDemandList -

i'm trying similar this question using ondemandlist instead of ondemandgrid. here have far define([ "dojo/_base/declare", "dijit/_widgetbase", "dijit/_templatedmixin", "dijit/_widgetsintemplatemixin", "dgrid/ondemandlist", "widget/categoryitem", "dojo/dom-construct", "dojo/text!./templates/category-list.html" ], function(declare, _widget, _templatedmixin, _widgetsintemplatemixin, ondemandlist, categoryitem, domconstruct, template) { var catlist = declare([ondemandlist]); return declare([_widget, _templatedmixin, _widgetsintemplatemixin], { templatestring: template, baseclass: "category-list", postcreate: function() { this.inherited(arguments); // create ondemandlist, place in div defined in template. var cat1 = this.cat1 = new catlist({ store: this.store,

linux - Problems running terminal command via Python -

i'm working on small project need control console player via python. example command works on linux terminal: mplayer -loop 0 -playlist <(find "/mnt/music/soundtrack" -type f | egrep -i '(\.mp3|\.wav|\.flac|\.ogg|\.avi|\.flv|\.mpeg|\.mpg)'| sort) in python i'm doing following: command = """mplayer -loop 0 -playlist <(find "/mnt/music/soundtrack" -type f | egrep -i '(\.mp3|\.wav|\.flac|\.ogg|\.avi|\.flv|\.mpeg|\.mpg)'| sort)""" os.system(command) the problem when try using python gives me error when run it: sh: 1: syntax error: "(" unexpected i'm confused here because exact same string. why doesn't second method work? thanks. your default user shell bash . python's os.system command calls sh default in linux. a workaround use subprocess.check_call() , pass shell=true argument tell subprocess execute using default user shell. import subprocess command

java - Recursion and Iteration method to locate missing brackets -

for assignment, specification simple. given text file of arbitrary length (possibly thousands of characters). considered correct, must contain matching pairs of brackets { } , [ ] , , ( ) . bracket pairs may nested arbitrary depth (but not need worry stack overflow) arbitrary amounts of text between brackets. file contains no brackets trivially correct. when discover pair of mismatched brackets, must report brackets , index in file. first character in file index 0. example, if file contains file has open { , { followed ) , } , text. program should report mismatch because { @ index 36 closed ) @ index 50. can think of start of file super opening bracket not match closing bracket. if file contains many closing brackets, mismatched opening bracket start of file. should use string stx (old ascii start of text ) report this. example, closing ] has no matching open [. in case, program should report mismatch because stx @ index -1 closed ] @ index 13. similarly, can think of end o

android - How do I fix the pull to refresh time? -

i using following code pull refresh : https://github.com/chrisbanes/android-pulltorefresh however, replace last date , time displays eg: 2:30 pm, july 10 july 10, 2:30 pm. can point out code residing , line can interchange work? thanks! justin in sample code, in each activity (grid/list etc)eg: pulltorefreshlistactivity.java there method called: mpullrefreshlistview.setonrefreshlistener(new onrefreshlistener<listview>() { @override public void onrefresh(pulltorefreshbase<listview> refreshview) { string label = dateutils.formatdatetime(getapplicationcontext(),system.currenttimemillis(), dateutils.format_show_time | dateutils.format_show_date | dateutils.format_abbrev_all); // update lastupdatedlabel refreshview.getloadinglayoutproxy().setlastupdatedlabel(label); // work refresh list here. new getdatatask().execute(); } }); the method updates text : refreshview.getloadinglayoutproxy().setlastupdatedlabel(label); and

Converting a string to a number in R -

i'm having trouble writing function turns string representation of number decimal representation. boil issue down essentials, consider following function: f <- function(x) { y <- as.numeric(x) return(y) } when apply function string "47.418" 47.42, want 47.418. seems return value being rounded reason. any suggestions appreciated you have done print options. no rounding: > f <- function(x) { y <- as.numeric(x); return(y) } > f(47.418) [1] 47.418 ?options the default value digits 7: > options("digits") $digits [1] 7 further questions should accompanied dput() on object in question.

Is Chrome's JavaScript console lazy about evaluating arrays? -

i'll start code: var s = ["hi"]; console.log(s); s[0] = "bye"; console.log(s); simple, right? in response this, firebug says: ["hi"] ["bye"] wonderful, chrome's javascript console (7.0.517.41 beta) says: ["bye"] ["bye"] have done wrong, or chrome's javascript console being exceptionally lazy evaluating array? thanks comment, tec. able find existing unconfirmed webkit bug explains issue: https://bugs.webkit.org/show_bug.cgi?id=35801 (edit: fixed!) there appears debate regarding how of bug , whether it's fixable. seem bad behavior me. troubling me because, in chrome @ least, occurs when code resides in scripts executed (before page loaded), when console open, whenever page refreshed. calling console.log when console not yet active results in reference object being queued, not output console contain. therefore, array (or object), not evaluated until console ready. case of lazy e

Lua hierarchy string to table -

is there way can convert hierarchy string table form? suppose input a.b.c.d ouput should table traverses above input: a = {} a.b = {} a.b.c = {} a.b.c.d = {} thanks. the obvious solution parse string , construct hierarchy table that. more clever solution let lua you. bit of metamagic , function environment manipulation can done: dump = require 'pl.pretty'.dump -- convenient table dumper penlight function createtable(str) local env_mt = {} env_mt.__index = function(t, k) rawset(t, k, setmetatable({}, env_mt)) return rawget(t, k) end local env = setmetatable({}, env_mt) local f = loadstring("return "..str) setfenv(f, env) f() return env end dump( createtable "a.b.c.d" ) this outputs: { = { b = { c = { d = { } } } } }

javascript - Node.js posting date wrong -

i'm posting date elasticsearch , i'n using date.now() var unixtime = date.now(); i'm getting output this: 1373508091156 then use this: var date = new date(unixtime*1000); the output this: thu sep 27 45494 05:19:16 gmt-0400 (edt) i'm not sure why i'm getting wrong date :/ stop multiplying 1,000. problem solved.

vb.net - .Net 4.5 Await Breakpoints -

i couldn't find full example postasync had piece 1 together. therefore, not sure if viewing limitation debugger or did wrong. this trying do: i have go through list , make web service call each item on list. thought use new 4.5 async stuff keep flowing without blocking during each call web service. i've done tone of research , watched jon skeet's video on tekpub, i'm still not sure if doing correctly. is, when set break points async method never returns control caller. seems go along synchronous version. question: is normal debugger appear synchronous or indicate code not implemented correctly? here post method: public async function postsecurexmlasync(byval username string, byval password string, byval xmltosend string) task(of string) dim content = new stringcontent(xmltosend, encoding.utf8, "text/xml") dim credentials = new networkcredential(username, password) dim handler = new httpclienthandler() {.credentials = credenti

Getting rid of console output when freezing Python programs using Pyinstaller -

i have written simple program grandfather using python gui tkinter, , works beautifully using for. however, there is, of course, ugly console output window. have gotten rid of changing extension of file .py .pyw. when freeze using pyinstaller, reappears again! there way me fix this? thanks in advance. if want hide console window, here documentation: how use --noconsole option python pyinstaller.py --noconsole yourscript.py if need using pyinstaller point need use --noconsole option here simple tutorial getting there.

actionscript 3 - AS3 softkeyboard auto slide up -

i having trouble have softkeyboard auto slide on ipad. here code trigger softkeyboard, doesn't work somehow... this.dispatchevent(new softkeyboardevent(softkeyboardevent.soft_keyboard_activating, true, true, null, softkeyboardtrigger.content_triggered)); anyone have suggestion? try this: tf.type = textfieldtype.input; tf.needssoftkeyboard = true; tf.addeventlistener( focusevent.focus_in, onfocus ); private function onfocus( e:focusevent ):void { tf.requestsoftkeyboard(); }

c# - WPF web browser Project, decreasing window size make tool bar items disappear -

<grid> <dockpanel lastchildfill="true" > <tabcontrol x:name="posstabcontrol" dockpanel.dock="top" height="auto" width="auto" verticalalignment="stretch" horizontalalignment="stretch" > <tabitem header="tab page 1" margin="-9,-2,0,-2"> <webbrowser name="webbrowser1" margin="0,36,0,0"></webbrowser> </tabitem> <tabitem rendertransformorigin="0.094,0.5" margin="-2,-2,2,-2" height="25"> <tabitem.headertemplate> <datatemplate> <stackpanel orientation="horizontal"> <image source="images/add.ico" width="19" height="15"></image> </stackpanel>

cocos2d x - Not able to change the background of the scene in cocos2dx android -

i have started game development using cocos2dx. , started helloworld sample game. able run sample game. when try change background color, getting error in **helloworldscene.h** type 'helloworld' must implement inherited pure virtual method 'cocos2d::ccrgbaprotocol::setopacity' **changes:** class helloworld : public cocos2d::cclayercolor and in **helloworldscene.cpp** invalid arguments ' candidates are: bool initwithcolor(const cocos2d::_cccolor4b &, ?, ?) bool initwithcolor(const cocos2d::_cccolor4b &) ' **changes:** cc_break_if(!cclayercolor::initwithcolor(ccc4(255,255,255,255))); i new cocos2dx , c++. there thing left include or what? please me solve issue. thank you. edit: helloworldscene.cpp #include "helloworldscene.h" using namespace cocos2d; using namespace cocosdenshion; ccscene* helloworld::scene() { ccscene * scene = null; { // 'scene' autorelease obje

php - if else statement is not working on codeigniter -

i have few if else statement on returning true or false, , every statement not working properly. have tried many ways don't know problem.it helpful if fix this. here code model function exists($email){ $this->db->where('email',$email); $query=$this->db->get('member_info'); echo "model called"; // after execution text shown not others if ($query->num_rows == 1) { return true; echo "i got one"; }else{ return false; echo "i got nothing"; } } and here controller function is_exists($email){ echo "this loaded"; //this line works if($this->validation_model->exists($email)){ return false; echo "true"; //this doesn't }else{ return true; echo "false"; // doesn't } } you returning function before print echo part. should echo before return.

Not able to access the directory created in HDFS after all the Hadoop deamons are stopped and restarted again -

i new hadoop have couple of problem , yet not able find solution issue goes below: **created directory on hdfs using below command: --bin/hadoop fs -mkdir /user/abhijit/apple_poc **checking if directory has been created: --bin/hadoop fs -ls --(output)-->drwxr-xr-x - abhijit supergroup 0 2013-07-11 11:09 /user/abhijit/apple_poc **stopping hadoop daemons: --bin/stop-all.sh **restarting daemons again: --bin/start-all.sh **again checking if directory on hdfs created above present or not: --bin/hadoop fs -ls --(output): 2013-07-11 11:37:57.304 java[3457:1903] unable load realm info scdynamicstore 13/07/11 11:37:58 info ipc.client: retrying connect server:localhost/127.0.0.1:9000. tried 0 time(s); retry policy retryuptomaximumcountwithfixedsleep(maxretries=10, sleeptime=1 seconds) 13/07/11 11:37:59 info ipc.client: retrying connect server: localhost/127.0.0.1:9000. tried 1 time(s); retry policy retryuptomaximumcountwithfixedsleep(maxretries=10, sleeptime=1 sec

java - Heap size issue in JSF web App -

i building web application using jsf.i using glassfish ssrver.i trying apply watermark on pdf using itext.it working when try apply watermark on pdf document more 30mb (conatains more 5500 pages) , thorw exception. type exception report message descriptionthe server encountered internal error () prevented fulfilling request. exception javax.servlet.servletexception: java.lang.outofmemoryerror: java heap space root cause javax.faces.el.evaluationexception: java.lang.outofmemoryerror: java heap space root cause java.lang.outofmemoryerror: java heap space note full stack traces of exception , root causes available in glassfish server open source edition 3.1.2 logs. while searching solution , found setting program size, can fix this. so put these vmargs - xms6000m -xmx6000m in class's run configuration no effect. unable understand can solution?thanks

perl - Piping to running socat process, But how is this done? -

i have little problem have following situation. i programmed server tool works. no tried test perl. therefore wrote startscript starting processes need testing, , seperate test script. problem following: have start socat prog before server started in start script. how can connect socat process inputs test script? possible? ok sorry confusing description try again: have 2 files: 1 starts processes on server , socat process writing data server process. start other necessary processes here not important problem. second file should write socat process sending server. how can connect running socat process (the process has started before server process started. reason server can connect socat)? short: wanna connect or pipe socat process , not server because server connected socat? i'm using unix system. something this: http://www.thegeekstuff.com/2010/07/perl-tcp-udp-socket-programming/ #!/usr/bin/perl #tcpclient.pl use io::socket::inet; # flush after every wri

wpf - How to Uncheck Menuitem isCheked property in MenuItemClick event -

i able check menuitem not able uncheck , more on showing previous check in menuitem. once click on menuitem doesn't uncheck previous menuitem. i'm adding menuitem code. private void onmenuitemclick(object sender, routedeventargs e) { routedeventargs args = e routedeventargs; menuitem item = args.originalsource menuitem; string header = item.header.tostring(); if (header == "b1") { btnmenu.content = header; item.ischecked=true; } else if (header == "a1") { btnmenu.content = header; item.ischecked=true; } } i applying same menuitems , event handler 4 buttons.so if select 1 menuitem first button show check on menuitem,the checked menu item show appear when click on second button.how can achieve this?..any

android - How can I make my layout have TableRows of equal height? -

Image
my layout this: <scrollview android:id="@+id/scrollview_page1" android:layout_width="300dp" android:layout_height="700dp" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <tablerow android:layout_width="fill_parent" android:layout_height="60dip" android:gravity="right" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/string1" android:id="@+id/textview1"/> <edittext android:id="@+id/edittext1" android:layout_width=&q

javascript game level inheritance -

i'm rewriting game i've designed in flash/as3.0 javascript , having trouble wrapping head around prototypes, having learned classes. i've read ton of info , still not quite sure how apply scenario. so... in as3.0 project had level class, had guts of happens in levels of game, enter_frame functionality etc. extended class each level, level specific details such item placement, terrain details etc... question how efficient , 'proper' way this. right have 2 functions: function level() { //generic level functionality } function level1() { //level1 specific functionality } then i've read should have set level1.prototype = new level(); but have found executes within level function @ runtime, don't want. ideally i'd start button instantiate level1, , level1 have properties , methods of level - and, if possible, execute within level1's , level's constructor when happens... possible? i'm sure it's obvious can't seem click, s

java - What's the advantage of encoding NFC data to Ndef? -

i'm not asking ndef in general - obvious need format data interchange. i'm working on application must read both - non-ndef (mifare classic in particular) , ndef nfc chips. i've separated routines reading both , managed detection part: tag tag = intent.getparcelableextra( nfcadapter.extra_tag ); string[] techlist = tag.gettechlist(); ( string tech : techlist ) { if ( mifareclassic.class.getname().equals( tech ) ) { string uid = byte2hexstring( tag.getid() ); // todo } else if ( ndef.class.getname().equals( tech ) ) { return this.readndef( intent ); } } but i'm not sure the abstraction part - should try encode data non-ndef (mc) chip ndef (if that's possible), or should separate these abstraction layers? there advantage of encoding data ndef? the advantage of using ndef formatted data more portable across different systems. ndef compliant data should work not on android, on windows8 or blackberry devices (with

kernel-based (Linux) data relay between two TCP sockets -

i wrote tcp relay server works peer-to-peer router (supernode). the simplest case 2 opened sockets , data relay between them: clienta <---> server <---> clientb however server have serve 2000 such a-b pairs, ie. 4000 sockets... there 2 known data stream relay implementations in userland (based on socketa.recv() --> socketb.send() , socketb.recv() --> socketa.send() ): using of select / poll functions (non-blocking method) using of threads / forks (blocking method) i used threads in worst case server creates 2*2000 threads! had limit stack size , works right solution? core of question: is there way avoid active data relaying between 2 sockets in userland? it seems there passive way. example can create file descriptor each socket, create 2 pipes , use dup2() - same method stdin/out redirecting. 2 threads useless data relay , can finished/closed. the question if server should ever close sockets , pipes , how know when pipe broken log fact?

portforwarding - SSH local port forwarding on a remote not listening port: the connection succeeds? -

i discovered today if ssh-forward local port x ssh server port y, , no process listening on port y, can still connect local port x (i don't usual "connection refused" error). i did test 2 different ssh clients on windows host connecting linux server. after bit of reflexion, came conclusion pure network point of view, behaviour should expect: ssh client listening on localhost:x, connection possible. nevertheless, leads problematic situation in have apparently connected socket talks nobody. sending data on socket successful operation. so question: ssh protocol manage situation in ways, i.e. have strategies detecting situation? , if yes, may hope support feature on ssh clients , apis (today i'm using ssh.net, not seem offer feature). if not, how proceed detecting situation? timeout on answer? thanks help, alberto. the logical behavior close client connection if server can't connect remote side, not better hanging connection. also there can

to extract .fic to sql server 2012 using Windev -

i have existing data_base using windev want convert database(and extract data (file .fic) windev sql-server 2012 use them . information application called payroll.exe 4.0.0.1 version. version of windev must download extract data ? need in sql-server it?? this depends on version of dll found windev application. example wd170hf.dll windev 17, wd90hf.dll windev 9. the easiest way can think of doing u want either using program called wdmap (it's installed windev). export table xls/csv , import 1 sql-server. far not best or fastest solution will/should work. or use odbc connector (this 1 can downloaded separately if not mistaken). comes windev installation. note on windev u can download & install full version site. u need dongle start ide. (u can use tools (like wdmap) without dongle. officially not allowed install ide if u not have dongle. express version won't allow u edit source files made full version.

html - display row column numbers in myeclipse statusbar -

is there option available in myeclipse showing column numbers of xhtml page. if cursor place in java file automatically row number , column number displayed not in xhtml pages. i've tried 10.7.1 , see line , column in status bar. ensure opening html file myeclipse html editor, myeclipse visual html designer or web page editor, i've tried of , see line , column. there no setting add or remove line , column status bar. however, if open in visual designer, won't see line , column if stay in visual design pane, rather typing in text pane.

javascript - Unable to customize the box to short single line in 'boxplot' type Highcharts -

Image
i able narrow down box single line in boxplot type highcharts. however, need make single line shorter lines @ end below image. code series is: series: [{ name: 'observations', data: [ [760, 848, 848, 848, 965], [733, 939, 939, 939, 1080], [714, 817, 817, 817, 918], [724, 806, 806, 806, 950], [834, 864, 864, 864, 910] ], tooltip: { headerformat: '<em>experiment no {point.key}</em><br/>' } } fiddle link am missing setting? appreciated. unfortunately not possible, can wrap drawpoints function of boxplot, , develop part of code: if (doquartiles) { crispcorr = (pointattr['stroke-width'] % 2) / 2; crispx = mathfloor(crispx) + crispcorr; q1plot = mathfloor(q1plot) + crispcorr; q3plot = mathfloor(q3plot) + crispcorr; left += crispcorr; right += crispcorr; boxpath = [