Brad's Blog

web dev, django, running, food, or whatever

Pondering a Robotic Lawn Mower 2008-09-13

Last weekend my gasoline powered lawn mower died. This prompted a search for a new mower, during which I stumbled upon some of Friendly Robotics' Robomow; a line of battery-powered robotic lawn mowers. Now, I have to admit that for the past 15 years or so, every time I've mowed a lawn, I've thought about the possibilities of a robotic lawn mower, and I'm not at all surprised that there's a company producing these. At first the Robomow seems like ...

Recursively deleting files (based on regex) 2008-09-09

While we're on the topic... (the topic being recursively doing stuff to files), I often want to delete all the files in a hierachy of directories that match a regular expression (or regex).The typical scenario for this is, "I want to delete all of my compiled python files."Here's how I do it:find ./ -type f -name "*.pyc" -exec rm {} \;find ./ -type f -name "*.pyc" should find all files ending in .pyc under the current directory. Once they've been ...

Recursively Renaming files 2008-09-05

My hosting provider offers PHP4 and PHP5. Unfortunately, all files ending in .php get interpreted by PHP4, while all files ending in .php5 get interpreted by PHP5. So, how do I quickly change all of my files that end in .php to .php5?Do a google search for "recursively rename files", and you might run across this:http://seal-7.blogspot.com/2006/12/recursively-rename-files-with-regex-one.htmlSo, to accomplish my task, I use the following:find . -type f -print0 | xargs -0 rename 's/.php$/.php5/g'Awesomeness.

Looking Forward to BarCampMemphis 2008-09-05

BarCamp is coming to Memphis!A project of LauchMemphis, this is yet another event focused on growing the local tech industry. It follows the successful Memphis Startup Weekend (which resulted in Spynnr).The theme of BarCampMemphis is FLUX: Your Paradigm, and from the About BarCampMemphis page: In a constantly shifting environment, what do you do? Entreprenuers and businesses are constantly trying to walk the line between chaos and control, between the cutting edge and solid ground. Things are in FLUX. Now enter ...

Safari is Cooler than you Think! 2008-09-04

When you really start digging into Mac OS X, it's fairly mind-boggling how much extra stuff it has that your average user never sees. I recently encountered a problem on my MacBook Pro, where the Optical Audio was overriding my internal speakers, which prevented me from hearing any audio (without using headphones). Unfortunately, there's no easy-to-access preference pane to enable or disable various audio devices. This led me on a search for command-line utilities to manage system preferences.(hang on, I'll ...

Net Neutrality 2008-08-13

Save the Internet | Rock the Vote

How to update an input value with the value from a selected option using Prototype 2008-08-12

Today, I needed to set the value of an HTML input element based on the value of a option in a select element. This is fairly easy to do with Prototype's writeAttribute. Here's an example:A simple javascript function to do the work:function populate_input(){ var field = $('tf_select').getValue(); $('tf').writeAttribute('value', field);}A simple HTML snippet to see it in action:<div><p><select id="tf_select" name="tf_select" onchange="populate_input();"><option value="">- choose one -</option><option value="v1">value 1</option><option value="v2">value 2</option></select><br/><input type="test" id="tf" name="tf" value=""/></p></div>And yes... I know the title of this post ...

Extracting and Encoding Still images to/from Video files 2008-08-11

ffmpeg is a cool tool.While it's got many many features and uses, I mostly use it to extract frames (or still images) from a video and create a video out of frames. While instructions on how to do this are posted on their list of FAQs, it's probably worth posting again.To extract all frames from a video file named "video.mpg": ffmpeg -i video.mpg frame%d.jpgThis will produce a series of JPEG image files named file1.jpg, file2.jpg... file10.jpg, file11.jpg... etc.I often like ...

The Apple Dock is a Mirror! 2008-08-08

I guess I'm still a relatively new Mac User, but I consider myself fairly technical and probably more savvy that your typical Mac user (though there are a lot of mac users who are far more savvy than I!)Imagine my surprise when, while working tonight, I discovered that the Dock in Leopard is a Mirror! Yes, I'd noticed the reflection of the Icons, but tonight, I actually saw my cursor (in Terminal) moving as I typed... that caught my attention! ...

PHP is chopping off my Access Memo Fields 2008-07-30

I've got a few simple web forms that use PHP to read and write to an Access database (running on IIS), and I just spent the last few hours frantically trying to figure out why some of my Memo fields were being truncated around 4000 characters. I know Memo fields "should" be able to contain up to 65536 characters, and I could verify this by inserting data directly into the database. However, when querying the database through PHP (using odbc), ...