Tuesday, October 6th, 2009
If you’re ever in a situation where something is only happening intermittently, and only on a live server, and only while it’s under load… Lets say its not generating any error_log or stderr output, and you cant run it manually to reproduce… (we’ve all been in this situation) How do you get any debugging output [...]
Tuesday, October 6th, 2009
in LimeChat.app/Contents/Resources/logrenderer.rb around line 419… WFM. IANAL. YMMV. RTFM. OMGWTF. WTL. GTFO. ETC. words.each do |w| next if w.empty? s = body offset = 0 # rex = Regexp.new(w, true) # while rex =~ s # begin # left = $~.begin(0) right = $~.end(0) pre = $~.pre_match post = $~.post_match ok = true if exact_word_match [...]
Wednesday, September 16th, 2009
When working with user provided images in PHP you run into a problem. Lets say that you want to generate thumbnails of uploaded JPEGs for users. This is a fairly common use case where you would employ PHP and GD (the most prevalent php image extension.) But when you generate the new, smaller, image what [...]
Monday, September 14th, 2009
Don’t you hate that… When it’s 2:00am… and you really should be in bed… But your mind has hold of a problem, and wont let it go. I have a project where it would be really handy for a process to be able to lock (arbitrary string identifier) and for another process to be able [...]
Wednesday, February 18th, 2009
Lets say you have the CouchDB classes (located here) all compiled together and included into your test.php script. Lets also say that you have created a database with the built-in web ui called “testing”. Finally let us say that your test.php has the following code in it, which would add a record to the db [...]
Thursday, February 12th, 2009
If you’re like me you have an OSX computer or 3 at home, and a debian file server. If you’re like me you hate samba/nfs on principle and want your debian server to show up in finder. If you’re like me you arent using debian 3 which is what most of the walkthroughs seem to [...]
Friday, January 23rd, 2009
I do a lot of things for Automattic, and many of the things I do are quite esoteric (for a php developer anyways.) Perl is not my language of choice, but I’ve never balked at a challenge…. just… did it have to be perl? Anyways. We have more than a thousand machines that we track [...]
Thursday, December 11th, 2008
This is a simplistic use of the pattern that I wrote about in my last post to wait on multiple commands in bash. In essence I have a script which runs a command (like uptime or restarting a daemon) on a whole bunch of servers (think pssh). Anyways… this is how I modified the script [...]
Friday, December 5th, 2008
You know that you can run something in the background in a bash script with ( command )&, but a coworker recently wanted to run multiple commands, wait for all of them to complete, collect and decide what to do based on their return values… this proved much trickier. Luckily there is an answer #!/bin/bash [...]
Tuesday, November 18th, 2008
I’ve been working, gradually, on a project using an sqlite3 database (for its convenience) and found myself missing the clean elegance of wpdb… so I implemented it. It was actually really easy to do, and I figured I would throw it up here for anyone else wishing to use it. The functionality that I build [...]