• URL Encoding an NSString on iOS

    I’ve been working on an iPhone app for the last few weeks, which I’ve really enjoyed. Every now and again, though, you hit what seems like a bug in the iOS SDK. This seems to happen much more frequently than it ever did when I was coding in C#. As a result, my default debugging approach – that any problem with my app must be my fault rather than something in the framework – has shifted slightly. I’m now much more likely to question the framework itself, and with a quick Google search it’s common to find other developers who have experienced the same problem.

    Here’s one that bit me recently. NSString has a method called stringByAddingPercentEscapesUsingEncoding, which purports to make the string safe for use, say, as a parameter to a URL. There are several characters that are reserved in parameters to URLs – for example the slash character, or the ampersand, because these are characters that are used to delimit the URL itself. Therefore we encode these, and this is done using the percent encoding scheme.

    As an example, if you want to use the string hell & brimstone + earthly/delight (and why wouldn’t you?) as a parameter to a URL then you’ll need to convert it to hell+%26+brimstone+%2B+earthly%2Fdelight so that the ampersand becomes %26, the plus becomes %2B and the slash becomes %2F. Note that spaces are encoded as pluses, which is why the original plus sign needs to be encoded.

    But stringByAddingPercentEscapesUsingEncoding doesn’t respect these rules, and actually produces this: hell%20&%20brimstone%20+%20earthly/delight

    It fails to encode the ampersand, the slash and the plus, and many (most?) web servers will be confused by that. It encodes the spaces as %20, which is just as acceptable as encoding them as a plus.

    In short, it’s completely broken, which is frustrating. But thankfully there’s a lower-level API we can use which, thanks to the magic of Objective-C categories, we can tack on to NSString. This is based on a blogpost by Simon Woodside, which I’ve just turned into a category.

    Here’s the category’s header file:

    #import <Foundation/Foundation.h>
    
    @interface NSString (URLEncoding)
    -(NSString *)urlEncodeUsingEncoding:(NSStringEncoding)encoding;
    @end
    

    And here’s the implementation:

    #import "NSString+URLEncoding.h"
    
    @implementation NSString (URLEncoding)
    
    -(NSString *)urlEncodeUsingEncoding:(NSStringEncoding)encoding {
    
    	return (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
    			   (CFStringRef)self,
    			   NULL,
    			   (CFStringRef)@"!*'\"();:@&=+$,/?%#[]% ",
    			   CFStringConvertNSStringEncodingToEncoding(encoding));
    }
    
    @end

    And now we can simply do this:

    NSString *raw = @"hell & brimstone + earthly/delight";
    NSString *url = [NSString stringWithFormat:@"http://example.com/example?param=%@",
    			[raw urlEncodeUsingEncoding:NSUTF8Encoding]];
    NSLog(url);

    And the result will be exactly as we hoped:

    http://example.com/example?param=hell%20%26%20brimstone%20%2B%20earthly%2Fdelight

  • A web app in 10k? Surely not!

    When @stueccles first encouraged me to enter the 10k apart competition (to create a web app in under 10 kilobytes) I wondered what was really possible in only 10k. After a little tinkering I realised quite a lot.

    Introducing the 10k Feed Board

    screen-capture-4

    Drawing inspiration from the recently released Flipboard app on the iPad I set about building an app that allowed you to browse Flickr photos and Twitter searches. You can configure a set of panels with different search criteria, choosing from either a Flickr search, Flickr set or a Twitter search. The app then makes use of Yahoo’s YQL service to retrieve the data and populate the panels for you to navigate around. It takes advantage of the new localStorage feature of HTML 5 compliant browsers to persist your queries, meaning that you can come back time and again without losing your search terms. The drawback here, of course, is that you need a modern browser for it to work – Sorry all you IE users – looks like you’ll have to upgrade to a proper browser (IE9 Dev Preview,Firefox or a WebKit browser)!

    Take a look at the 10k Feed Board here, your votes are appreciated! ;)

    Beyond the 10k limit

    With the competition’s 10 kilobyte restrictions I had to limit the content types to Flickr photos and Twitter searches but I will be taking the concept further to include RSS and Atom feed content – it will then become a nice new way to consume all your feed content.

    I will also shortly be blogging about the technical aspects of the app – localStorage; how to consume YQL data; and the associated problems of dealing with multiple feed types.

  • Customer Development: a few tools and resources (or how to become an excellent stalker)

    Following on from Justin’s post last week on the empty hamburger dilemma, I’ve been doing some research into what tools and resources are out there on customer development, and who’s using them. Unsurprisingly, it’s the usual suspects who have been putting this methodology into practice: start ups and the people advising them. As Justin pointed out, it doesn’t look like this approach has been adopted by agency land yet, primarily because their source of dollar is the client not the customer, which tends to derail their priorities.

    But how can we take some of the lessons that have been learned and implemented by the start up community and apply them to the agency worldview? Here’s a few thoughts pulled together from what other people are already doing.

    1. How to find your users

    The first step in the process of customer development is finding them. Cindy Alvarez, Product Manager at KISS Metrics, has some useful thoughts on this over on her blog. Adopt a diverse approach and and don’t be snooty about the methods you use (Facebook ads anyone?). It certainly makes sense to set up a Google Alert and trawl through Twitter for mentions of keywords relating to your problem/solution. If you are working for a pre-established brand, as we often are at Made By Many, she suggests putting out a call on Craigslist and equivalents to find customers of the brand and their competitors. As you do more research you’ll start to map where it is that your users hang out and what channels they are comfortable communicating through – Twitter, forums, comments on blogs, Facebook, plain old email. Basically you are a glorified stalker. You’re also a bit like a bee gathering snippets of user nectar from each point you touch down on, which then feeds back into your hypotheses about your problem/solution. Read full post

  • Vote for our SXSWi panel suggestions

    Made by Many has an opportunity — actually, three — to host panel discussions at South by Southwest Interactive Festival in March 2011, but we need your votes to make it happen.

    We attended SXSWi 2010 en masse and absolutely loved it — the people, the networking, the keynotes, the panels and the tequila. By bringing together a huge number of creative, freakishly intelligent people SXSWi acts as a sort of ideas incubator for our industry.

    The sessions delegates attend set the tone of the year to come: they raise the issues we talk about and tease out the problems we try to solve. The best sessions kick off conversations that lead to technical innovations, new ways of working, unexpected collaborations and all kinds of general awesomeness. Hosting a panel discussion is an opportunity to start some of those conversations.

    Here are the things we want to talk about

    Good News: Apps, Paywalls, Publishers and Content

    News organizations and publishers are walking backwards into the future carrying the cultural and business baggage of 200 years of mass media. Most will die; new models will arise. In the next half decade we expect a wholesale change in the way news is produced and consumed and by the end of this period we’ll know the answer to the question: “If we had never had mass media, what would journalism look like today?” A panel of individuals involved in news innovation looks at the issue from all sides and plots a path from old to new models of sharing what we need to know.

    Daddy, You Should Tweet That: Parenting Goes Digital

    The parenting web is on fire, with more parents tweeting and more family sites and services launching every month. Social media is fast becoming a huge part of modern parenting, but to what end? Is it here to wreck or revolutionize family time? Is there money to be made in this market, or are savvy parents marketing-proof? A panel of agencies and service designers will explore a series of projects to identify mistakes made, lessons learned, and future directions for the parenting web.

    The Last of the Launch-and-Leave ‘Ems

    Negotiating the new handover. Agencies are building fewer static campaign-oriented sites and more platforms, communities and services. Cutting the apron strings between agency and digital product immediately after launch doesn’t make practical sense, but maintaining the relationship indefinitely is costly for the client and creatively stifling for the agency. This panel will explore solutions that are most likely to be beneficial to both parties as well as the members of the service they are trying to build: a new plan for launch, propagation and perpetuation.

    Your vote will get us to the next round

    All of these panels are in the panel picker right now, just waiting for you to register or sign in (free! easy!) and vote for them. If you think these things are worth talking about, please spread the word and rally the troops to make it so. Please also use the comment space on this post or on the panelpicker to share any ideas or links that you think would make these sessions more valuable.

  • Would the real John Hegarty please stand up

    About a week ago (August 5th) a new Twitter account appeared. Nothing strange in that. But this one belonged to John Hegarty, Worldwide Creative Director of BBH. The BBH whose offices we share.

    His account accumulated over a thousand followers in a matter of hours as word spread that one of the most well known ad agency creatives in the world had joined Twitter.

    However, within a day or so people began to suspect that this wasn’t the real deal. The language was poor and the tweeted quotes hackneyed. “Not the language of Hegarty” people cried via Twitter.

    On Monday night I tweeted that I was unfollowing the account. The 1990s management speak and trite ‘creative’ blatherings were too much. This was obviously an imposter. And I think I know who it is… Read full post

  • Big Society – a new opportunity for brands and the arts?

    It’ll be a while before the full impact of the coalition’s swingeing cuts in the Arts world are realised, but one thing is clear: it’s forcing artists’ hands. There will be little choice but to seek patronage from sources other than the Arts Council, NESTA or the British Film Institute.

    Of course, brands have been supporting the arts for ages and there have been some great examples of this, although some backfire as seen recently with BP’s sponsorship of The Tate. And there are those in the arts community who feel that corporate sponsorship has no place, that it sullies the purity of art. But the harsh reality is that the arts need funds, and the most ready source is going to come from the private sector.

    At  Camp Bestival last weekend, in amongst the fun and wonder, I was struck by how much harder brands are going to have to work to engage with people, and how this has potential to benefit artists.

    The House of Mixology and The House of Noise

    One of the best things I experienced at the festival was ‘The House of Fairytales’ field which was made up of a whole range of family activities.

    Read full post

  • What Customers Want

    (or How I Learned to Stop Worrying & Love the Obvious)

    (also know as ‘The empty hamburger dilemma’)

    Most new products and services fail. This is a depressing reality to swallow, however I am amazed by how few people ask why this happens. Or worse still all the people who have an in-built assumption and acceptance that most new things should fail. This shouldn’t be the case.

    Here is a sad graph showing total product failures.
    failed products

    Why all this failure? Read full post

  • Agile training day – another take on visual notetaking

    I’ve swithered about posting these notes, given their visual inferiority to Tim’s. But what they lack in beauty, I hope they make up for in utility. I certainly had fun making them. And as someone more adept with a viola in hand than a sketching pen, I’m not too ashamed of my efforts.*

    Enjoy.

    Rules of Lean

    Keeping it Lean

    * Please don’t take that as a cue to harangue me with rubbish viola jokes.

  • Sketchnotes: Agile training day at Made by Many

    Over the last couple of weeks we’ve put everyone at Made by Many through a day of Agile Training with Simon Baker and Gus Power from Energized Work.

    These guys really are the Penn and Teller of agile software development, and I thought the session was excellent. Most of us here have been trying to work in agile ways for  five years or more but this was an opportunity to get better at it by broadening our knowledge and understanding. Another post follows containing some more considered takeaways, but I wanted to share these sketch-notes I made during the day. They petered out towards the end of the day as proceedings became more discursive.

    There are 10 pages in total, including a ‘page of evil’ where I tried to capture all of the things that we decided one way or another were EVIL.

    Picture 49

    Picture 40

    Picture 41

    See the whole set —-> Read full post

  • Wikileaks, news, and the stories within the story

    At the start of this month I suggested that Rolling Stone’s McChrystal expose was the story of the year. I was wrong. Whistleblowing website Wikileaks’s release of more than 75,000 classified military documents — collectively referred to as the Afghanistan war logs — is now the story everyone is talking about, and it is unlikely this will change anytime soon.

    A security breach/freeing of information (as you like) such as this is pretty much unprecedented, although many are comparing it to the 1971 publication of the Pentagon Papers (including Daniel Ellsberg, the man behind that leak).

    Just as with the Pentagon Papers, the leak and the subsequent publication of previously classified information are just part of a complex knot of stories. Who leaked this? What do we make of what we read? What next for Afghanistan, for the US military and indeed for ISAF as a whole? — these are only the immediate questions.

    Last night I attended the Frontline Club’s sell-out Q and A with Julian Assange, founder of Wikileaks. I wanted to get closer to the story and explore a few of my own questions, specifically — How does a leak like this affect the life cycle of a story and the role of the press? What next for news and investigative journalism if Wikileaks steps in as the official sourcer of unofficial facts? Further, what are the ethics around what Wikileaks is doing — both Assange as an individual and the organisation as a whole?

    I don’t believe in censorship and I do believe in freedom of information, but no matter how I look at this, none of it is black and white.

    Read full post

Our latest tweets

Categories

Archives

Find us on the web