Archive for the 'Code' Category

Who Me Nerd?

Sunday, May 13th, 2007

Does the books you read defined who you are? I’m currently reading two books, one on the history of the Internet and the industry that stems from the network technology. The other is on the history of the typewriter and adding machine industry that later evolved into the computer industry.

Amawrong

Tuesday, January 23rd, 2007

Amazon regularly email me with usually interesting and tempting suggestions on books to buy. A good use of datamining. Today the mail recommended “Learning GNU Emacs, Third Edition“..

I take offense.

Port dependencies

Sunday, November 19th, 2006

When updating my system I realized I had tons of applications and stale library requirements, installed via ports, that I never use anymore. Which ones? Go through them all? Nono.. Just use a spiffy Perl oneliner and Pandoras portbox is open:

# pkg_info | perl -e 'while(<>) {$p=(split(/s/))[0]; (print $p.”n”) 
if (`pkg_info -R $p |wc -l`==3);}'

Unix is poetry..

DROP DATABASE ORACLE;

Sunday, October 8th, 2006

I’m spending my weekend in the computerlabs trying to not go postal while doing my assignment in Advanced Databases. A short summary..

  • The necessary TKPROF application hasn’t been installed.
  • When using XQuery I get erroneous results that my professor can’t explain since the query is correct.
  • When inserting the data I get an errormessage stating that 16 bytes couldn’t be allocated.
  • The database server just crashed..

Did I say that I sincerely hate the piece of overpriced toy that Oracle on Windows is?

Worst Bang for the Buck

Thursday, October 5th, 2006

Oracle SQL*Plus must be the worst piece of crap software ever written.. how can an industry-leading database made by a company making billions of dollars every year be shipped with a console that has been utter horsepoo for more than 10 years? Please Larry (and the rest of the Oracle crew), descend from the tower and download PostgreSQL now.

Yes.. I have to use it daily now.

Dont mind me, I’ll selfcombust over there in the corner now..

A Helping Hand

Thursday, July 6th, 2006

Programmers really like to help a fellow nerd in need.. oh yes.

Usenet can be a scary place..

Jack Syntax Highlight

Wednesday, April 5th, 2006

We’re going to use the Jack environment at the university for the Multi-Agent Systems class this semester. Jack is a superset of Java that adds some agent-oriented preprocessing directives, but in the process it upsets the Vim Java syntax highlighter and end up making it all look pretty horrorshow. To remedy this I hacked up a quick syntax file for Jack, you can get it here. This is just a first version, more syntactic elements will be added during the next days.

Converting Excel files

Monday, December 5th, 2005

For a project at work I need to convert Excel .xls files to a more suitable format for datamunging on a UNIX platform, csv for example. To achieve this I set out hacking a small converter using the POI project from Jakarta, according to the documentation traversing the fields in the file should be trivial. So it was, unfortunately it was equally trivial to blow the stack as well. Reading a 900kb xls file took too much memory to fit in the normal 64Mb heap allocation for the Java VM. Sigh. Even more painful was it since this was the smallest file out of the ten files I needed to convert. Assuming that this a 1Mb file just barely didnt fit the 64Mb allocation, to convert the largest file on my list I would need almost 800Mb of heapspace.. when all I did was reading one row at a time and writing it to a new file? Since I need to convert the files on the fly a few times per day this is utterly useless. It’s a good thing that this is opensource, it will be interesting to find out how they manage to blow up the data 64-fold in memory.

Fortunately the package provided an alternative way to traverse the file which consumed memory within the limits of sanity and in the end I had a small hack that converts a xls file into several csv files, one for each found sheet. If you need to do the same thing you can get it here under a BSD license.

CPE Provisioning

Saturday, November 26th, 2005

I spent today at work setting up provisioning of the Ericsson HM340d CPE which we have quite a few of deployed in our network. The configuration is pushed to the CPEs using vendor encapsulated options in the DHCP protocol which worked very well indeed, since the CPE performs the DHCP request on a management PVC the solution is safe as well. The format of the options is of course a network byte order encoded string which was documented in a protocol specification I received.. or so I thought. The documentation contained every octet except the checksums, how stupid is that? Luckily the missing octets were fairly simple to reverseengineer given that I had an example configuration but it was still more painful than needed. Perhaps hacking up a Perl module for the configuration creation would be in order?

Checking for binaries

Sunday, November 13th, 2005

I comitted a patch to the TenDRA buildprocess tonight which adds some keep-it-simple checking for needed binaries prior to configuration. The resulting hack got a bit messy due to limitations in bmake(1) however, the below code fails due to .for loops being evaluated prior to the variableexpansion in the BUILD_BINARIES list.

BUILD_BINARIES=  ${BIN_FOO} ${BIN_BAR}

.for BIN in ${BUILD_BINARIES}    test -x ${BIN}.endfor

Each test had to be hardcoded instead which seems like a suboptimal solution, it does however work which was the intended effect. Now for some preproducer hacking.

TenDRA Comitter

Tuesday, November 1st, 2005

I officially joined the TenDRA project today as committer which I’m very excited about. TenDRA is a BSD licensed compiler based on the ANDF technology currently featuring producers for C and C++. I’ll be blogging about my forays into compilerland using this category.

Updating

Sunday, October 23rd, 2005

Due to my /var disk being full last night the software that I use to create this site freaked out and left me with a crapped index. Seemed like a good enough time to do some maintenance so I decided to update to the latest version, a process involvning too much painful handwork.. The most notable change is that the ability to comment has been removed, this due to increasing commentspam and some security issues with the commenting software. I’ll hack up a new comment script to restore that feature soon, you can always mail me in the meantime.



If you find anything broken on the site, please contact me.

Claws Bugfixing

Monday, September 12th, 2005

Had a productive day hacking on Sylpheed-Claws which resulted in 5 patches getting submitted, three bugfixes, one typofix and one feature improvement to hide unavailable menutitems. My current project is to have Sylpheed-Claws compile cleanly with -Werror -pedantic given the focus on bugfixing for the upcoming 1.9.15 release.

The weekend was otherwise pretty quiet and mostly spent cleaning and other less fun stuff..

Unix::Processors OpenBSD Support

Monday, June 27th, 2005

Since I for the first time in quite long time had a fresh OpenBSD installation around I decided to hack up support for the Unix::Processors Perl module. A trivial patch against the 2.031 version can be found here. It will probably be merged with the main distribution soon as well.

AutoRacer 0.1 Released

Thursday, April 28th, 2005

A few hours of hacking today at school payed off and I wrapped up the first iteration of the AutoRacer testharness compiler for PostgreSQL. This first version is quite rough around the edges and still lacks a few of the features I have planned but I will no doubt continue to hack on until it is the ultimate database logic testharness. Testing and feedback is most welcome, download and documentation is available on the code page if you want to play with it. Now I desperately need to sleep but I know that I’ll spend too much time reading Hackers and Painters.. keeping interesting books too close to the bed is treacherous when you really need to sleep..