Archive for the ‘Tutorial’ Category

Accessing Facebook Chat anywhere with XMPP

Thursday, February 11th, 2010

Facebook ChatSo you want to access pardon, I mean via : I’m not jocking, it works exactly like the ’s IM. But with less features.

Forget authentication, audio and video support (at least, right now): it’s the same crap without plugins — yet existing for .

I really don’t care about AIM integration: GTalk provides it too, but I’ve never used it and I won’t in the future.

Anyway, I appreciate that freed its chat, thank to the protocol: I already tested it via Telepathy and it works (exactly like using the dedicated Pidgin’s plugin).

Here’s what you need to get started:

  • Account → Jabber or XMPP
  • Username → foo (some clients need the full address, so add @chat.facebook.com if it doesn’t seem to work)
  • Server → chat.facebook.com
  • Port → 5222

I hope you don’t need any suggestion about the password… just remember to de-select SSL and check Ignore SSL certificate errors if available. Logging enables the web interface too.

Best track scrobbling with MPD + Sonata + Last.fm

Tuesday, February 9th, 2010

Last.fmI’ve already described how to setup MPD on Linux: it wasn’t enough to play music. You may choose from lots of interesting clients, but I preferred .

It’s a clean, lightweight, full-featured PyGtk client for : you could find it in the official ’s repositories or wherever you need to.

Sonata got a built-in integration, while other clients require you to install lastfmsubmitd to scrobble tracks.

Installing it on is as easy as running:

$ sudo apt-get install sonata

It supports multiple profiles to connect to different servers, but one of its main lacks is that you can’t change the default profile’s name from the GUI.

Unfortunately, I wasn’t able to integrate it with Notify OSD — although it dials with D-Bus. Anyway, Sonata is the best solution I tried: feel free to install it on all of your -powered devices.

YouTube is over IPv6: how to access it from Linux

Saturday, February 6th, 2010

YouTubeWhere it stands for , because is still accessible from : the changes made by Google don’t affect users accesses to the platform — but reduced the amount of IPv4 addresses needed (because YouTube is actually one of the largest sites on the web).

Anyway, you should prepare to switch soon: IPv6 will definitively replace IPv4 in 2012. If you didn’t disable it via kernel and/or system configuration – somebody suggests to do so to increase internet speed – you could easily take addresses via .

The Freenet6 community changed its web site recently and joined the Ning platform: I’ll speak about OpenSocial integration for blogs in a second time.

The best way I found to get IPv6 connectivity is : you can choose to login with username and password – registering for a free account – or anonymously.

The next example shows how to do it without any registered account: the main difference is about credentials — if you don’t need routing.

You could find packages for almost any distribution: here’s what to do with .

$ sudo apt-get install gw6c
$ sudo apt-get remove --purge radvd

In old releases the gw6c package was called tspc and its configuration files had another path: radvd isn’t really useful for our purposes, so I suggest you to completely remove it.

You may configure the client as you like, but the next settings are taken directly from the official example:

$ sudo gedit /etc/gw6c/gw6c.conf

userid=
passwd=
server=anonymous.freenet6.net
auth_method=anonymous
host_type=host
prefixlen=64
if_prefix=eth0
dns_server=
gw6_dir=
auto_retry_connect=yes
retry_delay=30
retry_delay_max=300
keepalive=yes
keepalive_interval=30
tunnel_mode=v6udpv4
if_tunnel_v6v4=sit
if_tunnel_v6udpv4=tun
if_tunnel_v4v6=sit1
client_v4=auto
client_v6=auto
template=linux
proxy_client=no
broker_list=/var/lib/gw6c/tsp-broker-list.txt
last_server=/var/lib/gw6c/tsp-last-server.txt
always_use_same_server=no
log_stderr=0
log_filename=/var/log/gw6c/gw6c.log
log_rotation=yes
log_rotation_size=32
log_rotation_delete=yes
syslog_facility=USER

Warning: prefixlen must equals to 64 if you don’t have an account, otherwise it won’t work — host_type could be router just if you login, with a prefixlen of 48.

The if_prefix option is about your physical interface: it supports bridges too (change it accordingly). The tunnel_mode must be v6udpv4 if you’re behind a NAT. In this case you can’t make use of a proxy client.

I don’t suggest you to change if_tunnel_* options: you need at least to enable the tun interface in your kernel settings — if it’s not yet. Restart your network to finally get an IPv6 address.

$ sudo /etc/init.d/gw6c restart
$ sudo /etc/init.d/networking restart

If you want to configure previous Ubuntu releases, just edit the file /etc/tsp/tsp.conf instead. That’s it: you could test your effective address pinging web sites with ping6 from a shell or connecting to the Google’s IPv6 search engine.

How to quickly setup MPD on a Linux system

Friday, February 5th, 2010

TuxHave you ever heard about cloud computing? I hope so. BTW, isn’t necessary to got an internet connection to create a “cloud”: I mean, you don’t need any web server.

Well, using the web should help you to remotely access your files… but this time I’m going to explain you how to install and configure an server on your system — sharing your playlists in a .

This is very quick and easy on , that requires a minimal configuration: even if the next steps apply to , you could install similar packages under any distribution.

I use it daily with : once a server is up and running, you may use any client to access and play your music tracks (from other machines too, if you need this).

$ sudo apt-get install mpd

After installing this package – the one and only you need, right now – you have to configure the server with very few options. I prefer to do this system-wide instead a per-user configuration.

$ sudo gedit /etc/mpd.conf

music_directory "/path/to/music"
playlist_directory "/path/to/playlist"
bind_to_address "192.168.1.2"
port "6600"

I followed the order (which may vary) of the default configuration file I found: you should leave the rest unchanged. Just notice that in the example I used 192.168.1.2 – my system’s local in the LAN – instead localhost: this is particularly useful if you plan to access your playlist from other devices.

Remember to change the address to fit your system’s configuration: assuming that you’re using and , you could go on with the setup — it supports too, I don’t use it. Try running mdp --version if you installed MPD in a different distribution.

audio_output {
type "pulse"
name "foo"
server "192.168.1.2"
sink "alsa_output"
}

While ALSA should have been configured properly during the installation, you must manually de-comment PulseAudio’s lines: check both and make sure the set address is correct. The name option doesn’t matter.

Now that you’re server is ready, you just need to restart its daemon to start playing your tracks:

$ sudo /etc/init.d/mpd restart

Of course, the configuration file is longer and you may choose other settings to optimize the stream. But this works and it’s enough to get started.

Learn FeedBurner’s feed picture building from WordPress.com

Tuesday, February 2nd, 2010

WordPressSome weeks ago I wrote about picture building for : this time I’d like to speak about : it’s possible to select a remote image to show on your feed too.

Unlike the previous post, the best example comes from : it exceeds the maximum recommended width for feeds, but it looks cool.

My interest starts with a Jonathan Snook’s post on how to add logos to the feeds: it could be useful to identify syndications with a custom picture.

I used to create a rounded-corner picture for this purpose, but you may use whatever you want — giving it the form you like most. You can see a preview of what I mean on my own feed.

Which are the best dimensions?

It doesn’t really matter if you’re on FeedBurner or not: feeds allow 144×400 pixels images (but WordPress.com’s is 224×58 and it’s good for me).

Default values are 81px for width and 33px for height, like the smallest standard banner. It’s not enough for logos: the English WordPress.com’s official blog shows why.

What about adding it via FeedBurner?

This is the best way to do so, especially because you don’t need to make changes on the source code: it’s enough to upload the created image anywhere on the web (of course, your own hosting is preferable).

Going to Optimize → Feed Image Burner you should provide its absolute address — selecting Specify custom image in the Image Source’s drop down menu.

Just notice that the Link field is completely useless if you don’t make use of the BrowserFriendly function (and I don’t suggest you to do so): on the contrary, the Title field should contain the blog’s title as an alternate text if the image isn’t reachable.

The BrowserFriendly view forces a standard, smaller picture because it has to fit the selected layout: I don’t like it because there’s no way to customize the theme.

What about adding it directly in the source code?

If you don’t use FeedBurner (and I’d really like to understand why), you could always modify the feed source code: this means that you have to manually keep track of your readers and in most cases it needs a plugin.

I dislike both, but it’s up to you: have a look at the official reference for Atom and at the relative alternative for RSS before continuing. Keep in mind that editing the sources depends on the you’re on.

As you can imagine, the markup is different for each mentioned format. Here’s how to include your logo on an Atom feed — that’s simpler:

<logo>http://domain.ext/path/to/image.ext</logo>

The RSS way is a bit more complex because it allows more attributes: I think you’ll need both, at least. You may want to include all the optional fields too:

<image>
<url>http://domain.ext/path/to/image.ext</url>
<title>foo</title>
<link>http://domain.ext/</link>
</image>

Beware that in this case url stands for the full image address, while link points to your web site. Both need to be included before the item element.

I chose to create a transparent , but I don’t think that it really matters: 224×58 pictures could cause problems with portable devices… anyway, I have an alternate solution for them.

Running uvesafb with Linux 2.6.33-rc6 and higher

Monday, February 1st, 2010

TuxI explained how to use the new compression algorithm as a built-in feature of the kernel yet, but I didn’t notice that apparently the unstable branch moved some framebuffer options to the modules.

Unfortunately, I’m forced to use because proprietary drivers don’t allow other kinds of framebuffer: this wasn’t a problem before.

My framebuffer needs to launch it as a “command” and with modularization it compromises its customization: I’m still working to fix this issue.

This means that uvesafb won’t start immediately and properly. It works quite like without default animations, if you can imagine.

To get it working again, first of all you need to remove any custom commands added to the kernel entry in as follows:

$ sudo gedit /etc/default/grub

GRUB_DEFAULT=0
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="nodmraid video=uvesafb:1280x1024-32@60,mtrr:3,ywrap"
GRUB_GFXMODE=1280x1024x32

Remove the video string that’s now useless and update GRUB: under it’s necessary to create a new configuration file in /etc/modprobe.d — adding the relative module in /etc/modules.

$ sudo update-grub
$ sudo echo "uvesafb" > /etc/modules
$ sudo gedit /etc/modprobe.d/uvesafb.conf

options mode=1280x1024-32@60 mtrr=3 scroll=ywrap

Rebooting will enable modifications: I assume that you were using uvesafb yet, so I skipped the kernel configuration (which doesn’t change at all, except for uvesafb itself built as module instead of built-in).

This solution is far from being optimal, but works: I fixed a syntax issue, so it should work even “better”. Anyway I’m waiting for to avoid these problems at all.

A first look at Google’s Rich Snippets: People

Monday, February 1st, 2010

I spoke about the ’s twice in the past, although some of you could haven’t noticed: I mentioned them talking about — but are a form of snippet too.

If you got a multi-user blog powered by or WordPress MU (which will be integrated on the traditional WordPress’ core of the next 3.0 version) as well, I planned to release a plugin to automatically handle what I’m going to explain.

On the other hand, if you’re the only writer of your blog you could easily take advantages of the People’s snippet on : just remember to enable RDFa on your site, before.

It doesn’t matter how do you insert the needed information: for example, I used a normal page chapter instead a simple list of terms (that’s the suggested method for the posts’ footers).

I chose to use too, while helpers suggest to use it alternatively with RDFa: using both doesn’t break anything (Microformats reside in classes, RDFa relates to special attributes) — and ensures more compatibilities.

Below, the official Google’s way to embed People snippets on a page. The 1st piece of code stands for the Microformats’ method:

<div class="vcard">
<div class="fn">Federico Moretti</div>
<span class="nickname">fedmor</span>
<span class="url">http://federicomoretti.name/</span>
<span class="org">b:G | studio</span>
<span class="adr">
<span class="locality">Varese</span>
</span>
<span class="title">Publicist</span>
</div>

Of course, you could add other informations using the Microformats’ syntax — like additional-name and so on. Here’s how the same looks with RDFa:

<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person">
<span property="v:name">Federico Moretti</span>
<span property="v:nickname">fedmor</span>
<span property="v:url">http://federicomoretti.name/</span>
<span property="v:affiliation">b:G | studio</span>
<span rel="v:address">
<span property="v:locality">Varese</span>
</span>
<span property="v:title">Publicist</span>
</div>

As you may notice, the number of elements doesn’t change: my implementation includes other optional fields, but this is enough to get started.

Merging the two previous examples in a single portion of code is very simple and you could easily customize them to fit your needs:

<div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Person" class="vcard">
<span property="v:name" class="fn">Federico Moretti</span>
<span property="v:nickname" class="nickname">fedmor</span>
<span property="v:url" class="url">http://federicomoretti.name/</span>
<span property="v:affiliation" class="org">b:G | studio</span>
<span rel="v:address" class="adr">
<span property="v:locality" class="locality">Varese</span>
</span>
<span property="v:title" class="title">Publicist</span>
</div>

It isn’t important what kind of element are you using in the place of span: just remember to assign the proper values in a dedicated container.

Compiling and installing the kernel with LZO compression on Ubuntu 9.10

Thursday, January 28th, 2010

So you’d like to enjoy the new compression support in the kernel? It should ensure a decompression boost: BTW, there are some aspects to pay attention to compile sources on .

First of all, even if still uses mawk by default, you must install instead. Of course, you can’t make use of although it’s supported too: Ubuntu starts with udev right now.

Don’t be scared: compiling the Ubuntu-way isn’t as difficult. Here’s how to resolve dependencies for the purpose:

$ sudo apt-get install fakeroot gawk lzop kernel-package libncurses5-dev
$ sudo apt-get remove --purge mawk

Be sure to remove mawk after installing gawk or your system will simply “die” — is only required if you want to switch on LZO’s compression (that’s what I’m going to explain).

Download the full source of the latest kernel from the official archive and go on configuring: patches aren’t necessary at all (but you could ever use them).

$ wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.33-rc5.tar.bz2
$ sudo mv linux-2.6.33-rc5.tar.bz2 /usr/src/
$ cd /usr/src/
$ sudo tar xjvf linux-2.6.33-rc5.tar.bz2
$ sudo ln -sf linux-2.6.33-rc5 linux

Choose whatever you want to configure the sources: I suggest you to make oldconfig before, skipping all the boring questions it should answer. Below is just an example.

$ cd linux/
$ sudo make oldconfig
$ sudo make menuconfig

In General setup → Kernel compression mode you could now select LZO (I selected it under Built-in compression mode too) and you’re done.

Warning: before to proceed you may solve a known bug to successfully create valid packages. Without a workaround the compilation will fail.

$ sudo make-kpkg debian
$ sudo gedit debian/ruleset/misc/version_vars.mk

You have to replace these strings:

UTS_RELEASE_HEADER=$(call doit,if [ -f include/linux/utsrelease.h ]; then \
echo include/linux/utsrelease.h; \
else \
echo include/linux/version.h; \

With these (around line 141):

UTS_RELEASE_HEADER=$(call doit,if [ -f include/generated/utsrelease.h ]; then \
echo include/generated/utsrelease.h; \
elif [ -f include/linux/utsrelease.h ]; then \
echo include/linux/utsrelease.h; \
else \
echo include/linux/version.h; \

So you’re ready to compile and install the kernel: I prefer to change the file debian/changelog too — because it’s impossible to append a custom revision now. It’s not mandatory.

$ sudo fakeroot make-kpkg --initrd kernel_headers kernel_image
$ cd ..
$ sudo dpkg -i *.deb

This will also create kernel headers. Remember to maintain a standard Ubuntu kernel installed if something goes wrong and reboot your system to test the new one.

Converting from OTF/TTF to WOFF for Firefox 3.6

Tuesday, January 26th, 2010

As I said some weeks ago, I don’t like the new font format proposed by for Firefox 3.6: anyway, the browser has been released and I implemented on this blog too.

Of course, I needed to convert existing font files to the new typeface format. To do so, I found just a command line tool unofficially provided by a Mozilla team member.

The small application is called sfnt2woff and comes from Jonathan Kew’s archive on the Mozilla server: he doesn’t provide additional informations to the source codeOS X and Windows binaries are also available on the same page.

It doesn’t matter what’s your operating system: just open a shell and execute the proper binary. Although it can be compiled with GCC… I preferred to use to get it working on too.

I suppose you’ve already installed it: if don’t, I suggest you these steps on : notice that packages could have different names in other releases.

$ sudo apt-get install gnome-exe-thumbnailer wine1.2 wine1.2-gecko
$ sudo apt-get remove --purge ttf-symbol-replacement ttf-tahoma-replacement

You don’t need ttf-symbol-replacement and ttf-tahoma-replacement at all and these should compromise some site’s rendering, so I removed them immediately. The package gnome-exe-thumbnailer should be considered optional.

It’s time to convert the fonts: the command is the same for all platform (just remove wine if you’re not using it). Unfortunately, you must repeat it for all the single file you need — it doesn’t support code auto-completion.

$ wine sfnt2woff.exe /path/to/foo.ttf

The executable extension is not necessary with OS X, as you can imagine. This converter support the font format too, if needed (I don’t know what about ).

Luckily the @font-face declaration supports multiple sources, so you’d like to modify your style as follows:

@font-face {
font-family: foo;
src: url('/path/to/foo.ttf') format('truetype');
src: url('/path/to/foo.woff');
}

Replace truetype with opentype (and the extension accordingly) if your primary font file got an OTF extension and warning: still need a separated EOT declaration. requires the full path of your files instead relative ones — there isn’t any WOFF format attribute to append, right now.

GNOME Activity Journal is ready to go

Monday, January 25th, 2010

GNOME Activity JournalUnfortunately, localization seems to be broken: I tried the Italian translation of and it got issues on special characters. But it works… without Btrfs too.

Usually I don’t like s, but most of the online tutorials to get running don’t work: you should consider that – although reached version 0.3.2 – development it’s still in an early state.

So, part of the framework is supported by (in fact a non-working version is on the universe yet) and the team opened an official repository.

This is actually the best way to install it on the desktop: of course it needs to have at least , editing the sources.list file to add the archive — here’s what you have to do:

$ sudo gedit /etc/apt/sources.list

deb http://ppa.launchpad.net/zeitgeist/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/zeitgeist/ppa/ubuntu karmic main

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7C5886C3

Once the repository is added – archives for Ubuntu up to 8.10 is also available – you could install gnome-activity-journal, the Zeitgeist’s UI for .

OK, but what does it do? Well… mainly, it keep track of your activities — letting you undo/redo actions: it will support snapshots ASAP (using a proper filesystem).

$ sudo apt-get install gnome-activity-journal zeitgeist zeitgeist-core zeitgeist-datahub

Unfortunately, the Italian localization is currently broken: it doesn’t print accented characters correctly and some labels aren’t translated yet — English wouldn’t have any problem.

If you can’t wait anymore, I suggest you to get GAJ from that repository: compiling could be frustrating and Python won’t run the application just by its downloaded binaries.