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

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

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