Obsessions

Monday 18. June, 2007

I might have some obsessions:

  1. Every time there’s any car/motorcycle/whatever activity outside, I nearly always run at window to see what’s going on
  2. I keep clicking Pidgin‘s tray icon even if I meant to click on Amarok‘s
  3. I check emails many times per day even though I get emails something like twice per month. On the other hand, subscribing to mailing list through newsgroups brings a few hundred new articles per day but I don’t even read the majority of those messages.
  4. I keep proving to myself depending on day that god or gods do exist or don’t exist, and think how I can take advantage of it.
  5. The Big Blue Tower that (sadly) exploded in Half-Life 2 universe. I want one. I wouldn’t have to pay for electricity, could go to places beyond my imagination, rule the Earth and suppress the reproduction cycle just because I could…
  6. I shower nearly everyday to keep myself clean, clean, cleeaan…
  7. I work on Prospekt Linux every now and then and still get nothing done
  8. I keep thinking of someone. It’s annoying. I deny such feelings
  9. I think I have written a similar post already.

After midnight, part 2: D

Monday 18. June, 2007

This post contains nothing perverted either.

The project of taking a look at different languages has progressed to D. The must-have Hello world example (hello.d):

import std.stdio;

void main(char[][] Args) {

writefln("Hello World");

}

Naturally compiling it needs a D compiler (one available at Digital Mars or one another as GDC-frontend for GNU Compiler Colletion).

As a difference to C, D contains built-in support for strings through variable types char[] and char[][], of which the latter is an array of strings and even char[][char[]] for variables like foo[“bar”] = “goo”.

Word of warning: The D language is very, very new and it’s specifications may change making older compilers and code more or less useless. For example, many of the projects I tried to use offered in DSource.org didn’t compile correctly or had some other problems making them useless. (All I wanted was SQLite bindings for D but errors in compilation or compilation system made me a bit frustrated)

After midnight, part 1: COBOL

Monday 18. June, 2007

This post contains nothing perverted.

My project of taking a look at different languages has progressed to COBOL. It appeared in 1959 so it’s quite old stuff. The famous Hello world in COBOL:

IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
PARAGRAPH-1.

DISPLAY "Hello, world.".
STOP RUN.


It’s interesting to see that every program line starts from 8th column, or at least OpenCOBOL compiler complained if they didn’t. COBOL can be very verbosive as this Wikipedia example for solving the roots of quadratic equation shows:

COMPUTE X = (-B + (B ** 2 - (4 * A * C)) **.5) / (2 * A)


or alternatively:

MULTIPLY B BY B GIVING B-SQUARED.
MULTIPLY 4 BY A GIVING FOUR-A.
MULTIPLY FOUR-A BY C GIVING FOUR-A-C.
SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1.
COMPUTE RESULT-2 = RESULT-1 ** .5.
SUBTRACT B FROM RESULT-2 GIVING NUMERATOR.
MULTIPLY 2 BY A GIVING DENOMINATOR.
DIVIDE NUMERATOR BY DENOMINATOR GIVING X.


Using of variables requires them being introduced in a dedicated DATA DIVISION. COBOL seems to have other DIVISIONS too.

This language seems to be the coolest one I have ever seen (well, so far), but it doesn’t mean that I would like to actually use it. It has over 600 keywords(?) and it’s designed for business world, so I probably wouldn’t have use for it. It has a nice name, though.