Tuesday, November 29, 2011

Setup GeoIP for PHP5 on Ubuntu Server

I lost a few hours on this, although I done it sometime ago. To make sure I don't forget it again, here it is:
  1. Install geoip packages:
    sudo apt-get install geoip-bin php5-geoip
  2. Download GeoIP Lite version:
    wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /tmp/GeoLiteCity.dat.gz
  3. Unzip GeoIP Lite to /usr/share/GeoIP/GeoIPCity.dat (this is what I forgot: to rename the file):
    sudo gunzip -c /tmp/GeoLiteCity.dat.gz > /usr/share/GeoIP/GeoIPCity.dat
  4. Reload apache
    sudo /etc/init.d/apache2 reload

Thursday, August 5, 2010

Elegant SEF columns layout

I found this somewhere (I can't remember where). I'm not using it now, but it's good to know.
The CSS is
/* @begin columns/sidebars (fixed L,R; liquid C) */
.columns-both, .columns-left {
  padding-left: 200px; /* LC width */
}
.columns-both, .columns-right {
  padding-right: 150px; /* RC fullwidth + CC padding */
}
.columns-container .column-main, .columns-container .column-left, .columns-container .column-right {
  position: relative;
  float: left;
}
.columns-container .column-main {
  width: 100%;
}
.columns-container .column-left {
  width: 190px;          /* LC width */
  left: -200px;          /* LC fullwidth + CC padding */
  margin-left: -100%;
}
.columns-container .column-right {
  width: 140px;          /* RC width */
  margin-right: -150px;  /* RC fullwidth + CC padding */
}
/*** IE6 Fix ***/
* html .columns-container .column-left {
  left: 150px;           /* RC fullwidth */
}
/* @end columns/sidebars (fixed L,R; liquid C) */
and the HTML (in a Drupal theme) is:


   

     
     

     
     
     
   

   
   
   

     
   

   
   
   
   

     
   

   
 

Tuesday, July 6, 2010

Working out OpenVPN with Network Manager in Lucid Lynx

For two years now, I've used OpenVPN to connect to a server where I upload some of the stuff I work on. Until now I always started OpenVPN from the terminal, because I didn't manage to get it working from the Network Manager in the last 4 Ubuntu versions.
Last weekend, I had some spare time and I installed Lucid Lynx on my laptop. I tried (again) to get OpenVPN working with Network Manager. As usually it failed, although I was pretty sure everything I did was correct.
So I decided to import my existing openvpn configuration file and export it back to see if there's something different. After doing this, I've noticed a few difference, but most of them were just due to syntax. However, two lines looked more interesting:

user openvpn
group openvpn
I've checked and saw that with these lines in the configuration file, the openvpn connection failed to start even from the terminal. Therefore, I did the following:
  1. create the openvpn group as a system group using

    groupadd -r openvpn
  2. assign the openvpn group to the directory (and files) that holds my openvpn key and certificates (mine and server's):

    chgrp -R openvpn openvpn_folder
  3. assign group read permissions to the openvpn settings directory and remove permissions for others:

    chmod g+r,o-rwx openvpn_folder
After these steps, the OpenVPN connection started from the Network Manager without problems (note that it's recommended route only traffic for that network through that connection).

Monday, May 24, 2010

Matlab 7 startup problem

Recently I had to install Matlab 7 on a Dell Inspiron 1501 laptop running Windows XP SP3. Everything went OK during installation. However, Matlab failed to start: it started, showed the splash screen, show the full application window, and as soon as the prompt was about to appear, all windows closes.
After some googleing I found out that this is caused by Matlab 7 using the wrong version of the Blas library (http://www.mathkb.com/Uwe/Forum.aspx/matlab/12542/MATLAB-7-R14-crashing). Dell Inspiron 1501 has an AMD Athlon processor.
The solution was quite easy (considering how much time I lost to find it): add the environmental variable BLAS_VERSION with the value atlas_Athlon.dll.