Category: Technical

Posts related to programming or other highly technical stuff that can only be of interest to computer geeks.

  • 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.
    (more…)

  • 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.

  • 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!

  • This is a remake of Installing Rails 2 on Ubuntu but targeting Ruby in general and with some improvements. Essentially the same, actually, but more usable, at least for myself.

    Ubuntu, like many other free operating systems, have a beautiful package management system that will track what depends on what, what is installed, what is not, what is not longer needed, which versions of each. If you tamper with it, you are asking for trouble. If you do a manual upgrade, from sources, eventually a package upgrade will downgrade your version or some other application being incompatible will not work. And once you start throwing files in /usr, you start to ask for trouble. I’ve been using this type of operating systems for years and I’ve learned this by experience.

    (more…)
  • I am trying to decide whether to use Pylons or Django. Both are frameworks for building Python web applications, but with opposing philosophies.

    Django tries to be everything. It comes with its own ORM, its own template engine, its own everything. That gives you a nice developing experience because everything fits together and because very nice applications can be built on top of all those components, like the admin tool, which is amazing. (more…)

  • Programming Languages: Application and Interpretation, the best book I’ve found on creating your own programming language is now available in paperback.

    You can still get a free-of-cost copy of Programming Languages: Application and Interpretation at its original site. Actually, the book is now released under a Creative Common license, thank you Shriram!

    This is, actually, old news. The book has been in paperback for quite a while, but I neglected to publish the post at that time. Today, a chat at the Esperanto meeting about Lulu (and how useful it is for Esperantists, that make books nobody wants to publish) reminded me about the post and I’m now publishing it.

  • If you fancy Zope getting up and running on Ubuntu takes no time. Install in the usual simple and lovely way:

    sudo aptitude install zope3
    

    and you’ll get Zope 3.3.1, and of course, all the dependencies. To create an instance run:

    (more…)

  • Ubuntu, like many other free operating systems, have a beautiful package management system that will track what depends on what, what is installed, what is not, what is not longer needed, which versions of each. If you tamper with it, you are asking for trouble. If you do a manual upgrade, from sources, eventually a package upgrade will downgrade your version or some other application being incompatible will not work. And once you start throwing files in /usr, you start to ask for trouble. I’ve been using this type of operating systems for years and I’ve learned this by experience.

    Nevertheless you, as I, want to try and code with Rails 2, right? Well, this is how I installed it in my Kubuntu box (should work the same for any Ubuntu and Debian derivate as well as others). I’ve decided to install everything on /opt/rails. I like to keep more-or-less self-contained directories in /opt. So I started with:

    (more…)

  • For the purpose of writing this article I’m going to use the following definition of “operating system”. There are other definitions and I’m not claiming this is the right one. An operating system is a unit of software that you can install in a computer and will let you use the computer, thought a set of utilities or program in one way or another. (more…)

  • Squeak is by far the best and most complex Smalltalk implementation out there. It may not play well with other operating systems because it is an operating system by itself. It is also one of the most impressive development environments I ever seen. OK, the most impressive.

    The only thing that bothers me is that Squeak is not really free software (search for Squeak in that page). Fortunately, some people are working on making it proper free software. Hurrah! I hope the succeed soon!