Toolbar buttons galore

Here’s a great time-saver extension. Toolbar Buttons is perfect for adding tough-to-find functions. They’re there BUT you have dig deep within Tools > Options to get to them. Need to quickly disable , and images with just three quick clicks? No problem, just drag and drop the buttons. Here is my current setup:

PHP to Javascript Project: php.js

A lot of people are familiar with ’s functions, and though functions are often quite similar, some functions may be missing or addressed differently. The implementations should be as compliant with the versions as possible, a good indication is that the function manual could also apply to the version.

http://kevin.vanzonneveld.net/techblog/

Installing Libmcrypt on a Godaddy Virtual Dedicated Server

We recently deployed a web site using ’s virtual dedicated server. Everything about the default installation was fine, except that was not available. When I asked the support staff “How do we enable for ?” their response was far from helpful:

Thank you for contacting Server Support. Unfortunately 3rd party installations and configurations are not supported.

Rather than argue with the support team about what constitutes a 3rd party installation, I decided to google around and see if I could do it myself. Hours later, I succeeded. Here are the steps for installing :

  1. su root
  2. yum install gcc-c++
  3. yum install lex
  4. yum install libxml2
  5. yum install libxml2-devel
  6. yum install flex
  7. wget http://downloads.sourceforge.net/mcrypt/-2.5.8.tar.gz?modtime=1171868460&big_mirror=0
  8. tar -xzvf -2.5.8.tar.gz
  9. cd -2.5.8
  10. ./configure
  11. make
  12. make install
  13. wget http://museum..net/php5/-5.1.6.tar.gz
  14. tar -xzvf -5.1.6.tar.gz
  15. cd -5.1.6
  16. ./configure –with-mcrypt=shared,/usr/local/lib
  17. make (after running ‘make’, DO NOT RUN ‘make install’)
  18. cp modules/mcrypt.so /usr/lib//modules/
  19. Add a file /etc/.d/mcrypt.ini
    ; Enable mcrypt extension module
    extension=mcrypt.so
  20. /usr/sbin/apachectl restart

That’s it! To confirm a successful install, just run phpinfo() and look for the mcrypt section

Wordpress 2.5 moderate comments bug

There’s a bug with 2.5 that doesn’t allow you to moderate comments. The problem is with the _wp_get_comment_list function and how it retrieves counts from the database specifically a missing column index. Running this line on your database should fix the problem:

ALTER TABLE wp_comments ADD INDEX ( comment_date_gmt );

Test drive higher quality YouTube videos (MP4)

Want to watch higher quality YouTube videos?

Add &fmt=18 to the last part of the URL. You won’t see DVD quality video but you’ll see a great difference from whats currently available.

Edit: Want to make it even easier? This GM script does it for you.

Setting locale to tr_TR (Turkish) lowercases class names

So I was working away at localizing some pages and for some reason they all worked except tr_TR. What was the problem? The server had an outdated installation with a bug that lowercases class names which ends a fatal error.

Why it it so? After some investigations I came across this bug and came to the conclusion that in the Turkish language, the latin i is not equal to capital latin i.

AWESOME!

JavaScript debugging on Safari for Windows

Just had to do this and thought I’d post it for anyone who might find it helpful. Here is how you enable the Debug menu if you’re running windows:

1. Navigate to the folder below (replace USERNAME with your user account).
C:\Documents and Settings\USERNAME\Application Data\Apple Computer\

2. open up Preferences.plist and add the following two lines anywhere before the line “</dict>”

<key>IncludeDebugMenu</key>
<true />

3. Restart and you should now have a Debug menu.

WTF!? preg_replace() returns null?

On one of our sites were were running into a problem when we tried to pass HTML content from a database through an email obfuscation function to prevent spiders from scraping our clients’ emails. We quickly discovered that some of the longer pages were showing up completely blank. The () function we were using to run the obfuscation code on email addresses was returning null. After some hunting I found the answer.

Read the rest of this entry »

ISO Week and Year in PHP and PostgreSQL

The new year always brings with it a few small things that go bump in the morning. 2008 was no different. Intervals started behaving oddly on New Year’s Eve morning — the default timesheet was a year behind schedule. What happened?

In our code, we are using the week number of year, as specified on the PHP date function page, but we weren’t using for the year. The week number specifies the last monday of a year as the first week of the new year, if that new year begins before thursday. Intervals thought it was the first year of 2007!

In , the fix was as easy as converting all instances of date(’Y') to date(’o'), according to php.net:

year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in 5.1.0)

That fixed everything on the side of things. But next we had to dig into the queries and get them to use the ISO Year.

Snag.

PostgreSQL 8.2.5 doesn’t support ISO Year in the Extract function. EXTRACT(ISOYEAR, timestamp) is being included in 8.3, as specified here in the RC1 documentation. But 8.3 hasn’t been released yet, and we needed to fix things immediately.

Our final fix was to instead use the TO_CHAR(timestamp, ‘IYYY’) function. It’s not ideal to be using a string formatting function for data comparisons, because it slows down some of the queries. But we had to trade some performance to get things working properly again in the new year. As soon as the PostgreSQL developers release a stable version of 8.3, we’ll change our queries back to using EXTRACT(ISOYEAR, timestamp).

Messenger bags

Check out these great messenger bags made from recycled materials, from Alchemy Goods:
http://alchemygoods.com/messenger.html