I’ve designed a t-shirt. In the front it says “Mi parolas Esperanton”.

In the back it says:
I speak Esperanto
Yo hablo Esperanto
Ich spreche Esperanto
Je parle espéranto
我说世界语
Я говорю на эсперанто
Io parlo Esperanto

A friend of mine complained that after switching to my new site (from WordPress to Plone 3) my feeds stopped containing the full article and only the body. So this is how I fix it.
Searching for how to fix it on the Internet I’ve found several articles (and I’m adding one more!):
So, my solution is essentially 2 or 4, with the addendum of the description to the content:
content
If you are wondering, “74” is “<” and “76” is “>”.
Let’s compare how we print the class-path in Clojure and how we do it on Java.
In Clojure:
[sourcecode lang=”clojure”]
(println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
[/sourcecode]
In Java:
[sourcecode lang=”clojure”]
import java.net.URL;
import java.net.URLClassLoader;
public class PrintClasspath {
public static void main(String[] args) {
//Get the System Classloader
ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
//Get the URLs
URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();
for(int i=0; i< urls.length; i++)
{
System.out.println(urls[i].getFile());
}
}
}
[/sourcecode]
To be fair, the output is not the same, but the effect is.
This is just one small example of why we need a international common language.
In 1975, the World Health Organization refused:
Meanwhile, it accepted Chinese and Arabic as working languages increasing the expenses in in translations by U$S 5,000,000, every year. (more…)
I decided, some years ago, to start learning Esperanto.
I went to Lernu and spent three days learning. On the third day I’ve decided to open the instant messaging system on that web site to see what was going on. I ended up chatting with someone from Russia, in Esperanto.
We talked about the usual things you talk when you only learned the language for three days. How are you? where are you from? where do you live? do you have brothers or sisters? blah blah. I was amazed I could communicate so soon. Eventually I’ve got tired and I said something like “OK, that was fun, let’s continue in English please.”
– “Mi ne parolas la anglan.” was the reply. “I don’t speak English.”
What about la hispana (Spanish)?
– “Ne”
I was talking with someone with whom I didn’t have any other common language than Esperanto. Three days before that we couldn’t have even say hi to each other.
The first time I heard about Esperanto, I attacked it. Because that was what everybody around me did and I’ve learned from them.
The second time, it annoyed me and I attacked again.
The third time, I was indifferent.
The fourth time, I was curious.
The fifth time, I started to learn it.
That’s why I keep repeating to anybody who’d listen: Esperanto, Esperanto, Esperanto, Esperanto, Esperanto. And I encourage others to do the same.
Being able to write, build and run a Clojure application, like I explained in a previous article, is not enough. You also want to hack on it, to iterative code on it, after all, you are using a Lisp.
What I mean by iterative coding is something not very few know or do, but it’s extremely common in Lisp. You have you REPL running all the time (that is, generally, the interpreter). You load the code into the REPL, run it, modify some part of the code and re-load it. You may not reload the whole file but only a function on it, and you may have background process running on the REPL, like a web server. It is very powerful. (more…)
I always wondered why they didn’t allow an optional closing tag of “</>” that would close the corresponding open tag.
For example:
<p>This is a string with something <b>bold</> in it.</p>
where “</>” is closing the <b> tag. Or:
<blah><bleh><blih><bloh>bluh</></></></>
which is shorter than:
<blah><bleh><blih><bloh>bluh</bloh></blih></bleh></blah>
I fell it is a shortcut like the stand-alone tag <tag/>.
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.