One of the hacks I put in place for my new site design was to get image titles to display when you click on an image in the gallery. This isn’t out-of-the-box functionality for the NextGEN plugin; the description (which you set manually in the gallery manager) is populated, but the image title is not. The solution lies in modifying the title attribute of the a tag generated by gallery.php. To see an example of this hack in action for images with and without descriptions, visit the Space Needle pictures gallery and click on the last two images in the set. One shows only the image title, the other shows title and description. Code after the fold.
read more …
I doubt anyone will twitterbook about this on their InterScapes, but I know there’s a niche audience out there for this sort of Excel hackery so I’m posting it anyway.
If you know why you’re reading this already, skip to the code below the fold. Otherwise, here’s some explanation. In a project Work Breakdown Structure (WBS), tasks are organized into major tasks, sub-tasks, sub-sub-tasks, etc. as in the following example which is an actual project plan used by NASA:
1 Build a spaceship
1.1 Read wikipedia article on spaceships to determine required supplies
1.2 Buy spaceship supplies
1.3 Assemble spaceship
1.3.1 Attach top part to middle part
1.3.2 Attach middle part to thruster thingie
1.3.3 Paint spaceship a neat-o color
1.4 Set spaceship upright (facing sky)
2 Fly around in spaceship
3 Discover strange new worlds
4 Return home
4.1 Point spaceship at Earth
4.2 Land spaceship on Earth
4.3 Park spaceship in designated parking space
Instead of sequentially numbering the tasks, we assign subtask numbers to those tasks that roll up under other tasks. Assemble spaceship is a subtask of Build a spaceship so it gets Build a spaceship‘s number (1) plus a subtask number (3, since it’s the third subtask) so its WBS number is 1.3. Attach top part to middle part is a subtask of Assemble spaceship, so it gets 1.3 plus a sub-subtask number (1.3.1), and so on. MS Project also bolds any items with subtasks.
Since this type of WBS or outline numbering functionality isn’t available in Excel, it requires a VBA macro. Free code after the fold.
read more …
Unlike the rest of the known universe, Sprint has chosen not to support the Multimedia Messaging Service (MMS) for picture messages on Windows Mobile phones such as the Treo. This is annoying for many reasons, but most of all because it severely limits your ability to upload photos from your Sprint phone to Facebook. Facebook only allows mobile uploads via MMS or text message, and in some limited ways from mobile email as some iPhone users have figured out. Unfortunately this doesn’t seem to work with emails sent from Windows Mobile phones; Facebook returns a message stating that “you have uploaded from an unrecognized or unsupported address.” What is a poor Sprint user to do? Read on …
read more …
I was in the middle of upgrading the Wasington Parkour forum software to the new phpBB 3.0 when I got distracted by a MySQL limitation I wasn’t previously aware of: it seems you can’t drop more than one table at a time in the MySQL command line interface. This curious limitation begs for a command-line script solution, and indeed I was not surprised to find that there are plenty of them out there. As usual, though, I’m reinventing the wheel for my own entertainment.
For today’s exercise, I experimented with PHP on the command line (PHP CLI). Some of the features I wanted to include weren’t in the scripts I found elsewhere, so I built them in order to make this useful for my current phpBB upgrade and on into the future for various other situations:
- Allow the user to store db login information in the script if he really wants to, but if he’s a security-conscious and relatively sane person, leave it empty in the script and prompt him for the login information when the script is called.
- Allow the user to specify table prefixes so only certain tables are deleted. When I experienced epic failure on my first attempted phpBB 2 -> phpbb3 conversion, I had to go back and remove all the bad tables that had been created. They were prefixed with phpbb3_ while the old tables were prefixed with phpbb_. Obviously I wanted to leave the old ones alone.
- Provide some useful reporting on any errors encountered and results of the batch drop.
So, here’s what I have for you today: a PHP CLI script to batch drop all your unwanted MySQL tables (after the fold).
read more …
I present to you a short script to automate backup and compression of a MySQL database using perl on a Linux system. I had to solve this problem today and figured there might be others out there in need of the same solution. Store the script in a safe location, hidden from the Internets, and chmod it to 700 to prevent other users from viewing the source (because it contains db login information). Customize the variables at the top of the script and test it out (perl sqlBackup.pl). If it runs without outputting any errors, add a line to your crontab file to run the backup at the desired interval.
There are of course better ways of doing this, namely this one. I am doing it my way because I’m more comfortable with perl and this script gives me more flexibility and a bit of debugging in case something goes wrong. This script assumes you’ve got cron setup to email you any output, so you should receive notification if something goes wrong.
read more …