Friday, December 31, 2010

My Blogging Experience

After stepping into the blogosphere. I got to see that, the search engines weren't showing up my blog in search results, even I tried keying in my blog name, that too didn't fetch me the expected results; and moreover I was keen to get some analytics data on my blog. While trying to find answers to these questions, I happened to meet a friend of mine, who was into SEO domain. He was kind enough to provide solution to my problem on getting my blog visible to search engine's and on getting analytics data for my blog. After getting putting his mantras in practice, I started getting desired results. So if you already own a blog or planning to starting one, then this post should definitely get you some insight into SEO and Analytics.

Google Analytics - This was the crème de la crème among web analytics. With Google Analytics I could get analytics data for my blog in an intuitive manner, the dashboard renders a page with visitor statistics like:
  • Line graph of total number of visits on a given Day/Week/Month. 
  • Plotting out visitors on a map.
  • Listing out articles\pages with the highest number of hits.
  • Returning visitors\New visitors.
  • How did users got to your blog like whether from Search engine, direct URL, site references etc.
  • Landing page optimization and many more options.
If you aren't satisfied with Google Analytics, there's a lot more to explore on the commercial forefront, this includes solution from Yahoo Web Analytics, WebTrends, ClickTracks and Omniture from Adobe.

Promote your blog - The million dollar question of every blogger is that, how to get people visit my blog. Definitely there are heaps of solutions out there in the Internet, which are available for a fee or as a free service.  I will be writing about the free services which appeals me more, as I do blogging as a hobby, and not for any monetary benefits. Some of the sites which could publish your blog links are like Technocrati, Google Add URL, Live Add URL, Yahoo Site Explorer this makes your blog more visible to search engines. 

The other ways to promote you blog, is by placing links to your blog in email signatures, forums, comments, slide presentations, chat room titles, business cards etc. Also email your blog link to friends n colleagues and don't forget to get feed back from them. You could also use social networking sites like FaceBook, Twitter, Orkut, LinkedIn to broadcast updates on your blog.

Here's a couple of points worth noting, to keep visitors coming back to your blog.
  • Enable Following on your blog if your using blogger.com, this is a great way to keep your friends updated on the latest activity on your blog.
  • Keep your posts and paragraphs short. Go for compact posts that are to the point.
  • The more you blog, the more traffic you'll get.
  • Always reply to comments posted against your posts\articles.
  • Turn on your site feed. This includes RSS\Atom feeds.
  • Install Email This Post, this makes people to forward your posts to friends.
  • Most importantly write quality content and do it well.
A couple of times, I had seen people working on the same problem as I did previously. This made me to think about sharing, what ever small resourceful stuff I had with others. Earlier I used to mail my finding on programming problems as Knowledge-base to my peers, this method of sharing has its own limitations which made me to look for other ways. Finally my search for an effective way to share Knowledge-base stuff among my colleagues, peers and friends got materialized with rolling out of my blog TechAnnotations.

Hope you enjoy my blog posts and Thank you for you visiting.

Thursday, December 30, 2010

C# Snippets - Display Console application parameters

The other day while working with a console application, we had to log all the parameters passed on to the  application. Here is a single line code to fetch all parameters passed onto the application.


Console.WriteLine(String.Join(", ",Environment.GetCommandLineArgs()));

C# Snippets - Get executing method name

Recently while working on a C# application we had a requirement like, every method should log its name when called. Here is the solution I came up with to output the method name. The Utils.DispMethodName() utilizes the StrackTrace .Net class to get the method name from which it was invoked from.


using System.Diagnostics;
public static class  Utils
{
  public static void DispMethodName()
 {
    string MethodName;
    string ClassName;
    MethodName = (new StackTrace(true)).GetFrame(1).GetMethod().Name;
    ClassName = (new StackTrace(true)).GetFrame(1).GetMethod().ReflectedType.Name;
    Console.WriteLine("Invoking " + ClassName + "." + MethodName);
 }
}

public class Alpha
{
 public void Foo1()
 {
   Utils.DispMethodName(); 
 }
}
Now, if you were to create an instance of class Alpha and invoke method Foo1(), this would print out "Alpha.Foo" to screen.

Wednesday, December 29, 2010

Developers Arsenal

For the first time when I got myself a personal computer, I was under the impression that, what ever application I require was prepackaged with the OS. But soon I came to realize that, things didn't look as rosy as I thought of.


This made me to narrow down my search for applications. which were specifically tagged as "Freeware". So by this time, I had a pretty rich collection of freeware applications ranging all the from mere arcade games to EXE Packers, kernel debuggers and disassemblers. The list what i have in mind is pretty exhaustive, which could take some time to get all of them listed here. Anyhow I am starting off with what I could recall off the top of my head and don't get turned down by this minuscule list as of now. I will be constantly updating this space with more and more freeware applications, so keep watching.

Desktop Notes - When coming to sticky notes application for windows desktop, the one I prefer is "PNotes". Its simple yet hight configurable opensource freeware application written in C and Win32API, which gives lightning fast performance. PNotes allows you to pin notes and reminders,  to your desktop. There is provision to customize the notes like applying skins, password, transparency. Finally this one requires no installation at all.

World Time - If you had ever worked with teams who are in a different timezone, then definitely you would have wished for an application to get their local times listed on your desktop. QClock a freeware application, which has a pretty huge list of timezone listing all over from the world.

ZoomIt - Have you ever found it difficult to read small texts on you desktop? If yes, definitely this is the perfect freeware application which allows you to zoom into that particular area. This application has even some pretty cool features like you could draw on your screen while doing presentations.

Image Resize - Why is it taking so long to upload\view the photos taken from my camera? Have you ever asked this yourself while trying to upload\view pictures to Facebook or other social networking sites? . If yes, definitely this one is the real answer to internet friendly images. Usually the images from your Digital cam might be around 3-5MB in size, which is pretty huge for internet connections with moderate bandwidth. The "Microsoft Image Resize" will bring down this huge files to below 100KB, without any noticeable degradation in image quality. Once installed you could right click the images you want to shrink and select "Resize Pictures" from the context menu. (If you are using Windows7 this wont work, instead you can go for a similar kind of utility from Codeplex which is available for both 32 and 64 bit platforms as well. Click here to download)

SiteToPhone - Ever wished to send URLs to your mobile from your desktop browser? The SiteToPhone.com provides exactly this and that too without any complicated registration. This application required no login at all. Just visit the site, click "Create an ID" email the generated URL to your mobile and bookmark it. Next time when ever you need to send any link to your mobile, use the SiteToPhone browser plugin to pass on this URL of choice to your mobile.


Startup Programs - Autoruns a freeware powerful startup program management utility from Sysinternals, lists out an exhaustive list of applications, DLLs, plugins, drivers which gets loaded during windows bootup and while user login. The application neatly groups up all those startup modules into different tabs for easy viewing and moreover it provides online search facility to identify unknown startup applications. Whats more catchy is with this application is that, it even lists out windows services which doesn't show up in the Windows services console (services.msc).


Multi-Monitor - When I got my secondary monitor for my workstation, I felt a bit uneasy while moving applications(windows) between monitors, at the same time the taskbar too didn't show up on my secondary monitor which was quite strange. After Googling, I found light at end of the tunnel, with the Multimon utility. Multimon provides extended taskbar support for additional monitors and this cool utility comes in two different versions freeware and shareware. The freeware version will definitely meet the basic requirement of getting the taskbar support extended to secondary and third monitor if any. In addition to the extended taskbar, it provides window switch functionality through buttons placed on the title bar of each window. You could also use the shortcut key to switch applications between monitors, which I find myself using most of the time. Use Ctrl + Alt + -> to switch the current active window to the right monitor and Ctrl + Alt + <- to switch applications to the left one.


File Unlocker - Its not unusual for a windows user to get messages like "File in use. Access denied", while trying to delete, move or rename files or directories. Unlocker a shell based utility comes to the rescue. Once installed, you will find a new entry named "Unlocker" when ever you right-click a file, selecting this will bring up a list of applications or processes which had locked this file. You either kill those processes or unlock the handles by clicking on appropriate options.


Process Explorer - This is the best ever freeware utility from SysInternals, I had used to manage processes running on my system. This one is packed with tons of features, which definitely is far ahead and powerful than the Microsoft TaskManager. This application throws out tons of details for a given process, which definitely assists in debugging a lot many issues involving handles, permissions\security, modules etc. I love this application especially its process suspend capability, which is badly missing in Microsoft TaskManager. This I recommend as a must to have tool for every windows user.


Hash\Checksum Extension - Whenever you download or upload file over internet, how can you guarantee that the file you uploaded\downloaded was received intact at the other end?, i.e without any data loss or data corruption. In such scenarios the hashing algorithm comes to rescue. The hash algorithms generate a unique signature against the file you wish to verify. So when ever you host a file in an HTTP\FTP site, always upload the hash signature of that file along with. This helps those downloading the file, to verify the integrity of the downloaded file by generating the hash value of the downloaded file against the hash value provided there in the server. The HashChecksum extension discussed here, adds a new tab named "Checksums" to the file properties dialog, here you will find checksum values generated for the given file using different algorithms like, CRC-32, MD4, MD5, SHA-1.


Notepad++ - If you have ever worked with Microsoft Notepad, definitely you would have asked for something better. After stepping  into development, my search for a better text editor ended up with Notepad++. Now for the past 4 years this is my preferred text editor of choice, which comes with a whole lot of features and that too with a small memory footprint unlike other Microsoft products. There's a whole lot of of features like Color coding\ Syntax highlighting for almost all the programming languages under the sun.Then you could zoom into the document if text seems difficult to read and moreover it has a tabbed interface which shows up last active\opened documents each time whenever the application is triggered. If you want to try out some popular opensource text editors here's a selected few from my archive. Notepad2, Programmers Notepad.


Audacity - This is a must to have utility, if you want to do basic audio editing or recording kind of stuff. I was using this utility to record audio from skype. The coolest thing about this application is that its opensource as well as free.


Tamper IE: Some time back while executing a web project for Dept. of Defense, our application was put to security test, which uncovered a pretty long list of vulnerabilities. While going through their test cases, one thing which caught my attention was on tampering data after form submission, i.e. after all validations. The tool they had used for this was a free IE add-on utility called Tamper IE, with which you could alter the data posted from browsers.


DM2: This is pretty cool utility with which you could make certain windows stay on top of all other windows or move some applications to system tray or even make those transparent and change there process priority by simply right-clicking the title bar or its corresponding task bar icon. The feature which I love the most is the WinEnable plugin; this is almost like an hackers tool, with which you could enable most of the disabled controls in any application, just by hovering the mouse over it. Theres a lot more you could accomplish with the plugins packed along with. I am leaving this for you to try it yourself.


Recuva - Have you ever been in a situation, where by chance you deleted some important files which and was running from pillar to post to get those recovered? If yes then this is the right tool to get yourself out from the nerve breaking situation in any time in future. This is a free file recovery tool from Piriform with a pretty good list of options to get your file back. A small tip in case you find yourself in a situation where you had accidently deleted a file. Keep you computer as it is, never try yo open or close any running programs or files, which could overwrite the deleted file sectors. If any Instant messaging apps or email clients are running exit those by going to task manager and killing the process, this may seem like a contradictory statement to what I mentioned above. The reason why is that, the IM could write out chat logs if some one pops in at that moment and email clients could pull mails from the server which might cause overwrite issues. So as to avoid this its safe to kill the process rather than exiting the normal way.


System Information: If you need to get a detailed inventory of your computer like details of processor, motherboard, RAM, HDD, Graphics Card etc. There are a couple of free utilities out there in the internet, but the best among which I came to find was the one from Piriform called Speccy CPUZ and Belarc Advisor


Process Terminator: There are times when process like antivirus background scanners which might be slowing down your computer or some unknown processes which you might not be able to terminate at all. In most of these cases Task manager might be of no use, because it will simply show an access denied or failed message when ever your try to terminate such processes. As a solution to this i came to find these two freeware utilities namely Process Explorer with which you could terminate most of the process, if not you could at least suspend them(the safe bet, I would say), which is like pressing the pause button for the selected process. Next is the ultimate one, the Process Hacker. I had seen this one terminating most of the processes even which Process Explorer had failed to terminate. Process hacker presents the user with a list of options to be executed against the process which is to be terminated.


Wire Shark (Network Analyzer): For those developing network apps and doing security analysis, this is a must to have tool in your arsenal. This one captures the network traffic flowing through the system NIC and presents in a clean UI. It could even capture VOIP and media traffic. Wireshark's native network trace file format is the libpcap format supported by libpcap and WinPcap. The best part of this application is that, its Opensource and freeware.


Widows API Monitor - Have you ever been in a situation where you had to list out specific Win32 APIs called by a windows application? Hopefully not in most development scenarios. But chances are there you might have looking for this, especially if your were to unlock a trial version of  the software or trying to uncover a hard to find bug in any third party apps. This small utility which could hook to the application of choice and capture all the API calls made. This is a must to have application if you want to do some hacking kind of stuff and also not to mention use this wisely.


Dependecy Walker - If you had done COM development then definitely you might had nightmare with missing modules during deployment. This is pretty cool utility with shell integration, which could be used  for troubleshooting system errors related to loading and executing modules. Dependency Walker detects many common application problems such as missing modules, invalid modules, import/export mismatches, circular dependency errors, mismatched machine types of modules, and module initialization failures. The utility works for both 32-bit and 64-bit windows modules and moreover this is freeware.


MagicISO - This freeware utility is capable of mounting virtual DVD\CD drives in your machine. This little application sits in the system tray, from where you could manage all the virtual drives and mounting\unmounting operations.


CamStudio Screen Recorder - If you are planning to do some screen recording for preparing a demo of your product or whatever, this freeware utility will meet most of the basic screen recording needs.


German Dictionary - My search for a free Desktop based German - English dictionary came to end, after finding this cool freeware application called LingoPad. This application sits in your system tray and provides both German to English and English to German translations. The best feature I really love is the "Clipboard watcher" this feature monitors your clipboard for copied texts and provides the German translation, so one no longer need not type in those grueling Deutsch words containing the umlauts.


Virtual Floppy Disk Drive - Nowadays floppy drives are no more seen in any present day computers, even if they were there, chances are that you will find most of them as defective. I came across a situation where I had to download some drivers which had to be loaded to a floppy disk and accessed. I don't know why they did it like that. So this cool free ware utility came to the rescue. This one installs a device driver in XP and creates a virtual FDD in either RAM or in a disk file.


TeamViewer - This is the simple tool I had used to remotely troubleshoot computers over internet. This tool offers you a remote desktop kind of experience to remotely manage others desktop. The beauty of this is, no installation is needed and renders remote screens without considerable time lag even with low bandwidth connections. The only downside wit this one is, a person should be available on the other end in order to establish a link.


LogMeIn - Ever faced the situation, where you had to remotely login to your office machine to get some files?. If yes this is the best solution to get your machines accessible from a browser. The only requirement is that, the machine which your trying to reach remotely should be left turned on.


Windows Grep -  Ever faced with the task of searching a specific string in a set of files\folders? If yes, you know how difficult it is especially with windows search. The Windows Grep a freeware tool provides you with power and flexibility of traditional command line grep utilities available on DOS, UNIX and other platforms with the ease of use of Microsoft Windows. You could even preview the file contents that match your search string.


In case the developer tool you were looking for isn't listed over here, then here's a link from Scott Hanselman's "Ultimate Developer and Power Users Tool List", with links to tons of developer tools. I would say this is a must to visit link, if you happen to be a web developer.

Wednesday, December 8, 2010

Microsoft Kinect - The Next Generation Gaming Interface

Have you ever imagined, how it would feel like playing games without any kind of joystick or  controllers; and how about hiding behind couches to avoid shots from a first person shooter game? Got your jaws dropped? thinking whether am I hearing a Flash Gordon sci-fi story? Yeah me too was in the same situation, when I first heard about Microsoft Kinect.

Nowadays motion controllers being the buzz word in the gaming industry, which got Nintendo’s Wii on to the market forefront, but this time Microsoft made a giant leap, which took the gaming industry by storm.   The ground breaking product from Microsoft, code-named "Natal" had finally hit the stores christened as "Microsoft Kinect", this time Microsoft has not only come up with something which is innovative, but moreover something for the open source community as well.

Microsoft Kinect the next generation gaming add-on for Xbox 360, redefines the way we interact with games and gaming consoles. Its not something we had seen anytime before in the gaming arena, no controllers, no joysticks, no remotes nothing but just human gestures!!!!. Yes you heard it right, just gestures. No device's attached to you body or surroundings. An excellent piece of technology which I had ever experienced. So before moving on, let me show you this marvelous piece of technology in action.








Got astonished at just what you saw? Keep reading there's still a lot more to see on this wonderful piece of engineering. So whats behind this next generation device? lets find out. Microsoft Kinect at its core is like that of a human with eyes and ears. Practically it could see you in 3D, i.e; height wise, width wise and depth wise and could interpret your gestures. Moreover it could recognize your face and even comprehend your voice. So what gives this marvelous device these capabilities? At the heart of Microsoft Kinect is a 3D camera(from PrimeSense an Israel based company) aka "radar camera", a motion sensor, a tilt motor, a Mic and definitely the software to process data from all these sources. The device provides USB interface for connecting with consoles.

If you were to dissect this device, you could find four microphones for voice input, two camera's, one infra red projector, a three axis gyroscope, 64 MB of DDR2 RAM and a motor to point this device to a particular point. 

The 3D camera could even operate in complete darkness, as it relies on a infra-red beam to analyze the objects. The depth information is computed by measuring the time taken for the beam, to bounce off from an objects back to the camera. While the motion sensor is capable of tracking 48 points of movement in the human body which could track your finger movements. Despite of all these glittering features, a UK based firm had reported that Kinects facial recognition didn't work for dark skinned people, while some had denied that, they didn't experience any such problem with Kinect.

I think you should see how the depth and motion sensing capabilities of Kinect looks like in real world.





So now after seeing all these, you might be wondering how to get yourself this  wonderful piece of hardware. If you already own a Xbox 360, then you are lucky that you just need to shell out Rs.10,000 to own this. You could find more information on pricing related stuff over here at TechnixUpdate.

Open Source and Microsoft Kinect
In case if you interested to programme this device then read on, else you could skip this section. If you were look at Kinect from a different perspective, you could see that, this device opens up tremendous possibilities at what you could achieve with this marvelous piece of engineering. So the first question which could be lurking in you mind could be, how about interfacing this with my PC? If this was your concern, then no need to worry at all, as this had been  already taken care of by the open source community. Here are a couple links providing driver for this device.


The other cousin - EyeToy
If you had heard about PS2's EyeToy from Sony, then you could find a lot many similarities between these two, but for those who are new to EyeToy, here is what its all about. EyeToy released by Sony in 1999 for its gaming console had gesture recognition capabilities, which allowed players to interact with the games using color, motion and voice recognition. But unfortunately the device didn't catch up the market as expected during those days, which spelled doom for the EyeToy.

Finally the ultimate question from every gamer would be, are there any games out there that could take advantage of Microsoft Kinect. Absolutely Yes !!! indeed the Xbox forum is full with this very same query. Take a look over here to see the long list of games being showcased which are specifically targeted towards Microsoft Kinect.


Microsoft Kinect has a whole lot stuff to offer other than from the gaming arena. Definitely the applications of this wonderful piece of hardware is yet to be unleashed, once this is interfaced with Mobiles, Tablet PC and even with workstations. Well this device is definitely going to rewrite on how we are going to interact with entertainment systems as well in near future, well wait and see....


If you are anxious to know more about Microsoft Kinect click here to explore further.

Wednesday, December 1, 2010

German alphabets - Language Bar to my rescue

After myself enrolling for a course in German language, I had pretty tough time to digest those grueling tongue twisting  pronunciations. Any how I decided to take on this new challenge head on, to get myself acquired with a new linguistic skill. So each day I had to learn a handful German vocabulary to keep up with the lessons. 

To keep pace with learning a bunch of  new vocabularies, I turned to Google Translator and other online sites for instant German to English translations which got me results in a jiffy than those bulky dictionaries. The very moment I started using online tools, I hit a road block while dealing with special German characters on standard English keyboard layout.

In German language you could find four new special characters\alphabets other than the standard 26 English alphabets. Here the first three characters are called Diacritics (Ä/ä, Ö/ö, Ü/ü) and the last one is called the ligature (ß).  In simple terms the Diacritics and the ligature are alphabets specific to German language and here's how its spelt.

ß - Pronounced as "ss" or called "Sharp s" or Scharfes.
ü - Pronounced as "uyuh".
ö - Pronounced as "ooh".
ä - Pronounced as "ay".

After doing some research on this, I came up with an apt and elegant solution for this very problem which was the Language bar. So in order to key in those special German characters what all I had to do was pretty simple, just select "German" from the options and proceed typing in those Diacritics and ligature, thats it. So lets start off with on how to setup the Language bar for German language in you computer.
  1. First of all I assume, you are using WindowsXP or higher for this feature to work.
  2. Open "Control Panel" and click open "Region and Language Options".
  3. In the "Region and Language Options" window, select "Languages" tab and click "Details" button.
  4. Now you will see a window with the title "Text Services and Input Languages" like the one below.


  5. Next click on "Add" button. 
  6. The "Add Input Language" window will come up. Here select "German (Germany)" from the "Input Language" drop down and click  "OK".

  7. Now you should be seeing the "Text Services and Input Languages" window with German Keyboard listed, like the one shown here.

  8. Now click "Language Bar" button in the "Preferences" section. This should take you to the "Language Bar Settings" window as shown here.

  9. Here in "Language Bar Settings" window, check\tick the "Show the Language bar on the Desktop" and click OK.

  10. Click "OK" to close all the open windows.
  11. Now you are almost there with just one more step to go. Enabling language bar in your windows Taskbar.
  12. To enable Language bar in you Taskbar right click the TaskBar and select "Language Bar" from the "Toolbars" menu. 

  13. You should now see an icon left to the System tray in you taskbar. If you click the icon, it will show the available languages. For us, we now have English and German. Here you could see the tick mark is against "English (United States)" that means, you keyboard layout at present is set to "English US layout", to change that to German layout just click "German (Germany)" and there you are. Now you have a keyboard layout to key in those special German diacritics and ligature.

Now lets complete the last mile of the journey. How do I key in those special characters with my standard English keyboard? I don't know how you keyboard layout is like; but Microsoft Windows does know. Lets ask windows on, which are those keys designated for special German characters on my keyboard?. So here we go. 

  1. Before we move on, make sure you had selected "German (Germany)" from the Language bar icon in the task bar.
  2. Select Start-> Run.
  3. keyin "osk" (without quotes).
  4. press enter key.
  5. You should get something like this on your monitor.
  6. Now looking at the key layout shown in the "On Screen Keyboard" window, you should be able to map which all keys act as special German characters. 

  7. Here in my case you could see the following key's map\correspond to the German diacritics and ligature.

    ß - Key next to "Zero" or the second key to the left of backspace.
    ü - Key next to "P".
    ö - Key next to "L".
    ä - Key next to "ö" or the first key to the left of "Enter".

    Now when ever you want to switch between the English or German keyboard layout, here is simple tip. Just press "Alt" + "Shift" to cycle between the Keyboard languages listed in the "Language bar". You will see the icon on the Taskbar changing from "EN" to "DE" and back.

    So thats it, Auf Wiedersehen (Good bye).

Wednesday, June 9, 2010

Finally World Cup 2010 Is Here

World Cup- Soccer 2010 is finally here, with our favorite teams lining up for the mega sporting spectacle. While for the Internet savvy's there's more to cherish with, as the IT giants Google, Yahoo and Microsoft are gearing up to woo you with their eye catchy gadgets and services to keep yourself updated with the events and news directly from South Africa.


WorldCup Highlights
In case if you missed out those heart throbbing shots? Then here is an opportunity for those tied up with tight schedules. FIFA has put up the match highlights video online here.








Google's World Cup Offerings

Google with its innovative offerings has loads of serves for Soccer enthusiasts. With the very first one from the search engine forefront itself. If you were to key-in world cup to Google search box, you will be presented with the match details straight away.




A Panoramic Walk-through of World Cup Stadiums
While Google Street View is there with more aerial and visual treats, with street and panoramic views focused on to world cup soccer stadiums. Here you can take a walk through of those majestic Soccer stadiums in South Africa.




just in case if you are curious on how the street view is captured, here's a  how to video released by Google.


World Cup Stadiums 3D Video
You tube guys are out there with something different with a three dimensional view of the world cup soccer stadiums. Here you can immerse yourself in a three dimensional treat of those marvelous engineering.


World Cup Theme Songs
YouTube doesn't end there with just a view of the soccer stadiums, theres even more. The 2010 World Cup Theme song which really holds the spirit of the game, is a must watch.  

Here's The Official World Cup 2010 theme song by FIFA
  
 FIFA World Cup South Africa 2010 Official Theme Song.


Ariel Snaps of World Cup Stadiums
The PicasaWeb is there with some really good snaps, where you can find some Ariel view of the stadiums right from construction to completion.


Chrome Extensions
With the World Cup fever caught up with the browser extensions, Google Chrome is now made available with a new extension exclusively for FIFA World Cup 2010. This lists out news, fixtures, results, videos and more from the Soccer forefront. You can download the extension from here.




Yahoo World Cup 2010 Offerings
Yahoo had put up a dedicated site for reporting the latest happenings at World Cup Football 2010. The site has loads of details which every football manic expects and many more. You can visit the Yahoo Sports site here.


Microsoft World Cup 2010 Offerings
Microsoft has come up with new FIFA World Cup 2010 themes for Windows 7, upholding the spirit of Soccer. Here you can download the themes for World Cup 2010


Microsoft World Cup 2010 Score Card
Keep track of Who's Who at next level with Microsoft Excel Templates. Here you can download templates hosted by community members.


World Cup Live Video Feed
Here is a couple of sites coming up with live video feed from World Cup 2010.
http://watchworldcup.tv/ These chaps are providing live feed for a nominal fee. http://www.streamdirect.tv/ While these guys are said to offer the live feed for FREE of cost !!!. I think I should try out this once the World Cup rolls out into action.


WorldCup - Blogs 
Keep a tab on development at FIFA World Cup 2010 at the forefront and the things behind the scenes at http://www.worldcupblog.org/


Official World Cup Site
World Cup 2010 South Africa
FIFA World Cup Matches







World Cup 2010 match Schedule
You can download the match schedules from FIFA website.


If you want a single snapshot of the match schedules, Teams, Groups, Countries, Locations. Then here's an elegant 360 degree chart presenting with all of the above attributes, click here to visit.













World Cup 2010 
Broadcasters
If you interested to know which channel covering World Cup Football in your country, click here.


So get yourself ready for the mega event starting from June 11th to July 11th.


Thursday, June 3, 2010

Exploring Main() in C#

In a typical Win32 .NET application you could find that the entry point always point to the Main method, be it Console or Windows application. Out of curiosity I thought of digging into the internals, to see whether is it possible to map the entry point to a method name different from "Main". So to start off with, lets take the infamous HelloWorld sample for demo purpose.

Listing - 1

   1:  using System;
   2:   
   3:  namespace HelloWorldNamespace
   4:  {
   5:      public class Program
   6:      {
   7:          public static void Main()
   8:          {
   9:              Console.WriteLine("Hello World...");
  10:          }
  11:      }
  12:  }

Here in listing 1, you could see the Main method being the entry point as usual; before proceeding have you ever tried renaming the "Main()" to something of your choice?, If so, definitely the compiler would have stopped from compiling the application saying like "The Entrypoint Main() not found". So c'mon lets alter this code to get the entry point name mapped to something different. Before starting off, I strongly recommend using Notepad++ for working with the code listing discussed in the article, as we are going to deal with multi-file assemblies.


Listing - 2

   1:  using System;
   2:  using System.Reflection;
   3:   
   4:  namespace HelloWorldNamespace
   5:  {
   6:      public class Program
   7:      {
   8:          public static void MyEntryPoint()
   9:          {
  10:              MethodBase method = MethodBase.GetCurrentMethod();
  11:              Console.WriteLine(method.Name + ": Hello World...");
  12:          }
  13:      }
  14:  }


In listing 2, you could find the same code as in Listing 1 being retrofitted with some new additions like, the entry point had been re-named to MyEntryPoint, while a new type MethodBase is being implemented for printing out, the method name during application execution, this for ensuring that the MyEntryPoint method name is not being altered or overwritten by the compiler nor by the runtime behind the scenes. 


So lets compile the above code snippet from "Visual Studio command prompt", before this save the code in listing 2, to a file named "HelloWorld.cs". Key-in the commands in listing 3, to the "VS.NET Command Prompt" and make sure the location in console window is set to where the source code is located.


Listing - 3











csc /target:module HelloWorld.cs
al HelloWorld.netmodule /target:exe /Main:HelloWorldNamespace.Program.MyEntryPoint /out:Helloworld.exe  


(If you find working with the VS.NET command prompt cumbersome; like opening up the program from deep inside the start menu item and thereafter navigating to the source code location, I recommend reading this article.)
If you are familiar the commands and parameters in listing 3, you can straight away proceed to "Executing Application" section. In case if you find the commands in listing 3 unfamiliar? Let me give you a sneak preview. The commands CSC and AL are provided by .NET framework SDK, where "CSC" is the "CSharp Compiler", while the "AL" is the "Assembly Linker". Lets analyze the Listing 3, line by line. 


Listing - 4




csc /target:module HelloWorld.cs



In listing 4, you can find the first line from taken from listing 3. Here the csharp compiler(CSC) is passed with two parameters. The first parameter "/target:" instructs the compiler to generate a ".netmodule". While the second parameter "HelloWorld.cs" specifies the file name of source code as input. On execution the CSC generates  a file named "HelloWorld.netmodule" in the same directory as of "HelloWorld.cs".


Listing - 5
al HelloWorld.netmodule /target:exe /Main:HelloWorldNamespace.Program.MyEntryPoint /out:Helloworld.exe

In listing 5, you can find the second line from taken from listing 3. Here we are calling the "Assembly Linker" to generate an executable by referring the previously generated "HelloWorld.netmodule". From the the above listing you could find four parameters being passed to "AL.exe". The first parameter instructs to reference the HelloWorld.netmodule which was generated in the preceding step (Listing - 4). While the second parameter is a '/target:' flag which instructs to generate an console application. The Third parameter '/Main:' is where the entry point mapping happens, here we are specifying the method to be called in replacement of Main method. You can find fully qualified path to the method being passed in the following format {Namespace.TypeName.MethodName}. Finally in last parameter, the "/out:" flag where the name of the executable is mentioned as "HelloWorld.exe".



Executing Application
Voila, we are done with. Now you can execute the application and see the output. The output should be similar to listing 5, if you have used the same name for your entry-point.


Listing - 6




MyEntryPoint: Hello World...



Inside Story
So now we have an assembly with the entry point mapped to a different method name than that of the default Main(). Lets peek inside the HelloWorld.exe Assembly using "Red-Gate Reflector" and see, how this entry point re-mapping works.


Peeking inside the Code
Here is a screenshot from Reflector, of the HelloWorld.exe.




In the above screen shot from "Red-Gate Reflector", you can see two different modules namely HelloWorld.exe and HelloWorld.netmodule. You can find a method named "_EntryPoint():Void" the one highlighted in the screenshot, which does the job of pointing to the  entry-point of our choice. In the Disassembler window; you can see the C# code that does this mapping.


Main Program Variants
Its common to see the Main() method container type being used inside a Reference-Type most of the time. But did you know that, its possible to use "Struct"in place of "Class" container? Here in the below code listing you could find "struct" being used in place of "class", which is perfectly legal.




Listing - 7
   1:  using System;
   2:   
   3:  namespace HelloWorldNamespace
   4:  {
   5:      public struct Program
   6:      {
   7:          public static void Main()
   8:          {
   9:              Console.WriteLine("Hello World...");
  10:          }
  11:      }
  12:  }

So thats it. Truth to be told, If you were you ask me whats the benefit of this remapping Main() with a custom method name? I am clueless on this, if you happen to know any benefits on aspects relating to security or obfuscation, please let me know.