Automagic Asset Generation For Apps

Between the iPhone (non retina, retina, 3x), iPad (non retina, retina, and pro), and Watch (2 sizes), generating an icon for all those things necessitates no less than 26 images. I have been using a custom Automator script to generate them all through a service that accepts any image as an input, which grew quite big.

As I was updating it, I thought it might be a nice thing to do to let my fellow sufferers have it. So, if that is something you think you might have a use for, feel free to grab it. As a matter of course, it works for me, but I make no promises for your workflow. Just drop me a line if you want to say thanks, make modifications you think might be useful for others, or throw curses at me for having released that just as you finished yours.

It uses no dependancies on libraries or custom applications, by the way.

Download XCAsset Automagic Generator right here!

Mood : working
Music : Griffin House

[Rant] Collaboration on Code

It so happens that we just found a bug that plagued us for 6 months, in the form of a commit that ignored completely the existing code in favor of a copy/paste from an internet source (I assume).

Now, let’s get one thing out first. I really really don’t mind having stack overflow code in my source. It has, over the years, established itself as a reliable way to fix thorny issues, or at least find pointers, and is probably todays numero uno origin of most code written by new programmers. That’s fine. Better than fine, it’s totally rad to have a community help students and people exploring new fields of our wonderful pitfall-laden world.

The second thing I want to point out is that I have worked freelance for 16 years. That should tell you my teamwork leaves a lot to be desired. I know that.

Now, every now and again, I still have to work with existing code, being updated while I work on the project. That’s fine too. However, successful collaboration, especially on code, relies heavily on communication, and prepwork.

So, without further ado, the Cardinal Rules of Team Code Editing (at least when I’m involved):

  • Thou shalt have a clearly defined “ownership” system. What parts of the code are you responsible for? What parts has someone else in charge?
  • Thou shalt have a clear way to communicate the changes thou art making. No, commit logs aren’t enough. At least not on their own.
  • Thou shalt always check thrice as much when changing code thou doth not have ownership thereof. If you “fix” something in someone else’s code, you’d better be pretty bloody sure you understood how the owner made that piece work.
  • Thou shalt notify the owner of the code of thy changes. Email, Slack, IM, Skype, I don’t care how.
  • Thou shalt make sure your changes art reversible. Possibly by having separate commits for each piece of the project that is owned by a different author.
  • Thou shalt not update critical pieces of thy project that are tied to a specific setup. Kind of an off the cuff unrelated item, but next time I have someone update the friggin project file with their own heavily personal paths, I’ll ‘git rm -rf’ everything. Be warned.

I know it sounds like a rant from a totally pissed lunatic, but beyond the anger, I actually believe these are sensible (and scalable, even if you have different layers of ownership) rules that would make everybody’s life better if thoroughly applied.

Feel free to add your own in the comments.


[Xcode] Broken IPA Generation

As of Xcode 6.0.1, you can only generate an IPA with a certificate/provisionning profile pair that matches a team you are part of (it offers only choices present in your Accounts preference pane).

Before ranting about why this this is stupid as hell, here’s a workaround:

xcrun -sdk iphoneos PackageApplication [path to the .app] -v -o [path to the ipa] --embed ~/Library/MobileDevice/Provisioning\ Profiles/[profile to use] --sign "[matching developer NAME*]"

NAME is the name that appears in the popup menu in your xcode build settings, not its ID

After a somewhat lively discussion on Twitter about that, two things:

  • I know Apple would prefer that developers are organized in teams managed on their servers. It’s just not practical for a lot of them, and there’s even a few good reasons not to go that way
  • It’s stupid to have that drastic a change, when 3 weeks ago, the official way of having a third-party developer generate IPAs for your company was to give him a p12 and a .mobileprovision and let him do his thing, and to not warn people about the change

For those of you who don’t know how development of a mobile application works, yet, here’s a quick run down.

A customer contacts me for a development. We agree on a timeframe and a price. I write the code, provide them from time to time with testable betas. When we agree it’s finished, I give them the final IPA for putting on the store and we call it a day.

Providing betas and giving an IPA for the App Store work exactly the same: a binary is produced, which is put in an IPA (kind of installer package for iOS), then that IPA is signed, and transmitted. On the other end of the wire (be it the customer or the App Store), the IPA is decompressed, the signature checked for validity (by app ID, device, and status of the apple account), and the app can be run or put on sale.

In that scenario, if I use my certificate, I have to enter the device IDs the customer will test the app on, of which my developer account allows for 100, in total. So if I have 10 customers with 10 devices a year, I can’t work anymore. So, most of the time, the customer has to provide the relevant information for me to give access to the betas, and of course, since they’re releasing it under their own name, the relevant information to produce the final version, which is a different pair of keys.

So far, so good, all they had to do up until now was give me a couple of p12 (key archives) and the corresponding profiles, and manage themselves the test devices, the release, etc.
It allows whoever’s in charge to retain access and knowledge about what the company is doing. Does that person want me to see they are also working on a concurrent product to something I’m doing for somebody else? Of course not. And there’s no reason to give me that kind of access. Oh and if the customer wants to prevent me from using that certificate again, all they have to do is revoke it.

The new way of doing things is to have the customer invite the developer in the team (in the Apple sense of the term), which gives the developer access to every piece of information under the sun (even when we can’t use it directly).

This is part of an ongoing cycle of making life difficult for contractors. We always have to find workarounds. The idea that almost every ios/mac developer out there is writing code for the structure they belong to, who will then release it in their own name for the general public is ludicrous. It hinges on something that has been gnawing at me for years: the idea that code and binary are the same thing, and is what I’m selling.

That idea is false. When you get Unity3D for your game development, you DO NOT GET THE CODE. For Pete’s sake, we don’t get the code of the OS we are developing on! The idea that when a developer is hired, the customer automatically owns the code is one of the many fallacies I have to deal with on a monthly basis. You hire a developer for his/her expertise first, and foremost. It might be then applied to internal code, which the dev won’t own in the end anyways, or to a newly minted piece of code which might or might not be given with the ability to use said code as part of something that has value. It is a separate item on the negotiation list.

I might delve into the pros and the cons of giving out your source code with the binary in a later post, but let’s get back on topic.

If, like me, you don’t always give the code with the binary to the customer, you’re screwed. Of course they won’t give you access to their company’s secrets by adding you on the team, if they don’t want to. And, obviously, you can’t release the binary under your own name for a customer who wants an app.

Please give me back a way to sign IPAs for customers, directly from my IDE.

Thank you, and sorry for ranting.


Rule Of Thumb

Principles, rules and laws are essentially the same thing. I won’t bother you with a paraphrasing of my recent reading list, which includes Plato, Kepler and Douglas Adams, but for a freelancer, it’s important to differentiate what is what, especially for the Other Guy.

A principle is a lighthouse on the horizon, and it’s OK to veer left and right, or even ignore it altogether. That’s one end of the spectrum. At the other end of the spectrum, you have the Law, which, to quote Morpheus, will break you if you try to break them (and get caught, obviously).

There are varying degrees of rules in between, from the rule of thumb to the house rule. Which apparently is akin to law. Or so I’m told.

Moving on…

Developing a program is kind of a ninja split between the two: some rules are unbreakable, because of maths, and contracts and stuff, and some people try to impose on us rules that can (and sometimes should) be gladly ignored. Just look at some interface designs blatantly ignoring the rule that someone somewhere edicted, and look just plain awesome. Right?

I took a roundabout way to make that point but programmers tend to consider rules with a clear downshift on the “have to” slider.

But, as computers are very attached to their governing rules, humans go a long way to actually enforce them. Case in point: you’re asked to make a mockup app that will illustrate some concept or something. It’s about as easy as making a working prototype, sometimes, so we bend the Prime Beancounter Directive: we go beyond what’s asked. But it’s not what was covered in the Contract. So we don’t get paid. Or at least it’s very hard.

So the appreciation of this particular rule was apparently wrong.

The problem is twofold: the question of the rigidness in the expression of the rule, and whether the Other Person tends to respect the spirit of the rule rather than the letter of it.

For the second part, it’s a lot easier to hide behind wording and you-have-to-s than to imagine what the intent of the rule is. That’s how we get “warning hot” on coffee cups (wait, what? I specifically ordered a lukewarm boiled cup of coffee, not that seemingly delicious cup of joe!), or “do not dry your pet in it” on microwaves (I won’t even bother). As weird as it sound, stupidity is foolproof. Adhering completely to blatantly stupid explicit rules is what makes the world tick smoothly it seems. For more on that, see the Miss Susan vs Jason, in Thief of Time.

You soon learned that ‘No one is to open the door of the Stationery Cupboard’ was a prohibition that a seven year-old simply would not understand. You had to think, and rephrase it in more immediate terms, like, ‘No one, Jason, no matter what, no, not even if they thought they heard someone shouting for help, no one – are you paying attention, Jason? – is to open the door of the Stationery Cupboard, or accidentally fall on the door handle so that it opens, or threaten to steal Richenda’s teddy bear unless she opens the door of the Stationery Cupboard, or be standing nearby when a mysterious wind comes out of nowhere and blows the door open all by itself, honestly, it really did, or in any way open, cause to open, ask anyone else to open, jump up and down on the loose floorboard to open or in any other way seek to obtain entry to the Stationery Cupboard, Jason!’

Loophole. The Dreaded Word by the Rulemakers. The Golden Sesame for the Rulebreakers.

But the power of a loophole relies solely on the fact that the rule is rigid to the point of absurdity. Of course, there should be an unbreakable rule that states that it’s not allowed to come to my home and take my hard-won computer for themselves. Of course there should be one for being able to tell a power hungry person that they overstep said power.

I guess the whole point is finding out where the rule protects a group of people from others and also from themselves. But when we’re talking about breaking a rule, in order to make something better for everyone, it’s an epitome of everything that’s wrong with our reasoning abilities.

And yet… I hear some of you think along the lines of “yea but if some rules should be put aside, how can that not be an argument for that there should be no rule, at least with some people?”. Strictly respecting all the rules makes it easier to have others respect all the rules as well, right?


Again, I think it’s a matter of harm. If by breaking a rule you harm no one (including yourself) in any way (except maybe their ego, but that has nothing to do with anything), then the rule is stupid. And should be ignored. Like, say, going beyond expectations. Actually, breaking a stupid rule should be grounds for an award, a compensation, something stating “wow, that rule was stupid. This awesome programmer deserves a raise. And he’s so cute too… <fawns>“.

Ahem. Anyways…

So then, I hear you think from here on my spaceship, how do you know you’re doing no harm? to anyone?

Dude, the daily personal and professional interactions we have are rarely a matter of life and death for entire nations. Business laws are supposed to protect me from getting screwed over by customers with no scruple. Not to prevent me from doing my job better than I’m supposed to. Fact is, most of the time, to enforce a “common sense” rule (getting paid for a job), I have to go through stupid rules first. And since the Other Guy is usually better equipped than I am to handle these first stupid hurdles, they win the race. So it spirals down: stupidity being the most efficient way, it becomes the norm. And we have to edict new rules to kind of balance the most stupid of our actions, or to close the loophole. Oh wait, another set of stupid rules to follow!

Stupidity is recursive. Thinking is hard.

The end doesn’t justify the means. Life shouldn’t be a permanent chess game either.


The Bane Of Reality

Fiction is not enough. Apparently the masses want reality. The superheroes and master spies have to be explained and “fit in” the real world (by the way, thanks to the people who did Iron Sky, it was a breather of absurdity and laughter).

In software terms, it gave us (rolling drums) skeuomorphism, the art to mimick real objects to help us poor humans deal with apparently complex functions.

Last one to date, the podcast application from Apple, and it looks like a tape deck. Seriously. Man, I mastered the art of obscure VCR controls a long time ago… And now you want to simplify my life by analoguing a defunct technology?

Don’t get me wrong, I really think interfaces should be thought about and self-explanatory, but really? Who uses a binder these days? So what’s the point of the spirals on the left of your writing interface? I’ve actually never used an agenda that I recall, so why give me that faux-leather look?

Some ideas are not based in the real world, but they quickly become THE way to do it, like pull-for-refresh, for instance, or pinch to zoom in and out. What’s the real world equivalent of those? Do we need any equivalent?

I guess I’m not a natural target for software anyway: when I take a look at a program, I want to know what it does for me. Let’s say I want an app that gives me remote control of my coffee maker. That way, I’m heading back home after a tiring day, and I want a coffee that’s strong (more coffee in it) and has been finished 5 minutes before I get home (because coffee has to cool down a little bit). Do I want to drag and drop the number of spoons from one half of the screen to the next to simulate the amount to pour in? Do I want the same kind of clumsy timers-with-arrows that exists already on these machines? Nope.

But I want to know if the coffee maker can make me coffee (because it’s all washed up and ready to go), the amount of coffee left in the reservoir, as well as the water level, I want to set up the amount in as little movements as possible while being totally reliable and I want to be able to just say “ready 5 minutes before I’m in” and let the location manager deal with it (one man can dream, right?)

There is a history behind physical controls. Some designers, ergonomists, and engineers took the time to fine tune them for daily use (with mixed results), and the ones that stayed with us for 20 years or more stayed because people “got them”, not because they liked them or thought it was a good analogy to whatever they were using before. Thank goodness, we’re not driving cars with reins-analogues, or bicycle-horns-analogues.

It’s time to do the same with software. Until we have 3d-manipulation interfaces, we’re stuck in Flatland. And that means that any control that was built for grabbing with multiple fingers at several depths, is out (you hear me rotating dial analogue?).

If you want your users to feel comfortable with your software, make sure the function of it is clear to the intended audience. Then prettify it with the help of a computer designer. Different world, different job.


One For The Money, Two For The Show,…

WWDC is just around the corner, featuring some 10.8 (dubbed “Mountain Lion”) excitement, maybe some iOS 6 news, and possibly some hardware upgrades, although I have my doubts about cluttering the developer conference with hardware announcements.

But since it’s coming I decided to have a glance at Mountain Lion, to be at least able to follow the discussions. Now, it’s true I haven’t changed my setup in a while: my traveling companion is a late 2008 black MacBook (boosted in RAM and hard drive as time passed) that’s way more than a match for its current counterparts in terms of development. And to my mind, once it’s equipped with a SSD drive (which I can swap in very easily, by the way), it’s going to be somewhere between 20 and 40% slower than its 4-years-younger rivals. Yep.

The only thing that dramatically improved these past few years are the graphics and the core redundancy. Since I don’t play on my macbook, and can wait the extra 20s it will take to finish compiling my biggest project (I tested), I feel confident this puppy will follow me a little bit more.

But! Not so fast! 10.8 won’t run on it. Wait, what? For a frickin 20% penalty, I get to buy a new laptop in which I can’t change the hard disk, upgrade its RAM, or get an extra battery? Apparently so.

The official reason is that it won’t run in 64 bits. Wait, what? It does too! It runs 64bits programs like a charm.

“No no no, you don’t get it, it won’t boot in 64 bits. That’s why we won’t support it”. Wait, what? Windows 7 boots it in 64 bits. So does Linux. What’s the game here?

So, for my laptop, not only do I have to shell out 2k euros, but for features that I don’t care about (I have a console for gaming purposes, thank you very much), and at the expense of features I actually need (given that I work a lot with video, my hard drive has a life expectancy of a couple of years, tops). OK, well… For my laptop, I might actually get convinced, given the fact that it is pretty banged up. But that’s vanity, not technical.

And it gets worse with my trusty Mac Pro. 4 cores, 8GB of RAM and some pretty good video card (for gaming… sold that way, anyway), but still no go. The same “it won’t boot in 64 bits” shenanigans.

Except, we are absolutely not in the same game, price-wise. I can’t replace my Mac Pro with an iMac. I have 4x2TB of storage in there, plus a boatload of things connected to the myriad of available ports. So I would have to replace it with a new Mac Pro. If it ever gets announced, the thing I will need will cost something like 4k to 6k. That’s a hell of a lot for a tiny teenie booting issue that got fixed on both b1 and b2 beta releases of the OS, but that got closed on the b3 for no obvious reason.

I get that Apple is a hardware company, and needs to sell hardware. And in the past, every time my computer slowed to unbearable speeds, I upgraded my hardware gladly. But this is not it. If someone forces you to do something for no other reason than “because we say so”, there’s a good chance of a backlash.

Oh and by the way? VMWare Fusion allows me to run 10.8 in a virtual machine… on these two computers. And the speed is decent too. So I hope Apple continues behaving like the good guy, and does not start using wrong tactics for commercial reasons. They have the money (that I gave freely and abundantly over the years), they can afford it.