• Home
  • About
  • Doom II
  • Flog
  • Inspiration
DiscogsFacebookFlickrGood ReadsGoogle+Last.FMSteam CommunityTumblrTwitterVimeoYouTube
Jan 11

Oz Observations

Have been in Melbourne for almost three months now and still not dead.

  • The weather here goes up and down more than a pole dancer.
  • St. Kilda is Little Ireland.
  • The sole purpose of French travellers is to speak loudly outside hostel rooms late at night with no consideration for other people. Fuck the fucking French.
  • Flashing crosswalk sign: “GIVE WAY TO PEDS”. Too easy.
  • No refrigerating eggs. They’re found in the supermarket baking aisle.
  • It wasn’t until late Christmas Eve that I made my first legit grocery shopping excursion. Takeout is comparable in price to cooking for yourself.
  • I watch more hockey overseas than in Canada, but that had more to do with the World Junior’s and HBO’s 24/7 Rangers/Flyers: Road to the NHL Winter Classic.
  • Moved to Brunswick East in late October and the first morning it sounded like a zoo out my window – the house borders a park. Birds are loud.
  • Demolition five lots down of old retail space for new condos that has been ongoing since I moved in? Louder.
  • Brunswick East is a black hole for Optus coverage even if I’m a 10min tram ride to the CBD.
  • I am still confused as to whether it’s Brunswick East or East Brunswick.
  • It doesn’t matter because most people, even from Melbs, assume I’m talking about Brunswick St. in Fitzroy.
  • Quarry Hotel chicken parma and pint of Carlton, sing it.
  • The East Brunswick Club is my new Sneaky Dee’s. It’s no King’s Crown, but they have a chicken parma served on nachos.
  • Milk bar staples: milk, bread, Tim Tams.
  • Discovered my new favourite past-time is telling Pommies there is no purpose of the monarchy and then watching their head explode.
  • Brunswick Town Hall Kebab have begun upgrading me from small to large at no cost. Yes, I am already a regular at a food truck in a carwash parking lot.
  • Footy pre-seasons exist to see if your exhausted legs will secrete tears.
  • I don’t think anyone at the cricket is actually spectating a match played out in front of them. So like most people in the 500 level at a Jays game, the sole goal is getting tanked.
  • So far this conversation has played out three times:
    “What part of Canada are you from?”
    “The east coast.”
    “Oh, British Columbia is nice.”
    “The other east.”
  • Now Playing: Built to Spill - There is No Enemy - 03 - Nowhere Lullaby
0 Comments   |   Posted by Derek @ 06:07am UTC
Nov 27

Let’s Be Vague

Hydro

Decided to pick it up again, maybe finish it. Seven levels.

  • Now Playing: Manic Street Preachers - Postcards From a Young Man - 06 - Auto-Intoxication
0 Comments   |   Posted by Derek @ 08:17pm UTC
Nov 20

Harvest Festival: The Gathering

Given my too short stay in Australia, it was deemed necessary I check out Melbourne’s festival scene as Canada’s state of affairs has led to attending headlining tours-only. With the geographical isolation of Oz, a rarity of international acts coming through leads to excessive admission charges to make up for visa and travel costs. Next month Welsh band Future of the Left is $47AUS at The Corner. I paid $15CDN in Toronto at ElMo. $10US at Austin’s Beauty Bar in 2009. So dropping $150 for Harvest Festival of more than a handful of desirable bands hooks into my opportunity cost appreciation. And the lineup for this festival was a doozy for overseas acts Down Under.

My prospective schedule for the day:

  • Kevin Devine 12:30 – 1:15PM
  • The Walkmen 3:00 – 4:00PM
  • TV on the Radio 4:00 – 5:00PM
  • Mercury Rev 5:00PM – 5:30PM
  • Death in Vegas 6:15 – 7:00PM
  • The National 7:00 – 7:45PM
  • Mogwai 7:45 – 8:15PM
  • Portishead 8:30 – 9:45PM
  • The Flaming Lips 9:45 – 10:45PM

Actual happenings:

  • The Walkmen 3:40 – 4:00PM
  • TV on the Radio 4:00 – 5:00PM
  • Mercury Rev 5:00PM – 5:20PM
  • stand in line for Brazilian Barbecue 5:20 – 7:00PM
  • The National 7:00 – 7:20PM
  • Mogwai 7:30 – 8:15PM
  • Portishead 8:30 – 10:00PM
  • Holy Fuck 10:00 – 10:30PM

Read the rest of this entry »

  • Now Playing: Los Campesinos! - Hello Sadness - 03 - Hello Sadness
0 Comments   |   Posted by Derek @ 01:36pm UTC
Nov 17

RichFaces #{rich:element()} Workaround

Working with the Seam Framework and RichFaces for over a year, I found their components work in the general case. i.e., the simplest of early oughts HTML forms. But complex AJAX views cause all sorts of difficulties once you get into EL expressions for iterated components (e.g., from <rich:datatable>) within <f:subview>-named scopes.

The biggest challenge has been to get each customized component instance to display and behave correctly within the same view, avoiding situations where the rendered=”" attribute doesn’t evaluate to the expected value (as elements are still in the component tree when rendered=”false”.) For example, the <c:if> test=”" expression is evaluated when the component tree is built, so if any variables within test=”" reference a render-time component such as var=”" of <rich:datatable>, that EL statement may evaulate to null or false. Do not use <c:if> nested in an iterated component like <rich:datatable>. It will only cause hands to be thrown up in the air with disgust.

Another big problem is RichFaces’ rich:element() function not taking namespace into consideration, so the nearest id=”" component-matching sibling or even first match in the whole view will be returned. A parent <f:subview> will not be used unless you explicitly prefix the rich:element() parameter with it.

<f:subview id="mySubview">
<h:inputtext id="myInput" />
<h:graphicimage value="img.png" onclick="#{rich:element('mySubview:myInput').focus()" />
</f:subview>

The issue I had was <f:subview> instances used in customized components, where I would have to require an id=”" attribute to be defined for every usage of components. e.g., <customlibrary:customtag id=”yourComponentId” …/>. This is just tag soup and kinda amateur hour.

I found the best workaround was a JavaScript hack that takes into account how JSF generates the HTML markup of id=”" attributes on each DOM element sourced from the component tree. It is the clientId of each JSF component in the tree concatenated by the ‘:’ character. By truncating up to the last ‘:’, you can attain the parent subview and then append the string parameter usually passed into rich:element() or rich:component(). For example, the oncomplete=”" attribute of <a4j:commandbutton>, the previous method to attain a local DOM reference:

var domObj = #{rich:element('yourComponentId')};

becomes:

var domObj = document.getElementById(this.id.substring(0, this.id.lastIndexOf(':')) + ':yourComponentId');

And that fixes all the wonkiness with changing visibility or using JQuery animations to manipulate JSF components in a contemporary manner. I mean, really RichFaces.

  • Now Playing: Fair to Midland - Fables From a Mayfly: What I Tell You Three Times is True - 04 - The Wife, The Kids, and The White Picket Fence
0 Comments   |   Posted by Derek @ 11:21am UTC
Oct 13

Rogers Wireless: A Direct Line to Your Pockets

Even after I move to Australia, Rogers manages to get my ire. Emailed below to their support, likelihood of a proper response…?

My most recent wireless invoice contains billing detail:

Oct 02 Early Cancellation Fee 500MB Data Option 100.00

I was under contract with Rogers wireless May 2008 to May 2011. I purchased an unlocked iPhone4 direct from apple.com and activated Mt. Sinai’s iPhone corporate plan in September 2010. At no point was another time-sensitive service agreement signed or even communicated to me by a CSR.

On top of this assumed contract, the most current billing cycle ends Oct 7 yet this ETF appears Oct 2 while I’m also being invoiced for another period into November due to Rogers’ draconian 30 day notice for cancellation policy. If the iPhone plan is for one year, the cancellation date would fall outside my service time.

When I called in to cancel, at no point did the retentions rep indicate an iPhone plan ETF of $100 would be applied. And I’m traveling in Australia now and won’t be calling again using international long distance to clear this up.

0 Comments   |   Posted by Derek @ 07:00pm UTC
Sep 26

Live AFL Grand Final Broadcast in Canada? Not for 2011

I sent the below letter to TSN’s Audience Relations, where relations means you get an auto-reply indicating a cog will read the message but not personally respond. If there’s enough volume on a topic, someone in power at Bell Media may hear about it at the end of the day so you may be better off calling them at 416-384-7660. Also, come to my club’s AFL Grand Final party in Toronto. We’ll figure out a way to show it on TV whether TSN is involved or not.

I’ve come to learn that Bell Media doesn’t plan to air the AFL Grand Final on TSN2, instead showing Rugby World Cup games of Australia v Russia and France v Tonga. The March 18th press release stated,

“The top two teams face off in the AFL GRAND FINAL – the Aussie Super Bowl – airing live on TSN2.”

Football clubs across the country have planned Grand Final parties with the expectation of a live broadcast, just as many have done for more than five years now when it was once annually broadcast by Setanta Sport. The AFL’s party tracker has 11 registered events in Canada that will have hundreds of attendees each.

Last minute scheduling news of a tape-delayed broadcast on TSN this Saturday has lead to a non-announcement through social media of it now being streamed live on tsn.ca. Fans of AFL in Canada already had an ad-free web site to stream the Grand Final and such a haphazard handling of the AFL license will tarnish good will toward the TSN brand while also diminishing the opportunity to attract future viewership to the sport.

At this point, the best case scenario would be for Bell Media to offer a pay-per-view option to all the pubs holding event nights this Friday. AFL Grand Final parties have a social atmosphere akin to Canada’s run at Olympic hockey gold and that setting certainly isn’t attained hunched over a laptop.

2 Comments   |   Posted by Derek @ 01:59pm UTC
Sep 25

Used hardware. It’s not old, it’s vintange! (It’s old)

I thought about posting this on Craigslist but it’s seriously not even worth the effort meeting people to off-loading such junk. To storage the lot goes!

  • 8-port 10mbps Ethernet Soho Hub
    The manufacturer seemingly wants to 100% hide its brand from the packaging, manual, and equipment. Ethernet 8/16-Port 10Base-T Stackable Hub.
  • Linksys Wireless-G USB Network Adapter with SpeedBooster
    Ideal for your desktop to avoid whinging about too many cords tangling up precious domestic space. Go wireless and give your missus one less reason to complain.
  • Logitech Cordless Desktop 967461-0403
    Wireless keyboard and mouse combo. See above.
  • Tekram Ultra SCSI DC-315U
    50 pin. What up.
  • Intel Core 2 Duo Processor E6300 1.86GHz 1066MHz FSB 2 MB L2 Cache
    Melt it into an ashtray maybe?
  • StarTech ST100S Ethernet card
    Designed for Windows 98!
  • TMS418169DZ-60 SIMM DRAM 2x8mb
    Show the ladies your VGA graphics in Ultima! Guaranteed panty dropper!

Also four CaseLogic flip books for storing CD/DVDs. 30x, 100x, and two 200x.

Are landlines relevant anymore? No. But I have a GE 26920GE2 cordless phone.

  • Now Playing: Black Mountain - Wilderness Heart - 08 - Wilderness Heart
0 Comments   |   Posted by Derek @ 10:15pm UTC
Mar 31

Oreo-Stuffed Chocolate Chip Cookies

Oreo-Stuffed Chocolate Chip Cookies

Yes, I made this ridiculous cookie-within-a-cookie for our Monday dessert club at work. The recipe from Picky Palate indicates it’s portioned for two dozen cookies but I only got a baker’s dozen out of it. I guess I had a biggie ice cream scoop? Either way, it’s time we try a cookie-within-a-cookie-within-a-cookie and just wait for the kick.

  • 2 sticks softened butter
  • 3/4 cup packed light brown sugar
  • 1 cup granulated sugar
  • 2 large eggs
  • 1 tablespoon pure vanilla
  • 3 1/2 cups all purpose flour
  • 1 teaspoon salt
  • 1 teaspoon baking soda
  • 10 oz bag (a bit over 1 cup) chocolate chips
  • 1 bag Double Stuf Oreo Cookies
  1. Preheat oven to 350°F. In a stand or electric mixer cream butter and sugars until well combined. Add in eggs and vanilla until well combined.
  2. In a separate bowl mix the flour, salt and baking soda. Slowly add to wet ingredients along with chocolate chips until just combined. Using a cookie scoop take one scoop of cookie dough and place on top of an Oreo Cookie. Take another scoop of dough and place on bottom of Oreo Cookie. Seal edges together by pressing and cupping in hand until Oreo Cookie is enclosed with dough.
  3. Place onto a parchment-lined baking sheet and bake cookies 9-13 minutes or until cookies are baked to your liking. Let cool for 5 minutes before transferring to cooling rack.
  • Now Playing: Biffy Clyro - Puzzle - 10 - Get Fucked Stud
0 Comments   |   Posted by Derek @ 12:09am UTC
Mar 25

Seam Framework AJAX reRender Causing “duplicate attribute”

When using RichFaces’ <a4j:support> to reRender components in the current view upon a certain event, a couple times I’ve come across an XML parsing error in the AJAX response which prevents the rerendering process from completing. The AJAX progress indicator icon just continues into infinite despite the request completing its cycle, albeit in an error state. Firebug’s panel indicates the issue is “duplicate attribute”, where I track down the id=”" attribute as being added twice to at least one of the components being rerendered.

I’ve never been able to break the problem down to a simplified example that I can submit to RichFaces’ JIRA tracking system (or just fix myself) because it seems to be very context specific. Once, the duplicate id=”" was added to <rich:calendar>, despite that component rerendering fine on another page when auto-refreshing one date dependent on a birth date field. Another time, it occurred within <h:selectOneRadio>, but only to the first <f:selectItem> child, with a “:0″ added to the end of the second id=”" added to the component tree’s problem node. I find the problem component is usually the first item rerendered within the list of ids passed to the reRender=”" attribute of <a4j:support>.

The solution I’ve used to fix the problem is ad-hoc and likely won’t always work: reRender another level up in the component tree. It will take longer for more components to redraw themselves by possibly causing more retrievals from the persistence layer but at least that obtuse programming error buried within RichFaces’ codebase disappears. It’s this nonsense that makes working with the RichFaces library a hair-pulling experience at times. Well, that and the Ruskie broken English found in the documentation and support forum.

  • Now Playing: Mogwai - Young Team - 08 - R U Still In 2 It
0 Comments   |   Posted by Derek @ 04:49pm UTC
Mar 15

Recovering Faster Than Fevola

Swear I’ve been meaning to post more on this blog but every item is in a scattered draft form. It doesn’t help that last week my 1TB Seagate hard drive decided to stop powering up so I had to rebuild my computer while losing over a year’s worth of music along with 10 hours+ of Doom editing which was the tedious details-oriented sort. Otherwise, I tend to keep all my files online somewhere so the incident wasn’t as disastrous as it’s been in the past. But I’m going to try finding a circuit board to hopefully repair the hard drive because my meticulously organized music collection is a labour of love (and I cry myself to sleep at night.)

I’m still Tumblring and tweeting about.

  • Now Playing: PJ Harvey - Stories From the City, Stories from the Sea - 07 - The Mess We're In (Feat. Thom Yorke)
0 Comments   |   Posted by Derek @ 03:05pm UTC
Dec 20

Magic Bars

Magic Bars

Ingredients:

1/2 cup butter or margarine
1 1/2 cup graham cracker crumbs
1 cup semi-sweet chocolate chips
1 1/2 cup sweetened coconut flakes
1 can Eagle Brand milk

Melt butter in a 13″x9″x2″ pan in the oven while it pre-heats at 350°F. Sprinkle Graham cracker crumbs on top of butter, add chocolate chips, coconut, then pour Eagle Brand milk evenly on top for a layered effect. Bake for 25 minutes or until lightly brown. Let cool before cutting.

Makes 3 dozen.

  • Now Playing: Mew - Frengers - 10 - Comforting Sounds
0 Comments   |   Posted by Derek @ 08:26pm UTC
Nov 18

When I Actually Showed Up to Softball

Like last year, I tracked my plate appearances for my softball team.

Spring: Multitards, 7-1 for 1st
May 11 won 23-17, 7-7, 2B, 3B
May 18 won 21-8, 5-5, 2B, HR
May 25 won 33-14, didn’t play (sick)
June 1 won 28-13, didn’t play (TTC subway delay due to St. George Stn. police investigation)
June 8 lost 21-8, 2-5 (warning track FO with the bases juiced was disappointing)
June 15 won 15-14, didn’t play (Thrice concert!)
June 12 won 8-7, 1-2, SF
June 29 won 16-15, 5-5, 3B (pitched my teammate the hit that was the winning RBI in top 8th)
AVG 0.833 (20-24), SLG 1.208

I didn’t end up playing the summer session because games were Monday nights which interfered with my Aussie Rules Football team’s training at Cherry Beach. Then for autumn, our team (named Catch the Taste!) forfeited half our games due to lack of numbers and for the other half I was either out of town or too damned hungover to make it. Mid-afternoon Sunday leagues played in seasonally-deteriorating weather are just not a cool idea. But I did fill in a for a couple friends with spot starts:

June 13 for Kieno’s team, won 10-9, 2-3, 2B, GW 1B
June 17 for Zeff’s team, lost 15-9, 3-4, 2B
Aug 8 for Kieno’s team, lost 16-6, 1-3, BB

My commitment to hard hit grounders between SS/3B or liners to shallow outfield paid dividends in keeping my on-base percentage on the up-and-up. Here’s to hoping a free evening schedule in 2011 will allow me to keep this momentum going against my age’s grain.

  • Now Playing: Crippled Black Phoenix - I, Vigilante - 04 - Bastogne Blues
0 Comments   |   Posted by Derek @ 12:41am UTC
Oct 19

H2 and DB2 (in)Compatibility Mode

Creating TestNG cases at work, I was having issues creating proper data sets for our test suite since the data model is so complex. I was manually instantiation each class’ entity, populating the object, persisting, then committing the transaction manually. It became obscene for certain objects that referenced up to ten different classes with multiple constraints each. We already have SQL scripts to pre-populate our local JBoss environment so it was a possible solution to use that same data for our tests. I posed the question of a better solution on the interweb and it was suggested I try another DBMS that supports DB2 used by our site and also operates in-memory to increase speed. We already were using Hypersonic but it doesn’t support SQL import from DB2. So I tried H2, using this JDBC connect string to enable the DB2 compatibility mode and trigger our create + populate scripts on the test suite’s startup.

jdbc:h2:mem:localDB;MODE=DB2;INIT=RUNSCRIPT FROM ‘~/workspace/database/create.sql’\;RUNSCRIPT FROM ‘~/workspace/database/populate.sql’

As the H2 features page indicates, “for certain features, this database can emulate the behavior of specific databases. Not all features or differences of those databases are implemented.” Enter what I found out was in fact DB2 incompatibility mode.

1
2
3
4
5
6
7
8
9
10
11
12
13
CREATE TABLE MAIL_RECEIPT (
    MAIL_RECEIPT_KEY INTEGER NOT NULL,
    DATE TIMESTAMP NOT NULL,
    USER VARCHAR(255) NOT NULL,
    CONTENT VARCHAR(32) NOT NULL,
    FROM VARCHAR(255) NOT NULL,
    TO VARCHAR(1000),
    CC VARCHAR(1000),
    BCC VARCHAR(1000),
    SUBJECT VARCHAR(255) NOT NULL,
    BODY VARCHAR(2000) NOT NULL,
    PRIMARY KEY (MAIL_RECEIPT_KEY)
);

org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement

DB2 allows FROM as a column name. H2 does not. And no, I didn’t originally write this schema so don’t blame me for its poor naming.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
CREATE VIEW REPORT_CAGE_MOVEMENT AS
        SELECT CURRENT_ROOM.ROOM_NAME AS CURRENT_ROOM_NAME,
                CURRENT_ROOM.ROOM_ID AS CURRENT_ROOM_ID,
                ANIMAL_PROTOCOL.PROTOCOL_NUMBER,
                PERSON.LAST_NAME,
                PERSON.FIRST_NAME,
                CAGE.BARCODE_VALUE,
                MOVE_FROM.CAGE_ID AS CAGE_ID,
                MOVE_FROM.ROOM_ID AS FROM_ROOM_ID,
                MOVE_TO.ROOM_ID AS TO_ROOM_ID,
                MOVE_FROM.TO_DATE AS EXIT_DATE,
                MOVE_TO.FROM_DATE AS ENTRY_DATE,
                FROM_ROOM.ROOM_NAME AS FROM_ROOM_NAME,
                TO_ROOM.ROOM_NAME AS TO_ROOM_NAME
        FROM CAGE_MOVEMENT AS MOVE_FROM
        INNER JOIN CAGE_MOVEMENT AS MOVE_TO
                ON MOVE_FROM.CAGE_ID = MOVE_TO.CAGE_ID
                AND MOVE_FROM.TO_DATE + 1 DAY = MOVE_TO.FROM_DATE
        INNER JOIN ROOM AS FROM_ROOM
                ON MOVE_FROM.ROOM_ID = FROM_ROOM.ROOM_ID
        INNER JOIN ROOM AS TO_ROOM
                ON MOVE_TO.ROOM_ID = TO_ROOM.ROOM_ID
        INNER JOIN CAGE
                ON MOVE_FROM.CAGE_ID = CAGE.CAGE_ID
        INNER JOIN PERSON
                ON CAGE.CAGE_OWNER_KEY = PERSON.PERSON_KEY
        INNER JOIN ANIMAL_PROTOCOL
                ON CAGE.ANIMAL_PROTOCOL_ID = ANIMAL_PROTOCOL.ANIMAL_PROTOCOL_ID
        INNER JOIN ROOM AS CURRENT_ROOM
                ON CAGE.ROOM_ID = CURRENT_ROOM.ROOM_ID

org.h2.jdbc.JdbcSQLException: Column “CURRENT_ROOM.ROOM_NAME” not found

Aliases defined in an INNER JOIN clause cannot be referenced in the SELECT’s expression (isn’t that how Hibernate builds all its join queries?)

1
GRANT CONNECT ON DATABASE TO USER SOMEUSER;

org.h2.jdbc.JdbcSQLException: Table “DATABASE” not found

Uh…

1
2
3
4
5
6
7
CREATE TRIGGER BI_STRG_ALLCTIN
NO CASCADE BEFORE INSERT ON STORAGE_ALLOCATION
REFERENCING NEW AS NEW_STORAGE
FOR EACH ROW
MODE DB2SQL
WHEN (NEW_STORAGE.STORAGE_ALLOCATION_KEY IS NULL)
SET (NEW_STORAGE.STORAGE_ALLOCATION_KEY) = (NEXTVAL FOR TCP_POID_SEQUENCE);

org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement “…”; expected “AFTER”

Well it looks like a DB2 trigger doesn’t need that AFTER keyword.

So we’ve switched back to Hypersonic and I’m now creating an XML-based data set using DBUnit.

  • Now Playing: Killing Joke - Absolute Dissent - 02 - The Great Cull
0 Comments   |   Posted by Derek @ 10:44pm UTC
Oct 06

Look At Me, Look At Me

Since I’m a dicktard that prefers to dilute his own online brand, you can now also follow me on Tumblr. Longer items that are less microbloggy will still be appearing on this domain.

  • Now Playing: Envy - Recitation - 08 - Worn Heels and the Hands We Hold
0 Comments   |   Posted by Derek @ 02:17pm UTC
Aug 25

Sweet Potatoes

Sweet Potatoes

  • 2 1/2 lbs of sweet potatoes, peeled, cooked and cut into irregular shaped pieces.
  • 1/2 cup brown sugar
  • 2 tbsp butter or margarine
  • 1 1/2 tbsp cornstarch
  • 1/2 tsp salt
  • 1/8 tsp pepper
  • 1 cup orange juice

Cut potatoes int bite size pieces and place in 2 quart (8 litre) casserole dish.

Mix remaining ingredients in saucepan. Heat and stir until it boils and thickens. Pour over potatoes. Cover and bake in 350°F oven for 20 minutes. Remove cover for last few minutes if desired. Serves 8.

  • Now Playing: Celldweller - Wish Upon a Blackstar Chapter 02 - 01 - Eon
0 Comments   |   Posted by Derek @ 11:45pm UTC
Jul 07

Seam Framework JSF Component Validation: At Least One Checkbox

For some reason Seam Framework doesn’t include form validation to ensure at least one checkbox is selected out of a group of checkboxes. Like a radio button, but more than one may be selected. One custom code sample was bullshit because validation takes place in JSF lifecycle before the model is updated, so you must wait for the component tree to be built before such a validation can take place.

The solution I found wasn’t optimal but hey, I’m not the only one wanting this simple form functionality.

/resources/WEB-INF/web.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
.
.
.
	<context-param>
		<param-name>facelets.LIBRARIES</param-name>
		<param-value>/WEB-INF/compositions.taglib.xml</param-value>
	</context-param>
</web-app>

/resources/WEB-INF/compositions.taglib.xml

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd">
<facelet-taglib>
    <namespace>http://mytaglib.com/jsf</namespace>
    <tag>
    	<tag-name>atLeastOneValidator</tag-name>
    	<validator>
    		<validator-id>atLeastOneValidator</validator-id>
    	</validator>
    </tag>
</facelet-taglib>

/src/main/validator/AtLeastOneValidator.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package yourpackage.validator;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlSelectBooleanCheckbox;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
 
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.faces.Validator;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.ui.component.html.HtmlLabel;
 
@Name("atLeastOneValidator")
@Validator
@BypassInterceptors
@Scope(ScopeType.CONVERSATION)
public class AtLeastOneValidator implements javax.faces.validator.Validator, Serializable {
 
	private static final long serialVersionUID = -4249428843435574402L;
 
	private static Map<String, Map<String, Boolean>> formCheckboxes;
 
	public void validate(FacesContext context, UIComponent component, Object value)
		throws ValidatorException {
 
		List<HtmlSelectBooleanCheckbox> checkboxes = new ArrayList<HtmlSelectBooleanCheckbox>();
		String groupWith = "";
		UIComponent rootComponent = FacesContext.getCurrentInstance().getViewRoot();
 
		if (!(component instanceof HtmlSelectBooleanCheckbox)) {
			throw new ValidatorException(createErrorMessage("atLeastOneValidator can only be used on HtmlSelectBooleanCheckbox components."));
		}
 
		if (component.getAttributes().get("groupWith") != null) {
			groupWith = (String)component.getAttributes().get("groupWith");
		}
 
		if (formCheckboxes == null) {
			formCheckboxes = new HashMap<String, Map<String, Boolean>>();
		}
 
		if (formCheckboxes.get(groupWith) == null) {
			formCheckboxes.put(groupWith, new HashMap<String, Boolean>());
		}
 
		// Store this component's value, queuing to be checked at the last
		// checkbox in the group to see of any component has the value
		// set to "true"
		formCheckboxes.get(groupWith).put((String)component.getAttributes().get("id"), (Boolean)value);
 
		// retrieve all checkboxes under this group in the component tree
		getCheckboxes(rootComponent, checkboxes, groupWith);
 
		// Last checkbox in the component tree of this group, so
		// now check whether at least one is checked.
		if (component.equals(checkboxes.get(checkboxes.size()-1))) {
			boolean atLeastOneChecked = false;
			String styleClass = "";
 
			for (String componentId : formCheckboxes.get(groupWith).keySet()) {
				if (formCheckboxes.get(groupWith).get(componentId)) {
					atLeastOneChecked = true;
					break;
				}
			}
 
			// highlight or unmark checkboxes/labels
			if (!atLeastOneChecked) {
				styleClass = "required";
			}
			for (HtmlSelectBooleanCheckbox checkbox : checkboxes) {
				if (checkbox.getParent() instanceof HtmlLabel) {
					((HtmlLabel)checkbox.getParent()).setStyleClass(styleClass);
				} else {
					checkbox.setStyleClass(styleClass);
				}
			}
 
			if (!atLeastOneChecked) {
				throw new ValidatorException(createErrorMessage("At least one " +
					((groupWith == null || groupWith.length() == 0) ? "" : "\"" + groupWith + "\" ")
					+ "checkbox must be selected."));
			}
		}
 
    }
 
	/**
	 * Recursively traverse a component tree to retrieve all the
	 * HtmlSelectBooleanCheckbox objects containing a specific groupWith=""
	 * attribute.
	 *
	 * @param component Initial invocation should be the root component.
	 * @param checkboxes Initial invocation should be instantiated blank list.
	 * @param groupWith Name/label given to the group of checkboxes. null
	 *                  or a blank string returns ALL checkboxes in the tree.
	 * @return List of child checkboxes in a component tree.
	 */
	protected List<HtmlSelectBooleanCheckbox> getCheckboxes(UIComponent component, List<HtmlSelectBooleanCheckbox> checkboxes, String groupWith) {
 
		if (component != null) {
			for (UIComponent childComponent : component.getChildren()) {
				if (childComponent instanceof HtmlSelectBooleanCheckbox) {
					if ((groupWith == null || groupWith.length() == 0) ||
					    groupWith.equals(childComponent.getAttributes().get("groupWith"))) { 
						checkboxes.add((HtmlSelectBooleanCheckbox)childComponent);
					}
				} else if (childComponent.getChildCount() > 0) {
					getCheckboxes(childComponent, checkboxes, groupWith);
				}
			}
		}
 
		return checkboxes;
	}
 
	private FacesMessage createErrorMessage(String s) {
		FacesMessage message = new FacesMessage();
		message.setDetail(s);
		message.setSummary(s);
		message.setSeverity(FacesMessage.SEVERITY_ERROR);
		return message;
	}
 
}

/view/atLeastOneValidatorTest.xhtml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:mytaglib="http://mytaglib.com/jsf">
 
	<h:form>
		<h:messages />
		.
		.
		.
		<s:label>
			<h:selectBooleanCheckbox value="male" groupWith="Sex">
				<tcp:atLeastOneValidator />
			</h:selectBooleanCheckbox>
			<h:outputText value="Duder" />
		</s:label>
		<s:label>
			<h:selectBooleanCheckbox value="female" groupWith="Sex">
				<tcp:atLeastOneValidator />
			</h:selectBooleanCheckbox>
			<h:outputText value="Dudette" />
		</s:label>
		<s:label>
			<h:selectBooleanCheckbox value="unknown" groupWith="Sex">
				<tcp:atLeastOneValidator />
			</h:selectBooleanCheckbox>
			<h:outputText value="???" />
		</s:label>
		.
		.
		.
	</h:form>
 
</ui:composition>
  • Now Playing: Minus the Bear - Omni - 03 - Secret Country
0 Comments   |   Posted by Derek @ 10:44pm UTC
Jun 16

Hibernate’s Inexplicable Failure

DEBUG [SequenceGenerator] Sequence identifier generated: 1025
DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG [ConnectionManager] aggressively releasing JDBC connection
DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG [AbstractSaveEventListener] generated identifier: 1025, using strategy: org.hibernate.id.SequenceGenerator
DEBUG [AbstractSaveEventListener] generated identifier: 1025, using strategy: org.hibernate.id.ForeignGenerator
DEBUG [AbstractFlushingEventListener] processing flush-time cascades
DEBUG [AbstractEntityManagerImpl] mark transaction for rollback

It’s a one-to-one foreign key generated by a DB2 sequence to persist multiple entities in one transaction. It seems to be created and assigned to the two entities mapped to each other but I have no clue why the JPA/Hibernate transaction decides it’s a no go as all the required fields are assigned in the objects being persisted. I’ve been working on this Seam Framework wizard for a week and this is an example of roadblocks in the dozens that have taken me to varying edges of sanity when it comes to troubleshooting this project.

I can only take solace in knowing once these niggles are straightened out, the rest of the system will be easy to implement. But the technological learning curve and unseen issues derived from requirement complexities make me believe Seam is a terrible framework solution. Absolutely terrible.

Update July 2: This error was occurring because a RunTimeException was thrown in the Hibernate library which wasn’t displaying in the server’s log or on the JBoss stack trace because the entrance method was invoked using EL. Wrapping my persist() call with a try {} containing a generic Exception catch() revealed it was a constraint violation occurring on a value set as a Hibernate TrueFalseType (char(1) with ‘T’ or ‘F’ values) when it should’ve been a YesNoType (char(1) with ‘Y’ or ‘N’ values).

  • Now Playing: Gridlock - Formless - 12 - Re/Module
0 Comments   |   Posted by Derek @ 05:43pm UTC
May 02

My expectations of this reunion were pretty low but wow, Cornell still has the vocal chops and this performance highlights how Kim Thayil has been sorely missed for more than a decade.

  • Now Playing: TV on the Radio - Dear Science - 03 - Dancing Choose
0 Comments   |   Posted by Derek @ 09:23pm UTC
May 01

Disable <rich:inplaceInput> in Seam

You can’t. But you can use <h:outputText> for read-only visitors and <rich:inplaceInput> for write-enabled logged-in users. Customize the inplaceInputTest.xhtml s:hasRole() parameter to give the proper boolean value on whether the logged-in user is an administrator or not of the field you want to control access of.

/resources/WEB-INF/web.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
.
.
.
	<context-param>
		<param-name>facelets.LIBRARIES</param-name>
		<param-value>/WEB-INF/compositions.taglib.xml</param-value>
	</context-param>
</web-app>

/resources/WEB-INF/compositions.taglib.xml

1
2
3
4
5
6
7
8
9
<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd">
<facelet-taglib>
    <namespace>http://mytaglib.com/jsf</namespace>
    <tag>
        <tag-name>inplaceInput</tag-name>
        <source>../compositions/inplaceInput.xhtml</source>
    </tag>
</facelet-taglib>

/view/compositions/inplaceInput.xhtml

1
2
3
4
5
6
7
8
9
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich">
 
	<rich:inplaceInput value="#{value}" showControls="true" editEvent="ondblclick" layout="block" rendered="#{isManager}" />
	<h:outputText value="#{value}" rendered="#{not isManager}" />
 
</ui:composition>

/view/inplaceInputTest.xhtml

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:mytaglib="http://mytaglib.com/jsf">
 
	<mytaglib:inplaceInput value="Example text" isManager="#{s:hasRole('module_manager')}" />
 
</ui:composition>
  • Now Playing: Toadies - Rubberneck - 06 - Away
0 Comments   |   Posted by Derek @ 12:24am UTC
Apr 27

JBoss Seam, Hibernate, DB2, and Lucene Indexing

Yeah, it’s all happening. Migrating a CMS to Java’s Seam framework using an existing DB2 schema/dataset, the Lucene search indexes on a few tables caused DB2 error SQL1584N. The bizarre part was it was only happening locally on my machine, but not for two others at work, who each have the same amount of RAM. It may have been because I was on Ubuntu and the other devs use Red Hat Enterprise Linux.

System temporary tablespace with page size of at least pagesize could not be found.
Explanation:
A system temporary table space was required to process the statement. There was no system temporary table space available that had a page size of pagesize or larger.

The statement cannot be processed.

User Response:
Create a system temporary table space with a page size of at least pagesize.

sqlcode: -1584

sqlstate: 57055

Following the instructions for ensuring system temporary table spaces page sizes meet requirements, I ran DB2 query:

LIST TABLESPACES SHOW DETAIL

…checking for the entry with Type = System managed space, Contents = System Temporary data, I confirmed the page size used was 32k, which is the highest possible with DB2.

After googling a bit, it seemed the solution was to increase the bufferpool size used by the tablespace giving me this error. The instructions for adjusting the bufferpool are to simply run DB2 query:

SELECT * FROM syscat.bufferpools

Confirm the bufferpool size, then increase the number of pages available until the Lucene indexing doesn’t shit the bed. e.g.,

ALTER BUFFERPOOL ibmdefaultbp SIZE 2000

During this process, you may get the error:

SQL20169W The buffer pool is not started.

sqlcode: +20169

sqlstate: 01654

This just means the change won’t take effect until DB2 is restarted, so execute:

db2 force applications all
db2stop
db2start

Now, if you have the Seam observer Java annotation setup for Lucene indexing, this DB2 error will begone on the next deploy. And yes, this whole post makes me yearn for a non-Java project started from scratch.

  • Now Playing: Cave In - Perfect Pitch Black - 09 - Tension in the Ranks
0 Comments   |   Posted by Derek @ 06:46pm UTC
Previous Page 1 of 13

Derek MacDonald


  • Photo Stream
  • Categories
    • Australia
    • Computing
    • Film & TV
    • Food
    • Gaming
    • General
    • Music
    • Sports
    • Visual Art
  • Search






  • Home
  • About
  • Doom II
  • Flog
  • Inspiration

© Copyright Derek MacDonald. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top