Wednesday, December 26, 2012

Rounded corners CSS3

CSS3 border-radius Property

Example CSS code:
border-radius:3px;

Browser compatibility: http://www.w3schools.com/cssref/css3_pr_border-radius.asp

Linux antivirus scan command-line

Clamav - anti-virus utility for Unix, command-line interface.

Clamav package, clamscan command.

$ clamscan -rv /folder1/subfolder2

Monday, November 12, 2012

Friday, November 9, 2012

PHP SimpleXml - generate XML document

SimpleXml generate XML document from PHP:

$oXml = new SimpleXMLElement('<itemlist></itemlist>');
foreach($aItems as $aItem)
{
    $oXmlParameter = $oXml->addChild('item');
    $oXmlParameter->addChild('title', htmlentities($aItem['title']));
    $oXmlParameter->addChild('description',
htmlentities($aItem['description']));
}
header('Content-type: text/xml');
echo $oXml->asXML();
exit;

Apache https virtual host

 Apache https virtual host example:

<IfModule ssl_module>
<VirtualHost *:443>

SSLEngine on
SSLCertificateFile "/path-to-apache-ssl-folder/server.crt"
SSLCertificateKeyFile "/path-to-apache-ssl-folder/server.key"
 
#SSLCertificateKeyFile "/path-to-apache-ssl-folder/server.pem" 
BrowserMatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

Define HOST hostname.com

ServerName    ${HOST}
DocumentRoot  /path-to-https-document-root

ErrorLog     
/path-to-apache-logs-folder/${HOST}_https_error.log
CustomLog    
/path-to-apache-logs-folder/${HOST}_https_access.log combined


RewriteEngine On
# ...

</VirtualHost>
</IfModule>

Apache https SSL certificates

Generate certificates:

$ openssl genrsa -des3 -rand rand-seed1.gz:rand-seed2.gz -out server.key 2048
$ openssl rsa -in server.key -out server.pem
$ openssl req -new -key server.key -out server.csr
$ openssl x509 -req -days 180 -in server.csr -signkey server.key -out server.crt

$ # remove password from key file:
$ openssl rsa -in server.key -out server.key.nopass

Apache conf:

SSLEngine on
SSLCertificateFile "/path-to-apache-ssl-folder/server.crt"
#SSLCertificateKeyFile "/path-to-apache-ssl-folder/server.pem"

SSLCertificateKeyFile "/path-to-apache-ssl-folder/server.key"
BrowserMatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

Thursday, November 8, 2012

Shell scripting: conditional string concatenation

Run a different command depending on an input parameter. Make use of an if statement, concatenate 2 strings and run the resulting bash command.

#!/bin/bash

if [[ "$1" == "pro" ]]; then

part1="ls -la"
else
part1="ls"
fi


part2="/home/dir";

command=$part1$part2;

eval $command


Shell scripting if else example

Script example that accepts one parameter.

Example:

./my-script.sh param1 # - string comparison
./my-script.sh 100 - # integer comparison

Integer comparison

if [ $1 -eq 100 ]; then
echo "Parameter equals 100"
else
echo "Parameter is not equal to 100"
fi

# Other possible values for comparison operator: -qe, -ne, -gt

String comparison

if [[ "$1" == "param1" ]]; then
echo "Comparison match"
else
echo "String does not match / parameter invalid, etc"
fi

Svn server, create new svn project

Svn server, create new project:

svnadmin create /svn-repository-path/project-name

chown -R user-name:subversion /svn-repository-path/project-name

Creating branches and trunk:

cd temp
rm -rf svn-project
svn co svn-host-address/svn-repository-path/project-name svn-project
cd svn-project
mkdir trunk
mkdir branches
mkdir tags
svn add *
svn ci -m "init deploy" *

Svn checkout local file (svn server)

Local project checkout on the svn server.

Svn checkout local file example:

svn co file:///svn-repository-path/project-name/trunk project-name

Wednesday, November 7, 2012

MySQL Show Indexes

Show MySQL table indexes:

SHOW INDEX FROM `table_name`;

Saturday, September 29, 2012

PHP session keep-alive: JavaScript solution

PHP session keep-alive mechanism, client side with JavaScript.

*** File: page.html

<script type="text/javascript" src="keep-alive.js"></script>


*** File: keep-alive.js

function KeepAlive() {
   
    // Keep alive session time (seconds)
    this.nKeepAliveSeconds = 4 * 60 * 60;
   
    // Keep alive time interval to check elapsed time (seconds)
    this.nKeepAliveTimeIntervalCheck = 60;
   
    // Keep alive time interval to call the AJAX keep-alive server file (seconds)
    this.nKeepAliveTimeInterval = 8 * 60;
   
    // unix timestamp when the page was first loaded
    this.nKeepAliveTimestampStart = 0;
   
    // unix timestamp when the session was last refreshed
    this.nKeepAliveTimestampLast = 0;
   
    this.init = function() {
        this.nKeepAliveTimestampStart = Math.round((new Date()).getTime() / 1000);
        this.nKeepAliveTimestampLast = this.nKeepAliveTimestampStart;
    }
   
    this.run = function() {
        var nTimestampNow = Math.round((new Date()).getTime() / 1000);
       
        if(nTimestampNow > this.nKeepAliveTimestampLast + this.nKeepAliveTimeInterval) {
            this.ajaxCall();
            this.nKeepAliveTimestampLast = nTimestampNow;
        }
       
        if(nTimestampNow < this.nKeepAliveTimestampStart + this.nKeepAliveSeconds) {
            setTimeout("KeepAlive1.run()", this.nKeepAliveTimeIntervalCheck * 1000);
        }
    }
   
    this.ajaxCall = function() {
        $.get("/keep-alive.php", function(data) {});
    }
   
}

var KeepAlive1 = new KeepAlive();
KeepAlive1.init();
KeepAlive1.run();

*** File: keep-alive.php

<?php

session_start();
echo 'Keep-alive: ' . time();

?>

Monday, August 27, 2012

CSS: Do not break word, nobr tag equivalent

CSS: Do not break word when space character is encountered.

CSS property:
white-space: nowrap;

PS: The old way to achieve this was by using <nobr>, which is deprecated.

Sunday, August 26, 2012

MySQL: Change table type, set InnoDB or MyISAM

To modify the storage engine of a MySQL table, one can use one of the following.

ALTER TABLE `table_name` ENGINE = InnoDB;

OR

ALTER TABLE `table_name` ENGINE = MYISAM;

Sunday, July 8, 2012

MySQL IF NULL return 0 - IFNULL() function

Test if expression is NULL; return NULL if true, return expression if false.

Definition:
IFNULL(expr1, expr2)

Example:
IFNULL(SELECT MAX(field) FROM table, 0)

Saturday, July 7, 2012

MySQL get date tomorrow

MySQL function to get tomorrow's date:

DATE_ADD(CURRENT_DATE(), INTERVAL 1 DAY)

MySQL: Delete / Reset Query Cache

Delete the cache results for MySQL queries:

RESET QUERY CACHE;

OR

FLUSH TABLES;

PS: "FLUSH QUERY CACHE" also exists, but the command only defragments the query cache to better utilize the memory; it does not delete/empty the query cache.

Friday, July 6, 2012

PHP: Generate random string, random date

PHP Function: Generate random string

/**
 * PHP Generate random string
 * @param int $length
 * @param array $chars - optional
 * @return string
 */
function generateRandString($length, $chars = array()) {
    if(empty($chars)) {
        $chars = array_merge(
            range('a', 'z'), range('A', 'Z'),
            range('0', '9'), array(' ', '.', ',', '-', ';')
        );
    }
   
    $string = '';
   
    for($i = 0; $i < $length; $i++) {
        $string .= $chars[mt_rand(0, count($chars) - 1)];
    }
   
    return $string;
}

PHP Function: Generate random date

/**
 * PHP Generate random date
 * Compute a random date between 2 given dates
 * @param string $date1 - YYYY-MM-DD format
 * @param string $date2 - YYYY-MM-DD format
 * @return string date
 */
function generateRandDate($date1, $date2) {
    list($y, $m, $d) = explode('-', $date1);
    $time1 = mktime(0, 0, 0, $m, $d, $y);
    list($y, $m, $d) = explode('-', $date2);
    $time2 = mktime(0, 0, 0, $m, $d, $y);
    return date('Y-m-d', mt_rand($time1, $time2));
}

Thursday, July 5, 2012

Linux: SVN subversion client certificate config (.p12)

Console SVN subversion client configuration. Using .p12 SSL certificate.

Edit: ~/.subversion/servers

[groups]
group1=*.hostname1.com
group2=*.hostname2.com

[group1]
ssl-client-cert-file=/home/user/cert/cert-file.p12
ssl-client-cert-password=abcde

[group2]
ssl-client-cert-file=/home/user/cert/cert-file.p12
ssl-client-cert-password=abcde

Setting the password is optional. This can be skipped, but the password will be required at every svn action.

OOP recommended practices

Inheritance

class Customer {
    protected $discount = 0;
   
    public function getDiscount() {
        return $this->discount;
    }
}

class CustomerPremium extends Customer {
    protected $discount = 5;
}


Global Constants

Recommended: no use of global constants inside class methods.

class MyClass {
    protected $path_server;
   
    public function setPathServer($path_server) {
        $this->path_server = $path_server;
    }
   
    public function getFileContents($file) {
        return file_get_contents($this->path_server . '/' . $file);
    }
}


Abstract & Final

abstract class MyClassAbstract {
    abstract protected function computeData();
    abstract protected function sendMail();
   
    final public function run() {
        $this->computeData();
        $this->sendMail();
    }
}

class MyClass extends MyClassAbstract {
   
    protected function computeData() {
        ...
    }
   
    protected function sendMail() {
        ...
    }
}

Wednesday, June 27, 2012

JavaScript: iterate every character in a string

Loop through characters in a string:

var str = 'My string';
for(var i = 0; i < str.length; i++) {
    console.log(str.charAt(i));
}

Saturday, June 16, 2012

JavaScript - position div ( block / box ) in the center of the page - compute top & left position

Position a box in the middle of the screen (horizontal and vertical) using JavaScript.
The following function dynamically computes (using the height and width of the browser and of the box to be centered) the left and top size in pixels to be used for positioning the box.

function computePositionLeftTopElement(_element_width, _element_height) {
    var screenWidth = $(window).width();
    var screenHeight = $(window).height();
    if(_element_height < screenHeight) {
        var layerContentPositionTop = Math.round((screenHeight - _element_height) / 2);
    } else {
        var layerContentPositionTop = 0;
    }
    if(_element_width < screenWidth) {
        var layerContentPositionLeft = Math.round((screenWidth - _element_width) / 2);
    } else {
        var layerContentPositionLeft = 0;
    }
    return [layerContentPositionLeft, layerContentPositionTop];
}

To place the box as a layer over the page content, the CSS properties can be used:
position:fixed;
z-index:10;

Thursday, May 24, 2012

PHP delete, remove directory

PHP delete folder recursively.
Remove all subfolders and files.

function rrmdir($dir) {
    if (is_dir($dir)) {
        $objects = scandir($dir);
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object);
                else unlink($dir."/".$object);
            }
        }
        reset($objects);
        rmdir($dir);
    }
}

Sunday, May 20, 2012

PHP: remove single and multiple line comments

Remove single line comments:
$string = preg_replace('/\/\/(.*)/', '', $string);

Remove multiple line comments:
$string = preg_replace('!/\*.*?\*/!s', '', $string);


Friday, May 18, 2012

Javascript: get element by id inside iframe (from parent)

From parent window, get an element inside an iframe by id:

document.getElementById('iframe-id')
    .contentWindow.document.getElementById('div-id');

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) {}
   
}



Tuesday, March 20, 2012

Simple backup script - using PHP and rsync

- Backup multiple directories and files
- Backup every X hours (run backup.php periodically using a scheduler; ex: cron)
- Store backup data separately for each date (backup history by date; ex: YYYY-MM-DD folders)
- Copy data in multiple (unlimited) backup destinations folders

// Backup options
$bkp_verbose = false;
$bkp_write_log_file = true;

// Directories / Files to back-up
$dir_bkp = array();
$dir_bkp[] = '/path-to-project1';
$dir_bkp[] = '/path-to-project2';
$dir_bkp[] = '/path-to-project3/file1';

// Backup storage directories
$dir_bkp_storage = array();
$date_bkp = date('Y-m-d');
$dir_bkp_storage[] = '/path-to-backup-dir1/' . $date_bkp;
$dir_bkp_storage[] = '/path-to-backup-dir2/' . $date_bkp;


foreach($dir_bkp_storage as $dir_storage) {
   
    $time_start = microtime(true);
   
    if(!is_dir($dir_storage)) {
        if(!mkdir($dir_storage, 0755)) {
            echo 'Error: could not create bkp dir: ' . $dir_storage;
            continue;
        }
    }

    foreach($dir_bkp as $dir) {
        echo chr(10) . 'copy backup from ' . $dir . ' to ' . $dir_storage . ' ... ';
        $cmd = "rsync -avz $dir $dir_storage/";
        if($bkp_verbose) {
            echo shell_exec($cmd);
        } else {
            shell_exec($cmd);
        }
    }
   
    if($bkp_write_log_file) {
        $time = microtime(true) - $time_start;
        file_put_contents(
            $dir_storage . '/bkp-log',
            'Date end: '.date('Y-m-d H:i:s') . chr(10) .
                'Total time: ' . $time . ' seconds' . chr(10)
        ');
    }
}

Linux search files by content (grep)

Linux, command line search files by content.
Search file contents, display line, highlight text, show line number:

$ grep  -iRn "text fragment" path1/*

Saturday, March 17, 2012

Bash(shell prompt) server name, time and other options

Edit ~/.bashrc

Change bash(shell prompt) hostname and add a custom server name:
 #export PS1='\h:\w\$ '
export PS1='my-server:\w\$ '

Add bash(shell prompt) time:
export PS1='[\t] my-server:\w\$ '

Apply changes:
Logout ( CTRL + D ) and login again.

Other available options:
\a ASCII bell char
\d current date
\e ASCII escape char
\h hostname (until first ".")
\H hostname
\n new line
\r carriage return
\s shell name
\t current time 24H
\T current time 12H
\@ current time 12H AM/PM
\u username
\v bash version
\V bash version + patch level
\w current working directory
\W basename of the current directory
\! history number of this command
\# number of the command
\$ "$" (if UID is not 0), "#" (if UID is 0)
\\ "\"
\[ begin sequence nonprinting chars
\] end sequence nonprinting chars

Friday, March 16, 2012

Javascript objects and classes; private and public methods and properties

1) Object literals

var Object = {
   
    speed : 0,
   
    setSpeed : function(speed) {
        this.speed = speed;
    },
   
    getSpeed : function() {
        return this.speed;
    }
   
}

Example:
Object.setSpeed(150);
var speed = Object.getSpeed();

All properties and methods of the object literal are public.

2) Classes

function Class1() {
   
    // private property example
    var name = 'Random name here';
   
    // public property example
    this.speed = 0;


    // private method example
    function getName() {
        return name;
    }
   
    // public method example
    this.setSpeed = function(speed) {
        this.speed = speed;
    }
   
    // public method example
    this.getSpeed = function() {
        return this.speed;
    }
   
   
}

Example:
var Object1 = new Class1();
Object1.setSpeed(150);
var speed = Object1.getSpeed();

MySQL Error: Got a packet bigger than 'max_allowed_packet' bytes

Command:
mysql -u root -ppassw db_name < db.sql

Error:
MySQL ERROR 1153 (08S01) at line 35977: Got a packet bigger than 'max_allowed_packet' bytes

FIX/SOLUTION:
1) Edit db.sql and add:
set global net_buffer_length=1000000;
set global max_allowed_packet=100000000;

2) Run:
mysql --max_allowed_packet=100000000 -u root -ppassw db_name < db.sql

Tuesday, February 21, 2012

jQuery document ready

$(document).ready(function() {
    // ... code to run after the page loads
});

PHP - number formatting using letters

Number formatting using letters, in PHP:

define('PR_NFORMAT_DEC_SEPARATOR', '.'); // decimals separator
define('PR_NFORMAT_THS_SEPARATOR', ','); // thousands separator

/**
 *
 * Formatting numbers using letters; ex: 1066345732 becomes 1.07B
 * @param float $fValue
 * @param int $nSupportedDecimals
 * @return formatted string
 */
function customNumberFormatLetters($fValue, $nSupportedDecimals = 2) {
   
    if(!preg_match('`^[0-9\.]+$`', $fValue)) {
        return $fValue;
    }
   
    // get rid of decimals
    $fValue = round($fValue);
   
    // supported cases !!! order is IMPORTANT !!! the cases are teste in this order
    $aCases = array(
        array('no_chars' => 9, 'letter' => 'B'), // billions
        array('no_chars' => 6, 'letter' => 'M'), // millions
    );
   
    $sNumberNice = $fValue;
   
    // test suppoort cases
    foreach($aCases as $aCase) {
        if($fValue > (int)str_repeat('9', $aCase['no_chars'])) {
            $fValue = $fValue / pow(10, $aCase['no_chars']);
            if($nSupportedDecimals > 0) {
                $fValue = $fValue * pow(10, $nSupportedDecimals);
                $fValue = round($fValue);
                $fValue = $fValue / (pow(10, $nSupportedDecimals));
            } else {
                $fValue = round($fValue);
            }
            $sNumberNice = number_format($fValue, $nSupportedDecimals, PR_NFORMAT_DEC_SEPARATOR, PR_NFORMAT_THS_SEPARATOR);
            $sNumberNice = eraseEndingZeros($sNumberNice);
            $sNumberNice .= $aCase['letter'];
            break;
        }
    }
   
    return $sNumberNice;
}

function eraseEndingZeros($fValueFormatted) {
    // erase all ending zeros:
    $aNparts = explode(PR_NFORMAT_DEC_SEPARATOR, $fValueFormatted);
    if(count($aNparts) == 2) {
        if(strlen($aNparts[1]) === 0 || preg_match('`^0+$`', $aNparts[1])) {
            $fValueFormatted = $aNparts[0];
        } elseif(strlen($aNparts[1]) === 1 && (string)$aNparts[1] !== '0') {
            $fValueFormatted = $aNparts[0] . PR_NFORMAT_DEC_SEPARATOR . $aNparts[1];
        } else {
            $aNparts[1] = preg_replace('`^([0-9]+)([1-9])(0+)$`', '$1$2', $aNparts[1]);
            $fValueFormatted = $aNparts[0] . PR_NFORMAT_DEC_SEPARATOR . $aNparts[1];
        }
    }
    return $fValueFormatted;
}

Saturday, February 11, 2012

Eclipse - adjust indentation when pasting

Fix Eclipse indentation problem:

Preferences -> Java -> Editor -> Typing -> When pasting: Adjust indentation

PHP: singleton pattern implementation

PHP Singleton implementation:

class MyClass {

 static private $instance = null;

 public function getInstance() { if(!self::$instance) {
$class_name = __CLASS__;
self::$instance = new $class_name;
}
return self::$instance;
}
}

PHP get current class name


Get current class name:
$sClassName = __CLASS__;

Tuesday, January 24, 2012

Highcharts: Controlling and mastering axis interval properties


Interval properties for xAxis and yAxis:

tickPixelInterval
tickInterval
tickInterval
startOnTick
endOnTick

Example "fixed number of intervals":
tickInterval : xAxis_tickInterval
startOnTick : xAxis_min
endOnTick : xAxis_max

The secret to get the exact number of intervals desired is to have xAxis_min and xAxis_max multiples of xAxis_tickInterval.
To do this, assuming you want 10 intervals, the extra fix should look like:

var xAxis_min = value_min;
var xAxis_max = value_max;
var xAxis_tickInterval = Math.round((xAxis_max - xAxis_min) / 10);
while(xAxis_min % xAxis_tickInterval != 0) {
xAxis_min--;
}
while(xAxis_max % xAxis_tickInterval != 0) {
xAxis_max++;
}

And the xAxis properties:
xAxis: {
showLastLabel: true,
min : xAxis_min,
max : xAxis_max,
tickInterval : xAxis_tickInterval,
startOnTick : xAxis_min,
endOnTick : xAxis_max
}

Wednesday, January 18, 2012

Highcharts: hide highcharts.com branding

To hide hide highcharts.com link set: credits.enabled = false

chart = new Highcharts.Chart({
credits : {
  enabled : false
},
...
});

jquery add options to select

How to add option elements to a select element:

$('#selector-id').append('<option value="123">Text Option</option>');

jquery select first option from select

How to select first option element from a select.

Get the value of first option:
var val-to-select = $('#selector-id').find('option:first').val();

Select it:
$('#selector-id').val(val-to-select);

jquery remove select options

How to remove all option elements from a select element:

$('#selector-id').children().remove();

ies4linux Ubuntu 11.10

Install ies4linux Ubuntu 11.10

sudo apt-get install wine cabextract
cd ~/Desktop/
wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux

Tuesday, January 17, 2012

PHP: Simple files exporter

Export only certain files from a project directory to an external directory. Operating system: linux (can be addapted to Windows).
Define a short list of files which will be exported.
The PHP script also creates recursively the target directories. This will spare the user from waisting a lot of time creating complex folder/subfolder structures.

<?php

$files = '
folder1/folder2/folder3/folder4/file1.php
folder1/folder2/folder3/folder4/file2.php
folder1/folder2/folder5/folder6/folder7/file3.php
folder1/folder2/folder5/folder6/folder8/folder9/file4.php
';


$project_path = '/absolute-current-path-of-the-project';
$project_path_export = '/absolute-target-path-of-the-export-folder';


$files_array = explode("\n", trim($files));
foreach($files_array as $f) {
$f = trim($f);
if(is_file($project_path . '/' . $f)) {
// make target dir if necessary
$dirs = explode('/', $project_path_export . '/' . $f);
unset($dirs[count($dirs) - 1]);
$dir_target = implode('/', $dirs);
if(!is_dir($dir_target)) {
shell_exec("mkdir -p $dir_target");
}
// copy file
if(is_dir($dir_target)) {
shell_exec("cp {$project_path}/{$f} {$dir_target}/");
}
}
}


PHP: AJAX json encode french characters

How to display french or other charset characters using AJAX JSON calls.

Current behaviour: text replaced by null;

Solution: Apply PHP function utf8_encode to the string (for each element in the array).

$string_array_element = utf8_encode($string_array_element);

Friday, January 6, 2012

SVN command line resources

Eclipse - permanently store certificate password

Preferences -> Team -> SVN

Change SVN interface Client to SVNKit

Eclipse - Ignore local files for SVN commit

Examples of files to ignore:
.buildpath
.project
.settings

Eclipse -> Preferences -> Team -> Ignored Resources

Ubuntu: Install PHP, Apache, MySQL

$ sudo apt-get install apache2 libapache2-mod-php5 php5 php5-common php5-curl php5-mysql php5-json php5-gd php5-mcrypt php5-memcache php5-memcached php5-ming php5-cli

Ubuntu - Eclipse - Failed to load JavaHL Library

Eclipse SVN, subclipse: "Failed to load JavaHL Library"

Solution:
$ sudo apt-get install libsvn-java

Ubuntu 11.10 - Eclipse 3.7.1 - No Java virtual machine was found

Error: eclipse: "No Java virtual machine was found"
System: Ubuntu 11.10 fresh install

Solution:
$ aptitude search jdk
# install openjdk-7-jre openjdk-7-jdk if they are not installed
$ sudo apt-get install openjdk-7-jre openjdk-7-jdk

Mount SMB shares from the command line

Mount smbfs command with permissions for the current user:

$ sudo mount -t smbfs //network-resource/folder /local-path/local-folder -o username=user,password=pass,uid=`id -u`,gid=`id -g`

Ubuntu 11.10 add/remove/move panel elements

How to add/remove/move panel elements in Ubuntu 11.10

The problem is that when you right-click on the panel nothing happens!

The solution: hold ALT pressed and right-click the panel. :)

Ubuntu 11.10 restore classic menu/panel

How to restore classic menu/panel in Ubuntu 11.10

Open terminal: CTRL + ALT + T

$ sudo apt-get install gnome-session-fallback

Log out and select at Log-in screen: Gnome Classic.

Tuesday, January 3, 2012

wstats.net - new version

Some new features are now available. Feel free to check the new version: http://wstats.net.

Sunday, January 1, 2012

Ttransparent background CSS

CSS properties for transparency:
.transparent
{
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}