Featured Post

Device Command Shell - DCS - A Simple but very useful PowerToy

Found a neat little PowerToy for smart device development, a Shell enhancement to the Visual Studio 2005 – Device Command Shell (DCS). DCS neatly tucks itself within the command window, and you can execute various shell commands against your target device. This tiny tool gives you the flexibility to...

Read More

2005… Looking Back…

Posted by Logu Krishnan | Posted in Uncategorized | Posted on 01-01-2006

0

Should I say this was quite a eventful year! I don’t know… !!

But,

A Year Where I’ve met so many new faces across the world, from the sweetest of all to the scariest of all to the charismatic of all…

A Year filled with travel, almost every weekend or alternate I was traveling…

A Year where I’ve made more number of flop shows and more flunks…

A Year filled with new experiences, some of which, I Didn’t know how to play…

Some of which, I Never wanted to repeat, if it repeats, Now I Know How to play the game!

A Year which changed perceptions towards life…

 

A Year Where I learned Amateur Photography…

 

[I've compiled a list of photos at http://photos.logukrishnan.net/Shots2005 ]

Favourite Shots 2005

.

.

.

 

Welcome 2006…

  • Share/Save/Bookmark

“C# - Orcas” Introduces LINQ

Posted by Logu Krishnan | Posted in Uncategorized | Posted on 14-11-2005

0

Language INtegrated Query - After all the discussions and sessions from Anders Heijlsberg, All I could say is, “This feature adds lot’s of Common Sense to the Language…And Not a Cryptic Rocket Science kinda feature :-) But, Just lots of essential & practical Common Sense…”

In Layman/Fresher terms, this can be explained with the following question “Whenever we build a application, we always interact with lots of data, and when it is relational data, we have SQL to manipulate the query with in the database systems. But, what happens to the data after retrieving from the Database Server ? Isn’t all the querying capabilities you had just few moments back is lost and you end up in using for…next loops and endless of other mechanism to manipulate the same data ? Next, How about in-memory objects ? traditionally they are always treated as collections and never had another fresh look of handling things… Finally What about XML Data, and ploethra of stuff like XQuery, XPath et al ?”

When most of our application always involves in manipulation of data…data…data, shouldn’t our language know about this and provide support to manipulate these data in a uniform manner and a flexible, simple ways ? and most importantly today we see object orientation has become a very common phenomena of software development, shouldn’t we need a technology to reduce the complexity for the developers for accessing and integrating data that is not natively defined in Object Oriented Technology ?

Whoa… You got it… The Answer is LINQ, A Brain child of Anders Heijlsberg, and he has architected this LINQ Project, with his own minimalistic approach, so we can definitely expect Evolution of LINQ in future.

The Way this is implemented is quite simple -
1. .NET API’s are now Query Enabled

2. .NET Languages Integrated query defines a general purpose standard query operators that allow,
a. Traversal
b. Filter
c. Projection
operations to be expressed in a direct yet declarative way

Now, It is up to the .NET Programming language to implement this feature, VB.NET Adopts known “Select …” ANSI SQL Query Approach, and C# uses a similar approach, and VC++ guys as usual need to access the API’s directly for their querying capabilities.

LINQ Also allows third parties to define their own set of domain specific standard query operators targeting their technology and also has the flexibility to replace the standard queries.

In order to Query XML, XLINQ uses an efficient and easy to use in-memory XML Facility to provide querying capabilities and NO it does not replace XPath/XQuery. XLINQ Just Extends them.

In order to Query Relational Data, DLINQ is build on integration of SQL based schema definitions into the CLR Type System, resulting in retaining strong typing and expressive power of the relational model, and NO DLINQ does not replace ADO.NET, it just extends or adds more value to ADO.NET

Here is a very very simple program given by Anders and Don Box to see LINQ in action and uses standard query operators to process contents of in-memory objects like Array

using System;
using System.Query;
using System.Collections.Generic;

If you were to compile and run this program, you’d see this as output:

class app {
static void Main() {
string[] names = { “Burke”, “Connor”, “Frank”,
“Everett”, “Albert”, “George”,
“Harris”, “David” };

IEnumerable expr = from s in names
where s.Length == 5
orderby s
select s.ToUpper();

foreach (string item in expr)
Console.WriteLine(item);
}
}

BURKE

DAVID

FRANK

Simple Ain’t it… Though it might not sound like a great at first look, think about the flexibility on complex stuff…

Now, Let’s Dissect the Code a bit,
IEnumerable expr = from s in names
where s.Length == 5
orderby s
select s.ToUpper();

couple of new stuff to notice

expr = a local variable, initialized with a Query Expression

The Query Expression uses 3 standard operators Where, OrderBy & Select

The Arguments passed to these operators are called as Lambda Expressions (much like delegates, but has a very insightful implementation, I shall blog a bit more on insights of Lambda Expression soon), these lambda expressions allow operators to define individual simple methods and finally they are connected using a dot notation. These are the simple blocks for LINQ, All of the above combine to serve as building blocks for extensible query language.

Actually, a feature every programmer requires, and all of a sudden it makes you think… “Whoa! How did I Program all these days without this LINQ ?!” :-)

Anyways let me keep it short with this basic stuff, but do not underestimate the power of LINQ, you need to look deep inside the complexity reduced by LINQ.

You can try this at : http://download.microsoft.com/download/2/a/4/2a405b66-1b1c-4fca-bfbf-007aad63d307/LINQ%20VB%20Preview.msi

Okay, Stay tuned for some interesting stuff on insights on Lambda Expressions, Expression Trees, Deferred Query Evaluation et al…

  • Share/Save/Bookmark

The Infamous “Multiple Events” Problem in FileSystemWatcher Class

Posted by Logu Krishnan | Posted in Uncategorized | Posted on 02-11-2005

0

Whoever, tries the FileSystemWatcher Class for first time, immedietly starts complaining about multiple event notifications and after a brief moment complains, that .NET is buggy and concludes that as a bug. Had heard this many times, and again recently came up with this issue…

Actually, the real root cause of this problem is the File System, NTFS. for e.g.: when a file modification operation occurs NTFS gives out 2 notifications,

Notification 1 : for Data Stream
Notification 2 : for Metadata

Hence 2 Notifications… Poor FSW Class, just handles this and does it’s job properly. Only possible way is to ignore the 2nd Notification.

else, we can use WMI and specify the polling interval, which should read something like the below,
“SELECT * FROM __InstanceModificationEvent WITHIN 10 …..”

Absolutely, nothing wrong in .NET…

  • Share/Save/Bookmark

New Blog

Posted by Logu Krishnan | Posted in Uncategorized | Posted on 10-10-2005

1

New Blog… New Perceptions… New Thoughts…

  • Share/Save/Bookmark