error message

Fixing the Scala error: java.lang.NoSuchMethodError: scala.Product.$init$

As a note to self, when you see a Scala error message that looks like this:

java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

it probably means that you have a mismatch in the Scala versions you’re using in your project. For instance, I just tried to use a library I compiled with Scala 2.12 with Spark, which was compiled with Scala 2.11, and I got that error message. In this case I was able to resolve the problem by recompiling my library with Scala 2.11.

Solution to sed error message: “\1 not defined in the RE”

As a quick sed solution, if you get this “\1 not defined in the RE” error message when running a sed script:

$ sed -f sed.cmds c4.in.html > c4.out.html
sed: 2: sed.cmds: \1 not defined in the RE

the problem probably isn’t too bad. For me I usually get the error message when I forget to “escape” parentheses that I use in my search pattern. I usually write this, which is an error:

s/foo(.*)bar/\1/

when I need to write that sed command like this:

How to handle Scala Play Framework 2 404 and 500 errors

To handle 404 and 500 errors in the Scala Play Framework 2, you need to create a Global.scala object in your main app directory. The object should extend GlobalSettings, and override the necessary methods.

The following example Play Framework Global object, saved as app/Global.scala, demonstrates this:

The “Unfortunately your Android app has stopped” error message

Android error FAQ: Help, I'm developing an Android app, and I'm getting a "Unfortunately your Android app has stopped error message"; how do I fix it?

If you're getting an Android error message that looks like this:

"Unfortunately your Android app has stopped error message"

It's probably because you forgot to put a new Activity in the AndroidManifest.xml file (or at least that's been the #1 cause of this error message in my experience).

PHP cannot redeclare function error message

PHP function FAQ: Help, I'm getting a PHP cannot redeclare function error message, how do I fix it?

Assuming you don't really have two PHP functions defined with the same name, this "cannot redeclare" function error message is usually caused by using the require or include functions to include the same common file (and therefore its functions) more than once.

JSF error - Why your JSF error message might not be displayed

Using JavaServer Faces (JSF), if you can't see the error message (FacesError) you're creating in your controller/handler when you forward to a new JSP (JavaServer Page), the problem may be that you have a "redirect" tag in your faces-config.xml file.

For example, the following JSF faces-config.xml example shows the problem, where I do have a redirect tag when I bounce control back to the login.jsp page:

JOptionPane showInputDialog examples

I thought I'd share a collection of JOptionPane showInputDialog examples today. I'll start with the easiest example first, then try to add a little complexity as we go along.

First up, here's a simple JOptionPane showInputDialog example where I display a dialog that prompts a user to enter their name: