Learning Cocoa/Objective C

I’m going back to Uni next year, to complete a post-grad degree in Computer Science. This is a course that people without a background in Computing can enrol in, so I’ll be able to get a bit of credit towards some units, but not too much, since when I did part of a Computer Systems Engineering degree, Java wasn’t the language taught. Now, at all three Universities in Adelaide, it almost seems to be the only language being taught.

Just for my own personal gain, I’m also teaching myself Objective-C. This is the language used by Apple and third-party coders for most of the OS X application software. All of their APIs are available under Objective C, and Java, whilst still somewhat supported, doesn’t appear to be as high on Apple’s agenda as it is on the local Universities.

I’ve borrowed books in the past on Cocoa/ObjC, but never really made much progress. This time, having a laptop means I can actually do my learning on that, wherever I happen to be. In this coffee shop, for instance.

I’ve also found some handouts and example program “tests” at Stanford University, and have started to work through those. The first program, a simple conversion application for temperatures, was fairly simple, and I wrote that. I even managed to complete the extra credit sections, or at least two of them.

Psuedo-evidence (in that you can’t actually see this working):

(Note, the temperatures change to red when above a certain value, and to blue when below a certain value. Within the ‘normal’ range, they are black).

This wasn’t a programmatically onerous task, more about making sure you can connect up various components and have them affect one another.

Instead of doing the next task, I’m pretty confident I’ll be able to write the application I gave to my Year 12 students, a 9-letter word puzzle solver. It will be interesting to see if I can effectively re-implement the python version I’ve already written:

The only reason I really want to learn Obj-C is that it enables me to use a GUI design tool, rather than having to create the interface using coordinates. And packaging up python applications isn’t exactly fun, either.

And, after the 9-letter puzzle solver, I might reimplement a sudoku solver I wrote. Not sure if I have the python source code for that one. And I never wrote a GUI for it, either.

SSSSA Touch 2007 Report

Here is a report on the 2007 School Sport Australia Touch Football tournament I wrote for the Touch Football South Australia website. Not sure if it is up there yet, but here’s what I wrote anyway.

Secondary School Sport SA, in conjunction with Touch Football SA, were again represented this year at the School Sport Australia National Championships. With Monash University providing a fantastic site, including newly surfaced fields, it was nice to actually have grass under our feet.

The teams travelled together, and having had a much closer relationship throughout the training campaign than in the past, this set the tone for the trip. With a direct flight from Adelaide to Melbourne, at not too unreasonable a time, both teams were pumped for the weeks competition. After arrival in Melbourne, and a long bus ride from Tullamarine to the accommodation, the players were met by a blast of un-Melbourne-like hot weather.

The good weather didn’t hold for the whole week, however, with rain on most of the competition days. At least the sun was out for the trip to the MCG on the Wednesday, where our lovely tour guide, Brian, provided us with a fun, interesting tour of the famous ground.

Competition was tough on the first day of games. With both boys and girls teams facing the big two - QLD and NSW - it was always going to be hard work. Both teams showed plenty of spirit against well drilled and capable players from the eastern seaboard, with the boys managing a touchdown against their QLD opponents.

The second day of games was much more interesting. With three potentially winnable games against Tasmania, Victoria and Western Australia, both teams were eager to win, but were disappointed with their performance in the morning games. The boys in particular looked to have the game in hand, but struggled to keep the Tasmanian boys from scoring enough touchdowns to steal a draw in the dying minutes. The girls came back from this result to resoundingly beat Victoria in their second game of this day, and were finally looking like they had travelled for a reason. However, they ran out of legs in the final game of the day, and couldn’t manage to keep WA’s half runners from finding their targets.

As mentioned previously, after the strenuous second day of competition, the Wednesday was a day of rest, with a trip to the MCG, and then to IMAX cinema for an entertaining, yet still educational movie about Dinosaurs.

The final round games were against “The Territories”, with opportunities to beat both ACT and NT going begging in both games. By this time the strain of the tournament was starting to show on the bodies of the players - whilst the fields had grass on them, they were still hard enough to leave a nasty graze.

The finals were another chance for both teams to play against teams they could have beaten the first time around. Again, whilst at times it looked like both teams could have won their way through to the Plate Final, the girls struggled against a young yet effective Tasmanian team, and the boys were unable to top the NT team. And so it came to the 7v8 playoffs. The SA girls again managed to dispatch the Victorians, with a great captain’s effort by Georgia Brown to score four touchdowns in the one game, and Beth Fairfield almost winding up to top speed to score a couple more. The boys battled valiantly, but again struggled against Tasmania, who outscored them in the second half.

A hard, yet enjoyable week. With mostly first-time players in both teams, some new to touch football altogether, and many being eligible to play again in 15s next year, the trip to Launceston for next year’s tournament promises to be just as much fun. As our state develops and these junior players filter into our senior ranks, you can bet you’ll see plenty of them playing at a high level in the future.

Awards.

Boys.

  • Coaches - Tom Starkey
  • MVP - Alex Peecock
  • Players Player - Billy Macklin

Girls.

  • Coaches - Abbey Freer
  • MVP - Kelly Rowe
  • Players Player - Georgia Brown

Using VMWare Fusion to create Windows Worksheets

I’m still a teacher, at least for the next few weeks.

And one of the tasks I need to do is create a series of worksheets to enable the other guys in my learning area to teach the stuff I am an expert in - most notably AutoDesk Inventor. I generally just teach from my head. I provide the kids with some sheets with drawings on them, sometimes go through a couple of the steps on the projector, and then just wander around helping out those that are stuck.

This is a fine way to teach, for me, anyway. It gives the kids a heap of independence, and it means by part way through the semester, the kids are pretty close to being able to work without my assistance. Setting relief lessons is a piece of cake (Continue with your <whatever> project). It also makes my classroom mostly fun - I can actually often get other work done while teaching.

So, not being able to rely on there being a specialist CAD teacher next year, I’ve had to start writing explanatory worksheets for the kids, most notably for the new Year 8 course that is running next year. I’ve done this in the past, on a Windows PC (which Inventor requires), and using OGrabIt, a screen capture application that is okay.

But not as good as the built-in screen capture with OS X. I’m finding my workflow is much better with VMWare open, running Inventor, and Pages open on the same screen. I just do the CAD steps, press ⇧⌘3 at each step, and I have a series of files I can then crop to size.

Even better, if I have a static screenshot, I can use ⇧⌘4 to grab just the area, or press the space-bar afterwards to grab a window. This was possible with OGrabIt, but required switching of applications, and, IIRC, only allowed for grabbing of the screen to the clipboard. Meaning a paste was required after each step of a process.

Of course, if you hold down Ctrl, you can grab to the clipboard in OS X, too.

The next thing that makes my life easier is being able to work in Pages, rather than Word. Word has these nasty habits like making objects jump around when trying to fine-tune their position. Pages’ guidelines are a bit annoying at times, when it tries to align the centre of two similarly sized objects instead of the left-hand side, but at least when you use the keyboard arrows to move stuff, it doesn’t reach a certain point, and then on the next press jump right up to the very top of the page. I’m fairly sure I blogged about this in the past, it is possibly the most fucked-up-and-annoying thing about Word.

Pages is a lot faster, too. No more waiting for spinning beachballs. The only bad stuff is related to positional incompatibilities when converting back to Word, which I haven’t really checked out that much yet. That won’t really be my problem, though. I’ll give my colleagues a PDF, which they can use to print out, and if they need to make any major edits, they’ll also have a Word document version, but then it is up to them.

Having said all of that, it still takes quite a long time to generate a worksheet for students. I spent at least 3 hours today on one task, that will probably take the kids about 45 minutes to complete. Still, it’s not as long as if I’d used Windows+Word - the rule of thumb there is 10x the student time.

Exporting Keynote takes ages.

Not everyone uses Keynote. Some people don’t even use MacOS X!

So, in preparation for me not being at my job next year, I’ve had to convert the dozens of presentations I created for my Stage 2 IT Studies class into PowerPoint, and since PPT doesn’t always have all of the features, an SWF version as well.

And, it takes about 3 minutes to convert each one. Most of which is the progress bar at 99%.

Learning to Program

I learned programming originally, I think, on an Apple //. We had some of these at my primary school, and I clearly remember doing something like programming, even if it was only Logo, in class time. Or perhaps it wasn’t in class time, but at lunch and recess. I had a C=128 at home, and did lots of programming in Commodore Basic, most notably the more advanced basic that they shipped with the 128. Very little of the stuff was to do with peeks and pokes, but there was a little of this more assembly-level stuff.

At high school we did some programming, I think, on the BBC micros. I’ll have to check with the two guys I still keep in contact with, on WoW of all places, but I remember doing some programming on the machines at my first high school.

When I went away to boarding school I ‘moved on’ from computer programming in some senses, and went more into the hard sciences and mathematics. I think a big part of this was me not having any respect for (a) the machines we were forced to use in IT, and (b) the teacher we had for IT, who we also had for Religious Education. (!)

In actuality, I failed year 10 IT. Not because it was hard, but because it was easy. I did all of the work, and then gave it to the girls I fancied to hand in. (Hi Catie, Moose and co!) This wasn’t programming at all, but using computer applications. The stuff that is really boring. Learning how to use Excel, Word and the like. And, note, this was pre-windows.

During this phase, I was into Amiga. I didn’t actually have one, I still only had the C128D, I think. We had a choice between the BBC micros and the dodgy XT PCs. Both of which were limited to monochrome screens. I was, in the boarding house, barely living with the glory (!) of 256 colours, while my friends at home were basking in 4096 colours. And at school, the dull orange on black of the PCs.

I think I got an Amiga 500 while I was still at school. It was awesome, and I loved it. Games were much better on it, and it had a real windowed operating system, that actually multitasked better back then with a slow CPU and 512k of memory than the much more powerful machines in my lab pool do with Windows XP.

My learning of different computer programming languages began in earnest when I started University. Finally, I had proper instruction in several languages, and I was first forced to learn Pascal. We were taught using Turbo Pascal on the PC lab at Uni, but I think I downloaded and installed a pascal compiler on the VAX/VMS terminals we also had access to, but everyone only used for email. I used them for reading usenet, and learning how to push the limits of what the sysadmins allowed us to do.

Second semester of Uni was better - we did C. Finally, a real language. Again, Borland was the platform of choice, but I was different. As well as using the VAX/VMS machines, I managed to get myself an account on the Unix server, lux. I didn’t bother attending lectures (the room wasn’t large enough for all of the students, the lecturer wasn’t a good communicator), and I got enough out of the tutorials.

I submitted all of my work to the tutor via email, and obtained, IIRC, 97% for the subject. I think he was impressed that the rest of the drones were using Turbo C, and I was doing it the real way.

All of this coding was done without a windowing environment. Even though I had a lux account, I wasn’t allowed to actually go into the lab that had the X-Windows terminals in it. I did spend a bit of time in at Adelaide Uni, and got some exposure to X-Windows there, but not much.

Third semester, and things started to go a bit shaky for me. The programming subject was called “Data Structures in Pascal”, and I must say I wasn’t so keen on diving back into this toy language. I got hold of the C++ books for the second semester, and started teaching myself a bit of this.

However, all good things come to a close, and with my rather poor performance overall, I was forced to choose something else to do.

After a couple of years, I came across python. I don’t think it was even while I was still at Uni - I think it was something I picked up on my own while teaching. I do remember printing out all of the 1.5.2 documentation (I think I still have it in a filing cabinet somewhere). I may have started while at Uni in my Education degree, I can’t recall.

Students (not) submitting work

I’m feeling pretty down today. Which really annoys me, because I have a Touch Football tournament on this weekend, and I’d love to be able to really focus on that, and prepare. At least I will have plenty of motivation to go hard, though.

See, my Year 12 IT Studies kids are supposed to be handing in work, or have handed it in already. I have to submit my results to SSABSA tomorrow, and at this stage I don’t have anything that even slightly resembles a full marks book.

I have found this to be the worst aspect of teaching. Trying to get all of the required work from a cohort of students.

It makes me feel like a bad teacher. Why can’t I manage to get all of the students, or even a majority of them, to submit all of the required tasks? Am I doing something wrong? I know there are stacks of things I would approach from a different direction if I were teaching the subject again, or if I could do it over. But surely I m not single-handedly responsible for their lack of work.

Having had discussions with other teachers at my school makes me think not. One of the Maths teachers mentioned she had 3 out of 17 students who have submitted all of their tasks. A Science teacher had similar things to say of his class.

At some stage, students need to stand up and take responsibility for their own actions. Regardless of excuses they make (the computer network is down, or whatever), I have continually reminded my class of the tasks they have not completed. And yet with some students, I have received no more than 20% of their assessable work. And these are the very same students who have not attended at all in the “extra week” I have put on for them, since I was absent all of last week.

Perhaps I just need to go “fuck it”, and hand out a whole bunch of failing grades.

Of course, that would only result in me getting hauled through the admin team’s offices, wanting to know why so many students scored so badly. So I spend countless hours giving students way more help than I would really like, and quite a few of my website projects look fairly similar.

Stiff shit. I’m over this whole thing. I am just killing days until the year finishes.

Smoking Ban in SA Pubs

As of midnight this morning (or last night, if you prefer), all smoking is prohibited inside in South Australian hotels and clubs. This is a great step - as someone who is not a smoker, it’s nice to be able to go anywhere and drink myself into a stupor without having to worry about lung cancer. This is a follow-on from the previous laws, where it was illegal to smoke in certain areas in pubs. For instance, there was always at least one “smoke free” bar in any licensed establishment, and if there was only one bar, smoking was prohibited within 1m of that bar.

Of course, there is one side-effect of the new laws, which I noticed before work this morning.

Where do all of the smokers go when they can’t stay inside and smoke? Outside on the footpath, of course. Normally this wouldn’t bother me too much, but down Hindley Street there are several pubs, and each one had a cloud of smoke and a cloud of smokers outside of them. That I had to pass through as I strolled to work.

Dodgiest Quote. Ever.

Watch How You Say Stuff

That quote, my friends, is why you should really think more about what you type, and how it may be interpreted.

Address Book: Family Relationships

I have a fairly large address book.488 contacts, who are shared between my various hobbies and pastimes. Including a large number of people who are related to one another. In some of these cases, I have populated the Related Names field, often where I just need to know a child’s parents names, but also in other cases where the related person is also in my address book.

I have several groups of people who are siblings, and I could go through each sibling and add in ‘father, mother, sister, brother’ items for each sibling, but it would be great if this could be done automatically.

The father/mother bit should be relatively straightforward, since the fields are the same:

Bob and Alice have two children, Carol and David. If I have put father:Bob and mother:Alice in for Carol, and I put brother:David in, then the system should be able to easily put father:Bob and mother:Alice in for David.

The tricky bit is with gender related to siblings. There is no default field for gender in Address Book, so how does the system know if David should have sister:Carol or brother:Carol? Especially since I don’t want to have to hand-code a list of names and which gender they are. I have many people with unusual names, and some with non-gender-specific names.

A short-term solution might be to (a) see if there are other sibling relationships (ie, if there is also brother:Eric, and Eric has sister:Carol, then clearly Carol is a female, and David should also have sister:Carol); or (b) have a temporary sibling:Carol field, which can be changed by the user.

You could then have a Smart Address Book Group which has all people with a sibling: field, which would make finding those people easier.

Conceivably, this should be possible with AppleScript. I have, however, butted heads with Address Book’s scripting in the past. It doesn’t always seem to be that easy to get data from this application.

Perhaps this type of feature, as well as my other hope for Address Book (notice if two contacts have the same number, including just the last X digits (for +614 vs 04 numbers in Australia, which are the same), and allow manipulation of this data, might appear in Leopard.

Rubik's Cube

One of my students today had a Rubik’s cube in class, and I had a bit of a fiddle with it. He told me what needed to be done for the first step, and I think I managed to do this.

I then went down to the shop and bought a cube. Almost immediately I figured out how to do the first step, which is to get the top face, and the top layer done. I also managed to get a fair way into the second layer. Then I got a little stuck.

A couple of hours later I decided to find a website with some directions:

How To Solve A Rubik’s Cube - Step By Step Directions

The first time, these instructions worked. The second time, not quite.

I know I was doing them right, but at one point they are in fact not always sufficient to complete the task.

Step 5 is the problematic one. If you have two correct, it will not always work. You in fact may need to set it up so there is only one correct side, and have that at FR.

From there, it seems to work.