29 Apr 2009

Best USB Linux distros

I have used almost all Linux distros on the market! I liked some of them, hated the rest of them. Majority of users who still do not use Linux, they actually hesitate to install Linux on their computers' hard disks so that it does not interere with Windows.

So, I reckon a good way to start Linux is to try it without touching your existing Windows hard disks.
Of course, you can run a lot of Linux distros directly from live CD/DVD. But not only this is slower but also you often don't get any option to save your settings.

Fortunately, a lot of Linux distros offer the facility to create live bootable USB disk! You can simply boot from your USB disk [as long as your PC BIOS supports that] and then you will work like normal. You can even save your files on USB disk.

One thing you must remember though, Linux uses a different file system known as ext2 or ext3 compared to NTFS (and FAT) for Windows. Linux can read (but may not write) your Windows disks but not vice versa (without using special software)!

The new Linux users mostly confused by so many distros available. Which one is best?

First of all, you must select a distro which supports your hardwire fully. A lot of Linux distros don't support many WiFi cards and so if you use them, you need to connect to internet via ethernet cable only!

Here is a list of what I found about most popular distros.

Ubuntu - The version 8 onwards offers you to create a USB disk once you have booted with live CD.
Ubuntu is most popular distro now and it has excellent user community. However, its only problems are poor hardware support (especially non Intel based WiFi cards) and rather slow startup time.

Open SuSE - A very competent distro. Very good hardware recognition. However, I couldn't make it work from USB following guidelines.

Fedora (formerly Redhat Linux) - My personal favorite. It's hardware recognition is very good and it's lightening fast! My Windows Vista boots up from hard disk in 45 seconds. Fedora 10 boots up from USB in same time!
It is also easy to install new applications (eg. Open Office) in Fedora.

Mandriva - Another very good distro. Lots of built in apps. You can run from USB disk. But it too didn't like my WiFi card.

Knoppix - Its live DVD comes with most number of built in applications. But I was unsuccessful running Knoppix 6 from USB disk. Even if you run it from live DVD, you can still save your settings (persistent storage) in USB disk.

Puppy Linux - a small frill free Linux. At one time in past it was my favorite distro. But now, there are better alternatives available. A version of puppy comes with Open Office as well.

Damn Small Linux - Just 50 MB in size. But too small for modern day computing.

gOS - Based on Ubuntu, comes with lots of Google gadgets. Nothing special though.

Other distros - Not used yet.

Remember, if you Windows computer is screwed, you can still access most of your files if you boot up your computer with Linux.

The site www.pendrivelinux.com has list of USB Linux versions with step by step guide of how to create them.

Feel free to try all of them and see what you like. My personal suggestion will be - Ubuntu, Fedora and SuSE though as they offer best balance between features and usability.

In Linux world, you often hear the terms like Gnome and KDE. These are just two different GUIs for desktop (like Start menu/taskbar in Windows). You will also come accross as Debian and RPM packages. This is just a way of distributing applications in Linux. Some distros are Debian based (eg. Ubuntu) and some are RPM based (eg Fedora).

22 Apr 2009

How my mobile phone works like iPod Nano?


I thought of buying an iPod Nano. But after I examined iPod’s features, I discovered that my Nokia 6300 mobile can do almost everything an iPod Nano does!
The iPod Nano’s display size and resolution is exactly same as that of my Nokia 6300’s
My Nokia can play MP3 directly and 3GP video files. I can convert any MPEG, WMV, MOV, AVI, FLV (You Tube’s) etc. video files using loads of free converter available on internet.
Feature
iPod Nano
Nokia 6300
Screen
320x240 [4 cm x3 cm]
320x240 [4 cm x3 cm]
Music Playback
AAC
MP3, WMA
Video Playback
MOV
3GP
Interface
Via iTune only
As USB disk via cable or Bluetooth
Portrait/Landscape mode
Possible by tilting iPod
Possible via buttons
Built in Accelerometer
Yes
No (but not an issue)
Adding extra application
Only Apple’s application will work
Any Java (jar) file will work in the phone
Replacing battery
You need soldering tool to replace battery
Just take out the old one and put new battery inside
Extended memory
No way to put additional memory in iPod Nano
You can add micro SD card of size up to 2 GB
Built in speaker
None – you listen via microphone plugged into your ears only
Yes and of good quality sound
Built in camera
No
Yes – 2 mega pixels
Built in radio
No
Yes
Can be used as phone?
No
Yes (it is a phone!)
Price (mid 2009)
£100
£70
If you are thinking of buying an iPod (Nano or Classic), my advise will be hold on. There is a high possibility that your current mobile phone has all the facilities of an iPod. Although I do understand that majority of people buy iPod just because everyone else have it and it looks cool.
Nokia 6300 is quite an old model. But even that phone can compete with iPod. So, I am sure newer mobile phones even have more capabilities than an iPod.
Now I might have saved you few $£€ etc

16 Apr 2009

Cost of databases


Money moves the world!

Ultimately your choice of database will depend on cost benefit analysis. The vendors intentionally make pricing model very complex (you might need help of your lawyer to understand it – seriously).

Customers rarely pay list price of software nowadays. So, this chapter is to give you some ballpark figures only as guide.

Since, most vendors are USA based, prices are given in $.

Vendor
Product
$ per CPU
$ per user
Support per year $
Oracle
11g Enterprise
40,000
800
10,000
Oracle
11g Standard
17,000
350
4,000
Microsoft
SQL Server 2008 Enterprise
25,000
?
?
Microsoft
SQL Server 2008 Standard
6,000
?
?
Sybase
IQ 12
70,000
?
15,000
Sybase
ASE 15 Enterprise
70,000
?
15,000
IBM
DB2 9.5
35,000
?
7,500
MySQL
Enterprise Platinum
Free to install
N/A
3,000
per server support

As you can see yourself, SQL Server is cheapest and serves requirement of small to medium organizations very well. Oracle is cheap compared to its features against other databases like Sybase. That’s why Oracle is most popular among large organizations.

Although I mentioned earlier that Sybase IQ, being column based database, is better for large data warehouses, but it doesn’t make sense to justify its cost unless your DWH database size in terabyte level.

31 Mar 2009

Row versus Column oriented databases


We illustrate this with an example. Consider following table.
ID
FIRST_NAME
LAST_NAME
SALARY
MGR _ID
DEPT_ID
100
Steven
King
24000

90
101
Neena
Kochhar
17000
100
90
102
Lex
De Haan
17000
100
90
103
Alexander
Hunold
9000
102
60
104
Bruce
Ernst
6000
103
60
105
David
Austin
4800
103
60
106
Valli
Pataballa
4800
103
60
107
Diana
Lorentz
4200
103
60
108
Nancy
Greenberg
12000
101
100
109
Daniel
Faviet
9000
108
100
110
John
Chen
8200
108
100

In a row based database, the data is stored in disk in row-wise fashion like shown below.

100|Steven|King|24000||90101|Neena|Kochhar|17000|100|90
102|Lex|De Haan|17000|100|90103|Alexander|Hunold|9000|102|60
104|Bruce|Ernst|6000|103|60105|David|Austin|4800|103|60
106|Valli|Pataballa|4800|103|60107|Diana|Lorentz|4200|103|60
108|Nancy|Greenberg|12000|101|100109|Daniel|Faviet|9000|108|
100110|John|Chen|8200|108|100

I have just colored each row in alternating color for easier visualization. I used “|” as value separator just for the sake of understanding.

As you can see, values for each row are stored together on disk. When a new row is added, it is just appended at the end of existing disk blocks (as shown by this color in above example)

Most databases are row based. These are – Oracle, SQL Server, Sybase ASE, Access etc.

Next we see how same data will be stored in column oriented databases.

This will be like this.

100|101|102|103|104|105|106|107|108|109|110Steven|Neena|Lex|
Alexander|Bruce|David|Valli|Diana|Nancy|Daniel|JohnKing|Kochhar|De Haan|Hunold|Ernst|Austin|Pataballa|Lorentz|Greenberg|Faviet|Chen
24000|17000|17000|9000|6000|4800|4800|4200|12000|9000|8200
|100|100|102|103|103|103|103|101|108|10890|90|90|60|60|60|60|60|100|100|100

Yes, you are right. Here all column values are stored together. Seems odd, isn’t it?
Whether it is weird or not, depends on the context.

Suppose you want to query the sum of salaries for the above table. How a row based database (say Oracle) will do it?

It will read entire first row and then will take the “24000” into its memory and will discard rest of column values for this row. Then it will to the same for 2nd, 3rd, 4th and nth rows. After that it will add all values to get the sum of salaries.
So, it will actually scan the full table. When we have few thousands (or even few millions) the result will appear almost instantly and you will hardly notice any performance issue.

The same query, when performed in a column based database (say Sybase IQ), it will read all the salary values
24000|17000|17000|9000|6000|4800|4800|4200|12000|9000|8200 in a single seek of the column! Clearly number of I/O operations is far less compared to row based database.
But on other hand, adding new row means all existing values need to move little bit to make spaces for new row (as shown by this color above).

Some notable column oriented databases are Sybase IQ, Vertica, C-store etc. Although Sybase IQ stores user data column wise fashion, its own data dictionaries are stored in Sybase ASE (within IQ product) which is a row wise database!

Column storage has another advantage. Since data in columns are of similar type, an efficient compression algorithm can be applied. As a result, often column based storage takes same or less space than raw data!
So what’s the moral of the story?
Row based databases are better where:
· Online Transaction Processing (OLTP) where lots of insert, update, deletes are happening.
· Where only a subset of data such as all or few columns of some rows (i.e. not all values of a column) only is accessed regularly.
· When all row values are supplied at the same time (i.e. adding a new record)
Column based database have upper hand where:
· Data warehouse and Decision Support System (DSS) where aggregates need to be computed over many rows but only for a notably smaller subset of all columns of data (because reading that smaller subset of data can be faster than reading all data).
· When all column values are supplied at same time – like adding a new column in a table.
Column based database will perform very poorly if rows are frequently inserted/deleted/updated!

So, in a nutshell, row oriented databases are best for OLTP systems and column based ones are for very large OLAP/DS systems. For small or medium DWH, a row based database with proper tuning will perform at par with column based storage.

In DWH environment, because of their inherent design, column based databases will perform 10 to 50 times faster depending on circumstances. I had to underline the “depending on circumstances” clause as it is only apparent when querying millions and billions or records from DWH fact table.

The fundamental reason using a column based database is to reduce disk “seek time”.
Horses for courses, that’s the bottom line.

Disclaimer:
It is important to recognize that modern databases are not so simply column-oriented or row-oriented as in the simple example above, since partitioning, indexing, caching, materializing views, OLAP cubes, and transactional systems such as write ahead logging or multi-version concurrency control all dramatically affect physical organization of DBMS data.