Posts Tagged ‘tips’

Blog Posts and Podcasts

October 26, 2017 Leave a comment

It has been a while since I created a new blog post, but if you are feeling neglected, never fear! I have not given up writing them, and still have many ideas I want to discuss. I’m sure the world is relieved to hear this news!

The reason I haven’t posted anything for 10 days is that I have been concentrating on podcasts.

Just in case you haven’t caught up, a podcast is an audio recording (usually a spoken discussion or reading) which can be downloaded from the internet and listened to at any time, usually on a smart phone, but also possibly on a computer, tablet, or similar device. There will be a feed which allows you to “subscribe” and be notified of new podcasts, which are usually created regularly as a series. Alternatively individual programs can be accessed through a normal web page.

My podcasts are at
and the RSS feed is

At one point in the past I was creating these fairly regularly, but have gone through a period where I neglected them a bit. Recently I got back into the fine art of podcasting, which is quite involved. My podcasts are usually between 5 and 10 minutes in length but most require about an hour to create.

First I need to record the program. I find a quiet space and read the material into my computer. Including errors, phone calls and other interruptions, re-reads, etc this usually ends up being twice as long as it should be!

Then I edit the audio file I recorded using an audio program. I currently use the quite powerful, free program, Audacity. I remove the errors and repeats, fix the spacing by adding and removing gaps, improve the overall tempo, standardise the volume level, and improve the pitch dependent on the room I did the reading in. On a few podcasts I also add music or sound effects. Finally, I export the file as an MP3.

The last step is to write the XML and HTML (don’t worry if you don’t know what these are) so that the files can be accessed through a news aggregator program (I use NetNewsWire), a podcasting app (I use Downcast on my iPhone), or a web browser (such as Safari or Chrome). And I put all of those components on my web server (, of course.

So what is in these podcasts? Well mostly they are just audio versions of my favourite blog posts and web pages. There’s nothing new in them and the podcast just provides an alternative way to get my valuable thoughts!

So if you are already bored with reading this stuff then now there is a new way for you to get bored. Now you can also achieve this by listening!

If you want some recommendations from the (currently) 74 podcasts on my site, try these…

2012-04-27 – Its Five Day Mission
2014-04-25 – The Libertarian Dream
2017-05-23 – A Ticket to Heaven
2014-02-19 – All My Macs
2016-03-16 – Sadness and Beauty
2017-10-16 – Child or Picasso?
2015-09-21 – Insulting Sir Pita

Remember, these are all available at

There’s a combination of stuff there which I hope most people would find interesting. If you do listen and have any thoughts, let me know in the comments for this blog post.


The Apps I Use

April 2, 2016 Leave a comment

I work in IT doing general computer support and web programming (and anything else to do with Macs and other Apple stuff). Sometimes when looking at problems my clients are having it is suggested I am a bit negative about the programs they are using and have been asked: well if you don’t like (whatever program is under discussion, usually Microsoft Word) what do you use instead?

That’s a good question and I thought I might answer it here. My main computer is a 15 inch i7 MacBook Pro with a high resolution screen, an SSD, and 16G of RAM, so it’s a moderately high-spec machine but not outrageously so. The programs I use could be used by almost anyone else with a fairly modern computer – as long as it’s a Mac, of course.

The programs I use most are in my Dock so to answer the question of what my alternative apps are I’ll just list all the stuff in the Dock and briefly say why they’re there…

General System Tools

Finder. This is Apple’s program which creates the desktop environment for file management. It is a standard part of the system so it might seem pointless listing it here, but there was a long period of time when I did use an alternative called “Path Finder”. That is a great app (like the Finder on steroids) but in the end it just didn’t offer enough extra to replace the good old Finder.

Helium. This is a small app which displays a web page in a floating window. On my Mac I have the Dock and menu bar hidden so I created a small web based app (using PHP) to display the information which would normally be in those two locations (plus a bit more) such as battery level, wifi signal strength, my public IP address, etc.

Astrill. This is a VPN service I use when I want to maintain privacy or make it look like I am actually in another country. I won’t say anything more about this!

Cisco Secure Client. This is the VPN service I use at work.

Server. This is Apple’s server suite which includes services such as web serving, file sharing, and many others.

Parallels. Sometimes I need to run Windows apps (I estimate about 10 minutes per month) just to check that my web-based programs work OK on Windows. Apart from this I have no need for Windows at all. In fact I spend about 10 times as much time maintaining it as I do using it!

Remote Desktop. This is Apple’s remote management service which allows me to take control of other computers screens, install new software, get status reports, etc. I use it a lot to do remote control of other people’s Macs to help with problems and to monitor and maintain remote servers.

Productivity Apps

Notes. This is Apple’s notebook app which automatically syncs with my iPhone and iPad. I keep all sorts of temporary information here which needs to be accessible from all the Apple devices I use. For example, I might write a note here on the iPad about a wine I am trying and copy the synced version into the main database on my laptop later.

Maps. I use Apple’s map program more than Google Maps, although I do use the Google street-view feature sometimes so I do have both installed.

Reminders. I use this to keep track of my list of things to do. It syncs across all of my devices.

Calendar. I have several calendars, mostly on Apple’s iCloud service, where I keep track of my tasks for the day. These also sync across all devices so I get reminders on my iPhone for appointments entered on the laptop.

Contacts. I use Apple’s address book program synced to other devices through iCloud for keeping all my contact information. I have photos for most of the people in the list so I see a picture of the person calling, emailing, or messaging me on all my devices.

Programming Apps

Skim. This is a nice PDF viewing program which I use to read documentation files. It has some useful features but the main reason I use it as an alternative to Apple’s Preview program is just to keep the documentation in a separate place from all the other PDFs I work with.

Script Editor. I use AppleScript (Apple’s scripting language) quite a lot of small tasks on my computer (connecting to servers, launching apps, etc) as well as for more sophisticated applications I have created to automate processes on servers.

XCode. This is Apple’s program development environment. I’m not doing any “real” programming at the moment but I have used this in the past, and it has useful utility tools as well.

FileMaker Pro 11. I have to maintain this older version of FileMaker to open older databases I have created and not moved to the newer version yet.

FileMaker Pro 14. If I am creating a serious database I prefer the MySQL/PHP/Apache environment but I quite like FileMaker for creating simpler desktop databases.

BBEdit. This is my main text editor for programming. It has excellent syntax colouring, keyword autocomplete, multiple file handling, and search and replace facilities. I also use the GREP system in this program to do complicated text processing.

Safari. Apple’s web browser is the one I use for testing and debugging my web sites and apps. It has good analysis tools and follows standards well so it is well suited to this.

Terminal. My favourite app! The command line is the “killer app” for the Mac. I love the Mac’s graphical user interface but I also like getting behind the scenes and using all the power of Unix, including Apache, MySQL, PHP, and shell scripts.

Internet Apps

NetNewsWire. This is an RSS viewer. I don’t tend to use RSS feeds as a source of information much, but I use this to check that the feeds I create for my blog, etc all work OK.

Chrome. I use Google’s browser for most of my web browsing. I like it because it is fast and reliable and handles lots of tabs open simultaneously (I just checked and I currently have 33 tabs).

Messages. This is Apple’s messaging app which syncs with my iPhone and iPad so I can send and receive text messages from my computer (also phone calls and iMessages).

Mail. Apple’s Mail program has a few faults but overall it is very clean and fast. I check 8 email accounts which I use for different reasons here: my main Apple account on iCloud, my work Exchange account, and 6 GMail accounts I use for special purposes. I do have a few sync problems with some of my Google accounts but just quitting Mail and restarting it (a few seconds) usually clears them.

Skype. I don’t use Skype much but occasionally people want to communicate with me this way so I keep it ready. BTW, I don’t count this as a real Microsoft program (see below).

Media Apps

iTunes. I think we all admit that iTunes has its faults but once you get over the confusing user interface it can do a lot and there really isn’t a realistic alternative for managing iPhones, etc.

Photos. Apple’s photo storage app is simple but fast, reliable and efficient. I just use it to store and display photos because I do my photo processing in more powerful apps before adding the photo to my library. Photos also syncs my photos between my computer, iPad, and iPhone through iCloud.

General Purpose Apps

Dictionary. Apple’s dictionary program looks up multiple dictionaries as well as Wikipedia. I have over 30 dictionaries installed but usually only have about 6 active. It also integrates automatically with most programs to allow word lookup from anywhere.

TextWrangler. This is a free, slightly scaled down version of the BBEdit text editor I mentioned above. I use it to open general text files separately from my programming files.

Preview. Apple’s PDF app is surprisingly capable and I use it instead of Adobe’s clunky Adobe Reader and Acrobat. It does almost everything most users need and is really reliable and easy to use.

Pixelmator. I am a big photography fan do I need a good photo editing program. I have used Photoshop since the first version was released, but I now find Adobe apps clumsy and slow, and I don’t like their licensing. So I use Pixelmator instead. It does most of what Photoshop can do, but because it is designed specifically for the Mac it is much nicer to use.

Pages. I use Apple’s Pages for word processing. It is so nice to use a word processor which works reliably, and quickly, and fits in with the rest of the system. I would never go back to Microsoft Word which I believe is probably the single worst program ever written (because of the frustration it causes for so many users).

Numbers. Of all the Microsoft programs I have used Excel is probably the one I find most useful. But, while it is quite powerful, it is still horrible from a user interface perspective so I usually use Apple’s Numbers app instead.

Keynote. Using Apple’s Keynote instead of PowerPoint is such a luxury. I know it will work reliably, that movies will play, and that graphics will always display. Plus it has a much nicer user interface and works better with the rest of the system.

So that’s it. Notice that I am Microsoft free (apart from Skype) and Adobe free. I do still have Office and Creative Suite installed but I almost never use them (really only to help other people who use them and have problems). This is partly political (I don’t like big corporations) and partly practical (I like elegant, well designed software). And yes, I do know that Apple is a big (evil?) corporation but I can’t really work in IT without teaming up with one corporation (Microsoft, Adobe, Apple, Google, Oracle, etc) so I guess at least Apple is the best choice out of all of them.

Apple Watch Update

February 9, 2016 1 comment

I have now been using an Apple Watch for over 6 months so it must be a good time to post an update on how useful it is. I guess the most telling point is that on the odd occasion that I forget to wear it I constantly find myself looking at my wrist until I realise nothing is there. If I got through a day (or even an hour) without missing it then I would probably have to say it was a failure, but the opposite is true.

I still don’t think this is a device that everyone needs. In fact what does that mean? Do we really need anything – especially any high-tech gadget? Probably not. But I do think it is a device that everyone could find useful – assuming they already have an iPhone for it to talk to, of course.

First some preliminary comments. This is a very usable device. I wear it almost all of the time – except for two 15 to 30 minute intervals per day for charging. With this system the charge is always well above 50%. With the amount of use I give it I could probably manage with a charge every second day but it’s more sensible to have a routine where I keep it as fully charged as possible (with lithium-ion polymer batterries it is the number of full cycles which matters so frequent charging isn’t a major problem).

Because I wear it all the time it needs to take some punishment. A while back I was cleaning windows and slipped and ground the watch into a concrete wall. It looked like the case and face were badly scratched but after cleaning off the extra concrete and polishing the face a bit there was no damage at all, except for a chip out of the concrete wall. I’m not joking, this thing is very robust!

And yesterday I was doing some work with expanding foam, which contains a solvent capable of dissolving many materials. Yes, I spilled some on the watch, but after it had set I just scraped it off and there’s not a sign it was there.

So this is a device you can actually use and it doesn’t require too much special treatment. I mean, I wouldn’t deliberately slam it into concrete walls but if that happens there’s a decent chance it won’t suffer a lot of damage.

Until recently I hadn’t worn a watch for many years and I thought the basic fluoroelastomer strap might be a bit uncomfortable, but it doesn’t seem to be a problem. And the 42 mm watch just feels a tiny bit too big, but it’s not excessively obtrusive like I initially thought it might be.

Now on to what I actually use it for. As I suspected, it’s really just a supplement to the iPhone. There’s not much I use it for that can’t do with the phone – it’s just a lot easier and more convenient.

Here’s my list of uses: show the date and time, temperature, next appointment, and countdown timer (I have these 4 functions on the watch face); display the phone number of incoming calls; view text messages and emails; compose and send new text messages; view my diary; show distance walked and sleep patterns; display news notifications (currently from the New York Times and Guardian) and notifications of new podcasts on the phone.

That’s the list of stuff I use “all the time”. In addition there are many other functions I use less often: view photos, play podcasts and music, check bank accounts, check upcoming astronomical events, view tweets, use maps, and probably a whole lot more I haven’t remembered just now.

The difference between the “all the time” and “occasional” functions is convenience. Some things just aren’t that easy on such a small screen with minimal inputs (no mouse or keyboard and only basic touch control) when an iPhone, iPad, or computer is available instead.

And that’s the whole point. It may seem like an unnecessary luxury but having all 4 devices works well for me. I usually have an Apple Watch, an iPhone 6S, and iPad Air 2, and a MacBook Pro i7 15″ laptop available. And I use all 4 almost equally. This is an example of the Apple ecosystem working really well for me.

The way the devices work together is the key. For example, I can receive and send text messages (and iMessages) on any of the four devices and they all sync together. And if I put the phone into airplane mode the watch follows it automatically. There’s a lot of small things like that which make the separate devices work as a system.

It does mean that I am stuck with Apple as my supplier of all hardware but that’s a compromise I make to get the level of compatibility and convenience I want. The fact that I am an unashamed Apple fan-boy helps, of course!

So yes, the Apple Watch has worked well for me. There are some frustrations and performance issues, and some things could be better than they are (for example, finding the app I want to launch from the disorganised “cloud” of icons), but for a version 1 product it is very impressive.

Three iPhone Games

September 18, 2013 2 comments

The iPhone is a great gaming platform. It has an excellent, hi-resolution screen, nice sound (through the phones, not so much the built-in speaker), a really powerful graphics processor, a good CPU, and a huge collection of different game apps.

A friend recently criticised it by saying the screen is too small and he prefers his tablet, to which I replied “OK, let’s have a look at your tablet games then”. He had to admit “I don’t have it with me, the screen is too big to carry around”. Exactly. That’s my point. If I wanted a gaming device I could use at home I would use a computer or console connected to a big TV. But I prefer a device I always have with me and that means the screen must be small (I do have an iPad but use it a lot less).

The biggest problem with gaming on the iPhone (and this applies to all categories of apps) is that there is just too much choice. I have apps I have bought (luckily they are all very reasonably priced or free) and never used, and this especially applies to games. But there are a few iPhone games which I not only play, but play a lot: every day in fact.

I don’t have hours to play games but I do have numerous short periods of time when I want to “waste” a few minutes, so I am a “casual gamer” from that perspective. So now I will cut to the chase and list the games I have spent more than a few minutes playing. This could be seen as a recommendation but it really depends on what you are looking for. If you want to avoid wasting time every day playing addictive games then stop now!

Game 1. Clash of Clans. I have played this game every day for well over a year. That has to be some sort of recommendation, doesn’t it? The game has been near the top of the paid charts of iTunes for a long time so I guess many other people are hooked as well!

The game is free but it is difficult to progress without making some in-app purchases of “gems” which allow you to buy upgrades (you can do this without buying anything but it takes a lot longer). I figured the game was worth about $10 so that’s how much I bought. However I do know some people who have spent hundreds!

And that’s the problem. Not only is it a somewhat devious way to make people pay (get them hooked on the free game but force them to pay to make progress) but it does disrupt the balance of the game-play as well. If you are defeated it could be because your opponent is really skilled – or more likely he has just spent a fortune on upgrades!

But I guess I should describe what sort of game this is. It is basically an empire building, cooperative, strategic combat game. The player builds a village and after progressing to a certain point builds a clan castle and joins a clan (of up to 50 other players) where he can swap troops and chat.

Different village buildings can be used to train troops, or gather resources, or defend against attacks. When the player has sufficient forces he can attack other players and win trophies from them. The purpose of the game is to gather trophies (although there are strategies used when building capabilities where players deliberately lose them).

Many processes take a long time (my last town hall upgrade took 2 weeks) and there is usually a 12 hour shield period after a defence so there’s no need to play continuously for long periods of time. It’s just a few minutes to swap troops, a few more to tidy up after a defence, and a few more to attack someone.

The game has a lot of subtle strategy and doesn’t need to involve a huge amount of time so it suits me fine. The fact that I am still playing it after all this time shows how addictive it is!

Game 2. Real Racing 3. I love racing and flying simulations but most of them are too hard to control on a phone. Also, after a few races there is generally nothing new to try in most racing games. But RR3 is different because of several innovative features.

First, there are three driving assists available: steering assistance, traction control, and braking control. If the player turns all of these on all he really needs to do is steer because the car will always brake at the corners to get around them at the right speed. I use the phone like a steering wheel and just tilt it to steer. It works really well. Of course you can go a lot faster if you turn some or all of the assists off, but you need to concentrate or you’ll be off the track at the first corner!

Second, RR3 has a feature called Time Shifted Multiplayer. It’s usually not practical to get 20 people together to race against each other, but with TSM various players races are gathered together and you can race against them after they have played. How it works exactly I don’t know but it’s very effective and more interesting than racing against computer generated opponents.

Finally, the game has an excellently paced way to progress to better cars and events. Every event pays the driver a certain amount and that can be used to pay for new cars or to upgrade the current car. I started with a Nissan Silvia and now have an McLaren MP4-12C. Unless you upgrade your car you will get trashed in the next race!

The events themselves are also quite varied. There’s the short drag race in a straight line to test acceleration and fast gear changes, conventional multi-lap races on many different courses, time trials of single laps, top speed on a lap, elimination events where you must stay out of last place, chase down the lead car, racing against one opponent, and others.

The tracks are quite realistic. After watching the real racing at Mount Panorama on TV the same race on RR3 seems very familiar. The same applies to the cars. They have similar capabilities to the real thing and different cars are better or worse at different types of events depending on their top speed, acceleration, braking, cornering ability, and other factors.

Like Clash of Clans, RR3 is free but some people buy in-game bonuses to advance more quickly. I have progressed reasonably far without spending anything yet but I will probably spend what I think the app is worth because I think the developer should be rewarded for producing such a great game.

Game 3. The Simpsons Tapped Out. Back in the day I must admit I was one of those really lame people who played Farmville. There, I have admitted it! But to move on… The Simpsons is like a more modern version of Farmville where you must build a community (in this case the town of Springfield instead of a farm) by giving the characters tasks to do to earn money and experience which can then be used to get more buildings, characters, and other features.

This is another game I play for a few minutes at a time a few times a day. I just start the app (which I admit takes away too long) and give a few characters some tasks to do, collect some resources, and maybe start building something. There is also a small social element where the player can visit other people’s towns to collect resources in return for some extra experience points.

I suppose the best thing about this game is its sense of humour. The Simpsons is one of the most humorous TV programs ever and that is transferred quite well into the game. The characters have the same personalities and catch-phrases as they do on the TV program and do some of the same wacky things.

For example, currently I have Cletus de-lousing the young ‘uns, the Sea Captain telling a tall tale of the sea, Chief Wiggum collecting bribes, Lisa playing the sax, … well, you get the idea.

Apart from the humour this game is a fun creative outlet because you can rebuild Springfield (did I mention it needs to be rebuilt because of a nuclear accident?) your own way, either crazy or elegantly depending on your personality.

Again, this is a “freemium” app, meaning it is free but some people may choose to buy in-app purchases to make progress faster. So far I have avoided this and because there is no real competition in this game the people who have spent heaps don’t have an unfair advantage over the rest.

So those are my three iPhone game recommendations. Now I must get back to my iPhone because my village just got attacked again, I have a fully upgraded and repaired McLaren ready for racing, and I think Cletus has finished doing the de-lousing!

Laptop Upgrade

November 21, 2012 1 comment

I’m writing this blog entry on my iPad because I’m doing an upgrade on my laptop. Specifically I’m switching it from a conventional hard disk to a solid state drive. I have done the same for a client’s machine recently and I was very impressed with the increased performance, lower noise, less weight, decreased heat, and better battery life. I have also used computers with SSDs pre-fitted – like the new MacBook Pro – and the speed is awesome.

Sounds great, doesn’t it? But if SSDs are so great you might wonder why all computers (especially laptops) don’t use them. Well there is one problem: cost. SSDs cost about 5 times as much as an equivalent capacity hard disk, so they are generally used in most compact laptops (like the MacBook Air) and in premium devices where cost is less of a factor.

In fact all Apple laptops now use SSDs so I hope greater production will mean the price will continue to drop, although it will be a while before conventional hard disks are completely replaced. An intermediate step is Apple’s “fusion drive” which combines a conventional disk and an SSD to give the speed of an SSD and the relatively cheap high capacity of a conventional hard disk. That doesn’t help much in a laptop though because the weight, heat, and power issues are not improved like they would be in a pure SSD.

So how does it work? As the name suggests, an SSD is a solid state device – it has no moving parts – which explains the reduced weight and power use. Because there’s no need to wait for moving parts to access different parts of the disk the speed is also much better – and I mean a lot better: in my testing programs launch, the system boots, and files open up to 5 times faster – it really is a huge improvement.

The technology in SSDs is flash memory, similar to what is in flash drives. It’s not just a simple matter of scaling that technology up though, because most flash drives are designed for a limited number of read/write cycles, but a hard disk replacement must be able to do a lot more. So paying about NZ$600 for a 512G drive is actually quite reasonable.

I am expecting that reliability should be improved as well because the lack of moving parts should improve robustness. That is a bit of an unknown factor because SSDs haven’t been widely used for long enough yet to get an accurate idea of reliability. All I will say is that I have a box with about 100 dead hard disks in my office but no dead SSDs… yet!

I’m finishing off this entry on the laptop – after the 5 hour process of the data copying from the old disk to the new one – and I am happy to say the performance is as good as I had hoped for. I click an icon and a second later the program is ready, plus the area of my laptop above the hard disk is cool instead of warm like it used to be.

So my recommendation for anyone wanting to improve the performance of their computer is to consider an SSD – in many cases it will provide a better boost than a fast hard disk, more memory, or even a a faster CPU or GPU. Of course it will depend on the specific machine, what it is used for, and how much data you have to store, but I’m convinced SSDs are the easiest way to really make a difference.

Recursion: See Recursion

August 28, 2012 2 comments

Today I listened to a Radio NZ podcast which discussed computer science. One of the topics they talked about was recursion, but in my humble opinion they didn’t explain it very well. Many years ago I did a computer science degree and have worked as a computer consultant and programmer ever since so I wanted to offer my own contribution to the topic here: that is recursion and programming in general.

First I want to say why I love programming so much. To me it is the ideal combination of art and science. That suits my personality best because I am an analytical and precise person but I also like to be creative. There is no other profession that I know of which combines both of those elements in quite the same way. Writing a program involves solving a problem in an analytical way but many of the elements of creating a program also involve a lot of creativity and “beauty”.

In programming (as in many fields where beauty seems a strange word to use as a description, such as maths) beauty refers more to the elegance, simplicity, and subtlety of a solution to a problem more than any outward manifestation of the item being created. In programming there is often an opportunity to create a visual interface which can be described as beautiful but that’s not really what I am talking about here. It’s deeper and more subtle than that.

When I write a program I don’t just try to solve the initial problem, I try to make the solution extendable, tolerant of errors, fast, compact, and easy to understand. Usually a short program is a far more impressive achievement than a long one which has the same function. And every moderately complex problem has an infinite (or so close to infinite that it doesn’t matter) number of possible solutions, some of which are elegant and beautiful and some which aren’t.

Of course there is a certain amount of subjectivity in judging how good a program is but, as in most areas of expertise, skilled programmers will generally agree on what is good and what isn’t.

Now getting back to recursion. First of all, what is it? Well it’s a way to solve a problem by creating a series of steps (what computer scientists call an algorithm) and allowing that algorithm to refer to itself. The nerdy joke in the computer world is that if you look up recursion in the dictionary the definition will include “see recursion”. There is also the little “in” jokes where some languages have recursive names. For example the name of the scripting language “PHP” is a recursive acronym for “PHP: Hypertext Preprocessor”, and GNU is an acronym for Gnu’s Not Unix.

The serious example given in the podcast was an algorithm to climb stairs which went like this: (I have given the following steps the name “climb”)…

algorithm “climb”:
go up one step
are you at the top?
– if no: “climb”
end (of climb)

You can see in this example that the algorithm called “climb” has a step which refers to itself (the last step “climb”). But this is a bad example because it could also be done like this…

go up one step
are a you at the top?
– if no go back to “start”

This is what we call an iterative algorithm: it iterates or “loops” around until it stops at a particular step. Generally these are more efficient than recursive algorithms.

By the way, I realise that neither of these work properly if you start at the top of the steps already. That sort of thing is a common programming problem and one which is obvious and quite easy to fix here but often not in more complex algorithms.

So what about an example where recursion does make sense? There is a classic case often used in computing which involves processing a binary tree. So what is a binary tree? It’s a structure in a computer’s memory which contains information in a way which makes it easy to search, sort, and manipulate in other ways. Imagine a series of words and with each word are two links to two other words (or the link could be empty). The words are put in the tree so that the left link always goes to words alphabetically before the current word, and the right link to words after.

If the first word is “computers” for example and the second word is “are” the second word would be accessed from the left link from “computers”. If the third word was “fun” then that would go on the right link from “computers”. if the fourth word was “sometimes” it couldn’t go on the right link from “computers” because “fun” is already there so it would go on the right link from “fun” instead (“s” comes after “f”). If the next word was “but” that would go right from “are”. Continuing the sentence with the words “can be tricky too” we would get this…

Now let’s say I wanted to display the words in alphabetical order. First I make a link pointing to the top of the tree. Now I create some steps called “sort” which I give a link to the current word (initially “computers”). Here are the steps…

Algorithm “sort” using “link”:
Is there a left link at the word for the link you are given?
– if yes, “sort” with the left link
– if no:
— display the current word
— is there a right link?
—- if yes “sort” with the right link.
end (of sort)

That’s it! That will display the words alphabetically. The first link points to “computers” but there is a left link so we send a link to that which points to “are”. There is no left link so we print “are” and send the right link (to “but”) to sort. There is a left link so we send that (to “be”) to sort. There is no left link so it prints “be” and finds no right link. At that point the sort algorithm ends but the previous sort which caused this sort to start is still active so we go back to that. That sort pointed to “but” and we had just taken the left link, so we carry on from that and check the right link using sort. That takes the next sort to “can”, etc…

The key thing here is that each time “sort” is used it sticks around until the end, so there can be any number of sorts waiting to continue where they left off before a “sort” further down the tree was started.

Wow, that sounds so complicated but it’s really quite simple. I did all of this from memory and it’s quite easy when you understand the concept. Without recursion sorting a binary tree would be difficult because there is no reverse link back up the tree and no easy way to remember what has already been done at each word. With recursion when one version of sort launches another its information is left behind and creates a way to go back up the tree when the one it started has finished running.

The recursive algorithm in this case is efficient and elegant. It’s also very simple because all of the complexity that might be required otherwise is available as an intrinsic part of how recursion works. It’s a simple example of “beauty” in programming.

More iPad Comments

August 5, 2010 Leave a comment

About 3 weeks ago I blogged about my first day as an iPad user. Now I have used one for a lot longer and two things have happened: first, the initial novelty value has worn off; and second, I have found areas where it is more useful than I originally thought that it would be.

So what novelty has gone? Well I don’t get as many people approaching me and wanting to talk about it. Maybe that’s because the iPad has been an unprecedented success. The local store I talked to the other day said they had sold about 70 of them (mostly the 3G model) in the last week. So there are more around now and the early adopters, like myself, are no longer anything too unusual.

I’m probably not spending much less time using the iPad now than I did when I first got it. In that time I have written 6 blog entries (including this one and my longest blog entry ever titled “is atheism rational”) on the pad and only one one my laptop. I also do a lot of email and some web browsing on the pad, but my laptop is still my work machine: you just can’t do serious web programming without a real laptop.

I spend more time playing games on the pad than on any other platform. The games aren’t necessarily better because, although the iPad does have a good processor and a good graphics chip, it still can’t compete with the extra power available on game consoles and real computers. But the games are very good and the convenience makes up for the lack of pure power.

In my original post I suggested about $100 as an adequate amount to buy apps but I have now gone significantly over $200 and I could have easily spent a lot more. iPad apps are more expensive than their iPhone counterparts even though they are essentially the same. Sure the most expensive one so far was only $14 but after buying a few useful apps at that price, a few games at $6, magazines at about $4 and cheaper programs and smaller games at just over $1 the total does start adding up.

But spending over NZ$1200 on an iPad and then not making real use of it by using good apps seems to be false economy. I’m just saying that if you get an iPad set aside some cash to get some good apps so that you are really making the best use of it.

So moving on, what are the good and the bad capabilities of the device? Well first, it’s surprisingly good to type on. The keyboard in landscape mode is the same size as a real keyboard and, although the lack of movement in the keys feels a bit weird, I can really type quite quickly and accurately on it (and I readily admit I’m usually a terrible typist).

It’s also very usable as a book reader. I have spent fairly long periods of time reading and have found it no harder than reading a real book. The only issue is reflections from the glossy screen. I realize that a glossy screen is almost essential for a touch device because it would be too hard to keep clean otherwise. I specifically got an anti-glare screen on my laptop and think it was well worth the extra cost, but I just have to watch the positioning to make the iPad easier to read. Its maybe a little bit heavier than it should be too, but that hasn’t been too much of a problem.

As a basic internet device it’s brilliant. I actually prefer to check and read my email and compose short email messages on it and it does web browsing really well because the screen is big enough to display the page just as well as many conventional computers do. The lack of Flash has been a problem only very rarely and I really think Apple has effectively killed Flash as a technology.

As a media device it’s also very good. I still use my iPhone to listen to podcasts, simply because it’s more portable, but I watch movies on the pad and it does that really well (except for the glare issue again).

I have some special purpose programs which I find very useful. Astronomy programs work really well. One of them allows me to hold the pad up to the sky in the direction of objects I want to identify and a map appears showing that part of the sky.

So that’s enough good news, what doesn’t work so well? I just realized yesterday that I can’t print. That’s not really an issue for me because I never print anything even form my real computers but some people might find it annoying. Of course you can email documents to your computer for printing but that’s not very elegant.

As I have said in a couple of places above, the glare from the screen can be annoying. That can be minimised by positioning and turning up the brightness (which does go quite high) but it can be a nuisance.

Document sharing between the pad and the computer can be a bit clunky. I usually do this through iTunes and a USB connection but it would be nicer to have a more transparent system. Of course, it is possible to move documents through email too, but that’s not ideal either.

Because the iPad currently only runs iOS 3 there is no multitasking for most programs and the mail program doesn’t have an integrated inbox. These problems will be solved when the pad gets iOS 4 but they can be annoying at the moment. The super-fast launch times for apps makes the lack of multitasking a bit more bearable.

So overall I love my iPad. There are areas where Apple can make it better, of course, but for a new device it’s very smooth, very reliable (it never crashes although some apps have crashed on rare occasions), and really fun to use!

Categories: computers Tags: , , , ,