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
});
09 February 2011
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)
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 !
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
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.
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();
just add
$actionName = strtolower($actionName);
in lib/action/sfSslRequirementActionMixin.class.php
line 65 in method sslRequired();
25 February 2010
position element form symfony
$this->widgetSchema->moveField('name', sfWidgetFormSchema::FIRST);
$this->widgetSchema->moveField('title', sfWidgetFormSchema::AFTER, 'name');
$this->widgetSchema->moveField('title', sfWidgetFormSchema::AFTER, 'name');
13 October 2009
Plugin for Silverstipe
Release of a silverstripe module : SSDropDownMenu
http://code.google.com/p/ssdropdownmenu/
css menu and ddsmoothmenu
http://code.google.com/p/ssdropdownmenu/
css menu and ddsmoothmenu
03 October 2009
These : Systèmes multi-agents
Mon projet de recherche de DEA sur les sytèmes multi-agents.
http://docs.google.com/fileview?id=0B2LXMvSKtt9VNDEwNzc1N2EtNTE1YS00NzFmLWFlYjktNzdhNjQwNjg4OTJm&hl=en
http://docs.google.com/fileview?id=0B2LXMvSKtt9VNDEwNzc1N2EtNTE1YS00NzFmLWFlYjktNzdhNjQwNjg4OTJm&hl=en
L'Intelligence Artificielle Distribuée (IAD) est apparue vers la fin des années 1970. Hewitt, confronté à un problème de résolution de théorèmes, proposa une solution en 1977 avec des entités actives appelées « acteurs » et considéra la résolution comme une confrontation de points de vue.
D'un autre côté, Erman (1980) élabora l'idée du tableau noir (" blackboard ") avec le projet HERSAY II. Le tableau noir est un emplacement réservé pour la transition des informations entre les différents agents. Chaque agent peut venir le consulter.
C'est donc à partir de ces premières réalisations que sont apparus des modèles, composés de « petits » programmes – appelés entités –, certes intelligents, mais aussi capables de communiquer et de s’organiser en un système plus complexe et interagissant avec l’environnement.
Ces systèmes sont appelés systèmes multi-agents (SMA) : chaque agent est une entité, l'ensemble des agents forme un tout. Ces ensembles illustrent l' idée sous jacente du philosophe Blaise Pascal que « Le tout est plus que la somme des parties ».
D'un autre côté, Erman (1980) élabora l'idée du tableau noir (" blackboard ") avec le projet HERSAY II. Le tableau noir est un emplacement réservé pour la transition des informations entre les différents agents. Chaque agent peut venir le consulter.
C'est donc à partir de ces premières réalisations que sont apparus des modèles, composés de « petits » programmes – appelés entités –, certes intelligents, mais aussi capables de communiquer et de s’organiser en un système plus complexe et interagissant avec l’environnement.
Ces systèmes sont appelés systèmes multi-agents (SMA) : chaque agent est une entité, l'ensemble des agents forme un tout. Ces ensembles illustrent l' idée sous jacente du philosophe Blaise Pascal que « Le tout est plus que la somme des parties ».
30 September 2009
Document MySQL optimisation
En français, des notes pour optimiser une base de données MySQL
(type de données, dates, astuces, serveur)
http://spreadsheets.google.com/pub?key=toSt1VdSpf8rdn9YTCTe9Jw&output=html
(type de données, dates, astuces, serveur)
http://spreadsheets.google.com/pub?key=toSt1VdSpf8rdn9YTCTe9Jw&output=html
24 September 2009
MySQL Optimisation
Here is some advise to speed up a database or to manage a large amount of data.
- Denormalized table (a CRON can create them every night)
- Use Memory/Heap table
- MyISAM better than InnoDB (just for the speed)
- Right choice of the indexes (be carefull when using memory table,
you need to change them and use Btree if you have to sort or group
your data)
Sometimes you need two indexes : col1, col2 and another one col2, col1
- There is tricky things about DATE, I think in a WHERE, Date =
Datetime wont use index, you need to use Date = Date(Datetime), use
EXPLAIN to find out
- Decompose a year on quarters, so you have a structure like : Date
(Datetime), Year(Smallint unsigned), Quarter(tinyint unsigned) and
indexed on (Date) and (Year, Quarter),
> this is a kind of "partitioning"
- Use the right Datatype to minimize the size of the tables (dont use
Datetime if Date is sufficient, Tinyint and not Int, and Unsigned (one
bit but important on billion of line!) like for NULL(1 extra bit) and
NOT NULL !)
- Best Replace query :
with InnoDB : INSERT INTO … ON DUPLICATE KEY UPDATE
with MyISAM: REPLACE
- No sub-query most of the time, prefer create a temporary table and
join on it. (JOIN ON will be your WHERE when using a subquery)
- Datawarehouse, store the old data somewhere else, and notice that it
gonna be slow to access the archived.
- Then a huge part for the server configuration ! see my-huge.cnf, and
keybuffersize and table_cache
When I did this, MySQL could not use multi-processors, and it was
better to have a huge memory RAM and fast hard drive.
- MySQL Table partition was useless in our case, maybe not in yours ..
- Denormalized table (a CRON can create them every night)
- Use Memory/Heap table
- MyISAM better than InnoDB (just for the speed)
- Right choice of the indexes (be carefull when using memory table,
you need to change them and use Btree if you have to sort or group
your data)
Sometimes you need two indexes : col1, col2 and another one col2, col1
- There is tricky things about DATE, I think in a WHERE, Date =
Datetime wont use index, you need to use Date = Date(Datetime), use
EXPLAIN to find out
- Decompose a year on quarters, so you have a structure like : Date
(Datetime), Year(Smallint unsigned), Quarter(tinyint unsigned) and
indexed on (Date) and (Year, Quarter),
> this is a kind of "partitioning"
- Use the right Datatype to minimize the size of the tables (dont use
Datetime if Date is sufficient, Tinyint and not Int, and Unsigned (one
bit but important on billion of line!) like for NULL(1 extra bit) and
NOT NULL !)
- Best Replace query :
with InnoDB : INSERT INTO … ON DUPLICATE KEY UPDATE
with MyISAM: REPLACE
- No sub-query most of the time, prefer create a temporary table and
join on it. (JOIN ON will be your WHERE when using a subquery)
- Datawarehouse, store the old data somewhere else, and notice that it
gonna be slow to access the archived.
- Then a huge part for the server configuration ! see my-huge.cnf, and
keybuffersize and table_cache
When I did this, MySQL could not use multi-processors, and it was
better to have a huge memory RAM and fast hard drive.
- MySQL Table partition was useless in our case, maybe not in yours ..
Subscribe to:
Posts (Atom)