Compile Thunderbird 3.0 on CentOS 5.4 (64 bit) With Enigmail 1.0.0.

I used the following procedures to install Thunderbird 3.0 with the Enigmail add-on to send encrypted email. I found myself needing to do this when I upgraded Thunderbird via yum from the CentOS repository. Instead of going back to the older version, I decided move ahead since I had also had trouble with the 64 bit version of Thunderbird when using the Enigmail add-on. Also, I liked the changes made from Thunderbird 2.0 to 3.0 that I saw in Fedora. Note: I found that I needed to remove the old Enigmail add-on before upgrading. Then after following the steps below, I installed the latest Enigmail add-on.

# yum –disablerepo=rpmforge install cvs zip gcc-c++ glib2-devel gtk2-devel fontconfig-devel libnotify-devel libIDL-devel alsa-lib-devel libXt-devel freetype-devel pkgconfig dbus-glib-devel curl-devel autoconf213 xorg-x11-proto-devel libX11-devel libXau-devel libXext-devel

The following was installed from the rpmforge repository.
# yum install mercurial
# cd /usr/local/src
# wget ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/3.0/source/thunderbird-3.0.source.tar.bz2

# tar -xjvf thunderbird-3.0rc2.source.tar.bz2
# cd comm-1.9.1/
# vi .mozconfig

ac_add_options –prefix=/usr/local/thunderbird
ac_add_options –disable-tests
ac_add_options –disable-debug
ac_add_options –enable-crypto
ac_add_options –enable-optimize
ac_add_options –enable-static
ac_add_options –enable-static-mail
ac_add_options –enable-application=mail
mk_add_options MOZ_CO_PROJECT=mail

# make -f client.mk configure
# make -C mozilla tier_base
# make -C mozilla tier_nspr
# make -C mozilla tier_js
# make export
# make -C mozilla/modules/libreg
# make -C mozilla/xpcom/string
# make -C mozilla/xpcom
# make -C mozilla/xpcom/obsolete
# cd mailnews/extensions/
# wget http://www.mozilla-enigmail.org/download/source/enigmail-1.0.0.tar.gz
# tar -zxvf enigmail-1.0.0.tar.gz
# cd enigmail/
# ./makemake -r
# make
# cd /usr/local/src/comm-1.9.1
# make -f client.mk build
# gmake install

Modify Windows registry using VB script.

Here is an example of a VB script I used to set the domain suffix search list on a Windows machine. I just saved the following in a file with a vbs extension and executed the script.

SET WSHShell = CreateObject(“WScript.Shell”)

WSHShell.RegWrite “HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\SearchList”, “mydomain1.com,mydomain2.com”, “REG_SZ”

Install Windows XP on a laptop without a CD/DVD drive.

The following was done on a machine running CentOS 5.4 and Vmware Workstation 7. I used a Kingwin PATA USB enclosure for a 20GB 2.5” hard drive that came out of a Dell Insprion 4100 laptop.

Download 59874-dos71cd-26343.zip from http://www.syschat.com/download60.html&act=down.

Unzip the file, and burn the DOS71CD.ISO image to a CD. I used K3b on my CentOS 5.4 host.

Remove the laptop hard drive and put it in a USB drive enclosure.

Connect laptop hardrive in USB enclosure.

The drive should have all partitions removed, so the DOS installation can create a partition during install.

Create MS-DOS Vmware instance with the USB drive accessed via a physical drive (The only hard drive for this instance.), and the DOS71CD.ISO image file as the CD device.

Make sure that both have “Connect at power on” checked.

Boot the CD/ISO by powering on the newly created Vmware instance.

Go through the installation process and allow the installation to create the boot partition and install the MBR and install Smartdrv.

Once the installation is completed, verify that the USB drive boots by unchecking “Connect at power on” for the CD.

Boot the drive up to verify is boots DOS.

Power down the Vmware instance.

Then, copy the I386 directory from the Windows XP CD to the USB drive. I did this from my CentOS 5.4 Vmware host.

Remove the hard drive the enclosure, and put it back in the laptop.

Boot the laptop into DOS. Note: This did not work for me. I had to boot off a floppy and use “fdisk /mbr” to fix the Master Boot Record. Once, I did this things went pretty quickly.

Run smartdrv. Note: This made a huge difference.

Cd i386.

Run winnt.exe.

This will take quite a while (hours even, although not so in my case). It will even appear stuck on the copying files screen, but it will still be working.

I had to boot a few times during the XP install during the copying files stage. It looks like the install also repaired the boot loader. Nonetheless, in the end it is working fine.

Create Firefox policies in Windows Server 2008

I used the following procedure to be able to create and manage Firefox via Windows Server 2008 Group Policies. I used a solution provided by FrontMotion (http://www.frontmotion.com). I used the Firefox Community Edition which is Firefox packaged as an msi for deployment from an Active Directory. Use it for deployment, but instead wanted to manage Firefox browser setting via a Group Policy.

I started on my Windows 2008 Server, by download the firefox.adm (Administrative Template) from http://www.frontmotion.com/Firefox/firefox.adm.

Then from the Group Policy Management, clicked on “Group Policy Objects” and then “Default Domain Policy,” since I wanted to implement these policies for the entire domain. From here, click on the “Settings” tab, and right mouse click in the “Settings” windows pane and select “Edit.” This will bring up the “Group Policy Management Editor.”

Click to expand “User Configuration”/”Policies.” Note: You put this in the “Computer Configuration” as well.

Right mouse click “Administrative Templates: Policy definitions (ADMX files) retrieved from the local machine.” and select “Add/Remove Templates.”

Click “Add” and navigate to where you saved the firefox.adm you download earlier to add the adm.

This will add the Firefox policies to “User Configuration”/”Policies”/”Administrative Templates”/”Classic Administrative Templates.”

From here, you can set your policies. Such “Cache” and “Proxy Settings.”

When you are done, exit out of the “Group Policy Management Editor.”

From “Group Policy Management”, you should be able refresh (right mouse and hit “Refresh”) the “Default Domain Policy.” I closed “Group Policy Management” and re-opened it.

Once refreshed, you be able to see the new policies under “Default Domain Policy”/”User Configuration”/”Administrative Templates”/”Firefox.”

Now the policies are set.

Onto the client. As I mentioned before, I did not use the FrontMotion solution to deploy Firefox. I just installed the msi download from FrontMotion (http://www.frontmotion.com/Firefox/download.php?fileid=3652). Then, to test my policies, I logged in as a domain user. All of my policies were set.

Snow Leopard – Enable 64 bit

To enable the 64 bit kernel, hold the 6 and 4 keys while booting. Likewise, to enable the 32 bit kernel (if it is not your default), hold down the 3 and 2 keys while booting. By default, Snow Leopard has the 32bit kernel enabled to provide better application support until developers have ported their applications over to 64bit.

To permanently make the 64bit kernel your default enter the following from a Terminal session.

Update:
This didn’t work for me.
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.Boot ‘Kernel Flags’ ‘arch=x86_64’

However, this did:
nvram boot-args=”arch=x86_64″

To verify the kernel you are running, click on the Apple symbol in the top left corner and client “About this Mac.” Then, click “More Info…” and then Software. Look for the following:

64-bit Kernel and Extensions: Yes

If running the 32-bit kernel, it would read the following:

64-bit Kernel and Extensions: No

MacOSX – Burn a DMG or ISO image to disc.

Bring up the Disk Utility in Applications/Utilities.
Drag and drop the image file to the left window pane. The image file will be listed along with your other disk drives.
Click on the newly listed image file to select it in the Disk Utility.
Click on the Burn icon on the top toolbar.

MySQL Commands

I intend to add to this as I have time.

To display the schema of a table:

mysql> desc tablename;

To restore a database from backup:

mysql -u root -p
mysql> create database databasename;
mysql> use databasename;
mysql> source databasebackupfile;
Note: I back my databases up to a file name of databasename.sql.

To update all records in a column of a table:

mysql> update tablename set columnname=’value‘;

To update one record in a column of a table. Note: othercolumnname needs to be unique to the record.:

mysql> update tablename set columnname=’value‘ where othercolumnname=`somevalue‘;

To create an account:

GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’hostname‘ IDENTIFIED BY ‘password‘;
GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’localhost’ IDENTIFIED BY ‘password‘;
FLUSH PRIVILEGES;

To make mysqld listen only localhost:

vi /etc/my.cnf

bind-address=127.0.0.1

To count the number of rows in a table:

SELECT COUNT(*) FROM tablename;

To remove formatting and heading from a SELECT statement and delimit using a TAB character:

mysql mydatabase -N -B -u myuser -p -e “myselect statement;”

How to convert timestamp to date from a SELECT statement:

SELECT column1,DATE_FORMAT(FROM_UNIXTIME(`column2`), ‘%b %e %Y’) AS ‘date_formatted’ FROM tablename;

Here is a simpler example, where timestampcol is the name of date column you want to convert:

SELECT FROM_UNIXTIME(timestampcol) FROM tablename;

How to get the time an hour ago:

SELECT TIME(DATE_SUB(NOW(), INTERVAL 1 HOUR));

To access a MySql database from a script without having the password stored in the script:
Add the information to the .my.cny file in the user’s home directory that the script will run under.

Edit or create the file:

# vi ~/.my.cny

Protect the file:

# chmod 600 ~/.my.cny

Sample file contents:

# cat ~/.my.cny
[client]
user=mysqlusername
password=mysqlpassword
database=defaultdatabase

Then, to use it:

# mysql < mysqlscript > my.output

Display table information:

show table status from databasename;

How to backup one table:

# mysqldump -u mysqlusername -h mysqlhostname -p databasename tablename > tablename.sql

To search or output of a query. This would also apply to a SELECT statement.:
SHOW TABLES LIKE ‘%whatever%’;

To limit the number of rows:
SELECT * FROM mytableLIMIT 100;

To sort output based on a particular column:
SELECT * FROM mytable ORDER BY mycolumn DESC;

To get the size of a databse:
SELECT table_schema “Database Name”, SUM( data_length + index_length)/1024/1024
“Database Size (MB)” FROM information_schema.TABLES where table_schema = ‘mydatabase‘;

To get the size of all the tables in a database:
SELECT table_name “Table”, table_rows “Number of Rows”, round(((data_length + index_length)/1024/1024),2)
“Size of Table” FROM information_schema.TABLES WHERE table_schema = “mydatabase“;

To allow an account to export data to a file:
GRANT FILE ON *.* TO ‘username‘@’hostname‘;

Configure Finder to display the hidden files and directories.

From a Terminal session, type in the following:

To display hidden files:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To hide hidden files:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Updated my blog to use Yourls plugin.

This looks like is could be a pretty interesting plugin. We will see.

Well, my first attempt at this did not work so well. I have my own domain (tyni.info) and I am now trying to use it.

Well, at least I got yourls to work. However, I still having trouble getting the twitter plugin to work.

All right, I got this to work. The version I installed today worked fine with my yourls installation using my own shortened url. Cool stuff.

I used the the version 1.2.1 of the plugin (http://planetozh.com/blog/yourls-wordpress-to-twitter-a-short-url-plugin/). This is the one that worked for me.

I downloaded and installed yourls from http://code.google.com/p/yourls/downloads/list.
I downloaded and installed t he yourls WordPress plugin from http://planetozh.com/blog/yourls-wordpress-to-twitter-a-short-url-plugin/.

Sed to remove first or last character in a string.

To remove the first character in a string:
echo $STRING |sed ‘s/.\(.*\)/\1/’

To remove the last character in a string:
echo $STRING | sed ‘s/\(.*\)./\1/’

To remove the last five characters in a string:
echo $STRING | sed ‘s/\(.*\)…../\1/’

To remove all whitespace at the end of the line:
echo $STRING | sed ‘s/[ ]*$//’

Return top

INFORMATION