<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>xandrev.com</title>
	<atom:link href="http://xandrev.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://xandrev.com</link>
	<description></description>
	<lastBuildDate>Mon, 05 Mar 2012 08:00:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Organize TV Shows Downloads &#8211; 0.1</title>
		<link>http://xandrev.com/2012/03/organize-tv-shows-downloads-0-1/</link>
		<comments>http://xandrev.com/2012/03/organize-tv-shows-downloads-0-1/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 21:24:57 +0000</pubDate>
		<dc:creator>xandrev</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[TV Shows]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://xandrev.com/?p=23</guid>
		<description><![CDATA[I&#8217;m writing this post because I want to introduce to you the last software I develop. This application comes for a reason: &#8220;I can&#8217;t organize all the chapters that I download of every TV show and because of that I always lost some files and I need to be downloaded. Because of that I&#8217;ve tried [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing this post because I want to introduce to you the last software I develop. This application comes for a reason:</p>
<p>&#8220;I can&#8217;t organize all the chapters that I download of every TV show and because of that I always lost some files and I need to be downloaded. Because of that I&#8217;ve tried to do an app that do this hard work instead of me.&#8221;</p>
<p>If you follow some TV Shows by the internet, sure you know that all the files of the shows (ripped by the main groups (eztv, LOL, or something like that)) have the same simple pattern:</p>
<p>&nbsp;</p>
<blockquote><p>TV Show Name.Season.Chapter.Quality.Extension</p>
<p>&nbsp;</p>
<p>&nbsp;</p></blockquote>
<p>Following this pattern and this idea this app only do a analysis in the download folder where my prefered app downloads the shows. Once these files have been detected the app distribute them in some folders, one for each tv show so I can have all the chapters of a show in a same folder and separated by the others tv shows. With this thoughts born &#8220;Organize TV Shows Downloads&#8221;.</p>
<p><span id="more-23"></span></p>
<p><a href="http://xandrev.com/wp-content/uploads/2012/03/organizeTVDownloads.py_001.png"><img class="aligncenter size-full wp-image-33" title="organizeTVDownloads.py_001" src="http://xandrev.com/wp-content/uploads/2012/03/organizeTVDownloads.py_001.png" alt="" width="402" height="425" /></a></p>
<p>The application is developed in Pyhon and it only has one window with no many options, so you can choose the following options:</p>
<ul>
<li><span style="line-height: 18px;">Download folder: The folder where the chapters of your favourites tv shows are placed.</span></li>
<li><span style="line-height: 18px;">Output folder: The root folder where the chapters must be placed with a folder for each tv show.</span></li>
<li><span style="line-height: 18px;">Extensions used: You can specify the list of file extensions of the files that will been trasfered of the new location (you can include AVI Files, Subtitles files and all the stuff you need).</span></li>
</ul>
<div><span style="line-height: 18px;">Specifying this options and pushing the button &#8220;Convert&#8221; will be the moved of the files of a new tree structure of your media files.</span></div>
<div></div>
<div>So, I want to finish with an example:</div>
<div></div>
<div>
<ol>
<li><span style="line-height: normal;">Suppose that you have a folder with this content:</span></li>
</ol>
<div><img class="size-full wp-image-30 aligncenter" title="Selection_003" src="http://xandrev.com/wp-content/uploads/2012/03/Selection_003.png" alt="" width="337" height="470" /></div>
<div></div>
<div></div>
<ol>
<li><span style="line-height: normal;">After invoke the application I&#8217;m explained in this post, you will have this final structure:</span></li>
</ol>
<div><a href="http://xandrev.com/wp-content/uploads/2012/03/Selection_004.png"><img class="size-full wp-image-31 aligncenter" title="Selection_004" src="http://xandrev.com/wp-content/uploads/2012/03/Selection_004.png" alt="" width="189" height="78" /></a></div>
</div>
<div></div>
<div></div>
<div>I must say this is an home-application but I want to share it with all the world so I uploaded the code and the app in my account in Launchpad so you can access to it in this URL: <a href="https://launchpad.net/organizetvshowdownloads">https://launchpad.net/organizetvshowdownloads</a>. If anyone is interested in doing some improvement I will be happy to do the updates that I think will be useful for many people.</div>
]]></content:encoded>
			<wfw:commentRss>http://xandrev.com/2012/03/organize-tv-shows-downloads-0-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Realizing tests in JUnit when EJB are involucred</title>
		<link>http://xandrev.com/2011/12/realizing-tests-in-junit-when-ejb-are-involucred/</link>
		<comments>http://xandrev.com/2011/12/realizing-tests-in-junit-when-ejb-are-involucred/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 13:00:32 +0000</pubDate>
		<dc:creator>xandrev</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[ejb3unit]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://xandrev.com/?p=19</guid>
		<description><![CDATA[In many cases when you are testing java software that you develop, you must do some unit testing using famous testing framework such as JUnit or TestNG. This testing process allowed you to do a great testing cases and automatic all the process but there is some problems when your program includes non-standard Java SE [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">In many cases when you are testing java software that you develop, you must do some unit testing using famous testing framework such as JUnit or TestNG. This testing process allowed you to do a great testing cases and automatic all the process but there is some problems when your program includes non-standard Java SE classes. This is the cases when you use EJB.</p>
<p style="text-align: justify;">The EJB artifacts are Java components that in the modern times (forget about the 2.1 version!!) support dependency injection. So, when the EJB container is in execution, it has the goal to instance the EJB and all its dependencies and give to us an &#8220;completed object&#8221; when all the dependencies set, but you don&#8217;t have any EJB container when you are running your JUnit test, so what you can do? Ok, there is a free software library which can help us with that. The name of the project is the following: Ejb3Unit, and you can get it by these URL: http://ejb3unit.sourceforge.net/.</p>
<p style="text-align: justify;"><span id="more-19"></span></p>
<p style="text-align: justify;">This library supports dependency injection and provides testing capabilities with your session beans and entities. It&#8217;s very simple to use, here is an example of a session bean test in Junit:
</p>
<pre class="wp-code-highlight prettyprint">public class DIFieldSessionBeanTest extends BaseSessionBeanFixture&amp;lt;MySessionBean&amp;gt; {

	private static final Class[] usedBeans = { };

	public DIFieldSessionBeanTest() {
		super(MySessionBean.class, usedBeans);
	}

	public void testDependencyInjection() {
		final MySessionBean toTest = this.getBeanToTest();
		assertNotNull(toTest);
		assertNotNull(toTest.getDs());
		assertNotNull(toTest.getEm());
	}</pre>
<p>&nbsp;</p>
<p style="text-align: justify;">When your Session is coded with the name of MySessionBean, so you can see it&#8217;s very easy to use this library and very useful.</p>
<p style="text-align: justify;">
<p style="text-align: justify;">So, one tip. Please, do not provider a setup method (NOT @Before annotation) because in this case the injection fails and it&#8217;s not worker properly. If you want to do some preparations, use the public constructor of the test, not a @Before method.</p>
]]></content:encoded>
			<wfw:commentRss>http://xandrev.com/2011/12/realizing-tests-in-junit-when-ejb-are-involucred/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First approach to JMX with sample code</title>
		<link>http://xandrev.com/2011/11/first-approach-to-jmx-with-sample-code/</link>
		<comments>http://xandrev.com/2011/11/first-approach-to-jmx-with-sample-code/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 23:48:24 +0000</pubDate>
		<dc:creator>xandrev</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[jee]]></category>
		<category><![CDATA[jmx]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://xandrev.com/?p=12</guid>
		<description><![CDATA[In this post I want to introduce JMX, a &#8220;new&#8221; (it&#8217;s not very very new, as it becomes a part of the JEE 5.0 standard, but it is very unknown) technology in the Java World. The main goal of the JMX technology is provide a simple, standard way of managing resources such as applications, devices, [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I want to introduce JMX, a &#8220;new&#8221; (it&#8217;s not very very new, as it becomes a part of the JEE 5.0 standard, but it is very unknown) technology in the Java World. The main goal of the JMX technology is provide a simple, standard way of managing resources such as applications, devices, and services. Because the JMX technology is dynamic, you can use it to monitor and manage resources as they are created, installed and implemented. You can also use the JMX technology to monitor and manage the Java Virtual Machine (Java VM).</p>
<p>You can use this technology to measure resources of your Java project, such as, number of threads alive, memory consumption and every thing you want to measure, and you can use the JConsole to get an interaction with the kind of resources.<span id="more-12"></span></p>
<p>The main part of this technology is the <em>MBean</em>. As we can see in the Java documentation:</p>
<blockquote><p>A standard MBean is defined by writing a Java interface called <code>SomethingMBean</code> and a Java class called <code>Something</code> that implements that interface. Every method in the interface defines either an attribute or an operation in the MBean. By default every method defines an operation. Attributes and operations are simply methods which follow certain design patterns. A standard MBean is composed of the MBean interface which lists the methods for all exposed attributes and operations, and the class which implements this interface and provides the functionality of the instrumented resource.</p>
<p>&nbsp;</p></blockquote>
<p>So, you will use this kind of artifacts to define the attributes and the methods you can use to interact with the rest of your application. Now, we are going to define an example with the name HelloMBean:</p>
<pre class="wp-code-highlight prettyprint">public class Hello implements HelloMBean {
    public void sayHello() {
	System.out.println(&quot;hello, world&quot;);
    } 

    public int add(int x, int y) {
	return x + y;
    } 

    public String getName() {
	return this.name;
    } 

    public int getCacheSize() {
	return this.cacheSize;
    } 

    public synchronized void setCacheSize(int size) {
	this.cacheSize = size; 

	System.out.println(&quot;Cache size now &quot; + this.cacheSize);
    } 

    private final String name = &quot;Reginald&quot;;
    private int cacheSize = DEFAULT_CACHE_SIZE;
    private static final int DEFAULT_CACHE_SIZE = 200;
}</pre>
<p>This is the interface of the MBean and now, you need to do a java implementation:</p>
<pre class="wp-code-highlight prettyprint">public interface HelloMBean { 

    public void sayHello();
    public int add(int x, int y); 

    public String getName(); 

    public int getCacheSize();
    public void setCacheSize(int size);
}</pre>
<p>So we have now all the parts of the bean created, but we need to implement a JMX agent, so the JMX clients like JConsole cand stablish a connection to our application so it can be controlled by it. The code must be something like that:</p>
<pre class="wp-code-highlight prettyprint">import java.lang.management.*;
import javax.management.*; 

public class Main { 

   public static void main(String[] args) throws Exception { 

      MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); 

      ObjectName name = new ObjectName(&quot;com.example.mbeans:type=Hello&quot;); 

      Hello mbean = new Hello(); 

      mbs.registerMBean(mbean, name); 

      System.out.println(&quot;Waiting forever...&quot;);
      Thread.sleep(Long.MAX_VALUE);
   }
}</pre>
<p>&nbsp;</p>
<p>When you do something like that, and you start this Main program, you can use a JConsole instance to do a connection with our implementation, like we can see in this screenshot:</p>
<p><a href="http://xandrev.com/wp-content/uploads/2011/11/Screenshot-at-2011-11-20-004122.png"><img class="alignnone size-full wp-image-16" title="Screenshot at 2011-11-20 00:41:22" src="http://xandrev.com/wp-content/uploads/2011/11/Screenshot-at-2011-11-20-004122.png" alt="" width="709" height="331" /></a></p>
<p>As you can see, you can invoke the operation you defined as part of your interface. And you can refresh the values of the attributes defined in the implementation.</p>
]]></content:encoded>
			<wfw:commentRss>http://xandrev.com/2011/11/first-approach-to-jmx-with-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JiBX extras inside the JiBX Eclipse Plugin</title>
		<link>http://xandrev.com/2011/11/using-jibx-extras-inside-the-jibx-eclipse-plugin/</link>
		<comments>http://xandrev.com/2011/11/using-jibx-extras-inside-the-jibx-eclipse-plugin/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 21:48:03 +0000</pubDate>
		<dc:creator>xandrev</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jibx]]></category>
		<category><![CDATA[woraround]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://xandrev.com/?p=4</guid>
		<description><![CDATA[JiBX is a Java library that allows you to convert Java objets into a XML files that provides a great performance in comparation with other Java libraries such as XStream. The main difference between JiBX and the other Java libraries is that JiBX modifies the class files generated by the javac compiler and it adds [...]]]></description>
			<content:encoded><![CDATA[<p>JiBX is a Java library that allows you to convert Java objets into a XML files that provides a great performance in comparation with other Java libraries such as XStream.</p>
<p>The main difference between JiBX and the other Java libraries is that JiBX modifies the class files generated by the javac compiler and it adds some bytecodes which contains some methods that are used when you do the convertions between class file and xml file.</p>
<p><span id="more-4"></span></p>
<p>The only thing you must do to use this is define a XML document where you specify the mapping between the class file and the XML file output.</p>
<p><a href="http://xandrev.com/wp-content/uploads/2011/11/example1.gif"><img class="alignnone size-full wp-image-6" title="example1" src="http://xandrev.com/wp-content/uploads/2011/11/example1.gif" alt="" width="578" height="296" /></a></p>
<p>And how these kind of libraries works integrated with you usual IDE? That&#8217;s a good question. First of all it has a eclipse plugin that allows to do this post-compilation phase in a easy ways for the developers, but it has some limitations.</p>
<p>The main distribution of a JiBX contains only one JAR File: jibx-run-&lt;version&gt;.jar that contains the classes to use the main features of the libraries. In addition to this library, the jibx distribution contains another JAR file which contains the clasess that are needed to do the post-compiilation file in the clasess you want to convert into XML files.</p>
<p>These are the two files that are included in the eclipse plugin but it exists another JAR file named jibx-extras-&lt;version&gt;.jar that allows you to include advanced features, but when you use some of the features you have a problem when you use the eclispe plugin because you will get an ClassNotDefFoundError because this jar is not included by default in the eclipse plugin. But you have a way to solve it.</p>
<p><code>Error: Unmarshaller class org.jibx.extras.HashMapperStringToComplex not found; on structure element at (line 5, col 164, in binding.xml)<br />
Error running binding compiler<br />
org.jibx.runtime.JiBXException: Binding binding.xml is unusable because of validation errors</code></p>
<p>You must include this JAR File in the build path of your project but not the &#8220;easy&#8221; way. This JAR must be included as an External JAR so its path must be an absolute path. We don&#8217;t know the reason of this little &#8220;hack&#8221; but it&#8217;s the only workaround to get it work!. It happends at least in version 1.2.3 of the JiBX Java Library.</p>
<p>If you are using maven you don&#8217;t have none of this problem, because Maven always use absolute paths of the local repository of JAR files.</p>
<p>&nbsp;</p>
<p>References</p>
<p>[1] &#8211; JiBX Home Page - <a href="http://jibx.sourceforge.net/">http://jibx.sourceforge.net/</a></p>
<p>&nbsp;</p>
<p>[2] &#8211; JiBX Tutoria . <a href="http://jibx.sourceforge.net/tutorial/binding-start.htm">http://jibx.sourceforge.net/tutorial/binding-start.htm</a>l</p>
]]></content:encoded>
			<wfw:commentRss>http://xandrev.com/2011/11/using-jibx-extras-inside-the-jibx-eclipse-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.907 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-19 19:51:58 -->

