Friday, August 14, 2009

Top things I miss when going from Eclipse JDT to Visual Studio C++

I recently dived into Visual Studio to do some C++ hacking after several months of doing mostly Java in Eclipse, and discovered a few items which I really miss.
  • Hot code replacement. This is really addictive in Eclipse: I set a breakpoint in a function, edit the code around it. After saving, the code in the debugged JVM is replaced and PC is reset to the start of the function. The other day I got annoyed when this didn't work (I changed the class' external signature), and I actually had to restart the debug session. Oh no!
  • Drop-to-frame. I can at any time reset the execution state to a frame further down on the stack and rerun from there.
  • Automatic code formatting. In Eclipse I have function "format entire source file on save" switched on, basically letting the editor do all the formatting for me. It even does line-wrapping inside comments, something I find very handy. In Visual Studio I have to manually indent each line (well, the indentation level is given automatically), but things like line-wrapping I have to do manually.
  • Incremental background compilation. I can sit several seconds waiting for the code to build before I realize that I need to start the build manually. (You also have to save your code before you can get any sort of feedback from the compiler.)
  • The "open type" and "open resource" commands. "Open type" allows me to interactively search for a class and jump to it. Visual Studio has a similar search, but I often get multiple matches and need to think about which match I'm actually interested in. "Open resource" does the same thing, but searches for files in the workspace. Visual Studio only gives me the regular Open File dialog, which is useless since I first need to locate the directory the file is in.
  • Red squiggles for errors. Compilation errors are indicated as a tiny line in the margin, instead of a red squiggle in the code.
  • The Emacs-bindings in Visual Studio are much crappier than in Eclipse. The most annoying part is that TAB doesn't indent an empty line, so you have to start your line at column zero, and not until you've written at least one character can you indent the line. (The Emacs-bindings in Eclipse aren't perfect either, I especially miss the kill-ring).
I realize that several of these issues are very difficult to get right in a C++ IDE (hot code replacement and drop-to-frame, for example), or completely subjective (I don't really expect Microsoft to spend a lot of time getting Emacs-binding completely right; I'm actually very happy that there are Emacs bindings at all).

Tuesday, August 11, 2009

The role of exercise in weight loss

I've recently lost a bit of weight by using a controlled diet. By writing down everything I eat (using the Weight Watcher's point system) I managed to lose around 18 kg in around 30 weeks, getting me down from 105 kg to a considerably healthier 87, where I've stayed now for a while. I can now run without breaking my knees, and my current personal record over 10km is under 54 minutes. Using a pulse-meter I've also been able to keep a decent track of calories spent while exercising.

One of the revelations I got when starting to document how much I ate (calories or weight-watcher points, it doesn't really matter), is that exercise does not really matter when losing weight. First, if you're 20 kg overweight like I was, chances are that you're overeating with at least a day or two worth of food per week. A pizza easily covers 80-100% of your recommended calorie intake per day. To balance one day worth of calories, you will need at a significant amount of intensive exercise. Going swimming or running 30 minutes twice a week will not help.

According to the article Why Exercise Won't Make You Thin, exercise will also stimulate hunger, causing you to eat more. (It certainly does for me; I ofter food-hallucinate when I'm running.)

So, while exercising is a good idea for most people, don't expect to lose any weight unless you also change what you eat.