JPublish and AJAX are finally happy together! DWR rulezzzz
Today I am very happy to announce that JPublish works beautifully with one of the best AJAX frameworks: DWR2.0.
DWR 2.0, a great milestone, a great achievement, congratulations to the DWR team.
Integrating JPublish with DWR was a long and winding road but I don't regret a second of development. It was also a nice game of expectation during the few releases of DWR, with every release I had to tweak something in my code or implement something new. It was challenging to see which will be Joe's next move and then tune my existing code for the new DWR release.
Because I started to integrate DWR when 2.0 was just a baby ;) I had to tweak, change and even to scrap completely my code until DWR RC2 came out. DWR support lists are a great help, highly recommended to any new DWR user.
Even though DWR2.0 is very fresh and there is already a roadmap for 2.1 ;) I do believe that my simple integration is stable and can be used.
To be able to test my code, I followed DWR's examples and here they are in action as JPublish-2 citizens :) JPublishDWR.flop.ca
As soon as I'll migrate my SVN repositories to a better place I'll open the access to the JPublishDWR sources including the related projects I also maintain, one of them being a refactored and very stable JPublish (2.0.12) (included in the examples).
If you want to use it and have a look at the current integration, please download the archive containing the JPublishDWR and all the required libraries (including the new JPublish2x).
For those of you already familiar with JPublish, to enable DWR in a JPublish application is extremely simple.
- modify your jpublish.xml file and include this snippet:
<module classname="ca.flop.jpublish.dwr.DWRModule">
<dwr-config-file>/WEB-INF/dwr-test.xml</dwr-config-file>
<dwr-path-prefix>/dwr</dwr-path-prefix>
<dwr-servlet-parameters>
<activeReverseAjaxEnabled>true</activeReverseAjaxEnabled>
<debug>false</debug>
</dwr-servlet-parameters>
</module>
- be sure you have the JPublishDWR-2.0.jar in your application's WEB-INF/lib folder
- start coding DWR AJAX.
By looking at the examples in the attached archive you'll learn easily to enable AJAX in your JPublish applications, here are few hints:
- in a template add the following key ingredients:
<script type='text/javascript' src='$request.ContextPath/dwr/engine.js'></script>
<script type='text/javascript' src='$request.ContextPath/dwr/util.js'></script>
- then in a page where you would like to use DWR, I am gonna use here one of the DWR examples (the asmg example), publish your java objects that you would like to use, in this case: Generator and EmailValidator
<script type="text/javascript" src='$request.ContextPath/dwr/interface/Generator.js'></script>
<script type="text/javascript" src='$request.ContextPath/dwr/interface/EmailValidator.js'></script>
- now you can easily use these objects:
<td>
<input type=text id="address" onkeypress="DWRUtil.onReturn(event, process)"
onblur="verifyAddress()"/>
</td>
To see the JPublish DWR's own asmg example follow this link: asmg, neat eh? :)
Next? Moving my SVN, implementing a super nice DWRAction for JPublish to allow you to invoke JPublish Actions through DWR, writing some DOCS and more JPublish specific examples, opening the sources for the JPublishDWR module, and more :)
Let me know if you're interested to use this implementation and I'll be glad to assist you.
Cheers,
-florin
DWR 2.0, a great milestone, a great achievement, congratulations to the DWR team.
Integrating JPublish with DWR was a long and winding road but I don't regret a second of development. It was also a nice game of expectation during the few releases of DWR, with every release I had to tweak something in my code or implement something new. It was challenging to see which will be Joe's next move and then tune my existing code for the new DWR release.
Because I started to integrate DWR when 2.0 was just a baby ;) I had to tweak, change and even to scrap completely my code until DWR RC2 came out. DWR support lists are a great help, highly recommended to any new DWR user.
Even though DWR2.0 is very fresh and there is already a roadmap for 2.1 ;) I do believe that my simple integration is stable and can be used.
To be able to test my code, I followed DWR's examples and here they are in action as JPublish-2 citizens :) JPublishDWR.flop.ca
As soon as I'll migrate my SVN repositories to a better place I'll open the access to the JPublishDWR sources including the related projects I also maintain, one of them being a refactored and very stable JPublish (2.0.12) (included in the examples).
If you want to use it and have a look at the current integration, please download the archive containing the JPublishDWR and all the required libraries (including the new JPublish2x).
For those of you already familiar with JPublish, to enable DWR in a JPublish application is extremely simple.
- modify your jpublish.xml file and include this snippet:
<module classname="ca.flop.jpublish.dwr.DWRModule">
<dwr-config-file>/WEB-INF/dwr-test.xml</dwr-config-file>
<dwr-path-prefix>/dwr</dwr-path-prefix>
<dwr-servlet-parameters>
<activeReverseAjaxEnabled>true</activeReverseAjaxEnabled>
<debug>false</debug>
</dwr-servlet-parameters>
</module>
- be sure you have the JPublishDWR-2.0.jar in your application's WEB-INF/lib folder
- start coding DWR AJAX.
By looking at the examples in the attached archive you'll learn easily to enable AJAX in your JPublish applications, here are few hints:
- in a template add the following key ingredients:
<script type='text/javascript' src='$request.ContextPath/dwr/engine.js'></script>
<script type='text/javascript' src='$request.ContextPath/dwr/util.js'></script>
- then in a page where you would like to use DWR, I am gonna use here one of the DWR examples (the asmg example), publish your java objects that you would like to use, in this case: Generator and EmailValidator
<script type="text/javascript" src='$request.ContextPath/dwr/interface/Generator.js'></script>
<script type="text/javascript" src='$request.ContextPath/dwr/interface/EmailValidator.js'></script>
- now you can easily use these objects:
<td>
<input type=text id="address" onkeypress="DWRUtil.onReturn(event, process)"
onblur="verifyAddress()"/>
</td>
To see the JPublish DWR's own asmg example follow this link: asmg, neat eh? :)
Next? Moving my SVN, implementing a super nice DWRAction for JPublish to allow you to invoke JPublish Actions through DWR, writing some DOCS and more JPublish specific examples, opening the sources for the JPublishDWR module, and more :)
Let me know if you're interested to use this implementation and I'll be glad to assist you.
Cheers,
-florin
When is the time to create an alias for the most used commands?
The
Here is a good way to run some stats:
$ history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}'| sort | uniq -c | sort -r
What do you think?
alias command allows you to create your own names or abbreviations for commands by performing string substitution on the command line according to your specifications. But how do you identify the commands you're using very often? Statistics! Well, sort of ;)Here is a good way to run some stats:
$ history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}'| sort | uniq -c | sort -r
What do you think?
Migrating from Thunderbird to Mail; the easiest way!
After a couple of years I finally switched to OSX at work as well. The computer is a G5 and is not as snappy as my MacIntel from home, but the machine is a reliable one.
No more twisting my fingers in trying to remember the keyboard shortcuts in IntelliJ for Windows :) one of my "favorite" shortcut being CTRL+Q on windows ... the equivalent of the Quit command on OSX, so I was *by my request* abandoning my current task every-time I was looking for fast Java docs. Yey, no more of that :)
At home I switched to Mail many moons ago and I am very happy with the default OSX mail client, however at work, as a Windows user I was still using Thunderbird (the best mail client for Windows, in my humble opinion) and now I wanted to import my huge mail archive into Mail.
Due to a fantastic well done tool, migrating the mail messages was the easiest task during this PC->Mac migration.
I hardly recommend the Eudora Mailbox Cleaner to any new switcher or former Thunderbird/Eudora user.
Kudos to Andreas for this fantastic tool!
No more twisting my fingers in trying to remember the keyboard shortcuts in IntelliJ for Windows :) one of my "favorite" shortcut being CTRL+Q on windows ... the equivalent of the Quit command on OSX, so I was *by my request* abandoning my current task every-time I was looking for fast Java docs. Yey, no more of that :)
At home I switched to Mail many moons ago and I am very happy with the default OSX mail client, however at work, as a Windows user I was still using Thunderbird (the best mail client for Windows, in my humble opinion) and now I wanted to import my huge mail archive into Mail.
Due to a fantastic well done tool, migrating the mail messages was the easiest task during this PC->Mac migration.
I hardly recommend the Eudora Mailbox Cleaner to any new switcher or former Thunderbird/Eudora user.
Kudos to Andreas for this fantastic tool!
