<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4249852743259802437</id><updated>2011-10-06T22:46:39.958+03:30</updated><title type='text'>Easy Road</title><subtitle type='html'>The important matter is finding the easy road.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-7977124997192184324</id><published>2011-01-19T12:30:00.003+03:30</published><updated>2011-01-19T12:32:21.921+03:30</updated><title type='text'>Hexican.com</title><content type='html'>I just started my own blog &lt;a href="http://hexican.com"&gt;here&lt;/a&gt;. I just appreciate Google's hosting for blogger. Follow my posts in &lt;a href="http://hexican.com"&gt;hexican.com&lt;/a&gt;.&lt;br /&gt;Amir.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-7977124997192184324?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/7977124997192184324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2011/01/hexicancom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/7977124997192184324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/7977124997192184324'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2011/01/hexicancom.html' title='Hexican.com'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-915694284947774428</id><published>2011-01-08T09:26:00.005+03:30</published><updated>2011-01-08T10:00:18.798+03:30</updated><title type='text'>Setters and Getters</title><content type='html'>Every Java or C# developer knows how getter/setter methodes make the code messy and noisy because you have to define them explicitly in those languages. I just like the idea of using annotations to reduce amount of the code that should be written. Objective C has defined an annotation to define getter/setter methods implicitly. See below example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;@interface SimpleCar : NSObject {&lt;br /&gt; NSString* make;&lt;br /&gt; NSString* model;&lt;br /&gt; NSNumber* vin;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;@property(readwrite, retain) NSString* make;&lt;br /&gt;@property(readwrite, retain) NSString* model;&lt;br /&gt;@property(readwrite, retain) NSNumber* vin;&lt;br /&gt;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The implementation:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#import "SimpleCar.h"&lt;br /&gt;&lt;br /&gt;@implementation SimpleCar&lt;br /&gt;@synthesize make, model, vin;&lt;br /&gt;@end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There is no sign of setter/getter methods however, they actually will be accessible during runtime. This is the most clear implementation that I've ever seen.  Interface is more declarative.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-915694284947774428?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/915694284947774428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2011/01/setters-and-getters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/915694284947774428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/915694284947774428'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2011/01/setters-and-getters.html' title='Setters and Getters'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-8278726874328807854</id><published>2011-01-07T17:44:00.009+03:30</published><updated>2011-01-07T22:51:59.918+03:30</updated><title type='text'>It is not a big deal to start a smaller one.</title><content type='html'>There are two kinds of software project I think. The one is large scale projects that consume a lot of time/resources and you cant always estimate if it gets done successfully or not. The other one is small size project which you can accomplish them by yourself. Some kinds of small software widgets and iPhone or Android applications are in this category. &lt;br /&gt;The atmosphere of these two kinds of projects are pretty different. An enterprise project needs long time frequently meetings and  professionals while each one is just responsible for some parts of the project and not more. It also needs expensive servers and environmental tools, configuration management and administration. These projects run just by millions. Their failover also is a catastrophe. I remember the time that I was involved into developing, deploying and testing an enterprise Java based core banking solution which was run over IBM technologies. It was the worst nightmare that I've ever seen. Each step was just going more into the mud and sludge.  &lt;br /&gt;However, a small size project needs one or two developer who know perfectly the whole project. They need just a brilliant idea and one or two notebooks and nothing more. They gain wonderful experience in each step. Aslo it is not a big deal at all if the project fails. There is just an attempting to build a cash cow.&lt;br /&gt;After some years of playing with harmful enterprise toys I just need to get rest by developing small mac applications. So I've started to learn Objective C, iOS and Mac OS concepts and technologies. They are really simple solutions to sweet success.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-8278726874328807854?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/8278726874328807854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2011/01/it-is-not-big-deal-to-start-smaller-one.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8278726874328807854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8278726874328807854'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2011/01/it-is-not-big-deal-to-start-smaller-one.html' title='It is not a big deal to start a smaller one.'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1291598601324402753</id><published>2011-01-05T00:00:00.004+03:30</published><updated>2011-01-05T09:57:09.486+03:30</updated><title type='text'>They've cared about details.</title><content type='html'>MacBook Pro isn't just beautiful. It has a perfect design and material. When you use it you find soon some intelligent behaviors and perfect arrangement of the things and functionalities that made it a brilliant. For example you never hit caps lock key wrongly when you are typing quickly. Caps lock has a delay to response that let you keep typing so fast without caring about hitting caps lock instead of tab button. They have cared about details. Watch &lt;a href="http://www.youtube.com/watch?v=lJx6cF-H__I"&gt;this&lt;/a&gt; video and enjoy how they make things.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1291598601324402753?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1291598601324402753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2011/01/apple-have-cared-about-details.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1291598601324402753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1291598601324402753'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2011/01/apple-have-cared-about-details.html' title='They&apos;ve cared about details.'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1177113424529185166</id><published>2010-12-29T11:04:00.010+03:30</published><updated>2011-01-07T17:44:13.702+03:30</updated><title type='text'>Sending SOAP messages through HTTPS using SAAJ</title><content type='html'>&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;A month ago a task assigned to me. It was calling the API of a network management device by sending SOAP messages through HTTPS. It wasn't so easy and straight forward to me. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SAAJ&lt;/strong&gt;&lt;br /&gt;I've used &lt;a href="https://saaj.dev.java.net/"&gt;SAAJ&lt;/a&gt; for calling web services. It is well known for Java developers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;br /&gt;The process contains below steps:&lt;br /&gt;1. Export the HTTPS Certificate into a file&lt;br /&gt;2. Import the HTTPS Certificate into Java HTTPS certificates&lt;br /&gt;3. Creating a SOAP connection&lt;br /&gt;4. Creating a SOAP message&lt;br /&gt;5. Populating the message&lt;br /&gt;6. Trust to HTTPS certificates&lt;br /&gt;7. Sending the message&lt;br /&gt;8. Retrieving the reply&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Get the Certificate&lt;/strong&gt;&lt;br /&gt;Assume WSDL address is:&lt;br /&gt;&lt;pre&gt;https://192.168.10.1:8991/wsdl/balance.wsdl&lt;/pre&gt;&lt;br /&gt;Read &lt;a href="http://www.ehow.com/how_6624512_export-certificate-use-other-servers.html"&gt;this&lt;/a&gt; to find out how to get the certificate for access to the upper WSDL address.&lt;br /&gt;Here I saved the certificate in "amirssw.cer" file.&lt;br /&gt;Java HTTPS certificates stored in&lt;br /&gt;&lt;pre&gt;$JAVA_HOME/jre/lib/security/cacerts&lt;/pre&gt;&lt;br /&gt;To import your new certificate into "cacerts" run below command:&lt;br /&gt;&lt;pre&gt;sudo keytool -import -file amirssw.cer -keystore cacerts&lt;/pre&gt;&lt;br /&gt;The password is "changeit".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SOAP message&lt;/strong&gt;&lt;br /&gt;In my sample SOAP message stored in a file: "/home/amir/projects/mine/p8/message/helloWorld.msg".&lt;br /&gt;You can find a sample SOAP message &lt;a href="http://www.w3.org/2004/06/03-google-soap-wsdl.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Java Code&lt;/strong&gt;&lt;br /&gt;This is a simple code that shows clearly how to send a SOAP message through HTTPS. The only different between sending the message on HTTP over HTTPS is the URL and doTrustToCertificates() method call just before sending the message.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;package com.neverhood.webssl;&lt;br /&gt;&lt;br /&gt;import javax.net.ssl.*;&lt;br /&gt;import javax.xml.soap.*;&lt;br /&gt;import javax.xml.transform.Source;&lt;br /&gt;import javax.xml.transform.Transformer;&lt;br /&gt;import javax.xml.transform.TransformerFactory;&lt;br /&gt;import javax.xml.transform.stream.StreamResult;&lt;br /&gt;import javax.xml.transform.stream.StreamSource;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.net.MalformedURLException;&lt;br /&gt;import java.net.URL;&lt;br /&gt;import java.security.SecureRandom;&lt;br /&gt;import java.security.Security;&lt;br /&gt;import java.security.cert.CertificateException;&lt;br /&gt;import java.security.cert.X509Certificate;&lt;br /&gt;import java.util.Iterator;&lt;br /&gt;import java.util.Vector;&lt;br /&gt;&lt;br /&gt;public class Client {&lt;br /&gt;&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        talk("https://192.168.10.1:8991/balance/soap", "/home/amir/projects/mine/p8/message/helloWorld.msg");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private static void talk(String urlval, String msgPath) {&lt;br /&gt;        try {&lt;br /&gt;            // Create message&lt;br /&gt;            MessageFactory mf = MessageFactory.newInstance();&lt;br /&gt;            SOAPMessage msg = mf.createMessage();&lt;br /&gt;&lt;br /&gt;            // Object for message parts&lt;br /&gt;            SOAPPart sp = msg.getSOAPPart();&lt;br /&gt;            StreamSource prepMsg = new StreamSource(new FileInputStream(msgPath));&lt;br /&gt;            sp.setContent(prepMsg);&lt;br /&gt;&lt;br /&gt;            // Save message&lt;br /&gt;            msg.saveChanges();&lt;br /&gt;&lt;br /&gt;            // View input&lt;br /&gt;            System.out.println("\n Soap request:\n");&lt;br /&gt;            msg.writeTo(System.out);&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;            // Trust to certificates&lt;br /&gt;            doTrustToCertificates();&lt;br /&gt;&lt;br /&gt;            //SOAPMessage rp = conn.call(msg, urlval);&lt;br /&gt;            SOAPMessage rp = sendMessage(msg, urlval);&lt;br /&gt;&lt;br /&gt;            // View the output&lt;br /&gt;            System.out.println("\nXML response\n");&lt;br /&gt;&lt;br /&gt;            // Create transformer&lt;br /&gt;            TransformerFactory tff = TransformerFactory.newInstance();&lt;br /&gt;            Transformer tf = tff.newTransformer();&lt;br /&gt;&lt;br /&gt;            // Get reply content&lt;br /&gt;            Source sc = rp.getSOAPPart().getContent();&lt;br /&gt;&lt;br /&gt;            // Set output transformation&lt;br /&gt;            StreamResult result = new StreamResult(System.out);&lt;br /&gt;            tf.transform(sc, result);&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;            // now GET the Response and PARSE IT !&lt;br /&gt;            Vector list = new Vector();&lt;br /&gt;            SOAPBody soapBody = rp.getSOAPBody();&lt;br /&gt;            Iterator iterator1 = soapBody.getChildElements();&lt;br /&gt;            while (iterator1.hasNext()) {&lt;br /&gt;                SOAPBodyElement ThisBodyElement = (SOAPBodyElement) iterator1.next();&lt;br /&gt;                Iterator it2 = ThisBodyElement.getChildElements();&lt;br /&gt;                while (it2.hasNext()) {&lt;br /&gt;                    SOAPElement child2 = (SOAPElement) it2.next();&lt;br /&gt;                    Iterator it3 = child2.getChildElements();&lt;br /&gt;                    while (it3.hasNext()) {&lt;br /&gt;                        SOAPElement child3 = (SOAPElement) it3.next();&lt;br /&gt;                        String value = child3.getValue();&lt;br /&gt;                        list.addElement(value);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            for (int i = 0; i &amp;lt; list.size(); i++) {&lt;br /&gt;                System.out.println(list.elementAt(i));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (Exception e) {&lt;br /&gt;            System.out.println(e.getMessage());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;static public SOAPMessage sendMessage(SOAPMessage message, String endPoint) throws MalformedURLException, SOAPException {&lt;br /&gt;        SOAPMessage result = null;&lt;br /&gt;        if (endPoint != null &amp;amp;&amp;amp; message != null) {&lt;br /&gt;            URL url = new URL(endPoint);&lt;br /&gt;            SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();&lt;br /&gt;            SOAPConnection connection = null;&lt;br /&gt;            long time = System.currentTimeMillis();&lt;br /&gt;            try {&lt;br /&gt;                connection = scf.createConnection(); //point-to-point connection&lt;br /&gt;                result = connection.call(message, url);&lt;br /&gt;            } finally {&lt;br /&gt;                if (connection != null) {&lt;br /&gt;                    try {&lt;br /&gt;                        connection.close();&lt;br /&gt;                    } catch (SOAPException soape) {&lt;br /&gt;                        System.out.print("Can't close SOAPConnection:" + soape);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    static public void doTrustToCertificates() throws Exception {&lt;br /&gt;        Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());&lt;br /&gt;        TrustManager[] trustAllCerts = new TrustManager[]{&lt;br /&gt;                new X509TrustManager() {&lt;br /&gt;                    public X509Certificate[] getAcceptedIssuers() {&lt;br /&gt;                        return null;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {&lt;br /&gt;                        return;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {&lt;br /&gt;                        return;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        SSLContext sc = SSLContext.getInstance("SSL");&lt;br /&gt;        sc.init(null, trustAllCerts, new SecureRandom());&lt;br /&gt;        HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());&lt;br /&gt;        HostnameVerifier hv = new HostnameVerifier() {&lt;br /&gt;            public boolean verify(String urlHostName, SSLSession session) {&lt;br /&gt;                if (!urlHostName.equalsIgnoreCase(session.getPeerHost())) {&lt;br /&gt;                    System.out.println("Warning: URL host '" + urlHostName + "' is different to SSLSession host '" + session.getPeerHost() + "'.");&lt;br /&gt;                }&lt;br /&gt;                return true;&lt;br /&gt;            }&lt;br /&gt;        };&lt;br /&gt;        HttpsURLConnection.setDefaultHostnameVerifier(hv);&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1177113424529185166?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1177113424529185166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/12/introduction-i-just-develop-simple-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1177113424529185166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1177113424529185166'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/12/introduction-i-just-develop-simple-code.html' title='Sending SOAP messages through HTTPS using SAAJ'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-3011487812257557581</id><published>2010-09-25T13:43:00.007+03:30</published><updated>2010-09-25T14:33:39.952+03:30</updated><title type='text'>Port Forwarding, The way I use SSH</title><content type='html'>"Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices." &lt;a href="http://en.wikipedia.org/wiki/Secure_Shell"&gt;Wikipedia.&lt;/a&gt;&lt;br /&gt;That is just an abstract definition. I use SSH to do much more. Here are just some simple commands that I used to run for such a different reasons:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Whenever I need to pass stupid filtering of stupid government&lt;/strong&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ssh -D 8888 root@100.101.102.103&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;"100.101.102.103" is just the host that you want to connect it. I assumed that 100.101.102.103 is a SSH enabled machine. &lt;br /&gt;This command simply forwards the remote machine's HTTP port to my local machine. So I just need to use a socks4 proxy like this : 127.0.0.1:8888. &lt;br /&gt;So whatever you do using your browser will forward to the remote machine. The channel between your local machine and the remote one is pretty secured. However, the remote machine should be trusted. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Whenever I need to connect a remote MS-SQLServer on a windows machine using my Linux machine&lt;/strong&gt;&lt;br /&gt;Assume a service such as SQLServer which runs on a machine that is hosted in a remote LAN with [192.168.0.100] IP address. Assume you just can connect to another machine that is hosted in the same LAN using:&lt;br /&gt;&lt;pre&gt;ssh root@100.101.102.103&lt;/pre&gt;&lt;br /&gt;Assume again the MS-SQLServer uses the port number 1433. &lt;br /&gt;I need to connect to the ssh server machine using ssh root@100.101.102.103 moreover I need to forward 192.168.0.100:1433 to my local machine. This is the simple solution:&lt;br /&gt;&lt;pre&gt;ssh -L 1433:192.168.0.100:1433 root@100.101.102.103 -N&lt;/pre&gt;&lt;br /&gt;The pattern is "ssh -L myPort:host:hostPort". -N is useful for just forwarding ports and nothing else.&lt;br /&gt;&lt;br /&gt;The connections could be same as below map:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;my machine       ssh server            MS-SQLServer&lt;br /&gt;127.0.0.1 &lt;===&gt; 100.101.102.103 &lt;===&gt; 192.168.0.100&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note:&lt;br /&gt;-Install &lt;a href="http://www.openssh.com/"&gt;OpenSSH&lt;/a&gt; if you need to provide SSH over Windows servers. &lt;br /&gt;-To access ports under 1024 you should have root privilege.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-3011487812257557581?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/3011487812257557581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/09/port-forwarding-way-that-i-use-ssh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3011487812257557581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3011487812257557581'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/09/port-forwarding-way-that-i-use-ssh.html' title='Port Forwarding, The way I use SSH'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-8410936924052766858</id><published>2010-09-18T00:23:00.009+04:30</published><updated>2010-09-18T15:19:49.332+04:30</updated><title type='text'>MuleSoft's Tcat, an Enterprise view to the Tomcat</title><content type='html'>&lt;a href="http://tomcat.apache.org/"&gt;Apache Tomcat&lt;/a&gt; is the most convenient and reliable tool that I've ever seen. Here are Tomcat's power points that I've founded during my experiences:&lt;br /&gt;&lt;br /&gt;-Tomcat works cross platforms. Just by copying from a machine to another one it serves applications. For example from a Linux to a Windows just a copy is enough.&lt;br /&gt;&lt;br /&gt;-Tomcat is fast to deploy and easy to use. In most cases you just need to copy the WAR and forget about later configurations.&lt;br /&gt;&lt;br /&gt;-Tomcat doesn't need as much resources as others.&lt;br /&gt;&lt;br /&gt;While Tomcat doesn't claim to provide hosting services for the enterprise level of business we developers used to overused it. &lt;br /&gt;It is long time that market is expecting such as plugin or solution that give Tomcat the capabilities which developer and administrators need. &lt;br /&gt;&lt;br /&gt;Now &lt;a href="http://www.mulesoft.com/"&gt;MuleSoft&lt;/a&gt; made it. I just downloaded and try TCat server of Mulesoft. The amasing thing is that it remained a Tomcat. The major different is that they developed and deployed an application that is hosted within the TCat. It called "Console". TCat's console gives some missed features such as "Profile". I used to have different Tomcats on my machine depends on the projects. I work on Tele-communication and monitoring solutions using SNMP, TR-069 and JMX. In In another team I just develop web-based business applications. So I have to separate Tomcats regarding to different natures of companies and purposes. Now TCat profiles solved this problem. Also TCat has provided a repository that helps you to keep and manage your WARs. TCat has an embedded JRE! Also it is possible to use your pre-installed JRE. Anyway this gives TCat more enterprise shape! &lt;br /&gt;I prefer to use an enterprise Apache Tomcat rather an IBM Webspher. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-8410936924052766858?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/8410936924052766858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/09/mulesofts-tcat-enterprise-view-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8410936924052766858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8410936924052766858'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/09/mulesofts-tcat-enterprise-view-to.html' title='MuleSoft&apos;s Tcat, an Enterprise view to the Tomcat'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1413664335227767091</id><published>2010-09-13T11:48:00.004+04:30</published><updated>2010-09-14T15:02:20.514+04:30</updated><title type='text'>When Tomcat looks different cross Linux flavors</title><content type='html'>Some days ago at the time I was working on different Linux flavors to setup a uniform solution, I have notified that there are many differences in Tomcat installed files and configuration even when you have same Tomcat version. The mission was setting up a centralized monitoring system that makes user enable to track what is happening within Tomcat and its applications on different Linux machines such as CentOS, FreeBSD and Ubuntu. I was developed the solution in my notebook that uses Ubuntu 9.04, Sun Java 1.6 and Tomcat 6.0. Also I qualified the solution on an Ubuntu server edition. The tests passed perfectly so I tried to migrate it to FreeBSD and CentOS. The system administrator was worry about any major modification on his servers configuration that both were pretty busy. On both FreeBSD and CentOS I had different OS, Java and Tomcat. FreeBSD 7.2 had its own Java runtime and JDK that called Diablo. It used a Tomcat version 5.5. The CentOs machine had an OpenJDK Java edition. Also It uses Tomcat 5.5. &lt;br /&gt;Differences between Sun JDK, OpenJDK and Diablo didn't make any trouble in using JMX. The biggest incompatibility was different installations of the same version of Tomcat that was installed in different ways by CentOS and FreeBSD package managers! &lt;br /&gt;The administrators has been installed a same version of Tomcat using package managers. It seems each package manager installs a customized version of Tomcat  that is more respects to the OS concerns rather than development. In CentOS I didn't find "catalina.sh" that is a well known startup routine. &lt;br /&gt;Any way JMX listener didn't work and I guessed that could be caused by different Java editions. Fortunately the administrator rejected my suggestion for using Sun Java on both machine. So I tried other ways. &lt;br /&gt;In latest try I just copied my Tomcat to FreeBSD and CentOS both and it worked like a charm!&lt;br /&gt;Different flavors use their own package managers that install just customized versions of the packages. While any Java developer needs to produce more compatible solutions that are more usable with minor differences cross platforms. Compatibility and scalability are the most advantages of Java over other solutions. This is why we use Java. Every Java developer prefer to keep compatibility over customization.&lt;br /&gt;As a suggestion just use a more secured copy of your own Tomcat over all target servers rather than muted and morphed versions that installed by package managers.&lt;br /&gt;&lt;a href="http://blog.datispars.com/exploring-under-hood-of-java-applications-using-jmx-part-2/"&gt;Here is a step by step tutorial of what I have done....&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1413664335227767091?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1413664335227767091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/09/when-tomcat-looks-different-cross-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1413664335227767091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1413664335227767091'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/09/when-tomcat-looks-different-cross-linux.html' title='When Tomcat looks different cross Linux flavors'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-366788553656394048</id><published>2010-07-03T15:55:00.002+04:30</published><updated>2010-07-03T15:57:46.751+04:30</updated><title type='text'></title><content type='html'>"In Iran a large scale software project implementation is just like somehow to completing a puzzle that you don't have all pieces. The map is out of date. Moreover you have to use some pieces of other different puzzles to cover some areas of your puzzle with them. Some how there are missing pieces that you have to develop them. Finely you have to integrate them all."&lt;br /&gt;&lt;a href="http://blog.datispars.com/software-market-in-iran-part-1/"&gt;I've just posted an article about Software Development in Iran.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-366788553656394048?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/366788553656394048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/07/in-iran-large-scale-software-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/366788553656394048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/366788553656394048'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/07/in-iran-large-scale-software-project.html' title=''/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-3476305855498584071</id><published>2010-06-12T15:45:00.002+04:30</published><updated>2010-06-12T15:49:40.893+04:30</updated><title type='text'>Object Orientation in Javascript</title><content type='html'>This could wired for whom used to program using Javascript that they can create objects. I didn't know till some while ago. &lt;a href="http://blog.datispars.com/creating-object-in-javascript/"&gt;Here&lt;/a&gt; is an example.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-3476305855498584071?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/3476305855498584071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/06/object-orientation-in-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3476305855498584071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3476305855498584071'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/06/object-orientation-in-javascript.html' title='Object Orientation in Javascript'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-3644232705097326448</id><published>2010-06-05T17:06:00.005+04:30</published><updated>2010-06-05T17:20:25.376+04:30</updated><title type='text'>An Opportunity for Investment</title><content type='html'>I just wrote an article for datispars.com. "&lt;a href="http://blog.datispars.com/how-to-be-a-successful-investor-in-software-development-field-part-1/"&gt;How to be a successful investor in software development field&lt;/a&gt;" is an article that talks about software development opportunities such as outsourcing. The article tries to explain easy ways of develop better applications using better approaches, regardless of business restrictions and technologies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-3644232705097326448?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/3644232705097326448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/06/opportunity-for-investment_05.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3644232705097326448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3644232705097326448'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/06/opportunity-for-investment_05.html' title='An Opportunity for Investment'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-4925656643592058030</id><published>2010-05-08T18:01:00.002+04:30</published><updated>2010-05-09T00:07:48.260+04:30</updated><title type='text'>Using A More Specific Programming Language</title><content type='html'>Whichever programming language you are using in a software application development for, be sure to choose the proper language that exactly fits requirements. This needs to be familiar a bit more with some other technologies and programming languages such as &lt;a href="http://en.wikipedia.org/wiki/Domain-specific_programming_language"&gt;domain specific languages&lt;/a&gt;.&lt;br /&gt;Migrating from a multi purpose programming language such as Java to a domain specific programming language such as &lt;a href="http://www.springsource.com/products/grails"&gt;Groovy and Grails&lt;/a&gt; is just like choosing a more specific wrench rather than a general purpose. A handy man who knows just hammer then will recognize every problem as a nail.  The same as this story may occur in software development projects too. The developer which uses only Java or .Net as  a general purpose technology may loose a lot of resources to make an adoption between the solution and the problem rather than the one who uses a domain specific programming language such as Scala and Groovy.&lt;br /&gt;I think being familiar with other tools, frameworks and technologies give us the opportunity to choose the better solution in many situations. In the case I experienced learning curve of being familiar with Groovy and Grails was pretty shorter than starting a Java project even based on basic configuration that I have provided before. The concept of “convention over configuration” boosts software projects. You don't need to build everything from scratch. The framework prepares a customized and standard basic configuration that is pretty well formed. A Groovy domain class itself describes the business more clearly and more abstracted rather than Java POJOs. Moreover built in naming convention that respected by Grails makes a terminology between developers.&lt;br /&gt;All together the developers that uses DSLs are able to develop relevantly with a smaller knowledge base and terminology. In addition learning of Groovy and Grails is based on samples that called “Learning by Example” and Learning by example is a smooth way that we learned it when we were child.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-4925656643592058030?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/4925656643592058030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/05/using-more-specific-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4925656643592058030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4925656643592058030'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/05/using-more-specific-programming.html' title='Using A More Specific Programming Language'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-524541368233389203</id><published>2010-04-23T20:30:00.013+04:30</published><updated>2010-04-23T22:10:51.618+04:30</updated><title type='text'>Using Clear Source Java Codes In A Groovy/Grails Application</title><content type='html'>Groovy/Grails boosts the development process in many ways. The convention over configuration approach helps the developer to develop as fast as possible. Groovy and Grails talk in a much higher level language over than Java.&lt;br /&gt;&lt;br /&gt;Something just like the creation of Java it self, is happening again. Software market place needs to talking in a more higher level languages rather than Java I think. Business on demand pressures the market to create and use more productive tools and technologies.&lt;br /&gt;&lt;br /&gt;However, I as a developer need to write some parts of the applications using a little bit lower level language in many situations. Moreover, the huge amounts of developed and ready to use Java libraries such as source codes, jar files, and open source solutions warn  me to prevent of reinventing the wheel. So, I align my approach with using the Groovy and Grails and Java classes in source code together just to boost the development and walk with bigger steps; Furthermore, I keep using of Java libraries whenever I need.&lt;br /&gt;&lt;br /&gt;There are many situations that you need to use Java in a Grails application. This is more than using just JVM and importing jar libraries. I mean I prefer to user clear Java source code in the Grails application to have respect for the scripting concept of Groovy even in Java classes.&lt;br /&gt;&lt;br /&gt;Here we will use a particular Java source code in a Grails application.&lt;br /&gt;Assume below particular Java class:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package com.amir.util;&lt;br /&gt;&lt;br /&gt;class HelloWorld {&lt;br /&gt;&lt;br /&gt; public static String getMessage() {&lt;br /&gt;  return "Hello World!";&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public static String getMessageFor(String str) {&lt;br /&gt;  return "Hello "+ str +"!";&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I am going to use HelloWorld.java instead of HelloWorld.class. Then I will be able to modify it whenever I need and Grails will compile during each "grails run-app".&lt;br /&gt;&lt;br /&gt;To create HelloWorld Grails application you first need to give the grails a create-app command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails create-app helloworld&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will create a new directory inside the current one that contains the project. You should now navigate to this directory in terminal:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; cd helloworld/src/java&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now you need to create the packging folders:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; mkdir com&lt;br /&gt;$&gt; mkdir com/amir&lt;br /&gt;$&gt; mkdir com/amir/util&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The Java class should be find in this path:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;helloworld/src/java/com/amir/util/HelloWorld.java&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now come back to the helloworld folder which is the root folder of the application and create a hello controller:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails create-controller hello&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will create a new controller in the grails-app/controllers directory called HelloController.groovy. You need to modify it to call the Java HelloWorld class.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; gedit grails-app/controllers/HelloController.groovy&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And make it as below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class HelloController {&lt;br /&gt; def world = {&lt;br /&gt;     render HelloWorld.getMessage() + " , "&lt;br /&gt;     render HelloWorld.getMessageFor(" Amir ")&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now start-up the container with run-app command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails run-app&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This will start-up a server on port 8080 and you should now be able to access your application with the URL: http://localhost:8080/helloworld&lt;br /&gt;&lt;br /&gt;Job done! You used a clear source Java class instead of the compiled one in a Grails application. Everything is just scripted!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-524541368233389203?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/524541368233389203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/04/using-clear-source-java-codes-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/524541368233389203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/524541368233389203'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/04/using-clear-source-java-codes-in.html' title='Using Clear Source Java Codes In A Groovy/Grails Application'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1143685003235279417</id><published>2010-04-19T16:26:00.010+04:30</published><updated>2010-04-20T10:40:00.002+04:30</updated><title type='text'>Building A Blog Using 7 Simple Steps In Grails</title><content type='html'>Building a regular web application using Grails should be the minimalistic activity that any Java developer may involved in. Just follow below 7 steps to develop your first Grails blog.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1.&lt;/span&gt; To create an application using Grails we should run a "grails create-app applicationName" command:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails create-app com.datispars.blog&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2.&lt;/span&gt; Change directory to the currently built directory of the application:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; cd com.datispars.blog&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3.&lt;/span&gt; At this point we create domain classes. Domain classes will consist the logic part of MVC model:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails create-domain-class com.datispars.blog.Content&lt;br /&gt;$&gt; grails create-domain-class com.datispars.blog.Comment&lt;br /&gt;$&gt; grails create-domain-class com.datispars.blog.Author&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4.&lt;/span&gt; To put some business policy into the model area we should modify domain classes&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; gedit grails-app/domain/com/datispars/blog/Content.groovy&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You should modify Content class as below:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package com.datispars.blog&lt;br /&gt;&lt;br /&gt;class Content {&lt;br /&gt;String title&lt;br /&gt;  String body&lt;br /&gt;Category category&lt;br /&gt;Author author&lt;br /&gt;static hasMany=[comments:Comment]&lt;br /&gt;  static constraints = {&lt;br /&gt;     title(blank:false, nullable: false, size:3..80)&lt;br /&gt;     body(blank:false, nullable:false,size:3..500)&lt;br /&gt;     author(nullable:false)&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;.....&lt;br /&gt;&lt;br /&gt;$&gt; gedit grails-app/domain/com/datispars/blog/Author.groovy&lt;br /&gt;&lt;br /&gt;package com.datispars.blog&lt;br /&gt;&lt;br /&gt;class Author {&lt;br /&gt;String name&lt;br /&gt;String email&lt;br /&gt;String webpage&lt;br /&gt;static constraints = {&lt;br /&gt;name (blank:false, nullable:false, size:3..30,&lt;br /&gt;        matches:"[a-zA-Z1-9_]+")&lt;br /&gt;email (email:true)&lt;br /&gt;webpage (url:true)&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;String toString(){&lt;br /&gt;return name;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;$&gt; gedit grails-app/domain/com/datispars/blog/Comment.groovy&lt;br /&gt;&lt;br /&gt;package com.datispars.blog&lt;br /&gt;&lt;br /&gt;class Comment {&lt;br /&gt;static belongsTo=[content:Content]&lt;br /&gt;Author author;&lt;br /&gt;String comment&lt;br /&gt;  static constraints = {&lt;br /&gt;comment (blank:false, nullable: false, size:5..200)&lt;br /&gt;author (nullable: true) // Comments are allowed without a author&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String toString(){&lt;br /&gt;if (comment.size()&gt;20){&lt;br /&gt; return comment.substring(0,12);&lt;br /&gt;} else&lt;br /&gt;return comment;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5.&lt;/span&gt; To create the Controller part of MVC based on the domain classes you should run below commands:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails generate-controller com.datispars.blog.Content&lt;br /&gt;$&gt; grails generate-controller com.datispars.blog.Author&lt;br /&gt;$&gt; grails generate-controller com.datispars.blog.Comment&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;6.&lt;/span&gt; Now you need to modify three controller that you have built to use Scaffold functionality of Grails:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; gedit grails-app/controllers/com/datispars/&lt;br /&gt;       blog/ContentController.groovy&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Scaffolding allows you to auto-generate a whole application for a given domain class. The simplest way to get started with scaffolding is to enable scaffolding via the "scaffold" property. So add the commented line (def scaffold = true) in the start part of the  ContentController.groovy class:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package com.datispars.blog&lt;br /&gt;&lt;br /&gt;class ContentController {&lt;br /&gt;&lt;br /&gt; def scaffold = true  // The only modification&lt;br /&gt;                      // in the controller you should do...&lt;br /&gt;&lt;br /&gt; static allowedMethods = [save: "POST", update: "POST",&lt;br /&gt;                             delete: "POST"]&lt;br /&gt;&lt;br /&gt; def index = {&lt;br /&gt;     redirect(action: "list", params: params)&lt;br /&gt; }&lt;br /&gt;....&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Do just the same operatoion for AuthorController.groovy and CommentController.groovy (Same as 12 step) .&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;7.&lt;/span&gt; Run the application:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$&gt; grails run-app&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After running the server you should see below response in the terminal:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Server running. Browse to http://localhost:8080/com.datispars.blog&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So, you browse http://localhost:8080/com.datispars.blog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1143685003235279417?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1143685003235279417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/04/building-blog-using-7-simple-steps-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1143685003235279417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1143685003235279417'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/04/building-blog-using-7-simple-steps-in.html' title='Building A Blog Using 7 Simple Steps In Grails'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-8812498247758844209</id><published>2010-04-19T10:48:00.010+04:30</published><updated>2010-04-19T14:59:13.620+04:30</updated><title type='text'>Grails Over Rails</title><content type='html'>After a few research around rapid application development tools and frameworks, I started to try Groovy and &lt;a href="http://grails.org/"&gt;Grails&lt;/a&gt;. This just happened after a couple of weeks using of Ruby on Rails. Ruby on Rails has excited me when I knew Groovy and Grails. I have had some difficulties with Ruby on Rails at initiating days that I didn't touch them again during using of Groovy and Grails.&lt;br /&gt;&lt;br /&gt;At first I needed to install Grails. This was as much easy as you imagine. Later, I have explained how I installed Ruby on Rails on Ubuntu Linux in the &lt;a href="http://ezroad.blogspot.com/2010/04/put-ruby-on-rails-and-dont-repeat.html"&gt;previous article&lt;/a&gt; in current web log that shows rails installation needs some struggles to the end of deployment. But, Grails installation is just like a piece of cake in my experience. There is a binary version that is available as a &lt;a href="http://www.grails.org/Download"&gt;zipped file&lt;/a&gt; that just needs to download and extract it. Then you should set &lt;a href="http://www.grails.org/Installation"&gt;two environmental variable&lt;/a&gt;. I am using Grails on Ubuntu Linux. So I had to &lt;a href="http://jira.codehaus.org/browse/GRAILS-6001"&gt;fix a stupid bug&lt;/a&gt; at first try. In fact, Groovy and Grails are more indicated for Java developers because they can leverage their knowledge on Java platform and they can also turn to Java whenever they feel so, since Groovy runs on top of JVM. After all you have Spring and Hibernate ready available. Grails is very easy to get started with for Java developers. Also, You'll be able to continue using the same libraries that you used to (among many other things). The wide and enriched Java libraries are mostly accessible to your Grails application. All the code you developed and bug fixed routines are reusable in the Groovy applications. So you wont repeat all you have done.&lt;br /&gt;&lt;br /&gt;I think Grails follows Rails track but in a more organized way. The main different is Java compatibility of Grails I think. If you try to deploy a Rails application on a JEE application server you will find that there is not a straight forward procedure at all. I found that setting up the environment to develop Rails application needs gathering some very dependent components that you have to arrange them just like a puzzle and I don't know why they did not put them all in the same package!. In the opposite, Grails gives the same functionality by a more consistent and integrated solution. For making a war of the Grails application that you developed, this is enough to give it a "grails war" in the root folder of the application.&lt;br /&gt;&lt;br /&gt;Furthermore I found Groovy scripts meaningful and more conceptual. This may be just because the background I had from Java. I know Ruby is so abstracted and sharp but I used to explain exactly what I need, even by using a bit more symbols and reserve words. I cant feel the Japanese culture of Ruby short hands!&lt;br /&gt;&lt;br /&gt;Here is a piece of Groovy code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class User {&lt;br /&gt;String name&lt;br /&gt;String email&lt;br /&gt;String webpage&lt;br /&gt;static constraints = {&lt;br /&gt;    name (blank:false, nullable:false, size:3..30, matches:"[a-zA-Z1-9_]+")&lt;br /&gt;    email (email:true)&lt;br /&gt;    webpage (url:true)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;String toString(){&lt;br /&gt;    return name;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I have never seen any implementation of the validation routines as much simplified as Groovy codes. The "constraints" block has described validation rules clearly. Email and webpage validations are brilliant:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;email (email:true)&lt;br /&gt;webpage (url:true)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I think Grails accelerates the outlet of the development process for the everyone who needs to build Java compatible web applications using new generation of RAD tools and scripts.&lt;br /&gt;&lt;br /&gt;During working with Grail I've used &lt;a href="http://www.vogella.de/articles/Grails/article.html"&gt;this&lt;/a&gt; article from Lars Vogel. This could be an easy tutorial that shows how Grails works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-8812498247758844209?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/8812498247758844209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/04/java-developer-prefers-grails-over.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8812498247758844209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8812498247758844209'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/04/java-developer-prefers-grails-over.html' title='Grails Over Rails'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1812969982671387714</id><published>2010-04-04T00:03:00.012+04:30</published><updated>2010-04-04T23:43:58.564+04:30</updated><title type='text'>Intstall "Ruby on Rails" on Ubuntu 9.04 and Dont Repeat Yourself Anymore</title><content type='html'>My new position during initiating days of the new Iranian's year just started by a weird project that outsourced by an over seas company to an Iranian one.&lt;br /&gt;&lt;br /&gt;I have cooperated in some software projects with different technologies such as Java, .Net and Delphi. Indeed, the latest one is a &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; web based project that I have selected by the boss as the technology specialist and the senior developer to find out the way of using this unfamiliar technology. The project requirements and specifications ride us toward cutting edge technologies. For the first day searching and surfing through technical pages have filled my working time.&lt;br /&gt;&lt;br /&gt;I remember some months ago, a friend of mine tried to hire some Ruby on Rails developers in Tehran. He didn't succeed. This is why I feel so lucky. Ruby on Rails is designed based on the “Convention over Configuration” idea, and the rapid development principle of “Don't Repeat Yourself(DRY)”. I have found its agile motivations so practical. I as a web developer have wast a vast of time to implement repeated and simple parts of the applications such as database connectivity and configurations. Ruby on Rails reduces this times by emphasizing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CoC&lt;/span&gt; and DRY concepts.&lt;br /&gt;&lt;br /&gt;Ruby on Rails is often installed using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;RubyGems&lt;/span&gt;, a package manager which is included with Ruby. Many Linux flavors also support installation of Rails and its dependencies through their native package management system.&lt;br /&gt;I tried to deploy it on &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Ubuntu&lt;/span&gt; 9.04. It wasn't easy and straight forward in my case. I tried a couple of times.&lt;br /&gt;&lt;br /&gt;I found that I have to install ruby-full and ruby-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;elips&lt;/span&gt; packages first. Next, its time to install Ruby and Rails. Leave &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RubyGems&lt;/span&gt; for the latest installation. After all you need an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;IDE&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;RadRails&lt;/span&gt; is an Eclipse based Ruby on Rails &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;IDE&lt;/span&gt; that facilitating the developments using its nice and fast tools and services.&lt;br /&gt;&lt;br /&gt;Here are all commands in detail:&lt;br /&gt;First remove all installed Ruby, Rails, Gems and everything you will install in next steps. Any remain parts may make some troubles for this process.&lt;br /&gt;&lt;br /&gt;Make sure your repository is updated:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;sudo apt-get update&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Install rails by below command:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;sudo apt-get install ruby ri rdoc irb libopenssl-ruby ruby-dev&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Download &lt;a href="http://rubyforge.org/projects/rubygems/"&gt;RubyGem&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Extract it and then install Gem by following commands:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;tar xvzf rubygems-1.3.5.tgz&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;cd rubygems-1.3.5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo ruby setup.rb&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;You don't need to the downloaded file and extracted folder any more. So remove it:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;rm -r rubygems-1.3.5 rubygems-1.3.5.tgz&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, create a set of simlinks:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Make sure ruby-dev installed:&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 102, 0);font-size:85%;" &gt;sudo apt-get install ruby-dev&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Next, install the Rails:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;sudo gem install rails&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;You need Mongrel as server:&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;sudo gem install mongrel passenger capistrano&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setup databases (sqlite3 and MySQL):&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;sudo apt-get install sqlite3 swig libsqlite3-ruby libsqlite3-dev&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo gem install sqlite3-ruby&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo apt-get install mysql-client libmysqlclient15-dev&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;sudo gem install mysql&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Test what have you done:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;rails test_app&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Test the application with MySQL support:&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;rails test-app -d mysql&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Run the application:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 102, 0);"&gt;cd test_app&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 102, 0);"&gt;script/server&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1812969982671387714?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1812969982671387714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/04/put-ruby-on-rails-and-dont-repeat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1812969982671387714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1812969982671387714'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/04/put-ruby-on-rails-and-dont-repeat.html' title='Intstall &quot;Ruby on Rails&quot; on Ubuntu 9.04 and Dont Repeat Yourself Anymore'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-4841248545794515456</id><published>2010-02-27T11:47:00.008+03:30</published><updated>2010-03-02T22:05:39.396+03:30</updated><title type='text'>Parsing Huge Text Files Using Java and JSapar</title><content type='html'>Last week a friend of mine and I decided to parse a huge size text file that consists some reports of legacy devices. After few times trying we got that, opening and parsing huge text files in Java is very time and resource consuming. We started with a 35MB log file. We have never worked with such a huge size text files. So we tried to find the relevant solution. Indeed, Java is not the best solution for this kind of problems. I believe Python or Perl could perform this requirement by a higher performance. However regards to later developments and project requirements we decided to use Java. After some searching through web we found a brilliant tool. &lt;a href="http://tigris.org/"&gt;Tigris.org&lt;/a&gt; has some valueable open source projects. &lt;a href="http://jsapar.tigris.org/"&gt;JSapar&lt;/a&gt; is one of them. &lt;a href="http://jsapar.tigris.org/"&gt;JSapar&lt;/a&gt; is a Java library providing a schema based parser/producer of CSV (Comma Separated Values) and flat files.   The goal of this project is to create a java library that contains a parser of flat files and csv files.&lt;br /&gt;The file imports in to an object oriented model that we called it telegrams. The parser produces a Document class, representing the content of the file, or you can choose to receive events for each line that has been successfully parsed. Tigris claims that JSapar can handle huge files without loading everything into memory.&lt;br /&gt;The library is simple to use and possible to extend. Our log file consists thousands of lines just the same as below sample line:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;948853 : 47 E6 &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;18 FF 04 CD 0B &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;1D B1 C1 D1 1E  ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is a telegram. First part is row number (&lt;span style="color: rgb(0, 102, 0);"&gt;948853&lt;/span&gt;) and next bytes contains a message. This two part are separated by a ":". At first sight it seems it is a straight forward procedure, however, it is not as much easy as it looks. Millions of these lines makes a real slow running and unstable application if you use standard java scaner or parsers. First we defined a schema for csv files:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;schema xmlns="http://jsapar.tigris.org/JSaParSchema/1.0"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;csvschema lineseparator="\n"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;line occurs="*" linetype="Telegram" cellseparator=":"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cell name="Row No" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cell name="Body"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/line&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/csvschema&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/schema&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Then we just used a simple java code to read a 40MB text file into memory in less than 10 seconds.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;    public final void loadTelegrams() throws SchemaException, IOException, JSaParException { &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Document &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;       telegrams;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Reader schemaReader = new FileReader("schema/schema.xml"); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;        Xml2SchemaBuilder xmlBuilder = new Xml2SchemaBuilder(); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;        Reader fileReader = new FileReader("repo/dat.txt"); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;        Parser parser = new Parser(xmlBuilder.build(schemaReader)); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;        telegrams = parser.build(fileReader); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;        fileReader.close(); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;    }  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Using below command we moves whole of the file cell by cell so quickly.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;  telegrams.getLine(i).getCell(j).getStringValue()&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-4841248545794515456?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/4841248545794515456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/last-week-friend-of-mine-decided-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4841248545794515456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4841248545794515456'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/last-week-friend-of-mine-decided-to.html' title='Parsing Huge Text Files Using Java and JSapar'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-8029784787203069704</id><published>2010-02-23T11:11:00.006+03:30</published><updated>2010-02-23T13:04:41.686+03:30</updated><title type='text'>OFBiz, The Apache Open for Business</title><content type='html'>I am writing this to introduce the next generation of web based business applications that I am developing. As you know I used to develop a small J2EE based application that I called it Easy Tracking. Easy Tracking consists inventory, orders and sales applications. Also it has some small features and a rich Ajax based multi-language client. This is more than 4 years that my customers use it as a rental software and data hosting service on my servers. I have gained a lot of valuable experience in this kind of business service providing among the years.&lt;br /&gt;Now, different requests of individual customers makes me interested to use an open source professional business solution. During last months I reviewed a vast of ERP solutions and finely I have decided to use &lt;a href="http://ofbiz.org/"&gt;OFBiz&lt;/a&gt;. &lt;a href="http://ofbiz.org/"&gt;OFBiz&lt;/a&gt; is an Apache product; moreover, I reviewed its architecture and technologies and found them all matured and practical. Actually &lt;a href="http://ofbiz.org/"&gt;OFBiz&lt;/a&gt; is an open source framework to help developers in creating high quality business solutions. Development and customization both are available using straight forward procedures. However, &lt;a href="http://ofbiz.org/"&gt;OFBiz&lt;/a&gt; needs a mass of modification and development to be adapted with most of Iranian business companies requirements. In addition, it doesn't have a Farsi face yet.&lt;br /&gt;After a while I will need a patient rich customer to let me implement his business requirements by the solution and a holding software company who needs to have a localized, reliable and ready to use product.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-8029784787203069704?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/8029784787203069704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/i-am-writing-this-to-introduce-next.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8029784787203069704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/8029784787203069704'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/i-am-writing-this-to-introduce-next.html' title='OFBiz, The Apache Open for Business'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-6895607607871485614</id><published>2010-02-17T09:13:00.012+03:30</published><updated>2010-02-17T14:39:42.776+03:30</updated><title type='text'>Distributed Application Debugging Tips</title><content type='html'>Every distributed application works based on a collaborative environment that consists of services and method calls. Moreover, in a distributed environment almost services are hosted on different platforms and far machines that talks through network. Distribution makes some difficulties in the debugging of this kind of applications.&lt;br /&gt;&lt;br /&gt;During the development of a J2&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;EE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; based core banking software, I as a member of the team have had many struggled challenges for debugging. The solution uses some far, distributed components through network that work together using message queuing following &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SOA&lt;/span&gt;&lt;/span&gt; disciplines.&lt;br /&gt;&lt;br /&gt;DB2 Database, IBM &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;MQ&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, IBM &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Websphere&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; and Swing reach client are talking together using a vast of message sending and receiving. Also architecture uses Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;ESB&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, Spring, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;JMS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; and a vast of configuration files. We have found and fixed most of bugs using below simple techniques.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Use a Map.&lt;/span&gt; Just draw a symbolic map of the environment that causes the problem. Highlight servers, clients, firewalls, routers, with their specific &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; and ports of each one that used in the scenario. May be an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;IP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, a port or a firewall policy has been changed and the problem has arisen. Using Ping and Telnet be sure that service listeners are available at least.&lt;br /&gt;If the service was working and a problem has arisen eventually; then, configuration changing is the most error prone factor.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interpret Log Files.&lt;/span&gt; Review log files and exception messages carefully. Almost every raised exception message points to the problem exactly. In the other hand, logging is not a centralized activity in a layered distributed application. Indeed, each layer or component may logs its exceptions separately. So check them all. Check log files just like a detector and use your imagination to guess  the problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Go Deeper.&lt;/span&gt; Adjust logging level to the proper value to let logger catch more detail messages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Set Break Points to Watch.&lt;/span&gt; Set some break points to watch out what is happening during run time. Be sure messages send and receive by end points correctly. Then, step toward inner layers to find out what happened.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Use Replacements.&lt;/span&gt; Replace the component you suspected in with the correct one to find out if they are working probably. For example, you have another available application server, message queue or database use them regard the situation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Check Configuration Files.&lt;/span&gt; Be sure the build routines has done their tasks perfectly. Maven and Ant write values of variables in the compiled version of configuration files. Such as context.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;xml&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, web.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;xml&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; and other &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;xml&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; files. Lack of privilege or wrong configuration may prevent build process to finish its task completely. So check the compiled and built version of configuration files.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Be Patient.&lt;/span&gt; In a distributed system, method call doesn't perform as much fast as the standalone application. So check if timeout values are enough or not. Sometimes increasing timeout value is a key to solve the problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Do it Faster.&lt;/span&gt;  Faster compiling and running on lighter machines is the an effective approach to test more situations rapidly. So use lighter application servers and databases. For example, use Tomcat over &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;Websphere&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;; Also, use MySQL rather than DB2 during development.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-6895607607871485614?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/6895607607871485614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/distributed-applications-debgging-tips.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/6895607607871485614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/6895607607871485614'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/distributed-applications-debgging-tips.html' title='Distributed Application Debugging Tips'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-4944315425724273370</id><published>2010-02-03T14:13:00.023+03:30</published><updated>2010-02-08T16:42:49.527+03:30</updated><title type='text'>Routing multiple domains to an application using URL rewrite filter in JSP contatiners and JEE application servers</title><content type='html'>&lt;div&gt;My client has assigned two separated domain address to a certain &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;IP&lt;/span&gt; address. My client was going to map two domain addresses to an application which hosted on &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JBoss&lt;/span&gt; 4.2.2.&lt;br /&gt;Each domain address should route &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;requests&lt;/span&gt; to some certain pages of the application.  I had to assign &lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;firstdomain&lt;/span&gt;.com&lt;/span&gt; and &lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;seconnddomain&lt;/span&gt;.com&lt;/span&gt; to the a certain application that I call it "app" here. My task was clear; indeed, I had to implement below mapping:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://firstdomain.com&lt;/span&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; ....&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://1.2.3.4/app/first.html&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://seconddomain.com ....&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0);"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; http://1.2.3.4/app/repo/second.html&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;As you can see, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;IP&lt;/span&gt; and application name are the common parts and inner paths goes different. I used &lt;a href="http://tuckey.org/urlrewrite/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;UrlRewriteFilter&lt;/span&gt;&lt;/a&gt; that simulates Apache rewrite URL method in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;JSP&lt;/span&gt; containers and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;JEE&lt;/span&gt; app servers. It is just enough to follow the instruction. &lt;span style="font-style: italic; color: rgb(0, 102, 0);" class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;UrlRewriteFilter&lt;/span&gt; has a vast of samples but I have not found the proper rule that maps different &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;url&lt;/span&gt; on a certain &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;IP&lt;/span&gt; address. So, after some tries and errors; finally, below rule worked for me:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;rule&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span" style="font-style: normal; "&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;name&amp;gt;Changing Domain&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;/name&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;condition name="host" operator="equal"&amp;gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;firstdomain&lt;/span&gt;.com&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;/condition&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;from&amp;gt;^/(.*)&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;/from&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;to type="permanent-redirect"&amp;gt;http://1.2.3.4/app/repo/second.html$1&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;/to&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;i&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:small;"&gt;&amp;lt;&lt;/span&gt;/rule&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;This is just enough to add above rule into the &lt;span style="color: rgb(0, 102, 0); font-style: italic;" class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;urlrewrite&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-style: italic;"&gt;.&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-style: italic;" class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;xml&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-style: italic;"&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;first.html&lt;/span&gt; is the default page. So you just need to handle the request which comes to the &lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;seconddomain&lt;/span&gt;.com&lt;/span&gt;. I have got my routing goals on Tomcat 6.0 and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;JBoss&lt;/span&gt; 4.2.2 with this simple URL re-writing.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-4944315425724273370?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/4944315425724273370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/client-that-i-worked-for-assigned-two.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4944315425724273370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4944315425724273370'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/client-that-i-worked-for-assigned-two.html' title='Routing multiple domains to an application using URL rewrite filter in JSP contatiners and JEE application servers'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-6888566005544925236</id><published>2010-02-02T10:01:00.010+03:30</published><updated>2010-02-02T14:43:27.968+03:30</updated><title type='text'>Why I use Google Docs</title><content type='html'>Following extending an office automation, I worked on Apache Jackrabbit content repository some years ago. After it, I was looking for a free personal content repository to keep my documents, sample codes and commands over HTTP. Something just like a personal wiki, personal blog or a repository.&lt;br /&gt;I preferred to use a free one that supported by the web giants such as Google and Yahoo. Finally, I have found it. My friends in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Facebook&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; suggested me to try &lt;a href="http://docs.google.com/"&gt;Google Documents&lt;/a&gt; two weeks ago. Google Docs is exactly the tool I was looking for. Google means this is improving faster and wiser than others. Moreover, Google Documents is the most interesting tool that I found in the Google shelf. It works very fast; moreover, it is pretty much. Google Docs enables me to keep my valuable documents in a safety box on WWW. I shared some documents with the trusted friends of mine. Also, a friend and I are using Google Docs in an amazing way to keep synchronize together around an educational program. In addition, Google Docs, keeps all revisions on modifications. In fact, you can track the document growing life cycle. In my opinion every body should have his or her Google Documents account because of below reasons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Your knowledge is always accessible.&lt;/li&gt;&lt;li&gt;You don't need to care about hard disk failures and viruses attack any more.&lt;/li&gt;&lt;li&gt;You can edit your documents as well as possible just using a browser.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Google Docs is a repository so, all changes are traceable.&lt;/li&gt;&lt;li&gt;Google Docs Sharing mechanism works pretty secured.&lt;/li&gt;&lt;li&gt;I don't care about currently 1024 MB capacity limitation. Google is growing always.&lt;/li&gt;&lt;li&gt;Good feeling of extending my memory using Google Docs features is another special kind of experience that I gain by using Google Documents. You will never loose it if you keep it by Google Documents.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-6888566005544925236?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/6888566005544925236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/all-ways-i-use-google-documents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/6888566005544925236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/6888566005544925236'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/all-ways-i-use-google-documents.html' title='Why I use Google Docs'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-4214399659145044272</id><published>2010-02-01T15:04:00.007+03:30</published><updated>2010-02-02T11:01:36.379+03:30</updated><title type='text'>Good points for putting breaks across Mule ESB classes</title><content type='html'>This is the second year that I work as a J2&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;EE&lt;/span&gt; developer during development of a modern J2&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;EE&lt;/span&gt; based core banking project. The architecture uses Spring and Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ESB&lt;/span&gt; as its major components widely. Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;ESB&lt;/span&gt; (Enterprise Service Bus) allows us to connect the applications together as much simple as possible. The architecture uses Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;ESB&lt;/span&gt; as integration platform and service container. Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;ESB&lt;/span&gt; provides some easy to use methods for talking through &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JMS&lt;/span&gt;, HTTP, FTP and many more transfer protocols. Moreover, Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;ESB&lt;/span&gt; implemented a set of relevant mechanisms for message routing, message transformation and transaction management. However, debugging the started services which use Mule &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;ESB&lt;/span&gt; functionalities is not an easy activity. Because there is a lot of layered listeners and complex network devices/services which make problems bolder. The framework we used is a well design art work of my friend, Ara &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;Abrahamian&lt;/span&gt; and it works like a Mercedes Benz in most of areas. But, the modules added by developers almost have some problems. I noticed most of problems that we raise, has the origin in the wrong configuration files such as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;muleesb&lt;/span&gt;-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;config&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;xml&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;Spring's&lt;/span&gt; context.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;xml&lt;/span&gt;. Also, below classes could be a good place  to start debugging:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;JmsMessageDispatcher&lt;/span&gt;.java&lt;/li&gt;&lt;li&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;JmsMessageConsumerImpl&lt;/span&gt;.java&lt;/li&gt;&lt;/ul&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;JmsMessageDispatcher&lt;/span&gt; is the the most outer place just before sending message. Also, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;JmsMessageConsumerImpl&lt;/span&gt; is the first &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;JMS&lt;/span&gt; message receiver.&lt;br /&gt;&lt;br /&gt;In my experience debugging this two classes is an easy way to find what happened to the code or underlying services malfunctions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-4214399659145044272?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/4214399659145044272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/02/best-break-point-places-in-mule-esb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4214399659145044272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/4214399659145044272'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/02/best-break-point-places-in-mule-esb.html' title='Good points for putting breaks across Mule ESB classes'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-1506207018409213727</id><published>2010-01-31T21:13:00.016+03:30</published><updated>2010-02-02T11:06:36.280+03:30</updated><title type='text'>JBoss container managed basic authentication</title><content type='html'>These days I am working on an ACS (Automatic Configuration System) which runs on a JBoss app server. So, yesterday I configured the server for cotnainer-managed authentication. Here is a straight forward tutorial to demonstrate how to secure your applications which hosted in JBoss by BASIC authentication methods. Container-managed authentication methods control how a user's credentials are verified when a web app's protected resource is accessed. This is a straight forward tutorial that shows how to configure JBoss application server to protect resources by a role based simple mechanism. By receiving any request to the protected resources JBoss asks web browser for a username and password. With this authentication method, all passwords are sent across the network in base64-encoded text. This could be fine to review the commented parts of JBoss configurations to find some more facilities If you need.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;First step&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;, web.xml modifications&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Find the web.xml in the WEB-INF folder of your deployed ear application. This could be find in somewhere like this depends on the OS you use. Add below lines at the bottom of web.xml just before  tag.&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;security-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;web-resource-collection&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;                &amp;lt;web-resource-name&amp;gt;ossmanager&amp;lt;/web-resource-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;                &amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;/web-resource-collection&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;auth-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;                &amp;lt;role-name&amp;gt;ossmanager&amp;lt;/role-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;/auth-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;user-data-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;                &amp;lt;transport-guarantee&amp;gt;NONE&amp;lt;/transport-guarantee&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;/user-data-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;/security-constraint&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;login-config&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;realm-name&amp;gt;OSS Security&amp;lt;/realm-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;/login-config&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;security-role&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;description&amp;gt;ossmanager is the role required to access under oss&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;role-name&amp;gt;ossmanager&amp;lt;/role-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;/security-role&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;security-role&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;description&amp;gt;cpeowner is the role required to access under cpeowner&amp;lt;/description&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;        &amp;lt;role-name&amp;gt;cpeowner&amp;lt;/role-name&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;"&gt;&amp;lt;/security-role&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Second step&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;, joss-web.xml modifications&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Right besides web.xml in the WEB-INF folder you can find jboss-web.xml to add below lines in. Note, datak-oss is the context of the application and acs-security-policy is the optional name that you call your security policy using it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;jboss-web&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;   &amp;lt;context-root&amp;gt;datak-oss&amp;lt;/context-root&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;   &amp;lt;security-domain&amp;gt;java:/jaas/acs-security-policy&amp;lt;/security-domain&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/jboss-web&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Third step&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;, login-config.xml modifications&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Find login-config.xml in server/default/conf folder and add below lines at the proper place.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;lt;application-policy name ="acs-security-policy" &amp;gt;&lt;br /&gt;&amp;lt;authentication&amp;gt;&lt;br /&gt;     &amp;lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"&amp;gt;&lt;br /&gt;             &amp;lt;module-option name="usersProperties"&amp;gt;acs-users.properties&amp;lt;/module-option&amp;gt;&lt;br /&gt;             &amp;lt;module-option name="rolesProperties"&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;acs&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;-roles.properties&amp;lt;/module-option&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;           &amp;lt;/login-module&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;   &amp;lt;/authentication&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/application-policy&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Create acs-users.properties and acs-roles.properties text files into the WEB-INF/classes/ the same as below:&lt;br /&gt;&lt;br /&gt;acs-users.properties:&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;span style="color: rgb(0, 51, 0);"&gt;&lt;br /&gt;amir=takeiteasy&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0);"&gt;kamran=mamooshi&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;acs-roles.properties:&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt; amir=ossmanager,cpe&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;owner&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;kamran=cpeowner&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;&lt;span&gt;Exclude a URL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; by adding a blank security-constraint&lt;/span&gt;&lt;br /&gt;I added this part two days later. Because the project manager asked me to exclude a certain URL (/cpe) from the secured zone. I have performed it just adding a new without role constraint. Below code added an excluded path to the secured zone, which every anonymous user can access it.  Add below security-constraint to the web.xml the same as security-constraint that you added before.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;security-constraint&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;web-resource-collection&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;web-resource-name&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;CPE&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;/web-resource-name&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;url-pattern&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;/cpe/*&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;/url-pattern&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;web-resource-collection&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;security-constraint&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-1506207018409213727?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/1506207018409213727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/01/jboss-managed-authentication-in-10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1506207018409213727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/1506207018409213727'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/01/jboss-managed-authentication-in-10.html' title='JBoss container managed basic authentication'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-3404208012835072232</id><published>2010-01-30T10:53:00.006+03:30</published><updated>2010-02-02T11:12:49.763+03:30</updated><title type='text'>Make programming a bit easier in Linux</title><content type='html'>Restarting services or killing them are the must repeated activities that I have to do during current project. Running maven commands and deleting '.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;svn&lt;/span&gt;' folders are so easy but those take time too. By the other hand all of them should accomplish in the operating system shell. Sometimes more than ten times per a day I have ran this commands. Moreover, everyone knew that it could be much easier to develop simple Linux bash scripts or define Aliases which contains more usage commands. Then, I developed below scripts and define some aliases to make it easier.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;killj&lt;/span&gt;.sh is a bash script which kills my Java processes that consists '&lt;span class="Apple-style-span"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;javaagent&lt;/span&gt;' keyword. The application needs &lt;/span&gt;'&lt;span class="Apple-style-span"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;javaagent&lt;/span&gt;' as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;VM&lt;/span&gt; parameter; so, I am looking for it to kill the right process.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);font-size:85%;" &gt;&lt;i&gt;#!/bin/bash&lt;br /&gt;for i in `&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;ps&lt;/span&gt; -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;ef&lt;/span&gt; | grep &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;javaagent&lt;/span&gt; | cut -c10-14`&lt;br /&gt;do&lt;br /&gt;/bin/kill $i&lt;br /&gt;echo " $i has killed."&lt;br /&gt;done&lt;br /&gt;if [ $(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;ps&lt;/span&gt; ax | grep -c &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;javaagent&lt;/span&gt;) -gt 1 ] ; then&lt;br /&gt;echo "NOTE: There are more alive java process yet!!!"&lt;br /&gt;else&lt;br /&gt;echo "DONE"&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;fi&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;rmsvn&lt;/span&gt;.sh removes .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;svn&lt;/span&gt; folders recursively.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;#!/bin/bash&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;echo&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;echo "Warning!!!"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;echo "CHECK BELOW PATH. This will remove all .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;svn&lt;/span&gt; folders recursively!!!"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;pwd&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;read -p "Are you sure (yes/no)? "&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;[ "$REPLY" == "yes" ] &amp;amp;&amp;amp; rm -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;rf&lt;/span&gt; `find . -type d -name .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;svn&lt;/span&gt;` &amp;amp;&amp;amp; echo "all .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;svn&lt;/span&gt; folders have been removed!!!"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Also I added below lines at the end of .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;bashrc&lt;/span&gt; file:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 51, 0);"&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;lt&lt;/span&gt;='ls -alt | head -20'&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;ld&lt;/span&gt;="ls -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;al&lt;/span&gt; -d * | &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;egrep&lt;/span&gt; '^d'"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias c="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;mvn&lt;/span&gt; clean"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;ci&lt;/span&gt;="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;mvn&lt;/span&gt; -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;Pdev&lt;/span&gt; -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;DskipTests&lt;/span&gt; clean install"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias i="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;mvn&lt;/span&gt; -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;Pdev&lt;/span&gt; -&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;DskipTests&lt;/span&gt; install"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;jkill&lt;/span&gt;="/bin/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;killj&lt;/span&gt;.sh"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;rmsvn&lt;/span&gt;="/bin/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;rmsvn&lt;/span&gt;.sh"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias go="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;cd&lt;/span&gt; /home/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;amir&lt;/span&gt;/projects/company/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;jcb&lt;/span&gt;2"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;dpiproxy&lt;/span&gt;="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;sudo&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40"&gt;cp&lt;/span&gt; -f /etc/tor/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41"&gt;torrc&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42"&gt;dpi&lt;/span&gt; /etc/tor/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_43"&gt;torrc&lt;/span&gt;"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_44"&gt;noproxy&lt;/span&gt;="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_45"&gt;sudo&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_46"&gt;cp&lt;/span&gt; -f /etc/tor/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_47"&gt;torrc&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_48"&gt;noproxy&lt;/span&gt; /etc/tor/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_49"&gt;torrc&lt;/span&gt;"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size:85%;"&gt;&lt;i&gt;alias tor="&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_50"&gt;sudo&lt;/span&gt; /etc/init.d/tor restart"&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: rgb(0, 0, 0);"&gt;Now, compiling, cleaning and killing processes are much easier...&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-3404208012835072232?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/3404208012835072232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/01/going-bit-faster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3404208012835072232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/3404208012835072232'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/01/going-bit-faster.html' title='Make programming a bit easier in Linux'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4249852743259802437.post-849921813231665974</id><published>2010-01-29T15:05:00.010+03:30</published><updated>2010-02-06T18:59:58.042+03:30</updated><title type='text'>Port mapping in Linux in Ubuntu and CentOS</title><content type='html'>If you used to setup web servers under windows easily, you will find Linux doesn't show itself bared on the network. Indeed, Linux has its own secured solutions to let your web servers listen to the 80 port. In fact, you can not use the ports under 1024 for the individual users. Because they belongs to the super user. Moreover, its recommended to run web servers with a limited user. So, the best way to run HTTP listeners on 80 port is to map upper than 1024 ports 80 port.&lt;br /&gt;Last week I worked with a JBoss application server which has ran on 8080 port. In addition, the client needed to run it on 80 port, without any modification on JBoss settings. I make it so easily by running 3 iptable commands which I found in some tutorials on the web.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);font-size:85%;" &gt;sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);font-size:85%;" &gt;sudo iptables -I INPUT -p tcp --dport 8080 -j ACCEPT&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);font-size:85%;" &gt;sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8080&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;NOTE: if you dont put  &lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt; -o lo  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;option&lt;/span&gt; for the last command, all outgoing requestes will rout to the 8080 port on the localhost.&lt;br /&gt;&lt;br /&gt;Finally you should save new rules into disk. below command persists changes.&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 51, 0); font-style: italic;font-size:85%;" &gt;sudo iptables-save &gt;  iptable.rules&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Moreover you need to make sure rules will loaded in the next start up. So, add  below line into  &lt;span style="color: rgb(0, 51, 0);"&gt;/etc/network/interfaces&lt;/span&gt;  after iface command:&lt;br /&gt;&lt;span style="color: rgb(0, 51, 0);"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;pre-up iptables-restore &lt; /etc/iptable.rules &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you are using CentOS then it is enough to run below command to persist iptables rules:&lt;br /&gt;&lt;br /&gt;&lt;pre class="screen"&gt;&lt;code class="command"&gt;&lt;span style="font-style: italic; color: rgb(0, 51, 0);"&gt;/sbin/service iptables save&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Restart the network connection and enjoy it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4249852743259802437-849921813231665974?l=ezroad.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ezroad.blogspot.com/feeds/849921813231665974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ezroad.blogspot.com/2010/01/mapping-nat-ports-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/849921813231665974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4249852743259802437/posts/default/849921813231665974'/><link rel='alternate' type='text/html' href='http://ezroad.blogspot.com/2010/01/mapping-nat-ports-in-linux.html' title='Port mapping in Linux in Ubuntu and CentOS'/><author><name>Amir Sedighi</name><uri>http://www.blogger.com/profile/03707143726303711368</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://4.bp.blogspot.com/_Evrx4lw_lsM/S2P1S3zvmhI/AAAAAAAAAAs/2iVVFVOayKI/S220/aFIS_7300.JPG'/></author><thr:total>0</thr:total></entry></feed>
