Archive for July, 2009

Why every programmer should start their own business

Wednesday, July 29th, 2009

1. You can write off everything that you buy related to your business, which for me is a 30% discount for almost everything I spend money on. You’d be surprised at just how much can be considered a business expense.
A. Eating out while at a job site (though they limit this to half the discount, so 15%)
B. Buying computer games, when used for ‘market research’
C. Buying computer parts
D. The portion of my home I use for my home office applied to my rent
E. Similar to D, but for utilities
F. Auto depreciation and expenses (again just for the job site, but for me that’s practically the only place I go)
G. Common supplies – paper, pencils

2. You can demand more money from those you work for, if you work as a contractor, which is now easier if you contract through your own business. See my Contract pay calculator. It’s not one-sided. It actually costs your employer/customer less to hire you.

3. Using some of the money from item 2, you can buy your own health insurance. That means you don’t lose your health insurance just because you lost your job. It also means you can pick the health insurance you actually want.

4. In CA, and perhaps other states, having your own company means you can buy group health insurance. By law, you don’t have to disclose preexisting conditions with group health insurance. This is why you can have your family insured when you would otherwise start a new job as an employee without them requiring that your wife and kids get a checkup and turn over their medical records first. If you just went and bought individual coverage you’d have to do that.

5. If you do get hired as a contractor, you get emotional benefits from being your own boss. The freedom is great too – decline meetings you don’t want to go to, come in whatever you want, work for other customers at the same time, and often maintain ownership of part all of your work Of course this can be abused and you can get in trouble, but as long as you get your work done the customer has no basis to complain.

6. Now that you actually have a business license (which takes only a couple of hours for everything), if you want to sell goods or services, or do contracting, it’s much easier.

7. If you incorporate as an LLC, then you are personally shielded from the liabilities of your business. This means if you were to contract for or sell to company X, and they sued you for whatever reason, the most they could get is whatever was in your business bank account, and your business assets at the time you were served. The franchise fee in CA is $800 a year, less in other states. Keep your business account separate from your personal account, and you no longer have to worry about losing your house. (Within reason, see Piercing the corporate veil)

The only real downside is that contract work tends to be temporary. Some managers have this perception. However the way I see it, it’s no less temporary than being an employee, as employees can be fired too. As long as you are making the company money and doing a good job they have every incentive to keep you on as a contractor.

Playing music from Visual Studio

Tuesday, July 28th, 2009

1. View / Other Windows / Web browser
2. Enter
3. If desired, drag the tab off to the bottom of the code edit pane, and slide it down to minimize it.

So you can play Pandora without having another tab open in your taskbar and accidentally closing it.

Function calls as data

Saturday, July 25th, 2009

I’ve been using a function object design pattern for my Lobby system and it’s working well enough that I wanted to post about it.

The concept is very simple. Encapsulate the input and output parameters to a function, and the function call itself, in an object. This lets you manipulate a function call the same way you do objects.

Some useful things you can then do:

  1. Serialize them over the network
  2. Save them to disk
  3. Put them in a queue, for a test execution path
  4. Save them to call later
  5. Move the inputs and outputs around between threads
  6. Log what runs
  7. Perform operations on a set of function objects via the base class
  8. Give the user more functions by giving them more function objects from a class factory, making the system easy to extend.

So the lobby system exposes a large set of function objects. The user gets one from the class factory, with an identifier for what function to perform. The input parameters are filled in. They are serialized, processed remotely, and sent back. The user has all the contextual information because the input parameters are sent back as well as the output parameters. And a cool thing about this is the memory for function call lives on the internet. From the client’s point of view it is stateless. The client doesn’t have to track what is running.

It’s also useful for asynchronous operations.

In my case, rather than having a function pointer, the functor’s operation is in the functor itself (e.g. DoWork()). The needed parameters are passed to DoWork(), and operate on the database.

How to deal with customers in a financial crisis?

Thursday, July 23rd, 2009

One of my best customers has run into financial problems. This affects me because I contract for them on a routine schedule, and they missed the last payment by a week, with no solid ETA on when they can make it.

It’s an interesting question on how to handle this.

1. I could immediately suspend contracting services. This would insulate me from further potential loss, and I could use that time for other customers. But I’m a critical person they are counting on, and if I were to stop services they’d probably not be able to ship the game with multiplayer, or at least not on time.

2. I could give them a hard deadline to pay by. I’m exposed to further loss (over 25K in fees owed), but they might make the payment and I can continue contracting. They pay very well and I’d like to keep the contract if I can do so with reasonable assurance I’ll get paid.

3. I could give them a soft deadline to pay by. By this I mean being flexible and agreeable to whatever dates they offer as to when I will get paid. On the positive side, this maintains good relations, they’ll probably finish the game, and if they finish the game I’d probably be more likely to be paid than otherwise. On the negative side, if they DO go insolvent, as a contractor I’m an unsecured creditor behind the employees, and I could end up losing 50K in fees.

For option 2 or 3, suppose I set a deadline and they meet it. Should I continue on as if nothing happened? Or should I demand assurances for future payments, such as payment in advance, or requirement that the money be put in escrow? How about insisting on adding interest or late payment penalties to the contract? I’m critical enough I could probably get whatever I asked for, though they may not want me to contract after the game is done.

Suppose I set a deadline and they miss it narrowly. Should I bother coming back? And if I come back, should I demand assurances, as above? There are arguments both ways. Usually if a company is late on payments it’s because they are going to fall further and further late over time. Plus if they can’t meet a deadline to the point of losing key personnel, it doesn’t say much for their solvency. However, they did pay in the end and causing their game to likely fail regardless is kind of an asshole thing to do to a customer. Assuming of course they stay in business long enough to finish it.

In the last extreme, if I don’t get paid at all, yet the company stays in business should I file a lawsuit? That’ll definitely ruin relations and any chance of them recontracting in the future (assuming they did eventually pay, but much later).

As further background:

1. The company is very large – if they really wanted to I know they could make the payments, if nothing else by selling assets or reducing the salary of the CEO. But my payment has a lower priority than that of their employees and management (who did get paid on time, at least this last pay period)

2. I don’t think the finance officer’s handling of the situation is very respectful. Maybe it shouldn’t be a factor, but I feel like I’d be a lot more motivated to be flexible if I was told something like “Sorry, we’re having problems making payments. I was told we might have the money by Friday, and I hope you don’t mind waiting until then. I’ll try to see that this does not happen again.” vs. “I hope you’ll get paid next Friday” which is he actually said. It’s just words and doesn’t change the reality of the situation, but it does affect how cooperative I feel about the situation.

3. I’m not relying on the contract, it’s just one revenue stream among many.

4. The contract didn’t have provisions for late payments

Making RakNet releases, then vs. now

Wednesday, July 22nd, 2009


  1. Rebuild all
  2. Run a batch file to delete temporary files (.obj, etc.)
  3. Zip the whole directory
  4. Add a comment to revisionlog.txt
  5. Upload it, overwriting the old file (
  6. Change the date on the front page
  7. If I remember, also change the version number in readme.txt

It took me about 5 minutes to make a build. As a result, anytime I found a bug I’d basically release a build immediately.


  1. Rebuild all
  2. Of the over 50 projects, fix the ones that no longer build
  3. Fix warnings introduced by various ifdefs
  4. Build on Code Blocks, adding new files. Fix compile errors/warnings.
  5. Build on Dev-cpp, adding new files.
  6. Go to the source directory, do dir *.h, copy out file list to a text editor. Modify output to match formatting tags for makefiles. Copy output to makefile.
  7. Do the same for *.cpp
  8. Do a similar process for the VC6 project (if I bother)
  9. Build in Visual Studio again to make sure things still build
  10. Copy source files to CYGWIN. Figure out how to compile in GCC again, and fix any compile errors if any.
  11. Run through the easier to test projects to make sure the major features still superficially work
  12. Figure out when the last build was made, look up the log from SVN, and collect all the check-in log entries
  13. Format the log entries and add them to revisionlog.html. This is non-trivial, to prevent revisionlog from being unreadable
  14. Change the version number in readme.txt and RakNetVersion.h
  15. Update the remote dedicated server from SVN, rebuild, and restart
  16. Generate the Irrlicht demo exe. Download the .zip from the website, update the exe, and reupload
  17. In SVN, create a tag with the version number, which involves looking up how to do it each time
  18. Regenerate the Doxygen html documentation
  19. Run HTML help workshop to generate the chm documentation. Move the chm file out of the html file.
  20. If I remember, upload the new Doxygen documentation to the website
  21. Export from SVN to a temp directory.
  22. Zip the files in the temp directory. Sometimes there are unusual steps here, such as unzipping the ogre sample (lately I don’t bother to do that).
  23. Upload the zip to Sourceforge
  24. Figure out how to navigate the Sourceforge interface to get to the new releases page (which takes me a couple of minutes every time)
  25. Add a new release. Paste in the revision log from earlier. Add the file, and submit.
  26. Upload the same zip file to the website, making sure the version number of the filename of the zip file is correct.
  27. Open the 6 different pages on the website that reference the link and update them.
  28. Update the news page in the forum to point to the correct link
  29. Add a post to version announcements with the revision log.
  30. I used to also edit the download graphic with the correct version number. But this got to be such a pain I just changed it to 3.x so I wouldn’t have to keep modifying it.
  31. Sometimes send a post to about the new release (lately I don’t usually bother).
  32. Think about which of these steps I forgot, and sometimes redo part of this if I did.

It takes about an hour to make a build. I do a build every 1-3 months, depending on if I find any major bugs and how stable I feel the code is. If I’m changing existing code every day I usually won’t release.

Sega must have paid a lot of money for the Empire: Total War reviews

Sunday, July 12th, 2009

Any game review site that gave above a 75 for Empire: Total War must have been paid by Sega. I’m questioning if the game was even made by the same developer as the priors in the series, or just farmed out to Indians. While the game has promise, it’s unplayable due to bugs and horrible AI. The AI was never meaningfully updated from the prior games, which didn’t have guns, barricades, or cannons on walls. So a large part of the time your units are just standing around, trying to get into formation, while being shot in the meantime. The cannons on walls are almost never used. Your calvary just run right into barricades through normal speed movement. And the AI is way worse than in prior games. I can easily win with a 6-1 or 8-1 kill ratio just because 1/4 of the AI force is just standing around rather than attacking, or stuck walking up the ramps for the walls.

The performance is also bad. On my top-of-the-line system with dual 280’s I still can’t run at even medium settings without chugging.

Former health care exec speaks out against industry

Saturday, July 11th, 2009

Someone needs to write a C++ IDE for Linux that is user friendly

Friday, July 3rd, 2009

I’ve been trying to compile RakNet on Linux. g++ -lpthread *.cpp works, but nothing else does


Doesn’t support C++. If you add a plugin for C++, you can select it under help / update but it won’t install. “Eclipse C/C== Development Platform requires plugin-in “org.eclipse.core.contenttype (3.3.0)” A search for what the hell that is turned up nothing. So I moved on to

Code blocks:

There’s no download for Ubuntu. It says you have to install wxWidgets if you want to do that, to /etc/apt/sources.list. I know that’s a file, but no idea what I’m supposed to do with it. It also recommends to type in deb http://apt.wxwidgets.ogre/gutsy-wx main . I typed that in the console but it just returned some error. So I moved on to:


Even hello world won’t compile. Project / create new project / c++ / Simple Hello World Program. Then click build, and it asks you something about automake. If you click yes, it doesn’t work anyway. ../libtool line 2429: mkdir /.libs: No such file or directory. So I moved on to:

Net Beans IDE 6.5

I manged to setup a project and add all my source files. But when I right clicked on the project name and clicked build it said “make: Makefile: No such file or directory”

75% of Rent-a-coder bidders didn’t read what they were bidding on

Thursday, July 2nd, 2009

I posted the following bid request on Rent-A-Coder
PHP Directory Server 2

At the end of the bid I wrote
“To show that you read the requirements, write ‘I read the requirements’ in your bid. Bids that do not have this will not be considered as valid bids.”

I got 8 bids in the next 12 hours. Of those 8, 6 did not write “I read the requirements” Not surprisingly, of those that did not read the requirements, 5 were in 3rd world counties (the people you should never hire).

Never offer to work for free

Wednesday, July 1st, 2009

An old customer of mine is using the NAT punchthrough feature of RakNet. After my recent work on this feature with Stardock, the success rate is much higher. So out of a desire to help I offered to upgrade this feature for this customer for free. My terms were either remote desktop, or on-site if they covered the costs. I was only planning to spend an hour or two on the upgrade, basically replacing that one file and adding the extra functionality needed.

As it turned out, they wanted me to fly there to do the upgrade. As the date approached I started to regret not thinking it through. They wanted me to go there for the whole weekend. At first I just thought of this as a vacation. Work half a day and screw around in another city for some fun. But as the date approached I really regretted making that offer. Two lost days when I had a lot of other work to do, plus the tremendous inconvenience that comes with business trips. In any case, I missed the flight that morning. It was because the airline didn’t allow electronic or Kiosk check-in when the operating flight is different from the purchasing flight, and the line for the agents had 30 people in it – way too long for me to get on board on time. I’m not making excuses; that is just the reason why I missed it.

I called the customer that morning telling them I missed the flight and I’d just have to do the work over remote desktop. I did the work over the next three days, although I have to say with extreme reluctance and second guessing myself about why the heck I agreed to do this. The reason it took three days is because I couldn’t just change that one file as I had hoped. The customer had changed half a dozen or so related files in RakNet, and I had to integrate those changes. With those changes, it made more sense to just update the whole system while I was at it.

In hindsight, I suspect nobody told the lead programmer I was working with that I was doing this for free. So I got the impression he was annoyed when I was unwilling to do the work except at my own convenience, which meant during time I wasn’t working for a paying customer instead. I saw him as being awfully demanding and unappreciative considering I had no financial or legal incentive to do the work.

The next day, the customer sends me a thank you letter for the work done… Just kidding, they sent me an invoice for the unused plane ticket. A rudely worded one. And not an ounce of appreciation.

Never offer to work for free.

A. You’ll feel resentful
B. This will translate into being less cooperative
C. The customer will not appreciate it as much as you think they should