Posts

Showing posts from June, 2015

Run a python script from url in terminal -

i wondering way execute python script url (www.blahblah.com/script.py) in terminal without downloading file disk? thanks! do want run on client, or on server (which return results)? if want run on client, it's going have downloaded 1 way or another. easy way download, run, delete: $ wget blahblah.com/script.py && (python script.py; rm script.py) if want run on server, can use cgi mentioned others. depending on want though, may want use web framework instead. for lightweight framework check out flask . documentation excellent , managed , running in day (i'm new both python , web servers).

jsf 2 - JSF Jquery autocomplete setting ID to backing bean not working -

jquery autocomplete in jsf2.0 in xhtml working fine, when trying set value backing bean in select function not getting set, have used <div class="ui-widget" style="font-size: 0.9em; padding-left: 0.3em;" > <label for="organizatiosselectauto">representative organization: </label> <h:inputtext id="organizationselectauto"/> </div> <h:inputtext id="orgidhidden" value="#{lettermbean.orgid}" style="" immediate="true" onchange="submit()" valuechangelistener="#{lettermbean.orgchanged(this)}"/> $(function() { var availabletags = #{jqueryclientlist.arrayobj} ; $( '#organizationselectauto' ).autocomplete({ source: availabletags, minlength: 2, select: function( event, ui ) { alert("id"+ui.item.id); document.getelementbyid('housefrm:orgidhidden').value = ui.item.id; alert("input text vlaue"+document.getelementbyid('housefrm...

c++ - Reference of a pointer returning weird value -

can explain me why code works (why return value)? int main() { int *ptr = new int(113); int &rptr = *ptr; delete ptr; cout << rptr << endl; return 0; } basically, return value get: -572662307 what doing results in undefined behavior, fact you're getting number reasonable behavior. when perform sequence: int *ptr = new int(113); int &rptr = *ptr; the reference rptr refers integer created line new int(113) . on next line, execute delete ptr; this deletes int , meaning object no longer exists. pointers or references reference deallocated object, causes undefined behavior. consequently, when print rptr with cout << rptr << endl; anything can happen. here, you're getting garbage data, program have crashed or reported debug error message. interestingly: value printed (-572662307), treated 32-bit unsigned value, 0xdddddddd. bet memory allocator putting value deallocated memory debug memory errors one. hope helps!

amazon s3 - Rails + Paperclip + AWS S3 has_attached_file method: Why doesn't this String interpolation work? -

here have piece of code should work based on know of string interpolation in ruby. inside model class: "s3_file" basically wahat trying accomplish while saving file aws s3, save them under folder thats created @ runtime using following string interpolations. using devise , cancan authorization , authentication gems the code below works: paperclip.interpolates :prefix |attachment, style| "#{date.today.to_s }/system" end has_attached_file( :upload, :path => ":prefix/:basename.:extension", :storage => :s3, :s3_credentials => {:access_key_id => "xxx", :secret_access_key => "xxx"}, :bucket => "xxx" ) but, trying usersemail , insert paperclip block. code doesn't work desired. result of code not exception @curr_user_email null , result folder on aws s3 has no name. method create folder. how can correct this? this code still not work if(@curr_user_signed_in) @aprefix = "#{date.today.to_s }/#{@curr_...

antlr3 - how to solve this simple antlr recusive issue -

Image
i reading url(and trying copy) , failed...(great article on antlr too)... https://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/antlr/antlr.html my solution before added parenthesis stuff whereclause: expression -> ^(where_clause expression); expression: orexpr; orexpr: andexpr (or^ andexpr)*; andexpr: primaryexpr (and^ primaryexpr)*; primaryexpr: parameterexpr | inexpr | compexpr; my solution failed due infinite recursion (but thought lparen^ , rparen! supposed solve that???).... whereclause: where^ (expression | orexpr); expression: lparen^ orexpr rparen!; orexpr: andexpr (or^ andexpr)*; andexpr: primaryexpr (and^ primaryexpr)*; primaryexpr: parameterexpr | inexpr | compexpr | expression; notice primaryexpr @ bottom has expression tacked on has lparen , rparen can orexpr or expression(ie. first expression can use or not use parens). i sure simple issue dang typo keep staring @ hours or something. thanks, dean i reading url(and trying copy) , failed...

cygwin cannot find android -

hi i'm following android tutorial on ndk (hello-jni) , trying run following command within cygwin android update project -p . -s but following message: -bash: android: command not found i new @ , assume because cygwin isn't hooked android not know how fix this. can help? thanks in advance you need set path , cygwin knows find android program. in here , see line says, set path=e:/android/android-sdk-windows/tools;e:/android/android-ndk-r5b

c++ - MFC Dialog return vector -

i creating modal dialog box , dynamically creating textboxes based on user specified quantity. store values of these textboxes in vector vector <cstring*> textboxtext; i want pass vector when dialog closes. tried passing pointer dialog , updating pointer in: void cradiodialog::onbnclickedok(). however, did not work. don't think can data exchange, there way done? thanks, you can it. ensure return actual cstring objects, not pointers! vector <cstring> textboxtext; what in onbnclickedok ?

java - Finishing an activity brings me back to my first activity -

i'm writing app has multiple activities. activity calls activity b, not expecting result. if button pressed b startsactivityforresult activity c. when activity c done, makes intent of extras needs , finishes. problem when calls this.finish() or finish(), brings me way out activity a. onactivityresult in activity b not called. wrong? activity a: starts activity b intent in = new intent(ccstart.this,mainmenu.class); in.putextra("uid",loginresponse); sharedpreferences settings = getsharedpreferences(prefs_name, 0); sharedpreferences.editor editor = settings.edit(); editor.putstring("usr",text_user.gettext().tostring()); // commit edits! editor.commit(); startactivity(in); activity b: starts activity c result intent intent = new intent(mainmenu.this,filebrowser.class); startactivityforresult(intent,0); activity c: return statement intent result = new intent(); result.putextra("fname", file.getabsolutepath()); this.setresult(activity.result_ok, resul...

css3 - CSS transition image -

Image
this background image: #logo {background-image:url('logo.png');width:20px;height:23px;} #logo:hover {background-position:0 -23px;-webkit-transition: 0.5s ease;} #logo span {margin-left:-3000px;} <a href="#"><div id="logo"><span>logo</span></div></a> this code gives me slide effect (a vertical slide black s pink one) instead of fade effect i'm looking for. creating 2 images, solve issue, not possible in case. how fade affect when using 1 single image? try - http://jsfiddle.net/wds5z/4/ a, #logo { background: url('http://i.stack.imgur.com/w5znn.png') 0 -23px; width: 20px; height: 23px; display: block; } #logo { background-position: 0 0; -webkit-transition: opacity .5s linear; -moz-transition: opacity .5s linear; transition: opacity .5s linear; } #logo:hover { opacity: 0; } #logo span { margin-left:-3000px; }​

Regex nested asterisk -

i found regular expression in old system i'm working on. (\s*)* i'm pretty sure " * " @ end redundant want make sure not doing before remove it. it's causing performance issue when it's used in regex.matches() method point hangs entire system if string used parameter has 25+ spaces does knows if particular syntax has special functionality? ps: pretty huge system can't test every posible scenario assuming inner * greedy, then, yes, think outer 1 redundant. outer * attempts repeat sub-match, there ever 1 instance of sub-match because it's greedy.

css - Div Background Width browser -

i want header background , footer background wide browser window. on top think it´s ok footer background isn´t it on psr like header div, keep footer div outside wrapper . should work fine.

php - add where clause to datatables filtering -

hi trying add custom clause in datatables server side processing file. have managed work when page loads after filtering ignores clause , returns results. code: $swhere = "where customers_id= ".$customersid; if ( isset($_get['ssearch']) && $_get['ssearch'] != "" ) { $swhere = "where ("; ( $i=0 ; $i<count($acolumns) ; $i++ ) { if ( isset($_get['bsearchable_'.$i]) && $_get['bsearchable_'.$i] == "true" ) { $swhere .= "`".$acolumns[$i]."` '%".mysql_real_escape_string( $_get['ssearch'] )."%' or "; } } $swhere = substr_replace( $swhere, "", -3 ); $swhere .= ')'; } /* individual column filtering */ ( $i=0 ; $i<count($acolumns) ; $i++ ) { if ( isset($_get['bsearchable_'.$i]) && $_get['bsearchable_'.$i] == "true" && $_get['ssearch_'.$i] != '' ) { if ( $swhere == "" ) { ...

python - raw_input with limited time? -

is there way give user raw_input, give null response ( "" ) if nothing typed within x amount of time? i'd give user 10 seconds enter options when script starts, if time expires (or press enter), continue script. if know applescript, i'd display dialog "enter options" giving after 10 in python if in unix-land, can use python's signal library , use alarm . otherwise, think raw_input totally thread-blocking. see this answer implementation help.

networking - Security of DNS answers -

i have been searching information regarding topic found no direct answer. possible following happen: pc 1: -opens udp socket in port x -sends request dns server resolve name meanwhile a hacker captures packet in internet, , himself answers request wrong answer can happen? if not, prevents this? dns uses ssl or security mechanism? our operative systems use secure communications dns servers? thanks in advance the scenario present possible. it's 1 of reasons why dnssec invented. dnssec allows resolver client check chain of cryptographic signatures dns record way tree trust anchor (which dns root).

objective c - Why am I getting an ARC error with this method? -

Image
this here method im using display items on screen line cgsize gameareasize = [controller gameareasize]; says receiver type controller2 instance message not declare method selector gameareasize +(id)ship:(controller2*)controller { cgsize gameareasize = [controller gameareasize]; cgpoint center = cgpointmake(gameareasize.width/2, gameareasize.height/2); items2* item = [[items2 alloc] initat:center withradius:16 andimage:@"viper"]; [item setmovetopoint:center]; [item setspeed:.8]; } and after use [controller removeactor:item]; remove item off of screen says same thing not being able call removeactor automatic reference counting issue objective c - why getting arc error method? - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities ...