Swift 1.2 and Xcode 6.3 beta

https://developer.apple.com/swift/blog/?id=22

I’ve been working on Shopper for a while and I’m mostly using Swift.

Development has been good, slower than it would be if I was using Objective C but I decided that didn’t matter.

These updates to the Swift language look nice and as I read them I wanted to update my code to use it. Apple makes it sound super simple:

To begin the migration, click the Edit menu, then choose Convert > To Swift 1.2…

Those ellipsis at the end make it a bit ominous. My position will probably be to test this migration to see what the impact would be and how much work it will generate and then revert the changes and keep working on the current version until 1.2 is on a stable build of Xcode that allows you to submit to the app store.



4+1 problems with the new Calgary CITYonline (online store)

I’ve been buying my Calgary public transit passes via the online store and recently they launched a new version called CITYonline. It looks ok, and it’s definitely a step up from the previous version. But in the 10 minutes that took me to register and buy next month’s pass I found some glaring usability and security problems .

First: you broke my browser

Disabling copy and paste is the new “right click is disabled” (so, 1997).

Dear Calgary: people use copy and paste, they like it and rely on it. When the iPhone didn’t have copy and paste people complained.

So, why do you disable it?

If you are worried that your database will get filled with incorrect emails because of typos then check the SMTP response headers. Or just accept errors as a part of life, but don’t make your lives easier by dumping shit on your users.

Second: so many options

On any listing of products, Calgary chose to use a select input element (marked with the red arrows).

Select elements (combo boxes in corporate parlance) are meant to give the usersmore than one option to choose from.

Each of those select elements have only one option. There’s nothing to choose!

This is a small problem and can be solved easily, but still shows that the people who made the site didn’t know what they were doing.

Third: I say “Yes”, but I may mean “No”

When you create your account and confirm your email (more on that on the next problem) you are required to select a password, and a helpful message tells you that you have to use_at least_ 7 characters.

Then, I tried to use 44 using 1Password and noticed that it looked shorter than 44 characters.

We’ll it turns out they tell you to use at least 7 characters, but don’t tell you that you have a maximum of 20 available.

That’s a very bad usability problem, it’s like saying to your kid “yeah, go out and party all night and come whenever” and “forgetting” to tell them that you won’t open the door when they arrive at 3 in the morning =).

BTW: they do the same thing with emails, limiting them to 50 characters. The maximum length of an email address is actually 254 characters .

Fourth: here are the keys to my kingdom

Registering is a two step process in CITYonline:

  1. You write your name and email (no copy/pasting!)
  2. You receive a temporary password to your email.

When you go and login with said temporary password, it forces you to set a new password. Very safe.

And then they send you FRIGGIN’ PASSWORD TO YOUR EMAIL!!!

Never, ever send a password to the user’s email EVER!

  1. Email is not a secure enclosure.
  2. It potentially means that the City of calgary is storing the passwords in a readable way.

Good thing CITYonline doesn’t store your credit card information (or does it?).

Fouth plus one: the emails suck

This one is just a pet peeve.

The email I received from CITYonline has header image of 1029 pixels wide, this wreaks havoc with many email clients as you are forced to scroll back and forth to read the whole thing.

Just use an email template from the pro’s .


Shopper.app week 2

I’ll just say it: I barely worked on the app this week. I’ve been feeling ill and most of my evenings were spent either watching TV or studying for the citizenship test (I’m writing this as I wait for the test to begin).

Week 2: map/reduce in Swift

I did work on it a bit. Mostly reading and trying to figure out the syntax for closures in Swift to do map/reduce.

There are many different ways to write an Array.reduce; I like the succinct syntax of Swift but I think it allows succinctness to be taken to an extreme. For example doing a reduce to add up all elements can be this:

myArray.reduce(0, {$0 + $1})

That’s something you’ll need to re-understand every time you read it mostly because of those$ signs[1]. It also feels dirty coming from ObjectiveC where everything had names. Long names. I liked that.

You can also give names to$0 and$1 which is nicer:

myArray.reduce(0, {x,y in x + y;})

I also like that because operators in Swift are just functions you can pass it like this:myArray.reduce(0,+).

So, there are many levels of succinctness depending on the amount of hair you want to lose when it’s time to read the code again after some time.

Personally, I like the last one for one-liners but for more complex transformations I’m gonna go with this syntax:

myArray.reduce(0) { x,y in
    return x + y;
}

I’ve also used named functions instead of closures just to keep code readable.

myArray.reduce(0, addUpElements);

All this was explained with more details by Silviu Pop on this article: Higher Order Functions: Map, Filter, Reduce and more – Part 1 .


Back to work

I’m behind schedule by a week and need to catch up. I’ll be alone at home next week while Mary goes to The Grace Hopper conference so I’ll probably will get more time into this. Hopefully. Unless Netflix wins again[2].

Most of the work is run as automated unit tests which is good because it has allowed me to quickly prototype and change the way I structure and massage the data.

Week 3?

Today (Oct 7) is already the middle of the week 3 so things are still piling up. Week 3 is about starting to do some UI work for basic things like shopping list creation and going shopping with it to start looking at real life data point (event if just for one user: me). I’m planning to go shopping today so that’s probably not gonna happen.

I’m sad and I’m hitting publish now.


  1. I come from a PHP background so$ in my code shouldn’t bother me but it does. Nowadays I prefer the$ in my pocket.

  2. I’ve been watching Bones, The Walking Dead and How I met your mother. I still have Dexter (no spoilers please).


I'm building a new app

When Apple showed us the Apple watch I decided I wanted to build an app for two reasons:

  1. I want to make something for it and see how it fares in an environment not as overcrowded as the iPhone App Store.

    I don’t think the Apple Watch will produce the same gold rush era like the one the iPhone produced. Or at least it won’t be as long. That’s why I want ot try to get an app in before it gets overcrowded.

  2. I want one.

    I’ve been considering getting a Fitbit for a while to track steps and see if I can get myself to walk and exercise more. But with the recall of the Fitbit force I put a hold on the purchase and waited to see what Apple did.

The app I’m building is not a new concept, especially not in the App Store: a shopping list app. But the idea I have on how to integrate it into the Apple Watch may be innovative and if I have it ready for launch day I’m sure it will be interesting.

Exactly the day I started working, Justin Jackson posted this tweet . It was very good timing!

The cold months are coming:

So that leaves three months. If you want to build your side-project, this is your window.

Here are a few steps you can take:

  1. It’s September 20th today, that means launch day would be December 20th. Envision what you’d like to launch on that day.

  2. Now open up your calendar. Work backwards from December 20th and schedule all the times you’ll work on your project. It’s best if you can make it regular weekly times: ie. Saturday mornings from 6am-10am, and Friday nights from 8pm-11pm.

  3. Create a landing page. Put only 4 things on it: a headline (that says who this is for, and what their pain is), a sub-headline (describing what you’re offering), an email sign-up box (for folks to get updates), and a launch date (December 20th!).

I’ve done the calendar part and and have split the work over the three months and I plan to publish a post a week describing some of the things I’m learning and doing. Which brings me to the next point…

I haven’t done the landing page yet and to be frank it intimidates me to do that. Maybe I will create it just for the sake of having a reference for people reading this posts documenting my progress.

For now, I’m sorry if the following is too vague.

Week 1

Week 1 was all about two things:

  1. Setting up the data model for creating lists, registering products and then marking products as picked in the store. I used Marco Arment’s FCModel which made things super simple. A lot easier than Core Data.
  2. Analyzing that data to estimate which products you should be buying soon. I didn’t get too far into this. Partly because I got busy mid week[1] and mostly because I’m still developing the idea of what data I want exactly.

There’s also a non product related goals I wanted to hit which was starting to write some of the code in Apple’s new Swift language.

I’d say I hit 80% of what I wanted to achieve.

I’m not sure if the app will be successful[2] or not but I’m committed to getting it done.


  1. I started to work out in the mornings before going in to my “J.O.B. job” which just made working in the evenings a harder choice to make. I’m also studying for my Canadian citizenship test so that’s taken some priority.

  2. For some people a million dollars a year business is a failure so that’s all relative.


The Dropbox terabyte conundrum

http://sixcolors.com/post/2014/09/the-dropbox-terabyte-conundrum/

I was discussing this the other day at work: my macbook has a 128GB drive so getting a 1TB of Dropbox capacity does nothing for me; one of my coworkers said he was happy with his Transporter setup. What he didn’t mention was that nifty Library thing:

But there’s also a folder called Transporter Library . (It’s not actually a folder, but a mounted file-share volume.) When you move items to Transporter Library, they are moved off of your device and into the Transporter’s personal cloud.

This is cool and may be the last nail in my intention of getting a Dropbox Pro account.



Test Post

This is a test post entitled “Test Post”.


CoCPledge: why a code of conduct is a good idea

In the last couple of days, I’ve been “listening” on twitter to the #CoCPledge discussion. It boils down to: “If you don’t have a code of conduct for your Conference then I will not speak/attend.”

This initiative was started by Ashe Dryden “nearly a year and a half ago” but for some reason it has flared up on my feed just recently.

The idea is to stop cases of sex, race and other types of discrimination or harassment.

Seems like a no-brainer and it baffles me that some conference organizers don’t support it.

Arguing that “there are laws already” that prevent this kind of behaviors seem to make sense, but just look past your nose for a bit: laws have not prevented people from breaking them.

Having a code of conduct puts this kind of people on notice and leaves the threat - of losing their money or even their jobs - hovering over them. But it also tells those at the other end of the stick - the harassed - that they should feel safe coming to your conference because they will be protected.

The idea of a code of conduct is not new

Commercial establishments still to this day “Reserve the right to refuse admission” which, granted, threads dangerously close to discrimination; a code of conduct that describes clearly what is unacceptable behavior and its consequences doesn’t need to be discriminating.

Another place where we’ve seen code of conducts? Online communities and forums. Nobody complains about those because they give the owners the tools to maintain a healthy community. If you want your conference to be one where attendees want to come back the next year then you’d be well served by having one too.

A code of conduct will not stop harassment from happening, but it will give the organizers the framework and tools to react to those events and resolve the issues.

I profoundly agree with this initiative and will look for the code of conduct before signing up.


TinyFurniture 1.1

http://tinyfurniture.ca/

It’s now available on the App Store now!

Version 1.1 is all about the new Symbol information Sidebar.

The sidebar allows easier control on the dimensions and angle of your furniture and (soon) richer furniture symbols!

It also contains other improvements like distraction free working: when modifying a furniture symbol it centers it on screen and dims all other symbols to reduce noise and clutter.