Enrico Zini: liferea-summarise
Automatic feed summaries
What do you get if you merge
this and
this?
You get a scary little filter that extract the top 5 keywords from a post
content and adds them to the titles.
Useful titles for all
posts: how about that?
#!/usr/bin/python
# Copyright (C) 2007 Enrico Zini <enrico@debian.org>
# This software is licensed under the therms of the GNU General Public
# License, version 2 or later.
import libxml2, re, math
tokenize = re.compile(r"\W+")
doc = libxml2.parseFile("-")
root = doc.getRootElement()
# Create an xpath context and register the namespaces
xpc = doc.xpathNewContext()
for d in root.nsDefs():
if d.name == None:
xpc.xpathRegisterNs("rss", d.content)
else:
xpc.xpathRegisterNs(d.name, d.content)
# Collect text stats to generate summaries
doc_tokens =
for x in xpc.xpathEval("/rdf:RDF/rss:item"):
res = x.nsProp("about", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
tokens =
for c in x.children:
if c.type != 'element' or (c.name != 'encoded' and c.name != 'title'):
continue
for t in c.children:
if t.type != 'text': continue
for tok in tokenize.split(t.content):
if tok in tokens:
tokens[tok] += 1
else:
tokens[tok] = 1
doc_tokens[res] = tokens
# Aggregate token counts
aggregated =
for d in doc_tokens.itervalues():
for tok, count in d.iteritems():
tok = tok.lower()
if tok in aggregated:
aggregated[tok] += count
else:
aggregated[tok] = count
def tfidf(doc, tok):
"Compute TFIDF score of a token in a document"
tok = tok.lower()
return doc_tokens[doc].get(tok, 0) * math.log(float(len(doc_tokens)) / aggregated.get(tok, 0))
def top5(doc):
# Output the top 5 tokens by TFIDF
return sorted(doc_tokens[doc].keys(), key=lambda tok: tfidf(doc, tok), reverse=True)[:5]
# Rewrite the titles
for x in xpc.xpathEval("/rdf:RDF/rss:item"):
res = x.nsProp("about", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
for c in x.children:
if c.type != 'element' or c.name != 'title':
continue
for t in c.children:
if t.type != 'text': continue
name, content = t.content.split(":", 1)
summary = ", ".join(top5(res))
t.replaceNode(doc.newDocText(name+" ["+summary+"]:"+content))
# Serialize the result
print doc.saveFormatFile("-", True)
Being in Japan has also one great feature - even if you are in same DVD region
as in EU, you are still unable to play your DVDs, maybe because of PAL/SECAM
issue, I don't know. I think it must have been intentionally designed this way.
The hardware player I have here at my room just tells me: Disc Error, Playback
feature may not be available on this Disc. I have no idea what this error
actually means, but I somehow expected I'll be able to play my region 2 DVDs
in region 2 DVD player. Good luck that I still have my laptop with illegal
dvdcss library, where I can play whatever DVD I put into it.
I know this is not real DRM at all, but this has also started as a technology
to limit copying or whatever....
If, like me, you’ve been following development of Joey’s nifty new
Since I never really found a nice overview of which CPU flags (see /proc/cpuinfo) mean what, so I gathered some information using the web, with the most notable sources being the BOINC FAQ entry on CPU Register Acronyms at
Gofernet.net 466395
(or is it gofernet.co.uk? They
seemed confused about that - maybe it's
Jekyll and Hyde, one spammy, one not?)
of Sutton Coldfield
spammed an associate on 5 Oct 2007.
The spam
claimed it was sent to their client list.
That associate is not and
has never been a client of gofernet.
The spam claimed to be "in full compliance with the Privacy and Electronic Commerce Statutory Instrument 2003, No 2426".
I think they mean the
I’m looking for someone to help with
I found it easily,
which gave me a few minutes spare to visit
the co-operative food store on the Centre
(pictured),
which is the first rebranded one I've seen.
It looks light and airy and
the staff were friendly. I didn't find
everything I was looking for, but after
exiting, I noticed I'd not seen around the
corner of the L-shaped store!
Anyway, the meeting itself was chaired by
Peter Begley and was attended by six elected
reps, three regional officers, four trading
managers (all food?) and about 50 members
by my reckoning. There was a comment later
in the meeting about the low turnout from
Bath - it seems that a meeting for each city
had been requested and refused.
There was also a comment about lack of
transport from Weston-super-Mare, about
which I'm not sure: trains between WsM
and Bristol are at least hourly. Maybe
there should be a shuttle between station
and meeting for people who can't walk,
but it seems nuts to run a bus from here
when trains are faster and have space.
Officer
Chris Griffiths gave a presentation (with
loud music!) about our community support,
including windfarms on the co-operative farms,
Farm to Fork, the Woodcraft Folk,
the Queens Award for Sustainable Development,
community chef visits to Ilfracombe and Bath,
community challenge,
Mukti Mitchell's Low Carbon Lifestyle Tour,
Fairtrade fashion shows,
Holyland Handicrafts Co-operative at Bath
Christmas Market,
BAND (D is for Daycare, but I missed the rest),
Toy Box Library Bath,
Avonmouth Community Centre Association
and Oldfield Park Juniors.
Frank Jones presented
So, I finished graduate school at
In the last few days, I have replaced the two 20 inch CRT monitors that I have hardly used the last years with two 20
inch TFT displays, and my company (finally) gave me a 19 inch TFT display to accompany my notebook display at work.
Maybe I should take that as a hint that they want to see me in the office more frequently rather than in my home office
which I generously use these days. At home, I built a “new” computer from mainly used parts to drive the two
20 inchers.
I have learned a lot about X in the last days, but spent too much time with it.
I have been running my Desktop with older X and two CRTs for quite some time, but I hardly ever used it due to the
setup of my now ex-flat. Back then, I learned that the “two monitors, one display, one screen, one desktop”
option of X was called Xinerama and statically configured: You write down your display layout in xorg.conf and it uses
it. Configuration changes mean restarting the X server.
KDE notices Xinerama automatically, designates one monitor the “main monitor” and displays its panel there.
You can move windows from one monitor to the other one, but changing virtual desktops always changes what both monitors
display. This is not really what I want, since I often have “static” contents (news reader, mail reader,
chat windows, help screens etc) on one monitor while I do my normal work on the other monitor, which involves changing
virtual desktops.
So I was rather happy when I learned upon the arrival of the external TFT display for the notebook that you can work
without Xinerama. In that case, the X server comes up with one display and two screens, which KDE uses to display two
independent desktops which can be independently configured, but can both be accessed with one mouse and one keyboard.
For me, this means that I finally can independently change virtual desktops on both monitors, but pay the price that I
cannot display a certain virtual desktop on monitor 1 now, and on monitor 2 in five minutes, and that a window opened on
monitor 1 is never going to be shown on monitor 2 without serious interference. This looked ok for me. Additionally, you
can use different font sizes on the different monitors as defaults, which comes in handy if both monitors are blatantly
different in size (which is the case with the notebook and its external monitor).
However, with that setup, KDE seems to be challenged when it comes to saving the configuration. Some things (such as
desktop background and panel config) seem to save fine, desktop independent, other things (such as open windows and
their position) are lost when the session exitst. My daily visit to Kevin&Kell (which used to be in a browser window
that was saved with my session) has badly suffered since then.
Then, a few weeks ago, somebody talked me into trying the X server from experimental. Which is when my dual-desktop
setup ceased working.
The nice people on #debian-x told me that Xinerama is a thing of the past, and is currently in the process of being
replaced by Xrandr 1.2. The removal of “my” two monitor, two screens, two desktop setup is collateral
damage, and if I still want that behavior, the X.org upstream considers this an issue to be handled by the Window
Manager / Desktop Environment now. Gee, thanks. That’s what I call a regression.
After spending half a day cursing and ranting, and even considering to go back to lenny’s (or even etch’s)
X.org, I finally settled on going with the “new” way as I was going to lose my independent desktops sooner
or later anyway. Again, with the friendly help of the people on #debian-x, I found out about a lot of advantages of the
latest X servers.
In most basic cases, the latest X server does not need a configuration file any more. It autodetects your hardware and
chooses whatever modes it finds optimal. It does a pretty decent job in doing so. If one wants to influence how the X
system comes up, once can always write an Xorg.conf file - the configfileless server even writes the “virtual
config file” it uses to the log as a starting point.
Additionally, almost everything regarding screen layout can be reconfigured at run time using the xrandr binary from a
command line. Even a hardware change (such a new monitor plugged into the powered on notebook) is correctly detected.
Cute. This allows me to reconfigure my notebook depending on where it currently is and which external monitor (or
projector) is connected.
This can be perfected if I find out whether X offers a hook to plug a reconfiguration script into that is called when
the X server starts or when the system is waking up from standby or hibernation with the X server running. A lot to do,
and great potential for elegant stuff.
However, while I am talking about hibernation, this is a downside of the new driver: When the system wakes up from
hibernation, the X server sometimes confuses itself enough to become nearly unuseable: I had it become psychotic when
plugging in the external monitor (which can do 1600x1200 points) after waking it up from hibernation at the office. The
internal display can only do 1400x1050, and the box thought that the external monitor only had 1050 y axis pixels,
displaying bit garbage in the lower part of the big monitor, and showing a useable, but unintelligible panel. When
opening any browser or any other application with considerable text amounts in the window, all fonts become unreadable
once one scrolls down. Restarting the X server helps and everyting is fine. But I do not use hibernation to force myself
to log out of X after waking up. After going back to the “one monitor mode”, the X server now thinks that my
virtual desktop is 1600x1200 and only shows 1400x1050, with dead space at the right and lower side of the virtual
desktop. xrandr does not allow me to reisize the FB below 1600x1200. No idea what’s going on here.
In most of the cases, calling xrandr --auto for each output will fix the issues at run time, but sometimes a session
restart is needed. Code needs to stabilize quite a bit before becoming useable in production.
There are a few disadvantages that will remain: Both monitors will change their contents when the virtual desktop is
changed, and both displays will use the same default font size (which might be inappropriate if both displays are of
different size). But I think, when the issues are cleared up, that I can live with these disadvantages.
The “new” desktop system that I built has a Matrox G450 dual head graphics card, and unfortunately, the
Xrandr 1.2 enabled X server from experiemental has shown to be unuseable: Upon some mode changes, the X server goes into
an endless loop and proves itself to be unkillable short of SIGKILL. And if it dies, it sometimes pulls the entire
system with it. There is a corresponding
One of the common criticisms of the war in Iraq is that it was just an excuse to plunder that nations' oil. Of course
After a very short meeting, the DebConf team agreed on having the next DebConf
the first two weeks of August. That will be August, 2nd to August, 17th. Also,
the Debian Day will be held after DebConf in Buenos Aires, just before the
eigth edition of the Regional Free Software Conference, a very big event with
people coming from different countries in South America. This way, we expect to
reach much more people.