Posts

google app engine - Asynchronous requests in AppEngine -

i'm building app following: get user enter parameters. pass params backend , start task based on params. when task complete redirect user page showing results of task. the problem here task expected take quite long. hoping make request asynchronous. appengine allow ? if not, options ? looking @ documentation task queues. while satisfies part of i'm trying do, i'm not clear on how queue notifies client when task complete, redirect can initiated. also, if results of task have returned calling client ? possible ? you can't (shouldn't really) wait completion, gae not designed that. launch task, task id (unique, persisted in app) , send id client in response launch request. the client can check, either polling (at reasonable rate) or on-demand, status page (you can use id find right task). can add progress/eta info on page, down road if desire. after task completes next status check request client can redirected results page mentioned. this...

darwin - What is '@_silgen_name' in Swift language? -

while reading darwin library in swift 2.2, found below codes. @warn_unused_result @_silgen_name("_swift_darwin_sem_open2") internal func _swift_darwin_sem_open2( name: unsafepointer<cchar>, _ oflag: cint ) -> unsafemutablepointer<sem_t> what '@_silgen_name' in 2nd line? i found below information here , want more detail information, apple developer library. if it’s specific set of swift functions want call c, can use @_silgen_name attribute override mangled name, and/or make them @convention(c) use c calling convention. @_silgen_name renamed @asmname ( see following commit ) following commit message: this reflects fact attribute's only compiler-internal use , , isn't equivalent c's asm attribute, since doesn't change calling convention c-compatible. so general swift developer, 1 wouldn't come across attribute, unless working with, say, porting swift other platform. now, @_silgen_name att...

PHP: using sub-namespace class inside a namespace -

suppose have top-level namespace \outer , have sub-namespace \outer\inner , have top-level namespace \inner and in class in \outer use inner this use inner; then inner used? \outer\inner // ( sub-namespace ) or \inner // ( top-level namespace ) i confused because php said \ optional top-level namespaces? when have namespace \outer in class use inner going using inner top-level namespace. if want use subnamespace sould \outher\inner as stated in php using namespaces lets first file was: <?php namespace outer\inner; <?php namespace outer; /* qualified name */ inner\foo(); // resolves function outer\inner\foo

dom - get element id using classname with multiple element with same class name in c# -

private void button5_click(object sender, eventargs e) { htmlelementcollection links = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement link in links) { if (link.getattribute("classname")== "input-style1 psgn-name") { textbox10.text = link.getattribute("id"); } } } result: id of 4th element id out of 4 element same class. how rest of 3 element id? your overwriting text value each iteration of loop. updated code: private void button5_click(object sender, eventargs e) { htmlelementcollection links = webbrowser1.document.getelementsbytagname("input"); foreach (htmlelement link in links) { if (link.getattribute("classname")== "input-style1 psgn-name") { textbox10.text += link.getattribute("id"); } } } if wanted put first 4 items found if exist in different t...

c++ - Regex to replace all occurrences between two matches -

i using std::regex , need search , replace. the string have is: begin foo spaces , maybe new line( text replace foo foo bar foo, keep rest ) more text not replace foo here only stuff between begin .... ( , ) should touched. i manage replace first foo using search , replace: (begin[\s\s]*?\([\s\s]*?)foo([\s\s]*?\)[\s\s]*) $1abc$2 online regex demo online c++ demo however, how replace 3 foo in 1 pass? tried lookarounds, failed because of quantifiers. the end result should this: begin foo spaces , maybe new line( text replace abc abc bar abc, keep rest ) more text not replace foo here question update: i looking pure regex solution. is, question should solved changing search , replace strings in the online c++ demo . i have come code (based on benjamin lindley's answer ): #include <iostream> #include <regex> #include <string> int main() { std::string input_text = "my text\nbegin foo 14 spaces , maybe \nnew line(\n...

javascript - jsPdf Android Stock browser error -

i'm developing script transforms html table in pdf document. use jspdf , jspdf-autotable. did testing on various brwser , works fine except android stock browser.   android stock browser error : resource interpreted document transferred mime type application/pdf: "data:application/pdf;base64,jvberi0xljmkmyawig9iago8pc9uexblic9qywdlci9qyxj…l6zsaxoqovum9vdcaxocawifikl0luzm8gmtcgmcbscj4+cnn0yxj0ehjlzgozmdk5ciulru9g". jspdf code error jspdf.debug.js line 863 case 'dataurl': return global.document.location.href = datauri; jspdf version: jspdf/1.0.272/jspdf.debug.js what's wrong? the "android stock browser error" warning don't have worry about. might old versions of android stock browser don't support datauri location href. try use save method instead pdf. doc.save('table.pdf');

python - web2py fails on importing matplotlib modules -

i don't quite understand workings of web2py's custom_import.py . attempting import modules withing mathplotlib getting inconsistent results. my controller version.py contains these statements. def import_mathlab_cbook(): import matplotlib.cbook cbook return "cbook.__file__ = %r" % cbook.__file__ def import_mathlab_figure(): matplotlib.figure import figure return "figure.__file__ = %r" % figure.__file__ def import_mathlab_backends(): matplotlib.backends.backend_agg import figurecanvasagg return "figurecanvasagg.__file__ = %r" % figurecanvasagg.__file__ the import of matplotlib.cbook works fine, others produce errors. cbook.__file__ = '/opt/anaconda2/lib/python2.7/site-packages/matplotlib/cbook.py' traceback (most recent call last): file "/site/web2py.2.13.4/gluon/restricted.py", line 227, in restricted exec ccode in environment file "/site/web2py.2.13.4/applications/plotlab/con...