torkell: (Default)

I have a small snippet of code here, written in Visual Basic 6. Guess what it does:

Dim s As String
s = String(2, "0")
Debug.Print s

I'll give you a hint: it doesn't do what I wanted it to do.

Ok, I'm a fool. That code does what I want it to do. The following code in my program:

RSet s = Hex(1)

most certainly does not do what I wanted it to do, as it appears that RSet will replace leftover characters with spaces. Which kind of negates the whole point of padding the string with zeros in the first place. Grrr.

torkell: (Default)
Today's discovery: Java will not flush file streams for you. If you open a BufferedWriter, write some stuff to it, and then don't call close() on it, then Java will happily throw the remains of the buffer away.

This is probably related to the lack of destructors in Java, and the complete and utter uselessness of Object.finalize() - the method that's like a destructor, except it only gets called if the garbage collector runs, and then only if the garbage collector feels like it.
torkell: (Default)
Update: the gremlins appear to be fans of shakespeare, judging by what one of them is merrily writing.
torkell: (Default)
You have got to love a debugging enviroment which has a "New Gremlin Horde" command.

How I code

Mar. 7th, 2006 11:04 pm
torkell: (Default)

How I code


Yep, that's three of me, all coding and browsing. There gets quite a fight for the mouse at times. (and the keyboard)
torkell: (Default)
I now have a MakeChild() function. This is probably going to kill my interpreter in interesting ways, but then again random input always makes for a good stress-test.
torkell: (Default)
Today's achievement: writing an interpreter for brainfuck in Visual Basic 6, something that's taken me all of an hour, and that included a fair amount of time spent trying to make the laptop talk to the desktop to transfer a file that I didn't use in the end.

Source will be uploaded somewhere somewhen, so don't hold your breath.

The next step will be to add genetic algorithm support to it, so I can make it randomly generate programs. But what programs to generate?
torkell: (Default)
Memo to self: a bitwise OR is not the same as a logical OR.

(that bug took me the past hour to track down)
torkell: (Default)

Entish
Entish

To which race of Middle Earth do you belong?
brought to you by Quizilla

Never thought of myself as an Ent. I was thinking more of Gandalf, although that's a characted, not a race. Hmm...

Well, I made some progress with the list I posted. Found a new API call in the MSDN library (InitiateSystemShutdown) for the booking program and wrote a test C++ program. Sucessfully shutdown my other PC with it. Now all I need to do is to transfer it to VB, unless I change my mind and develop everything in C++. I might do that actually, as everything is going to be NT4/2k/XP, and that will let me use a Unicode-based system with Unicode API calls. Plus, there's less overhead. Maybe if I use named pipes or something for inter-PC communication. It'll make coding it easier, and I could do with the experience with C++. I'll probably not use MFC for this - I think I'll find it easier that way, and it reduces the overhead.

May 2025

S M T W T F S
    123
45678910
111213141516 17
18192021222324
25262728293031

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 15th, 2025 10:51 am
Powered by Dreamwidth Studios