Posts

otp - About a client for pusher written in Erlang -

i want write module need able push message pusher in erlang. found repo https://github.com/bradfordw/pusherl , not maintained anymore, think can adapt make work. followed readme, , ran rebar command. open rebar console command ./rel/pusherl/bin/pusherl console so server should start. when try call gen_server:call(pusherl_server, {push, {"channelname", "eventname", "payload"}}). then throws error: exception exit: {noproc,{gen_server,call, [pusherl_server, {push, {"channelname","eventname","payload"}}]}} in function gen_server:call/2 (gen_server.erl, line 182) i'm quite new erlang , otp, , takes me half of day make work not successful. please me solve this. appreciate. by way, if know other pusher client, please suggest me. lot. here code gen_server callback: -module(pusherl_server). -behaviour(gen_server). -define(server...

How do I compare strings in Java? -

i've been using == operator in program compare strings far. however, ran bug, changed 1 of them .equals() instead, , fixed bug. is == bad? when should , should not used? what's difference? == tests reference equality (whether same object). .equals() tests value equality (whether logically "equal"). objects.equals() checks nulls before calling .equals() don't have (available of jdk7, available in guava ). consequently, if want test whether 2 strings have same value want use objects.equals() . // these 2 have same value new string("test").equals("test") // --> true // ... not same object new string("test") == "test" // --> false // ... neither these new string("test") == new string("test") // --> false // ... these because literals interned // compiler , refer same object "test" == "test" // --> true // ... should call objects.equals() o...

android - How can I show image taken from camera -

i'm trying write android app, works camera. show preview of camera in textureview, working. if press button camera take picture , show on imageview on second half of screen. everytime press button app stops working, tells me error android.view.viewrootimpl$calledfromwrongthreadexception: original thread created view hierarchy can touch views. so looked up, , seems can't change image of imageview try to. don't know how else solve problem. can give me advise? here code: image changed in "imagereader.onimageavailablelistener" in method takepicture(). public class mainactivityold extends activity { private textureview mtextureview; private imageview mimageview; private cameradevice mcameradevice; private size mpreviewsize; private capturerequest.builder mpreviewbuilder; private cameracapturesession mpreviewsession; private button mbtnshot; @override protected void oncreate(bundle savedinstancestate) { supe...

c++ - Is strtok() safe to use -

this question has answer here: strtok function thread safety 2 answers i reading lot negative things strtok() , obsolete, not thread safe, etc. so truth, can use strtok() ? , thread safe? note: using visual c++. you can use it, it's part of standard library. it uses internal storage shared across users of function, no it's not thread-safe. it modifies string hand it, quite scary. i not recommend using it, in cases.

jquery - move images in a line with timed effect -

the idea have div images ( in horizontal line) see first image within div. there 5 images. want move images right left leaving div (and screen) , after last images has moved first image in front (that 1 entire loop) start animation, click button. now trick of this, @ every uneven numbered image animation has stop few moments. starting image 1, pass number 2 , stop @ 3 few seconds pass numver 4 , stop @ number 5 after image continues first 1 again , stops until start button clicked again. i want able expand amount of images easy. what have far in css / html is <body> <div id="container"> <div id="fotos"> <div class="image"><img src="afb_stuk/1.png"/></div> <div class="image"><img src="afb_stuk/2.png"/></div> <div class="image"><img src="afb_stuk/3.png"/></div> <div style="clear...

php - Getting values stored in mutiple arrays. Checkboxes involved -

heloo, i have following php code: <?php $ratings = array( 1 => "all", 2 => "love", 3 => "hate", 4 => "maybe", 5 => "super" ); $question = array( 1 => "pizza", 2 => "prajitura", 3 => "placinta", ); echo '<form method="post" action="' . $_server['php_self'] . '">'; echo '<p>how feel each topic?</p>'; foreach ($question $key=>$value){ echo "".$value."<br>"; echo "aici valoarea".$key; $importhtml=""; foreach ($ratings $cheie => $raspuns) { // echo "cheie: ".$key."cheie raspuns:".$cheie."raspuns".$raspuns."\n"; $importhtml .= "$raspuns <input type='checkbox...

java - How much string objects are created (String.format())? -

after dispute colleague couldn't find solution. question for(int = 0; < 2; i++) { string.format("variable = %d", i); } how variables created during running code? have opinion, here can created 4 variables: "variable = %d", "variable = %d" - on both cycle steps created object formatting "variable = 0", "variable = 1" - resulted strings. am right? "variable = %d" string literal, put in string pool , not created twice. hence, you'll have total of 3 strings: "variable = %d" , "variable = 0" , "variable = 1" .