domingo, 22 de mayo de 2011

How to perform automatic actions after a connection is established with wvdial/ppp


I'm on kubuntu Natty and I'm pretty glad with the distro overall. However, there are a couple  of bugs that bug me more often than I'd like them to. One of them is that, for whatever reason, when I establish an internet connection with wvdial/ppp, squid doesn't go through it. I have to restart he service once the connection is set up so that traffic starts pouring from squid. What I realized was that it is possible to do this action automatically.

There is one directory where you can put scripts to be run when a new connection is established and when a connection is dropped. I wanted to do something when the connection was established, so had to upt the script in /etc/ppp/ip-up.d:

$ cat /etc/ppp/ip-up.d/9999squid

/etc/init.d/squid3 restart

Pretty straightforward, right? Make sure the script has the executable flag set up and you are done.

Additionally, the script get the following information as parameters (in the order they are received):
Network Interface
Local IP address
Peer IP address
Additiona Parameter (as received by pppd).

There are some environment variables that I think are available for the script, but I haven't tested them: PPP_IFACE, PPP_TTY, PPP_SPEED, PPP_LOCAL, PPP_REMOTE y PPP_IPPARAM.

Note: Given that the hack is implemented on ppp, this should probably work with network connections set up on NetworkManager that use ppp (like broadband).

lunes, 9 de mayo de 2011

How to install django (or run it without installing it at all) without administrative permissions


I'm giving my first baby steps at learning Django. Right up front I saw the installation procedure and it talked about requiring an administrator to do the installation or copy the django directory inside the Djando tar ball to site-packages.... I personally don't like doing these kind of things so I sat down for a while to see how it could be done without requiring running at all. It's like this.

In my environment, I unpackaged the Django tarball that created this directory:

$ ls -l /home/antoranz/Downloads/Django/Django-1.3
total 72
-rw-r--r--  1 antoranz antoranz 19166 2011-03-21 20:38 AUTHORS
drwxr-xr-x 17 antoranz antoranz  4096 2011-05-09 09:16 django
drwxr-xr-x 14 antoranz antoranz  4096 2011-03-23 00:08 docs
drwxr-xr-x  2 antoranz antoranz  4096 2011-03-23 00:08 extras
-rw-r--r--  1 antoranz antoranz   592 2009-10-30 03:24 INSTALL
-rw-r--r--  1 antoranz antoranz  1558 2008-08-09 09:40 LICENSE
-rw-r--r--  1 antoranz antoranz  1494 2011-03-16 14:02
-rw-r--r--  1 antoranz antoranz  1228 2011-03-23 00:08 PKG-INFO
-rw-r--r--  1 antoranz antoranz  1786 2011-01-28 17:07 README
drwxr-xr-x  2 antoranz antoranz  4096 2011-03-23 00:08 scripts
-rw-r--r--  1 antoranz antoranz   108 2010-08-05 08:00 setup.cfg
-rw-r--r--  1 antoranz antoranz  4325 2011-03-23 00:06
drwxr-xr-x  5 antoranz antoranz  4096 2011-03-23 00:08 tests

This is the place you should run from to do django's installation, right?.... you can just skip it completely.

Now, without doing anything but just extracting the tarball, you won't be able to do much with it. From a small project I'm working on (following the tutorial):

$ python runserver
Traceback (most recent call last):
  File "", line 2, in
    from import execute_manager
ImportError: No module named

Too bad. But if you just export the PYTHONPATH to include the django directory you are done:

$ export PYTHONPATH=/home/antoranz/Downloads/Django/Django-1.3/
$ python runserver

Validating models...

0 errors found
Django version 1.3, using settings 'django1.settings'
Development server is running at
Quit the server with CONTROL-C.

And that's it. If you need to call django's binaries ( and so on), use the full path to reach them or add the required path to PATH environment variable so that it's available.

I staill haven't tried to run django from apache without doing the instalation..... but will be publishing it (if possible) once I reach that part of the tutorial.

miércoles, 4 de mayo de 2011

Will kubuntu natty stabilize? Ever?


First off, let me tell you something before I start my rant on kubuntu: I've been a kubuntu user for 6 years now... and I don't intend to switch to gnome (ubuntu) or xfce (xubuntu) or any other of the other variants anytime soon. I like KDE and I'm willing to put up with the nag that I have to go through in order to continue using it

Back when I installed natty 'bout a couple of weeks ago I had a few complaints but we were in beta, right?... but it's been a few days since release time and things feel worse and worse. At first I didn't use gl-based screensavers because they made the graphics go completely crazy (it's a samsung netbook with intel chipset) so I used a simple screensaver instead (though I had desktops effects turned on and they tend to work pretty well)... then updates started to come in. gl screensavers started to be stable some days ago and I could start/stop it at will... only sometimes it crashed KWin.... but yesterday there was another update and things have gone to hell. Every single time I start the screensaver it crashes KWin... now gkrellm doesn't remember it's on desktop 6 when KDE starts.... When KDE starts it always turns off my desktop effects (which I think didn't happen when I updated to natty), hell... this is just too much for my taste. Are we experimenting here? I haven't tested if kded4 goes crazy when I come back from sleeping/hibernating yet... but something tells me it's not going to be pretty.

Guys, could you please stabilize this whole thing and not make us kde users feel like third class citizens in the ubuntu world and keep us in second class at least?