Notes on Java, Solaris, PHP, LDAP…

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 20, 2008

File upload problems in Safari

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

I had a weird problem: a simple HTML form with a file upload input, processed by PHP. It worked in Firefox but in Safari the uploaded file (small size) didn’t make it to the server about half the times. Not even a first line of PHP was invoked.

It’s a known issue. Solution – an extra header. See http://www.webmasterworld.com/macintosh_webmaster/3300569.htm

July 17, 2008

Never call your HTML elements ‘content’

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

I’ve created a simple HTML form with basic Javascript validation of the fields. The form would send an email via the server, so it had a textarea which I called ‘content’ – both name=”content” and id=”content”.

However, it turns out that Javascript (Firefox, Safari) can’t retrieve such an element by document.getElementById( ‘content’ ).  It looks that ‘content’ is special/reserved. Once I changed it to ‘message’ then all worked fine.

June 20, 2008

How to get a Javascript element by id in JQuery/Prototype

Filed under: Java — negev @ 6:54 pm
Tags:

In JQquery/Prototype: $(‘#id-of-the-element’) is same as document.geleElementById(‘id-of-the-element’)

Getting all properties and custom attributes of a Javascript object

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

I’ve added a custom attribute to <TR> rows of a table and then my code searched over all rows through the values of this attribute. This is how to print all fields of an object:
var attrs= ”;
for( var attr in theObject ) {
attrs+= attr+’, ‘;
}
alert( attrs );
And to get value of a custom attribute (e.g. ‘custom_data’): row.getAttribute(  ‘custom_data’ )

November 17, 2007

Tiny MCE on Firefox, HTML/Ajax tools

Filed under: Uncategorized — negev @ 8:07 pm
Tags:

HTML/CSS/Ajax notes
Edward Ort mentions in his blog http://weblogs.java.net/blog/edort/archive/2007/03/
– HTML/Ajax tools:
Firebug
Cross check – open-source toolkit that has an emulation environment for every major browser
Web developer toolbar – it provides a variety of neat functions such as editing CSS in place and validating HTML

Use <span style=”float: left” > to have stuff on same line as other div (in this case the other div aligned to the right)

Customizing CSS in Tiny MCE editor on Firefox
– when using default ‘advanced’ theme, edit tiny_mce/themes/advanced/css/editor_content.css and then re-load it in Firefox. Otherwise Firefox caches old version of editor_content.css
– in order to change line spacing of paragraphs, set margin-top, margin-bottom properties. Do not set padding-top, padding-bottom – those work in Safari but not in Firefox 2.
http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=20422#p20422
– subsequent editing of a contents in Safari loses formatting
—- some debugging: http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=20463#p20463
when pressing enter in Tiny MCE, it starts a new paragraph with vertical space between the paragraphs. In order to make it a normal linespacing, set
— in /tiny_mce/themes/advanced/css/editor_content.css add

p {
margin-top: 0em;
margin-bottom: 0em;
}
and then anywhere when displaying the submitted text, render it within <span class=”tiny_mce_view” >…</span> and use

.tiny_mce_view p {
margin-top: 0em;
margin-bottom: 0em;
}
— However, after pressing Enter the current bold/italic… formatting gets lost.
— Rather than changing CSS, users can press Shift-Enter to enter a line break within the same paragraph – this preserves the formatting. However, in Safari 2.0.4 (419.3) on Mac OS X 10.4.8 or 10.4.9 it doesn’t start a new line until another character is presses – that character gets displayed on the new line.

Next Page »

Blog at WordPress.com.