Sashidhar Kokku's blog

September 2007 - Posts

GoogleBomb(Microsoft related stuff) = SourceOfAllEvil

So I am a web-developer, and I use tools like "Ruler" or "Screen Calipers" all the time. And yeah...if something works fine, why should I go ahead and get a newer version ...especially for something as simple as a caliper ... eh ?

But trouble struck, when I got a new machine at work. I wanted to install the Screen Calipers tool again, and for some reason, that I still can't remember, I did not save the installation file to C:\Workspace\Installs.

So, whats the next logical thing to do...search for the tool online, and pray that it is still free !!!!!

Enter Google.... and the search string [Link].

And this is what I get:

GoogleSearch

And for the good web browser that firefox is.....I get a nice warning to bucker off...coz something seemed fishy.

FireFoxWarning

Ok....but I still want to go through, and click yes and go through...

WebUrlChange

After that I did not have the heart to click "Continue". But my wife went ahead and did some research on this topic, and the avid googler that she is....and after a bunch of conversations and searches, we find out that this is what is called as "GoogleBombing". A detailed discussion on this topic is posted here.

This could be old news for a lot of people, for the ones like me....its funny as hell.

For a while I getting a nice smirk on my face. 

Building a well-formed XML programmatically (C#)

This post is more of a reminder to self. I keep debating with myself as to how to create a well-formed XML programmatically in C#.

After some researching, and trying out various methods, that included the StringBuilder class amongst other funny ways to do the same, I settled upon the following style.

For every class that I write, I include a ToXml() method, that returns a string representation of the xml representation of the class.

 1: public string ToXml()
 2: {
 3: TextWriter obj = new StringWriter();
 4: XmlTextWriter xmlString = new XmlTextWriter(obj);
 5:  
 6: xmlString.WriteStartElement("Client");
 7: xmlString.WriteElementString("ID", ID.ToString());
 8: xmlString.WriteElementString("Name",Name);
 9: xmlString.WriteElementString("Url", Url);
 10: xmlString.WriteElementString("Notes", Notes);
 11: xmlString.WriteElementString("CurrentStatus", (Convert.ToInt32(_Status)).ToString());
 12: xmlString.WriteElementString("CurrentUserID",CurrentUserID.ToString());
 13:  
 14: xmlString.WriteEndElement();
 15: xmlString.Close();
 16: obj.Close();
 17:  
 18: return Helper.ReplaceSpecialCharacters(obj.ToString()); 
 19: }

 

 

Should something better come up, I shall update this post accordingly.

Technorati Tags: , ,