Archive for the 'PHP' Category

Safari, AJAX and "broken" encodings

Thursday, June 15th, 2006

Some lessons are learned the hard way.
I was doing another AJAX based system today, and faced a problem where the Ajax.Updater updated text was shown correctly in every single browser except for Safari.
Like I wrote in one of my previous posts, one should check if the output to browser from a script is sent in UTF-8, because this is the encoding AJAX supports. So, in my case with Japanese-language web-sites, I have ordinary pages encodings set to ShiftJIS. So, when I output text which is supposed to be used to replace web-page contents using Prorotype's Ajax.Update call, I convert it from ShiftJIS to UTF-8 before outputting as the result of AJAX call.
(more…)

System testing

Thursday, June 15th, 2006

Some systems need some extensive testing to be done :) Here's how you test when you have too much time on your hands ;)


hello :)

hello2.gif

ROR-style Flash alerts in PHP

Monday, June 12th, 2006

Although I didn't get to use Ruby on Rails in my job due to various factors I had to consider, I took some interesting concepts for the framework, namely the ROR-style flash alerts. These alerts are stored in cookies and are transferred between pages even on redirects. Pretty cool idea, so I wrote a replicate for this functionality in PHP.

Demo and the source code can be viewed here

Have fun :)

Placeholders

Wednesday, June 7th, 2006

Sometimes when you code the whole bloody day some relaxation is in order, even though it's just adding some silly content to a placeholder ;)

preved.jpg

AJAX and Japanese. Check your encodings.

Friday, May 26th, 2006

I'm starting to use AJAX more in more in CMS I develop. And that exactly what I was doing today. Had to "optimize" some site for speed. I have created the CMS for the site, using AJAX in parts, but was a little bit too lazy to add AJAX everywhere. So the pages we loading.. well.. fast, but not fast for the client, so I was told to make some optimizations.
(more…)

New Zend Studio

Tuesday, January 17th, 2006

page0_blog_entry6_1.gifNew version of Zend Studio 5.1 was released today. Nothing really special actually except for support for PHP 5.1 (still don't use 5.x only features in production systems but books on the new version is on their way to me from amazon.com). Also, they FINALLY fixed the bloody bug when the program didn't remember default text encoding in prefs, reverting from Shift-JIS to the default encoding. What a relief.
I don't really have PHP systems to develop right away (stuck with FileMaker-based accounting system for some rice processing factory), but I'm eager to give the new version a full-fledged try.

PHP upgrade

Tuesday, December 6th, 2005

I have upgraded PHP to version 5.x on one of our company's main servers. The reason was that well.. pretty stupid. I'm currently working on a project for some direct mailing, and all the processing is performed by a script residing on a server, and fed with the input of procmail. Once the script receives a text of an email it parses it and well.. either adds sender of the mail to the list or removes it from the list.

The script is called by means of Unix shell scripts, so I had this thing:
!#/usr/bin/php

which turned out to be the wrong version of php, not the one I compiled myself, so some of functions I needed just were "undefined". It tooks some time to figure out that the path was wrong, and during that time I made that 4>5 upgrade only to find out that mb_* functions still are not defined, and then _finally_ I have decided to check the path of PHP executable :) And but of course it turned out to be wrong, and the right one was:

#!/usr/local/bin/php


The upgrade was painless. Although I had to upgrade my libXML installation, and also set the path to mySQL headers (for PHP 4.x setting --with-mysql was enough, but that's not the case for version 5). This type of install is for shared module PHP, though.

installing libXML

ftp://ftp.gnome.org/mirror/gnome.org/sources/libxml2/2.6/libxml2-2.6.22.tar.gz
tar zxvf libxml2-2.6.22.tar.gz
cd libxml2-2.6.22
make
sudo make install

now to the PHP

wget http://jp.php.net/distributions/php-5.1.1.tar.bz2
bunzip2 php-5.1.1.tar.bz2
tar xvf php-5.1.1.tar
cd php-5.1.1
./configure –with-mysql=/usr/local/mysql –with-apxs=/usr/local/apache/bin/apxs –enable-ftp –enable-mbstring=ja
make
sudo make install

It would be a good idea to disable old php4 modules in apache (/usr/local/apache/conf/httpd.conf) I guess.

Then just restart apache and voila! Everything works now, so I'm a happy camper, and a good thing is that upgrade didn't break any of my scripts, which is the only thing I worried about.