2006-05-16 16:35

Heads or Tails?

There is a command, head, to take the first piece of a file.

There is a command, tail, to take the last piece of a file.

Tail does a few extra things, because it's useful to watch the end of a file that is being updated and similar things, but they should be pretty similar pieces of code, supporting similar options, right?

Well, no.

  • head supports a negative number of lines as argument, meaning "all but the last N lines", and tail doesn't.
  • Same about bytes instead of lines

That means that you can't quite simply get "all but the first two lines of this file".

But don't worry, this is how you do it:

tac file |head --lines=-2 | tac

Correction: tail has what I wanted. I am just a silly guy that doesn't read the man pages completely, you can do tail -n +2 to do it.

On the other hand, it's not explained in the option, and the syntax is different from head's, so it's still slightly rant-worthy ;-)

2006-05-16 15:05

So, this is how it feels...

...to scratch an itch that isn't there!

For some reason I can't stop playing with my blog's site.

Latest ricer-like "improvements": a google search box and a google sitemap so the search box will work well.

At least the sitemap was something I needed to learn about for a client :-)

2006-05-16 10:34

Roadmap for Qt/IUP

I have been contacted by a few people about Qt/IUP. Here's my current state of mind...

  • It works mostly.
  • It lacks a few widgets
  • It needs someone to walk over the docs checking everything is implemented and semantically right.
  • It has a (IMVHO) decent structure for the Qt backend. It should be possible to implement everything using it.
  • The IUP people know about it.
  • It's still just my toy, AFAIK

So, its future seems to rely on me having time and energy to finish it... and there's the catch.

I am Gimli. I am not a marathon runner. We dwarves are natural sprinters! So, I can usually cook up a decent project in a week or a month, and then it languishes.

Specially because I really don't need Qt/IUP.

I only got here because I was trying to learn D and I didn't like any of their portable toolkits, and I found no better small C toolkit I could wrap, and then I disliked it being Motif.

As you can see, an entirely too weak link from me to Qt/IUP to be sustainable.

I will try to push it today, implementing the missing widgets, and see what happens.

2006-05-16 00:20

Using runit is even simpler

I have posted in the past about runit.

One of the problems people migrating to runit have is that all your services are SysV scripts.

The runit author has a collection of scripts you can use, but usually they require some adjustment to work on a specific version of Linux.

So, I wrote a lame python script that takes the SysV scripts you are currently using and turns them into runit services, including dependencies.

Suppose you usually start on runlevel 3. Then you save this script and run it like this:

mkdir services
python importinit.py 3

And you should end with a bunch of runit services inside services/

Those services will start in roughly the same order as if you were using SysV init. That's probably way too much dependencies.

The main difference is that kdm will start earlier and the ttys will start way earlier than you are used to.

I have found that my notebook boots faster using this, but I can't provide a bootchart because it simply doesn't seem to work in my computer.

If anyone is willing and able to run the tests and quantify the difference, I am all ears.

For some reason kudzu, iptables and arptables_jf don't work with this approach, so just stick them at the bottom of /etc/runit/1

Also, please understand that these are not correct runit services. They are not managed, so if your service crashes it stays crashed.

So, you should still eventually migrate to correct scripts. This is just a way to make that simpler.

2006-05-15 14:44

Well, I didn't know that!

As everyone knows, the Da Vinci Code is about to be premiered worldwide.

I will probably see it. By chance I ran into the plot synopsis in the site of Dan Brown (the author of the book).

Hmmmm... interesting.

For example, it describes Opus Dei as

Opus Dei [is a] clandestine, Vatican-sanctioned Catholic sect believed to have long plotted to seize the Priory's secret.

Whoa.... Opus Dei is a clandestine sect! I must say I dislike the guys (and I know at least 4 of them), but they are about as clandestine as the Baptists. And much less so than the Unitarians.

Not to mention that (I've heard) much of the plot revolves around clues left "hidden" in things like Da Vinci's paintings.

You know, if I were the Priory of Sion, and had a secret... sure, I would hide the keys to the secret in world-famous pieces everyone sees. Or maybe I would ... hide them? You know, as in not telling anyone about them. As if it was a secret?

What would you choose? Anyone? Anyone? Bueller?

On the other hand... the good guys are the ones (the Priory) that have the secret and the bad guys are another secretive organization (Opus Dei) that wants to get the secret?

Well... color me unimpressed, but what the hell does either one having the secret matter? If it is a secret, and noone should know about it, why not give it to the guys at Opus and let them keep it? They don't intend to announce it either.

Then the nice fellas at the Priory can go to the beach or something.

But who cares. They are all the same to kdaptists.

2006-05-14 09:39

Booting with runit / runit RPM - updated

I have updated my Booting with runit story for the commands in runit 1.5.1 and included a mention for my easy runit RPM (which is now also up to 1.5.1).

If you are looking for an alternative way to boot your linux machines, or for a reliable way to run and control your services, please take a look. Runit is cool.

2006-05-13 13:21

Measure twice, crash once (or less)

Having running statistics on your systems is always a good idea.

Since I am a qmail freak, I have been using the venerable qmailmrtg7 for a long while.

In fact since I use my courier pop3/imap server with tcpserver, I can even use qmailmrtg7 to give me stats about POP3 and IMAP, which it susually doesn't.

But... qmailmrtg7 is kinda lame. In part it is lame because it uses mrtg. In part it is lame because it's one opaque thing.

Munin, based on rrdtool is much nicer to look at than mrtg, and has a much more reasonable architecture.

Then, I found qmrtg which is much nicer than qmailmrtg7, and also has a much nicer architecture.

So, why not make a qmunin based on qmrtg which will marry them?

Well, that's an idea.

It's not even very hard to do :-) I should probably do it and publish it.

2006-05-12 12:17

CherryTV

A simple (yeah, sure!) solution so you can watch TV on all the computers in your home. CherryTV!

It's small, it's cherryPowered, and it does work.

2006-05-11 22:40

RA SPP Plugin collection version 0.2.2

Fixed a silly bug in the ipthrottle plugin.

It had debug code enabled, and it was getting to the SMTP client :-(

If you tried to use it, and got "invalid response" errors (or something similar)... well, try it.

2006-05-11 16:22

I am **so** not a guru.

I got this nice multifunction printer+scanner+copier, called HP PSC 1410.

Cheap, too!

Works nice, even!

Except... it can't be networked. You simply can't, using HP's software, print on that thing from any other computer on your network.

Except, that is, if they are both running windows XP. Not even other versions of windows will work. And HP says so. (Correction, maybe not even with XP?)

On Linux? Well, it shoulda kinda work, says linuxprinting.com.

And then I suppose I could export a postscript queue and let the linux driver do the job, and get some printing done from the must-be-windows-98 notebook running the legal case management software.

But you know what? I am so tired of this crap. It doesn't work right on Linux. It's crippled on windows. What exactly are we supposed to run for this piece of engineering to work?

Why does this, a rather new model, lack a feature every godforsaken printer has had since the dawn on Windows For Workgroups 3.11?????

I know my page is read by no windows printing guru, but I really can use a hand here.

Contents © 2000-2019 Roberto Alsina