Category: Coding


Fuse and FCO's

A few days ago Ikke was experimenting with FUSE. I had read about FUSE on Planet Gnome, but I never really looked into its possibilities. It seems though that FUSE could provide a solution for the first problem I mentioned at the end of my previous post. Writing a FUSE filesystem doensn't seem to be all that hard, and there are Python bindings too! (mmmm, Python :-p )

But the more I think about this, and the more I discuss it with Ikke, the more I'm convinced that this 'magic' directory should do a lot more than just move files. It should also allow me to browse my files in some set-based way. That brings us to the FCO's, or First Class Objects: a user should be able to browse his/her FCO's (and their attributes). When he/she wants to listen to music of artist Foo, he/she just browses to ~/Music/Artist/Foo/. (This example is based on the functionality of TagsFs.) Equally, when our user wants to open a file that belongs to a Project he/she is working on (Projects are FCO's), he/she browses to ~/Projects/Bar/. When the 'Bar' Project has a Subproject called 'Barbar', our user just browses to ~/Projects/Bar/Subprojects/Barbar/. (I'm assuming here that Project has a 'Subprojects' attribute.)

Not only should our user be able to find his/her files through this interface, it should also work the other way around: when a file is dropped into ~/Projects/Bar/ it should appear there each time that directory is opened. To implement this kind of behaviour, a database of FCO's should be updated each time files are being handled in these 'magic' directories. The files themselves could be moved into a seperate (hidden?) directory where they can be easily retrieved when needed. Ikke has some great ideas about how this could work.

But what if our user wants to group some files together that don't have any relation that can be expressed with an FCO? Answer: tags. There should be an extra 'magic' directory ~/Tags/ that allows the user to browse using tags. ~/Tags/Fun/ would contain all fun files, ~/Tags/Vacation/ should return all files with a 'Vacation' tag. Now let's say that our user wants to view all files that are fun, and have something to do with vacation. A possible path could be ~/Tags/Fun/Vacation/ or ~/Tags/Vacation/Fun/. The problem with these paths is that only interections between the tag-sets are possible. Unions and complements should be possible too...

This could be solved by adding special keywords to the path: 'and', 'or' and 'not'. The path for an intersection would then be: ~/Tags/Fun/and/Vacation/. Files that are fun, but do not have anything to do with vacation would be in ~/Tags/Fun/and/not/Vacation/. And files that are fun or are vacation-related would be in ~/Tags/Fun/or/Vacation/.

I hope I'll find some time to implement tiny parts of this in the near future. If I get something interesting working, I'll post it here. :-)

Permalink . RealNitro . 20:47:39 . 586 Words . Coding . Email . 1336 views


Automatic file-sorting

My home directory is a mess. I have all kinds of files on my Desktop, in my downloads directory, in a Media directory, everywhere. The reason for this is that I'm too lazy to move new files into their appropriate directories. Especially when I'm downloading stuff. The ideal situation would be to have all my videos inside my Media/Video directory, my music inside my Media/Music directory (preferably inside an artist/album subdirectory), images in another directory, screenshots inside a subdirectory of that image directory, etc.

The problem is that I'm forced to do all of this by hand, and that I only do it from time to time:

jens@dell ~ $ ls downloads/ | wc -l

The 'algorithm' I use to move the files I download to their destination directories is executed by me, not by my computer.

Some time ago, I started dreaming about an 'active' directory that did this sorting for me. This directory would:

  1. Detect when a file was dropped inside of it

  2. Extract all needed (meta)data from the file

  3. Analyse this data and descide where the file should be moved to

  4. Tag the file

  5. Move the file

The tagging of the file would allow to reconstruct the contents of the 'magic' directory with a saved Beagle search. That way I could still open my downloads directory right after I downloaded a new file, and find that new file inside of it.

Having an idea is one thing, implementing it is another. I would like to implement this idea, but there are a few problems still remaining that keep me from doing so:

  • Which technology should I use to make the directory 'active'? And by 'active' I mean that a script or some code would be called for each file that is moved into it. Could this be done in Gnome-VFS, or should some daemon monitor the directory?
  • The 'active' folder should be configurable in an easy, intuitive and flexible way. I will need to give this some thinking. The (simple) filtering user-interfaces I know are not flexible enough to use them for this purpose.

If you read this, and have an idea to solve (a part) of these problems, or any other idea about the rest of this post, please leave a comment. ;-)

Permalink . RealNitro . 20:12:24 . 378 Words . Coding . Email . 1581 views


Remote X on Nokia 770: schreenshots

Due to the fact that the screenshot tool had a bug at the time I gave remote X windows a try on the N770, I could't post any 'proof'.

But, that screenshot-bug has been solved, and I connected my N770 to the fresh install of Ubuntu Linux so I could take shoot some screens. It took me about 4 minutes to make my N770 talk to the pc (Ubuntu recognised my usb bluetooth key immediately, it really wasn't hard at all). I installed the openssh-server on the pc (enabled it in Synaptic, and pressed Apply, easy stuff), started it, and logged in with my N770.

This time I used some new command line options (thank you daf):

ssh -X user@server -c blowfish -C

And I started oowriter2 again:

oowriter2 starting...
(Larger image)

and a few seconds later (the pc is quite old):

oowriter2 on N770
(Larger image)

Then I gave The Gimp another try, but the lag was still there. It was better a bit faster than without the compression settings for the ssh connection, but nowhere near usable. :-(

btw, has anyone tried this keyboard with the N770 yet? Does it work? Or should/will it work? Plz let me know!

Permalink . RealNitro . 19:54:46 . 261 Words . Coding . Email . 1227 views


Remote X sessions on Nokia 770

Some topics on have great views on what the N770 might have to offer in the future. One nice possibility is forwarding X sessions to a N770. I started with forwarding Gedit from my pc to my N770, but later on I had a go at 'oowriter2' ( 2 Writer), Supertux and The Gimp. My experiences about those apps on the N770 are at the end of this post. First I'll tell you how to try it yourself.

Some basic requirements:

  • a computer running the X-server and sshd (a decent linux box ;-) )
  • a (fast) network connection between your N770 and the server
  • openSSH for the maemo platform

To install openSSH on your N770, download the openSSH .deb package to your N770. Next,open an X-terminal, and gain root access. If the .deb openSSH package is on your mmc, navigate to it:

cd /media/mmc1/

And install openSSH (it doesn't install using the graphical package installer):

dpkg -x ssh_*.deb /

Caution: make sure that your servers sshd allows X forwarding! Time to connect to the server:

ssh -X user@server

Change user to your login-name, and change server to your servers IP or domain name. The first time you log into your server from your N770, ssh wil ask you a question. Answer 'yes'. Then it will ask your password. Enter it. You should get a command prompt as 'user' on your server. Time to execute a program! I use the Gnome desktop environment, and the default text editor (like notepad in Windows -- but waaay better ;-) ) in Gnome is Gedit. The command to start Gedit from a terminal is 'gedit' (duh! :-p ). Execute


Give it some time to start, and you'll see Gedit running on your N770! To try any other programs, just tap their commands into the terminal and have fun!

But there are a few downsides. The first big downside is text-input: The onscreen-keyboard does not appear when you put the cursor inside a text-field of an X-forwarded window. Copy-pasting text is possible though. Maybe people with working Bluetooth keyboards will be able to type some text. Is somebody willing to try? One other downside is that X-forwarded windows vanish when they are minimized. There seems to be no way to get them back, killing the parent program and restarting it is the only solution. (You can kill the parent program by bringing your X-term back up, opening 'X Terminal'->'Terminal'->'Send Ctrl-some key', and tapping the 'c' keyboard button.) The fullscreen button didn't work aswell. Gedit just doesn't recognise/receive the signal emited by that fullscreen button, I guess.

Beside those little anoyances, Gedit ran quite smooth. So I decided to start the 2 Writer. And it worked too! The gui wasn't 100% snappy (i.e. scrolling was laggy), but it seemed fast enough to be usable. Later that day, I decided to give Supertux a try. (Supertux is a Super Mario clone.) The verdict: not playable. The bluetooth connection between my pc and my N770 just wasn't fast enough to transfer all that graphical goodness without (a LOT of) lag. The Gimp suffers from the same problem. Drawing with your stylus is possible, but the result lags several seconds behind.

A possible solution for the lag problems would be to compress the data that's being sent between the X-server and the client (your N770). A FreeNX-client would be great as the NX protocol is in fact a compressed (and secured) forwarded X-session. (FreeNX is a free alternative to NoMachine NX.)

Permalink . RealNitro . 21:31:01 . 658 Words . Linux, Coding . Email . 2278 views


Sharing internet with Nokia 770 over bluetooth

It's been a (very) long time since I have posted here (again), but I bought myself a Nokia 770 last week, and it took me a lot of time to get it on the net, so I thought I'd share how I got it to work.

First off, some interesting links:

You need to have your bluetooth stick working first. Gentoo users should read the first parts of the host to host bluetooth howto, other distro's should consult the proper information on the community forums/wiki. (Don't scan for other devices yet, just setup your kernel and BlueZ.)

Then open the X Terminal on your 770 and be root. Enter:

hcitool scan

The scan should display your pc's bluetooth name and its bluetooth ID. If the scan cannot find your computer, check again if your bluetooth stick is really working. Scanning for your 770 on your computer is no use, since your 770 will remain invisible. Now let's pair your 770 with the pc. Execute the following on your 770, but replace 00:10:20:30:40:50 with your computer's Bluetooth ID:

hcitool cc 00:10:20:30:40:50

If you get an error, try:

rm /etc/bluetooth/link_key

If the pairing works, you will be asked to enter the PIN code of your pc. There is no need to try to connect from your pc to your 770, it will not work anyway (your pc cannot see your 770, remember). Next, make your computer listen for an incoming (network) connection. As root execute:

pand --listen --role NAP

Now, on your 770, connect to your pc:

pand --connect 00:10:20:30:40:50

(Replace 00:10:20:30:40:50 with your pc's Bluetooth ID again.)

If the connection has been set up, the following command should work on your 770:

ifconfig bnep0 netmask broadcast

Warning: if your local network already uses the 192.168.2.* subnet, replace the IP with another one that isn't in a subnet your pc is a part of!
On your pc, execute the same command, but change the IP:

ifconfig bnep0 netmask broadcast

We're almost there now. Your 770 and your pc are part of the same subnet now! Let's try to ping the 770. On your pc:


If you installed the ssh server, you can run it now, and log into it from your pc.

Now, let's set up the internet connection forwarding. First off, let your 770 know that your pc is its gateway to the internet:

route add default gw

Also add a dummy internet connection:

gconftool -s -t string /system/osso/connectivity/IAP/DEFAULT/type DUMMY

On your pc, display the content of /etc/resolv.conf:

cat /etc/resolv.conf

And add the rules to the /etc/resolv.conf file on your 770. For each line do:

echo "line" >> /etc/resolv.conf

All that's left to do is making your pc act as a router for your 770. One way to do that (not the easiest one), is to use a program called iptables. In this howto I will explain how to setup iptables on gentoo. Again, if you use an other distro, check the community forums and/or wiki. On gentoo, emerge iptables. You might have to recompile your kernel, just follow the 'Kernel Support' chapter of this howto on the gentoo wiki. To configure iptables, you can read this guide, or, if you just want a quick solution, use this script. As root, paste it inside a file. Then comment out IPTABLES=/usr/local/sbin/iptables, and uncomment #IPTABLES=/sbin/iptables. Change INTIF="eth1" to INTIF="bnep0". You might have to change EXTIF="eth0" too. (I had to change it to vpnlink because I connect to the internet with a vpn.) When you finished changing the script, make it executable, and run it. There should be no errors. Now save the script:

/etc/init.d/iptables save

and start iptables:

/etc/init.d/iptables start

If you want to start iptables everytime you boot, do:

rc-update add iptables default

You should be able to surf with your 770 now! I plan on writing a few script to make the linking more automatic. Plz share your comments here, and post any mistakes in the howto.

Permalink . RealNitro . 20:05:28 . 807 Words . Linux, Coding . Email . 3195 views

:: Next Page >>