WordPress 2.8 announced and installed

The WordPress version running on this blog is now "2.8-beta1-11380". After the first beta has been announced, i switched the svn installation to trunk again (after having it to branches/2.7) and updated the blog.

There is a problem with gengo though: Right after upgrading i got this warning:

CODE:
  1. Warning: Invalid argument supplied for foreach() in /.../wp-includes/classes.php on line 255

The line in question looks like this:

PHP:
  1. foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t)

I really didn't have the time to get into this, so in order to get the blog going, i used the workaround suggested here and changed the line to:

PHP:
  1. foreach ((array) $GLOBALS['wp_taxonomies'] as $taxonomy => $t)

Wolfram Alpha goes public

Wolfram Alpha is finally the computer we were waiting for. Not only does it compute mathematical problems really fast, but it tries to give us everything about the answer, that we would like to find out. It's like a wikipedia - just with more accurate information. Also, WolframAlpha is able to interpret user input and find out what the user is trying to find out by searching for the terms of a query in a semantic database: Weather in Guatemala, President in Germany or C6H6O.

Below the answer set that WolframAlpha delivers, there is the option for an output as pdf-file and a rather general information of where the information came from.

Convert Gray-Code to decimal/binary and back

Gray-Code is a binary code developed by Frank Gray in 1947. It is used by most absolute incremental encoders and some favor it's use for fringe projection systems that have to encode the pixel data in a series of image patterns (mostly fringes with differing widths). To convert Gray-Code from and to Decimal numbers using c++ i had to look up different approaches with varying difficulty levels. I then compiled the following algorithms, that i will be using for my own fringe projection system (keep tuned).

It's rather easy if you know how to do it. I had to find out the hard way, so here's for the rest of the world:

First the easy part: transforming a integer number dec into a Gray-code _code:

C++:
  1. void _calculateGrayCode () {
  2.     bitset<numeric_limits<int>::digits + 1> bs(dec);
  3.     bitset<numeric_limits<int>::digits + 1> gs(dec);
  4.     bitset<numeric_limits<int>::digits + 1> _code(0);
  5.     bs>>= 1;
  6.     gs ^= bs;
  7.     for (unsigned i=0; i<_code.size(); i++){
  8.         _code[i] = gs[i];
  9.         gs[i]=0;
  10.     }
  11. }

Now to the part of converting Gray-Code to binary and then decimal number: Suppose our Gray-code is inside the bitset _code.

C++:
  1. void _calculateNumber () {
  2.     bitset<numeric_limits<int>::digits + 1> gs(0);
  3.     bitset<numeric_limits<int>::digits + 1> bs(0);
  4.     for (unsigned i=0; i<_code.size(); i++){
  5.         gs[i] = _code[i];
  6.     }
  7.     bs[gs.size()-1] = gs[gs.size()-1];
  8.     for (int i=gs.size()-2; i>=0;i--){
  9.         bs[i]=bs[i+1];
  10.         bs[i]=bs[i]^gs[i];
  11.     }
  12.     _number = static_cast<int>(bs.to_ulong());
  13. }

bs holds the binary representation of the Gray-Code and _number is the decimal respresentation.

References:

Major crisis: some databases not readable

Two days ago i was just about to reinstall the whole server (web, db, mail and fileserver). The reason was, that mysql was apparently not able to open most databases. The files were still there (under /var/lib/mysql), but only two databases which belonged to two gregarius-installations were accessible. I had just installed the aggregator at solidworks.toomuchcookies.net and had instructed the installer to create the database needed. I gave him root-access and also told him to access that database after that as root.

And that was the problem: The installation procedure involved creating the database and granting the user (in this case root himself) on localhost only rights to that database - not on all databases. After that the mysql.users table had a line which granted root/password/localhost only access to two databases and another line which granted root/password/bigcook root access to all privileges. The second line came first and was therefor ignored. I even wasn't able to access the mysql-database, which hods information about the user privileges..

To solve the problem (after an hour and a half of desperate searching and trying to 'recover' the data) i had to start mysql with the "--skip-grant-tables" parameter.

CODE:
  1. /etc/init.d/mysql stop
  2. mysqld --skip-grant-tables &

This is a rather dangerous mode and should be handled with care, since it instructs mysql to ignore the privilege table and allow all users access. I used this mode to verify that the databases were still there and then moved on to see the mess created in the mysql.users table. By removing the second grant line, the server was finally able to read all the databases. Phew!

Don't forget to stop the server and restart as daemon:

CODE:
  1. killall mysqld
  2. /etc/init.d/mysql start

Postfix: sender_bcc_maps

For an email account for a group project, we needed the ability to see what was being sent via a specific email account. The reason was, that we're going to handle the account data very liberally and therefor to avoid misuse of the account, we needed an automatic forward of all emails that were sent from this account to some screening account.

I thought i would need to script some piping instructions but actually it was much easier: Using the command sender_bcc_maps i could simply define that any email sent by x@x.com would be bcced to the same account. Now, that account has an automatic forward to some aliases. So anytime someone sends an email from x@x.com all the aliases (outside emails) would get a notice.

To setup sender_bcc_maps, i needed to setup a hashtable that looked like this:

CODE:
  1. bcc_maps
  2. x@x.com   x@x.com

After "postmap bcc_maps" i had to include the command in main.cf, that looks like

CODE:
  1. sender_bcc_maps = hash:\etc\postfix\bcc_maps

That did the trick. Thanks to miniGeek, Linox.BE and of course the Postfix team.

Pingbacks and Trackbacks work again in WordPress

For quite some time, i had a problem getting pingbacks and trackbacks working. Receiving them wasn't a problem, but i couldn't send any. It seems, i'm not alone and no where were any answers to be found..

I think i found the problem: the function spawn_cron (/wp-includes/cron.php, 153) opens a socket to then wp-cron.php file after adding a new scheduled item. For that reason it runs the function wp_remote_post which also accepts a timeout parameter. That parameter is set to 0.01 by default. I guess these are seconds (which means these are 10 milliseconds!) and for some webservers this value is simply too small. Change that to something bigger (i'm using 0.1 or 1) and pingbacks and trackbacks should work again..

Now what about the old trackbacks and pingbacks that didn't get sent? Actually you'll simply need to write a new post and all the old unsent pings should be scheduled for sending. If you don't want to do that, you could install the plugin Wp-Crontrol where you can specify a hook to be scheduled to a specific time. Schedule the hook "do_pings" to be triggered any time soon (parameter should be empty = "[]") and it should take care of the old pingsbacks.

Finally wordpress 2.7 final

The final version of wordpress 2.7 "Coltrane" has been released. I've kept this blog up to date and switched from trunk to 2.7-branch now for fear that the stability held up until now won't be kept up. I've also updated my main blog. The only thing that is bugging me is the notice at the top of the blog telling me to upgrade to please WordPress 2.7, even though the blog is long updated.. A last-minute bug?

It's really funny at the dashboard, where it literally says "You have version 2.7. Would you like to upgrade to version 2.7?"

upgrade27

upgrade27

Anyway, the team of Automattic has again done a great job with this version. I'm totally happy with it. Thanks guys.