zwwcn

Just another WordPress.com site

Monthly Archives: September 2011

Upgrade to Selenium2

1 click a button  in picklist:

By default, define a webelement will perform click operation.
here we need to get focus for the current browser, then click the button.
getDriver().findElement(By.id(id)).findElement(By.xpath(“..”)).click();
WebElement selectElement = getDriver().findElement(By.id(id));

------------------------------ 

enable Jboss server for other computer to access

Interfaces JBoss Application Server binds to

 

Up to JBoss AS 4.2 the server (HTTP and all services) bound to 0.0.0.0, meaning to all interfaces on the system. Since too many people have not secured internet facing systems this behaviour has been changed since JBoss AS 4.2.0. The Application Server now only binds to 127.0.0.1 by default. You can use the -b parameter with run.sh/run.bat to either bind to the desired IP or 0.0.0.0 if you want the pre 4.2 behaviour back. Make sure you went through the security guideline point by point since there are at least 5+ ways an unsecured JBoss AS instance can be taken over.

 

If bound to 0.0.0.0 clients will receive the hostname to connect to RMI. In this case you can set ‘java.rmi.server.hostname=’ to send an IP or different hostname to the client.

MYSQL procedure

DELIMITER //
CREATE PROCEDURE deletePrepaymentWithoutPaymentItems(IN p_invoice_id INT(20))
BEGIN
DELETE FROM OP_LEAD_STATUS_XREF WHERE INVOICE_ID =p_invoice_id;

DROP table if exists TMP_INV_CONTACT;

CREATE TABLE TMP_INV_CONTACT as SELECT * FROM OP_INVCONTACTTYPE WHERE INVOICE_ID=p_invoice_id;

DELETE FROM OP_INVCONTACTTYPE WHERE INVOICE_ID=p_invoice_id;

DELETE FROM OP_INVCONTACT WHERE OBJECT_ID IN (SELECT INVCONTACT_ID FROM  TMP_INV_CONTACT);

DROP table if exists TMP_INV_ADDRESS;

CREATE TABLE TMP_INV_ADDRESS as SELECT * FROM OP_INVADDRESSTYPE WHERE INVOICE_ID=p_invoice_id;

DELETE FROM OP_INVADDRESSTYPE WHERE INVOICE_ID=p_invoice_id;

DELETE FROM OP_INVADDRESS WHERE OBJECT_ID IN (SELECT INVADDRESS_ID FROM TMP_INV_ADDRESS);

DELETE FROM OP_INVOICE WHERE OBJECT_ID =p_invoice_id;

END //
DELIMITER ;

——————————–

call deletePrepaymentWithoutPaymentItems(3984571);

———————————

DROP PROCEDURE IF EXISTS `deletePrepaymentWithoutPaymentItems`;

 

 

cvs list changes between two tags

C:\Documents and Settings\XP>cvs -d :pserver:tony@192.168.10.15:/var/cvs rdiff
s -r ear20110831 -r ear20110830 1place2

delete files older than 30 dates

Delete files which have last modified date older than 30 dates:

 

find /dir/where/shows/are/ -mtime +30 -exec rm {} \;

Selenium1

table clickLinkInCell : id is the id for the link

mytempaltesPage.contentTemplatesTable.clickLinkInCell(inactiveEmailrow, “titleLink”, EditContentTemplatePage.class);

 

getCellText: id is the id for the collumn

contentTemplatesTable.getCellText(rowIndex, “title”);

 

 

win7 robocopy

win7 only show one external hd even you connect two:

open disk management in win7, you will find a list of all connected hd . one of them will be offline, right click it and change it to “online”.

win7 schedule task doesn’t run batch script:

change it to only run when the current user is logon

 

value of context variable is not an instance of the component bound to the context variable

Sometimes this is caused by a hot deploy problem and can be rectified by doing a clean redeploy/restart. Other times it may indicate that you have a Seam component name (@Name annotation) the same as a variable name. Check your code carefully to see if your context variable is not already in use as a Seam component name. If it is, change one of them.
Check Factory and Seam Component

 

 

ref: http://jeremygoodell.com/2009/03/26/value-of-context-variable-is-not-an-instance-of-the-component-bound-to-the-context-variable.aspx

Hibernate JPA polymorpic queries and instanceof

instanceof doesn’t work properly in polymorphic queries,can’t cast to subtype

another solution I found is call “Hiberante.initialize()” before the casting

if(someobj  instanceof HibernateProxy){
HibernateProxy proxy = (HibernateProxy)someobj;
currentAgency = (Agency)proxy.writeReplace();
}