Each photo on my photo-blog is a record in a MySQL database, but not every day of the year has a photo. I’ve been adding photos on and off since August, 2004, and each day I’d like to automatically provide links to the older photos I’ve posted on that day in the past (ie Jan 11 2010, Jan 11 2009, Jan 11 2008 and so on, but ONLY if they exist). I could have my PHP code loop through each of the possible dates and see if there is a record, but I’d rather have a single SQL command that would return just the records I was looking for. Somehow the MOD command seemed like the right place to start, but how?
It seems like an obvious question, but when someone on an IBM developerWorks forum asked how to use wildcards as literals in SQL I realized I didn't know the answer off hand! How DO you find all the records with a part number that contains an underscore, say? SELECT * FROM partno WHERE part LIKE '%_%' doesn't work as we'd like!
I had what I thought was a simple requirement, sort a set of MySQL 5 rows in order by the day of the year, regardless of the year. April 22nd before April 21st, etc... In particular I wanted to show photos from 'this day in history' going back over a hundred years! My DAYOFYEAR() code worked perfectly, until the Great Toronto fire of 1904...
I use phpMyAdmin to administer my remote MySQL databases and find the GUI good enough for most tasks, but I found myself wondering "How do I create a view in phpMyAdmin?" A careful review of the GUI turned up nothing, but this seems like such a common task I was surprised there was no way to create a view other than directly via SQL. A few web searches later and I realized there was a way, it was just not obvious until you figure it out. So here's my quick tutorial on creating a MySQL view directly in phpMyAdmin.
I'm a big fan of Perl, but seem to use it for just one reason these days: reading and processing various HTML files out on the web (ie writing a spider). The LWP Perl modules makes this easy, and can honor robots.txt automatically. I've found, though, especially during development, that I don't want to access the live web page again and again as I develop the rest of the script. This is even more relevant for HTML pages that take a long time to return, or when I'm developing the script offline, or without intranet access.
My solution? Adding some HTML cache code in my object that can save a copy of the HTML locally the first time it is accessed, then automatically use that file each subsequent run.
Every so often when I try to safely remove a USB drive from my Windows machine I get the Problem Ejecting USB Mass Storage Device error even though I'm sure no programs are using the drive.
Microsoft suggests using a free program to fix this - Process Explorer (from a company called 'Sysinternals' that was purchased by Microsoft a few years back). Once you've downloaded the software it is a simple enough process, but does have the potential to make you system unstable, so make sure you understand the risks before continuing through this quick tutorial.
You may have heard that Bell Internet customers can now wirelessly connect to the Internet at Starbucks locations across Canada. Although the Bell website only mentions laptops running Windows, I thought I'd go grab a grande latte and see what the process was to connect with my iPod Touch. It worked, and I could browse the web and connect to the internet with all my applications, too. Here's a set of screen captures walking through the process.
** Update ** Turns out the Toronto Public Libraries are also offering free WiFi which will work on the iPod touch and iPhone as well - take a look at their website for details - and no, you don't need to be a Bell subscriber.
( This is a link to an older technology based blog entry I wrote. )
A quick tutorial on how I put together a PHP script to serve a Google Earth KML file updated live with all the geo-tagged photos from my photo-blog, stored in MySQL. Rather than having people store the whole, static data file on their local machine, I've created a small, second XML file that uses the
If you have Google Earth installed you should just be able to load the KML data file on this page to see a live version of the links.
( This is a link to an older technology based blog entry I wrote. )
I've added GEO microformat codes to a bunch of the pages at Wholemap (as well as to my photoblog entries). The various Firefox extensions that I have seem to recognize them, but to be quite honest, I'm not sure really how anyone will use them just yet... are there search engines that recognize them? More information about Microformats in general is available here.
( This is a link to an older technology based blog entry I wrote. )
I just picked up a new Apple iPod Touch and thought I'd create a version of my photoblog that is optimized for the iPhone and/or iPod Touch. This won't be an actual application available through the App Store, but instead a web page using Joe Hewitt's iUI CSS and JavaScript library.
( This is a link to an older technology based blog entry I wrote. )