<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7024716269332790260</id><updated>2012-01-28T04:05:40.856-08:00</updated><category term='install'/><category term='flash'/><category term='openid'/><category term='pilot organizers'/><category term='derby'/><category term='news'/><category term='web'/><category term='husehold'/><category term='development'/><category term='free'/><category term='maven'/><category term='jersey'/><category term='parsing'/><category term='rdbms'/><category term='RIA'/><category term='survival'/><category term='software development'/><category term='sessions'/><category term='redhat'/><category term='cost'/><category term='pda'/><category term='popup'/><category term='configuration'/><category term='ejb'/><category term='mocking'/><category term='tips'/><category term='printer'/><category term='web service'/><category term='file similarity'/><category term='jta'/><category term='eclipse'/><category term='jee'/><category term='treo'/><category term='job hunt'/><category term='utility'/><category term='search api'/><category term='scripting'/><category term='overview'/><category term='security'/><category term='designpattern'/><category term='restful'/><category term='best practices'/><category term='unittesting'/><category term='javadb'/><category term='flex'/><category term='pdf'/><category term='rest'/><category term='billing'/><category term='ui'/><category term='interpreter'/><category term='rain'/><category term='android'/><category term='problems'/><category term='sim'/><category term='struts'/><category term='middletier'/><category term='jpa'/><category term='persistence'/><category term='mac'/><category term='palm'/><category term='unit testing'/><category term='integrity'/><category term='testing'/><category term='j2ee'/><category term='json'/><category term='ide'/><category term='svn'/><category term='google'/><category term='yahoo'/><category term='rules'/><category term='datasource'/><category term='wiki'/><category term='GWT'/><category term='support'/><category term='connection'/><category term='folder'/><category term='smart phone'/><category term='web applications'/><category term='glassfish'/><category term='mock'/><category term='cairngorm'/><category term='winter'/><category term='application'/><category term='Ajax'/><category term='rpm'/><category term='caltal'/><category term='win7'/><category term='transactions'/><category term='plugin'/><category term='enterprise'/><category term='skinning'/><category term='voice'/><category term='domain'/><category term='windows'/><category term='layout'/><category term='tdd'/><category term='port'/><category term='vbscript'/><category term='business objects'/><category term='confluence'/><category term='database'/><category term='shoes'/><category term='linux'/><category term='driver'/><category term='vba'/><category term='recovery'/><category term='hibernate'/><category term='boot'/><category term='office'/><category term='howto'/><category term='tutorial'/><category term='engine'/><category term='scm'/><category term='remote'/><category term='flexunit'/><category term='lynx'/><category term='Java'/><category term='samsung'/><category term='ie'/><category term='vb'/><category term='versioning'/><category term='appserver'/><category term='sql'/><category term='flex 4'/><category term='orm'/><category term='history'/><category term='server'/><category term='file sharing'/><category term='rescue'/><category term='snow'/><category term='problem'/><title type='text'>All Stuff and More</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-845298123655179666</id><published>2011-12-16T06:35:00.000-08:00</published><updated>2011-12-28T06:32:43.471-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='best practices'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='layout'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='folder'/><title type='text'>Java Project Layout - Best Practices</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Simple Project&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;project-name&lt;/li&gt;&lt;ul&gt;&lt;li&gt;trunk&lt;/li&gt;&lt;ul&gt;&lt;li&gt;src...&lt;/li&gt;&lt;li&gt;pom.xml&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;branches&lt;/li&gt;&lt;ul&gt;&lt;li&gt;branch-abc&lt;/li&gt;&lt;ul&gt;&lt;li&gt;src...&lt;/li&gt;&lt;li&gt;pom.xml&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;li&gt;tags...&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&amp;nbsp;Multi-Module Project&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;project-name&amp;nbsp;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;project-name-parent&lt;/li&gt;&lt;ul&gt;&lt;li&gt;pom.xml - defines all modules that are part of the project &lt;/li&gt;&lt;/ul&gt;&lt;li&gt;module 1&amp;nbsp;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;trunk&lt;/li&gt;&lt;ul&gt;&lt;li&gt;src...&lt;/li&gt;&lt;li&gt;pom.xml - points to the parent pom.xml&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;branches&lt;/li&gt;&lt;li&gt;tags&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;module 2&lt;/li&gt;&lt;ul&gt;&lt;li&gt;trunk&lt;/li&gt;&lt;ul&gt;&lt;li&gt;src...&lt;/li&gt;&lt;li&gt;pom.xml - points to the parent pom.xml&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;branches&lt;/li&gt;&lt;li&gt;tags&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;module ...&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&amp;nbsp;The key point is that the parent folder doesn't define the parent project, but is just a container for the parent and the children-modules.&lt;br /&gt;&lt;br /&gt;Advantages:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Nicely groups the modules under one folder.&lt;/li&gt;&lt;li&gt;Allows to build the whole project by calling "mvn clean install" from parent's folder. &lt;/li&gt;&lt;li&gt;Keeps the SVN (and/or Git) operations simple, unlike the layout where the project-name-parent is the parent folder.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-845298123655179666?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/845298123655179666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=845298123655179666' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/845298123655179666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/845298123655179666'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2011/12/java-project-layout-best-practices.html' title='Java Project Layout - Best Practices'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6889271306018779714</id><published>2011-11-17T01:40:00.000-08:00</published><updated>2011-12-16T05:32:21.027-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scm'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='versioning'/><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Project Versioning and Release - Best Practice</title><content type='html'>&lt;ul&gt;&lt;li&gt;A new project starts usually as version 1.0.0.0-SNAPSHOT. Three number versions (1.0.0) are also used but, for example, ServiceMix OSGi server requires three dots.&lt;/li&gt;&lt;li&gt;A new feature/fix is frequently developed on the trunk and committed there when ready for release. &lt;/li&gt;&lt;li&gt;Release (is all done by maven release plugin, more datails &lt;a href="http://jenkins.361315.n4.nabble.com/Releasing-a-plugin-gives-quot-You-don-t-have-a-SNAPSHOT-project-in-the-reactor-projects-list-quot-td388987.html"&gt;here&lt;/a&gt;):&lt;/li&gt;&lt;ul&gt;&lt;li&gt;up the version by 1 (often on the last numbered position: 1.0.0.1)&lt;/li&gt;&lt;li&gt;build, maven-release and deploy to organization's repository if any&lt;/li&gt;&lt;li&gt;tag it in SCM&lt;/li&gt;&lt;li&gt;up the version number on the trunk (it will become 1.0.0.1-SNAPSHOT)&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;On the trunk, we have always -SNAPSHOT versions&lt;/li&gt;&lt;li&gt;Each release has a tag&lt;/li&gt;&lt;li&gt;If the maven release plugin fails, it usually leaves the pom.xml messed up on the trunk.&amp;nbsp; Make sure to fix the version and scm tags.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Alternatively,&amp;nbsp; a new feature/bug fix can be developed on a branch.&amp;nbsp; In this case, the branch needs to be merged to the trunk, when feature/bug fix is ready. I guess, this merge should happen before the release.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6889271306018779714?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6889271306018779714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6889271306018779714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6889271306018779714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6889271306018779714'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2011/11/project-versioning-and-scm.html' title='Project Versioning and Release - Best Practice'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-9134669333572706069</id><published>2011-09-07T23:42:00.000-07:00</published><updated>2011-09-12T00:13:09.014-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='maven'/><title type='text'>Maven - My Own Cheat-Sheet</title><content type='html'>&lt;ul&gt;&lt;li&gt;How maven &lt;b&gt;finds the parent&lt;/b&gt; pom.xml:&lt;ul&gt;&lt;li&gt;by groupId/artifactId/version in the repo (local and then internal etc)&lt;/li&gt;&lt;li&gt;by parentsRelativePath if the tag is present&lt;/li&gt;&lt;li&gt;if both found, in some order, unknown to me.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;To &lt;b&gt;do a release&lt;/b&gt;: use release plugin which, among others:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;verifies that not SNAPSHOT dependencies are used &lt;/li&gt;&lt;li&gt;cuts of the "-SNAPSHOT" and builds the project&lt;/li&gt;&lt;li&gt;tags the corresponding version&lt;/li&gt;&lt;li&gt;bumps up the version number and commits the version with "-SNAPSHOT" on the Head of the SVN/CVS&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Dependency scope&lt;/b&gt;: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;compile - makes the dependency available to dependent projects, will be placed to all classpaths (compile, testing, runtime), it's default scope&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;What are possible values for &lt;b&gt;dependency versions&lt;/b&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1.0.7 - is satisfied by 1.0.7 only and once installed in local repository, it never checks again if a newer or different version 1.0.7 is available&lt;/li&gt;&lt;li&gt;1.0.7-SNAPSHOT - is satisfied by 1.0.7-SNAPSHOT only, but every so often it checks if a newer (or different) 1.0.7-SNAPSHOT is available&lt;/li&gt;&lt;li&gt;RELEASE - is satisfied by the highest release version available&lt;/li&gt;&lt;li&gt; none (tag skipped) - inherits the version from dependency defined in parent's pluginManagement&lt;dependencymanagement&gt;&lt;/dependencymanagement&gt; tag.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-9134669333572706069?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/9134669333572706069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=9134669333572706069' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/9134669333572706069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/9134669333572706069'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2011/09/maven-my-own-cheat-sheet.html' title='Maven - My Own Cheat-Sheet'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-618665532064144095</id><published>2010-09-26T13:28:00.000-07:00</published><updated>2010-09-26T13:28:39.866-07:00</updated><title type='text'>Developing a GWT Hosted on  AppEngine</title><content type='html'>&lt;b&gt;&lt;span style="font-size: large;"&gt;GWT&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Using Eclipse with Google plugin:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;to run application&amp;nbsp; locally: Google-&amp;gt;Compile GWT (red toolbox toolbar icon) and run as Run As-&amp;gt;Web Application&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-618665532064144095?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/618665532064144095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=618665532064144095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/618665532064144095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/618665532064144095'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/09/developing-gwt-hosted-on-appengine.html' title='Developing a GWT Hosted on  AppEngine'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8190455544633157903</id><published>2010-05-20T23:21:00.000-07:00</published><updated>2010-08-24T05:35:08.981-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='openid'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google OpenID URL</title><content type='html'>It's: &lt;a href="https://www.google.com/accounts/o8/id"&gt;https://www.google.com/accounts/o8/id&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8190455544633157903?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8190455544633157903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8190455544633157903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8190455544633157903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8190455544633157903'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/05/google-openid-url.html' title='Google OpenID URL'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8472979206321131147</id><published>2010-05-19T13:19:00.000-07:00</published><updated>2010-05-19T13:19:50.042-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='popup'/><category scheme='http://www.blogger.com/atom/ns#' term='designpattern'/><category scheme='http://www.blogger.com/atom/ns#' term='cairngorm'/><title type='text'>Flex with Cairngorm 2 - Popups Strategy</title><content type='html'>This post is a brief summary how we use Cairngorm 2 methodology for popups in Flex applications in the IT shop I work at:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Three files are created for each popup:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;popup view&lt;/li&gt;&lt;li&gt;Cairngorm event to initiate showing of the popup&lt;/li&gt;&lt;li&gt;Cairngorm command to actually show the popup using PopupManager&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Any data that needs to be passed to the popup is attached to the event. &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;When user closes the popup, the popup view simply removes itself from PopupManager.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The results of the popup, if any, are updated (can be done via data binding) in the ModelLocator, to which other controlls are bound as well, if needed.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8472979206321131147?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8472979206321131147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8472979206321131147' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8472979206321131147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8472979206321131147'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/05/flex-with-cairngorm-2-popups-strategy.html' title='Flex with Cairngorm 2 - Popups Strategy'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-295529385629465592</id><published>2010-05-12T16:16:00.000-07:00</published><updated>2010-05-12T16:16:35.784-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='enterprise'/><category scheme='http://www.blogger.com/atom/ns#' term='middletier'/><title type='text'>Options for Java Middle-Tier of an RIA Application</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Choice of Standard/Framework&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;Here's my best option or two for each area:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Persistence:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JPA. Use implementation-specific annotations only where unavoidable, and mark them in a way that will allow you to find all of them easily.&lt;/li&gt;&lt;/ul&gt;&amp;nbsp; &lt;/li&gt;&lt;li&gt; Transaction Management: EJB 3.1 &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Dependency Injection: EJB 3.1 &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Security: EJB 3.1&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Exposing required web services:EJB 3.1&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;AOP: EJB 3.1 if their support for AOP is sufficient for you. Otherwise: Spring &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Other:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Singletons: EJB 3.1&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Providers&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JPA: I use Hibernate, but the whole advantage of JPA is, that which provider  you use is much less important than it used to be.&lt;/li&gt;&lt;li&gt;Application Server: Glassfish 3. It does support EJB 3.1. &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-295529385629465592?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/295529385629465592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=295529385629465592' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/295529385629465592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/295529385629465592'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/05/options-for-java-middle-tier-of-ria.html' title='Options for Java Middle-Tier of an RIA Application'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7943729376986413310</id><published>2010-04-28T18:13:00.000-07:00</published><updated>2010-05-12T17:04:37.085-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='flex 4'/><title type='text'>Flex 3 and Flex 4 - Tips</title><content type='html'>&lt;ul&gt;&lt;li&gt;When manually &lt;b&gt;dispatching an event&lt;/b&gt;, using uiComponent.dispatchEvent(your-event), you need to &lt;b&gt;add listener&lt;/b&gt; to the same component uiComponent. So, uiComponent.addEventListener(type,handler) will work, but uiAnyOtherComponent.addEventListener(type,handler) will not work.&lt;/li&gt;&lt;li&gt;The &lt;b&gt;state changes-related  transition effects&lt;/b&gt; have to &lt;i&gt;correspond&lt;/i&gt; to the type of changes  between the corresponding states. &lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Example&lt;/i&gt;: I had a vertical group with two components. In  State 1, both components show. In State2, Comp1 is not included. I set a  Resize transition for Comp1 and a Move transition for Comp2.  The  effect was surprising: when state changed, Comp1 disappeared and  appeared at the bottom of the screen. There it was re-sized. &lt;i&gt;The right  fix&lt;/i&gt; was to change Comp1: instead of includeIn=State1, I did  height.State2=0. That did the trick.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Constraint-based layout&lt;/b&gt; is supported only in a container with  BasicLayout. If you want to use it inside a VGroup, for example, you can  put it inside a Group for which you don't specify any layout  (BasicLayout is the default).&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7943729376986413310?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7943729376986413310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7943729376986413310' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7943729376986413310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7943729376986413310'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/04/flex-3-and-flex-4-tips.html' title='Flex 3 and Flex 4 - Tips'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3748433596567399032</id><published>2010-04-22T19:47:00.000-07:00</published><updated>2010-04-23T19:27:37.065-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='win7'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='printer'/><category scheme='http://www.blogger.com/atom/ns#' term='samsung'/><category scheme='http://www.blogger.com/atom/ns#' term='driver'/><title type='text'>Installing Samsung Printer ML-2510 on a Network Server under Win7</title><content type='html'>&lt;ul&gt;&lt;li&gt;Go to: Control Panel &amp;gt; Hardware and Sound &amp;gt; Devices and Printers.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Click  "Add a Printer" and in a new window: Click "Add a local printer".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Select  "Create a new port" via radio buttons. Select "Standard TCP/IP Port"  via dropdown. Click "Next".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; Enter "192.168.0.2"&amp;nbsp; or whatever is your print server IP address via textbox "Hostname or IP Address". Modify  "192.168.0.102" via textbox "Port Name" if desired. Unselect "Query the  printer [...]" via checkbox.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; Select custom settings and set:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Protocol LPR and Queue Name L1 and enable LPR Byte Counting.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Reach page "Install the print driver".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Select  "Samsung" via scroll list "Manufacturer". Click "Windows Update" if  "Samsung ML-2510 Series" does not appear in scroll list "Printers".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; [Additional procedures may be needed to continue with printer addition]&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Reach  situation in previous step. Select "Samsung" and "Samsung ML-2510  Series". Click "Next".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;[Additional procedures may be needed to  complete printer addition]&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3748433596567399032?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3748433596567399032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3748433596567399032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3748433596567399032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3748433596567399032'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/04/installing-samsung-printer-ml-2510-on.html' title='Installing Samsung Printer ML-2510 on a Network Server under Win7'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8005157023230073205</id><published>2010-04-19T12:07:00.000-07:00</published><updated>2010-04-28T08:35:52.140-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='persistence'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='orm'/><title type='text'>Persistence Layer for Flex-and-Java Applications And The Like</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;1. Introduction&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When architecting an RIA (aka Web 2.0) application, you have to decide how do you implement the persistence layer. Using the ORM is a standard nowadays, so it's given.&amp;nbsp; Question as to which ORM to use, got easier with strong acceptance of the Sun's JPA standard by the industry. But, how do you apply ORM in an RIA application is not a question with just a one obvious answer. On one side, the choice of the framework (and the architecture with it). This is presented in section 2. Section 3 presents another aspect of persistence layer: session management, that is how you actually use ORM to persist detached objects (detached, because they are received from outside of the application, namely from the client, for example a Flex client).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;2. ORM in an RIA Application&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Popular options are listed below. Each with advantages and disadvantages.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2.1. Just-JPA Approach:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;LCDS, BlazeDS or another Flex remoting framework&lt;/li&gt;&lt;li&gt;JPA (in general: ORM) on the server-side, with an object mapper like Dozer&lt;/li&gt;&lt;/ul&gt;Pros and Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Pro: Simple and a popular choice.&lt;/li&gt;&lt;li&gt;Con: Doesn't let you take advantage of ORM's lazy loading and lazy initialization.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2.2. LCDS with Built-In Hibernate Adapter:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This solution requires you to purchase a commercial heavy-duty Flex remoting framework Adobe LCDS (LiveCycle Data Services). If you go this way, to integrate it with persistence layer, you create a Hibernate assembler class on the server (Java) and point the LCDS destination to it, as described &lt;a href="http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=dms_standard_assemblers_3.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Pros and Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Pro: (I believe) it takes advantage of lazy loading and initialization.&lt;/li&gt;&lt;li&gt;Cons: all of the persistence layer is implemented on the client which can lead to bigger/fatter client.&lt;/li&gt;&lt;li&gt;Cons: expense.&lt;/li&gt;&lt;li&gt;Cons: proprietary solution.&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2.3. BlazeDS with Gilead:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Open source solution. Described in detail &lt;a href="http://ria.dzone.com/articles/flex-hibernate-integration"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Pros and Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Pro: open-source; no vendor lock-in.&lt;/li&gt;&lt;li&gt;Cons: unknown.&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2.4. GraniteDS:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Provides a complete open-source solution. Described in a nutshell in comment to &lt;a href="http://ria.dzone.com/articles/flex-hibernate-integration"&gt;this&lt;/a&gt; article. More complete information, and a comparison with LCDS-with-Hibernate-assembler option, can be found in &lt;a href="http://www.insideria.com/2010/01/getting-real-with-graniteds.html"&gt;this&lt;/a&gt; article by the same person (as the comment), William Drai. &lt;i&gt;This article has also more general, highly useful, background on the topic as a whole.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Pros and Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Pro: open-source; no vendor lock-in.&lt;/li&gt;&lt;li&gt;Cons: unknown&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;3. Persisting Detached Objects&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The three most common applicable persistence design patterns are (as described by Hibernate &lt;a href="http://community.jboss.org/wiki/sessionsandtransactions#Transactions"&gt;documentation&lt;/a&gt;):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;session per request&lt;/i&gt;The most common solution. A single &lt;tt&gt;Session&lt;/tt&gt; and a single database transaction implement  the processing of a particular request event. Do &lt;i&gt;never&lt;/i&gt; use the &lt;i&gt;session-per-operation&lt;/i&gt; anti-pattern.&lt;/li&gt;&lt;li&gt;&lt;i&gt;session per conversation&lt;/i&gt;Once persistent objects are considered &lt;i&gt;detached&lt;/i&gt; during user  think-time and have to be reattached to a new &lt;tt&gt;Session&lt;/tt&gt; after  they have been modified.&lt;/li&gt;&lt;li&gt;&lt;i&gt;session-per-request-with-detached-object&lt;/i&gt;Recommended. In this case a single &lt;tt&gt;Session&lt;/tt&gt; has a bigger scope  than a single database transaction and it might span several database  transactions. Each request event is processed in a single database  transaction, but flushing of the &lt;tt&gt;Session&lt;/tt&gt; would be delayed until  the end of the conversation and the last database transaction, to make  the conversation atomic. The &lt;tt&gt;Session&lt;/tt&gt; is held in disconnected  state, with no open database connection, during user think-time.&lt;/li&gt;&lt;/ul&gt;For another good article on this topic see &lt;a href="http://blog.xebia.com/2009/03/23/jpa-implementation-patterns-saving-detached-entities/"&gt;this&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;b&gt;3.1 More about Session-Per-Request Pattern&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;Let's assume we have an application an RIA with stateless EJB's on the server side. Each request gets a new EntityManager injected. I suggest the following approach to implement session-per-request:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;if we receive a new object, persist it using &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; entityManager.persist(entity)&lt;/li&gt;&lt;li&gt;if we receive an object, that is already in the database, use&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; entityManager.merge(entity)&lt;/li&gt;&lt;/ul&gt;There is one narrow case, when this wouldn't work as expected: when we have a bidirectional association between Invoice and InvoiceDetail and we receive and invoiceDetail with the field &lt;i&gt;invoice&lt;/i&gt; set to null. If we apply the method as above, the merge() will reset the &lt;i&gt;invoice&lt;/i&gt; in invoiceDetail to null, while the field &lt;i&gt;invoiceDetails&lt;/i&gt; in invoice object will continue pointing to invoiceDetail. However, I consider this not a practical case.&lt;br /&gt;&lt;br /&gt;4. Conclusion&lt;br /&gt;So, a simple starting point that I recommend for your RIA application is to use just JPA with a session-per-request persistence pattern. It can be as simple as:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;JpaDao {&lt;br /&gt;  public void persist(E entity) {&lt;br /&gt;    if (entity.getId() == null) {&lt;br /&gt;      entityManager.persist(entity);&lt;br /&gt;    } else {&lt;br /&gt;      entityManager.merge(entity);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;as suggested by &lt;a href="http://blog.xebia.com/2009/03/23/jpa-implementation-patterns-saving-detached-entities/"&gt;Marcell Manfrin&lt;/a&gt; (in a comment).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;4. My Recommended Solution&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Use JPA with an ORM provider of your own.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Use only JPA annotations and avoid using native provider's annotations. If you have to use a provider's native application, mark it in the code in an easy to discover way.&lt;/li&gt;&lt;li&gt;Use &lt;i&gt;session-per-request&lt;/i&gt; approach with object mapper like Dozer.&lt;/li&gt;&lt;li&gt;Unless domain model is very simple and used only in CRUD-like way, use DTO objects to transfer data between client and server (&lt;a href="http://blog.xebia.com/2009/05/11/jpa-implementation-patterns-service-facades-and-data-transfers-objects/"&gt;article&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Question: use simple domain objects with public fields?&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Use service facade layer to:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;manage session-per-request&lt;/li&gt;&lt;li&gt;map domain to/from DTO objects&lt;/li&gt;&lt;li&gt;isolate the client from the server&lt;/li&gt;&lt;li&gt;provide an lightweight API for the client rather than exposing the client to a complex domain model.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8005157023230073205?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8005157023230073205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8005157023230073205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8005157023230073205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8005157023230073205'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/04/flex-and-persistence-layer-options.html' title='Persistence Layer for Flex-and-Java Applications And The Like'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-5798818525814665703</id><published>2010-04-19T09:23:00.000-07:00</published><updated>2010-04-19T11:36:56.765-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='skinning'/><category scheme='http://www.blogger.com/atom/ns#' term='overview'/><category scheme='http://www.blogger.com/atom/ns#' term='flex 4'/><title type='text'>Flex 4, Spark Architecture Overview: Notes</title><content type='html'>Based on a great &lt;a href="http://ria.dzone.com/articles/spark-architecture-flex-4"&gt;article&lt;/a&gt; by Deepa Subramaniam.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Intro &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Every Spark component consists of the &lt;b&gt;skin class&lt;/b&gt; (defined declaratively via an MXML file) and a &lt;b&gt;component class&lt;/b&gt; (defined via ActionScript).&lt;/li&gt;&lt;li&gt;Previous Flex component architecture and component set was &lt;b&gt;MX, aka as &lt;i&gt;Halo&lt;/i&gt;&lt;/b&gt;. &lt;/li&gt;&lt;li&gt;&lt;b&gt;Spark components extend the MX class mx.core.UIComponent&lt;/b&gt;, and so Spark containers can hold MX components and vice-versa, and Spark and MX components can live side-by-side. The  same component lifecycle methods, properties, and events that existed  for the MX components apply to Spark components.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Skinning&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Three key elements— data, parts, and states—define the skinning contract upon which Spark is founded:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Every Spark component class: &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;defines the data the component expects,&amp;nbsp;&lt;/li&gt;&lt;li&gt;defines the constituent parts that  make up the component (aka skin parts), and&amp;nbsp;&lt;/li&gt;&lt;li&gt;defines the states the component can enter and exit; responsible for all of the event handling needed to  identify when a state change has occurred and ensures the component is  put in the right state.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The corresponding skin class: &lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;how that data is  visually displayed,&amp;nbsp;&lt;/li&gt;&lt;li&gt;how the parts are laid out and visualized (it instantiates the parts), and&amp;nbsp;&lt;/li&gt;&lt;li&gt;what  the component looks like as it enters and exits different states.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;New Capabilities of Spark Architecture&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Effects in Spark: faster and more capable; can be invoked directly within Spark skin classes  through state-based transitions.&lt;/li&gt;&lt;li&gt;New layouts&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;APIs for robust 2D and 3D transformations,&lt;/li&gt;&lt;li&gt;the ability to easily implement custom layouts&lt;/li&gt;&lt;li&gt;assignable layout&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;FXG and MXML Graphics: graphics library  that captures drawing primitives as simple MXML tags. FXG is a declarative XML syntax for defining vector graphics in applications built with Flex and can be created by Adobe Illustrator (or manually) and understood by other Adobe CS tools as well as by FlashPlayer (and probably created and read by Catalyst).&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;What Next&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;For more information, read references from the base article&amp;nbsp; by Deepa Subramaniam. For examples and details on skinning read &lt;a href="http://www.adobe.com/devnet/flex/articles/flex4_skinning.html"&gt;article&lt;/a&gt;  by Ryan Frishberg. For more information on FXG, read &lt;a href="http://help.adobe.com/en_US/Flex/4.0/UsingSDK/WSda78ed3a750d6b8f26c150d412357de3591-8000.html"&gt;this&lt;/a&gt;  Adobe well written documentation.&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-5798818525814665703?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/5798818525814665703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=5798818525814665703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5798818525814665703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5798818525814665703'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/04/flex-4-spark-architecture-overview.html' title='Flex 4, Spark Architecture Overview: Notes'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2440758876133347348</id><published>2010-04-01T16:52:00.000-07:00</published><updated>2010-04-07T18:56:44.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='jpa'/><category scheme='http://www.blogger.com/atom/ns#' term='ejb'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><title type='text'>JPA with Hibernate on Glassfish 3</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Intro&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;This post is simply a summary of a simple proof of concept. It shows how to&lt;/span&gt;&lt;b&gt;:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;create a stateless EJB3 bean&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;persist an entity using JPA with Hibernate as a JPA provider&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;configure JPA to use a datastore defined on Glassfish (uses pre-installed java/__default datastore, which uses pre-installed Derby/JavaDB)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="font-size: small;"&gt;You can download the source code for this sample from &lt;a href="http://sites.google.com/site/sharewhatyouknow123/downloads"&gt;here&lt;/a&gt; (&lt;/span&gt;&lt;/span&gt;&lt;span dir="ltr"&gt;EJB3_First_Project_with_Test.zip).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Entity&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;@Entity&lt;br /&gt;public class Book implements Serializable {&lt;br /&gt; @Id&lt;br /&gt; @GeneratedValue(strategy = GenerationType.AUTO)&lt;br /&gt; private int id;&lt;br /&gt; private String title;&lt;br /&gt; private float price;&lt;br /&gt; &lt;br /&gt; public Book() {&lt;br /&gt;    super();&lt;br /&gt; }&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Here, I have annotated the property, rather than the getter (not shown for brevity), since it feels more intuitive to me. I don't know if there is any advantage/difference of one vs the  other other than my personal preference. The "@GeneratedValue(...)" annotation for primary key in JPA entity  definition is not optional, as I expected. Using just the "@Id" annotation results in  the primary key being not set (set to 0).&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;EJB Bean &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The interface:&lt;br /&gt;&lt;pre class="brush: java"&gt;@Remote&lt;br /&gt;public interface BookManager {&lt;br /&gt; public abstract int addBook(Book book);&lt;br /&gt; public abstract Book find(int bookId);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And the bean implementation:&lt;br /&gt;&lt;pre class="brush: java"&gt;@Stateless(name="BookManager", mappedName = "ejb/BookManagerJNDI")&lt;br /&gt;@TransactionAttribute(TransactionAttributeType.REQUIRED)&lt;br /&gt;public class BookManagerImpl implements BookManager {&lt;br /&gt;&lt;br /&gt; // Dependency injection of Entity Manager for&lt;br /&gt; // the given persistence unit&lt;br /&gt; @PersistenceContext(unitName="pu1") EntityManager em;&lt;br /&gt; &lt;br /&gt; public int addBook(Book book) {&lt;br /&gt;&lt;br /&gt;  // Transitions new instances to managed. On the&lt;br /&gt;  // next flush or commit, the newly persisted&lt;br /&gt;  // instances will be inserted into the datastore.&lt;br /&gt;  em.persist(book);&lt;br /&gt;  &lt;br /&gt;  return book.getId();&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; @Override&lt;br /&gt; public Book find(int bookId) {&lt;br /&gt;  return em.find(Book.class, bookId);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The annotation @Stateless with the mappedName make the bean to get registered with JNDI. The &lt;br /&gt;&lt;pre class="brush: java"&gt;TransactionAttributeType.REQUIRED &lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;tells the container to wrap each method in the class with a transaction.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="brush: java"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;JPA Setup&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The persistence.xml file (put it into META-INF folder under src folder so it will be deployed onto the server)&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"&amp;gt;&lt;br /&gt;    &amp;lt;persistence-unit name="pu1"&amp;gt;&lt;br /&gt;     &amp;lt;!-- Persistence provider --&amp;gt;  &lt;br /&gt;        &amp;lt;provider&amp;gt;org.hibernate.ejb.HibernatePersistence&amp;lt;/provider&amp;gt;&lt;br /&gt;        &amp;lt;jta-data-source&amp;gt;jdbc/__default&amp;lt;/jta-data-source&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;properties&amp;gt;&lt;br /&gt;   &amp;lt;property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" /&amp;gt;&lt;br /&gt;   &amp;lt;property name="hibernate.hbm2ddl.auto" value="create" /&amp;gt;&lt;br /&gt;   &amp;lt;property name="hibernate.show_sql" value="true" /&amp;gt;&lt;br /&gt;        &amp;lt;/properties&amp;gt;&lt;br /&gt;    &amp;lt;/persistence-unit&amp;gt;&lt;br /&gt;&amp;lt;/persistence&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The "hibernate." prefix in persistence.xml file is not optional when  adding properties of the JPA provider (Hibernate in this case). They are ignored without it, without a warning.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Glassfish Setup&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Nothing other than installing the Hibernate component using the Glassfish console.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Unit Tests&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The unit test:&lt;br /&gt;&lt;pre class="brush: java"&gt;try {   &lt;br /&gt;   InitialContext ctx = new InitialContext();&lt;br /&gt;   BookManager bean = (BookManager) ctx.lookup("ejb/BookManagerJNDI");&lt;br /&gt;   Book book = new Book("Chocolate Rain", 25.10f);&lt;br /&gt;   int bookId = bean.addBook(book );&lt;br /&gt;   book = null;&lt;br /&gt;   &lt;br /&gt;   book = bean.find(bookId);&lt;br /&gt;   Assert.assertEquals("Chocolate Rain", book.getTitle());&lt;br /&gt;  } catch (NamingException e) {&lt;br /&gt;   // TODO Auto-generated catch block&lt;br /&gt;   e.printStackTrace();&lt;br /&gt;   Assert.fail("Failed. Exception thrown.");&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;A Few Notes &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Can JPA be used to create and index? Yes and no. Not in general. But it provides a limited capability. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;To create a unique constrain on a table, use @UniqueConstraint(columnNames={"EMP_BDAY", "EMP_NAME"})&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;How to specify the character column type length? Use @Column(length=50).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;What the client can understand about   the remote exception, in case the EJB bean fails? The remote exception is wrapped in a EJBException and returned to the client. For example, if the password for the DB is incorrect, the org.hibernate.exception.GenericJDBCException will be returned with a message "Cannot open connection" (when Hibernate is used as JPA provider).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Conclusion &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;A few things to try in the next proof of  concept:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;test the  rollback function, if second of two persistence operations failed when  both are in the same method of the BookManager class.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;do a parent/child relationship.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2440758876133347348?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2440758876133347348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2440758876133347348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2440758876133347348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2440758876133347348'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/04/jpa-with-hibernate-on-glassfish-3.html' title='JPA with Hibernate on Glassfish 3'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6111126524494933924</id><published>2010-03-11T09:32:00.000-08:00</published><updated>2010-03-11T09:36:30.932-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='transactions'/><category scheme='http://www.blogger.com/atom/ns#' term='persistence'/><category scheme='http://www.blogger.com/atom/ns#' term='sessions'/><title type='text'>Hibernate Session and Transaction Management</title><content type='html'>It seems, there are several approaches to manage Hibernate sessions and transactions:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;explicitly by the application&lt;/li&gt;&lt;li&gt; explicitly by the application with ThreadLocal pattern (&lt;a href="http://www.java2s.com/Code/Java/Hibernate/HibernateTransactionWithTryCatch.htm"&gt;example&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;via Hibernate transaction demarcation with JTA &lt;/li&gt;&lt;li&gt;via Hibernate transaction demarcation with plain JDBC&lt;/li&gt;&lt;li&gt;using Spring Framework&lt;/li&gt;&lt;li&gt;using EJB / CMT (container-managed transactions)&lt;/li&gt;&lt;/ul&gt;For a good explanation of all options, other than ThreadLocal, see Hibernate &lt;a href="https://www.hibernate.org/42.html"&gt;document&lt;/a&gt;. Note that EJB, as well as JTA, are available even outside the J2EE container as a module. Also, supposedly, the Spring Framework can be easily used just for the functionality you decide to use from it and it doesn't require the application to use all parts of this framework.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Basic Approach: Managed by Application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Here's a code sample from &lt;a href="https://www.hibernate.org/42.html"&gt;hibernate document&lt;/a&gt;:&lt;br /&gt;&lt;pre class="brush:java"&gt;Session session = factory.openSession();&lt;br /&gt;Transaction tx = null;&lt;br /&gt;try {&lt;br /&gt;    tx = session.beginTransaction();&lt;br /&gt;&lt;br /&gt;    // Do some work&lt;br /&gt;    session.load(...);&lt;br /&gt;    session.persist(...);&lt;br /&gt;&lt;br /&gt;    tx.commit(); // Flush happens automatically&lt;br /&gt;}&lt;br /&gt;catch (RuntimeException e) {&lt;br /&gt;    tx.rollback();&lt;br /&gt;    throw e; // or display error message&lt;br /&gt;}&lt;br /&gt;finally {&lt;br /&gt;    session.close();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;You choose the approach.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6111126524494933924?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6111126524494933924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6111126524494933924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6111126524494933924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6111126524494933924'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/03/hibernate-session-and-transaction.html' title='Hibernate Session and Transaction Management'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-9156546342727605322</id><published>2010-03-08T22:21:00.000-08:00</published><updated>2010-04-18T18:26:11.812-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android Testing - Tips</title><content type='html'>&lt;ul&gt;&lt;li&gt;What is Android &lt;b&gt;Context class&lt;/b&gt;? It's "an interface to global information about an application environment.  This is  an abstract class whose implementation is provided by  the Android system." &lt;/li&gt;&lt;li&gt;The native &lt;b&gt;Android OS support for testing is based on jUnit 3&lt;/b&gt;. Don't try to use jUnit 4. The results are not predictable. I had the first test run fine, but no more tests would finish.&lt;/li&gt;&lt;li&gt;Testing support:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Use ActivityInstrumentationTestCase2&lt;t&gt; for &lt;b&gt;functional testing of a single Activity&lt;/b&gt;. The selected activity will be created and managed by the system as specified by the regular activity lifecycle. Tests can interact with the UI widgets to imitate user actions.&lt;/t&gt;&lt;/li&gt;&lt;li&gt;&lt;t&gt;Use ActivityUnitTestCase to run &lt;b&gt;unit tests of an isolated activity&lt;/b&gt;. Activity under test will not be subject to regular activity lifecycle.&lt;/t&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;t&gt;If you see a problem of type &lt;b&gt;error: device not found&lt;/b&gt; and shutdown the adb.exe process. It will restart automatically and try to reconnect to the device. Sometimes, starting the intended Instrumentation on emulator (an option in Dev Tools application) does it all for you.&lt;/t&gt;&lt;/li&gt;&lt;li&gt;&lt;t&gt;If adb does not connect after restarting it (shows "DeviceMonitor]Connection attempts: 11..." and LogCat nic nie pokazuje), restart PC.&lt;/t&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-9156546342727605322?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/9156546342727605322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=9156546342727605322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/9156546342727605322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/9156546342727605322'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/03/android-testing-tips.html' title='Android Testing - Tips'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3134255696420878198</id><published>2010-03-02T13:39:00.000-08:00</published><updated>2010-03-09T11:48:18.812-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='orm'/><category scheme='http://www.blogger.com/atom/ns#' term='jta'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><title type='text'>JSON RESTfull Service Using Jersey with Hibernate Persistence on Glassfish - Part 2</title><content type='html'>This is continuation of my &lt;a href="http://sberka.blogspot.com/2010/02/json-restfull-service-using-jersey-with.html"&gt;blog&lt;/a&gt; on this topic. I'm adding the solution to the questions/issues left out in that first blog as delineated in the last part of the blog. Actually, this effort wasn't successful. I wasn't able to make it work. Although made a good progress, I had to go back to the approach presented in my previous blog. This post is just to document what I was able to achieve.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;JTA&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Switch to use JTA, instead of native JDBC transactions. All new application servers support JTA natively. With JTA, the session is bound to the transaction. If you call sessionFactory.getCurrentSession(), anytime between userTransaction.begin() and userTransaction.commit(), a session bound to this transaction is returned. User transaction is usually obtained via JNDI. So, an example of code:&lt;br /&gt;&lt;pre class="brush:java"&gt;UserTransaction tx = (UserTransaction)new InitialContext()&lt;br /&gt; .lookup("java:comp/UserTransaction");&lt;br /&gt;&lt;br /&gt;SessionFactory factory = HibernateUtil.getSessionFactory();&lt;br /&gt;PersonDao dao = new PersonDao(factory);&lt;br /&gt;&lt;br /&gt;try{&lt;br /&gt; tx.begin();&lt;br /&gt; &lt;br /&gt; dao.saveOrUpdate(person);&lt;br /&gt; &lt;br /&gt;    tx.commit();&lt;br /&gt;&lt;br /&gt;} catch( Exception ex) {&lt;br /&gt; tx.rollback();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;while the only thing that the Dao needs to do is to request the session via: factory.getCurrentSession().&lt;br /&gt;&lt;br /&gt;The required Hibernate configuration file hibernate.cfg.xml:&lt;br /&gt;&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE hibernate-configuration PUBLIC&lt;br /&gt;  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"&lt;br /&gt;  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;hibernate-configuration&amp;gt;&lt;br /&gt;    &amp;lt;session-factory name="hibernate/sessionFactory"&amp;gt;&lt;br /&gt;     &amp;lt;property name="transaction.manager_lookup_class"&amp;gt;org.hibernate.transaction.SunONETransactionManagerLookup&amp;lt;/property&amp;gt;&lt;br /&gt;     &amp;lt;property name="transaction.factory_class"&amp;gt;org.hibernate.transaction.JTATransactionFactory&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="connection.datasource"&amp;gt;jdbc/xaderby&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="dialect"&amp;gt;org.hibernate.dialect.DerbyDialect&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="current_session_context_class"&amp;gt;jta&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="hbm2ddl.auto"&amp;gt;create&amp;lt;/property&amp;gt;&lt;br /&gt;    &lt;br /&gt;     &amp;lt;mapping resource="olcc/entity/Person.hbm.xml"/&amp;gt;&lt;br /&gt;    &amp;lt;/session-factory&amp;gt;&lt;br /&gt;&amp;lt;/hibernate-configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;where jdbc/xaderby is a data source defined on Glassfish, of type javax.sql.XADataSource.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Configuration&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Glassfish 3&lt;br /&gt;Hibernate 3.5&lt;br /&gt;JDK 6 (Derby included)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Result &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;This configuration results in the following error message:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;FINEST: saving transient instance&lt;br /&gt;FINE: surrounding JTA transaction suspended [JavaEETransactionImpl: txId=1 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[org.hibernate.transaction.CacheSynchronization, org.hibernate.context.JTASessionContext$CleanupSynch@1d069e4]]&lt;br /&gt;FINE: opening JDBC connection&lt;br /&gt;INFO: JTS5014: Recoverable JTS instance, serverId = [100]&lt;br /&gt;&lt;br /&gt;FINE: select next_hi from hibernate_unique_key for read only with rs&lt;br /&gt;FINE: update hibernate_unique_key set next_hi = ? where next_hi = ?&lt;br /&gt;FINE: closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)&lt;br /&gt;SEVERE: org.hibernate.HibernateException: unable to resume previously suspended transaction&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.engine.transaction.Isolater$JtaDelegate.delegateWork(Isolater.java:179)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:64)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:74)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.id.TableGenerator.generate(TableGenerator.java:118)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:84)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)&lt;/pre&gt;When I tried using a plain javax.sql.DataSource instead of XADataSource, I was getting XAResource.start error.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Remaining Questions:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;findAllByProperty(), findByCriteria() and/or findByExample() methods. Commonly used. What is the right way to implement them?&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3134255696420878198?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3134255696420878198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3134255696420878198' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3134255696420878198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3134255696420878198'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/03/json-restfull-service-using-jersey-with.html' title='JSON RESTfull Service Using Jersey with Hibernate Persistence on Glassfish - Part 2'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-51162583493485385</id><published>2010-03-02T13:37:00.000-08:00</published><updated>2010-03-02T13:37:40.630-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='jta'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><title type='text'>J2EE - Tips and Tricks</title><content type='html'>&lt;ul&gt;&lt;li&gt;Sun/Oracle's J2EE 5 SDK is installed in small pieces. Unlike previous versions of J2EE, there is no j2ee.jar. And so, pieces of it are installed in glassfish\modules folder, as separate jars. For example, the JTA stuff is installed as jta.jar (the implmementation stuff, com.sun....* classes) and javax.transactions.jar, which holds the core of the JTA API.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-51162583493485385?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/51162583493485385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=51162583493485385' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/51162583493485385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/51162583493485385'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/03/j2ee-tips-and-tricks.html' title='J2EE - Tips and Tricks'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-5175244126015732425</id><published>2010-02-27T22:42:00.000-08:00</published><updated>2010-03-29T14:18:37.432-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='problems'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='ui'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android Development Tips and Issues</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;General&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;After importing a project created by someone else, you may need to correct the Project Build Target via project Properties -&amp;gt; Android panel.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;UI&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;The attribute &lt;i&gt;layou_height=fill_parent &lt;/i&gt;doesn't work as usually inside the ScrollView. Set the size explicitly, possibly using &lt;i&gt;minHeight&lt;/i&gt; and &lt;i&gt;MaxHeight&lt;/i&gt;. &lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-5175244126015732425?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/5175244126015732425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=5175244126015732425' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5175244126015732425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5175244126015732425'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/android-ui-tips-and-issues.html' title='Android Development Tips and Issues'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8357592729244505507</id><published>2010-02-19T17:28:00.000-08:00</published><updated>2010-02-22T09:18:44.622-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><category scheme='http://www.blogger.com/atom/ns#' term='jersey'/><title type='text'>JSON RESTfull Service Using Jersey with Hibernate Persistence on Glassfish</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Tips:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;to setup Hibernate to use a datasource defined under Glassfish, see my other &lt;a href="http://sberka.blogspot.com/2010/02/configure-hibernate-to-use-datasource.html"&gt;post&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;usefull Jersey annotations:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;for the resource class: @Path("/person/")&lt;/li&gt;&lt;li&gt;for a method: @GET @Path("{personId}/") @Produces("application/json"). Then, you can use &lt;i&gt;public Person getUser(@PathParam("personId") int personId)&lt;/i&gt; for method declaration.&lt;/li&gt;&lt;li&gt;add @Consumes("application/json") with &lt;i&gt;public Person post(Person person)&lt;/i&gt; method declaration. Jersey takes care of unmarshaling the Json into Person object.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;to return an error code from the restfull webservice, throw a new WebApplicationException(Response.Status.NOT_FOUND), for example. This one would return 404 error. No Need to declare the jersey handler method as "throws ...".&lt;/li&gt;&lt;li&gt;to unit test the service, use com.sun.jersey.api.client.Client:&lt;br /&gt;&lt;pre class="brush:java"&gt;Person result = Client.create().resource("http://localhost:8080/myapp/person")&lt;br /&gt;   .type("application/json")&lt;br /&gt;   .post(Person.class,new Person("Jon Smith",133));&lt;br /&gt;Assert.assertEquals("Jon Smith", result.getName());&amp;nbsp;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;To pass an object retrieved via Hibernate as a response from a webservice, it needs to be serializable. But objects retrieved this way have additional members and so they need to be converted to a pure entity object (Person, in my case). I have used the Dozer library for this purpose (see the code below).&lt;/li&gt;&lt;li&gt;The entity classes (Person and PersonCollection, in my example)need to be annotated with @XmlRootElement.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Complete web service implementation class code (in RESTfull, call a resource):&lt;br /&gt;&lt;pre class="brush:java"&gt;package olcc.jersey.service;&lt;br /&gt;&lt;br /&gt;import java.util.List;&lt;br /&gt;import javax.ws.rs.Consumes;&lt;br /&gt;import javax.ws.rs.GET;&lt;br /&gt;import javax.ws.rs.POST;&lt;br /&gt;import javax.ws.rs.Path;&lt;br /&gt;import javax.ws.rs.PathParam;&lt;br /&gt;import javax.ws.rs.Produces;&lt;br /&gt;import javax.ws.rs.WebApplicationException;&lt;br /&gt;import javax.ws.rs.core.Response;&lt;br /&gt;import olcc.entity.HibernateUtil;&lt;br /&gt;import olcc.entity.Person;&lt;br /&gt;import olcc.entity.PersonCollection;&lt;br /&gt;import org.dozer.DozerBeanMapper;&lt;br /&gt;import org.dozer.Mapper;&lt;br /&gt;import org.hibernate.Transaction;&lt;br /&gt;import org.hibernate.classic.Session;&lt;br /&gt;&lt;br /&gt;@Path(&amp;quot;/person/&amp;quot;)&lt;br /&gt;public class PersonResource {&lt;br /&gt; &lt;br /&gt; @GET @Path(&amp;quot;{personId}/&amp;quot;) @Produces(&amp;quot;application/json&amp;quot;)&lt;br /&gt; public Person getPerson(@PathParam(&amp;quot;personId&amp;quot;) int personId) {&lt;br /&gt;  Session session = HibernateUtil.getSessionFactory().getCurrentSession();&lt;br /&gt;  Transaction tx = null;&lt;br /&gt;  Person personClean;&lt;br /&gt;  &lt;br /&gt;  try{&lt;br /&gt;   tx = session.beginTransaction();&lt;br /&gt;   Person person = (Person) session.load(Person.class,personId);&lt;br /&gt;   &lt;br /&gt;   Mapper mapper = new DozerBeanMapper();&lt;br /&gt;   personClean = mapper.map(person,Person.class);&lt;br /&gt;&lt;br /&gt;   session.getTransaction().commit();&lt;br /&gt;&lt;br /&gt;  } catch( Exception ex) {&lt;br /&gt;   if( tx != null ) tx.rollback();&lt;br /&gt;         throw new WebApplicationException(Response.Status.NOT_FOUND);&lt;br /&gt;  }&lt;br /&gt;  return personClean;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; @GET @Produces(&amp;quot;application/json&amp;quot;)&lt;br /&gt; public PersonCollection get() {&lt;br /&gt;  Session session = HibernateUtil.getSessionFactory().getCurrentSession();&lt;br /&gt;    session.beginTransaction();&lt;br /&gt;  List&amp;lt;person&amp;gt; result = session.createQuery(&amp;quot;from Person&amp;quot;).list();&lt;br /&gt;&lt;br /&gt;  Mapper mapper = new DozerBeanMapper();&lt;br /&gt;  PersonCollection persons = new PersonCollection();&lt;br /&gt;        &lt;br /&gt;  for( Person person : result ) {&lt;br /&gt;    persons.add(mapper.map(person,Person.class));&lt;br /&gt;  }&lt;br /&gt;  session.getTransaction().commit();&lt;br /&gt;        &lt;br /&gt;  return persons;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; @POST @Consumes(&amp;quot;application/json&amp;quot;)&lt;br /&gt; @Produces(&amp;quot;application/json&amp;quot;)&lt;br /&gt; public Person post(Person person) {&lt;br /&gt;  Session session = HibernateUtil.getSessionFactory().getCurrentSession();&lt;br /&gt;  session.beginTransaction();&lt;br /&gt;  &lt;br /&gt;  session.save(person);&lt;br /&gt;  &lt;br /&gt;  session.getTransaction().commit();&lt;br /&gt;  return person;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; @GET @Path(&amp;quot;delete/{personId}/&amp;quot;) @Produces(&amp;quot;application/json&amp;quot;)&lt;br /&gt; public Person deleteOne(@PathParam(&amp;quot;personId&amp;quot;) int personId) {&lt;br /&gt;  Session session = HibernateUtil.getSessionFactory().getCurrentSession();&lt;br /&gt;  session.beginTransaction();&lt;br /&gt;  Transaction tx = null;&lt;br /&gt;        Person personClean;&lt;br /&gt;  &lt;br /&gt;  try{&lt;br /&gt;   tx = session.beginTransaction();&lt;br /&gt;   Person person = (Person) session.load(Person.class,personId);&lt;br /&gt;   session.delete(person);&lt;br /&gt;   &lt;br /&gt;   Mapper mapper = new DozerBeanMapper();&lt;br /&gt;   personClean = mapper.map(person,Person.class);&lt;br /&gt;&lt;br /&gt;   session.getTransaction().commit();&lt;br /&gt;&lt;br /&gt;  } catch( Exception ex) {&lt;br /&gt;   if( tx != null ) tx.rollback();&lt;br /&gt;         throw new WebApplicationException(Response.Status.NOT_FOUND);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  return personClean;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Open Questions:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I'm not sure where the Hibernate &lt;b&gt;session should be closed&lt;/b&gt;. I don't think this can be done at the end of each handler method.&lt;/li&gt;&lt;li&gt;How to &lt;b&gt;use JTA&lt;/b&gt; for transaction management instead of direct JDBC transaction management?&lt;/li&gt;&lt;li&gt;Most of the Hibernate-specific code should go into a &lt;b&gt;DAO&lt;/b&gt;, with most of it into a generic DAO. But the recommended by Hibernate &lt;a href="https://www.hibernate.org/328.html"&gt;documentation&lt;/a&gt; generic DAO is defined in terms of &lt;b&gt;state-oriented data access API&lt;/b&gt; (makePersistent() and makeTransient() methods), which are less intuitive for me. What is the advantage of using them and how to use them from CRUD operations?&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8357592729244505507?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8357592729244505507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8357592729244505507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8357592729244505507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8357592729244505507'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/json-restfull-service-using-jersey-with.html' title='JSON RESTfull Service Using Jersey with Hibernate Persistence on Glassfish'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4648959734365311341</id><published>2010-02-17T14:29:00.000-08:00</published><updated>2010-02-17T14:37:30.249-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='datasource'/><title type='text'>Configure Hibernate to Use A Datasource</title><content type='html'>I'm using Glassfish application server, on which (using its Console) I have created a JDBC datasource (&lt;i&gt;JDBC Resource&lt;/i&gt;). I'd like configure the hibernate framework to use it. The resons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Connection pooling (it's true that I could use the Hibernate's own connection pooling)&lt;/li&gt;&lt;li&gt;Portability: moving the application to another application server is easy, as long as they both provide a datasource with the same name (Hibernate dialect may still need to be changed appropriately).&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;hibernate.cfg.xml File&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush:xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE hibernate-configuration PUBLIC&lt;br /&gt;  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"&lt;br /&gt;  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;hibernate-configuration&amp;gt;&lt;br /&gt;    &amp;lt;session-factory name="hibernate/sessionFactory"&amp;gt;&lt;br /&gt;        &amp;lt;property name="connection.datasource"&amp;gt;jdbc/derbydb&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="dialect"&amp;gt;org.hibernate.dialect.DerbyDialect&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="current_session_context_class"&amp;gt;thread&amp;lt;/property&amp;gt;&lt;br /&gt;        &amp;lt;property name="hbm2ddl.auto"&amp;gt;create&amp;lt;/property&amp;gt;&lt;br /&gt;    &lt;br /&gt;     &amp;lt;mapping resource="olcc/entity/Person.hbm.xml"/&amp;gt;&lt;br /&gt;    &amp;lt;/session-factory&amp;gt;&lt;br /&gt;&amp;lt;/hibernate-configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;HibernateUtil.java File&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;private static SessionFactory buildSessionFactory() {&lt;br /&gt;    return new Configuration().configure().buildSessionFactory();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;The Application Code&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush:java"&gt;Session session = HibernateUtil.getSessionFactory().getCurrentSession();&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4648959734365311341?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4648959734365311341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4648959734365311341' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4648959734365311341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4648959734365311341'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/configure-hibernate-to-use-datasource.html' title='Configure Hibernate to Use A Datasource'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4355993301439655915</id><published>2010-02-11T14:35:00.000-08:00</published><updated>2010-02-11T14:38:13.747-08:00</updated><title type='text'>Using Powermock to Mock Java Objects for Unit Testing</title><content type='html'>This test uses the EasyMock style (as opposed to Mockito style), so it needed the corresponding file &lt;a href="http://code.google.com/p/powermock/downloads/list"&gt;download&lt;/a&gt;. The code sample (click on &lt;i&gt;view source&lt;/i&gt; icon to see it better): &lt;pre class="brush: java"&gt;import org.junit.Test;&lt;br /&gt;import org.junit.runner.RunWith;&lt;br /&gt;&lt;br /&gt;import static org.easymock.EasyMock.expect;&lt;br /&gt;import static org.powermock.api.easymock.PowerMock.*;&lt;br /&gt;import org.powermock.core.classloader.annotations.PrepareForTest;&lt;br /&gt;import org.powermock.modules.junit4.legacy.PowerMockRunner;&lt;br /&gt;&lt;br /&gt;@RunWith(PowerMockRunner.class)&lt;br /&gt;@PrepareForTest({Person.class })&lt;br /&gt;public class PersonResourceTest {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Test&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; public void testPost() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Person personMock = createMock(Person.class);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;expect(personMock.getName()).andReturn("Jon Smith");&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;replay(personMock);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do the test...&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Assert.assertEquals("Jon Smith", result.name);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4355993301439655915?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4355993301439655915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4355993301439655915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4355993301439655915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4355993301439655915'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/using-powermock-to-mock-java-objects.html' title='Using Powermock to Mock Java Objects for Unit Testing'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2859214074287840770</id><published>2010-02-10T17:07:00.000-08:00</published><updated>2010-02-10T17:07:01.785-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='rules'/><category scheme='http://www.blogger.com/atom/ns#' term='domain'/><category scheme='http://www.blogger.com/atom/ns#' term='integrity'/><title type='text'>SQL Checks And Rules</title><content type='html'>In most data models, there are columns that should take values only from a limited set.&amp;nbsp; For example, a state of License (as in our current project) may only take three values: AppliedFor, Granted or Denied. This kind of restriction is part of what is called &lt;a href="http://www.databasedev.co.uk/domain_integrity.html"&gt;Domain Level Integrity&lt;/a&gt;. How do you implement it?&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Old Way: Separate Table&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;I used to create a separate table for the allowed values. It can be done, but this table has only couple records in it, is rarely updated and using a whole table for this is almost an overkill. Also, you end up writing more code to manipulate it.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;New Way: SQL Rules&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;There is an SQL construct purpose of which is exactly this kind of constraint: SQL Rule (for Sybase docs: see &lt;a href="http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@ebt-link;pt=2919?target=%25N%15_37302_START_RESTART_N%25"&gt;this&lt;/a&gt;). An example:&lt;br /&gt;&lt;br /&gt;&lt;pre style="color: #0b5394;"&gt;create rule pub_idrule &lt;br /&gt;as @pub_id in ("1389", "0736", "0877", "1622", "1756")&lt;br /&gt;or @pub_id like "99[0-9][0-9]"&amp;nbsp;&lt;/pre&gt;&lt;pre style="color: cyan;"&gt;&amp;nbsp;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2859214074287840770?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2859214074287840770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2859214074287840770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2859214074287840770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2859214074287840770'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/sql-checks-and-rules.html' title='SQL Checks And Rules'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4863659136623917706</id><published>2010-02-03T09:30:00.000-08:00</published><updated>2010-02-03T09:30:18.916-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='persistence'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='orm'/><title type='text'>Persistence Frameworks, ORMs</title><content type='html'>The big three, I consider mainstream (from Java perspective):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Hibernate&lt;/li&gt;&lt;li&gt;JPA&lt;/li&gt;&lt;li&gt;JDO&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;I have sorted them in the &lt;i&gt;market share&lt;/i&gt; order, but there are some interesting facts that make all three important:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Hibernate is definitely the strongest, most popular ORM framework for Java and .Net, but it's not a standard per se.&lt;/li&gt;&lt;li&gt;JPA is a standard and it's fully supported by HIbernate, so choosing it gives you some advantages over Hibernate. Its design was based on Hibernate and JDO.&lt;/li&gt;&lt;li&gt;You can use Hibernate and restrict yourself to the JPA-only, which gives you a portability to another JPA-type framework, if you so choose in future.&lt;/li&gt;&lt;li&gt;JDO, although the oldest one, is the preferred persistence mechanism for Google Application Engine, the Java application hosting service of Google (although, you can also use JPA with it).&lt;/li&gt;&lt;/ul&gt;Which framework to choose? Your choice.&amp;nbsp; Need more help choosing? Try this &lt;a href="http://madgeek.com/Articles/ORMapping/EN/mapping.htm"&gt;article&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4863659136623917706?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4863659136623917706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4863659136623917706' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4863659136623917706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4863659136623917706'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/02/persistence-frameworks-orms.html' title='Persistence Frameworks, ORMs'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3209783809946451124</id><published>2010-01-02T08:46:00.000-08:00</published><updated>2010-01-03T08:12:21.234-08:00</updated><title type='text'>Trends in Web Application Development</title><content type='html'>Recently, I have been exploring the landscape of web application development a little but.&amp;nbsp; Here are some of the results. Comments are welcome. What is the real trend?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Overall Look&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Simple. I have used indeed.com trends tool to compare number of jobs openings for major web application development platforms and technologies. Result is below:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_e4sNHM9RAKE/S0DAF95LsHI/AAAAAAAAADs/F-70YRwKUc0/s1600-h/web+developer+jobs.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_e4sNHM9RAKE/S0DAF95LsHI/AAAAAAAAADs/F-70YRwKUc0/s400/web+developer+jobs.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Some conclusions that seem obvious:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Major development platforms had a hit in mid-2008, but recently are slowing down. Note, that the latter can't be explained with economy, since the graph shows the percentage of job postings, not the absolute numbers. Possibly, hiring in IT slowed down as compaed to other areas, though.&lt;/li&gt;&lt;li&gt;Definitely, the Web2.0 (RIA) technologies are experiencing the strongest, or better to say the only growth. Look at Ajax. More analysis on this below.&lt;/li&gt;&lt;/ul&gt;Now, to verify this result, let's see the results from google.com/trends. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Server-Side Technologies&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;This comes from google.com/trends:&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;Server-Side Technologies &lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_e4sNHM9RAKE/Sz91c23JxiI/AAAAAAAAADM/fAL5XNANwi8/s1600-h/google+web-appl+technologies.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_e4sNHM9RAKE/Sz91c23JxiI/AAAAAAAAADM/fAL5XNANwi8/s400/google+web-appl+technologies.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;One technology, I have definitely missed on the indeed.com side, it seems, is the PHP. A strong player.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Client-Side Technologies&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;Client-Side Technologies &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_e4sNHM9RAKE/Sz925Nc2elI/AAAAAAAAADU/yQZELdqBLpM/s1600-h/google+web-appl+client+tech.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_e4sNHM9RAKE/Sz925Nc2elI/AAAAAAAAADU/yQZELdqBLpM/s400/google+web-appl+client+tech.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;The most surprising conclusion from the graph above is that Flash technology is so much above all of the rest. And it's significantly more obvious than on the job openings analysis. That may mean, that Flash is coming to the market as a strong candidate. However, since flash is not necessarily used for application development, I am adding another graph, with &lt;i&gt;flex web&lt;/i&gt; instead of &lt;i&gt;flash.&lt;/i&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;RIA (Web2.0) Technologies &lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_e4sNHM9RAKE/Sz985k4dtII/AAAAAAAAADc/pLkVho2IXVY/s1600-h/google+web-appl+client+tech+2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_e4sNHM9RAKE/Sz985k4dtII/AAAAAAAAADc/pLkVho2IXVY/s400/google+web-appl+client+tech+2.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Here. it seems we can see the currently strongest players. Ajax, which, unfortunately is split among many libraries, is still the front runner. However, it seems to give in to Flex and Silverlight. That wouldn't be a big surprise, since Ajax based on JavaScript is a rather low-level development hack, only somewhat improved by using an Ajax framework.&lt;br /&gt;Finally, one more graph. It comes from indeed.com. A comparison of job openings for Flex, Silverlight and GWT developer jobs:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_e4sNHM9RAKE/S0C-ngOD0gI/AAAAAAAAADk/ew4iVMMCwgo/s1600-h/flex+sliver+gwt+dev+jobs.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_e4sNHM9RAKE/S0C-ngOD0gI/AAAAAAAAADk/ew4iVMMCwgo/s400/flex+sliver+gwt+dev+jobs.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;And, just for a comparison, a sample of mobile development job trends:&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_e4sNHM9RAKE/S0DBfVNClkI/AAAAAAAAAD8/C9wHv9Iq8sg/s1600-h/android+iphone+dev+jobs.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_e4sNHM9RAKE/S0DBfVNClkI/AAAAAAAAAD8/C9wHv9Iq8sg/s400/android+iphone+dev+jobs.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;So, that's it for my analysis. What do you think? What is the future of web application development? Specifically:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What should application developers invest in for the the 2010?&lt;/li&gt;&lt;li&gt;What will in be over the next five years (futuristic prediction)?&lt;/li&gt;&lt;/ul&gt;Waiting for your comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3209783809946451124?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3209783809946451124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3209783809946451124' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3209783809946451124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3209783809946451124'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2010/01/trends-in-web-application-development.html' title='Trends in Web Application Development'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_e4sNHM9RAKE/S0DAF95LsHI/AAAAAAAAADs/F-70YRwKUc0/s72-c/web+developer+jobs.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7062753821931026405</id><published>2009-12-24T06:00:00.000-08:00</published><updated>2009-12-24T06:38:19.782-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mock'/><category scheme='http://www.blogger.com/atom/ns#' term='unittesting'/><category scheme='http://www.blogger.com/atom/ns#' term='mocking'/><title type='text'>Mocking Objects To Unit Test Android OS Applications</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;First Things First&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;Testing applications for Android OS can be done in two ways:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;test on the Android platform using android.test and android.test.mock classes, or&lt;/li&gt;&lt;li&gt;testing on the development machine using the regular Java VM and standard Java unit testing and object mocking frameworks.&lt;/li&gt;&lt;/ul&gt;The good discussion as to pros and cons of each is presented in this &lt;a href="https://sites.google.com/site/androiddevtesting/"&gt;article&lt;/a&gt; by a Google developer (although not an Android developer). The conclusion was to use the second option, due to valid limitations ofTo the first approach.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Mocking &lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;What are mock objects? They are &lt;i&gt;fake&lt;/i&gt; objects that can pretend to the callers to be an object they pretend to be, but are under &lt;i&gt;full control&lt;/i&gt; of the test. Full control means two things here:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; The test can monitor what methods of a mock object are called during the test and what parameters are provided, and&lt;/li&gt;&lt;li&gt;The test can dictate what results a mock class should return, without having to actually use, or even implement the class that is mocked.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Why mock objects? Without mocking objects, unit testing is limited to cases where the class under test doesn't use any other classes, or may be just some basic classes. The fuller answer is to &lt;i&gt;why&lt;/i&gt;, can be given the following answers. To simplify explaining these answers, let's assume that we want to test class A which uses class B:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If some of the &lt;b&gt;class A results depend on class B results&lt;/b&gt;. Without using mocking, the test would include the testing of class B. Often, we want to be able to write a test that tests just a single class. Smaller tests can be less brittle, that is they don't break as often with the changes done to the code after the test has been written.&lt;/li&gt;&lt;li&gt;If &lt;b&gt;using class B in the test environment is not practical&lt;/b&gt;. For example, if the class B is a database, a web service or a GPS module, both of which are tightly coupled to the real world. &lt;/li&gt;&lt;li&gt;If we want to &lt;b&gt;test class A before class B is implemented&lt;/b&gt;, so it doesn't exists, yet.&lt;/li&gt;&lt;li&gt;In general, mocking allows us to test not only an internal code of class A, but also if it uses class B correctly. So, it &lt;b&gt;tests the class collaboration&lt;/b&gt;. &lt;/li&gt;&lt;/ul&gt;For more info on this topic see wikipedia &lt;a href="http://en.wikipedia.org/wiki/Mock_object"&gt;article&lt;/a&gt; or &lt;a href="http://www.sizovpoint.com/2009/03/java-mock-frameworks-comparison.html"&gt;this&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;What Tools Are Available for Mocking?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The least of tools is quite long. In last couple years, I used probably the following ones:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;JMock&lt;/li&gt;&lt;li&gt;Easy Mock&lt;/li&gt;&lt;li&gt;Mockito&lt;/li&gt;&lt;li&gt;PowerMock&lt;/li&gt;&lt;/ul&gt;The reasons I moved from one framework to another are new features (PowerMock can mock even static and final methods) and simpler syntax/tests (esp. Mockito). Also, PowerMock is in a way a conglomerate of Mockito and EasyMock. Although, that means that sometimes, when you use PowerMock you have to use the Mockito, and sometimes the EasyMock like API's. The good part is, that onces you know what mocking is about, using different API's is not that different.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7062753821931026405?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7062753821931026405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7062753821931026405' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7062753821931026405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7062753821931026405'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/12/mocking-objects-to-unit-test-android-os.html' title='Mocking Objects To Unit Test Android OS Applications'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6090700158410109369</id><published>2009-12-14T17:02:00.000-08:00</published><updated>2010-02-09T10:44:57.674-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful'/><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>Using JSON RESTfull Web Services in A Flex Application</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Choice of JSON Library for Flex&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;After a few hours of googling, I have decided that the strongest candidate is the corelib library, which for ActionScript 3 is called &lt;i&gt;as3corelib&lt;/i&gt;. It's hosted on Google code, although there are multiple references to it on Adobe website. However, none of these references pointed me to any trace of corelib on Adobe website. I wasn't able to figure out why. Leave a comment if you know the story behind.&lt;br /&gt;&lt;br /&gt;It seems, that Flash Builder 4 comes with a HTTPService Wizard, which can import a JSON webservice, among other formats.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Limitations of Flash HttpService for RESTfull Webservices&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The problem is that because FlashPlayer uses the browser for all networking operations, and Safari browser supports only Post and Get operations, HttpService doesn't support Put, Delete, Headers and Options operations. As a workaround, there is a library hosted on Google Code called RestHttpService, that can be used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6090700158410109369?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6090700158410109369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6090700158410109369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6090700158410109369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6090700158410109369'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/12/using-json-restfull-web-services-in.html' title='Using JSON RESTfull Web Services in A Flex Application'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1911346596613746305</id><published>2009-12-14T13:23:00.000-08:00</published><updated>2010-03-19T14:55:09.438-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ide'/><category scheme='http://www.blogger.com/atom/ns#' term='howto'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><title type='text'>Using Eclipse IDE: Tips, Facts and Tricks</title><content type='html'>&lt;ul&gt;&lt;li&gt;If a value gets stuck in Eclipse caches/preferences that doesn't make sense and you can't find a way to update to the new value using Eclipse GUI:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Search the workspace/.metadata folder for the obsolete value and correct it, esp. the .settings files. Don't touch binary files, unless you know what you're doing.&lt;/li&gt;&lt;li&gt;clean the Eclipse cache by starting exlipse, just once, with the first command line argument set to -clean&lt;/li&gt;&lt;li&gt;export preferences, switch to a new workspace and re-import the saved prefs.&lt;/li&gt;&lt;li&gt;reinstall Eclipse&lt;/li&gt;&lt;/ul&gt;For more info see this great &lt;a href="http://www.eclipsezone.com/eclipse/forums/t61566.html"&gt;article&lt;/a&gt;. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;The &lt;b&gt;&lt;i&gt;Project Delete&lt;/i&gt; doesn't delete any files&lt;/b&gt; from the project directory, not even from the .settings folder, unless you check the &lt;i&gt;Delete files...&lt;/i&gt; checkbox. Question: is any information lost if I delete a project and then re-import it?&lt;/li&gt;&lt;li&gt;How to add a .jar file to &lt;b&gt;classpath without using absolute paths&lt;/b&gt;? Follow these steps:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to Windows &amp;gt; Prefs &amp;gt; Java &amp;gt; Build Path &amp;gt; Claspath variable. Add a new variable pointing to the jar or to a folder, if there are many jars to add. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Go to Java Build Path of your project and click Add Variable. If you have specified a var pointing to a single jar, just select it and click OK. If you have created a var pointing to a folder, select it and click Extend. Then, select the jars you want to add (you can add them all in one step). Click OK.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;How can I &lt;b&gt;move project to another folder&lt;/b&gt;? For me this works:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Delete the project&lt;/li&gt;&lt;li&gt;Move the folder&lt;/li&gt;&lt;li&gt;Re-import the project&lt;/li&gt;&lt;/ul&gt;&amp;nbsp; &lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1911346596613746305?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1911346596613746305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1911346596613746305' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1911346596613746305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1911346596613746305'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/12/using-eclipse-ide-tips-facts-and-tricks.html' title='Using Eclipse IDE: Tips, Facts and Tricks'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3535983952251725935</id><published>2009-12-08T09:05:00.000-08:00</published><updated>2010-02-22T10:40:17.386-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='restful'/><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><title type='text'>RESTfull Webservices Using Java with Introduction to JSON</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;What are RESTfull or Rest web services and how can they be implemented in with Java? Also what is JSON and how to make a webservice that returns a JSON object?&amp;nbsp; This is what this blog is about. Specifically, first, about installing and running a sample RESTfull application available from Jersey project.&lt;br /&gt;&lt;br /&gt;What are RESTfull webservices?  See &lt;a href="http://www.infoq.com/articles/roa-rest-of-rest"&gt;this&lt;/a&gt; article. Or any other; there are many.&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: x-large;"&gt;&lt;b&gt;Approach 1 &lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;This approach uses one of the samples provided&amp;nbsp;by the Jersey project and uses Maven to install the libraries. It's a bit heavy approach, but it works. Approach 2 below also uses Jersey, but is way lighter and simpler.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Server Side&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;I'm using Eclipse IDE with Glassfish Application Server. The steps for this configuration are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Add &lt;i&gt;Jersey&lt;/i&gt; and Jersey &lt;i&gt;Documentation and Examples&lt;/i&gt; components to Glassfish using its admin console. Note, use GlassFish v3 Prelude version.&amp;nbsp; When I used GlassFish v3 Promoted Build, the Examples module was not showing in its Update Tool.&lt;/li&gt;&lt;li&gt;Restart the GF server. &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Find the Jersey samples in GF_Home/glassfish/jersey folder.&amp;nbsp; Go into helloworld-webapp folder. You should see a .pom file there, that is used by maven. From that folder, run "mvn clean package" command. Install maven if needed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Maven installs many files, and for me it ended with an error saying it can't read the glassfish-embedded-all-3.0-Prelude-Embedded-b10.jar file.&amp;nbsp; I have located this file in the maven repository (Documents and Settings/user/.m2/...) and found that it was broken.&amp;nbsp; I had to download it manually from internet (search by the file name).&lt;/li&gt;&lt;li&gt;Rerun the mvn command. It finished successfully and created a war file in the target directory.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Open GF console, and from Web Applications do a deploy. Point to the above war file and click OK. That did it.&lt;/li&gt;&lt;li&gt;Point your browser to &lt;a href="http://localhost:8080/helloworld-webapp/helloworld"&gt;http://localhost:8080/helloworld-webapp/helloworld&lt;/a&gt;. The string "Hello World" appeared.&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Analyzing the Sample&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;After I had the sample running, I have exploded and analyzed the contents of the generated war file. The file had a class file implementing the resource plus two more short config files. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;sun-web.xml:&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;sun-web-app error-url=""&amp;gt;&lt;br /&gt;  &amp;lt;context-root&amp;gt;/helloworld-webapp&amp;lt;/context-root&amp;gt;&lt;br /&gt;  &amp;lt;class-loader delegate="true"/&amp;gt;&lt;br /&gt;  &amp;lt;jsp-config&amp;gt;&lt;br /&gt;    &amp;lt;property name="keepgenerated" value="true"&amp;gt;&lt;br /&gt;      &amp;lt;description&amp;gt;Keep a copy of the generated servlet class' java code.&amp;lt;/description&amp;gt;&lt;br /&gt;    &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;/jsp-config&amp;gt;&lt;br /&gt;&amp;lt;/sun-web-app&amp;gt;&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;web.xml:&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&amp;gt;&lt;br /&gt;    &amp;lt;servlet&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;Jersey Web Application&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;servlet-class&amp;gt;com.sun.jersey.spi.container.servlet.ServletContainer&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;        &amp;lt;init-param&amp;gt;&lt;br /&gt;            &amp;lt;param-name&amp;gt;com.sun.jersey.config.property.packages&amp;lt;/param-name&amp;gt;&lt;br /&gt;            &amp;lt;param-value&amp;gt;com.sun.jersey.samples.helloworld.resources&amp;lt;/param-value&amp;gt;&lt;br /&gt;        &amp;lt;/init-param&amp;gt;&lt;br /&gt;        &amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;br /&gt;    &amp;lt;/servlet&amp;gt;&lt;br /&gt;    &amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;        &amp;lt;servlet-name&amp;gt;Jersey Web Application&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;        &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;    &amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&amp;lt;/web-app&amp;gt;&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: x-large;"&gt;Approach 2&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Approach 1 worked OK, but I wasn't able to apply the sample to deploy an application of my own. And so I searched for a tutorial that uses Eclipse and possibly no Maven. I have run into this mini &lt;a href="http://www.vogella.de/articles/REST/article.html"&gt;tutorial&lt;/a&gt; which worked great. I was able to drop this application into a Tomcat 6.0 and GlassFish 3 Prelude containers and it worked in both fine.&lt;br /&gt;Also, this example illustrates how the service can be implemented for different response formats, leaving to the requestor to decide which one to use.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: x-large;"&gt;JSON&lt;/span&gt;&lt;/b&gt; &lt;br /&gt;&amp;nbsp;JSON is simply a format, in a way an alternative to XML, that is especially useful for (de-)serializing objects, for example in order to send them over internet. The format is derived from JavaScript native format, but it became language neutral.&amp;nbsp; Here's a sample:&lt;br /&gt;&lt;pre&gt;{"name":"Alfred Alfredo","age":"47"}&lt;/pre&gt;A nice and concise description of JSON syntax is on JSON &lt;a href="http://json.org/"&gt;website&lt;/a&gt;. To have your RESTfull webservice return a JSON object, download and add to the project jettison.jar that Jersey uses to create a JSON object. Now, for the sake of the demonstration, say that the webservice need to return a Person object:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;@XmlRootElement&lt;br /&gt;public class Person {&lt;br /&gt; public String name;&lt;br /&gt; public int age;&lt;br /&gt; &lt;br /&gt; public Person() {} // required by JAXB&lt;br /&gt; &lt;br /&gt; public Person(String name, int age) {&lt;br /&gt;  this.name = name;&lt;br /&gt;  this.age = age;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Thanks to the annotations in this class, in order to return a JSON object we just need to define a method:&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;@Path("/person")&lt;br /&gt;public class PersonResource {&lt;br /&gt;  @GET  @Produces("application/json")&lt;br /&gt;  public Person get() {&lt;br /&gt;   return new Person("Alfred Alfredo",47);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;The JSON object as specified above, in the first part of this section will be returned. You can test it using a browser by pointing it to http://localhost:8080/jersey1/rest/person, where &lt;i&gt;jersey1&lt;/i&gt; is the context of my web app, &lt;i&gt;rest&lt;/i&gt; is my servlet mapping and &lt;i&gt;person&lt;/i&gt; is what I defined with @Path in my RESTful resource class.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3535983952251725935?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3535983952251725935/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3535983952251725935' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3535983952251725935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3535983952251725935'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/12/flex-and-restfull-webservices.html' title='RESTfull Webservices Using Java with Introduction to JSON'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1582085368007971400</id><published>2009-12-01T12:20:00.001-08:00</published><updated>2009-12-14T09:59:34.959-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pdf'/><category scheme='http://www.blogger.com/atom/ns#' term='business objects'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='web applications'/><title type='text'>Presenting Business Objects Reports in PDF Format Using Web Services</title><content type='html'>Suppose you have a web application, whether of an RIA type or Web 1.0 type, that needs to present a report. One of the attractive options, is to have the report show in the browser as a PDF document. It seems an interesting option, because most users already have Adobe Acrobat Reader installed and are familiar with it. They usually know how to navigate through the document, print it or save it for emailing or just for later use.&lt;br /&gt;If your organization is also one of the many that use Business Objects (BO) as their standard reporting technology, the solution presented below may be for you.&lt;br /&gt;&lt;br /&gt;Since version XII, the Business Object Enterprise server is bundled and by default installs the web services module which allows to access reports via SOAP web services. Here's the solution:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The web application requests a report by calling the special reporting servlet, passing to it the report ID and required parameters.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The servlet uses web services to login to BO server and request the report, which then is returned to the client and displayed in a new browser tab or window in Acrobat Reader.&lt;/li&gt;&lt;/ul&gt;The example below, shows the solution for the case when the client is a Flex application and the servlet is implemented in Java.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Reporting Servlet&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The servlet consists of the following modules:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;login module (login to BO server)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;report parms module (requests a list of the parameters required by the report and prepares them)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;report viewer module (configures the request to return the report in PDF format)&lt;/li&gt;&lt;li&gt;retrieve and deliver module (requests the report from BO server and sends it on its way back to the client)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;Login Module:&lt;/b&gt;&lt;br /&gt;&lt;pre class="brush: java"&gt;&lt;span style="font-size: 90%;"&gt;&lt;br /&gt;  SessionSoap session = new SessionSoapProxy("http://crystalbo:8080/dswsbobje/services/session");&lt;br /&gt;  EnterpriseCredential credents = new EnterpriseCredential();&lt;br /&gt;  credents.setLogin(businObjectsLoginName);&lt;br /&gt;  credents.setPassword(businObjectsLoginPwd);&lt;br /&gt;  SessionInfo si = session.login(credents);&lt;br /&gt;  if( si == null ) { login failed... }&lt;br /&gt;  // Instantiate Report Engine&lt;br /&gt;  ReportEngineSoap rptEngine = new ReportEngineSoapProxy();&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1582085368007971400?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1582085368007971400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1582085368007971400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1582085368007971400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1582085368007971400'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/12/presenting-business-objects-reports-in.html' title='Presenting Business Objects Reports in PDF Format Using Web Services'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7553825340504988704</id><published>2009-11-16T16:28:00.000-08:00</published><updated>2009-11-30T09:20:09.519-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>FlashPlayer and Flex Security Restrictions When Consuming a Webservice</title><content type='html'>Here our system configuration (scenario):&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Server A: hosts your Flex application&lt;/li&gt;&lt;li&gt;Server B: hosts a webservice consumed by your Flex application&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&amp;nbsp;In order for your Flex application to be able to consume the webservice in above scenario, you have two options:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Place in the root of the application server on Server B a crossdomain.xml file specifying: allow-access-from-domain: server-A-domain, or&lt;/li&gt;&lt;li&gt;Use the Proxy service on Server A, which is part of LCDS and BlazeDS dataservices.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7553825340504988704?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7553825340504988704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7553825340504988704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7553825340504988704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7553825340504988704'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/11/flashplayer-and-flex-security.html' title='FlashPlayer and Flex Security Restrictions When Consuming a Webservice'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-878079200181960159</id><published>2009-11-10T14:32:00.000-08:00</published><updated>2009-11-10T14:32:35.211-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='voice'/><category scheme='http://www.blogger.com/atom/ns#' term='cost'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='billing'/><title type='text'>Google Voice: Can I Make Calls and Receive Them Without Using My Air-time Minutes?</title><content type='html'>It's tricky, and I have wasted $55 by not understanding this. You always can make free calls to continental US if you place the call from the GV website. But, how about calling from you cell phone?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Scenario: GV Account with GV Mobile Application &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;If you:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;open a Google Voice (GV) account and add you cell phone number to it&lt;/li&gt;&lt;li&gt;download to your mobile device a GV application (I'm using Android, G1)&lt;/li&gt;&lt;li&gt;make a call, or receive, a call selecting Google Voice for this, when asked,&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;The call will use your minutes!&lt;/b&gt; I have experienced this and it costed me. I know.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Scenario: As Above with myFavs&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;If you:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;have myFavs or a similar service on your cell phone plan, and&amp;nbsp;&lt;/li&gt;&lt;li&gt;you add your GV number to your favs&lt;/li&gt;&lt;li&gt;receive a call or call you GV voice mail: &lt;b&gt;your minutes won't be used&lt;/b&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; place call: &lt;b&gt;your minutes will be used&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Scenario: As Above with A Twist&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;If you add to your favs also the number that GV calls when you initiate a call, no minutes will be charged. However, for some reason, this number changes. So, this is not a robust solution.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-878079200181960159?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/878079200181960159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=878079200181960159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/878079200181960159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/878079200181960159'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/11/google-voice-can-i-make-calls-and.html' title='Google Voice: Can I Make Calls and Receive Them Without Using My Air-time Minutes?'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1676556239002861894</id><published>2009-10-31T08:17:00.000-07:00</published><updated>2009-11-01T08:36:37.397-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='tdd'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='caltal'/><title type='text'>Why TDD Rather Than Traditional QA's Writing Tests</title><content type='html'>&lt;span style="font-size: small;"&gt;First, I describe what is &lt;/span&gt;&lt;span style="font-size: small;"&gt;TDD. Then, I present a story that lead me to writing this article.&amp;nbsp; But if you don't care about stories, just skip to Conclusion and Resources&lt;/span&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;What is TDD?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;I'll describe TDD not with my own words but with a few selected excerpts from this &lt;a href="http://www.infoq.com/articles/flexmonkey-ui-unit-testing"&gt;resource&lt;/a&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The practice of maintaining automated unit test suites has gained widespread acceptance over the past decade to the point where most developers today either engage in some amount of test writing or at least feel bad for not doing it.&lt;/li&gt;&lt;li&gt;To prevent regression, developers must provide a set of tests that exercise an application top-to-bottom and end-to-end (front-end to back-end), but anecdotal evidence suggests that even automated tests covering as little as 50% of the code can effectively guard against regression in many applications.&lt;/li&gt;&lt;li&gt;Competent developers either conform to a test-first discipline in which small test harnesses are built to exercise an API before the API itself is even implemented, or else employ a code-a-little-test-a-little (CALTAL) approach in which each unit of code developed is tested immediately after its compiled.&lt;/li&gt;&lt;li&gt;Most build systems, such as &lt;b&gt;ant&lt;/b&gt;, provide direct support for running test suites as part of the application build process, and continuous integration systems, such as &lt;b&gt;Cruise Control &lt;/b&gt;or &lt;b&gt;Hudson&lt;/b&gt;, kick off such builds automatically each time code is committed to the team's version control system &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Situation&lt;/span&gt;&lt;/b&gt; &lt;br /&gt;Recently, I ran into project OpenSatNav. It's an open-source version of AndNav2, that is navigator application for Android OS based on OpenStreetMap. Great project, still pretty young, but dynamically expanding. I watched a few issues being fixed by the developers involved, and noticed that the process of findind a solution was a bit erratic. There were several attempts to guess a solution, and guesses were not perfect, but then there were a few better guesses.&amp;nbsp; Some NullPointException bugs cropped out after a few days and were fixed. Still, some issues were reported, but never reproduced, so by the token "it doesn't show the problem anymore, so let's close this issue", the issue has been closed. What was obvious to me, is that the solution is not necessarily correct. The testing was done manually and without even any systematic approach.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Spring into Action&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;It was obvious to me that what was definitely missing, was the automated testing, especially unit testing. I tried to step in and encourage unit testing. The idea of TDD, or any unit testing that I proposed several times was for the project team like a fairy tale about a bad wolf. But the developer team and the project lead were friendly and not exclusive.The lead-developer on this issue, responding to my requests, did include a well defined test-scenario with the fix code. I thought: it's not bad, I'll step in and write a unit or functional test for this fix. I have experience with TDD for Android, Java, GWT and Flex projects.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;It took me time (I have a full-time job and four children ages 4 - 19, plus, I took this as an opportunity to review the currently best practices for testing for Android OS), but finally I got to writing the test. And here's what I have found, which may be very well what also you experience is in this matter.&amp;nbsp; While writing a unit or a functional test for your own fix or new feature is a fun and a relatively straightforward activity, writing a test for a code written by someone else, is neither much fun nor simple. You end up reverse engineering the whole part of the system that surrounds the part where the fix was made.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Simple. &lt;i&gt;Write your own tests.&lt;/i&gt; This, was for me always fun and an enlightening experience. And, I think, my design and coding have improved because of the tests I wrote. Tests for &lt;i&gt;my own&lt;/i&gt; fixes.&amp;nbsp; Tests written &lt;i&gt;immediately after&lt;/i&gt; I have written the code (CALTAL), &lt;i&gt;or even just before&lt;/i&gt; I have written the code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Resources &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;The following are useful for getting quickly to speed with TDD, esp. for Android OS development:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A very nice and concise intro &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development"&gt;article&lt;/a&gt; in Wikipedia.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="https://sites.google.com/site/androiddevtesting/"&gt;Writing Unit Tests for Android&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://blog.lv25.com/2009/06/android-simple-guide-to-unit-tests.html"&gt;Android: simple guide to unit tests&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1676556239002861894?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1676556239002861894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1676556239002861894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1676556239002861894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1676556239002861894'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/why-tdd-rather-than-traditional-qas.html' title='Why TDD Rather Than Traditional QA&apos;s Writing Tests'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4088750268631874499</id><published>2009-10-29T13:17:00.000-07:00</published><updated>2009-11-30T09:17:03.697-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='jee'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Use Eclipse to Build a Starter Java Web Application</title><content type='html'>&lt;ul&gt;&lt;li&gt;Create a new eclipse project using the &lt;i&gt;Dynamic Web Project&lt;/i&gt;.&amp;nbsp;&lt;/li&gt;&lt;li&gt;After it's created, you may find an error in web.xml: Cannot find the declaration of element 'web-app'. To fix it, change all occurrences of j2ee to javaee in the attributes of the web-app tag in web.xml.&lt;/li&gt;&lt;li&gt;Place all jars required by your app:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;into yourWebApp/WEB-INF/lib folder if you want just your app to acces it&lt;/li&gt;&lt;li&gt;into tomcatHome/shared/lib folder if you want all web apps on the server to share it&lt;/li&gt;&lt;li&gt;into tomcatHome/common/lib folder if you want all application and the server to be able to use it&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4088750268631874499?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4088750268631874499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4088750268631874499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4088750268631874499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4088750268631874499'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/use-eclipse-to-build-starter-java-web.html' title='Use Eclipse to Build a Starter Java Web Application'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4074841389441339814</id><published>2009-10-29T09:36:00.000-07:00</published><updated>2009-11-30T09:14:54.984-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='engine'/><category scheme='http://www.blogger.com/atom/ns#' term='rdbms'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='javadb'/><category scheme='http://www.blogger.com/atom/ns#' term='derby'/><title type='text'>Using Derby aka JavaDB</title><content type='html'>&lt;ul&gt;&lt;li&gt;The database package is included with j2ee package or &lt;a href="http://db.apache.org/derby/quick_start.html"&gt;download&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;To start the server: go to &lt;i&gt;bin&lt;/i&gt; folder and fire-off the &lt;i&gt;startNetworkServer.bat&lt;/i&gt; or the like on other OS's.&lt;/li&gt;&lt;li&gt;To create a database: connect to the server with the following JDBC URL: jdbc:derby://localhost:1527/fiber1;create=true. Replace &lt;i&gt;fiber1&lt;/i&gt; with the name of the DB you want to be created upon connect.&lt;/li&gt;&lt;li&gt;There is a tool called DdlUtils freely available from Apache that allows migration from one DB vendor to another. That means migration of the schema and the data. Can be used via Ant or from a Java program.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4074841389441339814?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4074841389441339814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4074841389441339814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4074841389441339814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4074841389441339814'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/using-derby-aka-javadb.html' title='Using Derby aka JavaDB'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2138220902146576792</id><published>2009-10-24T08:45:00.000-07:00</published><updated>2009-11-30T09:21:07.223-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><category scheme='http://www.blogger.com/atom/ns#' term='rescue'/><title type='text'>System Recovery Using Linux</title><content type='html'>Recently, oe of our laptops failed.&amp;nbsp; It was slowly getting worse and worse.&amp;nbsp; We had to recover the files, but the installed windows OS wasn't operational any more.&amp;nbsp; I have run into a &lt;a href="http://www.sysresccd.org/Main_Page"&gt;SystemRescueCD&lt;/a&gt;. It's an open project, that provides a set of rescue-oriented tools, togather with the basic linux system on a bootable CD or USB.&lt;br /&gt;&lt;br /&gt;Here's how I have done the retrieval of the files:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Mount the windows harddisk:&lt;br /&gt;&lt;span style="background-color: #9fc5e8; color: black;"&gt;mkdir /mnt/sjb/windows&lt;/span&gt;&lt;br style="background-color: #9fc5e8; color: black;" /&gt;&lt;span style="background-color: #9fc5e8; color: black;"&gt;ntfs-g3 /dev/sda1 /mnt/sjb/windows&lt;/span&gt;&lt;br style="background-color: #9fc5e8; color: black;" /&gt;&lt;/li&gt;&lt;li&gt;Mount the USB to copy the files onto:&lt;br /&gt;&lt;span style="background-color: #6fa8dc; color: black; font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mkdir /mnt/sjb/usb&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;mount -t vfat /dev/sdb1 /mnt/sjb/usb (vfat is an extension of fat16)&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;I have also used an external harddisk connected via USB to copy a larger amount of data from the laptop's harddisk.&amp;nbsp; To find which device name I should point to to mount it (like /dev/sda1), I have used the &lt;i&gt;testdisk&lt;/i&gt; utility available on the CD.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2138220902146576792?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2138220902146576792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2138220902146576792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2138220902146576792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2138220902146576792'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/system-recovery-using-linux.html' title='System Recovery Using Linux'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6761401591386345320</id><published>2009-10-23T14:07:00.000-07:00</published><updated>2009-10-23T14:16:46.025-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='problem'/><category scheme='http://www.blogger.com/atom/ns#' term='ie'/><category scheme='http://www.blogger.com/atom/ns#' term='office'/><category scheme='http://www.blogger.com/atom/ns#' term='confluence'/><title type='text'>Confluence Wiki Office-Connector Plugin: Problem when Using IE</title><content type='html'>We have experienced problems, on some of our computers, when trying to use Office Connector plugin with IE.&amp;nbsp; Office Connector is a plugin that allows to easily edit an attached office document in its native editor, whether MS Word, Excell or OpenOffice Writer or some other. In Firefox, it works very well, once you install the add-on.&amp;nbsp; But in IE, it displays a message:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #a2c4c9; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Unable to create an ActiveX object to open&lt;br /&gt;the document. This is most likely because&lt;br /&gt;of the security settings for your browser.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The SharePoint.OpenDocuments ActiveX class is installed as part of MS Office, as part of Office Tools. The problem is not related to the IE version (both, IE6 and IE7 sometimes worked and on other computers didn't).&lt;/li&gt;&lt;li&gt;If you try to open for edit a document attached to a confluence page, the above class gets loaded into IE, and can be found in the list of loaded IE extensions.&lt;/li&gt;&lt;li&gt;To verify that it's installed correctly on your machine, run the script&lt;br /&gt;&lt;span style="background-color: #9fc5e8;"&gt;WScript.Echo "About to create an new SharePoint.OpenDocuments.1"&lt;/span&gt;&lt;br style="background-color: #9fc5e8;" /&gt;&lt;span style="background-color: #9fc5e8;"&gt;dim obj&lt;/span&gt;&lt;br style="background-color: #9fc5e8;" /&gt;&lt;span style="background-color: #9fc5e8;"&gt;set obj = CreateObject("SharePoint.OpenDocuments.1")&lt;/span&gt;&lt;br style="background-color: #9fc5e8;" /&gt;&lt;span style="background-color: #9fc5e8;"&gt;WScript.Echo "Finished"&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;After tweaking the existing versions of the MS Office on the machine, it started working. &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6761401591386345320?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6761401591386345320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6761401591386345320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6761401591386345320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6761401591386345320'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/confluence-wiki-office-connector-plugin.html' title='Confluence Wiki Office-Connector Plugin: Problem when Using IE'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3052595314946419609</id><published>2009-10-23T11:00:00.000-07:00</published><updated>2009-10-23T11:57:53.865-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vb'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='vbscript'/><category scheme='http://www.blogger.com/atom/ns#' term='vba'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>VBScript, VB, VBA Scripts and The Like: A Few Basic Facts</title><content type='html'>First two samples. A VBScript:&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #9fc5e8;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;WScript.Echo "About to create an new SharePoint.OpenDocuments.1"&lt;br /&gt;&lt;br /&gt;dim obj&lt;br /&gt;set obj = CreateObject("SharePoint.OpenDocuments.1")&lt;br /&gt;&lt;br /&gt;WScript.Echo "Finished"&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;And a VBA:&lt;br /&gt;&lt;div style="background-color: #9fc5e8; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Public Sub myTest()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim spObject As Object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim aaa As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; On Error Resume Next&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set spObject = CreateObject("SharePoint.OpenDocuments.1")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Err.Number &amp;lt;&amp;gt; 0 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aaa = "sss"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;End Sub&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In VBScript, the try/catch/finally/end try is available.&amp;nbsp; Not in VB/VBA.&lt;/li&gt;&lt;li&gt;VBA runs in a MS Office App only, while the VBScript is more like JavaScript: can run in the browser or from the command line. Use CScript.exe to run in the latter environment.&lt;/li&gt;&lt;li&gt;How to output a line to the console in VB/VBA? Don't know.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3052595314946419609?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3052595314946419609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3052595314946419609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3052595314946419609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3052595314946419609'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/vbscript-vb-vba-scripts-and-like-few.html' title='VBScript, VB, VBA Scripts and The Like: A Few Basic Facts'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3579851957545856515</id><published>2009-10-20T09:55:00.000-07:00</published><updated>2009-10-20T09:56:57.487-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='problems'/><category scheme='http://www.blogger.com/atom/ns#' term='tips'/><category scheme='http://www.blogger.com/atom/ns#' term='connection'/><category scheme='http://www.blogger.com/atom/ns#' term='remote'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Windows Remote Desktop Connection Issues</title><content type='html'>&lt;span style="font-size: large;"&gt;Clipboard Sharing Not Working&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;* if the RDPCLIP is not running, start it (Start Menu -&amp;gt; Run -&amp;gt; CMD and type RDPCLIP)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;* if it's running, restart it.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;That was tested with WinXP.&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3579851957545856515?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3579851957545856515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3579851957545856515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3579851957545856515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3579851957545856515'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/windows-remote-desktop-connection.html' title='Windows Remote Desktop Connection Issues'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6209050966131030857</id><published>2009-10-02T16:48:00.001-07:00</published><updated>2009-10-05T10:23:25.932-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='redhat'/><category scheme='http://www.blogger.com/atom/ns#' term='install'/><category scheme='http://www.blogger.com/atom/ns#' term='rpm'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='utility'/><title type='text'>RedHat Software Installation Utility RPM</title><content type='html'>Simple usage:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You need: an RPM file downloaded from rpmfind.net website or the like&lt;br /&gt;&lt;ul&gt;&lt;li&gt;On that website, provide the complete name of the package, but only the name, in main search box.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Run: rpm -Uvh name_of_the_rpm.rpm&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The nice thing: this command will not install anything until all dependencies are satisfied.&lt;/li&gt;&lt;li&gt;If any dependencies are unsatisfied, this command will indicate what is needed. Download it and append the name of additional .rpm file(s) to the command and execute again.  Continue the loop until all dependencies are satisfied.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;That's it.  For today.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6209050966131030857?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6209050966131030857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6209050966131030857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6209050966131030857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6209050966131030857'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/10/redhat-software-installation-utility.html' title='RedHat Software Installation Utility RPM'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1239982803818915613</id><published>2009-09-28T11:58:00.000-07:00</published><updated>2009-09-28T17:23:11.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='redhat'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='boot'/><title type='text'>Start An Application When Linux, RedHat, Starts</title><content type='html'>Here you go:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create a control script in /etc/init.d folder that responds to at least &lt;span style="font-style: italic;"&gt;start&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;stop&lt;/span&gt; commands.&lt;/li&gt;&lt;li&gt;In this script, include a comment line: &lt;span style="font-style: italic;"&gt;chkconfig 35 80 20&lt;/span&gt; (there is a meaning to it: for which runlevels the process is to be off or on).&lt;/li&gt;&lt;li&gt;Run the &lt;span style="font-style: italic;"&gt;chkconfig --add your_control_script&lt;/span&gt; command. Run it with --list option to verify that the control script has been added to the list of processes to start at boot time.&lt;/li&gt;&lt;li&gt; If there are any problems during boot time, they are recorded in the /var/log/boot.log and/or /var/log/messages files.&lt;/li&gt;&lt;/ul&gt;Note:&lt;br /&gt;Global environ variables are usually defined in the /etc/profile script.  This script is automatically run by every interactive shell process (or a shell process with --login argument).  The /etc/profile doesn't seem to be executed automatically during the boot process, though.  You may need to do:&lt;pre&gt;. /etc/profile&lt;/pre&gt;in your control script if you need to use any of the global environ variables.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1239982803818915613?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1239982803818915613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1239982803818915613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1239982803818915613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1239982803818915613'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/start-application-when-linux-redhat.html' title='Start An Application When Linux, RedHat, Starts'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1242795141990895180</id><published>2009-09-28T10:20:00.000-07:00</published><updated>2009-09-28T10:25:06.679-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file sharing'/><category scheme='http://www.blogger.com/atom/ns#' term='mac'/><title type='text'>How to Share Files between Mac and Other Computers</title><content type='html'>I mean, other than via a USB disk.&lt;br /&gt;&lt;br /&gt;Share Mac's Files via FTP&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to Settings -&gt; Sharing and enable &lt;span style="font-style: italic;"&gt;File Sharing&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Click the &lt;span style="font-style: italic;"&gt;Options&lt;/span&gt; button and check the &lt;span style="font-style: italic;"&gt;FTP&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;From a windows machine, point to the mac using ftp://11.123.123.321 (use mac's ip)&lt;/li&gt;&lt;li&gt;Provide your mac's user and password.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1242795141990895180?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1242795141990895180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1242795141990895180' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1242795141990895180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1242795141990895180'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/how-to-share-files-between-mac-and.html' title='How to Share Files between Mac and Other Computers'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1606626821779798436</id><published>2009-09-27T22:02:00.000-07:00</published><updated>2009-09-28T10:20:23.327-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Android: News Summary</title><content type='html'>&lt;ul&gt;&lt;li&gt;In July 2009, a new SDK version was released, called 1.5 release 3.  Was it a release corresponding to the Android update that happened 1-2 months after the Cupcake update?&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;There is also Android 1.6 SDK available, that will work only with Android 1.6 to be made available on Oct 2009.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1606626821779798436?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1606626821779798436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1606626821779798436' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1606626821779798436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1606626821779798436'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/android-news-summary.html' title='Android: News Summary'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2919358984409551689</id><published>2009-09-25T23:26:00.001-07:00</published><updated>2009-09-26T20:06:19.682-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='support'/><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='remote'/><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Connect To A Remote Windows Workstation To Provide Support</title><content type='html'>So, someone from you family, living far away from you, asked you to help him/her with her windows computer and you would like to help, but are not willing to spend $450 for air tickets. Well, sometimes it may be a good idea to spend this money and spend some time with your family.  But if there are reasons you can't do it right at this moment, but you would still like to help with the computer problem, &lt;span style="font-weight: bold;"&gt;what do you do?&lt;/span&gt;  Especially, if it's your older relative or friend?  Not really technical savvy or even scarred of this new and strange technology.&lt;br /&gt;&lt;br /&gt;One simple approach I have found (after trying two other approaches with only partial success), is a product called &lt;a href="http://teamviewer.com/"&gt;TeamViewer&lt;/a&gt;.  The personal/non-profit use is free. The thing works like this:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The person that receives the support,  downloads and runs the TeamViewerQS, which generates a random ID and password.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The supporter downloads the TeamViewer and starts it.  It asks for a user and password.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The supported needs to obtain these to pieces of information from the other person (phone, email, text message, etc.) and enter.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The rest is simple. Just like the MS Remote Desktop or VNC.&lt;/li&gt;&lt;/ul&gt;A really cool part of this is, you can actually test the TeamViewer first without getting your relative at all.  The company provides a "test" machines you can connect to for testing.  Easy, they're probably running just a bunch of windows virtual boxes.  But still, it's a good idea.&lt;br /&gt;&lt;br /&gt;Enjoy!  And do make at another time a trip to visit your family in person.  In my case, the relative I needed to help, lives in Poland.  I live in Oregon. TeamVeaver was helpful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2919358984409551689?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2919358984409551689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2919358984409551689' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2919358984409551689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2919358984409551689'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/connect-to-remote-windows-workstation.html' title='Connect To A Remote Windows Workstation To Provide Support'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7171414307705624582</id><published>2009-09-18T08:34:00.000-07:00</published><updated>2009-09-18T08:42:32.166-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='port'/><category scheme='http://www.blogger.com/atom/ns#' term='appserver'/><category scheme='http://www.blogger.com/atom/ns#' term='glassfish'/><title type='text'>Glassfish Enterprise Server: Changing Port</title><content type='html'>I couldn't find a straight and good answer easily.  So, here's what you to change the port your server is listening on:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;start the server&lt;/li&gt;&lt;li&gt;go to admin console (default: http://localhost:4848)&lt;/li&gt;&lt;li&gt;Open: Configuration -&gt; HTTP Service -&gt; Network Config -&gt; Network Listeners&lt;/li&gt;&lt;li&gt;The main port is listed as the listener1, I believe.&lt;/li&gt;&lt;/ul&gt;That's it.  Simple. You don't even need to restart the server for the change to take effect.&lt;br /&gt;&lt;br /&gt;Changing it by editing the domain.xml file is possible, but the server always chokes for a while to accept it.  You can also use &lt;span style="font-style: italic;"&gt;asadmin get server&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;asadmin set ...&lt;/span&gt; but this is still more messy than just doing it in the console.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7171414307705624582?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7171414307705624582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7171414307705624582' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7171414307705624582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7171414307705624582'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/glassfish-enterprise-server-changing.html' title='Glassfish Enterprise Server: Changing Port'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2756150130215871833</id><published>2009-09-07T08:50:00.000-07:00</published><updated>2009-09-28T11:58:27.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='wiki'/><category scheme='http://www.blogger.com/atom/ns#' term='parsing'/><category scheme='http://www.blogger.com/atom/ns#' term='interpreter'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Parsing a Text on Android Phone</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;I have a wiki markup text that I need to parse.  My first version, which I use in &lt;a href="http://www.cyrket.com/package/org.sjb.droidwiki"&gt;DroidWiki&lt;/a&gt; application for Android, is a wiki custom parsing.  I wrote my own parsing, because  I haven't found a parsing code on the internet that was light enough to be used on Android phone. That code does a regular expression matching for each wiki tag. So, every line is matched at least  Recently, I decided to try my hand at more fancy parsing: just parse into a sequence of tokens.  Below, are the results of my research on this topic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using One-Character-At-A-Time Parsing&lt;/span&gt;&lt;br /&gt;One way to solve the problem is to use a one-pass parsing, having the Java code to look at each character (just once) and isolate the tokens this way.  Using the character iterator goes like this:&lt;br /&gt;&lt;pre class="brush: java"&gt;StringCharacterIterator iter = new StringCharacterIterator(markup);&lt;br /&gt;&lt;br /&gt;for( char c = iter.first(); c != CharacterIterator.DONE; c = iter.next() ) {&lt;br /&gt;  // process the char: is it one of the characters that starts any of the syntax tokens?&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This could be fast, but the code would be complicated.  I decided for a different approach.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Using Interpreter Design Pattern&lt;/span&gt;&lt;br /&gt;The idea:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Parse the text and convert it to a sequence of basic tokens:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;every continuous piece of a regular text is a token&lt;/li&gt;&lt;li&gt;every sequence of syntax is a token (for example, the char less-than if parsing HTML text would be a simgle token by itself)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Process the list of these basic tokens and aggregate them into complete syntactical elements (for example, every complete HTML tag would be a single token).&lt;/li&gt;&lt;/ol&gt;If you want, create&lt;br /&gt;&lt;ul&gt;&lt;li&gt;a SimpleToken class for item 1 above,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;a base Token class and specialize it for more significant/complex syntactical elements for item 2 above&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2756150130215871833?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2756150130215871833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2756150130215871833' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2756150130215871833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2756150130215871833'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/parsing-text-on-android-phone.html' title='Parsing a Text on Android Phone'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3260738553863727989</id><published>2009-09-03T15:10:00.000-07:00</published><updated>2009-10-09T10:05:54.582-07:00</updated><title type='text'>Compiling a Flex Application with Ant</title><content type='html'>Introduction&lt;br /&gt;This blog summarizes how to compile a Flex application using ant.&lt;br /&gt;&lt;br /&gt;Creating the build.xml File&lt;br /&gt;The build.xml file:&lt;br /&gt;&lt;pre class="brush: as3"&gt;&amp;lt;project name="fishbaitTestModule" basedir="." default="compile_flex_project"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Properties --&amp;gt;&lt;br /&gt;&amp;lt;property environment="env" /&amp;gt;&lt;br /&gt;&amp;lt;property name="flexhome_dir" location="${env.FLEX_HOME}" /&amp;gt;&lt;br /&gt;&amp;lt;property name="src_dir" location="${basedir}/../test-src" /&amp;gt;&lt;br /&gt;&amp;lt;property name="libs_dir" location="${basedir}/libs" /&amp;gt;&lt;br /&gt;&amp;lt;property name="deploy_dir" location="${basedir}/deploy" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Define the flex ant task --&amp;gt;&lt;br /&gt;&amp;lt;taskdef resource="flexTasks.tasks" classpath="${libs_dir}/flexTasks.jar"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;target name="clean"&amp;gt;&lt;br /&gt;  &amp;lt;delete dir="${deploy_dir}" /&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;target name="init" depends="clean"&amp;gt;&lt;br /&gt;&amp;lt;mkdir dir="${deploy_dir}" /&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Don't touch.  Required by flex ant task --&amp;gt;&lt;br /&gt;&amp;lt;property name="FLEX_HOME" location="${flexhome_dir}" /&amp;gt;&lt;br /&gt;&amp;lt;target name="compile_flex_project" depends="init"&amp;gt;&lt;br /&gt; &amp;lt;mxmlc file="${src_dir}/testSuites/FishBaitTestModule.mxml" output="${deploy_dir}/FishBaitTestModule.swf"&amp;gt;&lt;br /&gt;    &amp;lt;load-config filename="${flexhome_dir}/frameworks/flex-config.xml"/&amp;gt;&lt;br /&gt;    &amp;lt;source-path path-element="${flexhome_dir}/frameworks"/&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;compiler.source-path path-element="${src_dir}"/&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;compiler.debug&amp;gt;false&amp;lt;/compiler.debug&amp;gt;       &lt;br /&gt;&lt;br /&gt;    &amp;lt;!-- List of SWC files or directories that contain SWC files. --&amp;gt;&lt;br /&gt;    &amp;lt;compiler.library-path dir="${basedir}/libs" append="true"&amp;gt;&lt;br /&gt;      &amp;lt;include name="AirMonkeyLibrary.swc" /&amp;gt;&lt;br /&gt;      &amp;lt;include name="MonkeyFlexUnitLibrary.swc" /&amp;gt;&lt;br /&gt;      &amp;lt;include name="fluint.swc" /&amp;gt;&lt;br /&gt;    &amp;lt;/compiler.library-path&amp;gt;&lt;br /&gt; &amp;lt;/mxmlc&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How To Use The Script&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;create FLEX_HOME environment variable on your system (we tested this on WinXP) and point it to Flex root folder.&lt;/li&gt;&lt;li&gt;copy files flexTasks.jar and flexTasks.tasks into &lt;ant_home&gt;libs_dir folder. You can obtain these files from Adobe.&lt;/ant_home&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Note:&lt;/span&gt; the ant FLEX_HOME property just above the compile_flex_project target needs to be there; it seems that the mxmlc task uses and requires it, even if you already have envvar with the same name setup on your system.&lt;/li&gt;&lt;li&gt;the src_dir, libs_dir properties point to folders where the Flex source, required SWC files are located, respectively. The deploy_dir is where the SWF files will be created, your compiled application.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;FYI:&lt;/span&gt; If you are running your Ant script from Eclipse, the Ant you're running is installed in ...\eclipse\plugins\org.apache.ant_1.7.0.v200803061910 or similar folder.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3260738553863727989?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3260738553863727989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3260738553863727989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3260738553863727989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3260738553863727989'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/compiling-flex-application-with-ant.html' title='Compiling a Flex Application with Ant'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1301349116360638963</id><published>2009-09-03T11:58:00.000-07:00</published><updated>2009-10-27T11:52:07.272-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flexunit'/><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='cairngorm'/><category scheme='http://www.blogger.com/atom/ns#' term='tdd'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='web applications'/><title type='text'>Using FlexUnit to Unit Test Cairngorm Visual Objects</title><content type='html'>&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;In a RIA application a typical split of the source code (counted by code size, in bytes) is as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;45-60% - client: visual objects like views and their sub-components with their logic&lt;/li&gt;&lt;li&gt;15-20% - client: non-visual objects (primarily Cairngorm worker-to-service piping)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;30-35% - server: middle-tier code&lt;/li&gt;&lt;/ul&gt;In the couple medium-size business application, I have analyzed, the middle-tier was implemented in Java and the client was implemented in Flex using the Cairngorm architecture. So, I don't have verified numbers for other RIA configurations.&lt;br /&gt;&lt;br /&gt;If we are determined to use TDD or simple just provide automated tests for our application and get the most coverage for the effort required to develop these tests, it seems we could use the following testing methodologies:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;FlexUnit testing for the client, especially the client's visual objects&lt;/li&gt;&lt;li&gt;FlexMonkey tests for whole client's features&lt;/li&gt;&lt;li&gt;jUnit tests for the middle-tier code.&lt;/li&gt;&lt;/ul&gt;I another blog, I will touch on the FlexMonkey.  In this one, I'd like to present how we can unit test the visual layer of the client using the FlexUnit framework. jUnit testing is well described in many other sources.&lt;br /&gt;&lt;br /&gt;Testing Scenario&lt;br /&gt;In the spirit of Cairngorm, a UI user gesture is directed to a handler which creates a Cairngorm message, attaches a payload to it (any relevant information) and dispatches it (event.dispatch()). Our test will mimic a user gesture (click a button) and will try to catch the dispatched Cairngorm event and verify its payload. We're using Flex 3 (ver. 3.2) and FlexUnit 4 beta 2.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;Sample Application&lt;/span&gt;&lt;br /&gt;To explain the topic, I'll be using the following sample application. The view (Main.mxml adds it to the ViewStack) is (to see the code in a new window, move your mouse pointer over the code and click the left of the icons that appear in upper-right corner):&lt;br /&gt;&lt;pre class="brush: as3"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"&lt;br /&gt;width="400" height="300"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mx:Script source="MyViewScript.as" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mx:HBox verticalAlign="middle" &amp;gt;&lt;br /&gt;&amp;lt;mx:Text id="txtValue" text="Entry:" /&amp;gt;&lt;br /&gt;&amp;lt;mx:TextInput id="entryTextInput" /&amp;gt;&lt;br /&gt;&amp;lt;mx:Button id="btnSave" label="Save" click="onBtnSaveClick(event)" /&amp;gt;&lt;br /&gt;&amp;lt;/mx:HBox&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/mx:VBox&amp;gt;&lt;/pre&gt;&lt;br /&gt;The script used bu the view is:&lt;br /&gt;&lt;pre class="brush: as3"&gt;import gov.olcc.fishbait.events.SaveEntryEvent;&lt;br /&gt;import gov.olcc.fishbait.model.ViewModelLocator;&lt;br /&gt;import gov.olcc.fishbait.vo.EntryVO;&lt;br /&gt;&lt;br /&gt;public var modelLocator:ViewModelLocator = ViewModelLocator.getInstance();&lt;br /&gt;&lt;br /&gt;public function onBtnSaveClick(event):void&lt;br /&gt;{&lt;br /&gt;trace("clickHandler detected an event of type: " + event.type);&lt;br /&gt;&lt;br /&gt;var entryVO: EntryVO = new EntryVO();&lt;br /&gt;entryVO.text = entryTextInput.text;&lt;br /&gt;&lt;br /&gt;var saveEvent: SaveEntryEvent = new SaveEntryEvent(entryVO);&lt;br /&gt;&lt;br /&gt;saveEvent.dispatch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and the TestRunner class to run the test is&lt;br /&gt;&lt;pre class="brush: as3"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&lt;br /&gt;xmlns="*"&lt;br /&gt;xmlns:flexunit="http://www.adobe.com/2009/flexUnitUIRunner"&lt;br /&gt;xmlns:business="gov.olcc.fishbait.business.*"&lt;br /&gt;xmlns:control="gov.olcc.fishbait.control.*"&lt;br /&gt;xmlns:view="gov.olcc.fishbait.view.*"&lt;br /&gt;layout="vertical"&lt;br /&gt;width="100%" height="100%"&lt;br /&gt;creationComplete="runTests()"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;import com.adobe.cairngorm.control.FrontController;&lt;br /&gt;// import gov.olcc.fishbait.view.TestFishBaitView;&lt;br /&gt;import gov.olcc.fishbait.view.MyView;&lt;br /&gt;import org.flexunit.runner.FlexUnitCore;&lt;br /&gt;import org.flexunit.flexui.TestRunnerBase;&lt;br /&gt;import gov.olcc.fishbait.view.MainTest;&lt;br /&gt;// import gov.olcc.fishbait.view.TestFishBait;&lt;br /&gt;&lt;br /&gt;//Add an import statement(s) for the class(es) under test&lt;br /&gt;private var core: FlexUnitCore;&lt;br /&gt;&lt;br /&gt;private function runTests():void&lt;br /&gt;{&lt;br /&gt;core = new FlexUnitCore();&lt;br /&gt;core.addListener(testRunner);&lt;br /&gt;core.run(MainTest);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- Cairngorm Controller and Service Locator --&amp;gt;&lt;br /&gt;&amp;lt;control:FishBaitController id="controller" /&amp;gt;&lt;br /&gt;&amp;lt;business:Services id="services" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;flexunit:TestRunnerBase id="testRunner" width="100%" height="100%" /&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;/pre&gt;&lt;br /&gt;The trick is to be able to catch the Cairngorm event. What is not obvious, the event.dispatch() method uses a CairngormEventDispatcher, so we need to add our listener to it. The resulting test code is&lt;br /&gt;&lt;pre class="brush: as3"&gt;package gov.olcc.fishbait.view {&lt;br /&gt;import com.adobe.cairngorm.control.CairngormEventDispatcher;&lt;br /&gt;import flash.events.MouseEvent;&lt;br /&gt;import gov.olcc.fishbait.events.SaveEntryEvent;&lt;br /&gt;import gov.olcc.fishbait.model.ViewModelLocator;&lt;br /&gt;import gov.olcc.fishbait.vo.EntryVO;&lt;br /&gt;import mx.automation.codec.AssetPropertyCodec;&lt;br /&gt;import org.flexunit.Assert;&lt;br /&gt;import org.fluint.uiImpersonation.UIImpersonator;&lt;br /&gt;import org.flexunit.async.Async;&lt;br /&gt;&lt;br /&gt;public class MainTest {&lt;br /&gt;var myView: MyView;&lt;br /&gt;public var modelLocator:ViewModelLocator = ViewModelLocator.getInstance();&lt;br /&gt;&lt;br /&gt;[Before(async,ui)]&lt;br /&gt;public function setUp():void {&lt;br /&gt;myView = new MyView();&lt;br /&gt;UIImpersonator.addChild(myView);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[After(async,ui)]&lt;br /&gt;public function tearDown():void {&lt;br /&gt;UIImpersonator.removeChild( myView );&lt;br /&gt;}   &lt;br /&gt;&lt;br /&gt;[Test(async,timeout="3000")]&lt;br /&gt;public function testOnBtnSaveClick():void {&lt;br /&gt;CairngormEventDispatcher.getInstance().&lt;br /&gt;addEventListener(SaveEntryEvent.SAVE_TEXT,&lt;br /&gt;Async.asyncHandler( this, handleTestOnBtnSaveClick, 3000 ),&lt;br /&gt;false,0,true);&lt;br /&gt;&lt;br /&gt;myView.entryTextInput.text = "Test Text";&lt;br /&gt;var clickEvent: MouseEvent = new MouseEvent(MouseEvent.CLICK);&lt;br /&gt;myView.btnSave.dispatchEvent(clickEvent);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private function handleTestOnBtnSaveClick(event:SaveEntryEvent,&lt;br /&gt;passThroughData:Object):void {&lt;br /&gt;var entry:EntryVO = event.text;&lt;br /&gt;Assert.assertEquals("Test Text", entry.text);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Other points about this test:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;We use FlexUnit UIImpersonator as a parent to our view. Without adding a view to a parent, the UI controlls are not initialized and can't be used.&lt;/li&gt;&lt;li&gt;To get the instance of the CairngormEventDispatcher, we use its static mathod getInstance().&lt;/li&gt;&lt;li&gt;Since the actual test happens in the event handler, we need to user an annotation [Test(async,timeout="xxx ms"] to request the Async support for the test.&lt;/li&gt;&lt;li&gt;Then, instead of providing just the handler method as an argument to the assEventListener(), we wrap this method in Async.asyncHandler(), which will wait for the handler to be called unless the handler will not be called within specified time, in which case the test will fail.&lt;/li&gt;&lt;/ul&gt;And this is it. Enjoy testing Cairngorm visual objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1301349116360638963?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1301349116360638963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1301349116360638963' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1301349116360638963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1301349116360638963'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/09/using-flexunit-to-unit-test-cairngorm.html' title='Using FlexUnit to Unit Test Cairngorm Visual Objects'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8965521264696272665</id><published>2009-08-26T17:08:00.000-07:00</published><updated>2009-08-26T17:12:48.240-07:00</updated><title type='text'>Wikipedia Is Still Free.</title><content type='html'>I have recently been sent an &lt;a href="http://www.cnn.com/2009/TECH/08/26/wikipedia.editors/index.html"&gt;article by CNN&lt;/a&gt; about changes in Wikipedia.  It decided to start to moderate the changes to articles about living people.&lt;br /&gt;&lt;br /&gt;The article is interesting.  Although, it's not much of a shift.  There were some rules and monitoring in place already.  Although, the results of these monitoring processes were only shown as warning/information boxes at the top of the articles. The change the article is talking about will affect only a small portion of the wikipedia articles.  So, you're still free to go there and correct any misinformation, if any, about State of Oregon, US or City of Portland. Or extend them, if you know of facts that would be good to be there. It's still in your hands. Sorry, in our hands.&lt;br /&gt;&lt;br /&gt;Go, ahead!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8965521264696272665?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8965521264696272665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8965521264696272665' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8965521264696272665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8965521264696272665'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/08/wikipedia-is-still-free.html' title='Wikipedia Is Still Free.'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3652759288420862648</id><published>2009-08-18T08:34:00.000-07:00</published><updated>2009-11-30T09:18:49.078-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flexunit'/><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='tdd'/><category scheme='http://www.blogger.com/atom/ns#' term='flex 4'/><title type='text'>Using FlexUnit 4 with Flex 3: Sample Application</title><content type='html'>&lt;span style="font-size: 130%; font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;We had hard time finding on the internet a sample like this.  So, here's ours. Additional steps required for this test to be run:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;download FlexUnit 4 from their &lt;a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit"&gt;site&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;add the FlexUnit swc files to the project's classpath&lt;/li&gt;&lt;li&gt;copy the sources below into your project and adapt them (use the &lt;span style="font-style: italic;"&gt;view source&lt;/span&gt; icon in each source code frame below to view/copy the source code).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;once everything is on place, right click on the TestRunner and select Run Flex Application.&lt;/li&gt;&lt;/ul&gt;At the end of the article, we have added some notes about using FlexUnit with FlashBuilder 4 and Flex 4&lt;br /&gt;Enjoy! It's a great tool!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;File structure&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_e4sNHM9RAKE/SorMC3TLp7I/AAAAAAAAACY/cpiFySuFkzQ/s1600-h/MWSnap001+2009-08-18,+08_37_23.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5371329855168948146" src="http://3.bp.blogspot.com/_e4sNHM9RAKE/SorMC3TLp7I/AAAAAAAAACY/cpiFySuFkzQ/s400/MWSnap001+2009-08-18,+08_37_23.gif" style="cursor: pointer; display: block; height: 258px; margin: 0px auto 10px; text-align: center; width: 337px;" /&gt;&lt;/a&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tested Object&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush: as3"&gt;&lt;span style="font-size: 130%;"&gt;package olcc.account&lt;br /&gt;{&lt;br /&gt;public class Account&lt;br /&gt;{&lt;br /&gt;public function Account(){&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private var balance:Number=0;&lt;br /&gt;&lt;br /&gt;public function deposit(amount:Number): void {&lt;br /&gt;balance=balance+amount;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public function withdraw(amount:Number): void {&lt;br /&gt;balance=balance-amount;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public function getBalance():Number {&lt;br /&gt;return balance;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;Test Suite (&lt;/span&gt;Optional&lt;span style="font-weight: bold;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush: as3"&gt;&lt;span style="font-size: 130%;"&gt;package olcc.account&lt;br /&gt;{&lt;br /&gt;import org.flexunit.runners.Suite;&lt;br /&gt;&lt;br /&gt;[Suite]&lt;br /&gt;[RunWith("org.flexunit.runners.Suite")]&lt;br /&gt;public class MyTestSuite&lt;br /&gt;{&lt;br /&gt;public var t1: AccountTest;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Unit Test&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush: as3"&gt;package olcc.account&lt;br /&gt;{&lt;br /&gt;import org.flexunit.Assert;&lt;br /&gt;&lt;br /&gt;public class AccountTest&lt;br /&gt;{&lt;br /&gt;[Test]&lt;br /&gt;public function testNew():void {&lt;br /&gt;var account:Account = new Account();&lt;br /&gt;Assert.assertEquals("Expecting zero account balance", 0, account.getBalance());&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[Test]&lt;br /&gt;public function testDeposit():void {&lt;br /&gt;var account:Account=new Account();&lt;br /&gt;account.deposit(50);&lt;br /&gt;Assert.assertEquals("Balance on a new account after 50 deposit is 50",50,account.getBalance());&lt;br /&gt;account.deposit(25);&lt;br /&gt;Assert.assertEquals("Balance after 50 deposit and another 25 deposit is 75", 75,account.getBalance());&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[Test]&lt;br /&gt;public function testWithdraw():void {&lt;br /&gt;var account:Account = new Account();&lt;br /&gt;account.deposit(100);&lt;br /&gt;account.withdraw(50);&lt;br /&gt;Assert.assertEquals("Balance should be: + $100 - $50 = $50",50,account.getBalance());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Test Runner&lt;/span&gt;&lt;br /&gt;&lt;pre class="brush: as3"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&lt;br /&gt;xmlns="*"&lt;br /&gt;xmlns:flexunit="http://www.adobe.com/2009/flexUnitUIRunner"&lt;br /&gt;creationComplete="onCreationComplete()"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;mx:Script&amp;gt;&lt;br /&gt;&amp;lt;![CDATA[&lt;br /&gt;import org.flexunit.runner.FlexUnitCore;&lt;br /&gt;import org.flexunit.flexui.TestRunnerBase;&lt;br /&gt;//Add an import statement(s) for the class(es) under test&lt;br /&gt;import olcc.account.MyTestSuite;&lt;br /&gt;&lt;br /&gt;private var core: FlexUnitCore;&lt;br /&gt;&lt;br /&gt;private function onCreationComplete():void&lt;br /&gt;{&lt;br /&gt;core = new FlexUnitCore();&lt;br /&gt;core.addListener(testRunner);&lt;br /&gt;core.run(MyTestSuite);&lt;br /&gt;}&lt;br /&gt;]]&amp;gt;&lt;br /&gt;&amp;lt;/mx:Script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;flexunit:TestRunnerBase id="testRunner" width="100%" height="100%" /&amp;gt;&lt;br /&gt;&amp;lt;/mx:Application&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: 130%; font-weight: bold;"&gt;Using FlexUnit 4 with Flex 4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Flex 4 beta2 has support for FlexUnit, and the most recent version of it which is version 4.0. If you go to the New-&amp;gt;TestCase menu, FlashBuilder can create for you a whole test class. And add to the flex build path the necessary libraries. This is done pretty well. But when I tried to apply the simple test application presented above to a Flex 4 application, I ran into multiple problems.  One critical, as of today, was the issue that the AsDoc for Flex 4 is not available, nor much of the documentation for it.  So, some classes from FlexUnit 4 that I needed (like TestRunnerBase), I wasn't able to find. Until these issues are resolved in Flex 4, I decided to use the FlexUnit 4 directly.  To do this, I removed the Flex 4 libraries from the build path and added the FlexUnit 4 beta 2 libraries (.swc files). In general, the flex parser is not always &lt;span style="font-style: italic;"&gt;stable&lt;/span&gt;, which showed up in this exercise and I had a compilation error that shows every other time I compile my TestRunner.mxml (with the same source code), but I can run the tests. Simply, I made sure that the last compilation is a clean one. Also, closing and reopening the project eliminated this issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3652759288420862648?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3652759288420862648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3652759288420862648' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3652759288420862648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3652759288420862648'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/08/using-flexunit-4-with-flex-3-sample.html' title='Using FlexUnit 4 with Flex 3: Sample Application'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_e4sNHM9RAKE/SorMC3TLp7I/AAAAAAAAACY/cpiFySuFkzQ/s72-c/MWSnap001+2009-08-18,+08_37_23.gif' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2399106976823344384</id><published>2009-08-11T10:58:00.000-07:00</published><updated>2009-10-15T09:40:50.812-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flexunit'/><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='unittesting'/><category scheme='http://www.blogger.com/atom/ns#' term='tdd'/><title type='text'>FlexUnit Plugin for Eclipse</title><content type='html'>Since we intend to do unit testing in our Flex+Java development, I have been playing with FlexUnit and have found an &lt;a href="http://forums.adobe.com/thread/417925?tstart=0"&gt;eclipse plugin&lt;/a&gt; that makes it easier to use (also, in &lt;a href="http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1476.html"&gt;plugin central&lt;/a&gt;).  Here's a summary and lessons learned on how to start with the plugin&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Installation&lt;/span&gt;&lt;br /&gt;Follow the installation instructions from &lt;a href="http://www.codesquared.com/eclipse/installinstructions.html"&gt;here&lt;/a&gt;. Once installed, open the plugin's help in Eclipse and configure it.  A few points:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Download &lt;a href="http://opensource.adobe.com/wiki/display/flexunit/Downloads"&gt;FlexUnit&lt;/a&gt; and &lt;a href="http://www.codesquared.com/eclipse/FlexUnitTestHarness.swc"&gt;FlexUnit extension for the plugin&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;You will need to have Flex Builder 3.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You will need a debugger version of Flash Player (I used version 10). A standalone player used by the plugin comes with Flex Builder (directory: player)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Follows &lt;a href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;amp;file=logging_125_04.html"&gt;instructions from Adobe&lt;/a&gt; on how to enable logging and error output for Flash Player. When you follow them, after you create a mm.cfg file, you will need to restart &lt;span style="font-style: italic;"&gt;all&lt;/span&gt; instances of Flash Player for the &lt;span style="font-style: italic;"&gt;Logs&lt;/span&gt; folder to show up.&lt;/li&gt;&lt;/ul&gt;Using The Plugin&lt;br /&gt;To use a plugin:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Create a unit test&lt;/span&gt; using Flex Builder's wizard.  I recommend keeping them in another source folder, so they can be easily skipped when releasing the app. For example, keep the flex source in flex-src and flex tests in flex-test. The server code put in java-src and java-test, or whatever language you use for the middle-tier.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Create a harness&lt;/span&gt;. Right click in the test file in the project navigator, find FlexUnit menu and select &lt;span style="font-style: italic;"&gt;Create Harness&lt;/span&gt;. This will create a small mxml file for your test.  However, if you use FlexUnit 0.9, the code needs a correction.  Replace:&lt;blockquote&gt; EclipsePluginTestRunner.runTests( new Array(AccountTest.suite()) );&lt;/blockquote&gt;with&lt;blockquote&gt; EclipsePluginTestRunner.run( AccountTest.suite() );&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Run the test&lt;/span&gt;. Right click on the harness file and select &lt;span style="font-style: italic;"&gt;Run&lt;/span&gt; from the FlexUnit menu. Observer the test results on the nice eclipse viewer.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I had the problem that the test launch process never finishes in eclipse. But it doesn't seem to be harmful.  Just ignore it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;br /&gt;It's a great plugin.  It could do quite a bit more, but it's a great start. It worked for me with a FlexUnit 4, when I used the syntax of FlexUnit 0.9.  When I switched to FlexUnit 4 syntax, I didn't have to apply the correction mentioned above to the auto-generated harness to compile. However, I didn't get my tests executed. So, I guess, for now, using the FlexUnit 0.9 is a better option.  However, I have heard from the plugin author that he intends to do another release of the plugin.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2399106976823344384?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2399106976823344384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2399106976823344384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2399106976823344384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2399106976823344384'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/08/flexunit-plugin-for-eclipse.html' title='FlexUnit Plugin for Eclipse'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6651618896064053008</id><published>2009-07-12T21:26:00.000-07:00</published><updated>2009-07-12T21:46:34.162-07:00</updated><title type='text'>Graphics - Format Selection</title><content type='html'>&lt;span style="font-weight: bold;"&gt;The Problem&lt;/span&gt;&lt;br /&gt;So, you decided to edit an picture from you camera.  Most likely, it came from the camera as a JPG or JPEG file.  However, if you edit it and save, and especially repeat this process couple times, your image will look different.  Wherever there was a smooth transition from one color, or shade, to another color or shade, you will notice strange lines, like contour lines on a map. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Mystery Revealed&lt;/span&gt;&lt;br /&gt;The reason is, each time your editing software saves a file in JPEG format, it compresses the image and introduces small changes to your picture.  These changes are small and they are not noticeable. Because JPEG compression algorithm is allowed to perform these small changes, it is able to compress the file so nicely.  So, it all works great, unless you save it not once but 3, 4 or 8 times.  Then these small changes accumulate and the deformations are very well visible and not really pretty.  Your picture is ruined. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Solution&lt;/span&gt;&lt;br /&gt;So, what, shall you avoid the JPEG format? Not at all.  However, if you decide to edit the picture, save it in a &lt;span style="font-style: italic;"&gt;lossless format&lt;/span&gt;.  You can open it, edit and save as many times as you want, and you picture will not deteriorate.  Than, when you are ready to post the picture to your website or print it, save it as a JPEG file.  But what is a lossless format?  Well, there are two good candidates: TIFF and PNG.  TIFF is better, in a way, because it can save more than just the image.  It can also save paths and layers (I'm not sure of layers, though).  Just make sure, that you don't let the TIFF formatter use JPEG as compression.  You would get into the same problem as described above.  PNG may be even a bit smaller, but it will not save anything more than the image itself.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tool&lt;/span&gt;&lt;br /&gt;GIMP image editor will allow you to open and save in all these formats without problems.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6651618896064053008?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6651618896064053008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6651618896064053008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6651618896064053008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6651618896064053008'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/07/graphics-format-selection.html' title='Graphics - Format Selection'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-2830938877403166235</id><published>2009-07-05T21:39:00.000-07:00</published><updated>2009-07-05T22:20:41.916-07:00</updated><title type='text'>Date, Time, SQLite and Android</title><content type='html'>This post summarizes my recent experience (problem, finally solved) with storing and then reading and displaying the date and time in Android application.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Storing the current time/date in SQLite&lt;/span&gt;&lt;br /&gt;The most common way is to do:&lt;br /&gt;&lt;blockquote&gt;database.execSQL("update TABLE_NAME set COLUMN_NAME = datetime('now') where ...");&lt;/blockquote&gt;As a result, SQLite stores a string representing the current time in UTC (GMT), using the ISO8601 date/time format.  This format (YYYY-MM-DD HH:MM:SS), is by the way suitable for date/time comparisons. The fact that the value stored is in UTC and not in a local time zone, is actually nice.  More about it below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Retrieving a time/date and displaying it&lt;/span&gt;&lt;br /&gt;To retrieve the value, follow the recommended Android practice:&lt;br /&gt;&lt;blockquote&gt;Cursor row = databaseHelper.query(true, TABLE_NAME, new String[] {&lt;br /&gt;             COLUMN_INDEX}, ID_COLUMN_INDEX + "=" + rowId,&lt;br /&gt;             null, null, null, null, null);&lt;br /&gt;String dateTime = row.getString(row.getColumnIndexOrThrow(COLUMN_INDEX));&lt;br /&gt;&lt;/blockquote&gt;This, returns a string, parse it and reformat to your local format and time zone:&lt;br /&gt;&lt;blockquote&gt;DateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");&lt;br /&gt;try {&lt;br /&gt;  date = iso8601Format.parse(dateTime);&lt;br /&gt;} catch (ParseException e) {&lt;br /&gt;  Log.e(TAG, "Parsing ISO8601 datetime failed", e);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;long when = date.getTime();&lt;br /&gt;int flags = 0;&lt;br /&gt;flags |= android.text.format.DateUtils.FORMAT_SHOW_TIME;&lt;br /&gt;flags |= android.text.format.DateUtils.FORMAT_SHOW_DATE;&lt;br /&gt;flags |= android.text.format.DateUtils.FORMAT_ABBREV_MONTH;&lt;br /&gt;flags |= android.text.format.DateUtils.FORMAT_SHOW_YEAR;&lt;br /&gt;&lt;br /&gt;String finalDateTime =  android.text.format.DateUtils.formatDateTime(context,&lt;br /&gt;      when + TimeZone.getDefault().getOffset(when), flags);&lt;br /&gt;&lt;/blockquote&gt;Note the &lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(102, 0, 204);"&gt;when + TimeZone.getDefault().getOffset(when)&lt;/span&gt; &lt;/span&gt;above&lt;span style="font-style: italic;"&gt;.  &lt;/span&gt;This does the trick to convert the UTC time/date to local time.  The DateUtils.formatDateTime() seem to be supposed to do this, but it doesn't, or I wasn't able to find a way to achieve it.&lt;br /&gt;&lt;br /&gt;And that's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-2830938877403166235?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/2830938877403166235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=2830938877403166235' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2830938877403166235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/2830938877403166235'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/07/date-time-sqlite-and-android.html' title='Date, Time, SQLite and Android'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-5058235147810575022</id><published>2009-06-18T09:17:00.000-07:00</published><updated>2009-06-18T11:30:11.796-07:00</updated><title type='text'>Interfaces, Inheritence and Hibernate</title><content type='html'>&lt;span style="font-weight: bold;"&gt;How to choose: Inheritence or Interface?&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://bytes.com/groups/net-c/262347-interface-vs-inheritance"&gt;Idea 1&lt;/a&gt;: If the relationship is more an "is a", use inheritance.  If it is more a "can be", use interface. Examples: TextBox "is-a" Control, ArrayList "can-be" enumerated.&lt;/li&gt;&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms973861.aspx#interinher_topic4"&gt;Idea 2&lt;/a&gt;: If your object is a specialization of another object, use inheritance. But if the feature that distinguishes the derived class from the base class is something that other classes may need to support as well, an interface is a better choice.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-5058235147810575022?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/5058235147810575022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=5058235147810575022' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5058235147810575022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/5058235147810575022'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/06/interfaces-inheritence-and-hibernate.html' title='Interfaces, Inheritence and Hibernate'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1596754664865473998</id><published>2009-06-15T17:21:00.000-07:00</published><updated>2009-06-17T10:41:05.215-07:00</updated><title type='text'>Flash Builder 4, Hibernate and Eclipse: Working Together</title><content type='html'>So, we at OLCC decided to give Flash Builder 4 (beta) a try.  So far, we have been working only with a small sample using the JEE for its server tier, but already have learned a few valuable lessons:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Creating a New Flex Project&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Accept the folder names flex_src, bin-debug; the FB4 doesn't deal correctly with non-default values.&lt;/li&gt;&lt;li&gt;After creating a project, go to .flexProperties and set the serverContextRoot="/YourProjectName". After opening Properties-&gt;Flex Server window, reset this value of serverContextRoot.&lt;/li&gt;&lt;li&gt;Instead of using mx:Text, there is now s:SimpleText control.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Error 404, when trying to Debug the application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When we got this, we saw the URL that FlashBuilder is trying to use to start the HTML wrapper is &lt;span style="font-style: italic;"&gt;http://localhost:8080/ProjectName&lt;span style="font-weight: bold;"&gt;bin-debug&lt;/span&gt;/Main.html&lt;/span&gt;. The bin-debug definitely shouldn't be there. We also noticed, that this same URL shows in the project properties on Flex Build Path page as the Server Root URL.  It can't be fixed there, but we fixed it in the Debug run configuration. Trying to use Run instead of Debug was even more messy. For some reason, it tried to connect the debugger to the FlashPlayer (yes, in Run mode).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PermGen Issue&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Also, recently, we had problem with running out of the space in PermGen.  The only solution we found, was to reduce its size (yes, reduce!) from the default 256M to 128M. &lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;br /&gt;The funny thing is, we had eclipse running fine for a long time.  Then, when we installed a 2nd instance of eclipse, using a separate workspace, we started experiencing this problem. When we used the 256M, and any serious action crashed the Eclipse, we ran the eclipsec.exe which showed an error message "not able to find enough memory to start jvm with these options" or smth like this. That's why we have reduced the memory.  We haven't had the PermGen issue since then. I don't understand this issue really, it's more a trial-and-error solution, but it works.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Hibernate&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;For Hibernate, we use:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Database Development perspective provided by eclipse&lt;/li&gt;&lt;li&gt;Hibernate installed via GlassFish admin console (we pointed eclipse compiler at it)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Hibernate Tools from JBoss Tools (installed just the hibernate tools through the eclipse update site http://download.jboss.org/jbosstools/updates/stable/)&lt;/li&gt;&lt;li&gt;JavaDB bundled with GlassFish server&lt;/li&gt;&lt;/ul&gt;This configuration seems a good mix. That's it for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1596754664865473998?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1596754664865473998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1596754664865473998' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1596754664865473998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1596754664865473998'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/06/flash-builder-4-hibernate-and-eclipse.html' title='Flash Builder 4, Hibernate and Eclipse: Working Together'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3915775440252543448</id><published>2009-06-09T10:28:00.000-07:00</published><updated>2009-06-09T10:28:16.006-07:00</updated><title type='text'>GlassFish Application Server: Introduction and More</title><content type='html'>This blog summarizes what I have found interesting or not-obvious about the Sun's open source enterprise application server called GlassFish.  If you think, any of the info in this blog is not precise or just incorrect, feel free to comment.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Version 2.1 of GlassFish is the final version that implements Java EE 5.  Version 3.0 of GlassFish is the first one that implements Java EE 6. It's a preview, but ready for production.&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Server Domain&lt;/span&gt;: a new concept introduced into GlassFish that means one or more server instances that can be managed as a whole by an administrator. For developer, domain=server instance.  For administrator, it can comprise of multiple, clustered server instances. Each domain, even if all domains are local, runs in its own JVM (there is also one JVM instance associated with the server administration/control, it seems). More &lt;a href="http://blogs.sun.com/bloggerkedar/entry/concept_of_a_glassfish_domain"&gt;info&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Virtual Server&lt;/span&gt;: to be finished... &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3915775440252543448?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3915775440252543448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3915775440252543448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3915775440252543448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3915775440252543448'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/06/glassfish-application-server.html' title='GlassFish Application Server: Introduction and More'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-3324885003566794779</id><published>2009-05-20T06:21:00.000-07:00</published><updated>2009-05-20T06:40:25.514-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><title type='text'>Using Unit Testing to Test GWT RCP Calls</title><content type='html'>This is a short note.  I'm working on a GWT application and ran into a problem with an RPC call which gets some objects from the database using Hibernate and passes them back to the client.  I'm going to solve the problem using Dozer, but I needed to confirm this was the problem and simplify the testing of this in future.  So, I decided I want to unit test this service from the client's perspective. Here are my notes from this exercise:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The easiest way to create a GWTTestCase is using the GWT's jUnitCreator.  Creating it by hand is possible but tricky.&lt;/li&gt;&lt;li&gt;The asynchronous test needs to use delayTestFinish(delayMs) and finishTest(). In my case, I had to set 5000 Ms.  For some reason, 500Ms, which I thought would be more than enough was timing out.&lt;/li&gt;&lt;li&gt;The good news is, that when using Eclipse plugin for GWT, starting initiating Run as JUnit Test on the GWTTestCase test starts for you also the server.  And doing the same with Debug as JUnit Test allows to debug the client as well as server code.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Note: the similar test is supported in Flex application!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-3324885003566794779?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/3324885003566794779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=3324885003566794779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3324885003566794779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/3324885003566794779'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/05/using-unit-testing-to-test-gwt-rcp.html' title='Using Unit Testing to Test GWT RCP Calls'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-310411346640976357</id><published>2009-05-12T13:36:00.000-07:00</published><updated>2010-04-19T11:39:46.210-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='RIA'/><category scheme='http://www.blogger.com/atom/ns#' term='web applications'/><title type='text'>Developing Flex Applications with Java Middle-Tier</title><content type='html'>&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;Intro&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;In my job we are using Flex with Java to develop web applications that support the activity of the agency I'm working for.  It's my first experience with Flex and I'd say, I'm duly impressed.  I had experience of developing using GWT and I must say, that Flex is an equally good tool.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 130%;"&gt;A Simple Way&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;Just follow this &lt;a href="http://www.flexlive.net/?p=92"&gt;tutorial&lt;/a&gt;.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tools Used&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;We use the following toolset:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;eclipse &lt;span style="font-size: 100%;"&gt;with FlexBuilder plugin (plugin is not free)&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 100%;"&gt;jBoss&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 100%;"&gt;Java for back-end&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 100%;"&gt;LCDS to communicate between Flex and Java (not free, but there are free alternatives: BlazeDS and the LCDS Express is also free, I think).&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 100%;"&gt;Cairngorm pattern for Flex client structure&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tips and Gotchas&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A great intro to Cairngorm (and Flex itself) is one by &lt;a href="http://www.davidtucker.net/2007/10/07/getting-started-with-cairngorm-%E2%80%93-part-1/"&gt;David Tucker&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;He is using ColdFusion for the back-end, so switch to &lt;a href="http://www.flexlive.net/?p=92"&gt;this&lt;/a&gt; or &lt;a href="http://www.adobe.com/devnet/flex/flex_java.html"&gt;this&lt;/a&gt; for how to do it with Java.&lt;/li&gt;&lt;/ul&gt;The Cairngorm pattern for calling a remote service is a bit complex.  Here's how it goes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In the main mxml file (the one where you define &lt;mx:application&gt;mx:Application):&lt;span style="font-weight: bold;"&gt; instantiate the ServiceLocator&lt;/span&gt;: &lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: trebuchet ms;"&gt;&lt;business:services id="services"&gt;&lt;/business:services&gt;&lt;/span&gt;&lt;/span&gt;. The id "services" is irrelevant, it seems. And instantiate the &lt;span style="font-weight: bold;"&gt;FrontController&lt;/span&gt;.&lt;br /&gt;&lt;/mx:application&gt;&lt;/li&gt;&lt;li&gt;Let say, the command LOGIN is to be handled by the back-end. &lt;span style="font-weight: bold;"&gt;Dispatch the command&lt;/span&gt; by initiating the LoginEvent and calling dispatch() on it.&lt;/li&gt;&lt;li&gt;Each&lt;span style="font-weight: bold;"&gt; event is mapped onto a command in the FrontController&lt;/span&gt;. Let say, in this case, onto a LoginCommand.&lt;/li&gt;&lt;li&gt;In loginCommand, &lt;span style="font-weight: bold;"&gt;instantiate a delegate, say LoginDelegate and call the login(event)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;In LoginDelegate, &lt;span style="font-weight: bold;"&gt;obtain the service proxy&lt;/span&gt; using:&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;ServiceLocator.getInstance().getRemoteObject("myRemoteObject");&lt;/span&gt;&lt;br /&gt;and call the login(args) on it.&lt;/li&gt;&lt;li&gt;Now, two additional files need to be setup: Services.mxml and remoting-config.xml&lt;/li&gt;&lt;li&gt;In the first one, &lt;span style="font-weight: bold;"&gt;Services.mxml&lt;/span&gt;, define a &lt;span style="font-size: 85%;"&gt;mx:RemoteObject with id="myRemoteObject" and the destination="myRemoteClass".&lt;br /&gt;&lt;mx:remoteobject destination="myLoginService" id="myRemoteObject"&gt;&lt;/mx:remoteobject&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-size: 100%;"&gt;In the second, the &lt;span style="font-weight: bold;"&gt;remoting-config.xml&lt;/span&gt;, define a destination with id="myRemoteClass" and the Java class package+classname in the source tag.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-size: 100%;"&gt;In the Flex Server properties (access through project properties), set the Root Context as the &lt;span style="font-size: 85%;"&gt;/YourProjectName&lt;/span&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 100%;"&gt;If you need to pass an object between client and the server, create two corresponding value objects (usually named *VO, like LoginVO), one in ActionScript in flex branch and one in Java branch:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;The ActionScript version, needs to have an annotation above the class definition: &lt;span style="font-size: 85%;"&gt;[RemoteClass(alias=org.sjb.LoginVO)].&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;The Java version needs to be public and have public setters.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 100%;"&gt;If you want to debug not only Flex (which is done the usual "eclipse" way), stop the JBoss server and start it in Debug mode.  That's all that is needed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;Altogether, using Flex with Java is very simple.  Enjoy it!&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-310411346640976357?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/310411346640976357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=310411346640976357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/310411346640976357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/310411346640976357'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/05/developing-flex-applications-with-java.html' title='Developing Flex Applications with Java Middle-Tier'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-1244975601497797069</id><published>2009-04-29T07:02:00.001-07:00</published><updated>2009-04-29T07:53:09.302-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GWT'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='web applications'/><title type='text'>How to Deploy a GWT Application to Tomcat?</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Intro&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;OK, so &lt;span style="font-weight: bold;"&gt;you have tried the GWT&lt;/span&gt; (Google Web Toolkit), decided that &lt;span style="font-weight: bold;"&gt;it's cool&lt;/span&gt;, and &lt;span style="font-weight: bold;"&gt;you created your first application&lt;/span&gt;, precisely a module.  You have tried it locally on your development machine, using the &lt;span style="font-style: italic;"&gt;hosted&lt;/span&gt; mode and, may be, in the &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-style: italic;"&gt;web mode&lt;/span&gt; by using the &lt;span style="font-style: italic;"&gt;Compile/Browse&lt;/span&gt; button on the hosted-mode preview window. Now, you can either deploy it to Google App Engine, which is a way to try it online free and easily (make sure that your app doesn't become the IP of Google! I haven't looked at the terms of use myself.) or you decide yo want to go for it, and publish it for real.  You &lt;span style="font-weight: bold;"&gt;purchase a Java hosting plan&lt;/span&gt; (google for &lt;span style="font-style: italic;"&gt;it; you can find some within $12/mo.), and you're ready to deploy your application to your Tomcat server.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-size:130%;"&gt;Deploying It&lt;/span&gt;&lt;br /&gt;I used &lt;a href="http://bit.ly/196cgj"&gt;this&lt;/a&gt; re&lt;/span&gt;&lt;span&gt;source to help me with.  Basically, follow the steps (&lt;gwt-app-folder&gt; is the root of your GWT application,):&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;create a staging folder (let's call it &lt;span style="font-style: italic;"&gt;deploy&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;copy contents of &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;&lt;gwt-app-folder&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;/www/com.meography.EntryScreen into /deploy&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;create &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;&lt;gwt-app-folder&gt;/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;WEB-INF with folders &lt;span style="font-style: italic;"&gt;classes&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;lib&lt;/span&gt; in it&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;create web.xml file in WEB-INF. See the above resource for how to.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;copy contents of &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;&lt;gwt-app-folder&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;/bin folder to deploy/WEB-INF/classes&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;copy all needed jars into deploy/WEB-INF/lib (you don't need gwt-user.jar nor gwt-dev-windows.jar, though)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;compress all of the conents of deploy folder into a zip file and rename the file to .war.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;upload the file to Tomcat, which can be done via browser using Tomcat manager, which is usually already installed for you by your Java hosting vendor. Once the upload finishes, the manager will show your application with options to Start, Stop, Reload and Undeploy it. The name of the app, is the base URL for your app.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;Point your browser to the main .html file of the module (URL indicated by Tomcat manager + YourMainScreen.html).  And, voila, you should be on. Well, if there are any problems, for example with your database setup, you'll find errors in the &lt;span style="font-style: italic;"&gt;catalina.log&lt;/span&gt; file in the /&lt;span style="font-style: italic;"&gt;tomcat&lt;/span&gt;/&lt;span style="font-style: italic;"&gt;logs &lt;/span&gt;folder on your production server.&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;&lt;span style="font-size:130%;"&gt;Re-Deploying It&lt;/span&gt;&lt;br /&gt;To redeploy, after you have done some changes, simply &lt;span style="font-weight: bold;"&gt;repeat the steps above&lt;/span&gt;, but remember to &lt;span style="font-weight: bold;"&gt;preserve files you had to tweak or create&lt;/span&gt; for your production environment like web.xml and possibly hibernate.cfg.xml, if you happen to use Hibernate and use different database on your development machine and on your production server (Java hosting plan will usually have MySQL and PostgreSQL databases included). And, one more thing. I have found that I have to do &lt;span style="font-weight: bold;"&gt;Undeploy, upload the new .war file and then Deploy&lt;/span&gt; for the changes to post correctly.  The reason may be, that GWT application is compiled into JavaScript cache files with random names, so the file names will be different each time you compile it, and so, just copying the new .war file over will not replace all of the old files.&lt;br /&gt;&lt;br /&gt;Any feedback?  Feel free to let me know.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-1244975601497797069?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/1244975601497797069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=1244975601497797069' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1244975601497797069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/1244975601497797069'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/04/how-to-deploy-gwt-application-to-tomcat.html' title='How to Deploy a GWT Application to Tomcat?'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7810014490404097657</id><published>2009-04-23T11:05:00.000-07:00</published><updated>2009-08-03T22:50:56.233-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Developing for Android Platform</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Why Android&lt;/span&gt;?&lt;br /&gt;&lt;div style="text-align: justify;"&gt;I'm a Java developer.  Yes, I could enhance my C/C++ skills, get an iPhone and develop for the &lt;span style="font-style: italic;"&gt;iDevices&lt;/span&gt;.  But, I guess, I wasn't motivated enough.  Also, I'm a strong supported of open source development.  So, first, I noticed &lt;span style="font-style: italic;"&gt;OpenMoko platform&lt;/span&gt;.  But their development slowed down and stopped.  Never got to the point when I'd be able to get a phone and develop for it. Finally, I noticed the Google's Android initiative in late 2007.  Yes, I'm afraid of humongous corporations like Micstosoft and now Google.  Still, I didn't see a more attractive choice.  So, I waited for Google to release the Android phone.  I could switch to Windows Mobile platform, but this, somehow, didn't attract me.  Finally, in Jan 2009, after living with Palm for good 7 years, and I'm a heavy user of the personal organizers (several years ago, I'd create my own notebooks/calendars, so they'd fit my needs; out of paper and cardboard; I did this for good 2-3 years), finally in Jan 2009, I decided it was time to do the move and I purchased a black G1 (for the picture and a story of my other organizers, see this &lt;a href="http://sberka.blogspot.com/2009/01/brief-visual-history-of-pdas.html"&gt;blog&lt;/a&gt;).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Does It Fulfill The Promise?&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In short, yes.  Is it perfect? No. I can suggest several improvements of the top of my head, even just for hardware.  And for software, too, of course.  Would I recommend it? Definitely.  Does it have a potential? Oh, yes, sure.  This section could be a topic on its own, but, it will have to wait for another time.  Let's move.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;So, to Cut To The Chase, How Do I Develop for Android&lt;br /&gt;&lt;/span&gt;Simple.  The list of tools I use:&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Eclipse (3.4.2)&lt;/li&gt;&lt;li&gt;JDK (1.6)&lt;/li&gt;&lt;li&gt;ADT (0.8.0) - great tool.  Can even deploy to the device over USB and monitor the app.&lt;/li&gt;&lt;li&gt;Positron aka Autoandroid - for integration testing. Unit testing doesn't work that great for fat clients.  This is a great tool except for a few hick-ups.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;jUnit - for the pieces that can be unit testing without reaching to your left year with your right foot.&lt;/li&gt;&lt;/ul&gt;Do you want more details, technical details? Sure.  Here they're:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Where can I find some sample Android applications?&lt;/span&gt;&lt;br /&gt;Well, one good &lt;span style="font-style: italic;"&gt;sample&lt;/span&gt; is the Android platform itself.  For example, to see the source code for the native Android calendar application, you can view it &lt;a href="http://android.git.kernel.org/?p=platform/packages/apps/Calendar.git;a=blob;f=src/com/android/calendar/EditEvent.java;h=e1c5310debcb796384aab2318bce42b80f4d5821;hb=HEAD"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Deploying onto the Device:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;an unsigned .apk file installs with a "Application installation unsuccessful"&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;log a application crash,,, where can I find it? The ADT displays LogCat.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Using Positron aka Autoandroid:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;If getting an error about Autoandroid "java.net.SocketException: Connection reset" problem, either:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;rerun the Android Application and run stories again or&lt;/li&gt;&lt;li&gt; application crashed on Android&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;If you get error "Internal Error ... ShouldNotReachHere", do&lt;br /&gt;&lt;ul&gt;&lt;li&gt;go to the jUnit relevant run configuration, //Classpath// and remove the Android Library from Bootstrap.&lt;/li&gt;&lt;li&gt;do //Advanced//, //Add Library// and choose JRE System Library&lt;/li&gt;&lt;li&gt;add JUnit library the same way&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7810014490404097657?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7810014490404097657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7810014490404097657' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7810014490404097657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7810014490404097657'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/04/developing-for-android-platform.html' title='Developing for Android Platform'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-4248340812437109429</id><published>2009-02-03T10:39:00.000-08:00</published><updated>2009-02-03T11:08:29.912-08:00</updated><title type='text'>To Refinance or Not To Refinance</title><content type='html'>OK.  Mortgage interest rates  are falling.  Everyone is refinancing or at least trying to do it to benefit from the lower rates.  So, I did a research myself as well.  There were three distinct ways to do it.  I'm describing them below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;No-Cost Refinancing Offer From My Current Mortgage Bank&lt;/span&gt;&lt;br /&gt;The WaMu offered to reduce my mortgage by 0.25%, for no cost.  The savings looked fabulous (down to $500's from almost $1200 a month), but after I looked at it carefully, it was primarily because they calculated as if for a new 15-years loan, while on my current loan I have only 10 years left.  The actual savings would be only about $40 a month.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Best Deal I Was Able To Find on The Internet&lt;br /&gt;&lt;/span&gt;I did a search for the best rates.  The website (don't remember which one), took me into a lender search instead of giving me a rate.  When I clicked the button that said &lt;span style="font-style: italic;"&gt;Get Your Rate&lt;/span&gt;, I've got a list of lenders instead, and after 5 minutes (yes! even though it was Saturday night, around 8pm), my phone rang and one of the lenders from the list wanted to talk to me.  So, in a way it worked smoothly.  The thing is, that the best deal the lender had was a rate lower by 0.75% for a closing cost of some $4500.  And, no, it wasn't because of my credit score.  Mine is over 800, and it was him who checked and told me the score.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ING Direct EasyOrange Refinancing Deal&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;This deal is about a 5 year loan based on a 30-year period. So, I'd have to payback the whole loan after 5 years.  But that wouldn't be a problem in our situation.  Anyway, they're giving a rate of 4.75%, which is pretty good right now, for closing costs of $1750 only. Seemed a great deal.&lt;span&gt;&lt;span&gt;&lt;span&gt; Just to make sure it makes even sense to refinance if we don't  plan to live in this house more than 2-3 years, I went to timevalue.com website and compared my current mortgage with th EasyOrange deal.  The image below shows the results:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_e4sNHM9RAKE/SYiVUo0JKXI/AAAAAAAAAAw/Zp9b9CNLAR0/s1600-h/compare-mortg.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 283px;" src="http://2.bp.blogspot.com/_e4sNHM9RAKE/SYiVUo0JKXI/AAAAAAAAAAw/Zp9b9CNLAR0/s400/compare-mortg.gif" alt="" id="BLOGGER_PHOTO_ID_5298649143387433330" border="0" /&gt;&lt;/a&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;It seems after all, that the EasyOrange doesn't save as any money after all.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;That was it.  I guess, the no-cost 0.25% is the best deal after all. But it will lock me for a year at least.  What is rates go down a lot within months?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-4248340812437109429?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/4248340812437109429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=4248340812437109429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4248340812437109429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/4248340812437109429'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/02/to-refinance-or-not-to-refinance.html' title='To Refinance or Not To Refinance'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_e4sNHM9RAKE/SYiVUo0JKXI/AAAAAAAAAAw/Zp9b9CNLAR0/s72-c/compare-mortg.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-8119221669550837637</id><published>2009-01-20T13:34:00.000-08:00</published><updated>2009-01-20T13:49:51.050-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='smart phone'/><category scheme='http://www.blogger.com/atom/ns#' term='pilot organizers'/><category scheme='http://www.blogger.com/atom/ns#' term='palm'/><category scheme='http://www.blogger.com/atom/ns#' term='pda'/><category scheme='http://www.blogger.com/atom/ns#' term='history'/><category scheme='http://www.blogger.com/atom/ns#' term='treo'/><title type='text'>Brief Visual History of PDA's</title><content type='html'>Today, I had to stay home and take care of our youngest one for a couple of hours. He was very busy playing out the story of Joseph being almost killed and then sold by his loving brothers, that I decided to do some cleanup.  Since my G1 phone is more or less setup, I decided to trash the older PDA I used to use and which I still kept in my drawer.  I had a moment of nostalgia and so I ended up saving for some of my memories for the generations to come.&lt;br /&gt;&lt;br /&gt;Most of my adventure with PDA's is captured by the following picture:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_e4sNHM9RAKE/SXZE29T5KsI/AAAAAAAAAAo/QqbLpAQhN24/s1600-h/pda-hist-annot.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_e4sNHM9RAKE/SXZE29T5KsI/AAAAAAAAAAo/QqbLpAQhN24/s400/pda-hist-annot.jpg" alt="" id="BLOGGER_PHOTO_ID_5293494122982222530" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I have been using all these PDA's, including Treo 90, the most fun one, in addition to the cell phone.  Finally, with G1, I have one device instead of two.  I didn't stress it: I was actually carrying the two devices &lt;span style="font-style: italic;"&gt;always&lt;/span&gt; with me, wherever I went. One in my pocket and another in a little holster.  I got rid of the holster now, which made my wife happy.  She never liked this extra decoration.  And, besides the two functions being one fullfilled by a single gadget, I must say I enjoy the G1 a lot.  It's appearance doesn't give it justice.  Really.&lt;br /&gt;&lt;br /&gt;There is much more to say about this little brief history topic, but my time is limited while I want to have some left to play with extending WikiNotes app into a more fully developed wiki application.  Yes, for G1, or I should rather say, for Android.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-8119221669550837637?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/8119221669550837637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=8119221669550837637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8119221669550837637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/8119221669550837637'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/01/brief-visual-history-of-pdas.html' title='Brief Visual History of PDA&apos;s'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_e4sNHM9RAKE/SXZE29T5KsI/AAAAAAAAAAo/QqbLpAQhN24/s72-c/pda-hist-annot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-223879602812050141</id><published>2009-01-02T12:05:00.000-08:00</published><updated>2009-11-30T09:19:44.414-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='search api'/><category scheme='http://www.blogger.com/atom/ns#' term='yahoo'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Search Web Services or API for Commercial Use</title><content type='html'>Suppose, you need to collect some data based on Internet search for your business.  What options are there to use existing web search services?  Google?  Yahoo?  Anyone else?  Here's what I have found.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 130%;"&gt;Google&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;Here's what I have found:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Google SOAP search web services seem not to be available for new applications any more.  In 2006, Google seems to have stopped issuing new API keys.&lt;/li&gt;&lt;li&gt;There is another option from Google: API not SOAP based.  The terms don't exclude commercial use, but there is a restriction on caching the results of the search.  I guess, if we process the results and store the processed data, it wouldn't be considered &lt;span style="font-style: italic;"&gt;caching&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;The API services have exclusivity requirement: you are not supposed to use on the same site any other search provider.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;Yahoo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Here's what I have found:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Y! makes the search available via web services (REST but not SOAP webservices).&lt;/li&gt;&lt;li&gt;Each application has to use Application ID, which Y! issues  for free.  There is a &lt;span style="font-style: italic;"&gt;rate limit&lt;/span&gt; for each application id.&lt;/li&gt;&lt;li&gt;Allowed usage: web search API is available to commercial use, however a form of exclusivity restraint is imposed: you are not supposed to integrate the results with results from other search providers.&lt;/li&gt;&lt;li&gt;Storage restrictions: "you may not store any user data collected through the Yahoo! APIs for more than 24 hours".  Again, would storing the processed, for example aggregated data, be subject to this restriction?  I suppose, not.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size: 130%;"&gt;&lt;span style="font-weight: bold;"&gt;MSDN: Live Search WebServices API&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Terms of use summary:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;SOAP-based webservices call &lt;span style="font-style: italic;"&gt;Silky Road&lt;/span&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;No restrictions other than an application ID needed.  But their license is more complex and I might have missed something.&lt;/li&gt;&lt;/ul&gt;Other&lt;br /&gt;I'm sure there are/may be other search web services available, and some of them may be free.  DoubleClick?  I didn't analyze other options.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-223879602812050141?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/223879602812050141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=223879602812050141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/223879602812050141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/223879602812050141'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2009/01/search-web-services-or-api-for.html' title='Search Web Services or API for Commercial Use'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6039473623380883146</id><published>2008-12-30T14:17:00.000-08:00</published><updated>2008-12-30T14:36:58.913-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lynx'/><category scheme='http://www.blogger.com/atom/ns#' term='job hunt'/><category scheme='http://www.blogger.com/atom/ns#' term='file similarity'/><category scheme='http://www.blogger.com/atom/ns#' term='sim'/><title type='text'>How Similar Are Two Text Files?</title><content type='html'>Suppose you are doing a job hunt (like I'm doing right now) and after applying for quite a few of jobs you see you are loosing track of jobs you have already applied for.  The company name is often not shown, since most recruiting/staffing agencies don't reveal it in their job postings.  The job titles are often very similar.  After inquiring 2 or 3 times a recruiting company about a job you have already been submitted for by another staffing agency (and after you have already wasted your time on duplicate application process), you just wish you'd bee able to quickly detect that the job description you are looking at is very similar to one you have applied to 3 weeks earlier.  What do you do?  Using the diff isn't very useful, since the job descriptions are often slightly modified by the staffing agency before posting.  You want to search for a &lt;span style="font-style: italic;"&gt;similar&lt;/span&gt; instead of &lt;span style="font-style: italic;"&gt;identical&lt;/span&gt; text.&lt;br /&gt;&lt;br /&gt;I have found that there is research on this topic.  The best short-and-sweet summary, I have found is on Y! &lt;a href="http://answers.google.com/answers/threadview?id=337832"&gt;answers&lt;/a&gt;. From the tools mentioned there, I chose the &lt;a href="http://www.cs.vu.nl/%7Edick/sim.html"&gt;SIM tool&lt;/a&gt; by Dick Grune.  DOS binary is available there, but the trick was to select command parms that will fit best comparing two html files.  I have found that the following combination gives the most to the point answer: sim_text.exe -nT -r 100 job1.html job2.html.  It will show only relatively large common sequences (over 100 chars), and if it does show any of those, you better check that the two files don't correspond to the same job opening. &lt;br /&gt;&lt;br /&gt;I have also tried stripping the html tags from these html files using Lynx browser with the -dump option.  DOS binaries for Lynx, after some digging, I was able to find &lt;a href="http://www.fdisk.com/doslynx/lynxport.htm"&gt;here&lt;/a&gt;.  I had also to create the following lynx.bat:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   @ECHO OFF&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   set home=c:\bin\lynx\temp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   set temp=c:\bin\lynx\temp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   set lynx_cfg=c:\bin\lynx\lynx.cfg&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   set lynx_save_space=c:\bin\lynx\temp&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 153);"&gt;   c:\bin\lynx\lynx.exe %1 %2 %3 %4 %5&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The results were not convincing.  Actually, for some reason, the file similarity was less obvious when using the stripped files than when I used the original html files.  Not sure why.  I haven't analyzed this issue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6039473623380883146?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6039473623380883146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6039473623380883146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6039473623380883146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6039473623380883146'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2008/12/how-similar-are-two-text-files.html' title='How Similar Are Two Text Files?'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-7911051024321583569</id><published>2008-12-29T09:44:00.001-08:00</published><updated>2009-11-30T09:16:27.925-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='software development'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='struts'/><category scheme='http://www.blogger.com/atom/ns#' term='web applications'/><title type='text'>Struts, Hibernate Development with Eclipse</title><content type='html'>I'm developing an web application to test algorithms for Romba-like devices.  I have some algorithms in mind, that I want to test, so I decided I develop an application for the purpose of testing these algorithms or any algorithms.&lt;br /&gt;&lt;br /&gt;I wanted to use Java standard frameworks, for now Struts and Hibernate and Eclipse as the.  It took me some time to figure out what free plugins to use with Eclipse to add support to Struts and Hibernate. I looked for some time and finally found the following set of plugins:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Tomcat plugin from &lt;a href="http://www.eclipsetotale.com/tomcatPlugin.html"&gt;EclipseTotale.com&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Hibernate Core Plugin from &lt;a href="http://www.hibernate.org/255.html"&gt;Hibernate Team&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;StrutsIDE - Project &lt;a href="http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=StrutsIDE"&gt;Amateras&lt;/a&gt; plugin&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;For DB development support I have used three:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;DB Development plugin (from Eclipse.org)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;QuantumDB&lt;/li&gt;&lt;li&gt;Derby plugin (from Eclipse.org)&lt;/li&gt;&lt;/ul&gt;Probably the first of these would be enough.&lt;br /&gt;&lt;br /&gt;A few notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Tomcat plugin doesn't come with a documentation, but the website has a decent one.  Plugin works nicely.  Starts Tomcat in debug mode, unless user disables this feature in plugin preferences.  Switch to Debug perspective and you can debug your application.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;QuantumDB is a well known plugin, but I had problems with it.  I couldn't find in it the tables that were in the database.  Possibly, I'll learn how to use it.  DB Development plugin is easier to learn it.&lt;/li&gt;&lt;/ul&gt;I'm still in early phase of the development.  I'll update this blog when I have more experience with these plugins.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-7911051024321583569?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/7911051024321583569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=7911051024321583569' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7911051024321583569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/7911051024321583569'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2008/12/struts-hibernate-development-with.html' title='Struts, Hibernate Development with Eclipse'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7024716269332790260.post-6044954533296246705</id><published>2008-12-28T12:03:00.000-08:00</published><updated>2008-12-28T12:15:10.712-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shoes'/><category scheme='http://www.blogger.com/atom/ns#' term='winter'/><category scheme='http://www.blogger.com/atom/ns#' term='rain'/><category scheme='http://www.blogger.com/atom/ns#' term='husehold'/><category scheme='http://www.blogger.com/atom/ns#' term='snow'/><category scheme='http://www.blogger.com/atom/ns#' term='survival'/><title type='text'>How to dry wet shoes or boots</title><content type='html'>&lt;span style="font-family:verdana;"&gt;Materials needed:&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;wet shoes&lt;/li&gt;&lt;li&gt;old newspaper&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:lucida grande;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:georgia;"&gt;&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-family:verdana;"&gt;Do you have shoes that are wet and you need to dry them as quickly as possible?  Unfortunately, putting them in a warm place, even near &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;the heating stove isn't a very quick way to dry them.  I had often shoes staying overnight in a warm place like this and they were still wet in the morning.  So, here's what you do:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Tear a piece of the newspaper and make a ball out of it.  &lt;/li&gt;&lt;li&gt;Push the paper ball into the shoe, as far as you can.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Put a few more paper balls (say, 2-3 per shoe) into your shoes&lt;/li&gt;&lt;li&gt;Place the shoes in a warm place.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Even, if the only warm place is your living room, your shoes should be dry after 4-6 hours.  Definitly, the next morning.&lt;br /&gt;&lt;br /&gt;Enjoy your dry shoes!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7024716269332790260-6044954533296246705?l=sberka.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sberka.blogspot.com/feeds/6044954533296246705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7024716269332790260&amp;postID=6044954533296246705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6044954533296246705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7024716269332790260/posts/default/6044954533296246705'/><link rel='alternate' type='text/html' href='http://sberka.blogspot.com/2008/12/how-to-dry-wet-shoes-or-boots.html' title='How to dry wet shoes or boots'/><author><name>stanb</name><uri>http://www.blogger.com/profile/13757930019234576108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://3.bp.blogspot.com/_e4sNHM9RAKE/SWVe7dCm4BI/AAAAAAAAAAM/eRdLGe0FnvI/S220/staszekB1.jpg'/></author><thr:total>0</thr:total></entry></feed>
