Blog rebuilt and back online

After a few month hiatus, the blog is now back online. The old installation was about 10 years old, so its been manually rebuilt from scratch which should improve everyones experience browsing around. Expect some casual and technical posts coming in the next few days/weeks/months.

 

Compiling Swift from Source on the Raspberry PI

In late 2015, Swift was fully open sourced by Apple and hosted by GitHub. (you can find more info about both of these items on the Swift.org website and Apple’s Github.)

What this did was open up a lot of interesting opportunities and potential for a lot of people / projects / systems. I’m sure the first thing on a lot of people’s minds was… “will it run on X?”. Well the answer is… sure why not… Apple already provide ready-made packages for a few Linux variants and there are also ready-made packages out there for other platforms too, including android :o. There’s no fun in using a ready-made packages though right? if you’re insane enough, why not try to compile Swift on the Raspberry PI? Well thats what I did and here’s what I found out…

If you want to get a decent installation of Swift up and running, including the compiler, Foundation, stblib then the whole thing consists of 9 different git repo’s.

Initially I tried a Raspberry PI Zero ($5 Tiny Computer) running the latest Raspbian. Unfortunately, after trying a few times (with each cycle taking around 12 hours), I didn’t get very far at all. First I had to make some modifications to some of the repo compile time checks, then manually install newer versions of cmake / clang etc, try different compilation configurations etc… after which the PI Zero sadly didn’t have enough memory to get to the very end. So for the remainder of this post i’ll be using a Raspberry PI2 running the latest Ubuntu Mate image.

From here-on in, i’m gonna summarise a little, as getting this far took me a few days of hacking combined with trial and error, of which i’ll spare you the details.

 

Ubuntu Mate This is the OS you’re gonna need to load onto your microSD before continuing. You could try with Raspbian, but i’ve had mixed results. NOTE: this only works on armv7 based PI… so as of writing thats the Raspberry PI2.

A full clone of all repo’s you’ll need for Swift, as you’ll see below, a couple of the repo’s are not the official Apple ones, this is because they’ve had patches applied to them to aid in compilation on the Raspberry PI

UPDATE: 2017, You can now check-out all the repo’s directly from Apple and it will successfully compile as PI support has been merged in.

sudo apt-get install git -y
git clone https://github.com/apple/swift.git swift
git clone https://github.com/apple/swift-llvm.git llvm
git clone https://github.com/apple/swift-clang.git clang
git clone https://github.com/apple/swift-lldb.git lldb
git clone https://github.com/apple/swift-cmark.git cmark
git clone https://github.com/apple/swift-llbuild.git llbuild
git clone https://github.com/apple/swift-package-manager.git swiftpm
git clone https://github.com/apple/swift-corelibs-xctest.git
git clone https://github.com/apple/swift-corelibs-foundation.git

In case you still want to use the old repo’s, they’re here for reference.

sudo apt-get install git -y
git clone https://github.com/hpux735/swift.git swift
git clone https://github.com/apple/swift-llvm.git llvm
git clone https://github.com/apple/swift-clang.git clang
git clone https://github.com/hpux735/swift-lldb.git lldb
git clone https://github.com/apple/swift-cmark.git cmark
git clone https://github.com/apple/swift-llbuild.git llbuild
git clone https://github.com/apple/swift-package-manager.git swiftpm
git clone https://github.com/apple/swift-corelibs-xctest.git
git clone https://github.com/hpux735/swift-corelibs-foundation.git

Make sure to clone all of the above into the same parent folder, so you should end up with 9 different folders.

There are a few dependencies you will need to get the compilation going, along with a few others added in for your benefit, as you’ll need them immediately after.

sudo apt-get install build-essential cmake ninja-build clang python uuid-dev libicu48 libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config

Now comes the more nitty gritty part. You’re gonna need three resources for this compile. CPU, RAM and Disk Space. You can’t do a lot about CPU, however you can improve the RAM and Disk Space situation quite easily.

Assuming you haven’t already expanded your root filesystem to the extents of your microSD card, we’ll do this now using the easiest approach possible. There’s a neat little utility called raspi-config that is an aid to some of the common tasks you’ll need to do on your pi.

sudo apt-get install rasps-config -y

Now run it and choose “Expand Filesystem”, after you’ll see an option to change the Memory (RAM) Split between GPU and System, you’ll want to allocate as much as possible to the System for now, it’ll make the GUI a little sluggish but don’t worry about that for now… After you’ve changed the value reboot and thats it!

After all this, we still have a lack of RAM… likely around 1012MB (1024-12vmem) available. The compile of Swift will take a lot of memory to get things going, so we’re gonna enable a SWAP file. This essentially will allocate a portion of your microSD card for on-demand “RAM” that can be used when your actual RAM has ran out. Its very similar to how paging works on other platforms, but at the same time, completely different. The caveat is… SWAP on a microSD is very very slow, however you’ll have to make do.

sudo apt-get install dphys-swapfile

This will enable a file to be used for SWAP, usually on Linux you slice off a specific partition for this purpose, but as its only going to be temporary whilst we compile Swift, we’ll use our approach.

Now that all the above is complete, we’re ready to get on with compiling 🙂 We’re going to build a “release” configuration of Swift with no-assertions enabled, what this will do is greatly speed up the compile time (by around a factor of 2) whilst reducing the memory usage required. The trade-off is that you won’t have debug symbols or a great ability to poke around. For our needs, it’ll suffice.

From the parent folder you cloned the 9 repositories into, perform the following steps:

cd swift
utils/build-script -R --no-assertions

Now go and make a tea, watch a box-set of game of thrones and come back around 9 hours later… You’ll either find yourself with an Error, or a lovely compiled version of Swift on your Raspberry PI! If the latter is the case, lets take it for a spin!

~# nano helloworld.swift
  let message = "Hello World!"
  print(message)

hit (Ctrl+X)
hit (Y)

~# swiftc helloworld.swift

~# ./helloworld

Hello World!

Viola!

P.S I’m currently refining this post to add a script that performs all of the above.

Questions or comments, hit me up on Twitter @ArmstrongAtWork

 

Mocking data for UI testing in Xcode 7

Over the passage of time working on different projects i’ve seen a lot of different automation frameworks to handle UI testing. Mostly quite similar, they rely on the concept of having deterministic mock data that will power your views, they then drive your views through a user journey to assert an expected outcome. Most of these frameworks follow the Behaviour Driven Development (BDD) approach to writing tests through their adoption of Cucumber, I won’t go into the details of these here as its not really relevant.

Xcode UI testing however takes a different stance and on my current project, we’ve used it more as a “no, don’t unit test that, its a view controller, write a UI test” style tool, rather than a fully fledged automation framework. What this really means is, we’re asserting things like “the menu only contains 5 items that match our mocked data” or “when you hit login an activity indicator view is displayed”; whereas in UI Automation land we’d be testing things like “given i’m a logged out user, then I enter text into username and text into password, then I hit login, I should be presented the welcome screen”… Or similar. So effectively we’re testing small discreet units of UI within our application.

The two things we soon discovered we’d need for this are:

 The ability to inject dependencies where possible so we can load views without always necessarily progressing through a user journey to them.

The ability to test our views deterministically. This means we require MOCK data.

Why don’t we just go to the network, we can guarantee our API? Well, basically because you can’t. If you can run your test suite in a nuclear bunker, surrounded by a faraday cage with no outward or inward connectivity, then you’re onto a winner. The ability to be deterministic, to be certain that if your test fails its not because of some outward problem, but indeed due to a problem with your implementation, is vital for this specific type of testing. Other testing strategies such as end-to-end etc can accomodate this.

I’ve seen a few approaches to mocking data over the past decade. The common theme seems to be either one of:

Running a proxy that will returned canned responses to requests, configuring your network to use it as appropriate..

Littering all of your network code with #ifdef UI_AUTOMATION… and returning canned responses from an NSBundle.

In each individual test case, creating stubs and mocked responses for HTTP calls on the fly

All work, but it can be a little easier depending on your use case. SuperMock is inspired by both… a framework that you can drop into an existing code base, provide it with a simple .plist that maps network calls to canned responses in your NSBundle, functions as an NSURLConnection/NSURLSession proxy, but runs as part of your application test target, runs no server, requires no network and only leverages built in components of Foundation.

Example Scenario:

You have a menu in your application, which is dynamically driven from a web service, the contents of this menu can change at any time, but you’d like to assert that given some data, it populates and draws correctly on the screen.

Given the aforementioned problems… bring on the MOCK!

Example of the required Mocks.plist

Example of the required Mocks.json

By defining your original/real URL in

Mocks.plist

of SuperMock and running 1 line (ok maybe 2) of code in your AppDelegate, you are able to guarantee the value of your menu items in your application. Making your UI Test case very simple to write and very reliable to run.

How to implement SuperMock in your App.

How to implement SuperMock in your App.

Now when your HTTP client fires off a request for

http://mike.kz/api/menu.json

it will instead get returned

file://....menu_MOCK.json

from the NSBundle you provided earlier. In your UI Tests (whatever framework you use), you can now assert based upon these MOCK values. Whats advantageous is that there is no more work to be done and no extra code in your test cases to stub out responses.
This is a short whirlwind tour of my latest little pet project, but expect to see feature like dynamic override of mocks (for use when you want the same URL to return different responses upon each request) and some more real world scenarios.

I’ll be using this framework a lot myself in my personal projects over the coming months, so I may tweak / change / improve / try not to break it, in the process. Right now its functional but not complete and needs a new README.md ?

 

https://github.com/michaelarmstrong/SuperMock / @ArmstrongAtWork

 

MacBook 2015 released with 12″ Retina Display. My Thoughts & Comparison

design_retina_large

On 9th March 2015, Apple announced (among other things…) an all new MacBook, I won’t go into the marketing details as you’ll find those everywhere else. Essentially however its an ultra low power, ultra light, 12″ MacBook with a Retina Display. As a heavy 11″ MacBook Air user I can confidently say I think they’ve really pulled it out the bag this time.

Firstly looking at the overall dimensions of the 12″ MacBook I was very surprised to see its smaller than the 11″ Air (just about) in every dimension, whilst also being lighter and having a 1″ bigger display.

Device Height Width Depth Weight
2014 MacBook Air 11″ 0.11-0.68″ (0.3-1.7 cm) 11.8″ (30 cm) 7.56″ (19.2 cm) 2.38 lb (1.08 kg)
2015 MacBook 12″ Retina 0.14-0.52″ (0.35-1.31 cm) 11.04″ (28.05 cm) 7.74″ (19.65 cm) 2.03 lb (0.92 kg)

To summarise, the thinnest part of the MacBook is thicker than the thinnest part of an Air by 0.05 cm (which perhaps is a good thing if you’ve seen how thin and almost transparent the MacBook Air 11″ display is) and its slightly deeper, apart from that its almost identical in its dimensions, which is great if (like me) you’ve invested in bags/sleeves and the likes, all your non-technical accessories will still work.

Additionally its battery life estimates and tech specs are very comparable if not identical to the battery in the 11″ MacBook Air. Meaning you get your retina display without any compromise… Except one…

The next part of this post is purely speculation until proper benchmarks arrive, however, after some digging into the Intel Core M, i’ve noticed only 5 Broadwell architecture CPU’s exist and one in particular matches the top spec CPU mentioned by Tim Cook in the Apple Keynote almost identically. I’ll take a look at that top spec CPU vs the top spec CPU of the 11″ MacBook Air.

Device CPU Power Cores Benchmark
2014 MacBook Air 11″ Intel Core i7-4650U 15W Max TDP 2 (4 logical) 4156*
2015 MacBook 12″ Retina Intel Core M-5Y71 4.5W Max TDP 2 (4 logical) 2780*

* according to cpubenchmark.net

What this shows is the 2014 MacBook Air 11″ in its top spec config scores 66% higher than the 2015 MacBook 12″ Retina. However what it shows me is that trade off has been made in choosing an ultra low powered CPU to maintain battery life whilst giving the user a Retina Display. Remembering, the benchmark used isn’t a real world scenario, its more of a point scoring benchmark and additionally, I have no idea what CPU the new MacBook 12″ Retina actually uses… This is just an intelligent guess. Interestingly again, both CPU’s support up to 16GB Memory, however the configs at Apple top out at 8GB.

Nevertheless if price wasn’t a factor, it’d be really tough to choose an MacBook Air 11″ over a MacBook 12″ Retina. Having a black bezel, retina display, edge to edge keyboard really sells it here for me. I was happy with the existing size of the MacBook Air 11″, but every little helps. Mondays keynote was the first time I truly agreed with and believed Jonny Ive when he said something along the lines of “we’ve really tried to optimise the efficiency of the MacBook’s design as much as possible”.

 

The next thing that sparked by interest was the inclusion of USB-C for… everything, (for those who don’t know, its a new USB standard that allows power, data + different standards over a single cable). I travel a lot and although my Air rarely runs out of a battery when i’m out of reach of a power outlet, its interesting to think that you could buy a 29$ USB-C to USB cable and potentially charge your MacBook 12″ Retina using the same portable battery pack you use to charge your iPhone / iPad, it is to be confirmed, but i guess it wouldn’t be reaching far to expect this. UPDATE: I can confirm you can charge your MacBook 12″ with a portable battery pack you use for your iPad/iPhone. 🙂

Power pack charging MacBook

 

[follow_me]
Those are my initial thoughts beyond the keynote and various tech blog info out there and i’ll try to update this post once my Space Grey top spec MacBook 12″ with Retina Display has arrived and i’ve (with sentiment) retired my trustworthy and fantastic MacBook Air 11″.

 

SuperRecord an ActiveRecord implementation in Swift

All the media buzz around swift seems to be having some tangible effect. I won’t go into the opinionated slaw of Swift VS Objective-C VS Swift VS XYZ here :). Many of you know I freelance in the iOS space around London and beyond for SuperArmstrong and one of my recent clients asked me to work on a greenfield project to replace a very old wrapped web app they had. When we got down to the nitty gritties, one of their few requirements was that it should be written in Swift. My jaw did drop a little… considering this was about 20 days after Swift had first been publicly announced. After some conversation, we came to the mutual conclusion that they were brave.

Like many of the apps I work on, this project relied heavily on CoreData, as a convenience I decided i’d try out a library that I have a lot of respect for (even though its had its challenging moments) “MagicalRecord”, having only done organic CoreData for the past few years. As you probably know, Objective-C and Swift can sit alongside in a project and work in unison… however, not all the interoperability is 100% sound. I soon started to endure strange bugs and thanks to the incompleteness of Swift lldb support at the time (especially when mixing with Objective-C) these bugs soon became quite difficult to track down.

The most annoying was this:

let entityDescription = NSEntityDescription.entityForName("Pokemon", inManagedObjectContext: context)

Although harmless… this would actually fail when trying to insert an entity of that description into your managed object context. The culprit here? the NSString to String bridging (or vice versa).

To get around this bug (which I won’t go into too much detail) I began using:

let entityName = "Pokemon" as NSString
let entityDescription = NSEntityDescription.entityForName(entityName, inManagedObjectContext: context)

Performing a forced downcast to NSString. So great, now it works… However, many of the MagicalRecord finders and helpers I was using, would not have these forced downcasts as they came from the Objective-C world. I first forked MagicalRecord, after delving into the source-code, making many changes for better Swift support, fixing some threading irregularities I then realised I was putting a lot of work into making something work that had more functionality than I required at the time. So I embarked on making a Swift ActiveRecord style “companion” to CoreData.

The reason I say “companion” and not “wrapper” is that I didn’t want to abstract away CoreData too much or remove the power from the hands of the developer. I wanted to make the developer’s life easier, whilst maintaining their flexibility.

I’d much rather do something like this:

let pokemon = Pokemon.createNewEntity() as Pokemon

and avoid the above lines + more.

Thereby SuperRecord was born. The original goals for SuperRecord were simple.

  1. Give me the ActiveRecord style finders I crave, optimise them, keep my application level code tidy, but still performant.
  2. Rather than me typing out the same code in each project to handle batch updates on my UITableView and UICollectionView classes, have a special “one size fits all” class that will act as your NSFetchedResultsControllerDelegate, providing “safe” batch updated to your reusable views.
  3. Additionally, I didn’t wanna have to spend too much time creating NSFetchedResultsControllers all the time either, so I added some helpers for this too.
  4. Be written in Swift, keeping the public API’s simple and stable, but changing the implementation as Swift changed and moved with updates.

In late October 2014 whilst still very much a work in progress, I released the first public version and it was featured in the great iOS Dev Weekly newsletter. I decided to release it early as I saw a lot of discussion around CoreData and Swift and thought there’d be a lot of people interested in this OSS effort, so we could build up a good toolset as a community. I’m still the only maintainer… (not by choice) but its early days :).

Below is some extract from the README.md but I suggest you head over to the project on github for more information and feel free to checkout the demo project also on github which shows how to use the safe batched updates along with some other common tasks.

 

Core Files

  • NSManagedObjectExtension.swift This extension is responsible for most of the “finder” functionality and has operations such as deleteAll()findOrCreateWithAttribute()createEntity() and allows you to specify your own NSManagedObjectContext or use the default one (running on the main thread).
  • NSFetchedResultsControllerExtension.swift In constant development, this Extension allows the easy creation of FetchedResultsControllers for use with UICollectionView and UITableView that utilise the SuperFetchedResultsControllerDelegate for safe batch updates.
  • SuperFetchedResultsControllerDelegate.swift heavily inspired by past-projects i’ve worked on along with other popular open source projects. This handles safe batch updatesto UICollectionView and UITableView across iOS 7 and iOS 8. It can be used on its own with your NSFetchedResultsController or alternatively, its automatically used by the NSFetchedResultsControllerExtension methods included in SuperRecord.
  • SuperCoreDataStack.swift a boilerplate experimental main thread CoreData stack. Can be used either as a sqlite store or in memory store. Simply by calling SuperCoreDataStack.defaultStack() for SQLite or SuperCoreDataStack.inMemoryStack() for an in memory store. Of course you have access to your context .context / .saveContext()

Usage

Create a new Entity

Assuming you have an NSManagedObject of type “Pokemon” you could do the following

let pokemon = Pokemon.createNewEntity() as Pokemon

Please add @objc(className) above the class name of all your NSManagedObject subclasses (as shown in the demo project) for now. Better support will be coming in the future.

Creating an NSFetchedResultsController

This feature is currently in progress with basic support so far, in future versions, sorting and sectionNameKeyPath’s will be supported. Until then you can create your own NSFetchedResultsController, however, if you have no need for the above missing functionality then simply use

lazy var fetchedResultsController: NSFetchedResultsController = self.superFetchedResultsController()

func superFetchedResultsController() -> NSFetchedResultsController {
return NSFetchedResultsController.superFetchedResultsController("Pokemon", tableView: tableView)
}

With Pokemon being the entity name of your NSManagedObject.

Delete Entities

I’m planning on adding much more powerful functionality around Delete soon, such as deleteAllWithPredicate() or deleteEntity(), right now all that is available is

Pokemon.deleteAll()

Method Listing

This isn’t an exhaustive list of all methods and classes, however it includes some of the most useful ones.

  • NSManagedObjectExtension
  • findAllWithPredicate(predicate: NSPredicate!, context: NSManagedObjectContext) -> NSArray
  • findAllWithPredicate(predicate: NSPredicate!) -> NSArray
  • deleteAll(context: NSManagedObjectContext) -> Void
  • deleteAll() -> Void
  • findAll(context: NSManagedObjectContext) -> NSArray
  • findAll() -> NSArray
  • findFirstOrCreateWithPredicate(predicate: NSPredicate!) -> NSManagedObject
  • findFirstOrCreateWithPredicate(predicate: NSPredicate!, context: NSManagedObjectContext) -> NSManagedObject
  • createNewEntity() -> NSManagedObject
  • findFirstOrCreateWithAttribute(attribute: NSString!, value: NSString!, context: NSManagedObjectContext) -> NSManagedObject
  • findFirstOrCreateWithAttribute(attribute: NSString!, value: NSString!) -> NSManagedObject
  • NSFetchedResultsControllerExtension
  • superFetchedResultsController(entityName: NSString!, collectionView: UICollectionView) -> NSFetchedResultsController
  • superFetchedResultsController(entityName: NSString!, tableView: UITableView) -> NSFetchedResultsController

NSFetchedResultsControllers created using this method will automatically handle safe batch updates.

Developer Notes

This whole project is a work in progress, a learning exercise and has been released “early” so that it can be built and collaborated on with feedback from the community. I’m using it in a project I work on everyday, so hopefully it’ll improve and gain more functionality, thread-safety and error handling over time.

The next key things to be worked on are Optionality (as this has changed in every Swift BETA), the CoreDataStack, adding more finders with more functionality and improving the NSFetchedResultsControllerExtension.

 

 

iPhone 6 and 6 Plus side by side Paper Comparison

So on September 9th (as of time of writing thats last night) Apple announced (among other things) the new iPhone 6 and iPhone 6 Plus… Both are which are larger than the any predecessor. I won’t go into details of what each phone does / has… as i’m sure you can find that information anywhere on the Internet :). The biggest question on everyones minds is….

Which should I buy?

So, I was curious about the sizing of the new devices, therefor I made a really quick and dirty paper prototype with the precise dimensions. What it shows… the 6 Plus is a beast, larger, but somewhat smaller than a Samsung Galaxy Note II, but probably a commuters powerhouse, a halfway house between the traditional sized iPhone and iPad. Whereas the iPhone 6 is a welcomed and comfortable size increase on the iPhone 5/5S/5C generation.

Samsung devices in the Apple Spaces

Now next to the original devices

IMG_1330 iPhone sizing

 

Despite the iPhone 6 Plus being ginormous… I think thats the one i’ll be getting… Having to commute 1 hour a day on a train and being an overall geek… it suits me well 🙂

For more info on the specs and sizing of the new iPhones I suggest visiting the apple specs webpage.

 

mai (Reuters) Kinder Morgan Inc Trans Mountain pipeline

Kinder Morgan Canada sier rørledning mot hindring har ‘møtt hver test’

CALGARY, Alberta, 31. mai (Reuters) Kinder Morgan Inc Trans Mountain pipeline https://www.canada-goose-jakker.com ekspansjon har hver test i canada goose jakker dame sitt bud for å oppnå godkjenning, sa selskapet onsdag, og reagerte på et løfte av British Columbia-provinsen, de canada goose victoria parka facto canada goose innkommende regjering for å blokkere prosjektet.

Utvidelsen canada goose norge av rørledningen som går gjennom British Columbia har oppnådd både føderal og regulatorisk godkjenning, canada goose jakke herre og har bestått en miljøvurdering under provinsens etablerte liberaler.

Mountain har fulgt canada goose trillium hver prosess og møtte hver test satt foran oss, sa canada goose jakke Kinder Morgan Canada Ltd, president Ian Anderson, i sin første offentlige kommentar etter at canada goose outlet British Columbia Green og New Democratic parties på tirsdag ville bruke canada goose victoria verktøy mot prosjektet.

I mange år har prosjektet blitt gjennomgått, analysert, canada goose jakke dame diskutert og vurdert grundig, sa Anderson i en uttalelse.

Selskapet canada goose herre begynner å tildele kontrakter canada goose outlet og går videre med fordelingsavtaler, sa canada goose salg han.

Trans Mountain-ekspansjonen tredobles nesten kapasiteten til den eksisterende rørledningen, som er konstruert for å transportere råolje fra Canadas oljesand til vestkysten.

Canada oljeprodusenter, som mangler eksportruter, sier det hjelper dem med å oppnå bedre priser.

Utvidelsen har støtte fra British Columbia Liberal Party, som mistet sin lovgivende flertall i en 9. mai valg.

Opposisjonen Greens og New Democrats har forseglet en avtale for å canada goose jakker herre unseat Liberals og sa tirsdag at de canada goose dame ville konsultere provinsbyråkratene om å tillate for utvidelsen.

Mens det er noen tvil om British Columbia har en formell rett til et vetorat, kan provinsen øke forhindringer som effektivt kan gjøre rørledningen umulig å bygge.

Langvarige slag over Trans Mountain og andre rå rørledninger har reist spørsmål om levedyktigheten til nye energiprosjekter i British Columbia. (Rapportering av Ethan Lou, redigering av G Crosse).

 

Truly, they have a higher level of trust than most of us

BMW 430i delivers sunshine and good times

Canada Goose Parka Disillusion is canada goose outlet winnipeg a constant Canada Goose Outlet in life, like an ever present pigeon waiting for you https://www.canadagoosejacketsaleca.com to drive out of canada goose outlet montreal the car wash. Canada Goose Parka

canada goose factory sale Trust, it seems, is hard to come by. That why you don leave your car door unlocked. If we truly trusted each other, cars wouldn have locks. Of course, such things don bother convertible owners; all you need to break into their cars is a pocketknife. Truly, they have a higher level of trust than most of us. canada goose factory sale

canada goose uk shop True, even retractable hardtops canada goose coats uk come with issues. They bulky, meaning it takes a lot of space to stow them, markedly reducing trunk space. They add a serious amount of weight, an anathema to driving enthusiasts. canada goose uk shop

canada goose coats on sale And there seems to be a limit to how these roofs sheet metal can be shaped while also being retractable, meaning that most retractable hardtops lack the sporting canada goose outlet michigan grace possessed by their soft top brethren. canada goose coats on sale

canada goose black canada goose parka outlet friday sale Today subject, the BMW 430i Convertible, looks ungainly compared to its coupe sibling, but fresh air access comes with compromises. canada canada goose outlet authentic goose black friday sale

canada goose clearance With classically conventional styling in the best BMW tradition, the 430i appears to be more the quiet conservative than loudmouth radical. Nevertheless, the 430i gets much better looking once the lid is lowered. canada goose clearance

Canada Goose online Stowing the 430i roof doesn take long, although it seems to take longer than you like, as if the mechanisms have arthritis. However, it an ingenious solution in a world where strangers can seem to canada goose outlet new york be trusted. Canada Goose online

canada goose uk black friday But with the top down, a modest trunk turns meager. So if you traveling, or heading to Costco, pack light. Or lower the rear seatback, which transforms the legroom deprived rear seat into a more appropriate storage hold. canada canada goose outlet 2015 goose uk black friday

uk canada goose Once underway, you find wind management to be excellent, meaning that you can hold a conversation without screaming to be heard by your fellow passengers. uk canada goose

canada goose clearance sale For BMW enthusiasts, performance matters more than trunk space, so let look canada goose factory outlet at the numbers. canada goose clearance sale

canadian goose jacket The BMW 4 Series comes as the turbocharged four cylinder powered 430i or six cylinder powered 440i, with rear wheel or all wheel drive. The 430i is rated at 248 horsepower, while the 440i comes canada goose outlet toronto with 320 horsepower. Both engines mate to an eight speed automatic transmission. (Base prices: $51,650 $60,700.) canadian goose canada goose outlet store toronto jacket

canada goose Opting for the former engine propels the car to 60 mph in 6 seconds; opting for the later reduces that to 5.1 seconds. (There also a high performance M4 Convertible, with a variety of performance enhancements, but that a different review.) canada goose

Canada Goose Coats On Sale Certainly, the 430i that I tested never felt underpowered, with minimal turbo lag and lots of power for passing at speed. An added benefit is its fuel economy, which measured a respectable 27 mpg. That very good given the amount of time spent with the roof down, which hurts aerodynamics, and thus fuel economy. Canada Goose Coats On Sale

cheap Canada Goose For the record, the EPA rates the 430i at 24 mpg city, 34 mpg highway with rear wheel drive. Adding all wheel drive reduces canada goose outlet toronto factory that to 22/32 mpg respectively. BMW canada goose outlet uk recommends using premium unleaded canada goose outlet vancouver fuel. cheap Canada Goose

buy canada goose jacket As with any BMW, you find this canada goose outlet black friday to be a lively dancing partner, ready for commuting or navigating pokey parkways. The steering canada goose outlet washington dc is quick and nicely weighted, and the brakes ensure you don inadvertently re sculpt the 430i sheet metal. The car feels athletic enough to enjoy on your favorite back road or for the cut and thrust of daily driving. buy canada goose jacket

canada goose store Engineers fine tuned the suspension and steering to enhance straight line stability for 2018, although only diehards will notice the difference. canada goose store

buy canada goose jacket cheap The interior is straight from the 3 Series, with which it shares canada goose outlet in usa DNA, canada goose jacket outlet uk so expect a premium but not lavish interior. Material quality is pleasing yet restrained in the finest European tradition. canada goose outlet england buy canada goose jacket cheap

Canada Goose Outlet A large flatscreen anchors the center of the instrument canada goose outlet eu panel and features the latest iteration of BMW infotainment system, which proves far easier to use than previous iterations no doubt helped by the larger screen. A large wheel controls it, and is surrounded by shortcut buttons that prove easy canada goose outlet hong kong to identify by touch. Canada Goose Outlet

cheap canada goose uk Better yet, this BMW supports your e life by supplying two USB ports, a Wi Fi hotspot that supports up to 10 mobile devices, and an inductive charging tray for wireless charging. Stingily, canada goose outlet in uk BMW makes Apple CarPlay optional, not standard. cheap canada goose uk

canada goose coats The front seats canada goose outlet in chicago proved firm yet comfortable for long stints in the saddle. Legroom is generous in front; rear seat accommodations are best left to parcels and purses. The cabin is satisfyingly quiet with the roof up. With the roof down, wind management canada goose outlet orlando was excellent, allowing for conversations at civilized levels. canada goose coats

uk canada goose outlet Is it any wonder that the 2018 BMW 430i Convertible ably plays the part of a grand tourer? Its sublime blend of ride comfort and sporting performance keeps everyone happy, while its intimate cabin feels like a special treat. uk canada goose outlet

Canada Goose sale Besides, any vehicle that provides a fun driving experience, remarkable handling and a dollop of canada goose outlet seattle style with effortless access to sunshine which is in short supply this time of year is more than welcome Canada Goose sale.

 

Mockacino a lightweight ruby/sinatra API Mocking script

Hi Guys, so i’ve been working on a new app recently for a client of mine, currently there is no API… so in the meantime I decided to knock up a quick few lines of ruby to get a mocking api up and running… to explain this better, I need not do more than paste my README.md here.. Enjoy 🙂

Mockacino

A very simple and easy to use MOCK API server that serves static JSON written in ruby/sinatra.


NOTE: This is a super simple, super fragile MOCKING SERVER Intended so you can test routes and mock an API with static jso whilst you’re still building the real production API. DO NOT EVER use this in production… Seriously. It breaks a lot and will if you try… DONT. Absolutely 0 effort went into it, therefor 0 Warranty. Use if you dare.

DOCS:

Folder structure defines API calls…. return.json is what gets served.

site_root ->;
    [ http method ] ->; [ api call route ] ->; [ json response contents of call return.json ] 

e.g.

site_root ->;
    GET ->; users ->; return.json
    POST ->; users ->; create ->; return.json

If you have static assets you wanna reference in the json, plonk them in the ASSETS folder

e.g.

site_root ->; file.jpg

You can call http://yourhost:port/ASSETS/file.jpg

Here’s the directory structure of the sample project included here

mockacino.rb  
./site_root/ASSETS
./site_root/GET
./site_root/POST
./site_root/GET/sheep
./site_root/GET/sheep/create
./site_root/GET/sheep/return.json
./site_root/GET/sheep/create/return.json

Which supports calls like…

http://localhost:4567/sheep
http://localhost:4567/sheep/create

And gives responses from the static result.json file like…

{
    "sheep": [
        {
            "id": "1234",
            "name": "Dolly Two",
            "url": "http://mike.kz/sheep1234",
            "assets": {
                "small_image": "http://cloned.sheep.com/ASSETS/small.jpg",
                "large_image": "http://cloned.sheep.com/ASSETS/large.jpg"
            }
        }
    ]
}

Usage:

gem install sinatra
ruby mockacino.rb
 

Installing Debian or Ubuntu on a Cubox i4-Pro

IMG_0434In March I got my hands on a new Cubox i4-Pro, for those who don’t know what it is… its basically an armv7l based “raspberry-pi style” 2″ cube on crack! It packs a Quad Core 2GHz armv7l i.MX6  variant architecture with 2GB of memory, on board bluetooth,wifi,esata,usb and more. Its pretty damn cool… Until recently I didn’t really have time to get it all up and running, but after unboxing it last week, I realised… damn this thing is tiny and must pack a punch… So I get it out the box and I wonder… so…. erm…. how do I get something running on this thing. After a quick lazy trawl of Google I noticed there isn’t a lot of info compared to other dev-boards and systems and a lot of info seems out of date. So here is my attempt to making a first post of a few, this one aimed at getting you up and running immediately on a CuBox i4-Pro with a “no-frills” approach… Next in line, i’ll maybe do some posts on how to build your own image, kernel and more. These instructions are for Linux / Mac OS X only really. Those using Windows, google is your friend :).

  • Firstly download the latest debian jessi image from solid-run.com. (note: if you browse around there you’ll find both an ubuntu and geexbox image also).
IMG_0435 IMG_0436

Now you’ve got all that downloaded. The next step is to extract it using the ‘xz’ utility. Much like any other compression utility, this one is a little different as it uses lzma but supports the usual commands.

xz --decompress debian-jessi-4-july-2014.img.xz

You should now be left with a .img file thats ready to copy over to your Micro SD card 🙂 To do this we’ll be using the ‘dd’ utility that ships with most variants of Linux and Mac OS X. Windows users can find `windd` via the google link above 🙂

But before hand… you’ll need to find out which device on your system is your Micro SD card and make sure NOT mounted!

Mac OS X :

~# diskutil list
/dev/disk0
#: ......
/dev/disk1
#: ......
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FAT *31.97GB disk2

~# diskutil unmountDisk disk2

Linux :

sudo fdisk -l
sudo umount /dev/somedevice

Now you know which device you want… its time to copy over that .img! For this we’ll be using ‘dd’. Depending on which version of ‘dd’ you’ve got on Mac OS X or Linux, the command will vary very slightly, but remain very similar.

Mac OS X:
sudo dd if=/path/to/debian-jessi-4-july-2014.img of=/dev/disk2 bs=16384

Linux:
sudo dd if=/path/to/debian-jessi-4-july-2014.img of=/dev/sdb bs=16M

On Linux you’re likely to see progress, but on Mac OS X, nothing will “appear” to happen and the command prompt will hang, but trust me… thats a good thing, its copying… Once done. Your prompt will return to normal and after a few seconds, you can safely pull the Micro SD out of your machine.

Now place that Micro SD into your Cubox i4-Pro upside down. Plug in some power and Ethernet… and boot! 🙂