Search This Blog

Friday, March 02, 2007

Philip K's Java Lunar adventures-kinda not!

Howdy - just a quick word on the eclectic mix of photo's book covers etc., - Lunar eclipse and some Philip K Dick photo's - yes that is his gravestone and no it does not say here lies a dick - although a quick glance gives one that impression, perhaps - the rest was all about Artificial Intelligence and picked up my text book image and a range of other odds and ends . . .


Lunar eclipse on 3 March

just an advance warning! Who knows what may happen . . . lol - photo courtesy of NASA - see link above - all the technical jargon - just hope for clear skies.

Other thing of interest in the interim - today 2 March is the day 25 years ago that the switched off Philip K Dick's life support system - a prolific science fiction author - whom I have not read enough of - a very interesting and paranoia person - seemed to be able to see far beyond his own time - died a pauper - and yet wrote some of best sci-fi seldom surpassed even today.

What else - will pick up as per normal later today - being punished for something - so will have plenty of time tonight to write blog . . . lol

Must mention all hell breaking loose in Barrwoodhill - communications / music system / someone seems to have zapped my flat - everything that can go wrong is going wrong - at the moment my cd player is playing up - telephone gave up on Wednesday evening - I left my mobile on train - it cuts out every 15 minutes or so . . . so roll on the lunar eclipse maybe it will be back to normal after that . . .lol

Well I am suddenly quite taken with writing as in pen to paper - sitting in Queen Street station now awaiting my train home - so I thought I'll use the time and write my blog - which I am now typing up . . . I think this writing thing has something to do with problems (logic problems) that I have been forced to use pen and paper to solve - I actually have a white board and I need to buy some marker pens because it would probably work just as well if not better as you can stand back and look at it and see if it makes sense - so this new found like, in my opinion, is somehow linked to this . . . so I am capturing my thoughts as I go along (which is shorthand for I'm making this up as I go along). Anyway uni week has now finished - I was assessed on my Java practical this morning - (I think I described it for you last week) - Bottom line spent most of last night worrying / trying to work out how to sort a LinkedList - only to discover that I was looking at the wrong sort algorithm - I was doing a BubbleSort instead of a MergeSort - how did that happen - I think it may have something to do with me paying scant regard to the specs . . .and basically doing my own thing . . . lol. SO I arrived frustrated at the lab this morning - coffee in hand complaining bitterly that I couldn't get this damn thing to work - cut a long story short - Chris, God bless him, helped me sort it - I had the other 80% running and had tested it and it was working fine - it should be Colin (my Java instructor) and I had spent almost 2 hours the day before going through everything - changing / testing / changing again etc., - just to ensure all the methods were actually working - he didn't write it all - he left me during the course of the day and I sorted out a few things and we carried on again. The thing about Colin (a Natural teacher - they are far and few between - ask me that is my line of business) he writes / thinks code at your level - and also is flexible / knowledgeable to adjust to your understanding. For example I had written my LinkedList code with a header and also used a tail and then added a addTail() method - which really means anything you add will to the end (tail) of your list - So if your input is 1, 2, 3 - the order the programme will print it out for you is 1,2, 3 - Amazing (I can hear you say - a 1 year course to teach him this!) but the difference is if you add to the beginning of the list every time - and you then printed it out you would get 3, 2, 1 . . . . . make sense. Now here is the code - to do exactly that i.e. add everything to the end of the list . . . . which is easy enough - basically whatever your input, create a new Node (which will store whatever it is you put in) and just bung it in at the back of the list . . all we have to be careful of is an initial state where the List is empty . . . as head pointer would then point to the single element this new Node tail

public void addTail(Object o)
{
Node n = new Node(o,null);
if (isEmpty())
{
head = n;
tail = n;
}
else
{
tail.setNext(n);
tail = n;
}
elementCount++;
}

When it came to our assessment - guy came to me - straight after Chris (whom I was sitting next to and asked if I was ready - remember at this stage my mergeSort method had not been written . . . so I am like "Erm - not yet" - so he moved on . . . & Chris and I finished off
code - which from memory is something like this:
public void mergeSort (List input, List one, List two)
{
List sortTemp1 = new JLinkList;
List sortTemp2 = new JLinkList;

if(input.listSize() <= 0) { return input; } if (sortTemp1.listSize() <=0) { return sortTemp2;
}
if(sortTemp2.listSize() <=0) { return sortTemp1;
}
merge(mergeSort()(sortTemp1, sortTemp2);
return returnList;
}


I'll check - not sure about the last statement - but that is it I think. Anyway about 15 minutes later I beckoned the assessor across - he got me to explain how that method worked asked me to demonstrate - and explain some other choices and then deducted a point because mergeSort did not have an explanation - so it did stick out a bit - he said it looked as if it was something that had just quickly been added on - in all fairness I explained that I had been working on the incorrect algorithm and that I had just added it that morning. Noting happens by accident - I had been working furiously away the day before and he had come up to me and asked me how it was going - I actually didn't recognise him and wondered if he thought I was part of some other lab then it dawned on me who he was and that he had been referring to the Java . . . so we had a brief chat and he asked me why I was using an enumerator an a couple of other questions and made a few suggestions then he was off . . . I saw him looking for the enumerator and checking some of what he had seen the day before - most of which was either gone or streamlined - so let me tell you nothing happens by accident - there are no coincidences.

Lord Linlithgow raved on as usual - on both Thursday and Friday - he had originally meant to finish today (Friday 2 March) - if he carries on like this he will be lecturing deep into June sometime (classes officially finish end of April) - although many may finish prior to Easter - leaving students with assignments and them some time to recuperate after another semester and before all the marking and paperwork starts again. He really does ramble on at times - a very nice chap - he always has a few boxes of transparencies - and they must be in the correct order - he is meticulous about this - albeit (my fav word at moment) we are being given a mixture of 2nd and 3rd year plus some original material . . . so it might be a slide from this box followed by 1 from that box and then another from the box over there - so you can imagine an administrative nightmare but Lord Lithy is up for it - it looks to me as if they each have their own special backing sheet as well as many a lecture has ground to a halt as he sorts out one box or another or realises that the slide that he needs is not in any of the three boxes that he has with him and he runs off to fetch box number 4 . . . which naturally adds to his dilemma . . .lol. He actually had some overlays i.e. pictures on 3 different slides which you put up and then the story develops with each new slide - kind of like animation - quite impressive really compared to plain hand written text on a slide - nay revolutionary I say - if only he got the full slide on the screen - the projector too far away from the screen so about 75% is now on the screen (I got their early and moved the table) but it most annoying when you cant see what is being referred to . . .

We were given the topics for our BIG Java project - Lord Lithy was at lengths to tell us there are 3 we can choose from and then shared 5 with us - but I think that was a misunderstanding - I am interested in the Spell checker - it will work with the practical we have just finished and should work if I understand the concept similar to your mobile phone predictive text in that the programme should recognise any word but also allow you to add words to the dictionary . . . seems interesting and initial problem will be creating the dictionary.

We never had anything to hand in for DUS (Designing Usable Systems) . . . but we have double to hand in next week - 4 separate things to be handed in and we are how many in team - right so that should be 1 thing each . . . My chances of doing a research paper on M-Learning now seems remote as we have suddenly changed how the topics are allocated - it was going to be each individuals choose what they want to do and then groups would be formed around choices . . .whereas now all of a sudden it is all about the existing groups deciding amongst themselves what they want to do - we each have a vote and we are 4 members - Murv already expressed an interest in web browsing on mobile devices which leaves David & Nicole - Nicole said she had made a choice and I lost count of how many times David asked her - eight times at least but she was saying nothing ???? so I don't know what that means but as I say looks remote chance now. I need to look at the other topics to see (as Michelle suggested) whether or not I ma able to stretch things to include M-Learning just
within a different context.

Beginning to realise how much work this DUS subject is - every week (barring this week) something to hand in - you have to keep a scrap book as well - plus rate / mark the people in your own group every week. Your research paper - at least 4 pages and a 15 minute lecture / presentation. Then 2 exams - 1 covering the theoretical aspects the text book and 1 covering the research topics.

AI - Artificial Intelligence kicked off with us moving on to the third topic - Planning - all about for example a robot; rooms and boxes - the robot having to perhaps move boxes around and stack them somewhere . . . It comes complete with its own language / syntax i.e.
(at ?r ?b1) which would tell you the robot was at box 1 - of course r and b1 - have to be defined so that everyone knows what each variable stands for . . .

What we have is whole lot of variables - a set of truths then a set of goals. Your job is to list a sequence of actions which will allow you to achieve your goal - each action may change your existing set of conditions / environment.
Domain
(:types object room robot)
?b1 ?b2 ?b3 - boxes;
?Rm1 ?Rm2 ?Rm3 ?Rm4 - rooms
?d1 ?d2 - doors
?r - robot

Goal - get all the boxes stacked in the following sequence ?b1 ?b3 ?b2 in Rm1

You now have to work out what actions you need to take to achieve you goal

Early days but I think you'll get the idea - and can quite easily get very involved.

"...an artificial intelligence system was placed on board to plan and execute spacecraft activities. In contrast to remote control, this sophisticated set of computer programs acts as an agent of the operations team on board the remote spacecraft. Rather than have humans do the detailed planning necessary to carry out desired tasks, remote agent will formulate its own plans, using high level goals provided by the operations team....Remote agent, like the other high-risk technologies that have now been tested on DS1, promises to make space exploration of the future more productive and more exciting while staying within NASA's limited budget."

- from NASA's site about Remote Agents

Otherwise seems to have been a hell of a long week - Judi busy until tomorrow morning - so can't come over until about 12h00 - so not seeing each other until Sat afternoon - and staying overnight. I have been over to her place from a Friday and then left straight for uni on a Monday morning from her place - not really practical for Judi to do something like that - would be nice though . . ah well there's a thought.

A feast of rugby over the weekend - Scotland Vs Italy - which should logically have given only one result - still can't quite get over it - a couple of freak interceptions saw Italy leading by 24 points to 0 in the first 10 minutes. Scotland left themselves with the Italian alps to climb and whose knows them better than the Italians - they defended the high ground well and the rest is history. This after the highs for Scotland of beating both England and France . . . lost to Italy (apologies to all Italians out there). Ireland thoroughly outplayed England and will be rue last weeks results where they had France (who beat Wales on Saturday) in the bag and then in injury time allowed them to snatch victory . . . so looks like France will win the 6 nations - so far unbeaten.

Graeme, my nephew, returned to South Africa on Tuesday - we hit Nando's @ X-treme on Sunday night a chicken eating frenzy ensued - had a few Brazilian beers and a relatively good night was had by all . . .he was out mostly for my Mum's 80th - He did not particularly like the Scottish way of life and I think even although he has enjoyed his stay with his mother I think he will be glad to get back. He took some of Arran's shirts and ties back for him. Speaking of which now that I am full-time student I qualify for rebate on my council tax and you do not pay any if you live alone. SO with Arran off back to South Africa I thought - fine time for me to sort this out - sent Council a letter with a copy of Arran's ticket - would they not right back an tell me they want the following documents:
1) A copy of Arran's lease agreement in South
2) a copy of his visa
3) proof that his bank statements are being posted / sent to South Africa

they were also kind enough to point out that they would not consider my application until such time as they were in receipt of all the above documents. Strange that when I wrote to them that he had arrived they immediately adjusted my council tax - nothing needed - no documentary proof . . . .lol

Stop Press! - Dumbarton enters the 21st century - we now have a Marks & Spencer's down at the local shopping centre - albeit (there's that word again) - a smaller version . . . Oh watch out Oh Judi'est one - what culinary delights might I be conjuring up now . . . the mind boggles . . . . not to mention the waist-line . . . lol.

Anyway that was my last week - how was yours . . . . .?
PS - From What the rest of the World Knows about South Africa - forum

Q: Will I be able to speek English most places I go? (USA)

A: Yes, but you'll have to learn it first.

Q: I was in South Africa in 1969, and I want to contact the girl I dated while I was staying in Hillbrow. Can you help? (USA)

A: Yes, and you will still have to pay her by the hour.

1 comment:

Anonymous said...

Hillbrow wasn't like that 50 years ago when I lived there !!! Mags