Posts

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 ?