October 13th, 2011 | Tags: ,

XCache is a fast, stable  PHP opcode cacher that has been tested and is now running on production servers under high load. Install php5-xcache:

apt-get install php5-xcache

Configuration file is /etc/php5/conf.d/xcache.ini . Some of major config options:

extension=/usr/lib/php5/20090626/xcache.so - load xcache
xcache.admin.enable_auth = On - enable auth of admin page
xcache.admin.user = "UserName" - username
xcache.admin.pass = "ca34ew" - password, must be md5(password)
xcache.size = 256M - memory used for xcache
xcache.coverager = On - to enamble coverage
xcache.coveragedump_directory = /tmp

To enable xcache admin page, create file /etc/apache2/conf.d/xcache.conf

Read more…

September 21st, 2011 | Tags: , ,

Refreshing iframe using jQuery.

setInterval(function() { loadFrame(); }, 1000);
function loadFrame() {
    var frames = jQuery('._frameToRefresh');
    var link = 'http://blog.webdir.bg/demo/iframe-time.php';
    frames.each(function(index) {
    	jQuery(this).slideDown('slow');
    	jQuery(this).attr( 'src', link) ;
    });
}

Read more…

September 21st, 2011 | Tags: , ,

Apache config: (you need to set AllowOverride all)

<Directory /var/www/>
                Options FollowSymLinks MultiViews
                <strong>AllowOverride all</strong>
                Order allow,deny
                Allow from all
</Directory>

Create .htaccess file in document root ( /var/www/.htaccess ) and set

AddHandler application/x-httpd-php js
August 3rd, 2011 | Tags:

If you are using http://pagespeed.googlelabs.com to view the speed your site, some of most common suggestions for improvement is Leverage browser caching

To set up caching you need to edit apache configuration (This code uses the FilesMatch directive and the Header directive to add Cache-Control Headers to certain files):

                <IfModule mod_expires.c>
                        ExpiresActive On
                        <FilesMatch "\.(js|jpg|jpeg|png|gif|swf|css|js)$">
                                ExpiresDefault "access plus 7 days"
                        </FilesMatch>
                </IfModule>
June 8th, 2011 | Tags: , , , , ,

Ubuntu 10.04 configuration:

Install ifenslave — Attach and detach slave network devices to a bonding device.

apt-get install  ifenslave

Ubuntu 10.04 introduce a new way of configuring bond interface ( you don’t need to use /etc/modprobe.d/aliases.conf ).
Open and edit /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

auto bond0
iface bond0 inet static
        address 192.168.200.5
        netmask 255.255.255.0
        network 192.168.200.0
        broadcast 192.168.200.255
        bond-slaves eth0 eth1
        bond_mode 802.3ad
        bond_miimon 100
        bond_xmit_hash_policy 1
        bond_lacp_rate 1

bond-mode 802.3ad - use 802.3ad protocol. You can read supported modes in kernel’s documentation bonding.txt
bond_xmit_hash_policy 1 – default value is 0

  • 0 (layer 2) - Uses XOR of hardware MAC addresses to generate the hash.
  • 1 (layer3+4) - This policy uses upper layer protocol information, when available, to generate the hash. This allows for traffic to a particular network peer to span multiple slaves, although a single connection will not span multiple slaves.

bond_lacp_rate 1 - default 0

April 15th, 2011 | Tags:

You can use a port on EX4500 as access ( using native vlan ) and trunk.
For our example on a linux box we have a tagged traffic (vlan 100) and untagged traffic ( vlan 10 ):
EX4500 configuration:

root@bravo# set interfaces ge-0/0/8 unit 0 family ethernet-switching port-mode tagged-access
root@bravo# set interfaces ge-0/0/8 unit 0 family ethernet-switching native-vlan-id 10
root@bravo# set interfaces ge-0/0/8 unit 0 family ethernet-switching vlan members 100
root@bravo# run show configuration interfaces ge-0/0/8
unit 0 {
    family ethernet-switching {
        port-mode tagged-access;
        vlan {
            members 100;
        }
        native-vlan-id 10;
    }
}
March 7th, 2011 | Tags:

To match a white space in MySQL table field use REGEXP.

SELECT username FROM mytable WHERE username REGEXP '[[:space:]]'

the result will be

+--------------+
| username     |
+--------------+
| user 474     |
| user 113     |
| user 22      |
+--------------+
March 4th, 2011 | Tags:

This howto is installed and tested on:

Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic
*******************************************************
PHP 5.2.10-2ubuntu6.7 with Suhosin-Patch 0.9.7 (cli) (built: Jan 12 2011 17:56:07)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
*******************************************************
Linux sns 2.6.31-14-server #48-Ubuntu SMP Fri Oct 16 15:07:34 UTC 2009 x86_64 GNU/Linux

P.S ( this howto is tested and working also on Ubuntu 10.04 )
STEP 1 : install the following packages:

apt-get install rrdtool librrd-dev php5-dev gcc binutils

STEP2: Go to http://oss.oetiker.ch/rrdtool/pub/contrib/ to get the PHP rrdtool source : php_rrdtool.tar.gz Read more…

February 17th, 2011 | Tags:

If you connect for example on Linux Samba server, for example \\192.168.2.1, and use for first shared folder one user and pass, and after that you try to login to second folder with another user and pass, Windows can’t login. The only way to login ( I found ) is to delete share, to clear window’s share cache. Open cmd, and type the following command:

net use /delete \\192.168.2.1
January 21st, 2011 | Tags:

Before entering the BootROM menu, you need to restart the S2300. During the restart of the S2300, the following information is displayed:

Press Ctrl+B to enter BOOTROM menu... 1

Press Ctrl+B within one second, and then enter the password. The default password is huawei or www.huawei.com . Then the advanced BootROM menu is displayed. The following information is displayed:
BOOTROM MENU

1. Boot with default mode
2. Enter serial submenu
3. Enter startup submenu
4. Enter ethernet submenu
5. Enter filesystem submenu
6. Modify BOOTROM password
7. Reboot

Enter your choice(1-7):