Thursday, September 06, 2007

Moving out from here to wordpress

Hey, all I am shifting my blog from blogspot to wordpress. From now on stay tunned to for updates.

Bye to blogspot !

- Reza

Tuesday, August 28, 2007

Last words for RTL colleagues !

Following is a mail I sent out to my RTL colleagues when I left for Sweden to do my masters in Software Engineering and Distributed Systems ..

Hello All,

As you might have heard (or perhaps not) today is my last day at Relisource. Unfortunately today is a curfew and none of you are here at this moment to say goodbye. I think its all good as the goodbye part would have been very tough for me. Many things have happened and so many people have come and gone, and in this last day, I am not sure what to write for all of you, since there are so many things and each deserve a special thank you in their own way. It's been an exciting and eventful one year and eight months. I will cherish this memories and moments I have lived with you guys for the rest of my life.

In short, I would like to say no matter which part of the map I am in I will always keep in touch and flood your email boxes with my mails no matter what Vaskar Da has to say.

I would also like to take this opportunity and thank all the people in RTL, each and every one of you have, in some way influenced my life in a big way. I have learned a lot during my stay here, not only coding but how to lead and enjoy each moment of life. I have better understood the meanings of fun, commitment and professionalism.

Please do pray for me so that I can stick to path of goodness and follow my own religion with faith and believe.

This is the end of a memorable chapter of my life and beginning of a new one.

/Reza - End of a wonderful Chapter !

Monday, August 13, 2007

How to justify that your code is stable !

Have you ever wondered how much tested your code is ? We often write Unit Tests to ensure proper functionality of a product. But how do you ensure that the Unit Tests actually covers most of the functionality. Well the solution to this problem is a open source tool named Cobertura. This is for Java freaks only. Cobertura is a tool which calculates the code coverage of your project.

A sample report generated by the tool :

Detailed report on the lines covered by the unit tests written for the project:

Feature List :
[This feature list is quoted from official cobertura page : ]

  1. Can be executed from ant or from the command line.
  2. Instruments Java bytecode after it has been compiled.
  3. Can generate reports in HTML or XML.
  4. Shows the percentage of lines and branches covered for each class, each package, and for the overall project.
  5. Shows the McCabe cyclomatic code complexity of each class, and the average cyclomatic code complexity for each package, and for the overall product.
  6. Can sort HTML results by class name, percent of lines covered, percent of branches covered, etc. And can sort in ascending or decending order.
The integration of this tool is very straight forward. They have given the ant script which when added to your projects ant will automatically have this integrated with your project. So simply go to the following link and digg more on how to integrate :

I am sure Java lovers will find it great and indeed a nice tool through which you can justify that your code is stable and it RoCks. :) Enjoy !.

- Reza

Friday, August 10, 2007

Porting legacy codes to Visual Studio 2005

Lately we were given a code base from EA. It was a mixture of C and C++ codes. They continously added code to it on demand in an adhoc basis for the last 14 years. Our task is to develope the same tool from scratch if need be we can use some of their codes as well. And the requirement is the tool needs to be developed in Microsoft Visual Studio 2005. So our first task was to build the existing legacy code they dumped us with in 2005. While trying to do so I faced a few issues which I want to share in this post :

Commmon Problem 1:
error C2220: warning treated as error - no 'object' file generated
warning C4996: 'wcstombs' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdlib.h(562) : see declaration of 'wcstombs'
Message: 'This function or variable may be unsafe. Consider using wcstombs_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'

Solution -
#pragma warning ( disable : 4996 )
Commmon Problem 2:
error C2440: 'initializing' : cannot convert from 'const char *' to 'char *'

The code was :
char *pTxdGroupXml = strstr(name, "_resources.xml");

Solution -
Change the code to :
char *pTxdGroupXml = (char*) strstr(name, "_resources.xml");
Common Problem 3
error C3861: '_assert': identifier not found

#define _assert(exp, fileName, lineNumber) assert(exp)
Common Problem 4
error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll) LIBCMTD.lib
ProjectSettings - > Linker - > Input -> Ignore specific Library : LIBCMTD.lib

Hope this post helps when you are down and fighting to build a mamoth Legacy Code.

- Reza

Monday, August 06, 2007

Playing with linker options [C++]

Changing the entry point of your Application:

Did you know that the entry point of a C++ program can be changed. It can be set from the linker option.
ProjectProperties -> Linker -> Advanced -> Entry Point

In the entry point we can set any function name and that will be the starting point of the program. Try it and have fun :).

How to have a console running behind your MFC or Win32 Application:

Well at times this things come in handy. Suppose you have made a MFC project and have initialized OpenGL in one of the windows. Now while drawing on the window you need to watch some values of animation. In such a case as the values of animation are being update continiously, to see those values via a message box will be very pathetic. The other way to see the values might be to dump them in a file and then see the files. Wouldn't it be better if you could have a console window running behind the MFC windows you have created. Well having a console running at the same time would be easy to debug things on run time as we can have printf statements dumping values in the console, while at the same time the MFC windows are working as usual.

This can be acheived very easily.

SubSytem can be set via :
ProjectProperties -> Linker -> System -> SubSystem

Entry Point can be set via :
ProjectProperties -> Linker -> Advanced -> Entry Point

A bit of playing around with the linker options. When you open a MFC project you have the following set as default :

The subsystem value is set as : Windows(/SUBSYSTEM:WINDOWS)

And for Entry point the value will be wWinMainCRTStartup if you are using MicrosoftVisual Studio 2003 or 2005. For VC6 the value will be winMainCRTStartup.

Changes needed to bring a console :

Set value of the subsytem to be : Console(/SUBSYSTEM:CONSOLE)

When you set the subsytem the Entry Point value will be blank. We need to set it to have the value it initally had that is wWinMainCRTStartup or winMainCRTStartup.

Thats all. Run the program and you will have a console running at the back where you can dump all the information you need.

Hope this helps.


Saturday, July 21, 2007

Career planning for csc gradutes

In the last two years I have seen a lot of ups and downs in the Software Industry. So I thought of writing this post specially for fresh graduates who will enter the industry.

Initially there are two options for a computer Science graduate :
1 - Software Industry
2 - Telecommunication

In breif I can say if you are confident about your programming skills do not you choose Telecommunication just for the intial spark of salary they offer. If you are good enough as a programmer then defiently you will get better salary and satisfaction being in the Software Industry. Plus in the long run if you compare with your fellow mates you will find out that you are getting better salary and plus you are happy with your work.

Since I have not worked in the Telecom Industry I will not go in details about how to choose one to work in.

For the Software Industry according to me the best advice for freshers is to start working with a company who gives you the oppurtunity to work independently and have atleast one or two seniors. Even though there are lots of companies where you might even get to be the senior in no time .. but at the end of the day it is not worth it. So choose a company where you have atleast one or two good seniors. Make sure the company gives you actual development work rather than make you test softwares by saying be professional and do testing temprorary as soon as there is project you will be switched. Or makes you wait by saying there are projects in the pipeline, so you wonder around like a dangling pointer with no reference. This companies will create memory leaks in your career, so the solution is to leave those companies immeditely. No matter how much work you do each day make sure you are involved with opensource projects. Working on opensource porjects just takes you to another level. Always keep an eye on System design, try understand the project you are working on, understand its architecture. Since there are projects which have been going on for years, its understandable that understanding its architecture is not a piece of cake, so try understand the portion you work on and how it interacts with the rest of the system. Try getting yourself familiar with the upcoming technologies and do small sample projects when ever possible just to keep your self up with the rest of the world. Knowing the latest release of API's and Technology will also aid in your daily work.

The last advice is WORK WORK WORK and understand your WORK
- Reza

Monday, October 30, 2006

Eid in a graveyard

Well this time around I had a bit of different Eid. Usually I go to the Eid prayer with my Dad and my elder brother. This time I was alone as my Dad passed away last year. And my borther is in germany doing his higher studies. So this time I went alone. It was a different feeling. After namaj ended I had no one to have a eid hug. Well thats life for me at the moment, so slowly walked towards my home. Hugged my mom at home and was wondering to myself such a different and bad Eid I am having. But that was not all. Around 2:35 pm suddenly a sad news came by. My khalu expired just moments ago. We all rushed to thier place. My Khalu was sufferring from Brain cancer and he was in total bed rest for the last one year. One can say he was suffering badly. May Allah Bless his soul and may he rest in peace. Well so now come the formalities. Took khalu's dead body to the graveyard. A hole was digged for his burial. I got down in it and though to myself one day this is a place I will be coming as well. Everyone's final destination. It was a chilling experince all together.