December 19th, 2012 | Tags: , ,

With current version of rp-pppoe 3.11 and kernel version 3.5.x can’t compile kernel module of PPPoE.

./configure --enable-plugin
....
checking for Linux 2.4.X kernel-mode PPPoE support... no
....
On this platform, the following targets will be built:
pppoe pppoe-server pppoe-sniff pppoe-relay

Find in source “linux/in.h” and replace with “netinet/in.h”

cd rp-pppoe-3.11/src/
grep -R "linux/in.h" *
configure:#include<linux/in.h>
configure:#include <linux/in.h>
configure.in:#include<linux/in.h>
configure.in:#include <linux/in.h>

After that:

./configure --enable-plugin
....
checking for Linux 2.4.X kernel-mode PPPoE support... yes
....
On this platform, the following targets will be built:
pppoe pppoe-server pppoe-sniff pppoe-relay rp-pppoe.so
November 12th, 2012 | Tags: ,

What we have is a table table with checkboxes, and need to:
- check/uncheck all checkboxes
- select checkbox clicking on table row and changing background ot row

$(document).ready(function() {
    // if user clicks on checkbox with id="checkall" - all checkboxes are selected
    // and table row background is highlighted
    $("#checkall").on('click',function(event){
        $('input:checkbox:not(#checkall)').prop('checked',this.checked);
        if ($(this).is(':checked') == true) {
            $("#tblDisplay").find('tr:not(#chkrow)').css("background-color","#FC9A01");
        } else  {
            $("#tblDisplay").find('tr:not(#chkrow)').css("background-color","#FFFFFF");
        }
    });    
    // if user clicks on checkbox, diffrent than checkbox with id="checkall" , 
    // then checkbox is checked/unchecked
    $('input:checkbox:not(#checkall)').on('click',function(event) {
        if($("#checkall").is(':checked') == true && this.checked == false) {
            $("#checkall").prop('checked',false);
            $(this).closest('tr').css("background-color","#ffffff");
        }
        if(this.checked == true) {
            $(this).closest('tr').css("background-color","#FC9A01");
            // function to check/uncheck checkbox with id="checkbox"
            CheckSelectAll(); 
        }
        if(this.checked == false)  {
            $(this).closest('tr').css("background-color","#ffffff");
        }
    });
    // if user clicks, someware on table row, checkbox is checked/unchecked
    // and table row background is highlighted or not
    $('#tblDisplay tbody tr').on('click',function(event) {
        var this_row = $(this);
        var checkbox = this_row.find('input.case');
        if (event.target.type !== 'checkbox') {    
            if ( checkbox.is(':checked') == false ) {
                checkbox.prop('checked', true);
                this_row.css("background-color","#FC9A01");
                CheckSelectAll();
            } else {
                checkbox.prop('checked', false);
                this_row.css("background-color","#FFFFFF");
                CheckSelectAll();
            }
        }    
    });
    // if checkbox is checked on page load, highlight table background
    $('#tblDisplay tbody tr').filter(':has(:checkbox:checked)').css("background-color","#FC9A01").end();    

function CheckSelectAll() {
    var flag = true;
    $('input:checkbox:not(#checkall)').each(function() {
        if(this.checked == false)
        flag = false;
    });
    $("#checkall").attr('checked',flag);
    }
});

Require jquery 1.7.x
Working demo: http://blog.webdir.bg/demo/checkbox-jquery.html

October 29th, 2012 | Tags: , ,

ZyXEL CPU OID: .1.3.6.1.4.1.890.1.5.8.31.12.7.0
ZyXEL CPU Temperature: .1.3.6.1.4.1.890.1.5.8.31.9.2.1.2.2
ZyXEL MAC Temperature: .1.3.6.1.4.1.890.1.5.8.31.9.2.1.2.1
ZyXEL PHY Temperature: .1.3.6.1.4.1.890.1.5.8.31.9.2.1.2.3

Screenshots:

Zyzel ES-3124F MIB Download

Zyzel ES-3124F CACTI Host Template

May 10th, 2012 | Tags: , , ,

From Google Webmaster Tools:

lang=>HTTP/1.1 404 Not Found
Date: Thu, 10 May 2012 06:43:57 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.10
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 5626
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="bg-bg" lang="bg-bg">
<head>
<title>Страница грешка - 404, 404 Error page</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 

The PHP code

       header('HTTP/1.1 404 Not Found');        
        readfile('notfound.html');
        die();
May 10th, 2012 | Tags: , , ,

To achieve permanent URL redirect 301 as shown from Google Webmaster Tools:

Old URL is  http://www.example.com/details.php?id= ….. ,  new URL is SEO friendly http://www.example.com/seo-friendly-url.html

This is how Googlebot fetched the page.
URL: http://www.webdir.bg/details.php?id=4&KeepThis=true&TB_iframe=true&height=340&width=600
Date: Thursday, May 10, 2012 12:10:50 AM PDT
Googlebot Type: Web
Download Time (in milliseconds): 343
HTTP/1.1 301 Moved Permanently
Date: Thu, 10 May 2012 07:07:52 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.10
Location: http://www.webdir.bg/%D0%B3%D1%80%D0%B0%D0%B4%D0%B8%D0%BD%D1%81%D0%BA%D0%B8.html
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

PHP Code:

    header('HTTP/1.1 301 Moved Permanently');
    $location = "www.example.com/newurl.php";
    header("Location: $location",true,301);
    die();
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.

   $(document).ready(function(){
        $('#load_events').load('events.php');
    });
    var auto_refresh = setInterval(function(event)
     {$('#load_events').load('events.php');}, 2000);  

HTML:

<div id="load_events"> </div>

Demo:

September 21st, 2011 | Tags: , ,

Apache config: (you need to set AllowOverride all)

<Directory /var/www/>
                Options FollowSymLinks MultiViews
                AllowOverride all
                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