Monday, July 24, 2006

Gmail and plus-addressing

Plus-addressing is an additional option in some mail servers including gmail. What I mean by "plus-addressing" I mean addresses containing '+' in the local part of the email i.e. user-host. For example lets assume that someones email is: someone@gmail.com. If given server allows to use plus-addressing, you can append to the above email some string, also called a tag. And the above email may have form: someone+string@gmail.com, someone+work@gmail.com, someone+spam@gmail.com or someone+blahblah@gmail.com.

What are advantages of this plus-addressing? Thanks to this, we can have one email account, and we can have few addresses just by adding tags. Real power of this system can be seen using gmail accounts, when there is possibility to tell what should be done automatically with incoming email containing additional string after '+' sign. In another words, i gmail such action are accessible by filters.

I will show how to create a filter. Lets create filter that looks for tag: 'todo'. Because of that me email address: someone+todo@gmail.com. Such email for example I will give to my boss that he could send me mails to that addres, and in my gmail account they automatically will be assigne to a label called e.g.: 'work_to_do'.

To begin with we need to create 'work_to_do' label. To do this, you go to Setting and than Labels in your gmail account. There new label can be created:


Then filter must be created. To make a filter first click on 'Create a filter':



and after that you create filter in two stages. Frist, you define your tag (string after plus sign in your email address):


In the second step you define what action should be done with such email. In this case we want to assign label 'work_to_do'. To do this, you check 'Apply the label' and select label to apply and you create filter:

And that's it. From this moment on, you can recieve emails in the form of someone+todo@gmail.com, and they automatically are labeled 'work_to_do'.

Of course, you can consequently create others 'plus-addresses', and you can create different actions for them.

Your PHP installation appears to be missing the MySQL which is required for WordPress

Yesterday I went to this blog and I see:

Your PHP installation appears to be missing the MySQL which is required for WordPress.

I was quite suprise to see it, couse I hadn't been doing anything with my server configuration before, and yet something happend and this site was not working. What's more, my apache, php, mysql, phpmyadmin were working perfectly.

So, I did a little bit of googling, and I found solution on wordpress officiale site here.

I needed to add those lines just before mysql test in wp-settings.php:

if (!extension_loaded('mysql')){
if (!dl('mysql.so')) {
exit;
}
}

I also tried the second possible solution listed there, but it wasn't working.

Saturday, June 24, 2006

Mounting nfs share

When my nfs server is running, it would be nice to mount this share. I use Ubuntu 5.10 as one mounting the nfs share. In fact, I have access to few Ubuntu based servers, so my experience is mainly base on Ubuntu distribution.

Firts of all, to mount on Ubuntu you need root privilages. Asummig you have them, mounting is childish.

Actual mounting can be made in two ways:

  1. Manually - as root you mount using mount command:
    mount -t nfs 196.17.43.65:/home/me/mynfs /home/menew/mounted_nfs
    where:
    • -t nfs - we mount nfs
    • 196.17.43.65:/home/me/mynfs - IP and sheared folder
    • /home/menew/mounted_nfs - where this share should be installed on our local file system
  2. Using /etc/fstab
    Add one line to /etc/fstab describing your nfs volume e.g.: 196.17.43.65:/home/mwolski/mynfs /home/menew/mounted_nfs nfs noauto,rw,users,owner 0 0
    Thanks to this to mount you as a normal user can execute
    mount /home/menew/mounted_nfs

To unmount nfs partition, you invoke umount /home/menew/mounted_nfs just like normal other partition.

Used options in fstab

  • noauto - the nfs is mounted only explicitly,insead of being mount at bootup
  • users - normal user can mount this volume
  • owner - only owner of local directory (/home/menew/mounted_nfs) can mount
  • rw - mount is read/write

Friday, May 05, 2006

Ruby: One click Installer

I was writing a lot how Ruby is cool and great. But now I have come across two problems, or rather annoyance. First of all few days ago I tried to use Ruby on Windows XP; hence, I had installed One-Click Ruby Installer. According to description it contains 'Ruby language itself, dozens of popular extensions, ...'. So I installed it without any problems, it run also without any problems. Nevertheless, I wanted to program some script using Tk. So I was quite surpriese when I found out that I cannot use Tk. Of course due to this, I did not do any programming. Of course this is because I did not install Tk on Windows, but without the access to the Internet, it was hard to do it.

The funny thing about this is, that when you working mostly with Unix based systems (Mac X, Linux, Solaris) many things you assume for granted, like presence of Tk. I forgot that on Windows there is no Tk, just like many other things :-)

Second thing is rather not Ruby but Tk itself. I think that combo boxes are quite useful in GUI applications; nonetheless, Tk does not have combo box widgets. This I already knew from Perl, but with comparison to Ruby, Perl has third party modules that provide combobox functionality eg. JComboBox, Tix. Problem with Ruby is that there is no combobox out of the box, and even though there is Tix port to Ruby (here), its documentation is in Japanese, so for me and for many other programmers it rather not very useful.


Wednesday, April 19, 2006

Latex: Sorting and referencing using bibtex

Standard way of referencing in Latex is to put references number is square brackets, ,e.g., [3]. However, sometimes it is necessary to put references in superscript. To do this in TexShop it is enough to include package Natbib and use it like this:\usepackage[super,sort&compress,numbers]{natbib} This results in reference numbers as shown below
instead of standard way:

Wednesday, April 05, 2006

Ruby: Real number precision

If you do some things that involve float/real/double numbers in Ruby, you must lookout for one thing. For example if one write code like this:

#!/opt/local/bin/ruby

(0..5).each {|x|
puts x/2
}

the result will be:

0
0
1
1
2
2

As everyone can see those results are quite incorrect, cause Ruby assumes that x/2 is division of two integer numbers; hence, the result also must be integer. Such small thing, can be very unseen and hard bug to detect, especially if long, mathematical function is written.
Correct version of the above code is:

#!/opt/local/bin/ruby

(0..5).each {|x|
puts x.to_f/2
}

The result finally is ok:

0.0
0.5
1.0
1.5
2.0
2.5


I had this bug lately and it took me quite a time to find out why my program gives incorrect results.

Friday, March 03, 2006

imagemagick: apply median filter

Apply median filter of radius 2:for f in *.tiff; do convert -median 2 $f ../outDir/$f; echo $f; done

Sunday, February 12, 2006

Matlab code time execution

Most people is familiar with tic; toc; commands in matlab to check execution of their code;

But more detail insight into this problem is by profile viewer.


This nice tool shows exactly how much time is used by each line, how many times it is executed. Moreover, profiler also gives some suggestions how to improve execution time.

For example, thanks to profiler I was able to reduce time of one image processing program from few hours to few minutes. Profiler showed me, that very simple operation, takes huge amount of time. Just by removing, changing and rewriting few time consuming lines, I was able to significantly shorten exec time of my program.

Thursday, February 09, 2006

Mac X: Changing bash prompt in X11's xterm

Default bash prompt in my X11's xterm was:PS1="\h:\w \u"This was very annoying as the prompt contained all the path to the current directory, which was especially bed if I went dip into the directory tree. In such a case it is better to use '\W' option instead of '\w', as this option shows only current directory name, and not full path to it. To change bash prompt use:export PS1="\h:\W \u$ "To make it permanent just add this line to ~/.bashrc.

Thursday, February 02, 2006

Unreal Tournament 2004: Make it slower

UT2004 is very nice and one of my favorite games. One nice option it has it is possibility to setup the speed of the game. You cannot do it in game itself, however, to do it, you must edit: UT2004.ini file in: \UT2004\System and change the value of variable GameSpeed Originally: GameSpeed=1.000000

I use GameSpeed=0.650000 My computer is not fast enough to render the game in its original speed. Moreover, with slower action, it is easier to observe all those special effects that game has - you can observer, e.g., rocked heading your way, which is pretty nice.