Notes on Java, Solaris, PHP, LDAP…

July 20, 2009

Error blackhole in Adobe Flex or SWF player

Filed under: Uncategorized — negev @ 1:34 pm
Tags:

So you have an Adobe Flex application that uses GUI states. You get back to it after a longer period, and you need to fine-tune details. You need to set initial properties of some GUI controls for some situations. You already had an initialization function, so you just do it there. Then you run it, and the code just stops where you changed it. No error and no execution. You try the debug SWF player, same thing.

That’s when you access a GUI control, which wasn’t created yet. It happens if your control is added in a GUI state, but the component didn’t enter that state yet. Like if in the following you want to set contactMe.selected before you switch your component to “extendedForm“.

<mx:states>
<mx:State name=”extendedForm”>
<mx:AddChild position=”lastChild”>
<mx:CheckBox id=”contactMe” x=”10″ y=”216″ label=”Would you like us to contact you about our new products? Maximum 4 times a year.” />
</mx:AddChild>
</mx:State>
</mx:states>

Adobe Flex or SWF player should really report this as a null exception or some other meaningful error.

I reported it at Flex bugs site.

June 1, 2009

Using standard error output (stderr) in PHP

Filed under: Uncategorized — negev @ 10:51 am
Tags:
$STDERR= fopen("php://stderr","w");

February 12, 2009

Xdebug and NetBeans for PHP on Mac OS X

Filed under: Uncategorized — negev @ 1:08 pm
Tags:

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

Filed under: Uncategorized — negev @ 1:55 pm
Tags:

When talking to to DokuWiki community, I’ve noticed that they use Darcs – http://darcs.net

December 19, 2008

DokuWiki fix

Filed under: Uncategorized — negev @ 6:39 pm
Tags: , ,

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

Filed under: Java — negev @ 1:04 pm
Tags: , ,

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

Filed under: Java — negev @ 5:05 pm
Tags:

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

Filed under: Java — negev @ 11:28 am
Tags:

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

Filed under: Java — negev @ 10:58 am
Tags: ,

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

Filed under: Java — negev @ 8:42 am
Tags: ,

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!

Next Page »

Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.