AVLTree 0.1.4 Released

This morning I released AVLTree version 0.1.4. The difference from version 0.1.3 is an idea from modifications made to the code by the Samhain folks to improve performance.

If you are not familiar with my AVLTree project, it is a C library that implements AVL trees and provides an interface for indexing and iterating over objects. I like to think of it as my little C answer to the hashes and dictionary objects available in more advanced languages.

Templating in Excel

I wrote a little spreadsheet template language for Excel VBA (Visual Basic for Applications). What for? Say you have a report you create often, and you’re thinking of making a macro in Excel to help automate its generation. You want to report on the sales of your widgets from multiple locations, and you already have a template in mind for how the report should look:

Template of Widget Report in Excel

Template of Widget Report in Excel

I thought it would be so nice to be able to do this that I wrote the VBA to do it. I call it TemplateKicker. To use it, I copy the TemplateKicker module and the TemplateKickerVariables class module into my spreadsheet from TemplateKicker.xls (this file also contains the example shown here). Then I write a macro to insert the values for each location I am reporting on:

Public Sub Widget_Report()
    Dim Vars As TemplateKickerVariables
    Dim LocationIDs As Variant
    Dim WidgetSales As Variant
    Dim Index As Integer

    LocationIDs = Array("A-12345", "B-22222", "C-33333", "D-2R2", "E-5555")
    WidgetSales = Array(34, 12, 15, 6, 39)

    Set Vars = New TemplateKickerVariables
    For Index = 1 To 5
        Vars.SetVar "location:" & Index & ".id", LocationIDs(Index - 1)
        Vars.SetVar "location:" & Index & ".widgets.sold", WidgetSales(Index - 1)
    Next Index

    KickWorksheet(ActiveWorkbook, Sheets("Sheet1"), Vars).Name = "Widgets"
End Sub

One run of the macro later, and I have a new worksheet with the results:

Widget Report after running macro

Widget Report after running macro

TemplateKicker also has the following features that I will showcase in upcoming blog posts:

  • Nested ForEach loops
  • Rows to insert between items being looped over
  • Generation of named ranges for use in formulas

Even with all this, however, TemplateKicker does have some limitations:

  • The template language is somewhat “fragile”—spaces must be exactly placed.
  • Errors are not reported. Bad syntax or variable names produce undefined results.

Still, I think this is a great start to doing some pretty awesome things in Excel VBA. I do not know if I will develop it further, but if you find it interesting please let me know!

As a side note, CosineWave Technologies Inc. now also offers VBA solutions for business automation now. ;) Please drop me a line if you have need for some tools to automate your workflow when using Microsoft products (or many other products for that matter)!

Mephisto

I have spent a lot of hours in the past week working with Mephisto. Mephisto is a blogging platform with aims of eventually being a full-fledged CMS. Overall I like it, but I am uncertain if it is a platform I ought to continue working with at this point.

Here are the highlights of the pros:

  • It is written in Rails, which is a platform I know well and therefore can extend rather easily.
  • The site can be split into multiple sections, each of which can be its own blog and have its own RSS feed, or which can be a single page.
  • Themes! Mephisto can be themed, and it is easy to write new ones using one or more of several template languages.
  • It allows multiple layouts to allow for different looks for each section of the site.
  • Articles can be formatted in with Textile, Markdown, or just plain HTML. I was able to integrate TinyMCE without much trouble as well.

But there are also the cons:

  • The current version is 0.8. That is not quite 1.0, and I wager that the reason it is not at 1.0 is related to the various little bugs that I have found.
  • Sometimes Mephisto will select the wrong layout for a page and it is difficult to figure out why. Fortunately, these situations are limited to “Preview this Post” and the “permanent links” to articles that represent pages that normally do not get linked to.
  • Mephisto has plugins and themes, but it is difficult to find useful plugins and more than a small number of publicly available themes.

I think Mephisto is a better platform than Radiant at this point, and in my opinion it gives Rails a reasonably usable blogging platform. Before committing more time to it, however, I think I will take a look at the much touted Drupal. I have been meaning to take a look at it anyway. :)

I Am an Independent Contractor Now

Yes, that’s right. Today is my last day at my present employer. Two weeks ago I formed my own company, CosineWave Technologies Incorporated, and I will be working for it as a contractor.

Here are the primary services that I offer today:

  • Unix Security
  • Security Management
  • Application Development
  • Internal Training

Please go to the CosineWave website and drop me a line if you are interested in hiring me!

And to all my friends and colleagues that have helped me get here: thank you very much!

Chisec 16 and C

Thursday, February 28 was a long day for me, but in a good way. It started almost like any normal morning, except I had to wake up 20 minutes early to handle the morning care and feeding of my animals. That task is one my wife usually performs, but she had to run out extra early for her own work.

My morning at work went relatively fast. I had very few scheduled tasks because of meetings dotting my schedule and my vice president’s group was all going out to play Whirlyball for the afternoon. Additionally, due to my company’s sales team scoring a big contract, the company was serving free Lou Malnati’s pizza for lunch.

Whirlyball was probably the most fun of the day, but it is what happened afterward that is the most interesting. I arrived at Houlihan’s at 6:30, preparing to socialize with other security professionals at Chisec 16 starting at 7:00. I did not wait long. I had hardly sat down when Maniac showed up, always full of interesting conversation and even an Asus Eee PC, something I had never seen before. It was not long before the room was full of other security professionals from all over the Chicago area.

With 20–30 people in a room, you do not get to talk to everyone. I primarily spoke with a couple guys from the University of Chicago and some consultants from no less than three different firms. It was Thomas Ptacek that gave me the biggest surprise of the evening.

Tom told me that it is getting increasingly rare to find computer people that know C. I had never thought about it, but I could see why this would be a problem. I have been using C since 1994, and I simply consider it a staple of my computer abilities. It is like part of the foundation. It is through C that I know how a shell interacts with an operating system, or how any program interacts with other components of the system. My knowledge of C is how I learned about the general structure of a running process in memory, and from that I understand how things like buffer overflow attacks actually work. It is through C that I even know how Ruby handles its garbage collection, at a low level. In regard to modern computer architecture, if you do not know C, then I would be incredulous if you told me that you really understand computer architecture. I am not sure that knowledge of C++ can really convey the same understanding, except that someone could do so by paying close attention to the subset of C++ that is C.

I wonder… do you know C? If I were to compile a list of important languages that all computer programmers should learn, C would be high on the list, if not the top language. Certainly there are other important languages out there that expand ones mind around advanced programming topics, such as Ruby, Lisp, and ML, but down at the linker level C is the language that all other languages communicate with the operating system or the hardware—application binary interfaces (ABIs) are designed around how C compilers generate object files. It is that important.