Or maybe there’s a message beyond my understanding skills.
I have just made a new release of Score Reading Trainer, 0.1.4. This release has a very important bug fix, thanks to Julian Kniephoff. The fix allows to use notes below the first line of the staff without getting the extra lines mixed and eventually crashing. It was also upgraded to compile correctly and easily to a current KDE, version 3.
After watching the OpenID community grow for years, I finally joined them. I’ve liked the idea from the first day I’ve read about it; aren’t we all tired, after all, of having to remember hundreds of usernames, passwords (sometimes with conflicting constraints: a password must have numbers, a password can’t have numbers)?
From OpenID’s web site:
OpenID means the elimination of multiple user names and passwords and a smoother, more secure, online experience. For businesses, this means a lower cost of password or account management, the opportunity for easier and higher numbers of new user registrations and the elimination of missed transactions because of user frustration with lost and forgotten passwords. OpenID allows for innovation in the authentication space beyond just using a password to “unlock” your OpenID identity, but the ability to strongly protect your OpenID and have that benefit move with you everywhere you go online.
For me, joining the revolution was very easy. First I open an account on MyOpenID, then I installed the OpenID Delegate WordPress Plugin in my wordpress blog so my OpenID address is, actually, pupeno.com. So even thought I’m using a third party service, if they disappear I just pick another one (or become my own OpenID provider) and go on using the same address, pupeno.com. Isn’t it great? There are many other OpenID providers and many sites already supporting OpenID.
SCons is a program designed to replace make and autotools. SCons being a new tool is built with all the knowledge of what problem really this kind of tool should be solving, while make and autotools were built while discovering the real problem. It is natural to expect SCons to have a better design that covers the big picture. Continue reading “Another simplistic solution, with SCons”
I recently stated what I believe is the biggest problem with Lisp, you can’t make programs with it. In my quest, my first solution is a very simplistic Makefile that does the job using cl-launch, a very interesting program that can turn a Common Lisp program into a Bash script. Other solutions are likely to use cl-launch as well.
So, we’ll play with this little program:
(defun main () (format t "Hello world!~%")) (main)
Very trivial indeed. And to “compile it”, we’d use this trivial Makefile:
%: %.lisp cl-launch --output $@ --file $&< hello-world: hello-world.lisp
All we have to do now is run make:
$ make cl-launch --output hello-world --file hello-world.lisp
And we now have a runable hello-world:
$ ./hello-world Hello world!
It run! it worked! it’s portable! Isn’t it great?
Obviously all the logic is hidden inside cl-launch (thank you Fare Rideau). The problems with this simple solution is that using only make makes programs harder to port and package for different distributions and operating systems. That’s why the autotools where invented. Remember those days when to compile something we had to open a Makefile and set up variables? well, this simplistic solution is going back to those days. We can do better, I hope I can do better.
Now, for the curious, this is how the hello-world script looks like (I’d say its quite remarkable):
#!/bin/sh #| CL-LAUNCH 2.03 CONFIGURATION SOFTWARE_FILE=. SOFTWARE_SYSTEM= SOFTWARE_INIT_FORMS= SYSTEMS_PATHS= INCLUDE_PATH=/usr/share/common-lisp/source/cl-launch LISPS="cmucl sbcl clisp ecl openmcl gclcvs allegro lisp gcl" WRAPPER_CODE= DUMP= RESTART= IMAGE_BASE= IMAGE_DIR= IMAGE= # END OF CL-LAUNCH CONFIGURATION # This file was generated by CL-Launch 2.03 # This file was automatically generated and contains parts of CL-Launch # PROG="" . /usr/share/common-lisp/source/cl-launch/wrapper.sh launch_self "$@" ABORT # |# (load "/usr/share/common-lisp/source/cl-launch/header.lisp" :verbose nil :print nil) ;;;; CL-LAUNCH LISP INITIALIZATION CODE #-cl-launched (cl-launch::run :load :self) ;;;; END OF CL-LAUNCH LISP INITIALIZATION CODE ;;; 65bcc57c2179aad145614ec328ce5ba8 SOFTWARE WRAPPED BY CL-LAUNCH BEGINS HERE: (defun main () (format t "Hello world!~%")) (main)
I’m not really going to talk about the problem with Lisp, but only a problem. And I’m not really going to talk about Lisp, but Common Lisp. So this post should be called “A problem with Common Lisp”, but the current title is more catchy, isn’t it?
You are still with me? nice. Because I believe I have something important to say. A problem with Common Lisp is that you can’t make programs with it. That may have been another nice catchy title: “You can’t make programs with Lisp”. Continue reading “The problem with Lisp”
Common Lisp macros feel like cheating. I’ve reached chapter 9 of Practical Common Lisp, where the goal is to build a unit test framework, and you can see right away how the patterns are easily abstracted out with macros. It’s so easy it feels like cheating.
Getting a text representation of the test code to be able to point what when wrong, to show the piece of code failing, is supposed to be a hard task. Well, it is a hard task, sometimes impossible, in most programming languages. In Common Lisp it’s so trivial, it feels like cheating.
If you want to know what Lisp is about, read up to chapter 9 of PCL (Practical Common Lisp), at least. I used to tell people to at least read chapter 3, but it seems not to be enough, sadly, to impress the average programmer (either because they just don’t see it or chapter 3 is still too basic).
Comments at the original blog
Hey, good point. You know what also feels like cheating to me? The loop language.
I mean, from the 99 lisp problems:
Flatten a tree of lists:
(defun flatten (list) (loop for i in list if (listp i) append (flatten i) else collect i))
or, remove duplicated values from a list
(defun makeset (list) (loop for i in list unless (find i set) collect i into set finally (return set)))
At first it looks like cheating, but then i realized that the loop language is to lists what regular expressions are to strings, and it’s better than having a bunch of different people writing their loops and boilerplate in different ways.
I’ve discovered something recently. Most programmers have a favourite programming language. No, that’s not it, there’s more to my discovery. Whenever those programmers have an idea they open a text editor and start coding and/or they start playing with a REPL, if they are lucky to like a programming language that provides one.
You watch them code and they do it fast, with little errors. They don’t program fast because it’s a good language, they program fast because they know it, and they know it because they use it often, and they do that because they like it. That was the first part of my discovery. Continue reading “A programmer’s favourite language”
I am coming from the Plone world. My web site used to be Plone and various website I still maintain are still Plone-based. In Plone, one of the formats to write text is ReStructured Text (RST); and Matt has convinced me it is the right way… or at least, one good way. But in the world of WordPress, RST is not a first class citizen.
Searching for “restructured text wordpress” I’ve found an article titled “Using reStructuredText with WordPress” . That seemed like good news. The author talks about a plug in, but getting it to work required some work on my side and that is what I am trying to show here.
Disclaimer: poorly written article ahead (and above), take the information, ignore the prose.
First, the plug in is not distributed as a compressed archive (tar.gz, tar.bz2, etc) like software is generally distributed but as a TXT. You have to download rest.php-1.2.txt to your plugins directory of your WordPress install and rename it to “rest.php”.
In the computer were WordPress is installed you should also have Docutils installed, particularly the program rst2html. The plug in has a hard-codded path to reach that program, around line 18:
// Set this to the prefix of your docutils installation. $prefix = "/usr/local"; // Set this to the path of rst2html.py $rst2html = "$prefix/bin/rst2html.py";
// Set this to the prefix of your docutils installation. $prefix = "/usr/local";
Also, due to various personal preferences, I’ve changed the line 116 to:
$execstr = $rst2html . ' --no-generator --no-source-link --rfc-references --no-doc-title --initial-header-level=2 --footnote-references="superscript"';
To know more about it, read the man page of rst2html.
The other important change is that around line 100, there’s some code to replace the “more” HTML links that WordPress insert with RST links. The problem with that is that the code searches for a particular text (“(more…)”):
$pattern = '\(more...\)'; $replacement = "\n\n`(more...) < \1>`__\n\n"; $text = ereg_replace($pattern, $replacement, $text);
but that text is skin-dependent, so I changed it for:
$pattern = '(.*)'; $replacement = "\n\n`\2 < \1>`__\n\n"; $text = ereg_replace($pattern, $replacement, $text);
which is more generic and will successfully correct all the links, no matter what they say. Now that I take a look at it, the line jumps in the RST version shouldn’t be there. This had an unfortunate consequent. The text of the a element of an HTML link can have HTML specific stuff, in my case it had one HTML entity. The right thing would be to expand all HTML entities into text, but I just did a search and replace for this particular one. An ugly hack indeed:
$pattern = '»'; $replacement = "»"; $text = ereg_replace($pattern, $replacement, $text);
And at last the jewel. If you don’t write -*- mode: rst -*- somewhere in the article, then it won’t be RST, it would be the built-in simple WordPress markup language whatever that is called. You can prefix that with two dots and a space, like “.. “, in the beginning of the line to also turn it into a RST comment so the actual text doesn’t appear in the final article.
You’ll see that there are many nasty things here, lots of hacks, etc. The right thing would have been to solve the bugs, make a customization page to set the path and the RST options and make the solution more generic. Then pack it and release it. I am not going to do that, enough time has been spent writting it down here, now I am back to my main project. This is related to what I’ve said in my previous post regarding worrying less about the perfectionism of my web site and work more in my personal projects.
Comments in the original post
- Matt Dorn Says:
Finally caught up with your new site and updated my RSS feeds–looks nice! But I like that I can now read your entire articles within my RSS reader instead of just the introduction.I agree that Plone is not ideal for a personal site, though I think I’ll be keeping mine for a while. I would like to get comments activated without hosing my Apache caching setup–that seems to be the main challenge, because running a Plone site without caching is not advisable.
Re. our shared enthuasiasm for Restructured Text, I just had another occasion to appreciate it. You can use it in Tracs. I also got Tracs working with Darcs, which I know you use as well. Have you thought about making your software projects available via Tracs projects? If so, the writeup I just did might help you:
February 1st, 2007 at 13:01
Nice to see you active in the community. When I was re-structuring my web site I’ve decided to use Trac for my projects but after a quick try I gave up. A quick try to use it with Darcs (or nothing at all) that is.
Now that you have written a tutorial about it I am going to read it and give it a nice try. Isn’t it nice that I helped you start with darcs and now you help me start with trac plus darcs? That’s karma!
February 1st, 2007 at 20:40 e
I’ve just installed this plugin to a blog on my local machine (not the blog above). It doesn’t quite work. If I could get it working it would be an absolute godsend. Please help.
When I add the mode line to a post, wordpress then ignores the entire body of the post – I get the title and nothing else. Any idea what might be wrong?
I have no knowledge of php at all, my main language is Python. Would it be possible to write plugins in Python?
My blog is fairly new. I’m enjoying using wordpress, but the rest of the time I more or less live in emacs and use rest for most of my documentation. If I could write my blog posts in rest I should be very happy. Would be prepared to put some work into this to get it working.
June 15th, 2007 at 12:52 e
- Pupeno Says:
Hello Ivan,Be sure that the plug in is activated. Otherwise, contact the plug in author.
I am not sure about programming plug ins in Python but I doubt it’ll be possible, you should check in WordPress’ site and mailing lists.
I am only a user of WordPress, my knowledge of its internals is null, but if you ask in WordPress’ mailing list or IRC channels, I am sure you’ll get a lot of help.
June 16th, 2007 at 13:53 e
- you know something? » Blog Archive » Happy! ReST Says:
[…] 落ち着いて考えれば、すぐ分かりそうなものですが、 以前、うまくいかなかった理由は、 rst2html.py をあらかじめインストールしておいて、 rest.php 内のパス を書き換えておかったため。 […]September 7th, 2007 at 2:41 e
- ROTR » reStructuredText for WordPress is now a Launchpad project Says:
[…] Pupeno […]September 9th, 2007 at 5:30 e