Archive

Posts Tagged ‘tips’

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 1 comment

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…

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

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: , , , ,

One Day With the iPad

July 14, 2010 Leave a comment

I have used my new iPad (the top model with the 3G cell network and 64 G of storage) for one day now. So what are my conclusions so far? First, it’s too early to tell for sure. Of course when you get a new toy it seems great to start with but that doesn’t necessarily mean it will be useful long term.

My initial impressions and the general feel are great. Operation is very fast and fluid. The visual effects are beautiful and the user interface is intuitive. It’s a real Apple device: carefully designed and with great attention to detail. This makes it more than just a “big iPod Touch”. It’s more like a totally new and different type of device.

One thing I tried to do on the iPhone was write blog entries and other text. But it just didn’t work because the screen was too small and the keyboard was too unreliable (or at least my typing on it was). I’m writing this on the iPad in Pages and it is a much better experience. I can type here almost as well as I can type on my laptop using both hands and multiple fingers instead of the single finger typing I use on the iPhone. I do have to say that after a while you can enter text quite well on the phone too but I could never use it for more than just short notes.

I mentioned I am using Pages. It isn’t included with the iPad so I had to buy it from the app store. In fact I have already “invested” quite a lot at the app store – including Keynote and Numbers as well as Pages. I also got the Time magazine app (which is free) and bought one issue of the magazine to test the experience reading that sort of material as well. If you buy an iPad you should set aside a budget for apps. I would suggest about 50 to 100 dollars (New Zealand).

I started by copying over all my apps for the iPhone but since then I decided to only install iPad apps. I did this for two reasons: first, because the iPhone apps don’t look very good scaled up to fit on the bigger screen; and second, because I want to try out different programs which are more suited to what the iPad can do.

Of course I’m not certain what the iPad will be used for yet. I thought it would be a book reader and a web browser but Its starting to look like it might be a useful substitute for my laptop for simpler tasks. I have used Numbers to look at existing spreadsheets and Keynote to view presentations and they have both worked well. But I’m not sure how well they would work for creating new content yet.

Some of the iPhone apps work the same on the iPad, except it’s not the same because the extra speed and extra screen size transforms them. One which is particularly impressive is the astronomy program “Sky Voyager”. I am looking forward to having iOS 4 on the iPad though because multitasking for viewing the sky maps and taking notes would be useful for astronomy.

I will use the iPad for another week and write another blog entry then. At that time I should be able to report about how usable the book reading experience is.

iPhone Notes

March 31, 2010 Leave a comment

The iPhone has become very popular but I have noticed that there are two types of iPhone user: one, the people who use it to its full capability; and two, those who just use it like an expensive phone. Of course, as a serious iPhone user and connoisseur of fine technology I think it’s a waste when people don’t use high-tech toys to their full capabilities.

So there are two things you can do to make the most of your iPhone. The first is to make use of the capabilities it has built in, and the second is to install some apps (an app is an application or program which runs on the iPhone) and get extra functionality that way.

It’s surprising how many people don’t use the audio capabilities of their iPhone. When it was released Apple said it was the best iPod they had ever created. That’s right, the iPhone is a very good iPod and I think everyone should use that function. I’m not saying everyone should walk around listening to music all day (although that’s not a bad idea for many) but their are other ways to make use of the audio abilities: podcasts, lectures, and audio books, for example.

I think that everyone could benefit from subscribing to some podcasts which fit into their interests or professional expertise. I certainly find podcasts are an essential way to keep up with some of the details in areas which interest me, such as: computers, technology, science, skepticism, philosophy, and general news. There are so many podcasts that I think everyone should find something they can use.

Photos are another area where I think the phone is useful. It’s easy to synchronise an iPhoto library with a phone and I find that having my photo collection with me at all times can be quite useful. The screen is just big enough to make it suitable for displaying photos without being too big to always have with me.

Using the calendar and address book is more common because that’s a traditional function of smart phones but anyone who hasn’t got their calendar synchronised with their computer should do that. It works well through Apple’s MobileMe service but corporate Exchange servers also work OK.

All of the above can be done with little effort using the functionality built in to the phone. To extend that there are plenty of iPhone apps. Actually “plenty” doesn’t really begin to describe it because there are so many that it’s difficult to sort through them and find the ones which are genuinely useful!

The iPhone is a closed platform which means Apple controls all of the programs that can be run on it. That’s bad because they can block stuff they don’t like and it sometimes delays availability of new stuff but it’s also good because there is a quality check on new programs and a single place where they can be found (that is the iTunes app store).

So, unless you have “jailbroken” your phone you will need an account on the iTunes store to get apps. Many apps are free but you still need this account set up even if you aren’t intending to buy anything. Note that this account can also be used to buy other media such as music from the store.

The biggest problem with the app store is that there is just so much there. That’s a nice problem to have I guess, but it makes downloading a good starting set of apps difficult. So I have come to the rescue and am going to recommend a few of the more useful ones I own! Some of these are free and others may be paid (usually only 1 to 10 dollars) and I really can’t remember which I paid for now but I hope this isn’t too inconvenient.

AppBox Pro is a useful multi-purpose utility which replaces many other small single-purpose apps. I find this useful because it reduces the amount of clutter on my screen. Here’s some of its more useful functions: currency conversion, date calculations, a flashlight, a level, loan calculator, ruler, translator, unit converter, and many others.

Air Sharing makes it easy to transfer files from a computer to a phone over a wifi network. Once the files are on the phone it also makes it easy to view them. It supports formats like Word, PDF, text, JPEG, etc.

AroundMe uses the iPhone’s GPS to locate useful businesses and facilities around you. For example you could ask for the nearest coffee shop and it will list them in order of proximity plus provide a map and directions to get there.

Dictionary (actually I have two apps called Dictionary) is a dictionary which includes a thesaurus and pronunciation. It’s very handy for looking up definitions anywhere and is much faster than using a paper dictionary.

Evernote allows you to take photos of stuff that interests you and store it “in the cloud” so you can access it from your phone of computer later. Information can be tagged and classified for easy access. You can store a smaller number of items for free or pay for greater capacity.

Facebook is the official app used to access the popular Facebook social web site. It’s really well designed and makes it easy to make new posts (including photos) and read your friend’s posts as well.

Google Earth is the iPhone version of the well known program. It’s nice to use because you can move around the world using gestures (for example using the pinch gesture to zoom in and out).

Shazam is a neat technology demonstration and one which is also useful. It will listen to any music and tell you what it is as well as displaying the album artwork and offering various ways to download it (legally).

Starmap is currently my favourite astronomy app. It displays a map of the night sky for any location on Earth at any time so I find it useful to plan observing sessions and identify objects I may have forgotten.

Tweetie is currently my favourite Twitter iPhone app. The problem here is that there are so many good ones it’s hard to choose. Anyway I find it really easy to use just to tweet my latest activities, including photos which can be easily taken with the iPhone’s camera.

WordMaster is useful if you do crosswords and other word puzzles. It will look through hundreds of thousands of words in a second and give a list of matches. It has really helped with solving some puzzles which dictionaries and dedicated electronic dictionaries have failed on.

The iPhone doesn’t have a built-in FM receiver but WunderRadio allows you to tune in to thousands of internet radio stations from all over the world. It works really well but you do have to be careful of streaming too much information if you have a limit on your cell data.

So that is about a third of the general apps I have installed on my phone (about 4 pages of them). I also have one page of utilities and two pages of games but I might leave a description of them for another blog entry. By the way, I wrote this on my Mac laptop because entering a lot of text is one thing I just can’t do efficiently on the phone!

Categories: computers Tags: , , , ,

A Useful Mac Program

March 25, 2009 Leave a comment

Occasionally I discover a new Mac program which is just so useful that I have to tell everyone about it. This time the program is something I have been using for a while now but I have just discovered new functionality which makes it even more useful than I previously thought. The program is TextExpander. If you use a Mac you should read this entry and consider using this program.

The basic function of TextExpander is to expand text (as you might have guessed). Its a background process which waits for you to type a shortcut and then inserts the expanded text into the current program you are using at the insertion cursor.

This means that you can type a short sequence of characters and have a much longer or more complex sequence substituted. For example, if I want my email address inserted I just type oj“ and TextExpander expands that to “ojb@mac.com”. That only saves a few characters but I can use a different short sequence to expand to my full 6 line postal address or even more – in fact pages of text if necessary.

I use a two character mnemonic followed by two backquotes because I never need to type two backquotes otherwise. That means TextExpander won’t expand stuff when I don’t want it to. The sequence can be anything though. If I was never going to just type oj by itself I could have that expand to my email address instead.

So that’s an example of a simple substitution but it goes beyond that. TextExpander can also substitute dynamic data like the date and time. For example, if I want Greenwich Mean Time inserted I just type gm“ and I get “Wed, 25 Mar 2009 15:32:29 GMT” substituted. I have similar shortcuts for the date and time in different formats and other data.

Another powerful feature is that the substitution doesn’t have to be text. If I wanted my signature inserted as a graphic for example I could just type ms“. Obviously the program I’m expanding into would need to support graphics for this to work. Text substitutions seem to work everywhere, even in the Finder where I can insert the date into a file name by typing dm“ (the dm here stands for day-month-year. I use ym“ to give a year-month-day date, such as 2009-03-25).

Recently I discovered a feature which I had never noticed before. TextExpander can run an Applescript and substitute the result instead of doing a simple text substitution. I use the TinyURL web site to create short URLs which can be used in Twitter and other places. To get a short URL I can copy (or cut) the long URL I want shortened then type tu“. The shortened URL is then substituted by TextExpander (which sends the long URL on the clipboard to the TinyURL web site, returns the shortened version and substitutes it into the current document).

I can see that using Applescript might allow me to generate all sorts of useful dynamic data. Applescript can call Shell scripts, can access databases, documents, and just about anything else, so there is no limit to what can be done. I will create a page on my web site with useful substitutions, scripts, and other tips soon.

You might think that remembering all of those shortcuts is hard but it isn’t really. Its just a matter of choosing sequences which make sense but don’t get triggered accidentally. After a while it becomes so natural that I type them on other peoples’ computers and wonder why nothing happens! As well as that, all the substitutions can be accessed from the TextExpander menu, but that partly reduces the speed of the whole system.

TextExpander is published by Smile on My Mac. Their web site is http://www.smileonmymac.com/TextExpander/ and the program is US$29.95 shareware.

Categories: computers Tags: , , ,
Follow

Get every new post delivered to your Inbox.

Join 95 other followers