Internet access for everyone at Etap hotel

If you are at the Etap hotel and you get “Error: The maximum number of subscribers has been reached” just find someone with Internet access that can route you and make him type this as root:

echo 1 >> /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -j MASQUERADE

Then you should type (as root):

route del default gw 10.71.0.1
route add default gw route add default gw $IP_WITH_INET_ACCESS

Tip kindly provided by em :).

File transfers and Empathy

This week I worked on adding file transfer support to Empathy for the Telekinesis project. Empathy with my patches (the code is not yet in SVN trunk) can exchange files using every connection manager that supports file transfer, that is just telepathy-salut (aka bonjour, aka XEP-0174, aka link-local messaging) for now :).

libempathy, the non-GUI library wrapping the telepathy interfaces, will get a class to handle file transfer channels (i.e. org.freedesktop.Telepathy.Channel.Type.FileTransfer) and a class for single file transfers, which are just IDs in Telepathy.
The dialog, in libempathy-gtk, was copied from Gossip, I’m going to modify it later to better fit our needs and to solve some problems, for instance now you cannot choose the file name, only the directory where to save the file.

This work is far from perfect but I can already show some screenshots and videos:


Receiving a file


Sending a file (Ogg Theora video, 150 kB)


Receiving a file (Ogg Theora video, 138 kB)

Tomorrow I will arrive at the Birmingham train station around 5 PM. See you all there!

Telekinesis and source control

Havoc, the jhbuild moduleset for Telekinesis was written before deciding any technical detail on the project, so it builds everything including avahi! As soon as the project becomes usable by someone other than me I want to remove unneeded libraries and add a comment suggesting to skip libraries which have recent versions packaged for common distros.

Mercurial is used only by salut-chat, a simple and ugly Python script I use to test telepathy-salut (the library I’m working on at the moment). When telepathy-salut will get more tests and empathy will support file transfer I plan to kill salut-chat removing the need for Mercurial.

This means that when Telekinesis will start to be useful it will require only darcs (used by Telepathy) and svn (used by mission control and empathy). Anyway, if you are interested in telepathy-salut for Big Board, I can already try to reduce the number of needed modules.

By the way, I agree that a question before pulling each patch is silly, to resolve it use “darcs pull -a“.

Telekinesis

As said in previous posts, I’m working on a SOC project, called Telekinesis, to make easy to transfer files over a LAN.

Telekinesis

For now I modified telepathy-salut (the Telepathy connection manager that handles link-local connections) adding file transfer support, but at the moment chat programs are not yet able to use it so it’s still completely useless for you :).

My next steps are to improve the code in telepathy-salut and then add file transfer support to Empathy.

Setup programs for Windows

Alberto, why did you chose NSIS to build setup programs? I don’t like it because its scripting language seems a mix between assembly and shell scripting and it doesn’t even have flow control statements, you have to use Goto!

Moreover you have to do manually everthing, for instance to copy a file that later can be uninstalled you need this code:

; Copy the file
File "example.exe"

; Create shortcuts.
CeateDirectory "$SMPROGRAMS\Example"
CreateShortCut "$SMPROGRAMS\Example\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\Example\Example.lnk" "$INSTDIR\example.exe" "" "$INSTDIR\example.exe" 0

; Copy the uninstaller.
WriteUninstaller "uninstall.exe"

; Write the uninstall keys for Windows.
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example" "DisplayName" "NSIS Example"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersionUninstall\Example" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example" "NoRepair" 1 WriteUninstaller "uninstall.exe"

And then you have to uninstall everything manually:

; Delete registry keys.
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example"

; Remove files and uninstaller.
Delete $INSTDIR\example.exe
Delete $INSTDIR\uninstall.exe

; Remove shortcuts.
Delete "$SMPROGRAMS\Example\Uninstall.lnk"
Delete "$SMPROGRAMS\Example\Example.lnk"
RMDir "$SMPROGRAMS\Example"

; Remove the program directory.
RMDir "$INSTDIR"

I prefer Inno Setup, the nice thing is that for common tasks (copying files, creating shortcuts, adding registry keys, etc.) you only have to write a simple ini-like file, but if you need something more powerful you can use Pascal scripting.

The previous example in Inno Setup would be:

[Files]
Source: "example.exe"; DestDir: "{app}"

[Icons]
Name: "{group}\Example"; Filename: "{app}\example.exe"
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"

Please, use Inno Setup! :)

s/Apache/lighttpd/

NerdOCRACY, the server hosting barisione.org, moved to lighttpd as it’s less resource-hungry and easier to configure.

I had only some problems with WordPress, to have clean addresses like http://www.example.com/about instead of something like http://www.example.com/?p=123 it uses this htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I resolved using server.error-handler-404 as suggested on snippets.dzone.com:

$HTTP["host"] == "www.example.com" {
    server.document-root = "/usr/share/wordpress"
    server.error-handler-404 = "/index.php"
}

Some notes on my SOC proposal

Reading some comments on my SOC proposal I have the impression that someone didn’t understand what I’m going to work on, I don’t want to write yet another Samba-like program but an application to send files over a LAN without the need to share folders.

Systems like Samba or FTP are useful at home or work when you want to permanently share a folder, but often people just want to quickly send a file to some specific person. For that you do not want to first put it in your shared files and then tell your contact that he/she can find it there. Moreover using Samba or FTP means that you have to handle permissions and passwords or just have a public folder available to everyone, which could be a security problem. So on occasional situations just right-clicking on a file and using “Send to” (through a nautilus-send-to back-end) to send this file to a person is a lot nicer.

Recently Xavier Claessens, the author of gossip-telepathy, started to work on grapevine, a modular version of gossip using Nokia’s mission control. A good idea would be to work on it adding file transfers capabilities instead of writing a separate GUI, this way other protocols could benefit of my work, making easy to send files using every chat protocol.

Note that I’m not going to invent new protocols, I will use XMPP (aka Jabber) and in particular I want to work on telepathy-salut, a Telepathy connection manager for XEP-0174, the protocol used by iChat for serverless chats on a LAN. For file transfer stuff I’m going to base my work on the code written by Mads Chr. Olesen for the last year soc on collaborative applications using Telepathy.

Update: The project has been accepted and it’s now called Telekinesis.