<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DEEBSXYyeip7ImA9WhRWEE0.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887</id><updated>2011-12-27T18:24:18.892+01:00</updated><category term="Activity" /><category term="body movement" /><category term="Queue" /><category term="decision tree" /><category term="Service" /><category term="android" /><category term="business" /><category term="data mining" /><category term="client" /><category term="Ethernet Shield" /><category term="acceleration" /><category term="concept" /><category term="churn" /><category term=".net json google location api mobile cellID base station" /><category term="inductive programming" /><category term="Netduino" /><category term="SD Card" /><category term=".net wcf android rest json" /><category term="architecture" /><title>My Pet Projects</title><subtitle type="html">Software Development Blog</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://mypetprojects.blogspot.com/" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MyPetProjects" /><feedburner:info uri="mypetprojects" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DUICRXc4cCp7ImA9WhdaFkw.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-3867270438629626909</id><published>2011-10-23T11:40:00.011+02:00</published><updated>2011-10-26T10:26:04.938+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-26T10:26:04.938+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SD Card" /><category scheme="http://www.blogger.com/atom/ns#" term="Ethernet Shield" /><category scheme="http://www.blogger.com/atom/ns#" term="Netduino" /><title>Netduino: Using Ethernet Shield to Read/Write to SD Card</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-5DqBl4GDRjPl_C8WOl6s_81bdE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-5DqBl4GDRjPl_C8WOl6s_81bdE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-5DqBl4GDRjPl_C8WOl6s_81bdE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-5DqBl4GDRjPl_C8WOl6s_81bdE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;After successfully running a program that writes a file to SD card and then reads the content I've decided to summarize all the steps required in order to use Netduino with Ethernet Shield and SD card.&lt;br /&gt;&lt;br /&gt;First, you have to upgrade the firmware (I used v4.1.1.0 Beta 1 which can be found &lt;a href="http://forums.netduino.com/index.php?showtopic=1592"&gt;here&lt;/a&gt;. The detailed instructions about firmware upgrade are available at the same address.&lt;br /&gt;&lt;br /&gt;Next, you have to solder ICSP pin on your Netduino board and connect D4 with D10 with jumper wire as it is shown on pictures below.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-mJGEz1eqwN8/TqPj_EnRZ7I/AAAAAAAAAXA/CwcZw4IEHX4/s1600/Drawing1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://3.bp.blogspot.com/-mJGEz1eqwN8/TqPj_EnRZ7I/AAAAAAAAAXA/CwcZw4IEHX4/s400/Drawing1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5666623428871940018" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-771gH0vn8wI/TqPkb03_tVI/AAAAAAAAAXM/kd9fKeCCG6g/s1600/Drawing2.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 267px;" src="http://4.bp.blogspot.com/-771gH0vn8wI/TqPkb03_tVI/AAAAAAAAAXM/kd9fKeCCG6g/s400/Drawing2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5666623922863322450" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After adding the ICSP header and jumper wire, the hardware is ready and you can write a program to use the SD card reader.  Below is the example I used for test and it worked fine.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Threading;&lt;br /&gt;using Microsoft.SPOT;&lt;br /&gt;using Microsoft.SPOT.Hardware;&lt;br /&gt;using SecretLabs.NETMF.Hardware;&lt;br /&gt;using SecretLabs.NETMF.Hardware.Netduino;&lt;br /&gt;using SecretLabs.NETMF.IO;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;namespace NetduinoSD&lt;br /&gt;{&lt;br /&gt;    public class Program&lt;br /&gt;    {&lt;br /&gt;        public static void Main()&lt;br /&gt;        {&lt;br /&gt;            StorageDevice.MountSD("SD", SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);&lt;br /&gt;            using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Create))&lt;br /&gt;            {&lt;br /&gt;                StreamWriter streamWriter = new StreamWriter(filestream);&lt;br /&gt;                streamWriter.WriteLine("This is a test of the SD card support on the netduino...This is only a test...");&lt;br /&gt;                streamWriter.Close();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            using (var filestream = new FileStream(@"SD\dontpanic.txt", FileMode.Open))&lt;br /&gt;            {&lt;br /&gt;                StreamReader reader = new StreamReader(filestream);&lt;br /&gt;                Debug.Print(reader.ReadToEnd());&lt;br /&gt;                reader.Close();&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            StorageDevice.Unmount("SD");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The whole solution for Visual Studio 2010 can be found &lt;a href="http://www.2shared.com/file/mma_0y5m/HelloNetduinoSD.html"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-3867270438629626909?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/LWrMjyae-mI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/3867270438629626909/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2011/10/netduino-using-ethernet-shield-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/3867270438629626909?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/3867270438629626909?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/LWrMjyae-mI/netduino-using-ethernet-shield-to.html" title="Netduino: Using Ethernet Shield to Read/Write to SD Card" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-mJGEz1eqwN8/TqPj_EnRZ7I/AAAAAAAAAXA/CwcZw4IEHX4/s72-c/Drawing1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2011/10/netduino-using-ethernet-shield-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4NQXg9fyp7ImA9WhZWF0Q.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-4714955791261146576</id><published>2011-05-19T09:06:00.011+02:00</published><updated>2011-05-19T09:43:10.667+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-19T09:43:10.667+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".net json google location api mobile cellID base station" /><title>Retrieving Cell Informations using Google Location API</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_Kp5ehGJlXjVKi68__VPG1gpxqY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_Kp5ehGJlXjVKi68__VPG1gpxqY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_Kp5ehGJlXjVKi68__VPG1gpxqY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_Kp5ehGJlXjVKi68__VPG1gpxqY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-qOb_0PTcLtk/TdTIQCVSRuI/AAAAAAAAAPs/lUa08NAoHPk/s1600/lokacije%2Bklicev.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 269px;" src="http://1.bp.blogspot.com/-qOb_0PTcLtk/TdTIQCVSRuI/AAAAAAAAAPs/lUa08NAoHPk/s400/lokacije%2Bklicev.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5608327613812721378" /&gt;&lt;/a&gt;&lt;br /&gt;Recently I examined the records of events stored on my phone. The list contained the informations about MCC (Mobile Country Code), MNC (Mobile Network Code), LAC (Location Area Code) and CellID from which it is possible to get the informations about the mobile cell's location.&lt;br /&gt;&lt;br /&gt;Below is the code that retrieves the data from Google Location API with JSON.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;using Newtonsoft.Json;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;namespace CellLocations&lt;br /&gt;{&lt;br /&gt;    public class GoogleService&lt;br /&gt;    {&lt;br /&gt;        public GoogleCell GetCellInfo(string lac, string mnc, string mcc, string cellID)&lt;br /&gt;        {&lt;br /&gt;            HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("https://www.google.com/loc/json");&lt;br /&gt;            myReq.Method = "POST";&lt;br /&gt;            myReq.ContentType = "application/jsonrequest";&lt;br /&gt;            string postData = "{\"cell_towers\": [{\"location_area_code\": \"" + lac +"\", \"mobile_network_code\": \"" + mnc + "\", \"cell_id\": \"" + cellID + "\", \"mobile_country_code\": \"" + mcc + "\"}], \"version\": \"1.1.0\", \"request_address\": \"true\"}";&lt;br /&gt;            myReq.ContentLength = postData.Length;&lt;br /&gt;&lt;br /&gt;            StreamWriter stOut = new StreamWriter(myReq.GetRequestStream(), System.Text.Encoding.ASCII);&lt;br /&gt;            stOut.Write(postData);&lt;br /&gt;            stOut.Close();&lt;br /&gt;&lt;br /&gt;            HttpWebResponse webresponse;&lt;br /&gt;            webresponse = (HttpWebResponse)myReq.GetResponse();&lt;br /&gt;            Encoding enc = System.Text.Encoding.UTF8;&lt;br /&gt;            StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(), enc);&lt;br /&gt;&lt;br /&gt;            string Response = loResponseStream.ReadToEnd();&lt;br /&gt;            loResponseStream.Close();&lt;br /&gt;            webresponse.Close();&lt;br /&gt;&lt;br /&gt;            GoogleCell cell = JsonConvert.DeserializeObject&lt;GoogleCell&gt;(Response);&lt;br /&gt;            return cell;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In order to deserialize the received data an appropriate class has to be created:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class GoogleCell&lt;br /&gt;    {&lt;br /&gt;        public GoogleCell() { }&lt;br /&gt;        public GoogleCell(string mnc, string mcc, string lac)&lt;br /&gt;        {&lt;br /&gt;            this.Mnc = mnc;&lt;br /&gt;            this.Mcc = mcc;&lt;br /&gt;            this.Lac = lac;&lt;br /&gt;        }&lt;br /&gt;        public string Mnc { get; set; }&lt;br /&gt;        public string Mcc { get; set; }&lt;br /&gt;        public string Lac { get; set; }&lt;br /&gt;        public string CellID { get; set; }&lt;br /&gt;        public Location location { get; set; }&lt;br /&gt;        &lt;br /&gt;&lt;br /&gt;        public class Location&lt;br /&gt;        {&lt;br /&gt;            public Location() { }&lt;br /&gt;            public Location(string latitude, string longitude, string accuracy)&lt;br /&gt;            {&lt;br /&gt;                this.latitude = latitude;&lt;br /&gt;                this.longitude = longitude;&lt;br /&gt;                this.accuracy = accuracy;&lt;br /&gt;            }&lt;br /&gt;            public string latitude { get; set; }&lt;br /&gt;            public string longitude { get; set; }&lt;br /&gt;            public string accuracy { get; set; }&lt;br /&gt;            public Address address { get; set; }&lt;br /&gt;&lt;br /&gt;            public class Address&lt;br /&gt;            {&lt;br /&gt;                public Address() { }&lt;br /&gt;                public string country { get; set; }&lt;br /&gt;                public string country_code { get; set; }&lt;br /&gt;                public string city { get; set; }&lt;br /&gt;                public string street { get; set; }&lt;br /&gt;                public string street_number { get; set; }&lt;br /&gt;                public string postal_code { get; set; }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The JSON library for .NET is available &lt;a href="http://james.newtonking.com/pages/json-net.aspx"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-4714955791261146576?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/yq0hzxY8a7A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/4714955791261146576/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2011/05/retrieving-cell-informations-using.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/4714955791261146576?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/4714955791261146576?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/yq0hzxY8a7A/retrieving-cell-informations-using.html" title="Retrieving Cell Informations using Google Location API" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-qOb_0PTcLtk/TdTIQCVSRuI/AAAAAAAAAPs/lUa08NAoHPk/s72-c/lokacije%2Bklicev.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2011/05/retrieving-cell-informations-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EGQn46eCp7ImA9WhZWGEU.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-7899740917566564093</id><published>2010-05-29T12:22:00.022+02:00</published><updated>2011-05-20T12:00:23.010+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-20T12:00:23.010+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="decision tree" /><category scheme="http://www.blogger.com/atom/ns#" term="inductive programming" /><category scheme="http://www.blogger.com/atom/ns#" term="churn" /><category scheme="http://www.blogger.com/atom/ns#" term="data mining" /><category scheme="http://www.blogger.com/atom/ns#" term="business" /><title>Constructing Decision Tree using WEKA</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/c2eQBciXgnVSMlPtjrduZwo7nWI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c2eQBciXgnVSMlPtjrduZwo7nWI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/c2eQBciXgnVSMlPtjrduZwo7nWI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c2eQBciXgnVSMlPtjrduZwo7nWI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/TAJ0WmYb04I/AAAAAAAAANk/MuZfcgdu6BM/s1600/Information-Gain.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;span style="font-size:180%;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Decision tree learning is a method for assessing the most likely outcome value by taking into account the known values of the stored data instances. This learning method is among the most popular of inductive inference algorithms and has been successfully applied in broad range of tasks such as assessing the credit risk of applicants and improving loyality of regular customers.&lt;/div&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;Information, Entropy and Information Gain&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;There are several software tools already available which implement various algorithms for constructing decision trees which optimally fit the input dataset. Nevertheless it is useful to clarify the underlying principle.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Information&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;First let's briefly discuss the concept of information. In simplified form we could say that the information is a measure of uncertainty or surprise; the more we are surprised about the news the bigger is the information. If there was a newspaper which pubblished a news about the morning sunrise certainly none of the readers would be interested in such story because it doesn't hold any information - the sunrise is a fact and we know it will happen tomorrow again. On the other hand if a story in a newspaper is about something noone expected it's a big news. An example is Michael Jackson's death. It happened during the time of one of the worst recessions which affected the whole world but according to the statistics the news about Michael Jackson were far more interesting than the economic facts of the time.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:130%;"&gt;Entropy&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In General entropy is the measure of the uncertainty associated with random variable. In case of stored instances entropy is the measure of the uncertainty associated with the selected attribute.&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:180%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();}  catch(e) {}" href="http://3.bp.blogspot.com/_5IscwJQSAUY/TAD9CwI9FJI/AAAAAAAAAM8/m3w8fsVD9y8/s1600/entropy.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 244px; height: 48px;" src="http://3.bp.blogspot.com/_5IscwJQSAUY/TAD9CwI9FJI/AAAAAAAAAM8/m3w8fsVD9y8/s400/entropy.png" alt="" id="BLOGGER_PHOTO_ID_5476655370606548114" border="0" /&gt;&lt;/a&gt;&lt;span style="font-size:100%;"&gt;where &lt;img class="tex" alt="p(x_i)\," src="http://upload.wikimedia.org/math/e/d/9/ed9e3ca7c710634c58ba420d673aa72b.png" /&gt;  is the probability mass function of  outcome &lt;img class="tex" alt="x_i\," src="http://upload.wikimedia.org/math/a/c/8/ac840fba3ce6957bef1a8b6fd5044da3.png" /&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;Information Gain&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Information gain is the expected reduction in entropy caused by partitioning the examples according to the attribute. In machine learning this concept can be used to define a preferred  sequence of attributes to investigate to most rapidly narrow down the  state of &lt;i&gt;the selected attribute&lt;/i&gt;. Such a sequence (which depends on the outcome of the  investigation of previous attributes at each stage) forms a decision tree. Usually an attribute  with high information gain should be preferred to other attributes.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/TAJ0WmYb04I/AAAAAAAAANk/MuZfcgdu6BM/s1600/Information-Gain.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 59px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/TAJ0WmYb04I/AAAAAAAAANk/MuZfcgdu6BM/s400/Information-Gain.jpg" alt="" id="BLOGGER_PHOTO_ID_5477068028444922754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:180%;"&gt;An Example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The process of decision tree construction is described by the following example: There are 14 instances stored in the database described with 6 attributes: day, outlook, temperature, humidity, wind and playTennis. Each instance describes the facts of the day and the action of the observed person (played or not played tennis). Based on the given record we can assess which factors affected the person's decision about playing tennis.&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try  {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/TAENHMPBDuI/AAAAAAAAANU/2g6s6GVU9xI/s1600/WEKA-classify.jpg"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try  {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/TAECFg4suTI/AAAAAAAAANE/TcQrvrLJRmk/s1600/tennis-table.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 219px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/TAECFg4suTI/AAAAAAAAANE/TcQrvrLJRmk/s400/tennis-table.jpg" alt="" id="BLOGGER_PHOTO_ID_5476660915609581874" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;For the root element an attribute with the highest entropy is selected. In the case of this example it is the outlook because it is the most uncertain parameter.&lt;br /&gt;After the root parameter is selected the information gain for every possible combination of pair is calculated and then the branches are selected upon the information gain value; the higher is the information gain the more reliable the branch is.&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/TAJ1_hw_7EI/AAAAAAAAAN0/uLQzlV8JDNU/s1600/Entropy.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 49px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/TAJ1_hw_7EI/AAAAAAAAAN0/uLQzlV8JDNU/s400/Entropy.jpg" alt="" id="BLOGGER_PHOTO_ID_5477069831092038722" border="0" /&gt;&lt;/a&gt;Entropy(S) is the entropy of classificator PlayTennis - there are 14 instances stored in the dataset from which a person decides do play tennis 9 times (9+) and not to play 5 times (5-).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_5IscwJQSAUY/TAJ3sHZLMwI/AAAAAAAAAN8/Z1i5wMiVjXw/s1600/values.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 198px; height: 96px;" src="http://4.bp.blogspot.com/_5IscwJQSAUY/TAJ3sHZLMwI/AAAAAAAAAN8/Z1i5wMiVjXw/s400/values.jpg" alt="" id="BLOGGER_PHOTO_ID_5477071696618533634" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/TAJ4LIS0YnI/AAAAAAAAAOE/Wm0jAVzwar0/s1600/gaincalc.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 100px;" src="http://1.bp.blogspot.com/_5IscwJQSAUY/TAJ4LIS0YnI/AAAAAAAAAOE/Wm0jAVzwar0/s400/gaincalc.jpg" alt="" id="BLOGGER_PHOTO_ID_5477072229436252786" border="0" /&gt;&lt;/a&gt;The above example shows the calculation of the information gain value of classificator Wind: There are 8 instances of value Weak. In case of weak wind a person decides to play tennis 6 times and not to play 2 times [6+, 2-]. In case of strong wind (6 instances) the user decides to play 3 times and not to play 3 times as well. Considering the given instances the calculated value of information gain of attribute wind is 0.48.&lt;br /&gt;&lt;br /&gt;Information gain values of all attributes are calculated in the same way and the results are the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Gain(S, Outlook) = 0.246&lt;br /&gt;Gain(S, Humidity) = 0.151&lt;br /&gt;Gain(S, Wind) = 0.048&lt;br /&gt;Gain(S, Temperature) = 0.029&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;Using WEKA&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The example is taken from the Book &lt;a href="http://www.amazon.com/Data-Mining-Practical-Techniques-Management/dp/0120884070/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1275135833&amp;amp;sr=1-1"&gt;Data  Mining: Practical Machine Learning Tools and Techniques, Second Edition  (Morgan Kaufmann Series in Data Management Systems)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;The .arff file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of possible options for importing the record in WEKA tool is writing records in .arff file format. In this example the file looks like the following:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;@relation PlayTennis&lt;/span&gt;  &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;@attribute day numeric&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;@attribute outlook {Sunny, Overcast, Rain}&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;@attribute temperature {Hot, Mild, Cool}&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;@attribute humidity {High, Normal}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;@attribute wind {Weak, Strong}&lt;/span&gt; &lt;br /&gt;&lt;span style="font-style: italic;"&gt;@attribute playTennis {Yes, No}&lt;/span&gt;  &lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;@data&lt;/span&gt;  &lt;br /&gt;&lt;span style="font-style: italic;"&gt;1,Sunny,Hot,High,Weak,No,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;2,Sunny,Hot,High,Strong,No,?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;3,Overcast,Hot,High,Weak,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;4,Rain,Mild,High,Weak,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;5,Rain,Cool,Normal,Weak,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;6,Rain,Cool,Normal,Strong,No,?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;7,Overcast,Cool,Normal,Strong,Yes,?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;8,Sunny,Mild,High,Weak,No,?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;9,Sunny,Cool,Normal,Weak,Yes,?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;10,Rain,Mild,Normal,Weak,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;11,Sunny,Mild,Normal,Strong,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;12,Overcast,Mild,High,Strong,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;13,Overcast,Hot,Normal,Weak,Yes,?&lt;/span&gt; &lt;span style="font-style: italic;"&gt;&lt;br /&gt;14,Rain,Mild,High,Strong,No,?&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The file can  then be imported using WEKA explorer. When the above file is imported the interface looks like the following:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:180%;"&gt;&lt;a onblur="try  {parent.deselectBloggerImageGracefully();}  catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/TAEF0QII6AI/AAAAAAAAANM/okcrhhQqDvc/s1600/WEKA-explorer.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 299px;" src="http://1.bp.blogspot.com/_5IscwJQSAUY/TAEF0QII6AI/AAAAAAAAANM/okcrhhQqDvc/s400/WEKA-explorer.jpg" alt="" id="BLOGGER_PHOTO_ID_5476665017099675650" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;Figure: Available attributes (left) and graphical representation (right) from the file data&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;after the data is imported there is a set of classification methods available under the classification tab&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-style: italic;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt; In this case the c4.5 algorithm has been chosen which is entitled as j48 in Java and can be selected by clicking the button choose and select trees-&gt;j48.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try  {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/TAENHMPBDuI/AAAAAAAAANU/2g6s6GVU9xI/s1600/WEKA-classify.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_5IscwJQSAUY/TAENHMPBDuI/AAAAAAAAANU/2g6s6GVU9xI/s400/WEKA-classify.jpg" alt="" id="BLOGGER_PHOTO_ID_5476673039053688546" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;Figure: after running Start The decision tree is created in this case using&lt;a href="http://en.wikipedia.org/wiki/C4.5_algorithm"&gt; c4.5 algorithm&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span&gt;The tree is then created by selecting start and can be displayed by selecting the output from the result list with the right-mouse button choosing the option "Visualize Tree"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-size:100%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/TAEP2TKtnBI/AAAAAAAAANc/f3kYf6vcuxo/s1600/WEKA-tree.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 321px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/TAEP2TKtnBI/AAAAAAAAANc/f3kYf6vcuxo/s400/WEKA-tree.jpg" alt="" id="BLOGGER_PHOTO_ID_5476676047391792146" border="0" /&gt;&lt;/a&gt;Figure: The decision tree constructed by using the implemented &lt;a href="http://en.wikipedia.org/wiki/C4.5_algorithm"&gt;C4.5 algorithm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;The algorithm implemented in WEKA constructs the tree which is consistent with the information gain values calculated above: the attribute Outlook has the highest information gain thus it is the root attribute. Attributes Humidity and Wind have lower information gain than Outlook and higher than Temperature and thus are placed below Outlook. The information gain of a specific branch can be calculated the same way as the example above. For example if we were interested what is the information gain of branch (Outlook, Temperature) the attributes Outlook and Temperature should be placed in the equation for calculating the information gain.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Data Mining and KnowledgeDiscovery; Prof. Dr. Nada Lavrač&lt;span style="font-size:100%;"&gt;&lt;span id="btAsinTitle" style=""&gt;&lt;br /&gt;&lt;br /&gt;Data Mining:  Practical Machine Learning Tools and Techniques, Second Edition; &lt;/span&gt;&lt;span class="h3color"&gt;Ian H. Witten, &lt;/span&gt;&lt;span class="h3color"&gt;Eibe Frank&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-7899740917566564093?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/x1XR6g2c4JQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/7899740917566564093/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2010/05/decision-tree-with-weka-part-i.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/7899740917566564093?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/7899740917566564093?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/x1XR6g2c4JQ/decision-tree-with-weka-part-i.html" title="Constructing Decision Tree using WEKA" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_5IscwJQSAUY/TAD9CwI9FJI/AAAAAAAAAM8/m3w8fsVD9y8/s72-c/entropy.png" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2010/05/decision-tree-with-weka-part-i.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQCSHo6fip7ImA9WxFXFk4.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-1829191833114962424</id><published>2010-05-23T17:45:00.006+02:00</published><updated>2010-05-23T18:32:49.416+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-23T18:32:49.416+02:00</app:edited><title>LDPC Block Code Simulator: GUI Preview</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7_OYsmcxZYrNzbMNloc_lJ73amw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7_OYsmcxZYrNzbMNloc_lJ73amw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7_OYsmcxZYrNzbMNloc_lJ73amw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7_OYsmcxZYrNzbMNloc_lJ73amw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;In the past days I've created a &lt;a href="http://en.wikipedia.org/wiki/Low-density_parity-check_code"&gt;LDPC &lt;/a&gt;Block Code Simulator in Matlab. It is possible to enter the parity matrix H, the information sequence D which is encoded into codeword C and then add &lt;a href="http://en.wikipedia.org/wiki/Additive_white_Gaussian_noise"&gt;Gaussian Noise&lt;/a&gt; of a chosen variance which simulates the transmission channel charcteristics.&lt;br /&gt;&lt;br /&gt;The simulator then calculates the original codeword and enables user to switch between the steps of the iterative decoding process. Each step displays the current message values that are passed between symbol and parity nodes and the next step operation.&lt;br /&gt;&lt;br /&gt;Below are the screenshots of three steps. In this example H is 4 x 8 parity-check matrix ([1 0 1 0 1 0 0 0; 0 0 0 1 0 1 0 0; 1 0 0 1 0 0 1 0; 0 1 1 0 0 0 0 1]). The information sequence D ([1 0 1 1]) is encoded into codeword C (1  0  1  1  0  1  0  1). The original unipolar codeword is  transformed to bipolar code (1 is transformed to -1 and 0 is transformed to 1) and the noise of variance 0.5 is added to the transformed code which results Y (-1.0371     0.12971     -1.1976      -1.808      1.3784     -1.3998      1.0451     -1.2452), the simulated received sequence. After 5 steps the algorithm determines the codeword C' (1  0  1  1  0  1  0  1) which is equal to the original codeword.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lSjqyUXqI/AAAAAAAAAMI/GVnHPVW1Ty4/s1600/LDPCSim1.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 238px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lSjqyUXqI/AAAAAAAAAMI/GVnHPVW1Ty4/s400/LDPCSim1.jpg" alt="" id="BLOGGER_PHOTO_ID_5474497594779786914" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lT51I3a5I/AAAAAAAAAMQ/6VOEU-GHYq4/s1600/LDPCSim2.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 238px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lT51I3a5I/AAAAAAAAAMQ/6VOEU-GHYq4/s400/LDPCSim2.jpg" alt="" id="BLOGGER_PHOTO_ID_5474499075027463058" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lUOFS601I/AAAAAAAAAMY/N26g5_z5U9w/s1600/LDPCSim3.jpg"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 238px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lUOFS601I/AAAAAAAAAMY/N26g5_z5U9w/s400/LDPCSim3.jpg" alt="" id="BLOGGER_PHOTO_ID_5474499422961980242" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-1829191833114962424?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/kBv7paWMYto" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/1829191833114962424/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2010/05/ldpc-block-code-simulator-gui-preview.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/1829191833114962424?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/1829191833114962424?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/kBv7paWMYto/ldpc-block-code-simulator-gui-preview.html" title="LDPC Block Code Simulator: GUI Preview" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_5IscwJQSAUY/S_lSjqyUXqI/AAAAAAAAAMI/GVnHPVW1Ty4/s72-c/LDPCSim1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2010/05/ldpc-block-code-simulator-gui-preview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEGRHk5cSp7ImA9WxJSFE0.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-7408580327357107813</id><published>2009-05-03T20:45:00.019+02:00</published><updated>2009-05-04T04:37:05.729+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-04T04:37:05.729+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term=".net wcf android rest json" /><title>Communication Between WCF Service and Android Client</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lss7PtlWPY8VurfECa8LT4l37Ps/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lss7PtlWPY8VurfECa8LT4l37Ps/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lss7PtlWPY8VurfECa8LT4l37Ps/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lss7PtlWPY8VurfECa8LT4l37Ps/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/Sf3zGLltL4I/AAAAAAAAAJI/VLDKAA-Bm_M/s1600-h/data+exchange.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 342px; height: 400px;" src="http://1.bp.blogspot.com/_5IscwJQSAUY/Sf3zGLltL4I/AAAAAAAAAJI/VLDKAA-Bm_M/s400/data+exchange.jpg" alt="" id="BLOGGER_PHOTO_ID_5331684821392240514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;Overview of REST in WCF&lt;/span&gt;&lt;br /&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;Windows Communication Foundation (WCF), part of the .NET Framework, provides the first unified programming model for rapidly building service-oriented applications. It enables the development of secure, reliable, transacted services that interoperate with current Microsoft investments and non-Microsoft platforms.&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;With the .NET Framework 3.5 release, WCF added support for building REST style services. REST, an architectural style for building distributed hypermedia driven applications, involves building resource-oriented services by defining resources that implement uniform interfaces using standard HTTP verbs (GET, POST, PUT, and DELETE), and that can be located/identified by a URI.&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;REST support within WCF was enhanced with the release of .NET Framework 3.5 SP1 to add make REST development easier and to support the ADO.NET Entity Framework entities in WCF contracts. Improvements were made around UriTemplate flexibility and the Visual Studio tooling to increase developer productivity.&lt;/p&gt;&lt;p style="font-weight: bold; font-family: verdana;"&gt;Code example&lt;br /&gt;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;A good tutorial on how to create RESTful Service using Visual Studio can be found &lt;a href="http://msdn.microsoft.com/en-us/library/dd203052.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;First we need to define the structure (class) which will be used for data exchange between server and client. In this case I created a base class named Response and extended classes named ActivityStatusResponse and ConnectionStatusResponse:&lt;/p&gt;&lt;div id="iframeDiveb7b9e73-4512-4666-ba7b-0d9fcc4cc610" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframeeb7b9e73-4512-4666-ba7b-0d9fcc4cc610" src="http://www.blogtrog.com/code.aspx?id=eb7b9e73-4512-4666-ba7b-0d9fcc4cc610" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDiveb7b9e73-4512-4666-ba7b-0d9fcc4cc610" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comment;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Successful&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;set&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  successful &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Comment&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comment;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;set&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  comment &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('eb7b9e73-4512-4666-ba7b-0d9fcc4cc610');&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="iframeDiv7be2fc22-46f6-4bea-8dc0-8d2928563a10" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframe7be2fc22-46f6-4bea-8dc0-8d2928563a10" src="http://www.blogtrog.com/code.aspx?id=7be2fc22-46f6-4bea-8dc0-8d2928563a10" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDiv7be2fc22-46f6-4bea-8dc0-8d2928563a10" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse : Response&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activity;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Activity&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activity;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;set&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  activity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('7be2fc22-46f6-4bea-8dc0-8d2928563a10')&lt;/script&gt;&lt;br /&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;Next we need to define the methods, message formats and URI templates in the interface:&lt;/p&gt;&lt;div id="iframeDivee2665bb-d6d3-4970-8f1b-19472ba93eb7" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframeee2665bb-d6d3-4970-8f1b-19472ba93eb7" src="http://www.blogtrog.com/code.aspx?id=ee2665bb-d6d3-4970-8f1b-19472ba93eb7" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDivee2665bb-d6d3-4970-8f1b-19472ba93eb7" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;[OperationContract]&lt;br /&gt;[WebGet(ResponseFormat &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; WebMessageFormat.Json, UriTemplate &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;/{strSessionString}/activityStatus&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)]&lt;br /&gt;ActivityStatusResponse GetActivityStatus(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString);&lt;br /&gt;&lt;br /&gt;[OperationContract]&lt;br /&gt;[WebGet(ResponseFormat &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; WebMessageFormat.Json,&lt;br /&gt;UriTemplate &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;/{strSessionString}/time={time}&amp;amp;lat={latitude}&amp;amp;long={longitude}&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)]&lt;br /&gt;Response StoreLocation(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; time, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; latitude, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; longitude);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('ee2665bb-d6d3-4970-8f1b-19472ba93eb7&lt;/script&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;WebMessageFormat parameter defines the data exchange format. In this example JSON format is used.&lt;br /&gt;&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;UriTemplate parameter defines the URI template.&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;The parameters within curly braces represent variable values. Everything else in the URI (not enclosed within curly braces) is considered a static part of the URI.&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;After the definition we have to implement the methods. The following code shows the implementation of StoreAcceleration method:&lt;br /&gt;&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div id="iframeDivd000962f-ccca-4659-961e-f8202bcdc0cd" style="margin: 0px; display: none; text-align: justify;"&gt;&lt;iframe id="iframed000962f-ccca-4659-961e-f8202bcdc0cd" src="http://www.blogtrog.com/code.aspx?id=d000962f-ccca-4659-961e-f8202bcdc0cd" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDivd000962f-ccca-4659-961e-f8202bcdc0cd" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response StoreAcceleration(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strMeasurementTime, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strAccelerationX, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strAccelerationY, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strAccelerationZ)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;      {&lt;br /&gt;SQLWorks sqlWorks &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; SQLWorks();&lt;br /&gt;Response response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strTime &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strMeasurementTime.Replace(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;_&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;  DateTime measurementTime &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DateTime.ParseExact(strTime, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;yyyy-MM-dd HH:mm:ss:fff&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationX &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Convert.ToDouble(strAccelerationX.Replace(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationY &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Convert.ToDouble(strAccelerationY.Replace(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationZ &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Convert.ToDouble(strAccelerationZ.Replace(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;&lt;br /&gt;  sqlWorks.StoreAcceleration(strSessionString, measurementTime, accelerationX, accelerationY, accelerationZ);&lt;br /&gt;&lt;br /&gt;  response.Successful &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;  response.Comment &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Stored!&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception ex)&lt;br /&gt;{&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ex.ToString();&lt;br /&gt;  response.Comment &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;an error occured!&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;  response.Successful &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('d000962f-ccca-4659-961e-f8202bcdc0cd');&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The service Endpoint and other properties are defined in .config file:&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&lt;div&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;configuration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.web&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;compilation &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;debug&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;compilation&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.servicemodel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;bindings&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;webhttpbinding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;binding &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DefaultBinding"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;binding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;webhttpbinding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpointbehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTFriendly"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;webhttp&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;webhttp&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTServer.JsonServiceAspNetAjaxBehavior"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;enablewebscript&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;enablewebscript&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicebehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTFriendly"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicemetadata &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;httpgetenabled&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicedebug &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;includeexceptiondetailinfaults&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="false"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicedebug&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicemetadata&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;service &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTServer.GaitLinkService"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpoint &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;address&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=""&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; behaviorconfiguration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTFriendly"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; binding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="webHttpBinding"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; bindingconfiguration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DefaultBinding"&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; contract&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="RESTServer.IGaitLinkService"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;identity&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;dns &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="localhost"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;dns&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;identity&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpoint&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;service&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicehostingenvironment &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;aspnetcompatibilityenabled&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicehostingenvironment&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;servicebehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpointbehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;bindings&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.servicemodel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.web&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;configuration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('c85a3db3-2dce-47c7-a915-0788b46a1d9a');&lt;/script&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-family: verdana;"&gt;At this point everything is ready to host the service in the windows application:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="iframeDiv8126d1ef-b3a3-4da9-b8e6-1f234f92ba57" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframe8126d1ef-b3a3-4da9-b8e6-1f234f92ba57" src="http://www.blogtrog.com/code.aspx?id=8126d1ef-b3a3-4da9-b8e6-1f234f92ba57" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDiv8126d1ef-b3a3-4da9-b8e6-1f234f92ba57" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; StartRestService()&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;   WebHttpBinding binding &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; WebHttpBinding();&lt;br /&gt;   RESTServiceHost &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ServiceHost(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;typeof&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(GaitLinkService), &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Uri(&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;http://localhost:8000/GaitLink&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;   RESTServiceHost.AddServiceEndpoint(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;typeof&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(IGaitLinkService), binding, &lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;GaitLink&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;   RESTServiceHost.Open();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception ex)&lt;br /&gt;{&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ex.ToString();&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;TODO: notify user about the error!&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            }&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('8126d1ef-b3a3-4da9-b8e6-1f234f92ba57');&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="font-weight: bold; font-family: verdana;"&gt;Client application&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;On client side there is a service called CommunicationService and additional class RestClient. Function arguments are sent to the server by generating the url address which has to be the same format as the template specified in the service interface on the server side.&lt;br /&gt;&lt;/p&gt;&lt;p style="text-align: justify; font-family: verdana;"&gt;Class RestClient.java:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="iframeDiv8f7cb0a7-2065-4e23-9781-96e90d4f5780" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframe8f7cb0a7-2065-4e23-9781-96e90d4f5780" src="http://www.blogtrog.com/code.aspx?id=8f7cb0a7-2065-4e23-9781-96e90d4f5780" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDiv8f7cb0a7-2065-4e23-9781-96e90d4f5780" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;package&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; com.client.gaitlink;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; java.io.BufferedReader;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; java.io.IOException;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; java.io.InputStream;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; java.io.InputStreamReader;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.HttpEntity;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.HttpResponse;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.client.ClientProtocolException;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.client.HttpClient;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.client.methods.HttpGet;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.apache.http.impl.client.DefaultHttpClient;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.json.JSONArray;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.json.JSONException;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; org.json.JSONObject;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;import&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; android.util.Log;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; RestClient {&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String loginParameters;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String accelerationParameters;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String activityRequestParameters;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String locationParameters;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String serviceAddress &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;http://testserver:8000/GaitLink/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String convertStreamToString(InputStream is) {&lt;br /&gt;BufferedReader reader &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; BufferedReader(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; InputStreamReader(is));&lt;br /&gt;StringBuilder sb &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; StringBuilder();&lt;br /&gt;&lt;br /&gt;String line &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;while&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ((line &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; reader.readLine()) &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;) {&lt;br /&gt;  sb.append(line &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (IOException e) {&lt;br /&gt;e.printStackTrace();&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;finally&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; {&lt;br /&gt;  is.close();&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (IOException e) {&lt;br /&gt;  e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sb.toString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; connect(String url) {&lt;br /&gt;&lt;br /&gt;HttpClient httpclient &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DefaultHttpClient();&lt;br /&gt;&lt;br /&gt;HttpGet httpget &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; HttpGet(url);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;HttpPost httppost = new HttpPost(url);&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;HttpResponse response;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; {&lt;br /&gt;&lt;br /&gt;response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; httpclient.execute(httpget);&lt;br /&gt;&lt;br /&gt;Log.i(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;REST:Response Status line&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, response.getStatusLine().toString());&lt;br /&gt;&lt;br /&gt;HttpEntity entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getEntity();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;) {&lt;br /&gt;&lt;br /&gt;  InputStream instream &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; entity.getContent();&lt;br /&gt;  String result &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; convertStreamToString(instream);&lt;br /&gt;  Log.i(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;REST: result&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, result);&lt;br /&gt;&lt;br /&gt;  JSONObject json &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; JSONObject(result);&lt;br /&gt;  Log.i(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;REST&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;jsonobject&amp;gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toString()&lt;br /&gt;          &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\n&amp;lt;/jsonobject&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Parsing&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;                JSONArray nameArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.names();&lt;br /&gt;  JSONArray valArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toJSONArray(nameArray);&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; valArray.length(); i&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;++&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;) {&lt;br /&gt;      Log&lt;br /&gt;              .i(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;REST&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;jsonname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;                      &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; nameArray.getString(i) &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\n&amp;lt;/jsonname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;                      &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;jsonvalue&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;                      &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; valArray.getString(i) &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\n&amp;lt;/jsonvalue&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;                      &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; i &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  json.put(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;sample key&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;sample value&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;  Log.i(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;REST&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;jsonobject&amp;gt;\n&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toString()&lt;br /&gt;          &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;\n&amp;lt;/jsonobject&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  instream.close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (ClientProtocolException e) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; TODO Auto-generated catch block&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            e.printStackTrace();&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (IOException e) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; TODO Auto-generated catch block&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            e.printStackTrace();&lt;br /&gt;} &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (JSONException e) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; TODO Auto-generated catch block&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            e.printStackTrace();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; isSuccessful() {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setSuccessful(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.successful &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String getComment() {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comment;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setComment(String comment) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.comment &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comment;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String comment;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response()&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful, String comment)&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.successful &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.comment &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; comment;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;extends&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String strSessionString;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse()&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;LoginFailed&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successful, String strSessionString, String comment)&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;super&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(successful, comment);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.strSessionString &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String getStrSessionString() {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setStrSessionString(String strSessionString) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.strSessionString &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strSessionString;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;extends&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String activity;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; String getActivity() {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activity;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setActivity(String activity) {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.activity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activity;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;boolean&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; successfull, String activity, String comment)&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;super&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(successfull, comment);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;.activity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activity;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse()&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;activity request failed&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; SetLoginParameters(String username, String password)&lt;br /&gt;{&lt;br /&gt;loginParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Login?username=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; username &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;password=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; password;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse Login(String username, String password)&lt;br /&gt;{&lt;br /&gt;SetLoginParameters(username, password);&lt;br /&gt;&lt;br /&gt;HttpClient httpclient &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DefaultHttpClient();&lt;br /&gt;HttpGet httpget &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; HttpGet(serviceAddress &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; loginParameters);&lt;br /&gt;&lt;br /&gt;HttpResponse response;&lt;br /&gt;&lt;br /&gt;LoginResponse loginResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; httpclient.execute(httpget);&lt;br /&gt;&lt;br /&gt;HttpEntity entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getEntity();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;{&lt;br /&gt;  InputStream instream &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; entity.getContent();&lt;br /&gt;  String result &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; convertStreamToString(instream);&lt;br /&gt;  JSONObject json &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; JSONObject(result);&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Parsing&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;                JSONArray nameArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.names();&lt;br /&gt;  JSONArray valArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toJSONArray(nameArray);&lt;br /&gt;&lt;br /&gt;  loginResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse(valArray.getBoolean(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;2&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  instream.close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception e)&lt;br /&gt;{&lt;br /&gt;loginResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; LoginResponse();&lt;br /&gt;String sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e.toString();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; loginResponse;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response SendAccelerations(String sSession, String measurementTime, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ax, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ay, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; az)&lt;br /&gt;{&lt;br /&gt;setAccelerationParameters(sSession, measurementTime, ax, ay, az);&lt;br /&gt;&lt;br /&gt;HttpClient httpclient &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DefaultHttpClient();&lt;br /&gt;HttpGet httpget &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; HttpGet(serviceAddress &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationParameters);&lt;br /&gt;&lt;br /&gt;HttpResponse response;&lt;br /&gt;&lt;br /&gt;Response accelerationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; httpclient.execute(httpget);&lt;br /&gt;&lt;br /&gt;HttpEntity entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getEntity();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;{&lt;br /&gt;  InputStream instream &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; entity.getContent();&lt;br /&gt;  String result &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; convertStreamToString(instream);&lt;br /&gt;  JSONObject json &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; JSONObject(result);&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Parsing&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;                JSONArray nameArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.names();&lt;br /&gt;  JSONArray valArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toJSONArray(nameArray);&lt;br /&gt;&lt;br /&gt;  accelerationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response(valArray.getBoolean(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  instream.close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception e)&lt;br /&gt;{&lt;br /&gt;accelerationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response();&lt;br /&gt;String sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e.toString();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationResponse;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setAccelerationParameters(String sSession, String measurementTime, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ax, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ay, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; az)&lt;br /&gt;{&lt;br /&gt;accelerationParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sSession &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;/measurementTime=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; measurementTime &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;accelerationX=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ax &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;accelerationY=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ay &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;accelerationZ=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; az;&lt;br /&gt;accelerationParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; accelerationParameters.replaceAll(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;_&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response SendLocation(String sSession, String locationTime, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; latitude, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; longitude)&lt;br /&gt;{&lt;br /&gt;setLocationParameters(sSession, locationTime, latitude, longitude);&lt;br /&gt;&lt;br /&gt;HttpClient httpclient &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DefaultHttpClient();&lt;br /&gt;HttpGet httpget &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; HttpGet(serviceAddress &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; locationParameters);&lt;br /&gt;&lt;br /&gt;HttpResponse response;&lt;br /&gt;&lt;br /&gt;Response locationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; httpclient.execute(httpget);&lt;br /&gt;&lt;br /&gt;HttpEntity entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getEntity();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;{&lt;br /&gt;  InputStream instream &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; entity.getContent();&lt;br /&gt;  String result &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; convertStreamToString(instream);&lt;br /&gt;  JSONObject json &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; JSONObject(result);&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Parsing&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;                JSONArray nameArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.names();&lt;br /&gt;  JSONArray valArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toJSONArray(nameArray);&lt;br /&gt;&lt;br /&gt;  locationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response(valArray.getBoolean(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  instream.close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception e)&lt;br /&gt;{&lt;br /&gt;locationResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Response();&lt;br /&gt;String sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e.toString();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; locationResponse;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setLocationParameters(String sSession, String locationTime, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; latitude, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;double&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; longitude)&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;/{strSessionString}/time={time}&amp;amp;lat={latitude}&amp;amp;long={longitude}&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;        locationParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sSession &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;/time=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; locationTime &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;lat=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; latitude &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;long=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; longitude;&lt;br /&gt;locationParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; locationParameters.replaceAll(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;_&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse GetActivity(String sSession)&lt;br /&gt;{&lt;br /&gt;setActivityRequestParameters(sSession);&lt;br /&gt;&lt;br /&gt;HttpClient httpclient &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; DefaultHttpClient();&lt;br /&gt;HttpGet httpget &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; HttpGet(serviceAddress &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activityRequestParameters);&lt;br /&gt;&lt;br /&gt;HttpResponse response;&lt;br /&gt;&lt;br /&gt;ActivityStatusResponse activityStatusResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; httpclient.execute(httpget);&lt;br /&gt;&lt;br /&gt;HttpEntity entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getEntity();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(entity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;{&lt;br /&gt;  InputStream instream &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; entity.getContent();&lt;br /&gt;  String result &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; convertStreamToString(instream);&lt;br /&gt;  JSONObject json &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; JSONObject(result);&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;//&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt; Parsing&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;                JSONArray nameArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.names();&lt;br /&gt;  JSONArray valArray &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; json.toJSONArray(nameArray);&lt;br /&gt;&lt;br /&gt;  activityStatusResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse(valArray.getBoolean(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;), valArray.getString(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;2&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  instream.close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception e)&lt;br /&gt;{&lt;br /&gt;activityStatusResponse &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ActivityStatusResponse();&lt;br /&gt;String sDummy &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e.toString();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; activityStatusResponse;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; setActivityRequestParameters(String sSession)&lt;br /&gt;{&lt;br /&gt;activityRequestParameters &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;/&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sSession &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;+&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;/activityStatus&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('8f7cb0a7-2065-4e23-9781-96e90d4f5780')&lt;/script&gt;RestClient methods are called from CommunicationService class. The following example shows the method which retrieves the activity status:&lt;div id="iframeDivd8aa0914-6572-4e43-b18e-8f2c4ed392db" style="margin: 0px; display: none;"&gt;&lt;iframe id="iframed8aa0914-6572-4e43-b18e-8f2c4ed392db" src="http://www.blogtrog.com/code.aspx?id=d8aa0914-6572-4e43-b18e-8f2c4ed392db" style="border: 1px solid rgb(224, 224, 224); margin: 0px; width: 600px; height: 200px;" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id="noIframeDivd8aa0914-6572-4e43-b18e-8f2c4ed392db" style="margin: 0px; display: block;"&gt;&lt;pre&gt;&lt;div&gt;&lt;!--  Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/  --&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; requestActivity()&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(strSessionString &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;{&lt;br /&gt;  ActivityStatusResponse response &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; restClient.GetActivity(strSessionString);&lt;br /&gt;  connectionAvailable &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.isSuccessful();&lt;br /&gt;  strActivity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; response.getActivity();&lt;br /&gt;  &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(strActivity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; strActivity &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;""&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;)&lt;br /&gt;  {&lt;br /&gt;      announceActivityStatus();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(Exception e)&lt;br /&gt;{&lt;br /&gt;connectionAvailable &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language="javascript" type="text/javascript"&gt;bt_code_init('d8aa0914-6572-4e43-b18e-8f2c4ed392db');&lt;/script&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: verdana; font-style: italic;"&gt;The example above is just a brief overview of practical RESTful service realization using WCF and data exchange with Android client. More detailed explanations of each segment could be found at the given addresses.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a style="font-family: verdana;" href="http://msdn.microsoft.com/en-us/library/dd203052.aspx"&gt;A Guide to Designing and Building RESTful Web Services with WCF 3.5&lt;/a&gt;&lt;br /&gt;&lt;a style="font-family: verdana;" href="http://msdn.microsoft.com/en-us/library/ms733128.aspx"&gt;Windows Communication Foundation Architecture&lt;/a&gt;&lt;br /&gt;&lt;a style="font-family: verdana;" href="http://msdn.microsoft.com/en-us/library/ms731082.aspx"&gt;What Is Windows Communication Foundation?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-7408580327357107813?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/eFqrBlQsS6o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/7408580327357107813/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2009/05/communication-between-wcf-service-and.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/7408580327357107813?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/7408580327357107813?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/eFqrBlQsS6o/communication-between-wcf-service-and.html" title="Communication Between WCF Service and Android Client" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_5IscwJQSAUY/Sf3zGLltL4I/AAAAAAAAAJI/VLDKAA-Bm_M/s72-c/data+exchange.jpg" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2009/05/communication-between-wcf-service-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8DR34ycSp7ImA9WxJTF0g.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-3769468344642833975</id><published>2009-04-26T04:46:00.014+02:00</published><updated>2009-04-26T16:57:56.099+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-26T16:57:56.099+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Activity" /><category scheme="http://www.blogger.com/atom/ns#" term="Queue" /><category scheme="http://www.blogger.com/atom/ns#" term="Service" /><category scheme="http://www.blogger.com/atom/ns#" term="concept" /><category scheme="http://www.blogger.com/atom/ns#" term="architecture" /><category scheme="http://www.blogger.com/atom/ns#" term="android" /><category scheme="http://www.blogger.com/atom/ns#" term="client" /><title>Client Architecture: Conceptual Overview</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-I4i97gsIU8jGJk_VrWhDABF5v4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-I4i97gsIU8jGJk_VrWhDABF5v4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-I4i97gsIU8jGJk_VrWhDABF5v4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-I4i97gsIU8jGJk_VrWhDABF5v4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_5IscwJQSAUY/SfR1Pk7z3bI/AAAAAAAAAJA/UnD7Wt-AkUk/s1600-h/client+architecture+overview.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 229px;" src="http://4.bp.blogspot.com/_5IscwJQSAUY/SfR1Pk7z3bI/AAAAAAAAAJA/UnD7Wt-AkUk/s400/client+architecture+overview.jpg" alt="" id="BLOGGER_PHOTO_ID_5329013169559166386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify; font-family: verdana;"&gt;The client application is the part of &lt;a href="http://mypetprojects.blogspot.com/2009/04/determining-body-movement-with-mobile.html"&gt;solution&lt;/a&gt; which runs on mobile devices. In general Android applications consit of the following elements:&lt;br /&gt;&lt;/div&gt;&lt;ul style="text-align: justify; font-family: verdana;"&gt;&lt;li&gt;Foreground Activity (Class with processes wihich run in the foreground and enable user interaction - User Interface)&lt;/li&gt;&lt;li&gt;Background Service (Class with processes which run in the background and exchange data with foreground activity and other services)&lt;/li&gt;&lt;li&gt;Intermittent Activity (The processes which can be modified directly by user and run in the background after user's modifications)&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family:verdana;"&gt;In case of &lt;a href="http://mypetprojects.blogspot.com/2009/04/determining-body-movement-with-mobile.html"&gt;solution for motion determination&lt;/a&gt; the main client's task is to retrieve the values from acceleration sensor. Optionally, in case we want to enable automatic emergency call with location report, the client has to determine the location by simply reading GPS values or getting the information from available web services which are able to determine the approximate location by base station the phone currently uses.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;In order to enable storing informations for later motion analysis in case the internet connection is unavailable, we can add the database and the logic for data storing and later retrieval before sending.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;The picture represents the client application concept. The red rectangles represent activities and blue are the services.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;The application consits of three dialogs: main dialog, login and settings. The main dialog displays current activity status, acceleration values and location informations. On application start the user has to sign-in to the server with username and password so at the beginning the login dialog appears. Some options modifications such as enable/disable location report are possible by using Settings dialog.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;There are four services running&lt;/span&gt;&lt;span style="font-family:verdana;"&gt; in the background . The Location Service retrieves the location informations and broadcasts the location data which are received at main (GaitLink) activity, Communication Service and optionally at Database Service. The Acceleration Service retrieves the data from accelerometers and also broadcasts the data which are received by the same components.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;The Database Service listens for the broadcasted messages which can represent the data that have to be stored or the commands for data reading and sending to Communication Service.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;Communication Service implements multiple threads. Broadcast Receivers for acceleration and location messages run in separate thread. Every received message is sent to queue. Another thread is periodically retrieving the messages from queues and send the messages to the server. In order to prevent queue congestion the reading frequency has to be higher than queue writing frequency.&lt;/span&gt; &lt;span style="font-family:verdana;"&gt;The main reason for using queues are possible transitory network delays or drops. Without intermediate measurements storing to the queue every value would have to be successfully sent before reading next values from the sensors which is certainly fair too unreliable.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-3769468344642833975?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/PNuWjTXF31w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/3769468344642833975/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2009/04/client-architecture-conceptual-overview.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/3769468344642833975?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/3769468344642833975?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/PNuWjTXF31w/client-architecture-conceptual-overview.html" title="Client Architecture: Conceptual Overview" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_5IscwJQSAUY/SfR1Pk7z3bI/AAAAAAAAAJA/UnD7Wt-AkUk/s72-c/client+architecture+overview.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2009/04/client-architecture-conceptual-overview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUCSXc4fSp7ImA9WxJTF0g.&quot;"><id>tag:blogger.com,1999:blog-5507856583232570887.post-458235411986157166</id><published>2009-04-25T06:23:00.010+02:00</published><updated>2009-04-26T16:47:48.935+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-26T16:47:48.935+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="body movement" /><category scheme="http://www.blogger.com/atom/ns#" term="acceleration" /><category scheme="http://www.blogger.com/atom/ns#" term="android" /><title>Determining Body Movement with Mobile Phone</title><content type="html">
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CjGL-wzxUhkL3KRYyhTxYZIQxHk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CjGL-wzxUhkL3KRYyhTxYZIQxHk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CjGL-wzxUhkL3KRYyhTxYZIQxHk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CjGL-wzxUhkL3KRYyhTxYZIQxHk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/SfR0BIkPYLI/AAAAAAAAAIw/4D-dYTlQr-E/s1600-h/solution+overview.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 173px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/SfR0BIkPYLI/AAAAAAAAAIw/4D-dYTlQr-E/s400/solution+overview.jpg" alt="" id="BLOGGER_PHOTO_ID_5329011821914316978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: justify; font-family: verdana;"&gt;Currently I'm trying to develop a solution which would determine the type of movement by measuring accelerations with mobile phone.&lt;br /&gt;&lt;br /&gt;By reading acceleration data many things can be discovered. The persons's walk pattern is almost as unique as fingerprint. By reading the walk (movement) patterns early stages of a possible disease could be recognized as well. Another thing that could be implemented is fall/collision detection and automatic emergency call. These are just a few of the possible uses of the solution.&lt;br /&gt;&lt;br /&gt;So far the mobile devices haven't been powerful enough to perform all the required processes independently, but luckily the data transmission is cheap and fast enough so the main analysis can be performed on the server.&lt;br /&gt;&lt;br /&gt;The accelerometers are cheap so almost every new phone have built-in sensors. Currently I'm using HTC Dream G1 (Android) phone and developing client application in Java. The server-side application has been built in C# .NET.&lt;br /&gt;&lt;br /&gt;So far I have established the connection between the phone and server. The phone sends the location data and acceleration measurements to the server which runs the analysis.&lt;br /&gt;I've managed to determine some simple user behaviour patterns such as walk, run and rest by measuring the frequency components of the pattern.&lt;br /&gt;&lt;br /&gt;Below there are the charts for collision and walk in time and frequency domain.&lt;br /&gt;&lt;br /&gt;These are the acceleration values of simulated collision:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/SfKZHvW_ZVI/AAAAAAAAAIA/AJV6M0fbtNM/s1600-h/collision.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 214px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/SfKZHvW_ZVI/AAAAAAAAAIA/AJV6M0fbtNM/s400/collision.jpg" alt="" id="BLOGGER_PHOTO_ID_5328489667383747922" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_5IscwJQSAUY/SfKZHyzfvNI/AAAAAAAAAII/1Fh7W0TuXbU/s1600-h/collision-fft.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 214px;" src="http://3.bp.blogspot.com/_5IscwJQSAUY/SfKZHyzfvNI/AAAAAAAAAII/1Fh7W0TuXbU/s400/collision-fft.jpg" alt="" id="BLOGGER_PHOTO_ID_5328489668308614354" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;and these are the accelerations of walk:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_5IscwJQSAUY/SfKZHwRm9pI/AAAAAAAAAIQ/3kBJKOkJxQs/s1600-h/walk.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 215px;" src="http://2.bp.blogspot.com/_5IscwJQSAUY/SfKZHwRm9pI/AAAAAAAAAIQ/3kBJKOkJxQs/s400/walk.jpg" alt="" id="BLOGGER_PHOTO_ID_5328489667629610642" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_5IscwJQSAUY/SfKZICOIupI/AAAAAAAAAIY/qCUsGJo2ghM/s1600-h/walk-fft.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 213px;" src="http://1.bp.blogspot.com/_5IscwJQSAUY/SfKZICOIupI/AAAAAAAAAIY/qCUsGJo2ghM/s400/walk-fft.jpg" alt="" id="BLOGGER_PHOTO_ID_5328489672446884498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In both cases The DFT has been performed on 32 sample points at sampling frequency 2.5 Hz.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_5IscwJQSAUY/SfKa5otpaHI/AAAAAAAAAIg/w1onC5cXTWE/s1600-h/walk+screen.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 267px; height: 400px;" src="http://4.bp.blogspot.com/_5IscwJQSAUY/SfKa5otpaHI/AAAAAAAAAIg/w1onC5cXTWE/s400/walk+screen.png" alt="" id="BLOGGER_PHOTO_ID_5328491624104814706" border="0" /&gt;&lt;/a&gt;This is the phone screen (any suggestion about the design is more than welcome). The phone gets the location address by performing reverse geocoding (part of the existing framework) and the activity status by questioning the server.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5507856583232570887-458235411986157166?l=mypetprojects.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/MyPetProjects/~4/lvTYPcdA5Z8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mypetprojects.blogspot.com/feeds/458235411986157166/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mypetprojects.blogspot.com/2009/04/determining-body-movement-with-mobile.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/458235411986157166?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5507856583232570887/posts/default/458235411986157166?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MyPetProjects/~3/lvTYPcdA5Z8/determining-body-movement-with-mobile.html" title="Determining Body Movement with Mobile Phone" /><author><name>Niko</name><uri>http://www.blogger.com/profile/03549314951981089987</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://3.bp.blogspot.com/-TyNjUGuEqGc/Ts86N6EC4YI/AAAAAAAAAbo/1nROuqUI-3s/s220/gamulin.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_5IscwJQSAUY/SfR0BIkPYLI/AAAAAAAAAIw/4D-dYTlQr-E/s72-c/solution+overview.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://mypetprojects.blogspot.com/2009/04/determining-body-movement-with-mobile.html</feedburner:origLink></entry></feed>

