Sunil Jagadish

Archive for June 2006

Windows Dev Live Beta launched

with one comment

When everything is going the Live way (Mail Live, Windows Live, Live Messenger etc.), why not something for Developers?

http://dev.live.com

Written by Sunil

2006.06.10 at 05:56 PM

Posted in Microsoft, Programming

LINQ – Language INtegrated Query

leave a comment »

Language INtegrated Query (LINQ) is an extension to the capabilities of .NET languages (currently C# 3.0 and VB 9.0) to perform SQL-like operations on any source of data. The conventional data sources that we’ve been using today are databases, flat files, XML documents etc. LINQ defines certain standard query operators that enable set operations, traversal, projection, selection, join (the relational algebra stuff) to be performed on non-conventional sources of data, which is IEnumerable<T>-based. This means that you can use LINQ to query data from sources such as the enumeration of the list of processes running on your machine. I found this neat example here.

To get started with LINQ, you need to download the LINQ SDK (May 2006). I delivered a session on LINQ at the BDotNETStudent UG meet.

One of my demos included querying a String collection.

Code:

string[] names = {"Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David"};
var q = names
           .Where(s => s.Length > 4)
           .OrderBy(s => s.Length)
           .Select(s => s);
foreach(var i in q)
           Console.WriteLine(i);

A simple query which selects those names from the collection which have a length greater than 4 and the same is then ordered based on the length of each string (in ascending order).

The output:

Frank
David
Burke
George
Harris
Connor
Albert
Everett

Here you’d observe that though “Burke” appears before “Frank” in the original collection, after the execution of the query, the order isn’t preserved. This is because; the OrderBy operator implements an unstable sort algorithm to order the elements.The subtle difference between OrderBy in LINQ and SQL is that, in case of SQL, a query like-

select * from tab_names order by len(sname)

would result in:

Burke
Frank
David
Albert
George
Harris
Connor
Everett

Links:

LINQ Project on MSDN
Download LINQ SDK
LINQ Samples
Anders Hejlsberg on LINQ [Channel9 video]
LINQ Intro

Written by Sunil

2006.06.04 at 11:50 AM

Posted in .NET, Programming

Hello, World!

leave a comment »

If you have been following my earlier blog and this you know that I am Sunil Jagadish, a Microsoft Student Ambassador, pursuing Master of Computer Applications in RV College of Engineering (RVCE), Bangalore.. As I mentioned in the last post on Dotnetjunkies.com, comment spam succeded in forcing me to say “Good Bye!” to Dotnetjunkies. Thanks to the really huge and irritating banner ads on GeeksWithBlogs.net, I moved on from there. WordPress is decent and a calm place to blog.

If you search through the archives of most of the technical blogs and look for the first post, you will find a “Hello World” post. I was wondering why I should be calling this post “Hello World” and looked into Wikipedia and this is what I found –

A "hello world" program is a computer program that prints out "Hello, world!" on a display device. It is used in many introductory tutorials for teaching a programming language and many students use it as their first programming experience in a language.

A "hello world" program can be a useful sanity test to make sure that a language's compiler, development environment, and run-time environment are correctly installed.

However, the first known instance of the usage of the words "hello" and "world" together in computer literature is in A Tutorial Introduction to the Language B, by Brian Kernighan, 1973. [1] (http://cm.bell-labs.com/cm/cs/who/dmr/bintro.html)

Gramatically – “Hello, world!“ is the right way to say it, but some programming language syntax places constraints on the usage of strings.

All this is history. Something that is really cool and something that I had once planned to do is already there. A comprehensive collection of “Hello, world!” programs written in various programming languages. Its just awesome! A nice way to get an idea of what a programming language tastes like. The list if growing. Check it out.

PS: I have posted the old posts from my earlier blog below, under the category "Old posts"

Written by Sunil

2006.06.04 at 05:11 AM

Posted in Uncategorized