In my development machine i wanted to have a specific vHost for each project. Something that would allow me to type URL like:
- http://wordpress-test1.lan/
- http://phpmyadmin.lan/
- http://project1.lan/
I started to set for each one a vHost in Apache but after a while I've found myself with too many vHost files.
So I started to search for a more easy and fast way, and here it is:
Note: you need to install Apache mod_rewrite to make things work.
Preamble:
- You have Apache installed, and your DocumentRoot is /var/www/
- You have mod_rewrite installed and enabled
- You can modify the /etc/hosts file
Let's say we want to install a test/demo version of WordPress and access it from the URL http://wp-test.lan/
- We download and untar WordPress in /var/www/wp-test/
- We tell our machine to resolve the domain wp-test.lan with the IP 127.0.0.1. To make this we add a line to our hosts file.
hpatoio@namazu:~$ sudo su -
[sudo] password for hpatoio:
root@namazu:~#echo "127.0.0.1 wp-test.lan" >> /etc/hosts
root@namazu:~#exit
hpatoio@namazu:~$
- Now we have to change Apache config. Open /etc/apache2/sites-anabled/000-default with your favorite editor and add these lines inside the <VirtualHost *> directive:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.lan$
RewriteRule ^(.+)$ /%1$1 Basically :
- The first line turns the mod_rewrite on
- The second one tells Apache to keep in the host part of the URL (HTTP_HOST) everything that stands before ".lan"
- Finally the third line insert the string matched before (%1) between the host and the resource part (directory + file + query string) of the requested URL
- Restart Apache
hpatoio@namazu:~$sudo /etc/init.d/apache2 restart
Now if open your browser and you point it to the URL http://wp-test.lan/ you should see the WP installation page. Right ?
Posted in apache, Ubuntu | 1 Comment »

???
Posted in Party | 1 Comment »
It has to start somewhere,
it has to start sometime !
Which better place than here ?
Which better time than now ?
Posted in life, Party | No Comments »

Giusy, Kathrin and me. Thanks to Adeline (on the other side of the camera
Like the last 4 years, few days ago, I was in Clusone for the Estate di S.Martino, I love this village and the feeling you get during the happening. Lovely wine, traditional food and true friends … need more to be happy ?
If the next year you wanna come mark this site: www.bandabidu.org.
Posted in life, Party, Travels | No Comments »

Reading and writing in Amsterdam !

Under the belly ...
Posted in Party, Travels | 8 Comments »
If you have access on the machine with MySQL and you need to export all tables in a database you can use:
hpatoio@namazu:~$ mysqldump -uroot -p DATABASE_NAME -T '/home/simone/export_csv' --fields-terminated-by "," --fields-enclosed-by '"' --lines-terminated-by "\n"
the script will create a files for each table of the DB and will place it in export_csv.
If you need to export a custom resultset or you need to export data from a remote MySQL server on your machine you can use this command :
hpatoio@namazu:~$ mysql -uroot -h HOSTNAME -p DATABASE_NAME -B -e "select field1,field2 ... fieldX from \`TABLE_NAME\`;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > my_export.csv
Posted in Computer, MySQL, Things I forget | No Comments »
Amazing online tool to convert MDB Microsoft Access file to MySQL SQL scripts !
Check it out -> http://www.mdb2mysql.com/
Posted in MySQL | No Comments »

Joelle and I
And also for this year my vacations are finished. Many people I've met on the way … some were already friends, some were new
.
I could write for hours trying to tell you who I meet and where I was, but, as you probably know I'm not good in telling stories.
So just wanna say thanks to : Jan, Rebekka, Bugo, Vale, Gio, Anca (even if it didn't work), Joelle and all the people at the NEVA meeting, Linnea, Kenneth and all the Tjärnkvist family, Karsten, Liga, the lovely people in Ultervattnet, the backpackers at the Sunflower Hostel, Adam and of course to Swedish Police
Due I didn't have a camera with me there are no pictures of the vacations, except for this one …
Posted in English, Sweden, Travels | No Comments »
I was looking for a good and clean editor for one of my customers, and I end up to WYMeditor !
That's the way I like, that's the way I meant !
Posted in Computer, English | No Comments »
shiftDay = 10
var myDate = new Date();
myDate.setDate(myDate.getUTCDate() + shiftDay)
day = myDate.getUTCDate()
month = myDate.getUTCMonth()*1 + 1
year = myDate.getUTCFullYear()
This code is quite easy:
- shiftDay hold the number of days you want to add, if you need to go backwards you can set it to a negative value.
- myDate is set to the current date
- At the end we will have the data we need in day, month and year.
- getUTCMonth return the current month shifted back by one (January is 0, February is 1 and so on) that's why we add 1. We multiply the value returned by getUTCMonth by one to cast it to integer.
Posted in Computer, javascript, Things I forget | No Comments »