
Sometimes change is bad. :(
I remember before, I had a post that showed me downloading at like a megabyte a second. *sigh*

Sometimes change is bad. :(
I remember before, I had a post that showed me downloading at like a megabyte a second. *sigh*
I can’t remember the last time I’ve just been sat around, being bored. (Though, that’s probably accountable to my awful memory.) I’ve either been working, or doing university work, or just general being around friends. And I’m not annoyed or bored of any one of them; I think I’ve found a really good balance.
I don’t feel stressed at all either. Knowing that there’s a safety net of a few hundred pounds overdraft available if I need it is really calming. I have spent a little more than I wanted to so far this month, but it’s nothing that I can’t afford thanks to the work I’m doing. Also, living with girls has definitely made me start eating more. Especially since Laura continually offers to make food, so I typically eat at least one good meal a day, which is an improvement on snacking when I’m hungry.
All in all, I have a pretty good life at the moment.
I didn’t realise that this was a two hour lab, and was about to pack up before checking my timetable again. Since I do have another hour in here, I may as well do this personal blog that we need to be doing for this module (and most modules, actually). Usually these are private between student and lecturer, but since I’m all about being open, why not share it here too? (Plus, this is a much nicer editor.)
This class is Agile Software Development, so it naturally uses Ruby on Rails, which is known for it’s fast pace, don’t-repeat-yourself development cycle. Pretty perfect fit then. I’ve never used it though, but it’s getting more and more popular. All the hot projects on Github are ruby ones, so it looks like the in language at the moment. I remember when Twitter changed from Rails to some other language though, because Rails just wasn’t scalable enough for them.
In the labs we’re using Instant Rails, but I think I’ll likely just install Ruby and Rails myself on my laptop manually, since I already have MySQL and Apache running. Hopefully that won’t be too hard.
We’ve mostly been playing around with the IRB today.
Coming from PHP, it’s pretty obvious how variables are treated differently. Doing something like
$foo = "blah"; var_dump ($foo * 10);
Would output 0; $foo is assumed as an integer, since * is an operator that works with numbers, and it’s assumed 0. 0 * 10 is 0.
But on Rails
foo = "blah" foo * 10
Here the * is treated as more of a method, than an operand, in that it takes notice of it’s context and has been overloaded, sort of. Because it’s a string in context, it has a different functionality. That code would return “blahblahblahblahblahblahblahblahblahblah” (“blah” repeated ten times).
It feels like values are treated more as objects can just … values, really. Literal values can have methods too (inherited from their value type, I guess).
I needed to round up to two decimal places for currency (you always round up when using money), but for some reason the internet didn’t want to share that information with me, so here it is.
PHP:
// Takes a decimal and rounds up (never down)
function round_up($val, $precision) {
return round($val + pow(10,-$precision-1), $precision);
}
Javascript:
function round_up (val, precision) {
power = Math.pow (10, precision);
poweredVal = Math.ceil (val * power);
result = poweredVal / power;
return result;
}
So, using round_up (1.432, 1); would return 1.5. For currency you’d want to set the precision (the number of decimal places you want) to two.
Last year I wrote about my classes, and although it probably wasn’t, I felt I talked about the tutors in a negative light to start with. Mostly because I think I was being moody. But either way, it turned out Matthew Dean — my old course leader — found my blog, and then I felt somewhat awkward. I’ve decided though that if he read the feedback then he could use it. There’s nothing wrong with it. With that in mind, I had my first classes of the year today.
First class was software design and development. Which is a weird way of saying Java. I’ve not used Java, but I’m pretty sure it’s as easy to pick up as every other language. I’m trying to stay enthusiastic about learning more about it, but looking through the list of topics for this module there’s only one or two things I don’t already know about. I’m worried this is going to be another module where we spend a year learning something that should be taught in a week’s worth of lessons.
Really; learning a language once you already know how to program isn’t hard. They don’t change much.
Second lesson was database design and implementation. Which I’m really worried is the exact same module as the database one last year. In fact, I have the course book which I’ll look though later.
Anyway, it’s still nice to have classes to go to now, I guess.