Mehmet Mutlu tarafından yazılmış tüm yazılar

bind slave dns example conf

acl recurseallow { 172.28.16.0/24; 172.28.35.0/24; 10.10.10.0/24; };

options {
	listen-on port 53 { 127.0.0.1; 172.28.16.2; };
	listen-on-v6 port 53 { ::1; };
	directory 	"/var/named";
	dump-file 	"/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
	
	allow-query     { any; };
	allow-recursion { recurseallow; };
	forwarders {
		195.46.39.39;
		195.46.39.40;
		77.88.8.8;
		77.88.8.1;
	        8.8.8.8;
		8.8.4.4;
		195.175.39.39;
		195.175.39.40;
        };

	dnssec-enable yes;
	dnssec-validation yes;
	dnssec-lookaside auto;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.iscdlv.key";

	managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

zone "bb.local" IN {
	type slave;
        masters { 172.28.35.2; };
	file "slaves/bb.local.db";
};

Partitioning the WordPress Comments Table

WordPress sites can get big. Really big. When you’re looking at a site of Cheezburger, Engadget or Techcrunch proportions, you get hundreds of comments per post, on dozens of posts per day, which adds up to millions of comments per year.

In order to keep your site running in top condition, you don’t want to be running queries against tables with lots of rarely accessed rows, which is what happens with most comments – after the post drops off the front page, readership drops, so the comments are viewed much less frequently. So, what we want to do is remove these old comments from the primary comment table, but keep them handy, for when people read the archives.

Enter partitioning.

The idea of MySQL partitioning is that it splits tables up into multiple logical tablespaces, based on your criteria. Running a query on a single partition of a large table is much faster than running it across the entire table, even with appropriate indexes.

In the case of the WordPress comments table, splitting it up by the `comment_post_ID` seems to be the most appropriate . This should keep the partitions to a reasonable size, and ensure that there’s minimal cross-over between partitions.

First off, we need to add the `comment_post_ID` column to the Primary Key. This can be a slow process if you already have a massive `wp_comments` table, so you may need to schedule some downtime to handle this. Alternatively, there many methods for making schema changes with no downtime, such as judicious use of Replication, Facebook’s Online Schema Change Tool, or the currently-in-development mk-online-schema-change, for Maatkit.

ALTER TABLE wp_comments DROP PRIMARY KEY, ADD PRIMARY KEY (comment_ID, comment_post_ID);

Now that we’ve altered this index, we can define the partitions. For this example, we’ll say we want the comments for 1000 posts per partition. This query can take a long time to run, if you already have many comments in your system.

ALTER TABLE wp_comments PARTITION BY RANGE(comment_post_ID) (
    PARTITION p0 VALUES LESS THAN (1000),
    PARTITION p1 VALUES LESS THAN (2000),
    PARTITION p2 VALUES LESS THAN (3000),
    PARTITION p3 VALUES LESS THAN (4000),
    PARTITION p4 VALUES LESS THAN (5000),
    PARTITION p5 VALUES LESS THAN (6000),
    PARTITION p6 VALUES LESS THAN MAXVALUE
);

When you’re approaching the next partition divider value, adding a new partition is simple. For example, you’d run this query around post 6000.

ALTER TABLE wp_comments REORGANIZE PARTITION p6 INTO (
    PARTITION p6 VALUES LESS THAN (7000),
    PARTITION p7 VALUES LESS THAN MAXVALUE
);

Naturally, this process is most useful for very large WordPress sites. If you’re starting a new site with big plans, however, you may just want to factor this into your architecture.

UPDATE: Changed the partition definition to better reflect how WordPress uses the wp_comments table, per Giuseppe’s comments.

source: http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/

Unlimited level of menu through PHP and mysql

 

SELECT id, parent_id, title, link, position FROM menu_item ORDER BY parent_id, position;

 

$html = '';
$parent = 0;
$parent_stack = array();

// $items contains the results of the SQL query
$children = array();
foreach ( $items as $item )
    $children[$item['parent_id']][] = $item;

while ( ( $option = each( $children[$parent] ) ) || ( $parent > 0 ) )
{
    if ( !empty( $option ) )
    {
        // 1) The item contains children:
        // store current parent in the stack, and update current parent
        if ( !empty( $children[$option['value']['id']] ) )
        {
            $html .= '<li>' . $option['value']['title'] . '</li>';
            $html .= '<ul>'; 
            array_push( $parent_stack, $parent );
            $parent = $option['value']['id'];
        }
        // 2) The item does not contain children
        else
            $html .= '<li>' . $option['value']['title'] . '</li>';
    }
    // 3) Current parent has no more children:
    // jump back to the previous menu level
    else
    {
        $html .= '</ul>';
        $parent = array_pop( $parent_stack );
    }
}

// At this point, the HTML is already built
echo $html;

MySql Partitioning Örnek

ALTER TABLE `TABLOMUZ` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`,`tarih`);

primary key i silip, primary keyi,tarih ile birleştiricez,

ALTER TABLE `TABLOMUZ`
      PARTITION BY RANGE(TO_DAYS(`tarih`))(      

      PARTITION `2011` VALUES LESS THAN (TO_DAYS('2012-01-01')),
      PARTITION `2012` VALUES LESS THAN (TO_DAYS('2013-01-01')),
      PARTITION `2013` VALUES LESS THAN (TO_DAYS('2014-01-01')),      

      PARTITION `201401` VALUES LESS THAN (TO_DAYS('2014-02-01')),
      PARTITION `201402` VALUES LESS THAN (TO_DAYS('2014-03-01')),
      PARTITION `201403` VALUES LESS THAN (TO_DAYS('2014-04-01')),
      PARTITION `201404` VALUES LESS THAN (TO_DAYS('2014-05-01')),
      PARTITION `201405` VALUES LESS THAN (TO_DAYS('2014-06-01')),
      PARTITION `201406` VALUES LESS THAN (TO_DAYS('2014-07-01')),
      PARTITION `201407` VALUES LESS THAN (TO_DAYS('2014-08-01')),
      PARTITION `201408` VALUES LESS THAN (TO_DAYS('2014-09-01')),
      PARTITION `201409` VALUES LESS THAN (TO_DAYS('2014-10-01')),
      PARTITION `201410` VALUES LESS THAN (TO_DAYS('2014-11-01')),
      PARTITION `201411` VALUES LESS THAN (TO_DAYS('2014-12-01')),
      PARTITION `201412` VALUES LESS THAN (TO_DAYS('2015-01-01')),       

      PARTITION `201501` VALUES LESS THAN (TO_DAYS('2015-02-01')),
      PARTITION `201502` VALUES LESS THAN (TO_DAYS('2015-03-01')),
      PARTITION `201503` VALUES LESS THAN (TO_DAYS('2015-04-01')),
      PARTITION `201504` VALUES LESS THAN (TO_DAYS('2015-05-01')),
      PARTITION `201505` VALUES LESS THAN (TO_DAYS('2015-06-01')),
      PARTITION `201506` VALUES LESS THAN (TO_DAYS('2015-07-01')),
      PARTITION `201507` VALUES LESS THAN (TO_DAYS('2015-08-01')),
      PARTITION `201508` VALUES LESS THAN (TO_DAYS('2015-09-01')),
      PARTITION `201509` VALUES LESS THAN (TO_DAYS('2015-10-01')),
      PARTITION `201510` VALUES LESS THAN (TO_DAYS('2015-11-01')),
      PARTITION `201511` VALUES LESS THAN (TO_DAYS('2015-12-01')),
      PARTITION `201512` VALUES LESS THAN (TO_DAYS('2016-01-01')),             

      PARTITION `2016` VALUES LESS THAN MAXVALUE 
);

http://pento.net/2011/04/28/partitioning-the-wordpress-comments-table/
http://www.pythian.com/blog/using-mysql-partitioning-instead-of-merge-tables/

Grace Hopper

Tümamiral Grace Murray Hopper (9 Aralık 1906 – 1 Ocak 1992) Amerikalı bilgisayar bilimcisi ve ABD donanmasında rütbeli askerdi. Harvard Mark I bilgisayarının ilk programcılarından biri olan Hopper, bilgisayar programlama dilleri için ilk derleyiciyi geliştirdi. İlk modern programlama dillerinden biri olan COBOL’un da geliştiricilerindendi.[1] Bilgisayar dilinde “debugging” diye bilinen programı hatalardan temizleme konseptinin de ilk kullanıcılarındandı. Amerikan savaş gemisi USS Hopper (DDG-70) adını kendisinden almıştır.

http://www.bursadabugun.com/haber/google-dan-grace-hopper-a-ozel-doodle-331752.html

http://www.bursadabugun.com/haber/grace-hopper-kimdir-331753.html