The best place to *find* answers to programming/development questions, imo, however it's 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 again, a great reference for *finding* answers.

My Music (Nickleus)

20140606

[SOLVED] what is the @T() method and where is it documented? razor? c# .net?

today i finally figured out what the "T method" is :)
it's a part of Orchard CMS and is used for localization (translating strings to other languages/locales):

example:
<br/>
@T("Price"): <b>$@Model.Price</b><br />
@Model.Sku<br/>

from the orchard article "Building the Templates":
This is very plain rendering of the shape. Notice the use of the T method call to wrap the "Price" string literal. This enables localization of that text.

from the orchard article "Localizing the Orchard Application and Orchard Modules":
All strings in the Orchard application are output through a single T() method that can look up a translated string based on the default site culture.

from the orchard article "How Orchard Works":
Localization of the application and its modules is done by wrapping string resources in a call to the T method: <%: T("This string can be localized") %>


20140604

orchard asp.net c# mvc - how to include jquery-ui.min.css file

in your view file, e.g. myView.cshtml:

@{
Style.Include("jquery-ui.min.css").AtHead();
}



put the jquery-ui.min.css file in your MyModule/Styles/ folder:
MyModule/Styles/jquery-ui.min.css

the rendered HTML will look like this:
<link href="/Modules/MyModule/Styles/jquery-ui.min.css" rel="stylesheet" type="text/css" />


thanks to Adding jquery ui themes Question for help.


UPDATE 20140610

orchard has a jQuery module already, so all i actually had to do was this:
@{
  Style.Require("jQueryUI").AtHead();
  Script.Require("jQueryUI").AtHead();
}


thanks to Nicholas Mayne

20140523

windows 8.1 useful shortcuts under mac boot camp

windows 8.1 useful shortcuts under mac boot camp

for norwegian users (mac with norwegian keyboard keys)


##########
CHROME
##########

MOVE TO TAB LEFT/RIGHT: fn+ctrl+arrow up/down

##########
INPUT
##########

BACKSLASH ( \ ): (right)alt+(right)shift+/

##########
NAVIGATION
##########

LINE HOME/END: fn+arrow left/right

##########
SYSTEM ACTIONS
##########

LOCK SCREEN: fn+cmd+L
PRINT SCREEN: fn+shift+F11


...more to come as i find more useful shortcuts


20140522

[SOLVED] mac boot camp windows 8.1 can't select text, context menu pops up

i installed windows 8.1 through boot camp on my mac (mavericks) and was having trouble selecting text because when i would select something, then hold left finger in to be able to select more text by using my second finger, a context menu would pop up right away when i tried expanding the selected text by moving my second finger.

i finally figured out how to configure the keyboard settings through boot camp so that text selection and expansion works as described above:

1. open "boot camp control panel" in windows


2. select the "trackpad" tab


configure it as shown in the image above:
One Finger > Tap to click: unchecked
One Finger > Secondary clickchecked > choose either Bottom right corner or Bottom left corner
Two Fingers > Secondary clickunchecked

click Apply or OK

20140516

mac boot camp install windows 8 - additional important info/steps

i originally tried installing windows 8.1 on my mac macbook pro osx mavericks and thought that a 32GB partition would be large enough, but after installing, there was only like 4GB left, os i started over and made the partition 80GB instead (i am going to install visual studio + some other large programs).

when boot camp loads the window install, i scrolled down to the partition i made while in boot camp in mac, selected it and clicked Next:

then i got this error message:
windows can't be installed on drive 0 partition 4


so i clicked the Format link (see screenshot above), and was warned that it was about to format the drive (this is normal)


click Next again:

then the installation proceeded as normal:

[SOLVED] gimp mac can't export png - saving failed, error while saving, could not save image

i installed gimp on mac and tried exporting an image to png, but got this error:
Saving '/Users/me/Documents/nick-cv-img2.png' failed:

Error while saving '/Users/me/Documents/nick-cv-img2.png'. Could not save image.

the solution was simple:

https://bugs.archlinux.org/task/35363#comment110197

Menu > Image > Mode > Convert to Color Profile ...

Then just click "Convert" to convert it to "RGB workspace (sRGB built-in)"

Now exporting to PNG just works flawlessly.

thanks to Felix Yan (felixonmars)


20140505

mac - mule studio - where is maven home?

i'm testing out mule studio and got a warning/error about maven, that it needed to be installed/configured, so to find out where the maven home folder was, i ran this in Terminal:

mvn -version

which returned the following:
...
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)

Maven home: /usr/local/Cellar/maven/3.2.1/libexec
...

i had previously installed maven like this:

brew install maven

20140416

jboss 8 wildfly: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal

noticed this warning in my eclipse console when i started up jboss 8:

09:56:37,832 WARN  [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011600: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal


the libaio-dev library made the warning go away (ubuntu 13.04--yeah, still haven't upgraded):
sudo apt-get install libaio-dev


NIO means New I/O:
"a collection of Java programming language APIs that offer features for intensive I/O operations"

but why would jboss want me to install linux libs instead of "pure Java NIO"?

"The Java NIO journal gives great performance, but If you are running HornetQ using Linux Kernel 2.6 or later, we highly recommend you use the AIO journal for the very best persistence performance."

http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/persistence.html#installing-aio


"Using the operating system's own asynchronous I/O provides the best possible performance and scalability."
(Exploiting HornetQ's Support of Linux's Native Asynchronous I/O)


see also Java.nio vs Java.io

20140409

jboss 8 wildfly startup errors (WARN), jrebel 5.5.2 and how to debug/resolve: Failed to define class X, Failed to link X, NoClassDefFoundError, ClassNotFoundException

at work we're in the process of migrating from jboss 7 to 8 (wildfly/undertow) and i've had trouble starting the server when "JRebel agent" is enabled (v5.5.2). i get tons of WARN msgs like this:

15:08:21,372 WARN  [org.jboss.modules] (MSC service thread 1-8) Failed to define class net.sourceforge.barbecue.BarcodePortlet in Module "deployment.myApp.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link net/sourceforge/barbecue/BarcodePortlet (Module "deployment.myApp.ear:main" from Service Module Loader)
...
    Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet
...
    Caused by: java.lang.ClassNotFoundException: javax.portlet.GenericPortlet from [Module "deployment.takecargo.ear:main" from Service Module Loader]



HOW TO DEBUG

using the above WARN as an example, open a java file in your project and write something like this:
BarcodePortlet a = null;

save

ctrl+shift+o

if it resolves (adds an import line), then you have a library somewhere in your project that has that class file.

put the cursor on the class name, BarcodePortlet, then hit f3 to find the jar library, e.g.:
barbecue-1.5-alpha2.jar

in eclipse project settings:
"Java Build Path" > "Libraries" (tab) > select "barbecue-1.5-alpha2.jar" and hit "Remove" > "OK"

if you get errors in the "Markers" tab, under "Java Problems", then you need the library.
if you don't get any errors, then search your project in *.java and *.xml files to see if the class or package is referenced there. if you still don't find anything then you *probably* don't need it and can delete it from your project.

in my case, some classes were using "barbecue-1.5-alpha2.jar", so then we look at the next related stack trace element in the output console in eclipse:

Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet


there wasn't any module in the jboss wildfly modules folders for "javax/portlet":

<wildfly-8.0.0.Final>/modules/system/layers/base/javax


so i needed to find a jar library, by googling, that has the class "javax.portlet.GenericPortlet", e.g. here:
http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar

i added "portlet-api-2.0.jar" to my eclipse project's "lib" folder (or wherever you place your jars to be bundled in your ear)

refreshed the "lib" folder in eclipse

added the jar to the "Libraries" tab:
"Java Build Path" > "Libraries" (tab) > "Add JARs..." > selected "portlet-api-2.0.jar" from the "lib" folder > "OK"

the project rebuilds automatically and no errors occurred from adding the jar, so we're good.

if you rebuild your project and start up wildfly, then that "WARN" should be gone from the output.


20140403

[SOLVED] sahi (OS v4.4) "did not complete in 150"

i upgraded from sahi v3.5 to v4.4 and when i ran one of my scripts, sahi would hang after logging into the application i'm testing, and after waiting a while, it would finally return this error message:
"did not complete in 150"

i had stumbled across something similar to this before and had documented it here: sahi how to test gmail

that gave me some clues about what to do to fix it:
1. make sure all the https sites in SSL Manager were displayed with a green checkmark, instead of a red dot.

in my case, "localhost" had a red dot, but when i clicked on "localhost", there was no way to accept the self-signed SSL certificate permanently--i only saw this in the iframe:

localhost uses an invalid security certificate. The certificate is not trusted because it is self-signed. (Error code: sec_error_ca_cert_invalid)

so i had to open a new browser tab at this address:
https://localhost

then i could accept the certificate.

2. then, as an educated trial-and-error guess attempt, i found out i needed this line, in userdata.properties, to fix it entirely:

xhr.wait_ready_states=2

20140402

[SOLVED] sahi _setSelected not working with primefaces 4, but works with richfaces 3. workaround

back when we were using richfaces 3, this code worked fine:
_setSelected(_select("myForm:ChrgTrsTbl:0:price_chargeCode_input"), "CustClearance");

but it doesn't seem to work with primefaces 4. this, however, seems to work fine:

_click(_listItem("CustClearance"));


20140331

sahi, suggestion: "_wait(maxTime, condition)" with "AND" functionality, not just "OR" -- stop execution if "condition" returns false

i wish there was an additional "_wait(maxTime, condition)" function that would stop execution if condition returns false.

as of now, it seems as if "wait + condition" continues execution no matter the outcome of "condition", which makes it an "OR" test, but my suggestion would be for an "AND" test, i.e.:
wait, up until maxTime is reached, and if condition is still false, then stop execution.

i want this because of network/server response timing issues, specifically related to ajax operations.

UPDATE
i just posted this as a discussion in the sahi forums:
suggestion for _wait: stop execution if condition returns false

UPDATE, WORKAROUND
to achieve the same thing today, it looks like you'd have to code it like this:
_wait(10000, _assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn"))));
_assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn")));

and this gives the same functionality, but with less code, but also may look potentially confusing:
_wait(10000, _isVisible(_link("detailsForm:saveAgreementBtn")));
_assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn")));

20140321

[SOLVED] sahi, primefaces: p:dataTable no rendered table tag id

i'm updating our sahi test scripts for our new primefaces frontend and ran into a difficulty when trying to select a specific table row cell.

this page gives a hint as to how to select specific table cells:
http://sahi.co.in/docs/faq/get-cell-data.html

using this format:
_cell(_table("<table_identifier>"), x-1, y-1)


but the problem is that when a primefaces p:dataTable gets rendered to HTML, the table is enclosed in a div tag, and that div tag gets the id value set in the p:dataTable code, and the actual table tag doesn't have an id.

i solved my problem like this:
_cell(_table(1, _in(_div("selectMember:selectMemberTable"))), 1, 1)

here i specify the *second* table (there's a table in the header too), which is the actual dataTable table (0-based indexing, so value "1").

however, from what i can see, the sahi documentation is confusing concerning "x" and "y", if you interpret "x" to mean column (left<->right position), like i do.

"...1, 1)", in reality, means "row 2 (x), column 2 (y)" (0-based indexing, so "1, 1")

------------

as a side note, i found this sahi script code useful/interesting too:
_table(0, _in(_div("selectMember:selectMemberTable"))).rows[0].style='background-color:red'

which changes the background color of the first row of the first table to red.

sahi, primefaces: "ReferenceError: PrimeFaces is not defined". solution: just rerun the sahi script

sometimes when i run a sahi script to test our primefaces ui, the script times out with the following error:

ReferenceError: PrimeFaces is not defined (http://localhost/pages/listTransportAgreements.jsf:278)

when i rerun the script, it usually goes away, so i'm not quite sure why it works sometimes and other times it doesn't.

20140320

primefaces p:commandLink oncomplete attribute referencing non-existent ID was messing up table filter and sort functions


i had this primefaces delete-icon code in a table row:
<p:commandLink id="deletelink" title="#{msg['label.delete']}"
    action="#{ta_mappingObject.setCurrentItemAndPanelToShow(agreement, 'deleteTA')}"
    rendered="#{!ta_mappingObject.createFromRequestDetails and userMenuBean.canEditAgreement()}"
    oncomplete="PF('confDeleteAgreement').show();">
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />
</p:commandLink>


and stuff on the page like filtering and sorting wasn't working, so i figured out that because that link was referencing a dialog ID that didn't exist, it was messing up the whole page, so i changed it to this:
<p:commandLink id="deletelink" title="#{msg['label.delete']}"
    action="#{ta_mappingObject.setCurrentItemAndPanelToShow(agreement, 'deleteTA')}"
    rendered="#{!ta_mappingObject.createFromRequestDetails and userMenuBean.canEditAgreement()}"
    oncomplete="PF('andIdThatExists').show();">
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />
</p:commandLink>



and everything started working again.

20140319

primefaces - show p:modalPanel from java backing bean / controller class and update specific id or collection of id strings

here's how you show a p:modalPanel from a java backing bean call:
org.primefaces.context.RequestContext.getCurrentInstance().execute("myModalPanelWV.show()");

"modalPanelWV" is the widgetVar value, e.g.:
<p:modalPanel id="myModalPanel" widgetVar="myModalPanelWV" ...

update an id from backing bean:
org.primefaces.context.RequestContext.getCurrentInstance().update("growl");

OR update a Collection<String> of IDs:
org.primefaces.context.RequestContext.getCurrentInstance().update(myCollectionOfStringIds);



20140317

[SOLVED] jboss 7 jdk 6 startup in debug opens FileNotFoundException.class: Suspended (exception FileNotFoundException) jdk/jre/lib/zi/UTC

i started to encounter something weird when i was starting up my local jboss 7 instance in debug mode (using jdk 6):
FileNotFoundException.class would open in the eclipse debugger

with this error message in the console:
Suspended (exception FileNotFoundException) ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/UTC


i figured out that "zi" means "ZoneInfoFile"

i can see that there's a UTC file in zi/Etc/:
~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/Etc/UTC

SOLUTION

all i had to do to fix this was copy the file to the expected folder:

cp ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/Etc/UTC ~/workspaceEclipse/tcTrunk/jdk/jre/lib/zi/




20140311

[SOLVED] sahi include script does not exist

today's problem started out like this:

### verify_any_transport_requests.sah ###

_include("functions/common_functions.sah");
_include("functions/common_vars.sah");
_include("functions/transport_request_functions.sah");

tc_login($buyer_user_unil, $buyer_pass_unil);

listAllTRQsUnfiltered();

tc_logout();


###########################

every time i'd try running this script i'd get the following error in the sahi log:
ERROR
Script: /home/nick/workspaceEclipse/tcTrunk/testing/functional_testing/stage_1/sahi/functions/transport_request_functions.sah does not exist.



since i knew that the include file indeed did exist, i figured it had to be something wrong with the code. then i saw this code in transport_request_functions.sah:

_link("filtermenubarForm:filterBtn");

it should have been:
_click(_link("filtermenubarForm:filterBtn"));

it seems like that was the problem.

20140304

web.xml jsf setting to treat empty string values in form submit as null so they're not saved in the database, but also comply with notnull constraints

the following setting in web.xml is quite useful:

...
<context-param>
    <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
    <param-value>true</param-value>
</context-param>

...

which means that when a user submits a form then no empty fields of type string will get saved in the database. having it set to true will also force compliance with @NotNull constraints, with regards to validation.

on a related note, there's a jboss startup setting called org.apache.el.parser.COERCE_TO_ZERO, which when set to true (default) will turn number field form values of "" (empty string) and null into the number 0 (zero) before the form is submitted, e.g.:

-Dorg.apache.el.parser.COERCE_TO_ZERO=true

setting it to false would mean that empty strings and null values for number fields in forms will be submitted "as is" and NOT get converted to the number 0.

20140303

when and why facelets.DEVELOPMENT was replaced by javax.faces.PROJECT_STAGE

was trying today to figure out when and why facelets.DEVELOPMENT was replaced by javax.faces.PROJECT_STAGE and i think i finally found the answer in the following article by IBM:

Changes to XHTML and Java sources of a JSF 2.0 web project not refreshed on publish to the WAS V8 server

facelets.DEVELOPMENT was used in JSF 1.2 (Facelets 1.x)
web.xml:
...
<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
</context-param>
...


javax.faces.PROJECT_STAGE has been used since JSF 2 (Facelets 2.0 VDL, Facelets 2.0 API [specifically javax.faces.application.ProjectStage])(see "*** NOTE" below).

web.xml:
...
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Development</param-value>
</context-param>
...




*** NOTE
"
In JavaServer Faces (JSF) 2.0, Facelets is the default view declaration language (VDL) instead of JavaServer Pages (JSP). With Facelets, you don’t need to configure a view handler as you used to do in JSF 1.2. Facelets is a JSF-centric view technology.
"


20140210

cascading primefaces "p:contextMenu"s?

i have a p:contextMenu for a p:dataTable, but inside the table is a p:rowExpansion which contains a p:dataTable, with a p:contextMenu for that inner datatable, but the "outer" p:contextMenu seems to be overriding the "inner" p:contextMenu.

<p:contextMenu for="tripTable">
    <p:menuitem value="context menu item for main dataTable" />
</p:contextMenu>

<p:dataTable id="tripTable" rowKey="#{listObj.id}"
    selection="#{
listTrqsDataModel.tripBean.currentItem}"
    selectionMode="single"
    value="#{
listTrqsDataModel.tripBean.dataList}" var="listObj"
    rows="#{listTrqsDataModel.tripBean.noOfItemsListedPrPage}">
    <p:column>
        <p:rowToggler />
    </p:column>
    <p:column>
        ...           
    </p:column>
    <p:rowExpansion>
        <p:contextMenu for="tripTRQTable">
            <p:menuitem value="context menu item for rowExpansion dataTable" />
        </p:contextMenu>
        <p:dataTable id="tripTRQTable" ... >
            <p:column>
                ...
            </p:column>
        </p:dataTable>
    </p:rowExpansion>
</p:dataTable>



not sure how to make this work... anyone?


UPDATE 20140210

it seems like a workaround for this is to remove the "for" attribute in the inner contextMenu--making its scope for the whole page, while the outer contextMenu is still working for the outer dataTable, i.e.:

    <p:rowExpansion>
        <p:contextMenu for="tripTRQTable">
            <p:menuitem value="context menu item for rowExpansion dataTable" />
        </p:contextMenu>
        <p:dataTable id="tripTRQTable" ... >
            <p:column>
                ...
            </p:column>
        </p:dataTable>



UPDATE 20140217

doesn't look like the workaround is very reliable. once the "inner" context menu is enabled, the "outer" doesn't show. looks like i'll have to use a button/icon instead of context menus, for now...


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://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRlMnfmunAhm6QemEvSvMYeZQf0S0YOflf0dyN1sH1AjIRV10OGzobKBxzI7IB2CMLzrHNfMLbXAiYop4VbboDjMhI46vz_YIatkcpVa8xJmP13tOuyI4vXiuxhiOMz_sE8k4YgSaOeI4/s16-no/facebook.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbIIXgMQ3zjkjRgezKky-zVWsaN-O6LnxiOXmlgBkYXqyTERYtNB6C8WPwym_iNl5MhMKA-_2YsyIQRv8N7xlqZy2YNbn_-eIXwLqJgNuLDwqaPWuusdacTD6JK4Pv1txnI8y5WtYI-7A/s16-no/twitter.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Dq6idjMTWMQzHDtoxtHDMpghtqr291Vv0-QVTilwLa1dmYvv5DQj4IEas2lHRw76asqMug0G9M84LE_B3ga9W7yVM5v_n22AWE5FSfNSsY9VVHrJaMUBnhPREOU-uzUyPXVMUpf1Twc/s16-no/linkedin.gif
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg52RjjN01eSPujkQM3Q-x8El2cDCz0e8eSDXeJISRgcrdIvouGOZveoGO52ZFFbdyuJ7lxOJFTlNOlPz-M_2UYtG4BAdmpABw4gzBCt4Al9onFyRxhaexbvSXQSKfmDIZoSXVBYHuyecc/s16-no/soundcloud-orange_white_16-94fc761.png


HTML CODE "TEMPLATE"

<a href="" title=""><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRlMnfmunAhm6QemEvSvMYeZQf0S0YOflf0dyN1sH1AjIRV10OGzobKBxzI7IB2CMLzrHNfMLbXAiYop4VbboDjMhI46vz_YIatkcpVa8xJmP13tOuyI4vXiuxhiOMz_sE8k4YgSaOeI4/s16-no/facebook.gif" /></a>

<a href="" title=""><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbIIXgMQ3zjkjRgezKky-zVWsaN-O6LnxiOXmlgBkYXqyTERYtNB6C8WPwym_iNl5MhMKA-_2YsyIQRv8N7xlqZy2YNbn_-eIXwLqJgNuLDwqaPWuusdacTD6JK4Pv1txnI8y5WtYI-7A/s16-no/twitter.gif" /></a>

<a href="" title=""><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg52RjjN01eSPujkQM3Q-x8El2cDCz0e8eSDXeJISRgcrdIvouGOZveoGO52ZFFbdyuJ7lxOJFTlNOlPz-M_2UYtG4BAdmpABw4gzBCt4Al9onFyRxhaexbvSXQSKfmDIZoSXVBYHuyecc/s16-no/soundcloud-orange_white_16-94fc761.png" /></a>

<a href="" title=""><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Dq6idjMTWMQzHDtoxtHDMpghtqr291Vv0-QVTilwLa1dmYvv5DQj4IEas2lHRw76asqMug0G9M84LE_B3ga9W7yVM5v_n22AWE5FSfNSsY9VVHrJaMUBnhPREOU-uzUyPXVMUpf1Twc/s16-no/linkedin.gif" /></a>



EXAMPLE

<a href="https://www.facebook.com/nickleus.artist" title="Nickleus on Facebook"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRlMnfmunAhm6QemEvSvMYeZQf0S0YOflf0dyN1sH1AjIRV10OGzobKBxzI7IB2CMLzrHNfMLbXAiYop4VbboDjMhI46vz_YIatkcpVa8xJmP13tOuyI4vXiuxhiOMz_sE8k4YgSaOeI4/s16-no/facebook.gif" /></a>
 

<a href="https://twitter.com/nickleus" title="Nickleus on Twitter"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbIIXgMQ3zjkjRgezKky-zVWsaN-O6LnxiOXmlgBkYXqyTERYtNB6C8WPwym_iNl5MhMKA-_2YsyIQRv8N7xlqZy2YNbn_-eIXwLqJgNuLDwqaPWuusdacTD6JK4Pv1txnI8y5WtYI-7A/s16-no/twitter.gif" /></a>
 

<a href="https://soundcloud.com/nickleus" title="Nickleus on SoundCloud"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg52RjjN01eSPujkQM3Q-x8El2cDCz0e8eSDXeJISRgcrdIvouGOZveoGO52ZFFbdyuJ7lxOJFTlNOlPz-M_2UYtG4BAdmpABw4gzBCt4Al9onFyRxhaexbvSXQSKfmDIZoSXVBYHuyecc/s16-no/soundcloud-orange_white_16-94fc761.png" /></a>
 

<a href="http://www.linkedin.com/in/nickleus" title="Nickleus on LinkedIn"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Dq6idjMTWMQzHDtoxtHDMpghtqr291Vv0-QVTilwLa1dmYvv5DQj4IEas2lHRw76asqMug0G9M84LE_B3ga9W7yVM5v_n22AWE5FSfNSsY9VVHrJaMUBnhPREOU-uzUyPXVMUpf1Twc/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>