Category Archives: Code

Code is a question and answer site for professional and enthusiast programmers.

Fix msysGit Portable $HOME location

I have successfully installed and configured msysGit Portable on my flash drive, and have used it to pull and push GitHub repos. However, I seem to always have to kludge the SSH support.

Specifically, in order for SSH to find my key files, I have to follow these instructions to start a second instance of ssh-agent and then ssh-add my key every time I run git-bash.bat.

Using the output of ssh -v git@github.com to debug I see that msysGit defaults to my Windows user directory to look for keys. It can’t do that; I need it to look in its own directory on the portable drive.

read more

Can boolean operators be used with the preprocessor?

I wondering if it possible to have a preprocessor OR or AND statement? I have this code where I want to run under _DEBUG or _UNIT_TEST tags(?).

What I want is something like the following:

#if _DEBUG || _UNIT_TEST
  //Code here
#endif

If this is not possible, is there a workaround to achieve the same thing without having to duplicate the code using a #elseif?

Can boolean operators be used with the preprocessor?

explosion sound thread in MFC game project is stopping the music that is playing

Mabye someone over here can explain to me what am I doing wrong. This is after reading a lot of articles over the net and doing what the articles say should work but it is not working for me.

I am developing a nice little game with a background music and an explosion sound. For the explosion I know I need to use threads or my music stops when the first explosion happens. I am using threads but the music still stops.

read more

How to make an add friend/defriend function in PHP?

I have created a site where people can create a profile. But I am trying to figure out how to start on making an add friend button so users can have friends.

In my user table, i have user_id, first_name, last_name, email, etc.

Should I somehow relate the user_id of the user and the friend in a friend table?

I am a novice to programming, so these things are still new to me. Thanks!

How to make an add friend/defriend function in PHP?