<aop:aspectj-autoproxy />
<bean id="timer" class="AopTimer" />
----------
@Aspect
public class AopTimer
{
private static final Logger logger = Logger.getLogger(AopTimer.class.getName());
public AopTimer()
{
logger.info("---------- instantiating ----------");
}
@Around("@annotation(com.helpdeskSos.aop.TimeIt)")
public Object time(ProceedingJoinPoint jp) throws Throwable
{
long start = new Date().getTime();
try
{
return jp.proceed();
}
finally
{
long end = new Date().getTime();
String method = jp.getTarget().getClass().getSimpleName() + "." + jp.getSignature().getName();
logger.info("ellapsed time in " + method + ": " + (end - start) + " (ms)");
}
}
}
----------
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface TimeIt
{
}
----------
@TimeIt
public void sendMail(Incident incident)
Thursday, 17 November 2011
Scroller following Focus
private function scrollToFocus(e:FocusEvent):void
{
if (!SCROLLER.verticalScrollBar.visible) return;
var focus:DisplayObject = e.currentTarget as DisplayObject;
var focusTop:Number = 0;
var focusAncester:DisplayObject = focus;
while(focusAncester != SCROLLER)
{
focusTop += focusAncester.y;
focusAncester = focusAncester.parent;
}
var focusBottom:Number = focusTop + focus.height;
var windowTop:Number = FIELDS.verticalScrollPosition;
var windowBottom:Number = windowTop + FIELDS.height;
// No scroll needed
if (windowTop <= focusTop && focusBottom < windowBottom) return;
// 10 pixels padding
FIELDS.verticalScrollPosition = focusTop - 10;
}
----------
<s:Scroller id="SCROLLER>
<s:VGroup id="FIELDS">
<s:Form id="FORM">
<s:FormItem width="100%" label="Nachname" required="true">
<s:TextInput id="NAME" width="50%" focusIn="scrollToFocus(event)"/>
</s:FormItem>
...
{
if (!SCROLLER.verticalScrollBar.visible) return;
var focus:DisplayObject = e.currentTarget as DisplayObject;
var focusTop:Number = 0;
var focusAncester:DisplayObject = focus;
while(focusAncester != SCROLLER)
{
focusTop += focusAncester.y;
focusAncester = focusAncester.parent;
}
var focusBottom:Number = focusTop + focus.height;
var windowTop:Number = FIELDS.verticalScrollPosition;
var windowBottom:Number = windowTop + FIELDS.height;
// No scroll needed
if (windowTop <= focusTop && focusBottom < windowBottom) return;
// 10 pixels padding
FIELDS.verticalScrollPosition = focusTop - 10;
}
----------
<s:Scroller id="SCROLLER>
<s:VGroup id="FIELDS">
<s:Form id="FORM">
<s:FormItem width="100%" label="Nachname" required="true">
<s:TextInput id="NAME" width="50%" focusIn="scrollToFocus(event)"/>
</s:FormItem>
...
Labels:
Flex
Monday, 14 November 2011
Install Tomcat 5.5 and 6.0 as Windows Service
sc config Tomcat5 DisplayName= "Apache Tomcat 5.5" (mind the blank after "=")
Modify ports in server.xml:
<Server port="8095" shutdown="SHUTDOWN">
<Connector port="8090" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" />
<Connector port="8099" protocol="AJP/1.3" redirectPort="8443" />
Modify ports in server.xml:
<Server port="8095" shutdown="SHUTDOWN">
<Connector port="8090" protocol="HTTP/1.1"connectionTimeout="20000" redirectPort="8443" />
<Connector port="8099" protocol="AJP/1.3" redirectPort="8443" />
Labels:
Tomcat
Tuesday, 1 November 2011
Subscribe to:
Posts (Atom)