Dumping MySQL databases using Groovy

Today I needed to use Groovy to create a dump of all MySQL databases on the MySQL server running on my local machine.

So I looked at my earlier blog entry on how to dump MySQL databases using the “mysqldump” command.

So when I issued the command create a dump from console, the contents of the database are dumped to a sql file as expected.

// Works in command line
mysqldump --all-databases -u [username] -p[password] -C > alldatabases.sql

As you might know, it is fairly straight-forward to execute shell commands from Groovy. You simply put the command in quotes and call the execute() method.

However, when I issued the same command using Groovy, the command did not work… well, at least not at first.

After some head-scratching and pondering over the help documentation of Groovy and MySQL, I found that the correct way to call the mysqldump command in Groovy is:

// Works in Groovy (as well as command line)
/usr/local/mysql/bin/mysqldump --all-databases -u [username] -p[password] -C --result-file=alldatabases.sql

The basic issue was that the “>” symbol (to redirect output to file) does not work as one expects in a console. If you use Groovy to issue command that contains the “>” symbol, the command will silently fail (which is rather frustrating).

Thankfully the mysqldump command provides an alternate way to dump SQL to a file — the “–result-file” option (which does the same job as “>”). Using this option instead of the “>” symbol does the job very nicely.

Another minor issue was that when issuing the command from Groovy, I needed to fully path the mysqldump call. So, in my case the call was to /usr/local/mysql/bin/mysqldump rather than mysqldump.

Oh, and BTW, this is my first post on Groovy. More will come 🙂

New Zealand, a great place to do business (including software development)

Just found this blog entry that speaks of why New Zealand is a great place to do business. Some of the reasons mentioned are:

  • At 30%, the corporate tax is lower than or equal to most developed countries?.
  • Our GST is only 12.5%, in most developed countries it is 15-25%.
  • Workforce participation is 68%, very high by international standards.
  • ACC provides no-fault income insurance, meaning businesses to not have to go to massive expense insuring themselves against litigation by injured workers and hiring lawyers to defend themselves.
  • Ease of doing business is New Zealand is second in the world only to Singapore.
  • This is the least corrupt country in the world.
  • Corporate profits were up 60.5% in just six years from 1999 to 2005.
  • Only 0.54% of businesses failed last year.

Plus it offers a great lifestyle!

On the downside, Internet connectivity less than average, but is getting better every year.

But if you can be happy living on a large, very pretty island, New Zealand is the place for you.

I came to New Zealand five years back and have been working in the area of software development, and have enjoyed every minute of being here.

iPhone and Flash — iPhone SDK comparison with Windows Mobile, S60, Android

Just saw an interesting article on Engadget that compared iPhone SDK to Windows Mobile, Android, S60 and Toolchain.

What is really interesting is that Windows Mobile along with Nokia S60 supports Flash.

iPhone, as you know, does not support Flash (and won’t support it any time soon, given Apple’s comments yesterday about Flash being too slow to run on iPhone).

And what is even more interesting is that Microsoft and Nokia have signed a deal to make Silverlight available on Nokia S60 and S40.

So two things really:

  1. Adobe needs to do something to get on to the iPhone platform. AIR runtime perhaps?
  2. Adobe needs to look at engaging Nokia for AIR runtime.

Here is the article at Engadget: iPhone SDK Comparison Chart.

Incorrect Flex 3 SDK download on Adobe site

I just went to download Flex 3 SDK from the Try Flex Builder 3 page on the Adobe site.

The file that downloads when one clicks the “Download Flex SDK 3 for all platforms” link at the bottom of the page is called “flex2_sdk_hf1.zip”.

When one unzips the file and looks at the readme, it confirms that the SDK vesion is: Version 2.0.1.

I presume the “hf1” in the file name suggests that it is Flex 2 SDK with ‘hotfix 1’.

Is anyone else also facing this issue or is it only me?

The SDK that ships with Flex Builder 3 does indeed have a readme that indicates SDK version 3.0. I guess I’ll just use that for now.

Update (9.30 a.m.):

The link on the download page has now been fixed. Adobe took just an hour to pick up this blog entry, respond to it, and fix the issue. Very impressive!

Given that I downloaded the incorrect Flex SDK (2.0) earlier today, and am downloading the correct one right now (3.0), I can’t help but comment on the size of the SDK. Flex SDK 2.0 was 38.11mb. Flex SDK 3.0 is 78.44mb! Lots of goodies!

Important Flash Player Security Update – Check your applications

Adobe Devnet has a security advisory on the upcoming Flash Player 9 update. The advisory lists a few very important changes to the security model in Flash Player which can possibly impact your existing Flex and Flash applications. The changes are primarily to address the vulnerabilities of the earlier versions of Flash Player (9,0,115,0 and before).

There are four key changes that can possibly impact existing applications:

  • A socket policy file will always be required for all socket connections
  • A policy file will be required to send headers across domains (This will possibly affect some of the Flex apps that I work with)
  • The allowScriptAccess default will always be “sameDomain”
  • “javascript:” URLs will be prohibited in networking APIs, except getURL(), navigateToURL(), and HTML-enabled text fields

Although no date is specified, but these updates to Flash Player would come in force during April 2008.

Here are some relevant links, including the link to the security advisory: