Main page | About | Articles | Previous Posts | Archives

Thursday, March 30, 2006

The Alphabet of Manliness

Maddox, the author of The Best Page in the Universe, has written a book!

The Alphabet of Manliness

If you have no idea who Maddox is, you should definitely go check out his site. Keep in mind though, he pretty much bashes anything and everything... don't take him 100% seriously ;)

In my opinion, his articles are very entertaining to read. Especially when you're bored. I might actually even buy his book sometime, even though I don't really read books other than comics and school books.

HTML rendering with GDI

I started to code my custom HTML rendering control today, aptly named zHTMLView. Yes, I like the letter Z. Now go away.

zHTMLView demonstration

I was kinda surprised how well it turned out, and this quickly!

The words wrap correctly, except for bold text. If you resize the browser window, the control resizes and re-wraps text correctly etc.

Oh yeah and it displays bold and italic. And bold-italic. Now how awesome is that?

The word wrap was quite easy actually.

  1. Take the text from a text-node

  2. Get width of each word one at a time

  3. Check if the word would go over the control's border when drawn
    • If it goes -> new line.

Now, to fix word wrap with B elements and to implement some Block-level element detection etc.

And on a side note, Super Eurobeat 166 was released yesterday and I got my.. uhm.. legal copy today. It's made of win and good! On a second thought, I'm quite disappointed with it. Only two or so good songs.

Domain name

I was fantasizing about registering a domain for myself. It's not that expensive, so I thought "why not"... I could put my secondary box which runs a linux (when I get it back together, it's in pieces atm due to... a project) serving some random crap.

And my host in IRC would be way cooler!


Static IP
I need a static IP. Well, no problemo, it isn't that expensive either.


How am I supposed to get the IP to point to my computer, not my brother's, who also uses the very same user/pass pair to connect to the 'net?

No idea there.

Idea postponed until I get my own 10mbit line. I have a 1mbit line but I'm using a 10mbit line from my folks' place, since the same account works anywhere and you can make up to 5 connections at the same time.


Wednesday, March 29, 2006

Web site business

I might be getting a new web-site job involving PHP and MySQL.
An easy and fun way of making money. Developing web sites.

What's troublesome though, is trying to tell the client how much the project will cost.

Even though I have quite much experience in developing sites with PHP and MySQL, I don't have that much experience in actually getting paid for it. When I did stuff just for fun, I didn't think how long it actually took me.

So... to get some kind of idea on what the project will cost, I have to think how long certain parts in the developement process take time, so I can calculate my fees.

Tracking time spent accurately can be a bit troublesome though. Since I work from home, I might get distracted by various other things quite easily. I could obviously just look at the clock or something... but meh, there must be something better.

If not - I'll make a prog myself.

Something with a stopwatch and a list of tasks or something would be juuuust fine, but I haven't found one. Only bloated project management applications and such.

Another thing to do then hm... we'll see...

Heat Vision and Jack

Here's a quote...

Heat Vision and Jack was created as a 1999 pilot for Fox. Written by Dan Harmon and Rob Schrab, directed by Ben Stiller, this series was passed over by Fox despite critical acclaim from those who've been lucky enough to see it.

The 30 minute pilot is about an astronaut (played by Jack Black) with a medical secret who is on the run from the evil Ron Silver and the rest of NASA, with the help of a talking motorcycle called Heat Vision (voiced by Owen Wilson).

That show is the shit!
I don't know why Fox didn't continue it ;)

It succesfully mixes (parodies?) Knight Rider with the Six Million Dollar Man and some others which names I can't quite grasp.

I order you to check it out!

Oh yeah, the title song is "Tom Jones - Situation".. a great tune by the way

Monday, March 27, 2006

Developing a web browser, part 3

Here I am again with some new thoughts about developing web browsers...

Here is another screenshot of my browser. As you can see it renders a simple page okayish already.
The scrollbar is missing. No idea why it isn't visible.

Page rendering

In it's current state, the browser renders the pages using simple windows forms controls. Elements like div,b,p and such are Panels. Text inside a b node is a Label inside a Panel.

This method has one major flaw: text formatting. Take a page which has a really really long text node. How would that be rendered on multiple lines? I could make the label higher... but...

If the page had something like..
<i>Hello</i>, here is a really long sentence which needs to be on multiple lines

..then we'd be in trouble. This is because we'd first have a small Panel which would containt the text Hello and then another Panel which would contain the rest of the text.

Imagine stretching the second box higher there... this is what happens:

So it would be just completely stupid looking. That is caused because the second panel cannot magically extend itself to begin from the left edge on the second row but not on the first.


GDI+ to the rescue

To overcome the problem, I will have to trash the current model of rendering pages which has the parts of the page as separate controls. I'd have to do a single über control which renders the whole page using some kind of magic!

That magic I'll call GDI+, which are the tools I can use from .NET Framework to render custom controls or whatever I'd want. (or something like that, google for GDI+)

So... what I'll do is... begin creating a custom super duper über control, which is made of win and good. It's gonna be one hell of a job, but I don't care. As long as I have fun... ;)

For starters, I have to make it render text. Okay. Then, if I'd want to make the text selectable, I'd have to make a custom routine which would highlight the text... and check where the mouse cursor actually was to determine what text to highlight.

And it would also need to understand clicks on certain parts of the text, like links.

After that... images... borders... whatever comes to my mind... craziness ensues.

Oh well. It's gonna be lots of work and if I'll ever get to the point with my custom control where it will render the page like the browser does now with the windows forms controls... I'll be happy. :]

and regarding html parsing...

I was originally going to use the .NET Framework built-in System.Xml features to parse documents, but considering nobody knows how to write valid html, or even less valid xhtml, I trashed the idea and wrote my own parser.

After all, I do want the browser to support documents that aren't 100% valid too. My parser seems quite good (for one written by me), it reads the document, gets element values and attributes and seems efficient. However, I don't have any idea at all if it does the parsing in a manner which is considered efficient by others than me too ;)

At the moment, it takes HTML data and just starts going through it, one character at a time using a StringReader. When it encounters a < character, it does into "read tag" mode, reading until a > is encountered (or EOF. EOF is always checked)

After reading the data between < and >, it tries to figure out the element type in question and the attributes of the element (if any). Then it proceeds to see if the element is an element which can contain text or child nodes or not(eg. an img element can not)

If it can contain child nodes, the newly read element is changed as the parent node to which new nodes are appended to, until a closing tag for the element is encountered.

Text data is considered to start after a >.. everything that comes after that and is not a < is considered as textual data for the current parent node and is converted into a text node when a < is encountered and appended to the parent.

That's basically it. Any comments and/or suggestions more than welcome.

Whoah, that was a rather long post. My work is soon over for today and it's time to head home!

ps. a "Read More..." link might be good

What is it with the night?

Yet again I find myself sitting on the computer, blasting trance from the headphones at late night. I have to wake up around 8 AM and now it's almost 3 AM...

Oh well. I'll have a cup or two of Pepsi after waking up and head to work half-asleep. Whatever. ;)

Maybe I'll write some code to keep me busy 'til it's something like 4... :]

Sunday, March 26, 2006

Windows Live Messenger

I got an account to the beta test of Windows Live Messenger (prev. known as Messenger 8.0 beta I think)

The new GUI looks pretty neat. I don't like too flashy interfaces, but the interface in WLM is quite nice, with gradient backgrounds and such. The color schemes can also be changed per window basis, which is nice. Nothing too flashy but nice touches.
I was also able to find a button to remove the useless tabs from the left side of the contact list!

Also there's something called Sharing Folders, something to do with file sharing I think. Haven't tried them yet though, but if I can make some folder on the HDD to be shared with someone on MSN, it would be a quite nice feature.

The contact list doesn't seem to differentiate from offline/online users. Where be the (offline) text? I don't know who's online and who's not!

...wait a second? Offline Instant Messaging? What's this? I clicked on someone who's offline, and it says it will send the messages to the person the next time he signs in! Nice... although I still want to know who's offline by looking at the list. You can sort the contacts by their status, but then they aren't grouped anymore, except to Online and Offline groups.

You can also store your buddies contact info and other info. I don't know if this information travels with you if you log into WLM from another computer though.

and my Winamp's Messenger Now Playing plugin broke up. Damn.
Update 3rd. Apr. 2006: It actually seems that the fault is in WLM. It displays only the song title, but everyone else with an older version sees it allright.

Windows Live Messenger main window
No, you don't need to see who's on my list or what my name is ;)

Windows Live Messenger chat window

Saturday, March 25, 2006

Developing a web browser, part 2

This far...

Google.fi in my browser!

The layout logic is quite simple at the moment. It just goes through all the nodes in the internal DOM tree in the app and checks if the node is a text node and makes a Label with the text the node has.

The problem now is how to detect what "styles" to apply to each node. For example, if we have the following HTML code...

<p>Some <i>text</i> here</p>

so if the B element had 20px of padding for example, how would the program know to not apply it to the P element anymore. The current way of looping through the nodes inside the document can go through all the child nodes, but it doesn't discriminate different childs in any way.

I'll probably implement some kind of parent-checking or something weird.

Suggested reading to get sleepy

Can't sleep? Print these and read them in bed...

DOM Specifications
XML Specs
HTML 4.01 Specs
XHTML 1.1 Specs

Now I'm gonna go sleeeeeeeeeeeeeeeeeee

Super Eurobeat 166 previews

I just listened to the SEB 166 preview clips at Avex's site. From the clips I'd say it's going to be a good one again, although Shock Out sounds a bit plain to me, but it could be a sound quality issue in the clip.

At least there's gonna be one great song for sure... Lupin - Black U.F.O.
I already have a version of the song, so I know it's great ;)

Dave Rodgers's Ring of Fire could be a hit too, since his latest tracks have been really good.

I can't even think how good SEB 170 is going to be if the quality of the songs stay the same or keep rising...

Friday, March 24, 2006

Developing a web browser

I've been coding a web browser, for fun obviously, since there's really no need for a crap browser made by a random coder ;)

There have been numerous questions to begin with.. How should I implement things like CSS? DOM? Am I ever going to go that far as in implement CSS support at all?

I didn't even have an idea how things should be drawn to the screen... Windows Forms? Custom GDI drawing? How?

I did some research on google and found out that you can redefine the layout engine used in Windows Forms.

So I did that.. created a new control based on the Panel class, which allowed me to change the layout engine used to a custom one.
I made a very simple layout engine, which would take some values and create Labels for every one of them and lay them on the panel.

I also had made some simple classes to open TCP/IP connections to the server and to send HTTP requests. They're a buggy pile of crap at the moment, I will look at them (maybe) at the point when I get the actual HTML outputted to the screen in somewhat similar manner as in Lynx (a text-only browser on *nix).

For saving the HTML data, I created some basic classes, with somewhat similar features as XmlNode and some ideas borrowed from W3C's DOM specification. Basically just something to contain possible text-data which the HTML element had, the attributes of the tag and possible child elements.

I also made some structures to be used with CSS. I thought that I'd use something like CSS to format the documents to begin with, so it would be easy to add support for it later.

Now I'm in the point where the HTML structure is parsed correctly (afaik) and I need to make a new layout engine which loads and displays the site, instead of a list of the tags found in the document like it does now :)

I've had to do lots of thinking. New concepts, new programming models in C# etc.
The last time I've thought this much was when I was coding a 2D engine in C#+Direct3D (abandoned due to lack of intrest at the moment)

Oh well. Maybe it's time to go sleep now. Gotta get up early tomorrow to work and so on.

What's wrong with russian drivers?


Someone tell me. Are there actually any requirements for a license in Russia? Or do you even need a license? :]

Thursday, March 23, 2006

Microsoft calling back on lunches

Like I thought. They probably got a huge amount of hits and now the site needs you to register an account, which will probably be validated against a database of MS OEM distributors.

Microsoft offering McDonalds lunches

Microsoft is offering free lunch coupons at McDonalds for finnish users if they answer correctly to a small quiz at their website.
Links and correct answers are spreading like wildfire on IRC, forums, MSN, etc.

I wonder if Microsoft is going to have thousands and thousands of people answering the questions and getting a free lunch...

Reminds me of the campaign the finnish distributor of Pepsi had.. They had numbers in the Pepsi bottles which you could enter at their website. With something like 1000 numbers, you'd get a decent laptop.

What happened was that some people started hoarding Pepsi and Pepsi Max bottles so much, that they even ran out at some stores! The manufacturer hadn't expected this and called back the campaign earlier than they were going to. Probably because they were losing money.

It was actually possible for you to gain money by that. You'd buy the bottles, enter the codes and then sell the bottles cheaper than in stores.

If anyone from Finland happens to read this, here's the link to the quiz

Wednesday, March 22, 2006

Graphics tablet funnay

I borrowed a graphics tablet from a friend/coworker (Thanks!, although I doubt you'll ever read this!)...

Ever tried playing games with one? Strategy games are fun with it, just tap the tablet with the pen and stuff.
I also tried playing Day of Defeat with it... the damn game doesn't seem to use absolute cursor positioning to track mouse movements, since all I was able to do, was spin around uncontrollably if the pen touched anything but the center of the tablet surface.

Note to self: code your games that use mouse with tablet users in mind. They're fun, although not necessarily useful for gaming ;)

Now I have to do some adjusting on some CSS code... laters.

Opera 9 Tech Preview 2

I installed the latest tech preview of the Opera browser. Lots of new cool and useful features, like built-in BitTorrent support and Widgets.

Ever used anything like Samurize?
Basically they are floating objects programmed with HTML/JavaScript embedded in the browser that do something. Like an analog clock, the latest news, TV shows, the weather, you name it.

Makes me wish I had two monitors... having the Widgets float on top of everything else forces you to hide them at times. They need to add a feature to force the Widgets to only show up on the desktop.

Another useful new feature is "Create Search"... You might already know, that you can add custom searches to Opera's search dropbox and to the URL search (eg. type "g foo" as the url to search Google for foo)... that feature lacked any inuitive and easy way of adding new searches.

Now you can just go to the search engine you want, right click on the search field and choose "Create Search". Easy, isn't it?

Opera 9 Tech Preview 2 changelog
More about Opera Widgets

Watch out Firefox, if the word about Opera gets out more, you'll have a tough competitor!

Tuesday, March 21, 2006


One of the few japanese tv-series I've watched, Densha Otoko, seems to be almost fully available for watching at YouTube. The quality isn't sky-high, but watchable.

I can't bother babbling about the series here, so if you don't know what it's about go look here

The episodes

  1. Episode 1

  2. Episode 2

  3. Episode 3

  4. Episode 4

  5. Episode 5

  6. Episode 6

  7. Episode 7

  8. Episode 8 not available

  9. Episode 9

  10. Episode 10

  11. Episode 11 part 1

    Episode 11 part 2

A very fun and touching series in my opinion.

The missing episode can be easily found with a bit of googling


While trying to figure out something fun to do, I started going through my old files on various servers around the internets.

Finding old logs... old versions of my site... etc.

I hate that!

I hate my old sites!

I hate how I talked on IRC in the old days!

I always find it quite embarrasing for some reason. I acted rather lame and childish some years back... and I don't like showing the files to anyone, even though they're actually rather funny.

Oh well. That's how it goes I guess. I tend to show parts of old logs to others, especially if they have something funny about the other person ;)
And it's actually quite fun to look at my old sites, seeing how crap they were... or my old PHP/whatever scripts.

I actually even found a few useful bits and pieces.. and some things worth backing up too.

I backed up a huuuge archive of funny pictures, .swf files etc., some old PHP scripts (a POP3 reader, a version of the POP3 reader which uses WML etc.), an old app (HL Script Utility) along the other things.

I wonder what I'll think of my writings here or somewhere in a couple of years? Who knows what an asshole I might be then!

Monday, March 20, 2006

AMD x2 CPU's - Now with built-in speedhack!

A funny thing I heard recently on IRC... AMD's dual-core CPU's supposedly run Counter-Strike too fast :]

Have no proof though, don't own one of those or anything.


JavaScript is an often disregarded technique to add a new level of user interaction to webpages.

I used to hate it. Now I love it.
Back in the day, the support for JavaScript was SO different between browsers. Now most browsers support it quite well.

Well enough to do simple things with ease and more difficult things with... well, with more difficulty.

There also seems to be a huge difference in the performance of the JavaScript "engines" in the browsers. Let's take a script which highlights table cells when you point the cursor over one.

1. Find the element where the mouse is
2. Loop through the table to find the position of the element in the table
3. Loop through the table to highlight the horizontal and vertical line of cells where the highlighted cell is
4. Highlight the actual cell too

That works lightning fast in Opera and Firefox. Internet Explorer on the other hand is quite slow.

I know the code I've written isn't very efficient and it could be faster for IE too. I just haven't had the time to go through the algorithms.

There's still one very annoying thing even with the modern browsers' quite equal JavaScript support. COLORS!

Wanna detect a color?

if(x.style.backgroundColor != "#ff0000" && x.style.backgroundColor != "rgb(255, 0, 0)" && x.style.backgroundColor != "blue")

You need 3 different detects.
Shoot me now!

(note: the colors in the example might not all be blue but you get the point)

Saturday, March 18, 2006


Something I've been tinkering with lately is this old laptop, which I call "craptop"
Why? Well...

  1. Broken HDD

  2. Broken CDD

  3. Missing battery (probably broken too)

  4. 300mhz/64mb RAM

I was thinking about converting the LCD screen to a "normal" monitor. Did a bit searching on the web and it seems possible, although troublesome.

Especially the article here was intresting.

Earlier today I took off the plastic cover on the LCD monitor.

It was quite easy after a while. I was quite careful to not break anything..

just had to take off the bolt covers with a paperknife since I had nothing better for the task, unscrew the bolts and press from strategic positions in the plastic to clip it off.

So, the next thing to do is probably to remove the keyboard and the rest of the plasitc covering to get to the wiring... then to think how on earth I will connect the wires to a normal lcd connector...

Friday, March 17, 2006

Midnight dwellers

What a crazy idea. A blog. Good going me!
Shouldn't stay up too late ;)

I have lately been having so many ideas and intresting things (at least to me) that I've been doing that I thought that it might be fun to write some of them down.

Oh well. Let's see when I'm done deleting this blog. ;)