Wow, almost 5 months

November 17, 2008

First post in almost 5 months. Yeah!
I really should get back into the swing of writing this thing.

Well 4th has been happening and I’m happily happening with it. I will (hopefully and doubtfully) write about each of the modules I’m doing, but thats for another day. So a few things for today.

Dissertation – Map Reduce in Java
Not going to say much about this yet. Check out my requirements document (which actually doesn’t really cover the requirements much) here. There will be another deliverable due in three weeks, I’ll also be posting that one here.

Finally got my head around the time dilation when traveling at relativistic velocities. I never got this when they banged on about it physics (it was first year, I hardly made a lecture back in those heady days) but the book I’ve just finished (Joe Hadleman’s Forever War) goes on about it, explaining the effects of it but never going into the science behind it. I reckon linking up the two has helped me see the light. Well, relatively. Any way I’ve got the two sequels to read through now.

Kind of forgot why I started this blog. I think my first post said that it had something to do with cheese. Oh well. Merry Pip!


Learning new things…

June 24, 2008

There are a couple of new things that I’ve learnt since Uni ended.

The first I picked up for from the project I’m doing for the summer. It’s based off of other peoples code so I’ve been looking through that. It’s written in C# which is something I’ve never had any cause to look at or read before, so when looking at the code there were things that I thought of as strange C# syntaxes but were actually nice little hacks. One of these things was ClassName.Instance.method(). At first I thought this was absolute madness and sheer C# witchery, but it is a really clever little hack. What it does is calls Instance which is a static method in the class ClassName (but works just as well with a static variable) which returns an instance of that class. This is great if a program only uses a singe instance of a class. Instead of passing references of the object to all the other objects which need it, the code just needs to call ClassName.Instance to get the instance of it. This means if something gets added later on then you don’t have to worry about maybe having to change the constructor, parameters and fields, you can just add the one line you need to get the instance. See the bottom of this post for an example in Java.

The second thing I’ve learnt is something I’ve always though should be possible through using interfaces in Java and it turns out I was right. This is the joys and wonders of dynamic class loading. I’ve always thought that there must be a way to add new functionality by changing a class that implements the same interface that the program uses without having to recompile anything. Today I decided to look into how to do this properly. A few things brought this investigation on. I’ve been playing about with some Perl and have thoroughly enjoyed being to use normal console commands by wrapping text in “’s, this is pure genius on Perls part. The other thig that brought this on was that the C# code I was given did this, although it used subclasses instead of interfaces (does C# have interfaces?) and some sort of calls to an assembly class. Any way this is done in Java by using Class.forName(“class name”).newInstance().
I think this a great tool and I show an example in the code below.

public class FunWithJava{

public static FunWithJava instance = new FunWithJava();

public static FunWithJava Instance(){
return instance;
}

public int val = 4;

public static void main(String[] args){
try{
//FWJ is an interface. I made three classes that implement it.
//Specifiy the name of the class you want on the command line
FWJ j = (FWJ)(Class.forName(args[0]).newInstance());
Instance().inc();
instance.inc();
instance.out(instance.val, j.getValue());
}
catch(Exception e){}
}

public void inc(){
val++;
}

public void out(int x, int y){
System.out.println(x + ” ” + y);
}

}


XML Parsing

June 19, 2008

Currently writing a XML parser as part of a feed aggerator.

It’s the first sort of project that I’ve done in a while just for myself. So I’ve got free choice of what language to use and how to design it. So first off all I went with a tree to represent a XML document so if I’m using a tree I’ll be using Java for the automatic memory allocation. Java however is not perfect for this. I’m missing using regular expressions (I know that they are burried in Java somewhere, but I can’t be bothered digging) so I thought that Perl would be good as a front end as a lexical anaylser, I hear good things about it’s String manipulation. However I don’t know any Perl so I’m just sticking it out in Java for now.

I’ll upload stuff when it’s done, if I ever finish, I have a habit of just stopping stuff halfway through. Let’s just say I’ll do it tomorrow…


The end of the year…

June 14, 2008

On Third Year…
Well that’s 3 years of Uni done with and I’ve earned an Ordinary BSc in Computer Science. That’s right. Gordon Govan, Computer Scientist. It seems to have all gone so quickly, have I really learnt enough to become a professional in my field? I’d hope so. I know that just about anything can be programmed and that it is just a matter of time and effort to develop a solution. It’s just coming up with quick, effective and adaptable solution that is the tricky part. Well I’ve still got another 2 years in Uni to go to get my MEng in Software Engineering and that includes an industrial placement as well. So I think that in two years time I’ll be much more ready and confident to step out into the real world and get a proper job, although ideally I’d just spend my life in the grandiose world of academia.
3rd year has been the best so far. The stuff that we have learnt you can see having very strong uses in industry, so I probably could go out and blag my way through a job, although I might need some C++ first. The Uni has been very good at teaching us the ideas behind things and then leaving us to fill in the gaps they leave. I’d say C++ is a good example of this. C++ seems to be one of the most common languages used in industry, but the Uni hasn’t taught us any. What they have taught us are good Object Oriented design principles, a wide selection of algorithms and data structures, and knowledge about how computers understand languages. All this means that if I wanted to learn C++ then I have all the background needed to pick it up in a short space of time. I feel that this is a much better approach then just teaching us the most common language and leaving us in the dark with the rest. As in most of computer science a high level, modular approach is better. They taught us that as well.

On the exams…
The exams went in okay. Compilers was good, AI was decent and Graphics was a gift. I had really enjoyed the graphics module and the exam was a perfect way just to wrap it up. A perfect end to the whole year in fact.

On the Group Project…
So the final Group Project event was yesterday, a meeting with Nick Taylor. We got our percentage for the group project, a respectable 70%, that’s first territory. Very pleased with the 70% after the demonstration had fallen apart. It was a short meeting, Nick just explaining how to end the group experience saying stuff like have a meeting and discuss each others weaknesses. So we went to this meeting afterwards so we went down to the Lectern (sadly soon to be closed for good) and like all our meetings it started out with good intentions and then just ended as random babbling, what a team. The group project really was a good teacher, one of the most illuminating parts of the course and it was good to be put in with such a good load of lads.

Looking to the holidays…
So I’ve got a week off before I start this summer project, so I’m taking time to go back west and visit my parents, I’m on a train to Glasgow as I write this (I love my eeePC). And then back through to Edinburgh to sort out all my notes from this term, a task I always dread and can spread it out to a whole afternoon. I’ll also need to get some background reading done before meeting Ruth.

Looking to 4th year…
4th year will be coming up in 13 weeks and I’m already putting a fair amount of thought towards it. Next year is also when Heriot-Watt changes from terms to semesters so many parts of the course are being moved about. The biggest change to effect me is that the MEng now do their dissertations in 4th year not 5th year. When we were talking to some of the existing 5th years they were saying that is was good to do your dissertation in 5th year for a number of reasons: you’ve got another years experience under your belt; you’ll have seen your friends on CS do it in their 4th year and learn from that; many of the ideas for the dissertations come from the industrial placement that has now moved to 5th year. I always thought that handing in your dissertation was like saying “Yes, that’s it, I’m finished at University”, but now we have another year. Oh well, we’ll see how it goes. Also there are two list to chose optional modules from, one for each semester but we only get one option from the first but it has so many good options, perhaps they’ll let us do 5 modules in one semester and 3 in the second…


And Then There Were None…

June 6, 2008

…well one, but thats not the name of the song. Yes thats right one coursework left. The essay I was doing on computer crime and identity was going painfully slow, yesterday I averaged about a word a minute, but today things really picked up as I got into a bit of a stride. I wrote so much I even had to take a section on cyber stalking out, it was a rubbishy section, so who cares. I didn’t really learn much from the essay, apart from how hard it is to find decent case studies, most of what I wrote was based on a few media articles and a few assumptions (I do this a lot, make assumptions based on very little, normally it ends quite well, other times…) so the references at the end were a bit of a mess. Another source of information was stuff I’ve picked up over the past few years that were a right pain to find proof of online. What I have learned from this is that when doing an essay do the research first, it’s not an afterthought thing you do when you find your self low on references. Here is a link to the essay if you wish to read.

AI is the only piece of coursework left and the dealine has been pushed back to Tuesday, so I’ve decided to take advantage of this. As the spec is a little bit vague in places there must be about infinte ways to complete it, so I’m going to do them all. Well a few. I’ve come up with five ideas for solutions and I’ve implemented 3 with the two harder ones still to do. I plan to test them all and get some good output figures and use those in the report. I’ll find it much easier to compare data like that than waffleing on for a while about some stuff.

Also when talking about the AI yesterday we were talking about the random movement based solution versus the march around the outside one. The march around the outside had the advantage of being much more efficent than the random based one, but if the layout of the enviroment was to change such that things were no longer on the wall then this method would not solve the problem. The random movement method is slower but can complete a solution in any environment. Note I say can, this is where the argument started. I said that there is no guarentee that the program would terminate, there is a nigh on biblical chance of this happening but it is a possibility. I was the only one who took this view and people kept on arguing and I admit they had me turned and I forgot about it, until Richard posted this explaing the problem a bit better. Well I follow most of what he says, but let me put it my way…

If the program he describes runs for a minute, what are the odds of it having terminated. A computer could give me those odds, it would be large but not quite 1. What if it were to run for 10 minutes. Again the computer could give me those odds and again there would still be a chance that it would still be running. What if it were to run for an hour, a week, a year, an eternity. Well again the chance of it still not having terminated after a year is still there, even though by now it will be astronomically small, but the problem comes when thinking about eternity. Could I imagine, having seen the simulation complete hundreds of times, that there would be a run that would never stop? Well no I can’t imagine that but I do belive that can happen and in a way I hope my words can help other people understand this aswell. Any comments or contradictions would be more than appreciated but I do hope I’m right on this one.

I think one of the reasons that I had backed down on this one is that I struggle to understand what I’m thinking and the process that gets me there and therefore find it difficult to explain my thoughts and actions to others. Writing it out here has really helped, as you can take your time and ellaborate with nobody quickly trying to get in their reason for being right.


Another one down …

June 2, 2008

AHHHHHHHHHHH, will people stop moving about deadlines. AI has jumped from Monday to Friday, losing a weekend of work on it. At least the compilers work is done. I managed, after a few days of disastrous lex, yacc and C usage to understand what it was we were doing and even implement a symbol table. The symbol table was by far the biggest problem, dynamic allocation of memory being something I’ve never used before and trying to get it to work at 3 A.M. the night before the deadline was perhaps a bad idea. I eventually scrapped the idea of linked lists and trees and went with a good old array with the size determined at compile time. And that worked. Thankfully. The report was quickly thrown together in the morning and then shipped off, hopefully to somewhere with good grades, not Viet Nam or somewhere, what an awful war.

The weekend was quite good. HMV were doing some quality low priced DVD sellage. I bought 6, and almost got change from a £20. Value. Hadn’t bought any DVD’s in a while but 8 this week, it’s a bit much, especially with exams and deadly essays around every corner. I should really start that essay. It’s strange, the people on the course seem to be mainly divided into two factions, those that like to do essays and answering long winded questions and the others that would much prefer to doing some maths and cracking out some algorithms (you’ll find this difference on a larger scale when you compare Information Technology and Computer Science students). I’ll put off essays and report writing till the very last moment which is the wrong way to be doing things as there are normally more marks to be found in good documentation than there is in the implementation behind it. This next AI hand in is a good example as there are no marks for having an efficient working program, it’s all in pseudo-code. That may be because of the module being taught across different disciplines. I finished the code for this AI a few weeks ago, but again I’ve made no start on the report.

It’s these very last few weeks that really hit the hardest. That’s it for the term and year, no more code, no more design, no more of the fun stuff. From now on it’s all on paper and word processors.

Joys…


Thought I was in the clear..

May 28, 2008

but then another flurry of coursework swooped down upon the few. And they’re not getting any easier. For this case presentation for Professional Development we’re kind of in a rut as we were given the case we were to argue for and none of us agree with that point of view. And then Gabbay has sprung us with a surprise Monday deadline and there’s a 2.5k word essay for next Friday as well. Chin up. And sadly our group didn’t make it into the finals for the ATOS origin prize.

I’ve been reading some AI books that I took from the library and one of them (Artificial Intelligence by Neill Graham) had a chapter on LISP which I found a really good read. LISP looks like a fun sort of language, the single chapter explained it well and I reckon I’ll give it a go over the summer some time with some sort of project or something (another thing to add to the list).

EDIT: Give this a read. http://www.paulgraham.com/distraction.html A good idea about how to make your computer usage less distracting, buy another one. It does seem like a very good idea, one that I might give a try some day (another thing to add to the list) as I do seem to spend a lot of my time ‘working’ just browsing about. How do you think I found the article?


Why does everything I touch…

May 24, 2008

…just break.

It’s been a long two weeks, what with writing and handing in all the documentation, AI courseworks and two demonstrations yesterday.

And the Group Project demonstration didn’t go well at all. The recommender for some unknown reason just started throwing back the first four items from the database and then the applet to run the graph wouldn’t launch. These were the only two parts of the implementation I worked on and they both broke. Makes me look like a right tool.

The graphics demonstration went a lot better but I wasn’t there for that one. The animation turned out quite well, and I got all the code to work the way I wanted it to. I like it when courseworks turn out well. Let’s have hope for the rest of the term, just another 3 weeks.


Regular Updates…

May 23, 2008

2 days in a row, take that whoever said otherwise.

Cracked on with some graphics coursework today and learnt a fair bit about ye old C programming language. Filled my program with some of the many features that C has to offer with pointers, structures, strange ?:; type if statements and references to functions (a very handy tool, although not as easy as interfaces in Java (then again few things are) with all the segmentation errors that is was complaining about (my bad really)). We decided to make our model some sort of triangular Newtons Balls (Martin had no idea what we were talking about) and it looks like it could be presentable for tomorrow.

I took the political compass test that was on Richards blog and I came out a bit of a lefty-liberal type, so did all the other people I showed it to. Well apart from Herr Hamilton.

Tomorrow demonstrations are happening for both the Group Project and graphics coursework. Then nothing to submit until Monday.


Well I got my glasses back…

May 21, 2008

Well it’s been a while.

I’ll cover the important things.

Went home for the weekend. Went to give blood and some guy fainted afterwards (I laughed on the inside). Finished off the group project. Had the MEng interview. Got a reply saying the panel would recommend me to the progression board. Got anoyed at KDE4, shiny as it may be, it doesn’t give me the bar thingee at the bottom anymore, although through a bizzre mix of widgets and console use it works a charm. Read Hackers and Painters and The Mythical Man Month (The later a bit dated going on as it does about punch cards and this strange thing called a text editor (I want me one of those)). Went to Alloa for Rays 21st, good laugh. Did both the AI courseworks today, my NetLogo skills not really up to the task, in the end I was just typing, hoping and putting in brackets (yes the square ones, not braces or parenthesis but brackets, good old [ and ]) everywhere, but the prolog went down like a charm. Got both the graphics and group project to demonstrate on friday and I have precious little of the graphics done.