Remove string from file

As I have been trying to figure out how to remove a specific string and not leave a blank line in a file, perl has really saved my day.

perl -ni -e 'print unless/mydomain.com/' virtualdomains

Back to developing scripts now :)

Hope this helps someone too.

openOleDBConnection The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine

I have just completed a migration for a friend of mine. As he is upgrading the server from Windows 2003 32bit to 64bit version, the site was hit with alot of errors not loading the right stuff for his .aspx files.

The following error was presented to me when trying to login to his administrative panel.

openOleDBConnection The ‘Microsoft.Jet.OLEDB.4.0′ provider is not registered on the local machine

Let me present you the solution:

http://support.microsoft.com/kb/894435

You need to convert the ASP.NET installation to 32bit version.

After which, type “iisreset” in the cmd prompt to restart your IIS services.

One last step which was not shown on the web, you need to go to IIS ->Web Service Extensions -> Enable “ASP.NET v2.0.50727 (32-bit)”

One last time, type “iisreset” in the cmd prompt to restart your IIS services.

Now your site should be functioning properly now.

Enjoy!

Mass Delete Kayako 3 Comments

If you have more than 100 spam comments to delete, you might need to spend quite a fair bit of time to delete. Time is precious. Here is a quick way to mass delete all the comments.

DELETE swcomments, swcommentdata FROM swcomments, swcommentdata WHERE swcomments.commentid = swcommentdata.commentdataid AND swcomments.isapproved = '0';

I am not responsible for any damage caused in your system, please DO backup before you execute any SQL query.

Hope this helps!

mysqlhotcopy cause MySQL server has gone away

As I was performing a backup for a ~5GB database on a new db server, I encounter this error.

DBD::mysql::db do failed: MySQL server has gone away at /usr/bin/mysqlhotcopy line 521.

The above means that the MySQL timeout while doing the mysqlhotcopy, you just need to increase the timeout. If your database is really huge, you will need to adjust the timeout accordingly.

For me, I will just set 15mins.

Append the following lines to /etc/my.cnf under [mysql] section

interactive_timeout = 3600
wait_timeout = 3600

Hope this helps!

Windows 2008 Activation Issue

I was hit with this error.

Code: 0x8007232B
Description: DNS name does not exist.

Quick Solution:

slmgr.vbs -ipk [your product key]
slmgr.vbs -ato

Enjoy!

Migrating GPG keys

As I am storing backup remotely, I used GPG to encrypt my stuff on-the-fly using duplicity.

Due to the upgrading of the current machine to a more powerful machine, I need to move my GPG keys too.

Here is how I do it.

List the available GPG key in the store.

 
[root@svr ~]# gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub   1024D/A1FC0247 2011-01-07
uid                  tanfwc <tanfwc @happylife.sg>
sub   2048g/F96387B6 2011-01-07
</tanfwc>

Let’s export the keys accordingly.
Continue reading ‘Migrating GPG keys’ »

Cluster Glue

As I am installing Cluster Glue, I bump into the following error. I was looking around the Internet and unable to find a answer thus I have to look into what package CentOS build libuuid into :)

Problem:

./.libs/libplumb.so: undefined reference to `uuid_parse'
./.libs/libplumb.so: undefined reference to `uuid_generate'
./.libs/libplumb.so: undefined reference to `uuid_copy'
./.libs/libplumb.so: undefined reference to `uuid_is_null'
./.libs/libplumb.so: undefined reference to `uuid_unparse'
./.libs/libplumb.so: undefined reference to `uuid_clear'

Solution:

yum install -y e2fsprogs-devel

Hope the above helps someone out there.

Changing Linux Network Interface Bonding

WARNING: The following steps will stop your network interface, please ensure that you have KVM-Over-IP before attempting to do it remotely.

If you ever had to change the bonding type while the server is live, follow the steps:

[db2:/root]# ifdown bond0
[db2:/root]# modprobe -r bonding
[db2:/root]# modprobe bonding mode=1 miimon=100
[db2:/root]# ifup bond0
[db2:/root]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
 
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
 
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 
 
Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr:

Hope this helps someone out there.

Windows Firewall can not run because another program or service is running that might use the Network Address Translation component (IPNat.sys)

Encounter a problem that cause my windows box to be offline remotely :(

I had to spend quite a fair bit of my time to look into this.

If you attempt to start the Windows Firewall, you will notice that you will get this error message:

Windows Firewall can not run because another program or service is running that might use the Network Address Translation component (IPNat.sys)

This is because “Routing and Remote Access” is enabled.

You can disable by doing this:
Start -> Run -> cmd -> mmc
Add “Routing and Remote Access” under the Snap-In.

Disable the protocol for the “Routing and Remote Access” now. You will need to restart your server for it to take effect.

You should be able to start your Windows Firewall now and gain access to the server remotely :)

Hope this helps…

Locating Dell Service Tag in Linux

Here is a quick command to retrieve Dell Service Tag number remotely.

dmidecode|grep -A 2 "PowerEdge"

Hope this helps…