Tutorial, Quick Tip

warning: Creating default object from empty value in /home/skyontech/www/www/blog/modules/taxonomy/taxonomy.pages.inc on line 34.

Using the SQL MOD function in a select statement

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?

Escaping wildcard characters % and _ in SQL

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!

How the Great Fire of 1904 fire ruined my MySQL DAYOFYEAR() calculations

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...

Creating a MySQL View directly in phpMyAdmin

Icon for creating a view directly in phpMyAdminI 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.

Adding a cache to your scripts that read HTML files

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.

Problem Ejecting USB Mass Storage Device in Windows

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.
Error dialog that reads: The device Generic volume cannot be stopped right now. Try stopping the device again later.
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.

Alone in Google Wave? Public search tutorial

Google Wave navigation panel - note the SEARCHES itemMany people I've talked to were excited to finally get their Google Wave invitation, only to realize they were all alone in the latest document collaboration system. What good is collaboration if you have no one else to work with?

Here's a quick hint to get you up and running and experimenting with Google Wave until your friends catch up: searching for public waves.

By adding the with:public qualifier to your search terms you can find public Waves to see how other people are using Wave and to start working with Waves yourself.

Toronto Public Libraries too: iPod Touch and iPhone Wi-Fi connection at Starbucks for Bell Internet customers

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. )

Firefox OpenSearch on popup menu after highlighting text

I consider myself a 'power' FireFox user, but I had no idea you could run an OpenSearch search of text you highlight. It even opens the search results in a new tab! Here's a quick video of the functionality in use, followed by the really easy steps to follow.

Google Earth KML file for the photographs on my photoblog

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 element to have Google Earth re-load the data file every hour, so that newly geotagged photos are included as well.

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. )

Syndicate content