Syntax Highlight Code On Any Page Using Google Code Prettify

prettify00

The Google Code Prettify is a JavaScript module that allows syntax highlighting of any code snippets on a HTML page.  Setting this up on any web page is a simple 3 step process, and is supported on most common browsers.

[Demo]   (Based on:  prettify-21-May-2009.zip)
[Download Source Files]

Read the rest of this entry »

Tags: , , , ,

Live Messenger 8.1/8.5 Bypass Mandatory Upgrade

msnbypass00

Today when logging into my Windows Live Messenger 8.1,  I received a message forcing me to upgrade to the latest Windows Live Messenger (2009).  This was discussed on their blog less than 1 month ago (thanks for the short heads-up).  However, like many others, upgrading to the 2009 version was not ideal. That is:  it just doesn’t work at all.

For me, I ran into problems logging in (via my workplace), as I kept getting the error: “Signing in to Windows Live Messenger failed because the authentication service is not compatible with this version of the program.
Error code: 8100030f”.
And NOTHING in the online help provided any clues with this message!

So the only resolution for me was to find a way to continue using the old version.  Here I found a workaround to skip the mandatory upgrade (I’m on XP, however Vista should work also).

Read the rest of this entry »

Tags: , ,

BusinessObjects Enterprise – Changing Tomcat Session Timeout

To change the timeout limit of a BusinessObjects Enterprise XIR2 (Solaris) logged-in session (with Tomcat), the following files needs to be modified:

$BOBJE_HOME/tomcat/webapps/businessobjects/WEB-INF/web.xml
$BOBJE_HOME/tomcat/webapps/businessobjects/enterprise115/desktoplaunch/WEB-INF/web.xml
$BOBJE_HOME/tomcat/webapps/businessobjects/enterprise115/adminlaunch/WEB-INF/web.xml
$BOBJE_HOME/tomcat/webapps/businessobjects/enterprise115/adhoc/WEB-INF/web.xml

Find the following setting within the web.xml file to change the timeout value in minutes.

<!-- Define the default session timeout for your application,
      in minutes.  From a servlet or JSP page, you can modify
      the timeout for a particular session dynamically by using
      HttpSession.getMaxInactiveInterval(). -->
<session-config>
      <session-timeout>20</session-timeout> <!-- 20 minutes for session objects -->
</session-config>

Then just restart the Apache Tomcat webserver to take effect.

Tags: , , ,

Get URL Variables in JavaScript & HTML

The following structure stores variables within a request URL:

http://www.mydomain.com/index.html?month=January&day=Tuesday

To read the variables within the index HTML file, we must process the URL string entirely, since there is no built-in functions which magically does it.  The following JavaScript demonstrates this:

function getUrlVars()
{
  var vars = [], hash;
  var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  for(var i = 0; i < hashes.length; i++)
  {
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
  }
  return vars;
}

To use the variables, we run the following to extract the values:

var myHash = getUrlVars();
alert(myHash['month']);   // prompts the value 'January'
alert(myHash['day']);     // prompts the value 'Tuesday'

Tags: , ,

Easily Find Wallpaper For Your Desktop Resolution

google_image_search

There is a nice little trick (or hidden feature) on Google Image Search that allows you to search images of specific resolution size and filetype.  Using this technique, we can search for the right image our desktop wallpaper.  This can be achieved by using the imagesize and filetype search parameter.

For example:

[imagesize:1900x1200 filetype:jpg design] finds 1900px by 1200px images related to design.

[imagesize:256x256 filetype:png icon] finds 256px by 256px icons.

Tags: , , ,

Display WordPress Unicoded Characters

Recently upgraded my WP blog, and released some japanese/chinese characters (in Unicode) were displaying strangely, giving me question marks (????) and funny symbols (トトãƒ).

I learnt that this can be fixed by modifying the WP source file wp-config.php on the web server.  The change required is simply commenting the following 2 lines of code,  by adding a // in front of:

/** Database Charset to use in creating database tables. */
//define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
//define('DB_COLLATE', '');

Tags: , ,

Directly Modify & Edit A Webpage

Want to modify a web page on your browser, or delete an image directly from the page?  Here is a very cool shortcut that allows you to do this without using any other programs.

In fact, you can do this right here by loading this link.

Tip: Add the link as a bookmark, then whenever you would like to modify a page, just click on the bookmark. Easy!

Tags: ,

A Better LightBox Using jQuery

The jQuery lightBox plugin (by Leandro Vieira Pinho) uses the jQuery JavaScript library to create an overlay effect of opening up images on top of a web page, and creating a navigable slideshow view.  See my demo below.

Setting this up on your own web page is an easy 2-step process: include the JavaScript and CSS on the webpage header, and then call the jQuery function.  The only change required is on the header.

This plugin is an improvement over the LighBox2 plugin which was demonstrated earlier, because we didn’t need to modify our link tags to activate it, thanks to the jQuery element selector.

[Demo]
[Download Source Files]

Tags: , , , , ,

Overlay & Slideshow Images with Lightbox 2

The Lightbox2 plugin uses the Prototype and Scriptaculous JavaScript libraries to create an overlay effect of opening up images on top of a web page, and creating a navigable slideshow view.

Setting this up on your own web page is an easy 2-step process: include the JavaScript and CSS on the header, and then on each link tag embed the rel=”lightbox” and title=”my caption” attributes.

[Demo]
[Download Source Files]

Read the rest of this entry »

Tags: , , ,

Firefox Disable Flashing Cursor

Something annoying just sprung up, a flashing cursor appears whenever I click on any part of a webpage.

The solution? Read the rest of this entry »

Tags: , ,