Notes on Java, Solaris, PHP, LDAP…

August 21, 2008

Weird Flex states

Filed under: Java — negev @ 6:06 pm

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.

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

Searching for RPM packages?

Filed under: Java — negev @ 1:09 pm

Searching for RPM packages? Just type package name at and it lists them by Linux distributions.

July 17, 2008

Never call your HTML elements ‘content’

Filed under: Java — negev @ 11:25 am

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

Virtual hosts on SUSE

Filed under: Java — negev @ 7:45 pm
Tags: ,

When enabling the second vhosts in Apache2 <virtualHost *:80> on a SUSE server, apache restart gave me the following error:

“_default_ VirtualHost overlap on port 80, the first has precedence”

Solution: in /etc/apache2/listen.conf add or uncomment following line:
NameVirtualHost *:80

June 20, 2008

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

Filed under: Java — negev @ 6:54 pm

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

Notes on Capistrano

Filed under: Java — negev @ 6:53 pm
Tags: ,

How to use capistrano to invoke a command remotely:
cap -f deploy.rb  invoke COMMAND=ls

Since Capistrano 2 it kind of required ‘Capfile’ in the folder where I run capistrano. deploy.rb can be under ‘deploy’ folder but not in the same folder as Capfile. Capfile then contains:
load ‘deploy’ if respond_to?(:namespace) # cap2 differentiator
load ‘deploy/deploy’

How to make capistrano deploy a chosen revision (thanks to Jamis Buck):
cap -S revision=1234 deploy

Capistrano on Suse SLES 10: Latest version of Ruby for SLES 10 is version 1.8.4 – from But the newest capistrano (2.4.0) doesn’t deploy correctly in ruby 1.8.4 – it deploys older revision (24) from Subversion rather the newest revision (HEAD).

Getting current versions of a gem package

Filed under: Java — negev @ 5:47 pm

To get a list of available packages of a chosen gem (package for ruby language), use:

gem list -r package-name

Concatenating strings and variables in shell

Filed under: Java — negev @ 5:44 pm

I had a variable and I wanted to concatenate its value with a string – in a Unix shell script (run by sh or bash). It turns out that quotation marks work well. Apostrophes don’t work all the time. An example:

echo Go “$HOME” — “$HOME”

Private/public SSH keys between different logins (usernames)

Filed under: Java — negev @ 5:40 pm

Today I’ve set up a private and public SSH key on one server, and I copied the public key to our CVS server. However, my login names were different on those machines, and the keys didn’t help.

Then my colleague advised to create a file under ~/.ssh called config, with an entry like this:
User peterk

And suddenly SSH connected fine!

« Previous PageNext Page »

Blog at