Thursday, 8 March 2012
Download the latest snapshot from nexus using wget
To get the latest version of snapshot you can use a service available from Nexus as
wget -O my-services.war http://nexus.myorg.net/nexus/service/local/artifact/maven/redirect?r=snapshots\&g=my.company.product.services\&a=my-services\&v=1.0-SNAPSHOT\&p=war
Where
r is the id of the repository
g is the group id
a is the artifact id
v is the version of artifact
p is the packaging type
The argument -O helps in renaming the output file to the name you want so that you have a fixed name you can use in your shell script.
Wednesday, 28 September 2011
Tomcat remote debugging from eclipse
DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
From your eclipse, create a Run Configuration for 'Remote Java Application' on socket 8000 and restart tomcat.
Wednesday, 7 September 2011
Auto scan hibernate entity beans like component-scan for general spring components
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="resourcesDataSource" />
<property name="packagesToScan">
<list>
<value>my.packages.hibernate.domain</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
Tuesday, 23 August 2011
Tomcat 6– Enable httpOnly and secure for jesssionid cookie
According to the release notes at http://tomcat.apache.org/tomcat-6.0-doc/changelog.html this looks to be implemented only from 6.0.33. Update your tomcat version before you try this configuration change.
Modify your context.xml under tomcat/conf directory by including this extra tag.
<Context><Manager useHttpOnly="true" />
…
</Context>
To make cookie secure, add the attribute secure="true" to the <Connector definition in server.xml
Friday, 19 August 2011
GWT/SmartGWT– Window popups with widgets
Recently I was implementing help infrastructure for our application. I wanted to have a help window open as a real popup and not a div popup that can hold smartgwt widgets to show help info.
There was no direct support for this in gwt or smartgwt however this can be achieved with a small hack.
Open a popup window by using the following JSNI script. This opens a new window popup with your own parameters and return the document from JSNI method. This gives you handle to popup’s document element.
private static native Document createWindowPopup() /*-{
var win = window.open("", "win", "width=500,height=300,status=1,resizeable=1,scrollbars=1"); // a window object
win.document.open("text/html", "replace");
win.focus();
return win.document;
}-*/;
If you have handle to this document object you can simply add any widget to this document by
document.appendChild(myWidget.getElement());
Dont forget to close the document after writing to it.
private static native void closeDocument(Document document) /*-{
document.close();
}-*/;
Thursday, 18 August 2011
Smart GWT– Canvas hiding other elements underneath it
Recently when I used Canvas to hold a popup positioned somewhere in the middle, the Canvas was starting from the top left corner of the screen and hiding other elements underneath it. It was really difficult to find how I can position Canvas so that it occupies just the widgets space and not any extra space.
This can be achieved using Canvas.setRect(left, top, width, height);
Friday, 12 August 2011
SmartGwt: Absolute position your widget with setSnapTo
If you like to absolute position your widget in smartgwt use setSnapTo
Usage:
widget.setSnapTo(“TL”);
widget.setSnapOffsetLeft(400);
widget.setSnapOffsetTop(200);
If you like to reset this behaviour, use setSnapTo(null) that will reset to its original state. This is particularly useful if you like to popoup one of your widgets and position them absolutely and reset back again