Posts

concurrency - Can I catch an external exit in Erlang? -

i have 2 processes linked; let's they're a , b , a set trap exits. want able recover piece of b 's process data if calls exit/2 on it, e.g. exit(b, diediedie) . in b 's module, let's call bmod.erl , have code looks this: -module(bmod). -export([b_start/2]). b_start(a, x) -> spawn(fun() -> b_main(a, x) end). b_main(a, x) -> try ! {self(), doing_stuff}, do_stuff() catch exit:_ -> exit({terminated, x}) end, b_main(a, x). do_stuff() -> io:format("doing stuff.~n",[]). and in a 's module, let's call amod.erl , have code looks this: -module(amod). -export([a_start/0]). a_start() -> process_flag(trap_exit, true), link(bmod:b_start(self(), some_stuff_to_do)), a_main(). a_main() -> receive {pid, doing_stuff} -> io:format("process ~p did stuff.~n",[pid]), exit(pid, diediedie), a_main(); {'exit', pid, {terminated, ...

Funcall inside Cons Lisp -

i began play lisp , i'm trying use funcall inside cons. this i'm trying do: (cons '(1 2 3) '(1 (funcall #'rest '(a b)) )) the result should be: ((1 2 3) 1 (b)) i know works: (cons '(1 2 3) (funcall #'rest '(a b))) and tried , didn't work (cons '(1 2 3) `,'(1 (funcall #'rest '(a b)) )) (cons '(1 2 3) '(1 (apply 'rest '(a b)))) (cons '(1 2 3) '(1 `,(apply 'rest '(a b)))) thanks in advance. (cons '(1 2 3) `(1 ,(funcall #'rest '(a b))))

php - Mysqli not showing errors properly -

i trying learn mysqli of functions. 1 thing left have proper error reporting across layers. don't understand why following snippet of code detects error won't error number nor error code. function get_pid_tid_by_pk($con,$ourid) { $returned['errno'] =""; $returned['error'] =""; //mistake on here!!! if(!$stmt = $con->prepare("elect gene_name,jgi_protein_id,jgi_transcript_id jgi_transid_protid_match our_protein_id = ?")) { $returned['errno'] = $con->errno; $returned['error'] = $con->error; return $returned; } if(!$stmt->bind_param('s',$ourid)) { $returned['errno'] = $stmt->errno; $returned['error'] = $stmt->error; return $returned; } if(!$stmt->execute()) { $returned['errno'] = $stmt->errno; $returned['error'] = $stmt->error; retu...

facebook - fb security warning while trying to login with fbgraph api -

while trying login fb, using graph api, web page appear showing message. security warning:please treat url above password , not share anyone. in ios fb graph api. this error occurs not time, half of time. how skip fb message ? i found 1 solution. hope work you. just paste uiwebviewdelegate method in fbgraph.m file.... - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype{ if([request.url.relativestring hasprefix:@"https://www.facebook.com/connect/login_success.html" ]) self.webview.hidden=true; return yes; }

NYTProf Profiler for Perl -

this question devel::nytprof profiler. the output receive profiler simple line such as: use strict; output: statements: 3 time on line: 22µs calls: 2 time in sub: 12µs so questions are: how 3 statements ? the time in sub .. represent ? does represent time spent converting module optree or else? is compile phase time or run phase time ? thank in advance use foo; is equivalent executing require foo; foo->import; at compile time. perhaps sub called strict::import . update : profiling program require strict; strict->import; shows devel::nytprof counts require statement 1 sub call , import another.

c++ - Cocos2dx : How to stop CCFollow moving the ParallaxNode and making background black -

i trying follow herosprite using ccfollow, there 2 erratic behaviors happening . i making camera follow sprite follows : startsprite = ccsprite::createwithspriteframename("santa_001.png"); startsprite->setposition(ccp (size.width / 5 , size.height / 2 )); this->addchild(startsprite,1); this->runaction(ccfollow::create(herosprite, ccrectmake(0, 0, size.width, size.height * 2))); now, happens : a) background parallax node consisting of different sprites , moving @ different speed moving in "upward" direction when herosprite jumps upward. want keep sprites @ original position , not move upward herosprite. how do ? voidnode = ccparallaxnodeextras::node(); voidnode->addchild(pspritegrass, 2, ccp(3.0f,0), ccp(0, size.height/10 - 50) ); voidnode->addchild(pspritegrass02, 3, ccp(3.0f,0), ccp(size.width - 10 , size.height/10 - 50) ); voidnode->addchild(psprite, 1, ccp(1.0f,0), ccp(0, size.height/10 - 50) ); ...

How to Create C DLL using Visual Studio 2012 -

i've been doing of development using c# in visual studio, first 2010 , 2012. need create dll using c language project i'm working on. when file | new project, can't find option creating dll using c. how do this? it's under file / new / project / templates / visual c++ / win32 / win32 project. follow wizard, , you'll offered "dll" on second page. (this visual studio 2012 - of wording may differ in other versions.)