Thursday, August 26, 2010

Hidden Gnome Panels in Fedora 13

I recently installed the new Fedora.

I right clicked my top panel and chose "Add Panel." Firefox, which had been maximized shrank about the size of a panel on the right side of the screen.

Just for grins I right clicked and added another panel. Firefox shrank on the left side.

I added "Show Desktop" to the top panel and clicked it. Panels appeared on each side of the desktop. I right clicked and deleted them.

Sunday, August 8, 2010

Debugging Grails Apps in Eclipse

This is pretty simple to accomplish. Simply run "grails-debug run-app" instead of "grails run-app".

However, be sure to start the debugger in Eclipse! The app doesn't finish starting up until the debugger is attached. I spent some time wondering what was taking so long before putting that together.

Thursday, July 29, 2010

Grails LinkageError for SAXParseException

I ran "grails run-app" for the app that I've been working on and was greeted with the following :

java.lang.LinkageError: loader constraint violation: loader (instance of <bootlo
ader>) previously initiated loading for a different type with name "org/xml/sax/
SAXParseException"
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:4
6)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.gr
oovy:127)
at grails.util.PluginBuildSettings.getPluginInfos(PluginBuildSettings.gr
oovy)
at grails.util.PluginBuildSettings$getPluginInfos.callCurrent(Unknown So
urce)
at grails.util.PluginBuildSettings.getPluginInfo(PluginBuildSettings.gro
ovy:164)
at grails.util.PluginBuildSettings$getPluginInfo.callCurrent(Unknown Sou
rce)
at grails.util.PluginBuildSettings.getPluginInfoForSource(PluginBuildSet
tings.groovy:202)
at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTran
sformationVisitor.java:303)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(Compil
ationUnit.java:832)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(Compilat
ionUnit.java:519)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(Co
mpilationUnit.java:495)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.j
ava:472)
at _GrailsEvents_groovy.run(_GrailsEvents_groovy:54)
at _GrailsEvents_groovy$run.call(Unknown Source)
at _GrailsClean_groovy$run.call(Unknown Source)
at _GrailsClean_groovy.run(_GrailsClean_groovy:29)
at _GrailsClean_groovy$run.call(Unknown Source)
$
at _GrailsPlugins_groovy.run(_GrailsPlugins_groovy:32)
at _GrailsPlugins_groovy$run.call(Unknown Source)
at _GrailsRun_groovy$run.call(Unknown Source)
at _GrailsRun_groovy.run(_GrailsRun_groovy:31)
at _GrailsRun_groovy$run.call(Unknown Source)
at RunApp.run(RunApp.groovy:25)
at RunApp$run.call(Unknown Source)
at gant.Gant.prepareTargets(Gant.groovy:606)
Error loading event script from file [PATH_TO_GRAILS\.grails
\1.3.1\projects\PROJECT_NAME\plugins\code-coverage-1.1.8\scripts\_Events.gr
oovy] loader constraint violation: loader (instance of <bootloader>) previously
initiated loading for a different type with name "org/xml/sax/SAXParseException"

Grails had done some sort of update that I didn't pay a lot of attention to. I wondered if this had something to do with the update and will have to find out what went on later.

I found an entry on the Grails Jira dealing with the problem of xerces and Java 6. The suggested solution was to remove xml-apis-1.0.2.b2.jar.

I ran :
find . -name "*xml*"
find . -name "*api*"
from my project directory, my .grails directory and my .ivy directory. I found xml-apis-1.3.04.jar in my .ivy directory.

I ran jarscan against my project directory, .grails directory and .ivy directory and found 0 hits for SAXParseException.

I added :

    inherits("global") {
excludes "xml-apis"
}

To my BuildConfig.groovy file just below dependencies. The app ran.

Saturday, July 17, 2010

Changing form actions with jQuery

I'm working on a simple cms in a side project. Naturally I have a page where administrators can create new web pages.

I'm using the jQuery version of TinyMCE for editing. It is worth a look if you need wysiwyg textarea editing.

I wanted to give my client the ability to preview the page before saving it. The solution was simple: change the form's action in the click handler.

The implementation eluded me for a while; although, it was completely obvious:
                $("#preview").click(function(event){
event.preventDefault();
$("#create_page_form").attr( "action", "/preview_page" );
$("#create_page_form").submit();
});

$("#submit").click(function(event){
event.preventDefault();
$("#create_page_form").attr( "action", "/create_page" );
$("#create_page_form").submit();
});


"#preview" and "#submit" are the ids of two links but could be buttons.

I thought I would post it in the event that anyone else Google's "jQuery change form action."

Tuesday, July 13, 2010

SHIFT : q

No matter what text editor I'm in I can't help but typing "SHIFT :" followed by "q".

Does that happen to anyone else?

Friday, June 25, 2010

groovy.lang.MissingMethodException: No signature of method: static .list() is applicable for argument types:

I've started using Grails recently. Its really nice. Productive, easy to get up and running, etc.

My first stab at testing a Controller produced :
groovy.lang.MissingMethodException: No signature of method: static dbtestapp.Team.list() is applicable for argument types:
(org.codehaus.groovy.grails.web.taglib.GroovyPageAttributes) values: [[max:10]]
Possible solutions: is(java.lang.Object), wait(), wait(long), print(java.lang.Object), split(groovy.lang.Closure), use([Ljava.lang.Object;)
at dbtestapp.TeamController$_closure2.doCall
A little weird. list() is a dynamic method and should be on the object.

Its a known issue in the Grails Jira. The solution is to stick the test inside the "integration" package.

Monday, June 14, 2010

Ubuntu slow internet connection

I'm running Ubuntu Karmic Koala on a Dell Latitude D620. I've had a pretty tough time with wireless. Broadcom's support for Linux is terrible.

Yesterday my browsers became ridiculously slow. Running "ping" or "host" from Konsole showed that the problem wasn't networking.

I found a few posts suggesting that I disable IPv6 and reboot. I created a file "/etc/modprobe.d/bad_list", added "alias net-pf-10 off" and rebooted. Much better.

I was on another machine and don't have links to the actual posts from Linux forums and Ubuntu's forums. My apologies to the solution's authors.