All posts tagged Code

Templatize Tool

I recently wrote up a template engine tool called Templatize. It started as a tool for my girlfriend so she could quickly generate HTML pages from CSV rows for use on eBay, but then quickly grew into a more robust template tool.

Basically it takes a set of input data, containing multiple entities (rows), each with multiple properties (columns), formatted from some type of delimited text file. Then it takes in a master template file and spits out multiple “data-injected” versions of that template.

View the full page here.

CTask-Lite on GitHub

Alright, I’ve finally put my open-source project website woes to rest. I successfully published the first version of CTask-Lite out on GitHub. It can be found here: http://github.com/cdunlap/ctask-lite

CTask-Lite is an easy to install, configure, theme, and use task management system. It is aimed at tiny teams working on ‘open’ projects. What I mean by open is that they don’t care who sees what (because there is no user/role management capability in it).

The Wiki for CTask-Lite is here:  http://wiki.github.com/cdunlap/ctask-lite

Spread the word! Download it, use it, mangle it, hack it, fork it, etc.

1 little 2 little 3 little endians… er wait, is it 3 little 2 little 1 little endians?

Well, it depends on what encoding you’re using.

Lately I’ve been in “endian-ness” hell on a project I’m working on. Well, not really a “hell”, more of a hurdle that can easily be overcome. A friend of mine recently asked me the difference between the two binary encoding strategies and when I went to explain it to him (via cell phone txt messaging) I quickly realized that I will run up both our bills pretty quickly by doing so. So here’s the quick rundown, and an example as it applies to the project I am working on.

Big Endian means that value is stored “from left to right”. The most significant values (bytes) are stored in memory with the lowest address first. This is probably what many people are familiar with, especially those in the networking field.  Here’s an example of data stored as Big Endian:

Take for instance the 2-byte value 1325, equivalent to a short or unsigned short. Stored in Big Endian encoding, the value would look like this in binary: 00000101 00101101. Makes sense right?

Now here is the same 2-byte value, 1325, in Little Endian encoding: 00101101 00000101. The bytes are flipped and thus to make any sense of it, you must read the last set of bits first.

So for simplicity’s sake, Big Endian values are stored like so:

<byte1> <byte2> <byte3> <byte4> ... <byten>

Little Endian values are stored like so:

<byten> ... <byte4> <byte3> <byte2> <byte1>

Network devices use Big Endian, it is considered the network standard, or “network encoding”. Endian-ness varies from CPU to CPU depending on its architecture. Power Macs use Big Endian, network devices use Big Endian. Intel PC’s (and Intel Macs) use Little Endian. What does that mean? Well, it means that if a program running on a Power Mac sends data to a PC, the PC may not understand it correctly without some type of encoding change taking place.

In my situation, I’m reading a series of values off of the network, all coming in via a byte stream. So the client will send the following packet for example:

4 bytes, 2 bytes, 1 byte, … and some others but I won’t get into them

So when I read the first four bytes off the network (which uses Big Endian encoding, remember?) I must flip the entire set of 4 bytes before my Little Endian PC can understand it.  Same goes for the next 2 bytes. The single byte obviously doesn’t need to be flipped with anything, it stands alone. So an incoming set of data may look like:

0x1A 0x2B 0x3C 0x4D 0x2A 0x2B 0xAD

Now I must flip each set of values byte by byte (but not invert the entire thing; this is a packet, containing multiple values).

In Little Endian, the same set of data reads:

0x4D 0x3C 0x2B 0x1A 0x2B 0x2A 0xAD

Confused yet? You’ll figure it out. Here’s some reading that should help: http://en.wikipedia.org/wiki/Endianness. It even gets into the origins of the word, which is pretty interesting. Here’s a little tool that may help you understand the pattern: http://dlnova.com/reverseendian.htm

KnowIT RC2.1 Released

I’ve completed the modifications and package builds for KnowIT releast candidate 2.1. They are available from the KnowIT Google Code site. Dare I say, this is one of the best peices of software I have written in a long time. And the best part is, its open source!

Check out the Screenshots.

KnowIT works with Windows ONLY. There is currently not a Linux/UNIX scanner available for KnowIT, and the database back-end is a Microsoft product (MSSQL 2005). However, I did add ODBC support this time around, so it may work on other database types as well. If anybody gets it to work on MySQL or Oracle, let me know.

VGL Math – 2D/3D Video Game Math Library

I decided to get bold and start another open source project. This time it is related to the math involved in developing 2D and 3D video games. The project is hosted at http://code.google.com/p/vglmath. I decided to deem it a “VGL community project”; VGL being the company I founded a few months ago.

I’m looking for any pointers, contributors, or experts to make improvements or recommendations to the code. So please check it out. If you’re interested in contributing, please send me an email at [email protected] so I can add your Google account to the members list.

And if you haven’t already, check out http://www.venomgamelabs.com!

Now for your entertainment for the evening:
httpv://www.youtube.com/watch?v=FRgYtp3HfvY