Jan 18 2008

Quick Tip: Using an authenticated proxy server with Ivy

Tag: ant, development, ivy, java, spring, springwebflow, webpmularien @ 8:25 am

I was recently checking out the sample applications that ship with Spring Web Flow 2.0. In order to build the examples, you have to run an ant build that involves the Ivy Dependency Manager.

I was doing this behind a proxy server which requires username/password authentication, which unfortunately isn’t documented in the Ivy FAQ.

In case anyone runs into this particular problem, here’s how I solved it. Set the following environment variable (note this is all on a single line - I’ve added line breaks for readability):

set ANT_OPTS=-Dhttp.proxyHost=myproxyhost -Dhttp.proxyPort=8080 -Dhttp.proxyUserName=myproxyusername -Dhttp.proxyPassword=myproxypassword -Dhttps.proxyHost=myproxyhost -Dhttps.proxyPort=8080

Replace as appropriate for your environment.


Jul 29 2007

CSS Tip: CSS Equivalent to CELLSPACING=0

Tag: css, webpmularien @ 11:12 am

Got this from an old post on css-d, and adapted it because it was bothering me that it was hard to find.

To simulate CELLSPACING=0, set this CSS on your table element:
border-spacing: 0px; border-collapse: collapse;


May 01 2007

A simple CSS Technique for Showing and Hiding Table Columns

Tag: css, html, webpmularien @ 6:36 pm

Yes, yes, I know. You see the word “table” in the post title, and you’re ready to run away yelling about Web 2.0, CSS, semantic HTML, and the overuse of tables for layout.

Don’t worry - I’m with you on that. However, the fact is that tables are still useful in Web 2.0 days for - get this - displaying tabular data.

I know that’s a little revolutionary, so I’ll let in sink in.

In the meantime, bear with me while I illustrate a little technique that allows you to show and hide columns in a table with only dead-simple CSS manipulation. While techniques exist for hiding/showing columns using relatively trivial Javascript, there’s a certain appeal to executing a visualization technique with only CSS.

I’ve tested this with the major browsers, namely Firefox 1.5 and 2, IE 6, Opera 9, and Safari 2.x, and amazingly, they all function properly (although we do use the star-html hack for IE).

Here’s a page showing the basic table: link.

Note that there’s some basic CSS in there just to style the table, and the table markup itself is a standard, run of the mill, table.

We’d like to have the “category” column shown only when the user takes an action, for example clicking an expand button. First, we annotate the th and td elements with the class “moreDetail”, e.g.:
<td class="moreDetail">Vegetable</td>

We’ll amend the CSS so that th and td elements with the class of “moreDetail” are not displayed by default:
th.moreDetail { display: none; } td.moreDetail { display: none; }

This leads us to the page seen in step 2: link.

Now, here’s the tricky bit. We will “show” the column not by manipulating the visibility of the individual cells (through the use of the display attribute), but instead by taking advantage of the way in which CSS rules are interpreted. We will apply a CSS class to the table itself, and take advantage of CSS descendant selectors to change the styling of the “moreDetail” class we’ve added to the table cells.

The CSS looks something like this:
table.showDetail th.moreDetail { display: table-cell; background-color: #E4E4A2; } table.showDetail td.moreDetail { display: table-cell; background-color: #E4E4A2; }

For illustrative purposes, we add the “showDetail” class to the table and see the result in step 3: link. Note that the category column has reappeared because we’ve added the “showDetail” class to the table element.

Of course, IE does not support display: table-cell - fortunately table cells display just fine using display: block, so we add a * html rule to enforce this for IE 6 only, which brings us to step 3a:link. In other browsers, display:block is not a rule you want to put on a table cell (exercise to the reader: try it and see what happens!).

Now to tie it all together, we add two simple buttons that use Javascript to add and remove the “moreDetail” class on the top-level table element. You can see with this simple manipulation, we can show and hide any number of table columns. The final effect is seen in step 4: link.

Once again, IE 6 eludes us. Remember that the CSS classes provided worked fine in IE in step 3a, but for some reason IE 6 will not redraw the table when we simply change the table’s className property. The only way I was able to work around this was to “tickle” the class of one of the table cells (the first TH element) by simply setting its display property to block (which it already was). This is the only difference between step 4 and step 5, seen here: link.

So with step 5, we have a simple way to show and hide table columns using CSS and basic Javascript CSS class manipulation, which is compatible with all major, modern browsers.

HTML purists will note that another effective way to do this is by taking advantage of the <col> element. I’ll explore this technique in combination with the <col> element in a later post. Enjoy! Please send comments/questions/feedback my way.


Apr 25 2007

Inline SVG Shiny Floor Technique v1.0

Tag: development, svg, webpmularien @ 9:18 am

A month ago, I posted about using inline SVG to simulate the Web 2.0 “shiny floor technique” (SFT) for a mirrored reflection effect on page headings. I have not had time to perfect it, but I figured I’d publish it and see if people are interested in enhancing the technique. Note that this has only been tested thus far on 2 browsers that natively support inline SVG, Firefox 2 and Safari.

Demo Page

For those not running one of the aforementioned browsers, here’s what it looks like:

Shiny Floor Example Image

There are several reasons why this is currently impractical for real-world use (although I’d like to change this):

  • This technique will only work if the page is served up as XHTML (content-type application/xhtml+xml, aka “true XHTML”). Since some browsers do not like proper XHTML, this will prevent a large percentage of your audience from seeing this technique in action.
  • Currently, the inline SVG is embedded in the page.
  • The demonstration of this does not use true headings (h1, etc.)
  • The text “SWOOSH” is repeated twice in the page - once in the heading and once in the SVG.

The latter three will be changed in the next published iteration of this technique. In the next iteration, I plan on adding Javascript so that this effect can be added unobtrusively on top of headings on an existing page. This will also allow the effect to degrade gracefully on browsers that do not support inline SVG.

Based on the way that inline SVG is implemented in current browsers (requiring support in the render engine of XML namespaces), I’m not sure whether the requirement of serving the content as true XHTML is a technical hurdle that can be overcome.

As far as I’ve been able to research, this is the first time anything has been published that uses SVG for this type of effect, using only plain text. Prior examples of the SFT have required Photoshop, required Flash, or only work on images.

I’m excited to take it to the next level (as noted above) and hopefully provide something that people find useful.


Mar 21 2007

Text Transform in SVG, Research Mode

Tag: svg, webpmularien @ 8:48 am

Ran across this site with some nice examples of text manipulation in SVG. I bet, with a modern browser, you could implement the shiny floor technique using DOM-scripted SVG. I’ll be working on this and hopefully post some results shortly.


Mar 09 2007

Spring 2 MVC Tutorial - in progress

Tag: spring, webpmularien @ 10:10 am

So there’s been some [1], [2], [3] grumbling in the Spring Web forum (which I tend to participate in when I have a spare moment) regarding the datedness of the only Spring tutorial on the Spring site, “Developing a Spring Framework MVC application step-by-step“. Although it’s a great introduction (heck, it was one of the first articles I read about Spring, it hasn’t been updated significantly since its introduction in July 2003. A lot of new Spring MVC users want to have some good, solid advice on how to use the new Web features that arrived in Spring 2. I have decided to get back to basics and try writing such a tutorial myself. I’ll post it in bits for review on my site, and hopefully some folks will like it.


Mar 08 2007

“Slashup”

Tag: random, webpmularien @ 10:22 am

This is a perfect name for some kind of mashup relating to Slashdot. The only problem is that I can’t think of any data that could be sensibly mashed with Slashdot - can you?


Mar 02 2007

Web presence v2.0

Tag: webpmularien @ 12:55 pm

What makes a good web representation of a developer? The 1990-s response to this question was typically an HTML-ized version of one’s resume (yes, I had one, and I know you did too). The 2000-s response to this question seems to be not so much “you want to hire me, look at my resume”, but “take a look at all this nifty information, and oh, by the way, I can be hired if you want”.

My plan for developing the site is to use the random notes I jot on this blog to build out articles that someone might want to someday read. Like most late 2000 bloggers, I figure if it’s interesting to me, then it’s sure to be interesting to someone else.