Month: January, 2011

I’m taking a C# and .NET class at ASU East. Our professor has example code that runs on Windows and the Mac (using Mono). I installed mono 2.8 from this link and I was able to get C# code to compile. However, when I tried to run my professor’s build script (he uses ant with some .NET extensions), I got the following error:

[dn:csc] Package dotnet35 was not found in the pkg-config search path.
[dn:csc] Perhaps you should add the directory containing `dotnet35.pc’
[dn:csc] to the PKG_CONFIG_PATH environment variable
[dn:csc] No package ‘dotnet35’ found
[dn:csc] error CS8027: Error running pkg-config. Check the above output.

To fix this, I set the value of PKG_CONFIG_PATH to /usr/local/mono/2.8/lib/pkgconfig (you’ll need to add this to your .bashrc). If you used the mono install-script without modification, then the value of PKG_CONFIG_PATH should be /opt/mono-2.8/lib.

Share this:

Like this:

I learnt something new about bytecode optimization today. In languages like C and C++, if you’re really concerned about efficiency, you can drop into assembly mode and write specific assembly code instead of relying on the compiler to convert your C/C++ code into assembly (compilers can optimize, but not as well as humans in all cases).

I saw a question on Stackoverflow today that talked about the getfield opcode in the context of the trim() method in the String class. In the trim() method, you have the following comments:

The author of the question wanted to know what these comments mean. This question seemed pretty interesting to me and so I went and did some research. I found out that getfield is an operation that lets you get access to the member variable/field of a class. This operation is fairly expensive as it involves indexing into the runtime constant pool. Performing this operation a few times does not really incur a performance hit. It is when you perform the operation multiple times, that performance becomes an issue. You can see this from the next few lines of code:

while ((st < len) && (val[off + st] <= ' ')) {
st++;
}
while ((st < len) && (val[off + len - 1] <= ' ')) {
len--;
}
[/sourcecode]
Now if the author of the trim() method hadn’t assigned offset and value to local variables, a getfield operation would be performed every time the loop-condition is tested. This is obviously inefficient. Therefore, the author assigned the the values of offset and val into the local variables off and val. So now, instead of getfield you have iload (for off anyway), which performs much faster.

Share this:

Like this:

I’ve been playing Minecraft for a while now. It doesn’t look like much at all, but it’s a really fun game. I love the fact that you can build whatever you want. It’s like legos, really. Anyway, I built a Stargate in Minecraft. I originally wanted to use the portal blocks, but if you stack two or more together, they just vanish. So I decided to make inner part of the Stargate out of glass and water. This means that you can’t walk through it, but it still looks kinda neat. I figure that I could make a wall of water if I had a trough that ran through the middle. But this would mean that you would fall into the trough every time you stepped through the Stargate. There might be other ways… I’ll see if I can figure it out. I used lightstone for the chevrons. The gate is bigger than it would be normally, but that was the only way I could make a circle that looked decent.

This is with the default texture-pack in Minecraft. It would probably look better with a better texture-pack.

A Stargate in Minecraft

A Stargate in Minecraft

A Stargate in Minecraft

I’ll try to build a DHD next. Probably won’t be able to make it look as nice as the original, though.

Share this:

Like this:

Alternative indie-band Six-man football has released their latest album titled … you can get silly again.

When asked about why the band has only four members (a vocalist, lead guitarist, bassist, and drummer) they replied:

We realized that only hipsters listen to indie bands until they get popular. Also, hipsters like anything that appears “ironic”. Hence, we only have four members and we also dress in baseball uniforms. Due to this ostentatious display of irony, we expect that we will have a lot of hipster fans until word of our existence spreads to the normal population. This way, we expect to slowly, but surely, grow our fan-base.

Six-man football: ...you can get silly again

This is fake. You can make your own album cover by following these instructions:

Get a random article from wikipedia. The title of this article is the name of your band.

Get the last four or five words, or the very last random quote on quotationspage.com.