<?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>Michele Rizzi Web PageMichele Rizzi Web Page &#187; Software engineering, architectures and distribuited systems (16)</title>
	<atom:link href="https://www.rizzimichele.it/arguments/ingsw/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rizzimichele.it</link>
	<description>Passion of IT</description>
	<lastBuildDate>Mon, 05 Dec 2016 20:53:30 +0000</lastBuildDate>
	<language>en-GB</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.8.41</generator>
	<item>
		<title>Hadoop Big Data</title>
		<link>https://www.rizzimichele.it/hadoop-big-data/</link>
		<comments>https://www.rizzimichele.it/hadoop-big-data/#comments</comments>
		<pubDate>Sat, 19 Nov 2016 10:19:01 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=1075</guid>
		<description><![CDATA[This week I got a chance of studying big data and Hadoop and I&#8217;ve written this short document What is big data? Big data is large amount of data to store and process on the server. They can be the user activities of big applications such as social media (facebook), search engines (google), Internet of [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>This week I got a chance of studying big data and Hadoop and I&#8217;ve written this short document</p>
<p><strong>What is big data?</strong></p>
<p>Big data is large amount of data to store and process on the server.</p>
<p>They can be the user activities of big applications such as social media (facebook), search engines (google), Internet of things (sensors, machines, transports etc)</p>
<p>Today 1TB hard drive costs around 50 euro so it&#8217;s cheap storing large amount of data but processing it requires long time using SQL database and NoSQL databases are better way for storing these informations and also they are other frameworks for processing them such as Hadoop.</p>
<p><strong>Big Data technologies</strong></p>
<p>There are two classes of technologies to handle big data, they are complementary and usually used together:</p>
<ul>
<li><strong>Operational big data</strong>: technologies for storing and processing the big data: NoSQL databases</li>
<li><strong>Analytical Big Data</strong>: Systems for Massive Parallel Processing such as Hadoop</li>
</ul>
<p><strong>Google Hadoop</strong></p>
<p>in the usual client-server approach we have a client that gets the information from the database.</p>
<p>Hadoop splits the task in small parts assigning each one to a computer connected to the network and connects all the information afterward.This is the MapReduce algorithm.</p>
<p>This means that Hadoop has the below components:</p>
<ul>
<li>his own distributed file system called HDFS: it&#8217;s made of masters NameNode which manages many slaves nodes DataNodes. A file is divided into many blocks stored in set of DataNode. NameNode makes the mapping between the file and the block</li>
<li>his own common libraries</li>
<li>the framework called YARN</li>
<li>the map reduce algorithm: made by a Map task which converts the input in a map and a Reduce task which splits the map in a smaller set of tuple. The map reduce Algorithm has a single master called Job Tracker responsible for resource management and scheduling jobs, and a slave TaskTraker which executes the task</li>
</ul>
<p>Hadoop works as below:</p>
<ul>
<li>the user submits a job to Hadoop with a input/output elements, a MapReduce algorithm, the job configuration</li>
<li>the jobTraker takes the responsibility of the job submitting it to the slaves</li>
<li>the task traker executes its task</li>
</ul>
<p><a href="http://hadoop.apache.org/docs/r3.0.0-alpha1/hadoop-project-dist/hadoop-common/SingleCluster.html">Here is a guide on how to install Hadoop</a></p>
<p><a href="http://hadoop.apache.org/docs/r3.0.0-alpha1/hadoop-project-dist/hadoop-common/FileSystemShell.html">Here is a list of the hadoop file system commands</a></p>
<p>I tested a couple of commands: mkdir and ls, they work fine</p>
<p>Finally I&#8217;ve written a simple map reduce example:</p>
<p><a href="http://hadoop.apache.org/docs/r3.0.0-alpha1/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html">Here is an example of the MapReduce algorithm</a></p>
<pre>

package com.michele.rizzi.hadoop;
import java.io.IOException;
import java.util.StringTokenizer;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class WordCount {

public static class TokenizerMapper
extends Mapper&lt;Object, Text, Text, IntWritable&gt;{

private final static IntWritable one = new IntWritable(1);
private Text word = new Text();

public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
StringTokenizer itr = new StringTokenizer(value.toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
context.write(word, one);
}
}
}

public static class IntSumReducer
extends Reducer&lt;Text,IntWritable,Text,IntWritable&gt; {
private IntWritable result = new IntWritable();

public void reduce(Text key, Iterable&lt;IntWritable&gt; values,
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
context.write(key, result);
}
}

public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "word count");
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}

</pre>
<p>&nbsp;</p>
<p>The mapper sets all words in the context with key=word, value=1.</p>
<p>if the text file is like the one below</p>
<blockquote><p>Michele Michele Rizzi</p></blockquote>
<p>the context at the end of the mapper method will have</p>
<p>key:Michele, value:1</p>
<p>key:Michele value:1</p>
<p>key=Rizzi value:1</p>
<p>&nbsp;</p>
<p>The reducer automatically groups the items with the same key, the input parameters will be</p>
<p>key=&#8221;Michele&#8221; values={1,1}</p>
<p>key=&#8221;Rizzi&#8221; values={1}</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Difference Flink Hadoop</strong></p>
<p>Map/Reduce is a protocol where one transformation takes most likely two phases: One map phase, one reduce phase. Between these phases, the results are spilled to disk. If you have more than one transformation, it stacks up.</p>
<p>One of the limitations of Hadoop MapReduce is that the framework can only batch process one job at a time.</p>
<p>MapReduce may be a legacy system for many companies who started their Big Data journey when Hadoop first came out. This framework has been the workhorse for large data projects. One of the significant challenges for systems developed with this framework is its high-latency, batch-mode response. Since MapReduce has evolved over the last 10 years some developers would complain that it’s difficult to maintain because of inherent inefficiencies in its design and code.<br />
Flink tries to combine all transformation into a job. If the job is started the transformations are done in this jobs, intermediate results are kept in memory. One of the highlights of Flink is its own memory management to prevent Garbage Collection and overflows.</p>
<p>Flink provides a true data streaming platform that uses high-performance dataflow architecture. It is also a strong tool for batch processing since Flink handles batch as a special case of streaming. Flink processes streaming data in real-time streams by pipelining data elements as soon as the elements arrive.</p>
<p>&nbsp;</p>
<p><a href="http://www.rizzimichele.it/aboutMePHP/MicheleRizzi.php?tech=hadoop">Here is available the source code of the application</a></p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fhadoop-big-data%2F&amp;linkname=Hadoop%20Big%20Data" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fhadoop-big-data%2F&amp;linkname=Hadoop%20Big%20Data" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fhadoop-big-data%2F&amp;linkname=Hadoop%20Big%20Data" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fhadoop-big-data%2F&amp;title=Hadoop%20Big%20Data" id="wpa2a_2"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/hadoop-big-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design Book object in Amazon Website</title>
		<link>https://www.rizzimichele.it/design-book-object-in-amazon-website/</link>
		<comments>https://www.rizzimichele.it/design-book-object-in-amazon-website/#comments</comments>
		<pubDate>Tue, 08 Nov 2016 07:34:00 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=1056</guid>
		<description><![CDATA[How it should be designed a book object in the Amazon website? Should it have a logic? if I were the architect of the system I wouldn&#8217;t have put any logic in that book object so it should be just a container and below are my reasons The clean code says that one class should [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>How it should be designed a book object in the Amazon website?</p>
<p>Should it have a logic?</p>
<p><strong>if I were the architect of the system I wouldn&#8217;t have put any logic in that book object so it should be just a container</strong> and below are my reasons</p>
<ol>
<li>The clean code says that one class should be as short as possible with just one responsibility. the less methods and the less code is inside the better it is.</li>
<li>I imagine the Amazon web site made of the Model View Control pattern and SQL database using the DAO pattern. If that&#8217;s implemented using also Spring and the Dependency injenction pattern and Hibernate the system should be designed as below
<ol>
<li>View: normal HTML  Javascript page so when the user wants to see the list of the book it calls the REST endpoint in the Spring book controller called getBook</li>
<li>Controller: Spring Book controller with the initial business logic for verifying the input of the user, calling the model, populating a response object which contains a list of books and returns it to the view
<ol>
<li>All logic should be in the controller and its method getBooks, the book should contain just informations</li>
</ol>
</li>
<li>Model: Another REST endpoint which like the controller has the logic. The logic is inside the rest book service and the book object should be just a container.
<ol>
<li>That rest service can collect the information from the SQL database using hibernate and as usual the Hibernate book object is just a mapping of the book table, all logic should be inside the BookDAO using the DAO design pattern</li>
</ol>
</li>
</ol>
</li>
</ol>
<p>For me the book should be just a bean POJO with private variables, getters, setters and constructors</p>
<p>The more logic you put inside the less clean is the code</p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fdesign-book-object-in-amazon-website%2F&amp;linkname=Design%20Book%20object%20in%20Amazon%20Website" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fdesign-book-object-in-amazon-website%2F&amp;linkname=Design%20Book%20object%20in%20Amazon%20Website" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fdesign-book-object-in-amazon-website%2F&amp;linkname=Design%20Book%20object%20in%20Amazon%20Website" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fdesign-book-object-in-amazon-website%2F&amp;title=Design%20Book%20object%20in%20Amazon%20Website" id="wpa2a_4"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/design-book-object-in-amazon-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat vs Websphere</title>
		<link>https://www.rizzimichele.it/tomcat-vs-websphere/</link>
		<comments>https://www.rizzimichele.it/tomcat-vs-websphere/#comments</comments>
		<pubDate>Thu, 20 Oct 2016 21:26:51 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=1003</guid>
		<description><![CDATA[Firstly it&#8217;s necessary to understand which are Tomcat and Web Sphere Tomcat and IBM WebSphere are both HTTP Java servers Server: is a machine always on, which serves the client requests: the client asks for a request the server processes it and replies with a response. HTTP is the Hyper Text transfer protocol, it&#8217;s a [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Firstly it&#8217;s necessary to understand which are Tomcat and Web Sphere</p>
<p>Tomcat and IBM WebSphere are both HTTP Java servers</p>
<p><a href="https://en.wikipedia.org/wiki/Server_(computing)">Server: </a>is a machine always on, which serves the client requests: the client asks for a request the server processes it and replies with a response.</p>
<p><a href="https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol">HTTP</a> is the Hyper Text transfer protocol, it&#8217;s a request- response protocol for exchanging web pages.<br />
A Java HTTP web server is a HTTP server which has a JVM (Java virtual machine) which allows to execute Java web applications.</p>
<p>A java web application can be stored in two archives: War and EAR.</p>
<ul>
<li><strong>WAR </strong>or web archive is an archive made of the below structure:
<ul>
<li><a href="http://www.rizzimichele.it/wp-content/uploads/2016/10/web-module.gif"><img class="aligncenter size-full wp-image-1016" alt="web-module" src="http://www.rizzimichele.it/wp-content/uploads/2016/10/web-module.gif" width="442" height="413" /></a></li>
<li>this archive is made of the below files
<ul>
<li><strong>web.xml</strong> is the application descriptors which contains the configuration information of the application</li>
<li><strong>lib</strong>: is a folder with all jar files necessary to make working our project</li>
<li>classes: all project byte codes</li>
<li><strong>JSP</strong>: the Java server Pages which contain html, css javascript code and Java code as well. After the user clicks on the button it may execute the java code inside the JSP or can call a class stored in the &#8220;classes folder&#8221; which can use a jar file contained in the lib folder.</li>
</ul>
</li>
<li>this archive can be made in many ways
<ul>
<li>using the eclipse export tool: export as-&gt;war</li>
<li>using the Java building tools such as Ant, Maven, Gradle</li>
</ul>
</li>
</ul>
</li>
<li><strong>EAR </strong>entreprise Archive is a more complex archive which can contain more war and the EJB JAR. The EJB or <a href="http://www.rizzimichele.it/enterprise-java-beans-and-all-j2ee/">Enterprise Java Beans</a> are necessary for implementing the session, the persistence of data and the message queue. EJB are used by Java front end framework such as JSF and Struts. If using Spring it has their own beans and it can make the above functions without needing EJB
<ul>
<li><a href="http://www.rizzimichele.it/wp-content/uploads/2016/10/7-packaging-and-deployment-16-728.jpg"><img class="aligncenter size-full wp-image-1017" alt="7-packaging-and-deployment-16-728" src="http://www.rizzimichele.it/wp-content/uploads/2016/10/7-packaging-and-deployment-16-728.jpg" width="728" height="546" /></a></li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p>After having clear the function about a Java web application and a java web server we can compare Tomcat and WebSphere</p>
<ul>
<li><strong>Tomcat: </strong>freeware open source server that is light and fast it doesn&#8217;t have a EJB container and it allows only to deploy EAR applications</li>
<li><strong>Web Sphere: </strong>Private IBM server very complex and expensive with the EJB container and the opportunity to install war and ear files. WebSphere allows to use JNDI, Queues and many other technologies.</li>
</ul>
<p>Both servers work with the java web applications (war) with JSP, Class files but being more widely supported Web Sphere is used for complex projects such as banks and insurances rather then Tomcat used for small projects such as web sites and small applications.</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Ftomcat-vs-websphere%2F&amp;linkname=Tomcat%20vs%20Websphere" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Ftomcat-vs-websphere%2F&amp;linkname=Tomcat%20vs%20Websphere" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Ftomcat-vs-websphere%2F&amp;linkname=Tomcat%20vs%20Websphere" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Ftomcat-vs-websphere%2F&amp;title=Tomcat%20vs%20Websphere" id="wpa2a_6"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/tomcat-vs-websphere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem solving applied to english</title>
		<link>https://www.rizzimichele.it/problem-solving-applied-to-english/</link>
		<comments>https://www.rizzimichele.it/problem-solving-applied-to-english/#comments</comments>
		<pubDate>Fri, 19 Sep 2014 21:25:47 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=464</guid>
		<description><![CDATA[Tomorrow I&#8217;ll take my second english certificate. I&#8217;ve been studied english in a deep way for more than two months at least one hour a day and I would write a feedback of my actual knowledgement what is done good and what I need to improve. There are many steps that you must follow when [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Tomorrow I&#8217;ll take my second english certificate.</p>
<p>I&#8217;ve been studied english in a deep way for more than two months at least one hour a day and I would write a feedback of my actual knowledgement what is done good and what I need to improve.</p>
<p>There are many steps that you must follow when you learn a new language:</p>
<ul>
<li>you learn the grammar, the voucabulary etc</li>
<li>you become to explain everything.</li>
<li> you become able to explain everithing with a lot of vocabulary, synonyms that are different on the basis of the environment:</li>
</ul>
<p style="padding-left: 60px;">For instance it is better to don&#8217;t use one word more time in a sentence. You have to use a synonym.</p>
<p style="padding-left: 60px;">If you want to say an apology you can say &#8220;sorry&#8221; (informal) or &#8220;I would like to tell you my apology&#8221; (formal)</p>
<ul>
<li>you replace the thought of your original language with the thought of your destination language when you speak with yourself</li>
<li>you become able to write a complex text</li>
<li>you become able to understand a film like the following without the subtitles</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Now I think to have an high level of english because I&#8217;m able to talk about everything as in the present as in the past as in the future by using a lot of synonyms and also I&#8217;m able to choose the correct word on the basis of the environment (formal or informal) and I speak with myself in english</p>
<p>My problems are the following</p>
<ul>
<li>I some times confuse some words such as few and little:</li>
</ul>
<p style="padding-left: 60px;">I know that little is used for uncountable nouns such as &#8220;little money&#8221; but instinctively I say &#8220;few money&#8221; because in my mind few=much=uncountable many=little=countable (wrong). I need more extercises but American and British Academy have few extercises, is better Douolingo and when I finish this course I will do Duolingo tests.</p>
<ul>
<li>There are some words that I never remember because I rarely use them but they are written on my english memory test</li>
<li>In my opinion the most difficult skill to have is undrestanding spoken english such as videos even if the interlocutor speaks fastly and with slangs because in this case first of all you must understand all the terms used into the phrase and then you&#8217;ll undrestand the sense of this one.</li>
</ul>
<p>I think that the advanced level of American and British academy is not enough to speak english perfectly for this reason I would like to have the following goals:</p>
<ol>
<li>I would like to finish all the American and British academy courses by the 10th of November 2014 this course is necessary to understand the english rules and the english accent gradually</li>
<li>I would like to finish All Duolingo three by the end of january 2015. The duolingo tests are more complex than ABAEnglish tests</li>
<li>when I&#8217;ve free time I&#8217;ll watch videos and films in english language with subtitles in italian and also I&#8217;ll read news in english</li>
<li>At the end of my duolingo test I&#8217;ll correct all articles written here and I would like to discover how much mistakes I&#8217;ve done to know how my ability is increase in these days</li>
<li>when I&#8217;m ready I&#8217;ll try to do IELTS exam</li>
</ol>
<p>I do my best to speak english very well asap I hope that I&#8217;m able to reach this goal.</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fproblem-solving-applied-to-english%2F&amp;linkname=Problem%20solving%20applied%20to%20english" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fproblem-solving-applied-to-english%2F&amp;linkname=Problem%20solving%20applied%20to%20english" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fproblem-solving-applied-to-english%2F&amp;linkname=Problem%20solving%20applied%20to%20english" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fproblem-solving-applied-to-english%2F&amp;title=Problem%20solving%20applied%20to%20english" id="wpa2a_8"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/problem-solving-applied-to-english/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gantt and PERT diagram of my english course</title>
		<link>https://www.rizzimichele.it/gantt-and-pert-diagram-of-my-english-course/</link>
		<comments>https://www.rizzimichele.it/gantt-and-pert-diagram-of-my-english-course/#comments</comments>
		<pubDate>Sun, 07 Sep 2014 15:55:31 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=447</guid>
		<description><![CDATA[PERT DIAGRAM GANTT DIAGRAM &#160; I wrote above small examples about how to plan the common activities with some professional instruments. At the end of each course I will share the deliverable also called milestone: my English certificate. This is very optimistic planning for this reason I think that this is a challenge. I&#8217;m not hurry and [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><strong style="font-size: 2.4em;">PERT DIAGRAM</strong></p>
<h1><a href="http://www.rizzimichele.it/wp-content/uploads/2014/09/pert.png"><img class="aligncenter size-full wp-image-449" alt="pert" src="http://www.rizzimichele.it/wp-content/uploads/2014/09/pert.png" width="1000" height="400" /></a></h1>
<h1><strong>GANTT DIAGRAM</strong></h1>
<p><a href="http://www.rizzimichele.it/wp-content/uploads/2014/09/document.jpg"><img class="aligncenter size-full wp-image-448" alt="document" src="http://www.rizzimichele.it/wp-content/uploads/2014/09/document.jpg" width="2861" height="203" /></a></p>
<p>&nbsp;</p>
<p>I wrote above small examples about how to plan the common activities with some professional instruments.</p>
<p>At the end of each course I will share the deliverable also called milestone: my English certificate.</p>
<p>This is very optimistic planning for this reason I think that this is a challenge.</p>
<p>I&#8217;m not hurry and I think that it&#8217;s better to end all my activities later but perfectly than end everything in time but wrongly.</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fgantt-and-pert-diagram-of-my-english-course%2F&amp;linkname=Gantt%20and%20PERT%20diagram%20of%20my%20english%20course" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fgantt-and-pert-diagram-of-my-english-course%2F&amp;linkname=Gantt%20and%20PERT%20diagram%20of%20my%20english%20course" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fgantt-and-pert-diagram-of-my-english-course%2F&amp;linkname=Gantt%20and%20PERT%20diagram%20of%20my%20english%20course" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fgantt-and-pert-diagram-of-my-english-course%2F&amp;title=Gantt%20and%20PERT%20diagram%20of%20my%20english%20course" id="wpa2a_10"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/gantt-and-pert-diagram-of-my-english-course/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NOSQL Mongodb Vs MySQL</title>
		<link>https://www.rizzimichele.it/nosql-mongodb-vs-mysql/</link>
		<comments>https://www.rizzimichele.it/nosql-mongodb-vs-mysql/#comments</comments>
		<pubDate>Sat, 02 Aug 2014 08:35:52 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=396</guid>
		<description><![CDATA[The better way to work with a SQL database and a programming language like java is by using a ORM (Object-Relational Mapping) layer such as hibernate or JPA. An ORM layer basically provides an object oriented interface to a relational database. That means that instead of writing a query to insert or update a record, you [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The better way to work with a SQL database and a programming language like java is by using a ORM (Object-Relational Mapping) layer such as hibernate or JPA.<br />
An ORM layer basically provides an object oriented interface to a relational database. That means that instead of writing a query to insert or update a record, you assign some properties to an object and call a persist method. Instead of writing queries with joins, you can access related data through properties of an object.<br />
For example, if you have a &#8220;post&#8221; object that represents a blog post, you can access it&#8217;s comments through the property &#8220;post.comments&#8221;. At first appearance, this might seem convenient.</p>
<p>The problem, however, is that this is horribly inefficient and it teaches developers to ignore how the underlying database works. In fact, it&#8217;s so inefficient that it just about mapping relational database systems in ORM system for this reasons were born a lot of new databases nosql like Apache Cassandra, MongoDB and others.<br />
I only studied one of these technologies: Mongodb, because in my opinion it is the most used.<br />
The differences between MySQL and mongodb are the following.</p>
<p><strong>Data Representation</strong></p>
<p>MySQL represents data in tables and rows.</p>
<p>MongoDB represents data as collections of JSON documents.</p>
<p>A JSON document is very much like what you would be working with in your application layer. If you are using javascript, it&#8217;s exactly what you&#8217;re working with. If you&#8217;re using PHP, it&#8217;s just like an associative array. If you&#8217;re using python, its just like a dictionary object.</p>
<p><strong>Querying</strong></p>
<p>The SQL in MySQL stands for Structured Query Language. That&#8217;s because you have to put together a string in this query language that is parsed by the database system. This is what makes SQL injection attacks possible.</p>
<p>MongoDB uses object JSON querying.</p>
<p><strong>Relationships</strong></p>
<p>One of the best things about MySQL and relational databases in general is the almighty JOIN operation. This allows you to perform queries across multiple tables.</p>
<p>MongoDB does not support joins, but it does multi-dimensional data types such as arrays and even other documents. Placing one document inside another is referred to as embedding. For example, if you were to create a blog using MySQL, you would have a table for posts and a table for comments. In MongoDB you might have a single collection of posts, and an array of comments within each post.</p>
<p><strong>Transactions</strong></p>
<p>Another great thing about MySQL is its support for atomic transactions. The ability to contain multiple operations within a transaction and roll back the whole thing as if it were a single operation.</p>
<p>MongoDB does not support transactions, but single operations are atomic.</p>
<p><strong>Schema Definition</strong></p>
<p>MySQL requires you to define your tables and columns before you can store anything, and every row in a table must have the same columns.</p>
<p>One of my favourite things about MongoDB is that you don&#8217;t define the schema. You just drop in documents, and two documents within a collection don&#8217;t even need to have the same fields.</p>
<p><strong>Performance</strong></p>
<p>MySQL often has  poor performance. Well if you are using an ORM, performance will likely increased. If you are using a simple database wrapper and you&#8217;ve indexed your data correctly, you&#8217;ll get good performance</p>
<p>By sacrificing things like joins and providing excellent tools for performance analysis, MongoDB can perform much better than a relational database. You still need to index your data and the truth is that the vast majority applications out there don&#8217;t have enough data to notice the difference.</p>
<p><strong>When should you use MySQL?</strong></p>
<p>If your data structure fits nicely into tables and rows, MySQL will offer you robust and easy interaction with your data. If it&#8217;s performance that is your concern, there is a good chance you don&#8217;t really need MongoDB. Most likely, you just need to index your data properly. If you require SQL or transactions, you&#8217;ll have to stick with MySQL.</p>
<p><strong>When should you use MongoDB?</strong></p>
<p>If your data seems complex to model in a relational database system, or if you find yourself de-normalizing your database schema or coding around performance issues you should consider using MongoDB. If you find yourself trying to store serialized arrays or JSON objects, that&#8217;s a good sign that you are better off MongoDB. If you can&#8217;t pre-define your schema or you want to store records in the same collection that have different fields, that&#8217;s another good reason.</p>
<p>&nbsp;</p>
<p><strong>Example of mongodb use</strong></p>
<pre>

&gt; use mydb

switched to db mydb
&gt; users ={"name": "Michele", "surname":"Rizzi" }
{ "name" : "Michele", "surname" : "Rizzi" }
&gt; db.users.insert(users)
WriteResult({ "nInserted" : 1 })
&gt; departments2={"name": "CS","value": "Computer Science" }
{ "name" : "CS", "value" : "Computer Science" }
&gt; db.department.insert(departments)
WriteResult({ "nInserted" : 1 })
&gt; db.department.insert(departments2)
WriteResult({ "nInserted" : 1 })

&gt; db.users.find()
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele", "surname" : "Rizzi" }
&gt; db.department.find()
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TC", "value" : "Telecomunications" }
{ "_id" : ObjectId("53dbe71f8f9fa523bbaef55a"), "name" : "CS", "value" : "Computer Science" }
&gt; db.department.find().sort({name:1})
{ "_id" : ObjectId("53dbe71f8f9fa523bbaef55a"), "name" : "CS", "value" : "Computer Science" }
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TC", "value" : "Telecomunications" }
&gt; db.department.find().sort({name:-1})
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TC", "value" : "Telecomunications" }
{ "_id" : ObjectId("53dbe71f8f9fa523bbaef55a"), "name" : "CS", "value" : "Computer Science" }
&gt; db.department.update ({name:"TC"},{ $set: {name:"TLC"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
&gt; db.department.find().sort({name:-1})
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TLC", "value" : "Telecomunications" }
{ "_id" : ObjectId("53dbe71f8f9fa523bbaef55a"), "name" : "CS", "value" : "Computer Science" }
&gt; db.department.remove({name: "CS"})
WriteResult({ "nRemoved" : 1 })
&gt; db.department.find().sort({name:-1})
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TLC", "value" : "Telecomunications" }
&gt; db.department.update ({name:"TC"}, {$set: {namee:"TLC"}})
WriteResult({ "nMatched" : 0, "nUpserted" : 0, "nModified" : 0 })
&gt; db.department.find().sort({name:-1})
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TLC", "value" : "Telecomunications", "namee" : "TLC" }
&gt; ObjectId()
ObjectId("53dbeb448f9fa523bbaef55b")
&gt; ObjectId()
ObjectId("53dbeb468f9fa523bbaef55c")
&gt; ObjectId()
ObjectId("53dbeb478f9fa523bbaef55d")
&gt; ObjectId()
ObjectId("53dbeb4a8f9fa523bbaef55e")
&gt; var id=ObjectId()
&gt; id
ObjectId("53dbeb658f9fa523bbaef55f")
&gt; db.department.update ({name:"TLC"}, {$set: {id: id}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
&gt; db.department.find().sort({name:-1})
{ "_id" : ObjectId("53dbe7128f9fa523bbaef559"), "name" : "TLC", "value" : "Telecomunications", "namee" : "TLC", "id" : ObjectId("53dbeb658f9fa523bbaef55f") }
&gt; db.users
&gt; db.users.update({},{$set: {depId:id}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
&gt; db.users.find()
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele", "surname" : "Rizzi", "depId" : ObjectId("53dbeb658f9fa523bbaef55f") }

&gt; db.users.find({name: $in: ["Michele","bla"]}})
2014-08-01T21:47:34.652+0200 SyntaxError: Unexpected token :
&gt; db.users.find({$and:[{name: {$in: ["Michele","bla"]}}]})
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele", "surname" : "Rizzi", "depId" : ObjectId("53dbeb658f9fa523bbaef55f") }

&gt; db.users.find({$and:[{name: {$in: ["Michele","bla"]}}]},{name:1})
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele" }
&gt; db.users.find({$and:[{name: {$in: ["Michele","bla"]}}]})
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele", "surname" : "Rizzi", "depId" : ObjectId("53dbeb658f9fa523bbaef55f") }
&gt; db.users.find({$and:[{name: {$in: ["Michele","bla"]}}]},{id:1})
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558") }

&nbsp;

&gt; var names=db.users.find({$and:[{name: {$in: ["Michele","bla"]}}]},{name:1});
&gt; var names_id=names.hasNext()? names.next():null;
&gt; db.users.find({name: names_id.name});
{ "_id" : ObjectId("53dbe6cc8f9fa523bbaef558"), "name" : "Michele", "surname" : "Rizzi", "depId" : ObjectId("53dbeb658f9fa523bbaef55f") }

&gt; var s={ _id: ObjectId("50a8240b927d5d8b5891743c"), cust_id: "abc123", ord_date: new Date("Oct 04, 2012"), status: 'A', price: 25, items: [ { sku: "mmm", qty: 5, price: 2.5 }, { sku: "nnn", qty: 5, price: 2.5 } ]}

&gt; s
{
"_id" : ObjectId("50a8240b927d5d8b5891743c"),
"cust_id" : "abc123",
"ord_date" : ISODate("2012-10-03T22:00:00Z"),
"status" : "A",
"price" : 25,
"items" : [
{
"sku" : "mmm",
"qty" : 5,
"price" : 2.5
},
{
"sku" : "nnn",
"qty" : 5,
"price" : 2.5
}
]
}
&gt; var mapFunction1 = function() { emit(this.cust_id, this.price);};
&gt; var reduceFunction1 = function(keyCustId, valuesPrices) { return Array.sum(valuesPrices);};
&gt; db.users.insert(s)
WriteResult({ "nInserted" : 1 })
&gt; db.users.mapReduce( mapFunction1, reduceFunction1, { out: "map_reduce_example" })
{
"result" : "map_reduce_example",
"timeMillis" : 343,
"counts" : {
"input" : 2,
"emit" : 2,
"reduce" : 0,
"output" : 2
},
"ok" : 1,
}
&gt; var res1=db.users.mapReduce( mapFunction1, reduceFunction1, { out: "map_reduce_example" })
&gt; db [res1.result].find()
{ "_id" : null, "value" : null }
{ "_id" : "abc123", "value" : 25 }

</pre>
<p><strong>Example of integration with java</strong></p>
<pre>

//connection

Mongo mongo = new Mongo("localhost", 27017);
DB db = mongo.getDB("database");

DBCollection collection = db.getCollection("collection");

//INSERT

BasicDBObject document = new BasicDBObject();
document.put("user", "Michele");

collection.insert(document);

//UPDATE WITH SET: REPLACE THE VALUE OF ONE FIELD

BasicDBObject updateDocument = new BasicDBObject();
updateDocument.append("$set", new BasicDBObject().append("user", "Ing Michele"));

collection.update(document, updateDocument);

//READ

BasicDBObject documentSearch = new BasicDBObject();
documentSearch.put("user", "Ing Michele");

DBCursor cursorDocJSON = collection.find(documentSearch);

while (cursorDocJSON.hasNext()) {
System.out.println(cursorDocJSON.next());
}

//DELETE

collection.remove(documentSearch);

</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fnosql-mongodb-vs-mysql%2F&amp;linkname=NOSQL%20Mongodb%20Vs%20MySQL" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fnosql-mongodb-vs-mysql%2F&amp;linkname=NOSQL%20Mongodb%20Vs%20MySQL" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fnosql-mongodb-vs-mysql%2F&amp;linkname=NOSQL%20Mongodb%20Vs%20MySQL" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fnosql-mongodb-vs-mysql%2F&amp;title=NOSQL%20Mongodb%20Vs%20MySQL" id="wpa2a_12"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/nosql-mongodb-vs-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jena: Semantic Web</title>
		<link>https://www.rizzimichele.it/jena-semantic-web/</link>
		<comments>https://www.rizzimichele.it/jena-semantic-web/#comments</comments>
		<pubDate>Sat, 26 Jul 2014 15:20:34 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Robotics and automation (4)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=355</guid>
		<description><![CDATA[Nowadays everyone has internet, there are a lot of web pages and it is quite difficult to perform an accurate research among these pages to get the correct information that you need. The problem is that the information online is not structured like a database: Web page is complex document with pictures, videos, images and [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Nowadays everyone has internet, there are a lot of web pages and it is quite difficult to perform an accurate research among these pages to get the correct information that you need.</p>
<p>The problem is that the information online is not structured like a database:</p>
<p>Web page is complex document with pictures, videos, images and meta information of mark up to specify the interaction with human and graphic effects.</p>
<p>A way to index a text is to use a system of information retrieval like <a href="http://www.rizzimichele.it/luceneinformation-retrival/">lucene</a> but it is not enough because Lucene works only parsing text on your web page.</p>
<p>Lucene makes a structure called index composed by a pointer of the document and many keywords that this document contains. When you are looking for some information Lucene searches them in these keyword and assigns a special outcome called ranking.</p>
<p>The disadvantage of Lucene is that it performs the simple research in string that is composed by keywords of the document. <strong>Lucene doesn&#8217;t know the semantic of the text but knows only the keyword contained in this document.</strong></p>
<p>The best way to perform a research on written text document is to add them a specific meta-information by introducing another tags to the html document.</p>
<p>These tags are not visible to the human but are necessary to improve the index of this page for a external information retrieval system.</p>
<p>This is called <strong>Semantic WEB</strong></p>
<p>Semantic web works using a special XML file with all <strong>rules</strong> of the domain, all the constraints of it and the objects written here must respect these rules.</p>
<p>This XML file is called <strong>ontology </strong>and it is the knowledge base (KB) of the system.</p>
<p>In this way it&#8217;s possible to convert the static not structured text into a xml structured document with a lot of constraints and rules (like database) and it&#8217;s possible to make queries to this system. The language that executes these queries is OWL (<strong>Ontology Web Language</strong>)</p>
<p>There are a lot of XML schemas and a lot of rules to make these semantic web a lot of ontology web languages but the most widespread used is RDF</p>
<p>&nbsp;</p>
<h1><strong>RDF</strong></h1>
<p>RDF is the acronym of Resource Description framework and it is the standard model for data interchange on the Web</p>
<p>This is an example of RDF written by me using Apache Jena:</p>
<pre>
&lt;xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
&lt;xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#" &gt;
&lt;rdf:Description rdf:about="http://www.rizzimichele.it"&gt;
&lt;vcard:N rdf:nodeID="A0"/&gt;
&lt;vcard:FN&gt;Michele Rizzi&lt;/vcard:FN&gt;
&lt;/rdf:Description&gt;
&lt;rdf:Description rdf:nodeID="A0"&gt;
&lt;vcard:Family&gt;Rizzi&lt;/vcard:Family&gt;
&lt;vcard:Given&gt;Michele&lt;/vcard:Given&gt;
&lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;

</pre>
<p>In the precedent example I written that the address www.rizzimichele.it is related at vcard descripted below that has Family Rizzi and Name: Michele.</p>
<p>This is a simple RDF example but I can make a complex XML like a WSDL and XSD that contains the identity card of web service.</p>
<p><a href="http://www.rizzimichele.it/aboutMePHP/OtherMySW/pizza.owl.rdf.xml">Here is linked a complex RDF example</a></p>
<p>For example, the following are tags to define the domain.</p>
<pre>
&lt;rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/&gt;
&lt;rdfs:comment xml:lang="en"&gt;
Note that hasTopping is inverse functional because isToppingOf is functional
&lt;/rdfs:comment&gt;
&lt;rdfs:domain rdf:resource="#Pizza"/&gt;
&lt;rdfs:subPropertyOf rdf:resource="#hasIngredient"/&gt;
&lt;rdfs:range rdf:resource="#PizzaTopping"/&gt;
&lt;owl:inverseOf rdf:resource="#isToppingOf"/&gt;
&lt;/owl:ObjectProperty&gt;
</pre>
<p>The property of #hasTopping is subproperty of #hasIngredient: each ingredient is Topping</p>
<p>hasTopping has the inverse of isTopping for passive voice.</p>
<p>hasTopping has a specified domains: pizza names.</p>
<p>This is an object that respects all rules and constraints on the system</p>
<pre>
&lt;owl:Class rdf:about="#FourCheesesTopping"&gt;
&lt;rdfs:label xml:lang="pt"&gt;CoberturaQuatroQueijos&lt;/rdfs:label&gt;
&lt;rdfs:label xml:lang="it"&gt;Quattro Formaggi&lt;/rdfs:label&gt;
&lt;rdfs:subClassOf&gt;
&lt;owl:Restriction&gt;&lt;owl:onProperty rdf:resource="#hasSpiciness"/&gt;
&lt;owl:someValuesFrom rdf:resource="#Mild"/&gt;
&lt;/owl:Restriction&gt;
&lt;/rdfs:subClassOf&gt;
&lt;rdfs:subClassOf rdf:resource="#CheeseTopping"/&gt;
&lt;/owl:Class&gt;
</pre>
<p>This pizza is the subclass of cheeseTopping with mid spiciness</p>
<p>&nbsp;</p>
<h1>Apache JENA</h1>
<p><a href="http://www.rizzimichele.it/wp-content/uploads/2014/07/ont-model-layers.png"><img class="aligncenter size-full wp-image-357" alt="ont-model-layers" src="http://www.rizzimichele.it/wp-content/uploads/2014/07/ont-model-layers.png" width="312" height="285" /></a></p>
<p>Jena is a java library to write or read RDF language and other owl languages such as TTL, it can also to perform a query to do a reasoning about the xml rdf tree to search the information that you need</p>
<p>this is an example of jena query</p>
<p>select ?pizza where {?pizza a owl:Class ; rdfs:subClassOf ?restriction. ?restriction owl:onProperty pizza:hasSpiciness ; owl:someValuesFrom pizza:Mild }</p>
<p>In the previous query I am looking for a pizza with Spiciness Mild</p>
<p>&nbsp;</p>
<h1>My project</h1>
<p>I tested four examples of applications with Apache Jena and I made one my application to write a simple RDF file.</p>
<p>When I tried to read a customized RDF file to execute a customized queries I get the following error:</p>
<pre>
Exception in thread "main" com.hp.hpl.jena.shared.PropertyNotFoundException: http://www.w3.org/2001/vcard-rdf/3.0#N at com.hp.hpl.jena.rdf.model.impl.ModelCom.getRequiredProperty(ModelCom.java:1243) at com.hp.hpl.jena.rdf.model.impl.ResourceImpl.getRequiredProperty(ResourceImpl.java:170)
at org.apache.jena.example.helloworld.Tutorial6.main(Tutorial6.java:52)
</pre>
<p><span style="color: #000000;">I am not an expert of Lucene or Apache jena these are not widespread technologies and there are few forums and manuals to learn about them, when it will be necessary to work with this framework I will spend much time to try and I will perform a lot of tests  to fix these problems and to study this framework but in my opinion it is enough for now </span></p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fjena-semantic-web%2F&amp;linkname=Jena%3A%20Semantic%20Web" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fjena-semantic-web%2F&amp;linkname=Jena%3A%20Semantic%20Web" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fjena-semantic-web%2F&amp;linkname=Jena%3A%20Semantic%20Web" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fjena-semantic-web%2F&amp;title=Jena%3A%20Semantic%20Web" id="wpa2a_14"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/jena-semantic-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lucene:information retrieval</title>
		<link>https://www.rizzimichele.it/luceneinformation-retrival/</link>
		<comments>https://www.rizzimichele.it/luceneinformation-retrival/#comments</comments>
		<pubDate>Sat, 19 Jul 2014 15:39:12 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Robotics and automation (4)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=317</guid>
		<description><![CDATA[How is internet search engine made of? How I can search a lot of information in many documents or web pages? I could search these information using a information retrieval system. Information retrieval The information retrival system executes queries to text unstructured document but this file is not ready to search information inside it because [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>How is internet search engine made of?</p>
<p>How I can search a lot of information in many documents or web pages?</p>
<p>I could search these information using a information retrieval system.</p>
<h1>Information retrieval</h1>
<p>The information retrival system executes queries to text unstructured document but this file is not ready to search information inside it because the user searches only few keyword that are written in sparse positions in the document and also the document can have a synonym of this keyword etc for this reason it is necessary to do a preprocessing operation.</p>
<p>The most important preprocessing operations are the following:</p>
<ul>
<li><strong>Stemming:</strong> Replacing words with their stems. For instance the English stem &#8220;bikes&#8221; is replaced with &#8220;bike&#8221;; now query &#8220;bike&#8221; can find both documents containing &#8220;bike&#8221; and those containing &#8220;bikes&#8221;.</li>
<li><strong>Stop Words Filtering</strong>: Common words like &#8220;the&#8221;, &#8220;and&#8221; and &#8220;a&#8221; rarely add any value to a search. Removing them shrinks the index size and increases performance. It may also reduce some &#8220;noise&#8221; and actually improve search quality.</li>
<li><strong>Text Normalization</strong>: Stripping accents and other character markings can make for better searching.</li>
<li><strong>Synonym Expansion:</strong> Adding in synonyms at the same token position as the current word can mean better matching when users search with words in the synonym set.</li>
<li><strong>Get most frequency terms</strong></li>
</ul>
<p>The information retrieval system executes the precedent operation and saves the resulted document and the pointer of the original document in a <strong>index</strong> file.</p>
<p>When the user searches the keyword, this keyword is find into the index file and the result is shown to the users grouped by ranking (level of relevance) when the user clicks on the link, he can open the document.</p>
<p>&nbsp;</p>
<h1><strong>Apache Lucene</strong></h1>
<p>Lucene is the framework composed by many libraries to execute queries on text documents like an information retrieval system.</p>
<p>The principal libs are the following:</p>
<ul>
<li><strong>org.apache.lucene.document.Document: </strong>allows to store into the index principal information (for example title or contain or creation date) called <strong>field</strong> of the document. When executing the query it&#8217;s necessary to specify what property of the document is searched</li>
<li><strong>org.apache.lucene.analysis.standard.StandardAnalyzer:</strong> the analyser that processes the documents to extract the information to save into the index, for example removes stopword, executes stemming and all the four preprocessing operation written above</li>
<li><strong>org.apache.lucene.search.Query: </strong>executes the query</li>
<li><strong>org.apache.lucene.search.ScoreDoc: </strong>executes the ranking of the results</li>
<li><strong>org.apache.poi.extractor.ExtractorFactory: </strong>is very useful for indexing office document like word or excel and to execute queries inside these documents</li>
</ul>
<h1><strong>My Project</strong></h1>
<p>I tested all the precedent libraries of Lucene for searching information into word and excel documents and they run well: Lucene creates index files, executes the query and shows the results ordered by ranking.</p>
<p>There are a lot of analysers:</p>
<ul>
<li><strong>org.apache.lucene.analysis.standard.StandardAnalyzer</strong></li>
<li><strong>org.apache.lucene.analysis.en.EnglishAnalyzer</strong></li>
<li><strong>org.apache.lucene.analysis.it.ItalianAnalyzer</strong></li>
</ul>
<p>each analyser makes different preprocessing because English stopwords are different from the Italian stopwords, the same for synonyms  and stemming.</p>
<p>The pre processing step is not executed automatically but it is necessary to use the method <strong>analyzer.tokenStream</strong></p>
<p>when I execute the following code</p>
<pre>

for (File f : queue) {

FileReader  fr = new FileReader(f);
TokenStream ts=analyzer.tokenStream("contents", ExtractorFactory.createExtractor(f).getText());
doc.add(new TextField("contents",ts));
ts.reset();
ts.close();
writer.addDocument(doc); }
</pre>
<p>the console shows the following error:</p>
<pre>
java.lang.IllegalStateException: TokenStream contract violation: reset()/close() call missing, reset() called multiple times, or subclass does not call super.reset(). Please see Javadocs of TokenStream class for more information about the correct consuming workflow.
at org.apache.lucene.analysis.Tokenizer$1.read(Tokenizer.java:111)

</pre>
<p>This is not the correct way to add the token that contains the text preprocessed at the indexed document.</p>
<p>when I add the field of the document to the indexed document there are no exceptions and the query is executed correctly  but when I use a token the previous exception occurs</p>
<p>&nbsp;</p>
<p>In my opinion the another way to make the fourth precedents preprocessing is manually, by making many simple dictionaries:</p>
<ul>
<li><strong>Stop word dictionary</strong> a simple xml file with all words that it will be removed while are processed documents for making the index and it will be removed from the user queries</li>
<li><strong>stem synonym dictionary: </strong>simple database table with two column<strong>: key:</strong>base term, another column:term to replace.
<ul>
<li>For example BASE TERM:eat; TERM TO REPLACE:ate,eating,eats, have a meal</li>
<li>I use a table that loads in a class file  when the aplication starts by executing the following query <span style="color: #3366ff;">&#8220;select * from stem_synonym_dictionary&#8221; </span><span style="color: #000000;"><br />
</span></li>
<li>when I process a document or a query and I found eating or have a meal, I replace it with eat (simple search into string)</li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fluceneinformation-retrival%2F&amp;linkname=Lucene%3Ainformation%20retrieval" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fluceneinformation-retrival%2F&amp;linkname=Lucene%3Ainformation%20retrieval" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fluceneinformation-retrival%2F&amp;linkname=Lucene%3Ainformation%20retrieval" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fluceneinformation-retrival%2F&amp;title=Lucene%3Ainformation%20retrieval" id="wpa2a_16"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/luceneinformation-retrival/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring MVC Vs JSF</title>
		<link>https://www.rizzimichele.it/spring-mvc-vs-jsf/</link>
		<comments>https://www.rizzimichele.it/spring-mvc-vs-jsf/#comments</comments>
		<pubDate>Sun, 13 Jul 2014 18:27:17 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=312</guid>
		<description><![CDATA[There most important front end frameworks of J2EE are Spring MVC and JSF. JSF: Java Server Facets JSF in my opinion is the most used front end framework because it is easy and stable: you can make a very complex and secure web application  in few time using it. This framework has the principal component called [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>There most important front end frameworks of J2EE are Spring MVC and JSF.</p>
<h1><strong>JSF: Java Server Facets</strong></h1>
<p>JSF in my opinion is the most used front end framework because it is easy and stable: you can make a very complex and secure web application  in few time using it.</p>
<p>This framework has the principal component called &#8220;<strong>portlet</strong>&#8221;</p>
<p>each portlet is independent by the others for this reason this framework is scalable and easy to maintaining.</p>
<p>each portlet has the following files:</p>
<ul>
<li>Session bean with all the data necessary to run the page</li>
<li>Request bean with all the operation and the action that the user can do</li>
<li>JSP and XHTML file that shows the result</li>
<li>Property file with the labels or db connections etc</li>
</ul>
<p>The defect of this framework is that <strong>stores everything in session</strong> so it <em><strong>stores </strong><strong>everything</strong><strong> in ram jvm memory of the server.</strong></em></p>
<p>This is a huge problem because the RAM of the java virtual machine of the server is expensive.</p>
<p>when the RAM memory of the server is full the server shows an &#8220;memory out of bound exception&#8221; and it is necessary to restart the server.</p>
<p>&nbsp;</p>
<p>The second problem of JSF is the conversion of HTML tags:</p>
<p>JSF uses particular tags, each tag has a class that performs the operation, <a href="http://www.horstmann.com/corejsf/jsf-tags.html">here is a small list of jsf tags</a></p>
<p>when you insert the tag &lt;h:form&gt;&lt;/h:form&gt; and you see the page rendered, this tag is converted in &lt;form action=&#8221;"&gt;&lt;/form&gt;</p>
<p>The conversion of tags is performed to simplify the operation of writing code: it is easiest to write JSF tags and they are rendered in html tags but it is a problem when you want to integrate the page with a special javascript or jquery component:</p>
<p>For example it is very difficult to integrate a jquery slider component with JSF because the slider requires a particular div sequence that are difficult to produce using JSF tags</p>
<p><strong>JSF is easy to use, is stable, scalable, easy to maintenance and each page is independent from the others and requires a lot of jvm memory of the server and also it is difficult to integrate with javascript, jquery, bootstrap component</strong></p>
<p><strong>My </strong> <strong>web application affittavetrina is developed using JSF for this reason it is expensive and unuseful because when there are connect a lot of people it might occurs the java memory out of bound exception but in the past  days I didn&#8217;t knew Spring model and view</strong></p>
<p>&nbsp;</p>
<h1><strong>Spring MVC</strong></h1>
<p>is in my opinion the best framework to make web application, it has the following characteristics:</p>
<ul>
<li><strong>Client (view): </strong>the client is a simple JSP file written in html language with special tags <strong>(JSTL javascript tag language) </strong>and other tags for example the property like jsf for the internationalization. <em>It</em> is fully compatible with all component like jquery, javascript, ecc</li>
<li> <strong>Controller: </strong>Spring beans that allow to communicate via rest with htmlServletRequest and htmlServletResponse and you can set the information that you need in  session.</li>
<li><strong>Model </strong>you can choose a web services or another rest services etc.</li>
</ul>
<p>The client with for example a jquery ajax component can send a rest request with the selection of url, methode (get, post) this request is processed by  server that sends the response to the client</p>
<p><strong>Spring MVC is more complex than JSF because it is necessary to develop everything from the scratch, but requires less JVM memory (you can store in session only the information that you need) and it is fully customizable. </strong></p>
<p><strong>it is less stable and less maintainable because the jsp page written in html is more complex then the page written in jsf tags</strong></p>
<p><strong>Today I made a small project in Spring MVC to store a complex object in session and to read it. Another example is to pass this object in post and in get to the controller and to read it, </strong><strong>I tested also the internationalization that runs correctly.</strong></p>
<p>&nbsp;</p>
<div style="background: #4c74be; border-radius: 20px; -moz-border-radius: 20px; -webkit-border-radius: 20px;">
<p>&nbsp;</p>
<p><span style="color: #993366;"><strong>Conclusion</strong></span></p>
<p><span style="color: #993366;"><strong></strong><strong>JSF: </strong><span style="color: #ffffff;">I don&#8217;t know what is the way that the framework uses to call the action written in the request bean but when I specify the method of the bean that I need to call when the user clicks on button, the application runs. It is easy and less customizable and saves everything in session (ram memory of the server)</span></span></p>
<p><span style="color: #993366;"><strong>Spring MVC:<span style="color: #ffffff;"> </span></strong><span style="color: #ffffff;">I can choose the way to comunicate with bean (http get, http put, rest web service etc) it is fully customizable but requires more time to write code and it is easy to make a mistake and the code written in Spring MVC is more complex to understand than JSF</span></span></p>
<p><span style="color: #ffffff;"> </span></p>
</div>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-mvc-vs-jsf%2F&amp;linkname=Spring%20MVC%20Vs%20JSF" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-mvc-vs-jsf%2F&amp;linkname=Spring%20MVC%20Vs%20JSF" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-mvc-vs-jsf%2F&amp;linkname=Spring%20MVC%20Vs%20JSF" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-mvc-vs-jsf%2F&amp;title=Spring%20MVC%20Vs%20JSF" id="wpa2a_18"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/spring-mvc-vs-jsf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring: framework of whole J2EE</title>
		<link>https://www.rizzimichele.it/spring-the-framework-of-the-enteire-j2ee/</link>
		<comments>https://www.rizzimichele.it/spring-the-framework-of-the-enteire-j2ee/#comments</comments>
		<pubDate>Sat, 05 Jul 2014 13:55:03 +0000</pubDate>
		<dc:creator><![CDATA[Michele Rizzi]]></dc:creator>
				<category><![CDATA[All articles (75)]]></category>
		<category><![CDATA[Programming languages (51)]]></category>
		<category><![CDATA[Software engineering, architectures and distribuited systems (16)]]></category>

		<guid isPermaLink="false">http://www.rizzimichele.it/?p=277</guid>
		<description><![CDATA[In the precedent page I&#8217;ve talked about J2EE and the main technologies, in a few word J2EE is composed by this layers: Presentation layer business layer persistence layer database (ETL) Each layer have a lot of frameworks to simplify the way to make it: Presentation tier (JSF, Primefaces, Richfaces, struts) that I used in affittavetrina Business [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a title="EJB and J2EE" href="http://www.rizzimichele.it/enterprise-java-beans-and-all-j2ee/">In the precedent page</a> I&#8217;ve talked about J2EE and the main technologies, in a few word J2EE is composed by this layers:</p>
<ol>
<li>Presentation layer</li>
<li>business layer</li>
<li>persistence layer</li>
<li>database (ETL)</li>
</ol>
<p>Each layer have a lot of frameworks to simplify the way to make it:</p>
<ol>
<li>Presentation tier (JSF, Primefaces, Richfaces, struts) that I used in affittavetrina</li>
<li>Business tier:web services, RMI, EJB etc</li>
<li>persistence tier: hibernate, jpa</li>
<li>database: oracle, mysql, DB2</li>
</ol>
<p>But there is an universal framework that allows to make the whole J2EE, the tiers from 1 to 3, this framework is SPRING and offers the following tools:</p>
<ul>
<li><strong>Spring Model and view</strong>: these libraries allow to make the presentation tier in simple html (without any conversion like jsf) and the browser calls a server using <a title="REST services" href="http://www.rizzimichele.it/jpa-rest-and-soap/">REST services</a>: browser of the computer client sends a request to the server via GET or POST HTTP and the server receives this request, writes the response and sends it to the client.</li>
<li><strong>Spring Beans is</strong> the way for making the communication between client-server: server exposes these beans that client calls to get particular service. These beans contain all business logic that calls external web services or performs particular operations. Spring beans are better than EJB because they are easy to configure and they has three important functionality:
<ul>
<li><strong>Dependency injection: </strong>simplify to bind two beans one with the other and separates the creation of a client&#8217;s dependencies from its own behaviour: when one or more dependencies (or services) are injected, or passed by reference, into a dependent object (or client) they become part of the client&#8217;s state.</li>
<li><strong>Aspect programming: </strong>allows the developer to call a method of a bean after, before or around that an event is generated.</li>
<li><strong>Scheduling: </strong>it is possible to schedule the execution of a particular method of the bean for example once a week or once a minute or one time every 6000 ms etc. Like the Quartz framework</li>
</ul>
</li>
<li><strong>JDBC Template </strong>is the tool of Spring for the persistence of the data.</li>
</ul>
<h2><a href="http://www.rizzimichele.it/wp-content/uploads/2014/07/spring-overview.png"><img class="aligncenter size-full wp-image-279" alt="spring-overview" src="http://www.rizzimichele.it/wp-content/uploads/2014/07/spring-overview.png" width="579" height="447" /></a></h2>
<h2><strong>My Spring knowledge</strong></h2>
<p>I Used Spring <strong>model and view</strong> to develop only one small project for one company and I tested this technology to develop Affittavetrina but I preferred JSF because last year, when I developed affittaVetrina I didn&#8217;t know Spring well and I didn&#8217;t know that JSF causes memory out of bound exception.</p>
<p>Today I have made an example using all the two functionalities of Spring bean: <strong>Aspect programming</strong> and <strong>dependency injection</strong> and in a few hour I finished both these my small examples.</p>
<p>Today is the first day that I used <strong>aspect programming</strong> and I think that it is like the technology  used by WordPress  to call modules.</p>
<p>And also today<strong> I tested a simple scheduler</strong> of the execution of a Spring method. Every minute the method is executed as I expected.</p>
<p>Spring beans are used by <strong>mule technology</strong> that allows the integration of different systems for making workflows called mule flows, I use this technology in EON energy.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-the-framework-of-the-enteire-j2ee%2F&amp;linkname=Spring%3A%20framework%20of%20whole%20J2EE" title="Facebook" rel="nofollow" target="_blank"></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-the-framework-of-the-enteire-j2ee%2F&amp;linkname=Spring%3A%20framework%20of%20whole%20J2EE" title="Twitter" rel="nofollow" target="_blank"></a><a class="a2a_button_google_plus" href="http://www.addtoany.com/add_to/google_plus?linkurl=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-the-framework-of-the-enteire-j2ee%2F&amp;linkname=Spring%3A%20framework%20of%20whole%20J2EE" title="Google+" rel="nofollow" target="_blank"></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=https%3A%2F%2Fwww.rizzimichele.it%2Fspring-the-framework-of-the-enteire-j2ee%2F&amp;title=Spring%3A%20framework%20of%20whole%20J2EE" id="wpa2a_20"></a></p>]]></content:encoded>
			<wfw:commentRss>https://www.rizzimichele.it/spring-the-framework-of-the-enteire-j2ee/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
