“Magic”

How to quickly obtain D-U-N-S number for iOS Enterprise Developer program (for free)

If you’re applying for an iOS Enterprise Developer program, you need a D-U-N-S number.

The enterprise program provides many benefits, such as deploying private apps to other devices without registering their UDIDs in the provisioning portal (according to the terms of use, you may only distribute such apps to internal company devices).

D-U-N-S number is provided by a commercial entity Dun & Bradstreet. Apart from the fact that the company’s products look like a scam, the D-U-N-S identifier is free and has become a worldwide standard for identifying business entities.

Apple basically uses it to outsource the validation of entities.

I found the registration form below provided by a German D&B branch to work well and fast. This registration form also supports international appliers and non-domestic company structures, whereas the official US form doesn’t.

http://www.upik.de/en/upik_anfrage.cgi

D-U-N-S received in 10 days (in the Gmail’s junk folder). No need to pay over $200 for “expedited service”. Just make sure you don’t miss it in the junk folder.

iOS hacking adventure: Rich text library with images & video, outputting clean HTML

If you need rich text capabilities with images and video embeds in iOS today, you don’t have many options. Matter of fact, there are no existing solutions available whatsoever.

Current state of iOS:

  • Bold, Italic, Underline and indent support in Mail.app, incorporated in a popup for selected text (UIMenuController)
  • All sorts of rich text features, alignment and font-face in Pages.app

Unfortunately, these controls are completely private. We don’t see many apps supporting rich text (without using geeky HTML tags) in iOS either — even Tumblr and Wordpress guys have probably decided it’s not worth the trouble. Evernote has shipped a pretty nice rich text engine in 08/2011, but it doesn’t combine images and video in between the content at the moment.

image

Building our own rich text

We needed high-quality rich text control, so we started hacking. This is what it takes:

  • Forget UITextField and UITextView
  • Write a new control from the ground up, conforming to the CoreText’s UITextInput protocol
  • Write custom methods to handle and render attributed strings
  • Clone current features of UITextField/UITextView, with loupe, magnifier, selections, suggestions and spell checking
  • Write HTML import/export methods reliably with reasonable level of abstraction and configurability
  • Hack UIMenuController to handle custom popups with rich text formatting options

International support

  • Write custom methods to enable the suggestions box and spell checking menu, accessing the current dictionary
  • Visually mark unknown words
  • Suggest replacement words from the current dictionary
  • Issue #1: iOS doesn’t provide, as far as we know, a public method to check whether user has enabled spell checking globally. This has to be incorporated into application’s settings separately (note: Evernote can access this global configuration, possibly using a private method?)
  • Issue #2: Right-to-left and BiDi not yet supported

Hack the UI, engineer the UX

iPhone display size is too small for huge menus taking up your screen. We needed to provide a meaningful UI without clutter, and decided to create a custom UIMenuController clone with formatting options - with custom UIView and paging support.

Also, rich text formatting wasn’t enough. We wanted to implement images and embeds right in between the text and allow rearranging them. We’ve identified these issues:

  • Users must be able to combine text with media (images, video embeds)
  • Must be able to rearrange placement of elements
  • Include the indicator area to recognize and distinguish between new line and soft-wrapped line
  • Allow selecting multiple lines of text more conveniently, by swiping across the line indicator area
  • Support splitting and merging text fields to insert media in between the text
  • Drag & Drop approach failed. Dragging an element in a view which can be thousands pixels long with automatic scrolling on such a small screen turned out to be a pretty bad experience.

After trying 8 different approaches, this is what we’ve came up with:

image

Enough talking, a video is worth thousands words. Obviously, we took some inspiration from Path for the buttons.

Example HTML output on the website

image

Code, sharing, licensing:

The reason why we’ve started building this was that we just wanted to let our users do what we felt should have been available a long time ago. The editor was built for our new “post-PC era” app (codename Webie, now M.dot) to create a mobile presence from the iPhone, currently in early alpha.

Overall, hacking took about 50 days for 1 super-skilled iOS hacker @pavelserbajlo (and I was designing). We’d possibly never jump into it knowing how ridiculously complex the whole iOS CoreText implementation is. The documentation is lacking and there are long-reported bugs in CoreText as well (we’re looking at you, Apple). But hey, at least it was an adventure.

So, where is the source code? There isn’t any. We don’t feel like sharing yet until we release it to public and have some exclusivity first. But we’re not just showing off. We’re asking people and looking for feedback and opinions.

Does it make any commercial sense? Is such a library alone worth licensing to enable all sorts of apps leverage rich text with images & embeds? Is there anybody in the wild likely to spend money on this?

You should follow me on Twitter @dominikbalogh. I am the interface hacker.

Why McDonald’s is so successful

Stop in the restaurant area on an international airport and look around.

What you mostly see is 5 or 6 restaurants each positioned just by the other one. But the long lines are only at McDonald’s.

Children, tourists, pilots, stewards, asian people, indian people, white people, black people, airport staff, terrorists, whatever.

How is it possible that everybody likes McDonald’s food? Now if course it’s not the food itself. It’s the consistency.

If you’re hungry and you know you have a certain amount of time before you need to leave, the only thing that matters is no surprises now, please.

You’re just not in a situation to try an unknown restaurant if you 1) don’t know how much time you’ll need to spend there, 2) don’t know how the food is going to taste and 3) don’t want to risk leaving dissatisfied with unfilled expectations.

You’ll rather eat something totally generic. Not as tasty, but in 20 minutes, and with no surprises. McDonald’s has built a network of exactly same restaurant branches with exactly the same generic food all over the world, and you know it best, because no franchise is as widespread as theirs.

I’m curious to find out how “no surprises” analogy can be applied to other businesses as well.