Posts

Showing posts from March, 2010

Send command via FTP from windows to linux -

i attempting use windows command (in cmd) connect linux server via ftp, send command, , have linux box execute command. can solid connection through ftp, unsure how format command linux machine execute it. there tag should precede code? thanks ftp file transmission. if want execute commands on box you'll have use ssh if on windows putty interactive approach that. if searching automated solution, install cygwin (+ ssh client )

c# - Load log4net.dll from alternate location -

i have custom .net dll component called ms access via com interop. because msaccess.exe calling process, default attempt locate assemblies .config file, , referenced ddls, @ location ms access installed. because of deployment concerns, want of custom code run separate location, not within ms office folder structure. i've been able force assembly load it's configuration information custom location using: appdomain.currentdomain.setdata("app_config_file", custompath); typeof(configurationmanager) .getfield("s_initstate", bindingflags.nonpublic | bindingflags.static) .setvalue(null, 0); typeof(configurationmanager) .getfield("s_configsystem", bindingflags.nonpublic | bindingflags.static) .setvalue(null, null); typeof(configurationmanager) .assembly.gettypes() .where(x => x.fullname ==...

Database connection error. Magento 1.7 with correct login info using PHP 5.4 -

while trying connect installation wizard, database connection error. though able set-up basic user-login on codegniter same database using same credentials. should eleminate common assumption. other potential issues? this in root directory, while have magento working fine on same server, using different domain name under /magento directory. i have scoured web , put in 12 hours little luck on resolving this. using fastcgi / suphp , have changed file permissions 755 / 644. updates... while testing new .zip file magento site on server worked previously, found same issue. have changed these downloads , issue? tried tar file , both servers show error... the page isn't redirecting firefox has detected server redirecting request address in way never complete. problem can caused disabling or refusing accept cookies. all of these errors, not experiencing while testing magento before attempting take real-world service. found setting worked best on apache. chrome says... ...

php - Which will load faster in the browser: including images in HTML as DataURLs, or using the normal img tag with src url? -

we're generating our pages in php , want make generated pages load possible in browser. when generating pages (which .html pages) realized have 2 options: page data url images <html> <head></head> <body> <img src="data:image/png;base64,blahblahblah1" /> <img src="data:image/png;base64,blahblahblah2" /> <img src="data:image/png;base64,blahblahblah3" /> </body> </html> page "normal" images <html> <head></head> <body> <img src="/images/image1.png" /> <img src="/images/image2.png" /> <img src="/images/image3.png" /> </body> </html> there pros/cons of dataurl: pros: fewer trips browser server (there 1 trip) - given generated nature, , needing maintain , css, using sprites not work on project less bandwidth usage on smaller imag...

c# - How do I add a new Table or Grid to a WPF TableCell? -

i can add text wpf table cell using: cell.blocks.add(new paragraph(new run("example text"))); what i'd able add object within cell such table or grid. possible? you cannot add grid tablecell ... tablecell can host elements deriving block msdn: tablecell elements may host 1 or more flow content elements deriving block. valid content elements tablecell include: blockuicontainer list paragraph section table the easisest way add other elements tablecell in xaml... <tablecell><paragraph fontsize="14pt" fontweight="bold">planet</paragraph></tablecell>

javascript - MongoDb map-reduce exception -

i have following prototype : { "_id" : "nwva", "cat" : { "_id" : objectid("4ffee943e4b08a66fd8e84a1"), "slug" : "fun" }, "imp" : false, "int" : { "comm" : 0, "fblk" : 1, "fbsh" : 0 } } and following map reduce function: var mapfunction1 = function() { if (!this.int || (typeof this.int != 'object')) { this.int = {}; } var lk = this.int.lk; var dlk = this.int.dlk; ..... ..... }; when have prototype without field "int" , i've got error: javascript execution failed: map reduce failed:{ "errmsg" : "exception: javascript execution failed: typeerror: cannot read property 'lk' of undefined near '= this.int.lk; \t\tvar dlk = this.int.dlk' (line 5)", "code" : 16722, "ok" : ...

php - Send email with attachment via PHPMailer -

i'm preparing create form page website require many fields user fill out , sent specified email. so far i've created dummy php email page gets message, 1 attachment, , recipient email address using google's smtp. here's code uploadtest.html: <body> <h1>test upload</h1> <form action="email.php" method="get"> message: <input type="text" name="message"> email: <input type="text" name="email"><br> attach file: <input type="file" name="file" id="file"> <input type="submit"> </form> </body> uploadtest.html user see here's code email.php: <?php require("class.phpmailer.php"); $mail = new phpmailer(); $recipiant = $_get["email"]; $message = $_get["message"]; $mail->issmtp(); // telling class use smtp $mail->smtpauth = true;...

python - Django-cron not executing job -

i trying use django-cron regularly run script on django server. seems though cronscheduler registering test class "class ran" prints terminal, have not found indication job run (i.e. have not seen "job ran" printed terminal). in case shouldn't have been relying on printing know if job running, watched django_cron_job table in database few minutes see if job's "last_run" value changed after sending request server found did not. just know: each time test have been hitting server 1 request job start, have modified cron_polling_frequency in settings file lower run_every value specify job, , ensured job set queued per posts' suggestion: similar problem . in order solve error getting ("attributeerror: 'settings' object has no attribute 'project_dir'"), set project_dir os.path.dirname(__file__) in settings.py. problem? i following when start server i've looked , couldn't find reason why problem: "...

asp.net - Sys.WebForms.PageRequestManagerTimeoutException during server-side debug -

Image
often during debug of server-side vb.net/c# code executed inside of asp.net partial postack (updatepanel, other controls ajax behaviors) getting client-side error: at point not care client-side (and @ runtime not happening). it's major annoyance during debug - there way prevent it? this happens when have asp scriptmanager ajax processing. control has default async postback timeout of 90 seconds, after throw exception. the solution rather simple: add asp tag during debug extend timeout long debug session might take you: <asp:scriptmanager id="scriptmanager1" runat="server" asyncpostbacktimeout="3600"> </asp:scriptmanager> the above let me run debug session 1 hour before throwing exception. don't forget remove tag production releases, or hung loop etc, never time out. jeff

windows - Possible to schedule a task to the second with schtasks? -

i have file creates scheduled task using schtasks: <?php $cur_dt = new datetime('now'); $cur_dt->add(new dateinterval('pt60s')); $cmd = 'schtasks /create /sc once /ru uname /rp pwd /tn "repost_labor" /tr "' . $fname . '" /st ' . $cur_dt->format('h:i:s') . ' /sd ' . $cur_dt->format('y/m/d'); exec($cmd, $out, $retval); ?> so generates looks this: schtasks /create /sc once /ru uname /rp pwd /tn "repost_labor" /tr "myfile.bat" /st 12:52:12 /sd 2013/07/23 however, though trying set seconds, task scheduler ignores , adds hour & minute. if current time 12:51:12, instead of above creating task @ 12:52:12, creates @ 12:52:00. why task scheduler ignore seconds? is there workaround? thanks! i haven't tried yet, think possible schedule second creating xml task file , using: schtasks /create /xml <filename> because can include seconds in xml. ...

xslt - msxsl:node-set() not recognized -

i trying pull nodes out of node set stored in variable using msxsl:node-set() function , not getting anything. xml looks this: <root> <items olditemnumber="100" newitemnumber="200"> <item itemnumber="100" itemaliascode="1001" itemcode="x" /> <item itemnumber="100" itemaliascode="1002" itemcode="x" /> <item itemnumber="200" itemaliascode="2001" itemcode="x" /> <item itemnumber="200" itemaliascode="2003" itemcode="x" /> <item itemnumber="100" itemaliascode="1003" itemcode="p" /> <item itemnumber="100" itemaliascode="1004" itemcode="p" /> <item itemnumber="200" itemaliascode="2002" itemcode="p" /> </items> </root> in xslt try populate variable subset of nod...

python - How can I delete plot lines that are created with Mouse Over Event in Matplolib? -

i'm created vertical , horizontal line in plot mouseover event. lines intend user select click in plot. problem when mouse moves on plot, lines previous drawn don't disappear. can explain me how it? used ax.lines.pop() after draw plot inside onover function doesn't worked. this code i'm using from matplotlib import pyplot plt import numpy np fig = plt.figure() ax = fig.add_subplot(111) ax.plot(np.random.rand(10)) def onclick(event): print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%( event.button, event.x, event.y, event.xdata, event.ydata) def onover(event): x = event.xdata y = event.ydata ax.axhline(y) ax.axvline(x) plt.draw() did = fig.canvas.mpl_connect('motion_notify_event', onover) #iii = fig.canvas.mpl_disconnect(did) # rid of click-handler cid = fig.canvas.mpl_connect('button_press_event', onclick) plt.show() thanks in advance help. ivo you need remove lines not want. exam...

Convert Windows dll of C functions for use in Python in Linux -

is possible convert windows dll file containing c functions use in python program in linux? i'm able call c functions in python in windows, not python in linux. there other way use dll file linux python? if don't have source code recompile linux (assuming it's easy), might able make work installing windows version of python in wine .

python - Insert MySQL timestamp column value with SqlAlchemy -

i have sqlalchemy class mapping database table in mysql innodb. table has several columns , able populate them except timestamp column: the mapping: class harvestsources(base): __table__ = table('harvested', metadata, autoload=true) the column on mysql timestamp has current_timestamp default value, when insert row it's being filled null. if default not working need manually set timestamp, how either of them. sqlalchemy code insert row table: source = harvestsources() source.url = url source.raw_data = data source.date = ? db.session.add(source) db.session.commit() datetime objects converted timestamps, can use: from datetime import datetime ... source.date = datetime.now() or datetime.utcnow() if want save using utc. default ( current_timestamp ) uses local timezone, datetime.now() closer - should preferrable store time related data in utc, , timezone conversions when presenting data user.

java - Eclipse Kepler not starting with specified vm -

i've modified eclipse.ini to: -vm c:\users\myuser\java\jdk1.7.0_25\bin\javaw.exe -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20130521-0416 -product org.eclipse.epp.package.jee.product --launcher.defaultaction openfile --launcher.xxmaxpermsize 256m -showsplash org.eclipse.platform --launcher.xxmaxpermsize 256m --launcher.defaultaction openfile --launcher.appendvmargs -vmargs -dosgi.requiredjavaversion=1.6 -xms40m -xmx512m in process explorer, see exe started with: c:\windows\system32\javaw.exe why not picking specified vm? in console, java -version anywhere reflects 1 i'd use, path fine. the -vm switch needs on 2 lines. try this: -vm c:\users\myuser\java\jdk1.7.0_25\bin\javaw.exe

Update table records with jquery and mysql using php -

i need updating selected item list populated via php , updated jquery, here have: my update.php front-end <?php include_once('db.php'); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>update collected</title> <link rel="stylesheet" href="css/style.css" type="text/css" media="print, projection, screen" /> <link rel="stylesheet" href="css/bootstrap.css" type="text/css" media="screen" /> <link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css" media="screen" /> </head> <body> <?php $sql=...

promise - Chain parameters between async functions with Q in node.js -

how can chain parameters need both async functions. the first function fs.readfile returns content of file in callback function second parameter. the second function marked requires content first parameter. second parameter optional , can options object. third parameter callback should give me converted content second parameter. currently i've tried code: var readfile = q.nfbind(fs.readfile); var md = q.nfbind(marked); readfile(filename, 'utf8') .then(md) .then(function (html) { res.setheader('content-type', 'text/html'); res.setheader('content-length', html.length); res.status(200); res.end(html); }) .catch(function (error) { res.setheader('content-type', 'text/plain'); res.send(500, 'server error: ' + error); res.end(); }) .done(); but doesn't work, because marked function needs second parameter when called callback function third parameter. how can set secon...

msysgit - When using mysygit (GitGui), is there a log of the git bash commands executed? -

i new using git , use msysgit gitgui exclusively because need basic pulls , pushes. when need help, of answers find given git bash not me gitgui. in order able understand doing gutgui in terms of git bash commands, wondering if gitgui keeps log of git bash commands executed actions gitgui actions? once have can better understand doing in gitgui git bash commands , make better use of gitgui. yes. can start git-gui --trace flag. on windows opens 2 windows: git-gui , tcl console logs executed commands git-gui [1] [proj. wiki] . can open console during running git-gui ctrl + f2 , , turn on logging with: set _trace 1 . but keep in mind commands "low-level" , shouldn't used during normal git usage.

sql - How to fix an error where no records come up if the phrase has an apostrophe in an MS access database? -

i have question how submit queries include apostrophe in access database. example, want search records have "women's health" in title. when try search that, no records come though there records include phrase. if search women health, records come up. how can overcome problem apostrophe? i've tried searching previous questions , of them should use " " in sql query using , still doesn't solve problem. don't have technical background, can give me advice on how fix query can search apostrophes? query below. thanks! select [off-site records].[file name], [off-site records].unit, [off-site records].branch, [off-site records].division, [off-site records].[date sent], [off-site records].[archives (yes/no)], [off-site records].[date range], [off-site records].[accession number], off-site records].[box #], [off-site records].[file name], [off-site records].id, [off-site records].[file name], [off-site records].[file...

Remove trailing pipes - '|' in c# -

i have string looks this: "pid||000000|z123345|23345|someone^firstname^^^miss^||150|f|1111||1 dreyfus close^south city^county^^post code^^^||0123 45678910^prn^ph^^^^0123 45678910^^~^^cp^^^^^^~^net^^^^^^^||||1a|||||a||||||||n||||||||||"; i trying remove separating '|' characters after 30th '|' in string output string looks this: "pid||000000|z123345|23345|someone^firstname^^^miss^||150|f|1111||1 dreyfus close^south city^county^^post code^^^||0123 45678910^prn^ph^^^^0123 45678910^^~^^cp^^^^^^~^net^^^^^^^||||1a|||||a||||||||n"; i trying using little code possible, not having luck. or ideas great. you can use trimend method string text = "stuff||||n||||||||||"; string result = text.trimend('|'); //result stuff||||n

apache - Django (mod_wsgi) - HttpBasicAuthentication using view decorator - AttributeError -

i'm writing small app. wish use view decorator found. here the snippet , , a post describing usage . have apache server (2.2) running, , django up-to-date. i've decorated view, , when trying it, attributeerror occurs: request method: request url: http://localhost/redb/test/ django version: 1.5.1 python version: 2.7.5 installed applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'redb_app') installed middleware: ('django.middleware.common.commonmiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware') traceback: file "c:\python27\lib\s...

php - Can I use a dynamic model in variable settings? -

i have code $this->loadmodel($model); $this->task->id = $id; $this->task->save($this->data[$model]); how can setup "task" model can make dynamic because doesn't work: $this->loadmodel($model); $this->$model->id = $id; $this->$model->save($this->data[$model]); i tried no luck: $this->loadmodel($model); $this->currentmodel = $model; $this->currentmodel->id = $id; $this->currentmodel->save($this->data[$model]); try one... <?php // dynamic model app::import('model', $model); $this->dynamicmodel = new $model; // usage example function getmodelcolumns($model){ app::import('model', $model); $this->dynamicmodel = new $model; print_r($this->dynamicmodel->getcolumntypes());exit(); } ?>

ios - XCode WorkSpace Files -

i have base projects share several static libraries. base projects don't reference each other. base projects have files have same file name, not same file. cause issues? ask because when command click on function, takes me function in other project. can 2 projects, in same workspace, have files same name long don't reference each other? i broke base projects own workspaces. workspaces contain same static libraries. fixed issue i'd command click method , xcode take me wrong file (correct file name/method name wrong project).

wpf - How does is the blend interaction functionality implemented? -

out of curiosity, i'd know how blend interaction (such in following example) functionality works behind hood. is interaction kind of attached property? how have elements of control using different namespace? does know of tutorial or goes through implementation of this? i.e how barebones wpf framework , no other frameworks <textbox> <i:interaction.triggers> <i:eventtrigger eventname="lostfocus"> ... </i:eventtrigger> </i:interaction.triggers> </textbox> interaction class, triggers attached property, access attached properties, can set on control. recommend reading the documentation .

swing - Java: How to use a cardholder with multiple classes -

i'm programming in java, trying use cardholder in order switch between 2 jpanels each extension of own class. think understand basic concepts having errors in current revision, when calling classes. i'm getting null pointer exception , think it's structural problem i'm not sure how or why. the main method points class public class skeleton implements actionlistener{ jpanel cardholder; cardlayout cards; string carda = "a"; string cardb = "b"; jpanel jboard; jpanel jmenu; jframe frame2; board board; menu menu; boolean menuset; boolean boardset; timer timer; public class switcher implements actionlistener{ string card; switcher(string card){ this.card = card; } @override public void actionperformed(actionevent e) { cards.show(cardholder, card); } } public skeleton(jframe frame){ jpanel menu = new menu(); jpanel board = new board(); jframe frame2 = frame; timer = new timer(5, this); timer.start(); ...

actionscript 3 - Gravity only working after a keystoke AS3 -

here problem, new programming , following tutorial learn random things. have gotten work far except gravity. when run program player floating, when hit "down" key gravity takes effect.. can't figure out why. if(leftbumping){ if(xspeed < 0){ xspeed *= -0.5; } } if(rightbumping){ if(xspeed > 0){ xspeed *= -0.5; } } if(upbumping){ if(yspeed < 0){ yspeed *= -0.5; } } if(downbumping){ if(yspeed > 0){ yspeed *= 0.0; } } else { yspeed += gravityconstant; } i have trace on bumping collisions , work properly. if in open space detect no collision, , when touching walls output shows am. iv been reworking these lines hours. please help this may also if(apressed){ xspeed -= speedconstant; } else if (dpressed){ xspeed += speedconstant; } if (wpressed){ yspeed -= speedconstant; } else if(spressed){ yspeed += speedconstant; } if(leftbumping){ if(xspeed < 0){ ...

ios - libMobileGestalt copySystemVersionDictionaryValue -

my app goes crash after installed new update app store , sometime log says - libmobilegestalt copysystemversiondictionaryvalue: not lookup releasetype system version dictionary anyone familiar it?? one of customer provided log. jul 23 15:57:49 ami-sandlers-iphone backboardd[26] : als: setdisplayfactor: factor=0.0500 jul 23 15:57:50 ami-sandlers-iphone backboardd[26] : als: setdisplayfactor: factor=1.0000 jul 23 16:00:24 ami-sandlers-iphone backboardd[26] : com.demandmedia.traileraddict.ios.free failed resume in time jul 23 16:00:24 ami-sandlers-iphone backboardd[26] : forcing crash report of traileraddict[4919]... jul 23 16:00:24 ami-sandlers-iphone backboardd[26] : finished crash reporting. jul 23 16:00:24 ami-sandlers-iphone com.apple.launchd[1] (uikitapplication:com.demandmedia.traileraddict.ios.free[0xeab9][4919]) : (uikitapplication:com.demandmedia.traileraddict.ios.free[0xeab9]) exited: killed: 9 jul 23 16:00:24 ami-sandlers-iphone backboardd[26] : application 'ui...

c++ - How to check a pointer is pointing heap or stack memory on iOS? -

this analogue another question , anyway looking platform specific way if exists on ios. developing apple platform means non-apple based toolset not applicable. wish find platform native way this. because simple google search gave me this( heap command) , i'm sure there's api function too. i looking debug build assertion detect case of deleting stack-allocated object. it's enough know address pointing - stack or heap. performance, version compatibility, internal api or quality concerns doesn't matter. (maybe testing on simulator can option) think not heavy operation if stack separated heap. i tagged c++, api in other language fine if applicable c++. if use gnu gcc compiler , glibc on ios believe can use mprobe() - if fails memory block either corrupted or stack memory block. http://www.gnu.org/software/libc/manual/html_node/heap-consistency-checking.html updated post os portable heap detection: otherwise, make own heap memory manager overridin...

Google App Engine - javax.servlet.UnavailableException: Initialization failed -

i'm old user of gae, recently, after updates of os x mavericks dp4 , java sdk(1.6, 1.7, 1.8) , goolge app engine sdk(1.8.1, 1.8.2), cannot start gae application again, , stack trace seems confusing, know why? works fine on local machine, once deployed hosting platform, cannot started, every request results following stack trace, project configured 1. use jdk1.7 (also, have tried 1.6) 2. use sdk1.8.2 (also tried 1.8.1, no luck) 2013-07-23 16:32:01.525 /_ah/spi/backendservice.logmessages 500 504ms 19kb 10.43.73.135 - - [23/jul/2013:16:32:01 -0700] "post /_ah/spi/backendservice.logmessages http/1.1" 500 19888 - - "3-dot-goo-apple.appspot.com" ms=504 cpu_ms=240 cpm_usd=0.002223 pending_ms=183 app_engine_release=1.8.2 instance=00c61b117c6d26217f5ce7350f5ea3e519ed8765 w 2013-07-23 16:32:01.508 exception java.lang.illegalargumentexception @ com.google.appengine.runtime.request.process-42b947a416991b23(request.java) @ java.lang.classloader.loadclass(clas...

Indentation of groovy style method parameters in emacs -

i using emacs groovy electric mode (installed outlined here ). relevant parts (i think) of .emacs file given @ end of question. the current behaviour getting indenting, type, is: def someobject = new something( param1 everything how @ point, type ':' character, becomes: def someobject = new something( param1: i want param/value pairs (and follow) remain indented 1 level, before, e.g.: def someobject = new something( param1: val1, param2: val2 ) .emacs excerpt: (electric-indent-mode t) (setq-default tab-width 4) (setq-default indent-tabs-mode nil) (setq indent-line-function 'insert-tab) (setq tabify nil) (setq-default c-basic-offset 4) (delete-selection-mode 1) (set-default-font "-apple-bitstream_vera_sans_mono-medium-normal-normal-*-*-*-*-*-m-0-iso10646-1") (setq load-path (cons "~/.emacs.d/" load-path)) (add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") (setq whitespace-action '(auto-cleanup))...

In vim, is there a way to cancel a search *without* resetting the cursor position? -

in vim, have hlsearch , incsearch turned on. when start search, goes first match. if press return accept search, result highlighted , cursor positioned @ first match. if press esc cancel, cursor position reset wherever when started search. is there way in case make esc cancel search leave cursor position on first match? way i'd end in right spot without highlighted. thanks! you use :nohl after hitting <enter> cancel highlighting. you make easy switch between highlight mode , non-highlight mode using mapping: " put in vimrc nnoremap <space> :set hls!<cr> alternately, use mapping clear out current search term. " put in vimrc nnoremap <space> :let @/=""<cr>

list - How to get name of directory (NOT subdirectory) and filename with PHP? -

i have following folder structure. want names of directories (not subdirectories) , files . how can php? thank you. main directory directory1 subdirectory1 file1 file2 subdirectory2 file3 file4 directory2 subdirectory3 file5 file6 subdirectory4 file7 file8 result should that: directory: directory1 file: file1 file: file2 directory: directory2 file: file3 file: file4 try directoryiterator,here example $path = dirname(dirname(__file__)); $it = new directoryiterator($path); while($it->valid()){ /*....*/ echo $it->getpathname().'">'.$it->getbasename(); $it->next();//i forgot }

hadoop - access file from hive streaming script in c# (HDInsight) -

i'm using hive streaming job process data in c# on hdinsight. in order process data, script has read xml file stored blob on azure so: operationcontext oc = new operationcontext(); cloudstorageaccount account = new cloudstorageaccount(new storagecredentials(asvaccount, asvkey), true); cloudblobclient client = account.createcloudblobclient(); cloudblobcontainer container = client.getcontainerreference("mycontainer"); cloudblockblob blob = container.getblockblobreference("file/f.xml"); memorystream stream; using (stream = new memorystream()) { blob.downloadtostream(stream); stream.seek(0, seekorigin.begin); string reader = new streamreader(stream).readtoend(); elem = xelement.parse(reader); return elem; } the code works on local machine: reads file storage account , returns elem correctly, when try run on cluster, has problem ...

pycharm - How to specify that a parameter is a list of specific objects in Python docstrings -

i using docstrings in python specify type parameters when projects beyond size. i'm having trouble finding standard use specify parameter list of specific objects, e.g. in haskell types i'd use [string] or [a]. current standard (recognisable pycharm editor): def stringify(listofobjects): """ :type listofobjects: list """ return ", ".join(map(str, listofobjects)) what i'd prefer: option 1 def stringify(listofobjects): """ :type listofobjects: list<object> """ return ", ".join(map(str, listofobjects)) option 2 def stringify(listofobjects): """ :type listofobjects: [object] """ return ", ".join(map(str, listofobjects)) i suppose wasn't great example - more relevant use case 1 objects in list must of specific type. better example class food(object): def __init__(self, cal...

How to load Rails Session from session_id? -

i using myapp::application.config.session_store :active_record_store in application store sessions in database. works fine. however, i'd able load specific session when passed session_id . value server stores cookie on client side. my rails application has client can't use cookies, has pass me session_id in parameter. i'd use before_action or sort of filter take parameter , use load session in controllers instead of app loading null session due lack of proper cookies. is there way can this? don't want turn off cookie method altogether because web client uses cookies, it's mobile client can't. edit: if declare class session < activerecord::base , session.find_by_session_id('whatever') session activerecord object, i'm not sure how make usable session in normal rails sense. just request.session_options[:id] = "whatever want" in before_action filter , rails use session_id load session when access (thanks lazy l...

html - PHP DomXPath encoding issue after xpath -

if use echo $doc->savehtml(); show characters accordingly , once reaches xml? @ xpath extract element , issues again. i cant seem display characters properly. how convert properly. i'm getting: 婢跺繐顒滈拺鍙ョ瀵偓鐞涱偊鈧繑妲戦挅鍕綍婢舵牕顨� 闂€鍌溾敄缂侊綀濮虫稉濠呫€� 娑擃叀顣荤純鎴犵綍閺冭泛鐨绘總鍏呯瑐鐞涳綀鏉藉▎ instead of proper chinese: <head><meta http-equiv="x-ua-compatible" content="ie=edge"><meta charset="gbk"/></head> my php code: $html = file_get_contents('http://item.taobao.com/item.htm?spm=a2106.m874.1000384.41.ag3kbi&id=20811635147&_u=o1ffj7oi9ad3&scm=1029.newlist-0.1.16&ppath=&sku='); $doc = new domdocument(); // based on article http://stackoverflow.com/questions/11309194/php-domdocument-failing-to-handle-utf-8-characters/11310258#11310258 $searchpage = mb_convert_encoding($html,"html-entities","gbk"); $doc->loadhtml($searchpage); // echo $doc->savehtml(); $xpath = new domxpath($doc); $el...

logic - Does PHP if statement assume you are checking for 'true' if left blank? -

i once thought read somewhere if have php script this: public function test($something){ if($something == "true"){ return true; }else{ return false; } } if(test("true")){ echo "returned true"; } then should work fine if statement assumes checking if true when left blank? true, , if 'good programming' leave blank or should finish off statement sake of not cutting corners? if($variable) is pretty saying if($variable != null && $variable != false && $variable != 0) so long variable set , not equal 0 or false evaluated true "and if 'good programming' leave blank or should finish off statement sake of not cutting corners?" if trying evaluate equal true, cutting corners, pretty common use if($variable) confirm $variable defined value

php - mysqli prepared statement doesn't seem to work -

i have following code: <?php if(!empty($_post)){ $db = new mysqli('localhost', 'root', '', 'verif1'); $password = $_post['pass']; $username = $_post['user']; $table = "admins"; $password = hash("sha256", $password); $statement = $db->prepare("select count(*) {$table} username = ? , password = ?"); $statement->bind_param("ss", $username, $password); $statement->execute(); $statement->bind_result($numrows); if($numrows == 1){ echo "yeah correct!<br>"; }else{ echo "no :(<br>"; } } ?> <form action="" method="post"> <input type="textbox" name="user"> <br> <input type="password" name="pass"> <br> <input type="submit"> </form> i'm sure correc...

mysql - Converting varchar to date displays 0000-00-00 -

i trying convert column date format. in varchar , displays as: 12/06/2013 i run following query; update dispatch set dispatchdate = date_format(str_to_date(dispatchdate, '%d/%m/%y'), '%d-%m-%y'); alter table dispatch change dispatchdate dispatchdate date; however after running query, displays data as: 0000-00-00 i trying change display dd-mm-yyyy not yyyy-mm-dd 0000-00-00 mysql's special way of displaying "zero" or "dummy" date . like many of mysql's oddities, learn live , suggest you: update dispatch set dispatchdate = null dispatchdate = '0000-00-00' or set whatever value works best you.

Tell "ls -laR /": do not recurse into other filesystems -

i "ls -lar /" on system , offsite backup results. if disaster strikes, i'll @ least know files i've lost. i started sshfs mounting remote systems, yielding 2 problems: "ls -lar" on sshfs mounted systems painfully slow i don't need "ls -lar" results of remote filesystems, @ least not locally. what's ls equivalent of find's "-xdev" option or du's "-x" option? in case there's better way it, goal efficiently list of files on hard drive size, owner, mod time, etc. in other words, info "ls -l" provide. i've considered: "find / -xdev | xargs ls -la", sense less efficient. there no such option ls itself, can do find / -xdev -ls or if not sufficiently detailed, possibilities offered -printf option.

asp.net - Web page request be aborted in Firefox -

Image
i have created asp.net web application , host in iis ,but there aborted message on firebug status column when access web page .why?

php - str_replace only a certain part of printed string? -

i have ran problem. want replace part in parenthesis, problem if value in parenthesis 1 or else in same part ([x(xxx:x:x)xx];), end replacing also, need x(value) @ end of each part. [0(267:0:0)x1];[1(257:0:0)x1];[2(256:0:0)x1];[3(258:0:0)x1];[4(261:0:0)x1]; [5(262:0:0)x64];[6(320:0:0)x10];[7(17:0:0)x32];[8(295:0:0)x2];[9(35:0:0)x2];[10(44:1:1)x6];[11(0:0:0)x1];[12(0:0:0)x1];[13(0:0:0)x1];[14(0:0:0)x1];[15(0:0:0)x1];[16(0:0:0)x1];[17(0:0:0)x1];[18(0:0:0)x1];[19(0:0:0)x1];[20(0:0:0)x1];[21(0:0:0)x1];[22(0:0:0)x1];[23(0:0:0)x1];[24(0:0:0)x1];[25(0:0:0)x1];[26(0:0:0)x1];[27(0:0:0)x1];[28(0:0:0)x1];[29(0:0:0)x1];[30(0:0:0)x1];[31(0:0:0)x1];[32(0:0:0)x1];[33(0:0:0)x1];[34(0:0:0)x1];[35(0:0:0)x1];[103(0:0:0)x1];[102(0:0:0)x1];[101(0:0:0)x1];[100(0:0:0)x1]; i cannot working. if try replace 1 value in part in parenthesis, ends changing of 1's on printed part. also keep in mind zero's in parenthesis won't 0's. here's tried: $items = $row['inventory'];...

multiple Inheritance in C# 4.0 -

presently doing study multiple inheritance.i read lots of article , blogs related it.i read lots of question on stackoverflow.during study read answer of 1 of member of stackoverflow c# 4.0 support multiple inheritance.now want discussion experts on stackoverflow it. please tell me how support multiple inheritance. c# not support true multiple inheritance , believe never will. multiple interface implementation has been supported since day 1 of c#.

Git branching model implementation -

i'm trying understand how can impelement branching model described here . am right infer on origin there 2 branches - master , develop, whereas additional branches releases, features , hotfixes created locally? or of these should created in origin? could please clarify phrase: each developer pulls , pushes origin. besides centralized push-pull relationships, each developer may pull changes other peers form sub teams...technically, means nothing more alice has defined git remote, named bob, pointing bob’s repository, , vice versa i'm particularly confused alice has defined git remote, named bob, pointing bob’s repository where did define it? on server or locally? all of them should created in origin, time colleague might want specific branch. if run git remote command shows remote repositories. it's origin there. may want define repository of other person remote repository. more details remote repositories here the phrase a...

php - Binding issues of slash with quotes -

i using php mysql-pdo , symfony issue : have query stated below status in (:status) with value of status a','b . and when bind sting escaping below status in ('a\',\'b') and hence wrong output. pleass help prepared statement can represent complete data literal only . not part of literal, nor complex expression, nor identifier. either string or number only. thus, query doesn't work binding complex expression, not because of quotes one have create query placeholders representing every array member, , bind array values execution: $ids = array(1,2,3); $stm = $pdo->prepare("select * t id in (?,?,?)"); $stm->execute($ids); to make query more flexible, it's better create string ?s dynamically: $ids = array(1,2,3); $in = str_repeat('?,', count($arr) - 1) . '?'; $sql = "select * table column in ($in)"; $stm = $db->prepare($sql); $stm->execute($ids); $data = $stm->fetchall(...