Search Results: "Enrico Zini"

30 August 2007

Enrico Zini: gpl-and-business-faq

GPL and Business FAQ I sometimes happen to be in a dialogue like this:
X: According to GPL, you can sell copies of your software at any price you want, right? Me: Right. X: But your customers can in turn sell copies of your software at any price they want, right? Me: Right. X: So, the only way a GPL developer can make money is by charge for development of their software? Me: Not only for development: also for maintenance, improvements, customisation, installation, training, gadgets, support...
The market is quite big, actually. In fact, one can even make business by selling the software in a box, if one makes a box that people would like to have (for example, including things like useful documentation, a few gadgets, a support contract and a pony). The idea is that the business of selling software alone is a useless extortion that provides no particular benefit to the user (and in many cases, no particular benefits to the developer either). If you put that aside, there is a plethora of ways to charge the customers more, and for things and services that are useful to them and make them happy. Actually, if you develop a GPL software for someone who is then happy about it, they may then pass it on to other people in the same sector. Who then maybe need help with installation, support, maintenance, custom features, training, gadgets and ponies. If your software hits the spot, a niche market can end up growing by itself. The last discussion on this topic then ended up with another question:
X: Ok. But to do a good job you have to be many people at once: for example you sometimes need to be a sysadmin as well as a developer. Me: Yes. Being many people at once is what starting a company is all about.
He complained that answers like these could not be found in the Selling Free Software article of FSF: in the meantime I'll publish them here. The license of this post is GPL. The FSF and any of their regional chapters are welcome to use all or part of this text, with or without modification as they see fit, alone or included in documents that use any license they see fit, even some of the not really free ones they use sometimes, such as the one used by Selling Free Software itself :-P

Enrico Zini: procmailrc-trap

Procmailrc, TRAP and LASTFOLDER I use procmail and lbdb. lbdb is invoked at the beginning of procmailrc harvesting From: addresses from all incoming mail, so that they can later be queried with mutt. It's really neat. However, if it's put at the beginning of procmailrc, it harvests From addresses from spam, too. This causes the ldbd databse to become very big, slow to query, and in some unlucky cases, to return lots of bad results. Problem is, I run the spam filter AFTER I delivered to the mailing lists. The rationale is that mailing lists already do their own spam filtering to some useable level. At least those I'm subscribed to. So, my current procmailrc goes like:
feed a copy through lbdb
filter list 1
filter list 2
...
filter list N for N very big
filter out spam
deliver to inbox
Now, is there a way I could invoke lbdb for every mail except what is caught by the spam filter? A way, I mean, that doesn't involve hooking into each and every of the N list rules an lbdb invocation? Here is the way. In .procmailrc, add:
TRAP=~/bin/scan-nonspam
Then write ~/bin/scan-nonspam:
#!/bin/bash
if [ $ LASTFOLDER:0:4  != 'spam' ]
then
    /usr/bin/lbdb-fetchaddr
fi
exit 0
For reference, this is the documentation of TRAP:
When procmail terminates of its own accord and not because it received a signal, it will execute the contents of this variable. A copy of the mail can be read from stdin. Any output produced by this command will be appended to $LOGFILE. Possible uses for TRAP are: removal of temporary files, logging customised abstracts, etc. See also EXITCODE and LOGABSTRACT.
And this is the documentation of LASTFOLDER:
This variable is assigned to by procmail whenever it is delivering to a folder or program. It always contains the name of the last file (or program) procmail delivered to. If the last delivery was to several directory folders together then $LASTFOLDER will contain the hardlinked filenames as a space separated list.

27 August 2007

Enrico Zini: pkgprune

Filtering Debian Packages file
pkgprune - Filter a Packages file
Usage: pkgprune Packages > Packages.filtered
Filters a Debian Packages file by removing either a list of packages (and
their reverse dependencies) or the packages that have given tags.
Dependencies in the filtered Packages file will still be satisfied.
Available via:
wget http://people.debian.org/~enrico/2007-08/pkgprune/pkgprune
or:
hg clone static-http://people.debian.org/~enrico/2007-08/pkgprune
The top of the script has a configuration section:
#
# Configuration
#
# Set of packages you don't want to have (the reverse dependencies will be
# removed as far as it's possible)
blacklist_pkgs = set(['gconf2'])
# List of sets of tags; the packages whose tag sets contain one of these tag
# sets will be removed
blacklist_tags = [ set(['implemented-in::php']) ]
Edit that before running the script. The idea is to be able to configure a system to run such a script after apt-get update, both to make dpkg faster on slow arches and to reduce the amount of packages displayed by an interface.

24 August 2007

Miriam Ruiz: GoPlay!

Thumbnail of GoPlay! v0.1DebTags is a really nice system for clasifying programs, it allows you to select which packages you want by being able to select between many different kind of labels, that are used to categorize them. Anyway, there is sitll a long way to go if we want to make it easier for users to locate the programs they want, and that goes for games too. In DebConf7, in Edinburgh (Scotland), Enrico suggested me that we could do a GUI for searching the games available in Debian, using his DebTags as the backend. Starting there, using his libept library for accessing the data, FLTK (Fast Light Toolkit) as the toolkit engine, and C++ as the programming language, we’ve been slowly developing it. The version 0.1 of the program is ready, and hopefully will be in Debian soon. We’ve decided to create a standalone package with the thumbnails, that could also be shared with other programs, and the package for goplay itself. Both are now waiting in the NEW queue, and hopefully soon they will be in Debian. Of course, more snapshots of the games shall be taken, and there’s a lot of room for improvements, but at least it’s a starting point. For using it, you’ll need to install debtags and ept-cache in your system, and set them up properly, and possibly also the results from popcon, if you want to have that data in the GUI too: apt-get install debtags ept-cache
debtags update
mkdir /var/lib/popcon/
cd /var/lib/popcon
wget http://popcon.debian.org/all-popcon-results.txt.gz
ept-cache reindex

5 August 2007

Christian Perrier: Set brightness from a script: result

The winner is Pierre "Madcoder" Habouzit who first mentioned (Enrico Zini came a little bit later) xbacklight which works perfectly with the i915 card in my Dell X1 and can even fade the screen brightness to values I couldn't reach with the Dell's buttons. Once, again, Keith Packard save my life (my Watts in that case). He already did so with xrandr, allowing to easily play with screen output on the very same Dell and have nice ways to do my talks. That X.org and XSF team really rock!

30 July 2007

Enrico Zini: lastsupper

Leonardo's "Last Supper" A lovely article mentions that:
superimposing the Last Supper with its mirror-image throws up another picture containing a figure who looks like a Templar knight and another holding a small baby.
Apparently all the websites showing the resulting image were heavily slashdotted, but superimposing a mirrored image is not rocket science, so I gave it a try. The result has nothing to do with Templar knights, but is shows very clearly that Jesus becomes Chtulhu: Jesus with superimposed mirror image Excited by this finding, I looked for more. I could not find much in the Mona Lisa: Mona Lisa with superimposed mirror image But indeed the Vitruvian Man after superimposing a mirror image shows incredibly large balls: Vitruvian Man with superimposed mirror image Leonardo was Italian, and in Italy "growing big balls" means "getting very tired and sick of something". This is clearly a very deep message from Leonardo. But why stop at Lenoardo? Teomondo Scrofalo with superimposed mirror image Absolutely wonderful.

18 July 2007

Martin F. Krafft: They don't want my business

I have been trying all day to get price quotes for a couple of flights within the next twelve months. I have not managed. Here is why, sorted by company, and for all companies that make sense for the routes:
Swiss When you click on the calendar fields to choose the departure date, a window pops up:
Shortly you see if there are flights available on your preferred date.
"Shortly" has lasted for as long as 3 hours, which is when I decided to try again, and ultimately to try someone else.
Emirates On submission of their form, I am being told:
Sorry, we were temporarily unable to process your request due to a technical problem. Please wait a moment and try again.
I've waited countless moments, and now, 11 hours since my first try, their idea of a moment still isn't over. But what kind of technical problem is this anyway, which resolves itself on retry after waiting a moment?
Austrian Airlines
Our website is currently undergoing maintenance. Please come back later.
All day.
Air New Zealand Once I hit "search flights", I get a blank page: a proper HTTP response followed by 0 bytes of HTML.
British Airways Whenever I hit submit, I am told that the return date has to be after the outbound date. I am then taken back to the form, which preserved all fields, except for resetting both dates to the same day, a week from now.
Malaysia Airlines
An error has occurred processing your request. Please contact our technical staff.
without a link or any hint as to how to contact them. I just tried them all again, without any changes; 11 hours later. Apparently they don't want my business. I really wonder what the future of air travel will be. In many ways, I hope they stop dumping prices and concentrate again on customer satisfaction. But I guess that applies to pretty much everything these days. PS: I especially appreciate Easyjet's policy of separating friends: after buying one ticket on a given route in August and finding out that we need a second one, I am told that "the route you have selected will be available from 28 October 2007". The funny thing is that we already have a ticket for that route in August. They just don't want my friend to fly along... NP: Gazpacho: Firebird Update: Sam Morris alerted me to Kayak, a very impressive meta-search engine for flights. Sure beats visiting each site in turn (although that could get you better deals through specials), and also replaces STA Travel and Opodo for me. Update: Enrico Zini points me to skyscanner, which complements Kayak in that it searches only the low-cost airlines. Kayak does include EasyJet, but they aren't always the cheapest.

13 July 2007

Enrico Zini: g++-parse

Simplify g++ error messages You use templates and STL and sometimes get lost on insanely complex compiler errors? Filter it through this script of mine.
#!/usr/bin/perl -w
use strict;
use warnings;
while (<>)
 
    s/std::basic_string<char, std::char_traits<char>, std::allocator<char> >\s*/std::string/g;
    s/std::set<(.+?), std::less<\1>, std::allocator<\1> >/std::set<$1>/g;
    print;
 
It's quite simple minded, but it has more than once been a lifesaver.

4 July 2007

Enrico Zini: debtags-prod

Debtags prod pages Are you a Debian maintainer? Have a look at the Debtags prod page: it lists debtags statistics by maintainer, and you can sort it: Look at yourself in the list: are you doing well? You want to improve? Click on your name and you'll end up in your own "Go tagging!" page, where you can tag all your packages and get suggestions by our various happy AI engines. If you're not in the list it means that all your packages are somehow tagged. If you still want to review the tags of your packages, hit the "Debtags" link in your DDPO page. The prod pages are updated every 6 hours. The "Go tagging!" page is updated in realtime.

29 June 2007

Enrico Zini: tg-linktoself

Linking to self in turbogears I want to put in my master.kid some icons that allow to change the current language for the session. First, all user-accessible methods need to handle a 'language' parameter:
@expose(template="myapp.templates.foobar")
def index(self, someparam, **kw):
    if 'language' in kw: turbogears.i18n.set_session_locale(kw['language'])
Then, we need a way to edit the current URL so that we can generate modified links to self that preserve the existing path_info and query parameters. In your main controller, add:
def linkself(**kw):
    params =  
    params.update(cherrypy.request.params)
    params.update(kw)
    url = cherrypy.request.browser_url.split('?', 1)[0]
    return url + '?' + '&'.join(['='.join(x) for x in params.iteritems()])
def add_custom_stdvars(vars):
    return vars.update( "linkself": linkself )
turbogears.view.variable_providers.append(add_custom_stdvars)
(see the turbogears stdvars documentation and the cherrypy request documentation (cherrypy 2 documentation at the bottom of the page)) And finally, in master.kid:
<div id="footer">
  <div id="langselector">
    <span class="language">
      <a href="$ tg.linkself(language='it_IT') ">
        <img src="$ tg.url('/static/images/it.png') "/>
      </a>
    </span>
    <span class="language">
      <a href="$ tg.linkself(language='C') ">
        <img src="$ tg.url('/static/images/en.png') "/>
      </a>
    </span>
  </div><!-- langselector -->
</div><!-- footer -->

Martin F. Krafft: DebConf7

I am sitting at Frankfurt airport in between flights home from Edinburgh (not anymore, but that's where this post was born). It's been an intense 2.5 weeks of DebConf7, which has been unlike other DebConfs for me in two respects: this was the first time I actually went to DebCamp, the week leading up to the conference, which is designated to teams and individuals with development goals to achieve during the week. And I was also actively involved in the organisation of the conference, which was unexpected, but a very good experience I am not going to miss next year. Well, it wasn't unexpected. When I booked my flights in January, I had decided to arrive a day early and leave a day late to be able to lend a hand. In between then and the conference, my life turned somewhat upside-down and I had forgotten everything about these noble goals of mine. So when I arrived at the conference venue on Saturday morning with thoughts of netconf circling my head, I was surprised to find everyone buzzing about (how na ve of me) and somewhat clueless as to how I should merge in: my wrists didn't really hold up to heavy lifting, and my knee certainly didn't enjoy stairs, of which there were plenty on the way up to the top floor, where DebCamp was taking place. After trying and being mostly ridiculed by the other organisers ("friends"... ha!), I set out to accomplish some other tasks more suited to my bodily condition, such as wiring the hack lab to accomodate 40 geeks for the first week. That took me most of the day, but at least the space was ready for Sunday morning and the official start of the camp. My goal for the week was netconf and I made good progress until I ran into a wall on Tuesday and had to back off and rethink my design. Reinhart Tartler and Enrico Zini dedicated their time to listen to my design and the problems and helped me clear the mess up and helped me reduce complexity and converge on a straight-forward, event-based design. As the newly appointed DebConf press officer and one of the organisation volunteers, I did not get any further for a few days, as I was manning the front desk or preparing and releasing my first press release (with the help of several others), which lead to a lovely story on The Register and doubled the number of attendees that preregistered for DebianDay (which marks the end of DebCamp and the start of DebConf). I blame the geeks in skirts, actually. Silly bunch, but not quite as silly as those attendants who could get a laugh out of the underwear question for two weeks in a row. Up to this point, I had managed to keep a perfect balance between netconf, orga-team, and sleep. So good, apparently, that when the orga-team t-shirts arrived, Uncle Steve made it quite clear that I should be getting one, even though I had spent considerable time on netconf, am sure some of the others must have worked twice the amount, and I was still quite well rested then. But they gave me a shirt and thus I became part of the orga-team. And even though it was rough at times, running around during the day, filling spare minutes with netconf brain-work, and enjoying nights that got longer with every day of the conference, I am glad and proud to be a member of this team now. It took me until after the official start of the conference to return to the netconf code, but with the new design, I got most of the framework to a point where it could obtain static and dynamic addresses from configuration files as well as DHCP servers in time for my presentation on Tuesday (the recording of which shall be linked from the netconf homepage as soon as it's available). Of course, nothing worked on screen in front of the audience, but noone really expected that anyway. and then I took it all apart for further simplification, so by the time night fell, the slides from the talk had already become outdated as I moved to yet another design, which is even simpler and which allowed me to sketch complex scenarios, such as DHCP after WPA. For two days, I made good progress, but the time available for hacking decreased noticeably, as I kept volunteering for more tasks that needed doing, and more and more people turned up. Somewhere in between, Keith Packard took hostage of (and fixed parts of) my broken X40 laptop, but that's the meat of another story. And on some other night, our leader Sam, in his official capacity as DPL, presented me with the instantiation of my innermost desires as consolation for my hosital stay: a pony. Just look at that smile! With 400 attendants, this year's DebConf continued the trend of immense growth of the event, and while it's great to witness this increase in popularity among attendees and sponsors, who make it possible each year to fly more people to the destination, I am also rather sceptical. The problem is less the additional load on the organising team the next 100 people are going to be easier to accomodate than the previous 100 were. It is more that the conference is losing focus. More people make you spend less time with the same folks, and as the number of non-contributors increases, the social element starts to outweigh the technical element. I am not condemning the social element, but to paraphrase the words of my favourite Debian developer, it's painful to come to DebConf or even IRC with a project and questions just to find that the people are generally more interested in being social, even to the point of preventing technical discussions. I realise that this is a sensitive subject as the issue of various cabals keeps coming up frequently and it does not seem right to start limiting the audience to this conference, but unless we consider the matter, DebConf might deteriorate similarly to other conferences, which have enjoyed enormous growth as well before it was too late. I think we must make sure that people understand that we are, after all, a technical project and must not lose touch with out roots. Of course, I may also be overreacting, after a week of intense coding and many other stress factors I continued working hard on netconf and helping with the organisation throughout Friday, briefly taking time off to prepare a presentation on my Ph.D. research, which was very well received, as well as a workshop on Debian packaging with modern (distributed) version control systems, which yielded around a dozen new subscribers to the vcs-pkg mailing list. But now, back to netconf. All things considered, I was making good progress, but not getting netconf into a releasable state just yet. I can parse /etc/network/interfaces files and get data from DHCP servers, even configure interfaces with those, but it's all still work in progress as I have not yet bothered to implement such basics as default gateways or DNS servers. But the framework is in place, and I am very happy with it as everything I keep adding falls into place beautifully. To mark the end of my netconf development sprint at DebConf7, I scheduled a code introduction session on Friday, where around 15 people turned out to get a walkthrough of the code and explanation of some of my design decisions. The session was recorded and will be available on video shortly. I think it turned out to be a very good idea; I found myself intrigued by someone else's code before until that someone took the time to explain what was going on. I sincerely hope that this introduction helps bootstrap a few people's experiences with the code and yields more contributors! Even though we ended almost every single evening of the two weeks in one of the surrounding pubs, the last few nights were definitely the most enjoyable. On Thursday, the local team had organised a Ceilidh with a band teaching us geeks how to dance the Scottish way, and the venue stayed open for two hours longer than before, causing most people to come out for beer or bouncing about. On Friday and Saturday, the folks of InfoSeed let us use their comfy couches (in the basement of the conference night venue) and we chilled to music and massages, while on Sunday, after a very tiresome day of cleaning up, the noticably lesser number of survivors hung out at the Forest Cafe for some so-so live music, few beers, and an early journey to bed, where a Dutch Muppet kept us entertained for at least another hour. The best about Monday, my day of return, must have been that the airline lost my backpack, which saved me from having to lug it around in Zurich, and made for a great moment on the phone with the baggage tracing service, who announced that my bags would be delivered in about 6 hours between 20:00 and 22:00 just as the door bell rang and the courier dropped off my bag. I'll be back in Argentina, unless something goes seriously wrong. And I'll be on the orga-team again. If you guys stop holding your meetings on Monday night. Thanks to everyone who made DebConf7 possible. I am proud to have been able to contribute, but the real work was done by a few others. You know who you are. NP: Solar Project: Five

20 June 2007

Enrico Zini: ept-cache-related

ept-cache related You finished wesnoth and you're looking for more?
$ ept-cache related wesnoth -t clean
wesnoth-editor - map editor for Wesnoth
wesnoth-server - multiplayer network server for Wesnoth
wesnoth-tsg - The South Guard official campaign for Wesnoth
wesnoth-ttb - A Tale of Two Brothers official campaign for Wesnoth
wesnoth-utbs - Under the Burning Suns official campaign for Wesnoth
asc - turn-based strategy game
attal - turn-based strategy game
xbattle - Concurrent multi-player battle strategy game
crimson - A hex-based tactical game
stratagus - realtime strategy game for Unix and X
fcmp - Free media files for FreeCraft
wormux - funny fight game on 2D maps
stratagus-gl - realtime strategy game for Unix and X - OpenGL version
boson - core package for Boson
netpanzer - online multiplayer tactical warfare game
You're looking for a package sort of like mutt and firefox?
$ ept-cache related mutt firefox -t clean
mozilla-thunderbird - Transition package for icedove rename
balsa - An e-mail client for GNOME
mozilla-mailnews - Transition package for Iceape Mail & Newsgroups and Address Book
mozilla-thunderbird-dev - Transition package for icedove-dev rename
mozilla-thunderbird-enigmail - Transition package for enigmail rename
mozilla-thunderbird-inspector - Transition package for icedove-inspector rename
firefox-gnome-support - Transition package for iceweasel rename
mozilla-firefox-gnome-support - Transition package for iceweasel rename
mozilla-thunderbird-typeaheadfind - Transition package for icedove-typeaheadfind rename
firefox-dom-inspector - Transition package for iceweasel rename
etpan-ng - console mail user agent based on libEtPan!
firefox-webdeveloper - Transition package for iceweasel rename
firefox-greasemonkey - Transition package for iceweasel rename
tkrat - Mail user agent with POP, IMAP, mh support using Tk
thunderbird - Transition package for icedove rename
All of this in ept-cache 0.5.7 uploaded tonight to unstable. Remember to ept-cache reindex after upgrades, as the indexing algorithm sometimes improves. With 0.5.7, for example, it generates an index which is something like 66% smaller than the previous versions.

Neil Williams: dpkg filtering

This started as an Emdebian idea but it is growing into a more all-purpose option. The requirement is to be able to filter packages during installation or cross-building so that manpages, infopages, documentation (including changelogs, copyright and readme etc.) and translation files for unsupported locales are omitted. When installing, the files would simply not appear on the filesystem or in the dpkg status information. When building, the files would disappear from the package completely (hence the role of filtering in Emdebian). The intention is that embedded systems can have empty /usr/share/man/ /usr/share/info/ and /usr/share/doc directories and a much reduced number of translation files in /usr/share/locale - the default would be only the translation files for languages that are supported on that machine, via 'dpkg-reconfigure locales'. Initially, only the narrow filters needed by Emdebian were considered - discussions at DebConf7 have shown how this can be easily extended to support arbitrary filters - necessarily the risks of using such optional filters would be made clear to the users in the manpage etc. - so that any file in any package could be omitted from the install process and the package file lists as well as during the preparation of packages for embedded devices.

Filters would be glob patterns held in a file in /etc/ (possibly /etc/dpkg/filters.d/) and would include the option to exclude files en-masse and specifically include some files that may otherwise be excluded in specific circumstances. The same filters could be used when building packages for embedded usage as well as installing Debian packages on systems where space is a problem. The main benefit of this filtering for Emdebian is that it makes it much easier to isolate the package changes needed to make the package cross-compilable from the changes needed to remove stuff that embedded devices don't need but which Debian Policy requires. This in turn makes Emdebian patches more useful to Debian maintainers when bugs are filed on their packages about a failed cross-build.

So far, it's taken up most of my hacking time in DebConf. Ian Jackson, Enrico Zini and Wookey have all helped improve the original ideas during that time. Prototype code is mostly complete but the extended filtering support will now have to wait until after DebConf. I'm hopeful that the patch will be accepted, once it is ready.

If this seems strange or unnecessary, just compare the disc usage of /usr/share/doc (which you can control) with /usr/share/locale/ (which you cannot currently control) or view the baobab images from my current laptop installation.

19 June 2007

Enrico Zini: xapian-tags

Using tags to enhance a keyword search A pet problem of mine to solve is that when you do a keyword search for "image editor", gimp does not show up. This is indeed because the description of gimp does not include the word "editor". And if you are a gimp developer, please don't change this otherwise I don't have a good example to point at anymore. Now that I have a Xapian engine in ept-cache, I already managed to make gimp actually appear somewhere in the search results through approximated matches. But I know one can do better: debtags is very good in providing data that brings gimp back to the world of image editors. So, how can one use tags to improve the xapian results? Today the Xapian developers told me. I've implemented it in ept-cache 0.5.6, that I've just uploaded to unstable. After you install it, do an ept-cache reindex to rebuild the index with debtags in it. The system is very clever: here is how it works. First you prepare the query as usual: tokenize, stem and so on:
// This is the nice ept interface to Xapian
TextSearch textsearch;
Xapian::Enquire enquire(textsearch);
// Set up the base query
Xapian::Query query = textsearch.makeORQuery(keywords.begin(), keywords.end());
enquire.set_query(query);
// Get a set of tag-based tokens that can be used to expand the query
vector<string> expand = textsearch.expand(enquire);
// Build the expanded query
Xapian::Query expansion(Xapian::Query::OP_OR, expand.begin(), expand.end());
enquire.set_query(Xapian::Query(Xapian::Query::OP_OR, query, expansion));
// Get the results as usual
    Xapian::MSet matches = enquire.get_mset(pos, 20);
for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
    ...
And this is how you build the expanded query:
// This functor filters out all tokens that are not tags
// (tags are indexed with a 'T' prefix)
struct TagFilter : public Xapian::ExpandDecider
 
    virtual bool operator()(const std::string &term) const   return term[0] == 'T';  
 ;
static TagFilter tagFilter;
vector<string> TextSearch::expand(Xapian::Enquire& enq) const
 
    // A Xapian RSet is a list of keywords that can be used to 'expand'
    // the search to show more documents like a set of given ones
    Xapian::RSet rset;
    // Select the top 5 result documents as the 'good ones' to
    // use to expand the search
    Xapian::MSet mset = enq.get_mset(0, 5);
    for (Xapian::MSet::iterator i = mset.begin(); i != mset.end(); ++i)
        rset.add_document(i);
    // Get the expansion terms, but only those that are tags
    Xapian::ESet eset = enq.get_eset(5, rset, &tagFilter);
    vector<string> res;
    for (Xapian::ESetIterator i = eset.begin(); i != eset.end(); ++i)
        res.push_back(*i);
    // Pass the tags to the caller, who will OR them to their
    normal keyword search
    return res;
 

18 June 2007

Enrico Zini: conversation-starter

Conversation starting tool
  1. Run ept-cache info and make sure that the popcon and debtags data sources are enabled
  2. Run ept-cache search -t clean -s t- less
This will show you all packages that are not shared libraries or application data, and will show you at the top of the list those packages that you have installed and other people are very unlikely to have installed. You can use that list in case someone asks you "tell me of the cool packages that you use". If you need to improvise a talk at some Linux event, that list could very easily get you started and talking for hours.

16 June 2007

Enrico Zini: chat-with-bubulle

Chat with bubulle These are a few notes from a chat with Bubulle about package descriptions. Check a description against keywords To see what packages would match certain keywords, and how:
ept-cache dumpavail keyword1 keyword2   grep-dctrl -sPackage,Search-Score .
To check how much a package would match certain keywords:
#!/bin/sh
PACKAGE=$1
shift
ept-cache dumpavail "$@"   grep-dctrl -sSearch-Score -FPackage -X $PACKAGE
Technical details in the descriptions The programming language used to implement the software and the X UI toolit used by the software can also be removed from descriptions: Debtags offer a better place to store this information, and most package managers now show tags together with the package description. Submitting descriptions for review Submitting descriptions for review to the Smith Review Project means posting them to the publicly archived debian-l10n-english mailing list, and that may turn off some. It would also be interesting to change the description template generated by debhelper to mention the Smith Review Project and a link to description guidelines Description guidelines There are various description guidelines that could use consolidation and eventually inclusion in the Developers Reference. For example, Writing package descriptions is a very good guide, but most of the unsolved issues at the end have actually now been solved by the Smith Review Project.

12 June 2007

Enrico Zini: callgrind

Callgrind Not many people who work in C and C++ seem to know this:
apt-get install kcachegrind valgrind
valgrind --tool=callgrind programname
kcachegrind callgrind.out.nnnnn
You can see in what functions the program spent its time, for every function in the program how much time it spent in every of the called functions and all other sort of cool analysis. And it's graphical, interactive, useful, cool. It helps to compile without libtool (otherwise you're valgrinding a shellscript unless you do something like valgrind --tool=callgrind .libs/lt-programname. It also helps to compile with debugging symbols.

11 June 2007

Enrico Zini: libept

libept 0.5.3 hit unstable I prepared a new toy to play with at Debconf and uploaded it to unstable:
Package: libept-dev
Description: High-level library for managing Debian package information
 The library defines a very minimal framework in which many sources of data
 about Debian packages can be implemented and queried together.
 .
 The library includes four data sources:
 .
  * APT: access the APT database
  * Debtags: access the Debtags tag information
  * Popcon: access Popcon package scores
  * TextSearch: fast Xapian-based full text search on package description
 .
 This is the development library.
Package: ept-cache
Description: Commandline tool to search the package archive
 ept-cache is a simple commandline interface to the functions of libept.
 .
 It can currently search and display data from four sources:
 .
  * The APT database
  * The Debtags tag information
  * Popcon package scores
  * A fast Xapian-based full text index on package descriptions
Yes, this finally brings lots of very cool data sources about packages together. Try this one:
# Check if all data providers are active and give instructions on how
# to activate those that aren't
ept-cache info
# Follow the instructions to activate everything
# Show all GUI image editors, sorted by popularity, in reverse order
ept-cache search image editor -t gui -s p-
If you have the Xapian data provider enabled, the results of a search are given in relevance order, the most relevant first. And also, searches are done with proper stemming, so if you look for image editor it will also find image editing, although it would score image editor higher. It's also quite lovely to work with it in C++. I'll improvise here a few examples: Print name and short description of every package
#include <ept/apt/apt.h>
#include <ept/apt/packagerecord.h>
using namsepace std;
using namespace ept::apt;
void playWithApt()
 
    // Apt data source
    Apt apt;
    // Parser of package records
    PackageRecord rec;
    // Iterate all package records
    for (Apt::record_iterator i = apt.recordBegin();
        i != apt.recordEnd(); ++i) 
     
        rec.scan(*i);
        cout << rec.pakcage() << " - " << rec.shortDescription() << endl;
     
 
Show all image editors
#include <ept/debtags/debtags.h>
#include <set>
using namespace ept::debtags;
void playWithDebtags()
 
    // Apt data source
    Apt apt;
    // Parser of package records
    PackageRecord rec;
    // Debtags data source
    Debtags debtags;
    if (!debtags.hasData())
        return;
    set<Tag> tags;
    tags.insert(debtags.vocabulary().tagByName("works-with::image:raster"));
    tags.insert(debtags.vocabulary().tagByName("use::editing"));
    tags.insert(debtags.vocabulary().tagByName("role::program"));
    set<string> results = debtags.getItemsHavingTags(tags);
    for (set<string>::const_iterator i = results.begin();
        i != results.end(); ++i)
     
        rec.scan(apt.rawRecord(*i));
        cout << rec.pakcage() << " - " << rec.shortDescription() << endl;
     
 
Print all package names, sorted by popularity
#include <ept/popcon/popcon.h>
#include <algorithm>
using namespace ept::popcon;
// STL comparator
struct PopconCompare
 
    Popcon& popcon;
    bool operator<(const std::string& pkg1, const std::string& pkg2) const
     
        return popcon[pkg1] < popocon[pkg2];
     
 ;
void playWithPopcon()
 
    // Apt data source
    Apt apt;
    // Popcon data source
    Popcon popcon;
    vector<string> sorted;
    if (!popcon.hasData())
        return;
    // Get all package names in the vector
    copy(apt.begin(), apt.end(), back_inserter(sorted));
    // Sort it by popularity
    sort(sorted.begin(), sorted.end(), PopconCompare(popcon));
    // Print it out
    for (vector<string>::const_iterator i = sorted.begin();
        i != sorted.end(); ++i)
        cout << *i << endl;
 
Search for image viewer, but we don't want to view kernel images
#include <xapian.h>
using namespace ept::textsearch;
void playWithXapian()
 
    TextSearch textsearch;
    vector<string> wanted;
    vector<string> notwanted;
    Xapian::Enquire enq(textsearch.db());
    // This will tokenise the search query into terms, stem them
    // and OR them together in a query.  Xapian will score higher
    // those results in which more ORed terms match, which is what
    // we want.
    Xapian::Query want = textSearch.makeOrQuery("image viewer");
    Xapian::Query dontWant = textSearch.makeOrQuery("linux kernel");
    enq.set_query(Xapian::Query(Xapian::Query::OP_AND_NOT, want, dontWant));
    // Print the top 20 results, with their relevance percentage
    Xapian::MSet matches = enq.get_mset(0, 20);
    for (Xapian::MSetIterator i = matches.begin(); i != matches.end(); ++i)
     
        // The get_data() of a document is the package name
        cout << i.get_document().get_data() << " ("
             << i.get_percent() << "%)" << endl;
     
 

10 June 2007

Enrico Zini: things-not-to-do

Things not to do with lvm and crypto At least as of june, 2007, you should never do this: "...I need some encrypted storage space...":
lvcreate -L1G -n test vgname
cryptsetup luksFormat /dev/vgname/test
cryptsetup luksOpen /dev/vgname/test test1
mke2fs -j /dev/mapper/test1
mount /dev/mapper/test1 /mnt
# ...copy important data to /tmp...
"...oh, I need more space...":
lvresize -L+1G /dev/vgname/test
# cryptsetup resize test1 did not seem to
# work, so why not try this instead:
cryptsetup reload test1 /dev/vgname/test
resize2fs /dev/mapper/test1
Message from syslogd@localhost at Sun Jun 10 13:17:37 2007 ... localhost kernel: journal commit I/O error
"...oh damn. What happened?":
umount /mnt
mount /dev/mapper/test1 /mnt
EXT3-fs warning (device dm-13): ext3_clear_journal_err: Filesystem error recorded from previous mount: IO failure EXT3-fs warning (device dm-13): ext3_clear_journal_err: Marking fs in need of filesystem check.
"...let's check it then...":
umount /mnt
e2fsck /dev/mapper/test1
"...what the hell is going on?":
e2fsck -fy /dev/mapper/test1
"...$ & ! ^ @ $ ( Y ^ Q ! @ % # !!!".

31 May 2007

Enrico Zini: package-descriptions

Writing good package descriptions Thanks to Fathi Boudra, I found the link to "Writing Debian package descriptions". Towards the bottom of the page, it contains an excellent checklist to follow when writing one. This entry is to take a note of it, so that I'll find it when I write one myself, and when I report a bug for a description that could be improved.

Next.

Previous.