Archive for June, 2007

Attensa: RSS Reader for Outlook

June 26, 2007

Working in a company which does not allow employees to use any other email client but Outlook, I was forced to look for an RSS reader which can plug in to Outlook and let me read the interesting blogs on my list.

A quick google pointed me to Attensa. Trusting a few google results, I downloaded Attensa and installed it. I haven’t regretted it. I like the simplicity of it. It sits as a plug-in in my Outlook and has a similar interface as Outlook mailbox. Each RSS feed has its own folder (not mandatory, this is configurable) and all posts will be listed under their respective folders. The frequency of checking for new posts is configurable and so are the alerts. Attensa supports Outlook’s desktop alerts.

The one thing that I hate about Attensa is it’s ‘River Views’ or some such thing. They have tried to give a view from which you can read all new posts of all your feeds. There is so much information on this page and it’s so messy, the moment you see it, you will change the view. If designed well, this view can actually be helpful.

For anybody who is still using Outlook and looking for an RSS reader, Attensa is a good choice.

C#: List of struct

June 21, 2007

Talking about discoveries, I discovered something about C# today.

Let’s say I have a struct ‘MyStruct’ with an integer as its data member. and I create a list of this type.

List list = new List();

I add a few elements to this list.

list.Add(new MyStruct(10));
list.Add(new MyStruct(20));

If I try to modify any element in this list, that is when things become interesting.

list[0].m_age = 30;

The compiler starts its blaring sirens. Error: Cannot modify the return value of System.Collections.Generic.List<MyStruct>.this[int]‘ because it is not a variable

This problem does not arise if you have a list of class instead of a structure. i.e, if I change MyStruct to a class (and call it MyClass to avoid confusion), this error message goes away. Why should it matter for structs and not for classes? I knew the basic difference between these two, one being a value type and the other being a reference type. This knowledge wasn’t enough to crack this puzzle.

A quick googling gave me the answer. The operator [] is actually a function call. When you index a list and get the individual element, you are actually making a function call. You get the individual element as the return value of the function. This return value is placed on the stack and when you try to use the dot operator on this, you are actually trying to modify the return value of the function. i.e. you are modifying a copy of the element and your modifications will not affect the element in the list. The compiler, smart it is, catches this and informs you of the pitfall.

This does not affect a list of class items because class is a reference type. When you use [] operator on a list of class, the [] function is actually returning a reference to the original object and hence your modification on this reference object will cause the original element to change.

Phew! One discovery that was. Next time you are creating a list of structs, remember this little piece of information.

Update:

Beware! If you save the return value of the function in a variable, modify that variable and expect the actual list element to change, that’s not going to happen.

MyStruct s = list[0];
s.m_age = 40; // This will not change the element list[0]

Modifying the variable s is not going to modify list[0].

This poses an interesting question. Once you create a list of structs and initialize it, there is no way you can modify it? I need to find this out. Look out for more updates on this.

Where did you find that?

June 21, 2007

Attensa had been troublesome since yesterday and I finally decided to re-install it. With a registry clean-up (thanks to my husband’s guidance) and a three finger salute (I admit I didn’t press CTRL+ALT+DEL, but I did reboot my machine), Attensa is finally up and running. This made me realize I have around 20 feeds in my list. My mind wandered off to how I came about having these feeds on my list.

I have my own blogs on the feed list. This I do to ensure my blogs are ticking fine. Few belong to my friends, who voluntarily gave their blogs’ links. Not considering those 8-10 feeds which include my blogs and my cousins’ or friends’ blogs, I still have around a dozen to account for.

Worse than failure: I know where I got that from. It was listed under the Time’s Top 50 websites for 2005 (was it 2006?). I think I discovered Lifehacker too in pretty much the same way.

Scobleizer: One will bump into this blog someway or the other, one can’t miss it. In my case, the credit goes to WordPress dashboard.

Zen habits: Lifehacker linked to one of the articles on this blog, which I religiously followed. I have learnt quite a bit from it.

I can look at one or two more feeds and vaguely remember my friends’ recommending it or my boss forwarding it or my husband pointing it out. But the rest remains a mystery. I have no idea how I came across that blog and when. All I know is every single day, I come to my workplace, check my official mails and spend at least half an hour in glancing over these feeds. They do make my day. I keep discovering or learning something or the other everyday.

It is just amazing how, against all odds, you land up on one particular blog which grabs you. The first post impresses you so much, you just have to have that blog on your feed list. With more than a dozen wonderful blogs which I thoroughly enjoy reading, I can’t help but wonder, how many more gems are out there in the world of web which I am yet to discover. That is one more reason why I take my feed list so seriously. I hope to be introduced to yet another interesting blog through this.

Every day is a new discovery, thanks to my feed list. And this list keeps growing.

A nitwit on Orkut

June 12, 2007

While doing my routine channel changes, I caught a news clip on a news channel (I forget which one it was). Orkut was the object of attention and with the amount of firing hurled at Orkut, I thought my television set will go up in flames.

The gist of the story: A girl met a boy on Orkut and they became paly-paly after some time (I refuse to use the sentence ‘She was befriended by him’, that’s utter nonsense, he can’t be friends with her if she doesn’t want to). She shared her personal details, including photographs of her family, her phone number, her address etc.  After a while, there was a tiff among them and the boy went ahead and ‘published’ all her details on Orkut. The girl claims that the boy put her name and phone number on his scrapbook for everyone to see.

The news channel invited the Managing Director of Google India and what surprises me is that the MD agreed to it! If a girl is stupid enough to give out her phone number to strangers, what can the MD of Google India can do about that? If she didn’t know that the rules of real life applied pretty much the same way to the internet life, whose fault is it? How can she claim that Orkut was responsible for the mess when she didn’t her own boundaries? How can she ask the MD to make scrapbooks private? If scrapbooks are private, then how do they differ from emails?

I am not pro-Orkut or anything, I know there are many pitfalls in using Orkut which many people don’t know. All I am saying is, don’t point a finger at Orkut to justify your stupidity. If you are a nitwit, abstain from using Orkut.

PS: I really wonder how net-savvy this particular news channel is. For the above story, the headlines being shown was: ‘Orkut hacked’. This news channel should have ‘How computers work’ and ‘How internet works’ on their wish list.

World Environment Day

June 5, 2007

I was reminded by the banner outside my office that today is World Environment Day. The cafeteria was noisier than usual, thanks for the documentary that was being shown to celebrate this day. The documentary was about Taj Mahal and how we Indians were neglecting it. The narrator was an American, this told me that the documentary was likely to have been made by an American.

There was an interesting point that the narrator touched. She said India’s priorities did not lie in conserving it’s rich heritage, but in controlling poverty. I thought to myself ‘If you know this fact, then why waste time in making this documentary?’

When people are starving to death everyday, would you think of providing them food for their survival or think of beautifying Taj Mahal?

I know, World Environment Day is not just about preserving ancient monuments, so let me move on. I asked myself this question today, ‘What am I doing to conserve my environment? What is my contribution to this world?’ Not surprisingly, I didn’t get an answer.

Things I don’t do:

I continue to use plastic even when I know how harmful it is for the world around me.

My family owns two bikes and a car. I am adding quite a bit pollutants to the already polluted air around me.

I am not using any alternative energy, I still rely on LPG and hydro-electric power.

Things I do:

I don’t own a refrigerator, so I am not adding any more CFC’s than what’s already there.

I don’t throw anything on the road. I mean to say, I don’t litter. This is more towards keeping your surrounding clean rather than conserving it.

I have quite a few plants in my house. I can say I am keeping my household green.

I don’t waste water and I am very particular about not wasting electricity.

I don’t throw plastic bottles out in the open, be it in my own city or any other tourist place I visit. I always trash it. I try to reuse as much plastic as I can.

I know it’s not much, but at least I am doing something.

Article on Multi-threading in C#.NET

June 4, 2007

For anybody who wants to gain some basic and intermediate knowledge on multithreading in C#.NET, John Skeet’s article is a must read.

The article displays the in-depth knowledge of the author on this topic. The author has painstakingly listed down the different synchronization objects available in C#. He also lists the pitfalls that one might get into while programming using threads. That explains why the article is so lengthy.

This article has everything one needs to know about multi-threading in the .NET environment. Bookmark it, you know you will need it one day.

Type.GetType and referred assemblies

June 1, 2007

Problem Statement:

There is a DLL called CommonAssembly. This contains a namespace called CommonNamespace. This namespace contains a class called CommonClass.

Another project adds a reference to CommonAssembly and wants to get the type of CommonClass using the method Type.GetType.

Additional Information:

// This statement won’t work.
Type.GetType(“CommonClass”);

// This will not work either
Type.GetType(“CommonNamespace.CommonClass”);

Since CommonClass type is defined in a referred assembly, Type.GetType will not be able to get the required type.

Solution:

Type.GetType(“CommonNamespace.CommonClass, CommonAssembly”);

Anything that is given after the comma (“,”) is taken as the assembly name. This assembly is searched for the given type name.

If the required class is not encapsulated in any namespace, then omit the namespace name.

Type.GetType(“CommonClass, CommonAssembly”);

If this doesn’t work, then try giving the fully qualified name of the assembly.