<?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/"
	>

<channel>
	<title>The leo-sa blog</title>
	<atom:link href="http://www.leo-sa.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.leo-sa.com</link>
	<description>Computers, technology and black holes.</description>
	<lastBuildDate>Sat, 13 Mar 2010 05:21:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How To Install Python + Django + Aptana Studio on Windows</title>
		<link>http://www.leo-sa.com/?p=72</link>
		<comments>http://www.leo-sa.com/?p=72#comments</comments>
		<pubDate>Fri, 05 Feb 2010 22:21:22 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=72</guid>
		<description><![CDATA[Installing Python and Django in windows may be a challenge that is a little bit more complicated than running several installers. In this article, I will explain how to get Python, Django, and Aptana Studio running smoothly on windows.

1. Install Python
- Go to http://www.python.org/download/ and download the Python 2.6.4 Windows Installer
NOTE: Make sure its 2.6! [...]]]></description>
			<content:encoded><![CDATA[<p>Installing Python and Django in windows may be a challenge that is a little bit more complicated than running several installers. In this article, I will explain how to get Python, Django, and Aptana Studio running smoothly on windows.</p>
<p><span id="more-72"></span></p>
<h3>1. Install Python</h3>
<p>- Go to http://www.python.org/download/ and download the Python 2.6.4 Windows Installer</p>
<p>NOTE: Make sure its 2.6! 3.1 Doesn&#8217;t work well with django yet.</p>
<p>- Execute and install what you&#8217;ve just downloaded with the default options.</p>
<p>Now for these different operational systems:</p>
<p>For Windows XP:</p>
<p>1. Start -&gt; Control Panel -&gt; System -&gt; Advanced<br />
2. Click on Environment Variables, under System Variables, find PATH, and click on it.<br />
3. In the Edit windows, modify PATH by adding &#8220;;C:\Python26;C:\Python26\Scripts&#8221;. Make sure you ADD it. DO NOT ERASE ANYTHING!. Also make sure you have a semicolon (;) before what you write.</p>
<p>For Windows Vista:</p>
<p>1. Right click “My Computer” icon<br />
2. Choose “Properties” from context menu<br />
3. Click “Advanced” tab (“Advanced system settings” link in Vista)<br />
4. In the Edit windows, modify PATH by adding adding &#8220;;C:\Python26;C:\Python26\Scripts&#8221;. Make sure you ADD it. DO NOT ERASE ANYTHING!. Also make sure you have a semicolon (;) before what you write.</p>
<h3>2. Make sure Python runs .py files correctly</h3>
<p>Some systems refuse to add the .py file association correctly. Just in case, execute the following steps to make Python run .py files:</p>
<p>- Open Windows Explorer</p>
<p>Windows XP:<br />
- Go to View &gt; Folder Options &gt; File Types tab</p>
<p>Windows Vista:<br />
- Download http://sourceforge.net/projects/types/ and use this program to edit the .py file extension</p>
<p>- Look for the PY extension, select it, and click &#8220;Advanced&#8221;<br />
- Select the &#8220;open&#8221; action, and click &#8220;Edit&#8221;<br />
- Make sure you have</p>
<p>&#8220;C:\Python26\python.exe&#8221; &#8220;%1&#8243; %*</p>
<p>in the &#8220;Application used to perform the action&#8221; box</p>
<p>- Click OK on everything</p>
<h3>3. Installing Django</h3>
<p>- Go to http://www.djangoproject.com/download/ and download the version that best suits you. Version 1.1.1 works fine for me.</p>
<p>- Extract the files to a folder. WinZip will do the job. Please REMEMBER THE FOLDER WHERE YOU EXTRACTED DJANGO.</p>
<p>- Open a command prompt (Start &gt; Run &gt; Type in &#8220;cmd&#8221; and press OK)</p>
<p>- In the black window that is going to show up, type in cd &#8220;[directory_of_django]&#8220;. For example:</p>
<p>cd &#8220;C:\Documents and Settings\lsa\My Documents\Dev\libs\python\Django-1.1.1&#8243;</p>
<p>- type</p>
<p>setup.py install</p>
<h3>4. Make sure you have a java JRE installed</h3>
<p>- Go to the command prompt again (Start &gt; Run &gt; cmd) and type in</p>
<p>java -version</p>
<p>- If the version is anything above 1.6, you&#8217;re good. If not, go to www.java.com and download it.</p>
<h3>5. Installing aptana studio</h3>
<p>I really like aptana studio because it is a version of eclipse that already comes with HTML and CSS editors, and installing PyDev in it is really easy.<br />
However, those instructions can be easily adapted to PyDev as well.</p>
<p>- Go to http://www.aptana.org/studio/download and download the standalone full installer version.</p>
<p>- Install aptana and fire it up.</p>
<p>- Click on the big plug-ins tab. Scroll all the way down where you will see &#8220;Aptana PyDev&#8221;. Click on &#8220;Get it&#8221;</p>
<p>- Select PyDev on the screen that opens, click next, accept the license, and click finish.</p>
<p>- After Aptana restarts, go to Window &gt; Preferences &gt; PyDev &gt; Interpreter &#8211; Python and click &#8220;Auto-Config&#8221;</p>
<p>- Click OK on everything else</p>
<h3>6. Installing MySQL for Python</h3>
<p>If you are going to use django with MySQL, you will probably need to perform those steps:</p>
<p>- Go to http://www.codegood.com/downloads and download</p>
<p>MySQL-python-1.2.2.win32-py2.6.exe, if you have a 32 bit OS or</p>
<p>MySQL-python-1.2.2.win-amd64-py2.6.exe, if you have a 64 bit OS</p>
<p>In doubt, download the first one.</p>
<p>- Install it.</p>
<h3>7. Testing the installation</h3>
<p>Now we are ready for testing.</p>
<p>- Open the command prompt, and cd to any directory you like. I strongly recommend to go to an empty directory.</p>
<p>- type</p>
<p>django-admin.py startproject mysite<br />
cd mysite<br />
manage.py runserver</p>
<p>- Wait until you get an output that tells you the server is running.<br />
- Fire up your web browser and go to http://localhost:8000<br />
- If you get an &#8220;It Worked!&#8221; message, it means everything is working as it supposed to. Congratulations!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=72</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>at76 linux driver for kernel 2.6.31 and (hopefully) up</title>
		<link>http://www.leo-sa.com/?p=70</link>
		<comments>http://www.leo-sa.com/?p=70#comments</comments>
		<pubDate>Sun, 15 Nov 2009 06:38:47 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=70</guid>
		<description><![CDATA[So I was bored on a saturday evening and decided to try to get my old linksys external USB adapter to work with the new Ubuntu Karmic. It&#8217;s drivers wouldn&#8217;t compile in the new kernel because they altered the net_device struct in the header files. After fixing it, here are the steps to get it [...]]]></description>
			<content:encoded><![CDATA[<p>So I was bored on a saturday evening and decided to try to get my old linksys external USB adapter to work with the new Ubuntu Karmic. It&#8217;s drivers wouldn&#8217;t compile in the new kernel because they altered the net_device struct in the header files. After fixing it, here are the steps to get it compiled and installed in ubuntu karmic:</p>
<ol>
<li>Get the original drivers from http://at76c503a.berlios.de/</li>
<li>Replace the at76_usb.c with <a href="http://www.leo-sa.com/at76_usb.c">this</a></li>
<li>$ make</li>
<li>$ sudo make install</li>
<li>reboot</li>
</ol>
<p>That should do the trick!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=70</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing JavaFX with NetBeans on linux</title>
		<link>http://www.leo-sa.com/?p=59</link>
		<comments>http://www.leo-sa.com/?p=59#comments</comments>
		<pubDate>Tue, 03 Feb 2009 21:00:12 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[javafx]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=59</guid>
		<description><![CDATA[Here is a quick short tutorial on how to setup NetBeans + JavaFX 1.0 to run under linux for those that do not want to wait on sun releasing a penguin version of their SDK:

(special thanks to Weiqui Gao for the wonderful instructions) 

Download the JavaFX SDK tar gz for Linux (unofficial) here. Unpack it [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick short tutorial on how to setup NetBeans + JavaFX 1.0 to run under linux for those that do not want to wait on sun releasing a penguin version of their SDK:</p>
<p><span id="more-59"></span></p>
<p><em>(special thanks to Weiqui Gao for the wonderful <a href="http://www.weiqigao.com/blog/2008/12/11/javafx_1_0_on_linux_netbeans_plugin.html">instructions</a>) </em></p>
<ol>
<li>Download the JavaFX SDK tar gz for Linux (unofficial) <a href="http://www.leo-sa.com/javafx-sdk1.0-linux-unnoficial.tar.gz">here</a>. Unpack it on a directory of your choice.</li>
<li>If you don&#8217;t have netbeans 6.5, download NetBeans 6.5 for linux <a href="http://www.netbeans.org/downloads/index.html">here</a></li>
<li>Install and run NetBeans</li>
<li>Go to Tools &gt; Plugins -&gt; Downloaded tab and click on Add plugins&#8230;</li>
<li>Browse to the folder where you unpacked the JavaFX SDK and select the folder &#8220;netbeans_plugin&#8221;. Select all the files there and click &#8220;ok&#8221;</li>
<li>Click &#8220;install&#8221;, accept everything and restart netbeans when prompted.</li>
<li>Execute the install.sh script on the JavaFX SDK folder. <code>Type in your netbeans 6.5 path when asked.</code></li>
</ol>
<p>Thats it!</p>
<p>Those instructions were not tested in all possible systems and circunstances. If you have any problems, please drop in a comment and I will be glad to help you.</p>
<p>I&#8217;m also accepting mirrors for the first file, if someone would like to do some charity <img src='http://www.leo-sa.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=59</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2008 error HRESULT -2147023293</title>
		<link>http://www.leo-sa.com/?p=51</link>
		<comments>http://www.leo-sa.com/?p=51#comments</comments>
		<pubDate>Sun, 11 Jan 2009 08:11:56 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=51</guid>
		<description><![CDATA[This is a tip for users that are trying to install Visual Studio 2008 but keep getting the HRESULT -2147023293 error: try uninstalling Microsoft Office.
If that doesnt work, you can check the installation log at C:\Documents and Settings\&#60;youruser&#62;\Local Settings\Temp\SetupExe(xxx) file to see what went wrong.
Thanks to Michael Hanes for the wonderful tip! (http://blog.mediawhole.com/2008/07/installing-visual-studio-2008.html)
]]></description>
			<content:encoded><![CDATA[<p>This is a tip for users that are trying to install Visual Studio 2008 but keep getting the HRESULT -2147023293 error: try uninstalling Microsoft Office.</p>
<p>If that doesnt work, you can check the installation log at C:\Documents and Settings\&lt;youruser&gt;\Local Settings\Temp\SetupExe(xxx) file to see what went wrong.</p>
<p>Thanks to Michael Hanes for the wonderful tip! (<a href="http://blog.mediawhole.com/2008/07/installing-visual-studio-2008.html">http://blog.mediawhole.com/2008/07/installing-visual-studio-2008.html</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>10 (real) reasons to use ubuntu linux</title>
		<link>http://www.leo-sa.com/?p=21</link>
		<comments>http://www.leo-sa.com/?p=21#comments</comments>
		<pubDate>Thu, 16 Oct 2008 21:54:04 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[top 10]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=21</guid>
		<description><![CDATA[Recently, a friend of mine asked me why I used linux. Being a linux user for more than 5 years, I have a lot of reasons on why to choose linux over windows, but nothing came to my mind at the time. I just knew I like it a lot better than windows. To settle [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, a friend of mine asked me why I used linux. Being a linux user for more than 5 years, I have a lot of reasons on why to choose linux over windows, but nothing came to my mind at the time. I just knew I like it a lot better than windows. To settle things up, and have a more objective answer next time, I put some thought to it and came with this list.</p>
<p><span id="more-21"></span></p>
<p>In this post, I will evaluate all the reasons regarding the current distribution I use, which is Ubuntu. However, by no means I say that <em>everyone </em>should use linux. You may use it as long as it fits your needs, and i&#8217;m aware that many people cannot live without applications that were developed only for windows.</p>
<p><strong>10. Package management system</strong></p>
<p>In windows, one have to dig around the internet trying to find applications to install, and pray that they won&#8217;t come full of viruses. In linux, there is a wonderful thing called packages, and a neat little program called Synaptic where it is possible to just type whatever application you want and it will automatically download and install, all of that without any virus and 100% free.</p>
<p><strong>9. Graphical interface</strong></p>
<p>Yes, with vista, windows can now do a lot of stuff linux can. But one would have to install a ton of additional software. I got so addicted to the exposé, multiple desktops, and being able to make a window translucent that I miss these features a lot when I go back to windows. Also, the application menu of gnome is terrific when new installed applications automatically appear under the right category, making it easier to find the desired program.</p>
<p>The top bar is also a plus. Right now, I have a in-bar weather and CPU usage applet that come in handy. Although you can put them on the desktop on windows, I&#8217;m not sure you can put them on the bar without any external program.</p>
<p><strong>8. Hardware Detection</strong></p>
<p>This is one of the best features on linux, and can also be the worse. After installation is done, or wheter you plug in a new hardware, everything is detected and installed automatically. No hunt for drivers is needed. I just installed Ubuntu on a friend&#8217;s laptop and we didn&#8217;t need any extra configuration to get things working. Everything worked out of the box.</p>
<p>However, I have to admit that when something is not detected right away, it is a pain to set up properly. Most of the times, one would have to dig through several forums in order to figure out how to install a particular piece of hardware.</p>
<p><strong>7. Process control</strong></p>
<p>Linux is stable by nature, but sometimes things may go out of control. When that happens, a little tool called &#8220;xkill&#8221; comes in handy by literally killing the troublesome application instantly without messing up with system stability. Also, the &#8220;kill&#8221; command does the same thing for every process in the system. Unlike windows, you don&#8217;t have to wait for the process to shut itself down, and therefore waste a lot of time. The process is killed instantly.</p>
<p>Another tool I miss in windows is the sysrq+s sysrq+u sysrq+b key combination. No matter where you are on linux, if you press that sequence, it will automatically unmount partitions and reboot the system. I have lost count on how many times I had to press the reset button on windows in order to get the machine rebooted because it wasn&#8217;t responding to any of my commands.</p>
<p><strong>6. The terminal</strong></p>
<p>Not many regular users would use it, but the terminal is a powerfull tool for power users. You can do anything you want with it, and most of the linux commands can be piped together to form more complex statements. I have lots of custom scripts that I use regularly to automate boring tasks such as renaming pictures, mounting encrypted filesystems, and even checking out code from a repository and deploy it automatically to a server.</p>
<p><strong>5. Low system overhead</strong></p>
<p>Vista needs at least 1GB of RAM in order to function properly. I used to run Ubuntu with full graphical interface with 512mb without a problem. The footprint of ubuntu over vista is considerably lower, giving more room to load more applications at one time. This is particularly useful when working with older hardware or thin clients.</p>
<p><strong>4. System security</strong></p>
<p>Vista introduced a series of annoying boxes that are prompted whenever you are about to make any system changes. I found that particularly annoying, and love the fact that linux only asks for the root password for very specific system settings.</p>
<p>Due to the open source nature of linux and its software community, security bugs are identified and fixed a lot quicker than in propietary software, making the system considerably more secure.</p>
<p><strong>3. No viruses or trojan horses</strong></p>
<p>The only real menace I know for linux are the rootkits, and even those need to exploit some bug. However, chances are that the particular bug in question was already fixed by security updates.</p>
<p>Although not really necessary if you aren&#8217;t running a server, a firewall is a plus in terms of increasing the security of your system. Nothing I know in windows can beat a well configured iptables, and few things can be more annoying than those security pop ups that appear in vista when some program wants to access the internet.</p>
<p>Finally, there is no need to waste your resources having an antivirus running all the time. Linux was built to be safe, so you can be sure that you won&#8217;t need any additional software constantly scanning for threats.</p>
<p><strong>2. Fast release time</strong></p>
<p>Thats particularly true with ubuntu: there is a new version comming around every 6 months with new and improved features. This beats by far the release cycle of windows, that can be as long as 2 or 3 years. Another good point is that your oppinion matters. If you find something wrong with your system, you can file a bug on launchpad, and that will go directly to the developers of the system.</p>
<p><strong>1. It&#8217;s free</strong></p>
<p>This is a cliché, but it doesn&#8217;t mean it is not a good thing. I&#8217;m a cheap person, and I really like the fact that I can upgrade all my computers every six months to a state-of-art operational system without spending a penny out of my pocket.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=21</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Getting Started with Java Web Development</title>
		<link>http://www.leo-sa.com/?p=10</link>
		<comments>http://www.leo-sa.com/?p=10#comments</comments>
		<pubDate>Sat, 27 Sep 2008 18:56:04 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[struts]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=10</guid>
		<description><![CDATA[If you come from another web language such as PHP and you are willing to learn java as a web development language, you may encounter some difficulties. The ammount of different java frameworks and techniques for java web development is overwhelming. In order to put order into the mess, here are some steps that every [...]]]></description>
			<content:encoded><![CDATA[<p>If you come from another web language such as PHP and you are willing to learn java as a web development language, you may encounter some difficulties. The ammount of different java frameworks and techniques for java web development is overwhelming. In order to put order into the mess, here are some steps that every beginner should do in order to excel with java on the web.</p>
<p><span id="more-10"></span></p>
<p><strong>1. Know what an application server is<br />
</strong></p>
<p>Differently than PHP and other scripting languages, Java code is compiled into bytecode and <em>deployed </em>to an application server. In other words, you will create your code, compile it, put everything into a compressed file, called a WAR file, and send it to the server.</p>
<p>The deployment keyword may be new for PHP developers.</p>
<p>Therefore, most of the time, you won&#8217;t have a <em>htdocs </em>folder where you can just put your code and it will run, like you have on Apache http server. Instead, you may have a webapp folder where you can throw in the WAR file, or you may have to use a web interface to upload your WAR file to the server. It will all depend on which application server you will use.</p>
<p>Here are some of the most popular application servers:</p>
<ul>
<li>Apache Tomcat: <a href="http://tomcat.apache.org/">http://tomcat.apache.org/</a></li>
<li>JBoss: <a href="http://www.jboss.org/">http://www.jboss.org/</a></li>
<li>Glassfish: <a href="https://glassfish.dev.java.net/">https://glassfish.dev.java.net/</a></li>
</ul>
<p><strong>2. Learn Servlets</strong></p>
<p>All the java web frameworks and application servers share on thing in commom: servlets.</p>
<p>Servlets are nothing more than classes that handle http request and response. Once you&#8217;ve mastered servlets, you will have a broad idea how to develop most web applications in java, and will understand some of the key concepts of java web developing.</p>
<p>Some good servlet tutorials:</p>
<ul>
<li><a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html">http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets.html</a></li>
<li><a href="http://www.novocode.com/doc/servlet-essentials/">http://www.novocode.com/doc/servlet-essentials/</a></li>
</ul>
<p><strong>3. JSP</strong></p>
<p>Before jumping in into a framework, it is always good to take a look at JSP. It&#8217;s more similar to PHP than pure servlet programming, and will help you get started with coding actual pages.</p>
<p>JSP tutorials:</p>
<ul>
<li><a href="http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html">http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html</a></li>
<li><a href="http://www.roseindia.net/jsp/jsp.htm">http://www.roseindia.net/jsp/jsp.htm</a></li>
</ul>
<p><strong>4. Create an app with JSP and Hibernate</strong></p>
<p>Hibernate is the most popular database framework for java, and it is used widely on web applications. It is a Object-Relational mapping framework, which simply means that you will mostly deal with actual objects rather than database queries. It can connect to various databases such as MySQL, PostgreSQL and Oracle. However, one may find the xml configuring files a bit confusing at first.</p>
<p>The best way to learn hibernate is to build an app using it along JSP. Try to build something simple, like a little blog system or even a one page CRUD (Create,Read,Update,Delete) page that manages one table on a database.</p>
<p>Once you master all the xml file configuration, I would suggest taking a look at hibernate annotations. They make life a lot easier, letting you put field relationships definitions on the actual class source code, instead on a separate xml file.</p>
<p>Hibernate tutorials:</p>
<ul>
<li><a href="http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html">http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html</a></li>
<li><a href="http://www.visualbuilder.com/java/hibernate/tutorial/">http://www.visualbuilder.com/java/hibernate/tutorial/</a></li>
</ul>
<p><strong>4. Pick a Java Web Framework</strong></p>
<p>Java web frameworks are, at least as far as i know, built on top of servlets, and make life a lot easier. This is probably the most chalanging part for a newcoming java web programmer. The list of java web frameworks is very extensive, and it can be hard to pick the best tool for the job. Here are three of the most popular frameworks:</p>
<ul>
<li>Struts 1 and 2: <a href="http://struts.apache.org/">http://struts.apache.org/</a></li>
<li>JSF: <a href="http://java.sun.com/javaee/javaserverfaces/">http://java.sun.com/javaee/javaserverfaces/</a></li>
<li>Spring MVC: <a href="http://www.ibm.com/developerworks/java/library/wa-spring3/index.html">http://www.ibm.com/developerworks/java/library/wa-spring3/index.html</a></li>
</ul>
<p><strong>5. Learn enterprise stuff, if you need it</strong></p>
<p>Keep in mind that, eventhough web development in java may be confused with enterprise development, both are <em>separate things.</em> Web development are the tecniques above, while enteprise development is mostly EJB related.</p>
<p>EJBs, or Enterprise Java Beans, make it possible to put your database entities and code logic in one server, and presentation in another. You don&#8217;t really need it if you are just developing websites.</p>
<p>On the other hand, if you work for a business and need to develop application that will run on several different media (mobile, browser, terminal..) EJBs, and JEE in general may come in handy. Keep in mind that, in order to run EJB, one needs an application server that supports EJB.</p>
<p>For more information on EJBs, take a look at:</p>
<ul>
<li><a href="http://docs.jboss.org/ejb3/app-server/tutorial/index.html">http://docs.jboss.org/ejb3/app-server/tutorial/index.html</a></li>
<li><a href="http://www.conceptgo.com/gsejb/index.html">http://www.conceptgo.com/gsejb/index.html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Intro to Aspect Oriented Programming with AspectJ</title>
		<link>http://www.leo-sa.com/?p=3</link>
		<comments>http://www.leo-sa.com/?p=3#comments</comments>
		<pubDate>Mon, 22 Sep 2008 00:10:06 +0000</pubDate>
		<dc:creator>Leo</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[aop]]></category>
		<category><![CDATA[aspect oriented programming]]></category>
		<category><![CDATA[aspectj]]></category>
		<category><![CDATA[car]]></category>

		<guid isPermaLink="false">http://www.leo-sa.com/?p=3</guid>
		<description><![CDATA[You have all your project done and ready to rock. After a couple of months, the customer decides to add more features and, guess what, that means you will have to alter significant part of your well structured code with clutter that was not really part of the original specification. If there only was a [...]]]></description>
			<content:encoded><![CDATA[<p>You have all your project done and ready to rock. After a couple of months, the customer decides to add more features and, guess what, that means you will have to alter significant part of your well structured code with clutter that was not really part of the original specification. If there only was a way to add the extra functionality without altering the code&#8230;</p>
<p>And there is! That&#8217;s why AOP, Aspect Oriented Programming, exists. Don&#8217;t be scared by the name: AOP is nothing more than add extra code to your code without altering your code.</p>
<p><span id="more-3"></span></p>
<p>Confusing? Not really. We can do that with a neat java library called AspectJ. Take a simple getter and setter class, let&#8217;s say, Car. We have getter and setter for the car color (getColor/setColor), and we would like to call a print statement whenever the color changes, but with a condition: we can&#8217;t alter the code of the Car class.</p>
<p>The first step is to create the car class. That can be easily done with the following code:<br />
<code><br />
public class Car {<br />
private String color;</code></p>
<p>public String getColor() {<br />
return color;<br />
}</p>
<p>public void setColor(String color) {<br />
this.color = color;<br />
}<br />
}</p>
<p>Now all we need is to tell the compiler to execute some extra code whenever the setColor method is invoked. In order for that to work, the compiler needs to know at which point of the program execution it will interfere to insert the extra code. This specific point is called a POINTCUT, and is defined on a file called an ASPECT. The syntax of a pointcut specification for our setColor method would be something like this:</p>
<p><code>pointcut setColorCall(): call(public void Car.setColor(String));</code></p>
<p>This simply tells the compiler to create a new pointcut named setColorPointCut whenever the public method setColor is called, with a string parameter. Pointcuts accept wildcard expressions. So if you wanted, for example, to intercept ALL method calls made to the car class, the pointcut would be something like this:</p>
<p><code>pointcut allCallsToCar(): call(* Car.*(..));</code></p>
<p>Once the pointcut is ready, we are ready to make the piece of code that we want to be executed. This is called an ADVICE, and it goes like this:</p>
<p><code>before(): setColorCall() {<br />
System.out.println("The car color has changed!");<br />
}</code></p>
<p>Basically, it tells the compiler to execute the forementioned code <em>before</em> the pointcut in question is executed. If you are wondering if you could put an <em>after </em>instead of &#8220;before&#8221;, you are right.</p>
<p>All this code goes into a file that is called the <em>aspect</em>, like this:</p>
<p><code><br />
public aspect CarAspect<br />
{<br />
pointcut setColorCall(): call(public void Car.setColor(String));</code></p>
<p>before(): setColorCall() {<br />
System.out.println(&#8221;The car color has changed!&#8221;);<br />
}<br />
}</p>
<p>I named this file CarAspect.aj. The aj extension means that this is an AspectJ aspect instead of a regular java class. I also created a driver class that will call the Car and see if everything works:</p>
<p><code><br />
public class CarDriver<br />
{<br />
public static void main(String args[]) {<br />
Car mycar = new Car();<br />
mycar.setColor("blue");<br />
}<br />
}<br />
</code></p>
<p>Make sure you have the AspectJ tools installed, and then you can compile everything using the command:</p>
<p><code>ajc CarAspect.aj CarDriver.java Car.java</code></p>
<p>on your OS command line. Also, make sure that you download AspectJ from http://www.eclipse.org/aspectj and put the <strong>aspectjrt.jar</strong> on your class path, otherwise it won&#8217;t work. If you go ahead and execute:</p>
<p><code>java CarDriver</code></p>
<p>the output should be:</p>
<p><code>The car color has changed!</code></p>
<p>AspectJ is a very powerfull tool, and it can do really impressive things much more interesting than this simple example. I would encourage you to go on http://www.eclipse.org/aspectj and take a look at the docs. There is also a nice eclipse plugin on that same site that helps you a lot when writing aspects for your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.leo-sa.com/?feed=rss2&amp;p=3</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
