Archive for the ‘Technology’ Category

How to remove the yellow fade from the highlight function in Tapestry 5’s zone update

Tuesday, May 12th, 2009

Thanks to Hugo and Igor from the Tapestry User’s mailing list for this solution. Hopefully this blog post will save someone some time.

If you want to remove the generic yellow fade from Tapestry 5’s zone update:

show
highlight
slidedown
slideup
fade

Just add t:update=”show” as a parameter to your zone component

If you just want the zone to be updated with no effect use “show” like

Flex 3 - Fixed Size ScrollThumb for VScrollBar

Thursday, June 26th, 2008

NPACEMO.com has a great post on Flex 3 Designer ScrollBar - Fixed Size ScrollThumb.

I was pulling my hair out for awhile on this issue - and hope to spread the knowledge to other Flex developers out there!

Flex, AlivePDF, and Tapestry5

Wednesday, May 28th, 2008

Here is the code to handle the request/response of PDF creation with Flex / AlivePDF in Tapestry 5.

Simply make this page class. There is no TML file required.


package com.companyname.project.etc;

import java.io.IOException;

import javax.servlet.*;

import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.util.TextStreamResponse;
import org.apache.tapestry.services.RequestGlobals;

public class WritePDF {
@Inject
private RequestGlobals request;

@Inject
private RequestGlobals response;

Object onActivate() throws IOException {
int i = 0;
int k = 0;
int maxLength = request.getHTTPServletRequest().getContentLength();
byte[] bytes = new byte[maxLength];
String method = request.getHTTPServletRequest().getParameter("method");
String name = request.getHTTPServletRequest().getParameter("name");
ServletInputStream si = null;
try {
si = request.getHTTPServletRequest().getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

while (true) {
k = si.read(bytes,i,maxLength);
i += k;
if (k <= 0)
break;
}

if (bytes != null) {
ServletOutputStream stream = response.getHTTPServletResponse().getOutputStream();
response.getHTTPServletResponse().setContentType("application/pdf");
response.getHTTPServletResponse().setContentLength(bytes.length);
response.getHTTPServletResponse().setHeader("Content-Disposition",method + ";filename=" + name);
stream.write(bytes);
stream.flush();
stream.close();
return response;
} else {
return new TextStreamResponse("text/plain", String.format("bytes is null"));
}
}
}

Arghhh. Puck. XML config files, web flows, JSPs, controllers, models and DAOs, WAR files, JARs, blah blah blah.

Monday, November 12th, 2007

Jean-Jacques Dubray wrote an excellent article that sums up my frustrations working with JAVA based technology:

 

“Refactoring allows us to continue tweaking something to make it better - and often you get incrementally better improvements. But, sometimes, when you take a step back, you’re looking at a big hairball of a design. That’s where we are with web architecture these days - and why I believe lighter-weight frameworks like Ruby on Rails have been wildly successful.

 

Try to do a simple web app in Java these days - name your framework? Arghhh. Puck. XML config files, web flows, JSPs, controllers, models and DAOs, WAR files, JARs, blah blah blah. And want to refactor your layout? Forget about it.

 

Enough is enough. We need to really rethink MVC on the server side as a way of building Rich Internet Applications.”