Wednesday, November 25, 2009

Installous does not work

If you are here you know what I am talking about. The question that stumbled you today is answered here:
To continue, you must answer the following question:

Kyek modified a Greasemonkey plugin to allow you to see if an Appulous IPA link was dead before you clicked it. The original plugin was the ________ Links Checker.

Your answer:


Sunday, November 1, 2009

Mac OSX Repeated Menus and strange rectangles

I was working on my MacBook since morning, all of a sudden I started noticing strange rectangles and repeated menus.

This was crazy, I tried restarting but since it is not MicroSoft Windows :) it did not help. I was not able to figure out what went wrong. No doubt I installed newer applications today but they have nothing to do with it. I was sick and I left worrying about it and tried to listen to music. Bingo!! as soon as I turned the application on, I found that my system was on mute. When I turned the sound on I got to know that it was my Voice Over feature which was on. So I turned it off by pressing Command + F5 key. That solved the problem. I guess those rectangles are for people who are specially able. Anyways, I was able to get rid of those nasty blocks now.

Post your comments if you found this helpful. Thank you.

Thursday, July 9, 2009

Error Error on the Lappy, You make the debugger happy

This blog is dedicated to random errors I witness as my career progresses and the solutions I found for them, if any.

1: Wamp server doesn't work on Vista:

Date: 07/09/2009
Symptoms: browsing to localhost returns 404 (Firefox stays white though)
Reason: Port conflicts with other applications.
Solution: Exit AVG and skype and try to put your wamp server online again. Worked for me.

2. Google Friend Connect widget on a blog crashes Internet Explorer.

Date: 07/14/2009
Symptoms: Internet Explorer crashes and would not open your blog. Case of my blog
Reason: IE doesn't read your HTML one line at a time, but all at once. Therefore the ending tag problem with Friend Connect widget causes IE to crash.
Solution: No Solution yet. Temporary workaround is to move the Friend Connect feature at the end of your widgets (footer).
P.S. If you faced a nasty error recently, you would want to share it with us. Please leave a comment with the problem and your solution.

3. A thread keeps waiting on a barrier

Symptoms: You have a thread which would not move forward from a barrier.
Reason: The barrier is not properly initialized. In most research projects if during initialization you used if.. statement chances are more that you have nested if.. which would not work as you expect.
e.g. see this
if (pthread_barrier_init(&barrier1))
#ifdef HDEBUG
fprintf(stdout,"There were errors initializing barrier 1");
if (pthread_barrier_init(&barrier2))
#ifdef HDEBUG
fprintf(stdout,"There were errors initializing barrier 2");
int somevar = 20;

You see, everything looks good but when you run your code without print statements above two statements are like nested "if" statements.

Solution: remove the #ifdef statements as this is not needed if you are using "if" while initializing.

4: printf prints structure variables together

Date: 08/29/2009
Symptoms: instead of printing value of just one member variable of a structure printf prints additional data from other member variables
Reason: The way C handles strings.
Solution: Make sure there is enough room for \0 at the end of your data values. I was storing an IP address in a string. The length of IP address was exactly equal to array size therefore C couldn't store "\0" at the end of that variable and hence it printed all of them together. I felt like kicking my back when I found this solution.

5: using malloc to assign memory to structure

Date: 10/07/2009
Symptoms: The structure pointer (mine was 3D) doesn't get enough memory as expected. Throws segmentation fault after a limit (it was 14 in my case)
Reason: Returned pointer's casting
Solution: I was assigning memory to a structure pointer by using malloc. I actually had a wrapper for malloc which used to return a void pointer (void *) and caught memory allocation errors. Therefore, I used my function to allocate memory and casted the pointer to my structure type. Sounds good, Looks good but it is not. What happens here is that the wrapper returns a void pointer which I casted again to a structure pointer. I am not sure exactly why I could not access the memory location mystruct[14][0]. Then I changed my wrapper function to allocate memory to a local variable to the wrapper and check for allocations time errors, if everything goes fine free that local variable and return a malloc call. Something like
int size;
return malloc(size)
That solved it for me.

Wednesday, April 8, 2009

Why this blog?

The internet is abounded with blogs started by PROGRAMMERS which sometimes provide interesting and/or useful information. Contents of any respective blog are dictated by the affinity of the author towards a particular language, technology or design patterns. I received a forwarded email a couple of days ago which read that having a technical/programming blog looks good on your resume, which definitely is good enough extrinsic motivation for people struggling for a job in these challenging times, to start a new blog.
I am also getting polarized towards more and more specific sub-sections of Computer Science and hence I wanted to start my own blog. However, this name "Typist vs Programmer" unfortunately is not my brain child. Nevertheless, It is an interesting story which gave me this idea and ofcourse name.