• entries
25
27
• views
14061

Drizzled in TODO with a side order of HACK

## Distractions

I'm sure you've sat down at your desk with the best intentions of being productive and ticking off more items on your todo list, but somehow you get side-tracked. This is almost a daily occurence with me, as everything suddenly becomes a million times more interesting than what I'm working on(regardless of whether it's a project I enjoy). What's more is that the distractions are the same ones causing me grief, so I've been looking at ways I can actually get some work done without requiring too much work.

• Google Customised Homepage - This *has* to go. It's the first thing I see whenever I open firefox, and it's full of things I want to read, which in turn usually lead onto related topics. This recursive time-sink will eventually soak up my entire day if I didn't need food/drink/toilet breaks.
• IM Programs - Setting my status to (Away) or (Busy) seems to do the exact opposite of saying "I can't talk", as instead I get messages such as "What you working on?", "CS? ", "I need help with my work!". The problem here is keeping in touch with people, but at the same time being able to work in peace. If anybody knows of an IM program which integrates with the MSN network and has an answering-machine style functionality but doesn't leave flashing minimized windows at the bottom of my screen, please let me know!
• Real and OS Desktop Clutter - I'm not sure why, but having a tidy desk makes my head feel tidier, maybe it's all the objects on the desk that my brain finds entertaining, or something else.
• Music - Some music helps me concentrate, whilst other music does the complete opposite. Heavy music(metal, industrial), just makes me unable to get anywhere near focused on my work, whilst classical, psytrance, light/melodic rock, piano allow me to listen without being too caught up. On the other hand, maybe I should consider not listening to any music at all.

Anyway, I think I've managed to sink enough time writing this, maybe I should get back to reading the dilbert archives and /.

## Doomed to fail...

Whenever I boot a computer from cold, I'm always slightly nervy until the OS had loaded, this is probably from the number of times seemingly OK equipment has just coughed up blood. Well, today was the debut of my laptop HD problem... The BIOS fails to detect the drive, so it spits out the immortal words "Operating System Not Found". So I reboot, get same message... reboot again, tada! It's "working" again. I have a recent backup(yesterday evening), so data loss isn't a problem, instead merely just the inconvenience of being without my laptop. Curious about what state the HD is actually in, I ran ScanDisk, which returned no errors, and I ran a SMART viewer, which also said the drive was fine.. I'm stumped.

## .MSI error woes

The installer tells me...

"Error 2203. There's something wrong with this package. kthxbye."

The log file tells me...

"Ack something bad happened. Bye."

But what really happened...

"You noob. The G:\Temp\ folder you recently created doesn't have SYSTEM full access priviledges. Go download XP Home if you can't deal with setting permissions."

I :heart: subtle problems, and I'm ashamed to say updating TortoiseSVN took me nearly half an hour.

Next week: "Manually removing TortoiseSVN using a RegEdit Chisel: It's never as complicated as you make it."

## Long time no siege

Well the time for exams has sprung up on me again, like some cunningly placed jungle trap. And naturally my response to this immense burden of work is to wander off and start a side project, which probably isn't one of the best ideas, but it keeps me off the streets(being 21 and all...). Anyway more to the point, I've been strictly adhering to a diet of other libraries, instead of doing something stupid and coding my own(a cookery analogy would be fitting here also). First up was the obligatory update of boost, primarily for boost::python, the very cosy wrapper around most of the repeatidly duplicated Python glue code. If you've ever had to mingle with raw Python C API calls and reams of error checking, you'll know it's not the nicest substance to have smeared around your app, and boost::python is like the pampering you see off the horlicks adverts(although it's purely psychological, I've yet to be attacked by hugs).

The next is Crazy Eddie's GUI, I remember a few eons ago when it started up that it looked very promising, and I've stumbled upon it again recently, and decided to have a tinker. They've got so many fancy features, my favourite being the ScriptingModule interface.. it took me about 15 minutes(no, really), to have a complete Python event handling system. This code only handles the events coming in, so it's basically only a few PyRun_SimpleString(...) calls. I've also noticed they've got a PyCEGUI add-on for Ogre(it seems), knocking around somewhere, but it seems more for extending Python than embedding, and is in it's infancy at the moment, but I suppose it can't hurt to have a mess about...

## Super-lightweight testing for the lazy

Today I've been working on a texture manager as part of my library of useful components which I'll hopefully use on my next project. Now I don't want to delve into how it works, because that's not what I want to blather on about.. what I *do* want to talk about is test-first development.

Step 1. Draft up the header file with the class interface.
Step 2. Put method bodies for Getters in the header(eg, GetNumLoadedTextures()).
Step 3. Create simple method bodies for more complex functions inside the source file.
Step 4. Return either false, 0, or other fail case for each method where appropriate.
Step 5. Construct tests in the main function.

Step 6...
Haang on, do I still have cppunit? Nope. Do I actually need it? Nope. I decided it was a bit draconian for what I need, and I could probably knock up something in about 5minutes which would achieve the same end result:

static int assertFailed = 0;static int assertPassed = 0;void zassert(bool cmp,const std::string& msg){ if (!cmp) {  std::cout << "FAILED:" << msg << "\n";  assertFailed++; } else {  std::cout << "PASSED:" << msg << "\n";  assertPassed++; }}void zstatus(){ std::cout << "Tests executed:" << (assertFailed+assertPassed) << "\n"; std::cout << "Failed:" << assertFailed << "\n"; std::cout << "Passed:" << assertPassed << "\n"; std::cout << "Overall Result:.... \n\n"; if (assertFailed > 0)  std::cout << "       -- FAILED --"; else  std::cout << "       -- PASSED --"; std::cout << "\n\n\n"; assertFailed = 0; assertPassed = 0;}

Now of course it isn't reusable in it's current form(other than copy+paste), and the majority of people will want to wrap the functionality up in a namespace or Singleton, add optional file output, emailing of results, etcetc, but really it's all you need to get your drafted test cases into code so you can begin bug fixing.

If you want to modularize your tests, you could just call zstatus() after each block, as the counters are reset, eg:

void testWeaponSystem(){ std::cout << "Testing weapon systems...\n"; ... zstatus();}void testShields(){ std::cout << "Testing shields...\n"; ... zstatus();}int main(...){ testWeaponSystem(); testShields();}

Nice and easy =)

## Network Stuff

Over the past couple of days I've been looking at some low-level network APIs(so this disregards behemoths like Raknet, etc), in an attempt to find something to start using for a remote debugger/python interface(sorta like a remote telnet session for any projects I may be working on). So obviously step #1 is to find a decent-enough network API for the job, and I vetted three... and eventually chose HawkNL. The reasons being: 1, I have an irrational fear of MS APIs, so WinSock2 was out of the question. And 2, SDL_net documentation is not quite so informative as is necessary. Also, HawkNL won't block on any method, and so didn't require me to write messy multithreading code, which is nice :)

As I started designing an interface for providing a Python interface over a socket, it became pretty obvious that a layer of abstraction over HawkNL was required... so I did what everyone should do.. wrap wrap wrap :D

The interface I've ended up with is quite simple, and doesn't try to do to much, which is usually a problem with any code written for public use.. it tries to do too much. So yeah, it's pretty slim,.. and non-blocking =)

Obviously different applications will have different ways of sending their data, some send it in plain text(ie, IRC), others, it's usually binary data(HTTP,Games). Initially the data goes from the HawkNL wrapper, to the SocketEventManager class, which will process the stream of raw data into a usable form. When it has gather enough raw data to be interpreted(ie, reaching a \n for IRC), the SEM will inform the NetworkEventManager, with news of a chunk of data which can now be processed. I figured two types of SEM would be useful:

1) A plain-text SEM, for text-based protocols, which informs the NEM when a full line of text has been recieved.

PlainTextSEM -> PlainTextNEM

2) A packet SEM, which will identify registered packets by a 2byte ID, and wait until the entire packet is in the buffer before notifying the NEM.

PacketSEM -> PacketNEM

The wrapper only requires that a class be registered with a Socket using a SEM interface, it does not require that a NEM be used, but as the PlainTextSEM and the PacketSEM would be bundled with the HawkNL wrapper, in order to prevent people from having twiddle with the innards of these classes, a NetworkEventManager has been added, to respond to events such as a line of text or complete packet being recieved.

## A warning would be nice

Grrrr....

class X { }class M{ public:  M(X* x) {}}class Y{ private:  M m;  X* x; public:  Y(X* nx):   x(nx),   m(x) {}}

The above code raises an exception when attempting to create a new class Y. The order of attributes is M, X*. In the constructor, x is initialised with nx, then m is initialised with the class attribute x.. this is not the case. Initialisation order is done in order of specification in code,

so the constructor actually executes like so:

Y(X* nx): m(x), x(nx) {}

As specified in C++ standard.

VC++ 2003 does not give any warnings or errors during compilation about using attributes before they've been assigned a value, it'd be helpful if it did :(

## Single-user version control software

Not only is it incredibly easy to set up, installing the correct plugins will give you a simple versioning system for all your projects files. I'm unsure as to the number of cached versions GDS will store for a particular file, but I'm at 8 already, and you presumably won't need much more than that for a single person project. Oh well, this is probably incredibly old news, just thought I'd share it with you guys :)

## Steam engine simulation.

*Wouldn't it be cool if* a physics engine could be used to construct a working steam train? Afaik the components missing from today's physics engines are the notions of temperatures and pressures. Ok, yeah, the whole principle of a steam engine is pressure and temperature, but I think it'd be cool to have a train move with no rules other than those of physics...

On a completely different topic, my 3rd year Comp Sci project/dissertation has been revealed to me(2nd choice of 5):
RKM-1: Detecting Repeated Patterns in Audio

Makes a change from the 3D bandwagon :)

## Trend in maths explanations?

I'm pretty sure I'm not just imagining things(unfortunately) when I talk about explanations given by maths lecturers.. This is what I've noticed:

- Easy stuff is drummed into our heads in great detail, far more than is necessary. The steps in easy calculations are too drawn out, and look almost redundant.
- When it comes to the hard stuff, they're running behind schedule, so it's rushed, it's brief, and we don't have enough time to write decent notes. The steps in harder calculations are either brief, missing, or shrugged over as "same as the easier ones"
- Symbols magically appear in preprepared lecture notes(and in the lectures themselves). Half way through a calculation, an alpha will appear from nowhere, and a factorisation will have occured that makes you go "the hell!?".
- Answers for past papers(to make sure you're doing something right), go something like:
"Basic Textbook"(Note: example similar to question will appear nowhere in the core texts or any of the recommended texts.)
* "As previous"(Note: answer to the previous question was indeed * "Basic Textbook")
* "Sorta like the last one, but not"
Not helpful. NOT HELPFUL AT ALL! If I'm reading the solutions to check my answers, stupid smart-alec answers like that don't help me at all. They may aswell write "LOL ITS DED ESAY LOL" on the front page of the solutions.
- Intellectual obfuscation, "Eigenpairs" suddenly cropped up, I was like "eh?, where'd this come from", turns out it's just a term used to group the Eigenvalues and Eigenvectors.
- omgwtf usage of "Thus", this usually occurs after they've managed to pull an extremely large polynomial out of their ass, then crunch it into something like a / (x2 + 3x - 1)
Note: the a is this alpha I was talking about previously, it just appears like a little bodge-pixie, fixing their horribly broken explanations.
- Inability to create questions that:
a) are on topic
b) are correct
c) have answers available for checking progress
d) if c), have correct answers available
e) are not repetitions of past questions, to make their lives easier, eg:
1) John has a ball sack, it has 3 red balls, and 4 red balls, he asks Jane to rummage around in his ball sack and pick one out at random "SHE DOES NOT GIVE HIM THE BALL BACK!!!111". What is the probability she noticed this cunningly disguised sexual reference to testes.
2) As 1), but she gives him the ball back.
3) As 1), but she takes two balls, gives one back.
3) As 1), but takes two balls, gives two back.
4) As 1), takes all his balls, doesn't give any back.
5) As 1), takes none, walks off.
You get the picture, not only is it tedious, it's annoying.
- Stupidly simple blackboard examples, rock solid assignment work questions. I had a physics teacher that realised this was common practice for maths teachers, and he came up with a practice known as "Giving us the most obnoxious example questions known to man". He wasn't the one to give a 2x2 matrix inversion example on the board, then give us a 7x7 matrix to do in our books, no, he'd do some outrageously stupid 9x9 matrix inversion example, go through it stage by stage, pointing out pitfalls, and asking us to complete parts of the process as we went along. Good stuff. Also, his examples weren't like this(hypothetically):

Invert this matrix:1 2 3 1 2 11 1 2 1 3 11 1 1 1 1 12 1 1 2 1 11 3 1 1 2 13 1 2 1 1 2I mean, for crying out loud.. what's wrong with the numbers 4 and upwards!?!. If I come to look at the working out for that example at a later date, I'll prolly just cry.

## Sorting my act out.

I took time out yesterday to reflect on what I've managed through my many years of coding as a hobby, and it's pretty pathetic really, with respect to projects completed, and knowledge gained. Sure, I know a fair deal in about a dozen languages, but I feel that I really need to sort out my coding discipline, and my level of knowledge about surrounding technologies. My mathematic skills are pretty much non-existent also, *sigh*. With all this realization of my lack of talent and knowledge, I've decided it's time to turn around my lazy attitude.. If I'm going to choose software development to the one thing I'm good at, I should really try to be the best at it. So the plan is:

• 40~ pages of design patterns a day
• 40~ pages of code complete a day
• 1 article a day from GD.net/flipcode/Gamasutra
• part of a computer science past paper/further questions in engineering mathematics book

Hopefully I'll be able to stick to it, so far it's been two days.

## Not sure if this is a good thing...

Recently I've been working like crazy on my second year group project at uni, and i've managed to (inavertently) pull two 80~ hour weeks :( Now, I've managed to get soooo much done, we're definitely in the top couple of groups, but it's been so tiring, and my diet has temporarily shifted to consist of pizza and dr.pepper :( So I think some sort of fitness regieme is in order! Overall, it's been enjoyable, apart from milestone builds and final cries of "One mo whilst I just change something" (weep).

## Nine Inch Nails

Omg. well, I went to go and see Trent and his posse perform at the Astoria in London on the 30th, and it was so amazing I actually nearly passed out from excitement(and lack of oxygen/water), anyway, yeah, it was cool.. and all you NIN fans out there that didn't bother/haven't bothered to get tickets to see them perform live, SHAME ON YOU!

ps. The dresden dolls are possibly the best supporting band I've ever seen.

pps. Oh yeah, NIN rules, and i've pressed some button in firefox and all my images have disappeared and my text has gone mega-big, uh oh.

## SDL Project Generator

MAKEPROJ v1.0 : Get it here

I know how many people hate so much to faff around with the project settings just to get a quick prototype SDL project to compile... and here is the answer(almost). You can create a new project straight from a template, specifying which libraries you want to use, whether you want a console window visible or not, and if you want to use OpenGL for rendering instead of SDL blitting.

Libraries supported:

• SDL_gfx

• SDL_mixer

• SDL_net

• SDL_image

Generates:

• (projectname).dsp

• main.cpp (with init/shutdown code respective of libraries chosen)

• version.rc (with some fields filled in)

## Exams *

I dislike the majority of exams, they want me to regurgitate whatever I've been reading exactly as it was in the text book, and it's not particularly interesting either. I'm looking forward to my Systems Analysis and Design exam tomorrow, which is strange.. Primarily because from the past papers I've seen I can actually apply knowledge, not just repeat information. Anyway.. back to my Design Patterns book(yum).

## Yay Pressies!

C++ Fourth Edition (McGraw Hill)
Design Patterns
Python In A Nutshell (O'Reilly)
The C++ Programming Language

Nothing better than eating through 2 months of food lazing out on the sofa at christmas half-watching a war film and reading a book on Design Patterns :)

## Daydream In Blue

me ..<240miles>.. her, go figure :( She kissed another guy, and considers our relationship over, she wants to be "free and single", ...I'd much rather have one person for more than just one night that I can have a good time with. Oh well, there's "plenty more fish in the sea", whoever first said that line needs to be executed in public, I also suspect he was the guy that came up with "it's for the best", FOR THE BEST!?, sounds more like you want to just flirt around and not have to give a shit about my feelings. I'm angry, and hurt, and I don't like it one bit.

## Visual Assist X

My trial version ran out :( And I felt so lonely... and naked... I couldn't look at myself in the mirror, or leave the house...I felt the world was ashamed of me for having crap Intellisense... ThenIboughtVAXandeverybodywashappytheend.

## Python MUD

Through wanting to learn Python I've taken up a side project of developing a MUD server. Nothing much to show at the moment, but the code will be available from my webspace as I continue developing it. Note: There is *no* design that is going into this project, it's a totally Ad-Lib thing :)

## Advent Calendar Yumminess

Well my windows install decided to bork on me, which wasn't nice, and I don't have the install cd with me, it's at home :( But fortunately thanks to the very kind people at Microsoft, they gave me a free copy, well, my CompSci department did, yay!!
*group hug with Zanthos and the Academic Alliance people*
Although I now have XP.. instead of 2000, but what the hell, I'd installed 2000 on two machines so at least now it's 100% legit, not that people would buy a copy of 2000 for EVERY machine they have in their bedroom :)

"An error occured that should never occur."(Roughly translated to...'Your OS has just shat it's pants') is what Win2000 told me...doesn't sound like it's an easily fixable problem :) the DHCP service wouldn't load, and neither would the Network Interface service, and the surprising thing is, I was only using firefox at the time it keeled over.

## Limbo

When you feel too ill to do anything, and feel so bored you want to do something, that's limbo.. :(

## Lab

Hmm, this seems to have appeared from nowhere..
Map Generator

It's a quasi-lame badly coded 2D map generator, notice the file names =) This is only supposed to be a little prototype for something far more advanced, no, really :P For 45mins work it's not that bad. Anyway, Prolog lab class...

## Yay!

First post! Yay! :)

Well I've finally managed to get myself this shiny GDNet+ subscription, and am so glad I did because I've fallen in love with the Christmas site theme =) My SDL/TrueType/OpenGL font system is coming along swimmingly, got Italic and multi-coloured text output to be finished and tested then I can put 0.0.0.0.0.1a RC1 out for criticism. I hate re-inventing the wheel usually, but it seems nobody has made any attempt to create a publically available OpenGL font system that:

a) Works
b) Is remotely supported
c) Uses something other than damned-awful PNG/TGA premade fonts
d) ...Custom font formats are even worse