D520 – Week Four

This week continued from the previous one, covering Chapter 4 of IronPython in Action.  That meant no new notes, and no new lab exercise.  We basically did two things: worked through the MultiDoc example in Chapter 4, and worked on implementing the Airline lab designed in the previous week.

The first recommended reading for the week was Part 1 of Joel Spolsky’s “Talk at Yale”, wherein he tries to relate his study to his career – the part I hoped they would find interesting was the discussion of “geeks” versus “suits”.  The second recommended article was Steve Yegge’s “Code’s Worst Enemy”, which is mostly about code bloat.  In retrospect, these might not be the best pairing, since Yegge is always long, and this particular Spolsky article is very long (if you read all three parts).  However, I was again pleasantly surprised to hear that students were actually reading these. Continue reading “D520 – Week Four”

Yet Another New Look

As you can tell (unless you’re reading this via RSS), I’ve changed the theme for the site again.  I quite liked the layout of the old theme, but the text was just too hard to read, especially with large posts (which I am prone to).  Let me know if there are any issues – since this is hosted WordPress, it should be fine, of course.

D520 – Week Three

When planning the semester’s schedule for D520, I choose a few topics that seemed large and gave them a two-week time-slot.  One of these was chapter 4 of IronPython in Action, which covers duck typing, design patterns, and introduces the MultiDoc example that’s used throughout the middle section of the book.  One of the concepts that the course has always (at least, as long as I have known it) tried to push is the importance of design – not just user-interface design (although that’s both important and covered), but the importance of doing at least some planning before starting to write large amounts of code.  In the last couple of years, I’ve moved the course away from focusing on extensive formal design to also cover design patterns and testing (particularly automated testing, like unit tests).  Since this is such a major issue for the course, and since I planned on using MultiDoc as an example in class (I try to always have an example that continues on from week to week), this seemed like an obvious point for a two-week session. Continue reading “D520 – Week Three”

Google Voice? Who really cares?

I really enjoy listening to Jason Calacanis when he’s on TWiT, and I think he generally makes a lot of sense (and considering his success, he clearly knows more than me).  However, his anti-Apple rant (like so many others) is really off-base (I’m not the only one that thinks so).

There is no technical reason why the iTunes ecosystem shouldn’t allow the ability to sync with any MP3 player

The iTunes ecosystem does allow the ability to sync with any MP3 player (even more so now that music is DRM-free).  You can build an application that uses the XML library description that iTunes creates to figure out where all the music/video is, and do what you like with it.  The way I see it, there’s no reason that iTunes/Apple should be forced to support any MP3 player with their software.  Apple clearly makes some money from the iTunes music/video sales, but it’s clearly not the main profit generator is the ecosystem – the high-margin iPods/iPhones are.  Apple has spent a great deal of time and money building a store and an application to make the players more appealing.  Why should any other player get to piggyback on the top of that?  If (e.g.) Palm wants to create an online music store and develop an application that works with it and the Pre, then they should be able to (and I see no reason they can’t).

I like iTunes more than other media applications I’ve used, but it’s certainly not perfect, and it shows that it started out as a music player and is now a great deal more.  I love the iTunes Store, but Amazon completes with it (I can’t tell how well, since they won’t see to me in NZ) as does the Zune Store – which even offers a subscription model (no idea if this is available in NZ – it’s too Windows-centric for me).  There’s absolutely room for someone (e.g. Palm) to build a better store (or interface with an existing one like Amazon) and built a better application.  Do that, and build a better device, and you’ll get customers.  Don’t expect that Apple should have to help you compete against them.

Think for a moment about what your reaction would be if Microsoft made the Zune the only MP3 player compatible with Windows.

The iPod/iPhone isn’t the only MP3 player compatible with OS X.  However, isn’t the Zune is the only MP3 player compatible with the Zune store?  The “PlaysForSure” idea got thrown out some time ago.

Simple solution and opportunity: Not only let the iPhone work on any carrier,

How many countries is the iPhone locked in?  It certainly isn’t locked here, or in many other countries (e.g. Australia).  This is only an issue in some countries, like the U.S. – it’s a U.S. Apple problem, not an Apple problem.  From what I understand, it makes business sense for Apple to have an exclusivity deal with AT&T, at least for now.  I don’t see anything wrong with that.  If AT&T was bad enough, then people wouldn’t use it, even if it was the only iPhone choice.  If other companies made phones good enough on other carriers, then it wouldn’t matter which network the iPhone was with.  I presume this is a temporary issue and the U.S. will join the other enlightened countries before long and have unlocked phones, anyway.

but put *two* SIM card slots on the iPhone

A nice idea in some ways, but about as un-Apple as you can get.

3. Draconian App Store policies that are, frankly, insulting

This is actually points 3, 4 and 5.

Yes, every application on the phone has to approved by Apple, and if you were interested in something adult in nature…well…you can’t do that.

From all accounts, the approval process needs a lot of work.  One suspects that now that Jobs is officially returned to work (and Schiller is speaking openly about at least some things) that changes will happen before too long.  I think Apple must surely realise that the situation is getting out of control, and will start implementing changes.  For now, there are still a lot of applications that I really love, there are none that I know of (which is an issue, of course) that I wish I had, and only one that has been pulled that I love (which is Amazon’s fault, not Apple’s).  I’m willing to give Apple a bit more time to fix this – I suspect that even they didn’t realise quite how successful this would be.

4. Being a horrible hypocrite by banning other browsers on the iPhone

Again, this is really just a specific case of #3.  Personally, I see almost no demand for Opera anywhere apart from by a few (very extreme) fans.  I don’t even see much desire for Firefox or Chrome on the iPhone.

5. Blocking the Google Voice Application on the iPhone

There’s a lot of talk about this.  It seems overblown to me, considering that Google Voice isn’t even publicly available (I believe it’s an invite-only beta) and is U.S.-only.  I think it’s just that a lot of the noisy tech pundits use Google Voice, and so this impacts them directly.  I think there are much worse cases of App Store approval problems.  In any case, this is again just another instance of #3.

Making great products does not absolve you from technology’s cardinal rule: Don’t be evil.

It seems to me that the cardinal rule is more “make great stuff”.  I’ll still buy from Amazon, even after they killed my favourite iPhone application.  I dislike some of how Apple handles App Store submission, but I’ll still buy various products from them.  I dislike DRM in general, but the iTunes Store is good enough that it’s still worth using.

1. Do you think Apple would be more, or less, successful if they adopted a more open strategy (i.e. allowing other MP3 players in iTunes)?

Less.  A huge part of the appeal of the Apple ‘ecosystem’ is that because they control all parts, everything “just works”.  If you use all-Apple products, everything works so much nicer than if you mix-and-match.

2. Do you think Apple should face serious antitrust action?

No.

3. Do you think Apple’s dexterity and competence forgive their bad behavior?

Yes.

My 2GB, 4 day 0.0.1 iPhone update

A few days ago, Apple released version 3.0.1 of the iPhone OS, which addressed a pretty major SMS vulnerability.  When Olyvia tried updating her 3GS to 3.0.1, something went wrong.  The iPhone entered “Recovery Mode”, which means that it displays an image indicating that you need to connect it to iTunes, and you can’t do anything else (no phone calls, no iPod, no applications – absolutely nothing).  Connecting the phone to iTunes prompted a message indicating that the phone needed to be recovered – doing so downloaded the 3.0.1 update, and then got stuck on the “Verifying Restore with Apple” step for a long time, until it would finally fail with error “3104”.  This process could then be repeated, with the same results.

What this meant in practice was that the phone was bricked as of last Friday.  An update should never be able to brick a (legitimate, not jailbroken) phone! Even more, failing to verify a restore with Apple should never leave the phone in a broken state.

I tried many thing to resolve this:

  • Restoring on three different computers (three OS X Leopard, one Windows XP).
  • Using three USB cables.
  • Using two Internet connections (different router, different physical location, different ISPs).
  • Restoring with five different user accounts, including one that was created solely for this purpose.
  • Removing iTunes and the Mobile Device helper completely and reinstalling.
  • Restoring with an administrator account (both OS X and Windows XP) and a standard account.
  • Redoing the restore at many different times of day, including times when most of the US would be asleep (so the server load should be fairly low), over Friday, Saturday, Sunday, and Monday.

None of this worked.  It did mean that I downloaded the 300MB+ update six times (one for each user account and once to refresh) over the four days.  That combined with the iTunes installation brings the total download cost to around 2GB.

I eventually gave up.  Google found many other people with this problem, but only a single solution, which involved opening a terminal connection to the phone and changing an environment variable.  I wasn’t particularly comfortable doing that, since if something goes wrong I want Vodafone/Apple to just replace the phone without any argument.  Since there isn’t any real support available over the weekend, I waited for Monday morning.

I wasn’t sure whether to contact Apple (expecting a “please call Vodafone” answer) or Vodafone (expecting a “what do you mean you updated your phone?  Can you do that?” answer).  Thankfully, Vodafone NZ has a very responsive and helpful Twitter presence (@vodafoneNZ).  I tweeted, asking who to call, and was asked for details.  I provided these (going into more detail in an email), and got back a (unfortunately not helpful at all) suggestion.  Since that didn’t work, Paul Brislen provided me with an 0800 number for the “iPhone Team” (I’d call them “iTeam”, subtitled “there’s an ‘i’ in iTeam”, but anyway…).  Unfortunately, since I had to do a lot of travelling and offline things on Monday, I wasn’t able to get to this until Tuesday.

I certainly appreciate a (free) phone number I can call.  However, I don’t have a great deal of time to spend talking on the phone, explaining a rather complex problem and the many steps that I’ve already done to try and resolve the problem.  I also have poor cellphone coverage (Vodafone’s fault) and a rather noisy landline (Telecom‘s fault), so voice calls aren’t a great solution to a problem.  Faced with a (presumably) long and difficult phone call, the ‘hack’ solution of altering the environment variable looked a little more appealing.

I downloaded iRecovery and opened a terminal (shell) connection to the iPhone.  Typing “printenv” gave a list of the environment variables – the ones that had a “P” at the start were presumably non-default values (these included “auto-boot”, “bootdelay”, “backlight-level”, and “platform-uuid”).  The article indicated that the “false” value for “auto-boot” was the problem (and the solution to use setenv to change it, then reboot the phone).  This seemed a reasonably safe thing to do (and also easily reversed), although I imagine that it would be rather scary to a non-programmer (who has no idea what “printenv” or “setenv” might mean).

Thankfully, this worked.  The iPhone rebooted – although it went straight back to the recovery page in iTunes, which wasn’t hopeful.  However, this time the recovery process worked flawlessly (using the existing four-day-old copy of the download).  The phone was recovered from the automatic backup, and then sync’d.  Some of the settings are a bit out as you expect in a recovery, but the phone actually works, which is really all that matters.

I don’t know what would have happened if I called the “iPhone Team” (and don’t need to find out now).  I suspect that we wouldn’t have got far, or maybe would have ended up doing exactly this (or perhaps having to return the phone for service).  I could be wrong about that.  I do feel that Vodafone (specifically @vodafoneNZ) handled this pretty well (and Apple extremely badly).

D520 Week Two

Here’s my material from the second week of “D520: Programming” (in IronPython).  The students got some brief notes [PDF] and the first proper lab exercise [PDF].  The recommended reading this week was a post by Lukas Mathis about poor hardware design (and lessons to be learnt), and a post by Wil Shipley about tracking down a Delicious Library bug.  The notes are again in four sections: textbook chapters (this week chapter 3, which is fairly essential reading), tools (same as last week, although I also recommended IronPython 2.6b2), key points, and example code (from chapter 3 of the textbook).  The lab exercise is a modification of one from last year (when it was in Visual Basic) – I’m trying to keep as many of the previous lab exercises as possible, so that there is still a tiny bit of continuity between 2008 and 2009. Continue reading “D520 Week Two”

D520 Week One

As promised, here’s my material from the first week of “D520: Programming” (in IronPython).  I gave the students a set of revision exercises [PDF] (and example answers [zip]), a course outline [PDF], and some brief notes [PDF].  The notes have four sections (this pattern will continue): which chapters of the textbook are covered this week (and a couple of sentences that summarise them or point out which parts are important to us), the tools that are required this week (since this is the first week, this section is large, covering installation of Adobe Reader, IronPython itself (including putting it on the PATH), and several IDEs (as previously covered), including configuration), key points, and example code (the examples that I plan to use in class).  For anyone interested (chiefly: me in about nine months time, when I’m planning the 2010 course), here’s a summary of the first week.  It’s rather long (2100+ words) – the summaries of future weeks should be shorter. Continue reading “D520 Week One”

IronPython Course Notes – The Plan

Since I decided to use IronPython as the programming language for teaching D520 at Northtec, I’ve planned on putting my course material online so that anyone else planning on using IronPython in teaching can make whatever use of it they can.  There won’t be a huge amount of material, especially in this first year, and especially since I managed to find an excellent textbook to use, but there will be some exercises, assignments, an exam, and so forth.  Each year I teach a course I add new material, and while some material is replaced or removed, usually the old material stays, so the amount of material gradually increases.

What I haven’t been able to decide is how to put this material online (the students have access to it via a Moodle installation, but I don’t want to make that publicly available).  I toyed with the idea of putting it up in wiki format (but that seemed like a reasonable amount of work and I doubt there will be contributions from other people), with using iWeb to create a small dedicated site (mostly to play around with iWeb, which I have never really used, but that seemed like a lot of unnecessary work), or with putting it on Google Docs and sharing it that way (but I write the material in Pages and publish as PDF, so that doesn’t suit well, since I’d have to convert to Word then to Google Docs).

What I’ve finally decided is that I’ll just put it up here.  It’s already setup, I’m a bit busy to put much else up at the moment so it won’t be crowded, and it’s very simple for me to do.  I’ve further decided that it would be best to publish it bit-by-bit (since no-one else needs it at the moment anyway – if I’m wrong about that, please contact me).  Each week, after the class has finished, I’ll post all the material I used that week, and some commentary about how well it went.  I think this commentary will provide added value (including for me, when I’m revising the material next year), and it means that it’s easier for me to update the material as I go (although I’ve prepared the whole course, I expect that there will be changes since it’s so different than last year’s course).

I expect that as I continue to use IronPython in a teaching context, I might have additional comments that I feel like posting, so those will be nicely interspersed with the teaching material.

I’ll put everything in the “Teaching” and “Python” categories, so it’ll be easy to ignore everything else here if anyone is interested in using this material.  I’m making it available under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 New Zealand License (I include using it in a similar course as non-commercial).

IronPython editor postscript

I earlier tried various editors I was considering using to teach IronPython.  One of the glaring omissions was Eclipse/PyDev, which has built-in support and is a very well-known IDE (particularly in the Java community).  The main reason that I skipped Eclipse was that when I was searching for an IDE to use professionally about five years ago I tried Eclipse (for Python, C, and C++ development) and I really hated it – the IDE was very slow (especially to launch), it was very Java-centric, and just didn’t suit me at all.  I’d briefly tried Eclipse before that as well, with similar results.

Over the last few days, I decided that I was probably being unfair, and since this was a choice for my students rather than for me personally, I really ought to try Eclipse (with the PyDev extensions).  I also noticed recently a post about using IronPython with NetBeans – I’d heard of NetBeans before, but only in a Java development context, and since I stay as far away from Java development as I can, I had no experience with NetBeans at all.

Eclipse/PyDev

I was right to re-examine Eclipse.  The things that I remember bothering me so much five years ago (speed, the interface) seem to have been completely addressed, and it looks like a quite usable product.  When adding PyDev (which was quite simple), there’s support for IronPython that appears completely built-in (although it’s still obvious that Java is the #1 choice).  It seemed like a quite reasonable contender, unlike I tried to actually configure it to use the IronPython interpreter (which has to be done manually).  I was using a completely standard, fresh, installation of IronPython 2.0.1 (from the .msi) installed in the default location (here ‘C:\Programs\Iron Python 2.0.1’) with ‘Eclipse Classic 3.5’ and version 6u14 of the Java Runtime.

I believe that, in theory, you can click the automatic configuration button, or manually locate the IronPython interpreter, and it’ll just work.  Unfortunately, for me nothing seemed to work.  The error message indicated that having spaces on the Eclipse path could be a problem (which seems pretty shocking in 2009), so I tried moving Eclipse to C:\, which didn’t help.  I tried moving IronPython to C:\ (and renaming the folder to have no spaces), and that didn’t help.  I imagine that someone more familiar with Eclipse, or with PyDev with CPython/Jython, might have been able to solve this easily.  However, if I can’t figure it out in 10 minutes, then I am not at all comfortable with telling my first-year students to use it (even though we walk through the installation together, some of them will need to do that by themselves as well).

NetBeans

It wasn’t entirely clear which version of NetBeans to use, but I presumed that the most appropriate was NetBeans 6.7 “Python EA2”.  Although the post I saw indicated that you needed to rename ipy.exe and ipyw.exe, I found that just selecting ipy.exe worked fine.  I quite liked this IDE, and it appeared (although I didn’t use it for long) that using IronPython worked fine.   There’s no graphical form designer, so NetBeans is in the same category as Komodo Edit (which I discussed previously).  In many ways, it’s probably a better choice than Komodo Edit (in that the IronPython integration is simpler to do, although it does require that Java is installed), although I don’t know if there is any way to provide .NET auto-complete.  It’s a fairly full-featured IDE, like Komodo and unlike DIE, which would normally be a positive, but in this specific case (first-year programming students) is actually a negative, since they need to ignore all the ‘team’ functionality, and you have to work within projects (which is true of Visual Studio as well).  This is an “early access” version – since I’m not familiar with NetBeans I don’t know how unreliable that makes it – it makes me a little nervous about suggesting it to students, but I certainly didn’t have any trouble with it myself.

Conclusion

If you’re able to get Eclipse/PyDev installed, then I suspect it might slightly beat out my previous recommendations of Komodo Edit and DIE; since I didn’t get it working, I can’t recommend it to the students.  NetBeans, however, will get added to the list of suggested tools (alongside Komodo Edit and DIE).  If I wasn’t so familiar with Komodo Edit, I’d probably use NetBeans as the editor I use to demonstrate, but it didn’t wow me so much that it overcomes the familiarity.

Choosing an IronPython editor for teaching

The Northtec D520 “Programming” course is changing to IronPython (from Visual Basic) this year, so I have to figure out what editor/IDE the students should use.  In some ways, Visual Studio would be ideal, since they need to get exposed to that during the course (and it’s an excellent IDE, with a really great form designer), but since there isn’t any real IronPython support in Visual Studio (hopefully coming in 2010), it’s not really a viable option.  Instead, they’ll start with a simpler editor, and then briefly learn how to use Visual Studio’s form designer and subclass the forms in IronPython (as described in IronPython in Action).

The requirements here are a bit different than when selecting an editor/IDE for actual development work.  Firstly, it needs to be free (at least for educational use), and it needs to be reasonably simple to use the basic functionality (since these are first-year students).  Code-completion isn’t necessary (on the one hand, it helps them out while they are learning – on the other, they rely a little too much on it), nor is a built-in debugger, or support for complex projects.

I considered seven different editors/IDEs – there are a couple of others, but they either seemed too young (e.g. IronPython IDE, IronEditor), or inappropriate for other reasons (e.g. ZeusEdit is not free, I can’t stand Eclipse.  UPDATE: I decided to try Eclipse and Netbeans after all).

Continue reading “Choosing an IronPython editor for teaching”