Thứ Tư, 28 tháng 11, 2012


Find and kill port on ubuntu and mac os
  • sudo lsof -w -n -i tcp:8080
  • sudo kill -9 pidnumber

Thứ Ba, 13 tháng 11, 2012

Add skype indicator on ubuntu 12.10 64bit

sudo apt-get install sni-qt:i386

Thứ Hai, 12 tháng 11, 2012

Enable automation test

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Thứ Ba, 30 tháng 10, 2012

Install Nividia driver


sudo apt-get --purge remove xserver-xorg-video-nouveau
sudo apt-get install linux-headers-`uname -r`
sudo apt-add-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current
sudo update-alternatives --config gl_conf
sudo ldconfig
sudo update-initramfs -u
sudo nvidia-xconfig

Thứ Bảy, 8 tháng 9, 2012

Am thanh bi giat tren Ubuntu
Bạn làm theo hướng dẫn sau nhé:
bật terminal
Code:
sudo gedit /etc/apt/apt.conf.d/70debconf.
thêm dòng này xuống cuối
Code:
APT::Cache-Limit "100000000";
Lưu lại và chạy lệnh
Code:
sudo apt-get clean && sudo apt-get update --fix-missing

Thứ Sáu, 24 tháng 8, 2012

Update php 5.3.2 in ubuntu


sudo add-apt-repository ppa:bjori/php5
sudo apt-get update
sudo aptitude show php5
Package: php5
State: not installed
Version: 5.3.6-8ubuntu0ppa4~lucid1
Priority: optional
Section: php
Maintainer: Hannes Magnusson
..
sudo aptitude install php5 php5-cli
php -v
PHP 5.3.6-8ubuntu0ppa4~lucid1 (cli) (built: May 5 2011 22:11:21)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Thứ Tư, 11 tháng 7, 2012

Setup Virtual Box error "Failed to load VMMR0.r0 (VERR_SUPLIB_WORLD_WRITABLE)"

Fix: chmod o-w /usr

Thứ Năm, 21 tháng 6, 2012


Setup Zend framework
sudo apt-get install zend-framework
sudo vim /etc/php5/conf.d/zend-framework.ini
uncomment: include_path=${include_path} ":/usr/share/php/libzend-framework-php"
Save file
Restart apache2

Thứ Ba, 5 tháng 6, 2012


Install gimp 2.6.10 in ubuntu 10.04(Lucid)
Open the terminal and run the following commands
sudo add-apt-repository ppa:lucid-bleed/ppa
sudo apt-get update
sudo apt-get install gimp
Resize HDD VBox


VBoxManage modifyhd /home/staff/van.dao/Desktop/local/ubuntu64/Ubuntu_64B.vdi --resize 20000

Thứ Hai, 21 tháng 5, 2012

Connection with computer other by shh


Connection with computer other by shh

<?php

class Application_Model_Slaves_Ssh {

    private $_connection = null;
    private $_log = '';

    /**
     * construct
     *
     * @param string $host
     * @param int $port
     */
    public function __construct($host, $port) {

        $this->_host = $host;
        $this->_port = $port;

        $this->_connection = ssh2_connect($this->_host, $this->_port);
        if (!$this->_connection) {
            $this->log .= "Connection failed !";
        }
    }

    /**
     * login server
     *
     * @param string $user
     * @param string $password
     */
    public function authPassword($user, $password) {

        $this->_username = $user;
        $this->_password = $password;

        if ($this->_connection) {
            if (!ssh2_auth_password($this->_connection, $this->_username, $this->_password)) {
                $this->_log .= "\n Authorization failed !";
            }
        }
    }

    /**
     * execute command line
     *
     * @param string $cmd
     * @return string
     */
    public function cmdExec($cmd) {

        if ($this->_connection) {
            $stream = ssh2_exec($this->_connection, $cmd);
            stream_set_blocking($stream, true);
            $stdout = stream_get_contents($stream);

            $stderr = stream_get_contents(ssh2_fetch_stream($stream, SSH2_STREAM_STDERR));
            $this->_log .= "\n " . $stderr;
            print_r($stderr);
        } else {
            $stdout = 'Connection failed !';
        }

        return $stdout;
    }

    /**
     * push file to server
     *
     * @param string $localFile
     * @param string $serverFile
     * @param int $mode
     */
    public function pushFile($localFile, $serverFile, $mode = 0644) {
        if (file_exists($localFile)) {
            $folders = explode("/", $serverFile);
            unset($folders[count($folders) - 1]);
            $this->createFolderInServer(implode('/', $folders));

            ssh2_scp_send($this->_connection, $localFile, $serverFile, $mode);
        }
    }

    /**
     * get file from server
     *
     * @param string $localFile
     * @param string $serverFile
     */
    public function getFile($localFile, $serverFile) {
        $sftp = ssh2_sftp($this->_connection);

        if (file_exists("ssh2.sftp://$sftp/" . $serverFile)) {
            $folders = explode("/", $localFile);
            unset($folders[count($folders) - 1]);
            $this->createFolderInLocal(implode('/', $folders));

            ssh2_scp_recv($this->_connection, $serverFile, $localFile);
        }
    }

    /**
     * create folder in server
     *
     * @param string $pathFolder
     * @param int $mode
     */
    public function createFolderInServer($pathFolder, $mode = 0777) {
        $folders = explode('/', $pathFolder);

        $path = '';
        $sftp = ssh2_sftp($this->_connection);
        foreach ($folders as $folder) {
            if ($folder != '') {
                $path .= '/' . $folder;
                if (!is_dir("ssh2.sftp://$sftp" . $path)) {
                    ssh2_sftp_mkdir($sftp, $path, $mode);
                }
            }
        }
    }

    /**
     * create folder in local
     *
     * @param string $pathFolder
     * @param int $mode
     */
    public function createFolderInLocal($pathFolder, $mode = 0777) {
        $folders = explode('/', $pathFolder);

        $path = '';
        foreach ($folders as $folder) {
            if ($folder != '') {
                $path .= '/' . $folder;
                if (!is_dir($path)) {
                    mkdir($path, $mode);
                }
            }
        }
    }

    /**
     * get log
     *
     * @return string
     */
    public function getLog() {
        return $this->_log;
    }

}

Auto Install software in ubuntu

Install software in ubuntu