Quite often Clojure hackers need to interoperate with various Java classes. To do that they have to import those classes into the namespace. It is easy if you know the full name of the class, together with its package, but what if you don't? In that case you have to google where the sought class is located, and then type in the whole path to it.

Java developers who use any decent IDE are not familiar with such problem. They just type in the short name of the class, and the auto-completion offers them the list of all classes short name of which matches what they typed in. But can we have something like that for Clojure? Of course we can!

Read more ->>

Last summer I had to do a fair bit of Clojure compiler hacking. Since the primary objective of a compiler is to produce compiled code (in case of Clojure it is Java bytecode), this process involved reading classfiles every now and then. To make it easier I set up a nice environment using publicly available tools to make reading the bytecode as painless as possible.

Note that despite me using this workflow for Clojure, there is nothing here specific to it, so you can utilize the same setup when working with Java, Scala or any other JVM-compiled language out there.

Read more ->>

Burt Gummer

Emacs is the editor for real folk, and CIDER is one sweet piece of software to program in Clojure, but some would argue that it lacks "big IDE" refactoring tools. This is partly true, but not entirely. Today I gonna show you an easy and cool way to rename all references inside a single function. This can be useful if you want to rename a local variable, or a binding introduced by let.

There are certain tools that allow you to do project-wide replacement too, but they are outside the scope of its post. You should absolutely check @bbatsov's excellent Projectile package for some leads. But let's get back to our original task.

Read more ->>

A few weeks ago Cognitect ran the annual State of Clojure Survey, and presented the results, shortly followed by the analysis. While they did a great job on presenting and analyzing the choice answers, text responses were largely dismissed. Each year text responses contain the most information about which features users lack, or what are their biggest gripes with the language; so to avoid the survey being just another reason to feel good about Clojure, these should be analyzed too. It is easy to overlook a problem people are having if it is stated in stone-cold percentage. The other thing is when you read the sincere words of real people.

I understand that manual digging through 2000 textual responses is a hard and thankless job, but a man's gotta do what a man's gotta do. I've spent the whole day, I've read them all, and boy oh boy do I have some information for you.

NB: I've processed only answers related to Clojure, as I'm not into ClojureScript yet. If you want to do the same for CLJS, be my guest. Especially since CLJS has fewer answers.

NB: Great thanks to Alex Miller and Justin Gehtland for running the survey and providing the results.

Read more ->>

Meet clj-vagrant-new, a Leiningen template that allows you to do this

lein new vagrant myproject +datomic

I struggled for some time to find a Vagrant-powered Clojure+Datomic setup until I stumbled upon this blog post. Even though everything was very nicely explained there, I still had to apply effort to remove overly specific parts, bring configuration files up to date etc. To save the trouble for others I made a template for creating a complete development setup with just one command.

The template uses Vagrant, and Ansible for provisioning. Once vagrant up is done inside the project directory a free version of Datomic (which uses local storage only) will be already set up, as well as the headless nREPL server for your Clojure program. You can now immediately connect to it from CIDER/fireplace.vim/… and start hacking. Some extra information is available at template's Github page.

If you want to move an already existing project to Vagrant it will be easier to just copy the files from clj-vagrant-sample which is a baseline project generated by the template.

Please try it, report issues and enjoy!

EDIT: In the comment section Alex Miller advised against using inline functions for now as they are subject to change in the future version of Clojure.

Clojure's inline functions is one of the rarely discovered features. Unlike any other concept that you can introduce via macros they are important enough to be treated specially by the compiler. But still many Clojure users have never heard about inlines let alone used them.

In this post I investigate what is an inline function, how is it different from macros and when either should be used.

NB: This post is a rewrite of this Gorilla session (you should definitely check Gorilla REPL out, it's awesome).

Read more ->>

ownCloud logo

This post is a follow-up to The Big Migration.

So, with moving many of Google-powered services to my personally hosted ownCloud, I've run into need of providing the necessary infrastructure on the device side. Since I own only Androids it was already easier for me to deal with a single platform, but subtleties, oh subtleties galore. In the post I describe the very ownCloud-compatible Android applications I use up-to-date and am quite happy with.

Read more ->>

For many of us Emacs is more than just a text editor. It is a programming environment, text processor, file manager, image viewer, organizer — you name it. But what's most enthralling about Emacs is the simplicity of ad-hoc repurposing it to the specific task. In this take I describe my recent application of Emacs to conveniently label large amount of images.

Read more ->>

DigitalOcean logo

Although OpenShift is a great service and fit all my needs completely, I decided to move on. There were several reasons for that. First of all, I wanted to have a more independent setup, bringing closer the day when I can run my own server reliably. OS being an IAAS applies certain restrictions on what you can and cannot do. Secondly, I hit the limit of three cartridges provided by free, and while it was just the amount I required, it prohibited me from doing any casual testing and web-doodling from that account. And when the money becomes involved, you apply a more careful judgment to where you wanna be.

So farewell Openshift, greetings DigitalOcean. I picked DO mostly for, I won't conceal it, the price tag. $5 is the exact amount I'm willing to spend on a VPS so far, when there is also an option of not paying at all. And for these $5 DigitalOcean provides a decent single-core VPS with 20GB SSD storage space. This is more than enough for me right now, and DO offers more advanced plans for roughly the same amount of money as other VPS providers do. I opted for an instance in San-Francisco (Amsterdam was unavailable when I was creating an instance), and that gives me around 150 ms latency — which is sufficient for my use-cases.

Read more ->>

Many novice Emacs users often complain about Emacs being slow to start. This makes them use alternative editors like vi or nano for quick edits. Emacs is indeed a slow beast to power up, but the following solution will show you that it's not much of an issue even if you want to make some quick changes in a single file.

Read more ->>

For more posts see the Archives page.