“Could not load file or assembly FSharp.Core, Version=4.0.0.0” In An ASP.NET Application

If you’ve ever tried to use an F# class library from an ASP.NET application, you may find that although things work perfectly when you are running locally, your web app won’t load at all in production.

Could not load file or assembly ‘FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

Fortunately, the fix is easy. All you need to do is add a reference to FSharp.Core to your web project, and set its Copy Local property to True. Not familiar with how to do that? Here’s a quick overview.

First, go to the Solution Explorer and right-click on your web project, or on your web project’s References folder, and select Add Reference…

add-reference

In the Reference Manager window, select Assemblies, and the find the FSharp.Core, version 4.3 reference. Check it, and click OK.

add-fsharp-dot-core-reference

 

Finally, in the Solution Explorer, find the FSharp.Core reference in your project’s References folder. Select it, then open the Properties window (or tab, or pane, depending on how you have Visual Studio configured), and set Copy Local to True.

copy-local

That’s it! Deploy your web app to your server, and the error will be gone.

What do YOU want to see in ios-queryable?

ios-queryable is a library that simplifies writing queries in Core Data. I released it around 9 months ago, and it has become reasonably popular since then, with a hundred-something stars and a few forks on GitHub.

At this point, it’s basically a complete, working, well-tested library, and it does pretty much everything I originally set out to accomplish. However, I don’t want to simply stop working on it; I want it to grow and evolve and become even more powerful. So I’m asking you – the community – for your input. What do you want to see in it? Where do you want to see it go?

Here are some possibilities:

  • Support for blocks (i.e. passing in a block to the where: method)
  • More IEnumerable methods – GroupBy, Join, ToDictionary, Aggregate, etc.
  • Direct Sqlite support (that is, no dependency on Core Data. Sounds like a lot of work…)
  • OS X support (I’ve never done OS X-specific development, so I’m not sure what’s involved here; maybe it already works!)
  • Improved error handling (since, you know, there isn’t really any at the moment…)

Do you have any other ideas, or any thoughts on these ideas? Leave a comment and let me know!

Like Programming? Like Fitness? Why Not Combine Them!

If you’re interested in programming and/or fitness, you should head over to http://fitnessprogrammer.com, where my wife has started her blogging journey.

She’ll be blogging about her experiences with learning to program, starting with Codecademy.com and JavaScript. She’ll also be blogging about fitness and health, and her love for all things Beach Body.

Her goal is to eventually release her own iPhone apps, so head over there now and start reading about her experiences! If you’re interested in learning how to program, it’s your chance to see somebody become a programmer from the ground up.

Don’t forget to leave her a comment – she’ll appreciate it!

 

trakt.tv’s API – The Good And The Bad

My most popular app, Which Episode?, is powered by trakt.tv‘s API. It uses the API to search for shows when you enter a name, and to download show posters.

which-episode

It takes exactly one API call to grab all the info I need. If the user enters in ‘Supernatural’, the app simply makes an HTTP request to http://api.trakt.tv/search/shows.json/[my API key]/supernatural. The resulting JSON includes everything about shows matching the search terms, including URLs for the show’s posters.

This is fantastic, and it’s exactly what I would expect from the API.

Unfortunately, the cracks in trakt’s API begin to show once you start looking at more advanced scenarios.
The app I’m currently working on requires the retrieval of information on recently released movies, or movies that are currently playing in the theater. Figuring out how to retrieve this info from trakt is an exercise in futility.

You could try to retrieve http://trakt.tv/api-docs/movies-trending to get a list of trending movies… but just because a movie is trending doesn’t mean it’s actually new, so you’ll have to filter the results based on whether or not they are actually new. More importantly, just because a movie is new, doesn’t mean it’ll be trending, so you’re not actually going to get all the movies you want to. It’s also a nearly 200K chunk of JSON – not something you want to be grabbing on a regular basis from a mobile device.

You could also try to keep a local copy of all the (recent) movies in the database using the http://trakt.tv/api-docs/movies-updated endpoint. This call gives you the timestamps of when the record for each movie was updated. Using this, along with a boatload of API calls (you’ll need one for each movie), you should be able to keep track of new movies and their release dates.

Both of these methods are, to put it mildly, inadequate. And they reveal the biggest problem with trakt’s API:

It doesn’t support server-side sorting, pagination, or result limiting!

Pagination was requested on trakt’s Google Group a few months ago, but the thread has no responses. I asked a question about retrieving movies by release date a week ago, and my thread has had no responses.

If I could retrieve the top n movies, sorted by release date, life would be great. It’s not even a breaking change from an API design point of view – all it takes is support for a few extra parameters in the query string. I could envision using it like this:

http://api.trakt.tv/something/somethingelse.json/[my API key]?sort=release_date&count=20

The lack of support for such things is why I’ll be switching away from trakt for my upcoming app. It’s too bad, because aside from these limitations, trakt has been fantastic.

One of the alternatives I’m investigating is the Rotten Tomatoes API. I haven’t dug too deeply, but it appears that it has far more functionality than trakt – for example, individual endpoints for Box Office Movies, Upcoming Movies, In Theater Movies, and Opening Movies. Pretty slick!

Here’s hoping the rest of it works as well as trakt does.

A Quick Look At AppCode 2.0

JetBrains recently released version 2.0 of their fantastic Objective-C IDE, AppCode. If you aren’t using it, you should go grab a copy – you won’t regret it. Let’s have a quick look at some of the cool new stuff, and how it compares to AppCode 1.x as well as Xcode.

First Launch

Let’s get to know AppCode! It’s a little bit slow to launch, but Xcode itself is no speed demon here, so it’s hard to fault AppCode too much.

AppCode

Unfortunately, opening a project for the first time still takes a while, thanks to the index building process.

Loading Project

Fortunately, the index building process only seems to happen once per project. Subsequent opens only take a few seconds of ‘Reading Index’. Additionally, there’s no longer a long delay when switching between configurations (iPhone simulator to iOS Device, for example). Thanks, JetBrains! That was a pretty big annoyance.

Look And Feel

AppCode looks a bit different than your typical Mac app. This is understandable, as it’s built on JetBrains’ cross-platform IDE framework – the same Java-based framework that powers products like IntelliJ IDEA and RubyMine.

AppCode

Version 2.0 adds an attractive new dark theme. It’s easy on the eyes, but it’s even more of a contrast from the rest of your system.

AppCode Dark

Keyboard Shortcuts

One of the best things about AppCode is it’s keyboard shortcut support. It includes a built-in Visual Studio keybinding scheme. If you are a developer coming from the Windows world, a nearly-complete set of Visual Studio keybindings is almost worth the price of admission by itself.

AppCode Keybindings

In addition, AppCode supports chorded hotkeys – hotkeys with multiple steps. Instead of having to use hand-contorting shortcuts like Cmd-Shift-Option-Space-R-7, you can use much nicer multi-step hotkeys like Ctrl-R, Ctrl-V to launch the Extract Variable refactoring.

You also get a few other niceties like proper (from a Visual Studio perspective) Ctrl-Tab document switching.

Unit Testing

When you run unit tests in Xcode (and by run unit tests, I mean run all the unit tests in your project, because that’s about all Xcode lets you do by default), an instance of the iOS Simulator gets launched, and your tests are run inside of it. Want to run something other than all the tests in your project? You can either create separate targets for each set of tests you want to run, or find a third party test runner.

When you run unit tests (or a single test, or a file’s worth of tests – it’s nice to have options!) in AppCode, the simulator isn’t used at all. Whatever AppCode is doing, it’s doing it a whole lot more efficiently than Xcode.

Refactoring

Here’s a quick look at some of the refactorings offered by Xcode.

Xcode Refactorings

… and here’s what AppCode has to offer. Quite a difference. I won’t go into the details of all the different refactorings here, but suffice it to say, if you want to do any serious refactoring you should be using AppCode.

AppCode Refactorings

What’s Missing?

In general, AppCode 2.0 is a fantastic IDE. However, there are a couple of important functionality gaps to be aware of.

AppCode does not include a UI designer or storyboard editor. If you try to open up a storyboard in AppCode, it will be launched in Xcode instead. Likewise, AppCode does not include a Core Data model editor, and opening an xcdatamodel will also launch it in Xcode.

AppCode also doesn’t have the ability to submit apps to the App Store. Given the secure, proprietary nature of the App Store submission process, I’m not holding my breath for this feature to appear anytime soon.

On the bright side, the integration between the two IDEs is fairly seamless, and changes made in Xcode are picked up right away in AppCode. I look forward to the day that I no longer have to launch Xcode at all (aside from app submission), but until then, the AppCode/Xcode combo works pretty well.

In Summary

AppCode 2.0 is a great update to an already great product. If you aren’t already using it, you should definitely give it a shot. The raw editing, navigation, and refactoring capabilities are almost guaranteed to increase your productivity, especially if you aren’t a heavy user of storyboards or Core Data.

I honestly wish I had started using AppCode a long time ago; I would probably have a few more apps in the App Store by now. It’s a particularly fantastic tool for UI-less libraries like ios-queryable.

As you can tell, I’m a huge fan of AppCode. But what do you think? Are you more productive in Xcode?