3 o'clock javascript

I was writing some code to react at a textarea.onKeyUp. I take the size of the current textarea.val().length, update an element and do some other stuff. yawn The first version of the code looked like: 1 2 3 4 $('#message').keyup(function(e){ $('#chars_num').html( new_len ); $('#sms_num').html( Math.floor($('#message').val().length / 161) +1) ); }); Working good, but was clearly slow: every keystroke was ā€œgiving back the cursorā€ too slowly for a fast typer like me. I went to take a look at twitter, and their text box was WAY FASTER. ...

March 28, 2010 Ā· 1 min Ā· 201 words

Snippet: fix Screen Orientation in a Qt/S60 app

I follow the Qt/S60 Mailing list, that is turning out to be a very interesting and active ML, and the Qt Labs blog, always full of very good code, written directly by the guys of Qt Software. I thought could be nice to start to post some of the stuff I’m learning. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> // ... // lock orientation CAknAppUi* appUi = static_cast<caknappui *>( CEikonEnv::Static()->AppUi() ); if ( appUi ) //< Actually, this will always pass. It's a "static_cast" after all... { appUi->SetOrientationL( CAknAppUi::EAppUiOrientationPortrait ); } // ... Today's source is: [Nokia Forum](http://discussion.forum.nokia.com/forum/showthread.php?t=164499).</caknappui></aknappui></aknenv></eikappui></eikenv>

August 11, 2009 Ā· 1 min Ā· 116 words