Tuesday, October 05, 2010

In This World - 16

"Relationship shouldn't be complicated, if it so, then its time to look at it from a different perspective and attempt to resolve challenges, if that doesn't work at any cost, put a period and move on."

Well..I have one more view to share which may sound bit contradictory to what I expressed above, but its indeed an unarguable truth!

"Move on - is the simplest one to say and most difficult to go through!" :)

Sunday, September 26, 2010

Windows Service or Windows Task Scheduler?

Are you planning to create long running background process (in C#) and thinking to build a Windows service?

Then wait for a moment!

Windows Task scheduler (Start->Programs->Accessories-> System Tools-> Task Scheduler) can also be a decent choice!

"Windows Vista and higher windows (server) operating systems are offering matured Task scheduler with many advancements like Triggers, Actions, Conditions, failure recovery, email notifications, security and much more."

Its obvious that many programmers think Windows Service is easy to maintain and what it can do, task scheduler can’t. But now, it’s time to look at Windows Task Scheduler [also at Microsoft white paper] and see what great features it is offering.

When to go for Windows Service?
Okay, let me try to answer this popular question in one line. 

Windows Service is suitable for receiving service request 'anytime' and process 'instantly'.

Just think of anti-virus scanner, network port activity tracker, remote access connection manager, SQL Server database service, chat server..etc. all these need ‘long running process’ because they have to serve the service requests coming in ‘any time’.

Scheduled Processes

your process wake up every few minutes, queries intended source (like database, Message Queue..etc), performs some operations and goes to sleep
Next time when it wakes up, has no interest in knowing what it did previously.
consider leveraging Windows Task Scheduler. Write a console program (hide console window if you want) or WinForms program (with Form + Taskbar visibility false) and set it up with Task scheduler.


  • No need to implement timer logic to keep process alive. Having programatic timer unnecessarily consume more CPU cycles because Windows has to create some more threads to keep timer run properly.
  • Avoids doing more R&D on finding and troubleshooting memory leak problems. Windows Scheduler gracefully terminate the windows process (on which our program is running) and creates new one for next run.
  • Don’t have to worry about automatic restart of your process when it crash or to perform multiple retries whenever it encountere problems.
Points to consider...
  • From support point of view, consider using logging component (like log4net) to log events to windows event viewer. Many monitoring systems mostly listen to event viewer and send notification emails to support team to flag about the problem.
  • When setting up your process with Task Scheduler, make sure to check option to run it  even when user is NOT logged into the system.
  • Make sure 'Task Scheduler' service (Start->Run->type 'services.msc' and check) is running on server operating system and set to 'Automatic' mode.
That's all for now. However choice between windows service and task scheduler is a design decision and depends on requirements. If something is tickling in your mind and want to express your thoguts as a comment, feel free to share here. Thanks!

Saturday, August 21, 2010

Tracking Downloads in Google Analytics

I wanted to track download count of Quick Quest demo version hosted on SrushtiSoft through Google analytics. I faced obstacle during the implementation process and wanted to share here, hoping to save your sometime if you are also trying to do the same for your website or blog.

Google neatly guide you how to do it, http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55529 with a slashing message "This article is for the latest version of the tracking code". But it just doesn't work at one-shot! 

I had to spend sometime to find a way to troubleshoot "pageTracker is not defined" javascript error. Finally, the post on StackOverflow puts you on right path: http://stackoverflow.com/questions/3503511/google-analytics-pagetracker-is-not-defined

Though google talks about the approach in detail here: http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html chances of it going unnoticed is more.

Monday, May 10, 2010

Getting ready for Paris trip?

I had wonderful experiences in Paris. Its a great place and you must visit at least once in a life time. I hope my below points would help to avoid some surprises during your Paris tour...

- Best way to visit Paris is using Metro. If you are planning to stay for few weeks, its worth to buy book of 10 metro tickets which will save you some euros.

- When you are walking on Champse-Elysee, you can have sandwiches from road side stalls. They are tasty and worth each penny.

- Most of the non-veg dishes are with Beef and Fish.

- Alcohol is cheap.

- At least try to greet people in French and they will try their best to assist you in English.

- Do not purchase Disneyland Paris tickets on its English version website when you are in Paris. Disney charge you as per UK (in GBP) rates, which is unnecessarily expensive, where as same kind of ticket can be found in French version of Disney website for 10 euro lesser the UK cost. Disney continue to make fun of you by expecting you to read and understand terms and conditions written in French. At some point you feel Micky laughing at you!

- At least Paris doesn't have telephones which can accept coin or credit cards!! So if you want to make a local call you must have telephone card purchased (starts with 7.5 Euro) in one of TABACs  found in many paris streets.

- Not all public automated toilets are free.

- If you are expecting your hotel reception will speak in English with you, thats your fault.

- Sunday is like a dead day in Paris. All most all the stores/pharmacies will be closed! if you have planned to have food near your home/hotel, you may prefer to die, instead trying really hard to find out 'open' restaurant.

- In most of the shows/planetariums...etc French is the default language, and you can't expect English.

- Louvre museum has multiple entries but no one knows. (including Paris residents :) Everybody stand in the big line near popular glass traingle!

- If you don't like crowd, It may be bad idea to plan visiting popular places in Paris during weekends.You will have to discover the tourist attraction place from the crowd. Specially, First Sunday of every month, most of the (state) museums will have free entry. If you enjoy standing in 2 or 3 hours long line, you can dare to step out of your home/hotel otherwise visit beautiful gardens in Paris.

- As euro international credit card, never ever go for "HDFC Forex Card plus" it doesn't always work on all online shops and HDFC demonstrated its unmatching irresponsiblility in customer support activities when you try to contact them over web/email.

- Better take vaseline with you, otherwise you will end up buying one vaseline tube for 3 euros!

- When you go to any cinema make sure it is V.O.S.T or VO (that means english version). Otherwise next 2 hours you won't know people laughing at you or on a joke in French from the movie.

- You may not feel all museums/tourist places are great! so do enough research before stepping inside by paying 8+ euros of entry fee. Otherwise you will feel museum sculptures looking at you as a dumb piece of stone.

- Your hotel may not have 3 pin plugs, so you can plan to buy 2-to-3 converter from castorama stalls for your mobile/laptop chargers.

- This is very important, Paris is a very romantic place and if you are married, go with your wife :)