A little bit o' Erlang - Although it's not the subject of this article I've been fooling around with CouchDB a bit lately. CouchDB is perhaps most well known for being written in Erlang, a functional language developed by Ericsson. All of the fiddling around really got me interested in actually hacking out some Erlang to evaluate any practical purpose it may have to me. I've messed around with functional languages in the past, namely F#, Caml and quite a bit of Lisp, but this was all in my spare time with no real goal in mind. In short, I am not an experienced functional programmer. I am familiar enough that if I bend my brain I can more or less get into the functional mindset although it certainly doesn't feel natural to me. Due to this...
C from erlang via linked-in driver - Erlang truly is a useful language. It's fast, full-featured and elegant. Like all high-level languages, however, you sometimes need to access legacy or system code written in another language like, you guessed it, C. I came accross this situation recently when porting my webcrawler to erlang. Under pressure http:request proved to be unreliable when used in a multi-threaded scenario. The solution I chose was to bridge erlang with libcurl by way of an erlang "linked-in driver". While I only used it for retrieving web page content into memory I figure I'll be able to wrap all of libcurl in the future. C I'll start out with some C code that will function as the bridge between erlang and libcurl. This is the code that qualifies as a "linked-in" driver. Like all...
Clojure, A Lisp for the JVM and CLR - I've been becoming increasingly interested in functional languages in the last few years and I'm apparently not the only one. It's pretty hard to listen to any general purpose software development podcast without hearing about Erlang, Haskell or F#. Another one came up recently that I just had to play with. It's a Lisp variant named Clojure. The reason I find Clojure particularly interesting is that it's designed to be hosted in the Java Virtual Machine and the .Net Common Language Runtime (via the DLR). From a practical perspective that's wonderful considering integration with other commonly used libraries in the business world is a snap. I'm sure it annoys Lisp purists, but it makes Clojure much more adoptable between 9 and 5. As is frequently the case this is not something...
Notes on Cloure XML Parsing - I figured I'd share some quick notes I had on a simple task that's not exactly strait forward in Clojure to the Lisp neophyte, like myself: XML Parsing. Clojure goes a long way to making it easy with clojure.xml.parse/xml-seq but complete/concise examples can be difficult to come by. XML All of the examples I'll outline below will depend on the following xml living in a file named "settings.xml" in the current working directory. <settings> <timeout>5000</timeout> <email>example@mail.com</email> <hosts> <host url="http://computer1.domain.com">COMPUTER1</host> <host url="http://computer2.domain.com">COMPUTER2</host> <host url="http://computer3.domain.com">COMPUTER3</host> </hosts> </settings> Basic Requirements In order to prepare clojure for the task at hand we'll need to make use of java.io.File and clojure.xml. (import '(java.io File)) (use 'clojure.xml) Examples Just to get warmed up, consider the following. All this does is load the contents of "settings.xml" into a...
Tags:
.Net .net framework 4.0 ADO.NET Android AppleScript Astoria BI BeOS C C++ Data Services EF GNOME GObject Groovy HTML Haiku JVM Java Mac MongoDB ORM Objective-C Operating Systems Oracle SSRS Solr VS 2010 Vala Web Services appengine c# clojure cloud clr cocoa touch concurrency couchdb cql curl database django dlr dynamic entity framework erlang exchange server filestream full-text functional go iPhone indexes ironpython ironruby jQuery linq lisp lucene mongodb monitoring natural language object oriented parallel performance podcasts powershell python rails refactoring remoting reporting services rs ruby scripting security setpolicies simpledb sql 2008 sql server systems programming testing tools vb virtualization wave webdav windows xml