Thursday, May 15, 2008

Apache 2 Compression with mod_deflate

Today, after a report from one my users that the our APEX application was getting "slower", I decided to implement mod_deflate for content compression. The performance is noticeable faster! I went with mod_deflate since is included in the Apache 2.0.x source package. Here is what I added to my httpd.conf:

LoadFile /usr/lib/libz.so
LoadModule deflate_module modules/mod_deflate.so

<IfModule mod_deflate.c>
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|htc|wsdl|exe|t?gz|bz2|sit|rar|pdf|zip)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

After that I all did was a quick
opmnctl restartproc ias-component=HTTP_Server
and voila!

For more information on mod_deflate go to http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

Tuesday, May 13, 2008

Adding Firefox Search Engine to APEX




Today, I got tired of constantly having to login to Metalink to search for SR's that I needed to check. I do have other tools (internal) that let me do the this (oracle forms) but I do prefer to use Metalink since it is built with APEX. So here is what I did to speed up the search process; I added this to my intranet APEX application so my users can install the search engine. I also created an alternate example using Ask Tom's Site.

First I created asktom.xml with the following (note that for space purposes could not include the whole data:image string. To create your own go to The data: URI kitchen).

<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>Ask Tom</os:ShortName>
<os:Description>Ask Tom Search</os:Description>
<os:InputEncoding>utf-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon,%01%01%10%10%01%20h% ...
</os:Image>
<SearchForm>http://asktom.oracle.com/pls/asktom/f?p=100:1</SearchForm>
<os:Url type="text/html" method="GET" template="http://asktom.oracle.com/pls/asktom/f?p=100:1:0::NO:RP:P1_SEARCH_CRITERIA:{searchTerms}">
</os:Url>
</SearchPlugin>

Then I added the following inside the <header> of this blog:

<link href='http://noelportugal.googlepages.com/asktom.xml' rel='search' title='Ask Tom' type='application/opensearchdescription+xml'/>

Now all you have to do (assuming you are using Firefox) is go to the Search engine and go to the bottom where it says: Add "Ask Tom", and thats it!

You can create as many Search Engines and have them available to your Firefox users.
For more info visit http://developer.mozilla.org/en/docs/Creating_OpenSearch_plugins_for_Firefox