libkibi 0.1 released

The first version of libkibi is released. This library is designed for formatting sizes in bytes for display. The user can configure a preferred prefix style. Packages for Debian unstable and Ubuntu 11.04 (maverick) are uploaded.

It contains a README for developers and a byteprefix man page for users, which can be read with man 5 byteprefix once installed. Thanks to Stefano Rivera for writing the man page!

For a demonstration how this library used by an application can look like, read my previous post.

Advertisements

Poll: libkibi VS libbyteprefix (or: How to call the library? 2)

Dear lazy web,

thanks for voting the best name for the library that helps implementing the Units Policy of Ubuntu. The winner with the most votes has been libkibi. There was one suggestion that got my attention: libbyteprefix. The suggestion came too late to have a chance. Therefore I ask you again to vote for the library name, but this time only these two names are open for voting: libkibi and libbyteprefix. libkibi is short and sounds good. On the other hand, libbyteprefix describes exactly what the library is supposed to do.

I was asked to use a free (as in freedom) poll-service. So please go to the Selectricity unitspolity vote and select your favorite. Thanks.

Poll: How to call the library?

Dear lazy web,

I am writing a library that implements the Units Policy of Ubuntu. This library can be used to format sizes (of files, disks, memory, etc.) for displaying them and the other way around. For example, the size 12345 bytes can be formatted to 12.3 kB, 12.1 KiB, or 12.1 KB depending on the configuration. An other function will give you the possibility to convert 12.3 kB, 12.1 KiB, or 12.1 KB back to 12345 bytes. The preferred binary unit can be configured by an text file (per system and per user) and by an environment variable. The library is written in C and doesn’t have any dependency. Therefore it can be used by any program on any desktop environment. Binding to other languages like C++, Python, Java are planned.

Before creating a project for this library, I need a name for the library. The current prototype is called libdisplayunits, but this name reflect only the half of the project. It does not indicate that the library can be used for inputting sizes. What do you think? What is the best name for the library? Please poll and/or comment below.

How to get units consistent across all applications?

We have a units policy in Ubuntu, which we have to implement in lucid+1 (Ubuntu 10.10). Correcting all applications to conform to this policy is not an easy task. The first attempt to patch glib, which provides the g_format_size_for_display() function, failed. We need a library that can handle input and output formatted sizes. Take transmission as example: I want to set the bandwidth limit in the same unit as it displays me the limit. We have to introduce a set of new functions.

Should I create a new library (named libbyteunits or similar) or add a bunch of new functions to glib (as replacement for g_format_size_for_display)? Is glib the right place for ten or more functions handling units?

Pros for a separate library:

  • the library can be used by non-glib application without depending on glib
  • it can be made user configurable (for example by an text file), because some user prefer base-10, others base-2.

Cons:

  • one more dependency for glib applications

I like to hear as many opinions as possible. Please let me also know, if you are glib developer, a g_format_size_for_display() using developer, a developer, or a user.

Comments to Ubuntu 10.04 Reads File Sizes Differently

I stumbled over Ubuntu 10.04 Reads File Sizes Differently and I have to correct some statements.

First I want to ask you, my blog reader, to read the units policy. Then think about it and read it again.

Now my criticism to the blog post:

  • We didn’t change the units policy. There were no such policy; we created one.
  • KB does not exist (in the SI or IEC standard). It’s either kB (meaning 1000 bytes) or KiB (meaning 1024 bytes). Did the author read the policy?

Now my clarifications to the commenter:

  • This policy was not Canonical’s decision. You have to blame me for creating the draft of the policy and the Technical Board for approving it.
  • This policy has nothing to do with Apple. I have never used a Mac and I don’t care what kind of byte prefixes Apple uses.
  • This policy is not connected to the decision to change the window buttons position of the default theme. This was done by different people. These two things are absolutely independent.

Correcting all applications to comply to the units policy is a goal for lucid+1 (Ubuntu 10.10). We are too late in the release cycle for the change in lucid (Ubuntu 10.04). My current plan is to create a library for inputing/outputting bytes to users. The user can then configure this library to display the units in base-2 (KiB), base-10 (kB), or the historical totally fucked-up format (KB).

Edit: My clarifications to the commenter apply to the commenter of Ubuntu implements units policy, will switch to base-10 units in future release too.