Clean Install of Snow Leopard

Like most of the people coming from Windows world, I am kind of accustomed to do clean OS install from time to time. I’ve switched to Mac 3 years ago and honestly speaking, unlike Windows I haven’t noticed any slowdown or anything on OS X even after many months, but I still like to get rid of old unused stuff and make some kind of fresh start from time to time. Also I am considering upgrade to Lion so doing it from cleaner system makes more sense to me.

This was my first clean install since I bought my current MBP in April 2010, and since some of my friends asked me for guide how to actually do it, I’ve decided to spend some time making this tutorial. In order to do clean install you will need either Mac OS X install DVD which come with your Mac or Snow Leopard Install DVD if you’ve obtained it separately.

Caution: This is clean install which means that before installation will start we are going to format partition on hard disc which will effectively destroy all your data. Make sure that you have backup for all important data or at least you do Time Machine backup before you start this procedure (this is how I did it btw).

Procedure for doing clean install goes as follow:

1. Insert Snow Leopard Installation DVD, and double click to “Install Mac OS X” icon.
Mac OS X Install DVD

2. When installer starts click Utilities and then click Restart.

3. System will go for reboot and Snow Leopard installation will be started.
4. Pick your Language of choice on the first screen and click to Continue button.
5. Choose Utilities->Disc Utility from the menu
6. Select your disk (i.e. Macintosh HD) in the left panel and then pick Erase tab. (see image bellow)
Disk Utility

7. Pick default Mac OS Extended (Journaled) from the format pop-up menu, optionally type name for your disk and click Erase.
Warning: This will erase all your data. Again don’t do this unless you’re 100% sure that you’ve made backup of your system.

8. After disk has been formatted, quit disk utility (Disk Utiliy -> Quit Disk Utility) and then follow instructions to finish installation.

After installation has been done you may start by coping data from your backup and install other software. Most likely you will want to install iLife software, but if you want all your previous stuff like preserved, good idea is to copy iLife files from backup to /Users/{your_username}. For example in order to have all my iPhoto images in place after I did clean install, first I copied back whole content of /Users/dinke/Pictures from backup, so when iLife installation is finished I already have all of my images stored in iPhoto.

Other example is Adium, very popular app used for Instant Messaging, personally I use it for Gtalk and ICQ and I can’t afford to lose any of my chat history, so this is the way to put everything back after doing clean install.

1. Download and install the latest Adium
2. Quit Adium and put back these data from your backup:

~/Library/Application Support/Adium 2.0/

Where ~/ is your home directory (for example, /Users/[your user name]).

3. Start Adium

Now you will have all of your settings and logs in it. Awesome isn’t it? :)

Also after I put my data back I had a problem to actually search trough Adium history. That’s known bug and solution for that problem can be found on this link:

That’s it, feel free to leave your comment in case you have any question or anything.

Android 2.2 Froyo on HTC Hero

As you probably already know, Android 2.1 (well known as Eclair) is the last version officialy published for our lovely Hero. With new phones such as Desire (HD) and Legend, HTC obviously has better things to do than keeping their old phones up to date.

However thanks to Villainrom guys, HTC Hero is still alive and kicking. They have various ROM versions available, some of them are based on official HTC build (with HTC Sense), but some of them are more like “vanila” built, with no HTC Sense at all. One of them is Froyd Villain 1.5, which is the one that I’ve decided to play with this weekend.

Honestly, I like to keep things on my phone working, but since I was totally frustrated with inability to do wifi tethering (even with anetShare or wifi tether apps it didn’t work with Mac) I’ve decided to jump into unknown and spend some time playing with Froyo this weekend.

First off, installation is really easy. Just follow these instructions and within half an hour, you should be running brand new Froyo device. First boot will take a while, but be patient it will payoff later :)

Now here are my first impressions after few hours of playing with Villain’s Froyo:

– It’s incredible fast. Works without any lag and it’s probably 2 or 3 times faster compared to official HTC 2.1 Build.
– It’s much more customizable than official build. There are more tweaks for advanced users but even for “ordinary” users there are more ringtones, wallpapers etc. stuff
– Since it’s Froyo you can opt to install app on SD card
– Wifi Tethering is working (tested with anetShare)

– No HTC Sense at all. That means, no HTC Widgets (like cool weather widget for example), no fancy dialer etc.
– Even though it’s pretty stable, it’s still buggy and some things are not always working as expected. For example my official HTC headphones are not recognized at all. Phone reboot solved that problem but still there isn’t any visible indicator showing that headphones are connected. Same stands for charging. I also had hard time to figure out how to turn off spelling and prediction.

Bottom line, I really like it but I also miss HTC Sense a lot, so will probably give it few more days and then try other (Villain) HTC Sense based release which still *should* work faster than official build plus there should be tethering available.

Here are some pics (created with dropcap2 app):

Steve Jobs Keynote Cloud Keywords

As Mac fan who always stays late at night to watch Steve Jobs Keynote after every big Apple Event, I always thought that having “Keyword Cloud” with most frequent words that Steve Job’s use during keynote would be very interesting to see.

Unfortunately we still don’t have anything like that, but someone put short (180sec) version of latest iPad keynote, and it’s really interesting to compare that with short version (90sec) of Steve Jobs 2008 keynote. I’ll leave keywords to yourself, it’s not very hard to figure ;)

Latest Keynote (iPad Announcement) in 180 sec

2008 keynote in 90 sec

MySQL: Deleting with Left Join

Today I had to deal with one huge table and cleanup all data where foreign key doesn’t have it’s primary key match in original table, just to remind myself how sub-queries in MySQL are terrible slower than joins.

I have some script which generates domains from typos, so I have one table with original domains (master_domains) and other one (result_domains) with generated typo domains. Basically something like this:

mysql> describe master_domains;
| Field  | Type             | Null | Key | Default | Extra          |
| id     | int(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| domain | varchar(255)     | NO   | UNI | NULL    |                | 
2 rows in set (0.07 sec)

mysql> describe result_domains;
| Field     | Type             | Null | Key | Default | Extra          |
| id        | int(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| domain    | varchar(255)     | NO   | UNI | NULL    |                | 
| master_id | int(10) unsigned | YES  | MUL | NULL    |                | 
3 rows in set (0.01 sec)

Table result_domains has master_id which is foreign key reference to primary key (id) in master_domains table. Since I also have other scripts generating domains without typos (which store result_domains.master_id field as NULL), today I simple wanted to get rid of those masters without proper master_id reference in result table or in other words those master domains where result_domains.master_id is NOT NULL.

With sub-queries you could write query easily with something like this:

delete from master_domains where id not in 
(select master_id from result_domains_frontend)

It is good habit to always run select query before deleting big number of rows (just to make sure your query is written correctly) so I tried select query first:

select * from master_domains where id not in 
(select master_id from result_domains_frontend) limit 10

However, it took several minutes to run without any output so eventually I’ve decided to stop it. I know that sub-queries are much slower than joins, so decided to do try removal operation with left join.

Left joins are actually perfect weapon to find rows that exist in one (left) and doesn’t exist in other (right) table. They also have one big advantage over sub-queries – they are performing much faster, plus they are backward compatible with old prehistoric MySQL 5.x versions. However delete syntax is little bit tricky so after few trial and errors eventually I came out with this query:

delete master_domains.* from master_domains 
left join result_domains_frontend 
where result_domains_frontend.master_id is null ;

And voila after a while it came up with result:

mysql> delete master_domains.* from master_domains 
left join result_domains_frontend 
where result_domains_frontend.master_id is null ;
Query OK, 270558 rows affected (46.58 sec)

MySQL: Moving table from one db to another

To move one table from one db to another, you can create new table (create table foo_new like foo) in db where you want to move table and then copy data with insert into/select query. However there is much easier way which is especially handy when you deal with big tables.

As you probably aready know, there is easy way to rename MySQL table just by issuing rename clause in alter statement:


You can also use RENAME TABLE syntax like this:

RENAME TABLE foo TO new_foo;

Now, when you need to move table from one db to another, all you have to do is to specify it’s current db and new db name as table prefix. For example if you want to move table foo from current db to new db you can issue queries like these:




Btw there is important difference between ALTER and RENAME statements in a way that with RENAME you can rename more than one tables at once. This comes handy if you want for example to swap names of two tables:

RENAME TABLE table1 TO temp, table2 TO table1, temp TO table2;

« Previous Page Next Page »