MySQL dumps with DateStamp's

Posted by John
on Tuesday, 30 October 2007

Quickie here, below is a simple command to backup your MySQL database to a fully datestamped file...

mysqldump -u user mydbname > "backup_`date +%Y%m%d_%H%M`.sql"

Replace 'user' with your MySQL username and mydbname with the name of the database your making a dump of.

The > pipes the output to the file.

The 'date' part uses Linux's date function to append date digits inside the filename. The ' embeds it inside the filename.

So in the end you should end up with a file something like...

backup_20071030_1700.sql

Neat!

Twittering with Skype

Posted by John
on Tuesday, 30 October 2007

Just found out how to do this, major bonus, now I can twitter from my Skype account; how easy is that!

  • First open Skype and click 'Search'
  • Do a search for 'twitter4skype'
  • Add them to your contacts

Now to authenticate this little Skype Robot with your Twitter account your going to have to send it a chat message, but in one line so be careful here.

  • Start a chat with twitter4skype
  • Type: /account
  • Press shift+return together
  • Type in your twitter account name
  • Press shift+return together
  • Type in your twitter password
  • Press return

You should get a message shortly after saying 'Registration complete!'.

Now every entry you send to twitter4skype will appear in your Twitter stream, including fully formatted html links.

Plus any posts your friends make will appear in the Twitter4Skype chat stream so you can track what your friends are doing as well as yourself.

Warning!

Be aware though that if you post anything in any group skype chats / swarms the Twitter4Skype bot will post them to your Twitter account.

Major pain!

Only way to kill it is to change your Twitter password, or change the Group chat to a Public chat.

Practically a virus!

The Skypephone

Posted by John
on Tuesday, 30 October 2007

Skypephone

I am so getting one of these, launching in the UK on November 2nd 2007; Skype and the 3 network are releasing a mobile phone that is connected 24/7 to the Skype network so all your phone calls are now free.

Damn cool, ok you have to top-up a minimum of 10 quid a month on pay-as-you-go and it costs 49.99 but with a 2mp camera, mp3, video streaming and instant messaging via Skype how could it be bad!

Will have to wait and see.

Alternative

Alternatively if you don't want to buy the new Skypephone and you're on an all-inclusive data plan, like Blackberry, you could use fring.

This is a free piece of software you download on to your SmartPhone which allows you to hook up to one of the IM Services like Skype, etc. at no cost other than data.

Geocoding... Virtual Earth + Google Maps

Posted by John
on Monday, 29 October 2007

As most will know but some still contend against, the world is indeed round; and to track a point within said world we use a system of Latitude and Longitude; and maybe the odd Harrison watch.

Now for computer's it's a little more complex. System's like Google Earth and Virtual Earth use something called Geocodes.

Unlike Latitude and Longitude which operate with hours, minutes, seconds; Geocodes are point-mapped numerically to the location.

Now converting zipcodes to geocodes is simple but I've been looking around and apparently UK postcode -> geocodes aren't freely available due to Royal Mail wanting cash, but I may be wrong.

Here's some resources to get you started...

Links

Virtual Earth SDK

Nice VS.NET example

Pricey for the UK, supposedly

Google Maps API Blog

Google Maps Clickable Polys

Geocoding with Virtual Earth & Google Maps

Precise Map Pointing with Virtual Earth

OpenStreetMap

Finding things with Virtual Earth

Reading points and plotting with Virtual Earth

link + demo

Source...

Feeding Maps with GeoRSS

code breakdown

hurricane tracker

Geocoding Tools

Rsync + SSH quickly

Posted by John
on Monday, 29 October 2007

Another little mini article on automating file remote file transfers with RSYNC + SSH.

RSYNC

RSYNC is a Linux tool that allows you to copy all the files from the source to the destination, but copies only the one's which have changed between them; limiting the data you have to send rather than doing a blanket copy all.

SSH

SSH is a tool that allows you to gain remote access to a server from your computer.

RSYNC + SSH

Put these two together and you'll be able to copy files from your pc to a remote box as seemlessly as you do a COPY * from the command prompt.

Creating the Keyfile

First off it's good to stick your .SSH keys in the .SSH directory rather than all over the place so type...

CD .SSH

...From the terminal to navigate to your .SSH directory.

Now type...

ssh-keygen -d

This will generate a stronger SSH key. When asked for the name of your key type 'STORAGE' as we'll use this to backup our files to somewhere else. Don't enter a password if you want it to not prompt you for one everytime you do a transfer.

Two files will be created, a private key, and a public .pub public key. These will be both binded to your PC and wherever you upload the public key file you will have access to from your PC.

Copy to your Remote Box

Now use WinSCP, TRANSMIT or some FTP tool to access your remote box and create a .SSH directory in it's root.

Create a text file called 'authorized_keys' with no extension and copy-n-paste the contents of your .ssh/storage.pub file into this text file on your remote box and save it.

Now you will have access to the remote box from your PC.

The RSYNC Command

Now to copy files from your PC to the remote box type this complex RSYNC command...

rsync -azvCL --exclude=.DS_Store --progress -e "ssh -i .ssh/storage" * user@mybox.com:/home/backup/

Let's break this down...

  • -azvCL, this tells RSYNC to compress the data across the connection if it can so if your sending 22mb of text data it'll take less time; plus it'll recursively copy all the files and directories you choose.

  • --exclude, defines what files to exclude in the transfer, for this i'm on a MAC box and I want to exclude the file thumbnails OSX creates.

  • --progress, tells rsync to show us interactively the progress of our transfers.

  • *-e*, is the important bit, this tells rsync to use SSH and where the keyfiles are located.

  • Replace USER with the username for your remote box, and storage.com with the domain name or IP address of your remote box.

  • :/home/backup/ tells RSYNC to copy the files to the backup directory located in the base of your remote box.

The beauty with RSYNC over FTP is that if the transmission breaks half-way it won't copy the file, so you won't be left with half of a file on your remote server thinking it's the full copy; and with all these options enabled it's hellishly quicker.

P.S. Use Markdown + SmartyPants for semantically correct XHTML.

Enjoy!