Older blog entries for ralsina (starting at number 603)

Nikola: New Tag Index Pages

Short and sweet:

In Nikola my static site/blog generator, the Tag pages used to just be a big list of titles linking to the posts in the tag. Now they can (optionally) look just like the blog does, but filtered. Check it out.

Minor tweaks still needed (like, mentioning the tag somewhere in the title), but the basic functionality (filtering, pagination, layout, etc) is complete.

To enable it in your site, just use master from git and enable TAG_PAGES_ARE_INDEXES = True in your conf.py.


Syndicated 2012-08-27 22:09:23 from Lateral Opinion

The end of lateral.netmanagers.com.ar

This site has been lateral.pycs.net, lateral.fibertel.com.ar, lateral.blogsite.com, and has been, for several years, lateral.netmanagers.com.ar.

Well, I am slowly going to deprecate that URL, and the new URL will be http://ralsina.com.ar where you already can find it since a few months ago.

It will involve some work moving comments around and such, but nothing much should change, all old links should remain valid, and all comments should stay attached to the right post.

I will contact the various planets that aggregate it, but since the feed will remain constant thanks to feedburner, I expect not to lose anyone in transition.


Syndicated 2012-08-26 22:33:55 from Lateral Opinion

Qt Mac Tips

My team has been working on porting some PyQt stuff to Mac OSX, and we have run into several Qt bugs, sadly. Here are two, and the workarounds we found.

Native dialogs are broken.

Using QFileDialog.getExistingDirectory we noticed the following symptoms:

  • If you do nothing, the dialog went away on its own after about 20 seconds.
  • After you used it once, it may pop up and disappear immediately. Or not.

Solution: use the DontUseNativeDialog option.

Widgets in QTreeWidgetItems don't scroll.

When you use Widgets inside the items of a QTreeWidget (which I know, is not a common case, but hey, it happens), the widgets don't scroll with the items.

Solution: use the -graphicssystem raster options. You can even inject them into argv if the platform is darwin.


Syndicated 2012-08-25 14:24:36 from Lateral Opinion

Istanbul, The Lost Pictures

http://farm9.staticflickr.com/8441/7827303746_43d5a70622_b.jpg

I will probably never take a better picture than this one.

I found a camera today at home, and then it hit me: this was the camera we took to Istanbul, dropped on the floor, never worked again, and I never found after we came back! And it still had the SD card in it!

So, here are the pictures (not even filtered), so family can see them.


Syndicated 2012-08-20 22:31:18 from Lateral Opinion

Cloud Atlas

Finished reading Cloud Atlas, gave it 5 starts. Here's a quick review:

I am not going to explain this book. It's enough, I think, to say I loved it, and that it's strange, and that it's a bit of a mistery.

Imagining a universe in which all the contents of the book could be real at the same time in a way that would allow all the pieces to be written as they are and yet, be, somehow, not the novel they are, but a found artifact, is both depressing and ellusive.

At the end, I felt something I can only describe as retrospective hope, the feeling that things were supposed to end up better, but that even as terribly as they did end, were it not by that earlier hope, they would have been more grim.

The control the author has over his own style is impressive. This book feels written by half a dozen completely different writers.

Some quotes (which may only make sense once you read the book):

"The sun was deaf'nin' so high up, yay, it roared an' time streamed from it."

"In the first set, each solo is interrupted by its successor: in the second, each interruption is recontinued, in order. Revolutionary or gimmicky? Shan't know until it's finished, and by then it'll be too late"

"What wouldn't I give now for a never-changing map of the ever-constant ineffable? To posess, as it were, an atlas of clouds."


Syndicated 2012-08-17 22:45:41 from Lateral Opinion

Nikola 4 Released

I have just uploaded release 4 of Nikola my static blog/site generator. Here are some of the changes in this version:

Features

  • Previous/Next post links
  • Teaser support
  • Support posts with HTML "sources"
  • Site checking script (nikola_check)
  • Maximum image size in galleries
  • Image descriptions in galleries
  • Image exclusion in galleries
  • Special "draft" tag
  • Pretty code listings ("code galleries")
  • Page descriptions
  • Easy theme tuning via Bootswatch
  • Support for WebAssets bundles
  • "Filters" for powerful file post-processing

Bugfixes

  • Improved HTML output
  • Support multiple time formats in post metadata
  • Slugify tag names for URLs
  • Archive path and filename configurable
  • Galleries sorted by date (supports EXIF)
  • Rotate gallery thumbnails (EXIF)
  • Tag feeds in tag pages
  • Colorbox support in restructured text figures
  • Fix for content displaying too wide
  • Changelog

As usual, you can discuss bugs or make feature requests at the nikola-discuss group and I love to know of sites using Nikola.

Hope you like it!


Syndicated 2012-08-17 10:10:03 from Lateral Opinion

Trying out CloudFlare

It's not that I need a CDN in any way, since the traffic for this site is little and the way the site is built is light, but hey, it's free, easy to setup and easy to leave when I feel like it. And I expect to have significantly higher traffic eventually after I finish some not-so-secret projects.

What's CloudFlare's service? They take over your DNS, then put a reverse proxy between your site and the clients. That reverse proxy then uses a CDN to serve you the pages from a conveniently located server, and can rewrite the HTML/JS/CSS in some ways to make it faster/safer/nicer.

It also supposedly will protect my site from different kinds of attack (the only one that could possibly affect me was DOS attack, but thanks anyway ;-)

Also, they offer a platform so apps can provide services for me, like intruder detection, analytics, and others, which is a very cool idea.

So, I created an account at cloudflare.com and configured it so that http://ralsina.com.ar (which is this exact same site except for wrong comment counts) is served via cloudflare, and lateral.netmanagers.com.ar is served directly.

What I've seen so far:

  • Setup is very simple
  • It works, even setting up experimental features
  • It does seem very slightly faster, but that's not a surprise since the tiny server the site runs on has good conectivity and ample unused resources.
  • It does do a good job of automatically optimizing some things in ways that are generally accepted as a good idea (in other words, my pingdom and YSlow numbers moved up)

So: no pain, maybe some gain. I will probably move all sites into it tonight.


Syndicated 2012-08-13 17:12:37 from Lateral Opinion

Sometimes More is More

We all hear all the time that less is more. That simple is better, that complex is worse, that options are evil, that defaults are what matter.

And yes, that is about 90% true. Except when it is false, which I know because I bought a coat a few weeks ago.

This is a rather nice coat, and if you saw it without much care you would miss one of its best features: it has two pockets on each side.

Let's think about why we want pockets in the sides of coats:

  1. To put our hands when it's cold. Since this is a cold weather coat, that's important. In moderate climates like this one, gloves are more trouble than they are worth, and just sticking hands in pockets is enough.
  2. To put stuff that is not hands in them: keys, phones, money, candy, etc.

For the first use case, we want the pockets to be shallow angled, so that the hand goes in naturally, almost horizontally. Also, we want the access to be unobstructed, so no zippers, which also scratch the wrists.

For the second use case, we want things not to fall off. So we want either a vertical pocket (perhaps with a flap) or a zipper. Zippers suck because you can forget to zip them, and things fall off. Vertical pockets are awful to put your hands in.

So, my jacket has two pockets on each side, one with a zipper, one without. One for hands, one for things. Since it's a thick coat you don't see it unless you know what you are looking for, and it's trivial to use: everything goes in the zipped one, except my hand. I can even check the contents of the zipped pocket without getting my hands out of their pockets.

This is one case where more is more, complex is better, options are awesome, and defaults don't matter. Now, if you find a place in software where that's the case, that's an opportunity.


Syndicated 2012-08-11 15:33:06 from Lateral Opinion

Nikola: Filters & Bundles

Two upcoming features for the next release of Nikola, my static site generator, due sometime in August.

Filters

Filters let you postprocess your output. Think of it like instagram for websites, but useful. You can configure per file extension a series of python functions or shell commands, which will be applied in place to the output file.

For example, suppose you want to apply yui-compressor to your CSS and JS files:

FILTERS = {
    ".css": [filters.yui_compressor],
    ".js": [filters.yui_compressor],
}

There, filters.yui_compressor is a simple wrapper around the command so that it applies in-place to the output files.

If you use strings there (untested), they are taken as commands. The "%s" will be replaced by the filename, the usual crazy shell quoting rules apply:

FILTERS = {
    ".jpg": ["jpegoptim '%s'"],
    ".png": ["pngoptim '%s'"],
}

Keep in mind that the filters modify the output of Nikola, not the input, so your images, CSS, and JS files will not be touched in any way. And of course changing the filters applied to a file will force a rebuild, so you can experiment freely.

Bundles

Having many separate CSS or JS files is usually a nono for performance reasons because each one may involve a separate HTTP transaction. The solution is to "bundle" those files in a single, larger file.

The reason not to do that is that usually it means having a huge, uncomfortable thing to handle. So Nikola tries to give you the best of both worlds, by letting you have separate files, and bundling them (or not) on build.

There is a new option, USE_BUNDLES that defaults to False, and there are some changes in the theme templates so that it uses the bundled version when needed.

This was only possible thanks to Webassets. However, if you don't have Webassets installed, or you don't enable USE_BUNDLES, this should cause no changes in the output.

Conclusion

These new features will allow Nikola users to improve their site's performance with minimal tweaking, which is always a good thing.


Syndicated 2012-08-10 20:06:54 from Lateral Opinion

The Minimal Server

I was a sysadmin for a long time. I did that for money, so I never really wanted to spend time doing the same thing in my own time, which lead to a severe case of cobbler's children walking barefoot in my private server.

So, today at lunch, I decided to clean up my garbage. So this is what I ended up with, which is the minimal server that is good enough to be generally useful for me.

Hosting

This is a cheap VPS provided by the nice folks at burst.net who are not giving me anything to speak nice things about their service. However, I will do it anyway:

  • Crazy cheap ($5.50 but I have a 20% discount for life)
  • Good amount of monthly bandwidth
  • Lots of disk space
  • Good uptime
  • Fast network
  • Very cheap
  • Decent performance

Distribution

I had CentOS 5 installed, and it stays. If burst ever starts offering Ubuntu Precise, I may switch. Or, since this works, I may not.

What's good about CentOS? It's stable and boring.

What's bad about CentOS? It's too boring. Lots of cool stuff just isn't packaged.

Web Server

I need to serve a bunch of domains, but I have a peculiarity: they are all static sites. I want:

  • Low resource usage
  • Decent performance (that mostly involves supporting ranges and content negotiation)
  • Stable
  • Support directory indexes
  • Easy configuration
  • Virtual domains by name

Almost any server works well for this. Even Apache, except for the easy configuration bit. I ended up with gatling because it fits those criteria fairly well.

  • It uses about 1.4MB of RAM , which is always nice in a VPS
  • It's pretty fast
  • Has not crashed in 2 hours?
  • Supports indexes
  • Here's the configuration: "-c /srv/www -P 2M -d -v -p 80 -F -S" (yes, there is no config file at all)
  • Virtual domains are just folders and symlinks inside /srv/www which is the easiest possilble way to do it.
  • It supports reverse proxying for when I want to try a python web app I am working on.

Mail Server

No, I don't want a mail server. I have gmail and/or a real mail server for that. I want to get the mails from cron. For this, I used ssmtp and an extra gmail account. It works, and here's the whole config:

root=roberto.alsina@gmail.com
mailhub=smtp.gmail.com:587
UseTLS=YES
UseSTARTTLS=YES
AuthMethod=LOGIN
AuthUser=roberto.alsina.3@gmail.com
AuthPass=notputtingthetrueoneheredude

The best I can say about this configuration is that it works, and doesn't involve running a daemon.

Misc

For when I need to be in two places at the same time: OpenVPN rules, and there is no argument. I have a squid running occasionally, and there is a Quassel core for IRC stuff. I installed mosh to make ssh less painful, rsync handles file deployment and backup storage, cron schedules stuff, and that's it.

Status

Plenty of free RAM and CPU (yes, that's the full process list):

[root@burst1 ~]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   2156   664 ?        Ss   22:01   0:00 init [3]
root      1135  0.0  0.1   2260   576 ?        S<s  22:01   0:00 /sbin/udevd -d
root      1518  0.0  0.1   1812   572 ?        Ss   22:01   0:00 syslogd -m 0
root      1594  0.0  0.1   7240  1032 ?        Ss   22:01   0:00 /usr/sbin/sshd
root      1602  0.0  0.2   4492  1112 ?        Ss   22:01   0:00 crond
root      1630  0.0  0.1   5684   716 ?        Ss   22:01   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
root      1631  0.0  0.0   5684   444 ?        S    22:01   0:00 /usr/sbin/saslauthd -m /var/run/saslauthd -a pam -n 2
root      1636  0.0  0.2   3852  1372 ?        S    22:01   0:01 /opt/diet/bin/gatling -c /srv/www -P 2M -d -v -p 80 -F -S
root      1677  0.0  0.2   4284  1232 ?        Ss   22:02   0:00 SCREEN /root/quasselcore-static-0.7.1
root      1678  0.0  2.1  36688 11148 pts/0    Ssl+ 22:02   0:03 /root/quasselcore-static-0.7.1
root      3228  1.0  0.7  12916  4196 ?        Ss   23:28   0:13 mosh-server new -s -c 8
root      3229  0.0  0.3   3848  1588 pts/2    Ss   23:28   0:00 -bash
root      3275  0.0  0.1   2532   908 pts/2    R+   23:48   0:00 ps aux
[root@burst1 ~]# w
 23:49:03 up  1:47,  1 user,  load average: 0.00, 0.01, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/2    186.153.52.253   23:28    0.00s  0.01s  0.00s w
[root@burst1 ~]# free
             total       used       free     shared    buffers     cached
Mem:        524800      49100     475700          0          0          0
-/+ buffers/cache:      49100     475700
Swap:            0          0          0

All things considered, fairly happy with the result.


Syndicated 2012-08-07 16:17:40 from Lateral Opinion

594 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!