• entries
18
21
• views
12275

GAH

## perl

Well I decided to learn perl by writing myself an image directory display script thingy.
I haven't bothered to install a file manager yet so I've been using mozilla to look through the directories, but when files are called things like 10215420.jpg it can be difficult to find what you're looking for.

Anyway, here it is in all its horrifying glory. I'm sure you perl gurus out there will find many ways to reduce this to two lines of code but I'm just learning, ok. [grin]

#!/usr/bin/perl

use strict;
use warnings;
use Image::Size;

print "Enter directory :";
my $dir = ; chomp$dir;
my $filename = "$dir/imgs.html";
my $imgs;$imgs = ls $dir; my @lines; @lines = split(/\n/,$imgs);
open(FILE, ">$filename") or die "error opening file\n"; print FILE "\n$dir\n\t\n\n\n";
my $counter = 0; foreach my$l (@lines)
{
if ($l =~ /\.jpg|\.bmp|\.png/) { if ($counter%4 == 0)
{
print FILE " ";
}
else
{
print FILE " ";
}
(my $width, my$height) = imgsize("$dir/$l");
$width = ($width * 128)/$height; print FILE "$l\">$l\">\n"; print FILE " ";$counter++;
}
}
print FILE "\t\n";
close(FILE);

It requires the Image::Size module. And creates a table with four images per line. Yay! (Oh, and I ecpect that the html is rather iffy as well, but it works!, I love that [grin])

edit: the html file has a title now

## Ooooo

Ooooo turns out she was also seeing someone when she was on holiday, and she has the nerve to post it on her blog. That's cheating that is.

Ok I really don't care anymore but still...just to show you what she's like... I mean if he was at least good looking, but he has little chicken arms and no pecs...he looks like he's 7 and she dares say he has a nice body. That's insulting that is, damn she has bad taste...

Ok I've finished boring all who read this journal with this girl. Now she isn't talking to me all day on msn I should be able to get some programming done and/or sit in #gamedev

## KERAAAAZY girl part II

Ok so nobody cares, well I care and this is MY journal so im going to tell you ANYWAY. Na.

So crazy girl goes "coucou" to me on msn ("coucou"...COUCOU? YOU JUST DUMPED ME?!!?) and we start "talking" (her saying how boring and pathetic my life is and then refusing to say anything when I asked why, etc.) Anyway, we soon got to the unavoidable criticism-of-other part. Soooo her life is much more interesting now apparently (I had noticed...) because I was pulling her back, and how she only wanted to go out with my out of desperation and how she never really liked me, and misc. insults.
She is going to regret stuff she said tomorrow, it's going to eaaat at her I know her so well, so I didn't say much..she's now taunting me with tails of her recent exploits...fascinating. I hate her so much right now that this isn't even making me jealous...

It will tomorrow though so I'm going to try again with her best friend..hah!

She turned me down once but she seemed interested recently...she seems relatively sane..

## Yay!

I got dumped!

If you consider that we were together at one point... Damn that girl is KERAAAAZYYY..in a bad way, anyway I always feel better after having bitched about it a bit even if nobody cares so here goes.. I've learnt my lesson anyway: Don't bother continuing to try with people like that. 90% of the time when she actually decided to bother meeting me (we live 2km away , I mean come oooon... "I'm doing my homework" (>__didn't understand why it should bother me!. As soon as she got back she said that she didn't want to see me anymore, "just because". I've been chasing this 'girl' for a damn year and all I got was one lousy kiss! >_
There, I feel better. I now need a new girl to obsess over...

Somewhat important are the Intel manuals:

Here.

This site also has mirrors, I found the Intel site quite slow so I got them from here when I downloaded them.

I hope these are usefull to someone, my OS links:

bonafide OSDEV. Down at the moment but most of the documents are mirrored here.
The OS wiki. Lots of good information
More good info
The megatokyo os board.
Yet more good info
80386 instruction set.
The art of assembly language programming.
Some articles and a forum.

There. Enjoy.

## OS

Well, I haven't posted in a while.

I've started work on an operating system. It is quite pathetic for the moment, but this time I'm sticking with it. An appropriate name would be PentenOperatingSystem really..pOS. Very, very bad joke I know.

Anyway I'm currently working on a slightly more complex memory manager than my current "throw memory at the user untill it runs out, what do you mean, free?" method and am trying to get paging working. I have a working timer and keyboard though, and I'm writing useful functions as I go so it's slowly growing. The design at the moment code wise is one header file for 12 .c files. Ouch. It's only young though.

## Editor

Well I had an idea while preparing my pizza just now to stop the editor flickering. I just stuck a Sleep(1); in there and it now scrolls nicely without a flicker in sight. This is the second Sleep(); I've used in two projects now though. [rolleyes]
Is it actually bad style or is that just in my head? It always feels somewhat hackish.

Anyway. Pizza time.

## Lisp

Well, I'm back and I've been reading this. I never remember a language unless I use it so I pulled out C++ Primer Plus and looked for an exercise as my first program. I decided to go with something very simple that nevertheless took me a depressingly long time to write: A program that prints the sum of all the numbers between two supplied values.

Here is the result:

(defun sum-between2 (x y &optional (verb 0))
"sum all numbers between suplied vars together - prettier version"
(when (> x y) (rotatef x y)) ;if x > y then sum-between2 (y x)
(let ((sum 0) (iter x)) ;sum = 0
(dotimes (- y x)
(setf sum (+ iter sum))
(incf iter))
(format t "The sum of the numbers between ~[~d~;~r~] and ~[~d~;~r~] is ~[~d~;~r~]~%" verb x verb y verb sum)
sum))

And because this was painfully slow I just had to optimise it into this shorter program:

(defun sum-between-fast ( x y &optional (verb 0))
"sum all numbers between suplied vars together fast"
(when (> x y) (rotatef x y))
(let ((sum 0))
(setf sum (/ (* (1+ (- y x)) (+ x y)) 2))
(format t "The sum of the numbers between ~[~d~;~r~] and ~[~d~;~r~] is ~[~d~;~r~]~%" verb x verb y verb sum)
sum))

Here is some output:

CL-USER> (sum-between-fast 1 5)
The sum of the numbers between 1 and 5 is 15
15

CL-USER> (sum-between-fast 1 5 1)
The sum of the numbers between one and five is fifteen
15

And for kicks:

CL-USER> (sum-between-fast 1 215478654 1)
The sum of the numbers between one and two hundred and fifteen million, four hundred and seventy-eight thousand, six hundred and fifty-four is twenty-three quadrillion, two hundred and fifteen trillion, five hundred and twenty-five billion, two hundred and seventy-two million, five hundred and sixty-five thousand, one hundred and eighty-five
23215525272565185

I love ~r. [smile]

Feel free to criticise anything.

## germany

Well i'm in Germany right now, compilerless, on a two week long school exchange. GDI was being annoying before I left and this editor thingy really isn't exiting me so...I'm going to drop it ( Yes, I do this a lot ) and learn lisp instead.

Why the hell not? [grin]

## editor

Here is my newish project. It is called, I'm very proud of this name, editor!
It doesn't support text editing yet but it is on the way. Hopefully.

Behold!

It could do with scrollbars, menus, text selection..

## foobar thingy - again

Well I decided to fiddle with it again. It now shows who the song is by when the mouse hovers over it.
I don't think this merits a screenshot so just imagine it.[rolleyes]

I finished the foobar thingy! It now works nicely although I did use a sleep function. It always seems somewhat hacky. But...it works. [grin]

## foobar2k thingy

Well I wanted something to show me what song was playing in foobar, so I wrote my first "usefull" program today.

It's just a little window that sits up on at the top of the window and reads the currently playing song from a text file thanks to the Textwriter plugin.

It looks more obvious here:

I currently have to move the mouse over it before it updates but I'm working on that.

Oh and happy easter if anyone actualy reads this

## ..

Ok. I expect that the space invaders game is dead. I haven't written here for ages. I got into PIC programming and forgot about directX for a while.
I'm back at school now so not much time.

That's all.

Well I've decided to go with Space Invaders for my next game ( Ironically I've never played it, so it won't be very faithfull to the original [grin] ) I'm going for lots of white blobs moving slowly towards a white ship-shaped white blob that shoots white..blobs at them.
To work!

## ping...pong

Well I don't know how to start this journal really so just imagine a witty and clever introduction .
There.
Now on to my last project. Pong. And you thought Doom III was good looking.

## ping...pong

Well I don't know how to start this journal really so just imagine a witty and clever introduction .
There.
Now on to my last project. Pong. And you thought Doom III was good looking.

Ingame:

You can get the .exe here