Skip to main content

Posts

Showing posts from May, 2006

Split function in SQL Server -- Method 2

There are instances when we want to insert a record into a table and based on the identity value of that row insert remaining content into another table. For the purpose of better understanding let me explain the case with an example.

Assume from a front-end page a user would provide a student's "Name", "Age' and "List of subjects he/she would be learning". Once the user clicks on "Save" button "Student Name and Age" needs to be stored in Table1 and with its identity value insert subject list in Table2. Hope I have made the case clear :)

There are actually two methods to approach this situation. They are:

1. Making use of sp_xml_preparedocument, sp_xml_removedocument and
2. Custom split function

Well, now let us take these items one by one and see how to solve this problem.

Sample table structure

Both the methods explained in this post would use the below table structure only.

Create table StudentMaster
(
StudentID int Identity(1,1) not null,

Lock your workstation on just click of a Mouse ...

Are you lazy like me ... then read on :)

If you think pressing Ctrl + Alt + Del key to lock your machine is really too much then I am sure you would love this post.

Step 1: Right click an empty spot on your desktop and choose New >> Shortcut.

Step 2: In the Create Shortcut dialog box, type the following in the 'Type the location' of the item text box: rundll32 user32.dll,LockWorkStation .

Step 3: Click Next and give a name of your choice for this short cut.

That's it. Now when ever you feel like locking your machine, just click on this shortcut. Cool isn't it?!?

Split function in SQL Server -- Method 1

Off late in many of the usergroups I see people enquiring about how to split data in SQL Server. I know couple of methods to achieve this. This post would explain the first method. I would write a seperate post on the other method of doing the same task.

Here we go ....



CREATE FUNCTION [dbo].[Split]
(
@String NVARCHAR(4000),
@Delimiter CHAR(1)
)
RETURNS @Results TABLE
(
Items NVARCHAR(4000)
)
AS
BEGIN
DECLARE @Index INT
DECLARE @Slice NVARCHAR(4000)
SELECT @Index = 1
IF @String Is NULL RETURN

WHILE @Index != 0
BEGIN
SELECT @Index = CHARINDEX(@Delimiter, @String)
IF @Index != 0
SELECT @Slice = LEFT(@String, @Index - 1)
ELSE
SELECT @Slice = @String

INSERT INTO @Results(Items) VALUES (@Slice)
SELECT @String = RIGHT(@String, LEN(@String) - @Index)
IF LEN(@String) = 0 BREAK
END
RETURN
END;
GO


Lets test it out:
SELECT [items] FROM [dbo].[Split] ('1,2,3,4,5,6,7,8,9,10', ',')

Sample table Structure:


CREATE TABLE testTable
(
Sno INT,
Fname VARCHAR(100),
Address VARCHAR(100)
)
GO


Make use of the SPLIT funct…

Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

I have planned to share my experience on the various .NET errors which I have faced till now and the solution for the same. This is the first post in this series.

Error:Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged.

Cause: Either debug is not enabled in your web.config (OR) For some reasons IIS is not considering your web application as a virtual directory. Instead it is considering it to be a normal folder.

Solution 1:

Step 1: Open the web.config
Step 2: If debug is set to "false" change it to "True".

For ex:
In my web.config I have a line like this <compilation defaultLanguage="c#"debug="false"/>
I would change it to <compilationdefaultLanguage="c#"debug="true"/>

If at all this doesn't work. Try out the next solution.

Solution 2:

Step 1: Start >> Run >> inetmgr
Step 2: Navigate to the virtual directory of the project which is thro…

Is there any problem with Gmail?

For past 3 days I am having trouble accessing my gmail a/c. Actually it takes too much time to login and show my inbox. Many times, only blank screen is displayed and I had no other option than to hit my keyboards F5 key.

I am really surprised!! One of the advantages which people said when GMail came into picture was SPEED.

Get it right, I am able to access Yahoo or Hotmail pretty normally on the same box. So something somewhere is going wrong for GMail. May be they are not able to handle the real load!

Update on May 26, 2006 @ 7.30 PM:

I forgot to mention that "TOO MANY" junk/spam mails are delivered to my Inbox. I am wondering how it fooled the spam filter and managed to get into my inbox. Something is SURELY wrong with Gmail server / application. Hope Gmail team to look into this ASAP before realising that it has gone above their head!

Intellisense in SQL Server for FREE!!

If you are developer working majorly on Microsoft IDE's then you would be aware of the intellisense feature which they provide.

As I am very much used to it when ever I work on SQL Query Analyser I miss that feature :) Yesterday night when i was browsing without any specific agenda in mind I stumbled on this. I was really happy to know that Red-Gate is offering their product SQL Prompt obsolutely free (till Sep 2006).Come-on guys make use of this wonderful opportunity at the earliest :) You can download the SQL Prompt here.

Yoga ...

My wife used to attend Yoga classes which is conducted within our colony by an external teacher. She used to say, its really good. I am more into cricket, chess, carrom, TT etc., than Yoga. Meaning, I am not at all against Yoga, I am saying, I am more interested in other activities than this. But still I attended Yoga classes for a month myself and found that its really easy and helpful.

Btw, why am I blogging about this all of a sudden? [ People who are reading my blogs regularly would be really surprised to see a non-tech post made by me :) ]

One of my close friend Mr. X is pretty well known to my family. Once when we were generally chit-chatting the topic turned to yoga. Mr. X told us that in christianity Yoga is considered to be illegal or something of that sort. I just took that as an information which I was not aware before. Period.

My wife is having a pain in her neck and her right hand for quite sometime. That's due to various OTHER reasons. Let me not get into it now.

Last th…

[Memo from Bill Gates] - Beyond Business Intelligence: Delivering a Comprehensive Approach to Enterprise Information Management

From: Bill Gates [mailto:billgates@chairman.microsoft.com]
Sent: Thursday, May 18, 2006 12:43 AM
To: xxxxxxxxxxxxxxx
Subject: Beyond Business Intelligence: Delivering a Comprehensive Approach to Enterprise Information Management

This week, more than 100 CEOs representing many of the world's leading companies are meeting in Redmond, Washington, to discuss technology trends that promise to reshape the corporate landscape. The occasion is the Microsoft CEO Summit, an annual event that we've been hosting since 1997.

In the decade since that first CEO Summit, technology has transformed the world of business in profound ways. Back then, e-mail was just emerging as a preferred medium for business communication. E-commerce was in its infancy. Most companies still relied on faxes and phone calls to conduct business.

Today, we communicate and collaborate instantly with colleagues, customers and partners around the world. Global supply chains speed the flow of products from factory floor to s…

Data-mining pioneer joins Microsoft

Not every big name in search is going to Google. Rakesh Agrawal, who is credited with creating data mining, or the science of extracting trends from large and often disparate databases, has left IBM to become a Microsoft technical fellow in the company's Search Labs.

Source: http://news.com.com/2100-1022_3-6072321.html

[Product Review] SwisSQL SQLOne Console 3.0

Few days back Srikanth from SwisSQL got in touch with me and introduced me to their new product called "SwisSQL - SQLOne Console 3.0". I initially thought I would fiddle with it sometime in the weekend. But one of the meeting which was about to happen yesterday evening got cancelled and so I came early to home than usual. I just utilized that time to review this product.

About the product:

1) SQLOne Console is an automated SQL Migration tool offering SQL Conversion, Execution and Comparison across multiple databases.

2) SQLOne Console migrates SQLs, either available as stand alone scripts or as embedded SQL statements within Application code like VB, PB, VC++, Java etc.,.

3) It supports Migration across Oracle, SQL Server, DB2, MySQL, Sybase, PostgreSQL, Informix and ANSI-SQL database SQL dialects.

4) This software also has features to test the converted SQLs in target databases. It would be a very handy product to have in database migration projects as well DBAs working in multi…

Dynamically create zip files programmatically using .NET

One of my collegue was enquiring whether we could zip a folder of files programmatically using .NET. Though I told him its possible, I couldn't remember the URL where I have read about it in MSDN.

To be frank the first option which came to my mind was to use some third party components to do this task. But after little bit of googling I was able to find out the exact URL which explains the way to do it without using any third party components.

If at all you are also interested in that check out this MSDNMag article.

Extract:

Zip compression lets you save space and network bandwidth when storing files or sending them over the wire. In addition, you don't lose the directory structure of folders you Zip, which makes it a pretty useful compression scheme. The C# language doesn't have any classes that let you manipulate Zip files, but since .NET-targeted languages can share class implementations, and J# exposes classes in the java.util.zip namespace, you can get to those classes in…

SQL Server 2000 not compatible with Media Center!!

One of my trustworthy friend Maruthi recently came from US. He actually went on a 3 months B1 visa for a project in Verizon. When he returned back in April 2006 he bought me a new DELL Inspiron 1505 laptop. This is the first time I am working in a laptop and I really loved it.

The laptop is pre-loaded with Windows XP Media Center and has 1 GB RAM, 80 GB HDD and lots of other features in it. For the past 3 weeks or so I was just browsing and doing nothing else using that :)

Last weekend I got bored with browsing and thought let me install SQL Server in my box. Since I know that, one need Windows Server 2000 or above to install SQL Enterprise edition I opted for SQL Server 2k Developer edition.

But I was really surprised to see that the installation wasn't working for me. Meaning, I was able to install only the client tools!! Really strange.

Why? Because one can install SQL 2k Developer edition in Win XP professional itself.

Since Media center is the next verion of XP obviously one would…

Terry Semel (Yahoo CEO) says he missed the opportunity to buy Google

In a talk with The New Yorker writer Ken Auletta as part of a Newhouse School lecture series, Semel was asked what his dumbest decision was after taking the job at the Net media company in 2001.

Shortly after joining Yahoo, Semel said, company founders Jerry Yang and David Filo suggested he look at buying up-and-comer Google, whose Stanford grad founders looked up Yahoo's inventors. So Semel said he had dinner with Larry Page and Sergey Brin, asking them what their business was with Yahoo paying only $7 million annually as its biggest licensor of Google search technology.

"They had no thought process on the subject," Semel said.

So Semel nevertheless asked to buy Google. They replied that they wanted $1 billion and didn't want to sell. Semel said he'd think about the price.

Another dinner and Semel agreed to the $1 billion. Larry and Sergey replied that they wanted $3 billion and didn't want to sell. "I couldn't and didn't buy this company and the re…

Testing Anconia RocketPost Blog Software

Today I downloaded Anconia RocketPost trial version and was testing it out. My initial impression is I am not at all satisfied with it.

I fiddled with the software for more than 30 mins and was trying to make a blog post from it. But the software crashed thrice. Its really strange.

1. First and Second attempt crashed when i tried to create more than one hyperlink in my post!!

2. In the third attempt I thought of keeping it pretty simple. So I just typed few lines of text alone (no html content in it) and clicked on "Post to web" button from the toolbar.

All the time it throwed the below error message only.

My buddies are blogging ...

Flash news: Check out http://vadivel.blogspot.com/ to know the latest tech news :)
Yesterday I messaged the above quote to few of my office buddies. Why? Just to inform them that I blog some tech stuff and those who are interested can drop by. Also, summa oru suya vilambaram dhan :)
Only then i came to know from Srini that he has also started blogging recently. I was glad to know that. I immediately started going through his posts and there waited a pleasant surprise for me. I saw Vignesh and Prathiba name listed in his blogrolls.

Short note about them:

Srini -- I interviewed him a year back. At that time he was a fresher and I was impressed to know that he was having vague idea about VS 2005 and SQL Server 2005. Nice guy and the first impression I got about him is "he is willing to learn". Srini correct me if I am wrong :)

Vignesh -- I was one of the person to interview him. The day when this guy came for interview to DBS center in Nungambakkam .... I initially thought one ano…

ICANN chokes off .xxx porn registry

Plans for an area of the internet dedicated to pornography were killed last night in a vote by overseeing organisation Internet Corporation for Assigned Names and Numbers (ICANN). Check the complete article here

I am personally disappointed on reading this. Till now all parents was complaining about their kids accidently entering into porn sites. I guess they would have been using some filtering software to block porn sites. Thats really cumbersome as there is no easy way to find out whether a site is porn related or not.

That said, if at all this voting was won, all porn sites would end with .XXX thats real simple for parents to block right? Then why the hell have they not approved this ... only god knows.

AJAX is the buzzword now ...

AJAX, a new name for old wine -- Asynchronous Javascript + XmlHttpRequest. I really don't think this to be a really new concept!! may we ppl didn't realise earlier that such a thing existed earlier :)

To my knowledge XMLHttpRequest was introduced within IE 5.0 when it was released with NT or Win 2K (now we are talking about IE7 with Windows Vista).

The companies which have released some sort of AJAX framework are:

1. Our big brother "Microsofts" framework for AJAX is called Atlas and you can read about it here.

2. Google's version is called "Google-ajaxslt". One can download their framework here.

3. Check out Project jMaki from SUN.

4. Yahoo's version is "Yahoo! User Interface Library"

All the above mentioned companies where competing directly/indirectly with each other for quite sometime now. But the surprise entry (Atleast for me) is Adobe.

Adobe has released a AJAX framework by name SPRY.

Offlate almost all major technology companies are into AJ…

Interview with Gary (the guy who hacked into NASAs computer)

In 2002, Gary McKinnon was arrested by the UK's national high-tech crime unit, after being accused of hacking into Nasa and the US military computer networks.

He says he spent two years looking for photographic evidence of alien spacecraft and advanced power technology.

America now wants to put him on trial, and if tried there he could face 60 years behind bars.

Banned from using the internet, Gary spoke to Click presenter Spencer Kelly to tell his side of the story, ahead of his extradition hearing on Wednesday, 10 May.

Click here to Read the full interview ...

How to fetch files based on Version label in VSS?

My collegue Prem and sriram on the other day where asking about how labling works in VSS. I was explaining them the details which I know. Incidently, today I happened to read this article on Dave GoodAll and found it really useful. The point which I learned is we can do it from command line also.

Extract from that article:

In Visual SourceSafe Explorer, highlighting the 'Revision 2.1' item line and clicking on the 'Get' button will extract the same revision of the file as if you had highlighted version 7.
Similarly, the command lines:
ss get "$/Test/date.java" -V"Release 2.1"
ss get "$/Test/date.java" -V7
are exactly equivalent, and will extract the same revision of the file.

Check out http://www.ezds.com/html/ss_info_index.html if you interested in reading about various articles relating to Visual SourceSafe (VSS).

Search engine results are almost always wrong!

This is the mail which I sent to my team mates / group of friends in Verizon on 9th Feb 2006. I thought let me post it here as well.

Does search engines lie on the number of results shown for a search string?

I tried searching for the word "vadivel.blogspot" in Google. It said there are 178 results found. But actually they are able to display only 23 results. The funny part is ... at the end of the page there was this block of text.

"In order to show you the most relevant results, we have omitted some entries very similar to the 23 already displayed. If you like, you can repeat the search with the omitted results included."

So now I searched again including the duplicates as well .. still it is able to list only 168 results :)

After this, I searched the same search string in Yahoo it said 164 results are there. But on clicking 2nd page ... the numbers changed to 280!! very strange. Still they where listing 129 records only.

So to my knowledge the numbers which "Sear…

How to find out the Service Pack of .NET Framework installed?

Few weeks back one of my team mate asked me this and I said I am not aware of it. Today morning one another guy asked me the same question. Only then i took this to be a serious query :) and tried to find out an solution for it. I am really surprised that there isn't any easy way of doing it.

The workaround which I found is described below:

Step 1: Open windows registry (Start >> Run >> Regedit)

Step 2: For .NET Framework 1.0, look for the below key
Key name: HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd}

Step 3: Within it you could find this, Value : Version

Step 4: Just double click on it. In my box, the data within it was "1,0,3705,2". It means .NET Framework Service Pack 2 has been installed in my machine.

Similarly for .NET Framework 1.1 the Key Name is HKEY_LOCAL_MACHINE\Software\Microsoft\Active Setup\Installed Components\{CB2FEDD-9D1F-43C1-90FC-4F52EAE172A1}

Command Line Calculator ...

I wasn't aware that DOS has an in-built calculator in it till yesterday morning. Ok based on my understaning I have written the following ... hope this info would be of some help to you!!

DOS Shell has a built in mini calculator to perform mathematical calculation.

How?

Syntax for SET command: Set /a Your_Expression_Comes_here

As you would be knowing, type set /? to display the complete help of that command. Btw, this supports "SHIFT" operators (both left <<>>).

Try it yourself:

Step1: Open the command prompt (Start >> Run >> cmd)
Step 2: Find below the screenshot which shows few examples I have tried myself.



FYI,
i) 10<<2 means 10 x ( 2 to the power of 2)
i.e., 10 x 4 = 40

ii) 40>>2 means, 40 / ( 2 to the power of 2)
i.e., 40 / 4 = 10

Hope this helps!

Web 2.0 Award ... PageFlakes beats Google!

Check out http://web2.0awards.org/?short to know what I am talking about :)

The number one start page seems to be PageFlakes, number two is Googles IG and the third is our Microsoft Windows Live.

Little bit of googling showed that PageFlakes have been develeped using ASP.NET 2.0 and Microsoft Atlas.

Extract from the blog which I saw in http://omar.mvps.org/

Here's what Pageflakes say:

Pageflakes is your personalized Internet. You can add what you like and remove what you don't like - and it's totally simple. What you see on the site right now is just a selection of a few standard modules ("flakes", as we call them) that allow you to read blogs, do web searches, create a to-do list, check your Gmail account and read the latest news. Normally you'd have to go to a different web page for each of those things. With Pageflakes, you have it all on one page! And it's all free.

Note: You can now create public sites and share your page with your friends! Setup a persona…

Why pay for MS hotfixes?

I happened to go through Chaz blog yesterday night. One of the post which made me think is "Why pay for MS hotfixes?".

Extract from chaz blog entry:

Okay, I don't want this to be an MS bashing session. But I ran into a problem where I believe a hotfix will resolve a problem I am having in a .Net 1.1 application. The problem is around a bug in certain kinds of serialization/deserialization in the .Net 1.1 framework SP1. The MS Knowledge Base article says there is a hotfix, but I have to go through support to obtain it. If MS knows there is a bug in the .Net framework and has a hotfix, then why do I have to pay $99 for e-mail support to obtain the fix?Is there a legitimate reason? Again I am not looking to bash Microsoft.

I feel he has a real valid point. May be I am missing something! So I am hoping to hear some (valid) response from Microsoft ppl on this.

Amazon is powered by MSN Live search ...

Check out this article on washitonpost ... Amazon has dropped Google and is now being powered by MSN Live search engine.

Extract from that article:

"Whenever the largest online retailer makes a decision, it's going to be a big deal," said Silicon Valley technology analyst Rob Enderle. "They're the bellwether for their segment. What they do, others will likely do or consider doing."

[Follow up] New Microsoft Browser Raises Google's Hackles

In continuation to my yesterdays post I read an interesting article Google cries foul, but for what?

Ed Bott in this article has explained with screenshots on how changing providers in IE7 is about the same as changing in Firefox with one exception - MSN Search is NOT an option in Firefox while Google IS an option in IE7!!!!!!!!!

Now, will Google put real pressure on Firefox to let Microsoft Search in their existing list? As I mentioned in the earlier post if you purchase a DELL machines Google search box comes in-built. So I don't think people would really take seriously as everyone by now would have known that "Google follow double standards" :)

Btw apple's new browser (called safari) has google search in-built in it. I have never used it. But I have read that there isn't any option to change it to any other search providers. If this is a fair game .. then whats the problem with Microsofts approach?

New Microsoft Browser Raises Google's Hackles

Check out http://tech.memeorandum.com/060501/p8#a060501p8

In this article I found this, "The new browser includes a search box in the upper-right corner that is typically set up to send users to Microsoft's MSN search service. Google contends that this puts Microsoft in a position to unfairly grab Web traffic and advertising dollars from its competitors."

I also found this,

"The focus of Google's concern is a slender box in the corner of the browser window that allows users to start a search directly instead of first going to the Web site of a search engine like Google, Yahoo or MSN. Typing a query and hitting "Enter" immediately brings up a page of results from a designated search engine."

hmm i am really pissed off on seeing Google's reaction. Why? Because just couple of weeks back I bought a new Dell Inspiron 1505 notebook. I was really shocked to see that Google search box was by DEFAULT added to the Internet Explorer.

Now if the same thing is …