Archive
Posts
Notes on engineering, applied AI, leadership and the occasional detour into writing fiction.
2009
Creating a MySQL dump in CSV format
mysqldump has no --csv switch, but with the right -T incantation you get clean CSV files that Excel and Calc open without complaint.
Cycling between strings
Cycling through a fixed set of values without counters, resets or static-variable hacks — a small class that keeps its own state does it better.
Mini caching in classes
A method called repeatedly, a result too expensive to recompute, and the five-line private-array cache that beats passing state around.
2009 has 53 weeks
The cronjob was fine, the import was fine — my firm belief that a year has 52 weeks was not. A calendar surprise, and the one-line PHP fix.
Large MySQL Inserts with PHP
A million rows from PHP without trashing the disk or timing out: combine the inserts and the whole job finishes in under thirty seconds.