It’s been a while


It’s been exactly a month since I update this space. A lot of things been happening with me. Working backwards from today.

  • Three Spears – The first ever project the guys took on will be done dusted by end of the week 😀
  • NHS Choices User council – last meeting was today. This is now cease to exist but they are doing more awesome stuff so I will be jumping on them
  • Perl coursework – due in few days time but for once I am prepared and I have set my milestones so far I’ve managed to stick them. I think for once breaking the habbit I will be able to finish them sooner than I think.
  • Networking – I’ve met some of the coolest people on the planet last week at 2 awesome events. More of that will be in the coming days (as soon as I get through my coursework)
  • Movember – I got a bad ass mo 😀 and I’m stuck with it for 2 months because of a promise I made… I need to finish up the site.
  • InDesign – Yes added it to my arsenal of weapons 😀
  • Personal site and blog – Started drawing up mock up for this. I am using wordpress.com as a matter of convenience somewhere to temporarily hold my thoughts and portfolio till I get up and running.
  • Twitter – I am a sceptic about the social media (yes it’s ironic considering my job) But I started using more and more. It IS useful 🙂

Time is very precious but I think this time around I am more disciplined how I spend time and how I am allocating time to managing my priorities.

Advertisement

Calculating average using a perl script


Ok here is the basic perl script for calculating average.

I assume you know how to run the script if you dont ( I will put up a tutorial later so for now dig around in other forms )

Perl Script for calculating average from another file

#!/usr/bin/perl
#calculate averate from a file

use strict;

my $total = 0;
my $count =0;
while (my $line = <>) {
      $total +=$line;
      $count ++=;
}
print "Average = ", $total / $count, "\n";

So the  explaniation for the above code is…

use strict; – allow to find simple mistakes

to find the $average need to calculate

my $total

and the total number of lines

my $count

At the begining of the loop these values are 0.

therefore define the inital value

my $total  = 0;
my $count =0;

So now what you need to do this read each line andadd each value consequtively.

while (my $line = <>) {
   $total += $line;
   $count ++=;
 }
print "Average = ", $total / $count, "\n";

Read the first line.  Then add then and the value read to the total inital value  of 0.

   $total = $line + $total

calculate the total

   $count = $count + 1

calculate the total number of lines read
this can be written in short form as below

   $total += $line;
   $count ++=;

then go back in loop adding value conseutively until there are no more lines to read and then print the line

print "Average = ", $total / $count, "\n";

Hope this is clear I will put a anotated diagram up with more explanation later on.

Back to school


Finally I am doing MSc. I didn’t do quite well in BEng as I hoped. I didn’t listen to my lecturer at the time.

You can’t look after anyone else if you don’t look after your self

Those were her exact words and something that failed to listen at the time but never forget any more. It’s been haunting me forever. Hopefully MSc in BioInformatics would allow me to put that right. Leave the nightmare behind.

I think I was quite lucky to get in to MSc. I got  ripped apart in my interview. My references came in very late. I am still not properly enrolled because I am waiting for the documents to come through. So I got to make the most of this. But this would be just the beginning.  2 evenings per week (learn Unix, Perl and Java). It’s going to be fun. Brings back some some bad memories and some good memories. Oh and I am totally not using the MSc as an excuse to break my bank to buy one of those Alienware :D.

In the coming weeks I will be putting up the Tutorials I’ve learnt here. Mainly as a personal record and also hope it would be use to someone.