Sunday, May 11, 2014

Your bootable USB drive could not be created. An error occurred while copying the Windows installation files.

I spent an hour or so figuring this out. Downloaded the official Windows 8.1 ISO, but the Bootcamp assistant did not want to properly format my USB disk. After finding this http://apple-experience.blogspot.com/2013/08/your-bootable-usb-drive-could-not-be.html I became suspicious that maybe the problem is the ISO itself.

I found this then: http://www.makeuseof.com/tag/how-to-create-windows-compatible-iso-disc-images-in-mac-os-x/  and essentially converted the MS original ISO into a new ISO which was working fine with the Bootcamp assistant.

(I used disk utility to create a .dmg rather than a .cdr by selecting "hybrid image" in the image format drop down)

$ hdiutil makehybrid -iso -joliet -o IR3_CPRA_X64FREV_EN-US_DV9.iso IR3_CPRA_X64FREV_EN-US_DV9.dmg




Tuesday, March 18, 2014

Day 2 - NSConference 2014

1. Amy Worrall, KVO conidered awesome 

Apple’s idea: controller sits between the Model and View. This is not necessarily the best. Massive View Controller - the problem (view controllers are too big). 

KVO lets us go back to the original MVC pattern. Jejj, finally somebody likes KVO :)

Amy is practically giving an introductory talk to KVC and KVO. 

KVC can be used to get the min/max/count/sum/avarage of an array/collection. This is something new I haven’t seen before. 

[array valueForKeyPath:@“@count”];

KVC supports auto boxing/unboxing between int - NSNumber etc.
nil needs special treatment (setNilValueForKey)

KVC supports to-many relationships too: both ordered and unordered.

KVC also supports validation and coercion (example: i want to store a string in all capitals, if somebody calls the setter with lowercase i can convert it)

The she talked about KVO and an interesting observer pattern (self is the controller):

[self addObserver:self forKeyPath:@“modelObject.InterestingProperty” …]

With this pattern we don’t need to re-register is the model object changes under the controller.

Interesting: KVO works when ivars are set directly (so its not a for loop in the setter for observers). Its done via isa-swizzing, by creating a subclass of your class dynamically. 

Dependent key registration: full name is not backed up by an ivar, but rather derived from first name and last name. In this case for KVO to work we need to describe explicitly that changes in first/last name should trigger the change of full name. 

Change dictionary: you can ask for the kind of changes, the value of a property before and after the change. 

APIs on built on top of KVO: reactive cocoa, MAKVONotificationCenter, Cocoa Bindings

“Bindings are great”


2. Damian Sullivan, Legal considerations for contractors (Blitz talk)

This was a talk about Damian’s own experience of working on a project without a contract and the “fun” he had :)

3. Rich Siegel, Red meat and gin

Rich talked about his company and how they made is successful (work on ideas that are future proof etc).

Good engineering disciplines: no compiler warnings, etc.

They don’t use processes that are not needed: they have few processes form hard learned lessions, but he does not like agile, scrums etc. “If you create process just to have a process you are doing it wrong”.

4. Markos Charatzas, debugging with sounds (Blitz talk)

Xcode allows you to create voice notifications for tracepoints. This could be useful during debugging because the feedback is much quicker and natural than checking Xcode output window. Sounds are used almost like asserts. 

Example: noting when a hash table resizes.

5. Scott Little, wiring plugins for Apple’s mail application (Blitz talk)

No real APIs to write plugins. It’s all about swizzling, KVO etc. Reverse engineering. 

6. David Smith: 

This was a really interesting talk. “Unexpected delight” - understand the users need and make your application behave like that.

Normal design: asking what your user need. But this is insufficient, because we need to understand the user’s context and the respond to it.

Understanding context requires “detective work”. There is explicit and implicit context. User doing an action is an explicit context - application has to react to this otherwise its not doing its job. 

But implicit context is more difficult to detect. Easy to build 99% of the application (functionality part), but difficult to put on the cherries on top.

Examples: 

  • games add power management settings (lower graphics settings to save on battery) rather than doing it automatically (am I plugged in, do I have lots of battery left?)
  • Night mode vs day mode (based on screen brightness etc)
  • if I am running (or using the device in a car) with my phone it should have Huge buttons for easy access; hints: specific bluetooth device attached, motion sensors etc.
  • Knowing the user is not looking at the screen so we do something different (audio alerts)

Of course the problem is: what if you guessed the context wrong? Needs to provide easy way to turn off the functionality or disable it completely.

iOS 8 (hopefully) will have even more things which can be used to infer the context. 

7. Sean, meetup videos (Blitz talk)

Sean was talking about how to make good video coverage at conferences. One video stream from the presenter, one about the presentation and one about to show both when the presenter points to the screen. 

Audio is most of the time more import than video, so its important to capture it properly. 

8. Charles Parnot  (Blitz talk), Kitchen sink database

This talk is about how to cope with the fact that your database schema evolves over time due to new requirements etc. Also, specifically “core” data and pieces of data in the DB to drive UI behaviour should be separated. Also, there is persistent vs cache data. Critical vs disposable etc. 

The point is: we are using one DB to store them all (which part to sync then? should we migrate everything? ...).

Proposal is to separate these parts. Then you can optimise then separately (core data is optimised for backward compatibility for example, but the other part could be optimised for speed, can be kept sorted in oder to make the presentation easier etc).

9. Marcus S Zarra. Not invented here.

This was a controversial talk about how to develop software, particularly whether to rely on external components, 3rd party libraries vs re-implementing everything from scratch (which he prefers). “Don’t reinvent the wheel” - its a broken concept according to Marcus.

He believes adding external frameworks to a codebase is “black box” and “voodoo magic” and should be avoided.

To be fair he had some interesting points (like calling Apple itself a risk because Apple’s own libraries are black boxes) and he definitely triggered a big discussion at our table (and everywhere else) after his talk. 

However, since I disagreed with many of the things he said, so I decided not to recap more from his talk :) 

  1. Tobias Klonk, Another approach to observation (Blitz talk)

KVO, NSNotification center, delegates: approaches for notifying observers for changes. All of these have pros and cons. He like delegates because there are compile check safety associated with them, but delegates are good for 1:1 relations only.

Tobias went through some of the 3rd party approaches that help hiding some of the repetition code which you have if you implement observers yourself (for loop, iterating through observers, call method on them etc).

  1. Karsten, Building the next ten programming language (Blitz talk)

He talked about why is it that we still use text files to store source code. Why do we put breakpoints on the lines instead of statements etc. 

  1. Luc Vandal, Land or Slam

This was a talk about Luc’s experience and history in mac development (what apps he was writing and when, anecdotes etc). It was interesting and entertaining (but difficult to summarise the messages). 

  1. Daniel Pasco, Bil-Centric view of product development (Blitz talk)

These guys do Kaleidoscope and Versions (Black pixels). 

Our CTO (Bill): background in Smalltalk development, appreciated inside/outside of the company
Messages:

  • Building prototypes is important to try out new things. 
  • Don’t fight the frameworks (use NSArray, etc)
  • Don’t overcomplicate your code
  • talks about Designers, QA (very important to hire strong people, same qualifications and experience as developers), 

  1. Michael Lopp, The engineer the Designer and the Dictator

This talk was really-really awesome :) 

Monday, March 17, 2014

Plugins for Xcode - make it like Sublime text

1. Download the plugin manager for Xcode: http://alcatraz.io
2. Install the mini map plugin: https://github.com/stefanceriu/SCXcodeMiniMap

And voila:


First day - NSConference 2014

Day 1 (6th NSConference)

So it started. Mikey Ward from Big Nerd Ranch is here, in fact I am sitting at the same table next to him.

  1. Mike Lee, How to lose at Poker: 

This was a pretty interesting, but abstract talk. It was about poker, how to make decisions during poker, how to cope with winning and losing, how we believe that those who are winning are doing something great vs. how we believe those whoa re losing doing something wrong. 

I was constantly trying to make parallels in my mind and subtract away from poker: how this relates to Mac development etc.

For example Mike was talking about declining interest in poker and how to handle that (my parallel is declining interest in iOS because of Andoird)

As another example, he was talking about learning from losing and that you need a lot of luck in poker (is this about Flappy birds?)

During the talk I expected him to make the parallel with Apple and turn the talk into a tech talk, but that never happened, so his points were very implicit.

Neverthelast I found the talk interesting and inspiring - reminded me of professional magic the gathering play, where you have similar ideas (trying to play the best lines to maximise your chance of winning, though you cannot guarantee it etc).

  1. Uli Kusterer (Blitz talk):  

Uli was talking about “Hypercard”, an old 1987 “paint” tool. As the talk progressed (a pre-recorded movie was shown during the entire talk showing, presumably Uli, working with the software and doing nice things), it turns out that Hypercard is much more than a paint tool and in fact it was a pioneer in many areas:

- it has persistent state (so when you exit and restart you are there where you have been before)

- it has a built in script language which is natural language like (as opposed to today’s script languages)

  • it had just in time compiler (“Jaba before Java”)
  • it has built in “interface builder” where you can added buttons and wire them up with actions (“Xcode before Xcode”)
  • built in textfields animations (“Flash before flash”)
  • built-in database handling ("Filemaker before file maker”)
  • built in debugger, step through, watch etc.

It was interesting talk and a nice application. In general I thought this was all  heading towards some higher level point or conclusion, but the message was left implicit (should we not forget old ideas? should we think about programming languages differently? etc)

There are related applications, like Novocard (iPad). For more info see http://hypercard.org

  1. Drew McCormack, Ensembles a new Syncing framework. 

Drew was starting his presentation talking about how difficult syncing is today (keep your application on your Mac and iPhone in sync etc). The motto was that after today’s talk it should be “Syncing was hard” instead of  “Syncing is hard”.

Introduction of Ensembles - new framework,  built around core data; it started out as a hobby project, but it is officially production ready from today on (version 1.0 is released today and there are already apps in the App store using it).

Drew was talking about the background and types of syncing approaches (in historical order):

  • Peer to peer syncing over the wire (original way of syncing, plugin your phone into your mac via a cable); main properties: you can sync only at the given time, only between two devices
  • Cloud based syncing; main properties: you can sync any time and you can use multiple devices (mac, iPhone, iPad)
  • Dropbox model; main properties: introduces a local store on the device which allows syncing to be ssynchronous between the client and the server (also gives the option to work offline). I found this interesting because it resembles a bit out design for Analytics in Jabber.
  • Ensambles model; main properties: backend “abstraction” which means any server is good, does not need to be dropbox, can be iCloud etc. The server can be anything as long as it supports storing a file.

Ensambles stores chafes in the form of a set of transaction logs as files and sends them through the dump server.

Drew then talked about briefly why can’t we use web services for doing the same task (syncing)? His main point is that you want to avoid tight coupling between your data model in the client and in the cloud (to avoid the costs associated with the changes you need to make when the data model changes).

What s wrong with Apple’s iCloud core data syncing (official Apple way of doing syncing)? Drew says that although it is getting better in iOS7 and 10.9 probably it will never be good enough. Apple is not going to support Dropbox for example
as a backed or Custom servers. In general Apple is not going to open it up enough for third parties.

To summarise: Ensambles is a peer-to-peer, backend agonsitic (can be dropbox, iCloud, ftp, omnipresence, webdav etc) syncing framework. 15k lines of code, 40% are tests (unlike Apple’s code which is “buggy” - according to Drew). 

To use Ensambles in existing apps:
- no need to sublclass NSManagedObject, etc. (in general, no need to change the modelling)
-  it has hooks for conflict resolution (to handle invalid object graphs after syncing)

Ensambles also supports “baselining” - analysing the transactions to figure out how to simplify if certain operations cancel themselves out (adding an object, then removing the same)

The anatomy of an Ensables app: "4 lines of new code”
- set up the cloud file store
- create an ensamble
- call “leech” the very first time (this creates the local storage etc)
- call “merge” whenever you want, e.g. at login, etc. This does the actual syncing. 

Idiomatic - sample app to see how all this works; its a simple notes app demonstrating syncing, available in App Store.

Ensembles.io - commercial stuff can be bought here (documentation, support)

  1. Runar Svendsen (Blitzt talk)  

Finn.no (bit like daft.ie+carzone.ie+… together), 13 product owners 1 app: how to manage this?

Requirements: has to be fast, has to look the same on all platforms, etc

Layering: JSON based backend server, then Varnish, then the actual databases. Twice as many visitors from mobile web browsers than desktop.

I think the main message was to have a fast backend which provides all the data in a good format for a query. Then you can show it in many different places (browsers, apps) in a consistent look and feel. 

  1. Matthias Steffens (Blitz): OSXFuse, a custom made file system for OS X

This is available for many years now, it handles virtual file systems (like mounting and SSH or FTP server as local disc). 

This talk was about how to use virtual file systems in applications to hide the internal storage from the end users and present things in the normal finder. For example, having an app that stores your scientific papers, but not really as files on the file system - this is confusing to the end users, they would like to use finder to browse through their publications etc. 

In order to use you need to implement a few delegates (“give me the list of names of the virtual files”, “is this a file, is this a directory?”, “give me the file content” etc).

Your virtual files will show up in Spotlight as well.

For more, see http://osxfuse.github.io

  1. Alexander Repty, Treasue map

This talk was about MapKit, Apple’s framework for doing operations on Maps (OSX and iOS). It’s important to Apple, they invested  a lot into replacing Google. 

Originally introduced in iphone OS 3.0. It underwent massive changes in iOS 6.0 when Apple replaced Google Maps and then again in iOS 7.0.

He talks about what to show to the user which is useful. For example “where am I”, “Find my iPhone”. 

How to represent several annotations at the same location but still not to clutter the screen? Answer: use clustering and colour coding to clusters to denote density. More importantly: use animated clustering (zooming in will expand clusters to sub clusters, zooming out will collapse clusters). 

There is no real support for clustering in the current APIs. Apple’s own implementations (like in iPhoto) are private.  

There was a WWDC 2011 talk about this though “Visualising information geographically with MapKit”. The approach described here works, but does not scale for large number of pins/clusters. 

Alex was then talk about “callout views”, i.e. selections: what happens when the user clicks on an annotation on the map? 

This was an interesting UE talk.

  1. Manuel stuff Mc (Blitz talk)

The talk is about "fflp.me" (“flop me”) - its an app that is available on iPhone, Mac and iPad. It’s an app for kids, but the interesting thing about it is that it offers in app purchase (store kit) and game centre integration.

Game centre can be used to serve as a blackboard between your mac an iOS application (achievement, leaderboard, …). 

The talk went into technical details how to write an app (ifdefs etc) where the exact same code is running on both Mac and iOS. 

One specific advice: create a mac app even if you only want to distribute on iOS if you have in app purchases (much easier to test 0on mac than in simulator).


  1. Matias Pilpari: MPGestures (Blitz talk)

The talk was about gesture/character recognition (geometric shapes or letters). The had a quick part which was a generic introduction to machine learning. He was talking about a refinement of an existing classifier algorithm and showed how it was performing better for recognising emoticons than some of the existing standard approaches.

There are OSX and iOS libraries available if anybody wants to use it.

     9.  Jonathan D. Rhyne: Weirding way

Jonathan is an attorney and his talk is about the legal implications of communications between software producers and consumers etc. 

He brought up an example from Dune (Paul Atreides), showing how important to have effective communications :)

  1. Giovanni (Blitz talk)

Giovanni was showing tips and tricks how to achieve special effects with very few lines of code. For example, changing auto layout constraints and forcing cocoa itself to redraw etc. 


  1. David, UIView animations (Blitz talk)

Views by default don’t animate when we move them (as opposed to layers) if they are outside of an animation block. David digged into the details to find out the why? This was a very interesting technical talk, it practically went into the details of views, layers, their interaction and how to debug these interactions. 

  1. Paul Kim: Life outside the Mac App Store

Paul talks about Mac store limitations and the decision he made not to publish his app on the mac store. He didn’t want to have two version (mac store and non mac store, didn’t want to give up paid upgrades, direct contact with customers). 

He decided not to bother with the mac store. He was arguing that Mac store is far from being as relevant as App store on iOS and people in fact buy more directly from the developer’s web site than from the Mac store (for the same product). 

He suggests to use Sparkl for auto update. Omnipresence or DropBox for syncing. 

Marketing is something you need to do independent whether you are on the app store or not. Talks about the power of word of mouth. 

He talks about that it is important to do things sandboxed apps cannot, because that helps differentiating your application. Examples are: APIs that are not available in sandboxed environment, integration with other apps etc. 

  1. Matthew Robinson, NSURLProtocol (Blitz talk)

NSURLConnection, NSURLSession  both rely on NSURLProtocolol. Its an abstract class, concrete subclasses handle the specific protocols (http, etc).

He talks about how easily you can unit test network connections by overwriting few methods. 

canInitWithrequest: if you overwrite this you can claim you handle the request
startLoading: if we responded yes above, this will be called where we can return the mock data

You can also register custom protocols.

There is also a way to canonicalise requests (to describe that multiple URLs map to the same thing, e.g. capitals etc).

Anther example from Matt: modifying the incoming HTML (his example is to change every occurrence of “apple” to “fruit” if the MIME type of the document is HTML).

“NSURLProtocol is fantastic"

Sunday, March 16, 2014

Arrived to Leicester, ready for NSConference

It was not easy, but finally managed to find the hotel (and the city!). At Birmingham airport they sent me to Coventry saying there is train connection there, but there was no train there, only a bus - which brought me to Nuneaton and finally from there there was a train to Leicester. The good news is that I already met 6 other conference participants - they just came to me at the street and asked if I was heading to the conference  (so much for not looking geek ;)

Anyway, it's all set up, kick off tomorrow.

PS: ah, and thanks for meteor for telling me "if you want to use data roaming you have to go to the following website and accept terms and conditions" - very helpful to tell you to go to a website when you are trying to get net

Saturday, August 1, 2009

Setting environment variables in Mac OS X

I have suffered many times by the fact that applications from the dock or from the spotlight do not reach the same environment variables as if they were started from a shell. This is really problematic as some of them start non-interactive non-login sh shells (e.g. Doxygen, Eclipse plugins, etc) which cannot work properly without access to executables such as LaTeX, mercurial, etc.

I have tried many solutions, including the magical ~/.MacOSX/environment.plist, etc. Only one worked: I created a launchd.conf file in /etc and filled it up with content like:

setenv PATH /bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServ\
ices:/usr/texbin:/sw/bin:/usr/local/bin

After this all you need is a reboot.

Friday, June 12, 2009

Linking statically with Xerces C++ on Mac OS 10.5

Xerces C++ 3.01 automatically builds static and dynamic libraries as well. There are three things you will need to do in order to successfully link such a static library to your application:

- If you build Xerces-C++ with the network support (the default) then you will need to link to the curl library
- You need to specify the following g++ options: -Wl,-framework -Wl,CoreServices
- You need to add libxerces-c.a to the linker

Example:

g++ -Wl,-framework -Wl,CoreServices -o "DLog++" ./src/DLog++.o ./src/debug.o ./src/owl_parser.o /usr/local/lib/libxerces-c.a -lcurl


For the same thing under windows check this out: http://wiki.codesynthesis.com/Xerces_tips