$STDERR= fopen("php://stderr","w");
June 1, 2009
February 12, 2009
Xdebug and NetBeans for PHP on Mac OS X
I really used to like JEdit. It understands almost every shell/programming/database language and it colors source code accordingly. You can have 100+ files open, switch quickly between them and you can split the editor horizontally and vertically as you need.
But somehow JEdit on Mac OS didn’t like scrolling wheel recently – it jumped up and down, skipping many pages. So I’ve tried NetBeans 6.5. with PHP support. It looks beautiful. If you get PHP-only version of NetBeans rather than full version, it loads up quickly too.
While using NetBeans, I’ve noticed it can debug PHP via Xdebug. So I’ve installed Xdebug 2.0.4 on my Mac OS from sources – seemed easy. In Apache error log it just read: Failed loading /path/to/xdebug.so (null). But it didn’t load up in PHP. Then I’ve tried MacPorts Xdebug package, but still the same.
After I’ve tried several ways to resolve this, I’ve come across a solution at http://patrickgibson.com/news/andsuch/000198.php
Debugging PHP in NetBeans rocks! You can see variables, arrays, objects, set up breakpoints…. lovely!
December 22, 2008
Darcs – source code management
When talking to to DokuWiki community, I’ve noticed that they use Darcs – http://darcs.net
December 19, 2008
DokuWiki fix
Some time ago I’ve customized DokuWiki for our purposes – extra integration with LDAP and Novell iChain, and making it all nicer. Today I’ve fixed two bad errors that appeared when I was updating it to version 2008-05-05.
DokuWiki is perfect for users and it has many plugins. But if you want to customize or fix anything in it, then you’ll find that it is really disorganised inside.
December 10, 2008
Single sign-on and guest access to Adobe Connect
I’ve made our Adobe Connect service single sign-on for our employees and nicely work for our guests – all behind Novell iChain accelerator. It was a pain in the neck to make them work together. A lot of weird HTTP header and URI issues. Even though Adobe Connect offers a nice API to manage meetings, log in users and guests, it’s really proxy-unfriendly.
Some of my troubles and the solution are at http://www.connectusers.com/forums/cucbb/viewtopic.php?id=1496
November 13, 2008
Transparent images for IE 6
Heh. It turns out that Microsoft Internet Explorer 6 doesn’t like transparent PNGs. When you use them, the IE ignores their transparency. So I use transparent GIFs instead.
September 11, 2008
Generating Unicode email via mailto: link in Javascript
I wanted to generate mailto: link with a subject and body which contained Unicode characters. As an example for Unicode letters I was getting following from a PHP form. The application workflow required that I process any transformation in Javascript rather than on server.
%uB9E4%uB274%uC5BC
That stands for nice Korean 매뉴얼:
javascript:alert( unescape(’%uB9E4%uB274%uC5BC’) )
which in HTML Unicode escapes is (following without spaces, otherwise WordPress shows them as Korean letters):
& #xB9E4;& #xB274;& #xC5BC;
javascript:alert( ‘%EB%A7%A4%EB%89%B4%EC%96%BC’ )
-> same Korean letters
javascript:alert( escape(’%EB%A7%A4%EB%89%B4%EC%96%BC’ ) )
-> %uB9E4%uB274%uC5BC
javascript:alert( encodeURI(’매뉴얼’ ) )
-> %EB%A7%A4%EB%89%B4%EC%96%BC
So my final transformation was:
var encodedSubject= encodeURI( unescape( ‘%uB9E4%uB274%uC5BC’) );
var encodedBody= encodeURI( unescape( ‘%uB9E4%uB274%uC5BC Lala lala’) );
javascript:window.location.href= ‘mailto:?subject=’ +encodedSubject;+ ‘&body=’ +encodedBody;
————————————————————–
I’ve also tried following to generate HTML escapes of Unicode characters, but it doesn’t work for URLs:
function url_encoded_unicode_to_html( url ) {
var regex_search= new RegExp( “%u([0-9a-fA-F]{4,4})”, “g” );
var regex_replace= ‘&#x$1;’;
return url.replace( regex_search, regex_replace ); //( ‘/%u([0-9a-fA-F]{4,4})/’, ‘&#x$1;’, $text );
}
Unicode emails via PHPMailer
My web app has a form and then it sends emails via PHPMailer. But it didn’t work for Unicode messages.
I added accept-charset=”utf-8″ to the <form> tag. Then I changed $CharSet setting from default ‘iso-8859-1′ to ‘utf-8′. That worked for Unicode email body, but not for Unicode subject. In order to get Unicode subjects work I had to update PHPMailer to version 2.0.2.
var $CharSet = ‘utf-8′; //’iso-8859-1′;
var $ContentType = ‘text/plain’;
var $Encoding = ‘8bit’;
August 22, 2008
Limitation of CN length in eDirectory
Novell’s eDirectory has limitation of CN length to 64 characters. That is enough for common objects.
However, in my application I auto-generated CN out of some long string. I wanted management groups for user containers of a deep tree (5 levels e.g. ou=Happy Branch,ou=Berline,ou=DE,ou=Europe,o=Company). For some practical and user’s reasons I didn’t want to copy the container tree structure, so I created objects at the same level with CN made out in reverse – e.g. Europe-DE-Berlin-Happy Branch. But for some groups their CN got over 64 letters, and that failed. So I created region containers for them and then I created the groups under those region containers, with CN e.g. DE-Berlin-Happy Branch. Problem solved!
August 21, 2008
Weird Flex states
I had a weird experience with Flex states in Flex 2.0.1. My component had an initialization function. That set currentState to one of two values depending on something. Later on in the same function it checked for a few rare situations, and if any of those occurred then it set currentState to some special values.
Somehow Flex or Flash player didn’t like that and it rendered the 2nd (special/rare) state on top of the 1st state. Solution: instead of setting currentState directly, set some temp variable e.g. state:String. Then once state doesn’t change assign it to currentState. Note that you can’t use any GUI objects specific to that state before you switch to it.