Thursday, April 27, 2006

Lets start to think like a genius!!

Check out http://www.studygs.net/genius.htm

Extract from that site:

"Even if you're not a genius, you can use the same strategies as Aristotle and Einstein to harness the power of your creative mind and better manage your future."

The following eight strategies encourage you to think productively, rather than reproductively, in order to arrive at solutions to problems. "These strategies are common to the thinking styles of creative geniuses in science, art, and industry throughout history."


Let me try and think like a genius going forward :)

Sunday, April 23, 2006

To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem?

Check out this Microsoft research article on choosing whether to store your large objects in your database or filesystem. As expected from the common wisdom, objects smaller than 256K are best stored in a database while objects larger than 1M are best stored in the filesystem. Between 256K and 1M, Read on ...

Tuesday, April 18, 2006

How to negotiate salaries?

This is one of an excellent article I have read about "Salary Negotiations". Spare some time and go through this article .... needless to say, it would be worth your time.

Tuesday, April 11, 2006

Using Notepad as your virtual diary ...

Whenever I get into an official call I used to open notepad and start to take notes. After few days if I open that notepad I used to wonder on which particular days call i took this note :) [Yeah sometimes I used to forget to type in the current date and time before starting take notes].

Few weeks back I got to know this interesting tip which I have explained below via my collegue.

Step 1: Open notepad
Step 2: Type .LOG as the first line of the file and press the carriage return [Enter key]
Step 3: Save and close the file.
Step 4: Double click on the file and open it ... you could notice that notepad appends the current datetime at the end of the file and places the cursor on the next line.

Each and everytime you open the file it automatically appends the current datetime and places the cursor on the next line. Cool isn't it. This way one can make use of notepad as their virtual diary.

Wednesday, April 05, 2006

Sorting decimal values within a varchar field ...

Lets assume that you have data like '1.1.11', '1.1.3','4.1.2' etc within a column in a table. If you do
Select * from TableName
order by FieldName


it won't give you the data in the correctly sorted order.

Table Structure:

Create table tblSortIndexNumbers
(
sno int identity,
IndexNumber varchar(100)
)
Go

Insert scripts for generating sample data within our test table:

Insert into tblSortIndexNumbers values ('1.1.1')
Insert into tblSortIndexNumbers values ('2.1.1')
Insert into tblSortIndexNumbers values ('3.1.1')
Insert into tblSortIndexNumbers values ('1.1.3')
Insert into tblSortIndexNumbers values ('1.1.2')
Insert into tblSortIndexNumbers values ('1.2.1')
Insert into tblSortIndexNumbers values ('1.1.4')
Insert into tblSortIndexNumbers values ('1.2.2')
Insert into tblSortIndexNumbers values ('1.3.1')
Insert into tblSortIndexNumbers values ('2.2.1')
Go

Now, try running the below script and understand the problem I am trying to address:

Select sno, IndexNumber from tblSortIndexNumbers
Order by IndexNumber

Now that you have seen the actual problem .... let us see the correct way of sorting it also.

Code snippet to sort it properly

Select sno, IndexNumber from tblSortIndexNumbers
Order by
Convert (int, parseName(IndexNumber,3)),
Convert (int, parseName(IndexNumber,2)),
Convert (int, parseName(IndexNumber,1))


I got this idea from MS SQL Programming Newsgroup.