Selenium downloads: http://seleniumhq.org/download/
Selenium with Java: http://seleniumhq.org/docs/appendix_installing_java_driver_client.html
Groovy: http://groovy.codehaus.org/Tutorial+1+-+Getting+started
Extract selenium-remote-control
Copy selenium-server.jar and selenium-java-client-driver.jar into groovy/lib
Start Selenium server: java -jar selenium-server.jar
Start groovyconsole
Open selenium script
Run with Ctrl+R
Snippets and thoughts from a passionate software developer interested in all things DevOps, Continuous Delivery, Functional Programming, Distributed Systems. Also on Twitter as @mcallana.
Sunday, January 30, 2011
Tuesday, January 25, 2011
How to ssh/scp/sudo without being prompted for password
As source user run:
ssh-keygen -t rsa
This will geenerate ~/..sh/id_rsa.pub
Copy ~/.ssh/id_rsa.pub to target machine e.g. /tmp/tmpkey
As target user run:
cat /tmp/tmpkey >> ~/.ssh/authorized_keys
Ensure correct permissions
ssh-keygen -t rsa
This will geenerate ~/..sh/id_rsa.pub
Copy ~/.ssh/id_rsa.pub to target machine e.g. /tmp/tmpkey
As target user run:
cat /tmp/tmpkey >> ~/.ssh/authorized_keys
Ensure correct permissions
chmod go-w $HOME $HOME/.ssh $HOME/.ssh/authorized_keys
Should a method that can be static be static?
http://stackoverflow.com/questions/731763/should-c-methods-that-can-be-static-be-static/731779
It depends. There are really 2 types of static methods:
- Methods that are static because they CAN be
- Methods that are static because they HAVE to be
In a small to medium size code base you can really treat the two methods interchangeably.
If you have a method that is in the first category (can-be-static), and you need to change it to access class state, it's relatively straight forward to figure out if it's possible to turn the static method into a instance method.
In a large code base, however, the sheer number of call sites might make searching to see if it's possible to convert a static method to a non static one too costly. Many times people will see the number of calls, and say "ok... I better not change this method, but instead create a new one that does what I need".
That can result in either:
- A lot of code duplication
- An explosion in the number of method arguments
Both of those things are bad.
So, my advice would be that if you have a code base over 200K LOC, that I would only make methods static if they are must-be-static methods.
The refactoring from non-static to static is relatively easy (just add a keyword), so if you want to make a can-be-static into an actual static later (when you need it's functionality outside of an instance) then you can. However, the inverse refactoring, turning a can-be-static into a instance method is MUCH more expensive.
With large code bases it's better to error on the side of ease of extension, rather than on the side of idealogical purity.
So, for big projects don't make things static unless you need them to be. For small projects, just do what ever you like best.
Sunday, January 23, 2011
Find deleted file in SVN
svn log -v > svnlog.txt
Then find filename in svnlog.txt
http://stackoverflow.com/questions/401331/examining-history-of-deleted-file
Then find filename in svnlog.txt
http://stackoverflow.com/questions/401331/examining-history-of-deleted-file
Monday, January 17, 2011
Saturday, January 15, 2011
Design principles
GRASP
SOLID
http://www.codinghorror.com/blog/2009/02/the-ferengi-programmer.html
SOLID
S | SRP |
|
---|---|---|
O | OCP |
|
L | LSP |
|
I | ISP |
|
D | DIP |
|
http://www.codinghorror.com/blog/2009/02/the-ferengi-programmer.html
- SINGLE RESPONSIBILITY - DON'T MAKE A BIG BALL OF MUD.
- OPEN CLOSED - DON'T MAKE A THING THAT CAN BE INADVERTANTLY TROUNCED BY ANOTHER THING.
- LISKOV SUBSTITUTION - WHEN POSSIBLE MAKE THINGS MODULARLY SO YOU CAN CHANGE LESS LATER.
- INTERFACE SEGRATION - DON'T MAKE A CLIENT DEPEND ON INTERFACES THEY DON'T NEED.
- DEPENDENCY INVERSION - DON'T MAKE SOMETHING CONCRETELY DEPENDENT ON SOMETHING ELSE, RELY ON ABSTRACTIONS
Wednesday, January 5, 2011
Maven Clover Coverage
mvn clean clover2:instrument clover2:clover clover2:check
Checkstyle:
checkstyle:checkstyle
Checkstyle:
checkstyle:checkstyle
Subscribe to:
Posts (Atom)