tag:blogger.com,1999:blog-91006749491156952792023-06-20T06:08:42.025-07:00Code and symfonyAntoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-9100674949115695279.post-57620131931533872922011-02-09T13:04:00.000-08:002011-02-09T13:07:50.512-08:00On change event of select doesn't fire on up / down arrow pressIt 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. <br />Example: if you have a second select which is updated when the first one change.<br /><br /><br />$('select#myselect').bind("change keyup", function(e){ <br /> // do something<br />});Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-82984332627821878842010-11-05T00:40:00.000-07:002012-09-30T12:41:27.005-07:00Reminder UNIXlsusb (lists all the connected USB devices)<br />iwconfig (lists all the detected wireless hardware)<br />iwlist (allows you to scan the wireless networks around you)<br />ifconfig (lists all the detected network hardware. You can get some info for your wireless here too)Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-58680902080200834452010-08-04T00:48:00.000-07:002010-08-04T00:52:41.815-07:00Watch 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, <br />you can resize by re-encoding to a lower rate :<br /><br />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<br /><br /><br />I choosed a 1280 width because of my screen and a better vbitrate than a normal divx (~700Mo)<br />so the quality is good !Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com2tag:blogger.com,1999:blog-9100674949115695279.post-35001789744845386632010-06-03T20:46:00.000-07:002010-06-03T20:47:22.114-07:00Mount a samba share on unixsudo smbmount //server_address/directory /home/share -o username=,password=,uid=1000,mask=000Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-28672114075320387532010-06-02T22:13:00.002-07:002010-06-02T22:14:14.279-07:00Resize images on MAC by command-linesips -s format jpeg --resampleWidth 800 *.JPG<br /><br />it will resize all the JPG of the current directory to 800px widthAntoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-72846581311634403732010-05-04T02:50:00.000-07:002010-05-04T03:19:05.955-07:00GPS: gpsd and google earth ?how to use a gps with google earth on unix (ubuntu) ?<br /><br />first we need gpsd: <a href="http://gpsd.berlios.de/">http://gpsd.berlios.de/</a><br />start the gps: <span style="font-weight:bold;">gpsd -N -n -D 2 /dev/ttyUSB1</span><br />good tools to undertsand gpsd and your gps are: <br />gpsprof -f cycle <span style="font-style:italic;">(synchro)</span><br />xgps <span style="font-style:italic;">(check if it works)</span><br />gpsmon <span style="font-style:italic;">(display what the gps return - sirf or nmea (start a line with $GPRMC) - or change the config of the gps)</span><br /> <br />My gps does not return NMEA data but <span style="font-weight:bold;">SiRF</span><br />(try to change to nmea with gpsctl -n)<br /><br />so, I had to create fake/virtual serial port and use gpspipe to translate SiRF to NMEA.<br />Socat does the job and even better, you can execute a command to redirect in the serial port:<br /><br />sudo apt-get install socat<br />socat -d -d pty,raw,echo=0 "exec:gpspipe -r,pty,raw,echo=0"<br /><span style="font-style:italic;">> it will give you the name of the port, example: /dev/pts/6</span><br /><br />Then I have used a python script GEgpsd to read NMEA data and update a kml file:<br /><a href="http://www2.warwick.ac.uk/fac/sci/csc/people/computingstaff/jaroslaw_zachwieja/gegpsd/">http://www2.warwick.ac.uk/fac/sci/csc/people/computingstaff/jaroslaw_zachwieja/gegpsd/</a><br /><br />You can then open a kml file with googleearth, where the file generated by GEgpsd is linked and says to be refreshed.<br /><br />That's it .. thanks for this awesome free tools.Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com1tag:blogger.com,1999:blog-9100674949115695279.post-20305188477621341742010-03-01T16:46:00.000-08:002010-03-01T16:48:09.634-08:00sfSslRequirementPlugin symfony 1.4 quick fixMaybe not the best solution, but if you want to make it works quickly,<br />just add <br /><br />$actionName = strtolower($actionName);<br /><br />in lib/action/sfSslRequirementActionMixin.class.php<br /><br />line 65 in method sslRequired();Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com1tag:blogger.com,1999:blog-9100674949115695279.post-69200245981741429232010-02-25T14:06:00.001-08:002010-02-25T14:06:48.997-08:00position element form symfony$this->widgetSchema->moveField('name', sfWidgetFormSchema::FIRST);<br />$this->widgetSchema->moveField('title', sfWidgetFormSchema::AFTER, 'name');Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-3505780665794263462009-10-13T00:30:00.000-07:002009-10-13T00:33:31.421-07:00Plugin for SilverstipeRelease of a silverstripe module : SSDropDownMenu<br />http://code.google.com/p/ssdropdownmenu/<br />css menu and ddsmoothmenuAntoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com1tag:blogger.com,1999:blog-9100674949115695279.post-11402201777620923892009-10-03T23:23:00.000-07:002009-10-03T23:33:11.187-07:00These : Systèmes multi-agentsMon projet de recherche de DEA sur les sytèmes multi-agents.<br /><br /><a href="http://docs.google.com/fileview?id=0B2LXMvSKtt9VNDEwNzc1N2EtNTE1YS00NzFmLWFlYjktNzdhNjQwNjg4OTJm&hl=en">http://docs.google.com/fileview?id=0B2LXMvSKtt9VNDEwNzc1N2EtNTE1YS00NzFmLWFlYjktNzdhNjQwNjg4OTJm&hl=en<br /></a><br /><div style="text-align: justify;"><span style="font-style: italic;">L'Intelligence Artificielle Distribuée (IAD) est apparue vers la fin des années 1970. Hewitt,</span><span style="font-style: italic;"> confronté à un problème de résolution de théorèmes, proposa une solution en 1977 avec des entités</span><span style="font-style: italic;"> actives appelées « acteurs » et considéra la résolution comme une confrontation de points de vue.</span><br /><span style="font-style: italic;">D'un autre côté, Erman (1980) élabora l'idée du tableau noir (" blackboard ") avec le projet</span><span style="font-style: italic;"> HERSAY II. Le tableau noir est un emplacement réservé pour la transition des informations entre</span><span style="font-style: italic;"> les différents agents. Chaque agent peut venir le consulter.</span><br /><span style="font-style: italic;">C'est donc à partir de ces premières réalisations que sont apparus des modèles, composés de</span><span style="font-style: italic;"> « petits » programmes – appelés entités –, certes intelligents, mais aussi capables de communiquer</span><span style="font-style: italic;"> et de s’organiser en un système plus complexe et interagissant avec l’environnement.</span><br /><span style="font-style: italic;">Ces systèmes sont appelés systèmes multi-agents (SMA) : chaque agent est une entité, l'ensemble</span><span style="font-style: italic;"> des agents forme un tout. Ces ensembles illustrent l' idée sous jacente du philosophe Blaise Pascal</span><span style="font-style: italic;"> que « Le tout est plus que la somme des parties ».</span></div>Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-10108605097961196022009-09-30T00:52:00.000-07:002009-09-30T01:01:05.757-07:00Document MySQL optimisationEn français, des notes pour optimiser une base de données MySQL<br />(type de données, dates, astuces, serveur)<br /><a href="http://spreadsheets.google.com/pub?key=toSt1VdSpf8rdn9YTCTe9Jw&output=html">http://spreadsheets.google.com/pub?key=toSt1VdSpf8rdn9YTCTe9Jw&output=html</a>Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-15612963746386732812009-09-24T20:28:00.000-07:002009-09-24T20:33:06.531-07:00MySQL OptimisationHere is some advise to speed up a database or to manage a large amount of data.<br /><br />- Denormalized table (a CRON can create them every night)<br />- Use Memory/Heap table<br />- MyISAM better than InnoDB (just for the speed)<br />- Right choice of the indexes (be carefull when using memory table,<br />you need to change them and use Btree if you have to sort or group<br />your data)<br />Sometimes you need two indexes : col1, col2 and another one col2, col1<br />- There is tricky things about DATE, I think in a WHERE, Date =<br />Datetime wont use index, you need to use Date = Date(Datetime), use<br />EXPLAIN to find out<br />- Decompose a year on quarters, so you have a structure like : Date<br />(Datetime), Year(Smallint unsigned), Quarter(tinyint unsigned) and<br />indexed on (Date) and (Year, Quarter),<br />> this is a kind of "partitioning"<br />- Use the right Datatype to minimize the size of the tables (dont use<br />Datetime if Date is sufficient, Tinyint and not Int, and Unsigned (one<br />bit but important on billion of line!) like for NULL(1 extra bit) and<br />NOT NULL !)<br />- Best Replace query :<br />with InnoDB : INSERT INTO … ON DUPLICATE KEY UPDATE<br />with MyISAM: REPLACE<br />- No sub-query most of the time, prefer create a temporary table and<br />join on it. (JOIN ON will be your WHERE when using a subquery)<br />- Datawarehouse, store the old data somewhere else, and notice that it<br />gonna be slow to access the archived.<br />- Then a huge part for the server configuration ! see my-huge.cnf, and<br />keybuffersize and table_cache<br />When I did this, MySQL could not use multi-processors, and it was<br />better to have a huge memory RAM and fast hard drive.<br />- MySQL Table partition was useless in our case, maybe not in yours ..Antoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0tag:blogger.com,1999:blog-9100674949115695279.post-4882335520553894912009-09-24T20:25:00.000-07:002009-09-24T20:27:45.721-07:00Time to start a blog, snippet .. anythingAntoinehttp://www.blogger.com/profile/12297213274542219519noreply@blogger.com0