December 19, 2006 at 9:30 pm

So the new job at http://www.windriver.com/ rules. I’m working on some pretty exciting technology and I definitely feel like I’m getting the most out of my college degree. The people are cool, the perks are great and I’m a happy man.
The surf has been insane lately. Here’s a picture I took at Torrey Pines last week. Everyone and their mother was getting barrels.
September 25, 2006 at 8:18 am
Sometimes when performing a remove on a long list, you’ll get the error “Argument list too long”. For example, I have a script that pollutes the /tmp directory with msg-11* directories (perl MIME::Parser directories). Obviously I should clean this up, but I also needed a way to delete all these directories. The best way is to use a combination of xargs, find and rm.
For example:
find . -name ‘msg-11*’ | xargs rm -r
September 18, 2006 at 8:43 am
To revert to an older file in CVS, do the following:
cvs update -r 1.2 test
mv test test.old.ver
cvs update -A test
mv test.old.ver test
cvs commit -m “reverting to version 1.2″ test
Thanks to http://elib.cs.berkeley.edu/admin/cvs/cvsrevert.html for this hint.
September 14, 2006 at 12:36 pm
I know you, programmer. Sometimes even you- the most gifted of all programmers to ever place their hands on a keyboard- makes a mistake. Maybe you have a script that inserts into a database and that script steps on itself and for some unexpected reason your mechanism for making sure that doesn't happen fails. So what do you do when you are left with thousands of duplicate rows in a MySQL database?
Well, you could hire a college intern or someone from Manpower to manually delete all the rows. About a thousand dollars and a week later, you realize that they too can make mistakes, and about twenty important records are missing from your database. Then your boss comes to you and says, "So, Mr. Genius programmer, where did so-and-so's personal account information go?" Damn you Manpower!
That said, here's a quick and easy way to remove duplicates from a MySQL database. Make sure you execute it all at once, and make sure you backup your duplicated garbage table before hand.
CREATE TEMPORARY TABLE tblTempDoopless like tblWithDoops;
INSERT INTO tblTempDoopless(pkID, strField1, strField2)
SELECT pkID, strField1, strField2
FROM tblWithDoops
GROUP BY strField1; /* this is the field that is duplicated! */
DELETE FROM tblWithDoops;
INSERT INTO tblWithDoops(pkID, strField1, strField2)
SELECT pkID, strField1, strField2
FROM tblTempDoopless;
Also, note the group by. Weird how that works. As long as you're not using concat, all the other columns seem to be the first row MySQL finds.
August 13, 2006 at 12:07 pm
The CakePHP framework makes developing applications in PHP easier than ever. After a short download of the source code, you can start making customized dynamic webapps in minutes. Cake follows the Model-View-Controller paradigm to the extreme and makes tedious tasks such as html form creation and validation a breeze. I just walked through the tutorial, and I have no doubt that this will change the way I program all my future applications.
CakePHP Tutorial