Archive

Archive for the ‘Tech’ Category

How to Change/Extend phpmyadmin Authentication Timeout

December 18th, 2008 x=vv= No comments

phpmyadminI found it very annoying that phpmyadmin after a quite short amount of time they needed to authenticate again.

If you use cookie authentication method in your phpmyadmin, you might probably find it very annoying as you will automatically be signed out after certain period of idle time. This is because the lifetime of the cookie itself is set to 1800 seconds (30 minutes) by default, after which you need to authenticate again to log in.

To remedy this, simply edit the configuration file config.inc.php and add the following line:

$cfg['LoginCookieValidity'] = 3600*3;  // 3 hours, or 10800 seconds

This sets the cookie timeout to 3 hours, which is usually long enough.

Java – Final vs. Static Variable

November 13th, 2008 x=vv= 11 comments

The “static” and “final” modifier in Java are somehow confusing, especially when they interact. Here is a good explanation on how to understand these two modifiers:

You DO NOT have to assign a value to a final variable when you declare it. The “final” keyword just means that you can (and must) assign its value exactly once. Where you are allowed to assign the value depends on if it is static or not (as well as its access modifier).

private final int j;
The value MUST be assigned ONCE, either here in the declaration or in each constructor. It is NOT automatically assigned a value of 0 (zero). Also, since it is not static, there is a distinct value for each instance object, so it makes sense that it must be assigned in the constructor.

Read more…

How To Disable/Remove Automatic Restart After Windows Updates

November 12th, 2008 x=vv= 2 comments

Most of the time, after Windows Update system update the OS, it will ask you to restart the Windows, either now or later. The restarting dialog will pop up once in a while, which is quite annoying. The most disgusting thing is that it will automatically restart the computer without your consent, if there is no user interaction for a certain period.

Although this mechanism might enforce the Windows Operating System to be applied with the latest patch in due course, it is very annoying if I’m currently working on this computer, or having some programs running. I need to run my program regularly when I’m conducting research works, where each program is likely to take a few days to finish. This Automatic Restarting mechanism has really screwed me (and my lovely programs) many times. Therefore, finally, I’d like it to be turned off so that the restarting time would be totally under my control.

How To Remove/Disable the Automatic Restart After Windows Updates?

Read more…

How to Disable Directory Listing/Browsing in Apache Web Server

November 10th, 2008 x=vv= No comments

By default, Apache Web (HTTPD) Server is configured with the “directory listing” option enabled, which allows user to see all the files and sub-folders under a particular directory when index files like index.html, index.php etc. are not present in that directory.

This is not advisable on production website as it may expose sensitive information to prying eyes, and would probably be indexed by search engines if you do not define entries in robot.txt properly. Therefore, in order to protect your data from being compromised, making all contents under the directory invisible to unintended visitors becomes necessary.

How can we disable the Directory Listing in Apache Server?

There are two simple ways to achieve this:

  1. If you are able to access the Apache configuration file httpd.conf, you can do this with an Options directive inside a Directory tag. Either remove the “Indexs” from line begins with Options if it’s there, or change “Indexes” to “-Indexes“.

    <Directory “/www”>
    Options Indexes FollowSymLinks
    </Directory>

  2. If you have no access right to the Apache configuration file httpd.conf, you can obtain the same effect with method 1 by using the .htaccess file: open the .htacces file (create a new one if it’s not there) under the target directory, look for Options Indexes. If Options Indexes exists, modify it to Options -Indexes, or else add Options -Indexes as a new line.

Remember to restart your Apache Web Server, and the Directory Browsing feature should be disabled by now.

How To Restart or Shutdown Windows XP/Vista In Remote Desktop Connection

November 9th, 2008 x=vv= No comments

If you think you may restart or shutdown the Windows XP or windows Vista  in remote control mode by just clicking the “Restart” or “Shut Down” option in Windows Start menu, then you are WRONG!

You may check by yourself to see if you are provided with these two options in XP or Vista. Yes, there is actually no “Shut Down” or “Restart” option in Windows Start menu of the remote computer when you are in the Remote Control mode throught RDP. The only option you get are “Log Off” and “Disconnect” in Windows XP, or “Log Off” and “Lock” in Vista. (In Windows Server 2003 however, we do have an option of “Shut Down”)

How to restart / shutdown Windows in Remote Desktop Connection?

Read more…

Simple Ways of Sending Excutable File (*.exe) in Gmail as an Attachment

November 7th, 2008 x=vv= No comments

For some security reasons, Gmail does not allow the user to send executable files (for example, exe). When you send an exe file as an attachment, probably following window will pop up:

This error window also pops up even you compress your file into .zip format, prompting you that “<yourfile>.zip contains an executable file. For security reasons, Gmail does not allow you to send this type of file.”

So, how can we send the executable file in Gmail as an attachment? There are many tricks for this, and I’m listing two of the simplest here:

Read more…

How To Display Adsense Search Result Within Wordpress Page (with Default Template)

November 6th, 2008 x=vv= No comments

Google Adsense Search not only offers users site search or the world wide web search, but while brings in web publishers revenue from ads relevant to their search terms.

Initially, the Adsense Search result can only be shown on a google landing page, that is, a new pop up window or on the same window under Google.com domain.

There is third option now which allows you to display search result within your own specified landing page. For example, the search result can now be displayed on a user-defined page (e.g. site-search page on this site), or even the same window where the search form resides. Of course, you would have to be able to create such dedicated search result page yourself.

Next, I will show:

A step by step tutorial on How To Embed Adsense Search Result within WordPress page:

Read more…

Remove/Delete Adobe Acrobat 8.0 (Pro/3D) Activation Record

October 29th, 2008 x=vv= 4 comments

This is for those who needs to use “Phone Activation” option to re-activate your Adobe Acrobat 8.0 product.

If you install the Acrobat 8.0 (Pro/3D) for the first time, you would be lead to the “normal” type of activation. If you however, happen to uninstall the Acrobat 8.0 but try to reinstall it again, you would probably find the activation interface results in the “repair” mode, where your original activation key doesn’t work any more.

How to get rid of this “repair” mode and kick in the original phone activation interface? Well, here is the only thing you need to do:

For Windows XP user: delete C:\Documents and Settings\All Users\Application Data\FLEXnet\adobe_00080000_xxx.data

For Windows Vista user: delete C:\ProgramData\FLEXnet\adobe_00080000_xxx.data

For Mac user: delete content under /Library/Preferences/FLEXnet Publisher

That’s all. The “normal” activation mode should be back.

How to disable Post Revisions Tracking Feature in WordPress

October 28th, 2008 x=vv= No comments

Personally I don’t like the “Post Revision” feature at all. It just creates tremendous useless post entries in wp_posts table every time I click on “Save” button while writing a post or page. Over time, the database may grows bigger and bigger.This is really not my style.

If you are also using WordPress 2.6 or newer version, and feel that post revisions feature is not that useful, there are ways to  turn it off. Just follow this simple 3-step way:

  1. Open wp-config.php file which is located in the root or home directory of WordPress blog.
  2. Add this line of code in wp-config.php: define(’WP_POST_REVISIONS’, 0);
  3. Issue following clean-up SQL command: delete from wp_posts where post_type=’revision’;

Step 2 sets the constant WP_POST_REVISIONS to 0, indicating the revision feature to be turned off. Step 3 actually purges all post revisions related records in current database. This should give you a relative clean database environment (Wow~).

If you also suffice with AutoSave feature built-in in WordPress editor, then simply add another line in wp-config.php file: define(‘AUTOSAVE_INTERVAL’, 600); This changes the interval of AutoSave trigger to be one hour, which should be long enough.