Vacuum Database to Speedup Firefox

| Posted by watashii | Filed under Software

vacuum_firefox

Firefox performance can be improved by defragmenting the internal SQLite database.  This can be done by running a vacuum command within Firefox, as explained in Mozilla Links.   The process are as follows:

1) Open Tools > Error Console (or Press Ctrl + Shift + J)

2) In the Code text box, paste the following (in one single line)

Components.classes["@mozilla.org/browser/nav-history-service;1"].
getService(Components.interfaces.nsPIPlacesDatabase).
DBConnection.executeSimpleSQL("VACUUM"); 

Note:  Make sure the double-quotes are normal quotes and not slanted quotes

3) Press Evaluate.  Firefox will freeze for a few seconds while the database is being defragmented.

A handier add-on extension is also available to perform this action.

Tags: , ,

Exercise Your Idle System Doing Nothing

| Posted by watashii | Filed under Unix

sleepy_idle

Via Unix/Linux:

cat /dev/zero > /dev/null

or

cp /dev/zero  /dev/null

Explaination:

/dev/null is basically a black hole (a special null file), anything written to it goes down the drain.  Anything read from it will result in nothing returned.  /dev/zero is basically the same as /dev/null when writing to it, however reading it will result in a continuous stream of zeros without EOF.

Tags: , , ,

Oracle Index Null Values

| Posted by watashii | Filed under Oracle, Programming

When creating Oracle indexes, Oracle ignores the NULL values.  For example, the following index was created over “emp_name” column.

create index emp_name_idx
on employees (emp_name);

Querying for a NULL value on the indexed column would yield a full table scan.

select emp_name from employees where emp_name is NULL;

So how can we make Oracle perform a fast indexed search?

The solution is to index NULL values with a function-based index.  The following example replaces all the NULL values with a string named ‘null’ (note, this can be any arbitrary string).  This allows the NULL to be included as if it was a real value.

create index emp_name_idx
on employees (nvl(emp_name,'null'));

Tags: , ,

Viewing Firefox Cache Files

| Posted by watashii | Filed under Software

The browser cache stores all the web pages and images downloaded on to the computer to allow faster access and reduce the downloading bandwidth when revisiting a website.

Type “about:cache” on your Firefox address bar to view the cached files.  There are 3 types of cache for allocating the files…

Read the rest of this entry »

Tags: , , , , , ,

PL/SQL – Pipelined Table Function

| Posted by watashii | Filed under Oracle, Programming

Normally when writing PL/SQL functions, they return a single value result.  But what if you want to return a collection type instead?  The easiest way to do this is via a pipelined function, with the PIPELINED keyword, in which rows are returned by the function iteratively.   It can be created at the schema level, or inside a package.  I prefer the latter since its more portable, and easier to manage.

Inside the function, you return individual elements of the collection type, instead of returning the entire collection type when function ends.  This also has performance benefits, depending on your application.

Read the rest of this entry »

Tags: , , ,