2LeggedSpider

An excellent resource for different CSS techniques

Posted in CSS by Sumit Thomas on June 29, 2007

http://www.dassnagar.com/blogge/2007/06/15/53_css-based_techniques/

The resources in the above link are very useful. I particularly like the Nifty corners technique to generate rounded boxes without images.

Advertisements
Tagged with:

Deleting duplicate records/rows in SQL Server

Posted in SQL by Sumit Thomas on June 28, 2007

[tweetmeme style=”compact”]A duplicate record in a table is redundant data and is a violation of table integrity. Utmost care should be taken to avoid such situations. But, there might be situations where there is a loosely designed table which holds duplicate records. Removing duplicate records is of high priority in such situations.

Consider the following table design…

CREATE TABLE [dbo].[Categories](
	[CategoryId] [int] IDENTITY(1,1) NOT NULL,
	[Category] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 CONSTRAINT [PK_Categories] PRIMARY KEY CLUSTERED 
(
	[CategoryId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

Lets insert some records in this table

INSERT INTO Categories VALUES('Books')
INSERT INTO Categories VALUES('Books')
INSERT INTO Categories VALUES('Books')
INSERT INTO Categories VALUES('Toys')
INSERT INTO Categories VALUES('Automobiles')
INSERT INTO Categories VALUES('Gadgets')
INSERT INTO Categories VALUES('Toys')
INSERT INTO Categories VALUES('Toys')

As you can see we have inserted some duplicate data in this table. Imagine if we had thousands of records in the Categories table with lots of duplicate records. Fixing the table would be a pain. To solve this problem we need to first identify the duplicate records. The following query will help us do that.

SELECT Category, Count(Category) AS Occurence FROM Categories 
GROUP BY Category
HAVING COUNT(Category) > 1

We get the following result…

Category            Occurence
----------------  -----------
Books                 4
Toys                  3

As you can see it displays the duplicate records and the number of times it occurs in the table. Now how do we delete the duplicates?

Lets try another query on the table.

SELECT 	MAX(CategoryID), Category
FROM Categories
GROUP BY Category

The result is…

            Category
-------- --------------------------------------------------
6           Automobiles
4           Books
7           Gadgets
9           Toys

This is how our table should look like, no duplicates! The SQL query to delete the duplicate records is now simple…

DELETE FROM Categories
WHERE 	CategoryID NOT IN
	(SELECT MAX(CategoryID)
        FROM Categories
        GROUP BY Category)

and finally when we fetch all records from the Categories table, it gives us the desired result…

CategoryId  Category
----------- --------------------------------------------------
4           Books
6           Automobiles
7           Gadgets
9           Toys

This is a simple method to remove duplicates from a table. Please note that the table should have an Identity column for this method to work. There are several methods available to remove duplicate records from a table. If you have come across a better alternative please share it.

Tagged with:

Sitemap for Search Engines

Posted in technology by Sumit Thomas on June 18, 2007

Sitemap is a simple XML file that you can put in the root of your website to help search engines crawl your site better. It helps the search engines know which pages in your site to index and the frequency of updates in those pages. A simple sitemap.xml file looks like this…



   
      http://www.yourwebsite.com/
      2007-06-01
      monthly
      1.0
   
 

Check sitemaps.org for more information.

Google and Yahoo have good Webmaster tools that allow you to submit the path of your sitemap.xml file for crawling. Make sure you validate you sitemap file before submitting it to the search engine. Sitemap validator is an excellent tool to check your sitemap file.

Google’s Webmaster Central is a great resouce for information on Sitemap. You can submit your sitemap at Google Sitemaps.

Yahoo has a similar service called Yahoo! Site Explorer

For Ask.com just ping to their server with the following URL http://submissions.ask.com/ping?sitemap=http%3A//www.yourwebsite.com/sitemap.xml

MSN doesn’t have a sitemap submission tool(I couldn’t find one). Placing the URL of your sitemap in robots.txt would do I guess.

Sitemap is not a replacement to the crawling methods adopted by search engines to index your website, it just helps the search engine to crawl your site better.

Tagged with: , , ,

Safari on Windows

Posted in technology by Sumit Thomas on June 14, 2007

Its Troy all over again. It started with iTunes and now there is a new horse on the block claiming to faster and better than its bigger rivals. Safari, the new Trojan horse is available for Windows. The popularity of iPod grew several folds when Apple released iTunes for PC. It raised Apple’s awareness in PC users. Steve Jobs at the recent WWDC claimed that Safari is twice as fast as IE 7 and 42% faster than Firefox 2.0. Also, he announced that 3rd party developers will be able to develop apps for iPhone via Web apps. Its looks like a move to open up the iPhone development environment to a much wider audience. Probably we might see some tools for Windows to develop iPhone apps.

This is my first experience with Safari. The download and installation is easy. The installation comes bundled with three separate Apple products: Quicktime, Bonjour and Apple update. The startup page took almost 10 seconds to load. Contrary to the claim, it doesn’t seem to any faster than Firefox or IE 7. Here is an interesting benchmark test for Safari. Its beta 3 and obviously there will be some improvements in the final release.

Apart from some of the common features like tabbed browsing and pop-up blockers found in the advanced browsers, Safari has few cool features that are noteworthy. You can drag a tab out of the main window turning it in to new browser window. The inbuilt RSS reader is neat. If you click “Installed Plug-ins” under Windows menu, it shows a comprehensive list of plug-ins, some you never though you had. Private browsing is another cool feature that comes with Safari.

On the downside, the home button is not available on the toolbar by default, but you can drag and drop the toolbuttons you want from the “Customise Toolbar” dialog box on to the toolbar. The OK-Cancel buttons are reversed in dialog box, which was bit annoying. Search box support only Google and Yahoo. Another feature that you would see is that when you try to key in a URL in the address bar, Safari suggests few sites in a drop-down list, probably sponsors. I am not sure how many users will like this form of advertising built-in to their browser.

Safari’s beta 3 for Windows looks promising on the whole. I am interested to hear what Microsoft has to say about it. Personally I feel Firefox is the real deal.

Technorati: ,
Tagged with: , , ,

Folksonomy: Unordered categorization

Posted in technology by Sumit Thomas on June 13, 2007

Recently I’ve been reading few articles on Folksonomy. It is interesting to note that user generated classification is as much effective as the traditional structured classification found in many websites. Infact it works much better and creates a social environment which can expand in dimension and depth. Tagging is a term usually associated with folksonomy based websites. Some popular sites which allow users to tag their content are Flickr, del.icio.us, Technorati and 43things.com. There are many more websites which fall under the Web 2.0 classification sprouting up with this concept.

I would be interested to know about your experience in developing Folksonomy based websites, the underlying database schema used etc. Share your thoughts.

Technorati: , ,

Microsoft Surface

Posted in Microsoft, technology by Sumit Thomas on June 5, 2007

Microsoft’s experiments with portable devices has been as successful as India in the recent World cup cricket. Take for instance Zune, the iPod killer. I think by claiming it as an iPod killer they are indirectly giving a free advertisement for iPod and growing list of Apple products. I sometimes feel that Microsoft should stick to software and try focusing on making bug free products. The fact that Vista holds some features that were available in OS X is kind of becoming an embarrasment for many Microsoft product users, like me. I don’t even want to talk about it.

With Surface, I think Microsoft has got its head right as to how future computing should look like. Its definetely mind-blowing and very exciting. I am not sure if I will be able to get my hands on this baby but I am excited with the way technology is progressing in terms of user iteraction and experience with computers. Surface will definetely be a killer app for sure.

Having said that, I remember seeing a Video on Jeff Han’s Multi-touch sensing, which works on a similar concept. It’s good to see Microsoft embrassing this technology. Surface looks more refined and the number of possibilities seems endless. Its good to see that one day we will move away from Click Start -> All Programs computing 😉

Technorati:
Tagged with: ,