Laurens Van Keer

Laurens.VanKeer.eu

Updated Excel 2 AS/400 macro template

March 10th, 2009 by Laurens

I made some changes to the Excel 2 AS/400 post, with thanks to Mike. Apparently, I forgot to mention that the column variables (cCOL1, cCOL2, …) need to be set for the macro to work. In my own macros, I did this in the “IsCorrectSheet()” function, which I didn’t include in the template because this function is macro-specific. Another way to solve this is by explicitly defining column constants (e.g. Const cCOL1 = 1).

The IsCorrectSheet() function is now added and should hopefully resolve any problems with the column variables.

Posted in Scripting | having no comments »

Conway’s Game of Life: A C++ implementation

February 5th, 2009 by Laurens

This week I decided to learn two new languages: C++ and Python. The latter I need for understanding Plone (an open source CMS) better and C++ I need mainly for developing Windows applications (which is why I use Visual Studio now).

Today I quickly went through some of the basics of C++ and immediately started implementing something I usually make when learning a new language: Conway’s game of life.

The implementation went pretty smooth, apart from one headache I got because of a stupid mistake in the function for making the next generation. Anyway, here is the code. It’s my first C++ program, I know I probably did some bad practices, but I’m still learning so bare with me here. :)

Download the executable and cpp file here.
(view code in this post – click read more on the homepage)

Read the rest of this entry »

Posted in Programming | having no comments »

A simulated annealing approach to the TTP

December 28th, 2008 by Laurens

First of all: happy holidays! ^^

A lot has happened since my last post. I had a lot of work for school (still have – we have exams in two weeks) and I had some extra IT work (mainly scripting things for people & businesses) next to that. Anyway, I figured it was about time to update my blog again…

The past semester we had to do a project for the course “data structures & algorithms”. The assignment was to research the traveling tournament problem (the TTP), design a solution and finally implement the solution as a Java application.

The TTP is a global optimization problem and is basically a more complex variant of the traveling salesman problem. I’m not going into the details of the TTP here, there’s enough information out there, e.g. on Trick’s site http://mat.gsia.cmu.edu/TOURN/.

I opted for a simulated annealing (SA) approach. Again, I’m going to spare you from a detailed description of this meta-algorithm, but what it basically does is a kind of random (local) search in the solution space to locate a good approximation of the global optimum (minimal travel expenses in this case).

My particular implementation exists of a straight-forward SA implementation for the TTP and a more advanced, fine-tuned version of the SA algorithm. The advanced version (based on TTSA) features a couple of optimizations. It’s not the fastest way of solving the problem (clustering search is faster e.g.), but it’s definitely a practical and robust approach imho.

The JAR file of my final application can be found here (link). A lot of optimizations are still possible. The generation of initial solutions could be improved with genetic algorithms e.g. and more testing is necessary for optimal parameters. Also, the Swing-based GUI slows down the application immensely.

The source code has been deliberately left out of the JAR file for now, I have my reasons. I can post the source within a couple of weeks, but I’ll probably forget. If I do and you’d still like the source code: feel free to contact me.

Enjoy the rest of the holidays and good luck with the exams to any other students out here. Laurens.

Posted in Programming | having no comments »

How to sort huge lists – epic sort

October 12th, 2008 by Laurens

A couple of months ago I made a small Java application called “WordCollector“. This program makes “wordlists” (plain text files with on each line a word, used for e.g. brute force cracking), based on words it finds on the web. The goal was to make big word lists, consisting of commonly used words (as well as their misspelled versions).

One rather annoying problem version 1.0 still has, is that it can’t sort and filter out the duplicates as soon as the text file is too big to load into memory. So conventional sorting algorithms won’t work. Yesterday I made a solution for this problem: it’s called EPIC SORT. :)
Read the rest of this entry »

Posted in Programming | having no comments »

[update] Excel 2 AS/400

July 25th, 2008 by Laurens

Today I finished working for Dana (see my previous post for more). I’ve worked there for three weeks, mainly doing administrative tasks and scripting Excel and AS/400 Client Access macro’s. They were obviously very satisfied about my work. ;-)

One thing in particular they were excited about was the solution I found and customized for automatizing data entry via the AS/400 emulator. I made some AS/400 client access macros that automatically copy cell data from an Excel spreadsheet to the AS/400 client. In my last post I described how you can do this. This post is an update on this topic; one of the things I made in my last week is a “template” of such a macro. This template does nothing useful by itself, but it can be used for scripting new macro’s that need this “Excel 2 AS/400″ functionality.

Next week I’ll be working in IT at the KULAK (where I study).

Anyway, here it is: Read the rest of this entry »

Posted in Scripting | having 3 comments »