<t:submit image="context:images/submit.gif"/>Much simpler than I was thinking. Sometimes I get really frustrated with these little Tapestry issues...
Friday, May 22, 2009
Image submit in Tapestry 5.1
This just took me a really long time to figure out, so I'm writing it down. Tapestry 5.1 adds support for submit buttons with an image (I think it was added in 5.1). In any case, you just use the normal tag, but you add an image attribute which is an "asset". I added an Asset property to my page class and used @Inject and @Path to inject the asset. I used that property name in the image attribute, and it didn't work. It turns out, you don't need to declare the asset as a property in your page class. You just specify the path in the image attribute just like you would in the @Path annotation. So, it looks something like this:
Tuesday, May 05, 2009
Tabs vs spaces in Netbeans

I work with some people that like spaces and some people that like tabs in their code. I don't really care, so I try to follow whatever the project is using. I ran into a big problem with Netbeans, though, in that it seems like getting it to use tabs only is impossible. It turns out they appear to be following a weird part of the Java Code Conventions spec:
Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).
http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#262
So, Netbeans sort of has two different "numbers" around tabs. There is a number that says how many spaces a tab should appear as, and a number that says how many spaces should be used when you indent something. By default a tab appears as 8 spaces, but a level of indentation is 4 (like the spec says above). As a result, it inserts four hard spaces when you indent one level, and a tab if you indent two levels. The solution is to set the two numbers to the same value. Just a wee bit confusing for a new user.
Here's a bug report where someone describes it:
http://www.netbeans.org/issues/show_bug.cgi?id=52053
Wednesday, April 22, 2009
Opera!
I got really sick of Firefox hogging all of the memory on my laptop (it has 4 gigs), and I thought it would be fun to drive my coworkers nuts by reporting bugs specific to an exotic browser, so I started checking them out the other day. I started with Amaya because I remember it being really crappy back in like '98. Unfortunately it still is. So, I tried Opera and it is actually pretty nice. The interface is a little ugly, but it seems to be way faster than Firefox. It also has this cool speed dial thing that comes up whenever you open a new tab that shows you all of your favorite web sites, and it shows them as pictures, which I think is really cool. So far it is pretty much able to keep up with FF on ajaxy web sites, although I have noticed a few issues with facebook. It also works with this web site I use that has a complicated Java applet. Pretty cool.
Tuesday, April 14, 2009
Windows XP sucks
We all know Windows 7 and Windows Vista suck, but today I ventured into the land of Windows XP so I could transfer all of my financial documents over to my Mac where the backups are more reliable and what not. I have a 200 GB external drive I was using on my DVR, so I plugged it into the Windows box and went to partition it. It would only allow me to use NTFS, making it incompatible with the Mac. I googled. You can only make a FAT32 partition up to 32 GB on XP. Stupid. The suggested workaround is to use Lunix. This is why Microsoft is in a downward spiral right now. Good work, guys.
Tuesday, March 24, 2009
Browsing old versions of a subversion repository
I was trying to look at the contents of an old file in subversion today that had long ago been deleted, with no luck. In the Eclipse plugin for CVS, they had a feature that would allow you to define a date, then browse the repository based on that date, but it seems to be missing from subversion.
I found a workaround, but it isn't quite as nice. You can browse a specific revision of the entire subversion repository, then look at the file. All you have to do is go to this URL:
http://<host>/<repo>/!svn/bc/<revision>/
Where the base URL is the root of your repository, and the extra stuff after the ! specifies the revision. And don't ask me what bc stands for, I have no idea.
As for finding out which revision to look at, that is a little tricky. It can be helpful to look at logs of other files and see which dates correspond to which revisions.
I found a workaround, but it isn't quite as nice. You can browse a specific revision of the entire subversion repository, then look at the file. All you have to do is go to this URL:
http://<host>/<repo>/!svn/bc/<revision>/
Where the base URL is the root of your repository, and the extra stuff after the ! specifies the revision. And don't ask me what bc stands for, I have no idea.
As for finding out which revision to look at, that is a little tricky. It can be helpful to look at logs of other files and see which dates correspond to which revisions.
Tuesday, January 27, 2009
Managing ehcache through Spring
There does not appear to be any documentation in the Spring manual about setting up an ehcache cache in your Spring container. There is a Spring bean built in to do it. To set it up with the default configuration, all that is needed is a line like this:
<bean id="mediaCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean"/>It looks like you can also customize quite a bit of the config without providing an ehcache.xml file. That could be nice so you don't have to go chasing around to find all of the settings.
Thursday, January 22, 2009
A coffee cup quote
I got a cup from Starbucks the other day and I usually don't read the quotes on them, but I happened to read this one. It was interesting and I kept the cup around...here's what it said:
Failure's hard, but success is far more dangerous. If you're successful at the wrong thing, the mix of praise and money and opportunity can lock you in forever. -- Po BronsonHmmmm
Subscribe to:
Posts (Atom)
