« June 2008 | Main | August 2008 »

July 21, 2008

Tweaks to MySQL installation

After you install one of the MySQL packages available for the Mac, there are some steps that you should do.

First, make sure your MySQL installation knows about time zones. This is important if you want to run your MySQL in the UTC time zone.

To update the mysql database time zone tables, do:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

Type the password at the prompt (hit enter if you don't have one yet).

And then make sure all your date/datetime fields use the Highlander-timezone. Edit my.cnf and add:

[mysqld]
default-time-zone=utc

Second, make sure your server is using UTF-8 everywhere. Add to my.cnf:

[mysql]
default-character-set=utf8

[mysqld]
character-set-server=utf8

Third, set mysql to strict SQL:

[mysqld]
sql-mode="TRADITIONAL,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY"

Finally, make sure you use InnoDB by default:

[mysqld]
default-storage-engine=InnoDB

There are probably more tweaks to make your MySQL saner. This are the one I feel comfortable recommending.

DBD::mysql and db_imp errors

I'm installing all my MySQL stuff in a Leopard 10.5.4 desktop and I made some mistakes along the way that I though about documenting here for future reference.

First, although the hardware and OS are 64-bit in a lot of places, the standard perl installed is not one of those. So stick with the i386 MySQL package (or try a 64bit server, but use the 32bit client...). I'm using the Proven Scaling MySQL packages mentioned earlier, and I'm happy so far.

Second, make sure your regular user has all privileges to the test databases. I just do:

melo@DogsHouse:lib $ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 108
Server version: 5.0.62-enterprise-gpl MySQL Enterprise Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all privileges on test.* to 'melo'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

This will make your DBD::mysql tests much happier.

Third, in case you see failing DBD::mysql tests with:

Can't use dbi_imp_data of wrong size (127 not 124) at ...

Upgrade your DBI. I'm now with 1.605 and no dbi_imp_data errors anymore. Clean DBD::mysql install.

$chromatic++

Nothing to add, really. Maybe another day.

QOD

In response to the FSF article on the iPhone, let me point you to the balanced view of Stu Charlton.

Quote of the day:

The OpenMoko counter-argument is "give it time, in the long run, it will win". And look, in a way, I hope so. Using the iPhone is a great case of following Keynes' adage, in the long run, we are all dead., where we optimize for short term gratification at the expense of our future.

July 18, 2008

Creating a new user using dscl

In case you ever need to create a new user in Leopard using the command line, the required steps are documented in the Porting UNIX/Linux Applications to Mac OS X document.

Disqus

Heads up: I'm switching my comments to Disqus. I had several people complaining about the current HaloScan-based system.

Expect minor disturbances in the force.

Update: we are now Disqus-powered. They still don't have an importer for old comments, so for a while, old comments are orphaned. Hope they fix that soon.

Subversion 1.5.0

I missed the release of the new 1.5.0 version of Subversion. Its funny, actually. This was somewhere around June (the blog post lacks a proper date), and I didn't see it mentioned on any of the blogs I follow.

Anyway, its out and I was expecting it to see the new merge tracking stuff. One of my gripes with Subversion is that yes, branching is cheap, but the merge part is awful hard to do and puts much of the load into your lap.

From my superficial first look, all I can say is this: what a mess!

I need to read the documentation more thoroughly but it seems full of special cases and workarounds for common scenarios that should just work.

For example, the "Reflective/Cyclic merges" that are mentioned, are the most common ones for me when I'm using feature branches.

I think this phrase is telling:

The only way to truly solve this is to invent a new merge algorithm in Subversion that does not rely simply on revisions

Of course you can think that branches are not good for you, and that they slow you down. I think its a matter of personal organization. Multiple active branches fit my brain and my workflow just fine, and I love to organize stuff with them.

Trying MarsEdit again

I've tried at least twice now to move from ecto to MarsEdit, but I was having some problems moving my ecto setup from 10.4.x to 10.5.4, so I decided to give it another try.

This time it seems to be working much better. Local Markdown works, and I could define my usual shortcuts easily with the markup editor.

I've still haven't found a way to import all my posts (I want to have the full history locally), so I'll have the check the manual for that one.

In the features-I-would-love-to-see-departement, I haven't found a decent pre-post analysis tool. If I repeatedly link Markdown to http://daringfireball.net/projects/markdown/, my blog tool should suggest the same link in future posts.

A nice tweak to the editor would be smart quoting: if I have a selection active and I type \``,",',*, or_`, it should wrap the selection with that characters.

So for now, I've switched. Let's see how it goes.

July 16, 2008

TechCrunchIT are a bunch of hypocrites

Really, its disgusting how low you can get.

Here we can see Nik Cubrilovic ranting about how close the iPhone is and all the DRM plague that it brings to our world.

Cool, thats nice, and certainly a valid point of view. It's certainly better written than the usual diatribe we get from the Portuguese open source evangelists.

But take a moment to search the TechCrunchIT site for openmoko. You can just click the last word. None. Not a single article. Now try for iPhone. Yep, 9 articles just this month.

search for openmoko - result page

Hypocrites. At least other trolls-for-ad-money don't try to wear the open-source t-shirt.

July 15, 2008

Feed cleanup

I removed all traces of the multiple feeds this site had to just one: http://www.simplicidade.org/notes/42.xml.

I've also added redirects on all of the old feeds to that one, so unless your feed reader cannot read RSS 2.0 it should all work out.

Feed Validator tells me that I have three things to fix at the moment. I'll probably fix two of them (done). The other is content related, and I don't know of a easy fix.

Update: in a effort to improve my ego (any bit counts), I've also started to use FeedBurner services to track usage of the feed. You don't have to change nothing, the official feed URL will always be http://www.simplicidade.org/notes/42.xml.

July 13, 2008

Hell broke loose around here...

The silence around here is caused by a 100% increase on the house population.

Our dog, Ginger, was pregnant and gave birth to 6 new puppies (pictures as soon as I get some power into my phone).

The problem was with the first puppy. It was too big (the father dog was bigger than her, so this puppies are big..) and she was couldn't deliver the puppies on her own. So she had to do a C-section.

It went well, but due to the number of puppies they had to do a lot of incisions. So the uterus was damaged, and they had to remove it. Also the ovaries. So no more puppies.

The other problem is that given that she didn't have them in the usual way, she didn't bond with the puppies. If you think of it, try to imagine awaking up from a drug induced sleep (you know, your regular morning), and having 6 rat-sized tubes of flesh sucking hard on you (ok, maybe that imagine is the wrong one for some of you...).

Anyway, the bottom line is that she is not accepting them as well as she should. And that means work for us.

Our first born waked up like clock work each three hours to eat. This time, we need to awake up each three hours to convince Ginger to let them eat. All six of them. Fortunately she has plenty of milk...

So its crazy time around here, not a lot of time at the computer.

I'll try to catch up next week. There is a lot going on with the iPhone launch, the crazy data plans in PT, the new apps, my new desktop at work, and XMPP stuff.

July 07, 2008

Middle-range Macs

I'm looking for a desktop Mac.

I'm pretty unhappy with the current Apple offering. We have the high-end Mac Pro, starting at 2.499€ (but you can configure a single CPU version for 2.049€, and at the low end, the Mac mini, starting at 499€. In the middle we have the iMac's but those have a built-in screen, and I already have dual 20" Wide displays that I would like to reuse.

I wonder if Apple will ever fill the void between the two head-less versions they have now. I want multiple internal disk-drives (or at least an eSATA connector) because for my main workstation I like to have RAID1, but the only way to get those is a Mac Pro, way to expensive.

There are alternatives, but I would like to avoid the hassle.

July 04, 2008

Lazyweb request: how to find full path to script

Dear Lazyweb,

this is something that I searched for quite some time and could not find yet, maybe a helpful soul knows.

In a bourne shell script, how can I find the full path of the script being executed?

Thanks in advance.

Update: the following command, sent by Celso Pinto, passes all my tests.

SCRIPTDIR="`cd $(dirname $0);pwd`

For the record, I used two scripts to test this. First, the script_dir.sh script:

#!/bin/sh

echo "\$0 is $0"
SCRIPTDIR=`dirname $0`
echo "    dir: $SCRIPTDIR"
SCRIPTDIR="`cd $(dirname $0);pwd`"
echo "    dir: $SCRIPTDIR"

The script to run the tests, run_script_dir_tests.sh:

#!/bin/sh

chmod 755 script_dir.sh

./script_dir.sh 1
../$USER/script_dir.sh 2
../$USER/bin/../script_dir.sh 3

sh ./script_dir.sh 1 with sh
sh ../$USER/script_dir.sh 2 with sh
sh ../$USEr/bin/../script_dir.sh 3 with sh

export PATH=`pwd`:$PATH

cd /
script_dir.sh "via path"

No more bazzilion git-* commands

In case you use the script from the last post, be advised that the current master branch of git.git no longer installs all those git-* on your PATH.

The current git/bin/ contents are:

melo@MrTray:melo $ ls -l /usr/local/git/bin
total 14664
-rwxr-xr-x   89 root  wheel  2826820 Jul  4 10:05 git
-rwxr-xr-x    1 root  wheel   573476 Jul  4 10:05 git-receive-pack
-rwxr-xr-x    1 root  wheel  2826820 Jul  4 10:05 git-upload-archive
-rwxr-xr-x    1 root  wheel   994596 Jul  4 10:05 git-upload-pack
-rwxr-xr-x    1 root  wheel   273636 Jul  4 10:05 gitk

I'm using version v1.5.6.1-204-g6991357. This is not the final 1.6 release (the next one), so you might see further commands added (git-shell might join this list).

At least for me, this required some training because I liked to git-TAB to complete...

x-git-update-to-latest-version

This morning in the git mailing list, I wrote a small shell recipe to update your git to the latest version but keeping the previous ones around, in case something goes wrong.

I noticed that what I wrote was a lot better than the hack-and-slash script I was using, so I promoted a cleaned up version of that to my scripts stash. Hence, you can now download x-git-update-to-latest-version and enjoy painless git updates.

You need to tweak two things at the top of the script:

  • the location on your hard drive of the git.git clone (you need to create that with git clone git://git.kernel.org/pub/scm/git/git.git first);
  • the base directory where all the git versions will live.

You'll end up with something like this (I use /usr/local as my base directory):

melo@MrTray:melo $ ls -dla /usr/local/git*
lrwxr-xr-x   1 root  wheel   25 Jul  4 10:05 /usr/local/git -> git-v1.5.6.1-204-g6991357
drwxr-xr-x   7 root  wheel  238 Jul  4 10:05 /usr/local/git-v1.5.6.1-204-g6991357

Each version will be named git-VERSION where VERSION is the output of git-describe. A symbolic link named git points to the latest version.

Just add BASEDIR/git/bin to your PATH and your are done.

Small tweak to my mail setup

I try to keep my inbox empty, but due to a lack of a task manager that I can feel good about, I don't have a place to put pending tasks.

So sometimes I leave them on my inbox. Not good.

Until I find a good system that I like to use, to keep my tasks and projects, I made a small adjustment to my mail habits. I already have an extensive list of rules to filter mailing lists and other regular emails to proper folders.

What I did now was this:

  • created an Interesting Folders smart folder: basically, it joins together the folders (either mailing lists, or my regular inbox) that I want to keep a close eye on;
  • created a Quick Read smart folder: simple condition - show everything from Interesting Folders that is not read.

So each time I open up my email client, I just look at the Quick Read folder. It shows only new mail messages that I haven't read yet. The thing I like the most is that if I need to do something later, I can just leave it there and it will disappear on my next check, but still be safely stored on the original folder.

It's not perfect by any means, but its working very well for me.

Free weather report

There is a storm coming in.

Its time you realize that the best way to keep your mail service operational is to outsource the SMTP part. I did it last year, kept the IMAP server, moved the SMTP server of to Postini (before the Google buyout) and I must say I'm very happy.

July 02, 2008

MySQL advice

When people ask me what MySQL to use, I used to respond "Go to http://dev.mysql.com/ and download the community edition". I recommend it over any version of MySQL that is bundled with your OS.

But I also listen to people who know more than me when it comes to MySQL, and one of those just asked (and presented facts) if the those binaries are in fact dead.

So right now, my new advice on MySQL choices is this: read the latest MySQL Performance blog article and decide what you want.

I'm going to test the Jeremy Cole's releases of MySQL to see if they work correctly with my environment, and I'll keep you posted.

One thing will still send me to dev.mysql.com, though: Mac OS X binaries. Jeremy only has RedHat Enterprise Linux RPMs Update: I was wrong. At least the Enterprise version has Mac OS X binaries. Thanks to Joaquim Carvalho for pointing them out for me.

Off

Some articles should have comments turned off.

RabbitMQ added support for XMPP

This is interesting news. RabbitMQ, an open source implementation of APMQ in Erlang, now has support for XMPP using Ejabberd and mod_rabbitmq.

It seems to be MUC-based, not PubSub. I hope to see a future version with PubSub in the future.

Disabled menu items

A bit because of my last post, I couldn't stop noticing a similar trend in software development.

There is a series of posts about disabled menu items. It all started with Joel Spolsky "Don't hide or disable menu items".

That had a strong reaction from Daniel Jaikut (my personal favorite take on this) and John Gruber, amongst others.

I'm not a GUI application developer, but I must say that it just sounds pretty wrong to go into pop-up-hell to solve the problem. Sure, we could use a in-application tool to explain why the menu is disabled, but that should be optional (like the search menu function in Leopard).

Joel assumption is that users are not very smart and need some explicit text dialog boxes to explain things to him. This is of course true for many many users, but software developers should also be concerned with raising the bar of the average user. Sure, its not popular and you might sell fewer copies, but users need to be probed, poked and pushed to be a little smarter.

Road blocks can be challenging and the felling you get when you figure it out why something is grayed out is worth a thousand dummy books. Not because these particular problem was solved, but because the user developed a mental framework on how to tackle the next difficulty.

If you clear the road of all the roadblocks, your users will only know how to drive straight and they will crash on the first curve. If they are used to reason things out, and understand why some menu items are grayed out, you'll end up with a user base capable of making better use of your software, and allows you to write more full-filling software applications.

Make it harder

Right now, in Portugal and in other places like the US, our schools are lowering the bar (making tests easier) to have a higher percentage of students with passing grades.

This is wrong because the only thing that its raising is the bar of mediocrity.

Tests should be hard not because we like failing grades and angry students but because hard tests force students to evolve their reasoning and deductive skills, memory, and a lot other brain activities.

The worst case scenario is not having a poor student fail a passing test, the worst case scenario is having the next generation of bright students not being pushed to their full potential because they slept through their early years, and ended up a lazy brain.

Forget breakthrough advancements in medical, science, math, chemistry, and other areas. It was so easy to fly through the early years, the above-average kids just fell asleep and their capabilities where not exercised when they most needed, in their youth.

You are worried with the growing segment of the population that is growing fat because of bad lifestyle decisions and even worse food choices? That will be nothing if the next generation of leaders is made of average minded people, with poor to zero knowledge of history and culture, not to mention science.

That's my worst fear.

And you know what? It's your fault, and mine. Its our fault because you and I need to get off our asses and do one of two things:

  • be more politically active, run for local office, talk about education where ever you go, make it your national number one priority;
  • or if you are not inclined to be a politician, make sure your own politicians talk about education. Ask them, prod them, organize groups for higher standards, make your voice heard.

And if a pro-education politician gets elected, support him, defend him, give him cloud cover. Education is not a sexy subject and harsh measures might be required. Having Be aware of what is being done to the future of your kids, help in what you can.

I don't know if I will live to my own expectation on this, I sure hope so. Because this is an example of the right meaning to the word important.