GopherCon 2014!

So lately I haven’t been doing much rails, which has lead to a distinct silence on this site as far as new developments go. The truth is, my career has changed a bit and I find myself more and more in the world of Google’s Go. Golang has treated me well, and I suppose I should get around to posting updates to share some of that excitement here. Until then though, a little announcement.

Along with the release of Go 1.1 an official announcement went out today from the organizers of the first-ever GopherCon, a convention in Denver Colorado for those who work with, play with, and love Go. I know I’ll be there and I look forward to seeing a lot of great talks. More information can be found at GopherCon or by following @GopherCon on Twitter!

Writing views in Noir with Clojure

I’ve been busily looking at the options, getting a feel for templating languages, scrapers and all around view generation in Noir. There are a lot of options out there, including everything Java ever did along with a series of clojure specific plugins and concepts.

So the conclusion?

Slim for Clojure wins out for me by a wide margin. Slim is similar to Haml in its syntax, white space sensitive and generally easy to read, while adding a few nice features and eliminating a few more characters from your HTML generation.

What does it look like? A little like this:

      p Hello World

The Clojure implementation of Slim is developed by Chas Lemley, a Ruby software developer in the Atlanta area.

*Disclaimer: I have worked with both Andy Stone, the creator of Slim and Chas Lemley. Some bias may apply.

All is quiet on the western front

Missed a few updates, well, maybe more than just a few. I have a few projects in the work, and, much to my excitement, a podcast in the works with another very talented software engineer. We’ll start recording this weekend and see how it goes, I’ll update as news unfolds.

Getting the unmodified post body with Noir

Just a quick little post today about something that was more frustrating than you’d expect to google. Basically all I wanted was to get the entire post body without any modifications to it in any way, shape or form by any form of middle ware.

Sounds simple, and really it was very simple, once I found a random Google Groups post talking about it.

First thing is first, add this line to your view

(:require [noir.request :as request])

Then access the body within your defpage with the following code:

(let [request (request/ring-request)
body (slurp(:body request))]
(println body)

And there you go. The quick, easy, no noise to fight through explanation of how to get the entire post body in WebNoir.

Considering major projects

I’ve got a couple of big projects on my mind right now, and I’m curious about what the general feel is out there about some of the open source options I’m considering, so I thought I’d rattle them off and see if anyone had any thoughts.

#1 WordPress-like Clojure CMS

This project would be massive and I’d need to build up a strong community around it, but the idea is to take clj-blog and integrate it with more of a full-purpose-cms. This project would probably be based in Noir, use Korma and generally stick to the things I’ve already decided I’m comfortable with.

#2 Clojure migrations

This one should be pretty obvious to anyone used to the ActiveRecord style migrations. There is something to say about having all of that in a runnable little script.

#3 A generator library for Noir

Noir adopts a sinatra-style “Do what you feel like doing” attitude for the structure. I’ve been thinking about rolling up a lein plugin that would generate more opinionated Noir projects (probably including Korma by default, setting up an MVC style structure and integrating the Clojure Migrations project mentioned above). This is another big project, and one that would really use Noir as a base for a much more complex framework. I’m torn on this because while it IS nice to have everything in one place, rails has been getting far too opinionated lately.

#4 An implementation of Slim and/or Haml 

The Haml implemntations are hopelessly out dated (many not seeing updates over the last two or three years) and as far as I know no port of Slim has been done. This might be a cool project to improve an otherwise painful templating situation in Clojure.

And that’s all she wrote:

Let me know if anything there seems stupid, useful or otherwise worth commenting on. More importantly let me know if any of that exists and I just failed at researching it!

Clojure and QT for desktop applications

Up until now I have exclusively talked about web applications, and to a degree that stems from my mindset that the future of applications is the web. I stand by that…with caveats.

I’m embarking on a new personal project which requires a pure offline environment, something I haven’t done in any form in years and realistically have never done. Even in my past working with C# applications they always connected to remote databases maintained on networks and relied heavily on server storage. So for me, this will be my first time working on a stand alone desktop application.

Of course the Clojure comes in because I want to build something cross platform, targeting Mac OSx and Windows XP – 8…okay maybe not 8. I’m not sure yet.

At any rate if you’re not familiar with QT you should be. It’s a cross-platform UI framework maintained/developed by Nokia available through an LGPL license, making it a legitimate choice for commercial and open source uses. Read more

Not quite what I was hoping for

I’ve run into a few problems with Refinery on my production server, namely some weird caching that is causing me to hold off on deployment.

I’m honestly starting to wonder if I shouldn’t take the time to learn WordPress theming.

Oh well, back to work!

Simple form submission with Noir

One of the most basic things we do with interactive websites is submit data via the form tag. This method of input is so familiar to end users and programmers that we hardly think about it anymore. Naturally, one of the first questions I had as I started using Noir for web development was “How do I get data back from the user?”

For the most part it’s a very simple task thanks to form helpers in Hiccup (the HTML rendered that Noir houses underneath) that allow us to build what we need in much the same way we would with Ruby. Read more

Reading excel documents in Clojure

Let me take a minute to introduce you to a library called Incanter. Incanter is a wonderful little R-style statistical computing library written in Clojure. It is also the easiest way to read in data sets from Microsoft Excel documents in Clojure.

To use Incanter just include it in your project.clj (you are using lein, right) using:

[incanter "1.3.0"]

Then run lein deps in your console to install the dependency.

After that all you need to do to retrieve an excel file is use the following code.

(use ‘(incanter core io excel))

(defn get_excel (read-xls “/My/File/Location.xlsx”))

There you are. You now have the content of your excel file in a readable, manipulable list that you can use any way you please. This is both an easier and more pleasant experience than what I’ve seen with Excel documents in ruby, especially when you need to open both xls and xlsx documents.

Building libraries for public consumption

AKA: A temporary distraction from my time with Clojure.

This distraction is almost entirely based on my recent experience with Korma, the SQL DSL-of-choice for Clojure.

Korma itself is a great library, and I’m a huge fan. It’s solid dependable and well thought out, well, mostly. And there’s where my problem occurred.

My days are spent working with Oracle and SqlServer. Two technologies that are, by most measures, just unpleasant. They’re good at what they do and where they do it, but the level of standards compliance they support is about nil. So while working with Clojure and Korma I tried to do a limit on a query. You know the old “Select * from my_table LIMIT 20″. Read more

Return top


That is not dead which can eternal lie. And with strange aeons even death may die.
- H.P. Lovecraft

Social Widgets powered by