Archive for March 10th, 2008
Krav Maga – Day 5
Before you ask…yes, I plan to blog every day of Krav Maga.
After the class on Saturday, I was looking forward to a slightly more tame Monday class. Jesse, the Monday instructor (and Saturday assistant), usually spends more of his class going over technique. That means things slow down a bit giving you more time to catch your breath. Today however…he had some surprises for us.
Things started out pretty normal. Some running (with ~16 people in a crowded room, running becomes interesting) along with pushups and mountain climbers to get the blood moving. After that we partnered up. I was teamed up with the 14 year old in the room, not his lucky day. If he was lucky he weighted around 130 pounds…roughly 100 pounds less than me. We started out with one person on all fours. They then piked up so they were on their hands and toes with their butt up in the air. The other partner then military crawled underneath them to the other side. One there, the partner on the ground dropped low, allowing the other partner to jump over them back to the starting position. The person on the ground goes back into the piked position and we start over. At one point, the instructor blew his whistle and we went either all under (back and forth) or all over (back and forth). It was insane, I’ve got the carpet burns on my knees to prove it.
When that was over, one partner again got on all fours. The other partner then sits on their shoulders, hooking their feet around the other partner’s knees on the ground. The partner on top leans back and sits back up…kind of like doing a situp. This is where the weight discrepancy came into play. I started on top, leaned back and the kid’s arms buckled and I flattened him like a pancake. Fortunately I caught myself with my arms and managed not to pop his skull. Not wanting a lawsuit, they found me a larger partner.
When that was done we went back to punching and kicking drills, this time moving around the classroom to get used to throwing punches while on the move. Usually we stand in one place and throw them, so this was a nice change of pace. These punching and kicking drills still kill me. My arms get tired and it becomes difficult to keep the hands up, which is essential in any combative confrontation (protect your head at all costs).
We wrapped up with more choking. I pitty the fool who tries to choke me from the front. He’s in for a rude surprise, roshambo style.
I feel like my conditioning is improving. I won’t say it’s good, because it’s not. I’m still the fat guy huffing and puffing (sometimes wheezing) with his hands on his knees. But I’m huffing and puffing a little less and I’m going on three weeks without missing a day. I dare say I’ve even dropped a little bit of fat over the past week, according to the scale anyway.
March 10, 2008
Important safety tips when handling json-c
We’ve been using json-c internally for parsing and generating JSON in my new project. It’s a pretty nasty interface to work with, so I’ve been considering putting a prettier face on it for C++ developers. Today I sat down to do that. Instead, I spent many hours allowing json-c to repeatedly win games of roshambo.
It started out simply enough, a simple class to wrap the json_object:
#include <string>
#include <json/json_object.h>
class JsonObject {
private:
json_object* obj;
JsonObject();
public:
static JsonObject parse(const std::string& json);
~JsonObject();
};
There wasn’t much to it at this point, but I had enough to set up my Makefile to check that everything compiled properly. Sadly…it did not. While the compilation step was successful, linking wasn’t so fortunate:
libjsonwrapper.so.1: undefined reference to `json_object_put(json_object*)’
libjsonwrapper.so.1: undefined reference to `json_tokener_parse(char*)’
I spent some time (and by some time I mean most of Sunday) futzing with the Makefile, making sure json-c was properly installed, compiling my own version of json-c, checking different hardware architectures and operating systems…all with no luck whatsoever. I even looked at some other code that we have that uses json-c, checking out the Makefile to see what that code was doing that I wasn’t.
At around 8:45pm I took a break and went for Sunday bowling (Homestead Lanes does a special on Sunday nights, it’s great…you should go sometime). When I got home, I dug back in. Still no dice.
So I went back to the other code we’d written that uses json-c and looked at some other things. Finally, I happened upon it:
#include <json/json.h>
It’s subtle, but including json.h instead of json_object.h makes all the difference in the world. At first I didn’t want to know why, I was just mad that it mattered at all. Obviously json.h is some aggregate header that keeps you from having to #include every little file you need. But clearly it’s also performing a little black magic along the way that does something to affect linking. Ready to lose my shit, I dug into the header:
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#include "debug.h"
#include "linkhash.h"
#include "arraylist.h"
#include "json_util.h"
#include "json_object.h"
#include "json_tokener.h"
#ifdef __cplusplus
}
#endif
Whoomp there it is: extern “C”. If you include json.h it does the right thing and makes everything inside of json-c use C linkage when compiling C++. If you don’t include json.h and instead include one of the files that it includes…then nothing uses C linkage causing the linker to FAIL.
Thanks json-c for consuming a day of my life that I can never have back.
March 10, 2008