PostgreSQL – how to make the first function work

June 7, 2009 by myitsolutions

In order to make a simple function, you must first create a new language, called plpgsql. After that, create the function using plpgsql language, not the sql function.

Postgre SQL – autonumber – serial

June 7, 2009 by myitsolutions

To be able to set the serial pseudo-data-type, you must first set that field as primary key and then that type will appear for usage in Navicat PostgreSQL.

ExtJS – In IE, grid column headers are not shown, but ok in Firefox

May 12, 2009 by myitsolutions

Add this to your css

.x-grid3-header {position: relative;}

Have /m/* and also /* with mod rewrite

April 23, 2009 by myitsolutions

Options -Indexes

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^m/(.*)        /index.php?u=$1&m=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)         /index.php?u=$1 [L]

Dump a database into a gzip file

April 23, 2009 by myitsolutions

mysqldump –user=dbuser –password=dbpass dbname | gzip -9 > backup-`date +”%Y-%m-%d_%H-%M-%S”`.sql.gz

How to archive a folder and timestamp the name of the file

April 23, 2009 by myitsolutions

tar zcfv backup-`date +”%Y-%m-%d_%H-%M-%S”`.tgz /root/code

Install JSON on a VPS server CentOS

April 2, 2009 by myitsolutions

http://forums.crm.saeven.net/showthread.php?t=128

How to correctly setup permissions in Lunarpages webhosting

March 30, 2009 by myitsolutions

The folder containing the files should be 0755, and the files inside 0644 (in order not to yield “is writable by the group” error)

To do this, just call the following functions

find . -type f -print0 | xargs -0 chmod 644;find . -type d -print0 | xargs -0 chmod 755

PHP: Two functions to check if a string contains another one, or begins with another one.

March 20, 2009 by myitsolutions

 

function contains($haystack, $needle) {
    return strpos($haystack,$needle)!==FALSE;
}

function beginsWith($str, $prefix) {
    return strpos($str, $prefix)===0;
}

Read the rest of this entry »

Internet Explorer cannot open the Internet site – Operation aborted

March 20, 2009 by myitsolutions

Problem: see the title, a very frustrating problem.

Solution: This problem appears usually when using maps like Google Maps, Virtual Earth, Yahoo on your page. Move the script just before the closing of the body tag.

Read the rest of this entry »