Samsung NP-RV511-S02UK

I bought a new laptop the other week, a Samsung NP-RV511-S02UK. I have been using a Samsung NC10 dual booting Ubuntu and XP. An NC10 is a wondrous thing but when push comes to shove, a 1280×600 resolution is too small for Visual Studio work – especially when you want to see a PDF at the same time.

Continue reading Samsung NP-RV511-S02UK

Conics (or Khanics?)

I’ve been reading over the course material for MS221 (I quit this module’s last presentation for personal reasons).

Khan Academy has a very good series of videos. Plus it gives you points (seriously I’m addicted to rewards – you should see me driving for PS3 trophies).

Anyway, for block A part 1 try these: Introduction to Geometric Sequences, Sequences and Series (part 1 and part 2) and Write a Fibonacci Function; for part 2 try Introduction to Conic Sections through to Foci of a Hyperbola and Parabola Focus and Directrix.

Find the sum of all the multiples of 3 or 5 below 1000

Project Euler’s first problem:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

By brute force I can write code that checks every number below 1000 to see if it’s divisible by 3 or 5, if it is then add it to a running total.

I’m using Visual Basic (VB.Net 2010 to be precise). This might seem a little odd for an Ubuntu member but I’m thinking of trying MT264 (Designing applications with Visual Basic). Open University students qualify for Microsoft’s Dreamspark promotion, so I got a copy of Visual Studio 2010 Express to try it out. Besides, I’m at work so haven’t much choice.

Starting off with a “Console Application” template:

Dim beganAt As Date = Now
Dim total As Long = 0
' Repeat a thousand times
For counter As Integer = 1 To 999 Step 1
     ' Check if the current integer is divisible by 3 or 5 and
     ' if it is then add it to our total
     If (counter Mod 3 = 0) Or (counter Mod 5 = 0) Then
          total = total + counter
     End If
Dim endAt As Global.System.TimeSpan = Now.Subtract(beganAt)
Dim took As Integer = endAt.Milliseconds
Console.WriteLine(total.ToString + " in " + took.ToString + "ms.")

Running this code and clicking the button we get the answer 233168, which Project Eular confirms. Code must run in less than a minute, the timer shows less than a millisecond.

I can see another way to do this, by using two for loops – one in steps of 3 and one in steps of 5, adding the counter to a total for each. I don’t know if this offers a significant time saving, so I re-ran the original code, making the loop repeat a million times and it completes in 375ms. I can’t see any value in going any further.

Finally succeeding?

I read an article by James Somers at The Atlantic called “How I Failed, Failed, and Finally Succeeded at Learning How to Code“. I’d encourage anyone with an interest in learning to code to read it – he discusses how computer programming is an excellent learning experience but that his own experiences have been tempered by poor instruction, particularly from books. He goes on to discuss how Project Euler became the titular success.

Euler provides a series of programming challenges of increasing difficulty, as the student solves each in turn they gain experience of what does and does not work as well as confidence in their abilities. Importantly, the student is also applying programming to practical problems (if you’re a mathematics student) from the outset.

I’ll post my solutions here as I go. I’m aiming to do one a day but I’ll see how I get on. Not sure what language is best to get on with, Python is popular in open source circles but most of my courses are based around Java.


Completing BSc (Honours) Computing and IT

With ten years remaining in my contract and the government’s intentions unclear, I’ve decided to get my finger out and focus on completing the BSc (Honours) Computing and IT (B62). It can use 120 points from four completed modules – M150T175MST121 and M255 as well as 30 points from MS221, which I have already started.

At level two I’m taking two courses on top of MS221 which I intend to study concurrently, so as to be half way through by the end of next year:

  • T215 – Communication and information technologies (60)
  • MT264 – Designing applications with Visual Basic (30)

Leaving 120 points at level 3:

  • M359 – Relational databases: theory and practice (30)
  • M364 – Fundamentals of interaction design (30)
  • M366 – Natural and artificial intelligence (30)
  • TM470 – The computing and IT project (30)