My first semester back at University is almost complete, only two assignments (both completed) to hand in and then I’m done!  This semester has been quite easy, I’ve had to do 6 assignments in total, 4 in Java and 2 in .Net.  All the projects have been to create some kind of application, be it for a company who’s employee hierarchy resembles a pyramid scheme but overall nothing too hard.  At the end of it all, I can say I know Java, which opens the way for some Android development when the GooglePhone/Nexus One comes to the UK.

A couple of posts back I said I would learn C++ whilst learning Java.  I can honestly say this never happened, however I don’t see learning the language a challenge anymore.  One day I will finally get to program something in this language but I wont be going out of my way to do something in it.

A new year has forced me to get back into a exercise regime again.  So far I’ve been good and eventually I might be able to report some losses or gains.  My goal at the moment is to try and stay the same weight but lose some fat in exchange for muscle.

Onto work… The new year saw me working from home for the first time thanks to the weather (constant snow since Christmas).  A very different experience compared to working in a office (how do people work from home?) I will not miss it.  We have started a couple of new projects, both based in PHP using SOAP connected to a MySQL database, Good fun!.  Negotiated a pay rise over MSN :) and a bag of holidays left to take.

Thats it for now.

Ok so blogging isn’t really up there with my priorities. This just means I write more less often.

My semester at Uni is nearly over, only a couple of weeks left followed by a short break and i’ll be starting the next semester. The most interesting thing i’ve learned so far this year Object Orientatation. When I started my job at 3DPixel.net my first project was using PHP and OO techniques and I can honestly say I didn’t understand most of it at first but now it all makes sense.

I’ve started on a new personal project (http://rentopoly.com) to pass the time (when I have free time) which is a website targetted at students and landlords looking to rent properties. I will be using my new found knowledge of OO to build the website.

I have so far created one object which I think could be interesting for other people to use. This object connects to Yahoo! MapService API to resolve an address (via Curl) into geo latitude and longitude data. This is usefull if you need addressing lookup without having to purchase data like that supplied by the Post Office (PAF File).

To use the object;

$myAddress = new Address("House and Street Name", "Locality", "City Town", "Postcode");
echo $myAddress->getLatitude();
echo $myAddress->getLongitude();
/* You could also use the object to display address information */
echo $myAddress->getAddress1();
echo $myAddres->getCity();

You can use this with GoogleMaps to place a marker on a map.

Full object source.

/*
 * Creates an address object
 * See - http://eighty-six.co.uk/blog/2009/12/oo-techniques/
 * @author Damon Skelhorn
 */
class Address {

	private $postcode;
	private $address1;
	private $address2;
	private $city;
	private $longitude;
	private $latitude;
	private $url = "http://local.yahooapis.com/MapsService/V1/geocode?appid=yourapikey";

	function __construct($address1, $address2, $city, $postcode){
		$this->setAddress1($address1);
		$this->setAddress2($address2);
		$this->setCity($city);
		$this->setPostcode($postcode);
		$this->resolveAddress();
	}

	private function resolveAddress() {
		$stream = "location=" . $this->getAddress1() . ",".$this->getCity() . "," . $this->getPostcode() . '&output=php';
		$res = $this->fetchPage($this->getUrl(), TRUE, $stream, '');
		$res = unserialize($res);
		$this->setLongitude($res['ResultSet']['Result']['Longitude']);
		$this->setLatitude($res['ResultSet']['Result']['Latitude']);
	}

	private function fetchPage($url, $ispost, $params, $auth){
		if(!$ispost && $params) $url .= '?' . $params; //if not post and params (ie, if it's a get)
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		if(is_array($auth)){
			curl_setopt($ch, CURLOPT_USERPWD, $auth['username'] . ':' . $auth['password']);
			curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
		}
		if($ispost){
			curl_setopt($ch, CURLOPT_POST, 1);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
		}
		$result = curl_exec($ch);
		curl_close($ch);
		return $result;
	}

    public function getAddress1() {
        return $this->address1;
    }

    private function setAddress1($address1) {
        $this->address1 = $address1;
    }

    public function getAddress2() {
        return $this->address2;
    }

    private function setAddress2($address2) {
        $this->address2 = $address2;
    }

    public function getCity() {
        return $this->city;
    }

    private function setCity($city) {
        $this->city = $city;
    }

    public function getPostcode() {
        return $this->postcode;
    }

    private function setPostcode($postcode) {
        $this->postcode = $postcode;
    }

    private function getUrl() {
        return $this->url;
    }

    private function setUrl($url) {
        $this->url = $url;
    }

    public function getLatitude() {
        return $this->latitude;
    }

    private function setLatitude($latitude) {
        $this->latitude = $latitude;
    }

    public function getLongitude() {
        return $this->longitude;
    }

    private function setLongitude($longitude) {
        $this->longitude = $longitude;
    }
}
?>

I’ve recently got hold of my timetable for this years first semester at University and I’m quite excited!¬† My first year at uni was great, I really enjoyed everything I did except one subject which I felt was completely unrelated to what I was studying.¬† Anyway..¬† this year I will be studying Java along with more VB.Net and programming and design.¬† I have two lecturers which I had last year which is good as I enjoyed their classes.

Java has been something I have never really looked at in great detail, actually – in any detail at all so learning a new language is quite exciting.¬† Whilst studying Java and VB.Net at University, I will also start to study C++ in my own time.¬† I’ve always wanted to learn C++ however its syntax has always put me off in the past.¬† But with my new found experience with C languages (mainly Perl and PHP) which I have gained from working at 3DPixel.Net I’ve made the commitment to learn this language once and for all –
cout << “the basics anyway\n”;

In the past, I’ve only ever concentrated my time using a single language – this being VB.Net for any type of project.¬† Don’t get me wrong, I like using VB.Net simply because its quick and easy to use, however, is there really a demand for a VB.Net developer in the industry?¬† Surely a programmer that can write in a C language is sought after more? Not to mention the difference in salary.

I’ve recently forced myself away from using VB.Net with the exception of the program I am currently developing at my job and trying to use other languages instead of using VB.Net for anything that I feel the need to program.¬† Working at 3DPixel has helped me do this with project such as CheckMyBox.Net which was created in Perl (the backend anyway).

I’ve used VB since I was around 13, starting out by creating various chat bot programs for AOL, thats almost 10 years of using VB. Most recently (the past 3 years) I made the jump to VB.Net. This istelf was quite a challenge at the time considering I almost gave up on the idea of programming as a career after I left college.

Hopefully, I will pick up Java and C++ without any problems as I did with PHP and Perl.¬† If all goes well, I think Objective-C is next on the plate, but (for now) I’m not saying goodbye to VB.

Another week flown by! Not sure why weeks are going so fast at the moment but before I know it its Friday again. Not so much a bad thing?

This week I have been doing some work on Trap25 – a spam system which has been created by 3DPixel.net for their customers. From personal experience, Trap25 is already good at preventing spam to the point where I do not get spam at all!

I have been using Perl (which is still fairly new to me) to upgrade the existing system to become more robust and (thanks to Perl) faster than the old system which was created using PHP. The system has also been migrated from using several files located on various servers to one central database – without going into detail and boring you, this ensures the servers handling mail can still function should a server go down.

I’ve done some other work (in Perl) which monitors the amount of spam received into the email system and displays them in table organised by country. There’s also a fancy chart which was a pain to configure! Have a look here.

I have used other languages in various enviroments but theres something about Perl I like. I think, the fact that its fast, has endless functions available via CPAN and the amount of well documented examples on the interwebs makes this a good choice of language – yet people say its a dead language? Each language has its place, but just compared to PHP it seems a more structured language – I say this because I still have to check the manual to see what comes first, is it the needle or the haystack? Maybe im a noob!

I’ve also started looking into Python, hopefully a project will come along so I can play more with this language :)

Blogging is something I’ve never really done, maybe its because I cannot find anything interesting to write about or I generally do not have the time to do.¬† This is my second attempt at this following a very brief (1 post) blog I maintained/programmed as a University Project, once the project was completed – so was my blog!

So to introduce this new blog, considering I work doing and study anything related to computer programming, you can expect the usual geek posts about random programming problems, solutions or anything I may find interesting.  From experience, this means a very large percentage of people will not understand and find it very boooorrring.  This is where you press the back button on your browser.

I think this is a suficent introduction to my blog, so I will leave it at that.