The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)

20140126

Book Review: JBoss EAP6 High Availability (Packt Publishing)

I was recently asked by Packt Publishing to review their new book "JBoss EAP6 High Availability".

I have to admit I have little experience with clusters and have only been running JBoss EAP6 in standalone mode, so this book was exciting to read and I picked up A LOT of good tips and learned about a whole new field of computing.

Now, if I only had a couple of extra servers laying around so I could test this information out in practice! ;)



Buy the book directly from Packt: bit.ly/1dcbNEi

My review on amazon.

20140120

[SOLVED] eclipse deleted svn:ignore for folder tmp, still can't import folder

i had previously added a custom svn:ignore entry for "tmp", but today i wanted to undo that so i deleted the entire svn:ignore entry for my project:

then just right-clicked on the svn:ignore property at the bottom right there and chose "delete property".

but i was still unable to import a folder called "tmp" from svn.

eventually i found out that there was some kind of exclude entry for "tmp" as well in the project properties:
right click on project in eclipse > properties > resource > resource filters > delete the exclude entry for "tmp"


20140117

[SOLVED] primefaces click on p:commandLink doesn't work, nothing happens. firebug helped me easily find the error.


In firefox, i clicked on the magnifying glass (top left in above image) icon link that seemed to not be working. When i clicked on the image, nothing happened.


I originally tried a (bad and risky) workaround for this by setting the p:commandLink's "immediate" attribute to "true":

<p:commandLink
    actionListener="#{lrdm.openTRQDetails(trq.id)}"
    update=":growl :panelContent" immediate="true">
    <h:graphicImage value="/images/search.gif" style="border:0" />
</p:commandLink>


this "worked", but simply hid the error, so this isn't a solution.

Eventually, I found out that it was a hidden error: java.lang.NullPointerException

Here's how i found that:

In firebug > Console > All
i expanded the POST line and could see a clue about the error in the Response tab:

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class javax.faces.component.UpdateModelException</error-name><error-message><![CDATA[/path/to/inplaceInputText.xhtml @16,60 value="#{inputValue}": /path/to/tripRow.xhtml @53,69 value="#{backingBean.description}": java.lang.NullPointerException]]></error-message></error></partial-response>


here's the problem code in "backingBean"

...

public void setDescription(String description) {
    this.description = description.toUpperCase();
}

...


the error was occurring when "description" was null--toUpperCase() will obviously throw an error.

to fix this, i changed the code to this:

public void setDescription(String description) {
    if(description != null)
    this.description = description.toUpperCase();
    else this.description = description;
}


Once that was fixed, the form submitted properly :)

blogger: how to add social media icons/image links with consistent design/style theme using normal HTML "a"-tag and "img"-tag code

was searching for a while to find a standard way to add a line of 16x16 social media icons to my blogger, and finally ended up using the logo pack from "addthis":
http://www.addthis.com/logos

direct link to icon pack:
http://cache.addthiscdn.com/site/logos/addthis_social_icon_pack.zip

source of the soundcloud logo:
https://w.soundcloud.com/icon/assets/images/orange_white_16-94fc761.png


i've uploaded the images below to an album of mine on picasa called "social media icons"


here are direct links to the different icons:
https://lh4.googleusercontent.com/-G5OciLFJTtU/UtkdedDSq5I/AAAAAAAAAzY/cBIvXWntDCs/s16-no/facebook.gif
https://lh3.googleusercontent.com/-Wlm1tXaG94M/UtkdjGjebjI/AAAAAAAAA1I/404c-8igQc4/s16-no/twitter.gif
https://lh6.googleusercontent.com/-U7OB5Zx0BdI/UtkdgoAHctI/AAAAAAAAA0I/FZDlm78vBts/s16-no/linkedin.gif
https://lh3.googleusercontent.com/-Vpev-MbYvaI/UtkilFK6N0I/AAAAAAAAA2Q/ia4V855DesM/s16-no/soundcloud-orange_white_16-94fc761.png


HTML CODE "TEMPLATE"

<a href="" title=""><img src="https://lh4.googleusercontent.com/-G5OciLFJTtU/UtkdedDSq5I/AAAAAAAAAzY/cBIvXWntDCs/s16-no/facebook.gif" /></a>

<a href="" title=""><img src="https://lh3.googleusercontent.com/-Wlm1tXaG94M/UtkdjGjebjI/AAAAAAAAA1I/404c-8igQc4/s16-no/twitter.gif" /></a>

<a href="" title=""><img src="https://lh3.googleusercontent.com/-Vpev-MbYvaI/UtkilFK6N0I/AAAAAAAAA2Q/ia4V855DesM/s16-no/soundcloud-orange_white_16-94fc761.png" /></a>

<a href="" title=""><img src="https://lh6.googleusercontent.com/-U7OB5Zx0BdI/UtkdgoAHctI/AAAAAAAAA0I/FZDlm78vBts/s16-no/linkedin.gif" /></a>



EXAMPLE

<a href="https://www.facebook.com/nickleus.artist" title="Nickleus on Facebook"><img src="https://lh4.googleusercontent.com/-G5OciLFJTtU/UtkdedDSq5I/AAAAAAAAAzY/cBIvXWntDCs/s16-no/facebook.gif" /></a>
 

<a href="https://twitter.com/nickleus" title="Nickleus on Twitter"><img src="https://lh3.googleusercontent.com/-Wlm1tXaG94M/UtkdjGjebjI/AAAAAAAAA1I/404c-8igQc4/s16-no/twitter.gif" /></a>
 

<a href="https://soundcloud.com/nickleus" title="Nickleus on SoundCloud"><img src="https://lh3.googleusercontent.com/-Vpev-MbYvaI/UtkilFK6N0I/AAAAAAAAA2Q/ia4V855DesM/s16-no/soundcloud-orange_white_16-94fc761.png" /></a>
 

<a href="http://www.linkedin.com/in/nickleus" title="Nickleus on LinkedIn"><img src="https://lh6.googleusercontent.com/-U7OB5Zx0BdI/UtkdgoAHctI/AAAAAAAAA0I/FZDlm78vBts/s16-no/linkedin.gif" /></a>



20140114

[SOLVED] primefaces p:rowToggler and p:rowExpansion not working, not toggling

 i was near pulling my hair out when i couldn't get a simple table row toggle (DataTable row expansion) working. nothing was happening when i clicked on the toggle icon image. my colleague took a look at it and finally discovered the problem:
the p:rowToggler was inside an embedded p:column:

<p:dataTable...>
    <p:column...>
        <h:panelGrid...>
            <p:column...>
                <p:rowToggler />
                ...
            </p:column>

        </h:panelGrid>
    </p:column>
    ...
    <p:rowExpansion>
        <p:dataTable...>
            <p:column...>
            ...
            <p:column>
            ...
    <p:rowExpansion>
</p:dataTable>


the solution was easy--just remove the embedded p:column:

<p:dataTable...>
    <p:column...>
        <h:panelGrid...>
            <p:rowToggler />
            ...
        </h:panelGrid>
    </p:column>
    ...
    <p:rowExpansion>
        <p:dataTable...>
            <p:column...>
            ...
            <p:column>
            ...
    <p:rowExpansion>
</p:dataTable>

20140109

how to convert richfaces a4j:actionparam tags (that don't use "assignTo" attribute) to primefaces

during our migration from richfaces to primefaces, i stumbled across the richfaces tag a4j:actionparam (demo), e.g.:

<p:menuitem value="#{msg['label.showTrackAndTrace']}"
    ...
    actionListener="#{listTRQDataModel.fetchCurrentRow}">
    <a4j:actionparam name="row" value="{currentRowNo}" />
    <a4j:actionparam name="actionName" value="viewTNTListTrips" />
</p:menuitem>


luckily, since it doesn't use the assignTo attribute, the conversion of this tag to primefaces is pretty simple:

<p:menuitem value="#{msg['label.showTrackAndTrace']}"
    ...
    actionListener="#{listTRQDataModel.fetchCurrentRow}">
    <f:param name="row" value="{currentRowNo}" />
    <f:param name="actionName" value="viewTNTListTrips" />
</p:menuitem>


NOTE: f:param would have worked just as fine in richfaces, but for some reason, whoever coded the old version used a4j:actionparam instead (overkill and unnecessary).

see also the great f:param tutorial by mkyong.

20140103

[SOLVED] JBoss EAP6, JSF, Primefaces: "Unable to find matching navigation case with from-view-id..."

our company app is configured so that when a user clicks the login button from the front page, and index.html file redirects the user to the main page of the authenticated/authorized area of our app, index.xhmtl (rendered as index.jsf), but since the user hasn't logged in yet, they are shown the login page: login.xhml (rendered as login.jsf), BUT in the browser URI field it shows:
examples.com/index.jsf






my problem was trying to get a navigation rule working, so that if during the authentication/login process, if the app found out that the user needed to change his password, he would be redirected to /newPassword.xhtml

but it wasn't working and i was getting this error:
"Unable to find matching navigation case with from-view-id login.xhtml..."

i found out eventually that the from-view-id needed to be the page that was shown in the browser URI field, namely index.xhtml, and not login.xhtml.


here are the relevant code and configurations.

#############
/login.xhtml
#############

<p:commandButton value="Login" update="checkPassword" action="#{loginBean.login}" ... />


#############
LoginBean.java
#############




...
private String changePass = "newPassword";
...
public String login() {
    ...

    if(mustChangePassword) {
        ...
        return changePass;
    }
}

...


#############
WEB-INF/faces-config.xml
#############

<faces-config ... >

    <navigation-rule>
        <from-view-id>/index.xhtml</from-view-id>

        <navigation-case>
            <from-action>#{loginBean.login()}</from-action>
            <from-outcome>newPassword</from-outcome>
            <to-view-id>/newPassword.xhtml</to-view-id>
            <redirect />
        </navigation-case>
        ...
    </navigation-rule>

</faces-config>