Page 1 of 1
- Title: MySQL Copy Data from Live Table: A Helper Script
- Published: 2009-08-14 10:20:50 Updated: 2009-08-14 10:22:11
- Language: Bash
- Author: jonesy
- Description:
This is a script that can help you in a situation where a production database cannot be made unavailable for the amount of time it would take to copy data to a new table with a different indexing scheme, and indexing the production table directly would lock the table for way too long.
This script copies rows in small "nibbles" from the production table to an empty table you create with the same column defs, but different indexes (or, that was the reason I created it, you might use it for other purposes). Between copies, it checks the load average to insure you're not killing the server.
The variables at the top of the script are pretty self-explanatory, except to note that there are separate NEWDB and OLDDB variables in case your new table also lives in a new database. The INCREMENT is the number of rows you want to copy over at a time. If you set INCREMENT to 1000, it’ll copy 1000 rows, check the load average, and if it’s under MAXLOAD, it’ll copy over another 1000 rows. It also keeps track of the number of rows in each database as it goes, since writes are still happening on the bad table while this is going on.
- Title: Database-driven PDF Reports with Charts Using ReportLab
- Published: 2009-08-14 10:04:20 Updated: 2009-08-14 10:06:47
- Language: Python
- Author: jonesy
- Description:
You can see more about how this was put together at my blog: http://www.protocolostomy.com/2008/10/22/generating-reports-with-charts-using-python-reportlab/
This is an example script that will create a PDF with various text objects, a code sample, and a line chart using data from a database. It utilizes ReportLab, an excellent report generation library written in Python, for Python developers. It's done a great job for what I've used it for. The learning curve looks worse than it is -- you can get a lot done by reading a little documentation and looking at the examples that come with the library. You can get the library here: http://www.reportlab.org/rl_toolkit.html
- Title: Grab Event Locations from Google Calendar (and geocode them!)
- Published: 2009-08-14 09:50:28 Updated: 2009-08-14 09:50:28
- Language: Python
- Author: jonesy
- Description:
This is a dead-simple example of how to create an authenticated CalendarService object, grab the location of events on a given calendar, and geocode them in preparation for use in a GIS application, storage in a database, or the creation of a Google Maps mashup.
- Title: Send Important Syslog Messages to Your Jabber Client
- Published: 2009-08-11 14:41:58 Updated: 2009-08-11 14:41:58
- Language: Perl
- Author: jonesy
- Description:
Just set a syslog facility to report to a named pipe (the script uses "/var/log/log-fifo"), edit this script with the name of said named pipe, and it'll read from it continuously, sending any messages that come across to your Jabber server.
- Title: Command Line Interface to Google Spreadsheets
- Published: 2009-08-08 15:51:05 Updated: 2009-08-08 15:51:05
- Language: Python
- Author: jonesy
- Description:
Save this to a file, execute it, and it’ll prompt you for your gmail account credentials, then show you all of the spreadsheets you have access to. Pick one, then pick a worksheet within that spreadsheet, and it’ll dump the contents, or (if you use the -a option) it’ll prompt you to fill in values for each column of a new row.
Originally posted here: http://www.oreillynet.com/onlamp/blog/2007/11/a_command_line_interface_to_go.html