<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>This blog is pretty much about my experiences with the Java Language, Web Development per se, including PHP, Python.

I’m a growing developer focusing in web development area.</description><title>Java+Moccha</title><generator>Tumblr (3.0; @javaplusmoccha)</generator><link>http://javaplusmoccha.tumblr.com/</link><item><title>What is the best programming language?</title><description>&lt;p&gt;&lt;a href="http://adnan-chowdhury.tumblr.com/post/3280278242"&gt;adnan-chowdhury&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;img width="229" height="171" src="http://stevemooradian.com/wordpress/wp-content/images/programming/code.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;What is the &lt;strong&gt;best programming language&lt;/strong&gt; to learn and use?&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;Java&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;C/C++&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;PHP&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Python&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Perl&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Ruby on Rails&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Other&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Comment below and let me know what you think, I’m keen to know what you think!&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3283828257</link><guid>http://javaplusmoccha.tumblr.com/post/3283828257</guid><pubDate>Sun, 13 Feb 2011 20:50:11 -0500</pubDate></item><item><title>Play! Circus - For URL Perfectionists</title><description>&lt;p&gt;This is a module I&amp;#8217;m currently working on after making a suggestion in Play! Framework Mailing List, I realized that this one module could actually be nice to have. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goals of the module:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Generation of Java files using routes&lt;/li&gt;
&lt;li&gt;Generation of template files&lt;/li&gt;
&lt;li&gt;Increase productivity&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Right now I&amp;#8217;m almost done with the method generation &lt;strong&gt;which will look like this:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://javaplusmoccha.pastebin.com/j9s7XKwK"&gt;Link to pastebin&lt;/a&gt; (sorry my current tumblr design width is small)&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;strong&gt;It also take notice of regex:&lt;/strong&gt;&lt;br/&gt;&lt;a target="_blank" href="http://javaplusmoccha.pastebin.com/ESY9je29"&gt;Link to pastebin&lt;/a&gt; (sorry my current tumblr design width is small)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Its been a real experience creating this module, I don&amp;#8217;t know when I will be able to release it to the public but once I get a working copy I will commit it to Github.&lt;br/&gt;There are a few drawbacks, the module will automatically make the arguments Integer, since I cannot get which type of argument you want (string, integer), so the generation will not be 100% perfect, but it will save you time from creating templates and controllers :) &lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Also, it will not override files, so this is a &amp;#8220;run-once&amp;#8221; module then deactivate it :). Since it will be an experimental release I suggest not to be used in current projects. &lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Cheers!&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3258247937</link><guid>http://javaplusmoccha.tumblr.com/post/3258247937</guid><pubDate>Sat, 12 Feb 2011 16:29:00 -0500</pubDate><category>play-framework</category><category>java</category><category>programming</category></item><item><title>"Don’t try to change people, change the process."</title><description>“Don’t try to change people, change the process.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;some weird dude I couldn’t get the name!&lt;/em&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3187909875</link><guid>http://javaplusmoccha.tumblr.com/post/3187909875</guid><pubDate>Tue, 08 Feb 2011 18:09:44 -0500</pubDate></item><item><title>Fine, I will learn C first than C++ I&amp;#8217;ve been bought with a good reason too. You know...</title><description>&lt;p&gt;Fine, I will learn C first than C++ I&amp;#8217;ve been bought with a good reason too. You know sometimes I don&amp;#8217;t know if learning as a hobbyist has more advantages than going to college probably not&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3183774431</link><guid>http://javaplusmoccha.tumblr.com/post/3183774431</guid><pubDate>Tue, 08 Feb 2011 13:43:00 -0500</pubDate><category>c</category><category>programming</category></item><item><title>Creating an easy installer in Play! is tricky but fun</title><description>&lt;p&gt;I&amp;#8217;ve been working on some Play! related projects for some time now. This one is a gallery that I plan to release to a targeted audience. Usually when we use a web framework we sort of forget that eventually we will need to write an installer so the user or client can install the application without any technical voodoo crawling around.&lt;/p&gt;
&lt;p&gt;The only downside of this is &lt;strong&gt;portability&lt;/strong&gt;, for a simple gallery the ending war file is &lt;strong&gt;41mb&lt;/strong&gt;. It&amp;#8217;s not that bad if you wget it using the server connection though, but not everyone going to have a server at their disposal, &lt;strong&gt;sadly&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;It made my day though, I enjoyed writing the installer, using hibernate to create all the schema and use the Bootstrap to load common data. &lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3174696732</link><guid>http://javaplusmoccha.tumblr.com/post/3174696732</guid><pubDate>Mon, 07 Feb 2011 22:07:29 -0500</pubDate><category>play-framework</category><category>java</category></item><item><title>"Looking at code you wrote more than two weeks ago is like looking at code you are seeing for the..."</title><description>“Looking at code you wrote more than two weeks ago is like looking at code you are seeing for the first time.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;p&gt;So true :(&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;em&gt;Dan Hurvitz&lt;/em&gt;&lt;/span&gt; (via &lt;a href="http://adamjmorgan.tumblr.com/"&gt;adamjmorgan&lt;/a&gt;)&lt;/p&gt;&lt;/em&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3143633664</link><guid>http://javaplusmoccha.tumblr.com/post/3143633664</guid><pubDate>Sun, 06 Feb 2011 08:58:05 -0500</pubDate></item><item><title>Why Do Programmers Write Apps and then Make Them Free? - Programmers - Stack Exchange Q&amp;A Network </title><description>&lt;a href="http://programmers.stackexchange.com/questions/3233/why-do-programmers-write-apps-and-then-make-them-free"&gt;Why Do Programmers Write Apps and then Make Them Free? - Programmers - Stack Exchange Q&amp;A Network &lt;/a&gt;: &lt;p&gt;&lt;a href="http://kawohi-art.tumblr.com/post/3141594326"&gt;kawohi-art&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I love this question, tons of answers and reasons why you should give your apps away for free.&lt;/p&gt;
&lt;p&gt;One of the answers:&lt;/p&gt;
&lt;blockquote&gt;&lt;em&gt;One of the main reasons why I’d consider releasing an app for free is because it’s a surefire addition to my portfolio for future endeavors (potential job opportunities, promoting your name in the programming world). That’s more than enough payment if you ask me.&lt;/em&gt;&lt;/blockquote&gt;
&lt;/blockquote&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3143556638</link><guid>http://javaplusmoccha.tumblr.com/post/3143556638</guid><pubDate>Sun, 06 Feb 2011 08:50:18 -0500</pubDate></item><item><title>Even after all my trouble with Play! Framework&amp;#8230; there is no way I would jump to another web...</title><description>&lt;p&gt;Even after all my trouble with Play! Framework&amp;#8230; there is no way I would jump to another web framework.&lt;/p&gt;
&lt;p&gt;For Python: Django&lt;br/&gt;For PHP: &amp;#8230;? Zend Framework.. Zend seems to have over-engineered their framework, Kohana and CakePHP seems the way to go, still I would use some of their classes.&lt;/p&gt;
&lt;p&gt;Back to work &lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3126645339</link><guid>http://javaplusmoccha.tumblr.com/post/3126645339</guid><pubDate>Sat, 05 Feb 2011 13:25:03 -0500</pubDate><category>play-framework</category><category>programming</category><category>java</category><category>python</category><category>php</category></item><item><title>Last week nightmare!</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/NMjaip2hqPE?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Last week nightmare!&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3104860736</link><guid>http://javaplusmoccha.tumblr.com/post/3104860736</guid><pubDate>Fri, 04 Feb 2011 09:25:47 -0500</pubDate><category>supernatural</category><category>cw</category></item><item><title>At last, #supernatural is today, a good time to relax after programming all week. I had an horrible...</title><description>&lt;p&gt;At last, #supernatural is today, a good time to relax after programming all week. I had an horrible nightmare last night&amp;#8230; that they brought Stephanie Meyer to write SN script.&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3104587663</link><guid>http://javaplusmoccha.tumblr.com/post/3104587663</guid><pubDate>Fri, 04 Feb 2011 08:55:00 -0500</pubDate><category>relax</category><category>yay-friday</category><category>tv-show</category><category>supernatural</category></item><item><title>"My first novel was rejected by seven agents before I found someone willing to take it on. Then it..."</title><description>“My first novel was rejected by seven agents before I found someone willing to take it on. Then it was rejected by six publishers. Then my agent fell ill, and I had to find a new one. Three agents never responded at all. The fourth I sent it to took a chance on the book. And the chance paid off.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;span&gt;Jonathan Safran Foer&lt;/span&gt; (via &lt;a href="http://fernandofrench.tumblr.com/"&gt;fernandofrench&lt;/a&gt;)&lt;/em&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3104522933</link><guid>http://javaplusmoccha.tumblr.com/post/3104522933</guid><pubDate>Fri, 04 Feb 2011 08:48:13 -0500</pubDate></item><item><title>I find it weird that I get better performance using Play! in Linux than in Windows&amp;#8230; well,...</title><description>&lt;p&gt;I find it weird that I get better performance using Play! in Linux than in Windows&amp;#8230; well, fine, not weird and probably obvious but since we are talking about the JVM here&amp;#8230; why is it faster on linux than in windows?&amp;#8230; it&amp;#8217;s a guess by the way&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3095872551</link><guid>http://javaplusmoccha.tumblr.com/post/3095872551</guid><pubDate>Thu, 03 Feb 2011 19:57:53 -0500</pubDate><category>java</category><category>play-framework</category></item><item><title>I was just reading some comparisons between Python vs PHP, and it went like this, &amp;#8220;python...</title><description>&lt;p&gt;I was just reading some comparisons between Python vs PHP, and it went like this, &amp;#8220;python supports blah blah blah&amp;#8221;, then a PHP guy would say &amp;#8220;we do too!&amp;#8221;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://wiki.python.org/moin/PythonVsPhp"&gt;http://wiki.python.org/moin/PythonVsPhp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Check the retorts.. really silly, they should clean up and put some code examples if they are going to retort.&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3073671221</link><guid>http://javaplusmoccha.tumblr.com/post/3073671221</guid><pubDate>Wed, 02 Feb 2011 16:23:00 -0500</pubDate><category>php</category><category>python</category><category>weird</category></item><item><title>Bah, I found some workarounds for my Host routes issues, today it worked fine and well, time to keep...</title><description>&lt;p&gt;Bah, I found some workarounds for my Host routes issues, today it worked fine and well, time to keep working on&amp;#8230;&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3072751228</link><guid>http://javaplusmoccha.tumblr.com/post/3072751228</guid><pubDate>Wed, 02 Feb 2011 15:31:23 -0500</pubDate></item><item><title>My only wish: Better support for Host routes</title><description>&lt;p&gt;Yesterday I started working on a authentication module for Play! Framework called GateKeeper, this module will help me authenticate people in different host routes, for example:&lt;/p&gt;
&lt;p&gt;billing.myapp.com&lt;/p&gt;
&lt;p&gt;accounts.myapp.com&lt;/p&gt;
&lt;p&gt;You get the idea, right? Problem is that when it comes to reverse routing, and the annoying router matching it instantly kills progress and the first thing you do is to start poking your &amp;#8216;routes&amp;#8217; file and verify that it&amp;#8217;s written well. Guess what? I also think the router matching works whenever it feels like&amp;#8230;(when it comes to Host routes&amp;#8230;), I know Play! Framework is still new and all, but I just can&amp;#8217;t go and tell clients &amp;#8220;well, change of plans! I&amp;#8217;m changing to django (or spring, or struts 2, or whatever) because I can&amp;#8217;t get done what you asked me in this framework)&amp;#8221;. &lt;/p&gt;
&lt;p&gt;Most of you might be wondering &amp;#8220;that&amp;#8217;s silly, just a problem with routes matching and reverse routing? why not fix it yourself and contribute&amp;#8221; well, everyone has their priorities, mine is to work because they pay me to, after all day long looking at code and writing, no matter how passionate you are about programming it&amp;#8217;s really hard to get my free time to focus on code. &lt;/p&gt;
&lt;p&gt;And that&amp;#8217;s it! at least I could get this out of my system while the Play! team provides better support for such issue, I already added the tickets so it&amp;#8217;s all up to them. For now, since it will take a few months to develop the application I&amp;#8217;m working on I&amp;#8217;ll use normal routes then later make the switch, since GateKeeper will support both normal routes and Host routes, it shouldn&amp;#8217;t be any problem.&lt;/p&gt;
&lt;p&gt;P.S I should really learn another framework or two in case something similar happens again (actually I know CakePHP/Zend Framework, etc, but PHP bores me and I will do anything to steer away from it, run from it)&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3056658612</link><guid>http://javaplusmoccha.tumblr.com/post/3056658612</guid><pubDate>Tue, 01 Feb 2011 18:44:19 -0500</pubDate><category>play-framework</category><category>programming</category><category>language-agnostic</category><category>say-no-to-php</category></item><item><title>Accelerated C++</title><description>&lt;p&gt;A few days ago I started to learn C++, I was kinda disappointed due to not finding a decent book on C++ so I looked at StackOverflow and started looking for the best C++ books for beginners and &lt;a target="_blank" href="http://www.amazon.com/gp/product/020170353X?ie=UTF8&amp;amp;tag=mrgeekstore-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=020170353X"&gt;I saw lots of programmers recommending this book&lt;/a&gt; and it&amp;#8217;s really as they say, pure awesome. &lt;/p&gt;
&lt;p&gt;Today I read a few chapters and did examples to get myself started and motivated on learning this &amp;#8220;complex&amp;#8221; language. This book should be a model to authors attempting to write a beginners book of a programming language. I&amp;#8217;ve read a few Deitel &amp;#8220;X How to program&amp;#8221; books and it just doesn&amp;#8217;t compare to this one. It&amp;#8217;s straight to the point, it doesn&amp;#8217;t waste too much time on explanations and the author doesn&amp;#8217;t seem to have a hard time explaining the examples. &lt;/p&gt;
&lt;p&gt;I hope that when the next standardization kicks in ( &lt;a href="http://en.wikipedia.org/wiki/C%2B%2B0x"&gt;C++0X&lt;/a&gt; ) the author Andrew Koenig writes a new edition. &lt;/p&gt;
&lt;p&gt;p.s: I should start working towards my CS degree&amp;#8230; god knows why I haven&amp;#8217;t started it yet&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/3021825676</link><guid>http://javaplusmoccha.tumblr.com/post/3021825676</guid><pubDate>Sun, 30 Jan 2011 19:58:00 -0500</pubDate><category>books</category><category>C++</category></item><item><title>hmm... too many books... which one is the CORRECT to get?!</title><description>&lt;p&gt;I&amp;#8217;ve been doing some research on the following subjects: JPA 2.0, Hibernate, Swing (best practices). &lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve done MVC in PHP before, but web interface is just not the same as creating an application with Swing. &lt;/p&gt;
&lt;p&gt;For JPA 2.0, I&amp;#8217;m settling with &amp;#8220;Pro JPA 2: Mastering the Java Persistence API&amp;#8221;, for hibernate, I need a good one with examples of HQL. Oh well, time to start digging&lt;/p&gt;
&lt;p&gt;Bah, only thing left is to learn Apache Ant, luckily there are lots of online resources and documentation for that :D.&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/2785520705</link><guid>http://javaplusmoccha.tumblr.com/post/2785520705</guid><pubDate>Sun, 16 Jan 2011 19:23:10 -0500</pubDate><category>java</category><category>books</category></item><item><title>Things to change</title><description>&lt;p&gt;If you have read in blog description, it says I&amp;#8217;m a growing developer (not just web&amp;#8230; gotta fix that) so in the morning I start looking for programming articles, mostly related to Java and Application servers, blah blah. My motivation to learn Java came from nowhere, I just liked it, it was ideal and loved how &amp;#8220;strict&amp;#8221; is the language. Unlikely PHP, Python and other scripting languages, I just liked the concepts of Java.&lt;/p&gt;
&lt;p&gt;The limitations of PHP was that it was difficult to have control of other things in the server and it was all tied to the web. I know, I know&amp;#8230; (HyperText PreProcessor), what else do I expect (python, probably). Then I  went with Python, it was great at first but to be honest it wasn&amp;#8217;t my cup of tea. I started setting a my first Django application, Django had quite a learning curve with new introductions and terms I&amp;#8217;ve never heard before so it took me a while to get used to it. One thing I loved from Python was its IMPORT, and some other neat features it had. Sadly, I&amp;#8217;m not really motivated to learn it.&lt;/p&gt;
&lt;p&gt;(Changing the subject) The reality is, getting a job with PHP knowledge alone won&amp;#8217;t do it. You have to be very fierce, creating a PHP web application is so &amp;#8220;simple&amp;#8221;, even companies are starting to demand lower prices, and me, a freelancer who has his things to pay comes a very high risk. &lt;/p&gt;
&lt;p&gt;That said, this is where Java saved me actually, here are plenty of jobs for Java developers and that was a big plus, because I like Java plus there are jobs out there waiting. Honestly, it will take me several months or maybe a 1 or 2 or 3 years, to master it, is it worth it? Pretty much! Not because of that, but because I got my first job with it too!&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m still a young programmer, inexperienced in the Java world wanting to learn more. Especially in designing! &lt;/p&gt;
&lt;p&gt;Today I started to look for C++ articles and setting up an IDE and getting ready to learn C++ basics. It&amp;#8217;ll be little steps because I don&amp;#8217;t want to learn two languages at the same time so lets say a week (5 days of java) and weekend (2 days of C++), or something like that. I&amp;#8217;m sure with C++ I can get more experience :)&lt;/p&gt;
&lt;p&gt;Well, practice make best, theory&amp;#160;!= real world applications&lt;/p&gt;

&lt;p&gt;Cheers, until the next post.&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/2736912531</link><guid>http://javaplusmoccha.tumblr.com/post/2736912531</guid><pubDate>Thu, 13 Jan 2011 20:22:53 -0500</pubDate><category>daily</category><category>programming</category></item><item><title>Play! Framework - What you should know!</title><description>&lt;p&gt;&lt;strong&gt;Quick Links:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Common Pitfalls:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="#cachegivenulls"&gt;Why Cache keeps giving me null?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#securewontload"&gt;I can&amp;#8217;t get secure module on others controller packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#modulesdonotload"&gt;Modules do not load!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#checkcheck"&gt;Always add checkAuthenticity in your POST&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;FAQs:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="#book"&gt;Is there a Play! Framework book?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#getheaders"&gt;How do I get browser agent, client IP?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dropschema"&gt;I want to re-create my schema(database tables) every time I edit my models?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#modelsid"&gt;Why is the id in models already defined? I don&amp;#8217;t want it!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#cheatplay"&gt;Is there any cheat sheet I could use?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hostroutes"&gt;How to add (virtual) hosts routes?&lt;/a&gt; (e.x &lt;a href="http://host.myapp.com/"&gt;&lt;a href="http://HOST.myapp.com/"&gt;http://HOST.myapp.com/&lt;/a&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="#visible"&gt;Why does it says method connected() in Secure.Security class is not visible?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#scripting"&gt;Can I do scriptlets (scripting) in templates?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#orm"&gt;What does Play! use to do database transactions/queries/etc?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#beforeme"&gt;Is there a way to run code BEFORE running an action?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#crud"&gt;Why does CRUD module does not support X thing? &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#validate"&gt;Is there a data validation library?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#upload"&gt;How do I upload a damn file?!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;How to do multiple uploads with JavaScript/jQuery/Yui (coming soon)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Be aware of:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="#illegalcache"&gt;Lots of Illegal shutdown with Cache&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hostdilemma"&gt;Host routes dilemma&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#duplicatecookies"&gt;Why Play! Keeps duplicating its cookies when I&amp;#8217;m using host routes?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;You have seen Play! Framework video, right? It’s a promising RESTful Web Framework revolutionizing the Java Web Development area. I’ve done small applications with Java JSP and Servlet (usually, you use these two together if anyone is wondering), and it’s a lot of trouble to put together when you want to create something bigger.&lt;/p&gt;
&lt;p&gt;Now, I come from a PHP environment. I jumped to Java’s bandwagon when I got tired of PHP. PHP is a great language, the only thing that make it bad is the developers that does not follow best practices or does not even bother learning about security. I guess that any user learning the PHP language could just copy/paste anything another developer did. (I mean look at successful sites like Facebook, and Yahoo! (yes they use PHP, and some other languages too)&lt;/p&gt;
&lt;p&gt;No, no. I didn’t come to discuss PHP issues. I’m writing this to those who are getting started with the &lt;strong&gt;Play Framework&lt;/strong&gt;. First, we will start with the modules available.&lt;/p&gt;
&lt;p&gt;Be aware of Play! Modules, most of them will save your time, or your neck:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
&lt;p&gt; &lt;strong&gt;Deadbolt&lt;/strong&gt; is an authorization module, 	its documentation is pretty sucky and expects you to know how it 	works. Once running, it’s REALLY handy and a must have if you have 	your own authentication module, I will post real world examples when 	I get the time. Kuddos to &lt;a target="_blank" href="http://www.objectify.be/wordpress/"&gt;Steve 	Chaloner&lt;/a&gt; of Objectify.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Secure&lt;/strong&gt; authentication module, this module is 	one you will be eventually editing, why? If you need to add more 	cookies or your application require to only use paths you are better 	off forking this module and start making modifications. &lt;strong&gt;BUT!&lt;/strong&gt; for simple sites, this works like a charm, just remember, if you 	create a complex site this module won’t be of much help.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;PDF&lt;/strong&gt; module, pretty easy to use, 	straightforward API. This module here will help you generate PDF 	from a PDF template or a HTML file. It’s awesome.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Paginate &lt;/strong&gt;module, helps you paginate your 	stuff.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Play! Framework itself is still new, the developers have thought out almost all corners of this brilliant web framework. As the framework matures we should expect lots of API changes, new introductions and features and better virtual host support.&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Common Pitfalls:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="cachegivenulls" id="cachegivenulls"&gt;Why Cache keeps giving me null?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; I suggest you leave your cache implementations in your application to be the last thing. If you&amp;#8217;re developing your application, you should know that every time you save the file and hit reload, what got cached will no longer be there. The memcached connection resets.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="securewontload" id="#securewontload"&gt;I can&amp;#8217;t get secure module on others controller packages&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; If you like to keep things organized like I do and have packages like (controllers.Admin). Be sure to do this:&lt;/p&gt;
&lt;p&gt;import controllers.Secure;&lt;/p&gt;
&lt;p&gt;import controllers.Security;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="modulesdonotload" id="modulesdonotload"&gt;Modules do not load!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;Be sure you are loading the right folder, if you missed how to load the module when you installed it, it goes like this in your application.conf&lt;/p&gt;
&lt;p&gt;(check your play-framework base folder, and check the modules folder to get the folder names)&lt;/p&gt;
&lt;p&gt;module.NAME=${play.path}/modules/module-foldername&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="checkcheck" id="#checkcheck"&gt;Always add checkAuthenticity in your POST&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; What is checkAuthenticity? This method (provide by every class that extends Controller class) helps you keep spammers on a leash, not all of them but most of them, also it helps if someone tries to log in to your application from an extenal site. If you use the #{form} #{/form} tags, the authentication token is added automatically.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Frequently Asked Questions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="book" id="book"&gt;Is there a Play! Framework book?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;Yes, there is! &lt;a href="http://www.lulu.com/product/ebook/introducing-the-play-framework/14413149"&gt;Check this site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="getheaders" id="getheaders"&gt;How do I get browser agent, client IP?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; You can get the request variable in the global scope, it&amp;#8217;s provided by the Controller class. Now to the answer you just do.&lt;/p&gt;
&lt;p&gt;Import play.Logger;&lt;/p&gt;
&lt;p&gt;Logger.info(“My user-agent %s”,request.headers.get(&amp;#8220;user-agent&amp;#8221;).toString());&lt;/p&gt;
&lt;p&gt;Logger.info(“My IP %s”, request.remoteAddress);&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="dropschema" id="dropschema"&gt;I want to re-create my schema(database tables) every time I edit my models?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;Edit your application.conf, search the jpa.ddl and change its value to “create-drop”, end result is&lt;/p&gt;
&lt;p&gt;jpa.ddl=create-drop&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;BE AWARE, IF YOU DO THIS KEEP IN MIND THAT THE DATA WILL BE ERASED&lt;/strong&gt;. I suggest to do this if you are starting a new application and want to get your relations right and design your schema.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="modelsid" id="modelsid"&gt;Why is the id in models already defined? I don&amp;#8217;t want it!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Just extend the Model class and create your own, don&amp;#8217;t add anything else. Then when creating models you can use your custom model class on them and define your own ID.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="cheatplay" id="cheatplay"&gt;Is there any cheat sheet I could use?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Yes, there is, &lt;a href="http://playcheatsheet.appspot.com/show/ArtemMedeu/armed/play-cheatsheets"&gt;check this site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="hostroutes" id="hostroutes"&gt;How to add (virtual) hosts routes?&lt;/a&gt; (e.x &lt;a href="http://host.myapp.com/"&gt;&lt;a href="http://HOST.myapp.com/"&gt;http://HOST.myapp.com/&lt;/a&gt;&lt;/a&gt;)?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;In your routes file, add:&lt;/p&gt;
&lt;p&gt;GET	myhost.application.dev/	ControllerClass.ActionMethod&lt;/p&gt;
&lt;p&gt;GET	myhost.application.dev/pages	ControllerClass.ActionMethod&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="visible" id="visible"&gt;Why does it says method connected() in Secure.Security class is not visible?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Go to your play-framework base folder,  enter “modules/secure/app/controllers/”, edit the Secure.java  file, find the inner class Security and add “public” visibility to it.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="scripting" id="scripting"&gt;Can I do scriptlets (scripting) in templates?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;Yes, in your views, open a html file or tag file and write the following&lt;/p&gt;
&lt;p&gt;%{&lt;/p&gt;
&lt;p&gt;var something = “hello world”;&lt;/p&gt;
&lt;p&gt;obj = new object();&lt;/p&gt;
&lt;p&gt;}%&lt;/p&gt;
&lt;p&gt;the %{ }% helps you to do the modifications you want :)&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="orm" id="orm"&gt;What does Play! use to do database transactions/queries/etc?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; It uses Hibernate ORM, quite complex if you are a beginner, it requires lot of patience, start looking for articles about Hibernate or buy a book. Don&amp;#8217;t bother posting in Play! Mailing list, they do help sometimes, but if it&amp;#8217;s complex.. well there are hibernate related forums for that.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="beforeme" id="beforeme"&gt;Is there a way to run code BEFORE running an action?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Yes, there is also @Finally if you want to log things. At the beginning of your class extending the Controller class. Write this sample:&lt;/p&gt;
&lt;p&gt;@Before&lt;/p&gt;
&lt;p&gt;static void logSomething() {&lt;/p&gt;
&lt;p&gt;play.Logger.info(“My IP %s”, request.remoteAddress);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="crud" id="crud"&gt;Why does CRUD module does not support X thing?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; CRUD module, at its best is a very BASIC management panel. This is not symfony administration panel or django, you should create your own administration panel, will save you a lot of headaches.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="validate" id="validate"&gt;Is there a data validation library?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; &lt;a target="_blank" href="http://www.playframework.org/@api/play/data/validation/package-summary.html"&gt;Check the API&lt;/a&gt; and &lt;a target="_blank" href="http://www.playframework.org/documentation/1.1/validation"&gt;this documentation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="upload" id="upload"&gt;How do I upload a damn file?!&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;Lets say you have this action method:&lt;/p&gt;
&lt;p&gt;public static void upload(File attachment) {&lt;/p&gt;
&lt;p&gt;// that&amp;#8217;s it, manipulate the attachment variable&lt;/p&gt;
&lt;p&gt;// also use &lt;a target="_blank" href="http://www.playframework.org/documentation/api/1.0.1/play/Play.html#getFile%28java.lang.String%29"&gt;Play.getFile()&lt;/a&gt; if you want to place it in an attachment folder&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Be aware of:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="illegalcache" id="illegalcache"&gt;Lots of Illegal shutdown with Cache&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;I still don&amp;#8217;t know why this occurs. In fact I added this like a warning sign.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q:&lt;/strong&gt; &lt;a name="hostdilemma" id="hostdilemma"&gt;Host routes dilemma&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A: &lt;/strong&gt;The host routes, while a very exciting addition, still lacks support in many parts of the framework. It&amp;#8217;s still basic, just use it if you want to use it for assets along with Amazon S3.&lt;/p&gt;
&lt;p&gt;&amp;#8212;&amp;#8212;&amp;#8212;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: &lt;/strong&gt;&lt;a name="duplicatecookies" id="duplicatecookies"&gt;Why Play! keeps duplicating its cookies when I&amp;#8217;m using host routes?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A:&lt;/strong&gt; Play! does not recognize your host route as your own application host route. What I mean is that the cookies Play! generates are not shared across your hosts routes, so it will keep duplicating in each host route a user enters. This might be an advantage in some cases, but if you want to keep the user logged in, well, it might as well become a nightmare, well, just create a neat authentication module.&lt;/p&gt;
&lt;p&gt;I hope you found this post useful, there are still many things to add. My time is currently limited but I will keep doing my changes :) Let me know in the mailing list or here if you want to add more or if I made any mistake :)&lt;/p&gt;</description><link>http://javaplusmoccha.tumblr.com/post/2692592656</link><guid>http://javaplusmoccha.tumblr.com/post/2692592656</guid><pubDate>Mon, 10 Jan 2011 21:25:00 -0500</pubDate><category>play-framework</category><category>java</category><category>web-framework</category></item></channel></rss>
