A few minutes ago I tried to add some music to my N900 for my girlfriend. Unfortunately the media player doesn’t automatically scan for new media (or it takes a while?). If you want to force the N900 to re-index everything just invoke this command in your X Terminal (or via SSH):
tracker-processes -r
Found 136 pids...
Setting database locations
Checking database directories exist
Checking database version
Checking database files exist
Removing all database files
Removing database:'/home/user/.local/share/tracker/data/common.db'
Removing database:'/var/tmp/tracker-user/cache.db'
Removing database:'/home/user/.cache/tracker/file-meta.db'
Removing database:'/home/user/.cache/tracker/file-contents.db'
Removing database:'/home/user/.cache/tracker/email-meta.db'
Removing database:'/home/user/.cache/tracker/email-contents.db'
Setting index database locations
Checking index directories exist
Checking index files exist
Removing all database index files
Removing database index:'/home/user/.cache/tracker/file-index.db'
Removing database index:'/home/user/.cache/tracker/email-index.db'
And after a few minutes (the player will show your) your music/video collection will be up to date!
Of course there are a million ways to do so (Samba, AFS, NFS, SSH, FTP et cetera), but I think this is the easiest way you’ve ever seen. It is called SimpleHTTPServer and the only requirement is that you have Python installed, which is the case for most Linux systems. You use it like this:
python -m SimpleHTTPServer
This will launce a simple webserver serving you currect directory via port 8000. It is obvious that this page will only be accessible when this port isn’t firewalled. When you acces this page it will show you something like this:
Browser Listing
And what you see on the console is:
Python Server SimpleHTTPServer
To have this command always with you, simply create an alias in your .bashrc:
alias pyServ='python -m SimpleHTTPServer'
As said before, by default the server listens on port 8000. If we would like it to listen on 8001 that’s also possibe. Just add another parameter:
python -m SimpleHTTPServer 8001
Two other, related, (Python written) file sharing utilities I came across a while ago are Droopy and Woof. Have a look at them the’re quite handy too!
DynDNS offers “free Dynamic DNS service that lets you easily connect to your home network from anywhere. Use your personalized URL to view home security cameras, download shared files from your VPN, or even host a personal website. Don’t pay for a static IP address; our software syncs your domain to your network automatically”
Of course it is (completely) pointless, but what the hack. You could use it for running public services (apache, ssh et cetera) on your N900 if your 3G provider assigns you a public IP address, but I guess the main purpose would be tracking your phone when it’s lost or stolen.
Since Python is already present on the N900 the easiest way to get things working would be a Python based DynDNS client. Such a client is available at sourceforge.net and is named ipcheck. So what we do is:
And I assume that you already have SSH (root) access to your phone
Download ipcheck to the N900
mkdir /opt/ipcheck -p
cd /opt/ipcheck
wget http://downloads.sourceforge.net/project/ipcheck/ipcheck.py?use_mirror=ovh
chmod 0755 ipcheck.py
A few days ago I was visiting one of my favorite sites (commandlinefu) and read something about “Color Highlighted Log Viewing” so I tried it and was instantly hooked. According to it’s website: “CCZE is a robust and modular log colorizer with plugins for apm, exim, fetchmail, httpd, postfix, procmail, squid, syslog, ulogd, vsftpd, xferlog, and more”
To get full control over your N900 what would by easier than have SSH (root)access.
If you have the Maemo Extra repository enabled and already installed rootsh the only thing we have to do is search for a package named openssh. This is a meta package which contains both client and server. We install this package and it will ask us to choose a root password. After setting this password the installation is finished. We now should be able to login with that password:
For extra security we could choose not to allow password authentication, but only publickey. To configure this on Debian/Ubuntu have a look at this article. What we do is:
Install the ssh client
client: apt-get install openssh-client
Generate the key-pair, a public-key and a private-key
client: ssh-keygen -t rsa
Copy the public key to the server (in this case the N900)
For many things you would like to do on the Nokia N900 (OpenSSH, Debian) it is necessary to have root access. In order to get root access we have to install the rootsh package from the extra repository (see here how to enable “extra” repositories). Once installed we can type sudo gainroot an we’ll be root!
As said on nokian900applications, Maemo, the operating system of Nokia N900, has 3 repositories of applications. Repositories are Extras, Extras-Devel, and Extras-Testingand in each are grouped the applications according to their compatibility. In these repositories there are a lot of nice applications (openSSH, Nmap, Evince, Bash), but first we have to enable them. I would recommend not to use the Extra-Devel, but if you necessarily want to you could 👿
To enable, for instance, the Extra repository just click the “Extra” link above and be sure the “Disabled” checkbox is off. For a nice little demo watch this movie:
“zsync is a file transfer program. It allows you to download a file from a remote server, where you have a copy of an older version of the file on your computer already. zsync downloads only the new parts of the file. It uses the same algorithm as rsync. However, where rsync is designed for synchronising data from one computer to another within an organisation, zsync is designed for file distribution, with one file on a server to be distributed to thousands of downloaders. zsync requires no special server software — just a web server to host the files — and imposes no extra load on the server, making it ideal for large scale file distribution”
After seeing this movie a long time ago I was eager to use this tool sometime, but time passed by and I never did. Till the new Ubuntu (10.04) release! I already downloaded the RC version of Ubuntu a few days earlier so when it was launched I only had to zsync the two images:
For a project I was working on I needed a multi field (column) key. Both `id` and `server` were not unique, but put together they were. I already had `id` as my PRIMARY KEY, but that was not correct anymore. So the first thing to do was remove that KEY:
ALTER TABLE `clients` DROP PRIMARY KEY
And after that I created the `server` field:
ALTER TABLE `clients` ADD `server` VARCHAR(20) NOT NULL AFTER `uid` ;
According to this post there a few things to think about:
a multiple PRIMARY KEY can’t use AUTO_INCREMENT
each multiple field KEY is only allowed to spread 16 columns
there is a maximum overall length of 256 Bytes
After considering this (and concluding there were no problems) I created the PRIMARY KEY:
ALTER TABLE `clients` ADD PRIMARY KEY (`uid`, `server`) ;
If we wanted to have an UNIQUE KEY we should executed:
ALTER TABLE `clients` ADD UNIQUE (`uid`, `server`) ;
Sometimes you just don’t want to view website in “normal mode”; It’s long an not so wide (Google search results?). By default “portret mode” isn’t enabled for the Web browser on the Nokia N900 (it’s a hidden feature). Fortunately it is really easy to enable.