2012
07.24

Today I’ve searched through MySQL slow query log, and found some intresting log entries, like this:

1
2
3
4
5
6
# Time: 120724 12:10:12
# User@Host: user[db] @ localhost []
# Query_time: 1.539405  Lock_time: 0.000140 Rows_sent: 1  Rows_examined: 15162
use db;
SET timestamp=1343124612;
SELECT p.* FROM wp_posts AS p  WHERE p.post_date < '2012-07-06 17:42:00' AND p.post_type = 'post' AND p.post_status = 'publish'  ORDER BY p.post_date DESC LIMIT 1;

So this one tiny query took 1.5 seconds? What is this? It is essential for my site?

Read More >>

2012
07.15

I just copy&paste a piece of raw code, just for myself, to find it easily.

So I’m using this method to track method calling order in applications/frameworks.

I add this to my code.

1
2
3
4
5
6
7
8
9
   function trackCode($e)
   {
       echo "<b>MSG:</b> " , $e->getMessage();

       echo "<pre>";
       print_r( $e->__toString() );
       echo "</pre>";
   }
   set_exception_handler('trackCode');

And add this to my mighty function, to know where are we:

1
throw new Exception('Here is my code point');
2012
07.03

About 2 years ago I’ve created an autoblog network for the company I work for.
At that time I’ve figured out, that it would be freakin’ nice if we just extend the RSS feed with the first image from the post’s attachments.

Here I’ll publish a simplified version of my original code, thus there were many customizations in that, what a normal user wouldn’t need.

I left there only one thing, which is the width management.

Read More >>

2012
06.26

I’m wondering since ages why doesn’t WordPress support custom port number.
For a while I’m using my own method to avoid this limitation, but finally I created a patch, and submitted to the WordPress core trac here: #21077.

Read More >>

2012
05.18

This week we had some extra time, and we have to choose a technical area which we want to dig deeper. I’ve chosen MongoDB, which is a pretty widely used but new NOSQL solution.

First I wanted to install on my US based VPS, but it would need to upgrade/reinstall my whole system, because the latest versions needed the latest gcc 4.6 and libc6 upgrade, and spidermonkey, PCRE, and blah-blah…

Read More >>

2012
05.17

Now, I’m migrating a site for a popular radio station, to WordPress from Drupal and PunBB.

The biggest challenge for me was to create the site structure. We made the main site, to site.com, then the forum to forum.site.com and after that we ended up with blogs at blog.site.com/user/. If you want create this structure with WordPress, it needs some tricks.

Read More >>

2012
02.15

Today let’s see an interesting challenge around WordPress search URL.
Interesting, because rewrite rules, as part of regular expression knowledge is kind of a woodoo.
So I’ll prove, that you won’t need pins and a doll to customize WordPress search permalink structure.

There are plenty of ways to modify the search base url, I hope I show you the less painful way.

By default I pretend you are using some fancy permalink structure, unless this article will be totally useless.

If you use permalink structure /search/myterm way works fine, but by default search form won’t end up there.
That’s the first thing that we are going to handle.

Read More >>

2012
02.04

Recently I created a Facebook tab for a project.
As you might know it works in a funny way, they proxy the tab contents, so your visitors will never see the content from your server, but facebook page proxy will do it.

Here comes the big problem.

Read More >>

2012
01.26

It took a couple of hours to finally end up with the conclusion, that
ORDER BY statements does not work in MySQL subquery.

2012
01.10

Today I realized theres a pretty simple way, to generate JSON straight from MySQL.

I use it this way:

1
SELECT CONCAT('[',GROUP_CONCAT(CONCAT('{name:',USER.name,''),CONCAT(',email:',USER.email,'}')),']') FROM USER WHERE STATUS = 'active' ORDER BY created ASC