Notes on Java, Solaris, PHP, LDAP…

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
Tags:

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
http://demeter.uni-regensburg.de/SLES10-SDK-x86/suse/i586/ 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
Tags:

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
Tags:

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
Tags:

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:
Host happycvs.happycompany.com
User peterk

And suddenly SSH connected fine!

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’ )

June 17, 2008

Google Toolbar works in Firefox 3!

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

Yey. When I started Firefox 3rc3 today, it updated its Google Toolbar that before worked only in Firefox 2. And now it works in Firefox 3. Sweet.

June 13, 2008

How to configure PHP settings in .htaccess

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

When I need to configure PHP settings in .htaccess, I need ‘AllowOverride All’ line in Apache config. Then I can add something like following to .htaccess:

# 6143 is value of E_ALL
php_value error_reporting 6143

Read-only dump of MySQL

Filed under: Java — negev @ 7:52 pm
Tags:

Sometimes I need to dump MySQL data from servers where I have read-only access. When I run standard mysqldump, then it fails because it tries to lock the tables. Here’s how to dump without locking:

/usr/local/mysql/bin/mysqldump -u my-user -h my-server -p -O lock-tables=FALSE db-name >db-dump.sql

Next Page »

Blog at WordPress.com.