MySQL Backup Shell Script

Many of my clients need a quick backup solution before we implement anything on a larger more permanent scale. I wrote this simple script that simply make a copy of a database and then created a timestamped tarball of the file.

#!bin/sh

date=`date +%Y-%m-%d_%Hh%M`

cd /my/path/for/backups/

mysqldump -umy_user -p"mypass" my_database > $date.sql

tar -zcvf $date.tgz *.sql

# uncomment this line to import the sql into another database, for example as a mirror
#mysql -umy_user -p"mypass" mirror_database < $date.sql

rm *.sql

Then, just setup a cron job to run this at whichever interval you want this to run.

Bugzilla Changelog… Open Source

It’s been a few years since I’ve released the first version of Bugzilla Changelog, and over those years many folks have been asking if I ever intend on making it open source. While essentially open anyway as it was a Perl script, I’m now accepting patches and new work from anyone else interested.

Those of you who have submitted patches over the years should be pretty excited. I’ll be tracking project updates, requests, fixes, etc, through sourceforge.

View Bugzilla Changelog at SourceForge.net.

ZendCon 2007

It’s been about two weeks since I returned from San Fran, as I attended the full ZendCon 2007. Most of the tutorials/sessions were enjoyable and most of them gave me some ideas for new methods as well as pointing new tools out to me. A few have already come in handy, like cvs2svn.

However, several of the presentations had very poor descriptions and were not exactly what I was expecting. A few sessions were essentially waste of time because the presenters simply read their slides and failed to show any useful examples. Those sessions were simply a very expensive blog post, and I’ll be discouraging any and all conferences I go to from allowing that.

I met several folks from various projects and I was able to give feedback about some of their items. I had lunch with a few guys from Zend, who were involved in developing the Zend Studio IDE.

I also got to play around with the next version of the Studio app, which in my opinion is not quite ready (although it was a Beta). This new version is based off of the Eclipse project.

However, the new Adobe FlexBuilder2 is also built on eclipse, so it may eventually be easier for me to move to more eclipse-based projects.

Now it’s time for me to re-read some of slides from those presentations and see if I can re-brew for any new information.

Basic Flex Development Example

I see huge potential for Flex and Air applications with some of my core clients, as well as a way to attract new clients. As time goes on I’ll be discussing new applications we’ve got going in Flex, but I wanted to start with a very basic application.

This basic application displays a chart with download statistics for applications I’ve released over the years on Botsko.net. I’ll be adding on to this basic example so that I have a better showcase of flex work. For example, I plan on adding some advanced data parameters including changing the year, seeing data points on the chart, and some improved visuals.

This application totals about 300k including the php code that produces the xml for the data. That number can be reduced further with optimizations, and by removing some extra support-related files.

While Flex can be used to build some amazing applications, it’s also going to be extremely handy when used within an existing web page. I’m excited to see where we end up when using Flex.

Take a look:

http://experiments.botsko.net/tests/flex/chart2/

Uninstall U3 System from USB Thumbdrives

I recently bought a new thumb drive that came with the infamous U3 System software. I hate this software to no end and I wanted it gone, but the typical system formatting process and the manual deletion process didn’t work. After doing some research, I found that U3 provides an uninstaller which is a pain.

Just google “u3 uninstall.exe” or visit u3.com/uninstall and follow their stupid download process.

CVS to Subversion Transfer

Most of my projects all use Subversion now, as everyone knows it’s the recommended little brother of CVS. However, for everything that doesn’t have a home in SVN with a client, I was storing in CVS I had running on my local dev machine.

Not wanting to loose any of my files or their histories, I wanted to find a way to transfer everything into subversion. At the recent ZendCon I heard about cvs2svn and I tried it out. It was very easy to install (required Python, which was easy for me to installed through Yum), and it was easy to run – at least for me as I was just pulling everything over.

Now I’ve got everything in subversion and I was able to maintain the file histories for everything.

Tagging & Protecting PDF Files using PHP

I recently had to run some tests on tagging/watermarking an existing PDF file, and then protecting it using php. First, you’ll need to download the proper libraries.

Extract all of those packages, get rid of non-essential files and place most everything in the same folder… “font” and “decoders” will likely be the only folders remaining.

Then, place your existing pdf in the same folder.

Then, create a new php file with the following code. You can modify the message or its position, or you can ready the manuals for the above packages for more options. To set a user/owner password, just add them as the second and third arguments for the SetProtection method (outside the array, which is the first argument).

[PHP]
define(‘FPDF_FONTPATH’,'font/’);
require(‘FPDI_Protection.php’);

class PDF extends FPDI_Protection
{
function Footer()
{
//Position at 1.5 cm from bottom
$this->SetY(-15);
//Arial italic 8
$this->SetFont(‘Arial’,'I’,8);
//Page number
$msg = “If you’re not ” . $_SERVER['REMOTE_ADDR'] . “, then you’ve stolen our stuff.”;
$this->Cell(0,10,$msg,0,0,’C');
}
}

$pdf= new PDF();

$pagecount = $pdf->setSourceFile(“document.pdf”);

for ($i=1; $i < = $pagecount; $i++) {
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($tplidx,0,0,0);
}

$pdf->SetProtection(array(‘print’));
$pdf->Output(“newpdf.pdf”,”I”);
[/PHP]

Bugzilla Changelog Updated

The Bugzilla Changelog application has been updated to work with bugzilla 3.0. Please try it out and let me know if you have any issues.

Download Bugzilla Changelog 1.2.

One Year

I officially began my first full day of web development work under Botsko.net on October 2, 2006. It’s been one year since then and things are going well. I’m still in business with a growing list of larger projects and a great list of clients I’ve really worked well with over the last year.

Since we have a new baby on the way we’re going to be turning my home office into a baby room, at least until we move into a house with four bedrooms. Until then, I’ll be working from a studio downtown along with good clients / great friends Red Studio and Point Creative.

Here’s to a great second year with some exciting projects currently under development.