Saturday, April 28, 2012

Linux: import MDB files to MySQL

$ sudo apt-get install mdbtools

You can import MDB files to MySQL using the following:

View tables:
$ mdb-tables file.mdb

Export table as CSV:
$ mdb-export file.mdb table1 > table1.csv

# ... to be done, import from csv to MySQL

Friday, April 20, 2012

Apache 2.4: directory IP protection; require, allow, deny

Apache 2.4 

Allow access for all:
<Directory /dir1/dir2>
Require all granted
</Directory>

Allow access from one IP address:
<Directory /dir1/dir2>
Require ip 123.123.123.12
</Directory>

Apache < 2.4

Allow access for all:
<Directory /dir1/dir2>
Order deny,allow
Allow from all
</Directory>

Allow access from one IP address:
<Directory /dir1/dir2>
Order deny,allow
Deny from all
Allow from 123.123.123.12
</Directory>

Thursday, April 5, 2012

Javascript: tab navigation support class

Tab navigation support class:

function TabsSupport() {
   
    this.tab_ids = [];
   
    this.tab_class_active = '';
   
    this.init = function(_tab_ids, _tab_class_active) {
        this.tab_ids = _tab_ids;
        this.tab_class_active = _tab_class_active;
    }
   
    this.selectTab = function(_id) {
        for(var i in this.tab_ids) {
            $('#' + this.tab_ids[i]).removeClass(this.tab_class_active);
        }
        $('#' + _id).addClass(this.tab_class_active);
        this.selectAction(_id);
    }
   
    this.selectAction = function(_id) {}
   
}