Seam is an excellent framework. Hopefully having its' model implemented as part of the JEE spec will push adoption!
Thursday, November 19, 2009
Infoq Interview with Gavin King about Weld anc CDI
Infoq has a nice interview with Gavin King about Weld and CDI.
Tuesday, November 10, 2009
Django flatpages, templatetags and dynamic menus
One thing that Django's flatpages app is missing is a dynamic menu.
Coming from a Java background I am used to a huge user base and lots of open source code. The Django user base continues to meet my expectations.
I found this post detailing the creation of such a menu tag. I hadn't explored custom tags before anyway so I looked forward to trying it out.
I followed the instructions and got the following error :
TemplateSyntaxError at /menu/
'flatpage_menu' is not a valid tag library: Could not load template library from django.templatetags.flatpage_menu, No module named flatpage_menu
Request Method: GET
Request URL: http://127.0.0.1:8000/menu/
Exception Type: TemplateSyntaxError
Exception Value:
'flatpage_menu' is not a valid tag library: Could not load template library from django.templatetags.flatpage_menu, No module named flatpage_menu
Exception Location: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/template/defaulttags.py in load, line 927
Python Executable: /Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.6.4
Python Path: ['/Users/jdavis/Documents/django_workspace/cantina76', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages']
The post was from last year. I was using the Django 1.1.1. I figured something had changed since his post.
I found a couple of references in Google Groups to this same example, but their suggestions didn't work for me.
The solution was to add my own app to INSTALLED_APPS and "from django import template" to the "flatpage_menu.py" file.
It worked fine after that.
Tuesday, September 22, 2009
The excellent Mr. Haki blog
My morning routine has changed recently. I check out Mr. Haki, fire up the Groovy console and run the latest example.
I have been seriously impressed with the work Mr. Haki is doing.
Even if nobody reads this post, I want to at least help his search rankings!
Wednesday, September 16, 2009
jRecruiter presentation at AJUG
Gunnar Hillert gave an excellent presentation on his jRecruiter project at AJUG last night.
I will soon be downloading jRecruiter to check it out in more depth. Gunnar mentioned that the Maven build is a little wonky at the moment. He said he would fix it in the next week or two.
He has a lot of really cool stuff in the app:
- Struts 2.1, which I have not used. I spent years using the Struts 1.* releases, but have been in the JSF camp for a while now.
- Twitter integration, which I've wanting to check out.
- GZip and minification.
Friday, September 11, 2009
"The processing instruction target matching "[xX][mM][lL]" is not allowed."
I often put the Xml I use for test cases inside of Groovy classes. This allows me to make use of multiline Strings.
Whitespace removed :
String inputXml = '''
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<records>
<record>
<recordid>833432</recordid>
<name>Lorem ipsum dolor</name>
<parentid>0</parentid>
<link>http://consectetueradipiscingelit</link>
<date>9/10/2009</date>
<description>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</description>
<category ID="48015"></category>
<category>In enim justo</category>
</record>
</records>
'''
I ran into this error today :
"The processing instruction target matching "[xX][mM][lL]" is not allowed."
I'm surprised I hadn't run into it before. The problem was that I had white space before the xml prolog.
There are two easy solutions :
- Remove the whitespace.
- Call "trim()" on the String.
String inputXml = '''<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<records>
<record>
<recordid>833432</recordid>
<name>Lorem ipsum dolor</name>
<parentid>0</parentid>
<link>http://consectetueradipiscingelit</link>
<date>9/10/2009</date>
<description>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</description>
<category ID="48015"></category>
<category>In enim justo</category>
</record>
</records>
trim() called :
String inputXml = '''
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<records>
<record>
<recordid>833432</recordid>
<name>Lorem ipsum dolor</name>
<parentid>0</parentid>
<link>http://consectetueradipiscingelit</link>
<date>9/10/2009</date>
<description>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</description>
<category ID="48015"></category>
<category>In enim justo</category>
</record>
</records>
'''.trim()
Thursday, August 27, 2009
app-engine-patch Database problems
I've been using app-engine-patch to get some Django stuff running on Google AppEngine.
Several times my admin password has been reset or invalidated. On a couple of occasions I recreated the admin user from the link on the default page. After styling the site this wasn't possible.
I added the "create_admin_user" entry from the generated myapp/urls.py to the root level urls.py and manually entered the url. That worked.
Unexpected Groovy return value
I like Groovy's multiline Strings. I use them all the time in my test cases. Usually I have a utility class that returns whatever content I need.
Yesterday I decided to do the whole test in Groovy. Inside my TestNG test case I had a method that returned some xml :
String createInputFile(){
return
'''
<xml><one>Hello</one><two>World!</two></xml>
'''
}
The output was null. Kind of silly of me. Adding a semicolon after the String didn't produce an output. Putting the opening quote on the same line as the return statement did.
I still don't miss semicolons though.
Subscribe to:
Posts (Atom)