Phase test two run down

Since I’ve done absolutely no prep for this exam, I figured I’d do so in here. Here’s the mock. Usually I’d say break down what you’re being asked to do, but it seems like they’ve already done that for us.

Right clicking your project in the Solution Explorer to add a new item.
Right clicking your project in the Solution Explorer to add a new item.

Create a website. First thing I’d do is insert the database class we need to be using. (Looks like an informal CC GNU GPL, so long as he keeps credit.) Do that by copying the text – all of it. Going back to Visual Studio, right clicking on your project, Add new item…, Class, Yes to the “Put it in the ‘App code’ folder”. Select everything, and paste the contents of that Word document for the table class (overwriting everything that was there). Rename that class to something more logical.

We also need to add the yabba database we’ve been given. Right click App_Data, Add existing item…, find and insert the database we’ve been given.

Add two fields, like it says, for the name and message. Validate inputs. I’ve no idea howwhy you’d use a function to validate two strings though, so I’m not going to.

Now, uhh… lets find how to use this database thing. I’m sure there was a class on it. Yep, here’s the presentation on it: Database and webservers. Written by Mathew Dean. Slide 13 gives you the code to connect to a database. And he talks about adding records here, on slide 2 and onwards.

Just to explain what this class actually does. When you create it, it nabs all the records and puts them into a hashed array (which has a key, and a value, rather than just an index number and a value). You add to that array like normal, using NewRecord, and then when you save it just updates the database according to that array of information.

Okay, I’m actually bored of this now.

Here’s the badly commented code for the first page.

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        ' As if we're in C, variables at the top, for no reason. Regaurdless of if we need them. Which we don't.
        Dim Name As String
        Dim Message As String
        ' Make sure neither textbox is empty
        If (txtName.Text <> "" And txtMessage.Text <> "") Then
            Name = txtName.Text
            Message = txtName.Text

            'Connect to the database
            Dim MessagesDatabase As New DatabaseTable("yabba.mdb", "tblMessages")
            MessagesDatabase.NewRecord.Item("PostedBy") = Name
            MessagesDatabase.NewRecord.Item("MessageText") = Message

            lblStatus.Text = "Something was empty. Try again."
        End If
    End Sub

Second.aspx is supposed to output all the messages. Have fun with that.



I was just about to come and do an update saying that today is the end of the holidays, and so I’m going to start hardcore revising again. No one can start their start-of-hardcore-revision without a start-of-harcore-revision-cup-of-tea, so I went to get one.

Dad’s still in bed, at five to nine of the morning and had the audacity to say “Isn’t it about time you got a part-time job yet?” Unfortunately, he said it so off the cuff that I had to respond quick fire and we all know there’s a sort of speed/politeness relationship.

I ended up saying “Bite me. You’ve been looking for a job for seventeen years, I haven’t started looking yet and I’m closer.” It’s true though; how dare he question my employment state – I’m a student. I’m not even expected to have a job. My primary aim at the moment is to pass my exams – when he hasn’t had a job in so damn long when he has a family to support. It’s just freaking… rude!

Also, he said part time job. Part time!? If I was going to get a job it’d be a little more than part time, you ass.

Anyway. I’m going to watch Diggnation. Revision after this.

LAW2: Selection of Judges

I decided to go ahead and narrate my presentation on the select and appointment of judges as revision.

Beware though, I recorded it all in one go with no script so there’s a lot of “umm…” that would have been edited out if I had done it in Audacity (but I did it in Powerpoint). It’s in the .pptx format, so you might need Office 2007 to view it, though it’s probably that there’s a backwards computability patch that Microsoft released for it, like Word.

The Selection and Appointment of Judges (14Mb)