Sunday, July 25, 2004

Embedded CLR Vs. Tiny CLR

Last week while I Was discussing with Girish (My Colleague,my best friend)
the Topic of Embedded CLR and Tiny CLR Came up.

There was a misunderstanding that, both Embedded CLR and Tiny CLR are

I was little inquisitive, So, I Thought I shall explain my understanding

TinyCLR from Microsoft includes a real time Micro Kernel and is a new
platform which extends .NET tools. And is a newly architected/scaled down
version against the CLR - ECMA 335.

This TinyCLR is right now used in the Microsoft's SPOT Watches and MS is
planning to use it on all of the resource constraint devices.

[Guys, If you have not heard about SPOT, do check out http://direct.msn.com
This is one of the cool gadget initiative from Microsoft, this really beats
me. :-) ]

To put this in simple words, think about the CLR Being the OS. :-)

Embedded CLR on the other hand is Paul Pahm's research project at MIT
[http://colony.mit.edu/research/embedded-clr/ ], where he tries to recreate
the same but in a very effective manner, by unifying type-safety and
portability of VM's with real time OS's real-time scheduling.

He tries to do this with his 3 goals

Port CLR 335 to a Real-Time OS
make the new RTOS handle activities which includes threads and work items
scheduling CLR Threads using work items
he has tried to achieve this using his previous project MMLite [a realtime
scheduler] and recently he has published his papers and has demonstrated
this also.

and Paul is also planning to recreate TinyCLR in C right from scratch.

Man. This is an interesting effort. :-)

posted by Logu Krishnan : 11:32 PM

Thursday, July 22, 2004

Eric is listening now.

Eric Gunnerson is listening now for suggestions on Future Language Features
& Scenarios... This is really interesting

Read & suggest here...


posted by Logu Krishnan : 12:32 AM

Wednesday, July 21, 2004

I'm Online Now...

I'm now back in Chennai, and fully online now ;-)
Just clearing the backlogs...

posted by Logu Krishnan : 10:38 PM

Tuesday, July 20, 2004

Microsoft and Fiat Auto Works together on Telematics

Further to the tie up with BMW7 Series last year, Microsoft is now working with Fiat Auto on Telematics.

read it here...
Microsoft and Fiat Auto Partner for Major Telematics Deal

BMW7 Series had an innovative iDrive telematics system, powered by Windows CE 3.5

If you have not heard about Microsoft Automotive, this is the place to hit http://www.microsoft.com/automotive

posted by Logu Krishnan : 10:04 PM

Tuesday, July 13, 2004

Offline Again !!

I'll be offline for whole of this week, as my dad is hospitalised, and I'm here at my hometown... coimbatore. and use of any electrical devices is prohibited over here in the hospital...

Should be up and running next week....

posted by Logu Krishnan : 8:37 AM

Sunday, July 04, 2004

Encounter with HiByte, LoByte

While I was working with the ASPI32 Interface, I encountered these HiByte's and LoByte's. For a second I was stuck as I really did not know how to extract HiByte and LoByte using C#/.NET. I Turned to MSDN, after a few moment I realized... .NET does not have a way for me to extract these byte's. Yep! The Win32 World has a Macro for HiByte, LoByte, but the Managed world does not have a equivalent way :-(

Finally, I decided to write my own.
For a LoByte I had to extract low order(least significant) byte, and for a hi Byte I had to extract high order (Most Significant) Byte

public int LoByte(int word)
return (Word & 0xFF);

public int HiByte(int Word)
return ((word & 0xFF00) / 0x100);

If u are inquisitive, about what happens Behind the scenes, here you go

[let word=1234, i.e. 0001 0010 0011 0100]

0001 0010 0011 0100
0000 0000 1111 1111
0000 0000 0011 0100


0001 0010 0011 0100
1111 1111 0000 0000
0001 0010 0000 0000
0001 0000 0000 0000
0001 0010 0000 0000

Pretty Simple :-)

posted by Logu Krishnan : 12:08 PM

Best C# Bloggers

Here is the list of Best C# Bloggers chosen by the
community votes. Via Eric Gunnerson Post

Ian Griffiths  
Craig Andera
Wesner Moise
Frans Bouma
Brad Wilson
John Lam
Clemens Vasters
Ted Neward
Steve Maine
Roy Osherove
Miguel de Icaza
Justin Rogers
Ingo Rammer
Niels Berglund
Richard Blewett

posted by Logu Krishnan : 12:07 PM

WMI Vs. Win32

System.Drawing.Image Performance

The Product I was working on previously had to load & Edit JPEG Images, which were of Digital Quality, which means the Image size would be greater than 3-5 MB. My Client has been always cribbing about image loading speed, everything was fine while loading a 1-2 MB Image, but things started to change drastically whenever a 3 MB or greater image is loaded, it took around 1-2 sec to load a image. 2 sec is fine for normal applications, but not for people who work with thousands of images per day.

The Windows Form would almost Hang before loading up the image. After a considerable amount of research I found out that the real culprit, which caused the bottleneck is the line

I happened to hit a KB http://support.microsoft.com/default.aspx?scid=kb;en-us;831419 Which confirms this issue. And had a hotfix, which updates

Infact there was interesting new signatures under System.Drawing.Imaging
System.Drawing.Image.FromStream(Stream stream, bool useICM, bool validateImageData)
This bool validateImageData was the real cause for the image being slowed down, which validated the content of the image file before loading up. So as size of the image increased, the loading time increased exponentially. And now, when I used this new method, voila! the images started loading up atleast 90% Faster and took less than 10Millisecond to load! Wow! That was great….

But noway, I cannot distribute this hotfix along with the product. And these hotfixes are included in the next SP of .NET, so I had to lookout for an alternate. The obvious choice was Win32. and here is the method equivalent to Image.FromFile()

public static Image Win32ImageFromFile(string filename)
filename = Path.GetFullPath(filename);
IntPtr loadingImage = IntPtr.Zero;

if ( GdipLoadImageFromFile(filename, out loadingImage) != 0 )
throw new Exception("GDI+ threw a exception.");

return (Bitmap) imageType.InvokeMember("FromGDIplus", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { loadingImage });

When I executed this code, The images were loaded in less than 10 seconds. If you are constrained to use Win32 May be you should wait until next SP Release of .NET. sometimes Win32/Unmanaged is the savior :-)

posted by Logu Krishnan : 12:01 PM

WMI vs. Win32

Solving performance issues in Win32_LogicalDisk

Off late…. I’ve become a very big fan of WMI… WMI Definitely does wonders and reduces the development time drastically. I was just thinking about how difficult it would be for beginner-intermediate programmers to work on system level, like interacting with h/w, network devices, etc etc… and how error prone those codes are… WMI would definitely reach very far.

But there are many areas that WMI needs to mature or get fixed up. Here is the issue, where I dumped WMI and used Win32 Instead.
Here is the simple WMI code which would list the removable drives of the computer.

# region "WMI Code to retrieve Drives"
ManagementClass driveClass = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection drives = driveClass.GetInstances();
StringCollection driveCollection = new StringCollection();
foreach (ManagementObject drv in drives)
//Check is made to find whether the drive is from removable storage device
if ((drv["Description"].ToString()=="Removable Disk") && (drv["DriveType"].ToString()=="2"))
# endregion

This code would take a minimum of 4-5 seconds to enumerate my disk drives. And another problem is that, everytime my floppy is also physically checked, which further slows down the execution time. No client would accept this when this feature is used frequently, obviously my client also cribbed and there was no way to solve this issue except to lookout for an Win32 Method, and here is the alternative I wrote…

# region "WIN32 Code to retrieve Drives"
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError=true)]
static extern uint GetDriveType(string lpRootPathName);

/* Retrieves All the Mounted Drives on the computer. */
string[] _drives = System.Environment.GetLogicalDrives();

foreach(string _drive in _drives)
/* Call Win32 GetDriveType to determine the Drive Type, based on the Drive Letter */
_driveTypeLength = GetDriveType(_drive);

//Check whether the passed Drive is a Removable Disk Type
if(_driveTypeLength == 2 || _driveTypeLength == 5)
# endregion

This code would execute in less than 100 MilliSeconds !!! That was an incredible performance boost.

posted by Logu Krishnan : 11:58 AM

Are you Single…. No DSL Connection !!!

When I decided to dump my dial-up, I called up Touchtel for a DSL Connection… I got very positive fast replies… and at the end of the conversation when he came to know that I’m a single, living in a apartment, he announced “Sorry Sir! We don’t provide DSL connection to Single….”

What!!!!!!!! How Insane…. I was really irritated to hear that answer…. Why on earth somebody would deny a DSL connection for a single…. Ssshhh… all I could do is fight with him… but he said that’s the policy... What the heck… I did not wanna give another try…. So I ignored these guys

Contacted SIFY, and, SIFY was kind enough for single…

Steps to Get DSL Connection
1. Find a Girl, Marry Her
2. Apply for DSL Connection….

funny people and funny rules…. And I’m living in one of the 4 “Metropoliton” city of India…….

posted by Logu Krishnan : 11:55 AM

Stars Day…..

I have this habit of watching stars. This caught up with me since my school days, when I learnt about constellations during my science classes.
Twinkling Stars always catch my fascination… I would feel a silence while watching them… hmm…
Stars….. Varieties of constellation… I always love to observer and track “Orion” while I was at Coimbatore. I still remember the days of observing stars with my friend “Manu” while staying at his rubber estate, they had a beautiful pond before the house [house is on the mid of a hill on western ghats surrounded by trees]. It was great to observe stars while laying around the pond on a Full Moon Day… Manu would try to find out new constellations… :-)

Gone those days, now here I’m in Chennai and I hardly look up above the sky with all the work pressures and late night jobs. I do try observe stars here, but most of the time the sky would look blank… would look like almost no stars in the Chennai sky. I would wonder but have never thought about this…

One night I was standing at the balcony of my apartment, and there was a pleasant surprise… wow! There were too many stars… twinkling, blushing, laughing, twinkling shiny stars…. I couldn’t believe my eyes…. Man… that was too many, I’ve not seen so much of stars in Chennai….. I was really excited… and yelled at senthil[my flat mate]… he looked up and was surprised too… and thought for a while and shrugged his shoulders and said “TODAY IS MAY DAY” …. Boy! Something stuck in my head… only then I realized today is may day [laborer’s day] and all weenie big industries/mills would have closed today, and would have a very less traffic out here, which would have resulted in the decrease of air pollution today…. Hence I see Stars…. Oh My God! Where are we leading to in this so-called busy-materialistic-luxury-fantasy world… some how I hate these….

May be some day government would announce that “May Day” as “STARS DAY” … hmm… someday !!!!
Where the fellow human beings would watch stars on the sky…. What a bad day that would be…

May be my conceptions might be wrong, and there can be some other reasons like “summer” for stars being invisible, whatever it is this is not a good way ahead!

Rain day
This incident reminds me about an experience I had about “Rain” in Dubai. On the day I landed up in Dubai for a project implementation, one of my friend Gowri Shankar picked me up at the airport, while we reached his apartment rain busted out suddenly. And believe me I was the only fellow who saw rain very casual and ran into the apartment, rest of the people at the dubai streets were excited to death, and most of them were on the roads to enjoy the rain, and I saw a Mom holding her child [should be 2-3 yrs] yelling at her kid “Look… This is Rain” I was surprised and later I came to know that they had this rainfall after almost 4-5 years… Yep!! The kid is around 3 yrs, she would never ever have witnessed a rain… what a sad story. Some day later rains and trees would be thought only in school books, and only can be shown artificially…. !!!!!!!!!!!!!!

Don’t you see a paradox on all these worldly things happening around you !! I see a paradox !!!

posted by Logu Krishnan : 11:52 AM

My XPhone Story

I fit into one of those categories who think “Carrying Cell Phone is a SIN” and have been avoiding this for a long time, but I had to buy one when I had to leave my home town. Reason: simple, My Mom needs to track & monitor me :-) anyway she is the only soul in this world, who remembers me often. So I decided to buy one, but definitely not a costly piece. All I needed was a phone with ability to make calls and send SMS. So, at last I bought a second-hand old Panasonic GD95/96, For Rs.950 which could barely make calls and send SMS. But I made sure it was a dual band for roaming purposes. I had this phone for almost 1.5 yrs. Most of the eyes around me gave a nasty look whenever they saw the phone, but I was perfectly fine with the phone, I really did not care.

Almost everyone who saw the phone advised/screamed me to change the phone immedietly, as it was looking very old-fashioned. Moreover I had some battery problems. and at one point the hardware started to die and became highly unpredictable and irresponsive and was going beyond the depreciation value. But still I loved the phone and did not decide to change. Until one day when I went to the Elliot’s beach with my friends, we were playing on beach and suddenly my phone **slipped** and went into the Arabian Sea before even we realized what had happened… Ouch… What a Tragedy? Everybody except me who heard this was happy[Grrr….] Atlast I had to buy a phone. This time I had one more added to the wishlist for phones, a Expense Tracker application :-) but none of the mobiles had this.

This is when I started evaluating the phones. Went to some so-called “Priority dealers” and authorized shops to checkout some cell phones, but I found some uttlerly useless phones sold for atrocious cost. Most of these sales persons do not have any idea of what they sell, The main features that are exhibited by these people are 1. Dancing Disco Light 2. cinematic ring-tones 3. different color panels 4. white light, blue LED’s…. sssshhhh… these phones are in hi demand and called as fast moving phones. Infact I decided to hunt down for my good old Panasonic at second-hand again, my friend who accompanied me gave a strange look. Panasonic had a great feature of “Voice-recording” with one-touch button, which helped me to record some phone no or important calls without any effort. But new models of Panasonic do not have these.

Recently after joining ScapeVelocity, all these new smart devices caught my attention… Pocket PC’s, PDA’s, Tablet PC’s, Wi-Fi stuff etc etc So, I had a spark hitting me, and thought “Why not buy a smart phone? And add one to my Asset Section”

After a quick analysis, found there was no smartphones available in the Indian Market. Even on most parts of the US, only smartphones 2002 were available. Except phones like Orange SPV’s which is bundled by the mobile operators and is available only within the region. That’s when I heard about XPhone[www.xphone.com] After reading the specs smartphone really inspired me.

How about a phone with 133 MHz processor, with 64 MB flash and 32 MB SDRAM, more than whatz available on common PDA’s. What more it supports .NET CF [Ha… I can now program my phone… My own telnet client, my own expense tracker… hmm… tempting]

Moreover this phone has some other exciting useful features like
1. Tri-band GSM 900/1800/1900
2. Supported Speech Codecs : FR, EFR and AMR Speech codecs
3. MMC/CD card memory with SDIO support. [this is amazing I now have 128 SD card. Think about WIFI SDIO cards… WIFI keyboards !!! ]
4. Bluetooth 1.1 for: headset, serial port profile, dial-up networking profile, Object exchange profile
5. USB
6. Infrared
7. Wireless Modem [Yes I can dial up even while I travel, and connect to my PC]
8. IMAP,POP3,SMTP Support
9. Pocket Outlook, pocket IE, MSN msgr
10. Media player 7 [wma, mp3]
11. voice notes
12. camera, camcorder and other colorful usual stuff

No second thought’s here I go… I’ve bought the XPhone…

I shall post some of the time I spent with XPhone on upcoming posts….

posted by Logu Krishnan : 3:08 AM

This page is powered by Blogger. Isn't yours?