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)


[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):

@T("Price"): <b>$@Model.Price</b><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") %>


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

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


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

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:

thanks to Nicholas Mayne


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)


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


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


LINE HOME/END: fn+arrow left/right


PRINT SCREEN: fn+shift+F11

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


[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


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:

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)


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


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  [] (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."

"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


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]


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



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.:

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":


so i needed to find a jar library, by googling, that has the class "javax.portlet.GenericPortlet", e.g. here:

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.


[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:

then i could accept the certificate.

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



[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:



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.

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

to achieve the same thing today, it looks like you'd have to code it like this:
_wait(10000, _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")));


[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:

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.


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()}"
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />

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()}"
    <h:graphicImage value="/images/icons/delete.gif" style="border:0" />

and everything started working again.


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:

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

update an id from backing bean:

OR update a Collection<String> of IDs:


[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/:


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/


[SOLVED] sahi include script does not exist

today's problem started out like this:

### verify_any_transport_requests.sah ###


tc_login($buyer_user_unil, $buyer_pass_unil);




every time i'd try running this script i'd get the following error in the sahi log:
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:


it should have been:

it seems like that was the problem.


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:



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.:


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.


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)

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).


*** 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.


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:dataTable id="tripTable" rowKey="#{}"
listTrqsDataModel.tripBean.dataList}" var="listObj"
        <p:rowToggler />
        <p:contextMenu for="tripTRQTable">
            <p:menuitem value="context menu item for rowExpansion dataTable" />
        <p:dataTable id="tripTRQTable" ... >

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:contextMenu for="tripTRQTable">
            <p:menuitem value="context menu item for rowExpansion dataTable" />
        <p:dataTable id="tripTRQTable" ... >

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...


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:

My review on amazon.


[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"


[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":

    update=":growl :panelContent" immediate="true">
    <h:graphicImage value="/images/search.gif" style="border:0" />

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":

direct link to icon pack:

source of the soundcloud logo:

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:


<a href="" title=""><img src="" /></a>

<a href="" title=""><img src="" /></a>

<a href="" title=""><img src="" /></a>

<a href="" title=""><img src="" /></a>


<a href="" title="Nickleus on Facebook"><img src="" /></a>

<a href="" title="Nickleus on Twitter"><img src="" /></a>

<a href="" title="Nickleus on SoundCloud"><img src="" /></a>

<a href="" title="Nickleus on LinkedIn"><img src="" /></a>


[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:rowToggler />


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

            <p:rowToggler />


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']}"
    <a4j:actionparam name="row" value="{currentRowNo}" />
    <a4j:actionparam name="actionName" value="viewTNTListTrips" />

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']}"
    <f:param name="row" value="{currentRowNo}" />
    <f:param name="actionName" value="viewTNTListTrips" />

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.


[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:

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.


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


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

    if(mustChangePassword) {
        return changePass;



<faces-config ... >


            <redirect />