Sometimes when you’re face-to-face with iPhone memory management, you can run into troubles…
Read the rest of this entry »


MySQL over SSH tunnel

Posted: October 19, 2010 in MySQL, Shell scripting
Tags: , , , ,

Sometimes we face a problem when we have SSH access to the server, but not to MySQL.
Here is a simple workaround – SSH tunnel:


This command allows you to map remote port to the local one via SSH tunnel.

  • LOCAL_PORT – local port to map to
  • USER – SSH username
  • HOST – remote host

Surely, you can map other ports as well.

When you mapped the port, you can connect to MySQL using your favorite client (you need to specify LOCAL_PORT as MySQL server port in connection settings).

Many tasks require some application part to run in one instance per time, such as mail delivery cron job. And each time developers should invent some mechanism to determine if another copy is running. Usually no of these mechanisms are 100% reliable.
The solution is already found by MySQL development team. It is “named locks”.
Application can try to acquire a named lock on its start and check if another copy is running.
Read the rest of this entry »

DOMDocument class behaves strange sometimes. It could omit some entities like “ and some valid UTF-8 characters (it also may do so for other encodings). This probably could be fixed by using own DTD, but there is a simple way too. Each HTML entity has its binary code, so DOMDocument will export your entities correctly if you replace the entities with the appropriate codes. I have a small list of them.
Read the rest of this entry »

I faced a problem with one of my projects some time ago. Deep debug helped to understand that the issue is not in the code, but in PHP core.

PHP 5.2.5 has a problem with array_merge_recursive function. It was eliminating NULL values. I even found a bug filed in PHP bugtracker.

It’s just the interesting fact, so be careful 😉