Abizer Nasir

Staying Flash-free on a MacBook Air

You may have seen John Gruber’s posts on uninstalling system-wide flash and changing the Safari User Agent to view some sites that have Flash content.

The new MacBook Airs don’t have Flash installed by default so this is a tl:dr summary of those two articles so you don’t have to download and install the system-wide Flash player.

Many sites, such as YouTube, provide content in an alternative format for devices that do not have Flash installed. Get access to this from Safari by turning on the ‘Develop’ menu (Preferences | Advanced) and change the User Agent to ‘Mobile Safari 3.2.2 iPad’. This works per tab|window so doesn’t change the display in what you already have open.

If this still doesn’t work (I’m looking at you iPlayer) then you can use Google’s Chrome browser, which comes with its own Flash plug-in.

Getting the Address of a Shortened URL

Many times you will see a shortened url but you aren’t sure what it points at. Here’s a little tip that I picked up from Tom Morris.

Pop open your terminal, or console, or whatever your command-line application is and type the following:

1
curl --head shorturl

This pops up a short amount of useful information about the target url. For example the response for the Google short URL for this site shows this;

1
2
3
4
5
6
7
8
9
10
11
12
~ % curl --head http://goo.gl/oQx8
HTTP/1.1 301 Moved Permanently
Content-Type: text/html; charset=UTF-8
Expires: Sat, 16 Oct 2010 21:01:51 GMT
Date: Sat, 16 Oct 2010 21:01:51 GMT
Cache-Control: private, max-age=86400
Location: http://abizern.org/
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Transfer-Encoding: chunked

And you can see that the Location shows that you aren’t going to get Rick-rolled.

DVCS at LiDG

I gave a short presentation to the London iPhone Developer Group at the Apple store in London this week.

20 minutes is far too short to cover such a large subject but I did what I could. I have been given another opportunity to present in the future and I’m going to skip the boring beginner bits and just cover 3 or 4 advanced Git techniques which should be more fun.

For what it’s worth, here are the slides. Probably not much help unless you were there (I prefer more talk and less slides) and I apologise for being weak and using bullet points.

Download the Keynote presentation (540 kb)

Download the PDF slides (220 kb)

Blackjack and the Python Dojo

“A coding dojo is a safe place to deliberately practice and develop your coding skills.”

I went to my first London Python Dojo last night and had a better time than I expected. I know a little Python) (just enough to hurt myself). I was intrigued by this event where the idea was to learn together rather than just share knowledge.

A Year of Git

I’ve been inspired by Pieter Omvlee of Bohemian Coding and his 365Cocoa to set up my own contribution.

I’m going to try and and fill a year with git tips and inspirations over at 365git. I’ve got a few weeks worth of ideas but if anyone wants to know anything or has a suggestion, I’ll gratefully consider them.

Renaming an Xcode Project

You may have occasion to rename an Xcode project.

You can find step-by-step instructions and scripts with a little bit of Googling. But there is another way. If you’re running Xcode 3.2 on Snow Leopard there is a menu item you can use instead. Have a look at the Project > Rename… menu item instead.

Project > Rename…

A Simple Answer Is Not Always Best

On New Year’s eve, Dámasa asked me to calculate some fraction of a fraction and provide the answer as a fraction in eighths. The post had just arrived so I flipped over an envelope and started working it out.

“Why do you need the answer in eighths?” I asked.

“Because I’m trying to convert a recipe and my scales only go down to eighths of an ounce.”

“Why don’t you just use grams?”

“…”

This little episode reminded me of an article by Alex Papadimoulis where he used the analogy of being asked whether it was better to use a bottle or a shoe to pound a nail. Although there are situations where either could be used, the real answer is, of course, to use a hammer. Sometimes we are asked questions to which we can provide an answer; but perhaps we should first stop and ask the reason for the question before answering it.

Let’s take Stack Overflow as an example. The programmer’s question and answer site that is also a game. ‘Good’ behaviour, such as asking good questions, providing helpful answers, are rewarded by upvotes, ‘bad’ behaviour; lazy questions, incorrect answers, are discouraged by downvotes. It is becoming increasingly common to find a Stack Overflow link as the top hit when searching the web for answers to programming questions. But, if you follow a mailing list for your chosen speciality it isn’t hard to see the same question in both places and different approaches to answering them.

Stack Overflow’s recommended approach to help vampires is a pragmatic one. Essentially, you can either be aloof and use the tools of the site to discourage the behaviour; or you could just answer the question and get some points. On a mailing list like, say, CocoaDev, a weak question will get sharp answers (if any); but on Stack Overflow, somebody might just answer the question because they get something out of it.

This might be useful to somebody. I’m sure there are times where we all just need a quick answer to question without deeper knowledge. Get help with the ‘how’ to get something done, and pick up on the ‘why’ later. But read enough questions in public forums and you’ll soon recognise those who just want to know the ‘how’, and no amount of saying they need to learn the basics is going to help. Maybe back up and ask why they are asking so you can better answer their question.

To tie this back to fractions, have a look at this Republic of Math post about the difference between relational and instrumental understanding in mathematics. A particular example is how the invert and multiply method of fractional division is widely taught without actually developing an understanding of the operation itself. When I was 14 my elder brother taught me differentiation. Not by saying “subtract one from the exponent and multiply”, but rather by drawing a curve and working through calculating a tangent using deltas and differences tending to zero and how it led to the simpler method. I’ve long forgotten the hard way, but after that I was very good at calculus.

Perhaps this is something to think about next time you see somebody ask how to write an application without using Interface Builder.