09 February 2011

On change event of select doesn't fire on up / down arrow press

It makes sense that the onchange event is triggered only on unfocus, but it can be useful for the user to trigger this event when a key is pressed.
Example: if you have a second select which is updated when the first one change.


$('select#myselect').bind("change keyup", function(e){
// do something
});

05 November 2010

Reminder UNIX

lsusb (lists all the connected USB devices)
iwconfig (lists all the detected wireless hardware)
iwlist (allows you to scan the wireless networks around you)
ifconfig (lists all the detected network hardware. You can get some info for your wireless here too)

04 August 2010

Watch a hd movie (mkv) on a slow computer ?

If your computer is too slow to process the image and the sound of a large mkv file,
you can resize by re-encoding to a lower rate :

mencoder /path/orginal.mkv -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vqmin=2:vbitrate=2000 -vf pp=de,scale=1280:-2 -o /path/result_file.avi


I choosed a 1280 width because of my screen and a better vbitrate than a normal divx (~700Mo)
so the quality is good !

03 June 2010

Mount a samba share on unix

sudo smbmount //server_address/directory /home/share -o username=,password=,uid=1000,mask=000

02 June 2010

Resize images on MAC by command-line

sips -s format jpeg --resampleWidth 800 *.JPG

it will resize all the JPG of the current directory to 800px width

04 May 2010

GPS: gpsd and google earth ?

how to use a gps with google earth on unix (ubuntu) ?

first we need gpsd: http://gpsd.berlios.de/
start the gps: gpsd -N -n -D 2 /dev/ttyUSB1
good tools to undertsand gpsd and your gps are:
gpsprof -f cycle (synchro)
xgps (check if it works)
gpsmon (display what the gps return - sirf or nmea (start a line with $GPRMC) - or change the config of the gps)

My gps does not return NMEA data but SiRF
(try to change to nmea with gpsctl -n)

so, I had to create fake/virtual serial port and use gpspipe to translate SiRF to NMEA.
Socat does the job and even better, you can execute a command to redirect in the serial port:

sudo apt-get install socat
socat -d -d pty,raw,echo=0 "exec:gpspipe -r,pty,raw,echo=0"
> it will give you the name of the port, example: /dev/pts/6

Then I have used a python script GEgpsd to read NMEA data and update a kml file:
http://www2.warwick.ac.uk/fac/sci/csc/people/computingstaff/jaroslaw_zachwieja/gegpsd/

You can then open a kml file with googleearth, where the file generated by GEgpsd is linked and says to be refreshed.

That's it .. thanks for this awesome free tools.

01 March 2010

sfSslRequirementPlugin symfony 1.4 quick fix

Maybe not the best solution, but if you want to make it works quickly,
just add

$actionName = strtolower($actionName);

in lib/action/sfSslRequirementActionMixin.class.php

line 65 in method sslRequired();