August 30, 2004

Grrr!!!

Something should be made know as soon as possible. Like on the front cover Big Java. After bashing out a lot of repetitive code to access class variables by name, we were told there is a method in Object that does it!!

*beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep*

I refer to:
getClass

public final Class getClass()

Returns the runtime class of an object. That Class object is the object that is locked by static synchronized methods of the represented class.


Returns:
the object of type Class that represents the runtime class of the object.


And looking up the class Class (hehe), we are advised of the following methods:
getDeclaredField(String name)
          Returns a Field object that reflects the specified declared field of the class or interface represented by this Class object.

 Field[]
getDeclaredFields()
          Returns an array of Field objects reflecting all the fields declared by the class or interface represented by this Class object.
 Field
getField(String name)
          Returns a Field object that reflects the specified public member field of the class or interface represented by this Class object.

 Field[]
getFields()
          Returns an array containing Field objects reflecting all the accessible public fields of the class or interface represented by this Class object.


Field class has methods to converting the field into any of java's primatives as well as strings. So our code could have been a LOT smaller!

Grr....

Well now hopefully the world knows. Personally I never expected such high level abstraction, but hey, there it is...

Cheers,
Steve

August 17, 2004

Tumbolia

From slashbot.
...computers are built from something other than matter and occupy something
other than space...

You could actualy argue this (well I could). See, a computer has its physical hardware, yes, but tell me, where is the software? It has a representation in space and matter, but the actual alogrithm? the logic? the ideas? well...

You know why I like maths? Well one of the reasons is that it's always right. And it always has been. And it always will be. Because the angles of a triangle add up to 180: if they didn't it wouldn't be a triangle. The derivate of e^x is e^x, because that's waht e means. In science, your theories change constantly because they have their basis solely in the physical world: science cannot be separated from the world we perceive around us. Maths has isomorphisms in the physical world, but even if there were no physical world, it would still be. And it would still be true, and still right, and, at the risk of appearing completely eccentric, beautiful.



M.
(who has never cared that other people think she's strange)

August 16, 2004

Code updated...

Ok, that's the latest version of the code, hope that link is valid, am too tired to check (4:30am start tomorrow...argh). Otherwise you can find it on my uni website.

M.

The piece falling in place

Isn't it lovely when it just works?! Latest code is up, GUI components are now playing nicely!

Querying will be done when I have finished my tutorials/lab for tomorrow.

Cheers,
Steve

New shiny lines of my mind

New source code is up. GUI related methods for both vessel and passengervessel are done, the recursive descend parser has been fixed, xml writer has been written and tested slightly, xml parser/core have been modified to suit.

I better sleep before I do something silly like delete all the source files...

Night,
Steve

August 09, 2004

Even more gui...

Hurrah! The GUI is finished - until I find something wrong with it, that is. It can create, delete and edit ships, or, at least, it will be able to once the methods are written in Vessel and its subclasses. At the moment the only choice for creating a vessel is PassengerVessel, but as soon as more classes' edit(), display() and change() methods are written, more will be added to the list. Updated files are linked above. Steve, check updated Vessel dummy class for information on the change() method I need, since you weren't online tonight for me to tell you. :P

Random fact of the day:
The Japanese language had no word for 'privacy' before they encountered Europeans. The current word is simply an adaptation of the English word, written in katakana (sp?), the script used for adopted foreign words.


M.

August 08, 2004

Gooey

Well I have discovered java is not as perfect as it thinks it is. I create a window of width 750 and height 650. Then I create three panels inside it. Two of them are currently set at a height of 3000. They take up about a sixth of the frame each. Go figure.
Also, I would like to make a public complaint about BoxLayout and its power-drunk meddling with the sizes of my components. This despot must be deposed forthwith!
On the plus side, glue is the most wonderful component ever invented.
The GUI is well underway. So far I've done the main frame, functions for closing the program, and functions for getting data from the DataStore object and displaying it in a table. With a custom table model, created at the expense of much frustration on my part. But it's good now. :)

On a sadder note, my sincere sympathies go out to Jana Pittman. :( A tragic day for her.


M.

Object Location Table

Object Location Table (OLT) code is now fully operational :-) Deleted records forms a link list inside the OLT file, with insertion and removal always at the front, so its also a stack.
  • Creating the table from scratch took 30703 ms, just over half a minute.
  • Looking up 100 random records by ID took 313 ms thanks to binary search
  • Modifying the hash and offset of the same 100 random records took 109 ms. This result is misleading since the benchmarking code consists of recording the time before the loop, and working out the difference after. So all the printing function the lookup loop does contributes to the time. In reality I expect lookup to be around 50ms.
  • Deleting the same 100 records took 609 ms, again printing was done for debugging purposes, actual time would be around the same as modification.
  • Surprisingly inserting 100 records with new hash and offsets only took 188 ms, despite the fact the internal linklist is updated and debugging output was printed. File size did not change before and after delete/insert operations, this combined with debugging output indicates deleted records are being fully re-used.
Over all the performance of the object location table itself is quite satisfactory, and should not be a bottle neck in the performance of the system when scaled to 500,000 objects.

Now for a little doom3, then its off to write the datastore and vessle code.

Cheers,
Steve




August 07, 2004

System design

Sometimes one does very silly things. For example, I decided to merge the ID and offset fields in the object location table. Good idea at the time: smaller files. Then we ran into the problem of how to deal with deleted records, and eventually a dirty method was used: we mark it as deleted, and forget about it. A cleanup method was required for this, to clean out orphaned records. Method had a complexity of O(n^2/2).

A good friend of mine, Ycros to be exact, was reading up on file system design. This turned out to be extremely fortunate for me. He suggested a linked list of deleted records be constructed inside the OLT. Smart. Records already have an offset field, just set it to the next avaliable record (ie, a deleted one). Aha! no need for that terrible O(n^2/2) function to efficiently use diskspace!

The problem is, since I tied ID and offset together, and insertions into the XML file are indeed at the end, it effectively meant the records in the OLT have to reflect the ordering of objects in the XML file. Bad steve!

Solution is simple: split ID and offset apart again, and re-use offsets of deleted records. *sigh* More back tracking and coding. System design document has been updated to reflect this change in design :)

*Yawn* work tomorrow, good night!
Steve

August 06, 2004

The Second Law of Thermodynamics

In the interest of entropy generation, here are some truly absurd words bound to confuse and ultimately disorder all to whom they are said:

(85) TAUMATA­WHAKA­TANGI­HANGA­KOAUAU­O­TAMATEA­TURIPUKA
KA­PIKI­MAUNGA­HORO­NUKU­POKAI­WHENUA­KITANA­TAHU
A hill in New Zealand. This Maori name was in general use, but is now generally
abbreviated to Taumata. The name means: the summit of the hill, where Tamatea,
who is known as the land eater, slid down, climbed up and swallowed mountains,
played on his nose flute to his loved one.

(30) HIPPOPOTO­MONSTRO­SESQUIPED­AL­IAN = pertaining to a
very long word.

(29) FLOCCI­NAUCINI­HILIPIL­IFICATION = an estimation of
something as worthless.This is the longest word in the first edition of the
Oxford English Dictionary. Interestingly the most common letter in English, E,
does not appear in this word at all, whilst I occurs a total of nine times. The
word dates back to 1741.

muhaha....take that, ye proponents of order!

M.

Lemniscate

Did you know that the symbol for infinity (that sideways 8 thingy) is called a lemniscate?
The mathematical symbol for infinity, also known as a lemniscate. It was devised in 1655 by mathemetician John Wallis, and named lemniscus, ribbon, by Bernoulli about forty years later.
M.

Object Location Table

OLT Code is almost complete. Should be done tomorrow morning before I leave for uni.

`night,
Steve

August 05, 2004

Meet emma

My loyal readers *cough* cyber stalkers *cough*, meet emma, the new co-editor and entropy generator of journey's end :)

No doubt you will learn much from her (psst she is a math major) insights in to life :)

Cheers and enjoy,
Steve

and a random latin quote

"Stultum facit fortuna quem vult perdere." - Syrus, 'Maxims'

hehe try and find out what it means.

M.

1 thing I learnt today...

Do not set an ecryption program to 5000 bits without knowing how to terminate it.


M.

XML Specification

XML specification for soft1902 is up. As before, feel free to comment and point out design pit-falls :)

Cheers,
Steve

August 04, 2004

Keeping the pool clean

If you are the owner of a pool, and want to catch those inconsiderate people using it as a loo, try this little trick from atomic:
If you want to catch out people who piss in your pool, just add 5 ppm of phenolphthaleine into the water... it stays perfectly clear UNTIL someone lets one go - then the water around the culprit turns bright red!
Been a lazy evening, just relaxed and wrote/read documentation. Oh, here is a little gem for you. My good friend and team mate victor wrote this when our tutor requested "usage stories" from us ;)
After the tragic events of the 911 plane hijackings and the atrocious acts of terrorism that followed around the world, the United Nations unanimously agreed to the need of a super database that is able to keep track of all ships in the world both military and commercial. Its purpose is purely to provide instant access for the peace keepers of the world to detailed information on each and every vessel on the face of the planet and search for terrorist activities that may threaten world peace. This database and its hyper-sensitive information will only be accessible to a handful of secret international government agencies whose job is to search and destroy all active and inactive terrorist cells.
Cheers,
Steve

System design and invading Switzerland

Emma, victor, the current system design has been typed up. If I missed anything, or you want to make suggestions, just comment :)

On a related note, came across the following in slashdot, on why Switzerland is a hard country to invade:

Switzerland takes theis to the extreme, actually requiring all their households to have a government issued machine gun, which their citizens learn how to use during manditory military service.
Can some one confirm/deny?

Back to brainstorming.

Cheers,
Steve

ibook, glasses, yet another rdp

Paid the $300 desposite for my ibook today, should have it in 2 weeks :D Mum came to campus and picked out a new frame for me... she HAD to pick the $300 dollar friends. Can't for the life of me see why they are $300. :-S

Finally wrote the proper recursive descent parser. Wrote it all in one hit, and compiled once at the end. And guess what? Besides a few superficial bugs, it works :-) All the test cases I have thrown against it didn't manage to break it. I'll read up on javascript a little tomorrow night, and see if I can put up a version people can try and break.

*yawn* Better sleep soon, might actually manage a whole night, and wake up in time, unlike on monday when I got up late, and ran to the station in less then 2 minutes (new record), then got on the train, and promptly suffered from lack of oxygen as my legs stopped pumping blood, and my heart took all the load. Almost blacked out. That was an interesting experience. The edge of my vision faded black, I lost perhaps 30% of my vision. Not doing that again anytime soon.

'Night,
Steve

August 01, 2004

New code

New code. Testing with
boolean == false && ((3!=2 || 4==4) || (6-3)*(7-6) == (5*8)-(4*2*5)+3)
revealed a small bug I left when I re-wrote the function to determine if an expression is an atom.

Now I better sleep, early lectures, *sigh*

Cheers,
Steve

Recursion: n, see recursion

I had a lot of stuff to write about... but all that has been pushed out of my head by something called recursive descent parser. That thing soft1902 is suppose to teach me about.

The thing is see, I just finnished writting mine. With c compatible syntax, type checking, arithematic, and object descent property retrival (I made that one up). So much for that ;-)

No doubt testing will turn up bugs, but for now, I am too happy, and lazy, to extensively test it. Other people can do it. For me, its like throwing a newly made piece of art against a wall to see just how much force is required to break it. Eventually, but only after I get bored with it :-)

For my team mates, the above is undoublty good news. Now we are, oh, 10 weeks ahead. XMLCore now has query functionality, and parses files, with access control, and the ability to make objects inside objects inside objects inside... you get the idea :)

Now, lets see if I can dredge up other stuff from the past few days....
  • Shrek2: love it, just as good as the first one. Puss in boots was of course the favorite
  • Theater Sports: saw in Thursday @ Manning house, absolute fantastic!
  • Glasses: eyes are getting worst :-( 650/750 in my left and right eyes respectively. ~360 for new glasses.
I had some insightful stuff to say, but whatever it might have been, writting that rdp has pushed it all out of my head... so the world will just have to be a better place for a while more :-)

Emma and victor, the url to the latest Earth package is linked in the title.

Cheers,
Steve