kdmurray.blog

The crossroads of life and tech

A Changing Mobile Landscape

For the past year or so I’ve been trying to decide what laptop to buy. My current machine, a 2006 MacBook, is on its last legs and really hasn’t been an effective mobile computer for over a year due to a drastically shortened battery and what appears to be a busted wifi antenna. The machine has done great things for me for the past several years and is the primary machine from which I’ve authored most of the posts on this blog. It managed to get me started with podcasting and has been my primary development machine for nearly all my programming projects, regardless of platform. The machine still performs quite well considering its age and how much I’ve used it over the past five-and-a-half years, really the biggest reasons for me to upgrade it are its newfound lack of mobility (no battery or wifi) and its lack of ability to run OS X Lion and by extension the new version of XCode because Lion will not run on the Core Duo line of processors.

The logical step seemed to be replacing the 13″ MacBook with another MacBook of similar size and capability. The natural contenders were the MacBook Pro and the MacBook Air, both 13″ models. Most of the decision for me had started to revolve around the specs of those machines. Which one could hold more RAM? Which could have a larger hard drive? Do I need an optical drive? These questions plagued me for a number of months and I continued to debate which of these laptops was the right fit for me. One day, while browsing the web looking for indications of an upcoming refresh of the MacBook line I had a bit of an epiphany. I needed to follow the advice at I’ve given to friends and family for years when it comes to technology — don’t focus on the specs, decide what it is that you want or need the technology to do. This was an exercise that I had completely failed to undertake.

Understanding My Technical Needs

As I began to examine just what I used technology for on a daily basis some themes began to coalesce from the jumbled mishmash of devices, services and applications. When the patterns first became visible I was a bit surprised, mainly because they were leading me down a path I didn’t expect — a path which I had felt until now was for the less geeky, the non-power-user… the normals. My analysis was telling me that I didn’t need to get a mid- to high-end laptop, in fact it was starting to look like I didn’t need a laptop at all…

How did I come to this conclusion?

In any given week there are a number of things that I use computers for, typically all of these tasks have been done on my main laptop which was the centre of my digital life. When I looked over list list closely, the first pattern began to emerge.

  • Podcasting
  • Audio Editing
  • Working with family photos
  • Software development
  • Blogging
  • Writing
  • Watching video podcasts
  • Reading blogs and news sites
  • Casual gaming

Power User Tasks

Some of these tasks are really best suited to the stationary environment that my MacBook has been confined to for the past many months — it’s better to be at a desk with a big screen, a fixed setup and a hard-line to the Internet. The big screen is particularly important for me when I’m working on software projects, editing audio and working on photos. Having the extra screen real estate for toolbars and being able to get into the details of a photo makes those tasks more enjoyable when I can plug the screen into my laptop. These tasks also require a computer with a reasonable bit of power, but still nothing I would call a powerful workstation.

Light Content Creation

By contrast, I prefer to do my blogging and writing when I’m not confined to my desk. These are tasks I’ve really enjoyed having the laptop for because they’ve allowed me to get out and write in other locales, whether its in my living room, in bed or at the local coffee shop. The portability of a mobile device allows me to be wherever my creative juices will flow, and where I can even get some sunshine on occasion. These tasks, however, don’t require particularly powerful hardware. Even the most basic laptop with a wifi connection is enough to be able to take on most small writing projects and blogging assignments.

Casual and Mobile Applications

The last set of tasks fall neatly into the “content consumption” category. These are also tasks that I would very rarely do at my desk, but would rather read and watch with other people doing the same kinds of things, such as my wife and I reading for a bit on a Sunday afternoon during our daughter’s nap. This means that I definitely don’t want to be tied down to my desk in the basement, mobility is a key feature for these use cases.

Looking through these three groups of tasks, or use cases, a brand new 13″ MacBook Pro would fit the bill quite nicely. It has the power and expansion ports to take care of all of the power-user tasks quite handily. The 13″ size is still small enough to make the device nice and portable so that I can take on all of my writing assignments wherever the mood strikes me, and I could still use it for reading blogs and watching video podcasts.

As I thought about it more I also realized that there were some down sides to my one-machine-to-rule-them-all approach. The first being the cost of mobility. Every time I want to switch between my power-user setup and my mobile setup, I have to detach all of The devices from the MacBook, and then reconnect everything the next time I want to code or podcast. While these could definitely be considered trivial problems to solve, my inherent geek laziness doesn’t relish the prospect of continually connecting and disconnecting cables for the next four or five years. There is also the issue of heat with the higher-powered MacBook. They do run fairly hot, and whenever I use one for more than 10-15 minutes on a couch or some other similarly loungy position I find the need to place a towel or pillow between me and the device just to keep myself cool (being careful to keep the fan vents clear of course). Lastly was the price, the mid-range MacBook Pro with more RAM and AppleCare would set me back a bit more than $2000 after taxes. While not insurmountable, it’s certainly not a trivial amount of money.

The Rethink

After having considered my options a bit more carefully I began to realize that having a portable desktop-replacement like the MacBook Pro really wasn’t what I needed. I don’t write code away from my desk (except on a few very rare occasions), and I certainly don’t podcast away from my desk. When I looked at my mobile use cases, a great many of them could easily be accomplished with a a much lighter device -gasp- a tablet. In some cases the tablet experience would arguably be better than the computer experience. The tasks I wasn’t convinced would be good on a tablet were the writing and blogging tasks. My experiences trying to write using the onscreen keyboard of my iPhone had convinced me that I was going to need a physical keyboard to do that kind of work. That said, there are physical bluetooth keyboards available for tablets which can make that experience very similar to working with a laptop. The external keyboard has the added advantage of being removed and stowed when not in use.

Now the catch here (because there’s always a catch) is that the tablet can’t handle the more powerful scenarios laid out in my Power User Tasks section above. It’s limited storage, memory, processing power and screen real estate meant that I would still need another solution to supplement the tablet. This will likely be a mid-range Core i5 or Core i7 Mac Mini, but the need for that device isn’t quite as urgent, so the existing stationary MacBook will continue to fill that role until the next refresh of the Mini line, hopefully around the same time as the Mountain Lion launch.

Decision

With that last piece of the puzzle out of the way, I reached a final decision to extend my Apple ecosystem and picked up a 32GB 3rd generation iPad earlier last week. I have some additional tools coming to supplement the device including a case, a keyboard and a stylus, but details on those will have to wait for another blog post. So far I have been able to do all of my mobile tasks on the iPad, including writing. I banged out this entire post on the iPad using the on-screen keyboard. There were certainly more errors here than on a physical keyboard but it’s certainly serviceable.

Admittedly I didn’t give much consideration to purchasing a non-iPad tablet. This is partly because of my existing Apple “lock-in” with the iOS devices I’ve had in The past, including my iPhone, there is some amount of money invested in software. Having all of Those applications instantly available on my new iPad is nice. In addition, the iPad and iOS are a known quantity more than the other tablets.

While it has only been about 5 days since I made the decision to essentially abandon my use of laptops for the next few years (with the exception of my office-issued machine) I’m really enjoying it so far. There will undoubtedly be more to come on this topic as I learn everything I can about integrating this newest piece of technology into my workflows.

Bloggers – Get an Editor!

I started this post with the intention of publishing it on Grammar Day. Unfortunately I missed my deadline. Regardless I present for you a rant.

You need an editor. If you publish your writing, you need an editor. Let me be crystal clear, when I say “publish” I don’t mean books or magazines, at least not exclusively. I mean: if you put your written words in front of the eyes of other human beings (or intelligent animals) you need to have somebody edit it – and that somebody can be you. I am not asking for the world, your writing does not have to be perfect, but it should be free of glaring errors that make your writing difficult to understand and painful to read.

Typographical Errors (typos)

One of the most common problems in writing is that the writer’s fingers can start to move faster than their brain. This can lead to keys on the keyboard simply being pressed out of order. A few examples from my own writing:

  • the becomes teh
  • have becomes ahve
  • Paris becomes PAris

These kinds of errors can be detected by many different text-editing programs, and in more recent years by web browsers. Firefox, for example, will detect many spelling problems and underline the offending words to draw your attention to them. Please don’t ignore them.

Subject-verb Disagreement

This can be a more difficult problem to track down, particularly if English is not your native language, but it makes a tremendous difference in how your writing is perceived by your audience. Mignon Fogarty once referred to this as “the illness that kills your credibility” and I, for one, agree with her. These kinds of errors can creep into our writing when we don’t take into account the way that words in our sentences interact with one another. In some cases this can stem from a lack of familiarity with the language.

  • Dave and Amy is coming over tonight — is should be are, there are two people coming over
  • that team are mean during the game — are should be is, the team is being referred to as a single entity
  • either Amy or Dave are going to help tutor him — are should be is, the two individuals are treated separately

While these are trivial examples, there are more complex rules and scenarios that are worth reviewing. I learned a couple of things while writings this post. There are some excellent examples of subject-verb disagreement in this post by Richard Nordquist.

Verb Tense Disagreement

The last subject I’d likes to cover is somewhat related to the last one and can be just as difficult to track down, particularly if you are not paying close attention. Verb tense disagreements occur when a sentence contains more than one verb and they appear in different tenses. For example one verb in a past tense, and another in a present or future tense.

  • John slurps his soup when he ate — slurps could be slurped or *ate could be eats
  • Adam and Jamie make explosions when they were on TV — make could be made or were could be are

This one can occasionally be a bit more tricky to resolve because there are almost always multiple possible solutions. Selecting the correct one for your piece depends on the context, and often the verb tense of the surrounding sentences.

Wrapping up

While this is far from an exhaustive list of crimes that writers (including me, on occasion) perpetuate against the English language, they are some of the most common and often the most distracting. Simply giving your writing a once-over can help to eliminate many of these problems. Even when you are not 100% certain about the rule, many of these errors will simply “sound wrong” if you read them aloud. Correcting them immediately will help make you a better writer and save confusion and stress on the part of your readers.

Programming Languages 101

A few weeks ago I got an email from my brother asking about some programming tools for a project he wanted to try. He’s a fairly technically savvy guy, but has very little experience programming. He had asked a couple of questions which made assumptions about the lineage of some modern programming languages — assumptions which are totally reasonable given the names, but which didn’t reflect the actual nature of the languages.

This post is based on the email response I sent him.

Disclaimer: I realize that I have glossed over a number of technical details, and even introduced some of the concepts in a way which may even have some technical inaccuracies. This is not intended to be a technical manual, simply an introduction to a technical topic in terms that most non-programmers should be able to figure out.

Typically there have been two primary types of programming languages, compiled and interpreted. The source code of a compiled language is read by a lexer, parsed and then re-written into low-level machine instructions which can be executed directly on the hardware involved. Compiled languages almost always need to be recompiled for each individual platform because the physical instruction sets of Intel (x86), SPARC, ARM and other processors are all different. Operating system calls are also different. This means that code compiled to run on an Windows-based Intel machine won’t run on a Solaris-based SPARC machine.

Interpreted languages are not compiled. They are executed as they are read by some other process. These are sometimes called “hosted” programs since they don’t execute natively on the computer which is running them. The host process (web browser, game, or other runtime environment) reads the script line by line and then takes the appropriate action. So it’s the host process which actually reads files, communicates with the Internet or displays graphics on the screen. The interpreted language (script) is little more than a recipe. This is why differences in the implementation of the specification behind the script can cause such big problems. When you have 5 different web browsers which don’t quite agree on how to execute a particular construct of JavaScript it’s like the chef’s at 5 different restaurants having a different idea of what a medium-rare steak is. Sure it’s nice if one happens to do things the way you want, but you’ll never know until you try them all.

C is like the grand-daddy of modern languages. It’s curly-brace syntax pervades many modern languages (C++, Java, C#, JavaScript and many others). It is, however, a much lower-level language providing direct control of many system resources. C can also be optimized for speed and does not explicitly require any external frameworks or libraries to work. It’s a good language to have a grasp on, but may not be one you would ever use on a day-to-day basis.

JavaScript (a variant of and predecessor to the ECMAScript standard) was a language developed by Netscape in the 1990s to be a part of its web browser. Aside from the curly-brace design and the name, JS has absolutely nothing to do with Java. Until very recently, JS was purely an interpreted language. Its domain was to live inside the browser and help animate funny little things on screen or possibly display messages as you filled out a form. It’s only in the past few years that JS has really taken on a more leading role as massive libraries of complex JavaScript (jQuery) and people doing some seriously cool stuff with the language have led to uses of JS outside the browser. The node.js project is a perfect example. Node (whose executable is written in C) will serve as an engine for running JavaScript from the command-line much in the same way as Python, Perl and PHP do.

Just as most rules are made to be broken, so is the rule about a language being either compiled or interpreted. There are some languages which are a strange (and powerful) hybrid of both. Java and C# are both compiled languages. The thing is, they don’t compile down to natively executable machine code. They compile down to an intermediate format which is then interpreted when the code is executed. This provides a mechanism for the compiler to optimize the code for faster execution, while also providing a mechanism for the code to be ported to other platforms with minimal modifications.

From a language perspective C# and Java are like half-siblings… both members of a generation of languages designed to help build large cross-platform enterprise business systems, which have been drawn out into other areas due to sheer popularity. Visually the two languages look almost identical, with similar features and a “C-like” syntax, but due to each one being built to operate primarily with it’s own native framework (.NET for C# and J2SE for Java) the source code is essentially incompatible with the exception of a few trivial examples.

This all brings me to HTML5. This term has to be one of the most overused, over-hyped and poorly understood technological terms of the past decade. The name would imply that HTML5 is a new version of the HTML specification, designed to replace the rather aged HTML 4 specification in use on most websites today. And technically, that’s exactly what it is. There is a new version of HTML with some new tags (like <;video>; and <;canvas>;) which will provide web developers with some new tools to create compelling website experiences. The problem is that there are a lot more things behind the scenes that really make the next generation of web platforms powerful. A new version of HTML is just the start.

The new additions to the HTML DOM (Document Object Model) bring with them more powerful capabilities for JavaScript and CSS to help code and style the way web applications work. The <;canvas>; element is great, but it doesn’t do much without some fabulous JavaScript code to do the heavy lifting.

The next iteration of the CSS will provide more versatile styling for websites, allowing designs to function both for the desktop as well as the dozens or hundreds of combinations of screen sizes and browser capabilities on modern mobile devices. There’s a big difference between the kinds of things an iPhone 4S can display compared to a 3-year old BlackBerry Bold — both of which I have on the desk in front of me.

To wrap this up I really wanted to thank my brother for asking the question and giving me the opportunity to examine this question in detail. It isn’t something that I think about in my day-to-day work with software, but it’s still something important that bears examining from time to time.

Ubuntu School – GUI (xubuntu-desktop) for Ubuntu Server

Whether it’s because you’re not fully versed in the power of the command line, or you just want to use a tool that will speed things along like gparted, the command-line isn’t always the best tool for the job. Sometimes you just need a GUI, even if it’s just for a few minutes. I’m going to walk through how to do the installation on Ubuntu 11.10 with the assumption that you only want the GUI occasionally, and don’t want it consuming server resources all the time.

The first step is to get the GUI tools installed. sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xubuntu-desktop

That was the simple part. At this point you now have the GUI installed, but it will start the GUI every time the system boots, loading all of that extra cruft into memory. The next steps that I followed from a post on Techinote shows the steps to disable the automatic startup of the GUI environment.

sudo apt-get install lightdm
sudo nano /etc/default/grub

find the line GRUB_CMDLINE_LINUX_DEFAULT and set it to GRUB_CMDLINE_LINUX_DEFAULT="text"

sudo update-grub
sudo update-rc.d -f lightdm remove
sudo shutdown -r now

Done!

Your system will now be at the text-based login screen (as it was before this all started). When you need to use the graphical environment, simply type startx and it will move you into an already authenticated GUI desktop environment. This will allow you to setup and configure tools with a GUI (like CrashPlan) without having to rely the UI being constantly loaded and running in the background.

Ubuntu School – Get Rolling with Webmin on Ubuntu Server 11.10

Even if some Linux purists would have you believe the command-line is the only way to go, the pragmatist in me will always take an appropriate GUI over a complicated command-line any day. You can run a lot of powerful services for your home network using one or more Ubuntu server machines. With the right tools you don’t need to be a Linux expert to make that happen.

The tool of choice is Webmin. This is a set of web-based tools which allow you to control virtually every piece of server-side software on you Ubuntu server. The GUI is intuitive and straight-forward, the documentation is excellent, and the project is under active development.

Because Webmin isn’t in the standard repositories you will have to do a couple of quick command-line changes to configure your system to be able to find and download the apt package.

sudo nano /etc/apt/sources.list

Once the file is open, add these lines to the bottom of the file

#########################

Package Sources for Webmin

deb http://download.webmin.com/download/repository sarge contrib deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

Those lines will add the necessary sources to apt for it to find the Webmin package. The Webmin package has also been digitally signed by its author. By default you will need to download the author’s key so that apt can use it to verify the Webmin package at install time. Fortunately, this is really easy to do.

wget http://webmin.com/jcameron-key.asc sudo apt-key add jcameron-key.asc

Now that all the prep work is done, it’s time to install Webmin.

sudo apt-get update sudo apt-get install webmin

All done! Now you can access administrative functions of your server’s services from the Webmin console: https://yourservername:10000/. This URL is also shown in the last few lines of the apt install details that are ouput to the command-line.

Running Shell Scripts from the Finder in OS X

Bad AppleOne of the things that drives me insane about the Mac on occasion is the ability of OS X to make some of the simplest “power-user” tasks very difficult. Case in point – the ability to execute a shell script from a finder window (or by extension, the desktop).

In most sane operating systems, including Linux and Windows, if you double-click on an executable file, it executes. It’s just that simple. If you create a batch file on Windows (anything ending in .bat or .cmd), the operating system treats that file type as executable and will try to run the contents as command-line commands. In Linux, an operating system which is similar under the hood to OS X, you need to set the “executable” bit in the permissions. This is certainly more of a super-user type task than simply renaming the file, but still quite simple — and consistent across the POSIX world… except for Apple.

chmod +x myscript.sh

So the question is, how do I do this on my Mac? The answer I’ve been given by several people until today was that you would need to use AppleScript or Automator (or Xcode) to create a program that could be run from the Mac GUI. As ludicrous as it seemed, Apple’s tendency to force users to do things the “Apple way” made that quite believable. However I found a post today on Adam Young’s blog from back in 2008 which showed that it is, in fact, possible to do this — it’s just a bit harder than on any other OS. Essentially you have to do both the Linux (chmod) step, and the Windows (specific file extension) step.

mv myscript.sh myscript.command chmod +x myscript.command

You need to use the .command extension for the Finder to actually attempt to run your shell script. An identical file with the execute bit set but with a .sh extension will simply open up in Xcode (or whatever editor you have set for .sh files).

Siri Cheat Sheets

Right after I picked up my iPhone 4s late last year I found myself wondering if there was a list of valid “commands” for Siri. Since it’s supposed to provide “natural language” support, I was really looking for a comprehensive list of the things that Siri was supposed to be able to do for me.

I found a link to a blogger who has collected together a nice cheat-sheet of Siri commands. Available in both PDF and DOCX formats.

While I haven’t tried everything Siri can do (I live in Canada after all), I’ve tried a lot of them, and everything that “should” work, does work.

Ubuntu School – Add an Existing User to a Group

Occasionally you need to grant an existing user some additional permissions to files, directories or applications. This typically means some kind of change in your permissions settings for the object in question. But because you can only have a single owner for a given object you need to be careful making these changes.

Something you can do, though, is extend the permissions on the object to a set of users by way of a group. Logically, a group is nothing more than a named collection of users who all have the same access (by way of that group) to some resource. Users in Ubuntu typically carry one primary, and one or more secondary groups (I won’t get into the differences here).

By adding group permissions to your resources (ie give the ‘payroll’ group read/write access to the ‘HR’ folder) you can simply add users to and remove users from the appropriate groups and be confident that their level of access to the resources on your machine is set correctly.

To add an existing user to an existing group:

sudo usermod -a -G payroll graymond

To remove a user from a group you use the same command. The catch is, you remove a user from a group by re-adding all of their groups and simply omitting the group you wish to remove them from.

sudo usermod -nG mkirkpatrick

The system will show you a list of the user’s groups.

marketing sales vanprinters torprinters

Then you simply run the usermod command as above, removing the group in question (in this case vanprinters)

usermod -G marketing,sales,torprinters mkirkpatrick