Thursday, April 28, 2011

Testing framework - Chinese blog

http://www.51testing.com/?uid-13997-action-viewspace-itemid-87389

Ant copydir -> copy

copydir is deprecated


                <copydir src="${emma.out.dir}" dest="${basedir}" forceoverwrite="true"/>

use copy 

                <copy todir="${basedir}/report" force="true">
                    <fileset dir="${emma.out.dir}"/>
                </copy>


EMMA: RPC failure while executing

when run get coverage task


Exception in thread "main" com.vladium.emma.EMMARuntimeException: coverage.get:
RPC failure while executing [coverage.get]
at com.vladium.emma.ctl.CtlProcessor._run(CtlProcessor.java:242)
at com.vladium.emma.Processor.run(Processor.java:88)
at com.vladium.emma.ctl.ctlCommand.run(ctlCommand.java:151)
at emma.main(emma.java:50)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)



- Check if there are duplicated emma jars in the system 
- Could be caused by there's no yet any run against the server, hence there's no coverage.ec generated on the server port 
- Check if the gen/metadata.emma is the latest, i.e. if it is the result of instrumentation of the current code on the Server 

Monday, April 25, 2011

bypass proxy

export the proxy env first:

export http_proxy=http://webproxy:3128

redhat

e.g.
wget http://ant.apache.org/bindownload.cgi/apache-ant-1.8.2-bin.tar.gz

NOTE: wget usually give header problem to .tar.gz files

ubuntu:


gem (—http-proxy root:balmor@webproxy:3128) install rails --debug

Wednesday, April 20, 2011

ssh without password

How to do it (NOTE: sometimes it uses 'dsa' instead of 'rsa')

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh
b@B's password: 
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password: 
From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B hostname
B

Thursday, April 7, 2011

Spreadsheet sum with condition of value of a column

I want a spreadsheet function that will produce a sum of all values in column B for when column A is equal to 'X' and when it is equal to 'Y'
A     B

X    10
Y     3
X     7
X    22
Y     4
Y     9
The output should look like the following (where 39 & 16 are the results of the formulas):
X    39           -> 10 + 7 + 22
Y    16           -> 3 + 4 + 9


Symphony , Excel as well?

X   10
Y   3
X   7
X   22
Y   4
Y   9

X   "=SUMIF(A1:A6;A8;B1:B6)"
Y   "=SUMIF(A1:A6;A9;B1:B6)"

Sunday, April 3, 2011

Array to list and vice versa

Convert an array to a list.

List<Date> listOfDates = Arrays.asList(arrayOfDates);


On the fly list construction:

List<Date> listOfDates = Arrays.asList(new Date[]{date1, date2});


Convert a list into an array:

Date[] arrayOfDates = listOfDates.toArray(new Date[]{});
-------------------------
Date[] arrayOfDates = listOfDates.toArray(new Date[0]);