Posts for Saturday, August 28, 2010

Migrating to XMPP/Jabber (and AIM woes)

Alright, so I've decided to finally drop proprietary IM protocols.

To some extend because promoting free software and open standards while at the same using proprietary protocols of companies that don't respect your privacy is a bit, well, let's be honest, hypocritic. On the other hand though because I've increasingly grown fed up with WLM/MSN/ICQ/YIM/AIM, their quirks and the inability to provide me with what I want.

I've already stopped using YIM and AIM with the rest following soon. What I've learnt from this so far is how very scary proprietary IM actually is. Since (for now) I still use Yahoo as my spambox e-mail provider, I just disabled the messenger component and it was very simple.

But when I tried to delete my AIM account, stuff got difficult. Brace yourselves, this gets pretty ugly! First of all, the general AOL's idea on how to "cancel AIM" is "just stop using it". The second odd thing is that they have more then one official help/support portal (yes, portal. it's big!). That being said the official help I found on how to cancel an AOL account was that if you're a paid customer, it's just a click away; if you're a sad sap who got the free account only to communicate to some other bloke on AIM, ...weeeeeheeheheheeeell, then it depends, maaaaaybeee you can delete it, maybe you can't. As luck has it, in my case (and in case of many people out there) my free account doesn't allow me to cancel it. A quick search on the aforementioned help portal says it could be because I have a child account. Which is kinda odd, since a child account, as I understand it, is a subaccount made by an adult person with their own full account and I can remember registring my account while already full age. Setting the problem aside that AIM just called me a bastard (= a parentless child), the problem stays that I cannot cancel my account. Of course, live (= phone, e-mail etc.) help is only available to paid customers. Well, I'm cooked there. I searched the web a bit and found out one of many self-help groups which lists a few solutions. For now I'm trying the contact-AOL-UK-and-hope-they-comply method, but if that fails — people report it fails more often then not — they go so far as to suggest to break AOL's ToS and wait for them to suspend your account and then not log in for half a year. ...bloody hell!?!?! The only half-way sure way I can get my AOL account removed is by contract breach?!? That alone should send shivvers down anyone's spine! And people are wondering why I'm against such things.

Below is the notice I'm sending to people on my contact list to explain why I am migrating and informing them of the benefits the XMPP protocol brings:

This is just a friendly notice that I'm leaving <insert_proprietary_IM> (and other proprietary IM protocols). If you want to keep in touch via instant messaging you can add my XMPP/Jabber ID to your contacts: matija [döt] suklje [ät] gabbler [døt] org or you can always send me an e-mail at matija [æt] suklje [doŧ] name.

There are many reasons why I'm switching to XMPP (Jabber) and here I'll list just a few of its advantages.

XMPP is:

  • open standardXMPP is the only IM protocol that is an internet standard and it's free software as well, so anyone can use, adapt or write from scratch their own XMPP client, server or other program that uses it.
  • decentralised — so it doesn't matter on which server you are, you can always keep in touch with people on other servers, as is already true with e-mail (e.g. if you have GMail, you can just add my Jabber ID to your contacts, since GTalk is just Google's XMPP server); this also means you can chose any server you like best or even build your own and you won't lose the ability to chat with your friends. So you're not locked to just one provider.
  • extensible and flexibleXMPP stands for Extensible Messaging and Presence Protocol, so you can easily use it to provide additional functionailty. E.g. people already use it to (micro)blog, get news and status updates, issue commands to remote computers, collaborate, play games over it and all sorts of stuff.
  • security — the protocol itself uses industry-standard TLS and SASL for security and many XMPP servers pledge to never log your what you chat. That is not something you can expect from proprietary IM like MSN/WLM which stores whom you chatted with and what eternally (sic!). This is also a reason why even though you can use GTalk, I would advise you to chose a server that expects your privacy — Jabber.org and Gabbler.org are such examples, but there's many more. And since you can always build your own, you can be in complete control of your own data.
  • can communicate with other IM — if you desperately need to use other IM protocols, you can just tell the XMPP server to forward the messages to and from your other IM accounts.

Well, that's it from me. If you decide that a) this sounds good; or at least b) you'd like to keep in IM contact with me, here's a (non-complete!) list of XMPP servers where you can make your account: http://xmpp.org/services/ (Jabber.org is the oldest and most popular); and add me: matija [döt] suklje [ät] gabbler [døt] org

There is also a great number of clients (programs to connect to XMPP) you can use: http://xmpp.org/software/clients.shtml (I use Kopete, but chose whichever you like best; there's even web-based clients if you're in a cybercafe)

In case you got really excited about it, you can also run your own server: http://xmpp.org/software/servers.shtml

Cheers and hope to chat with you someday again,

Matija "hook" Šuklje

If anyone has done or plans to do a similar move, I'd be happy to hear about your experiences.

hook out >> hmmm, tea with honey's nice, but sadly honey usually overpowers the delicate taste of tea
<!--break-->

An unwinnable battle

For as long as I follow discussions and event around the internet and similar technology (networked databases, datamining &ct) the topic of privacy has been quite dominant (especially here in Germany!). Privacy itself is not a new concept, we’ve had the option to put curtains in front of our windows for a while now, we could close our doors and we could decide who to share our holiday pictures with. We had a lot of privacy and whenever a government agency or other entity was stepping in to rob us of it, there were complaints, demonstrations and public disobedience.

Now with the Internet being very dominant in many of our lives, the discussion of privacy comes up almost weekly: Facebook, 4Square, Google Street View … we could go on for ages here and list all the different “Privacy Disasters” we’ve had in the last year or so. But lately I’ve come to the conclusion that it’s a battle that cannot be won. Why? Because we’ve said it for years now, just in a different context.

Let’s step away from privacy and look at a different topic: DRM. DRM stands for Digital Rights (some say Restriction) Management, DRM is what tries to make copying a DVD or a video game not simple, DRM is what locks you out of the music you bought when you buy a second computer. What DRM does is (quoting Cory Doctorow here) “trying to make bits harder to copy” and as Cory so precisely nails:

There is no such thing as a copy-proof bit. There aren’t even copy-resistant bits. Copying is what bits are for. They will never, ever get any harder to copy.

If you want people to be able to listen to something at home, or watch something at home, you lose control over it. There are always ways to intercept data and copy it, even if you think it is encrypted, take a video file for example: Let’s say you encrypt it with a secret key so people can only play it after having contacted your servers and authenticated to get a key to unencrypt it. That’s safe, right? Except for the fact that at some point the data has to be decrypted to be playable on some sort of screen and at that point somebody can intercept it and save the unencrypted data. Even if you move the encryption to the TV, people will just start soldering a few contacts in and get the data some other way or they’ll use cameras to save the image. And yes, the quality suffers, but when I was young and we copied CDs for each other we used tapedecks and it was good enough. Quality loss will stop some people but not most of them.

So we just established that DRM does not work, right? It inconveniences only the “honest” people because the “dishonest” people rip the content out of its DRM-cell anyways (That’s why even people who buy a game use NoCD Cracks and other piracy-related technologies: They make using the product easier!). Now comes the problem: What we want as only privacy is just another layer of DRM, just that this time we are the guys asking for it.

Of course there always is the way of the luddite: We call all this fancy internet stuff crap and do not use it, we don’t publish our data here, we do not post our pictures, we just stay out of it. The problem is: When it comes to personal data you are not the only one that can enter it. If I put up a photo of me and a few friends on the internet and put a text with each person’s name next to it, all those people now have a part of “their” private data public (Remark: I don’t believe that you can own data, not even personal data). So keeping private data private means not just making sure that you are not leaking it, but also making sure nobody else leaks it. What happens if your bank has a data leak and your whole account data is online? There nothing you could have done, it’s not your fault but your data is public. And the net does not forget. The bits will have been copied and you will never get them back. All you can do is try staying ahead in the race and switch banks to get a new “private” account. Until that bank has a leak.

But most of us are no luddites: We enjoy putting stuff online. When me and Annette moved I took some pictures of our new house so I could send the link around to family and friends who don’t live in Oldenburg, I wanted to share something with others and the internet (and it’s great ability to copy bits!) made that easy for me. Now let’s make an experiment based on this.

People talking about “data ownership” would say that we need technology where we can say: “Only these 6 people can view these pictures.” This way we could use the internet to share data but keep privacy intact. Cool. So how do I make sure that one of those people does not save the image and uploads it on Facebook saying “Look what house my friend tante got!”? Do we really want to pretend that in this case where we want DRM for ourselves it would work?

“Privacy” as a concept has the same issues that “property” as a concept has when being transferred from the real into the online world: Property does not work because you can make indistinguishable copies without cost so the idea of scarcity that property is based on fails. Privacy is an idea based on control and especially on the internet where everything is virtual and easy to copy control is impossible.

Back in the days you had a photograph and would show it only to people you wanna show it to. I they tried making a photo of your photo you would see that and could intervene. A JPEG does not give you that control, if somebody except you has seen it you can assume the data to have leaked (at least you cannot guarantee that it didn’t if you didn’t turn the virtual data into a physical thing by forcing people to copy to your place and having them look at it on your screen).

DRM does not work. It does not work to make copying video games impossible, it does not work to keep movies from being copied online and it also does not work to keep your data private.

Posts for Friday, August 27, 2010

Paludis 0.54.2 Released

Paludis 0.54.2 has been released:

  • Upgrading from older versions to 0.54.1 would produce strange errors. This does not happen for 0.54.2.
  • Blockers and uninstalls for chroots are now handled.

Filed under: paludis releases Tagged: paludis

Paludis 0.54.1 Released

Paludis 0.54.1 has been released:

  • User-defined cave commands are now passed all command line arguments correctly.
  • ‘cave show’ now has ‘–description-keys’, and ‘cave search’ uses this where appropriate.
  • Paludis key=value configuration files can now use ‘$ENV{FOO}’ to refer to an environment variable.
  • output.conf can now set log_path, and user defined output managers will now override builtin output managers with the same name.
  • When running in ‘quiet’ mode, status messages are now shown.
  • Warning and error messages are now shown at the end, along with info and log messages.
  • The ‘tee’ output manager handler now has ‘stdout_children’ and ‘stderr_children’ for only forwarding stdout or stderr.
  • Where supported, ‘fallocate’ is now used when merging files.
  • Where supported, dirent->d_type is now used to reduce the number of stat() calls that are made.

Filed under: paludis releases Tagged: paludis

Posts for Thursday, August 26, 2010

avatar

PixieLive

A friend of mine, Christian, has released PixieLive, a slax based live linux distro build with gentoo.
It’s one of the few live distributions that support Intel GMA500, popular on netbooks like some Asus EEEPC.

PixieLive

avatar

Audio transcoding in bash

A proper transcode must have a lossless audio format as a source, a good one is flac ,stands for Free Lossless Audio Codec, because it does the job well and has a good licence ( BSD and GPL ).

If you have some flacs and want them in mp3 format (you need lame and flac) you can use this one liner:
for FILE in *.flac; do flac -cd "${FILE}" | lame - "${FILE/.flac/.mp3}"; done

the above line decodes every file that ends in .flac to the standard output (screen) and pipes it to lame that will encode it. “${FILE/.flac/.mp3}” will be the output file, in bash that means: take the variables “$FILE” (that is the original filename), remove “.flac” and substitute “.mp3″.

Nowadays I transcode quite often to 320 kbit/s constant bit rate (CBR)

  • achieving the best quality for an mp3 and still being highly portable, some players don’t like variable bitrate of high quality ( like the V0 preset)
  • doing something unefficient since mp3 is not a good codec for that quality but if your stereo reads just mp3 you don’t have any choices

I simply need to use lame with the proper switches , the above one liner becomes:
for FILE in *.flac; do flac -cd "${FILE}" | lame --cbr --preset insane - "${FILE/.flac/.mp3}"; done

To rip my compact discs and encode my music in flac I use a program for windows called Exact Audio Copy (EAC), my Wine build doesn’t like it for some reasons and Virtualbox has historical problems in handling cdroms correctly, the solution was VMWare. The native solution is RubyRipper

Posts for Wednesday, August 25, 2010

avatar

Added “iw” support to Linux Sea

The wireless driver developers are actively working on a new wireless toolset called “iw”, slowly deprecating the older wireless-tools toolset (which contains the “iwconfig” command). Kasumi_Ninja reported to me in the Gentoo Forums that it would be nice to add information on iw to Linux Sea, so I did. I must admit though that my systems don’t (or hardly) support iw, so I had to be lead by examples throughout the Internet.

Apart from the iw addition, I’ve reorganized the sections on Software Management as it was becoming too crowded. I’ve also started a ChangeLog for those who want to track the changes to the document.

Now if anyone can recommend me a good spell- and grammar checker…

avatar

cvechecker 0.4 released

Albeit with less updates than 0.3 had, cvechecker 0.4 brings in internal project files reorganization (more to the liking of the GNU autoconf/automake standards – I think), fixes a databaseleak (instead of memoryleak ;-) bug and introduces a teenie weenie bit more intelligent pullcves command (with multiple return code behavior to improve automation efforts) as was mentioned in the feature request list. All documentation is also updated and a pullcves manual page has been added.

avatar

the "Community Contributions" section on the Arch Linux forums is a goldmine

The Community contributions subforum of the Arch Linux forums is awesome.
It is the birthplace of many applications, most of them not Arch Linux specific.
File managers, media players, browsers, window managers, text editors, todo managers, and so on. Many shell scripts, urxvt extensions and dwm patches aswell.
Most of the apps are designed after suckless/KISS principles, but there are also some GUI programs.

If you like to discover new apps and tools, check it out.

avatar

Using PlayOnLinux to run applications already installed by vanilla WINE.

RTS is an acronym for real-time strategy. It’s a game genre. There’s a classic RTS game known as StarCraft. Although only a casual gamer (say, might I recommend Machinarium?) I have played (and somewhat enjoyed) a few more "hardcore" games – like for instance, StarCraft. Although being pretty pathetic at it, I did enjoy it and appreciated the balanced strategy between the various "races" you could control in the game. With StarCraft II already out (hell, it’s about time!) I decided to revisit the original StarCraft: Brood War game to refresh my memory.

I downloaded the game from Battle.net, installed the latest version of WINE (1.3.0), ran the Blizzard downloader flawlessly, ran the installer flawlessly – and true to its Gold ranking on the WINE AppDB, ran the game flawle- no wait. It was laggy. Not particularly laggy. But it wasn’t as fast as it should’ve been, and too many critters on the screen would make it choke. I tried all the lag-fixes suggested on the AppDB submission to no effect. It was a sort of phantom, website-loadingish lag.

However one comment on the AppDB page said that using PlayOnLinux to install WINE 0.9.14 to run StarCraft fixed all lag issues. I decided to give it a shot. Turns out any version below 1.0 is no longer supported (as any sane developer would do) and no longer available in portage. PlayOnLinux was, however – and PlayOnLinux did still allow WINE 0.9.14 to be installed. Unfortunately it wasn’t particularly intuitive to tell PlayOnLinux to run my installed .exe file with WINE 0.9.14, so perhaps this blog post might help others in my situation. Using these steps I was able to install a prehistoric version WINE via PlayOnLinux, and tell it to run the already installed version of StarCraft on my computer:

  1. Install PlayOnLinux, Tools -> Manage wine versions -> install v0.9.14. Should be straightforward.
  2. mkdir /home/username/.PlayOnLinux/wineprefix/starcraft && env WINEPREFIX=/home/username/.PlayOnLinux/wineprefix/starcraft wineboot
  3. cp -r /home/username/.wine/drive_c/Program\ Files/StarCraft /home/username/.PlayOnLinux/wineprefix/starcraft/drive_c/Program\ Files/ (or mv it, doesn’t make a difference)
  4. touch /home/username/.PlayOnLinux/configurations/installed/StarCraft
  5. Place the following in the StarCraft file:

#!/bin/bash
export WINEPREFIX="/home/username/.PlayOnLinux/wineprefix/starcraft"
export WINEDEBUG="-all"
cd "/home/username/.PlayOnLinux/wineprefix/starcraft/drive_c/Program Files/StarCraft"
wine "StarCraft.exe" $@

And that’s it! Run PlayOnLinux and you’ll be able to run the program from there. This guide should be able to work for other scenarios as well so feel free to adapt it.

Oh, and as for the lag? Yep – oddly enough it did get completely fixed. Regression time.

Related posts:

  1. Top 10 Windows Mobile Applications
  2. A scalable and adaptable standardised user file structure?

Posts for Tuesday, August 24, 2010

avatar

I remain impressed by the free software community

My current personal projects, Linux Sea and cvechecker, are actively being watched by the free software community. For the Linux Sea book, I get nice feedback and ideas on the Gentoo Forums and on the cvechecker application, people such as Nigel Horne are helping out in various ways – including feature requests of all sorts.

I must admit, I remain impressed.

Small changes have already been squeezed in in the Linux Sea document. A larger change (the use of the iw tools for wireless connectivity) is being investigated (sadly, my broadcom-sta device doesn’t support the new nl80211 API so the documentation change is slower to integrate than expected). I’m also planning to make some updates on the software management chapter as it is currently becoming quite crowded.

In the cvetool, most changes are bugfixes and output enhancements as expected. I’m not going to add more functionality now – I first want to get a stable 1.0 release out there. But first continue to squash bugs and add rules to the versions.dat file so that it is usable on various systems (release 0.4 is around the corner).

Paludis 0.54.0 Released

Paludis 0.54.0 has been released:

  • ‘cave resolve –remove-if-dependent’ will now cause dependent packages to be removed from world, if no versions remain.
  • ‘cave resolve –make’ now defaults to ‘chroot’ when the environment’s preferred root is not ‘/’.
  • ‘cave display-resolution –show-option-descriptions’ now works as documented.
  • ‘cave fix-linkage’ may take multiple ‘–library’ arguments.
  • New ‘cave’ subcommands: ‘report’, ‘print-id-environment-variable’.
  • ‘cave print-’ commands are now consistent in handling ‘–all’ / ‘-a’ and ‘–best’ / ‘-b’.
  • ‘cave show’ will now always show keys specified by ‘-k’, even if those keys are internal-only or complex.
  • ‘cave search’ now takes an optional SQLite index, which can be created using ‘cave manage-search-index’.
  • ‘cave search’ now has a ‘–visible’ option.
  • The ‘importare’, ‘inquisitio’ and ‘reconcilio’ clients are now deprecated in favour of ‘cave import, ‘cave search’ and ‘cave fix-linkage’ respectively.
  • Output managers and output.conf are now documented features, and a new ‘command’ output manager handler was added.
  • Hooks are now run using an output manager, where appropriate. The API for .so hooks has been changed to allow this.
  • The demo hooks have been removed, since none are particularly useful with ‘cave’.
  • ‘cave’ now has a global ‘–colour’ option, and coloured output is disabled by default when outputting to a non-tty.
  • The output format for certain cave commands can now be tinkered with by the user. Use ‘cave dump-cave-formats-conf’ to create ~/.cave/formats.conf and then edit as desired.
  • The way sub-programs are executed has changed to be somewhat less convoluted.

Filed under: paludis releases Tagged: paludis
avatar

The Principle of Least Surprise

An oldie but a goodie.

When you write / design / create, be it a building, a program, a document or something else, try and think what reaction would cause the least amount of surprise to some input (eg. if you walked down a hallway and came to a dead-end, you would probably be surprised, ergo don't design dead-ends into hallways for no reason).

Why then, does the Windows XP "ctrl + alt + del, u" always shutdown straight away, unless there happen to be 50 updates waiting to be installed?  Now I'm stuck waiting for half an hour with a dead computer, because the shortcut I always use to shut down has changed from "shut down now" to "install updates and then shut down".

Posts for Monday, August 23, 2010

avatar

Review of "Python 3 Object Oriented Programming"

Dusty Phillips, Arch Linux shwag guy, Archcon co-organizer, (python) consultant and since recently buddy of mine wrote his first book: Python 3 Object Oriented Programming.

I got the opportunity to get a free pdf copy in exchange for a review on my blog, so here we go.
Mind you, my Python knowledge is very limited. I have done some python programming, and I once read (most of) Dive into python, but over the years that experience has vanished from my memory. Dusty's book has had many proofreads/reviews by python-aficionado's, now it gets a fresh perspective from an amateur, and for me this was a good opportunity to work on my python skills.

To paraphrase the "who this book is for" paragraph, which is in the beginning of the book and in online advertisements for the book:

  • people new to OO programming and people with basic python skills who want to improve their python OO.
  • OO programmers experienced in other languages who want to get into python.
  • python 2 programmers interested in learning python 3, although this is not the target audience.

Good, that includes me (category 2)

Pro's:

  • seems very accurate
  • OO focused. But not in a college/university-ish way. Real experience, nuanced, real examples and exercises. Tells you when *not* to use OO. Teaches you the difference between object orientation, OO programming and OO design, and makes you understand that in the end everything are just means to end, and thanks to the versatility of Python, teaches you various tricks to implement certain designs in less then obvious ways.
  • Chapters about design patterns (there sure are many of them), testing, libraries, and some other topics not directly related to OO.

Con's:

  • Not an introduction to Python. Assumes some basic knowledge about Python. (like data structures and loops). There is a chapter about (some of the) datatypes later on in the book but it focuses more on their OO nature, and to get to know the basics, you're referred to the official python tutorial.
  • Does not cover *everything*.

I should clarify my last point. Here and there I found some information to be lacking. Especially static class methods (they are only mentioned very briefly in a case study somewhere) and static properties/variables.
Other then that, sometimes an example or explanation was not entirely clear to me. This didn't happen often, but there were moments where I thought 95% of what you need to know is explained, but the other 5% you have to google up yourself.
It is quite convenient however, to have the author of a book available in your jabber client.
So FWIW here are the things I asked him about and which responses I got, with some comments added by me afterwards.

  1. <Dieterbe> hmm you mention that methods *need* a self param, but why is this?
  2. can't python automatically make a variable self available in the scope of the function, when calling it?
  3. <Dusty> no, they are always explicit
  4. <Dieterbe> but why?
  5. <Dusty> it's part of the python philosophy, I guess. "explicit is better than implicit" is in the zen of python poem.
  6. Basically, if you are accessing a variable in any namespace, that variable has to be have been made explicitly available in that
  7. namespace. The one exception is the from X import * syntax, which 98% of python programmers avoid exactly because of the namespace issues.
  8. <Dieterbe> right
  9.  
  10. # good to know. Too bad this isn't really mentioned anywhere.
  11.  
  12.  
  13. <Dieterbe> i don't quite get why - in your notebook example of chap 2 - you iterate over the list to find the correct note based on its id.
  14. can't you just get the element based on it's index in the list? (ie keep the node id in sync with the index in the list)
  15. <Dusty> I don't have the code in front of me, but I suspect that it's because if a note is deleted, that id should not be recycled and applied to another note.
  16. <Dieterbe> but still, since you keep the last used id, and keep increasing it, you won't recycle id's.
  17. <Dusty> yeah, but the index in the list will change
  18. <Dusty> when you delete #4
  19. <Dieterbe> oh
  20. <Dusty> the object with ID 5 becomes the object at #4
  21. <Dieterbe> thanks buddy
  22. <Dusty> no problem. :)
  23.  
  24. # again, makes perfect sense. But if you don't know the ins and outs of the datatypes, you're on your own.
  25.  
  26. <Dieterbe> i had a question about your example for the decorator pattern.
  27. you use a socket and then you have 2 decorators that implement a send function which do some stuff (logging and what not)
  28. but also the actual sending on the socket
  29. <Dieterbe> and you mention you can have multiple decorators on the same object. but since each decorator also does the sending on the socket,
  30. doesn't that mean the sending happens multiple times?
  31. <Dusty> no, because the first decorator is decorating the second decorator
  32. <Dusty> which is decorating the socket
  33. <Dieterbe> ah yes you're right. and although you did not specify it like this in the explanation text, it should be clear from the code.
  34.  
  35. # If I would have looked better at the code I would have figured it out.
  36. # I just assumed something had to be wrong, I'm too used to the way 'behaviors' are implemented in CakePHP.
  37.  
  38. <Dieterbe> one last remark i have about the book: i couldn't find an explanation of static variables/properties.
  39. i did see a very short mention of static methods in the case study at the end of chap 3, i would have expected to have that info a bit more
  40. prominent, in it's own subsection or something
  41. <Dieterbe> especially because you use static class methods a few times throughout the book
  42. <Dusty> I had a long section on them and ended up removing it because the chapter was too long and one of my reviewers suggested that they aren't very good form in Python.
  43. <Dieterbe> hmm. i see

The writing is pretty informal, and here and there you'll find a subtle reference or joke. But of course that's not what you buy this book for.

Conclusion

I would say the "who this book is for" part is a bit too optimistic. You won't learn Python (3) from scratch by only using this book. It's not a book restricted to mere OO subjects (in python), but neither does it cover all basics of the Python language.

So if you are a python newbie, I would probably recommend you 'Dive into python'. It's free, covers the basics, but doesn't contain so many real life examples.

If you want to know more about OO in python, design patterns, some real life examples and techniques, or advice from a pro, then I definitely recommend this book.

Free chapter: Chapter No. 7 – Python Object-oriented Shortcuts

Posts for Sunday, August 22, 2010

Tomboy sync and Ubuntu One

I love tomboy. I drop tons of my ideas into it. And plans. Lists. Anything on my brain. The problem is as soon as I have more than one computer, like now with my netbook and laptop, all my thoughts are split in half. Ever since tomboy hit the scene years ago I've loved it but also known it needed synchronization to be the best and truly useful to me. I've only had sporadic luck with the sshfs sync. It worked last year. Now it doesn't.
Anyways, I finally couldn't stand it any longer and decided to sign up for an Ubuntu One account that goes with the Ubuntu Web Sync plugin shipped with Tomboy on Ubuntu. I'm not normally one for web services, I like to roll my own where I can (email, jabber, blog), but here since sshfs sync wasn't working and snowy (tomboy online) is pre alpha, I didn't have a choice.
(Actually, in hindsight I realize I could have tried and been using sync to local folder and placed that in my DropBox, whoops)
Anyways, it was painless and now my notes are synced to the cloud and my brain is healed. So thank you Ubuntu. I'm not a huge fan of proprietary solutions but no one else has a solution at all, so you win by virtue of just shipping. (Of course this isn't exactly a multi platform approach, I just thankfully only run Ubuntu on my laptops right now. A few years ago when I ran Gentoo on desktops/laptops this would have been a no go, and Dropbox would have probably floated to the top of my mind sooner)
Let that be a lesson to the rest of you, ideals are good, but solid options are better.

I need to get back into blogging, but like so many others, twitter has been eroding at that. We shall see.

gentoo mp3 tag editor

I just spent 20 minutes trying to find a good console-based mp3 tag editor in gentoo, and was surprisingly fruitless in doing so.

After using the wonderful "equery belongs" command tied to an editor I use on my server (but couldn't remember where it came from), the program mp3blaster came up.

Although mp3blaster claims to just be an mp3 player, it comes with an incredibly simple program called "mp3tag" which tags mp3s just fine.

So...  emerge mp3blaster, and then use mp3tag for tagging goodness.

Posts for Saturday, August 21, 2010

avatar

Fail2ban and postfix sasl

Today I found the usual chinese trying to get in my smtp to send his spam to the world and I realized that fail2ban wasn’t working because the regexp used to match the offender is wrong.

This is the log entry (/var/log/mail)
Aug 21 22:45:30 myserver postfix/smtpd[12071]: warning: unknown[xxx.xxx.xxx.xxx]: SASL LOGIN authentication failed: authentication failure

and this is the regex that work , just remove the part after “authentication failed” (/etc/fail2ban/filter.d/sasl.conf)

failregex = (?i): warning: [-._\w]+\[<host>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed

Test it:
fail2ban-regex /var/log/mail.log /etc/fail2ban/filter.d/sasl.conf

if you are on a slow server or on a big mail server use /var/log/mail.err instead

Posts for Friday, August 20, 2010

Hacked my Drupal into acknowledging Flattr

Well, I'm not very proud of it, but I got the Flattr button working somehow. I've added the static button to the theme's template, so it shows on every node.

OK, technically it's not pretty, but to be fair, my current Drupal install isn't either (that's also the reason why Drupal's Flattr module doesn't work for me in the first place).

Can't wait for Drupal 7 to come out, get myself a PlugComputer and migrate to it.

...actually can't wait until I get that done, with the state of my DB this should be quite an ugly ordeal :\

hook out >> taking a nap to cure the headache, then working on a text to finish my application for that legal counselling job
<!--break-->

Posts for Tuesday, August 17, 2010

Emacs undo trees

I've said it before: undo in Emacs is horrible. On the other hand, undo in Vim is awesome.

But this is true no longer. Now there are undo trees for Emacs! Yes, this news is so important I had to italicize and bold it. It's like Emacs has been punching me in the face for years, and today I got it to stop. I never thought I'd see the day.

And it works great too. You can even view the tree visually and navigate it with the cursor keys, which is a step up on what Vim offers out of the box.

Emacs undo trees

In other news, Vim 7.3 is out and it now has persistent undo across reloads. It's like an arms race, and gleeful hackers reap the benefits.

avatar

Non-obvious, Unannounced Gentoo Update

I’m not too happy the devicekit-power package has become unsupported but still remains in the tree as stable, with not even a word in elog or similar. This package depends on libusb:0, which has some pretty unfortunate bugs, resulting, at least for me, in power management only half working. I praise the developers of GNOME yet again for solid code writing that chugs along and still recognizes my battery and other things despite crashes like this.

It’s pretty easy to update and move on. Simply run emerge -1v upower and portage will handle the transition.


Posts for Monday, August 16, 2010

avatar

cvechecker 0.2 released

I’ve made version 0.2 available of cvechecker. It fixes some build warnings and also supports the normal “make install” step. The pullcves command now also pulls in the latest versions.dat file. Special thanks to Per Andersson for reporting that the ./configure didn’t fail if sqlite3 or libconfig wasn’t available – that should be fixed now as well.

In my Gentoo overlay, cvechecker-0.2.ebuild has been put available. Thanks there to webkiller71 for helping out with a more sane approach to cvechecker-0.1.ebuild – I hope I didn’t screw up his changes in 0.2 too much ;-)

Public Infrastructure

The picture you see on the right was taken a few days ago in our “new” house. We recently moved into a new place and the house we rent now was build in 1865 so the neighbors gave the owner this picture when he bought the place (a few years ago). It shows the house how it looked around 1955 and aggregates all the different owners and how the house was build and whatnot. I am not a historian but it is kinda neat.

In Germany we’ve had some discussions about Google Street View. Many people complained how a private company could do that and how it was a huge invasion into people’s privacy, especially considering how Google makes its money selling advertising and considering how good and effective Google is with crossreferencing and linking data.

The other side of the argument supported Google, pointed at the fact that those are just pictures (and you can get your house removed). This argument focuses on the possible uses of this neat technology.

Now I don’t want to rehash the whole thing (in fact I don’t really wanna link anything because most posts and texts about the whole discussion are borderline retarded, but I want to bring us to stand back and look at what’s really happening, apart from all the recent “Google hate” we’ve been seeing here.

Step one. Let’s restate what we can consider “fact”.

  1. Taking photos is somewhat of a touchy thing, people and license plates etc should be anonymized.
  2. Google will use the whole thing to profile its users better, to sell more ads and make more money.
  3. The service can be really useful (for navigation, to estimate an area you think about moving to etc).
  4. The problem is not only Google, we wouldn’t trust the government with that kind of data either.

Step two. Let’s analyze some further thoughts.

  1. Many of the direct privacy concerns can be deal with through technical means (i.e. anonymizing people’s faces and stuff). While any software will make mistakes, it still is good enough and the errors can be fixed quite simply by the community.
  2. We don’t want all that data in the hands of an entity that has interests that might go against ours.

Step three. Let’s draw conclusions.

  1. We have to forbid untrustworthy entities from gathering that kind of public data.
  2. We need a trustworthy entity to provide that kind of data in order for the public to benefit.

All those complaints about the bad bad Google or the bad bad Government are not without merit. In fact they do have a lot of weight: Google could take that data and close it off at any given time. And just cause they publish anonymized data does not mean that they won’t use the unfiltered images for something shady in the background. But should that mean that useful services shouldn’t be implemented?

As we have also seen, many people don’t trust “the government”. I wouldn’t either. Because it’s my job to always check on my government to see that they ain’t breaking the rules for the simple reason that we are the people which makes us boss.

So with the government dropping out of the equation and profit-oriented organizations also not sounding all too pretty there can be only one conclusion: We need to find ways to have non-government, non-profit organizations handle that kind of stuff. They can provide the data in a form that we can consider “clean”. They can also provide it for free. But the crux of the matter is: Right now we lack a framework to really finance that kind of endeavor.

Money for big projects that might help the public either comes from the government or from companies. And if you start pissing those off by not giving them what they want, you will find yourself without funding quite quickly.

If there’s one thing we can learn from the whole Google shebang it’s that right now we have no way to publicly fund infrastructure in a reliable and independent way. That’s what should scare us, not that Google’s engineers decided to kinda “fix” the situation.

Think of how much historians in 20 years would thank us for a yearly updated OpenStreetView that would allow them to analyze and show how a certain area changed. We need to find way to fund those infrastructure projects and we better do it fast. Because when those things are all privatized I don’t see a big push for an independent solution pick up any steam.

People care about things working. They want to get something done and if something gets it done good enough that’s fine. The whole license and freedom angle that some people (like me) might support does not interest many people in the least. Wikipedia (or maybe better WikiLeaks) are somewhat good examples for what we want: Independend data providers that allow people to get something done. But how can we get those projects funded?

creating c++ classes using python scripts

motivation

lately i had to create 31 classes( 31x .h and 31x .cpp), that is 62 files. i thought about doing that with Qt itself but i think this can be done much more elegant with python.

what i like most about python is the string handling using “”" and “”". this is very nice as one does not have to escape much. it’s basically copy’n'pasting the code and the places the script should replace some string names are altered using a $ sign.

the script

#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import os
import string
from string import Template

modules="""
Utils NoiseMapBuilderPlane      1 0 0
Utils RendererImage             1 0 0
Utils Image                     1 0 0

Generator Perlin                0 0 1
Generator Billow                0 0 1
Generator RidgedMulti           0 0 1
Generator Checkerboard          0 0 1
Generator Const                 0 0 1
Generator Cylinders             0 0 1
Generator Spheres               0 0 1
Generator Voronoi               0 0 1

Combiner Add                    2 0 1
Combiner Max                    2 0 1
Combiner Min                    2 0 1
Combiner Multiply               2 0 1
Combiner Power                  2 0 1

Modifier Abs                    1 0 1
Modifier Clamp                  1 0 1
Modifier Curve                  1 0 1
Modifier Exponent               1 0 1
Modifier Invert                 1 0 1
Modifier ScaleBias              1 0 1
Modifier Terrace                1 0 1

Selector Blend                  2 1 1
Selector Select                 2 1 1

Transformer Displace            1 3 1
Transformer RotatePoint         1 0 1
Transformer ScalePoint          1 0 1
Transformer TranslatePoint      1 0 1
Transformer Turbulence          1 0 1

Spring Mapgenerator             1 0 0
"""

myclass_h="""
#ifndef $MYIFNDEF
#define $MYIFNDEF

#include <DataAbstractModule.h>

#define ID "$MYMODULENAME"

// http://libnoise.sourceforge.net/docs/group__modules.html

/**
   @author Joachim Schiele <js@lastlog.de>
*/
class $MYCLASS : public DataAbstractModule {
public:
    $MYCLASS();
    ~$MYCLASS();

    QString identify();
};

#endif
"""

# testing code for the .h creation
#t = Template(myclass_h)
#s = t.substitute(MYCLASS=myClassName, MYMODULENAME=myModuleName, MYIFNDEF=myIFNDEF)
#print s

myclass_cpp="""
#include "$MYMODULENAME.h"
#include "ModuleFactory.h"

#include "registermodule_macro.cpp"

M_REGISTER($MYCLASS);

$MYCLASS::$MYCLASS() : DataAbstractModule($IN,$MOD,$OUT) {
  setProperty("FIXME", 112);
}

$MYCLASS::~$MYCLASS() {
}

QString $MYCLASS::identify() {
    return ID;
}
"""
# testing code for the .cpp creation
#t = Template(myclass_cpp)
#s = t.substitute(MYCLASS=myClassName, MYMODULENAME=myClassName,IN=portIN,MOD=portMOD,OUT=portOUT)
#print s

# this code will create directories, place cpp and h files into these directories
newlines=modules.split('\n')
for i in newlines:
 mylist=i.split()
 if len(mylist) > 0:
  myClassName=mylist[1]
  myCategoryName=mylist[0]
  myModuleName=myCategoryName + "::" + myClassName
  myIFNDEF=myCategoryName.upper() + "_" + myClassName.upper() + "__HH"
  portIN=mylist[2]
  portMOD=mylist[3]
  portOUT=mylist[4]
  t = Template(myclass_h)
  s = t.substitute(MYCLASS=myClassName, MYMODULENAME=myModuleName, MYIFNDEF=myIFNDEF)
  #print s

  # creating the directory for the module, based on it's class
  if not os.path.exists(myCategoryName.lower()):
   os.mkdir(myCategoryName.lower(), 0777)
  print "modules/" + myCategoryName.lower() + "/" + myClassName + ".cpp"

  # creating the .cpp file
  f = open(myCategoryName.lower() + "/" + myClassName + ".cpp", 'w')
  t = Template(myclass_cpp)
  s = t.substitute(MYCLASS=myClassName, MYMODULENAME=myClassName,IN=portIN,MOD=portMOD,OUT=portOUT)
  f.write(s)

  # creating the .h file
  f.close()
  f = open(myCategoryName.lower() + "/" + myClassName + ".h", 'w')
  t = Template(myclass_h)
  s = t.substitute(MYCLASS=myClassName, MYMODULENAME=myModuleName, MYIFNDEF=myIFNDEF)
  f.write(s)
  f.close()

summary

do run that script in ‘/tmp’ and experiment with the outcome. i hope this helps other c++ programmers on similar problems.

Posts for Sunday, August 15, 2010

FCron in practice — my fcrontabs shared

I've already stated my allegiance to FCron, but after using it for quite some while and writing an article or two about it already (see Publications subpage), I think it's time I shared my fcrontabs.

Since FCron is such a nice and vertisable command scheduler, I can depend that everything's going to get done even though my laptop is not up 24/7.

fcrontab -e systab lets me edit my system fcrontab (note: systab ≠ root's fcrontab):

# All FCron notifications are e-mailed to normal user
MAILTO=hook
 
# Updates 'slocate' in 'man' every day.
%daily,nice(7),random,mail(no) * 10-14 makewhatis -u
%daily,nice(7),random,mail(no) * 16-18 updatedb
 
# Once a month (as soon as possible) my Portage tree is updated and the results e-mailed to my normal user's account.
%monthly,nice(7)mail * 16-23  * eix-sync; emerge -DNuvp world
 
# Once a month (on a random day in the second half of it) some general cleaning of the Portage tree; again e-mail of results.
%midmonthly,nice(7),random,mail * 16-23 * eclean-dist --destructive --nocolor; eclean-pkg --destructive --nocolor; eix-test-obsolete detailed

And here's my normal user's everyday stuff, accessible by fcrontab -e:

# Twice a week the weather report gets printed automatically and an e-mail notifies me when I can take it from the printer or whether there's been a problem
%weekly,mail * 06-23 sleep 500; wget <a href="http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf" title="http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf">http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf</a> -O /tmp/vreme.pdf && lpr /tmp/vreme.pdf && echo "Weather report printed." || echo "ERROR: Weather report *not* printed!" ; rm /tmp/vreme.pdf*
 
%midweekly,mail * 06-23 sleep 500; wget <a href="http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf" title="http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf">http://www.yr.no/place/Slovenia/Ljubljana/Ljubljana/varsel.pdf</a> -O /tmp/vreme.pdf && lpr /tmp/vreme.pdf && echo "Vremenska napoved je stiskana." || echo "NAPAKA: Vremenska napoved *ni* stiskana!" ; rm /tmp/vreme.pdf*
 
# Using curl magic to automatically send updates to Status.net; I don't need e-mail notification of that ;)
%nightly,mail(no) * * curl <a href="https://identi.ca/api/statuses/update.xml" title="https://identi.ca/api/statuses/update.xml">https://identi.ca/api/statuses/update.xml</a> -u johndearheart:<password> -d status='GNU John Dearheart → !discworld'
 
%daily,mail(no) * * curl <a href="https://identi.ca/api/statuses/update.xml" title="https://identi.ca/api/statuses/update.xml">https://identi.ca/api/statuses/update.xml</a> -u dwtrivia:<password> -d status="`fortune discworld pqf -n 128 -s`"' → !discworld'

Note 1: I prefer to use the %*LY commands to define cronjobs, because they fit my needs the most. FCron itself uses all sorts of ways how to define the time when a cronjob should be executed — from strict date+time (like in "normal" Crons) to intervals and even defined by uptime.
Note 2: Of course, in the last two (f)cronjobs the passwords were censured ;)

I hope this whet your appetite and you'll be anxious to try it and find your own way of how to make your life easier with FCron :]

hook out >> doing "schoolwork" for my potential new legal counselling job
<!--break-->

Planet Larry is not officially affiliated with Gentoo Linux. Original artwork and logos copyright Gentoo Foundation. Yadda, yadda, yadda.