<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-20544632</atom:id><lastBuildDate>Wed, 28 Aug 2024 17:31:20 +0000</lastBuildDate><title>Don&#39;t  Quit Your Day Job</title><description>Technical notes from a code wielding startup guy</description><link>http://simergence.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-285326966594387482</guid><pubDate>Fri, 23 Apr 2010 19:08:00 +0000</pubDate><atom:updated>2010-04-23T12:12:59.309-07:00</atom:updated><title>Erlang for Java developers presentation</title><description>I gave this talk to the &lt;a href=&quot;http://www.meetup.com/ErlangChicago/&quot;&gt;Chicago Erlang Users Group&lt;/a&gt; this past Wednesday, April 21st. It is meant to be an introduction to Erlang for someone coming from an imperative language like Java.&lt;br /&gt;&lt;br /&gt;&lt;embed src=&quot;http://blip.tv/play/g%2BRygdioUQI&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;480&quot; height=&quot;350&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;I am considering expanding it in to a tutorial screencast with the slides and some live coding. If that sounds interesting to anyone, let me know!</description><link>http://simergence.blogspot.com/2010/04/erlang-for-java-developers-presentation.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-216162614493152221</guid><pubDate>Tue, 13 Apr 2010 03:12:00 +0000</pubDate><atom:updated>2010-04-12T20:49:21.747-07:00</atom:updated><title>Erlang on a Mac (for the lazy)</title><description>Getting Erlang installed on your Mac isn&#39;t really all that difficult. You can just download it from http://erlang.org/download.html and build from source. But if you want to plan for future lazyness, then Homebrew is the way to go. Homebrew is quickly becoming the package manager of choice for OSX, so it will not only get your Erlang installed quickly and easily, but many of your other *NIX-y tools of choice. Go here &lt;a href=&quot;http://wiki.github.com/mxcl/homebrew/installation&quot;&gt;http://wiki.github.com/mxcl/homebrew/installation&lt;/a&gt; for download instructions. I strongly suggest reading the whole page before you start. Once you have it installed just go to the Terminal (yea you are already there if you installed Homebrew) and type &#39;brew install erlang&#39;. After it completes downloading and making the source (yes Homebrew just automates the available .configure/make/make install process) you are ready for the next step.&lt;br /&gt;&lt;br /&gt;Now that you have Erlang on your system you are going to want to get the Erlware tools. Erlware is conceptually like Homebrew, except for Erlang applications. It is a bit heavyweight and not always completely intuitive, but the benefits far outweigh the potential confusion. Once you start writing real Erlang applications, you are going to need to package and release them. While the core Erlang language is super simple, releases are arcane black magic. Having a tool that can automate the process is a real life saver. Erlware is essentially two tools, Faxien, which handles installing packages and dealing with remote repositiories, and Sinan, which will generate project structures and build your applications. You can find them at &lt;a href=&quot;http://erlware.org&quot;&gt;http://erlware.org&lt;/a&gt;, just follow the links for downloads and the Faxien universal launcher.  &lt;br /&gt;&lt;br /&gt;Once Faxien is downloaded go back in to Terminal and type python and the name of the file you downloaded. It is going to prompt you for several pieces of information, the most important is (if you used the Homebrew defaults) /usr/local/lib/erlang as the install directory. It will ask you if you want to keep your current Erlang install and install Faxien on top of it. Choose this option. Faxien will now install any application you retrieve or create with it in your Erlang distribution, making it available to any program. This will solve any dependency issues you may have otherwise run in to. Again, lazyness is key. Once Faxien is installed you can use it to install Sinan, just type &#39;faxien ir sinan&#39;. ir is a shortcut for install release. All of the Faxien commands can be found with faxien help commands. ir is all you will need for now. &lt;br /&gt;&lt;br /&gt;Once Sinan is installed it is time to do some damage. I generally use &#39;sinan gen&#39; to create a project directory with all of the needed files for a valid OTP application. If the app is going to be relatively simple (99% of the time) then I generally move the contents of the project/lib/project/ directory up to the project directory. That probably didn&#39;t make much sense until you see it. For example if you did &#39;sinan gen&#39; and entered &#39;bob&#39; as the name of your project it is going to create a directory called bob with several subdirectories including _build and lib. Under lib you will find bob again, and inside that directory what appears to be a normal Erlang app. I just copy all of those files/directories up to the top. Sinan will handle this with grace and it feels a little less clunky. If you are planning on splitting your project in to several subprojects, don&#39;t bother doing this. &lt;br /&gt;&lt;br /&gt;Now you can go in to the source directory, write some code, add those modules to the .app in /ebin and type &#39;sinan&#39; to compile the code. After it compiles you can type &#39;sinan shell&#39; which will open an erl repl with all of the proper code paths set. from here you can do an application:start(bob). And it will fire up your app and let you interact with it from the shell. Once you are happy with your code you can do a &#39;sinan dist&#39; which will pack up your code in to an Erlang approved tarball format. Now Faxien comes back in to the picture. If you type &#39;faxien ir&#39; it will install the tarball in to your /usr/local/lib/erlang directory.&lt;br /&gt;&lt;br /&gt;Now, for the final piece of lazyness jackpot. When you sinan gen next, and create the project &#39;fred&#39;, you will be able to modify fred.app in the ebin of that project, and list bob in your modules and viola it just works as if you were using crypto or any other built in Erlang library. &lt;br /&gt;&lt;br /&gt;Happy Erlanging!</description><link>http://simergence.blogspot.com/2010/04/erlang-on-mac-for-lazy.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-7975653344294886301</guid><pubDate>Wed, 09 Sep 2009 04:16:00 +0000</pubDate><atom:updated>2009-09-09T08:40:16.916-07:00</atom:updated><title>Erlang for Java Programmers</title><description>In a previous post I declared the end of my monogamous relationship with Java. I really played the field for a little while, but it did not take long for an infatuation with Erlang to take hold. Clojure was the runner up, and something I intend to explore more soon, but two languages at a time was a bit too much.&lt;br /&gt;&lt;br /&gt;Erlang is a functional language, but as a Java developer it did not scare me off. While the syntax is a little out there, the concepts map pretty neatly:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Immutability&lt;/span&gt;&lt;br /&gt;I have always erred on the naughty side with Java when it comes to the use of objects. I tend to have fairly struct like domain objects with getters and setters, and leave the business logic to manager type classes. I was never comfortable tying business logic to something I read out of the db and pass around and which may have different requirements in different apps. So the switch to a functional language was pretty easy, the main difference is instead of using setters, updating an object is a bit more like a clone/set combo. It feels a little like wasting memory, but you get over it.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Conditionals vs Pattern Matching&lt;/span&gt;&lt;br /&gt;In Java my methods tend to end up littered with if/then/else tests on the state of various objects. In Erlang the case statement is occasionally used to make sure a function did not return an error, but not much else. Instead, Erlang takes the idea of an overloaded method to a whole new level. Pattern matching is pretty easy to understand, and impossibly powerful. Each function input can be used to direct flow in to this or another version of the function. This sounds like it might lead to a bunch of copy paste, but instead it results in a few succinct versions of a function that are far easier to reason about.&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;Objects are Processes&lt;/span&gt;&lt;br /&gt;One of the main reasons I picked Erlang over a more traditional functional language like Haskell is the idea of processes. I didn&#39;t quite understand how anything could happen in a side effect free, stateless world, but Erlang keeps state all neatly wrapped up inside processes. Erlang processes are instantiated functions. You heard that right, unlike in Java, where an object is an instantiated class, in Erlang you run a function in a recursive loop forever. Weird right? Well the only real trick to this is now that the loop is going infinitely, passing its own state back in to itself, it needs a way to talk to the outside world. This is accomplished through messages. By putting a receive block inside the function, it will sleep until another process sends it a message. It will then wake, handle the message, loop and go back to sleep.&lt;br /&gt;&lt;br /&gt;There are of course many more concepts to consider, and I did not touch on OTP, but these were the main hurdles I encountered when reading my first Erlang book. I think Joe Armstrong&#39;s book is fantastic, and the new O&#39;Reilly book is solid as well.&lt;br /&gt;&lt;br /&gt;There is a new online tutorial for beginners:&lt;br /&gt;&lt;a href=&quot;http://learnyousomeerlang.com/&quot;&gt;http://learnyousomeerlang.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For a solid 6 part intro to OTP check out Mitchell Hashimoto&#39;s blog:&lt;br /&gt;&lt;a href=&quot;http://spawnlink.com/articles/an-introduction-to-gen_server-erlybank/&quot;&gt;http://spawnlink.com/articles/an-introduction-to-gen_server-erlybank/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A good searchable API site (though seemingly lacking the bifs):&lt;br /&gt;&lt;a href=&quot;http://erlapi.prepor.ru/docs/&quot;&gt;http://erlapi.prepor.ru/docs/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you are in Chicago, be sure to check out our user group:&lt;br /&gt;&lt;a href=&quot;http://groups.google.com/group/ceug?hl=en&quot;&gt;http://groups.google.com/group/ceug?hl=en&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And if you are interested, my first Erlang project:&lt;br /&gt;&lt;a href=&quot;http://github.com/chrisduesing/simmoa/tree/master&quot;&gt;http://github.com/chrisduesing/simmoa/tree/master&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_url = &#39;http://simergence.blogspot.com/2009/09/erlang-for-java-programmers.html&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_title = &#39;Erlang for Java Programmers&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_blurb = &#39;Some tips for how to make the intuitive leap from an imperative language like Java to Erlang.&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_style = &#39;1&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script language=&quot;javascript&quot; src=&quot;http://widgets.dzone.com/links/widgets/zoneit.js&quot;&gt;&lt;/script&gt;</description><link>http://simergence.blogspot.com/2009/09/erlang-for-java-programmers.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-8299457413599617573</guid><pubDate>Wed, 20 May 2009 23:05:00 +0000</pubDate><atom:updated>2009-06-11T06:13:43.963-07:00</atom:updated><title>Learning a New Language</title><description>At some point I realized I was on my way to becoming the COBOL programmer of tomorrow. 10 years in to my career and I hadn&#39;t touched another language outside of Java for 9 of them (not counting a myriad of technologies used in conjunction with Java for web, XML, etc.). It really hit home at Startup Weekend when I couldn&#39;t keep pace with the Ruby programmers. Not everything was a nail, and I had become way too comfortable with my hammer. I wouldn&#39;t mind learning Ruby, but my goals did not end up pointing me in that direction. I wanted something&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;completely&lt;/i&gt; different than Java&lt;/li&gt;&lt;li&gt;good for concurrent, distributed and/or real-time programming&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I frequent &lt;a href=&quot;http://news.ycombinator.com/&quot;&gt;Hacker News&lt;/a&gt; and it is difficult not to become intrigued by Lisp after spending much time there. I started reading articles and eventually bought Paul Graham&#39;s ANSI Common Lisp. It was a good book, and I don&#39;t feel intimidated by the syntax anymore, but I have a long way to go before I intuitively can tell the difference between a function + arguments, a list and a macro body while browsing code. I am intentionally not coding much beyond hello world, because I haven&#39;t decided on a language yet, and because I want to develop a feel for the right way to do things before I just start porting over Java habits.&lt;br /&gt;&lt;br /&gt;Lisp was my first contact with a functional language, and the entire concept intrigued me. I began to do more research and started reading up on Haskell, Erlang and Clojure. I really liked all of them, but wanted to choose just one to really deep dive in to. I picked up the Manning MEAP on Erlang and started watching Clojure screencasts. My pro and con list is still taking shape, but here is a look so far: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;pro: Erlang seems like a perfect fit for writing the kinds of systems I am interested in, and has an easily understanable syntax.&lt;/li&gt;&lt;li&gt;con: Erlang&#39;s OTP and system libraries are a complete mystery to me and the documentation/resources are a bit scarce.&lt;/li&gt;&lt;li&gt;pro: Clojure lets me take advantage of Java&#39;s libraries and leverage the time I spent studying Lisp&lt;/li&gt;&lt;li&gt;con: The Clojure syntax isn&#39;t clicking for me, and I feel like I am not branching out far enough from Java.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I may just end up pursuing both if I cannot make a decision. I am going to step it up in the meantime. Tonight I am going to attend the &lt;a href=&quot;http://onclojure.com/chicago/&quot;&gt;Chicago Clojure Meetup&lt;/a&gt;, and hopefully in June I can take the &lt;a href=&quot;http://weblog.hypotheticalabs.com/?p=463&quot;&gt;Hands on Erlang&lt;/a&gt; training. I will keep you posted!&lt;br /&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_url = &#39;http://simergence.blogspot.com/2009/05/learning-new-language.html&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_title = &#39;Learning a New Language&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_blurb = &#39;Documenting the switch of a 10 year Java developer to a functional language. If anyone has any thoughts on further expanding on this your comments are most welcome!&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&gt;var dzone_style = &#39;1&#39;;&lt;/script&gt;&lt;br /&gt;&lt;script language=&quot;javascript&quot; src=&quot;http://widgets.dzone.com/widgets/zoneit.js&quot;&gt;&lt;/script&gt;</description><link>http://simergence.blogspot.com/2009/05/learning-new-language.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>11</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-3440391268209102564</guid><pubDate>Tue, 10 Jun 2008 20:32:00 +0000</pubDate><atom:updated>2008-06-13T15:44:51.217-07:00</atom:updated><title>Seam generated UI doesn&#39;t like references to multiple entities of the same type</title><description>Given two classes (minus important details like @Id, getters, setters, etc).&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;@Entity&lt;br /&gt;public class Bar {}&lt;br /&gt;&lt;br /&gt;@Entity&lt;br /&gt;public class Foo {&lt;br /&gt;&lt;br /&gt;  private Bar bar1;&lt;br /&gt;  private Bar bar2;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;and then running seam generate-ui on the containing project will produce something like:&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;@Name(&quot;barHome&quot;)&lt;br /&gt;public class BarHome {}&lt;br /&gt;&lt;br /&gt;@Name(&quot;fooHome&quot;)&lt;br /&gt;public class FooHome {&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome;&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome;&lt;br /&gt;&lt;br /&gt;  public void wire() {&lt;br /&gt;&lt;br /&gt;    Bar bar1 = barHome.getDefinedInstance();&lt;br /&gt;    if (bar1 != null) {&lt;br /&gt;      getInstance().setBar1(bar1);&lt;br /&gt;    }&lt;br /&gt;    Bar bar2 = barHome.getDefinedInstance();&lt;br /&gt;    if (bar2 != null) {&lt;br /&gt;      getInstance().setBar2(bar2);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;which of course, does not compile. Even if it did, it would not work properly. The FooEdit.xhtml page would set both instances to the same thing. This is the problem I set out to solve, not really knowing if there are any other use cases where this might be a problem.&lt;br /&gt;&lt;br /&gt;First I Googled seam generate-ui and found this JIRA post:&lt;br /&gt;http://jira.jboss.org/jira/browse/JBSEAM-994&lt;br /&gt;&lt;br /&gt;It wasn&#39;t all that helpful, especially when I saw that Gavin wrote, &quot;...in fact I don&#39;t see any easy way to arrive at a correct solution - this is a super-difficult one to solve by code generation, it needs human-written code.&quot; In order to achieve just that I set out to write the simplest code possible, since I evidently won&#39;t be able to modify the generator, I am going to have to re-apply my fix each time I re-generate the ui.&lt;br /&gt;&lt;br /&gt;First thing I did was tackle what seemed to be the most obvious 2 problems. 1) this doesn&#39;t compile. 2) The bars need to be stored in 2 separate home instances. The modified code...&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;@Name(&quot;barHome&quot;)&lt;br /&gt;@Role(name=&quot;barHome2&quot;)&lt;br /&gt;public class BarHome {}&lt;br /&gt;&lt;br /&gt;@Name(&quot;fooHome&quot;)&lt;br /&gt;public class FooHome {&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome;&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome2;&lt;br /&gt;&lt;br /&gt;  public void wire() {&lt;br /&gt;&lt;br /&gt;    Bar bar1 = barHome.getDefinedInstance();&lt;br /&gt;    if (bar1 != null) {&lt;br /&gt;      getInstance().setBar1(bar1);&lt;br /&gt;    }&lt;br /&gt;    Bar bar2 = barHome2.getDefinedInstance();&lt;br /&gt;    if (bar2 != null) {&lt;br /&gt;      getInstance().setBar2(bar2);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;The whole thing now compiles, but the resulting FooEdit.xhtml only sets the value of bar1, no matter which is selected.&lt;br /&gt;&lt;br /&gt;What we ultimately want to be able to do is limit changes to the components that need to know about this complexity and hide it from the ones that don&#39;t. The requirement is to not change Bar or any of the components/pages associated with it. Luckily this ended up working by making small changes to FooHome, FooEdit.xhtml and FooEdit.page.xml.&lt;br /&gt;&lt;br /&gt;First FooHome gets a variable to note which version of BarHome it should set an id for when coming back from the BarList.xhtml page. There need to be methods to get and set the proper barHome id for this as well. &lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;@Name(&quot;fooHome&quot;)&lt;br /&gt;public class FooHome {&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome;&lt;br /&gt;&lt;br /&gt;  @In(create = true)&lt;br /&gt;  BarHome barHome2;&lt;br /&gt;&lt;br /&gt;  int selectedBarHome;&lt;br /&gt;&lt;br /&gt;  public void setBarId(Long id){&lt;br /&gt;  &lt;br /&gt;    switch (selectedBarHome){&lt;br /&gt;   &lt;br /&gt;      case 1:&lt;br /&gt;        barHome.setBarId(id);&lt;br /&gt;        break;&lt;br /&gt;    &lt;br /&gt;      case 2:&lt;br /&gt;        barHome2.setBarId(id);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  public Long getBarId(){&lt;br /&gt;  &lt;br /&gt;    switch (selectedBarHome){&lt;br /&gt;   &lt;br /&gt;      case 1:&lt;br /&gt;        return barHome.getBarId();&lt;br /&gt;&lt;br /&gt;      case 2:&lt;br /&gt;        return barHome2.getBarId();&lt;br /&gt;    }&lt;br /&gt;    return null;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public void wire() {&lt;br /&gt;&lt;br /&gt;    Bar bar1 = barHome.getDefinedInstance();&lt;br /&gt;    if (bar1 != null) {&lt;br /&gt;      getInstance().setBar1(bar1);&lt;br /&gt;    }&lt;br /&gt;    Bar bar2 = barHome2.getDefinedInstance();&lt;br /&gt;    if (bar2 != null) {&lt;br /&gt;       getInstance().setBar2(bar2);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Next the FooEdit.page.xml parameter that sets the bar instance needs to reference the new fooHome bar id instead of the barHome id . So the line&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;param name=&quot;barId&quot; &lt;br /&gt;          value=&quot;#{fooHome.barHome.barId}&quot;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;becomes&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;param name=&quot;barId&quot; &lt;br /&gt;          value=&quot;#{fooHome.barId}&quot;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Finally the FooEdit.xhtml is changed to tell FooHome which BarHome it is going to be making changes to. Look for the s:button in the tab panel for &quot;Select bar1&quot; and &quot;Select bar2&quot;. Add an action to these buttons to accomplish this. Below is the generated xhtml page only showing the buttons with the new action added.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;s:button value=&quot;Select bar1&quot;&lt;br /&gt;    view=&quot;/BarList.xhtml&quot;&lt;br /&gt;    action=&quot;#{fooHome.setSelectedBarHome(1)}&quot; &amp;gt;&lt;br /&gt; &amp;lt;f:param name=&quot;from&quot; value=&quot;FooEdit&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/s:button&amp;gt; &lt;br /&gt;...&lt;br /&gt;&amp;lt;s:button value=&quot;Select bar2&quot;&lt;br /&gt;    view=&quot;/BarList.xhtml&quot;&lt;br /&gt;    action=&quot;#{fooHome.setSelectedBarHome(2)}&quot; &amp;gt;&lt;br /&gt; &amp;lt;f:param name=&quot;from&quot; value=&quot;FooEdit&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/s:button&amp;gt; &lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;And that is pretty much it. Now when you edit a Foo, the tabs at the bottom for bar1 and bar2 will properly select different instances of bar from the bar list.</description><link>http://simergence.blogspot.com/2008/06/seam-generated-ui-doesnt-like.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-20544632.post-3168984945481225256</guid><pubDate>Wed, 09 Jan 2008 18:24:00 +0000</pubDate><atom:updated>2008-01-09T15:17:34.541-08:00</atom:updated><title>Java Library Migration</title><description>I don&#39;t generally get super technical on this blog (I also don&#39;t often write on this blog, so increasing the scope couldn&#39;t hurt the frequency), but I thought I would share some of the pain I experience from time to time in migrating an existing Java project from one set of library dependencies to another. In this case I am taking the first steps in migrating an app from MyFaces JSF on Tomcat to Sun&#39;s JSF on JBoss. The pain is compounded by the fact that I use Eclipse as a development environment. Eclipse is great right up until the point you try to change one of its basic project settings, at which time you need to have a detailed understanding of all of its configuration properties. This will be a step by step how I approached the problem rather than an after the fact recipe for doing the same thing. It should be more illustrative of what a developer actually goes through in troubleshooting an issue.&lt;br /&gt;&lt;br /&gt;Background:&lt;br /&gt;The project is set up as a standard Eclipse &#39;Web Project&#39;. This means it will try to control all of the dependencies for Servlet/JSTL/JSF etc as well as Java version, building and server integration. The other way of doing this is to set up every project as a generic &#39;Java Project&#39; and then use Ant scripts to build everything. It takes more time to set up initially, but down the road you will end up using Ant to build for test/production scripts anyway, so the pain it can help you avoid is well worth just using it off the bat.&lt;br /&gt;&lt;br /&gt;Step 1 : Remove the MyFaces Libraries&lt;br /&gt;I deleted the MyFaces api and impl libraries from the project. I also removed them from the Tomcat launch configuration. I then added the Sun RI version which can be downloaded directly from &lt;a href=&quot;https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=5420&amp;amp;expandFolder=5420&amp;amp;folderID=5420&quot;&gt;dev.java.net&lt;/a&gt;.  Upon republishing and relaunching Tomcat I got the following error:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener&lt;br /&gt;java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;&lt;br /&gt;at com.sun.faces.config.ConfigureListener.getServletContextIdentifier(ConfigureListener.java:1804)&lt;br /&gt;at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:558)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Several Google searches imply this problem falls in to one of a few areas:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I have previously upgraded Tomcat to version 6 and there might be a dependency somewhere on the old version of the servelt implementation that does not implement the latest spec.&lt;/li&gt;&lt;li&gt;A previous upgrade of Java to version 6 may be causing an issue with the way jsf/servlets loads classes that is incompatible.&lt;/li&gt;&lt;li&gt;The latest JSF libraries have different dependencies than MyFaces did and there is a clash.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Step 2: Troubleshooting based on shoddy information.&lt;br /&gt;I initially try updating to the latest versions of the JSF libraries from dev.java.net to no avail. I then try pulling jstl from the latest Glassfish. I look around for newer versions of the servlet impl, but I have the latest version of Tomcat so that seems unlikely to help.  To eliminate Tomcat from the equation I plop the war file in JBoss and get the same exception. Has to be the project itself or somehow still Java6. The Java version seems a strange solution as the app worked before pulling the MyFaces library. I set up a new Tomcat server in Eclipse with Java 5 runtime and the same error occurs. This has to be a library incompatibility issue of some sort, but Java doesn&#39;t help in this area so the experimentation continues.&lt;br /&gt;&lt;br /&gt;Step 3: Getting the latest version of all dependencies.&lt;br /&gt;I find a page that explains the steps for getting JSF running in Tomcat, its dated, but it sparks an idea... why not start over? So I merrily delete Tomcat and all of the jars my project is dependent on. I remove that Tomcat from the Eclipse servers list and then go in to the project. Uht oh, now I notice that my project compiler level was building to 5 and I was trying to deploy to a 6 runtime.. was that the source of the problem? May be hard to say even if this fixes the problem since I blew away so much. This is a great reminder of why the patient, one step at a time approach is always the right one, even when frustration sets in.&lt;br /&gt;&lt;br /&gt;Step 4: Denouement&lt;br /&gt;Once I get the latest versions of the libraries dropped in to the tomcat/common/lib folder and the project and server pointed to them I need to go through each entry in the project &#39;properties&#39; menu and make sure everything is up to date and consistent. Once this is done the project builds and deploys nicely.&lt;br /&gt;&lt;br /&gt;This is one of many instances where you come to realize that the more a tool works to make your life easier, as soon as something goes wrong you really need an intricate understanding of it. The more the complexity is hidden from you on a day to day basis the worse it is when you finally peek under the hood. It never hurts to have a general understanding of how the tools you use work, but it really is times like these that make it happen. Good thing they don&#39;t happen every day...</description><link>http://simergence.blogspot.com/2008/01/java-library-migration.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>1</thr:total></item></channel></rss>