The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20130221

how to install RHQ and create default rhq postgresql database

documentation:
https://docs.jboss.org/author/display/RHQ/Running+The+Installer
https://docs.jboss.org/author/display/RHQ/Running+the+RHQ+Server

install postgresql:
sudo apt-get install postgresql
sudo passwd postgres
sudo adduser rhqadmin
su - postgres
psql template1
create database rhq;
\q
psql rhq
create user rhqadmin with password 'mysecretpw';
grant all privileges on database rhq to rhqadmin;
\q
exit


fyi: how to log into the database:
su - rhqadmin
psql -d rhq -U rhqadmin


set RHQ_SERVER_JAVA_HOME in ~/.bashrc:
echo "export RHQ_SERVER_JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64" >> ~/.bashrc
source ~/.bashrc


generate encoded password value for <rhq-install-dir>/bin/rhq-server.properties > rhq.server.database.password (line 8):
cd ~/Downloads/rhq-server-4.5.1/bin
chmod +x generate-db-password.sh
./generate-db-password.sh --dbpassword=mysecretpw


// output
Encoded password: 5190c896b298c0f6d669b731438ce42e331761a902fa3908


paste this encoded value into <rhq-install-dir>/bin/rhq-server.properties > rhq.server.database.password (line 8)



NOTE: rhq-server.properties : DO NOT PUT rhq.autoinstall.enabled=true , leave it as "false"


start rhq server:
./rhq-server.sh start


open in web browser:
http://localhost:7080


click the link to continue installation

enter the clear-text db password (not the encoded one)

click "test connection"

click "install server"


login:
username: rhqadmin
password: rhqadmin


change the default password:
administration > users
click "rhqadmin"
change password
save

[SOLVED] RHQ install error: javax.servlet.ServletException: /start.jsp(245,12) '#{configurationBean.haServer.endpointAddress}' Target Unreachable, 'haServer' returned null

when i clicked "test connection" in the rhq web install interface: http://localhost:7080/installer/welcome.jsf

i got the following jsp error:
javax.servlet.ServletException: /start.jsp(245,12) '#{configurationBean.haServer.endpointAddress}' Target Unreachable, 'haServer' returned null

i found out that this was because i had set:
rhq.autoinstall.enabled=true

in <rhq-install-dir>/bin/rhq-server.properties

*use the default value instead*:
rhq.autoinstall.enabled=false

20130214

sahi - how to click a span inside a table and match table id using regex

i have an html page rendered by richfaces which made things a little problematic for my sahi script test:

* even though the rich:dataTable had a hardcoded id:
<rich:dataTable id="providerListTA" ...

when the page gets rendered by richfaces, the id looks like this in the rendered html code:
id="j_id1045:providerListTA:tb"

* the table is rendered inside a rich:modalPanel and contains a list of providers to select. inside that table there's a row with a link in the first column that i want to click on
Provider X

the problem is that behind the modalpanel there's a list of price agreements which also contains "Provider X", so the following code doesn't work:
_click(_span($transporter_name));

specifying the element number also doesn't work because it will change from user to user, depending on what's in the price agreement list:
_click(_span($transporter_name[11]));

so i read the sahi api documentation and found out how to use the DOM relation marker called "_in", together with a regexp that matched only the hardcoded id in the xhtml/jsf code, leaving out the richfaces-appended texts, i.e. "j_id1045:" and ":tb":

_click(_span($transporter_name, _in(_table(/.*providerListTA.*/))));

Provider X is passed into the sahi script method as $transporter_name and the regex part of the code is this:
/.*providerListTA.*/

which means to match an id containing providerListTA with any characters in front or behind it.