enrii.blog

A passionate programmer’s findings in the world of internet.

Archive for the 'Software and tools' Category

Redirect a Directory to New Location using .htaccess

Wednesday, October 19th, 2011

After migrating system from temporary server to a new server, we will have to request all users to go to the new site.

I am not an expert in Apache rewrite rules, but finally found this way to redirect everything from a specific directory to a new location.

RedirectMatch 301 / http://blog.enrii.com

Save the file as .htaccess, then put the file into the folder you want to redirect (should be somewhere inside your htdocs folder). Replace http://blog.enrii.com with the new site that you want to redirect.

In case it doesn't work, see if the following line in httpd.conf is commented:

LoadModule rewrite_module modules/mod_rewrite.so

Un-comment it if necessary.

That's how I finally got it working. Please let me know if I am not doing it correctly.

Just Downloaded Firefox 3.5.1

Sunday, July 19th, 2009

Installed Mozilla Firefox version 3.5.1.

As with every Firefox release, I was expecting that it would reduce memory consumption, but it's didn't happen, or it wasn't obvious. With only four tabs running, it's using 125MB of memory.

On the UI, I notice a "new tab" button on the tab bar. I would normally have to double click on the tab bar to create new tab. Now, I can do it with single click on that button.

In the Options, I notice a new tab, the Privacy tab. But the content of the tab seems to be taken from other tab to create this new tab.

Nothing interesting. Still, it's worth upgrading. They had put lots of effort to enhance the stability and security of the browser.

Get yours: Mozilla Firefox

Microsoft Office Reactivation after Hardware Failure

Saturday, July 11th, 2009

I write PHP systems for companies. To keep the disaster recovery process easy, I always suggest to buy multiple computers with the exact same configuration. So, when the internal server that runs the PHP program failed, they can recover it by unplug the hard disk and plug in to another PC. Within minutes, the system is up and running again!

With few of my clients running on this same configurations, the actual disaster only happen few days ago. The lightning strike hit the server computer and it failed. Totally dead. Replacing the power supply didn't help.

So, I had to do disaster recover by moving the hard disk to another computer. I didn't realise that Microsoft Office 2007 actually detects what hardware it is running on.

This morning, the Microsoft Office didn't work. It says something like:

The Microsoft office systems detected hardware changes on your computer.

The PHP script that called Microsoft Excel COM failed. It requires reactivation. Reactivation is easy, can be done with just 2 clicks of mouse. But would Microsoft disable the license and ask me to buy another new copy?

A sane mind will agree that evil Microsoft will force me to do so. The office has spent more than RM10,000 on Microsoft licenses. They will definitely find more ways to squeeze more money from us!

Unbelievably, the reactivation was successful.

Although it good for now, I'm not sure whether I will get another message like "You are running a pirated version of Microsoft Office, please get a genuine version" tomorrow.

How to Recover Corrupted Excel File?

Friday, November 28th, 2008

When you an try to open a Microsoft Office Excel file, you get an error message that sounds like:

The file you are trying to open, 'XXX.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file?

Most of the time, when you get that message, your Excel file is corrupted. Here's a way to get data from your corrupted file.

  1. In office 2007, click on the round office button, then 'Open' (in older versions, go to File > Open).
  2. Select the problematic Excel file. Then, click on the small triangle on the right of the 'Open' button.
  3. Click on 'Select and Repair...'.
  4. Then, 'Extract Data'.
  5. Try both 'Convert to Values' and 'Recover Formulas' ('Convert to Values' works for me).

The small menu at Open button if you can't find it:
Open Button in Excel

Of course, you are going to lose some formatting or data, but at least you still have something.

Hope this helps.

Firefox 3 Released

Thursday, June 19th, 2008

Firefox 3 is finally released. I have been reading about its features again and again in the blogosphere. I keep stopping myself from downloading Release Candidates or Beta version but to wait for the actual release. I have just downloaded and installed.

The first impression is great. They replaced all the icons with something simpler. I also heard from my colleague that the memory leak problem has been fixed. I'm not going to cover each and every new feature, they have been fully documented at the website.

Anyway, I found some problems in this release. I suppose it's a bug. When I create a text field with a certain maximum length and a value longer than the maximum length, it seems be showing the value. In the older version, the value is truncated with the length specified in maxlength.

If you don't get what I'm trying to say, put the following code in any HTML file, then open it with Firefox 3. Edit the text in the text field and you will understand.

<input type="text" value="12345" maxlength="3" />

The second problem that I found, would be Google Browser Sync no longer supports Firefox 3. I had to switch to Foxmarks. It does not really affect me because I was only syncing bookmarks with Google Browser Sync.

Every thing else is great so far. So, go grab Firefox 3 now.