While scanning xprepare.c:xdl_prepare_ctx()
[1] in the hopes of speed-ups, I stumbled over this gem.
What puzzled me was this expression in xdl_cha_alloc()
:
chanode_t *ancur;
ancur = (chanode_t *) xdl_malloc(sizeof(chanode_t) + cha->nsize);
Huh? Passing sizeof(chanode_t)
made sense, but adding cha->nsize
?Where does nsize
come from? Turning to ...
People like to whine about how much NUS SOC sucks. Probably due to the bad experience with vi[m] on Sunfire. But let me be the first to tell you - no. They rule. Absolutely.
Ok ok, I'll come clean - I'm sounding like a fanboi after all the love ...
It is more important that innocence be protected than it is that guilt be punished, for guilt and crimes are so frequent in this world that they cannot all be punished. But if innocence itself is brought to the bar and condemned, perhaps to die, then the citizen will say ...
The conversion is complete. A few changes were made in the implementation, for example, some changes were due to the way line ranges were being handled. I also missed out on differences in the ranges for types, as I developed on a 64-bit machine (Java's types are 64-bit). This ...
Java seems to have done something right in this regard; with continue <label>
, you can, for example, instruct an outer loop to continue
. Remember, continue
glues to the inner-most loop.
For example, you could do write this in Java:
outer_loop:
for (...) {
for (...) {
continue outer_loop;
}
}
To accomplish something similar in C-like ...
From Wikipedia's entry on split, here's a quick way to split a file into 2 on a Unix-y system:
# on source machine
$ split -n 2 myfile
# on target machine
$ cat xaa xab > myfile
In vanilla django, if you wanted to `{% load foo_tags %}, what you did wsa to create a importable templatetags namespace with a foo_tags.py
like this:
/
|- settings.py
|- manage.py
|- ...
|- templatetags/
|- __init__.py
|- foo_tags.py
But with Google App Engine's django (0.96), it's not so easy. The tag ...
Nowadays I've been using Java pretty heavily. The current CS module I'm taking (data structures and algorithms) requires Java, and it also happens that I'm doing some GAE Java work.
For these, I've been leveraging JUnit 4 and Mockito, and writing code for these have opened ...
Update 2011/05/22: I take back my words. db->query()
calls return FALSE
on failure, and the error messages can be accessed via the "private" methods _error_message()
(CI doesn't have language-enforced private methods; they are only indicated as such by naming convention and @access
doc.).
For a recent ...
As mentioned earlier, I've been meaning to submit a patch for this for quite some time.
It's been around for some time as a gist:
This one's been tricky. Although I wrote it in August, just a couple of hours ago, I was still making non-trivial changes ...