Archive for January, 2006

Word Press 2.0 Trackback fix revisit

After follow Ah Knight’s instruction of updating wp_posts to_ping column, it seem like I can’t perform normal trackback again. I got it fix and download the files here. Or read below for more details, there are 2 files need to be change, which is;

  • wp-includes/function-posts.php
  • wp-admin/execute-pings.php

file: wp-includes/function-post.php
line of code: 700

if ( empty($to_ping) )
return;

Instead of doing nothing here, we replace the return; to Ah Knight’s code, become;

if ( empty($to_ping) ) {
$wpdb->query(”UPDATE $wpdb->posts SET to_ping = ” WHERE ID = ‘$post_id’”);
return;
}

file: wp-admin/execute-pings.php
line of code: 22

while ($trackback = $wpdb->get_row("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft' LIMIT 1")) {
echo “Trackback : $trackback->ID
“;
do_trackbacks($trackback->ID);
}

Some changes made here, make sure to_ping field is clean and make a trackbacks looping!

$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE TRIM(to_ping) != '' AND post_status != 'draft'");

if (is_array($trackbacks) && count($trackbacks)) {
foreach ($trackbacks as $trackback ) {
echo “Trackback : $trackback->ID
“;
do_trackbacks($trackback->ID);
}
}

Done, if you not sure what am I explaning above, you can download the file here in zip format, if you are worry the code is not working, backup your original file.

Happy Trackback!

Tags: , ,

Ruby On Rails!

Ruby on Rails successfully installed and configured on FreeBSD6.0 machine! I have followed the simple tutorial on Rails website and it amazed me, you can create a simple data entry apps in less than 5 mins, no more mysql_query.. just some simple codes.. Rails is amazing and am explore more on it… spoonfork is on the rails too… come join us and open source your code! P

Extreme Programming

Good read on another software development approach.

Extreme Programming (XP) is actually a deliberate and disciplined approach to software development. About eight years old, it has already been proven at many companies of all different sizes and industries world wide.

visit Extreme Programming(XP)

array_merge

Having problem during coding, was thinking how to join an array after results returned from several database tables, then Sogua found a function for me call array_merge() in PHP. After studied PHP documentation and I have found PHP built-in a lot cool array functions such as array_reverse, array_flip, array_diff_assoc and etc. These array functions have helped me a lot on array() manipulations.

Let talk about array_merge, let say you have done few query from differrent database tables, and you want all the returned results store into an array, here is simple example.

Assume you have array as below;

$takizo = array("Company Name"=>"Takizo", "Company Tel"=>"1234", "Country"=>"Malaysia");
$paulooi = array(”DOB”=>”09091999″, “POB”=>”AS”, “web”=>”paulooi.com”, );
$food = array(”Chinese”=>”Bak Kut Teh”, “Indian”=>”Tosai”, “Malay”=>”Nasi Lemak”);

Those arrays above are query from different database tables(after runing few time pg_query), but you want to put all in one array, this will save you.

$paul_details = array_merge($takizo, $paulooi, $food);
print_r($paul_details);

It will returns,

Array
(
[Company Name] => Takizo
[Company Tel] => 1234
[Country] => Malaysia
[DOB] => 09091999
[POB] => AS
[web] => paulooi.com
[Chinese] => Bak Kut Teh
[Indian] => Tosai
[Malay] => Nasi Lemak
)

Hope this helps!

PHP5.1.2 released

The PHP development team is proud to announce the release of PHP 5.1.2.
This release combines small feature enhancements with a fair number of
bug fixes and addresses three security issues. All PHP 5 users are
encouraged to upgrade to this release.

The security issues resolved include the following:

* HTTP Response Splitting has been addressed in ext/session and in the
header() function. Header() can no longer be used to send multiple
response headers in a single call.
* Format string vulnerability in ext/mysqli.
* Possible cross-site scripting problems in certain error conditions.

The feature enhancements include the following notables:

* Hash extension was added to core and is now enabled by default. This
extension provides support for most common hashing algorithms without
reliance on 3rd party libraries.
* XMLWriter was added and enabled by default.
* New OCI8 extension that includes numerous fixes.
* PNG compression support added to the GD extension.
* Added –enable-gcov configure option to enable C-level code coverage.
* getNamespaces() and getDocNamespaces() methods added to SimpleXML
extension.

The release also includes over 85 bug fixes with a focus on:

* Correction of the many regressions in the strtotime() function.
* Fixes of several crashes, leaks and memory corruptions found in the
imap, pdo, gd, mysqli, mcrypt and soap extensions.
* Corrected problems with the usage of SSI and virtual() in the Apache2
SAPI.
* Build fixes for iconv and sybase_ct extensions.
* Fixed the previously broken Sun(rise|set) functions.
* SQLite libraries upgraded to 2.8.17 and 3.2.8
* Win32 binaries now include libxml2-2.6.22 and libxslt-1.1.15.

The full details of the changes in PHP 5.1.2 can be found here:
http://www.php.net/ChangeLog-5.php#5.1.2

PHP Development Team.

Next Page »