php post response script execution

I guess it’s nice to have so here you go / basically allow a php script to return a response and continue with * code execution, good for statistics. * before echo anything to user call begin and after call end, than you can continue doing stuff / class ScriptContinuationManager { /** this is the point where we need to give a sign to this class * that we wanna write our response. * @return void / public function beginRespone() { ob_end_clean(); header(“Connection: close”); ignore_user_abort(); // optional ob_start(); } / * after this function execution the response will be sent to the * client, and code continue without client need to wait. */ public function endResponse() { $size = ob_get_length(); header(“Content-Length: $size”); ob_end_flush(); // Strange behaviour, will not work flush(); // Unless both are called ! } }

July 7, 2012 · 1 min · Chen Kinnrot

For all you android developers, If you ever installed a new rom and didn’t see any logs from your cat, just do this: http://stackoverflow.com/a/7272831/67505

June 12, 2012 · 1 min · Chen Kinnrot

Rails + Mongo + Heroku how?

After a few hours of fighting with google I decided to write it all here: *This post is more relevant for windows users but can help others. What do you need to have: First you need to have ruby 1.9.2+ Devkit then you need rails 3+ then u need the bundler gem then go to getting started with mongoid then install mongo locally then check it all good then add account in heroku then create app then add your key then push

March 28, 2012 · 1 min · Chen Kinnrot

CoffeeScript - language review

This weekend I learned a new programming language, called coffee script, It’s not a real language it’s actually compiled to JavaScript, so it’s a way to write JavaScript differently. After a little hands-on and one book read I can say that this is a good language for experienced and non experienced JavaScript programmers. What’s awesome about this language is that is fills like someone took all the good stuff from ruby python and java, and put it in one language that eliminates all the crap you need to take form JavaScript programming. I can start writing all the good stuff about coffee but there is no need just dive into http://coffeescript.org/ and you’ll understand all the benefits.

February 18, 2012 · 1 min · Chen Kinnrot

PHP Sessions

One more thing, If you do stuff like put instances of classes inside a session and expect to call methods of this classes later, you must put the session start after you include the classes definitions. But I suggest not to do this kind of stuff.

January 7, 2012 · 1 min · Chen Kinnrot

PHP sessions - stuff to check when things goes wrong.

There is too much information about problems with sessions in PHP, every dude got it’s own problem and it’s own solution. The probability that the problem you experiencing is the same is very low. So here is what my little (and very annoying) google journey came up to: You must call session_start(); on each pageIf you use the header(‘Location: blabla’); you should use relative url to keep preserve session some people say before using the header action you need to call session_write_close(); - I’m not using it.session_write_close(); could be the reason to your problems, cause after calling it you can’t modify the session (in the current http context), that was my problem.on php docs, they say that “Session ID is not passed with Location header even if session.use_trans_sid is enabled. It must by passed manually using SID constant."So first make sure you use session start, if you passed this search for voodoos like session_write_close() in the middle of your infrastructure and remove them. If I didn’t help, continue the journey.

January 6, 2012 · 1 min · Chen Kinnrot

End of job check list

I'm about to end my first gig(already end! yay I'm free!) as a programmer, and want to leave a clean desk. So here is a list of things I'm doing and suggest you all do before you move to your next gig: 1. Write about your major infrastructure developments on your wiki or any other system you got, in an easy to understand language. 2. Start lecturing your co-workers about complex parts you developed. 3. Make sure you got full code coverage with unit tests. 4. Search for to-do comments and make sure you do those todo's. 5. If you got unfinished work and think it's worth something make sure someone complete. And the most important: change your phone number :-) (Bazinga).

November 16, 2011 · 1 min · Chen Kinnrot

Startups: reshare very nice research

The Startup Gamble [infographic] | Daily Infographic

October 28, 2011 · 1 min · Chen Kinnrot

Rubymine recommended font for windows

Didn’t find a lot about it on internet so: File->Settings->Editor->colors & fonts->Font first save as current schema than click the … button choose Consolas and set size to 14 looks much better!

September 27, 2011 · 1 min · Chen Kinnrot

MVC Frameworks and dynamic languages

Warning! just figure out a mistake that can happen to every other programmer, and even brogrammers. I defined a method on my model that has the same name as one of the field of the model, because I used a dynamic language (ruby on rails) it was pretty hard to understand this issue (took me more than 1 hour). So a little tip: When thinking about names of actions and fields of your model, work with conventions and guidelines like: Don’t name your fields after action names!!! that’s it.

September 27, 2011 · 1 min · Chen Kinnrot