Wednesday, August 22, 2012

Tracking Time at Office

Before being a team lead, I used to work on a single task, in addition to the usual office chores. Now things have changed a lot. I find it hard to keep track of time during office hours. At the end of day, I wonder how much time I actually spent on my assigned task, how much time I worked with other teammates. I felt the need of a time tracking software.

In my previous software firm, Structured Data Systems Ltd. - an offshore branch of AfriGIS, South Africa, employees were encouraged to track time by using a software named Klok. A free version is available. I have started using it.

I intend to try out other related softwares later.

Here is the template I am using now:

Office chores
  > Check office mail
  > Daily scrum meeting
  > General office meeting : occurs occasionally
  > Lunch
  > Refreshment : 2 times a day - at around 11 am and 5 pm.
  > Table Tennis : we play TT at office!
Team work
  > Check client issues at JIRA and update TRAC
  > Check teammates' yesterday's work at TRAC
  > Today's task assignment
  > Retrospective meeting: weekly event
  > Work with teammates: I frequently do this. Tracking time for every teammate will enable me to find a trend about with whom or on what task I do pair-programming for a given period of time.
  > Knowledge sharing session: I greatly encourage to do this immediately after lunch when everyone is relaxed. I am planning to practice this more vigorously.
  > Meeting with Product Development Manager (PDM): occurs everyday intermittently.

Wednesday, August 08, 2012

Checklist Before You Join a New Company

Sometimes I browse the job sites to find out companies for better opportunity. When a job circular seems good, many questions pop up in my mind. Often, I can manage someone familiar working there and I get to know about that particular company.

I think it is a good idea to have a checklist for this. Here it goes!


1) How many projects are currently going on?

2) What is the average age of the projects?

3) Which technologies does the company work with?

4) How important is the project (for which recruitment is going on) to the company?

5) What are the application domains of the ongoing projects?

6) What is the average experience of engineers working there? I mean years of experience for most of the engineers.


1) How do you think the company provides a good learning opportunity for an engineer?

2) Do you feel sportive at office? or it feels like a conventional office (everyone working at his desk, no adda, few brainstorming among colleagues)?

3) How many hours do you "actually" need to work a day, on average? I mean, productive hour.

4) How frequent is overtime?

5) How frequent is working on weekend?

6) Do you feel that your job is secure?

7) How friendly is the relationship among the engineers?

8) How cooperative is the relationship between engineers and management?

9) What do you think a unique quality of the company that sets it apart from the other companies in the market?

10) Do you follow any software development process? If yes, what is it?


1) What is the salary range for a fresher?

2) How many times in a year do your company give salary increment?

3) What is the average percentage of increment?

4) Is project bonus a regular phenomenon?

5) What are the other benefits?

Tuesday, July 26, 2011

snprintf is not a member of std

I am working on an Xcode project that includes boost thread library through cross-project reference. One step of setting up cross-project reference is to add value for Header Search Paths setting under Build tab (from project target's Get Info option). While doing so, I have checked the Recursive check-box.

When the project is built, the following error occurs:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/include/c++/4.0.0/i686-apple-darwin9/bits/c++locale.h:72: error: 'snprintf' is not a member of 'std'

Googling leads to a solution - Uncheck the Recursive check-box.

Xcode version I am working with is 3.1.4.

Friday, July 15, 2011

How to build OpenSSL in Xcode

I extensively googled for how to build OpenSSL library in Xcode for iOS. I found the following links most useful:


Describes how to use already built OpenSSL static library in an Xcode project, how to build static libraries of OpenSSL for different architectures (i386, armv6, armv7) from terminal, how to make universal fat library with lipo command.


Script to build for both simulator and device.

* Easy inclusion of OpenSSL into iOS projects

Points to the following two Xcode projects on github that hides all the 'black magic':
1. Xcode project for OpenSSL by Stephen Lombardo
2. Xcode project for OpenSSL by Michael Tyson

Michael Tyson's project is easier as it simplifies Lombardo's project.

Since our target is to use cross-project reference technique wherever possible due to its greater flexibility in building for different architectures(i386, armv6, armv7), I went for Xcode project approach and used the one created by Michael Tyson.

The procedure is given below:
1. Download the OpenSSL source code directly from
2. Clone the openssl-xcode git repo to make a local copy
3. Put the downloaded OpenSSL source tar.gz into the same folder as openssl.xcodeproj.
4. The extracted OpenSSL distribution can also be placed in a folder called 'openssl' within the same folder as openssl.xcodeproj, or just extracted within the same folder as openssl.xcodeproj.
5. Then open openssl.xcodeproj in XCode and initiate a build

A possible problem:
In the Xcode project window, under Products directory, there is only libcrypto.a static library. As far as I know, OpenSSL build is supposed to produce two static libraries - libcrypto.a and libssl.a. However, I found libssl.a within the same folder as xcodeproj file. I sent a mail to Stephen Lombardo, original Xcode project creator for OpenSSL, still did not get any reply to the query - why libssl.a is not present in the Products folder of Xcode window.

Update #1:
The problem I guessed might happen actually happened when I tried to use the intended module from a test project. A good number of link errors related to SSL were produced. Googling with the first link error phrase SSL_CTX_free confirmed that libssl were not linked properly. I did not know how to add an additional library to Products folder (under Groups and Files pane in Xcode project window) so that it can be linked properly. Adding libssl.a file to Products folder in a straightforward manner did not help remove those link errors.

While trying out in an adhoc manner, I finally came up with the following procedure that could eliminate those SSL-related link errors:

Add libssl.a to the Products folder under Groups and Files pane in openssl project's window:

Step 1: Add New Target ssl:

Right click on Targets under Groups and Files pane.
Select Add -> New Target...
A dialog with title "New Target" will appear. On the left, under iPhone OS category, select Cocoa Touch. Then on the right, select Static Library.
Click Next button. Write ssl for Target Name. openssl should be selected for Add To Project.
Click Finish.

Step 2: Enter info about target ssl:

A new window titled Target "ssl" Info will appear from the previous step.

We need to add crypto as a dependency of ssl. Under General tab, Between Direct Dependencies and Linked Libraries, click + and select crypto, then click Add Target.

Select Build tab. Type search in the search box.
Under Search Paths category, for User Header Search Paths key, add value $(openssl_SRC) as path, set Recursive checkbox. openssl_SRC is an Xcode Source Tree variable defined from Xcode Preferences. It refers to the directory in which openssl.xcodeproj file is.
For Header Search Paths key, add value $(openssl_SRC)/openssl/include
Close the window.

Step 3: Link
Under Groups and Files pane, drag libssl.a from Products folder to Targets -> ssl -> Link Binary with Libraries folder.

Now the other projects that referred to openssl project with the help of cross-project reference mechanism should have both libcrypto.a and libssl.a static libraries when openssl.xcodeproj is expanded in client project's Xcode window.

Additional necessary steps for client projects:
Now that a new static library libssl.a has been added to openssl project, client projects must know about it. If libssl.a is added to openssl project before any client project refers to openssl project via cross-project reference mechanism, this is not necessary.

Let's assume openSslClient project is using openssl project.

Right click on openSslClient under Targets, select Get Info. A new window titled Target "openSslClient " info will appear.

Under General tab, add ssl to Direct Dependencies.

Under Build tab, User Header Search Paths and Header Search Paths should have appropriate values for openssl as it was done earlier for libcrypto.a. openssl.xcodeproj was added to openSslClient project through cross-project reference, following an excellent article by Clint Harris.

Close window.

Under Groups and Files pane, expand openssl.xcodeproj and drag libssl.a from there to Targets -> openSslClient -> Link Binary with Libraries folder.

Update #2:
Stephen Lombardo replied to my mail. He suggested adding a second target for ssl. I have already done this :-)

Wednesday, July 13, 2011

How to build c-ares library in Xcode

- Download the latest version of c-ares library on a Mac and unzip it.
- Open the terminal and go to the source file directory.
- Execute ./configure and it will create ares_config.h file.

- Now open a new project in Xcode. I created a Library project for iPhone OS category and named it 'cares'.
- Right click on 'Classes' and select Add -> Existing Files. A file dialog box will appear. Select and add the source file directory. The source codes will be added to the project.
- Right click on the project and select 'Get Info'. Under 'Build' tab, write 'flags' in the search box. You will see an entry named "Other C Flags". Add value -DHAVE_CONFIG_H for it.

Now c-ares library should be built in Xcode without any error.

Tuesday, June 07, 2011

IllegalThreadStateException problem

Have you checked if the thread is alive before interrupting it?

Thursday, May 26, 2011

Checklist while porting from C++ to Java

I have been working in a project which involves porting the code base from C++ to Java (to be precise, J2ME). The code base is large and we have been under severe pressure to get it working for the first release. What we have been doing is basically copy-paste the code of a class from C++ to Java, then removing errors, adjusting syntax and the like. What we often overlooked is the semantic differences between these two languages and hard-to-find bugs crept in insidiously.

So I think a checklist would be handy for this:

(1) C++ copy constructor and overloaded assignment operator:

ClassA obj1;
// ...
// code modifying obj1
// ...

ClassA obj2;
obj2 = obj1; // overloaded assignment operator gets called

// or

ClassA obj2 = obj1; // copy constructor gets called

If ClassA defines a copy constructor, then obj2 will be initialized to data with same value but with different allocated memory (deep copy). So subsequent changes made to obj2 does not affect obj1 and vice versa.

Now while porting, this statement (obj2 = obj1) does not generate compile error in Java and reference of obj1 is copied to obj2. So both obj1 and obj2 refer to, in fact, the same instance. We did not notice it and since changes in obj2 or obj1 affected the same object/instance, we were in trouble as it was not meant in the original C++ code.

The right way of doing this is to add an overloaded constructor of ClassA.

public ClassA(ClassA anInstance) {
// copy data from the given argument.

// deep copy if needed.


Instead of

obj2 = obj1;

change this in the ported code:

obj2 = new ClassA(obj1);

(2) C++ overloaded == operator:

if (obj2 == obj1) {
// ....

This statement also does not generate compile error. In C++, if ClassA overloads == operator, then the overloaded == method gets called. But in Java, this statement simply compares references of obj2 and obj1 which is not intended at all. This statement should be replaced by


and Object::equals() must be overridden in ClassA.

(3) C++ pointer/reference used to receive output from a method:

I do not consider it a good practice to pass pointer to a function in order to receive output. Example:
bool getWidthHeight(int& width, int& height)
width = this->width;
height = this->height;
return true;

Return value indicates success or failure. This is pervasive in the code base I ported. So how do I have to simulate this? In Java, I defined a class like this:
public class pInt {
public int value;
public pInt(int value) {
this.value = value;

So I ported that method like this in Java:
boolean getWidthHeight(pInt width, pInt height) {
width.value = this.width;
height.value = this.height;
return true;

This had to be done for every built-in or custom type for which a pointer was used to receive output. This is tedious and for mobile platform is not acceptable. But for the first release, I think, nobody will mind this workaround.

(4) C++ conditional compilation:
#ifdef CONDITION_1
// ....
// ....

I maintained a separate class, say Configurations, for these conditions and set value true or false for them. Then the ported code looked like:
if (Configurations.CONDITION_1 == true) {
// ........
} else {
// ....