<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Aquaryus's Blog</title>
	<atom:link href="http://aquaryus.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://aquaryus.wordpress.com</link>
	<description>Day by day thoughts...</description>
	<lastBuildDate>Wed, 25 Jan 2012 12:38:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='aquaryus.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Aquaryus's Blog</title>
		<link>http://aquaryus.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://aquaryus.wordpress.com/osd.xml" title="Aquaryus&#039;s Blog" />
	<atom:link rel='hub' href='http://aquaryus.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Error with h:commandButton and h:form with ManagedBeans on JSF v2.0 &#8211; Simple solutions</title>
		<link>http://aquaryus.wordpress.com/2012/01/25/error-with-hcommandbutton-and-hform-with-managedbeans-on-jsf-v2-0-simple-solutions/</link>
		<comments>http://aquaryus.wordpress.com/2012/01/25/error-with-hcommandbutton-and-hform-with-managedbeans-on-jsf-v2-0-simple-solutions/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 12:36:45 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commandbutton]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf commandButton]]></category>
		<category><![CDATA[validation method]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=373</guid>
		<description><![CDATA[Hi there! Very quick note today If you&#8217;re having issues with your h:commandButton with your ManagedBean refusing to run the action method, don&#8217;t dispair. There is a simple tutorial to fix it: 1) Watch out for your validation method syntax. The validation method in your ManagedBean MUST return a String and take no argument when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=373&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi there! Very quick note today <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you&#8217;re having issues with your h:commandButton with your ManagedBean <strong>refusing to run the action method</strong>, don&#8217;t dispair. There is a <strong>simple</strong> tutorial to fix it:</p>
<p><strong>1) Watch out for your validation method syntax</strong>. The validation method in your ManagedBean MUST return a String and take no argument when using the &#8216;action&#8217; attribute of your h:commandButton. This will be the page where you&#8217;ll end up (if you want,you can also return &#8220;&#8221; and use navigation strategies to redirect the user) .  However, if you&#8217;re using actionListener, you must use ActionEvent as an argument to your validation method.</p>
<p><strong>2) Check if your h:commandButton its nested inside a h:form</strong>. It must be. Also, it&#8217;s better to also use f:view and nest the form inside it.</p>
<p><strong>3) Don&#8217;t go around the web searching, &#8216;oh my god my form action doesn&#8217;t work!!&#8217;.</strong> Most times the error is in the attributes inside the form, not in the method itself. A common one is to forget those &#8216;required=true&#8217; on your h:inputText and simply push the &#8220;submit&#8221; button without filling them. Most times, nothing will happen (especially when you don&#8217;t have error messages) and leave you wondering!</p>
<p>Well that&#8217;s it!! Cumps! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=373&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2012/01/25/error-with-hcommandbutton-and-hform-with-managedbeans-on-jsf-v2-0-simple-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Ajax with JSF v2.0 and Managed Beans without Javascript</title>
		<link>http://aquaryus.wordpress.com/2012/01/24/using-ajax-with-jsf-v2-0-and-managed-beans-without-javascript/</link>
		<comments>http://aquaryus.wordpress.com/2012/01/24/using-ajax-with-jsf-v2-0-and-managed-beans-without-javascript/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 13:18:46 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=367</guid>
		<description><![CDATA[Quick tutorial today! If you&#8217;re experimenting on JSF and wanna check out the features that ajax can provide you but like me, you don&#8217;t like your business code on the client side, then this is for you First, of all, a super important note. Don&#8217;t mix your imports when dealing with ManagedBeans!! Make sure you&#8217;re [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=367&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quick tutorial today!</p>
<p>If you&#8217;re experimenting on JSF and wanna check out the features that ajax can provide you but like me, you don&#8217;t like your business code on the client side, then this is for you <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>First, of all, a super important note. <strong>Don&#8217;t mix your imports when dealing with ManagedBeans!!</strong> Make sure you&#8217;re either using CDI or JSF. For this example, i&#8217;ll be using javax.faces.bean package. Please make sure this is ok. It can give you really weird bugs&#8230;</p>
<p>So, what&#8217;s the idea. Let&#8217;s try and make a simple validator (which can be done in JSF ressorting to other methods but that will do as an example) which checks if a field is a INT and if not, then shows an error message.</p>
<p>We&#8217;ll need a .xhtml for the page and the managedBean.</p>
<p>In your .xhtml put something like this:</p>
<p><pre class="brush: xml;">

&lt;h:form id=myForm&gt;
&lt;h:inputText value=&quot;#{bean.myvalue}&quot; styleClass=&quot;someStyle&quot;&gt;
&lt;f:ajax event=&quot;change&quot; render=&quot;error_sub&quot; listener=&quot;#{bean.validateMyValue}&quot;/&gt;
&lt;/h:inputText&gt;

&lt;h:panelGroup id=&quot;error_sub&quot;&gt;
&lt;h:outputText value=&quot;Incorrect Format for Value!!&quot; styleClass=&quot;someErrorStyle&quot;  rendered=&quot;#{bean.show}&quot; /&gt;
&lt;/h:panelGroup&gt;
&lt;/h:form&gt;

</pre></p>
<p>Two important/cool notes in this html.</p>
<p>First, ajax in JSF will only work if nested in a form.</p>
<p>Second, to make a &#8216;section/tag&#8217; of your page disappear you <strong>cannot</strong> use rendered on that same tag with ajax! Ajax only sees rendered=true tags! So, to do that, apply the ajax to a &#8216;superior&#8217; tag, like i&#8217;m doing with panelGroup. In your validation function however, you can use a boolean like &#8216;show&#8217; which can be used to declare if outputText is to be display or not.</p>
<p>Got it? Ajax invokes validateMyBean which sets show to true or false&#8230; Renders error_sub again which this time, in case of an error, is display or not according to &#8216;show&#8217;. Got it? This is very important.</p>
<p><pre class="brush: java;">

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name=&quot;bean&quot;)
@RequestScoped
public class MyBean {

private String myvalue;
private boolean show;

//Getters and Setters for myvalue!! Don't forget these!!

public boolean validateMyValue(){
try{
show=false;
Integer.parseInt(myvalue);
}
catch(Exception e){
System.out.println(&quot;Error...&quot;);
show=true;
return false;
}
return true;
}
}

</pre></p>
<p>The above bean is used to place the variables, your getters and setters and your validation method.</p>
<p>Simple right? Well&#8230; now it is! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cumps!!</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=367&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2012/01/24/using-ajax-with-jsf-v2-0-and-managed-beans-without-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Implement authorization rules on pages with JSF v2.0 + PhaseListener</title>
		<link>http://aquaryus.wordpress.com/2012/01/20/implement-authorization-rules-on-pages-with-jsf-v2-0-phaselistener/</link>
		<comments>http://aquaryus.wordpress.com/2012/01/20/implement-authorization-rules-on-pages-with-jsf-v2-0-phaselistener/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 14:00:14 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=362</guid>
		<description><![CDATA[Hi there! If you&#8217;re developing a website with JSF v2 and are having issues with page jumping/direct access when credentials should be applied first, then this post is for you. Normally, when applying such mechanisms one resorts to filters with servlet association. However, with JSF this can be tricky because (in my experience at least) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=362&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p>If you&#8217;re developing a website with JSF v2 and are having issues with page jumping/direct access when credentials should be applied first, then this post is for you. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Normally, when applying such mechanisms one resorts to filters with servlet association. However, with JSF this can be tricky because (in my experience at least) the filter is initialized before your managed beans and FacesContext are. This is an issue for most examples out there, because the filter will give &#8216;null&#8217; when accessing the sessionScoped bean (or in any other managedBean) where your credentials are supposed to be checked. So, how to achieve this? Using a PhaseListener.</p>
<p>A PhaseListener is a something that you can apply whenever a &#8216;request&#8217; happens. So before the actual call to your ManagedBean happens, a routine can be called in your PhaseListener. With it, you can limit right there what will happen. So, first here is your listener:</p>
<p><pre class="brush: java;">

public class AuthorizationListener implements PhaseListener {

public void afterPhase(PhaseEvent event) {

FacesContext facesContext = event.getFacesContext();
String currentPage = facesContext.getViewRoot().getViewId();

boolean isLoginPage = currentPage.lastIndexOf(&quot;index.xhtml&quot;);
HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(true);
Object currentUser = session.getAttribute(&quot;username&quot;);

if (!isLoginPage &amp;&amp; (currentUser == null || currentUser == &quot;&quot;)) {
NavigationHandler nh = facesContext.getApplication().getNavigationHandler();
nh.handleNavigation(facesContext, null, &quot;loginPage&quot;);
}
}

public void beforePhase(PhaseEvent event) {
}

public PhaseId getPhaseId() {
return PhaseId.RESTORE_VIEW;
}
}

</pre></p>
<p>What we are describing here is that whenever a call is made for a page, then first, the attribute &#8216;username&#8217; must be checked. For this however we also need two more things. First, declare your faces-config.xml like so:</p>
<p><pre class="brush: xml;">

&lt;faces-config version=&quot;2.0&quot;
xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd&quot;&gt;
&lt;navigation-rule&gt;
&lt;from-view-id&gt;/*&lt;/from-view-id&gt;
&lt;navigation-case&gt;
&lt;from-outcome&gt;loginPage&lt;/from-outcome&gt;
&lt;to-view-id&gt;index.xhtml&lt;/to-view-id&gt;
&lt;/navigation-case&gt;
&lt;/navigation-rule&gt;

&lt;lifecycle&gt;
&lt;phase-listener&gt;org.views.security.AuthorizationListener&lt;/phase-listener&gt;
&lt;/lifecycle&gt;

&lt;/faces-config&gt;

</pre></p>
<p>And your login method (which will be in your ManagedBean):</p>
<p><pre class="brush: java;">

public void login(){

boolean result = businessBean.checkCredentiais(username, password);

if(result){
try {
errorMessageLogin=&quot;&quot;;
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(&quot;username&quot;, username);
FacesContext.getCurrentInstance().getExternalContext().redirect(&quot;main.xhtml&quot;);

} catch (IOException ex) {
Logger.getLogger(UserCredentiaisView.class.getName()).log(Level.SEVERE, null, ex);
}
}
else{
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(&quot;username&quot;, &quot;&quot;);
errorMessageLogin = &quot;Credentials not supported.&quot;;
}
}

</pre></p>
<p>And that&#8217;s it! Just don&#8217;t forget to clear your credentials in your logout method!! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Stay cool! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/362/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/362/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/362/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=362&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2012/01/20/implement-authorization-rules-on-pages-with-jsf-v2-0-phaselistener/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Step up your password protection in Java with SHA1 encryption</title>
		<link>http://aquaryus.wordpress.com/2012/01/19/step-up-your-password-protection-in-java-with-sha1-encryption/</link>
		<comments>http://aquaryus.wordpress.com/2012/01/19/step-up-your-password-protection-in-java-with-sha1-encryption/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 19:07:41 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=358</guid>
		<description><![CDATA[Hi there! If you need to store random passwords on your database and want to encrypt them for more safety, good for you! Here are some easy steps to help you on the way. First a Sha1Convertion Class: Second, a random generator for your passwords: Finally, your main (this is for 20 passwords): And that&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=358&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi there!</p>
<p>If you need to store random passwords on your database and want to encrypt them for more safety, good for you! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Here are some easy steps to help you on the way. First a Sha1Convertion Class:</p>
<p><pre class="brush: java;">

public class Sha1Convertion {

public Sha1Convertion(){
}

public String makeSHA1Hash(String input) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance(&quot;SHA1&quot;);
md.reset();
byte[] buffer = input.getBytes();
md.update(buffer);
byte[] digest = md.digest();

String hexStr = &quot;&quot;;
for (int i = 0; i &lt; digest.length; i++) {
hexStr +=  Integer.toString( ( digest[i] &amp; 0xff ) + 0x100, 16).substring( 1 );
}
return hexStr;
}
}

</pre></p>
<p>Second, a random generator for your passwords:</p>
<p><pre class="brush: java;">

public class PassPhrase {
/** Length for password */
public static final int MIN_LENGTH = 10;

/** The random number generator. */
protected static java.util.Random r = new java.util.Random();

/*
* Set of characters. This is limited to numbers and letters for error issues.
*/
protected static char[] goodChar = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'2', '3', '4', '5', '6', '7', '8', '9', };

/* Generate a Password object with a random password. */
public static String getNext() {
StringBuffer sb = new StringBuffer();
for (int i = 0; i &lt; MIN_LENGTH; i++) {
sb.append(goodChar[r.nextInt(goodChar.length)]);
}
return sb.toString();
}

}

</pre></p>
<p>Finally, your main (this is for 20 passwords):</p>
<p><pre class="brush: java;">

Sha1Convertion shc = new Sha1Convertion();

for (int i = 0; i &lt; 20; i++) {
String pass = PassPhrase.getNext();
System.out.println(&quot;Current - &quot; + pass);
String result = shc.makeSHA1Hash(pass);
System.out.println(&quot;SHA1 - &quot; + result);
}

</pre></p>
<p>And that&#8217;s it!! Stay cool! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/358/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/358/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=358&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2012/01/19/step-up-your-password-protection-in-java-with-sha1-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable Quicktime Streaming Server &#8211; MacOsX Leopard</title>
		<link>http://aquaryus.wordpress.com/2011/10/14/disable-quicktime-streaming-server-macosx-leopard/</link>
		<comments>http://aquaryus.wordpress.com/2011/10/14/disable-quicktime-streaming-server-macosx-leopard/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 15:15:04 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=355</guid>
		<description><![CDATA[Quick note today! If you, like me, want to get rid of that pesky streaming server that you installed a long time ago for a now forgotten reason, here&#8217;s a quick tip 1) Go to a Finder window. 2) On the tool bar, select &#8216;Go to&#8216; and input the following path &#8220;/etc/&#8220; 3) Find the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=355&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quick note today!</p>
<p>If you, like me, want to get rid of that pesky streaming server that you installed a long time ago for a now forgotten reason, here&#8217;s a quick tip <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>1) Go to a Finder window.</p>
<p>2) On the tool bar, select &#8216;<strong>Go to</strong>&#8216; and input the following path &#8220;<strong>/etc/</strong>&#8220;</p>
<p>3) Find the hostconfig file in there. Open it with an editor (any text editor).</p>
<p>4) Search for <em>QTSSWEBADMIN</em>, <em>QTSSRUNSERVER</em> and <em>QTSSERVER</em>. Put them all with -<strong>NO</strong>-.</p>
<p>5) Save the file. Restart.</p>
<p>6) Check <em>127.0.0.1:1220</em> in your browser to confirm or place a &#8220;<em>ps aux</em>&#8221; in your terminal and see if Quick Streaming Server will be there&#8230; I know it won&#8217;t <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cumps!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/355/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/355/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/355/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=355&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/10/14/disable-quicktime-streaming-server-macosx-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Eps figure issues on LaTex &#8211; TexShop</title>
		<link>http://aquaryus.wordpress.com/2011/10/12/eps-figure-issues-on-latex-texshop/</link>
		<comments>http://aquaryus.wordpress.com/2011/10/12/eps-figure-issues-on-latex-texshop/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 16:56:06 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=350</guid>
		<description><![CDATA[Simple note. If you&#8217;re trying to place .eps figures into your .tex but errors continuously come up and you don&#8217;t want to use command line apps to resolve the issue, here&#8217;s a quick tip: Simply import the epstopdf package in your .tex file Cumps!!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=350&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Simple note.</p>
<p>If you&#8217;re trying to place .eps figures into your .tex but errors continuously come up and you don&#8217;t want to use command line apps to resolve the issue, here&#8217;s a quick tip:</p>
<p>Simply import the <strong>epstopdf</strong> package in your .tex file <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cumps!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/350/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=350&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/10/12/eps-figure-issues-on-latex-texshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>J2EE &#8211; Adding multiple databases (or schemas) to your EJB3 project on JBoss</title>
		<link>http://aquaryus.wordpress.com/2011/04/15/j2ee-adding-multiple-databases-or-schemas-to-your-ejb3-project-on-jboss/</link>
		<comments>http://aquaryus.wordpress.com/2011/04/15/j2ee-adding-multiple-databases-or-schemas-to-your-ejb3-project-on-jboss/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 15:36:53 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=276</guid>
		<description><![CDATA[If you&#8217;re programming with J2EE and reach a place where you need to use more than one database, don&#8217;t dispair, it&#8217;s possible! So, what you need to do. First, define your persistence.xml. Each database will have an entry. Here&#8217;s an example using Hibernate: This example shows the name of the persistence unit (DatabasePU1) which we&#8217;ll [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=276&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re programming with J2EE and reach a place where you need to use more than one database, don&#8217;t dispair, it&#8217;s possible! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>So, what you need to do.</p>
<p>First, define your persistence.xml. Each database will have an entry. Here&#8217;s an example using Hibernate:</p>
<p><pre class="brush: xml;">
    &lt;persistence-unit name=&quot;DatabasePU1&quot; transaction-type=&quot;JTA&quot;&gt;
    &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
    &lt;jta-data-source&gt;java:/Datasource1&lt;/jta-data-source&gt;
    &lt;class&gt;entities.class1&lt;/class&gt;
    &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
    &lt;properties/&gt;
  &lt;/persistence-unit&gt;

 </pre></p>
<p>This example shows the name of the persistence unit (DatabasePU1) which we&#8217;ll need to distinguish from the others. The jta-data-source is the JNDI name you gave to the descriptor (i&#8217;ll explain this next). Finally, the classes which depend on this specific database.</p>
<p>Each database on the persistence.xml need to look like the above, so for other databases just follow the pattern. (Note: there&#8217;s only one persistence.xml on each project with one to multiple entries)</p>
<p>The jta-data-source corresponds to another file (jboss-ds.xml) that you must add to the deploy folder on your JbossAS (if it isn&#8217;t there).<br />
It&#8217;s responsible for connecting to the databases.</p>
<p>Here&#8217;s an example of a datasource based on MySql:</p>
<p><pre class="brush: xml;">
    &lt;local-tx-datasource&gt;
    &lt;jndi-name&gt;Datasource1&lt;/jndi-name&gt;
    &lt;connection-url&gt;jdbc:mysql://localhost:3306/yourdatabasename&lt;/connection-url&gt;
    &lt;driver-class&gt;com.mysql.jdbc.Driver&lt;/driver-class&gt;
    &lt;user-name&gt;username&lt;/user-name&gt;
    &lt;password&gt;******&lt;/password&gt;
    &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;
    &lt;max-pool-size&gt;20&lt;/max-pool-size&gt;
    &lt;idle-timeout-minutes&gt;0&lt;/idle-timeout-minutes&gt;
  &lt;/local-tx-datasource&gt;
</pre></p>
<p>If you&#8217;re using a different database, switch the connection entry and the driver. (just google and you&#8217;ll find the ones required for your specific case)</p>
<p>Once again, you&#8217;ll have multiple entries if you need multiple databases (just like the pattern so nothing new). Just remember, one database, one datasource.</p>
<p>Now, the bases are set. All that remains is using it!</p>
<p>Imagine you have two databases set. DatabasePU1 and DatabasePU2.</p>
<p>When you&#8217;re setting your EntityManager annotation, depending on the classes defined on the persistence.xml, add the unitName according to which database the class belongs to.</p>
<p>Exemplifying: Class1 belongs to DatabasePU1.<br />
So when adding an EntityManager to use it, do it like this:</p>
<p><pre class="brush: java;">
@EntityManager(unitName=&quot;DatabasePU1&quot;)
EntityManager em;
</pre></p>
<p>Nothing more to it really so enjoy! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>P.s- If for some small percentage you&#8217;re gonna use multiple databases from the same machine (which means multiple schemas) and are getting some odd errors based on GenericJDBC Exceptions try adding to the JPA beans the following annotation:</p>
<p><pre class="brush: java;">
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=276&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/04/15/j2ee-adding-multiple-databases-or-schemas-to-your-ejb3-project-on-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Create an error popup window on Java Swing &#8211; JOptionPane</title>
		<link>http://aquaryus.wordpress.com/2011/04/12/create-an-error-popup-windows-on-java-swing/</link>
		<comments>http://aquaryus.wordpress.com/2011/04/12/create-an-error-popup-windows-on-java-swing/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 08:50:42 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=343</guid>
		<description><![CDATA[Hi! Quick reminder for me today. To create a popup window in Swing with an error message for instances when a form value entry is incorrect, use the following code: JOptionPane.showMessageDialog(this,&#8221;Your error message&#8230;&#8221;, &#8220;Your error title&#8221;, JOptionPane.ERROR_MESSAGE); This may be very usefull inside a try catch!! However this type of windows can be used for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=343&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Quick reminder for me today. To create a popup window in Swing with an error message for instances when a form value entry is incorrect, use the following code:</p>
<p>JOptionPane.showMessageDialog(this,&#8221;Your error message&#8230;&#8221;, &#8220;Your error title&#8221;, JOptionPane.ERROR_MESSAGE);</p>
<p>This may be very usefull inside a try catch!! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
However this type of windows can be used for collecting a value (a login p.e.)&#8230;showing a slider bar&#8230;among others!! Just change the method &#8216;showMessageDialog&#8217; to the appropriate ones!!<br />
Cumps!! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/343/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/343/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=343&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/04/12/create-an-error-popup-windows-on-java-swing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>Tutorial &#8211; Create a quick JEE web service with Mysql and Netbeans &#8211; GlassFish</title>
		<link>http://aquaryus.wordpress.com/2011/04/11/tutorial-create-a-quick-jee-web-service-with-mysql-and-netbeans-glassfish/</link>
		<comments>http://aquaryus.wordpress.com/2011/04/11/tutorial-create-a-quick-jee-web-service-with-mysql-and-netbeans-glassfish/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 15:39:32 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=341</guid>
		<description><![CDATA[Hi!! So how to create a simple web service with a backend without wasting too much effort? Simple. Here are the steps: 1) Install Netbeans (at this time&#8230;6.9.1) and MySql (with Workbench) 2) Configure MySql. Create a user account for this test. 3) Create your ER-diagram in MySql workbench. Define the tables as MyISAM not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=341&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi!!</p>
<p>So how to create a simple web service with a backend without wasting too much effort?<br />
Simple. Here are the steps:</p>
<p>1) Install Netbeans (at this time&#8230;6.9.1) and MySql (with Workbench)<br />
2) Configure MySql. Create a user account for this test.<br />
3) Create your ER-diagram in MySql workbench. Define the tables as MyISAM not InnoDB. Synch it to your db motor.<br />
4) Open Netbeans &gt; New Project &gt; Create a EJB Module<br />
5) Configure your persistance.xml (the database settings)<br />
6) Create your entities first by &#8220;Creating entity beans from database&#8221;.<br />
7) Then create your Persistance layer (this helps to manage connections with the database) by &#8220;creating session beans from entities&#8221;.<br />
8 ) Now create a package &#8216;business&#8217;<br />
9) Create all your session beans here. Make them local for this purpose.<br />
10) When referencing &#8216;facade&#8217; beans, use the @EJB annotation (place the classes you need as variables)<br />
11) Create the web service layer by creating a package &#8216;webservice&#8217; and then generating the web service based on your &#8216;business&#8217; package (it will map all your operations as services).<br />
12) Start Glassfish and deploy your new app!! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cumps!!<br />
PS &#8211; To test, you may create a client using the Netbeans generator or simply go to GlassFish&#8217;s admin page and use the Tester there <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/341/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=341&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/04/11/tutorial-create-a-quick-jee-web-service-with-mysql-and-netbeans-glassfish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
		<item>
		<title>GlassFish and JEE &#8211; Common Error &#8211; Caused by: javax.naming.NamingException: Lookup failed for &#8230;</title>
		<link>http://aquaryus.wordpress.com/2011/04/11/glassfish-and-jee-common-error-caused-by-javax-naming-namingexception-lookup-failed-for/</link>
		<comments>http://aquaryus.wordpress.com/2011/04/11/glassfish-and-jee-common-error-caused-by-javax-naming-namingexception-lookup-failed-for/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 15:22:33 +0000</pubDate>
		<dc:creator>aquaryus</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aquaryus.wordpress.com/?p=339</guid>
		<description><![CDATA[Hi there! Just a quick note. Sometimes, when programming in JEE we come across the always popular &#8220;Caused by: javax.naming.NamingException: Lookup failed for&#8221; error. While sometimes this error is very hard to resolve, other times it is actually very simple. A common mistake that leads to this error comes from &#8220;injections&#8221; in your JEE code. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=339&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi there! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Just a quick note. Sometimes, when programming in JEE we come across the always popular &#8220;Caused by: javax.naming.NamingException: Lookup failed for&#8221; error. </p>
<p>While sometimes this error is very hard to resolve, other times it is actually very simple. A common mistake that leads to this error comes from &#8220;injections&#8221; in your JEE code. In other words, we simply do not indicate the right class to inject due to simply forgetting that in JEE, injections are done through the &#8220;local&#8221; and &#8220;remote&#8221; interfaces!!</p>
<p>So check your imports before you get this error again!! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Cumps!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aquaryus.wordpress.com/339/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aquaryus.wordpress.com/339/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aquaryus.wordpress.com/339/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aquaryus.wordpress.com&amp;blog=5451728&amp;post=339&amp;subd=aquaryus&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aquaryus.wordpress.com/2011/04/11/glassfish-and-jee-common-error-caused-by-javax-naming-namingexception-lookup-failed-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c5e2be2385e147f582536919e7eaa4b8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aquaryus</media:title>
		</media:content>
	</item>
	</channel>
</rss>
