How to create a Clojure application

Update: this is not my preferred way to create a Clojure application and shouldn’t be yours either, check out Leiningen

This is one of those posts that I publish partly for myself. And partly so people can criticize my way, which is also for myself, and only incidentally for others to learn from it.

It seems Maven is popular in the Clojure world. Clojure itself uses it, Webjure uses and its demo application uses it as well, there’s a branch for Compojure that uses too. So after building all those components using Maven I’ve decided to use it myself when building Clojure applications.
Continue reading “How to create a Clojure application”

Advertisements

IBM, I'm getting a Dell

When I was young, the laptops were Toshiba. Toshiba Satellite to be specific. Latter on IBM took that title with its Thinkpad, and the first laptop I bought was a Thinkpad which worked quite good. Very good, it’s been working almost non stop for four yeras already. I upgraded the hard disk and I gave it to my wife. I’ve decided to buy a new one. Continue reading “IBM, I'm getting a Dell”

Printing emails in Django

When developing applications in Django, it may be nice to print emails instead of sending them. If you send them you have to be careful which addresses you use. Just being on the safe side and always using @example.{com,org,net} is not enough, you have to use an address you can actually retrieve emails for. And you have to configure your development environment to actually deliver mails. And then wait for the whole thing in each code-try iteration.

So, basing myself on the testing code, I’ve added this to settings.py and mails are now printed:

if DEBUG:
 from utils import BogusSMTPConnection
 from django.core import mail
 mail.SMTPConnection = BogusSMTPConnection

Of course you’ll also need the BogusSMTPConnection class, I’ve defined it as following:

from textwrap import wrap
class BogusSMTPConnection(object):
  """Instead of sending emails, print them to the console."""

  def __init__(*args, **kwargs):
    print("Initialized bogus SMTP connection")

  def open(self):
    print("Open bogus SMTP connection")

  def close(self):
    print("Close bogus SMTP connection")

  def send_messages(self, messages):
    print("Sending through bogus SMTP connection:")
    for message in messages:
      print("tFrom: %s" % message.from_email)
      print("tTo: %s" % ", ".join(message.to))
      print("tSubject: %s" % message.subject)
      print("t%s" % "nt".join(wrap(message.body)))
      print(messages)
      return len(messages)

And that’s it.

What is a blog?

Going back to Plone, after using WordPress for a long while, and yet again inflicting a painful migration on myself, I ended up asking myself this question: What is a blog? and I’ve found an answer that really surprised me.

I’m a very structured person. Do you remember how everybody had a folder named MP3 back in 1999 or 2000, when MP3  became popular and people started to store music on their computers? Well, I didn’t have such a folder. My folder was called “music”. MP3 was only the format, what I had in that folder was, actually, music. And I even tried and convinced some people about doing the same. Continue reading “What is a blog?”

Who are Conor O'Brien and James McMahon?

Conor O’Brien of the Raglan Clinic and James McMahon of Hassett are the people that own me €1250, the deposit of the apartment I rented for more than a year in 4, Windermere, Gilford Road, Dublin 4, Ireland. That I returned in perfect condition and was accepted as such, more than a month ago.

Now that we got to the point, let me tell you the story. I’ll try not to sidetrack with issues like Conor arriving more than outrageously late when I had to handover the apartment and had very little time (moving to Zürich, where I live now) or that James published the apartment as having dishwasher and cable TV which it didn’t (nor was there hot water as well, or fire alarm, or the two set of keys, etc). Ooops, sidetracked. Or that when I went there with James and my wife to see the apartment, there was a guy taking a shower, in the apartment, that shouted “don’t come” and we had to return the day after. Ooops, sidetracked again. Continue reading “Who are Conor O'Brien and James McMahon?”

Typing Esperanto in Ubuntu (or any other X)

I’ve got tired of not being able to easily type in Esperanto in Linux. There are some articles out there explaining it how and the are always convoluted and I’ve never seen one that gets to the point of typing “ŭ”, the always try very hard to get “ĝ”.

There’s an Esperanto layout in Ubuntu and I suppose other X Window Systems as well, but there are two things I don’t like about it. One is having to find out where the keys are, I could re-label them, but then I would only be able to type in Esperanto (which might be educational but not what I want, at least for now). I also don’t like the fact that it is Qwerty, not Dvorak. And even if it was Dvorak, one should make the statistics about Esperanto to make a proper Esperanto Dvorak-style keyboard. Continue reading “Typing Esperanto in Ubuntu (or any other X)”

The single most important feature of Git

My favorite versioning system was Darcs for a long time, but it didn’t really took off and a new competitor is taking off amazingly fast: Git. I believe the single most important feature of Git is to be able to clone (checkout in Subversion jargon) repositories from other systems, particularly SVN. That means that your favorite project may be using SVN, but you just clone it and work with Git, in a distributed way, and then send back the changes. Or that you can clone the SVN-repo and basically you already migrated. Amazing!