Recently, ESET add my domain name to the black-list of their database. You can’t open my site and been warned my site is not safe if your PC is running the ESS or EAV. Why Eset block my site?The answer is obvious. That is reason that you come here. I promise that my site is pure, no virus, no spyware, no Trojan, no pop ads. You can test my word through intalling Kaspersky or other Antivirus Software. If you want open my site and take latest escalation ID & Activation Code, close your ESET software(disable antivirus and antispyware protection function temporarily) or by proxy or virtual machinor. You can also feed the RSS source http://feed.loserblog.cn.

Archive

Archive for the ‘Programm’ Category

Pear package of PHP_Compat

June 29th, 2008 Loser No comments


Pear's PHP_Compat is a relatively interesting package, it provided some php4 under php5 can also use the proprietary function, such as file_put_contents, array_combine, str_split ………. so even in php4 the host, In advance can enjoy the convenience of one point php5 function.
Usage
PLAIN TEXT
PHP:

    1.
       <? php
    2.
       require_once 'PHP / Compat.php';
    3.
      
    4.
       / / Load file_put_contents
    5.
       PHP_Compat:: loadFunction ( 'file_put_contents');
    6.
      
    7.
       / / Load str_split, array_chunk and file_get_contents
    August.
       PHP_Compat:: loadFunction (array ( 'str_split', 'array_chunk', 'file_get_contents'));
    9.
       «>

The above examples illustrate, you can load a specific function of n php5
Package Information: PHP_Compat

http://pear.php.net/package/PHP_Compat

Categories: Programm Tags:

Create a local pear

June 29th, 2008 Loser No comments

In some host, you may not modify the system's default installation of pear competence, but also want to install their own pear packages. Under such circumstances there are simple ways to achieve:

First of all in their own home under a pear create a profile. Pearrc:
$ Pear config-create $ HOME. Pearrc

If all goes well, the next step directly, or else run the following order:
$ Pear config-set download_dir / home / (username) / tmp / pear / cache
$ Pear config-set cache_dir / home / (username) / tmp / pear / cache
$ Pear config-set temp_dir / home / (username) / tmp / pear / temp

Then you can start the installation of pear, pear will be linked to the installation of a reliance on paper:
$ Pear install-o PEAR

After this step, pear installation is complete, if you want to install other package, then:
$ Pear install pear / PackageName

So you have a pear own customized package, in order to call in the proceedings of these pear, thank you need to write some additional code, after all, the code is not in your include_path.

php4
PLAIN TEXT
CODE:

    1.
       ini_set (
    2.
         'include_path',
    3.
         ini_get ( 'include_path'). PATH_SEPARATOR. "/ home / (youruser) / pear / php"
    4.
       );

php5
PLAIN TEXT
CODE:

    1.
       set_include_path (
    2.
           get_include_path ().
    3.
           PATH_SEPARATOR. '/ Home / (youruser) / pear / php'
    4.
       );

Categories: Programm Tags:

PEAR DB on the comparative method and MDB2

June 29th, 2008 Loser No comments

Php4 times in the past, I like to use the pear DB library, the use of very convenient. But now pear official has suggested that we stop using MDB2 to replace it, the predecessor of MDB2 Although there may be some DB's shadow, but there is still some use different methods, while using these days, while some notes.
MDB2 DB
queryAll getAll
queryRow getRow
queryCol getCol
queryOne getOne
autoExecute autoExecute (need to load extended module)
autoPrepare autoPrepare (need to load extended module)

Other methods appear consistent.

Categories: Programm Tags:

Let phpBB 2.0.x support mysql 5.0

June 27th, 2008 Loser No comments

    The current phpbb 2.0.x series is not supported mysql 5.0, but can be modified through the tiny achieve this objective.

Open:

     install / schemas / mysql_schema.sql

Find code:
PLAIN TEXT
SQL:

    1.
       bbcode_uid char (10) NOT NULL,

Replaced by:
PLAIN TEXT
SQL:

    1.
       bbcode_uid char (10) DEFAULT''NOT NULL,

Then choose when to install the MySQL 4 normal installation can use the mysql 5

Categories: Programm Tags:

mysql 5.1 of the plan tasks – Event

June 27th, 2008 Loser No comments

    mysql site more than a 5.1 on the new features Event (events), Ze look like windows of the plan tasks, a small, Oh, is this. If you have such a demand – the end of the year , I Cacak users every day to the table and what new beauty, perhaps you can use Events of the following are the establishment of new grammar Event
PLAIN TEXT
SQL:

    1.
       Create EVENT
    2.
       e / * case * /
    3.
       ON SCHEDULE
    4.
       EVERY 1 WEEK / * implementation interval * /
    5.
       DO
    6.
       Insert INTO t VALUES (0); / * SQL statement * /

To open or close this characteristic, just below the sql:
PLAIN TEXT
SQL:

    1.
       SET GLOBAL event_scheduler = 1; / * 0 is closed * /

In any case, mysql the new version is more powerful, but the actual projects, not to use them, it is hard to say performance is not the discount will bear

Categories: Programm Tags:

mysql 5.1 new features – by date Division

June 26th, 2008 Loser No comments


mysql 5.1 has reached the beta version, the official website also have a number of articles, such as last seen Improving Database Performance with Partitioning. Division in the use of the premise, you can use mysql achieve very large amount of data storage. Mysql today in the station and see an advanced article – by date storage area. If the district can be achieved by date, the timeliness of some very strong data storage is a very practical function. Below are excerpts from the article in some of the content.
The wrong example by date Division

The most direct way to do this is the direct use of this day of this date format for the District of conventional:
PLAIN TEXT
CODE:

    1.
       mysql> create table rms (d date)
    2.
           –> Partition by range (d)
    3.
           –> (Partition p0 values less than ('1995-01-01 '),
    4.
           –> Partition p1 VALUES LESS THAN ('2010-01-01 '));

The above example, is the direct use of "Ymd" to the format of a partition table, but take it for granted often does not work, will get an error message:

     ERROR 1064 (42000): VALUES value must be of same type as partition function near '),
     partition p1 VALUES LESS THAN ('2010-01-01 '))' at line 3

The district approach did not succeed, but obviously not the economy, the DBA will use sophisticated numerical for cosmetic Division:
PLAIN TEXT
CODE:

    1.
       mysql> Create TABLE part_date1
    2.
           –> (C1 int default NULL,
    3.
           –> C2 varchar (30) default NULL,
    4.
           –> C3 date default NULL) engine = myisam
    5.
           –> Partition by range (cast (date_format (c3, '% Y% m% d') as signed))
    6.
           –> (PARTITION p0 VALUES LESS THAN (19950101),
    7.
           –> PARTITION p1 VALUES LESS THAN (19960101),
    8.
           –> PARTITION p2 VALUES LESS THAN (19970101),
    9.
           –> PARTITION p3 VALUES LESS THAN (19980101),
   10.
           –> PARTITION p4 VALUES LESS THAN (19990101),
   11.
           –> PARTITION p5 VALUES LESS THAN (20000101),
   12.
           –> PARTITION p6 VALUES LESS THAN (20010101),
   13.
           –> PARTITION p7 VALUES LESS THAN (20020101),
   14.
           –> PARTITION p8 VALUES LESS THAN (20030101),
   15.
           –> PARTITION p9 VALUES LESS THAN (20040101),
   16.
           –> PARTITION p10 VALUES LESS THAN (20100101),
   17.
           –> PARTITION p11 VALUES LESS THAN MAXVALUE);
   18.
       Query OK, 0 rows affected (0.01 sec)

Get » Then down analysis

PLAIN TEXT
CODE:

    1.
       mysql> explain partitions
    2.
           –> Select count (*) from part_date1 where
    3.
           –> C3> date'1995-01-01 'and c3 <date'1995-12-31' \ G
    4.
       *************************** 1. Row ******************** *******
    5.
                  id: 1
    6.
         select_type: SIMPLE
    7.
               table: part_date1
    8.
          partitions: p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11
    9.
                type: ALL
   10.
       possible_keys: NULL
   11.
                 key: NULL
   12.
             key_len: NULL
   13.
                 ref: NULL
   14.
                rows: 8100000
   15.
               Extra: Using where
   16.
       1 row in set (0.00 sec)

Mysql rotten to the core of the above sql actually make use of scanning table, and not according to our district block for the date. original MYSQL explained to the Optimizer does not recognize the date of this form of district and spend a lot of space to lure I took amok, too.
District examples of the correct date

mysql optimization supports the following two built-in date functions Division:

     * TO_DAYS ()
     * YEAR ()

Look at an example:
PLAIN TEXT
CODE:

    1.
       mysql> Create TABLE part_date3
    2.
           –> (C1 int default NULL,
    3.
           –> C2 varchar (30) default NULL,
    4.
           –> C3 date default NULL) engine = myisam
    5.
           –> Partition by range (to_days (c3))
    6.
           –> (PARTITION p0 VALUES LESS THAN (to_days ('1995-01-01 ')),
    7.
           –> PARTITION p1 VALUES LESS THAN (to_days ('1996-01-01 ')),
    8.
           –> PARTITION p2 VALUES LESS THAN (to_days ('1997-01-01 ')),
    9.
 &n
bsp;         –> PARTITION p3 VALUES LESS THAN (to_days ('1998-01-01 ')),
   10.
           –> PARTITION p4 VALUES LESS THAN (to_days ('1999-01-01 ')),
   11.
           –> PARTITION p5 VALUES LESS THAN (to_days ('2000-01-01 ')),
   12.
           –> PARTITION p6 VALUES LESS THAN (to_days ('2001-01-01 ')),
   13.
           –> PARTITION p7 VALUES LESS THAN (to_days ('2002-01-01 ')),
   14.
           –> PARTITION p8 VALUES LESS THAN (to_days ('2003-01-01 ')),
   15.
           –> PARTITION p9 VALUES LESS THAN (to_days ('2004-01-01 ')),
   16.
           –> PARTITION p10 VALUES LESS THAN (to_days ('2010-01-01 ')),
   17.
           –> PARTITION p11 VALUES LESS THAN MAXVALUE);
   18.
       Query OK, 0 rows affected (0.00 sec)

To to_days () function zoning is successful, we look at the analysis:
PLAIN TEXT
CODE:

    1.
       mysql> explain partitions
    2.
           –> Select count (*) from part_date3 where
    3.
           –> C3> date'1995-01-01 'and c3 <date'1995-12-31' \ G
    4.
       *************************** 1. Row ******************** *******
    5.
                  id: 1
    6.
         select_type: SIMPLE
    7.
               table: part_date3
    8.
          partitions: p1
    9.
                type: ALL
   10.
       possible_keys: NULL
   11.
                 key: NULL
   12.
             key_len: NULL
   13.
                 ref: NULL
   14.
                rows: 808431
   15.
               Extra: Using where
   16.
       1 row in set (0.00 sec)

We can see, mysql for the optimization delivered, the only district in p1 query. In such circumstances enquiries, enquiries can really enhance the efficiency brought Mody » Below were the establishment of the district before part_date3 and the failure of part_date1 contrast to a query:
PLAIN TEXT
CODE:

    1.
       mysql> select count (*) from part_date3 where
    2.
           –> C3> date'1995-01-01 'and c3 <date'1995-12-31';
    3.
       +———-+
    4.
       | Count (*) |
    5.
       +———-+
    6.
       | 805114 |
    7.
       +———-+
    8.
       1 row in set (4.11 sec)
    9.
      
   10.
       mysql> select count (*) from part_date1 where
   11.
           –> C3> date'1995-01-01 'and c3 <date'1995-12-31';
   12.
       +———-+
   13.
       | Count (*) |
   14.
       +———-+
   15.
       | 805114 |
   16.
       +———-+
   17.
       1 row in set (40.33 sec)

Can see that the district correct, then query for the time spent four seconds, and the district is the wrong time to spend 40 seconds (at no district), a 90 percent efficiency improvement! Therefore, we must be the correct use of district functions, be sure to explain district after verification, in order to obtain real improvement in performance.

Categories: Programm Tags:

php 5.2 + pdo_mysql installation

June 26th, 2008 Loser No comments


That day in a redhat machines installed on php 5.2 + pdo_mysql, take a little detour, wasting a lot of time. The record:

     First of all, I recorded in accordance with the manual before installing php, some parameters of change, configure parameters of the increase – with-pdo = shared-with-pdo-mysql = shared

The wrong end of some tips:

     checking for MySQL support for PDO… yes, shared
     checking for mysql_config… / usr / bin / mysql_config
     . / configure: line 3038:-e: command not found
     . / configure: line 3039:-e: command not found
     checking for mysql_query in-lmysqlclient… no
     configure: error: mysql_query missing!?

Therefore temporarily removed the pdo-mysql installation of the module, installed directly on the latest PDO_MYSQL pecl.php.net

     tar-xf PDO_MYSQL.tar
     cd PDO_MYSQL-1.0.1
     phpize
     . / configure

Still appear before an error. Very depressing, in a google search on this, a most rude most violent way is to directly modify configure, bypassing mysql_query testing, this can build successful, but the use of the time called pdo_mysql module failure.

Even on this issue is the card for a long time, in the google search results in one comparison, the last a more constructive so I was prompted to go back and check glibc version.

     rpm-qa | grep glibc

So that the machine is on the glibc version 2.3, and I download and install the mysql is for glibc 2.2, It is no wonder that will compile failure. Installation of the corresponding version of the mysql after the issue is resolved.

Categories: Programm Tags:

MYSQL the FOUND_ROWS () function

June 26th, 2008 Loser No comments

    
Update: FOUND_ROWS () function seemingly there are still some problems, see http://bugs.mysql.com/bug.php?id=18454

mysql 4.1 add a FOUND_ROWS () function, the function of note is this:

     For a Select with a LIMIT clause, the number of rows that would be returned were there no LIMIT clause

     A Select statement may include a LIMIT clause to restrict the number of rows the server returns to the client. In some cases, it is desirable to know how many rows the statement would have returned without the LIMIT, but without running the statement again. To obtain this row count, include a SQL_CALC_FOUND_ROWS option in the Select statement, and then invoke FOUND_ROWS () afterward:

For example, a paragraph sql need to retrieve a list of the top 10 firms, but also need to meet the requirements out of the total number. This flip operation in some very common
PLAIN TEXT
CODE:

    1.
       Select SQL_CALC_FOUND_ROWS * FROM tbl_name
    2.
       Where id> 100 LIMIT 10;

In the last query, you just use FOUND_ROWS () can be obtained for the total number, this number is discard the results after the LIMIT:
PLAIN TEXT
CODE:

    1.
       Select FOUND_ROWS ();

The first of these sql SQL_CALC_FOUND_ROWS can not be omitted from the inside, it expressed the need to obtain the number of results, but also behind the use of FOUND_ROWS () function of the stage.

Categories: Programm Tags:

MySQL Proxy the Alpha release

June 26th, 2008 Loser No comments

MySQL Proxy the Alpha release. Below are the official presentation.

     What is MySQL Proxy?

     MySQL Proxy is a simple program that sits between your client and MySQL server (s) that can monitor, analyze or transform their communication. Its flexibility allows for unlimited uses; common ones include: load balancing; failover; query analysis; query filtering and modification ; And many more.

It seems that this thing can do load balancing, fault recovery and query filter things like, if good performance, bug bit the case, such as its official release, I will consider Nata to do something, after all, these are php developers often have to deal with things. Expect! !

Categories: Programm Tags:

PDO_MYSQL some predefined constants

June 26th, 2008 Loser No comments


PDO_MYSQL is PHP Data Objects (PDO) interface of a mysql expansion. Php manual carefully to see above, in fact, there are a few interesting parameter is available, such as:
PDO:: MYSQL_ATTR_INIT_COMMAND (integer)

     Command to execute when connecting to the MySQL server. Will automatically be re-executed when reconnecting.

When I use PDO_MYSQL connected to the mysql later, we can use some of the parameters automatically QUERY. Use the most common use is connected mysql utf-8 character set:
PLAIN TEXT
CODE:

    1.
       $ db = new PDO ( "mysql: dbname = dbname", "user", "password",
    2.
           array (PDO:: MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"));

The code above will be connected to the mysql immediately after the implementation of sql:
PLAIN TEXT
CODE:

    1.
       set names' utf8 ';

Categories: Programm Tags:
  • Partner links