Fast Chicken / Big Ted

Purveyers of fine iOS apps including mobileAgent and Trip Wallet

Xamarin Studio Cheat Sheet / Keymap

Xamarin Studio 4.0 was recently released, and as a lot of people might have started using it, I thought it might be a good idea to do a cheat sheet (or default key map) to give you an easy to find list of common keyboard shortcuts.

IntelliJ were one of the first ones to do this with Resharper, which has a lot of very complex keystrokes, and I must admit, I learned a lot about Xamarin Studio just by going through and writing the keys down.

This is based on the default key bindings – obviously, you can customise and add more in the settings.

You can grab a copy of the PDF here. It should print out ok on A4 and US Letter.

If you have any other obvious ones which I’ve missed, email them over and I’ll add them in. I didn’t think there was much point with things like copy and paste – everyone should know those.


On a similar note, Frank Kreuger pointed out Source Analysis:

@praeclarum: If you haven’t tried Xamarin Studio ➔ Preferences ➔ Text Editor ➔ Source Analysis, you’re missing out.

It’s new in Xamarin Studio, and it does nice things like hinting that you might like to extract a delegate into a method, or that you might be comparing two floats in an incorrect way. (in this case, “you” is me).

It also offers to fix them. Which is rather awesome.

I knew about this before, but I thought it needed Mono 3.x and a beefy machine. I can’t confirm it’ll work on low end hardware, but it doesn’t appear need Mono 3.x.

Worth trying out!

New Xamarin 2.0 Tools; Cheat Sheet for Getting Apps Reviewed; How to Design for Android

The quick stuff

  • Tope over at AppDesignVault has a cheat sheet for getting your app reviewed on the major websites (TUAW et al). I plan on try his tips when I’m done with the major rework of Trip Wallet that I’m nearly done with.
  • Meng To has a lovely visual guide on how to design for Android devices, including back buttons, the major resolutions, and proper use of the action bar. Well worth a read.

And now the major stuff!

Today, Xamarin launched a host of new stuff for mobile developersXamarin 2.0.

  • A re-designed and re-thought out version of MonoDevelop, now called Xamarin Studio. It takes a lot of its look and feel from Xcode, but without the complexity. At its core, it’s still MonoDevelop, but it feels like a whole new beast.

  • MonoTouch is now Xamarin.iOS, and Mono for Android is now Xamarin.Android. Xamarin.Mac was a good indication of where and why this was going in the direction it was going. This divorces the Mono brand (which I think Xamarin doesn’t own) from the products.

  • Each one now has three editions: Starter, Indie and Business. Business is the old professional, and is licensed per seat. It’s everything. Indie is targeted at individuals who are putting apps in the store (like me), and is licensed to a person. There is no Visual Studio support or LLVM. Starter is the free version, which now allows you to do on device deployment, with a few limitation. If you had a professional license, you now have a Business license, but I suspect you can change it when you upgrade again. All the pricing has changed, too, so check the site if you had discounted these tools because of the cost. (the old 5% discount I used to have isn’t working now, but I’m told it’ll be coming back – talk to me or Xamarin sales if that was a deal breaker)

  • [Updated]: If you bought MonoTouch/Mono for Android, you get upgrades at the existing, pre-Xamarin 2.0 price ($249.00?) – no expiry date. More info in the FAQ.

  • All of the products now support on-device deployment with the free Starter Edition. You can use the starter edition to build real apps, and deploy them to your own devices or the AppStore. There is a limit on size (32k of IL, no P/Invoke), and you don’t get the LLVM optimisations, but for smaller projects or people testing the waters, this is ideal.

  • The new Component Store is a nice way to find and get Xamarin.iOS and Xamarin.Android components – I’ve put BTProgressHUD up there – and it’s been approved already. It’s not a replacement for something like NuGet, but it’s a nice discovery tool. If you put your components in there, you can charge for them too – Xamarin handles the payment, you get 70%. The component store even includes some skins and non-code resources to help make your apps look great.

  • All the dll’s (monotouch.dll etc) are now signed, so you can also sign your own assemblies. The down side of this is that a lot of things need to be recompiled against the signed version, but you only have to do this once.

  • I’m told, lots of bug fixes. Lots and lots of bug fixes, which is another way of saying polish. It was a stable and polished product before, now it’s even more so.

  • For those wondering, it does not including C# 5 async support. This is in Mono 3.x, but Xamarin.iOS and Xamarin.Android have their own internal Mono version, which is in the process of being upgraded. Watch the space, because async/await is so incredibly useful for mobile development.

I’ve been using Xamarin Studio full time for the last few months (thanks Xamarin!), and it’s rock solid and stable. If you are used to Visual Studio and found MonoDevelop hard to use, then it may not change your mind, but if you liked MonoDevelop, Xamarin Studio is a nice evolution of that. Just not having to have a 100GB VM sitting on my SSD was enough for me to persevere with it, and now I love it.

The other huge new feature is that Xamarin.iOS now officially works inside Visual Studio. No more hacking the project files and copying over monotouch.dll – it works out of the box, including doing builds and deploying to your device.

This works by communicating to a service running on your Mac, which does most of the hard work of building and deploying – yes, you still need a Mac, there is (and never will be) no way around this. But on the up side, you get to use Visual Studio, Resharper, and all the tools that most .NET developers know and love.

The model is either a VM (windows) on a Mac (running the service), or a separate windows machine communicating over the network to a remote Mac. Either will work, but you can’t share the Mac between developers (that would be a license nightmare).

(Personally, I’m sticking with Xamarin Studio – I’ve got very used to it in the past 2 years, and I don’t have any major issues with it, but I know a lot of people who much, much prefer Visual Studio)

All up, outstanding work from all the folks at Xamarin – this has been a while in the making, and it’s great to see it released!

Hope to see you at Xamarin Evolve in April!

Introducing BTProgressHUD

It’s all very exciting.

Oh wait. That’s something else. This isn’t very exciting. But it is very useful.

I’ve needed a decent progress HUD in my apps for a while. I was using ATMHud for a while, and while that works, it doesn’t take the device rotation into account. Plus, it was a bit messy – you had to register it with your base window.

So I had a look around, and found SVProgressHUD which is referenced by pretty much every iOS app out there. I don’t really like using ObjC bindings unless I have to (read: too much code to port), so on a recent long haul flight to Japan, I ported SVProgressHUD to MonoTouch.

And so, I give you BTProgressHUD.

the shot is actually SVProgressHUD, but as it's a 1:1 port, it looks the same

It’s a 1:1 port of SVProgressHUD, with the addition of Android-style toasts.

As I said, not overly exciting, but very useful.

More info is on GitHub, including a sample. Feel free to use it, and submit bugs and the like.

FreeAgent Automated Bank Feeds and mobileAgent

FreeAgent just announced they have released automated bank feeds:

Sometime back in the late Cretaceous period we announced that development had started on Bank Feeds. Since then, tectonic plates have shifted, civilisations have risen and fallen, and all the while, work has continued inexorably on Bank Feeds.

The year is now 2013 and the great news is the coming of Bank Feeds is now upon us. But is it such a big deal?

Yes, this is a big deal!!!

Bank Feeds automate the process of importing bank transactions from your bank into FreeAgent.

I agree with Roan – this is a big deal. We use FreeAgent for our business, and Xero Personal for our personal stuff. Xero recently added automated bank feeds for Xero Personal – they have had it for the main Xero product for a long time.

To say it makes a difference is an understatement: we use it now, rather than putting things off until later. We don’t have to put a calendar reminder in to do imports before the bank removes the data. Throw in scheduled automated bank feeds (daily like FreeAgent, or even weekly) and a mobile app, and that would solve 80% of my problems with the UK personal banking system.

Which brings me to mobileAgent.

In the recent versions of mobileAgent, I now show the current bank account balances and the last 30 days of transactions, so you can see your up-to-date transactions on your iPhone.

Which, frankly, is pretty cool.

All you need to do – once the FreeAgent part is all setup and working – is open mobileAgent, hit Refresh (top right of the toolbar), wait bit for the download, and you are up to date!

If you consider this information to be especially sensitive, you can also set a pin number on mobileAgent, which requires you to enter it before you can open mobileAgent. It’s at the bottom of the Setting screen.

Side note: mumble grumble I’m with a bank thats not supported by this yet – not FreeAgent’s fault tho. I’d consider switching, but we might not be in the country for much longer, so it’s not worth it. But Luke Redpath has a wee script which fixes that, but it does need manual execution. Some Ruby skills required however. I’ll be trying this out shortly, I think.

Ry’s Objective-C Tutorial

TL;DR: An especially good tutorial for Objective-C from RyPress, which covers all the basics, without being too basic.

Over the years, I’ve used a few languages, starting with Pascal and Delphi then Java and C#, amongst others. Objective-C was always an oddball language because of its syntax and industry usage. It felt like C, but then there were the square brackets everywhere! However, in a lot of ways it was a long way ahead of its time: message passing and forwarding, protocols, dynamic typing, categories. Even back in 1996 when we did it at University, it felt different, and yet a lot more powerful than the current languages of the time (C, C++ and Java for me back then).

Since 2002, I’ve been firmly in the C# camp, which has evolved from a basic Delphi-like language (with squiggly brackets) into a well designed, fully formed language with a huge class library. Objective-C hadn’t moved much until Apple released iOS, and when I first looked into iOS development, it felt old – its core ways of working hadn’t moved with the times, manual memory management being one of the major things I wasn’t willing to go back to.

Since then, Apple has done some fantastic work making it a more modern language, but without breaking the original spirit of the language. Properties, dot notation, ARC, blocks and literals go a long way to making me like the language.

A lot of it is the compiler writing code for you, eg:

1
id object1 = [someArray objectAtIndex:0];

becomes

1
id object1 = someArray[0];

But thats what the compiler should be there for – to make your life easier and safer, and to force you to write less (or no) boiler plate code. Ruby and Rails got this right in a big way, with rails at times feeling like it’s own language.

Most of my mobile work, however, is in MonoTouch and Mono for Android, which is all C#-based. However, most samples for iOS development are in Objective-C, being able to at least read Objective-C code is (or should be) a requisite requirement for anyone doing iOS development with any tool – XCode, MonoTouch, RobyMotion, and even Phonegap.

The same goes for Android development: if you want to be effective, learn to read Java (thankfully, thats quite easy for C# developers).

Matt Gemmell linked to an especially good tutorial for Objective-C from RyPress, which covers all the basics, without being too basic.

If you are doing iOS development in any language, it’s well worth reading and understanding.

UICollectionView Tutorials

It appears that the UICollectionView is getting some well deserved love. UICollectionView is a successor – or just a well designed sidekick – to the UITableView, and provides a great way to display a list of items and let the user scroll thru them and select them.

Most of these are in Objective-C, but if you are doing iOS development and can’t at least read Objective-C, I suggest you stop what you are doing, and learn enough to read it. It makes life a lot easier.

If you can target iOS6+ for your app, the UICollectionView is a lovely component to use – and while you could do a UITableView-style element with UICollectionView, I’d love to see UITableView2, which had the function or UITableView, but with interface clean up of UICollectionView.

Almost worth going iOS6 only for.

BONUS: The iOS Design Cheat Sheet. Just how high was that title bar…..

Options, Apple and Stock Manipulation

There has been lots of talk about the Apple share price recently, around how its gone from around $700 to $500 in the past 3 months, all with very little apparent reason. Gruber has a number of very good pieces on it if you are so inclined.

What I want to talk about is what’s going on here. Not the “conspiracy” side of it (and I’d not be surprised at all if Wall St is manipulating the price), but the mechanics of Options, as I think it’s something that a lot of people don’t know much about.

Stock – buying, selling and shorting

The concept of owning stock is easy: I want a stake in Apples future, so I buy 100 shares at $500 ($50,000 worth). Stock goes up, I make money. Stock goes down, I lose money. Easy. As a normal punter, I have no control over the price, and the price should be based on how the company is doing.

Should. It’s not, but it should. More on that later.

If I think Apple is going to go down, I can short sell (or just short) Apple. This means I borrow the shares from someone, sell them at $500, and when they go down to $450, I can buy them back (and give them back to the original owner) and make a $50 profit.

Of course, if they go up, I’m screwed – I have to pay $550 to buy them back, and then only get $500 back, losing $50, but thats what the traders get the big bucks for – risk management.

If the borrowing sounds odd (who’d loan their shares out?), remember this is all automated, brokerages require anyone shorting to have a cash balance high enough to cover losses, and the actual owner of the shares never knows (or cares) that “their” stock has been sold and then returned. It’s invisible.

In all this, I’m going to use Apple as an example, with a current price of $500. This is just as an easy, round-number example.

Options

Options are what is called a derivative, as their price is derived from the price of the thing they are based on. Futures are also a derivative – their price is based on the price of the underlying commodity, eg the price of coffee. In the case of options, the underlying asset is the stock.

Investipedia has a nice definition which makes very little sense to the layman:

A option is a financial derivative that represents a contract sold by one party (option writer) to another party (option holder). The contract offers the buyer the right, but not the obligation, to buy (call) or sell (put) a security or other financial asset at an agreed-upon price (the strike price) during a certain period of time or on a specific date (exercise date).

So what does this mean? There are two sides to it.

I own some stock, I want to make some money on it.

Shares in the US seldom pay a dividend to the shareholders, and if they do, it’s not usually a large amount. So if you hold Apple, and want to make some money, you can create (write) an option. You literally sell a promise note, saying:

On Jan 15, I will sell the holder of this note my shares for $550, if they want them.

The components, which are in the definition, are the keys here.

  • Jan 15: It has a specific expiry date. After this date, the note is worth NOTHING.
  • sell: The action. I will sell my shares to the holder. This is a call option (the other is a put)
  • $550: The strike price. What price I’m going to sell my shares at.
  • if they want them: The holder of the note doesn’t have to buy the shares if they don’t want to. Infact, most (99+%) of options are never exercised (the underlying stock is never traded)

For this, I get a premium, like an insurance company does. The premium is based on the amount of time before it expires (time value), and the relationship between the option strike price and the shares current price (intrinsic value). Intrinsic value can go up. Time value always ticks down.

Options are very similar to insurance in this way, and hedge funds can use them to “hedge” or insure themselves against stocks going down:

I (the insurance company) will replace your phone if you break it before Feb 28. For this you will pay $5 for a phone of value $500. On March 1st, we renegotiate and you pay again.

If I do this – sell a call – I keep the premium regardless, and if the stock price is over $550 when the option expires, there is a chance the stock will be bought. If it’s under, the option expires, I keep the premium, and it all starts again.

This is called writing covered calls, as I cover it with the stock I own. You can also write naked calls, but unless you have an exceptional bank balance (Wall St), this is a good way to lose money.

This is what Wall St is said to be doing (they wrote a LOT of calls, and I suspect they were naked). If Apple closed at $500, and they wrote options at $500 or above, they keep the premium, and the shares. Easy money.

I want a stake in Apple, and I think they are going to go up, but I don’t want to shell out $500/share

For this, you might buy a call option. So if Apple is $500 now, and you think it’ll go to $600 before the middle of March (March 13 expiry), you would buy a March 2013 $600 Call. Options always expire on a specific friday of the month (3rd Friday).

Right now, the price of that option is $3.52 per share. I have to buy in contracts, and a contract is 100 shares, so if I buy 100 contracts, I have to pay $35,200. But I control $5,000,000 worth of Apple shares.

Time goes by. I can sell the option to someone else at the current price or keep it.

If the stock price stays the same, the option price will decrease over time, as the time component loses value. If the stock price goes up, the price of the option will go up (and down a little, as it still loses time value, but the increase in stock price offsets it).

If you are options trading, you sell it to make your money (and you can make 10-100% in 2-3 days if you do it right). If you want to own Apple stock, you can wait until it expires, and exercise it. But you’d need $5m cash sitting around (on the plus side, you’d then own stock worth $6m)

To give you an idea, if Apple jumped from $500 to $600 overnight, the option price is likely to go from $3.52 to around $30. Not a bad 10x return on your money. In reality, it might do that over a month or 2, so you would lose time value too, but the idea holds.

Puts are the opposite of calls. They are used when you think the stock will go down, and the contract looks like:

I will buy your shares at $450 on 15 Jan, if you want me to.

If Apple is at $500 on Jan 15, thats a great deal for the seller (they keep the premium and don’t have to buy the shares. No one would say “here’s a $500 share, just give me $450 for it”). If they are at $400, it’s not. If you buy a put (usually to offset an expected loss), and it hits $400, thats a great result for the buyer.


I hope that’s covered a bit of the basics of options. They are not overly complex or scary, but they can get you into a whole lot of trouble if you do it wrong, or get on the wrong side of one. I’ve not covered things like getting out of a contract (if you sold a call, you just buy one back at the market price to close it), but from what I know, the theory is solid.

I’ve also not covered Spread Betting which is very popular in the UK, as it’s not a “real” financial trading tool – it’s literally gambling against a casino.

I am strongly of the opinion that the stock market – mostly the big ones – are a bit of a casino. The “normal” player has no chance against the big boys and their computer-driven trading, who can get in and out of a trade before you even get the chance to buy. The stock price is also based not on “expected potential future earnings”, but just on the whims of analysts and traders with huge bank accounts, very large computing grids and 10ms ping times to the trading computers.

The other people trading the same stock as you are almost never “like you” – they have funds in the billions, and none of it is their money. Unless you buy and hold, you have no chance.

Now, just how many iPhone has Apple sold this quarter – thats the $5b question.

The Hobbit and HFR

Leonie and I finally got to see The Hobbit this weekend. We’ve been busy since it came out, but as we know a few people who’ve worked on it, I wanted to see it “how it was supposed to be seen”: High Frame Rate, 3D, on a 4K screen with a very modern sound system.

First, the film: as a first part, I really enjoyed it. I have read The Hobbit a few times, but not for many years. While I had a general idea of what was happening next, it wasn’t predictable. In general, I enjoyed it. I have no idea how they are going to fill two more movies with whats left of the story, but I’ll leave that to the writers.

For me, the 3D really works. Since Avatar, every 3D movie I’ve seen I’ve really enjoyed, and the ones that use the 3D to enhance the story (Hobbit, Avatar, Prometheus, Skyfall) have drawn me further into the story, which is really the point of it.

High Frame Rate (HFR) is something I can’t get into. I don’t get the headaches that some people do, it just looks fake to me. It looks like I’m looking into a film set, not into Middle Earth. I find it distracting and off-putting, especially the lighting on close ups of faces – eg during the dinner scene in Bilbos house.

Peter Jackson’s motivation was that with normal 3D, the movement tends to jump and blur a lot unless you increase the frame rate. I would absolutely agree with him, but I’m not sure this is the answer. I also read that motion blur can be added in in post production, but at a huge cost.

We had the same issue when we were on holiday over Christmas. The place we stayed in had a fairly modern TV (and Sky SD, not HD), but everything – including Lord of the Rings and Doctor Who – just looked fake, like the lighting department went on holiday and they hired the crew from Days of our Lives. I couldn’t for the life of me find the off switch for the higher frame rate on the TV, even tho there were numerous forum posts and articles about the exact problem and how to fix it.

I only have two data points – Leonie and I – but I wonder if finding HFR to be distracting is linked to frame rate sensitivity. I found the TV unwatchable (not a bad thing) and The Hobbit watchable, but only just. Leonie found the Hobbit to be fine, and the TV to be watchable, but “awful”.

Our eyes are very different, however. I can look at a working fluorescent tube office light and see a faint flicker. Leonie can’t. One of the shops on the high street has a broken bulb – I can see it flickering like a strobe light in a club, and find it distracting to the point where I can’t really think and start to get a headache. Leonie can only see a faint flicker, if anything at all.

Back in the days of CRT monitors – which I’m so very glad are behind us – I could never use 60hz, which was the default: I had to crank the refresh up to 75 or 80hz, which ment if I wanted a good resolution (over 1024x768 – this was the 1990s!) I had to pay top dollar for a monitor. Not good when I was a broke student.

I wonder if the two are linked. The Hobbit was a little distracting, but it’s something I would normally be sucked into so far, that I’d basically have no memory of the cinema – only of the movie. Not so this time.

If you have any thoughts on this, drop me a tweet or email. I’d love to hear how others found the High Frame Rate, and if you are sensitive to fluorescent or monitor flicker. I’m going to try to go and see The Hobbit again, just in normal 3D, and for the next one, I’m going to avoid the HFR version.

MonkeySpace / Monkey Square Videos Available

The videos for MonkeySpace / Monkey Square are up on vimeo, and worth a look.

MonkeySpace (run by Monkey Square – yes, it’s a little confusing at the moment) is:

is the official cross platform and open-source .NET conference. Want to learn more about developing for the iPhone, Android, Mac, and *nix platforms using .NET technologies? How about developing games or learning more about open-source projects using .NET technologies? MonkeySpace has provided an annual venue to collaborate, share, and socialize around these topics and more.

I’m hoping a few more go up, as there are some I linked to before which I really want to see.

As Monkey Square is a non-profit (tax deducable if you are in the US, i would assume), if you find the videos interesting, please donate, so they can do more of them.

C# Is Dead (Again). Long Live C#

Only yesterday, Verity Stob had the continuation of her (??) long Delphi saga, with a nice dig at C# at the end.:

For C# hath become a lonely path. And the Beast hath shut its gates against us, and hath broken our Silverlight into a million smithereens, and feedeth us alive to Herb Sutter and STL and the rest of the slavering C++ 11 crowd.

Except, it’s not dead. Still.

  • Silverlight never really got off the ground – except where it did (cough Netflix – tho mostly, it didn’t)
  • WPF never got off the ground – except try to get a job in London’s finance sector without it. Most of the front office stuff is WPF (or, oddly, Flash)
  • WinRT is looking like a flop – except if you are the likes of Marker Metro or the various other places who appear to have more work than they know what to do with.
  • No one uses ASP.NET and ASP.NET MVC – except Microsoft, StackOverflow and a host of other huge sites. Not as many as some other languages, sure, but have you seen what Facebook has had to do to PHP to get it to work for them? Or twitter porting most of their backend to the JVM?
  • XNA games got be-headed, only to grow another one (or 2) in the form of MonoGame.
  • BizTalk has a bit of .NET in it (ie, around 90%?). Sharepoint is all .NET. The only bits which aren’t at Microsoft appears to be Windows, and Office, who appear to be the ones who are confusing everyone with a new – but totally incompatible – framework.
  • Not to mention the many of millions of lines of .NET code out there running business, government departments, stores, media companies like NBC and BBC, casinos, and pretty much everything in between. (thanks for the reminder, @kiwipom)

Update: Dave Addey pointed out on Twitter that most of the top games for 2012 are done in Unity3D. Which is based on Mono for the scripting.

And then there is Xamarin, who just released Xamarin.Mac, which uses some of the magic of MonoTouch to let C# developers write native Mac apps.

Now we have Windows, Mac, Linux, iOS, Android, WP7/8, Raspberry Pi, BeagleBoard, S390 and a host of other platforms and products, all of which have a common framework: the .NET/mono framework.

Can’t say I saw THAT coming 7 or 8 years ago, when the .NET hype was at it’s peak.

So with or without Microsoft (or specifically the Windows and Office divisions, ‘cos DevDiv (developer tools), Server (BizTalk, SQL Server) and Azure are still rocking along), C# and it’s surrounding frameworks are looking anything but dead. There is a strong OpenSource community around various projects (eg ServiceStack) and Microsoft itself is opening up large chunks of the framework, which 5 years ago would have been unheard of.

Like I said last year:

Feels good to be a Gangsta C# developer.