Campus Ambassador Coordinator Around the Sun

Wednesday Dec 31, 2008

First I must say that I hope everyone has had a great Christmas and that you all have a good time tonight and a Happy New Year in 2009. I want to thank all the Campus Ambassadors for all their hard work in 2008 and I look forward to working with you all in 2009.

Now, moving on to the real reason for this blog post...

A couple of months ago I saw a really great SunSPOT project by a group of Campus Ambassadors based in Russia. They modified a remote control car so that it would run from a SunSPOT. In addition to being computer controlled it did a number of other cool things like turning the lights on when it got dark, playing music through a sound system etc. You can see more information about the original car at http://blogs.sun.com/MagDen/entry/spotcar_remote_controlled_car_with.

Inspired by this ingenious idea I started to develop a week long 'SPOTCar' project for a local secondary school to try and get more students enthusiastic about computer programming, electrical engineering and Sun's products and technologies - before they even get to university! You never know - one day these people could make great Campus Ambassador candidates.

A few weeks ago I got the pleasure of actually running the project with a great team of about 20 students, some A-Level, some GCSE, some Keystage 3  - all had one thing in common, they'd never programmed, soldered or even heard of Sun before.

I am pleased to say that the week went really well and I was truly amazed at how fast some people picked up the programming aspect of the project. Some teams had finished their SPOTCars to a basic level (i.e. the car would move forward, left, right, reverse and the lights could turn on) within 3 days - one of these days was pure theory! By the end of the week there were two functional cars with head lights that turned on and off as it got dark and light.

So - what was the point? Well, the main point of the project was to introduce a group of young people to Sun, and in this it was 100% successful. By the end of the week a large majority of the school, students and staff alike, had walked past and asked and inquired as to what the project was about and were asking about Sun, programming etc. I'm really pleased to say that some of these students are now considering work experience at Sun, some have moved over to Solaris as their operating system of choice and others are learning more about the Java programming language day by day. If absolutely nothing else I am now the proud owner of two SPOTCars which will be great for the Aberystwyth OSUM group tech-demo I'm running in February!

I feel that this whole experience just helps to emphasise how important Open Source projects are. If it weren't for the Russian Campus Ambassadors being open about their ideas this project never would have run, all these students would never have heard of, or had the chance to use products produced by, Sun... and I wouldn't have such a great demo for my upcoming talk in February.

Tuesday Nov 25, 2008

At last Aberystwyth University (where I am currently based) has an OSUM (Open Source University Meetup) club. I've managed to persuade a friend of mine to run the club. You can check out the website at http://osum.sun.com/group/aberystwythuniversityosum and I encourage you all to register and participate in the community.

So what do you get by registering?

  • Tech-demos and talks about all the latest Open Source technologies.
  • Free food and drink at the tech-demos.
  • Prizes and give-aways at events and competitions.
  • A community driven website where you can meet fellow developers and Open Source enthusiasts.

The first event is not going to be until early February due to exams in January and the fact that Aberystywth breaks up in 2 weeks time. However, the first demo is going to be on SunSPOTs (Sun Small Programmable Object Technology). I'm currently putting together what I hope will be an exciting demo using all the cool features of the SunSPOTs including the light sensors, tempreature sensors and accelerometer!

If you're interested in SunSPOTs already you can check out http://www.sunspotworld.com/, otherwise I look forward to seeing you all in February.

Friday Nov 14, 2008

I'm a day or two late but Sun announced on Monday the Amber Road line of products. Amber Road has been under development within Sun for some time. I remember seeing some of the early beta demos last year and thinking "This is going to be amazing!" Well here it is, finally - the Unified Storage System.

You can check out all the cool features, and even have a go with the software in a virtual machine by visiting: http://www.sun.com/storage/disk_systems/unified_storage/index.jsp

But to whet your appetites here is a picture, they say a picture speaks a thousand words...

Monday Nov 10, 2008

At Sun we get a 'Start the Week' email every Monday. I usually spend some time reading the articles in this e-mail as they can be interesting relating to new product releases, events during the week, talks to go to etc.

One thing that caught my eye this morning that I feel I ought to share is that a group of Sun employees are going to be sleeping rough in London this Wednesday (13th November) to help raise money for the national charity helping homeless young people, Centrepoint.

I'm going to donate some money and I urge you all to do so too... http://www.justgiving.com/sun-sleepout-team

Monday Oct 06, 2008

Over the weekend I saw what I considered to be an interesting e-mail on one of the various mail alias I am subscribed to. This e-mail was basically titled 'Error in the Java compiler?' and said the following...

Hallo all,

Why do different results come out with the program 2? From my point of
view A and b must agree. The lines are semantically alike. The operator
++ binds more strongly than +

public class Main {
    public static void main(String[] args) {

        int b, a;

        b = 2;
        b = ++b+b;

        a = 2;
        a = a+++a;

        System.out.println("b: " + b);
        System.out.println("a: " + a);

    }
}

Output:
run:
b: 6
a: 5

The answer to me was quite obvious. The user simply hadn't realised that a++ and ++a are different in so far as a++ will use the current value of a for whatever it is currently doing, then it will add 1 to a. ++a on the other hand will add 1 to a and then use the new value of a.

        2+1 + 3
++b+b = b+1 + b = 6


        2   + 3
a+++a = a++ + a = 5

However, it then turns out that the example provided wasn't really appropriate and as such the user sent a new e-mail, this time with the following example:

This was a bad example from me...

int b, a;

b = 2;
b = ++b*b; // this represent (2+1)*3 that's OK

a = 2;
a = a*++a; // ++a is 3, then is the first a also 3... but this a is 2...

System.out.println("b: " + b);
System.out.println("a: " + a);

Output:
run:
b: 9
a: 6

Naturally this again was not an error in the Java compiler. It was due to the Java specification which says that all expressions are evaluated from left to right. As such, in the second example we evaluate a to be 2 first, and then we times that by ++a, resulting in 6...

2+1 * 3
b = ++b * b = 9

    2 * 2+1
a = a * ++a = 6

The most interesting thing about this whole subject is that if you were to write that kind of code in C it would be completely undefined in terms of what the results would be. The compiler writers may do their best to come up with sensible solutions, but some times you'll get 9, other times you'll get 6 and for that matter some times you could get -99,938 or even 2,394,343 etc.

So - what is the moral of all this - don't write code like that. Do it in two separate statements. That way the code is clearer and the outcome is more predictable.


Sunday Oct 05, 2008

So I was really annoyed that my Mum's Elonex Webbook with Windows XP on was doing CPU frequency scaling out of the box and so was getting battery life nearer 4 hours than the 2 my Ubuntu Webbook was achieving.

I spent a couple of hours this evening searching for ways to get CPU frequency scaling working, and at last I've managed to find the information I was looking for. As such I thought I'd share it with you.

Download, extract and compile the following source code:

$ wget http://www.a110wiki.de/wiki/images/6/65/Cpufreq-2.6.25_backport.tar.bz2
$ tar xfvj Cpufreq-2.6.25_backport.tar.bz2
$ cd cpufreq
$ make

Now you need to create the following directory:

$ sudo mkdir /lib/modules/`uname -r`/cpu

Then copy the compiled kernel module into this direcotry...

$ sudo cp e_powersaver.ko /lib/modules/`uname -r`/cpu/

You're nearly good to go....

$ depmod -ae
$ modprobe e_powersaver

You will now have CPU frequency scaling support. You can add 'e_powersaver' to your /etc/modules file so that it loads automatically every time your computer starts.

Other tools that are useful include:

$ sudo apt-get install cpufrequtils

You can now do things like this:

 $ /usr/bin/cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: e_powersaver
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 399 MHz - 1.60 GHz
  available frequency steps: 399 MHz, 499 MHz, 599 MHz, 698 MHz, 798 MHz, 898 MHz, 998 MHz, 1.10 GHz, 1.20 GHz, 1.30 GHz, 1.40 GHz, 1.50 GHz, 1.60 GHz
  available cpufreq governors: ondemand, conservative, userspace, powersave, performance
  current policy: frequency should be within 399 MHz and 1.60 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.60 GHz.

And to change the power modes etc you can do this:

$ sudo cpufreq-set -g powersave
$ sudo cpufreq-set -g conservative

So, I hope this is of some help to someone. I should point out that the original source of this information was http://www.a110wiki.de/wiki/CPU.

Friday Sep 19, 2008

As the start of university approaches I have been wondering about a new laptop. I want a laptop to take to university so I don't have to lug my desktop PC along with me. However, I don't have an enormous amount of money to spend on a laptop so I decided to stick to a couple of key features, the main one being size - it must be small. This produces a problem as small laptops usually cost the most.

Given my monetary restrictions I decided that (unlike my usual requirement) I would forgo the need for hundreds of CPU cores, GBs of RAM, TBs of disk space and just settle for small. As such the natural solution to this would be to buy something like an Eee PC. However, I really don't want a Linux distro made for dummies. I want a real OS, and at the same time I don't want to spend time hacking the thing so I can get a terminal (not something you expect a Gentoo user to say)! Don't get me wrong, the Eee PC is a great product - it's just not for me.

So, my options are narrowing down dramatically!

Fortunately I was in town today - not something I do much nowadays, it's all internet buying for me. However, on this rare occasion that I did go in to town I happened to walk past the Carphone Warehouse and saw the Elonex Webbook. This little thing has a 10.2" screen, an 80 GB 2.5" HDD, 512MBs RAM, 1.6 GHz VIA C7M CPU, weights 1.3Kgs and was just what I was looking for. At a very reasonable price of about £240 or £25 per month with mobile broadband I could hardly say no.

Even though the specs are a little on the low side, I figured it's be just fine for compiling, writing and testing my (very small) OS - not to mention the mundane things such as writing university reports etc. So I decided I'd come home and check it out on the internet and then buy one online.

After reading some reviews I discovered that, if not the best on the market, it was the best price and the general performance and reviews were good. So, I headed off to the Carphone Wearhouse's website to buy my new 'Webbook'. However, when I got there I was shocked (er - well, perhaps that is a slight exaggeration, disappointed, I was disappointed) to find out that online it only comes with Windows XP, and as such costs more - bah! Like I'm going to get that then.

So I'm back off into town tomorrow (two days in a row!?!) to buy the version with Ubuntu on, cheaper and I get it straight away with no £15 delivery charge. I'm not sure what the moral of this story is. Some might think it's 'impulse buy'... in fact, yeah, that's what I think :p

So the only question that remains is should I spend the extra £360 over 24 months and get the mobile broadband, or should I just buy the laptop and forget the broadband - hmmm... decisions, decisions.

Wednesday Jun 18, 2008

I was reading a friends blog today and I saw he's linked to a truly fascinating news article about Scientists who have managed to genetically modify bugs in such a way that they consume waste and produce crude oil.

I'm of two minds regarding this 'discovery'. On the one hand it's great knowing that there could effectively be an unlimited supply of crude oil in the world - could this be the start of the road to free energy? Could this possibly mean an end to wars and and rivalry over oil rich countries?

However, I do have my concerns. Is this really the best thing for the environment - yes, it's a way of recycling our waste. It's also a means of gaining oil without the hassle of drilling and pumping and who knows whatever else - but is it sustainable for the environment and planet - do we really want to continue to have cars that pump out masses of CO2 or, would we prefer to find alternatives such as hydrogen power etc? Another interesting question - how much oil can these bugs really produce - too little, or as one critique on the news article says "Suppose some of these bugs mysteriously got out of the laboratory and into the environment. Would they not continue to behave in a similar fashion outside the petrie dish? So now everything around them would slowly be converted to oil. How is this scenario "environmentally friendly"?". Then there are the moral grounds - is it right to genetically modify bugs for such things? Should we be playing God?

Overall I think it's an interesting step, and it may even be a step in the right direction towards sustainable, environmentally friendly fuel - but I still think we've got a long way to go.

Saturday Jun 14, 2008

This week has been quite busy, fun and interesting. On Tuesday a fellow student, Fraser, finished his internship at Sun and headed off back to Scotland for a couple of weeks before starting his Summer internship at City Bank. His departure managed to coincide with the Lab teams planned social event - carting. We had good fun carting. I did pretty good during the qualifier getting 4th place, but then, despite a 1 second improvement on my best time, didn't do so well on the final race, coming 6th or it might have been 5th place. Never the less, we all had good fun and it was a good way to say goodbye to Fraser. 

On Thursday Robin and myself left work at 4pm and headed straight into London for a talk by Scott McNealy at the London Business School. Apart from getting out of the tube station and turning left rather than right, we managed to get to the talk with 10 minutes to spare - just enough time to meet some of the new Campus Ambassadors for next year. Despite the gloom and doom predictions from a colleague that Scott wouldn't turn up (because when he went to a talk, he never turned up) - Scott turned up and delivered a pretty interesting and funny talk.

The talk was titled 'Free is the new Black' (thus the title for this blog post). It was directed quite heavily at Business students, which was to be expected given that the talk was done at the London Business School. However, he did propose some interesting ideas - most revolving around Open Source with an interesting side talk about a meeting with Pfizer regarding the possibilities of 'Open Source Drug Development'. This, I have to admit, conjured up ideas of people producing and selling drugs in a garage behind their houses... hmmm? Is it me? He did also have some other ideas (or perhaps more views), again revolving around Free such as 'Free Media' citing websites such as YouTube, Last FM, BBC iPlayer etc. Ultimately I found Scott to be very humorous in his delivery of his talk and I think I could have listened to his ideas for hours. I was surprised how quickly the questions came around.

Scott also mentioned one of his most recent projects, Curriki which is basically a Wiki designed for providing educational material and learning tools to every child - worldwide. I thought it was an interesting idea, and it's well worth a visit. If nothing else you could donate a couple of pounds (or dollars or whatever) to the project using PayPal - who have kindly agreed not to charge PayPal fees!

So, that brings me nearly to the end of this update, expect to say that the fun and games didn't end there. This morning I was in work for a planned production server outage. In addition to running a lab for support engineers we also provide ITOps alternatives for Sun employees with regards to home directories, Sunray Servers (we have 4 in the UK, 3 of which cycle through the latest builds of Nevada), E-Mail servers, Solaris Build environments etc. Most of these servers were in need of some kind of maintenance or other, and we felt it was time to give the 'production cage' a bit of a clean up. The work went very well and we finished by about 1pm - just in time for a nice lunch at one of the local Pubs.

That's all from me for now - but don't forget, Free is the new Black!

Monday Jun 02, 2008

Something  I learned today on my Advanced Crash Dump Analysis course that I've never thought about before was how we can improve the performance of our programs just by re-ordering our variables in data structures. Whenever you write something like the following in C you naturally use up memory:

	struct unpacked {

int a; char b; int c; char d; int e;

};

The above structure (we can assume), will use up 20 bytes of memory due to the padding. This is due to the way the structure is layed out in memory. Assuming that we're using a Intel processor and that we are storing our values in memory in multiples of the sizeof() the item we're storing, if we were to look at the memory layout for the above struct we'd expect to see something like the following:

  int a
 int a
  int a
 int a
 char b
pad
pad
 pad 
 int c
int c
 int c
int c
 char d
 pad
 pad
pad
 int e
int e
 int e
int e

However, assume this time that we program the struct as follows:

	struct packed {

		int a, c, e;
		char b, d;

	};

Well, now we've reduced the amount of space used to 16 bytes - and no it's not because I've removed those line breaks! Instead of wasted space in memory between those ints and chars we're using the space more wisely. The new layout in memory would be something like the following:

 int a
 int a
 int a
 int a
 int c
 int c
 int c
 int c
 int e
 int e
 int e
 int e
 char b
 char d
 pad
 pad
 free free
free
free

Naturally there will be instances where you don't really have much choice how you order your structs - especially when dealing with hardware or predefined protocols by other people or organisations. Indeed, the performance gains may not even be that big - but it just peaked my interest and so I thought I'd share it with you :)

Sunday Jun 01, 2008

My name is Michael Clarke and I am currently a student at Aberystwyth University studying for a MEng in Software Engineering. Part of my degree requires me to do a year in industry, and I'm just in the process of finishing this year at Sun Microsystems working for the PTS Global Labs organisation under Paul Humphreys. During the last year I've really got enthusiastic about Sun, not only because of its truly amazing products such as Solaris, ZFS and DTrace  - but also the whole community and environment. Everyone who works at Sun is great, always willing to help and share ideas and I found the whole atmosphere inspirational.

I've had so many opportunities and experiences during the last year, from working with Sun's latests and greatest server range, spending a week in Paris at the French lab, to fixing bugs in DTrace (or at least, trying to!). The training provided has been top notch too - I've had my pick of courses including Solaris 10 Administration, 15/25K High-End Server Maintenance and Solaris Internals. What is more, it hasn't stopped there - next week I'm doing a course on Solaris Crash Dump Analysis which should be good fun.

So, you may ask yourself - if this guy is basically just finishing his year at Sun, why has he only just started a blog? The answer is that I haven't finished at Sun, and indeed I've only just begun. I am taking on the role as UK Campus Ambassador Coordinator for the next two years until the end of my degree. This role basically involves looking after all the Campus Ambassadors in the UK who are out there promoting Sun by doing presentations on our technologies, from DTrace to Java and encouraging student participation in projects such as Open Solaris. My experience at Sun over the last year has made me the perfect candidate for such a job, being a student myself I understand the ambassadors needs, but having worked at Sun's UK head office for the last year, I also understand Sun's needs.

This brings me nicely onto the content my new Sun blog. I intend to share with you all my experiences as a Campus Ambassador Coordinator. I also plan to post updates on the things I continue to learn each and every day working for Sun - from how the Solaris Kernel manages virtual memory to how to debug the Solaris boot procedure using OBP (courtesy of Chris Beal).