Friday, October 17, 2014

I updated cookingspace.com

I originally wrote cookingspace.com in Ruby and Rails about 8 years ago, and a few years ago I rewrote it from scratch in Clojure.

This week I made some major improvements. First, I cleaned up some technical debt by rewriting cookingspace.com as a plain Compojure and Hiccup app, removing all reliance on the deprecated Noir library. I also did some major code cleanup.

I also rewrote the code for calculating and displaying the nutritional information for the recipes. The nutritional information used on this site is derived from the USDA Nutrition Database. Nutrition information is shown for each displayed recipe. This includes total percentage of minimum daily requirement and for each nutrient the recipe ingredients supplying most of the nutrient (ingredients providing less than 1% of contribution to daily requirement are not shown). The cookingspace.com system tracks 42 nutrients including most vitamins and minerals important for good health.

I originally wrote cookingspace.com to help me track the amount of vitamin K in my diet. I now have the relative vitamin K levels in common food memorized and it is easy to eat (approximately) the same amount or vitamin K each day. Mission accomplished! I now use cookingspace.com to get a better understanding of which recipe ingredients contribute good and "bad" nutrients.

Sunday, October 12, 2014

Experimenting with Clojure + Ember.js and ClojureScript with Om

For a personal project I want to make a web app with a "rich client" interface. I had originally planned to write this app in Haskell with the Yesod web framework. However, as much as I like Haskell, I do still have occasional time wasting problems with cabal, Yesod, and sometimes with non-pure Haskell code. My gut feeling is that I will get things done faster if I use Clojure.

In the past I have experimented using Clojure and Ember.js but until today I have not spent much time with ClojureScript and Om (I have written web apps using ClojureScript, so the learning curve is trying to use Om).

Getting started with Om is straight forward. I used the chestnut lein plugin to create a new Clojure + ClojureScript + Om project. The chestnut plugin is very nice - it set up a reasonable development environment without having to go through a learning curve. After experimenting with the generated project, I then starting substituting in code from David Nolen's Om tutorial into the skeleton project that the chestnut lein plugin created.

I am not much of a user interface expert, and I am not sure how much time I will devote to learning Om. If I earned my living doing web apps, this learning curve would be very worthwhile. I usually use simple tools to make web apps like: Ruby + Sinatra, sometimes Rails, often Clojure + composure + hiccup.

A few years ago I did experiment with Ember.js and created small projects on my github account to experiment with Ember.js with various backend services. Today I cleaned up my embers-clj sample project. I removed the use of the old noir library and made this a straight-up compojure app. I also changed the JavaScript Ember.js application to remove two deprecation warnings.

I am leaning towards using Ember.js, mostly because I already am familiar with it. I also like the combination of Ember.js with a node.js backend (my started project for Ember.js and node.js is also on github). There are advantages to using JavaScript for both client and server sides but I like Clojure better.

Saturday, October 11, 2014

It is simple to use the IBM Watson AI APIs

If you sign up for a (free for 30 days) account on IBM BlueMix, it is simple to use a pre-canned IBM Watson instance that contains medical information and travel information. Code samples are provided for Java, node.js, and Ruby. I wanted to use Ruby so I used these setup instructions.

IBM BlueMix uses the Cloud Foundry PaaS tools. If you have any experience using Cloud Foundry then setting up a (free for 30 days) BlueMix account, and deploying one of the sample web applications that uses the pre-canned IBM Watson medical and travel instance can be done in about 20 or 30 minutes. This is a worthwhile exercise because once you deploy your sample web app you can experiment with IBM Watson's ability to parse natural language questions and return relevant data. Very nice stuff!

In order to build a custom application using IBM Watson you need to supply training documents and training questions. I am helping a customer do this right now. Currently you need a partnership arrangement with IBM to train your own IBM Watson instance but I believe that the ability for anyone to do this via BlueMix will be available in the near future.