<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4640198225857397031</id><updated>2026-09-11T00:36:43.152-07:00</updated><category term=".NET"/><category term="JAVA"/><category term="database"/><category term="C#"/><category term="visual studio"/><category term="CodenameOne"/><category term="Eclipse"/><category term="JavaME"/><category term="NetBeans"/><category term="class"/><category term="software"/><category term="API"/><category term="IDE"/><category term="J2ME"/><category term="PHP"/><category term="Threading"/><category term="Events"/><category term="Facebook"/><category term="MySQL"/><category term="OAuth"/><category term="Oracle"/><category term="Postgres SQL"/><category term="controller"/><category term="download"/><category term="engineering"/><category term="framework"/><category term="javascript"/><category term="ADempiere"/><category term="ASP.NET"/><category term="ASP.NET MVC"/><category term="CRUD"/><category term="CSS"/><category term="FolderBrowser"/><category term="Form"/><category term="HTML"/><category term="LWUIT"/><category term="MVC"/><category term="Phonegap"/><category term="RMS"/><category term="SMS"/><category term="SMSGH"/><category term="SQL"/><category term="Server"/><category term="Shai Almog"/><category term="UI"/><category term="VB.NET"/><category term="Windows Phone 7.5"/><category term="Yii"/><category term="Yii framework"/><category term="android"/><category term="app"/><category term="application"/><category term="browser"/><category term="classes"/><category term="client"/><category term="codes"/><category term="cross-thread"/><category term="custom event"/><category term="delegates"/><category term="file"/><category term="iPad"/><category term="iPhone"/><category term="interface"/><category term="jSQL"/><category term="language"/><category term="library"/><category term="listview"/><category term="mobile app"/><category term="mobile device"/><category term="model"/><category term="projects"/><category term="reflection"/><category term="software engineering"/><category term="source"/><category term="tables"/><category term="threads"/><category term="wrapper"/><category term=".config"/><category term="32-bit"/><category term="64-bit"/><category term="ADO.NET"/><category term="API Key"/><category term="ASP.NET MVC4"/><category term="Access Token"/><category term="ActiveRecords"/><category term="ActiveX"/><category term="AntiForgeryToken"/><category term="AntiModelInjection"/><category term="Areola Service"/><category term="Augustine"/><category term="BackPass"/><category term="Bearer"/><category term="Bearer Token"/><category term="Blackberry"/><category term="C language"/><category term="C++"/><category term="CPU"/><category term="CRM"/><category term="CRUD generator"/><category term="CSRF"/><category term="CSS3"/><category term="Canvas"/><category term="CheckBox"/><category term="CheckList"/><category term="CheckListBox"/><category term="Code Flow"/><category term="Common Sense"/><category term="Cordova"/><category term="Cross-site request forgery"/><category term="CustomerDetails"/><category term="CustomerService"/><category term="DDL"/><category term="DDM"/><category term="Dataset"/><category term="ERD"/><category term="ERP"/><category term="EditorPane"/><category term="Entity Framework"/><category term="FBJS"/><category term="FMBL"/><category term="FileSystemStorage"/><category term="FormInputValidator"/><category term="GUI"/><category term="Gii"/><category term="Gmail"/><category term="HATEOAS"/><category term="HTML5"/><category term="HTTP"/><category term="IMEI"/><category term="IMEI Plugin"/><category term="Input"/><category term="JDK"/><category term="JSON"/><category term="JSP"/><category term="LINQ"/><category term="List"/><category term="ListCellRenderer"/><category term="Lists"/><category term="MIDlet"/><category term="MSSQL"/><category term="MessageSender"/><category term="MetaData Reflection"/><category term="Metadata"/><category term="NavigationService"/><category term="NoSQL"/><category term="Notepad"/><category term="NuGet"/><category term="OOP"/><category term="ORM"/><category term="OS"/><category term="OnBackKeyPress"/><category term="Open Source"/><category term="OpenId"/><category term="PC plus"/><category term="Phonegap IMEI"/><category term="Phonegap IMEI Plugin"/><category term="Phonegap plugin"/><category term="QWERTY"/><category term="RDBMs"/><category term="REST"/><category term="Record Management Store"/><category term="Repository Pattern"/><category term="Rx"/><category term="SSO"/><category term="School Management System"/><category term="Screenshots"/><category term="Search"/><category term="Secre"/><category term="Singleton"/><category term="StartSeach"/><category term="Steve Jobs"/><category term="The Concept of a BackPass Token"/><category term="UML"/><category term="URL"/><category term="VM ware"/><category term="Validator"/><category term="Virtualization"/><category term="WP7"/><category term="WebBrowser"/><category term="Windows"/><category term="XAMPP"/><category term="XCode"/><category term="XmltoUSSD"/><category term="account"/><category term="activity"/><category term="app crash"/><category term="architecture"/><category term="asynchronous"/><category term="attachment"/><category term="attacker"/><category term="back"/><category term="background"/><category term="background worker"/><category term="blocking"/><category term="blog"/><category term="blogging"/><category term="bootstrap"/><category term="break"/><category term="cache-control"/><category term="class lopps"/><category term="codebase"/><category term="codenameone performance"/><category term="compatible"/><category term="computer"/><category term="concept"/><category term="connection"/><category term="content"/><category term="content-disposition"/><category term="crash"/><category term="credits"/><category term="crystal"/><category term="crystal reports"/><category term="custom events"/><category term="data"/><category term="data type"/><category term="db2lang"/><category term="delete"/><category term="developer"/><category term="devices"/><category term="diagram"/><category term="document root"/><category term="documentation"/><category term="down"/><category term="echo"/><category term="eclipse shared library JNI"/><category term="elouai"/><category term="email"/><category term="environment variables"/><category term="error"/><category term="exiting WP7 application"/><category term="experiences"/><category term="extension"/><category term="extensions"/><category term="failed to load the JNI shared library"/><category term="fields"/><category term="fire and forget"/><category term="generate token"/><category term="github"/><category term="happy new year"/><category term="iFrame"/><category term="implement"/><category term="inherits"/><category term="initialization error"/><category term="insert"/><category term="inspired"/><category term="instance"/><category term="invoke"/><category term="ipod"/><category term="javax.wireless.messaging"/><category term="lessons"/><category term="lightweight"/><category term="listeners"/><category term="loop"/><category term="menu"/><category term="messaging"/><category term="migrations"/><category term="mirror method(MM)"/><category term="mobile"/><category term="mobile phones"/><category term="mutex"/><category term="not-responding"/><category term="observable"/><category term="observeon"/><category term="online"/><category term="operating system"/><category term="operation"/><category term="package"/><category term="parameter tampering"/><category term="path"/><category term="pause"/><category term="permissions"/><category term="platform"/><category term="pointers"/><category term="post"/><category term="powerful"/><category term="print"/><category term="process"/><category term="programming"/><category term="protocol"/><category term="quicksearch"/><category term="reactive"/><category term="reactive extension"/><category term="read"/><category term="refactor"/><category term="register"/><category term="reports"/><category term="requirements"/><category term="resource"/><category term="school"/><category term="screen"/><category term="script"/><category term="searching algorithm"/><category term="security"/><category term="semaphores"/><category term="sense"/><category term="sequence"/><category term="servers"/><category term="session"/><category term="sessionID"/><category term="shared library"/><category term="shopping"/><category term="simple"/><category term="simple migrations"/><category term="simple migrations yii framework"/><category term="spirit"/><category term="stock"/><category term="stop"/><category term="stored procedure"/><category term="subclass"/><category term="subscribe"/><category term="synchronous"/><category term="system calls"/><category term="text message"/><category term="token"/><category term="topic"/><category term="touch devices"/><category term="treeview"/><category term="trigger"/><category term="try/catch"/><category term="twitter"/><category term="typeahead"/><category term="typeahead error"/><category term="unable to find a version of the runtime to run this application"/><category term="uncaught typeerror: cannot call method tolower of undefined"/><category term="up"/><category term="update"/><category term="use case"/><category term="user.name"/><category term="view"/><category term="virtual machine"/><category term="web page"/><category term="webapp"/><category term="welcome"/><category term="wife"/><category term="winforms"/><category term="wireless"/><category term="worker"/><category term="xmas"/><category term="xml"/><category term="zlip.output_compression"/><title type='text'>Future of Software Engineering</title><subtitle type='html'>articles on some software development topics</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-1748451811841872092</id><published>2016-01-29T15:39:00.002-08:00</published><updated>2019-09-03T03:06:53.350-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="app"/><category scheme="http://www.blogger.com/atom/ns#" term="Areola Service"/><category scheme="http://www.blogger.com/atom/ns#" term="Augustine"/><category scheme="http://www.blogger.com/atom/ns#" term="happy new year"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP"/><category scheme="http://www.blogger.com/atom/ns#" term="menu"/><category scheme="http://www.blogger.com/atom/ns#" term="screen"/><category scheme="http://www.blogger.com/atom/ns#" term="SMSGH"/><category scheme="http://www.blogger.com/atom/ns#" term="user.name"/><category scheme="http://www.blogger.com/atom/ns#" term="xml"/><category scheme="http://www.blogger.com/atom/ns#" term="XmltoUSSD"/><title type='text'>XmltoUSSD</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Happy new year.&lt;br /&gt;
&lt;br /&gt;
Let me go straight to the point.&lt;br /&gt;
&lt;br /&gt;
Have a look at the following code snippet:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;!DOCTYPE ussd SYSTEM &quot;xml2ussd.dtd&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;ussd&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;lt;screen id=&quot;main&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;form bindto=&quot;user&quot; onsubmit=&quot;ussd:nav:finish&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Welcome to my USSD application&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;input type=&quot;text&quot; display=&quot;Enter your name&quot;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;id=&quot;name&quot; required=&quot;true&quot;/&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/form&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;lt;/screen&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;lt;screen id=&quot;finish&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;text bindfrom=&quot;user&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Your name is {user.name}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/text&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;lt;/screen&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;lt;/ussd&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Wouldn&#39;t it be nice to feed this code into a compiler to compose a USSD app such as below?&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsjGDn6HJhB6Ga77aOk4eoNCirxRdRdToNdjlDgPguIaI63VbhqiQZnX5b2CbZ-RZnIUrFosrCsUbHxA8zr6k1grmmmuU0n4k7yGERFQCV2VO-T0kEPHAxZXgo9QF9dwS1Z1GpOVHMjL4/s1600/main.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsjGDn6HJhB6Ga77aOk4eoNCirxRdRdToNdjlDgPguIaI63VbhqiQZnX5b2CbZ-RZnIUrFosrCsUbHxA8zr6k1grmmmuU0n4k7yGERFQCV2VO-T0kEPHAxZXgo9QF9dwS1Z1GpOVHMjL4/s320/main.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW6AATUSUalkuP0z0gub808h7-8axbMUK3UyjksAZ59r3T0nmow7a1wSkalZ7QH4HfKiD4HGGcoXceuXuTXcw61VPlLY-0XhVt2sBBByS4lB9sLd1OQ5X_GbdcYgjULNqj7otElCRhGFM/s1600/main-response.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;103&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiW6AATUSUalkuP0z0gub808h7-8axbMUK3UyjksAZ59r3T0nmow7a1wSkalZ7QH4HfKiD4HGGcoXceuXuTXcw61VPlLY-0XhVt2sBBByS4lB9sLd1OQ5X_GbdcYgjULNqj7otElCRhGFM/s320/main-response.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifzBIgLD8LteGtYCixDqF0-WoMozBHfkKSnURLB8nTYyBAsZoks-I_8LelDsOH3KcLVlerj3-Q_BKZqCzSK5AaHUt0vtjJ8HYHbsHnWs5kykVXVYPDJGYExJm-QNINcNzbs_B0-o5FvVU/s1600/finish.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifzBIgLD8LteGtYCixDqF0-WoMozBHfkKSnURLB8nTYyBAsZoks-I_8LelDsOH3KcLVlerj3-Q_BKZqCzSK5AaHUt0vtjJ8HYHbsHnWs5kykVXVYPDJGYExJm-QNINcNzbs_B0-o5FvVU/s400/finish.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This has been my pet project for sometime now.&lt;br /&gt;
&lt;br /&gt;
Wait a minute. What&#39;s &lt;b&gt;USSD &lt;/b&gt;you ask? (I hope you didn&#39;t ask what is Xml as well)&lt;br /&gt;
&lt;br /&gt;
Wikipedia says &quot;&lt;i&gt;Unstructured Supplementary Service Data (USSD) is a protocol used by GSM cellular telephones to communicate with the service provider&#39;s computers. USSD can be used for WAP browsing, prepaid callback service, mobile-money services, location-based content services, menu-based information services, and as part of configuring the phone on the network&lt;/i&gt;&quot;&lt;br /&gt;
&lt;br /&gt;
As an engineer, i seek to make things simple or simple things simpler.... on to the superlative.&lt;br /&gt;
&lt;br /&gt;
My aim here is to ride on the existing USSD-HTTP bridge created by the geniuses at &lt;strike&gt;SMSGH&lt;/strike&gt; Hubtel by abstracting away the need to build HTTP apps for USSD.&lt;br /&gt;
Rather, a developer would simply construct an XML file and upload it into the magic box (what i call &lt;b&gt;Areola Service&lt;/b&gt;) &amp;nbsp;to spin off a USSD app on the fly, accessed by dialing a code such as *714*55#&lt;br /&gt;
&lt;br /&gt;
That&#39;s it.&lt;br /&gt;
&lt;br /&gt;
Project Areola is in two main parts: the open-source XmltoUSSD compiler and the SaaS (or rather Compiler-as-a-Service, CaaS) for actually hosting your xml file as a USSD app. The SaaS part is not open-sourced: sorry :(&lt;br /&gt;
&lt;br /&gt;
The compiler is available &lt;a href=&quot;https://github.com/austinejei/xmltoussd&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;on github. Grab it and try out some samples using the dtd as a guide.&lt;br /&gt;
&lt;br /&gt;
The CaaS version will be available shortly. Or you could contact me directly.&lt;br /&gt;
&lt;br /&gt;
Happy coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/1748451811841872092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/1748451811841872092?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/1748451811841872092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/1748451811841872092'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2016/01/xmltoussd.html' title='XmltoUSSD'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsjGDn6HJhB6Ga77aOk4eoNCirxRdRdToNdjlDgPguIaI63VbhqiQZnX5b2CbZ-RZnIUrFosrCsUbHxA8zr6k1grmmmuU0n4k7yGERFQCV2VO-T0kEPHAxZXgo9QF9dwS1Z1GpOVHMjL4/s72-c/main.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-5948421488599487689</id><published>2015-07-27T09:35:00.000-07:00</published><updated>2015-07-27T09:47:58.371-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Access Token"/><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="BackPass"/><category scheme="http://www.blogger.com/atom/ns#" term="Bearer"/><category scheme="http://www.blogger.com/atom/ns#" term="Bearer Token"/><category scheme="http://www.blogger.com/atom/ns#" term="client"/><category scheme="http://www.blogger.com/atom/ns#" term="Code Flow"/><category scheme="http://www.blogger.com/atom/ns#" term="concept"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="developer"/><category scheme="http://www.blogger.com/atom/ns#" term="email"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="generate token"/><category scheme="http://www.blogger.com/atom/ns#" term="Gmail"/><category scheme="http://www.blogger.com/atom/ns#" term="OAuth"/><category scheme="http://www.blogger.com/atom/ns#" term="resource"/><category scheme="http://www.blogger.com/atom/ns#" term="Server"/><category scheme="http://www.blogger.com/atom/ns#" term="The Concept of a BackPass Token"/><category scheme="http://www.blogger.com/atom/ns#" term="token"/><category scheme="http://www.blogger.com/atom/ns#" term="wife"/><title type='text'>The Concept of a BackPass Token</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoTitle&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
It’s been quite a well.&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
But once again, I’ll go straight to the point.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h1&gt;
Pre-ample:&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Before we go any further, I want to cite that understanding
this concept is dependent on principles and jargons of
OAuth 2.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h1&gt;
What is a BackPass Token?&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A BackPass token is a user-issued authentication and authorization
token that grants limited access to a user’s resource. It’s more like a
user-facing OAuth-like concept, not intended for developers alone.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
That’s the basis for this concept. For some time now, OAuth
generally focuses on developers and machine to machine interaction via APIs, with
some strange jargons like Bearer, Scopes, Auth Code, Access Token, Implicit
grants, just to mention a few. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I just thought it would be nicer (if not simpler) if a user “creates”
an authenticated token to access his/her resources for another user. So, the user is just allowing a &quot;backpass&quot; access to an app he&#39;s signed on to.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Let’s consider a simple OAuth Code flow:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFmqo6rsssbOm_iC9EIKXZKahhjx8HnznJl7FQuSlaXGkYcweI_AiJFVMe40QPHgq4GnE-5cYi7icwG3e9RC7JB3vZtVwx0phmmFHRyoGuVDvNOGow1Lm92AAq-D2XjT669CZtZ1omqyo/s1600/oauth+code+flow.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;630&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFmqo6rsssbOm_iC9EIKXZKahhjx8HnznJl7FQuSlaXGkYcweI_AiJFVMe40QPHgq4GnE-5cYi7icwG3e9RC7JB3vZtVwx0phmmFHRyoGuVDvNOGow1Lm92AAq-D2XjT669CZtZ1omqyo/s640/oauth+code+flow.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoCaption&quot; style=&quot;text-align: center;&quot;&gt;
&lt;i&gt;Figure &lt;!--[if supportFields]&gt;&lt;span
style=&#39;mso-element:field-begin&#39;&gt;&lt;/span&gt;&lt;span style=&#39;mso-spacerun:yes&#39;&gt; &lt;/span&gt;SEQ
Figure \* ARABIC &lt;span style=&#39;mso-element:field-separator&#39;&gt;&lt;/span&gt;&lt;![endif]--&gt;1&lt;!--[if supportFields]&gt;&lt;span style=&#39;mso-element:
field-end&#39;&gt;&lt;/span&gt;&lt;![endif]--&gt; OAuth Code Flow&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Now consider BackPass Token flow:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF0LTAdhfKKDe5KWXUeJ0qAGgtjfQjP9RA1S_hTzrf4za1TgETA5lhITYL_QK2R1qwCB9XvTCuvrUwCwkR_RlO4CKveaSExABflXSLAXJPYXlp-t2TLmwjfpWaGiYQwaviCmNZUvupH3A/s1600/backpass+token+flow.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF0LTAdhfKKDe5KWXUeJ0qAGgtjfQjP9RA1S_hTzrf4za1TgETA5lhITYL_QK2R1qwCB9XvTCuvrUwCwkR_RlO4CKveaSExABflXSLAXJPYXlp-t2TLmwjfpWaGiYQwaviCmNZUvupH3A/s1600/backpass+token+flow.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoCaption&quot; style=&quot;text-align: center;&quot;&gt;
&lt;i&gt;Figure &lt;!--[if supportFields]&gt;&lt;span
style=&#39;mso-element:field-begin&#39;&gt;&lt;/span&gt;&lt;span style=&#39;mso-spacerun:yes&#39;&gt; &lt;/span&gt;SEQ
Figure \* ARABIC &lt;span style=&#39;mso-element:field-separator&#39;&gt;&lt;/span&gt;&lt;![endif]--&gt;2&lt;!--[if supportFields]&gt;&lt;span style=&#39;mso-element:
field-end&#39;&gt;&lt;/span&gt;&lt;![endif]--&gt; BackPass Token Flow&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;h1&gt;
How is a BackPass Token generated?&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
As a first rule of thumb, a backpass token is not meant to
be used by non-human systems. That is, not meant to be injected as a custom
header in an API call.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
According to my diagram, UserA should simply enable this
feature in the web app that has capability of BackPass token. After which,
he/she creates a backpass token by entering some parameters such as:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Name of the person to access the app on his/her
behalf&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;How long the user is supposed to be logged in&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Resources to access (email, photos, etc.)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;4.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Extra Data as you please&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -.25in;&quot;&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
The backpass token itself should be a
well-encrypted/salted/hashed value and must be aliased by the user. Aliasing
means the user should now name the token with a sentence, such as “the quick
brown fox 2015”. &amp;nbsp;UserA provides this
alias to UserB.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
UserB presents this alias to the app. The app validates the
alias and grants access to UserB as if it is user A’s account.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
What’s the Point?&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
This concept is purely user-facing. The user does the simple
work of granting access to other people through tokens.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;
For example, if say, Facebook enables BackPass token, I can
generate a token for my wife to only post pictures for only 10 minutes and not
to view my messages (&lt;a href=&quot;https://www.facebook.com/susanokang&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;@SusuanOkang&lt;/a&gt;, I ain&#39;t hiding anything, &lt;span style=&quot;font-family: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;J&lt;/span&gt;) OR, on Gmail, I can
generate a token for my colleague to email my report to my boss only, not to
view or compose other emails. I don&#39;t need to share my username/password credentials with them.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A user should not be allowed to grant 100% access to his
resources (including features such as modifying his/her account profile,
passwords, etc.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
A user can generate/destroy as many BackPass tokens as
possible.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
How do I implement this?&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I’ve not stated any means of implementing BackPass tokens. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
If you understand the basics of OAuth, implementation should
be quite easy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
However, I shall follow up with a working example soon.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
Conclusion&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
BackPass token is just a concept. Hey, I’m open to both
constructive and destructive criticisms. Share your thoughts below&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/5948421488599487689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/5948421488599487689?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/5948421488599487689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/5948421488599487689'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2015/07/the-concept-of-backpass-token.html' title='The Concept of a BackPass Token'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFmqo6rsssbOm_iC9EIKXZKahhjx8HnznJl7FQuSlaXGkYcweI_AiJFVMe40QPHgq4GnE-5cYi7icwG3e9RC7JB3vZtVwx0phmmFHRyoGuVDvNOGow1Lm92AAq-D2XjT669CZtZ1omqyo/s72-c/oauth+code+flow.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-8153190314852224776</id><published>2014-11-18T09:09:00.001-08:00</published><updated>2014-11-18T09:09:25.276-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="architecture"/><category scheme="http://www.blogger.com/atom/ns#" term="blog"/><category scheme="http://www.blogger.com/atom/ns#" term="CPU"/><category scheme="http://www.blogger.com/atom/ns#" term="DDL"/><category scheme="http://www.blogger.com/atom/ns#" term="DDM"/><category scheme="http://www.blogger.com/atom/ns#" term="Entity Framework"/><category scheme="http://www.blogger.com/atom/ns#" term="HATEOAS"/><category scheme="http://www.blogger.com/atom/ns#" term="MSSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="NoSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="OAuth"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="ORM"/><category scheme="http://www.blogger.com/atom/ns#" term="Postgres SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="RDBMs"/><category scheme="http://www.blogger.com/atom/ns#" term="Repository Pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="REST"/><category scheme="http://www.blogger.com/atom/ns#" term="stored procedure"/><category scheme="http://www.blogger.com/atom/ns#" term="trigger"/><title type='text'>Simple Architecture for Modern Applications</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Once again, i will go straight to the point.&lt;br /&gt;
&lt;br /&gt;
This post is about presenting a simple architecture that acts as a foundation for building modern software. This has come from varied experience with software projects I&#39;ve personally worked on and managed over the years. They are pure abstractions and fully agnostic of specific tools or language implementation. I call it Simple Architecture for Modern Applications (SAMA).&lt;br /&gt;
&lt;br /&gt;
Here it is:&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5-s6Wgsh5O3WbJk_ssrUC_IEWpzcFNhnEDdsLCK8WSaRBOIXRzYLZLpGJgqdjTddUExMflHezCfUQnKFsN3OqJE_Cq-IuePaAngIKrOQrhyphenhyphenoJtb-o-0GQQXfqtsPPTLg-pLLD7SAkms/s1600/osama.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5-s6Wgsh5O3WbJk_ssrUC_IEWpzcFNhnEDdsLCK8WSaRBOIXRzYLZLpGJgqdjTddUExMflHezCfUQnKFsN3OqJE_Cq-IuePaAngIKrOQrhyphenhyphenoJtb-o-0GQQXfqtsPPTLg-pLLD7SAkms/s1600/osama.png&quot; height=&quot;479&quot; title=&quot;osama&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Simple Architecture for Modern Applications (SAMA)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
What does this mean and how can you benefit from it?&lt;br /&gt;
&lt;br /&gt;
Well, let me explain what each layer in the architecture does. Let&#39;s say we are to build a blogging app. Let&#39;s see how this architecture fits in.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Database Layer&lt;/b&gt;&lt;br /&gt;
This is the main persistence component. Every modern app needs to persist some data to a database. The database can be any kind; from large COTS RDBMs products like MSSQL, MySQL, Postgres or Oracle to NoSQL or even flat files, if you so desire. There&#39;s no real need of dictating how to structure the schemas of this component. I leave that to you.&lt;br /&gt;
With our blogger project, we shall have some tables to save user&#39;s information, their blog details, comments and followers.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Stored Procedure Layer&lt;/b&gt;&lt;br /&gt;
This is a layer that zips up all stored procedures (or functions or triggers) for the database component. Primarily, it is responsible for some very low level, event-triggered data manipulation before or after data is persisted into respective entities.&lt;br /&gt;
Using our example, we can have a procedure to auto-update the a field in a table with the total number of followers of a particular blog if an insert operation occurs in the followers table.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Repository Manager&lt;/b&gt;&lt;br /&gt;
This is a language-specific component that exposes DDM or DDL functions on entity abstraction instances. In other words, it preys on an ORMs capability and should implement a good design pattern, for example, the Repository Pattern, as a way of creating, reading, updating or deleting data from persistence.&lt;br /&gt;
Using our example, we may use Entity Framework and create some repository classes from our datacontext properties.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Core Services Integration Module (CSIM)&lt;/b&gt;&lt;br /&gt;
These are services that are indispensable to the application. They are internally protected and should not be exposed for modifcation to third-parties clients (developers or end-users). They may be some cron jobs or background service agents that perform some heavy CPU intensive processes. In our example, this may be a statistics service that counts how many comments are on a particular blog, source (geo-location) of the comments or perhaps some rewarding engine that increases a point per blog hit.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Notification Layer&lt;/b&gt;&lt;br /&gt;
This layer is primary for pushing out server notifications to various clients (web, mobile app or an IOT device). Ideally, these notifications should be real-time. This layer can be buttered in both before or after RM is called.&lt;br /&gt;
In our example, when the user&#39;s blog post is followed, notify user with an email.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Business Logic Layer&lt;/b&gt;&lt;br /&gt;
This is hard-core logic of the architecture. This is where many of the conditional and event-based statements are coalesced to form a working unit. For example, when a user saves a blog draft, generate a temporary URL to that draft for preview by other users.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;API Layer&lt;/b&gt;&lt;br /&gt;
This follows REST-ful HTTP standards and its garnishes (HATEOAS). The URI formats should be self-explanatory and should be conventional. In our case, if we want to retrieve a blog post, we can do a GET request, pass in the Id, and read in details of the post. (e.g. http://sweetblog.com/api/v1/blogs/324)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Authorization Layer&lt;/b&gt;&lt;br /&gt;
At this layer, each request to the API layer is checked to see if it has the appropriate permissions to access the intended resource. In our example, if a user has not granted permission to a 3rd party app to update a blog post, this layer would fail that request and return a 403 status code.&lt;br /&gt;
It would be wise to employ Bearer Tokens or similar token-based request patterns to ensure successful integration of this layer. In our example, we may use OAuth 2.0 as a way of inspecting authorization claims from a third party.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Authentication Layer&lt;/b&gt;&lt;br /&gt;
At this layer, each request to the API layer is inspected to see if it contains valid credentials of a user of the blogging app. If not, we fail the request and return a 401 status code.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;User-Interface Layer&lt;/b&gt;&lt;br /&gt;
This is where the end-user gets to see how the app looks and feels. The app may be presented in a web browser, as a desktop client, as a native mobile app, on a POS device or even handheld Internet Of Things (IOT) devices.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
That&#39;s it.&lt;br /&gt;
&lt;br /&gt;
The main benefits from such an architecture are:&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Separation of Concerns: Each layer or module can be easily replaced/modified without necessarily affecting another component. For example, we can rewrite the web-browers UI layer without affecting the API layer or even CSIM.&lt;/li&gt;
&lt;li&gt;Multi-Client: Your app can be accessed by any user over any internet-powered device.&lt;/li&gt;
&lt;li&gt;Ensures Project Continuity: Any developer can work on a particular layer/module of the project without breaking the entire stack.&lt;/li&gt;
&lt;li&gt;Implementation Agnostic: Yes, you realize that i do not necessarily depict data flow between each component, nor do i dictate where to start from. Neither is it coupled to a specific language or platform tools. Any good programming platform can be chosen to implement a specific part of the diagram. ASP.NET Web API may be used for the API Layer. A Node.js app may be wired in as the notification layer. The database may be built with Oracle. The authentication/authorization layers may be built with PHP. The Repository Manager may be built with NHibernate. The UI can be built with Angular JS. Mobile apps can be realized with Objective C.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
In the end, there can be a beautiful symphony of well-integrated components from varied frameworks.&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;/ol&gt;
&lt;div&gt;
Do tell me what you think.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/8153190314852224776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/8153190314852224776?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/8153190314852224776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/8153190314852224776'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2014/11/simple-architecture-for-modern.html' title='Simple Architecture for Modern Applications'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK5-s6Wgsh5O3WbJk_ssrUC_IEWpzcFNhnEDdsLCK8WSaRBOIXRzYLZLpGJgqdjTddUExMflHezCfUQnKFsN3OqJE_Cq-IuePaAngIKrOQrhyphenhyphenoJtb-o-0GQQXfqtsPPTLg-pLLD7SAkms/s72-c/osama.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-7018239416111373261</id><published>2014-04-04T04:47:00.001-07:00</published><updated>2014-04-04T04:47:05.877-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C language"/><category scheme="http://www.blogger.com/atom/ns#" term="codebase"/><category scheme="http://www.blogger.com/atom/ns#" term="CodenameOne"/><category scheme="http://www.blogger.com/atom/ns#" term="Form"/><category scheme="http://www.blogger.com/atom/ns#" term="FormInputValidator"/><category scheme="http://www.blogger.com/atom/ns#" term="github"/><category scheme="http://www.blogger.com/atom/ns#" term="Input"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="OAuth"/><category scheme="http://www.blogger.com/atom/ns#" term="OpenId"/><category scheme="http://www.blogger.com/atom/ns#" term="Shai Almog"/><category scheme="http://www.blogger.com/atom/ns#" term="SMSGH"/><category scheme="http://www.blogger.com/atom/ns#" term="SSO"/><category scheme="http://www.blogger.com/atom/ns#" term="Validator"/><title type='text'>Simple Form Validator for CodenameOne</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It&#39;s been quite a while.&lt;br /&gt;
&lt;br /&gt;
I&#39;ve been meandering through the somewhat rough and smooth roads of software engineering, from implementing SSO, OpenID and OAuth 2.0 to getting down and dirty with C language for some of our business products at SMSGH.&lt;br /&gt;
&lt;br /&gt;
But i&#39;m back.&lt;br /&gt;
&lt;br /&gt;
WHAT&#39;S NEW?&lt;br /&gt;
Ok. I wanted to do a quick demo for a friend who delights in a single codebase for his mobile apps. In comes CodenameOne. In the course of building a login form(or rather a registration) page, i stumbled upon the &quot;huge&quot; task of input validation. This is where i started a little concept of an input validator for CodenameOne forms. I remember asking Shai Almog in the developer forum if reflection and method attributes (or data annotations) were supported, but he replied in the negative. That would have been of great help, but hey, i found a way around it.&lt;br /&gt;
&lt;br /&gt;
HOW IT WORKS&lt;br /&gt;
So usually, forms (like my registration form) have input elements, like Textboxes, Checkboxes, Single/Multi select boxes, Date pickers, etc. Like you, i try to build a class that has those attributes. On on a more organized level, i create a base interface that will specify what the class should do.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s show some code. So in a &quot;Register&quot; button&#39;s click handler, we can do the following:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//RegistrationDetails should implement IValidatable&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;RegistrationDetails registrationDetails = new RegistrationDetails(txtEmail.getText(),txtPassword.getText());&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//new-up an instance of FormInputValidator&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FormInputValidator validator = new FormInputValidator();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//register a validator&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//remember, RegistrationValidator should implement IValidator&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; validator.registerValidator(new RegistrationValidator());&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (validator.validate(registrationDetails)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //yipeeeee we&#39;re good to go &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;//if validation fails, we can get a list of error messages&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Vector errorList = validator.getErrorList();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
It&#39;s that simple. I&#39;ve hosted the code on &lt;a href=&quot;https://github.com/austinejei/FormInputValidator&quot;&gt;github&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/7018239416111373261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/7018239416111373261?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/7018239416111373261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/7018239416111373261'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2014/04/simple-form-validator-for-codenameone.html' title='Simple Form Validator for CodenameOne'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-681331434030595164</id><published>2013-07-25T05:46:00.003-07:00</published><updated>2013-07-25T05:46:25.461-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CodenameOne"/><category scheme="http://www.blogger.com/atom/ns#" term="codenameone performance"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS3"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML5"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="lessons"/><category scheme="http://www.blogger.com/atom/ns#" term="library"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile app"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile device"/><category scheme="http://www.blogger.com/atom/ns#" term="NetBeans"/><category scheme="http://www.blogger.com/atom/ns#" term="Phonegap"/><title type='text'>10 Lessons from CodenameOne</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I&#39;ve been following and working with &lt;a href=&quot;http://www.codenameone.com/&quot;&gt;CodenameOne&lt;/a&gt;&amp;nbsp;since &lt;a href=&quot;http://austinejei.blogspot.com/2012/03/codenameone-one-for-all.html&quot;&gt;my first post in March 2012&lt;/a&gt;. Believe me, it&#39;s an awesome framework. Here are some lessons I learnt:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.Visit the discussion forum often:&lt;/b&gt;&lt;br /&gt;
Don&#39;t try to reinvent the wheel. Search the forum for topics similar to what you want to do. Carefully read through questions others have, try to solve it if u can. Post your questions there. You might want to check the &amp;nbsp;&lt;a href=&quot;https://codenameone.googlecode.com/svn/trunk/CodenameOne/javadoc/index.html&quot;&gt;developer documentations&lt;/a&gt; too.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Use your favourite IDE&lt;/b&gt;&lt;br /&gt;
Use an IDE that is more comfortable for you. I prefer NetBeans. And it looks like that might be a preferable IDE. There&#39;s a plugin for Eclipse as well.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Be patient with CN1&lt;/b&gt;&lt;br /&gt;
Uh-huh. You&#39;ll need this one a lot. It&#39;s a RAD tool in it&#39;s infancy, with a growing community support. Some native features (like Bluetooth API) may not be available to use on all platforms. Remember that the idea is one for all, not one for some. CN1 developers are seriously doing their best.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. CN1 is not HTML5, CSS3, Javascript&lt;/b&gt;&lt;br /&gt;
It is using industry-standard programming language (Java) to write applications which are cross-compiled (on a cloud server) for all mobile platforms. These apps behave natively on each platform, not executed in a webkit browser.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5. Swing all the way:&lt;/b&gt;&lt;br /&gt;
If you have a foreknowledge of Java Swing tools, then you&#39;re in for a good treat. .NET developers who are familiar with hand-coding Windows Forms can also enjoy it well. :)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6. A note on Web Connections:&lt;/b&gt;&lt;br /&gt;
Synchronous and asynchronous connections are both supported depending on your preference. To update UI elements from background threads, you need to wrap them with &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Display.getInstance().callSerially(....)&lt;/span&gt; &amp;nbsp;or &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Display.getInstance().callSeriallyAndWait(....)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7. Building your app:&lt;/b&gt;&lt;br /&gt;
Send a build request only when necessary, whether you&#39;re on a free or paid account. Be satisfied with debugging/using the simulator before sending a build request. Some features like multi-media recording are not supported on the simulator so you have to request a build and download it on your build server portal.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8. Building UI:&lt;/b&gt;&lt;br /&gt;
I prefer to hand-code my forms (and other GUI elements) than to use a GUI-builder. The GUI builder is a great way to start a pet project, until you really want to control/sub-class some methods from a base form.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9. Testing RIM apps:&lt;/b&gt;&lt;br /&gt;
When you want to test RIM builds on actual devices, you might wanna sign the .COD files using the BlackBerry IDE. You must have setup your signing keys (.db and .csk files) in your IDE.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10. Performance:&lt;/b&gt;&lt;br /&gt;
CN1 actually &lt;a href=&quot;http://www.codenameone.com/compare.html&quot;&gt;outperforms&lt;/a&gt; other apps built with other native tools. It openly shames HTML5-based apps on app-responsiveness and speed. However, you may not be able to develop intuitive games with CN1.&lt;br /&gt;
&lt;br /&gt;
That&#39;s it. Happy coding. :)&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/681331434030595164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/681331434030595164?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/681331434030595164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/681331434030595164'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2013/07/10-lessons-from-codenameone.html' title='10 Lessons from CodenameOne'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-2199675209287761105</id><published>2013-06-28T09:02:00.000-07:00</published><updated>2013-06-28T09:02:52.823-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="connection"/><category scheme="http://www.blogger.com/atom/ns#" term="data type"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="down"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="migrations"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="simple migrations"/><category scheme="http://www.blogger.com/atom/ns#" term="simple migrations yii framework"/><category scheme="http://www.blogger.com/atom/ns#" term="stock"/><category scheme="http://www.blogger.com/atom/ns#" term="tables"/><category scheme="http://www.blogger.com/atom/ns#" term="up"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><category scheme="http://www.blogger.com/atom/ns#" term="Yii"/><category scheme="http://www.blogger.com/atom/ns#" term="Yii framework"/><title type='text'>Simple Migrations in Yii Framework</title><content type='html'>Once again, i&#39;d be straight to the point.&lt;br /&gt;
&lt;br /&gt;
I&#39;m going to talk about how to do simple migrations when you&#39;re working on Yii framework. I&amp;nbsp;assume you&#39;ve already setup your project, done some db configurations, etc.&lt;br /&gt;
&lt;br /&gt;
Migration is a way to programmatically update (or append to) the&amp;nbsp;structure (data type,&amp;nbsp;name, etc)&amp;nbsp;of&amp;nbsp;your&amp;nbsp;database entities/tables/fields.&lt;br /&gt;
&lt;br /&gt;
In one of my pet projects (a simple shop manager), during the database design of&amp;nbsp;a Stock table, I forgot to add a field to&amp;nbsp;store the remaining quantity of an item. I noticed this after I had deployed the app to my localhost. I had to rely on Yii&#39;s migration power to skillfully modify the table. &lt;br /&gt;
&lt;br /&gt;
If you&#39;re&amp;nbsp;in the same soup, you&#39;re blessed to be here. Follow these simple steps.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;1. Configure&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
Open config.php under protected\config.&amp;nbsp;Modify the db connection array items to conform to your db settings in your main.php file.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;2. Command-line&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
Open commandline program and navigate to {project_name}\protected, and execute the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;{phpfolder}\php.exe yiic migrate create {migration_name}&lt;/span&gt;&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
and hit Enter. &lt;br /&gt;
Yii would ask if you really want to do this. Confirm your action by typing &#39;yes&#39; and hit Enter. &lt;br /&gt;
This creates a migration file with the name in this format: &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;{yyMMdd_hhmmss}{migration_name}.php&lt;/span&gt; The file would be create in {project_name}\protected\migrations&lt;br /&gt;
Yii would populate the file with a class that has the same name as the filename (without the extension, of course) and it should contain &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;up()&lt;/strong&gt;&lt;/span&gt; and &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;down()&lt;/strong&gt;&lt;/span&gt; functions. &lt;br /&gt;
&lt;br /&gt;
For those who are not familiar with migrations, &lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;up()&lt;/span&gt;&lt;/strong&gt; function is&amp;nbsp;executed to apply the intended migration, and the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;down()&lt;/strong&gt;&lt;/span&gt; function is &lt;br /&gt;
executed with the intent to revoke a previous migration.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;strong&gt;&lt;em&gt;3. Writing the migration&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
In my case, I had to add a column to an existing table. So this is what I did in the &lt;strong&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;up()&lt;/span&gt;&lt;/strong&gt; function method block.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;$this-&amp;gt;addColumn(&#39;stock&#39;, &#39;QuantityRemaining&#39;, &#39;int(11)&#39;);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Courier New;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Essentially, this tells Yii to visit the &#39;stock&#39; table, add a column with name &#39;QuantityRemaining&#39; and data type of &#39;int&#39; with length of &#39;11&#39;&lt;br /&gt;
You may include more lines of code to modify your database depending on what you really want to modify.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-size: large;&quot;&gt;&lt;strong&gt;&lt;em&gt;4. Executing the migration&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
Go back to the commandline program and execute the following:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;{phpfolder}\php.exe yiic migrate&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This would execute the latest migration file in the migrations folder.&lt;br /&gt;
&lt;br /&gt;
Enjoy migrating. :)&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/2199675209287761105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/2199675209287761105?isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2199675209287761105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2199675209287761105'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2013/06/simple-migrations-in-yii-framework.html' title='Simple Migrations in Yii Framework'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6641523536268234239</id><published>2013-05-21T08:58:00.002-07:00</published><updated>2013-05-21T09:04:16.207-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="Cordova"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="IMEI"/><category scheme="http://www.blogger.com/atom/ns#" term="IMEI Plugin"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile app"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile device"/><category scheme="http://www.blogger.com/atom/ns#" term="Phonegap"/><category scheme="http://www.blogger.com/atom/ns#" term="Phonegap IMEI"/><category scheme="http://www.blogger.com/atom/ns#" term="Phonegap IMEI Plugin"/><category scheme="http://www.blogger.com/atom/ns#" term="Phonegap plugin"/><title type='text'>Phonegap Plugin for IMEI</title><content type='html'>&lt;br /&gt;
Ok. It&#39;s been a giant leap from .NET to an open-source framework called
phonegap.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
I’m not gonna talk about the difference between the two. They&#39;re world&#39;s apart. I’m just gonna
share with you some basic techniques of going native using phonegap.&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
In my spare moments, I tried to investigate this much talked-about platform
that leverages HTML, CSS and Javascript skills. It was a wow experience. In my
basic understanding of the technology behind phonegap, you can bring your
webpage(s) to the user’s phone as “&lt;em&gt;native&lt;/em&gt;” applications. I’ve quoted the word
&lt;em&gt;native&lt;/em&gt; because Phonegap basically irons your files onto a browser component of
the underlying mobile device and packages it as an executable entity. Pretty
neat huh?&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Now to the main point of this blog:&lt;/strong&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
In my experimental app, I wanted to retrieve the IMEI of the mobile device,
and register through an external API. Phonegap provided just basic Javascript
functions. This particular one seems mission. I then discovered the world of
plugins. I found help online but that plugin couldn’t fit into the newest version
of Phonegap (2.7.0, at the time of writing) API that I had downloaded. So, I had
to do it on my own.&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Note&lt;/span&gt;&lt;/strong&gt;: &lt;em&gt;This plugin works for only Android devices. That’s the pain of having
to work with Phonegap. If you don’t find some great functionality in their API,
you might need to go native. And that means, Eclipse for Android, XCode for
iOs, Visual Studio for Windows Phone, etc. Also note that I assume you have
setup your Android project already, if not visit this &lt;a href=&quot;http://docs.phonegap.com/en/2.7.0/guide_getting-started_index.md.html#Getting%20Started%20Guides&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&lt;/em&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
So, I created a plugin class:&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;package com.myplugin.phonegap.imei;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;import
org.json.JSONArray;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;import
android.content.Context;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;import
android.telephony.TelephonyManager;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;import
org.apache.cordova.api.CallbackContext;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;import
org.apache.cordova.api.CordovaPlugin;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;public class
ImeiPlugin extends CordovaPlugin {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@Override&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;public boolean execute(String action,
JSONArray args, CallbackContext callbackContext) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;String result = &quot;&quot;;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;boolean returnState&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;= false;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (action.equals(&quot;get&quot;)) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;TelephonyManager telephonyManager =
(TelephonyManager)this.cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;result =
telephonyManager.getDeviceId();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (result==null) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 4;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;callbackContext.error(&quot;could
not retrieve IMEI&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;else{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;callbackContext.success(result);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;returnState = true;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;else {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;returnState
= false;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;return&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;returnState;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
Then I created its corresponding Javascript file:&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;var IMEI = function(){};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;IMEI.prototype.get = function(onSuccess, onFail){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;return cordova.exec(onSuccess, onFail, &#39;ImeiPlugin&#39;, &#39;get&#39;, []);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;if(!window.plugins) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;window.plugins = {};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;if (!window.plugins.imei) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;window.plugins.imei = new IMEI();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 36pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Then I implemented it in the main HTML file:&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;

&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;!DOCTYPE
html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;head&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;meta charset=&quot;utf-8&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;meta name=&quot;viewport&quot;
content=&quot;initial-scale=1.0, user-scalable=no&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;title&amp;gt;My Phonegap&amp;lt;/title&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;script type=&quot;text/javascript&quot;
charset=&quot;utf-8&quot; src=&quot;cordova-2.7.0.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;script type=&quot;text/javascript&quot;
charset=&quot;utf-8&quot; src=&quot;imei.js&quot;&amp;gt;&amp;lt;/script&amp;gt; &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&amp;lt;!-- --&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;script
type=&quot;text/javascript&quot;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;document.addEventListener(&quot;deviceready&quot;, onDeviceReady,
false);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;function onDeviceReady() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;getImei();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;function getImei(){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;window.plugins.imei.get(function(imei)
{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;alert(“your imei is: ” + imei);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}, function(errorMessage) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;deviceImei = errorMessage;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;/head&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;body&amp;gt;It
works…&amp;lt;/body&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;; font-size: 11pt; mso-bidi-font-size: 12.0pt;&quot;&gt;&amp;lt;/html&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;


&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
Then i ran the app and woala: I got the device IMEI. Weeeeellll, on the
emulator, I got a 000000000 as the device’s IMEI. However, when I tested it on
a Samsung Galaxy Ace, I got the correct IMEI.&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
You can read more about creating custom plugins &lt;a href=&quot;http://docs.phonegap.com/en/2.7.0/guide_plugin-development_index.md.html#Plugin%20Development%20Guide&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
Enjoy :)&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6641523536268234239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6641523536268234239?isPopup=true' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6641523536268234239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6641523536268234239'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2013/05/phonegap-plugin-for-imei.html' title='Phonegap Plugin for IMEI'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-5520596258129768660</id><published>2013-04-03T09:03:00.001-07:00</published><updated>2019-09-03T03:11:18.594-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="cross-thread"/><category scheme="http://www.blogger.com/atom/ns#" term="Events"/><category scheme="http://www.blogger.com/atom/ns#" term="extensions"/><category scheme="http://www.blogger.com/atom/ns#" term="LINQ"/><category scheme="http://www.blogger.com/atom/ns#" term="loop"/><category scheme="http://www.blogger.com/atom/ns#" term="mutex"/><category scheme="http://www.blogger.com/atom/ns#" term="not-responding"/><category scheme="http://www.blogger.com/atom/ns#" term="observable"/><category scheme="http://www.blogger.com/atom/ns#" term="observeon"/><category scheme="http://www.blogger.com/atom/ns#" term="reactive"/><category scheme="http://www.blogger.com/atom/ns#" term="reactive extension"/><category scheme="http://www.blogger.com/atom/ns#" term="Rx"/><category scheme="http://www.blogger.com/atom/ns#" term="semaphores"/><category scheme="http://www.blogger.com/atom/ns#" term="subscribe"/><category scheme="http://www.blogger.com/atom/ns#" term="Threading"/><category scheme="http://www.blogger.com/atom/ns#" term="winforms"/><title type='text'>Being Reactive: Using Reactive Extensions for .NET in your Applications</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
This post is about using Reactive Extensions(Rx) in your .NET applications. I shall use Windows Forms and C# to demonstrate the power of this helpful library.&lt;br /&gt;
&lt;br /&gt;
For starters, Rx is a library to compose asynchronous and event-based programs using observable collections and LINQ-style queries. Hmm...let&#39;s break that down: Rx helps us to subscribe to a list of objects and get feedback anytime elements in that list are processed. Initially, it might appear to be a not-so-different concept from the normal loop-eventcall concept. However, there are tons of extension methods that will really be of good help especially when we want to do asynchronous operations.&lt;br /&gt;
&lt;br /&gt;
Users don&#39;t want to wait for your app to respond. They want to do other things whiles your app is loading some tweets or reading some large chunk of data from a database. The era of &quot;Not Responding&quot; is practically vapoured by Rx.&lt;br /&gt;
&lt;br /&gt;
So here&#39;s an example.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s say our app writes 1 to 30 in a textbox when the user clicks &quot;Begin&quot;. That&#39;s simple right? You might just do this:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;private void WriteValues()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int maxValue = 30;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 1; i &amp;lt;= maxValue; i++)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; textBox1.AppendText(i + &quot;\r\n&quot;);&lt;br /&gt;
//just to simulate some operation that might take a while to complete&lt;br /&gt;
//Thread.Sleep(500);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
This works fine. It&#39;s good. No background threading or using Semaphores or WaitOne&#39;s or whatever. It&#39;s just simple. And it loads quite fast. Ok. Now let&#39;s make maxValue to be 10000, uncomment the &quot;Thread.Sleep(..)&quot; and execute. Your users now wait half a second for each integer in the loop to complete. That means they have to wait 1/2 * 10000 = 5000s = 83.33 minutes before they see their tweets. Oh my. Now we all know that&#39;s not helpful right? Wouldn&#39;t it be nicer to asynchronously load in the background and display the items in the textbox as it appears instead of blocking the whole app?&lt;br /&gt;
&lt;br /&gt;
This is just one of the problems Rx can help out without having to deal with System.Threading namespace or any of the messy low-level syntax.&lt;br /&gt;
&lt;br /&gt;
First thing is to get Rx library into your project. There&#39;s a special version of Rx for Windows Forms. It&#39;s available as a package on NuGet. Install with this command:&lt;br /&gt;
Install-Package Rx-WinForms&lt;br /&gt;
Next, let&#39;s create a new method that uses Rx to do the work for us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private static string WaitAWhile(string number)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
//just to simulate some operation that might take a while to complete&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Thread.Sleep(500);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return number;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
private void WriteValuesRx()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
int maxValue = 30;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var query = from number in Enumerable.Range(1, maxValue) select WaitAWhile(number.ToString());&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var observableQuery = query.ToObservable(Scheduler.Default);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; observableQuery.ObserveOn(textBox1).Subscribe(n =&amp;gt; textBox1.AppendText(n.ToString() + &quot;\r\n&quot;));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
//multiple subscriptions..&lt;br /&gt;
//observableQuery.ObserveOn(progressBar1).Subscribe(n =&amp;gt; progressBar1.Value += 1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
Yikes!! It looks like we&#39;ve written more code than the first instance. Well, yes. Let&#39;s see why.&lt;br /&gt;
&lt;br /&gt;
In the WriteValuesRx method, we built an enumerable list of strings to contain our numbers. We then convert it to an observable query, and subscribe to the observable query. This ensures that any time any of the elements in the list is being processed, we can observe it.&lt;br /&gt;
&lt;br /&gt;
Since we want to avoid &quot;Not Responding&quot; drama in most traditional desktop apps, we tell Rx to do the convertion on a default thread pool of the app. Then, during the asynchronous operation on each element in the observable list, we inform Rx that we want to observe the output of the operation on the textbox control. However, it should be on a thread that would safely talk to the textbox control to output the results. This will eliminate the common &quot;Cross-thread operation not valid: Control &#39;textBox1&#39; accessed from a thread other than the thread it was created on.&quot;&lt;br /&gt;
&lt;br /&gt;
That&#39;s it.&lt;br /&gt;
&lt;br /&gt;
Quite amazingly, Rx allows multi-subscription. You can add as many subscriptions to the observable collection as possible. Rx will do the work of reporting events to the underlying subscribers for you, in a thread-safe manner.&lt;br /&gt;
&lt;br /&gt;
Rx has come to stay. Happily, we can use it for traditional WinForms apps, WPF and even Windows Phone. There are more and more extension methods in the library which you can use to make your app more async and increase interactivity with your users.&lt;br /&gt;
&lt;br /&gt;
Happy coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b id=&quot;internal-source-marker_0.39549450390040874&quot; style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot;; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/5520596258129768660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/5520596258129768660?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/5520596258129768660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/5520596258129768660'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2013/04/being-reactive.html' title='Being Reactive: Using Reactive Extensions for .NET in your Applications'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6297890573740329630</id><published>2013-02-11T02:05:00.001-08:00</published><updated>2013-02-11T02:05:23.271-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AntiForgeryToken"/><category scheme="http://www.blogger.com/atom/ns#" term="AntiModelInjection"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="attacker"/><category scheme="http://www.blogger.com/atom/ns#" term="controller"/><category scheme="http://www.blogger.com/atom/ns#" term="Cross-site request forgery"/><category scheme="http://www.blogger.com/atom/ns#" term="CSRF"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="NuGet"/><category scheme="http://www.blogger.com/atom/ns#" term="parameter tampering"/><category scheme="http://www.blogger.com/atom/ns#" term="post"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>Securing Your ASP.NET MVC Apps</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Let me be straight to the point. I shall discuss two common security vulnerabilities in any MVC app and how to prevent it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: red; font-size: large;&quot;&gt;1. Cross Site Request Forgery&lt;/span&gt;&lt;/b&gt;:&lt;br /&gt;
As the name suggests, it&#39;s a forged request from an authenticated user on your site, triggered by some malicious tool. In other words, unknown to your authenticated user, a hacker might mimic form elements and repetitively post them to your controller. This can bloat your underlying persistent storage with dummy values and might even end up in a Denial-of-Service attack.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s an example:&lt;br /&gt;
&lt;br /&gt;
Let&#39;s say we&#39;re building a banking application, and there&#39;s a page for an authenticated user to transfer funds from his/her account to another account. This is what a typical developer might do for a view.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;section id=&quot;data-form&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.BeginForm(&quot;TranferAmount&quot;,&quot;MyTransfers&quot;); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; @Html.ValidationSummary(true)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h3&amp;gt;&amp;lt;legend&amp;gt;Account Details&amp;lt;/legend&amp;gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label for=&quot;ReceiverAccount&quot; class=&quot;control-label&quot;&amp;gt;Receiver&#39;s Account Number:&amp;lt;/label&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.DisplayFor(model =&amp;gt; model.ReceiverAccount)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.HiddenFor(model =&amp;gt; model.ReceiverAccount)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.ValidationMessageFor(model =&amp;gt; model.ReceiverAccount)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label for=&quot;Amount&quot; class=&quot;control-label&quot;&amp;gt;Amount:&amp;lt;/label&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.TextAreaFor(model =&amp;gt; model.Amount)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.ValidationMessageFor(model =&amp;gt; model.Amount)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;form-actions&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;input type=&quot;submit&quot; class=&quot;btn btn-success large&quot; value=&quot;Save&quot; /&amp;gt; or&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@Html.ActionLink(&quot;Cancel&quot;, &quot;Index&quot;, null, new { @class = &quot;btn btn-danger large&quot;})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/fieldset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.EndForm(); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Then in the MyTransfers controller, we do this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;[HttpPost]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Authorize]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult TransferAmount(TransferDetails transfer)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ModelState.IsValid) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _transferRepository.InsertOrUpdate(transfer);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _transferRepository.Save();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;FlashSuccess(&quot;Successfully transferred.&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return RedirectToAction(&quot;Index&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;FlashValidationError();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return View(transfer);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This seems normal. Indeed, it works logically. We have the &quot;[Authorize]&quot; attribute. It&#39;s ok, right? Nope. So what&#39;s missing? An attacker can inspect the page source of the view page and mimic it&#39;s behaviour and can iteratively post values to the form&#39;s action URL until the authenticated user&#39;s funds ran out. This is extremely dangerous.&lt;br /&gt;
To prevent this, there&#39;s a built-in library in ASP.NET MVC called AntiForgeryToekn. You need to add it&#39;s attribute to the controller&#39;s TransferAmount method and call it&#39;s HTML extension method to the view page, as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[HttpPost]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Authorize]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;b&gt;[ValidateAntiForgeryToken]&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult TransferAmount(TransferDetails transfer)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;.....&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and do this in the view:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.BeginForm(&quot;TranferAmount&quot;,&quot;MyTransfers&quot;); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;b&gt;@Html.AntiForgeryToken()&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; @Html.ValidationSummary(true)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now, look at the page source of the view page and you&#39;ll see a hidden element called &quot;&lt;span style=&quot;color: #1a1aa6; font-family: monospace; white-space: pre-wrap;&quot;&gt;__RequestVerificationToken&lt;/span&gt;&quot; with lots of &amp;nbsp;alpha-numerics as values.&lt;br /&gt;
This is what happens: Anytime the authenticated user visits that page, a new VerificationToken is created on the client and on the server. After a post, these values would be matched for validity before the actual form action is called to play. And that&#39;s it!&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red; font-size: large; font-weight: bold;&quot;&gt;2. Parameter Tampering&lt;/span&gt;:&lt;br /&gt;
Usually, when editing a model in MVC, the url might appear like this:&amp;nbsp;&lt;b&gt;http://some.remote.server/myaccount/Edit/4&lt;/b&gt;&amp;nbsp;and the page renders to allow the authenticated user to edit their profile. In the view page, we might do this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;section id=&quot;data-form&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.BeginForm(&quot;TranferAmount&quot;,&quot;MyTransfers&quot;); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; @Html.ValidationSummary(true)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;h3&amp;gt;&amp;lt;legend&amp;gt;Edit Account&amp;lt;/legend&amp;gt;&amp;lt;/h3&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;b&gt; @Html.HiddenFor(model =&amp;gt; model.UserId)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label for=&quot;Username&quot; class=&quot;control-label&quot;&amp;gt;Username:&amp;lt;/label&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.DisplayFor(model =&amp;gt; model.Username)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.HiddenFor(model =&amp;gt; model.Username)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.ValidationMessageFor(model =&amp;gt; model.Username)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;div class=&quot;control-group&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label for=&quot;Password&quot; class=&quot;control-label&quot;&amp;gt;Password&amp;lt;/label&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;controls&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.TextAreaFor(model =&amp;gt; model.Password)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @Html.ValidationMessageFor(model =&amp;gt; model.Password)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div class=&quot;form-actions&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;input type=&quot;submit&quot; class=&quot;btn btn-success large&quot; value=&quot;Update&quot; /&amp;gt; or&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;@Html.ActionLink(&quot;Cancel&quot;, &quot;Index&quot;, null, new { @class = &quot;btn btn-danger large&quot;})&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/fieldset&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.EndForm(); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
And in the controller, we might do this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;[HttpPost]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Authorize]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Edit(UserDetails userDetails)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ModelState.IsValid) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _userDetailsRepository.InsertOrUpdate(userDetails);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _userDetailsRepository.Save();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;FlashSuccess(&quot;Successfully updated account.&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return RedirectToAction(&quot;Index&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;FlashValidationError();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;return View(userDetails);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
This also works fine. However, since the number 4 might correspond to some field in, say, the UserAccounts table, an attacker might modify&amp;nbsp;&amp;nbsp; @Html.HiddenFor(model =&amp;gt; model.UserId)&amp;nbsp;value if he/she uses the developer tools in a modern browser. This would result in someone else&#39;s account being modified.&lt;br /&gt;
&lt;br /&gt;
How do we prevent this? Thanks to a third-party library, AntiModelInjection, available at&amp;nbsp;http://mvcsecurity.codeplex.com/ we can overcome this loophole. At the time of writing, this library has not been included in NuGet yet, so you have to manually download and include a reference to your MVC project.&lt;br /&gt;
It works almost the same as the AntiForgeryToken. So we just need to annotate our controller&#39;s method and add a line of code in the view.&lt;br /&gt;
&lt;br /&gt;
In the view, do this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;@{Html.BeginForm(&quot;TranferAmount&quot;,&quot;MyTransfers&quot;); }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;&lt;b&gt;@Html.AntiModelInjectionFor(o =&amp;gt; o.UserId)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; @Html.ValidationSummary(true)....&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
and in the controller&#39;s method, add this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;[HttpPost]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;[Authorize]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt; &lt;span style=&quot;color: blue;&quot;&gt;[ValidateAntiModelInjection(&quot;UserId&quot;)]&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Edit(UserDetails userDetails)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {.....&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now, when you view the source page, you should see a hidden element called &quot;&lt;span style=&quot;color: #1a1aa6; font-family: monospace; white-space: pre-wrap;&quot;&gt;_UserIdToken&lt;/span&gt;&quot;, with lots of alpha-numeric values.&lt;br /&gt;
&lt;br /&gt;
And the good thing is that AntiModelInjection and AntiForgeryToken can work together.&lt;br /&gt;
&lt;br /&gt;
These are but a few ways to secure your ASP.NET MVC apps.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoyed this post. Do let me know what you think.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6297890573740329630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6297890573740329630?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6297890573740329630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6297890573740329630'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2013/02/securing-your-aspnet-mvc-apps.html' title='Securing Your ASP.NET MVC Apps'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-2135290358471917419</id><published>2012-11-17T06:05:00.000-08:00</published><updated>2012-11-17T06:05:01.467-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC4"/><category scheme="http://www.blogger.com/atom/ns#" term="bootstrap"/><category scheme="http://www.blogger.com/atom/ns#" term="controller"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="twitter"/><category scheme="http://www.blogger.com/atom/ns#" term="typeahead"/><category scheme="http://www.blogger.com/atom/ns#" term="typeahead error"/><category scheme="http://www.blogger.com/atom/ns#" term="uncaught typeerror: cannot call method tolower of undefined"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio"/><title type='text'>Twitter Bootstrap Typeahead</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I had quite a struggle with the Typeahead component in Twitter Bootstrap component. I was using version 2.0.0. with ASP.NET MVC 4 using Visual Studio 2012.&lt;br /&gt;
&lt;br /&gt;
I wanted to display a list of locations as the user types in.&lt;br /&gt;
&lt;br /&gt;
Believe me, it was a pain when i kept on getting this error:&amp;nbsp;&lt;span style=&quot;background-color: #eeeeee; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;Uncaught TypeError: Cannot call method &#39;toLowerCase&#39; of undefined&amp;nbsp;&lt;/span&gt;in the console view of the Developer Tools in Chrome browser.&lt;br /&gt;
&lt;br /&gt;
After some intensive, exhaustive research, i got a workaround the problem. The js code in &quot;bootstrap-typeahead.js v2.0.0&quot; section of bootstrap.js had a bug. I got much need help &lt;a href=&quot;https://gist.github.com/1866577&quot;&gt;here&lt;/a&gt;.&amp;nbsp;The solution is to replace the existing section containing code for typeahead with the codes from the plugin.&lt;br /&gt;
&lt;br /&gt;
This is how i developed an ActionResult method in my Controller to return json for the typeahead to consume.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;public ActionResult GetPossibleLocations(string query)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string userLocation = query.ToLower();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var possibles =&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataRepository.All.Where(l =&amp;gt; l.Location.Contains(userLocation)).Select(l =&amp;gt; l.Location).Distinct().&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select(x =&amp;gt; new&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; locationName = x,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; locationAlias = x&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return new JsonResult&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ContentType = &quot;text/plain&quot;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Data = new&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; query,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; total = possibles.Count(),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; suggestions = possibles.Select(p =&amp;gt; p.locationAlias).ToArray(),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; matches = possibles,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonRequestBehavior = JsonRequestBehavior.AllowGet&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (Exception ex)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return Json(null, JsonRequestBehavior.AllowGet);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is what i did on the Views page to bring it to life:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$(function () {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(&quot;#location&quot;).typeahead({&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; source: function (typeahead, query) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $.ajax({&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url: &#39;@Url.Action(&quot;GetPossibleLocations&quot;)&#39;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataType: &quot;json&quot;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: &quot;POST&quot;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data: { query: query },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; success: function (data) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; typeahead.process(data.suggestions);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; onselect: function (obj) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // $(&#39;[name=&quot;user_id&quot;]&#39;).val(obj.id);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;});&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;lt;input name=&quot;location&quot; id=&quot;location&quot; &amp;nbsp;data-provide=&quot;typeahead&quot; &amp;nbsp;value=&quot;@ViewBag.location&quot; type=&quot;text&quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
There we are. Nicely done, simple and beautiful.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPNe1OYUwQRreUPulExN4Q0eNyy1dUJmh1oD6pOI_Nx9gFNBxzJ_hWVlXcxdcXdiCdhzR84bXOHzX-MLSSDeLlPsxjDKsRuiZp8PdshnUsbpbOVATwecAEXqPhtwjmJDLm_5EkFJHjLmg/s1600/typeahead.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPNe1OYUwQRreUPulExN4Q0eNyy1dUJmh1oD6pOI_Nx9gFNBxzJ_hWVlXcxdcXdiCdhzR84bXOHzX-MLSSDeLlPsxjDKsRuiZp8PdshnUsbpbOVATwecAEXqPhtwjmJDLm_5EkFJHjLmg/s1600/typeahead.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/2135290358471917419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/2135290358471917419?isPopup=true' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2135290358471917419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2135290358471917419'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/11/twitter-bootstrap-typeahead.html' title='Twitter Bootstrap Typeahead'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPNe1OYUwQRreUPulExN4Q0eNyy1dUJmh1oD6pOI_Nx9gFNBxzJ_hWVlXcxdcXdiCdhzR84bXOHzX-MLSSDeLlPsxjDKsRuiZp8PdshnUsbpbOVATwecAEXqPhtwjmJDLm_5EkFJHjLmg/s72-c/typeahead.PNG" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-3297523304409439018</id><published>2012-09-12T11:09:00.000-07:00</published><updated>2012-09-12T11:09:02.699-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="controller"/><category scheme="http://www.blogger.com/atom/ns#" term="CRUD"/><category scheme="http://www.blogger.com/atom/ns#" term="CRUD generator"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="Gii"/><category scheme="http://www.blogger.com/atom/ns#" term="model"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="view"/><category scheme="http://www.blogger.com/atom/ns#" term="webapp"/><category scheme="http://www.blogger.com/atom/ns#" term="XAMPP"/><category scheme="http://www.blogger.com/atom/ns#" term="Yii"/><category scheme="http://www.blogger.com/atom/ns#" term="Yii framework"/><title type='text'>Yii Framework Crash Course</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
MVC has become a popular framework for building great web applications. I migrating gradually towards advanced level in ASP.NET MVC 3 (i&#39;m discovering great features in 4.0 and above).&lt;br /&gt;
&lt;br /&gt;
Despite my great respect for the .NET platform, i was brought on a project where we had to use open-source tools to deliver a great product. After days of &#39;arguements&#39;, we settled on quite an outstanding PHP framework called Yii.&lt;br /&gt;
&lt;br /&gt;
Yii is a fast, secure and professional PHP web framework. Yii is practically easy to use. And i want to write something about it in 3 simple steps.&lt;br /&gt;
&lt;br /&gt;
I assume that you have already downloaded Yii (latest version at the time of writing is &lt;a href=&quot;http://yii.googlecode.com/files/yii-1.1.12.b600af.tar.gz&quot;&gt;v1.1.12&lt;/a&gt;) and extracted it to htdocs folder of your XAMPP web server. I shall present this making reference to the Windows OS platform and Eclipse IDE. Let&#39;s start.&lt;br /&gt;
&lt;br /&gt;
Step 1&lt;br /&gt;
1. Create your database.&lt;br /&gt;
This is the foundation for Yii. A well-engineered database will augur well for your application, though you can easily make changes and update it in Yii. I repeat, make sure you design your database very well before you proceed to the next step.&lt;br /&gt;
&lt;br /&gt;
Step 2&lt;br /&gt;
2. Create your webapp with Yii&lt;br /&gt;
How?&lt;br /&gt;
Open command-prompt and navigate to php folder. Then execute this command&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;php.exe ../htdocs/[yii folder]/framework/yiic webapp ../htdocs/[project name]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
If successful, you should have this response:&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;Create a Web application under &#39;C:\xampp\htdocs\testproject&#39;? [yes|no]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Type &#39;yes&#39; to continue. You would see Yii in action, creating all the necessary webapp files for you.&lt;br /&gt;
&lt;br /&gt;
3. Customize the code.&lt;br /&gt;
Now, you need a good PHP IDE to really help you out. I use Eclipse. It doesn&#39;t really matter. Open a new project in your IDE with the same name as the &lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;[project name]&lt;/span&gt;. If you&#39;re using Eclipse, it will automatically pull in all the files under that project name. You can inspect the folders to see what Yii did.&lt;br /&gt;
&lt;br /&gt;
In the &#39;protected&#39; folder are subfolders that should spark that MVC flame in you. You should see a models, views and controllers folder. These are what makes Yii fantastic. (You can view the output of your webapp anytime by navigating to &lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;http://localhost[:port]/[project name]&lt;/span&gt; in your browser.)&lt;br /&gt;
&lt;br /&gt;
So now you need to link Yii to some database right? Great.&lt;br /&gt;
&lt;br /&gt;
Yii uses a tool called Gii (lol) to auto-generate models, views and controllers after a successful connection to your database. Open the file &#39;main.php&#39; in the &#39;config&#39; folder under &#39;protected&#39; folder. What you see are the main configuration details for Yii.&lt;br /&gt;
&lt;br /&gt;
Yii mostly uses PHP codes throughout with lots of array returns. Give your webapp a name by changing the &#39;My Web Application&#39; value in the &#39;name&#39; key. Now, look for the &#39;modules&#39; section and uncomment the &#39;gii&#39; code. Replace the &#39;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Enter Your Password Here&lt;/span&gt;&#39; with an appropriate password.&lt;br /&gt;
&lt;br /&gt;
By default, Yii uses SQLlite to do lightweight db connections. However, it can work against a number of databases. As you scroll down, you can see the MySQL &#39;db&#39; configuration section commented out. Uncomment it, and comment the SQLlite db instead. Replace the values under the MySQL configuration section with your own database credentials (of course, they should be correct!). That should tell Yii that you&#39;re gonna point Gii to a MySQL database with those connection details.&lt;br /&gt;
&lt;br /&gt;
In your browser, navigate to &lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;http://localhost[:port]/[project name]/index.php?r=gii&lt;/span&gt;. This brings you to the Gii page. Enter the password, and welcome to the magic world of Gii.&lt;br /&gt;
As some sort of rule of thumb, you should create Models first before controllers or views are added, so click on Model Generator.&lt;br /&gt;
On that page, you are presented with 2 textboxes, the first one asking you to enter your table name. The other textbox will be the model name after you enter the name of your table. Yii may automatically fill the second textbox for you, but you are free to edit it. Click on &#39;Preview&#39; and then click &#39;Generate&#39;. Do this for all your tables in your database.&lt;br /&gt;
After this, click on Crud Generator, enter a model name and click &#39;Preview&#39;. As you shall see, Gii will generate a controller for that model as well as views for each CRUD operation. Repeat the procedure for each model that you created.&lt;br /&gt;
&lt;br /&gt;
That&#39;s it!! You have a full fledged webapp. It should take at most 20mins to build a raw Yii webapp.&lt;br /&gt;
You can test your finished work by navigating to &lt;span style=&quot;color: blue; font-family: Courier New, Courier, monospace;&quot;&gt;http://localhost[:port]/[project name]/index.php?r=[controller name without &#39;controller&#39; word]/[controller&#39;s method name without &#39;action&#39; word]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You may customize the URL routings to suit your pleasure.&lt;br /&gt;
&lt;br /&gt;
Still confused? Try a video tutorial &lt;a href=&quot;http://www.youtube.com/watch?v=H2c6HR0DzUQ&quot;&gt;here.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Happy coding!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/3297523304409439018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/3297523304409439018?isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3297523304409439018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3297523304409439018'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/09/yii-framework-crash-course.html' title='Yii Framework Crash Course'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-3990966263363219738</id><published>2012-06-22T04:33:00.001-07:00</published><updated>2012-06-22T04:45:56.696-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="app crash"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="crash"/><category scheme="http://www.blogger.com/atom/ns#" term="engineering"/><category scheme="http://www.blogger.com/atom/ns#" term="exiting WP7 application"/><category scheme="http://www.blogger.com/atom/ns#" term="NavigationService"/><category scheme="http://www.blogger.com/atom/ns#" term="OnBackKeyPress"/><category scheme="http://www.blogger.com/atom/ns#" term="software engineering"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7.5"/><category scheme="http://www.blogger.com/atom/ns#" term="WP7"/><title type='text'>Exiting a WP7 Application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Unfortunately, there&#39;s no class for safely exiting a windows phone 7 or 7.5 (may be 8 too) application. I struggled with this problem for quite some hours. I visited online forums and read many threads; visited many blogs too. All were trying to tell me to deliberately crash the app for exiting like below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;e.Cancel = true;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MessageBoxResult res = MessageBox.Show(&quot;Are you sure you want to exit?&quot;, &quot;Exit?&quot;, MessageBoxButton.OKCancel);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (res == MessageBoxResult.OK)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt; NavigationService.Navigate(new Uri(&quot;/kaboom.xaml&quot;, UriKind.Relative));&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;I felt it was reasonable but i knew that a good software engineer had to know and do better. After a couple of tries, 2 lines of code did the trick&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;e.Cancel = true;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MessageBoxResult res = MessageBox.Show(&quot;Are you sure you want to exit?&quot;, &quot;Exit?&quot;, MessageBoxButton.OKCancel);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (res == MessageBoxResult.OK)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;e.Cancel = false;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; base.OnBackKeyPress(e);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I believe this is a better, safer, engineering approach to exiting a WP7 app in a&amp;nbsp;programmatic fashion.&lt;br /&gt;
&lt;br /&gt;
Happy coding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/3990966263363219738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/3990966263363219738?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3990966263363219738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3990966263363219738'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/06/exiting-wp7-application.html' title='Exiting a WP7 Application'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-4750077908783940535</id><published>2012-04-25T05:32:00.000-07:00</published><updated>2012-04-25T05:34:44.297-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="devices"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="engineering"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="iPad"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="ipod"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="PC plus"/><category scheme="http://www.blogger.com/atom/ns#" term="Postgres SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="QWERTY"/><category scheme="http://www.blogger.com/atom/ns#" term="Server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Steve Jobs"/><category scheme="http://www.blogger.com/atom/ns#" term="touch devices"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Phone 7.5"/><category scheme="http://www.blogger.com/atom/ns#" term="XCode"/><title type='text'>What was Steve Jobs thinking?</title><content type='html'>&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I quite recently read an &lt;a href=&quot;http://news.cnet.com/8301-13924_3-57371681-64/ipad-kindle-fire-are-not-post-pc-says-idc-analyst/&quot; target=&quot;_blank&quot;&gt;article&lt;/a&gt; that seems to argue that
the flashy trends of smart devices (smartphones, tablets and whatnots) do not
stand a chance of replacing the traditional laptops, but can be thought of as
an enhancement or PC-Plus. I think I want to agree with that.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Most tech minds of our time are going frenzied with touch
devices. Touch is almost everywhere; touch this, tap here, sometimes gesture
movements. But do these near-future devices come to erase the indelible
mouse-pointers and our favourite QWERTYs?&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Let me take a look at these from a programmer’s point of
view:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo1; text-indent: -18.0pt;&quot;&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Can I write a simple program on any of these
devices?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -18pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;Can I do debugging and code engineering?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-indent: -18pt;&quot;&gt;Can I maintain a database engine on these and
perform real-time queries and retrieve stored procedures?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Obviously, the answer should be no.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
These PC-plus devices are almost for access and read-only
purposes. You do something on your PC (or Mac) and then sync it to your device
(or access through cloud). You may not be able to even edit what you do after
it gets on to your device.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
And don’t tell me you can edit pictures and other documents.
Ok, true to some point. But can you really type out your whole homework essay
on your phone, without a physical stress-free typewriter. That is where touch
becomes somewhat useless. I can’t imagine any student patiently typing his/her
final year thesis on a touch device.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
I’m yet to see a miracle when Oracle, Microsoft or Postgres
comes with a mobile SQL Server; would that be query limited or a read-only
version of such huge database systems. Or better yet, imaging Facebook’s
database servers were run on these tiny devices.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Additionally, I can’t imagine how painful it would be to use
visual studio on my Windows Phone 7.5 or even XCode on iPhone. Have you ever
thought of that?&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
If these touch devices are replacing PCs, as some might
ignorantly suggest, then how come you need to use XCode on a Mac to design and
develop for and iPhone or iPad. Why can’t I just do so straightway on those
devices.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
PCs are needed. The mouse, especially, is one of the most
precise pointing devices ever invented. It’s use is a can’t-do-without. They
are here to stay. Touch devices are like small but smart brothers (or sisters)
to these traditional computers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
So, what was Steve Jobs thinking? Arguably not a phased-out
generation of traditional PC but shift towards getting things done faster and
more comfortably.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/4750077908783940535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/4750077908783940535?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4750077908783940535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4750077908783940535'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/04/what-was-steve-jobs-thinking.html' title='What was Steve Jobs thinking?'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-4294409949047314549</id><published>2012-04-18T02:47:00.003-07:00</published><updated>2012-04-18T02:50:53.740-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="Blackberry"/><category scheme="http://www.blogger.com/atom/ns#" term="CodenameOne"/><category scheme="http://www.blogger.com/atom/ns#" term="FolderBrowser"/><category scheme="http://www.blogger.com/atom/ns#" term="J2ME"/><title type='text'>FolderBrowser for J2ME, BB and Android</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This is a reply for my friend Whayu:&lt;br /&gt;
&lt;br /&gt;
1. Copy and paste this into an empty java file and call it &#39;FolderBrowser.java&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import javax.microedition.io.*;&lt;br /&gt;
import javax.microedition.io.file.*;&lt;br /&gt;
import javax.microedition.lcdui.*;&lt;br /&gt;
&lt;br /&gt;
import com.orion.lala.settings.DownloadSettings;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
&amp;nbsp;* A UI for browsing and selecting a folder location on a phone&lt;br /&gt;
&amp;nbsp;* @author Augustine&lt;br /&gt;
&amp;nbsp;*&lt;br /&gt;
&amp;nbsp;*/&lt;br /&gt;
public class FolderBrowser extends Form implements CommandListener&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; private String currDirName;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; private Command view = new Command(&quot;Open&quot;, Command.ITEM, 1);&lt;br /&gt;
&amp;nbsp; private Command back = new Command(&quot;Back&quot;, Command.BACK, 2);&lt;br /&gt;
&amp;nbsp; //private Command btnWrite = new Command(&quot;Write&quot;, Command.OK, 2);&lt;br /&gt;
&amp;nbsp; private Command btnFolder = new Command(&quot;Select&quot;, Command.OK, 3);&lt;br /&gt;
&amp;nbsp; private Command exit = new Command(&quot;Cancel&quot;, Command.EXIT, 3);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; private final static String UP_DIRECTORY = &quot;..&quot;;&lt;br /&gt;
&amp;nbsp; private final static String MEGA_ROOT = &quot;/&quot;;&lt;br /&gt;
&amp;nbsp; private final static String SEP_STR = &quot;/&quot;;&lt;br /&gt;
&amp;nbsp; private final static char &amp;nbsp; SEP = &#39;/&#39;;&lt;br /&gt;
&amp;nbsp; Display display;&lt;br /&gt;
//Form callerMid;&lt;br /&gt;
&amp;nbsp; boolean isAPIAvailable;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; /**&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* &amp;lt;b&amp;gt; Do not use this method&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* @param display&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* @param caller&lt;br /&gt;
&amp;nbsp; &amp;nbsp;*/&lt;br /&gt;
&amp;nbsp; public FolderBrowser(Display display, Form caller)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;super(&quot;Select folder to save items&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// &amp;nbsp;this.display = display;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;//callerMid = caller;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;doStartUpThings();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; /**&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* The constructor&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* @param disp Must be valid and not null&lt;br /&gt;
&amp;nbsp; &amp;nbsp;*/&lt;br /&gt;
&amp;nbsp; public FolderBrowser(Display disp)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;super(&quot;Select folder to save items&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;this.display = disp;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; // callerMid = caller;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;selectedFolderPath = &quot;&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;doStartUpThings();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; private void doStartUpThings(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;currDirName = MEGA_ROOT;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; isAPIAvailable = false;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;if (System.getProperty(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;microedition.io.file.FileConnection.version&quot;) != null)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;isAPIAvailable = true;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;new Thread(new Runnable() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;public void run() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;// TODO Auto-generated method stub&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;     &lt;/span&gt;showCurrDir();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}).start();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (SecurityException e)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;System.out.println(&quot;microedition.io.file.FileConnection.version may be null: &quot; + e.getMessage());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (Exception e) { System.out.println(&quot;microedition.io.file.FileConnection.version may be null: &quot; + e.getMessage());}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;else&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; /* StringBuffer splashText = new StringBuffer(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;caller.getAppProperty(&quot;MIDlet-Name&quot;)).append(&quot;\n&quot;).append(&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;caller.getAppProperty(&quot;MIDlet-Vendor&quot;)).&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;append(isAPIAvailable?&quot;&quot;:&quot;\nFileConnection API not available&quot;);*/&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Alert splashScreen = new Alert(null,&quot;FileConnection API not available&quot;,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;null,AlertType.INFO);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;splashScreen.setTimeout(3000);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;//display.setCurrent(splashScreen);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; IFolderBrowserEventListener listener;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; /**&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* Sets the event handler.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;* @param l Must be valid and not null&lt;br /&gt;
&amp;nbsp; &amp;nbsp;*/&lt;br /&gt;
&amp;nbsp; public void setFolderBrowserEventListener(IFolderBrowserEventListener l) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;// TODO Auto-generated method stub&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;this.listener = l;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; private String selectedFolderPath;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; public void commandAction(Command c, Displayable d)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (c == view)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; List curr = (List)d;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; final String currFile = curr.getString(curr.getSelectedIndex());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; new Thread(new Runnable()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (currFile.endsWith(SEP_STR) ||&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currFile.equals(UP_DIRECTORY))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; traverseDirectory(currFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; showFile(currFile);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }).start();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if (c == back)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if (c == exit)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; //display.setCurrent(callerMid);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if (selectedFolderPath==null) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;listener.noFolderSelected();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;else if (selectedFolderPath.trim().length()==0) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;listener.noFolderSelected();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;listener.formExited();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if (c==btnFolder){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;//List curr = (List)d;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;selectedFolderPath = &quot;file://localhost/&quot;+currDirName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;listener.selectedFolderPath(&quot;file://localhost/&quot;+currDirName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;//display.setCurrent(callerMid);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;/* else if (c==btnWrite) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;new Thread(new Runnable() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;public void run() {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;// TODO Auto-generated method stub&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;writetoFolder();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}).start();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}*/&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; void showCurrDir()&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Enumeration e;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; FileConnection currDir = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; List browser;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (MEGA_ROOT.equals(currDirName))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e = FileSystemRegistry.listRoots();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; browser = new List(currDirName, List.IMPLICIT);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currDir = (FileConnection)Connector.open(&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;file://localhost/&quot; + currDirName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e = currDir.list();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; browser = new List(currDirName, List.IMPLICIT);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; browser.append(UP_DIRECTORY,null);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; while (e.hasMoreElements())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String fileName = (String)e.nextElement();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (fileName.charAt(fileName.length()-1) == SEP)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; browser.append(fileName,null);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //browser.append(fileName,null);//it is adding files....we don&#39;t want to see this...so we comment is out&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; browser.addCommand(btnFolder);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; //browser.addCommand(btnWrite);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; browser.setSelectCommand(view);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; //browser.addCommand(back);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; browser.addCommand(exit);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; browser.setCommandListener(this);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (currDir != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currDir.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; display.setCurrent(browser);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; catch (IOException ioe)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {System.out.println(&quot;at showCurrDir &quot; + ioe.getMessage());}&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; void traverseDirectory(String fileName)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (currDirName.equals(MEGA_ROOT))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (fileName.equals(UP_DIRECTORY))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // can not go up from MEGA_ROOT&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; currDirName = fileName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else if (fileName.equals(UP_DIRECTORY))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // Go up one directory&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; // TODO use setFileConnection when implemented&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; int i = currDirName.lastIndexOf(SEP, currDirName.length()-2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (i != -1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currDirName = currDirName.substring(0, i+1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currDirName = MEGA_ROOT;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; currDirName = currDirName + fileName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; showCurrDir();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; void showFile(String fileName)&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; FileConnection fc = (FileConnection)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Connector.open(&quot;file://localhost/&quot; + currDirName + fileName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (!fc.exists())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new IOException(&quot;File does not exists&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; InputStream fis = fc.openInputStream();&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; byte[] b = new byte[1024];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; int length = fis.read(b, 0, 1024);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; fis.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; fc.close();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox tb = new TextBox(&quot;View File: &quot; + fileName, null, 1024,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextField.ANY | TextField.UNEDITABLE);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; tb.addCommand(back);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; tb.addCommand(exit);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; tb.setCommandListener(this);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (length &amp;gt; 0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tb.setString(new String(b, 0, length));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; display.setCurrent(tb);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; catch (Exception e) {}&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;/* void writetoFolder(){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;try&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;FileConnection fc = (FileConnection)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Connector.open(&quot;file://localhost/&quot; + currDirName + &quot;somefile.txt&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(&quot;Now here:&quot; + &quot;file://localhost/&quot; + currDirName + &quot;somefile.txt&quot;);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!fc.exists())&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp;fc.create();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;OutputStream os = fc.openOutputStream();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;os.write(&quot;hello world&quot;.getBytes());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; //os.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;fc.close();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;catch (Exception e) {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;System.out.println(&quot;no way: &quot; + e.getMessage());&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
&amp;nbsp; }*/&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
2. Copy the following and paste into another empty java file and name it &#39;IFolderBrowserEventListener&#39;:&lt;br /&gt;
&lt;br /&gt;
package com.orion.lala.folderdialog;&lt;br /&gt;
&lt;br /&gt;
import com.orion.lala.ui.IFormExitedEvents;&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
&amp;nbsp;* Exposes methods called when browsing through folders&lt;br /&gt;
&amp;nbsp;* @author Augustine&lt;br /&gt;
&amp;nbsp;*&lt;br /&gt;
&amp;nbsp;*/&lt;br /&gt;
public interface IFolderBrowserEventListener extends IFormExitedEvents {&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * Called when user has selected a folder.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * @param folderPath The full path to the selected folder&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void selectedFolderPath(String folderPath);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;/**&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; * Called when user has not selected a folder (and there&#39;s no history of a selected folder) and wants to exit.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt; */&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public void noFolderSelected();&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
3. Use it in your J2ME midlet project.&lt;/div&gt;
&lt;div&gt;
4.After you build your J2ME jar file, you can convert it to BB app using &lt;a href=&quot;http://brandon.vslstudios.com/products/j2a-pro&quot; target=&quot;_blank&quot;&gt;J2A&lt;/a&gt; and you can also convert it to Android&#39;s APK using &lt;a href=&quot;http://www.netmite.com/android/srv/2.0/getapk.php&quot; target=&quot;_blank&quot;&gt;netmite&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Hope it helps.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For now, let&#39;s wait on &lt;a href=&quot;http://www.codenameone.com/&quot; target=&quot;_blank&quot;&gt;CodenameOne&lt;/a&gt; team to fix the issue.&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/4294409949047314549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/4294409949047314549?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4294409949047314549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4294409949047314549'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/04/folderbrowser-for-j2me-bb-and-android.html' title='FolderBrowser for J2ME, BB and Android'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6683487292280266315</id><published>2012-03-26T01:28:00.002-07:00</published><updated>2012-03-26T01:29:27.407-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CodenameOne"/><category scheme="http://www.blogger.com/atom/ns#" term="FileSystemStorage"/><category scheme="http://www.blogger.com/atom/ns#" term="FolderBrowser"/><category scheme="http://www.blogger.com/atom/ns#" term="Form"/><category scheme="http://www.blogger.com/atom/ns#" term="Screenshots"/><title type='text'>FolderBrowser for CodenameOne</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I was patiently waiting for the &lt;a href=&quot;http://www.codenameone.com/&quot; target=&quot;_blank&quot;&gt;CodenameOne&lt;/a&gt; team to fix a bug on the FileTree UI element
but i guess they had other more important issues on their hands and minds.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
Today, i decided to end the wait. I carefully inspected the CodenameOne
library and started off to design my own file/directory browser. And believe
me, it was quite simple. I played around with
the&amp;nbsp;com.codename1.io.FileSystemStorage package and voila, i developed my
own UI element.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
I guess some of the UI issues we file up can be solved by ourselves.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
I&#39;m giving back to the CodenameOne community what they gave me for free.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
My FolderBrowser Form only shows folders but you can fully customize it to
display files as well. It&#39;s very simple. I used just two methods to bring it to
live. Just 203 lines of code made all the difference.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
For code lovers, here&#39;s the code:&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;/*&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* FolderBrowser
component&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* Developed by
Augustine Gyawu Adjei&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* Started: 23 March
2012&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* First Public
Release: 23 March 2012&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* You may use this
class in your apps for both personal and commercial use.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* Send feeback to
austinejei@gmail.com or visit http://austinejei.blogspot.com&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;package
com.orionsystems.cnoui;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;import
com.codename1.io.FileSystemStorage;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;import com.codename1.ui.*;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;import
com.codename1.ui.events.ActionEvent;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;import
com.codename1.ui.events.ActionListener;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;import
com.codename1.ui.layouts.BoxLayout;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;/**&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* Form for browsing
through folders on a mobile device&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;* @author Augustine
Gyawu Adjei&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Courier; font-size: 10pt;&quot;&gt;public class&lt;/span&gt;&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt; FolderBrowser &lt;span style=&quot;color: blue;&quot;&gt;extends&lt;/span&gt; Form {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; FolderBrowser(){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; super(&quot;Folder Browser&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; initializeComponents();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;private void&lt;/span&gt; initializeComponents(){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp;this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; fs = FileSystemStorage.getInstance();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; cmdSelect = new Command(&quot;Select&quot;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; cmdView = new Command(&quot;Open&quot;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; gp = new ComponentGroup();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; gp.setLayout(new BoxLayout(BoxLayout.Y_AXIS));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; con = new Container(new BoxLayout(BoxLayout.Y_AXIS));&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; addCommand(cmdView);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; addCommand(cmdSelect);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; gp.addComponent(con);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; addComponent(gp);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; addCommandListener(new ActionEventListeners());&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; startListing();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
FileSystemStorage fs;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; private
&amp;nbsp;static String UP_DIRECTORY = &quot;..&quot;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; //DEFAULT
CHARACTERS&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; private
&amp;nbsp;static String ROOT_DIRECTORY = &quot;\\&quot;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; private
&amp;nbsp;static String DIRECTORY_SEPARATOR = &quot;\\&quot;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; private
&amp;nbsp;static char &amp;nbsp; SEPARATOR_CHARACTER = &#39;\\&#39;;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; private String
currentDirectory;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; ComponentGroup gp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; Container con;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; Command cmdView;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; Command cmdSelect;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; /**&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;* Starting
point of the dialog. Displays the root directories on the&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;* device.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;private void&lt;/span&gt; startListing(){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
SEPARATOR_CHARACTER = fs.getFileSystemSeparator();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
DIRECTORY_SEPARATOR = String.valueOf(SEPARATOR_CHARACTER);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
ROOT_DIRECTORY = DIRECTORY_SEPARATOR;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
currentDirectory = ROOT_DIRECTORY;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
displayFolders();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; List folBrowser;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; /**&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;* Displays
all folders under the current directory&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;private void &lt;/span&gt;displayFolders(){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; String[] folderItems;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; try {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (ROOT_DIRECTORY.equals(currentDirectory))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; folderItems = fs.getRoots();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setTitle(&quot;Drives&quot;);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; folBrowser = new List();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; folderItems = fs.listFiles(currentDirectory);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; setTitle(currentDirectory);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; folBrowser = new List();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; folBrowser.getModel().addItem(UP_DIRECTORY);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; folderItems.length; i++) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String fileName = folderItems[i] ;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //you may customize this part to show
files...&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (fs.isDirectory(currentDirectory +
fileName)) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
folBrowser.getModel().addItem(fileName);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;con.removeAll();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;con.addComponent(folBrowser);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;folBrowser.addActionListener(new
ActionEventListeners());&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; con.repaint();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; } catch (Exception ex) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; /**&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*
Browses a directory&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*
@param fileName Must be valid and not null&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; private
void browseDirectory(String fileName)&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
String thename = UP_DIRECTORY + DIRECTORY_SEPARATOR;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; if
(currentDirectory.equals(ROOT_DIRECTORY))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if
(fileName.equals(UP_DIRECTORY))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; //we don&#39;t need to go up from root&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; return;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
currentDirectory = fileName;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; else
if(fileName.equals(thename))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
//Move back one directory&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; int i = currentDirectory.lastIndexOf(SEPARATOR_CHARACTER,
currentDirectory.length()-2);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if
(i != -1)&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; currentDirectory = currentDirectory.substring(0, i+1);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
}&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
else&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; currentDirectory = ROOT_DIRECTORY;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; else&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
currentDirectory = currentDirectory + fileName;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
displayFolders();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; /**&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*
Class to handle action events&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; private
class ActionEventListeners implements ActionListener{&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; public void actionPerformed(ActionEvent evt) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; String currFile = folBrowser.getSelectedItem().toString();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (!currFile.endsWith(DIRECTORY_SEPARATOR)) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currFile = currFile + DIRECTORY_SEPARATOR;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; if (evt.getSource().equals(cmdSelect)) {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dialog.show(&quot;Great!!&quot;,
&quot;Selected Folder: &quot; + currentDirectory + currFile, &quot;Ok&quot;,
null);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else if(evt.getSource().equals(cmdView)){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (currFile.endsWith(DIRECTORY_SEPARATOR)
|| currFile.equals(UP_DIRECTORY))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
browseDirectory(currFile);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //you may want
to show your files here....&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; else if(evt.getSource().equals(folBrowser)){&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if
(currFile.endsWith(DIRECTORY_SEPARATOR) || currFile.equals(UP_DIRECTORY))&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
browseDirectory(currFile);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} else&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier; font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here are some screen shots of FolderBrowser in action:&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYlOQaiI84UpQ9LlN5A1ilhPVW3MYdCDYLQ6lGFr4xleNrEHvfjuQhgyExVh0lJsdvpFbw_zurpungNcdjx3beqwDCg8hUrEDTWi2XHYDKsRmyhUHjZpcePr644LtGldYVFgOh3pjcI9k/s1600/fb1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYlOQaiI84UpQ9LlN5A1ilhPVW3MYdCDYLQ6lGFr4xleNrEHvfjuQhgyExVh0lJsdvpFbw_zurpungNcdjx3beqwDCg8hUrEDTWi2XHYDKsRmyhUHjZpcePr644LtGldYVFgOh3pjcI9k/s320/fb1.JPG&quot; width=&quot;189&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibItbmPGcMe1A4ILqhDRcHSCPUhtzVR18diNOEabFlLHLgdJYIGkVK5b9UNKPST6xYyP7SuXVwAQXQgGhBBGMU1Jh75p8rs83xWGNAhhi-nvxqWCBFDKX66gOz2Xra6CLpUZ1Usd6hM5U/s1600/fb3.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibItbmPGcMe1A4ILqhDRcHSCPUhtzVR18diNOEabFlLHLgdJYIGkVK5b9UNKPST6xYyP7SuXVwAQXQgGhBBGMU1Jh75p8rs83xWGNAhhi-nvxqWCBFDKX66gOz2Xra6CLpUZ1Usd6hM5U/s320/fb3.JPG&quot; width=&quot;198&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizVVpa10TmwgWCPIcuknjEPH67eqUDJGZTb9uEq-kAmak5HBm5Ifqozr0UstY_pG-hjusGVrNVkPSrZny0r5oYdV2bqAgEy6kQrpIjSmLTe3Kscf-0hzjfIEvI3QPbMgepnmzyn2rEipE/s1600/fb2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizVVpa10TmwgWCPIcuknjEPH67eqUDJGZTb9uEq-kAmak5HBm5Ifqozr0UstY_pG-hjusGVrNVkPSrZny0r5oYdV2bqAgEy6kQrpIjSmLTe3Kscf-0hzjfIEvI3QPbMgepnmzyn2rEipE/s320/fb2.JPG&quot; width=&quot;203&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6683487292280266315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6683487292280266315?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6683487292280266315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6683487292280266315'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/03/folderbrowser-for-codenameone.html' title='FolderBrowser for CodenameOne'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYlOQaiI84UpQ9LlN5A1ilhPVW3MYdCDYLQ6lGFr4xleNrEHvfjuQhgyExVh0lJsdvpFbw_zurpungNcdjx3beqwDCg8hUrEDTWi2XHYDKsRmyhUHjZpcePr644LtGldYVFgOh3pjcI9k/s72-c/fb1.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-2212666478248611139</id><published>2012-03-14T02:20:00.000-07:00</published><updated>2017-03-10T15:32:26.026-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="app"/><category scheme="http://www.blogger.com/atom/ns#" term="CodenameOne"/><category scheme="http://www.blogger.com/atom/ns#" term="iPad"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="LWUIT"/><category scheme="http://www.blogger.com/atom/ns#" term="NetBeans"/><category scheme="http://www.blogger.com/atom/ns#" term="Shai Almog"/><title type='text'>CodenameOne: One for All</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Introduction:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;The mobile app development world has been truly revolutionized.
Clear the red carpet and make way for CodenameOne.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0.0001pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;CodenameOne is &quot;&lt;/span&gt;&lt;span style=&quot;color: #737373; font-family: &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 13.5pt;&quot;&gt;A revolutionary open source
mobile device development platform that leverages 15 years of Java portability
to enable high quality rapid application development targeting all mobile
platforms.&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&quot; In short,
you can use CodenameOne to develop truly native mobile phone applications that
is guaranteed to work on all platforms including JavaME, Android, RIM, iOS and &lt;strike&gt;coming-soon&lt;/strike&gt; Windows Phone. And the good thing is
that you don&#39;t have to bother yourself with the intrinsic know-hows of the
device’s programming requirements. If you know Java, that’s it! You can now
extend your skills to the world of mobile app development. And oh, it’s for
free.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;History:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;CodenameOne branched off from LWUIT (Light-weight User Interface
Toolkit). It is a huge improvement in terms of efficiency, speed (referring to
the really fast simulator for all devices) and structurally similar to the
industry-approved Java programming language.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Shai Almog let the cat out of the bag on 26 Dec. 2011 with some
teaser statements that whetted my code apetite. He wrote: “&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 11.5pt;&quot;&gt;Wouldn&#39;t it be great if you could write your code once and
actually have it work on all the devices out there?&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 11.5pt;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;Wouldn&#39;t it be
great if you could develop to iPhone/iPad without a Mac?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;&quot;&gt;Wouldn&#39;t it be
great if you could develop to Windows Phone 7 without a Windows 7 PC?&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;”&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;How to:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;CodenameOne has great products on the website, &lt;a href=&quot;http://www.codenameone.com/&quot;&gt;www.codenameone.com&lt;/a&gt; . Joyous of all is
that you can still install a plugin into your favourite Java IDEs like NetBeans
(which I now use) or Eclipse (tried it too, it’s great). I don’t know of any
support for IntelliJ or other Java IDEs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Anyway the installation is quite simple. Visit &lt;a href=&quot;http://www.codenameone.com/eclipse-plugin-installation.html&quot; target=&quot;_blank&quot;&gt;here for Eclipse&lt;/a&gt;
and &lt;a href=&quot;http://www.codenameone.com/netbeans-plugin-installation.html&quot; target=&quot;_blank&quot;&gt;here for NetBeans&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Available on the page is the perfect drag-and-drop designer tool, CodenameOne
designer, with previews for all devices. This takes much of the pain of having
to design device-specific UI. The designer can also be linked to your project,
and you can do some coding that links the designer’s elements to some click
events.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Example: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Let me do a quick walk through for those using NetBeans. In this
example we’re going to post a form to some web service and get some feedback.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;I assume you’ve already installed the plugin, restarted NetBeans,
created a new project with a GUI builder. Open the themeAndGUI.res file.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Click on ‘Add A New GUI Element’. &amp;nbsp;Select ‘UserDetailsForm’ from the ‘Templates’ combo
box on the dialog that has popped up. Give it a name and click ok. There we
are! For simplicity sake, I’ve deleted some of the UI elements.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;(At the time of writing, GUI builder was in it&#39;s infancy. Many changes have been made since then.)&lt;/span&gt;&lt;/b&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfq5uutsLKQSWkHChmrvy6wb9AfEXjVjdSLANBuwZ7DFsUNwf2_GNnf9EBb6J-oIno8WPYybea4II5Uo9AL-wvvVTNDiLOhc1KVOJDWFq4w0W6qZ-57U0PvUqMcX5HeBUIcKLat1b83E/s1600/cn4.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfq5uutsLKQSWkHChmrvy6wb9AfEXjVjdSLANBuwZ7DFsUNwf2_GNnf9EBb6J-oIno8WPYybea4II5Uo9AL-wvvVTNDiLOhc1KVOJDWFq4w0W6qZ-57U0PvUqMcX5HeBUIcKLat1b83E/s400/cn4.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;Select the submit button and go to the events tab. Click on ‘Action
Event’. This automatically reverts to NetBeans and creates a method to handle
that event.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXoStOzOKL97AlRtFz9P-S8_v7GccuOdX09CsQ1eag-pzLHtrPSAZzNAQScDE6SdgxwDa8xUNm5braPEprenmxFkypxo6IYw0iRYJ_iq9VPRvVowCgqhZFNQ_BC4qM7yfUL5CPR9mUkAU/s1600/cn3.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;50&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXoStOzOKL97AlRtFz9P-S8_v7GccuOdX09CsQ1eag-pzLHtrPSAZzNAQScDE6SdgxwDa8xUNm5braPEprenmxFkypxo6IYw0iRYJ_iq9VPRvVowCgqhZFNQ_BC4qM7yfUL5CPR9mUkAU/s400/cn3.JPG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;So we’re going to do some coding:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;protected void
onFrmDetails_SubmitAction(Component c, ActionEvent event) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If the resource file changes the
names of components this call will break notifying you that you should fix the
code&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String fname =
this.findFirstname(c.getComponentForm()).getText());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String sname =
this.findSurname(c.getComponentForm()).getText());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String occ =
this.findOccupation(c.getComponentForm()).getSelectedItem().toString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String comm=
this.findComments(c.getComponentForm()).getText());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NetworkManager networkManager =
NetworkManager.getInstance();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; networkManager.start();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
networkManager.addErrorListener(new ActionListener() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void
actionPerformed(ActionEvent evt) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NetworkEvent n =
(NetworkEvent) evt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
n.getError().printStackTrace();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;//you probably want to do the above once
throughout the lifetime of your app. I normally make networkManager static and
just call the below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectionRequest request = new
ConnectionRequest() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int
chr;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuffer
sb = new StringBuffer();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String
response = &quot;&quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected void
readResponse(InputStream input) throws IOException {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //do something with input
stream&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;while ((chr = input.read())
!= -1){&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.append((char)
chr);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //
System.out.println(&quot;reading...&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;response = sb.toString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if
(response.equals(&quot;OK&quot;)) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Dialog.show(&quot;Response&quot;, &quot;You made it! We&#39;ev registered
you&quot;, &quot;Ok&quot;, null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Dialog.show(&quot;Response&quot;, &quot;Aww, we could not register you
because of blah blah blah&quot;, &quot;Ok&quot;, null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;protected void handleException(Exception
err) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //do something with err&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
Dialog.show(&quot;Yikes!!&quot;, &quot;Are you connected to the
internet? Check your connection&quot;, &quot;Ok&quot;, null);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
request.setUrl(&quot;http://some.webservice.com/newuser.jsp?fname=&quot;
+ fname + &quot;&amp;amp;sname=&quot;+sname + &quot;&amp;amp;occ=&quot; + occ +
&quot;&amp;amp;comm=&quot; + comm);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.setPost(false);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
networkManager.addToQueue(request);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (Exception e) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;You can then build and run/debug the project.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;b&gt;Deployment:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;You need to setup an account on the CodenameOne build server. Once
you’ve simulated your project and you are ok, you can send a build request for
any of the device platforms having provided the signing keys in the Project
Properties page. For free users, you have 100 monthly build credits for free.
Visit &lt;a href=&quot;http://www.codenameone.com/pricing.html&quot;&gt;http://www.codenameone.com/pricing.html&lt;/a&gt;
for more information.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;&lt;b&gt;Conclusion:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: .0001pt; margin: 0cm;&quot;&gt;
&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;CodenameOne is here to stay. “&lt;/span&gt;&lt;span style=&quot;color: #737373; font-family: &amp;quot;helvetica&amp;quot; , sans-serif; font-size: 13.5pt;&quot;&gt;Codename One is the most
complete mobile development solution on the market today covering all stages of
development, design, debugging, simulation, deployment &amp;amp; analysis.&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;” You don’t want to miss out on this one
for all approach to app development. Get it now.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/2212666478248611139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/2212666478248611139?isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2212666478248611139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2212666478248611139'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/03/codenameone-one-for-all.html' title='CodenameOne: One for All'/><author><name>austine</name><uri>http://www.blogger.com/profile/03143491803277091066</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwfq5uutsLKQSWkHChmrvy6wb9AfEXjVjdSLANBuwZ7DFsUNwf2_GNnf9EBb6J-oIno8WPYybea4II5Uo9AL-wvvVTNDiLOhc1KVOJDWFq4w0W6qZ-57U0PvUqMcX5HeBUIcKLat1b83E/s72-c/cn4.JPG" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-3204549701193966495</id><published>2012-02-15T04:19:00.000-08:00</published><updated>2012-02-15T04:27:18.972-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="attachment"/><category scheme="http://www.blogger.com/atom/ns#" term="break"/><category scheme="http://www.blogger.com/atom/ns#" term="browser"/><category scheme="http://www.blogger.com/atom/ns#" term="cache-control"/><category scheme="http://www.blogger.com/atom/ns#" term="class"/><category scheme="http://www.blogger.com/atom/ns#" term="content"/><category scheme="http://www.blogger.com/atom/ns#" term="content-disposition"/><category scheme="http://www.blogger.com/atom/ns#" term="credits"/><category scheme="http://www.blogger.com/atom/ns#" term="document root"/><category scheme="http://www.blogger.com/atom/ns#" term="download"/><category scheme="http://www.blogger.com/atom/ns#" term="echo"/><category scheme="http://www.blogger.com/atom/ns#" term="elouai"/><category scheme="http://www.blogger.com/atom/ns#" term="extension"/><category scheme="http://www.blogger.com/atom/ns#" term="file"/><category scheme="http://www.blogger.com/atom/ns#" term="path"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><category scheme="http://www.blogger.com/atom/ns#" term="servers"/><category scheme="http://www.blogger.com/atom/ns#" term="zlip.output_compression"/><title type='text'>PHP File Downloads</title><content type='html'>I had to sweat a little before getting this right.&lt;br /&gt;
&lt;br /&gt;
I browsed the net to get help on PHP File Downloading class. Well, i got some help though but i had to break open it, and learn the hard way.&lt;br /&gt;
&lt;br /&gt;
As i rewrote the script from scratch, i suffered a lot. Testing and testing always led to the same incorrect result: the actual content of the targeted file was being &#39;echoed&#39; instead of downloaded. I saw the long lines of jumbled-texts in my browser any time i run that script. Aaarrrrgh!!&lt;br /&gt;
&lt;br /&gt;
Eventually, there was a light at the end of the tunnel as i added the following lines of code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;ini_get&lt;/span&gt;(&#39;zlib.output_compression&#39;))&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;b&gt;&amp;nbsp; &lt;span style=&quot;color: red;&quot;&gt;ini_set&lt;/span&gt;(&#39;zlib.output_compression&#39;, &#39;Off&#39;);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Explanation? You see, most php-included Servers set the output compression (in php.ini file) to On, by default. If this is so, your browser might display that jumbled-text instead of downloading the file. This usually occurs in Internet Explorer browsers; however, most well-known browsers might follow suite.&lt;br /&gt;
&lt;br /&gt;
I hope this helps you.&lt;br /&gt;
&lt;br /&gt;
And oh, here&#39;s the full source code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$itemname = $_GET[&#39;download_file&#39;];&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$path = $_SERVER[&#39;DOCUMENT_ROOT&#39;].&quot;/somefolder/&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$fullPath = $path.
$itemname&amp;nbsp;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// required for IE, otherwise Content-disposition is ignored&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;if(ini_get(&#39;zlib.output_compression&#39;))&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; ini_set(&#39;zlib.output_compression&#39;, &#39;Off&#39;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// addition by Jorg Weske&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;$file_extension = strtolower(substr(strrchr($fullPath,&quot;.&quot;),1));&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;if( $fullPath == &quot;&quot; )&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;{ &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; exit;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;} elseif ( ! file_exists( $fullPath ) )&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; exit;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;switch( $file_extension )&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;pdf&quot;: $ctype=&quot;application/pdf&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;exe&quot;: $ctype=&quot;application/octet-stream&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;zip&quot;: $ctype=&quot;application/zip&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;doc&quot;: $ctype=&quot;application/msword&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;xls&quot;: $ctype=&quot;application/vnd.ms-excel&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;ppt&quot;: $ctype=&quot;application/vnd.ms-powerpoint&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;gif&quot;: $ctype=&quot;image/gif&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;png&quot;: $ctype=&quot;image/png&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;jpeg&quot;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; case &quot;jpg&quot;: $ctype=&quot;image/jpg&quot;; break;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp; default: $ctype=&quot;application/force-download&quot;;//you may want to get more...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Pragma: public&quot;); // required&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Expires: 0&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Cache-Control: must-revalidate, post-check=0, pre-check=0&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Cache-Control: private&quot;,false); // required for certain browsers&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Content-Type: $ctype&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// change, added quotes to allow spaces in filenames, by Rajkumar Singh&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Content-Disposition: attachment; filename=\&quot;&quot;.basename($fullPath).&quot;\&quot;;&quot; );&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Content-Transfer-Encoding: binary&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;header(&quot;Content-Length: &quot;.filesize($fullPath));&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;readfile(&quot;$fullPath&quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;exit();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;Credits:&amp;nbsp;&lt;a href=&quot;http://elouai.com/force-download.php&quot;&gt;http://elouai.com/force-download.php&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/3204549701193966495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/3204549701193966495?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3204549701193966495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/3204549701193966495'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/02/php-file-downloads.html' title='PHP File Downloads'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6032652662616520517</id><published>2012-01-25T05:36:00.000-08:00</published><updated>2012-01-27T03:29:05.607-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ADempiere"/><category scheme="http://www.blogger.com/atom/ns#" term="Common Sense"/><category scheme="http://www.blogger.com/atom/ns#" term="CRM"/><category scheme="http://www.blogger.com/atom/ns#" term="CRUD"/><category scheme="http://www.blogger.com/atom/ns#" term="db2lang"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="ERD"/><category scheme="http://www.blogger.com/atom/ns#" term="ERP"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="Open Source"/><category scheme="http://www.blogger.com/atom/ns#" term="package"/><category scheme="http://www.blogger.com/atom/ns#" term="Postgres SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="sense"/><category scheme="http://www.blogger.com/atom/ns#" term="source"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Have you thought of ADempiere</title><content type='html'>This is what i&#39;ve gotten myself into now: ADempiere!! (I don&#39;t really care how you pronounce it)&lt;br /&gt;
&lt;br /&gt;
Thinking of developing an ERP, CRM or anything of those business suites, then ADempiere might be your missing rib. Of course, it is very open source; and i mean very open. Expect to go through the fire of no-support affliction. You might need lots of bandwidth to watch online videos or webinars to get familiarised with this system.&lt;br /&gt;
&lt;br /&gt;
But in the long run, it&#39;s worth it. My first encounter with ADempiere was sweet. All i had to do (or at least what i thought i had to do) was to properly organise my underlying database (with Postgres; also works well with Oracle) with a neat ERD, then let ADempiere create all the windows and connections to do the CRUD work. That is quick ADempiere 101. But unscrewing the bolts and nuts led me to a whole new world of ERP.&lt;br /&gt;
&lt;br /&gt;
Once upon a time, i thought of developing a system that will be used to develop db related systems. Let me explain. Developers always come in contact with some kind of database connections. As such, you need to do at least 3 things:&lt;br /&gt;
&lt;i&gt;1. Design database and tables&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;2. Develop entity classes that talk to the tables in the database&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;3. Design a good-looking UI that displays data from the database&lt;/i&gt;&lt;br /&gt;
I started off by developing db2lang to solve problem 2. Then i realised that the burden even lies more on 1 and 3.&lt;br /&gt;
&lt;br /&gt;
ADempiere becomes a saviour in each of these cases. (There are other good ERP, CRM IDEs).&lt;br /&gt;
&lt;br /&gt;
In this blog and subsequent ones, i shall address some common issues that you may encounter during setup of your development environment. I shall use the Windows OS to do the explanation.&lt;br /&gt;
&lt;br /&gt;
Here are the tools you need to develop that great enterprise software you&#39;ve always thought of:&lt;br /&gt;
1. &lt;a href=&quot;http://www.eclipse.org/downloads/index-developer.php&quot; target=&quot;_blank&quot;&gt;Eclipse JEE Indigo&lt;/a&gt;&lt;br /&gt;
2. &lt;a href=&quot;http://www.postgresql.org/download/&quot; target=&quot;_blank&quot;&gt;Postgres SQL (the current version)&lt;/a&gt;&amp;nbsp;with the GUI tools.&lt;br /&gt;
3. &lt;a href=&quot;https://adempiere.svn.sourceforge.net/svnroot/adempiere/tags/%20adempiere360lts.&quot; target=&quot;_blank&quot;&gt;ADempiere source package&lt;/a&gt;&lt;br /&gt;
4. Latest JRE&lt;br /&gt;
5. Common sense&lt;br /&gt;
Mind you, these are all free.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Installation Instructions:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
1. Unzip the Eclipse IDE to your drive C&lt;br /&gt;
2. Do the same for the ADempiere source package. Copy the contents to drive C:\Adempiere&lt;br /&gt;
Luckily, your ADempiere should come packaged with a JBoss web server. If not, get one and download it. We shall also be working with Tomcat too. You may download it &lt;a href=&quot;http://tomcat.apache.org/download-60.cgi&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
3. Install Postgres SQL using default settings&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Let&#39;s box on:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Ok, ok. So we&#39;re ready to go.&lt;br /&gt;
Create environment variables for Java JRE (if not already created), Postgres and your Adempiere directory.&lt;br /&gt;
Now, create a login role in Postgres with adempiere as both username and password. Then create a schema/database called adempiere.&lt;br /&gt;
&lt;br /&gt;
Done? Now open Adempiere folder and run RUN_setup.bat directly or you may execute it using Command Prompt. It takes some time so get a drink whiles waiting.&lt;br /&gt;
&lt;br /&gt;
Enter the required details as the screen demands. Follow the windows that appears and make sure all values entered are correct. Accept license terms when it appears. Adempiere creates a .properties file in your ADempiere home folder.&lt;br /&gt;
&lt;br /&gt;
Good! Now run the file named &#39;RUN_Adempiere.bat&#39;. This starts the Adempiere engine and open the login window.&lt;br /&gt;
Click on the textbox that has &#39;Server&#39; as label. This opens the Connection window. Inspect the settings to verify its correctness and hit any of the &#39;Test&#39; buttons for testing your settings. Ok the window to go back to the login window. Now you can login, select your role and wala, we&#39;re there.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6032652662616520517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6032652662616520517?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6032652662616520517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6032652662616520517'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2012/01/have-you-thought-of-adempiere.html' title='Have you thought of ADempiere'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-1961503232348627534</id><published>2011-12-12T02:23:00.001-08:00</published><updated>2011-12-12T03:00:54.710-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="32-bit"/><category scheme="http://www.blogger.com/atom/ns#" term="64-bit"/><category scheme="http://www.blogger.com/atom/ns#" term="ADempiere"/><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse shared library JNI"/><category scheme="http://www.blogger.com/atom/ns#" term="environment variables"/><category scheme="http://www.blogger.com/atom/ns#" term="failed to load the JNI shared library"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JDK"/><category scheme="http://www.blogger.com/atom/ns#" term="shared library"/><title type='text'>Eclipse Shared Library Issue</title><content type='html'>Just recently, after installing ADempiere platform and playing around with it, i decided to launch eclipse and do some commenting on some of my codes. After clicking the icon, i got the following:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRXa3ZlR_MD5uKCtQwhxEBH4fG1aYJD00vJMFLOxDBPs5P3c2J2CWwP_YDCIxgB-L2naJ7_xrJFsnxBiusn5EfqfK4bgxCGBHr1tZ08KVtASCSS8rjU6sOyhGSHDdkikQYqiN3SblU-do/s1600/eclipse+error.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;207&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRXa3ZlR_MD5uKCtQwhxEBH4fG1aYJD00vJMFLOxDBPs5P3c2J2CWwP_YDCIxgB-L2naJ7_xrJFsnxBiusn5EfqfK4bgxCGBHr1tZ08KVtASCSS8rjU6sOyhGSHDdkikQYqiN3SblU-do/s320/eclipse+error.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Unfortunately, i had changed the Java-Home path in my environment settings. My Eclipse was a 64-bit version, and i had pointed it to a 32-bit version of Java.&lt;br /&gt;
To resolve this issue, I opened the eclipse.ini file in the eclipse folder and added the following line right after the &#39;openFile&#39;:&lt;br /&gt;
&amp;nbsp;-vm &lt;br /&gt;C:\Program Files\Java\jdk1.6.0_25\bin\javaw.exe&lt;br /&gt;
&lt;br /&gt;
This points eclipse to where my 64-bit JDK resides. And it solved the problem. &lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/1961503232348627534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/1961503232348627534?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/1961503232348627534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/1961503232348627534'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2011/12/eclipse-shared-library-issue.html' title='Eclipse Shared Library Issue'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRXa3ZlR_MD5uKCtQwhxEBH4fG1aYJD00vJMFLOxDBPs5P3c2J2CWwP_YDCIxgB-L2naJ7_xrJFsnxBiusn5EfqfK4bgxCGBHr1tZ08KVtASCSS8rjU6sOyhGSHDdkikQYqiN3SblU-do/s72-c/eclipse+error.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-4963103173208420892</id><published>2011-12-07T01:05:00.001-08:00</published><updated>2011-12-07T01:24:43.657-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".config"/><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="application"/><category scheme="http://www.blogger.com/atom/ns#" term="compatible"/><category scheme="http://www.blogger.com/atom/ns#" term="error"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="initialization error"/><category scheme="http://www.blogger.com/atom/ns#" term="Notepad"/><category scheme="http://www.blogger.com/atom/ns#" term="unable to find a version of the runtime to run this application"/><title type='text'>.NET Framework Initialization Error!!</title><content type='html'>Do you get this error sometimes:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYauUjBMvFho4iOwyk4HxxWJPyKmtp8LFiXJ7GTyUXCYZXWwlNQB9ch2czffZmAfCgPHZxBeJ69DDmp7lcRt2J0Ov7VaCwZjsq_iTayEJcBayNs2FyccZAL9OHEKlDN1v3vTIdP-WOGEU/s1600/.net+error.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;100&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYauUjBMvFho4iOwyk4HxxWJPyKmtp8LFiXJ7GTyUXCYZXWwlNQB9ch2czffZmAfCgPHZxBeJ69DDmp7lcRt2J0Ov7VaCwZjsq_iTayEJcBayNs2FyccZAL9OHEKlDN1v3vTIdP-WOGEU/s320/.net+error.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Some versions of .NET may not be backward compatible unless you provide a .exe.config file next to your application.&lt;br /&gt;
I&#39;ve gotten the anti-error solution. Just create a .exe.config file (you can use Notepad) with the same name as your application. Copy the contents of this &lt;a href=&quot;https://skydrive.live.com/redir.aspx?cid=f5c5e1056fac2e69&amp;amp;resid=F5C5E1056FAC2E69!195&amp;amp;parid=F5C5E1056FAC2E69!185&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt; to your .exe.config file.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Put your .exe.config file in the same folder as your application. Now run your application. Is it done? Let me know!!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/4963103173208420892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/4963103173208420892?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4963103173208420892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4963103173208420892'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2011/12/net-framework-initialization-error.html' title='.NET Framework Initialization Error!!'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYauUjBMvFho4iOwyk4HxxWJPyKmtp8LFiXJ7GTyUXCYZXWwlNQB9ch2czffZmAfCgPHZxBeJ69DDmp7lcRt2J0Ov7VaCwZjsq_iTayEJcBayNs2FyccZAL9OHEKlDN1v3vTIdP-WOGEU/s72-c/.net+error.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-342832491604768578</id><published>2011-11-25T07:40:00.000-08:00</published><updated>2011-11-25T07:40:14.956-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CheckBox"/><category scheme="http://www.blogger.com/atom/ns#" term="CheckList"/><category scheme="http://www.blogger.com/atom/ns#" term="CheckListBox"/><category scheme="http://www.blogger.com/atom/ns#" term="class"/><category scheme="http://www.blogger.com/atom/ns#" term="data"/><category scheme="http://www.blogger.com/atom/ns#" term="implement"/><category scheme="http://www.blogger.com/atom/ns#" term="interface"/><category scheme="http://www.blogger.com/atom/ns#" term="J2ME"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaME"/><category scheme="http://www.blogger.com/atom/ns#" term="List"/><category scheme="http://www.blogger.com/atom/ns#" term="ListCellRenderer"/><category scheme="http://www.blogger.com/atom/ns#" term="LWUIT"/><category scheme="http://www.blogger.com/atom/ns#" term="subclass"/><title type='text'>No CheckListBox in LWUIT?</title><content type='html'>&lt;div class=&quot;MsoNormal&quot;&gt;As I was developing the next version of the famous SoftCards (a Scripture Mastery JavaME app), I wanted to employ the exceptionally stunning components in LWUIT to enhance my UI. However, I noticed that LWUIT was not packaged with a CheckListBox, like the one in .NET controls.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;I felt devastated but I did not lose hope. I searched the internet for help. I even realized there were others like me who wanted the same UI item. I got some help though, but, I decided to do my own thing and share it with the world. The result? CheckList!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;How did I do it?&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;CheckList subclasses the List class and provides a few critical methods like getItems(), getCheckedItems(), getItem(int index). It’s so because they were missing in the super class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Next, I created a CheckListItemData class that represents the data to be stored in the CheckList. To be simple, I created properties to get and set the check state, ID and Display Name of the item.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Also, I added a renderer class. As the name suggests, it’s responsible for presenting the check item itself; the UI. It subclasses the CheckBox and implements ListCellRenderer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Put it all together: CheckList!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Finally, I tested it and kawaam!! It works.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWExj29kVfNyj1IGikL3qyL9tX8vEGvx0MqFMWZtGMi_q1pDZuUiJ6N7jQb9MZ4oFYGa3bibxPwM6TwIfmaQ_1034rIy2LbVnO-RDLWK_GyUAJ-_VpL6w71OIbuZovLPAu_b8Wf4KCCjQ/s1600/CheckList+screenshot.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWExj29kVfNyj1IGikL3qyL9tX8vEGvx0MqFMWZtGMi_q1pDZuUiJ6N7jQb9MZ4oFYGa3bibxPwM6TwIfmaQ_1034rIy2LbVnO-RDLWK_GyUAJ-_VpL6w71OIbuZovLPAu_b8Wf4KCCjQ/s320/CheckList+screenshot.JPG&quot; width=&quot;145&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;For code lovers:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;For the CheckList class itself, I’m adding this method from the code because it was difficult to do so:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; CheckListItemData getItem(&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; index){&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;try&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CheckListItemData &lt;span style=&quot;background: yellow; mso-highlight: yellow;&quot;&gt;c&lt;/span&gt; = &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; CheckListItemData(0, &lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 10.0pt;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;, &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;false&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;if&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; (index &amp;gt;=size() || index&amp;lt;0) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;span style=&quot;background: silver; mso-highlight: silver;&quot;&gt;c&lt;/span&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setSelectedIndex(index, &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;false&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background: yellow; mso-highlight: yellow;&quot;&gt;c&lt;/span&gt; = (CheckListItemData) getSelectedItem();&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;span style=&quot;background: silver; mso-highlight: silver;&quot;&gt;c&lt;/span&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;catch&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; (Exception e) {&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 10.0pt;&quot;&gt;// &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f9fbf; font-family: Consolas; font-size: 10.0pt;&quot;&gt;TODO&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #3f7f5f; font-family: Consolas; font-size: 10.0pt;&quot;&gt;: handle exception&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt; CheckListItemData(0, &lt;/span&gt;&lt;span style=&quot;color: #2a00ff; font-family: Consolas; font-size: 10.0pt;&quot;&gt;&quot;error occured&quot;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;, &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #7f0055; font-family: Consolas; font-size: 10.0pt;&quot;&gt;false&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10.0pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 10pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;With this basis, it’s easy to do many other things.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Download the source files &lt;a href=&quot;https://skydrive.live.com/?cid=f5c5e1056fac2e69&amp;amp;permissionsChanged=1&amp;amp;id=F5C5E1056FAC2E69%21185#&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/342832491604768578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/342832491604768578?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/342832491604768578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/342832491604768578'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2011/11/no-checklistbox-in-lwuit.html' title='No CheckListBox in LWUIT?'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWExj29kVfNyj1IGikL3qyL9tX8vEGvx0MqFMWZtGMi_q1pDZuUiJ6N7jQb9MZ4oFYGa3bibxPwM6TwIfmaQ_1034rIy2LbVnO-RDLWK_GyUAJ-_VpL6w71OIbuZovLPAu_b8Wf4KCCjQ/s72-c/CheckList+screenshot.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-4491398766785728942</id><published>2011-11-24T14:26:00.000-08:00</published><updated>2011-11-25T07:34:17.660-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="fields"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="Metadata"/><category scheme="http://www.blogger.com/atom/ns#" term="MetaData Reflection"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="reflection"/><category scheme="http://www.blogger.com/atom/ns#" term="source"/><category scheme="http://www.blogger.com/atom/ns#" term="tables"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="wrapper"/><title type='text'>db2lang</title><content type='html'>Allow me to introduce db2lang.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Db2lang is software that creates wrapper classes for your databases entities. It simply generates source code files, nicely formatted, depending the language of your choice. For now, classes can be generated in C#, PHP and Java languages. Additionally, only MySQL and MSSQL are supported. My operations for extension to Oracle, Postgre and others were halted because of my ecclesiastical exile.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Db2lang was conceptualized when I posted a blog on making your classes talk with your database. Around the same time, a thought came to mind to develop a simple program to do this; instead of having to invariably create concrete classes for database connectivity. Thus, db2lang was born. Let me state here that I did not have any knowledge of any database-mapping tool, whatsoever. It was just my own small way of reducing time on writing code, especially for huge projects that I work on. Don’t get me wrong, I wasn’t re-inventing any wheel. &lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;It really came in handy when I was single-handedly working on over 40 tables in a single database. The user architecture was becoming complex, let alone the ERD. To sit down and write codes to perform CRUD operations would be time-consuming had it not been for db2lang.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;After successful testing, verification and validation from trusted software engineer colleagues, I feel to make it open to the public. Try it out, and let me know what you think.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;How it works&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Here’s a screen shot:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN1yj8tytm4yzh-rCUtiY06H9F2wnjM7P3jv0twLmwp0ztG2JcBWPzAAPauyw21z0HJ2xvEr1_3Uw_KzKyuAvavVXHICGfyXiBkszR8MgfDab26M4AIz9XCukk9vWA74-D-cL3hnlaGdM/s1600/db2lang.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;214&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN1yj8tytm4yzh-rCUtiY06H9F2wnjM7P3jv0twLmwp0ztG2JcBWPzAAPauyw21z0HJ2xvEr1_3Uw_KzKyuAvavVXHICGfyXiBkszR8MgfDab26M4AIz9XCukk9vWA74-D-cL3hnlaGdM/s320/db2lang.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;So, you select your database provider, enter your credentials (they are not cached anywhere, locally or sent via some unidentified socket to me, lol), select the language in which you want the source files to be generated and the folder, then start the operation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;Db2lang works in a simple process I call MetaData Reflection. Reflection here has no reference whatsoever to Java or .NET runtime reflection of objects. MetaData Reflection&lt;i&gt; means &lt;/i&gt;that it accesses your tables in the specified database, retrieves the metadata, map it to the basic types of the selected language and creates simple class properties out of it. Additionally, it creates a service class containing powerful yet simple methods that perform CRUD operations on your database. The property class and service class have filenames which are the same as your table name. Great huh?&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: 7pt; line-height: 115%;&quot;&gt;One Tiny Hurdle&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;The current version assumes that your MySQL database port is set to 3306. I shall rectify this in the next release. And oh, a PRO version will come out soon.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;How It Really Works&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;For code lovers, here are sample codes in C# (parts of the program were written in Java) on MetaData Reflection:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;summary&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; Generates the class files for the specified language&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/summary&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; GenerateClasses()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;[] thetables = &lt;b&gt;GetTables();&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;foreach&lt;/span&gt; (&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; onetable &lt;span style=&quot;color: blue;&quot;&gt;in&lt;/span&gt; thetables)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; notsupported = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;switch&lt;/span&gt; (_langtype)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;general2lang&lt;/span&gt;.&lt;span style=&quot;color: #2b91af;&quot;&gt;LanguageType&lt;/span&gt;.CSharp:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;db2cs&lt;/span&gt;(ClassesFolder, onetable, &lt;b&gt;GetFieldsInformation(onetable),&lt;/b&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._connstring,&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;MySql&quot;&lt;/span&gt;).&lt;b&gt;StartFileCreation()&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;general2lang&lt;/span&gt;.&lt;span style=&quot;color: #2b91af;&quot;&gt;LanguageType&lt;/span&gt;.Java:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;db2java&lt;/span&gt;(ClassesFolder, onetable, &lt;b&gt;GetFieldsInformation(onetable)&lt;/b&gt;, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._datasource, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._dbname, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._username, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._password).&lt;b&gt;StartFileCreation()&lt;/b&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;general2lang&lt;/span&gt;.&lt;span style=&quot;color: #2b91af;&quot;&gt;LanguageType&lt;/span&gt;.PHP:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;db2php&lt;/span&gt;(ClassesFolder, onetable, &lt;b&gt;GetFieldsInformation(onetable)&lt;/b&gt;, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._datasource, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._dbname, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._username, &lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;._password).&lt;b&gt;StartFileCreation();&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;general2lang&lt;/span&gt;.&lt;span style=&quot;color: #2b91af;&quot;&gt;LanguageType&lt;/span&gt;.VB:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.&lt;span style=&quot;color: #2b91af;&quot;&gt;MessageBox&lt;/span&gt;.Show(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;VB is not supported for now...&quot;&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notsupported = &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;; &lt;span style=&quot;color: #00b050;&quot;&gt;//vb is not ready now&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;default&lt;/span&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (notsupported)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;break&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #2b91af;&quot;&gt;Exception&lt;/span&gt; ex)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.&lt;span style=&quot;color: #2b91af;&quot;&gt;MessageBox&lt;/span&gt;.Show(ex.Message);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;So, &lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt; line-height: 115%;&quot;&gt;GetTables()&lt;/span&gt;&lt;/b&gt;retrieves all the tables under the chosen database.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt; line-height: 115%;&quot;&gt;GetFieldsInformation(onetable) &lt;/span&gt;&lt;/b&gt;returns the metadata about a particular field in the database&lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Consolas; font-size: 12pt; line-height: 115%;&quot;&gt;StartFileCreation() &lt;/span&gt;&lt;/b&gt;creates the data and service class for that particular field in the database.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
&lt;br /&gt;
Download the raw .exe and other files &lt;a href=&quot;https://skydrive.live.com/?cid=f5c5e1056fac2e69&amp;amp;permissionsChanged=1&amp;amp;id=F5C5E1056FAC2E69%21185#&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/4491398766785728942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/4491398766785728942?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4491398766785728942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/4491398766785728942'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2011/11/db2lang.html' title='db2lang'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN1yj8tytm4yzh-rCUtiY06H9F2wnjM7P3jv0twLmwp0ztG2JcBWPzAAPauyw21z0HJ2xvEr1_3Uw_KzKyuAvavVXHICGfyXiBkszR8MgfDab26M4AIz9XCukk9vWA74-D-cL3hnlaGdM/s72-c/db2lang.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-2800965331044518270</id><published>2011-11-10T05:21:00.003-08:00</published><updated>2011-11-10T05:21:11.454-08:00</updated><title type='text'>Back</title><content type='html'>Hi,&lt;br /&gt;
&lt;br /&gt;
I&#39;m back from my ecclesiastical exile.&lt;br /&gt;
&lt;br /&gt;
Get ready for more on software engineering.</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/2800965331044518270/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/2800965331044518270?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2800965331044518270'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/2800965331044518270'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2011/11/back.html' title='Back'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6978036091897508723</id><published>2009-10-12T05:27:00.000-07:00</published><updated>2009-10-13T07:03:56.402-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="codes"/><category scheme="http://www.blogger.com/atom/ns#" term="documentation"/><category scheme="http://www.blogger.com/atom/ns#" term="download"/><category scheme="http://www.blogger.com/atom/ns#" term="J2ME"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaME"/><category scheme="http://www.blogger.com/atom/ns#" term="jSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="library"/><category scheme="http://www.blogger.com/atom/ns#" term="refactor"/><category scheme="http://www.blogger.com/atom/ns#" term="RMS"/><category scheme="http://www.blogger.com/atom/ns#" term="wrapper"/><title type='text'>jSQL release 2</title><content type='html'>&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;I&#39;m happy to announce release 2 of &lt;a href=&quot;http://austinejei.blogspot.com/2009/09/introducing-jsqlrms-simplified.html&quot;&gt;jSQL&lt;/a&gt;, the much easy-to-use JavaME (or J2ME) wrapper library for Record Management Store(RMS).&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Release Notes:&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;1. Refactored code for optimization&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;2. Fully documented&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Download packages:&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;1.&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/file/0zohgy11e3o/undefined&quot;&gt;jSQL v1.0.2&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;2.&amp;nbsp;&lt;a href=&quot;http://www.mediafire.com/file/dmuy24hlm15/doc.zip&quot;&gt;jSQL Javadoc&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6978036091897508723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6978036091897508723?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6978036091897508723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6978036091897508723'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2009/10/jsql-release-2.html' title='jSQL release 2'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4640198225857397031.post-6047156317282582024</id><published>2009-10-12T05:26:00.000-07:00</published><updated>2011-11-29T08:43:22.415-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="account"/><category scheme="http://www.blogger.com/atom/ns#" term="API"/><category scheme="http://www.blogger.com/atom/ns#" term="API Key"/><category scheme="http://www.blogger.com/atom/ns#" term="Canvas"/><category scheme="http://www.blogger.com/atom/ns#" term="database"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="FBJS"/><category scheme="http://www.blogger.com/atom/ns#" term="FMBL"/><category scheme="http://www.blogger.com/atom/ns#" term="iFrame"/><category scheme="http://www.blogger.com/atom/ns#" term="JAVA"/><category scheme="http://www.blogger.com/atom/ns#" term="permissions"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="platform"/><category scheme="http://www.blogger.com/atom/ns#" term="register"/><category scheme="http://www.blogger.com/atom/ns#" term="Secre"/><category scheme="http://www.blogger.com/atom/ns#" term="session"/><category scheme="http://www.blogger.com/atom/ns#" term="sessionID"/><category scheme="http://www.blogger.com/atom/ns#" term="URL"/><title type='text'>Working with Facebook Platform</title><content type='html'>&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;Before you read:&lt;/b&gt; &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;This article is like 2 years old now. Facebook has sort-of changed their connectivity architecture. Please read more on this at http://developers.facebook.com&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I had a really difficult time trying to develop a simple page on the Facebook platform. It demanded lots of time and effort. It was like i was in a whole new world of re-organised programming platform. Talk about Facebook Markup Language, Facebook Query Language, Facebook JavaScript, the API itself, &amp;nbsp;etc.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
You can get really knocked out as to why they have to define their own way for programmers to follow. But hey, i respect their architecture. You can&#39;t just play around with people&#39;s publicly personal accounts. (lol!!).&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
After about 3 weeks of battling with the platform, i finally got the modus operandi. As i always do, when i get knowledge, i share.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
I&#39;ve written this post to guide newbies (or dummies, if you&#39;re one) on how to create a Facebook Application.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
As usual, i assume you already have some basic skills in programming especially Javascript, PHP, or even the ASP.NET languages (C#, VB.NET).&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Ok, let&#39;s start. I&#39;m going to do 6 things.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
1. Briefly introduce you to the Facebook platform&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
2. Crawl with you through the pre-requisites&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
3. Walk you you through your application setup and settings&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
4. Run with you through an example code&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
5. Fly with you through 1 or 2 high level intricacies.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
6. Kick you outta here to start your own application.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;1. Intro&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Facebook&#39;s developer platform enables developers to use any programming language to query their API via REST calls. As such, you can develop both desktop and web applications to do practically the same thing; update status, comment on status, view friend&#39;s profiles, it even goes to reading mails, uploading multimedia and send SMS. Awesome init?&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;2. Let&#39;s crawl&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Of course, you need to have a&amp;nbsp;Facebook&amp;nbsp;account before you can develop/host your application on their framework. So, after you login,&amp;nbsp;&lt;b&gt;go to the bottom of the page and click on &#39;Developers&#39;.&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiPwwS0vvQuBslG8pLadVv_9jtofq7LWPJmbxjUSC7MPFxDO7vrtguehIl14PoBCFzdECst4gIrLpUFa2eS8uOs02exwuZn4LY8r7lv-eF5y8V3-daJU-NJjuFaLy5TsIDdM_CbYvfgFaH/s1600-h/fb1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiPwwS0vvQuBslG8pLadVv_9jtofq7LWPJmbxjUSC7MPFxDO7vrtguehIl14PoBCFzdECst4gIrLpUFa2eS8uOs02exwuZn4LY8r7lv-eF5y8V3-daJU-NJjuFaLy5TsIDdM_CbYvfgFaH/s320/fb1.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;3. Walk with me:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Are you on the developer&#39;s page? Ok, now click on &#39;&lt;span style=&quot;font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: small;&quot;&gt;&lt;span style=&quot;font-size: 13px; line-height: 16px;&quot;&gt;Start Building for your site&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: &#39;Lucida Grande&#39;, Tahoma, Verdana, Arial, sans-serif; font-size: 12px;&quot;&gt;&lt;span style=&quot;background-color: transparent; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: white; cursor: pointer; display: inline !important; font-size: 13px; font-weight: bold; line-height: 16px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-shadow: rgb(77, 136, 53) 0px 1px 0px; width: auto;&quot;&gt;&lt;span style=&quot;color: black; font-family: &#39;Times New Roman&#39;; font-size: medium; font-weight: normal; line-height: normal;&quot;&gt;&#39;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYs8mW0ET5Pr1OMsnNzalwGjL3fjWFDUL3elelH5yDHrJJMFEC0jfuAbh1NM7gt40Y6NVFNKdccoa8Vmfka69k1srdWrnVn28rMSZL0Vm5bAAg3pcfkhZt2KfYDScBtEVqRX4kxyFLw-e4/s1600-h/fb2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYs8mW0ET5Pr1OMsnNzalwGjL3fjWFDUL3elelH5yDHrJJMFEC0jfuAbh1NM7gt40Y6NVFNKdccoa8Vmfka69k1srdWrnVn28rMSZL0Vm5bAAg3pcfkhZt2KfYDScBtEVqRX4kxyFLw-e4/s200/fb2.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
A wizard-like setup page appears. Enter your details as shown. Click &#39;Next Step&#39;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinjYqQPN419UAMQ9S1N4m7b-saF41e4c6w6BGxHYsD2qNX0rMeywEy_cAgQc5lDAX5TVliWtoPLyoSF2YMKrrUROm4dffwJrA8ErVLHCUUHFu1XOQ6_2VyumYnEfRf-e-Evmjcikki986U/s1600-h/fb3.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinjYqQPN419UAMQ9S1N4m7b-saF41e4c6w6BGxHYsD2qNX0rMeywEy_cAgQc5lDAX5TVliWtoPLyoSF2YMKrrUROm4dffwJrA8ErVLHCUUHFu1XOQ6_2VyumYnEfRf-e-Evmjcikki986U/s320/fb3.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
You can safely ignore step 2 (Try it if you&#39;re that curious)&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
That&#39;s it.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Do you see a page similar to the one shown below?&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NG14X0TmgkUfF6Y45wR8mm8EnR0nnrT9UiOcn2Y3slFgakys20VW7e7gfagewhrb5p4iDUNV-K2tFjCBdZGPie8aQgjch3Z9YY8b2BSQWOHLavOmrZCAmYBbFR9bkxxwvnL3jb_kUbu8/s1600-h/fb4.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1NG14X0TmgkUfF6Y45wR8mm8EnR0nnrT9UiOcn2Y3slFgakys20VW7e7gfagewhrb5p4iDUNV-K2tFjCBdZGPie8aQgjch3Z9YY8b2BSQWOHLavOmrZCAmYBbFR9bkxxwvnL3jb_kUbu8/s400/fb4.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Great!!&amp;nbsp;&lt;b&gt;Copy your API Key and Secret&lt;/b&gt;. They are the the lifeblood of your application. Click on &#39;Developer Dashboard&#39;. Allow access to the next page. As you might a little confused, the page you are entering is in itself a Facebook Application. It is a sort of control panel for all your applications (yeah, i said applications; you can setup more than 1).&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Ok, now click your application name. (shaded yellow in the image below)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-MsTgH4HKDIsEfv6rENH0F_FIUciMDUAL7D72lgAaXwLRNTqfH9ZzNp8zCrYtUbzrptXD9mfdSeRUBB7Qqc_rdS4zUfgxej7JRCDRd3Afs3w5EKrW0ZbkzqlFTeYBnLG-CaS2S5PVd5Jh/s1600-h/fb5.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-MsTgH4HKDIsEfv6rENH0F_FIUciMDUAL7D72lgAaXwLRNTqfH9ZzNp8zCrYtUbzrptXD9mfdSeRUBB7Qqc_rdS4zUfgxej7JRCDRd3Afs3w5EKrW0ZbkzqlFTeYBnLG-CaS2S5PVd5Jh/s320/fb5.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
The next page is the actual control panel for your new application.Click on &#39;Edit Settings&#39;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCj17ni7eCa6kV8hhAhCIeCPGgbSP4si1e7e09lAQ4TNycqgAHYNbJOAQ-LdmhERxD4p4ujxmmbuSDECyNGM6CQMJuTVPj9UPZOBp-U4yMb5kRgCtdOot9sfy1P-bgxQYNMJUjlAwfegg-/s1600-h/fb6.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCj17ni7eCa6kV8hhAhCIeCPGgbSP4si1e7e09lAQ4TNycqgAHYNbJOAQ-LdmhERxD4p4ujxmmbuSDECyNGM6CQMJuTVPj9UPZOBp-U4yMb5kRgCtdOot9sfy1P-bgxQYNMJUjlAwfegg-/s320/fb6.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
The next page presents you with a host of options. You can perform 1001 customizations on your application. Go through it, be curious!! One important page is on &amp;nbsp;&#39;Canvas&#39;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsnGwiNzZVVt5gP8vxjGS3bL1Mn0_KzuyvJPFCkb5ZQAZKb7Fe5NncZIEvXaMNtR9SFHP4fBR4Jh7HXZp6kr95AyMTpIemVGWnOTsyogRx_n0Tvqe8Qag-WEDNdKDtlFEPpMGmPBCVdLwY/s1600-h/FB7.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsnGwiNzZVVt5gP8vxjGS3bL1Mn0_KzuyvJPFCkb5ZQAZKb7Fe5NncZIEvXaMNtR9SFHP4fBR4Jh7HXZp6kr95AyMTpIemVGWnOTsyogRx_n0Tvqe8Qag-WEDNdKDtlFEPpMGmPBCVdLwY/s320/FB7.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
The portions shaded yellow are those i deem important. The first textfield requires you to specify just a URL name for your application. The next textfield is where you have to enter the exact URL to your index page (e.g. http://www.mytextApp.com). This page would be automatically loaded to the Facebook platform when a user visits your application.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
The next step is to specify the render method. As far as i know, Facebook renders your application as either iFrame or FBML. I like FBML;it enables you to use FBJS and FBML tags that would be intepreted and nicely rendered on your page. Read more&amp;nbsp;&lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Choosing_between_an_FBML_or_IFrame_Application&quot;&gt;here&lt;/a&gt;. Save your changes.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;4. Ready to run?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
Honestly writing, the only example i got was on the main dashboard. Click on &#39;Back to my Applications&#39; at the top. Scroll down and click on the hyperlinked text &#39;example code&#39;.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicphdgpheZmLwHfJQHeDCcJ99zS938bzMIacOm9knmUSGfalOAs1iNzYxq4ADgnWU7g6MjgAep46vMezc7m_SuGGs0-RRidBaKVD2RonM484SaHeKK-ltAHYu75016mi1haIgHwYlNhuSJ/s1600-h/f8.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicphdgpheZmLwHfJQHeDCcJ99zS938bzMIacOm9knmUSGfalOAs1iNzYxq4ADgnWU7g6MjgAep46vMezc7m_SuGGs0-RRidBaKVD2RonM484SaHeKK-ltAHYu75016mi1haIgHwYlNhuSJ/s320/f8.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
This pops up a dialog containing PHP codes. Yipeeeee!! Are we done? NO!! When you inspect the code, do you see &#39;require_once facebook.php&#39; and a line of code that reads&amp;nbsp;&lt;span style=&quot;font-family: monospace; white-space: pre;&quot;&gt;$facebook = new Facebook($appapikey, $appsecret);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Where did they get that? It&#39;s a PHP client library and it&#39;s freeeee!!. You can get on the same page. Scroll down and click on &#39;Download the Client Library&#39;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;What about .NET folks? Get yours &lt;a href=&quot;http://www.codeplex.com/FacebookNET&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Java lovers, try &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Java&quot;&gt;here&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;5. Let&#39;s fly&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Be patient!! Facebook offers high-level security to their account holders. Before you can do anything, the user needs to grant permission for your application. That permission can either be temporal or permanent.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Let me explain.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Anytime a user visits your page, Facebook transfers a session ID to your application. You can use this to get user&#39;s status update, list friends, groups or events. You can even use this to access the user&#39;s account offline. However, the user again needs to grant that permission; and this means you have to save it to a database.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Read on permissions &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Extended_permissions&quot;&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;Get more info on using session IDs &lt;a href=&quot;http://www.emcro.com/blog/2009/01/facebook-infinite-session-keys-no-more/&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;http://www.henrycipolla.com/blog/2008/02/how-to-create-infinite-sessions-with-the-facebook-platform-api/&quot;&gt;there&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;
&lt;span style=&quot;white-space: pre;&quot;&gt;6. I encourage you to be more curious. Play with the platform. It&#39;s fun.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://austinejei.blogspot.com/feeds/6047156317282582024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/4640198225857397031/6047156317282582024?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6047156317282582024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4640198225857397031/posts/default/6047156317282582024'/><link rel='alternate' type='text/html' href='http://austinejei.blogspot.com/2009/10/working-with-facebook-platform.html' title='Working with Facebook Platform'/><author><name>stynpro</name><uri>http://www.blogger.com/profile/00932345738669181423</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_eWKHxZe7vjY/Sbujh7GdzcI/AAAAAAAAACU/NDQCKQs92L0/S220/me+at+home.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiPwwS0vvQuBslG8pLadVv_9jtofq7LWPJmbxjUSC7MPFxDO7vrtguehIl14PoBCFzdECst4gIrLpUFa2eS8uOs02exwuZn4LY8r7lv-eF5y8V3-daJU-NJjuFaLy5TsIDdM_CbYvfgFaH/s72-c/fb1.JPG" height="72" width="72"/><thr:total>0</thr:total></entry></feed>