Cool simple way to remove dead links from iTunes Library

December 12th, 2008

Found this by chance after looooong dig on the ‘Net, therefore reporting here since it’s as simple as efficient!

1. Make a smart playlist called “All Files” with this rule: “Artist” is not “123456789″ (or any nonsense name that won’t be in your library).

2. Make a static playlist called “All Live Files”.

3. Make a smart playlist called “Missing Files” with these rules: Match all of the following rules, Playlist is “All Files”, Playlist is not “All Live Files”

4. Select all the files from “All Files” and drag them into “All Live Files”. The dead files marked (!) will not copy over.

5. “Missing Files” will contain all of your dead files. Select all and delete. Voila, a nice clean iTunes library.

I have these three playlists in their own folder. Whenever I gather more than a couple dead tracks for whatever reason, I delete all the tracks in “All Live Files” and repeat steps 4 and 5.

NOTABENE: when you select all files in the Missing Files Smart Playlist, Delete option is grayed out. You need to use key combination SHIFT+DELETE in Windows and OPTION+DELETE in Mac to perform deletion.


Email this post Email this post

Replace characters in MySQL

December 10th, 2008

It happens sometimes that due to database migration, you see spurious characters in MySQL tables and you would like to intervene massively (thick for instance to forums) and replace them with proper characters.

Luckily this is easily doable if you manage to have connection to DB with command line interface or web based system allowing you to issue SQL statements.

Command to use is:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);


Email this post Email this post

My Linux changed eth0 with eth1…

December 10th, 2008

This is happening, for instance, when moving a Virtual Machine from one Server to another or when changing the physical network adapter of a server.

The reason is that NIC’s MAC Address changes, therefore Linux perform a new HW detection and creates new adapter definition, ending in situation where there’s no more eth0 but only eth1… and if /etc/networks was configured to use eth0 it will default to DHCP mode causing issues.

How to solve?

You need to edit file /etc/udev/rules.d/70-persistent-net.rules

In this file you will find one line per each network device detected.

For instance in case of detected eth1 and disappeared eth0 it will probably read something like:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:74:1f:c6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:72:6f:c8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

where the second entry reports the currently detected MAC address.

How to solve this?

Delete the first line and edit the second line changing "eth1" in "eth0"… then I guess you need to reboot and eth0 will automagically reappear.


Email this post Email this post

Apache VirtualHost and Certificates for HTTPS

December 9th, 2008

I’ve finally managed to get this working, so now I need to write some note in case I have to redo it in the future :)

This is short howto about enabling https and multiple virtual hosts on Apache 2.0.

Much of the instructions are copypasted from Debian Admin Website where I found great guide I’ve successfully followed.

First of all let’s check that we have all the needed components, or proceed to install them as follows:

Install apache2 in debian etch

#apt-get install apache2

Install openssl using the following command

#apt-get install openssl ssl-cert

Install PHP5 support for apache2 in debian etch

#apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

Once you install apache server you need to Generate a certificate,Enable Apache SSL support and Configure your SSL options.

Generate A certificate

Generating a certificate will provide to protect the traffic exchanged between clients and your server, however it will be unsigned by a trusted certificate authority so it will generate warnings.

If you want to avoid these warning messages you need to get a trusted certificate from SSL certificate vendors.If you want to Generating an SSL certificate for Apache2 you need to use the openssl. This will ask you questions interactively then generate the certificate file appropriately.

Note:-For generating certificate you might have used the apache2-ssl-certificate command in debian sarge but in debian etch this command not available.If you want to generate certificates you need to use openssl from you command prompt Use the following command to generate certificates

#openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem

Now you’ll be prompted to configure the Certificate details. Answers are reflecting MY environment… yours might be different…

Generating a 1024 bit RSA private key
………………………………………….++++++
…………………………………….++++++
writing new private key to ‘/etc/apache2/apache.pem’
—–
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:IT
State or Province Name (full name) [Some-State]: Italy
Locality Name (eg, city) []:Milan
Organization Name (eg, company) [Internet Widgits Pty Ltd]:The RoarinPenguin Inc.
Organizational Unit Name (eg, section) []: Certification Department
Common Name (eg, YOUR name) []: The RoarinPenguin
Email Address []:roarinpenguin@roarinpenguin.com

You ahould now have our certificate ready, thus you’ll proceed in setting the proper permissions:

#chmod 600 /etc/apache2/apache.pem

By default the server will listen for incoming HTTP requests on port 80 - and not SSL connections on port 443. So you need to enable SSL support by entering the following entry to the file /etc/apache2/ports.conf save and exit the file.

Listen 443

Enable SSL Support

If you want to enable SSL support for your apache web server you need to use the following command:

#a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.

Now you need to restart the apache2 server using the following command

#/etc/init.d/apache2 restart

Configuring SSL Certificate to Virtual Hosts in Apache2

First you need to edit the /etc/apache2/sites-available/default file change

NameVirtualHost *
to

NameVirtualHost *:80
NameVirtualHost *:443

Now you need to configure Virtual hosts using port 80

My apache2.conf reads the following at file end:

# Include generic snippets of statements
Include /etc/apache2/conf.d/

NameVirtualHost *:80
NameVirtualHost *:443

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
AddDefaultCharset utf-8
DefaultLanguage it
ServerAdmin
marco@rottigni.net
UseCanonicalName off
DocumentRoot /var/www
ServerName webby.rottigni.net

And my /etc/apache2/sites-available/default reads:

<VirtualHost *:80>
DocumentRoot /var/www/
ServerName
www.rottigni.net
<Directory "/var/www">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/
ServerName
www.rottigni.net
<Directory "/var/www">
allow from all
Options +Indexes
</Directory>
    SSLEngine on
    SSLCertificateFile /etc/apache2/apache.pem
</VirtualHost>

Then I’ve enabled several websites using command

a2ensite followed by site name you want to enable.

Configuration files for VirtualHosts are stored in

/etc/apache2/sites-available#

and the configuration for one of my blog reads

<VirtualHost *:80>
DocumentRoot /var/www/myblog
<Directory "/var/www/myblog">
allow from all
Options +Indexes
</Directory>
ServerName myblog.rottigni.net
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/myblog
<Directory "/var/www/myblog">
allow from all
Options +Indexes
</Directory>
ServerName myblog.rottigni.net
    SSLEngine on
    SSLCertificateFile /etc/apache2/apache.pem
</VirtualHost>

That should be everything… oh, and don’t forget to reload your Apache config:

# /etc/init.d/apache2 reload


Email this post Email this post

Cleanup SPAM users in PHPBB2

December 5th, 2008

Once you have access to DB, the SQL string is:

DELETE FROM phpbb_users WHERE user_active=0 AND user_id>0

This will cleanup all the users marked as non active, thus most likely spam.


Email this post Email this post

Techielinks for November 16th through November 30th

November 30th, 2008

These are my links for November 16th through November 30th:


Email this post Email this post

Configuring layer two VM as inline IPS in VMware ESX

November 19th, 2008

To setup properly the portgroups in VMware vSwitching environment, we had to create two portgroups per vSwitch as depicted below:

schema for connecting two vswitch with SG IPS in ESX

Reason for this configuration is that “operative portgroups” where servers and machines are connected should not be in Promiscuous mode to avoid sniffing other machines’ traffic, while portgroups dedicated to IPS inline ports must:

    be configured in promiscuous mode to receive all traffic of the vSwitch they are connected to

    be part of VLAN ID 4095 to “pass” all VLAN IDs to Virtual Machine without any intervention


Email this post Email this post

Techielinks for November 14th from 10:50 to 10:50

November 14th, 2008

These are my links for November 14th from 10:50 to 10:50:


Email this post Email this post

What does it need to have graphical XFCE4 environment at startup in Ubuntu 8.10 (intrepid)

November 14th, 2008

Taking short note so I’ll never forget this again ;)

  • apt-get install x11-common (if not already there)
  • apt-get install xfce4-session
  • apt-get install xfce4
  • …and naturally ;) apt-get install xdm

Should you need to set runlevel 3 by default (I wanted it), edit /etc/rc-default and replace lines running telinit 2 with telinit 3.

Reboot.


Email this post Email this post

Techielinks for November 8th from 09:17 to 23:36

November 9th, 2008

These are my links for November 8th from 09:17 to 23:36:


Email this post Email this post