Reading Java properties file in Clojure
A simple and effective way to read properties files in Clojure, since they transform into Clojure maps! Next, to actually read this in, using atoms to swap the values like this seems to work, -- If you have any questions or thoughts, don't hesitate…
Decoding the US Military's Cyber Command Logo code
From this Wired article (http://www.fastsum.com/support/md5-checksum-utility-faq/md5-hash.php), it looks like there’s a number that is part of the cyber command’s logo – 9ec4c12949a4f31474f299058ce2b22a. Well, its 32 characters long, and looks like a…
Mutable vs Immutable datastructures - Serialization vs Performance
In my last post, I was playing around with methods to serialize Clojure data structures, especially a complex record that contains a number of other records and refs. Chas Emerick and others mentioned in the comments there, that putting a ref inside…
Serializing Clojure Datastructures
I’ve been trying to figure out how best to serialize data structures in Clojure, and discovered a couple of methods to do so. (Main reference thanks to a thread on the Clojure Google Group (http://groups.google.com/group/clojure/browse_thread/thread…
Ode to an Orange
A whiff of citrus – vibrant, shiny, dimpled and thick, your fingers move, probing textural ecstacy, as your tastes await the sweet tartness within. Peel away the layers softly, envelop a piece, let your tongue steep in a myriad of flavors, with the…
Stack implementation in Clojure II - A functional approach
My last post on the topic was creating a stack implementation using Clojure protocols and records – except, it used atoms internally and wasn’t inherently “functional”. Here’s my take on a new implementation that builds on the existing protocol and…
Resolving Chrome's SSL Error
I recently started getting a number of SSL related errors on accessing https links with Google Chrome on Ubuntu. One looks like, 107 (net::ERR_SSL_PROTOCOL_ERROR) The top link on Google’s search results is pretty fuzzy, so here’s the solution that…
Stack implementation in Clojure using Protocols and Records
I was trying to experiment with Clojure Protocols and Records recently, and came up with a toy example to clarify my understanding of their usage in the context of developing a simple Stack Abstract Data Type. For an excellent tutorial on utilizing…
PyCassa vs Lazyboy (updated)
Update As Hans points out in the comment below, it appears pycassa natively supports authentication with org.apache.cassandra.auth.SimpleAuthenticator. Lazyboy on the other hand doesn’t by default. It’s not too hard to do it though. Intuitively, we…
Thrush Operators in Clojure (->, ->>)
I was experimenting with some sequences today, and ran into a stumbling block: Using immutable data structures, how do you execute multiple transformations in series on an object, and return the final value? For instance, consider a sequence of…
Stock Crash
From the (http://www.reuters.com/article/idUSTRE6341EA20100506), The Dow suffered its biggest ever intraday point drop, which may have been caused by an erroneous trade entered by a person at a big Wall Street bank, multiple market sources said. and…
C++ Modulus Operator weirdness
Its surprising that the modulus (%) operator in C++ works upwards, but not downwards. When working on some code, I expected, -1 % 3 = 2 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 but ended up with, -1 % 3 = -1 0 % 3 = 0 1 % 3 = 1 2 % 3 = 2 As a result, you’d…
Implementing Binary Search with Clojure
I was trying to implement a simple binary search using a purely functional approach, and after much hacking, googling and wikibooking, came up with this in Clojure. -- If you have any questions or thoughts, don't hesitate to reach out. You can find…
Clojure Application with Command Line Arguments
I was recently looking for a method to create an application with Clojure that would allow specification of command line arguments. I came across an excellent (http://stackoverflow.com/questions/1341154/building-a-clojure-app-with-a-command-line…
20 Days of Clojure
Came across an excellent (http://loufranco.com/blog/files/category-20-days-of-clojure.html) of blog posts by Lou Franco, where he uses the SICP videos as input to learn more about Clojure. His explanation of HashMap implementations in Clojure, using…
Thinking in C++ by Bruce Eckel is an excellent book
I just finished skimming through Bruce Eckel’s Thinking in C++ book – available for free from his website. Volume 1 covers the basics pretty well and I didn’t really do much more than glance at it, but volume 2 is highly recommended for its marvelous…
Programming Clojure with Clojure 1.2.0 snapshot
This post contains a list of changes between Clojure 1.1.0 and 1.2.0 that would affect you if you’re reading Stuart Halloway’s “Programming Clojure”. It looks like you’d have to replace, (use ‘) (filter indexable-word? (re-split #”\W+” “A fine day…
BeautifulSoup on Cojure? Enlive
I was looking for a suitable library for Clojure that would work like Python’s BeautifulSoup or lxml – and found enlive. An excellent tutorial here http://github.com/swannodette/enlive-tutorial. -- If you have any questions or thoughts, don't…
Clojure AOT compilation tutorial
I was trying to figure out how to AOT compile a Clojure program, in order to really see some fast execution times. The simplest way to describe AOT compilation would be how its done in Java, `` javac file.java java file The invocation of the Java…
viksit-code
It’s been a while since I’ve uploaded code back to the community. This page will track my code on the web, as well as contains links to useful snippets of code in various opensource projects that I’ve worked with. Below is the Google code repository…
Moving from MySQL to Cassandra - Pros and Cons
Moving on from the question of which NoSQL database you should choose, after reading these excellent posts from (http://about.digg.com/blog/looking-future-cassandra%0A) and (http://nosql.mypopescu.com/post/407159447/cassandra-twitter-an-interview…
How 'Aardvark was the 6th idea we tried'
Just came across an excellent (http://ventilla.posterous.com/hello-world-2603) by Max Ventilla, the co-founder of Aardvark (a company that Google bought a few weeks ago). His description of how Aardvark was the 6th idea that he and his co-founders…
Misleading Youtube-Visa ad
-- If you have any questions or thoughts, don't hesitate to reach out. You can find me as @viksit on Twitter.
Why I quit Google Buzz
Google Buzz seems to have mashed up a number of positive features from Twitter and Friendfeed into itself, and I quite like the idea – or rather, the vision it is supposed to espouse. Unfortunately, it is at a stage where too much of my private data…