In order to allow web access to a different directory outside the root directory, you need to give Apache access to the directory, and then use the Alias directive. The Alias directive will map any directory into the web root.

For example if you want to create a virtual directory called test, and the directory is in the D:/example/test, then modify your httpd.conf and add the following entry at the bottom of the file:

<Directory "D:/example/test/">
    Options Indexes
    AllowOverride all
    Order Allow,Deny
    Allow from all
</Directory>

Alias /test D:/example/test

On a typical Windows installation, the httpd.conf file is usually located in the following directory:

C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf

So if a file file.htm exists in D:/example/test,  the URL of the resource is:

http://www.example.com/test/file.html

and it will be served from:

D:/example/test/file.html

For more information visit the Apache HTTP Server Version 2.2 documentation.

Tagged with:
 

Loading a file into a BLOB object in Oracle is easy. All we need to do is use the DBMS_LOB package to load the file into a temporary LOB object. This is demonstrated in the following example.

This example assumes that you have a directory object set up where the files are stored. In this example the following object is used:

CREATE DIRECTORY FILEUPLOADS AS '/home_new/dmt/public_html/fileuploads';

Use the following function to load a file based on the filename parameter and return the BLOB reference for processing:


CREATE OR REPLACE FUNCTION loadBlobFromFile(p_file_name VARCHAR2) RETURN BLOB AS
  dest_loc  BLOB := empty_blob();
  src_loc   BFILE := BFILENAME('FILEUPLOADS', p_file_name);
BEGIN
  -- Open source binary file from OS
  DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);

  -- Create temporary LOB object
  DBMS_LOB.CREATETEMPORARY(
        lob_loc => dest_loc
      , cache   => true
      , dur     => dbms_lob.session
  );

  -- Open temporary lob
  DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);

  -- Load binary file into temporary LOB
  DBMS_LOB.LOADFROMFILE(
        dest_lob => dest_loc
      , src_lob  => src_loc
      , amount   => DBMS_LOB.getLength(src_loc));

  -- Close lob objects
  DBMS_LOB.CLOSE(dest_loc);
  DBMS_LOB.CLOSE(src_loc);

  -- Return temporary LOB object
  RETURN dest_loc;
END loadBlobFromFile;
/

Easy as that.

MP4 to DivX Conversion

On August 18, 2009, in DivX, DVR-MS, MP4, MPG, Video Conversion, by ryelpango

I’ve just found out that MCEBuddy also works for converting MP4 to DivX.

To convert MP4 to DivX, just follow the instructions below.

  1. Go to http://mcebuddy.com/, and follow the instruction to install MCEBuddy.
  2. Once installed, open MCEBuddy, tick “File Selection” and enter either *.mp4 (to convert only MPG files) or *.* (to convert any format to AVI – I’ve found that MCEBuddy converts DVR-MS, MPG, and MP4 files effectively!).

What a great tool!

Tagged with:
 

Oracle VARCHAR2(1) vs CHAR(1)?

On August 17, 2009, in CHAR, Datatype, Oracle, VARCHAR2, by ryelpango

Well, minimum size for both Oracle datatypes is 1 byte. So in terms of storage, they’ll both consume either null or 1 byte in storage space. So, when declaring a character datatype with a length of 1, it doesn’t really matter which one you use. The rules change when the length is greater than 1 though.

This is because CHAR is a fixed character data, so values held in this datatype is always RPAD’ed with blanks. Storing character data as VARCHAR2 will save space on, not just the character field, but any indexes that reference it.

As a personal preference, I always use VARCHAR2. The most important practice though is to be consistent. For example, if you use CHAR for a 1 byte character datatype and VARCHAR2 for everything else, then stick with it throughout your whole database.

Tagged with:
 

SEO and Quality Backlinks

On August 7, 2009, in seo, website backlinks, website marketing, by ryelpango

Internet TrafficIt is almost impossible to generate regular traffic to your website without backlinks pointing to your site. Quality web backlinks play a vital part when it comes to optimizing your website, which directly impacts its SERPs position and Page Rank. Better SERPs position and a better Page Rank, means more traffic for your website!

The reason behind the importance of web backlinks is because Search Engine spiders primarily examine website backlinks when determining a site’s significance. In a nutshell, a site’s popularity is predominantly based on the number of quality links dispersed all over the internet pointing back to the site. The more “good friends” your website has, the more popular it will be, and it will be more inclined to attract and make more good friends.

The term “quality backlinks” simply means that website containing the link back to your site has rich meaningful textual content that is relevant to the nature of your site. So it’s a good idea to be selective when deciding which site or service to approach to provide the backlink for you.

The most successful means of acquiring backlinks pointing back to your website is through link trading. This is the method of exchanging your link for someone else’s. Effectively, your link partner will agree to create a link to your website, if you agree to create a link to his website.