tag:blogger.com,1999:blog-44870669784496582722024-03-13T13:30:57.761-04:00Broadly ApplicableDavid Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-4487066978449658272.post-87045946890277003432017-02-21T15:05:00.000-05:002017-02-21T15:05:47.656-05:00JSSeries : Javascript + conversion during comparisonHere is an example of using the compare function using the plus operator to convert the value to a number. It turns out 2 and Two are equal when Two isNan converted with the + in front of the value :) Javascript never ceased to impress LOL.<br />
<br />
<br />
<b>Code:</b><br />
<br />
function compare(v1, v2, change) {<br />
// The + converts to a number if possible<br />
<br />
var itm1 = v1;<br />
var itm2 = v2;<br />
<br />
if (change) {<br />
itm1 = +v1;<br />
itm2 = +v2;<br />
}<br />
<br />
console.log("itm1:"+itm1+" itm2:"+itm2);<br />
<br />
if (itm1 < itm2) { return -1; }<br />
if (itm2 < itm1) { return 1; }<br />
<br />
return 0;<br />
}<br />
<br />
one = "2";<br />
two = "Two";<br />
console.log("Test with +");<br />
console.log("------");<br />
console.log(compare(one, two, true));<br />
console.log("");<br />
console.log("Test without +");<br />
console.log("------");<br />
console.log(compare(one, two, false)); <br />
<div>
<br /></div>
<br />
<br />
<b>Output:</b><br />
<br />
Test with +<br />
------<br />
itm1:2 itm2:NaN<br />
0<br />
<br />
Test without +<br />
------<br />
itm1:2 itm2:Two<br />
-1David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-136430799993159702017-02-04T23:34:00.003-05:002017-02-04T23:34:38.545-05:00My Ugly JS Xmas Tree/**<br />
* My Ugly JS Christmas Tree<br />
*/<br />
<br />
var t = 1;<br />
var s = 22;<br />
for (var i = 1 ; i <= 20 ; i++) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>var spaces = "";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for (var z = 0 ; z < s ; z++) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>spaces = spaces + " ";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>s = s - 1;<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>t = t + (i * t);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>console.log(spaces + t + t);<br />
}<br />
<br />
for (var i = 0 ; i < 3 ; i++) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>console.log(" xxxxxxxxxx");<br />
}<br />
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfWnC8Yj_TwZOW9LhLoeYKAtmDF0InznC93joIBUaTzQWOJzcCMcHqOu3vDwfBdE2bNCNaOO2sfBb3XW59e5tpEPwIAnSdH8ucXQuNCJzWhHjeeYDzsKxiFcaSbIhvjvKnO8Iwcjt9dCxP/s1600/Screen+Shot+2017-02-04+at+11.31.47+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfWnC8Yj_TwZOW9LhLoeYKAtmDF0InznC93joIBUaTzQWOJzcCMcHqOu3vDwfBdE2bNCNaOO2sfBb3XW59e5tpEPwIAnSdH8ucXQuNCJzWhHjeeYDzsKxiFcaSbIhvjvKnO8Iwcjt9dCxP/s400/Screen+Shot+2017-02-04+at+11.31.47+PM.png" width="376" /></a></div>
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-75024250158827879562016-06-04T22:43:00.004-04:002016-06-04T22:54:38.077-04:00JS Series: Node.js vs. Java Simple Speed TestThis evening after working through a few asynchronous and synchronous methods in node.js to process huge files I thought I would write the same simple math routine in JavaScript/node.js and again in Java. I have been impressed so far with the performance of node and my JS code. The fact that I am getting the speed I do and I get it with a save then run without compile has me convinced JS is a contender for my next time sensitive project.<br />
<br />
<br />
<br />
--------------------------<br />
<b>Node/JavaScript </b><br />
--------------------------<br />
<br />
var start = new Date();<br />
var n = 1;<br />
for (var i = 1 ; i <= 100000000 ; i++) {<br />
n = n + i;<br />
}<br />
var end = new Date();<br />
var tm = end.getTime() - start.getTime();<br />
console.log('tm->'+tm+'milliseconds');<br />
console.log('n->'+n);<br />
<br />
<br />
<br />
--------------------------<br />
<b>Java</b><br />
--------------------------<br />
<br />
import java.util.Date;<br />
class Summer {<br />
public static void main(String[] args) {<br />
Date startDate = new Date();<br />
long n = 1;<br />
for (long i = 1 ; i <= 100000000 ; i++) {<br />
n = n + i;<br />
}<br />
Date endDate = new Date();<br />
long tm = endDate.getTime() - startDate.getTime();<br />
System.out.println("tm->" + tm + "milliseconds");<br />
System.out.println("n->"+n);<br />
}<br />
}<br />
<br />
<br />
<b>Results</b><br />
<br />
Minus the boilerplate class stuff in Java each of these are exactly 8 lines of code. So how did they do?<br />
<br />
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">Davids-MacBook-Air:numbers dbell$ java Summer</span></div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">tm-><b>41</b>milliseconds</span></div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">n->5000000050000001</span></div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">Davids-MacBook-Air:numbers dbell$ node summer.js</span></div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">tm-><b>139</b>milliseconds</span></div>
<br />
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">n->5000000050000001</span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;"><br /></span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;"><br /></span></div>
The difference isn't drastic for such a simple example but Java runs in 1/3 the time and is our winner!<br />
<br />
Enjoy!<br />
<br />
<br />
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-73421311097608367072016-06-03T12:17:00.001-04:002016-06-03T14:14:57.957-04:00JS Series: iTunes Connect Test Flight External Users Notify CSV Generator Using Node.jsIn this post I want to share a script that I wrote to parse through the iTunes Connect Test Flight external user test to determine which users have been notified of my new app build but who have not installed. The goal is to gather up the list of those users and re-create a new comma separated file for upload. This will cause all those users to be re-notified and will hopefully lead to more downloads of test builds.<br />
<br />
<b>Note: This script requires you install node.js to work.</b><br />
<b><br /></b>
<br />
<b>Step 1: Get users into a users.txt file.</b><br />
Log into iTunes connect, click on my apps, click on your app name, visit the test flight section, click on external testers. Highlight and copy/paste the list of users into a new text file called users.txt and place into a directory. The file should look similar to this screenshot below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_ygQQJ9XIFuV4puS0iEAZiZSC8Rp49uSO4XkLSn8rejwIFTmv86b4X1LClMu6A4DwQjY5AqDL75s8NjxN7MGh633-TaQpGDu8SI_9hdFCYXkhEGHHDrAVQNCdAyO6koLhULSgEP-t7P6l/s1600/Screen+Shot+2016-06-03+at+12.04.11+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_ygQQJ9XIFuV4puS0iEAZiZSC8Rp49uSO4XkLSn8rejwIFTmv86b4X1LClMu6A4DwQjY5AqDL75s8NjxN7MGh633-TaQpGDu8SI_9hdFCYXkhEGHHDrAVQNCdAyO6koLhULSgEP-t7P6l/s1600/Screen+Shot+2016-06-03+at+12.04.11+PM.png" /></a></div>
<br />
<b>Step 2: In the same directory as this users.txt file copy and paste the following javascript file.</b><br />
<br />
var fs = require('fs');<br />
var lineReader = require('readline').createInterface({<br />
input: require('fs').createReadStream('users.txt')<br />
});<br />
<br />
var date = new Date();<br />
var day = date.getDate();<br />
var monthIndex = date.getMonth();<br />
var year = date.getFullYear();<br />
<br />
var csvFile = 'notify_' + monthIndex + day + year + '.csv';<br />
console.log('csvFile:' + csvFile);<br />
<br />
fs.closeSync(fs.openSync(csvFile, 'w'));<br />
<br />
var cnt = 0;<br />
var fName = '';<br />
var lName = '';<br />
var email = '';<br />
var notified = false;<br />
<br />
lineReader.on('line', function (line) {<br />
if (line != '') {<br />
line = line.replace(',', '');<br />
switch (cnt) {<br />
case 0:<br />
email = line;<br />
break;<br />
case 1:<br />
var names = line.split(' ');<br />
fName = names[0];<br />
lName = names[1];<br />
break;<br />
case 2:<br />
if (line === 'Notified') {<br />
notified = true;<br />
}<br />
break;<br />
default:<br />
}<br />
cnt = cnt + 1;<br />
} else {<br />
if (notified) {<br />
var lne = fName + ',' + lName + ',' + email + '\n';<br />
fs.appendFile(csvFile, lne, function (err) {<br />
if (err !== null) {<br />
console.log('err:' + err);<br />
}<br />
});<br />
}<br />
cnt = 0;<br />
fName = '';<br />
lName = '';<br />
email = '';<br />
notified = false;<br />
}<br />
});<br />
<br />
<b>Step 3: Run Script</b><br />
Open up a terminal and go into the directory where the user.txt and the above script are found. (I called mine ReadFile.js).<br />
<br />
<div style="background-color: black; color: whitesmoke; font-family: Menlo; font-size: 12px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">Davids-MacBook-Air:itunes dbell$ node ReadFile.js </span></div>
<div style="background-color: black; color: whitesmoke; font-family: Menlo; font-size: 12px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;">csvFile:notify_532016.csv</span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;"><br /></span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;">When you run the file it should produce a new notify csv file. View the file (I used cat) and you should see only those users listed who need to be notified again. </span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;"><br /></span></div>
<div>
<span style="font-variant-ligatures: no-common-ligatures;"></span><br />
<div style="background-color: black; color: whitesmoke; font-family: Menlo; font-size: 12px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-variant-ligatures: no-common-ligatures;">Davids-MacBook-Air:itunes dbell$ cat notify_532016.csv </span></span></div>
<span style="font-variant-ligatures: no-common-ligatures;">
</span>
<br />
<div style="background-color: black; color: whitesmoke; font-family: Menlo; font-size: 12px; line-height: normal;">
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-variant-ligatures: no-common-ligatures;">Bob,Smith,bobsmith@outlook.com</span></span></div>
<span style="font-variant-ligatures: no-common-ligatures;">
</span>
<br />
<div>
<span style="font-variant-ligatures: no-common-ligatures;"><span style="font-variant-ligatures: no-common-ligatures;"><br /></span></span></div>
<span style="font-variant-ligatures: no-common-ligatures;">
</span></div>
<br />
<br />
<b>Step 4: iTunes CSV Load</b><br />
Go back into iTunes connect now where you copied out your users. Edit and remove each user manually who had only notified next to their name. You can use this new notify csv as a reference for who to remove. Then after they are removed use the add functionality to upload a csv file. Select your new csv file and then click on save.<br />
<br />
<br />
<br />
In my next Javascript post I will use the same users.txt file to determine how many users have installed and what build and how many are only notified as a means to provide a statistic for your app.<br />
<br />
Enjoy!<br />
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-61649548309372492152016-05-26T23:28:00.001-04:002016-05-26T23:28:40.319-04:00JS Series: Function vs. Object EncapsulationWhile going through JS and trying to figure out how functions work vs. objects since you know, functions are objects, I decided to put together a short example of how encapsulation works in JavaScript. Basically you can create private and public fields and methods but not inside an object you have to use a function.<br />
<br />
I'm well aware there are many more cases where this basic principle gets confusing or misused. An example where this all falls apart is changing out the var keyword on the cnt property inside the CalculatorFunction.js file. However this is meant to be a very simple example of how you can hide fields inside a file. You can do the same thing for methods by not doing a this.func = function() and instead just declaring the function() you wish to use privately.<br />
<br />
<b>Explanation</b><br />
The concept behind this test was to create the same thing as an object and a function. Call the method to add two values together. In this add function it should increase the cnt of methods executed and store that value. After calling that method the program tries to modify the cnt field in both types to see the result. In the function the cnt is protected and in the object it is not.<br />
<br />
<br />
<b>Screenshot of my results</b><br />
<b><br /></b>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYlxQmoZCLrOKDEgCuMgttsdG1HuKa7ZVxvi9g0F9SR13b9HwG3bTrJ9JxIKdeYrd0EY_HecefSDIzds-0tp6f1KiSVlkLYiTl0l_PXDih83MK2rA6xy6qPPxePlnOxzXwqy5e6Jlp4s8S/s1600/Screen+Shot+2016-05-26+at+11.15.20+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYlxQmoZCLrOKDEgCuMgttsdG1HuKa7ZVxvi9g0F9SR13b9HwG3bTrJ9JxIKdeYrd0EY_HecefSDIzds-0tp6f1KiSVlkLYiTl0l_PXDih83MK2rA6xy6qPPxePlnOxzXwqy5e6Jlp4s8S/s1600/Screen+Shot+2016-05-26+at+11.15.20+PM.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Index.html</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
<html></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<body></div>
<div class="separator" style="clear: both;">
<h1>Scoping Tests</h1></div>
<div class="separator" style="clear: both;">
<script src="CalculatorObject.js"></script></div>
<div class="separator" style="clear: both;">
<script src="CalculatorFunction.js"></script></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<script></div>
<div class="separator" style="clear: both;">
var a = 5;</div>
<div class="separator" style="clear: both;">
var b = 25;</div>
<div class="separator" style="clear: both;">
var c = 30;</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
var cf = new CalculatorFunction();</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
var rslt1 = calculatorObject.add(a, b);</div>
<div class="separator" style="clear: both;">
rslt1 = rslt1 + calculatorObject.add(b, c);</div>
<div class="separator" style="clear: both;">
var rslt2 = cf.add(a, c);</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
document.write("Result1->" + rslt1 + " count->" + calculatorObject.getCnt());</div>
<div class="separator" style="clear: both;">
document.write("<br/>Result2->" + rslt2 + " count->" + cf.getCnt());</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
/* Testing function encapsulation using var */</div>
<div class="separator" style="clear: both;">
document.write("<br/><br/><b>Test Function Encapsulation</b><br/>");</div>
<div class="separator" style="clear: both;">
cf.cnt = 25;</div>
<div class="separator" style="clear: both;">
document.write("<br/>Setting cf.cnt = 25 won't matter. getCnt() is still: " + cf.getCnt() + " aka encapsulation in JS.");</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
/* Testing object encapsulation using object parameters */</div>
<div class="separator" style="clear: both;">
document.write("<br/><br/><b>Test Object Encapsulation</b><br/>");</div>
<div class="separator" style="clear: both;">
calculatorObject.cnt = 999;</div>
<div class="separator" style="clear: both;">
document.write("<br/>Setting calculatorObject.cnt = 999. getCnt() on object should return 999: " + calculatorObject.getCnt() + " aka non-encapsulation.");</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
</script></div>
<div class="separator" style="clear: both;">
</body></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
</html></div>
<b><br /></b>
<b><br /></b>
<b>CalculatorObject.js</b><br />
<b><br /></b>
var calculatorObject = {<br />
"cnt": 0,<br />
<br />
"add": function (a, b) {<br />
'use strict';<br />
this.cnt = this.cnt + 1;<br />
return a + b;<br />
},<br />
<br />
"subtract": function (a, b) {<br />
'use strict';<br />
this.cnt = this.cnt + 1;<br />
return a - b;<br />
},<br />
<br />
"getCnt": function () {<br />
'use strict';<br />
return this.cnt;<br />
}<br />
};<br />
<br />
<br />
<b>CalculatorFunction.js</b><br />
<b><br /></b>
function CalculatorFunction() {<br />
<br />
'use strict';<br />
var cnt = 0;<br />
console.log(cnt);<br />
this.add = function (a, b) {<br />
cnt = cnt + 1;<br />
return a + b;<br />
};<br />
<br />
this.subtract = function (a, b) {<br />
cnt = cnt + 1;<br />
return a - b;<br />
};<br />
<br />
this.getCnt = function () {<br />
return cnt;<br />
};<br />
<br />
}<br />
<br />
<br />
Though this is a very small and simple example it will help you to understand just how these two items work in relation to what problem you are trying to solve in your source code.<br />
<br />
Enjoy!<br />
<b><br /></b>David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-89167859448687733862016-05-26T12:05:00.004-04:002016-05-26T12:15:58.015-04:00JS Series: JavaScript xmlHttp GET Request<br />
In this post I will provide a code sample for how to do simple xmlHttp GET requests and update a unordered list of times to display great nerdy Chuck Norris quotes using the icndb (Internet Chuck Norris Database).<br />
<div>
<br /></div>
<div>
In order to keep things simple at the beginning I'm going to try write all my JavaScript in the same html file. Once we move to modules and server side I'm sure that won't be possible but for now let's keep things simple. </div>
<div>
<br />
<br /></div>
<div>
<b>1. Create a new file called index.html and paste the following code into the file and save.</b></div>
<div>
<br /></div>
<div>
<div>
<script></div>
<div>
function httpGetAsync() { </div>
<div>
var xmlHttp = new XMLHttpRequest();</div>
<div>
xmlHttp.onreadystatechange = function() { </div>
<div>
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {</div>
<div>
callback(xmlHttp.responseText);</div>
<div>
}</div>
<div>
}</div>
<div>
xmlHttp.open("GET", "http://api.icndb.com/jokes/random", true); // true for asynchronous </div>
<div>
xmlHttp.send(null);</div>
<div>
}</div>
<div>
<br /></div>
<div>
function callback(respString) {</div>
<div>
var joke = getJoke(respString);</div>
<div>
var quoteList = document.getElementById("quoteList");</div>
<div>
var li = document.createElement("li");</div>
<div>
li.appendChild(document.createTextNode(joke));</div>
<div>
quoteList.appendChild(li);</div>
<div>
}</div>
<div>
<br /></div>
<div>
function getJoke(respString) {</div>
<div>
var obj = JSON.parse(respString);</div>
<div>
return obj.value.joke;</div>
<div>
}</div>
<div>
<br /></div>
<div>
</script></div>
<div>
<input type="button" value="Get Quote" onclick="httpGetAsync()" /></div>
<div>
<ul id="quoteList"></ul></div>
</div>
<div>
<br /></div>
<div>
<b>2. Open The File With Your Browser</b></div>
<div>
<b><br /></b></div>
<div>
Locate the new index.html file you just created and double click on it. This should open the file along with the script code into your browser. You should be supplied with a single button with a label called "Get Quote". Clicking on this button will fire off an asynchronous get request to the incdb server and return a string of data (JSON format) which we will show in the browser.</div>
<div>
<br />
<br />
<br />
<br /></div>
<div>
<b>ScreenShot</b></div>
<div>
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW4X6XBpXmzFv6126uoDhPlGzJVlXfUBuFsAxS-czwnjwpu5uFSj3xTF8el6ocD-U0PCL5E8mJSSIhva9j4dbRMe44JJw_S3lcvO9aY32ZoaMDWXzILHVk7blwauCB4pjKdwRYwpCnCwDn/s1600/Screen+Shot+2016-05-26+at+11.43.54+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW4X6XBpXmzFv6126uoDhPlGzJVlXfUBuFsAxS-czwnjwpu5uFSj3xTF8el6ocD-U0PCL5E8mJSSIhva9j4dbRMe44JJw_S3lcvO9aY32ZoaMDWXzILHVk7blwauCB4pjKdwRYwpCnCwDn/s1600/Screen+Shot+2016-05-26+at+11.43.54+AM.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Items To Note</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>There was a button added to the page which called the httpGetAsync() JS function.</li>
<li>The httpGetAsync method created a new xmlHttp object and opened a GET connection to a specific URL and called send.</li>
<li>The xmlHttp object created has a callback function assigned when the state of the connection changed.</li>
<li>This change fired off a call to a new method aptly named callback which took the response json returned. </li>
<li>The response json (JavaScript Object Notation) was then created using the JSON.parse method which takes a regular string and creates the actual JSON object.</li>
<li>This method also accesses the joke object value and returns it to the calling function.</li>
<li>Next the callback finds the UL tag by id, creates a new LI element, appends the joke text into that LI tag, then appends that LI back into the UL tag so the list continues to grow each time you hit the Get Quote button.</li>
</ul>
<div>
<br /></div>
<div>
I hope you enjoyed this simple yet powerful example of how to do a GET with JavaScript. As I continue down this path I look forward to the many challenges I will face. I can already tell just how powerful this whole JS thing is nowadays with this simple script. </div>
<div>
<br /></div>
<div>
Enjoy!</div>
<br />
<div>
<b><br /></b></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-33529784386937559862016-05-26T11:55:00.001-04:002016-05-26T11:55:18.143-04:00JavaScript oh JavaScriptThe World is eati.. wait.. no JavaScript is eating the world. That is the headline I keep reading everywhere I look. I have been coding JavaScript since the nineties. I have never really given JS any respect mainly because it was always just a toy language or something to add a little functionality to a web page. Well times sure have changed and it seems like everywhere I look you can use JS to do about anything from IOT to server side programmer and beyond.<br />
<br />
For this reason I have decided to embark on a new journey to the land of current JS. I'll try to post new articles as I teach myself all the new features in say ES6 to how to do try module encapsulation (looking forward to that one) and also our best friend Node.js which along with npm is one heck of a tool. So buckle in as we take a very seasoned veteran Java programmer and build out tools and products using nothing but JavaScript.David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-36384788057085607982015-12-12T11:42:00.001-05:002015-12-12T11:42:28.288-05:00Get Me Outta Here!<div class="MsoNormal" style="mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Happy Holidays! <o:p></o:p></span></div>
<div class="MsoNormal" style="mso-layout-grid-align: none; mso-pagination: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">For today's post I want to share something I have been working on for
the last few days. For quite some time I have wanted to build a small
application which would generate a maze of sorts. The program would produce a
user who would try to escape out of the box by trying multiple directions to
get around the obstacles. I decided to use JavaFX as my platform to
produce this application as it has the functions necessary (like intersects for
collision detection) to build out my idea and I know the Java language very
well. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><o:p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAbHs62YdwCtZxwf9eYKoEZyOxPhtMA-dSu4g5Y_8wVeo1xaSCKqO11SIFcq8fK2n1vsKfOr_48FSE1f2qgVB-iE0VFbdTW1R31yCsMEv5tIzNhhs9e1cStpqENKKNfg9CeucTGZerNosk/s1600/Screen+Shot+2015-12-10+at+10.42.57+PM.png" imageanchor="1"><img border="0" height="514" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAbHs62YdwCtZxwf9eYKoEZyOxPhtMA-dSu4g5Y_8wVeo1xaSCKqO11SIFcq8fK2n1vsKfOr_48FSE1f2qgVB-iE0VFbdTW1R31yCsMEv5tIzNhhs9e1cStpqENKKNfg9CeucTGZerNosk/s640/Screen+Shot+2015-12-10+at+10.42.57+PM.png" width="640" /></a></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times; mso-no-proof: yes;"><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
alt="../../../../Desktop/Screen%20Shot%202015-12-10%20at%2010.42.57" style='width:468pt;
height:377pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file://localhost/Users/dbell/Library/Group%20Containers/UBF8T346G9.Office/msoclip1/01/clip_image001.png"
o:title="../../../../Desktop/Screen%20Shot%202015-12-10%20at%2010.42.57"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Challenges<o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<u><span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Collision Detection<o:p></o:p></span></u></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">During the development process I ran into many challenges. One of the
largest of those was attempting to build the collision detection math from
scratch. After many failed attempts I came across the built in functionality to
assign intersection binding to nodes which is built into JavaFX. After each
move I took the new user coordinates and used the Shape class
getBoundsInLocal().getWidth() method to determine if the collision had occurred.
In that case I would reset the current direction of the user. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">for (Line border : borders) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>Shape intersect =
Shape.intersect(border, user);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>if
(intersect.getBoundsInLocal().getWidth() != -1) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>System.out.println("Hit a border");<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>hitPlayer.play();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>user.setCenterX(currentX);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>user.setCenterY(currentY);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>currentDirection =
-1;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>break;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<u><span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">UI Updates / JFX Application Thread<o:p></o:p></span></u></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Due to the implementation of JavaFX and threading it is necessary
execute updates to the scene graph on the JavaFX application thread. In order
to update this thread and graph from your application you must choose one of
the methods provided by the platform. The one that I choose was using the Task
object. Overriding the call method I execute the platform.runLater method to
move the user. After each move the status bar is updated along with the
position of the user in the application. This task is started with Thread t =
new Thread(task), t.setDaemon(true), then t.start(). <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Task task = new Task<Void>() {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>@Override<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>protected Void
call() throws Exception {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>for (int i = 1; i <=
TASK_MAX; i++) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>updateProgress(i, TASK_MAX);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>Platform.runLater(new Runnable() {<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>@Override<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>public void run() {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;">
</span>autoMove();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<u><span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">Movement<o:p></o:p></span></u></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times;"><span style="font-size: 16pt;">Another issue which I had to solve was giving the user some sort of
intelligence. If you were stuck in this box and you moved forward one space you
most likely wouldn’t change your mind and go backwards. To
provide for this I implemented logic to continue the user in their current
direction until you hit something. When a </span><span style="font-size: 21px;">collision</span><span style="font-size: 16pt;"> ccurred the user would randomly decide a new
direction and continue that way until they hit another block. I used a random
number generator to provide an integer between 0 and 7, one for up, down,
left, right, up right, up left, down right, down left. Then I update the position
: <o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">private void autoMove() {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>int dir = getDirection();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>if (dir < 0) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>return;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>switch (dir) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>case 0:<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>updateUser(null,
user.getCenterY(), 0, JUMP);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>break;<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">The get direction method is used to return your current direction or get
you a new one since you hit a block. A block collision sets direction <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">to -1. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">private int getDirection() {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>if (currentDirection ==
-1) {<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>Random rand = new
Random();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>currentDirection =
rand.nextInt(8);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>return currentDirection;<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p><span style="font-family: Times;"><span style="font-size: 16pt;">I hope everyone has a safe and happy holiday with family and friends! Enjoy!</span><span style="font-size: 16pt;"> </span></span></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Times; font-size: 16.0pt; mso-bidi-font-family: Times;">The code for this project can be found on my github site here: <a href="https://github.com/dtbell99/GetMeOuttaHere">https://github.com/dtbell99/GetMeOuttaHere</a><o:p></o:p></span></div>
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves>false</w:TrackMoves>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="380">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Level 9"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
</w:LatentStyles>
</xml><![endif]-->
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<!--StartFragment-->
<!--EndFragment--><br />
<div class="MsoNormal">
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-61844222112723028892015-11-18T20:28:00.000-05:002015-11-18T20:28:01.784-05:00Handy Diff Utility (aka Differ)How many times has someone asked you to tell them the difference between two files and that person would be upset if you handed them the output of a unix diff command? For developers who have access to IDE's or fancy difference tools you can see the changes easily but do any of them output those nice views into something useful you can hand over?<br />
<br />
Due to this issue and not finding anything useful on the web I decided to create such a utility. I call this program Differ.<br />
<br />
The command to run the application is: "java -jar Differ.jar changes.txt original.txt"<br />
<br />
Pass into the application the newly changed file first and the existing or original version as the second parameter. The system will run through and generate an html report which can be passed around and viewed by everyone in an easily readable format.<br />
<br />
<b>Sample Report:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB4i62CsMAr1HsDvdEW-lC0WhM8aEZ7XnupPmmVWSxRrQbGyrHbywaQvniPsmdL9SkyLK-1VZl5Iogx_zsKmxijXhcYK_JLO-Bs9Ab5pcklwyDAe0WQTHj0H-VromVwPd1UmNqdptehTj/s1600/Screen+Shot+2015-11-18+at+8.04.05+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAB4i62CsMAr1HsDvdEW-lC0WhM8aEZ7XnupPmmVWSxRrQbGyrHbywaQvniPsmdL9SkyLK-1VZl5Iogx_zsKmxijXhcYK_JLO-Bs9Ab5pcklwyDAe0WQTHj0H-VromVwPd1UmNqdptehTj/s640/Screen+Shot+2015-11-18+at+8.04.05+PM.png" width="524" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The source code will be available on my github page at the following: <a href="https://github.com/dtbell99/differ" target="_blank">https://github.com/dtbell99/differ</a></div>
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-90685669192502990732015-11-18T19:18:00.000-05:002015-11-18T19:59:09.795-05:00Easy Bash Git ScriptsWhile enjoying all the benefits of git source control on my local development machine I thought I would share a few of my favorite shortcut scripts I've created for you to enjoy.<br />
<br />
<b>gitstat</b><br />
This script is used to display the stat diff version between master and the current branch I'm working on. Save the script below in an executable path named gitstat.<br />
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<br /></div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
#!/bin/bash</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
clear</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo ""</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Command: git diff --stat master..$1"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "----------------------------------------------------"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
git diff --stat master..$1</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo ""</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
<br />
Run it with the command: gitstat branch_name<br />
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrRcchPfQdRLloy89aLk-yV0uqAgE1rGP0BPddtxiK4A663RxSBoLQugHICW4KXr30AKoRFCExubwpvCj9l8f3OD11OriN5Qhi3cMqSMsKUUJxpGEl-cHUtn8CfcY2B_wlWBBJsHUPyj5P/s1600/Screen+Shot+2015-11-18+at+7.10.37+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="428" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrRcchPfQdRLloy89aLk-yV0uqAgE1rGP0BPddtxiK4A663RxSBoLQugHICW4KXr30AKoRFCExubwpvCj9l8f3OD11OriN5Qhi3cMqSMsKUUJxpGEl-cHUtn8CfcY2B_wlWBBJsHUPyj5P/s640/Screen+Shot+2015-11-18+at+7.10.37+PM.png" width="640" /></a></div>
<div>
<br />
<b>githelp</b><br />
This is a simple echo of commonly used command line options for git to give me a quick reminder when I may forget something. Save the script in a executable path and name it githelp.<br />
<br />
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
#!/bin/bash</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
clear</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Useful git commands"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "---------------------------------------------------------------------------"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Create Branch : git branch nameofbranch"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Switch to Branch : git checkout nameofbranch" </div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Update master : git checkout master | git merge nameofbranch"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Remove branch : git branch -D nameofbranch"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Add all files to staging : git add -all"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Add staged files to branch : git commit -m \"message\""</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Show diff between branches : git diff branchone..branchtwo"</div>
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo "Show all branches : git branch"</div>
<br />
<div style="font-family: Menlo; font-size: 13px; line-height: normal;">
echo ""</div>
</div>
<div>
<br /></div>
<div>
Run it with the command: githelp</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiywuRg51xJx024CxJ3gCFKSHjbg3eGI9gn__PUMI-rDTRLucBRS0CR-zlw94SavEsVRV9aTUkZdrUtX4yGOoaVldRjP7kBn4hkqrFmrqVvmilVRiRC0X3uZ_4XrT4p3i8z-x3AggqBYbkD/s1600/Screen+Shot+2015-11-18+at+7.56.45+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="460" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiywuRg51xJx024CxJ3gCFKSHjbg3eGI9gn__PUMI-rDTRLucBRS0CR-zlw94SavEsVRV9aTUkZdrUtX4yGOoaVldRjP7kBn4hkqrFmrqVvmilVRiRC0X3uZ_4XrT4p3i8z-x3AggqBYbkD/s640/Screen+Shot+2015-11-18+at+7.56.45+PM.png" width="640" /></a></div>
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-16653113242326593382015-11-12T22:54:00.002-05:002015-11-12T23:02:43.911-05:00ScanMyCode : A Code Count GeneratorRecently I was sitting around wondering just how much code I had in a project I've been working on single handedly for the last couple years. Since there are programs out there that do this today I thought the best approach would be to write one myself.<br />
<br />
The main aspects I wanted to gather were total files of each type and their line count minus blank lines. I also thought I would write a few lines of code to capture the method count as well.. why not... :)<br />
<br />
So in order to complete the task I had to create a Java application which takes the base directory and a report name. I would then generate both a HTML and a CSV file after the code was finished. I used maps for files, lines, and methods. Then I used a collection of type Extension (custom class) and used a comparable to sort it by lines of code.<br />
<br />
The output of the HTML report looks like the following screenshot.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJR9qF1HPthr3TG5Tabj2uFTAq29H5R2ypryVwvHc1e69oEK9DOdxcYCd-golXz42LdkUZJfILfC7_0m4Hhc4WUYT4_YsoztoW6lq8P3Xgtk7WJe8rVBVkjVTHOSwptF8b3uUds3WrSghU/s1600/Screen+Shot+2015-11-12+at+10.15.24+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJR9qF1HPthr3TG5Tabj2uFTAq29H5R2ypryVwvHc1e69oEK9DOdxcYCd-golXz42LdkUZJfILfC7_0m4Hhc4WUYT4_YsoztoW6lq8P3Xgtk7WJe8rVBVkjVTHOSwptF8b3uUds3WrSghU/s640/Screen+Shot+2015-11-12+at+10.15.24+PM.png" width="576" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The code can be found at my github account: <a href="https://github.com/dtbell99/ScanMyCode" target="_blank">https://github.com/dtbell99/ScanMyCode</a></div>
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-16355975131289948972015-05-08T10:49:00.000-04:002015-05-08T10:49:02.471-04:00Tombstone IdeaI came up with the perfect idea for my tombstone message for when the final day eventually comes and thought I'd post it. Enjoy!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8anJc_MuHWUP5FrLTNovwZl-a21lqE1mu289bfegBHUHTeBL_KeQcQRIeLQFjMlIZKz7Gu0-LlT0e9CY-JIS2IO1uajkzwVZE9HOvuW9tQHMsqy46fIeAUTHMqG3GK6oVQSXSib2Jjd7x/s1600/Screen+Shot+2015-05-08+at+10.45.40+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8anJc_MuHWUP5FrLTNovwZl-a21lqE1mu289bfegBHUHTeBL_KeQcQRIeLQFjMlIZKz7Gu0-LlT0e9CY-JIS2IO1uajkzwVZE9HOvuW9tQHMsqy46fIeAUTHMqG3GK6oVQSXSib2Jjd7x/s1600/Screen+Shot+2015-05-08+at+10.45.40+AM.png" /></a></div>
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-36452972139522502272015-04-14T10:12:00.002-04:002015-12-12T09:37:48.163-05:00JavaFX : Using Shapes To Create Your Own IconsIf you are like me you are always on the lookout for great icons for your applications. I always seem to find options that are very close but not quite right. If the design looks good then the color is wrong, or if the color and design are great the icon isn't available in the size I need. As a general rule I do not go into Photoshop or any other graphics tools and create or modify items like icons as I do not have an eye for good design. That brings us to JavaFX shapes and how you can leverage built in objects to generate great looking sharp icons or images to use in your applications that are generated from code so no external resources are required.<br />
<br />
Below is an example of a play, pause, stop, and checkmark icon I created for a JavaFX application which I will be releasing later this year!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq0K4wq1DTjs-9tFyLGhcOyY0SXXa3rOhuZdH79tbb2QY4llOY7m7NCdh14Sz61O6LUmIZN2Iwv3m4zIxFGNVB-Vku4YOKuaS4vo9RCPM5Byu0ZgRS1tVdlXG6DsgbC1VsOqgqR6AZ0_UG/s1600/Screen+Shot+2015-04-13+at+9.03.42+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq0K4wq1DTjs-9tFyLGhcOyY0SXXa3rOhuZdH79tbb2QY4llOY7m7NCdh14Sz61O6LUmIZN2Iwv3m4zIxFGNVB-Vku4YOKuaS4vo9RCPM5Byu0ZgRS1tVdlXG6DsgbC1VsOqgqR6AZ0_UG/s1600/Screen+Shot+2015-04-13+at+9.03.42+PM.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The code for this project can be found on github: <a href="https://github.com/dtbell99/JavaFXShapeIcons" target="_blank">https://github.com/dtbell99/JavaFXShapeIcons</a></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b>FXML Markup:</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
<?xml version="1.0" encoding="UTF-8"?></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<?import javafx.geometry.*?></div>
<div class="separator" style="clear: both;">
<?import javafx.scene.shape.*?></div>
<div class="separator" style="clear: both;">
<?import java.lang.*?></div>
<div class="separator" style="clear: both;">
<?import java.util.*?></div>
<div class="separator" style="clear: both;">
<?import javafx.scene.*?></div>
<div class="separator" style="clear: both;">
<?import javafx.scene.control.*?></div>
<div class="separator" style="clear: both;">
<?import javafx.scene.layout.*?></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<AnchorPane id="AnchorPane" prefHeight="328.0" prefWidth="395.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40" fx:controller="com.broadlyapplicable.javafxexamples.shapes.icons.CustomController"></div>
<div class="separator" style="clear: both;">
<children></div>
<div class="separator" style="clear: both;">
<VBox fx:id="vbox" layoutX="70.0" layoutY="51.0" prefHeight="328.0" prefWidth="395.0" spacing="75.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="25.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="25.0" /></div>
<div class="separator" style="clear: both;">
</children></div>
<div class="separator" style="clear: both;">
</AnchorPane></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Controller:</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both;">
package com.broadlyapplicable.javafxexamples.shapes.icons;</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
import java.net.URL;</div>
<div class="separator" style="clear: both;">
import java.util.ResourceBundle;</div>
<div class="separator" style="clear: both;">
import javafx.fxml.FXML;</div>
<div class="separator" style="clear: both;">
import javafx.fxml.Initializable;</div>
<div class="separator" style="clear: both;">
import javafx.scene.layout.HBox;</div>
<div class="separator" style="clear: both;">
import javafx.scene.layout.VBox;</div>
<div class="separator" style="clear: both;">
import javafx.scene.paint.Paint;</div>
<div class="separator" style="clear: both;">
import javafx.scene.shape.Polygon;</div>
<div class="separator" style="clear: both;">
import javafx.scene.shape.Polyline;</div>
<div class="separator" style="clear: both;">
import javafx.scene.shape.Rectangle;</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
public class CustomController implements Initializable {</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
@FXML</div>
<div class="separator" style="clear: both;">
private VBox vbox;</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
private static final String GREEN = "#68C953";</div>
<div class="separator" style="clear: both;">
private static final String RED = "#CF3E3E";</div>
<div class="separator" style="clear: both;">
private static final String YELLOW = "#EDAD18";</div>
<div class="separator" style="clear: both;">
private static final String BLUEGREEN = "#22BDBD";</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
@Override</div>
<div class="separator" style="clear: both;">
public void initialize(URL url, ResourceBundle rb) {</div>
<div class="separator" style="clear: both;">
vbox.getChildren().add(getPlayIcon());</div>
<div class="separator" style="clear: both;">
HBox hbox = new HBox(5);</div>
<div class="separator" style="clear: both;">
hbox.getChildren().add(getHalfPause());</div>
<div class="separator" style="clear: both;">
hbox.getChildren().add(getHalfPause());</div>
<div class="separator" style="clear: both;">
vbox.getChildren().add(hbox);</div>
<div class="separator" style="clear: both;">
vbox.getChildren().add(getStopIcon());</div>
<div class="separator" style="clear: both;">
vbox.getChildren().add(getCompletedIcon());</div>
<div class="separator" style="clear: both;">
} </div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
private Polyline getCompletedIcon() {</div>
<div class="separator" style="clear: both;">
Polyline polygon = new Polyline();</div>
<div class="separator" style="clear: both;">
polygon.getPoints().addAll(new Double[]{</div>
<div class="separator" style="clear: both;">
0.0, 100.0, 40.0, 150.0, 80.0, 0.0</div>
<div class="separator" style="clear: both;">
}); </div>
<div class="separator" style="clear: both;">
polygon.setStroke(Paint.valueOf(BLUEGREEN));</div>
<div class="separator" style="clear: both;">
polygon.setStrokeWidth(15.0);</div>
<div class="separator" style="clear: both;">
return polygon;</div>
<div class="separator" style="clear: both;">
}</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
private Polygon getPlayIcon() {</div>
<div class="separator" style="clear: both;">
Polygon polygon = new Polygon();</div>
<div class="separator" style="clear: both;">
polygon.getPoints().addAll(new Double[]{</div>
<div class="separator" style="clear: both;">
0.0, 0.0,</div>
<div class="separator" style="clear: both;">
0.0, 100.0,</div>
<div class="separator" style="clear: both;">
75.0, 50.0});</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
polygon.setFill(Paint.valueOf(GREEN));</div>
<div class="separator" style="clear: both;">
return polygon;</div>
<div class="separator" style="clear: both;">
}</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
private Rectangle getHalfPause() {</div>
<div class="separator" style="clear: both;">
Rectangle rectangle = new Rectangle();</div>
<div class="separator" style="clear: both;">
rectangle.setHeight(75);</div>
<div class="separator" style="clear: both;">
rectangle.setWidth(30);</div>
<div class="separator" style="clear: both;">
rectangle.setFill(Paint.valueOf(YELLOW));</div>
<div class="separator" style="clear: both;">
return rectangle;</div>
<div class="separator" style="clear: both;">
}</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
private Rectangle getStopIcon() {</div>
<div class="separator" style="clear: both;">
Rectangle rectangle = new Rectangle();</div>
<div class="separator" style="clear: both;">
rectangle.setHeight(65);</div>
<div class="separator" style="clear: both;">
rectangle.setWidth(65);</div>
<div class="separator" style="clear: both;">
rectangle.setFill(Paint.valueOf(RED));</div>
<div class="separator" style="clear: both;">
return rectangle;</div>
<div class="separator" style="clear: both;">
}</div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
}</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-67206097687606096012015-03-18T11:15:00.003-04:002015-12-11T18:52:22.884-05:00JavaFX Toolbar Button LayoutFor this simple post I will show how to layout your buttons on a JavaFX toolbar. There are many scenarios in which you would want to move these buttons around on the toolbar. Therefore I will provide you a very simple example to accomplish left, right, center, and multiple alignments for your buttons.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP9R_z30IsBfK1zwyy4S8J8Hso2C6Argv_LHU-G7KclBlx_KV0gOhYNrBl3ujXNu_rSf-IjWw2WnL2vKqyixy9sPRK_OEtQnw-qtzVCylzpOzdGNERTca-U_xxhGqlZ_OSayUdon5psDKu/s1600/Screen+Shot+2015-03-18+at+10.59.15+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="378" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP9R_z30IsBfK1zwyy4S8J8Hso2C6Argv_LHU-G7KclBlx_KV0gOhYNrBl3ujXNu_rSf-IjWw2WnL2vKqyixy9sPRK_OEtQnw-qtzVCylzpOzdGNERTca-U_xxhGqlZ_OSayUdon5psDKu/s1600/Screen+Shot+2015-03-18+at+10.59.15+AM.png" width="640" /></a></div>
<br />
The key to accomplishing this is using a <b><Pane HBox.hgrow="ALWAYS" /> </b>between the edges to create space (see code below). Enjoy!!<br />
<br />
This project has been uploaded to github. For the most recent updates please visit : <a href="https://github.com/dtbell99/JavaFXToolbar" target="_blank">https://github.com/dtbell99/JavaFXToolbar</a><br />
<br />
<br />
<br />
<br />
FXML Code:<br />
------------------<br />
<br />
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<br />
<?import javafx.geometry.*?><br />
<?import javafx.scene.text.*?><br />
<?import java.lang.*?><br />
<?import java.util.*?><br />
<?import javafx.scene.*?><br />
<?import javafx.scene.control.*?><br />
<?import javafx.scene.layout.*?><br />
<br />
<AnchorPane id="AnchorPane" prefHeight="364.0" prefWidth="727.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.broadlyapplicable.javafxexamples.toolbar.ToolbarExampleController"><br />
<children><br />
<VBox prefHeight="577.0" prefWidth="727.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"><br />
<children><br />
<Pane><br />
<children><br />
<Label prefHeight="24.0" prefWidth="356.0" text="Left Aligned Buttons (Default)"><br />
<font><br />
<Font size="19.0" /><br />
</font><br />
<padding><br />
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /><br />
</padding><br />
</Label><br />
</children><br />
</Pane><br />
<b> <ToolBar></b><br />
<b> <items></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 2" /></b><br />
<b> </items></b><br />
<b> </ToolBar></b><br />
<Pane><br />
<children><br />
<Label prefHeight="24.0" prefWidth="356.0" text="Center Aligned Buttons"><br />
<font><br />
<Font size="19.0" /><br />
</font><br />
<padding><br />
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /><br />
</padding><br />
</Label><br />
</children><br />
</Pane><br />
<b> <ToolBar></b><br />
<b> <items></b><br />
<b> <Pane HBox.hgrow="ALWAYS" /></b><br />
<b> <Button mnemonicParsing="false" text="Center Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Center Button 2" /></b><br />
<b> <Pane HBox.hgrow="ALWAYS" /></b><br />
<b> </items></b><br />
<b> </ToolBar></b><br />
<Pane><br />
<children><br />
<Label prefHeight="24.0" prefWidth="356.0" text="Right Aligned Buttons"><br />
<font><br />
<Font size="19.0" /><br />
</font><br />
<padding><br />
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /><br />
</padding><br />
</Label><br />
</children><br />
</Pane><br />
<b> <ToolBar></b><br />
<b> <items></b><br />
<b> <Pane HBox.hgrow="ALWAYS" /></b><br />
<b> <Button mnemonicParsing="false" text="Right Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Right Button 2" /></b><br />
<b> </items></b><br />
<b> </ToolBar></b><br />
<Pane><br />
<children><br />
<Label prefHeight="24.0" prefWidth="356.0" text="Left Center Right Align Buttons"><br />
<font><br />
<Font size="19.0" /><br />
</font><br />
<padding><br />
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /><br />
</padding><br />
</Label><br />
</children><br />
</Pane><br />
<b> <ToolBar></b><br />
<b> <items></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 2" /></b><br />
<b> <Pane HBox.hgrow="ALWAYS" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 2" /></b><br />
<b> <Pane HBox.hgrow="ALWAYS" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 1" /></b><br />
<b> <Button mnemonicParsing="false" text="Left Button 2" /></b><br />
<b> </items></b><br />
<b> </ToolBar></b><br />
</children><br />
</VBox><br />
</children><br />
</AnchorPane><br />
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-41309682042615748472015-03-05T21:32:00.001-05:002015-03-05T22:03:29.539-05:00JavaFX Capture & Restore Splitpane Divider PositionHere is another simple code example on how to capture, store, and recover the divider position of a JavaFX splitpane. Implementing this approach allows your splitpane divider to be persisted when you close your application and restored as you left it when you closed the window.<br />
<br />
Once the application is built and run you can drag the divider and see the current value of the position. Upon closing the program and restarting the divider should return to its last position.<br />
<br />
<br />
<b>Concepts: </b>This example demonstrates the following:<br />
<br />
1) How to access the PositionProperty field on the splitpane divider and add a listener to capture change events using a lambda function in Java 8.<br />
<br />
2) How to use the javafx.application.Platform.runLater method to set the divider position when your application launches. (This technique is necessary due to how the application starts up and initializes)<br />
<br />
3) How to store and retrieve simple application preferences using java.util.prefs.Preferences.<br />
<br />
<br />
<b>Requirements: </b>Java SE 8<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdCwKPzCk7BZhihr-UiodQ-MfbRikrMIKHLzVtFKMB6PEc7nzcqnEiQi6EQBtUTrqzCcKi7xoxdkP-_V-3ItDJ_U1Igg5R-D6se_PGjw0Rg53Rq0qRi39eRHcNWs4WVK9oc33xy3X17dDo/s1600/Screen+Shot+2015-03-05+at+7.11.27+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdCwKPzCk7BZhihr-UiodQ-MfbRikrMIKHLzVtFKMB6PEc7nzcqnEiQi6EQBtUTrqzCcKi7xoxdkP-_V-3ItDJ_U1Igg5R-D6se_PGjw0Rg53Rq0qRi39eRHcNWs4WVK9oc33xy3X17dDo/s1600/Screen+Shot+2015-03-05+at+7.11.27+PM.png" height="524" width="640" /></a></div>
<br />
<br />
<br />
<br />
package com.broadlyapplicable.javafxexamples;<br />
<br />
import java.net.URL;<br />
import java.util.ResourceBundle;<br />
import java.util.prefs.Preferences;<br />
import javafx.beans.property.DoubleProperty;<br />
import javafx.beans.value.ObservableValue;<br />
import javafx.fxml.FXML;<br />
import javafx.fxml.Initializable;<br />
import javafx.scene.control.Label;<br />
import javafx.scene.control.SplitPane;<br />
<br />
public class FXMLDocumentController implements Initializable {<br />
<br />
private static final String SPLIT_PANE_DIVIDER = "SplitPaneDivider";<br />
private static final String NODE = "FXMLDocumentController";<br />
<br />
@FXML<br />
private SplitPane splitPane;<br />
<br />
@FXML<br />
private Label dividerLabel;<br />
<br />
@Override<br />
public void initialize(URL url, ResourceBundle rb) {<br />
javafx.application.Platform.runLater(new Runnable() {<br />
@Override<br />
public void run() {<br />
Preferences pref = Preferences.userRoot().node(NODE);<br />
double splitPaneDivider = pref.getDouble(SPLIT_PANE_DIVIDER, .25);<br />
splitPane.setDividerPositions(splitPaneDivider);<br />
}<br />
});<br />
<br />
DoubleProperty dividerPositionProperty = splitPane.getDividers().get(0).positionProperty();<br />
dividerPositionProperty.addListener((ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {<br />
dividerLabel.setText(newValue.toString());<br />
Preferences pref = Preferences.userRoot().node(NODE);<br />
pref.putDouble(SPLIT_PANE_DIVIDER, newValue.doubleValue());<br />
});<br />
} <br />
<br />
}<br />
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div>
<?xml version="1.0" encoding="UTF-8"?></div>
<div>
<br /></div>
<div>
<?import javafx.geometry.*?></div>
<div>
<?import javafx.scene.text.*?></div>
<div>
<?import java.lang.*?></div>
<div>
<?import java.util.*?></div>
<div>
<?import javafx.scene.*?></div>
<div>
<?import javafx.scene.control.*?></div>
<div>
<?import javafx.scene.layout.*?></div>
<div>
<br /></div>
<div>
<AnchorPane id="AnchorPane" prefHeight="427.0" prefWidth="570.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.broadlyapplicable.javafxexamples.FXMLDocumentController"></div>
<div>
<children></div>
<div>
<VBox prefHeight="427.0" prefWidth="570.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"></div>
<div>
<children></div>
<div>
<SplitPane fx:id="splitPane" dividerPositions="0.33098591549295775"></div>
<div>
<items></div>
<div>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" style="-fx-background-color: #dddddd;" /></div>
<div>
<AnchorPane prefHeight="425.0" prefWidth="86.0" style="-fx-background-color: #aaaaaa;" /></div>
<div>
</items></div>
<div>
</SplitPane></div>
<div>
<Label fx:id="dividerLabel" alignment="CENTER" text="0.0"></div>
<div>
<font></div>
<div>
<Font size="31.0" /></div>
<div>
</font></div>
<div>
<padding></div>
<div>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /></div>
<div>
</padding></div>
<div>
</Label></div>
<div>
</children></div>
<div>
</VBox></div>
<div>
</children></div>
<div>
</AnchorPane></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-2203038712582482722015-02-23T09:13:00.001-05:002015-02-23T09:19:29.098-05:00JavaFX Restore Window Size & PositionSo this evening I decided to figure out how to make my new JavaFX application remember the screen size and location so my wonderful users won't get mad at me when the app doesn't remember how they positioned it. I started to research how to do this in JavaFX and learned two things I did not know so I thought I'd share them with the world.
<br />
<br />
1) How to get the location and size of a JavaFX stage at the close of the application.
<br />
2) How to use java.util.prefs.Preferences to store simple key/value application settings.
<br />
<br />
package javafxexamples;<br />
<br />
import java.io.IOException;<br />
import java.util.ResourceBundle;<br />
import java.util.prefs.Preferences;<br />
import javafx.fxml.FXMLLoader;<br />
import javafx.scene.Parent;<br />
import javafx.scene.Scene;<br />
import javafx.stage.Stage;<br />
import javafx.stage.WindowEvent;<br />
<br />
public class ViewSwitcher {<br />
<br />
private static final String WINDOW_POSITION_X = "Window_Position_X";<br />
private static final String WINDOW_POSITION_Y = "Window_Position_Y";<br />
private static final String WINDOW_WIDTH = "Window_Width";<br />
private static final String WINDOW_HEIGHT = "Window_Height";<br />
private static final double DEFAULT_X = 10;<br />
private static final double DEFAULT_Y = 10;<br />
private static final double DEFAULT_WIDTH = 800;<br />
private static final double DEFAULT_HEIGHT = 600;<br />
private static final String NODE_NAME = "ViewSwitcher";<br />
private static final String BUNDLE = "Bundle";<br />
<br />
public void switchView(String fxmlView, Stage stage, String title) throws IOException {<br />
Parent root = FXMLLoader.load(getClass().getResource(fxmlView), <br />
ResourceBundle.getBundle(BUNDLE));<br />
Scene scene = new Scene(root);<br />
stage.setScene(scene);<br />
stage.setTitle(title);<br />
stage.show();<br />
<br />
<br />
// Pull the saved preferences and set the stage size and start location<br />
<br />
Preferences pref = Preferences.userRoot().node(NODE_NAME);<br />
double x = pref.getDouble(WINDOW_POSITION_X, DEFAULT_X);<br />
double y = pref.getDouble(WINDOW_POSITION_Y, DEFAULT_Y);<br />
double width = pref.getDouble(WINDOW_WIDTH, DEFAULT_WIDTH);<br />
double height = pref.getDouble(WINDOW_HEIGHT, DEFAULT_HEIGHT);<br />
stage.setX(x);<br />
stage.setY(y);<br />
stage.setWidth(width);<br />
stage.setHeight(height);<br />
<br />
<br />
// When the stage closes store the current size and window location.<br />
<br />
stage.setOnCloseRequest((final WindowEvent event) -> {<br />
Preferences preferences = Preferences.userRoot().node(NODE_NAME);<br />
preferences.putDouble(WINDOW_POSITION_X, stage.getX());<br />
preferences.putDouble(WINDOW_POSITION_Y, stage.getY());<br />
preferences.putDouble(WINDOW_WIDTH, stage.getWidth());<br />
preferences.putDouble(WINDOW_HEIGHT, stage.getHeight());<br />
});<br />
}<br />
}<br />
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com4tag:blogger.com,1999:blog-4487066978449658272.post-14851982842196364422014-10-11T11:40:00.002-04:002015-03-05T22:02:49.310-05:00Groovy Enum Generator Using eachLine and String InterpolationThis is a very short example about how to process a file line by line in the Groovy programming language to create an enum. There are so many times I open up the Groovy console to get something done fast. In this example I use the groovy to open up a file, iterate over each line, and use string interpolation to create the output that is then copied into my enum Java file from the contents of a text file.<br />
<br />
<br />
<b>Code:</b><br />
<br />
def tmpFile = new File("/Users/dbell/Desktop/example.txt")<br />
def cnt = 0<br />
def enumName = "Sports"<br />
def enumStringBuilder = new StringBuilder()<br />
enumStringBuilder.append("public enum ${enumName} {\n\n")<br />
tmpFile.eachLine {<br />
def desc = it<br />
def code = desc.toUpperCase().replaceAll("\\s", "_")<br />
if (cnt > 0) { enumStringBuilder.append(",\n") }<br />
enumStringBuilder.append("\t${code}(\"${code}\",\"${desc}\")")<br />
cnt++<br />
}<br />
<br />
def enumOutput = enumStringBuilder.toString() + ";\n";<br />
println enumOutput<br />
<br />
println "\tString code;"<br />
println "\tString description;\n"<br />
println "\t${enumName}(String code, String description) {"<br />
println "\t\tthis.code = code;"<br />
println "\t\tthis.description = description;"<br />
println "\t}"<br />
println "}"<br />
<br />
<br />
<b>example.txt</b><br />
<br />
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Soccer</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Football</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Basketball</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Hockey</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Hacky Sack</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
Corn Hole</div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
<br /></div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
<br /></div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
<b>Generated Output</b></div>
<div style="background-color: #fafffd; font-family: Monaco; font-size: 12px;">
<b><br /></b></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">public</span> <span style="color: #931a68;">enum</span> Sports {</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">SOCCER</span><span style="color: black;">(</span>"SOCCER"<span style="color: black;">,</span>"Soccer"<span style="color: black;">),</span></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">FOOTBALL</span><span style="color: black;">(</span>"FOOTBALL"<span style="color: black;">,</span>"Football"<span style="color: black;">),</span></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">BASKETBALL</span><span style="color: black;">(</span>"BASKETBALL"<span style="color: black;">,</span>"Basketball"<span style="color: black;">),</span></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">HOCKEY</span><span style="color: black;">(</span>"HOCKEY"<span style="color: black;">,</span>"Hockey"<span style="color: black;">),</span></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">HACKY_SACK</span><span style="color: black;">(</span>"HACKY_SACK"<span style="color: black;">,</span>"Hacky Sack"<span style="color: black;">),</span></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #0326cc;">CORN_HOLE</span><span style="color: black;">(</span>"CORN_HOLE"<span style="color: black;">,</span>"Corn Hole"<span style="color: black;">);</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #0326cc;">code</span>;</div>
<div style="color: #0326cc; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String </span>description<span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Sports(String <span style="color: #7e504f;">code</span>, String <span style="color: #7e504f;">description</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">this</span>.<span style="color: #0326cc;">code</span> = <span style="color: #7e504f;">code</span>;</div>
<div style="color: #0326cc; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #931a68;">this</span><span style="color: black;">.</span>description<span style="color: black;"> = </span><span style="color: #7e504f;">description</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div style="font-family: Monaco; font-size: 11px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<b>Screenshot:</b></div>
<div style="font-family: Monaco; font-size: 11px;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpSMsI_-nvKee7DT7-U0ZNU0rMbFflr5WZxfsJLvw0DaiMG9A8coUTVEl6Y-kZ0vMAHQ6CI9lCpErIhFeU5kSuleyrVWgzP-8RxVjHl337v0Ii_tW9WDOaHk5sxHga8uZQ4ip3btgakTA/s1600/groovy_enum.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpSMsI_-nvKee7DT7-U0ZNU0rMbFflr5WZxfsJLvw0DaiMG9A8coUTVEl6Y-kZ0vMAHQ6CI9lCpErIhFeU5kSuleyrVWgzP-8RxVjHl337v0Ii_tW9WDOaHk5sxHga8uZQ4ip3btgakTA/s1600/groovy_enum.png" height="640" width="496" /></a></div>
<div style="font-family: Monaco; font-size: 11px;">
<b><br /></b></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-51514031488436514572014-09-29T21:35:00.000-04:002014-09-29T22:27:52.754-04:00A Solution To Homelessness Using Technology (aka Homebook)Readers,<br />
<div>
<br /></div>
<div>
I have had an idea for quite some time and I would like to share it with you. For many years I drove to work and each day would get stopped by the same stop light at the top of the hill. Each morning there would always be someone standing there with a sign describing their situation and that anything helped. As I drove into work each and every day I always thought there had to be a better way to address these issues. My old boss Mr. Cook always said, do not complain unless you have a solution, and don't be surprised if you become the owner of that solution if it is a good one. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
So here comes my idea for Facebook for those in need, I call it HomeBook. The plan for this web and mobile program would be to sign up families and individuals in need. They would go to a center who was trained to identify individuals who truly needed assistance. These workers would put the necessary information into the web application. The individuals would then be issued an id card and number which would tie into their profile on the site: </div>
<div>
<br /></div>
<div>
Example: http://www.homebook.org/zipcode/id# </div>
<div>
<br /></div>
<div>
Now that we have the information in the computer we can begin helping. Each id would be assigned a bank account. This account would be funded by donations made by people visiting the website. People could simply visit the site, put in their zip code (or let the browser do it with location services) and up comes those in your community in need. The website would also work on mobile devices and allow both reviewing of profiles and donations. <b>If that person now wants to stand on the corner asking for help, they now can put a url on that piece of cardboard.</b> The person in their car could simply hold up their phone, snap a picture, and visit the url later, or, they could visit the website from their mobile device with a smart and intuitive interface, allowing them to quickly enter in the id.</div>
<div>
<br /></div>
<div>
This system would then connect you with those you have helped. You could continue to watch progress, see how the money was spent whether it be on housing, education, child resources, etc. </div>
<div>
<br /></div>
<div>
The big benefit today of Facebook is allowing us to connect and participate in peoples lives we care about. Why can't we connect and participate in the lives of those who need our help the most?</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
So now we have identified the problem and what we might be able to do to solve it... now where is this system going to come from, how will it be managed, how will we make sure there isn't corruption, how do we facilitate distribution of funds... these are all questions I do not have an answer. I know using Google App Engine for the back end, some jQuery and JSP pages, a credit card processor, and banking api's are a great start but there is a large amount of work that would be needed to pull this off. </div>
<div>
<br /></div>
<div>
Here is my proposal, I need help talking through these points, talking about this idea, starting a discussion... Is this a smart idea... does it make sense... do we think it would work? </div>
<div>
<br /></div>
<div>
What do you think?</div>
<div>
<br /></div>
<div>
<br /></div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-8798980539847075082014-09-19T17:29:00.002-04:002014-09-20T07:24:23.275-04:00Java EE Page View Servlet : Simple app analyticsFor this post I'm going to show how you can provide a simple page view recorder using a couple lines of html and java. Sometimes you want to record simple analytics about page views in your jsp/servlet based java web application. You could always attach Google Analytics but you may have an internal application which you do not want to tell Google about. In that case here is some sample code to allow you to do this easily yourself.<br />
<br />
<i>* Note: I get my user information from a session variable called user as an example.</i><br />
<br />
<br />
In your JSP or HTML page:<br />
<br />
<div style="font-family: Monaco; font-size: 11px;">
<img src=<span style="color: #9c1302;">"/yourappscontextpath/PageView.servlet?page=</span><%=request.getRequestURI().toString()%><span style="color: #9c1302;">"</span> style="display: <span style="color: #9c1302;">none</span>;" /></div>
<div style="font-family: Monaco; font-size: 11px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="font-family: Times; font-size: small;"><i>* Note: Replace the text yourappscontextpath with your actual applications context path.</i></span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="font-family: Times; font-size: small;"><i><br /></i></span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="font-family: Times; font-size: small;"><br /></span></div>
Create a new Servlet called PageViewServlet and set up the servlet mapping to point to PageView.servlet:<br />
<br />
In the doGet method add the following code:<br />
<br />
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">protected</span> <span style="color: #931a68;">void</span> doGet(HttpServletRequest <span style="color: #7e504f;">request</span>, HttpServletResponse <span style="color: #7e504f;">response</span>) <span style="color: #931a68;">throws</span> ServletException, IOException {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>User <span style="color: #7e504f;">user</span> = (User) <span style="color: #7e504f;">request</span>.getSession().getAttribute(<span style="color: #3933ff;">"user"</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #7e504f;">page</span> = <span style="color: #7e504f;">request</span>.getParameter(<span style="color: #3933ff;">"page"</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Add your own code here to save the user and page to the database or to a file.</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div>
<br /></div>
<div>
Now you can view each time a user accesses a certain page in your application using this simple process. Enjoy!</div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-23800574281429523002014-09-13T15:13:00.002-04:002015-12-11T18:06:12.937-05:00Teaching programming using a simple game written in html css javascriptThis tutorial has been created to teach individuals some of the basics of programming using a browser and html/css/javascript. The purpose of the game is to quickly find each letter or number presented. If you click on the correct item you receive 1 point and the wrong item you lose a point.<br />
<br />
The game uses a handful of concepts in programming like loops, conditionals, functions, arrays and more to help show how things work under the hood. I hope you enjoy the game but more importantly learn a little programming in the process!<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMoTSs4aSz3FMuK2BJM_69ML62sfgS_vP0WLh92QTPPxwKzJjE4eAmiE9ysG0kgyYOFA0JVhOKP5gd_W7PYUZW3C0ep70FlCEdeKVqwjV_i5Tzwz2M-H1UMPL3mxQ9Bu8s9HA-FsWsBaaU/s1600/Screen+Shot+2014-09-15+at+7.28.16+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="472" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMoTSs4aSz3FMuK2BJM_69ML62sfgS_vP0WLh92QTPPxwKzJjE4eAmiE9ysG0kgyYOFA0JVhOKP5gd_W7PYUZW3C0ep70FlCEdeKVqwjV_i5Tzwz2M-H1UMPL3mxQ9Bu8s9HA-FsWsBaaU/s1600/Screen+Shot+2014-09-15+at+7.28.16+PM.png" width="640" /></a></div>
<br />
<br />
<br />
Files Involved<br />
<br />
<ul>
<li>findit.html: This is the markup file which is directly accessed in the browser. This page sets up a basic user interface. A important aspect of this markup page is the <head></head> section of the page. This sets up our design file (findit.css) and our logic file (findit.js). </li>
<li>findit.css: This file contains the styling for our game including colors, sizes, borders and more. The type of file is a cascading style sheet file denoted by the .css at the end of the file. </li>
<li>findit.js: Here is where the real fun stuff takes place. This is the javascript file for our game and contains the logic which handles starting and stopping the game, adding and removing points, saving scores, and randomly assigning locations on the game board for our letters and numbers.</li>
</ul>
<div>
You can view the game here at <a href="http://www.broadlyapplicable.com/findit" target="_blank">www.broadlyapplicable.com/findit</a>. Using view source you can see the html markup created for the game. Below are the includes for the styling css file and the logic javascript file:</div>
<div>
<br /></div>
<div>
<div class="p1">
<span class="s1"><</span>head<span class="s1">></span></div>
<div class="p2">
<span class="s1"> <</span><span class="s3">link</span><span class="s2"> </span><span class="s4">rel</span><span class="s2">=</span>"stylesheet"<span class="s2"> </span><span class="s4">href</span><span class="s2">=</span>"http://www.broadlyapplicable.com/findit.css"<span class="s2"> </span><span class="s4">type</span><span class="s2">=</span>"text/css"<span class="s2"> </span><span class="s1">/></span></div>
<div class="p2">
<span class="s1"> <</span><span class="s3">script</span><span class="s2"> </span><span class="s4">type</span><span class="s2">=</span>"text/javascript"<span class="s2"> </span><span class="s4">src</span><span class="s2">=</span>"http://www.broadlyapplicable.com/findit.js"<span class="s1">></</span><span class="s3">script</span><span class="s1">></span></div>
<div class="p1">
<span class="s1"></</span>head<span class="s1">></span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1">You can view those files directly by replacing the url .html part with .css or .js. Here are handy links for you also:</span></div>
<div class="p1">
<span class="s1"><br /></span></div>
<div class="p1">
<span class="s1"><a href="http://www.broadlyapplicable.com/findit.css" target="_blank">www.broadlyapplicable.com/findit.css</a></span></div>
<div class="p1">
<a href="http://www.broadlyapplicable.com/findit.js" target="_blank">www.broadlyapplicable.com/findit.js</a></div>
<div class="p1">
<br /></div>
<div class="p1">
Looking at the logic file (findit.js) here are a few of the important methods and items to study and understand. Notice I have left a few console.log("..."); lines in the script. These output to your browser console. If you use chrome for example you can hit F12 (on Windows) or View/Developer/Developer Tools on a Mac to access the browser console. Here you can log any message like variable values so you can see what is occurring in the application.</div>
<div class="p1">
<br /></div>
<div class="p1">
Some concepts found in the game:</div>
<div class="p1">
</div>
<ul>
<li>Looping / Iterating</li>
<ul>
<li>loadTable()</li>
<ul>
<li>This method loops over the available letters or numbers array and creates buttons for the game which can be clicked. It also uses a random number generator to get the color of the button border. This method calls another method called shuffle(array) and changes the order of the letters and numbers so each time you play the layout is different.</li>
</ul>
<li>showScores()</li>
<ul>
<li>This method iterates on the stored scores in your local browser database and displays the initials and score.</li>
</ul>
<li>askQuestion()</li>
<ul>
<li>This method is used to determine what to display from the list of available letters and numbers and uses a while loop to continue checking each randomly chosen value against the previously used values until one is found. Once that happens a variable called badQuestion is set to false which breaks the while loop and returns the question.</li>
</ul>
</ul>
<li>Conditionals (if / else statements):</li>
<ul>
<li>determineLetterOrNumber(itm)</li>
<ul>
<li>This method takes the item chosen that is passed into the method and checks the number and letter arrays to determine if the item is a letter or number. This is used when asking the question "Find the Letter or Find The Number ..... ".</li>
</ul>
<li>testForFinishGame()</li>
<ul>
<li>This method checks the array of items already chosen against the available numbers total, when these numbers match you have successfully cleared the board and the game is finished.</li>
</ul>
</ul>
<ul><ul>
</ul>
</ul>
<li>Variables</li>
<ul>
<li>numbers : This is an array of numbers.</li>
<li>letters : This is an array of letters</li>
<li>lettersAndNumbers : This is a array created by combining the values from the letters and numbers array.</li>
<li>removedLettersAndNumbers : This array contains items which have been chosen and clicked on already. (notice in the startGame() method I set the length of this array to 0. This removes all the items from the array).</li>
<li>started : This is a true/false value which allows the game to know if it is currently running or not.</li>
<li>stopTimer : This value is used in the startTimer() method to set to true or false when creating the inner function for onTimer(). </li>
<li>questionIndex : The index position of the chosen letter/number to find.</li>
<li>questionValue : This holds the letter or number you are trying to find.</li>
<li>points : this one should be obvious :)</li>
</ul>
<li>HTML 5 Local Storage</li>
<ul>
<li>supports_html5_storage() : This methods determines if we can use the browsers local storage system to persist your scores from game to game.</li>
<li>getScores() : Retrieves your scores from local storage.</li>
<li>showScores() : Displays scores at the bottom of the game.</li>
<li>saveScores() : Saves your score in local storage</li>
</ul>
<li>CSS Manipulation</li>
<ul>
<li>updateStartButton() : This method changes the start/stop button text and color</li>
</ul>
<ul>
</ul>
</ul>
<div>
<br /></div>
<div>
Comments and questions are always welcome, I hope you enjoy the game, please pull the source down to your local machine and hack away!<br />
<br />
<br />
This application code has been uploaded to github. Please visit <a href="https://github.com/dtbell99/FindIt" target="_blank">https://github.com/dtbell99/FindIt</a> for the most recent source code.</div>
<br />
<div class="p1">
<br /></div>
<div class="p1">
<br /></div>
</div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-20180545374241942122014-09-11T11:42:00.002-04:002014-09-11T11:53:23.872-04:00Query the Internet Chunk Norris Database using Java and GsonThis tutorial will show you how to use Java and the Google Gson library to query the Internet Chuck Norris Database and return a quote you can display in your application.<br />
<br />
<br />
Step 1: Download Google Gson here: <a href="https://code.google.com/p/google-gson/" target="_blank">https://code.google.com/p/google-gson/</a><br />
<br />
Step 2: Familiarize yourself with the icndb rest api: <a href="http://www.icndb.com/" target="_blank">http://www.icndb.com</a><br />
<br />
Step 3: Create a new Java project in your favorite IDE or editor and add the Gson jar library to your application and class path.<br />
<br />
Step 4: Create a new class called Value.java:<br />
<br />
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">package</span> com.broadlyapplicable.icndb;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
public<span style="color: black;"> </span>class<span style="color: black;"> Value {</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>private<span style="color: black;"> </span>int<span style="color: black;"> </span><span style="color: #0326cc;">id</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">private</span> String <span style="color: #0326cc;">joke</span>;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> Value() {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">int</span> getId() {</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #0326cc;">id</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">void</span> setId(<span style="color: #931a68;">int</span> <span style="color: #7e504f;">id</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">this</span>.<span style="color: #0326cc;">id</span> = <span style="color: #7e504f;">id</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> String getJoke() {</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #0326cc;">joke</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">void</span> setJoke(String <span style="color: #7e504f;">joke</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">this</span>.<span style="color: #0326cc;">joke</span> = <span style="color: #7e504f;">joke</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Step 5: Create a new class called Quote.java:</div>
<div>
<br /></div>
<div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">package</span> com.broadlyapplicable.icndb;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
public<span style="color: black;"> </span>class<span style="color: black;"> Quote {</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">private</span> String <span style="color: #0326cc;">type</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">private</span> Value <span style="color: #0326cc;">value</span>;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> Quote() {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> String getType() {</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #0326cc;">type</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">void</span> setType(String <span style="color: #7e504f;">type</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">this</span>.<span style="color: #0326cc;">type</span> = <span style="color: #7e504f;">type</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> Value getValue() {</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #0326cc;">value</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">void</span> setValue(Value <span style="color: #7e504f;">value</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">this</span>.<span style="color: #0326cc;">value</span> = <span style="color: #7e504f;">value</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div>
<br /></div>
<div>
Step 6: Create a new class called RestUtil.java which will return a Quote object you can then use inside your application:</div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="font-family: Times; font-size: small;"><br /></span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="font-family: Times; font-size: small;"><br /></span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">package</span> com.broadlyapplicable.icndb;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> java.io.BufferedReader;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> java.io.IOException;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> java.io.InputStreamReader;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> java.net.HttpURLConnection;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> java.net.URL;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">import</span> com.google.gson.Gson;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">public</span> <span style="color: #931a68;">class</span> RestUtil {</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #3933ff; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #931a68;">private</span><span style="color: black;"> </span><span style="color: #931a68;">static</span><span style="color: black;"> </span><span style="color: #931a68;">final</span><span style="color: black;"> String </span><span style="color: #0326cc;">URLPATH</span><span style="color: black;"> = </span>"http://api.icndb.com/jokes/random"<span style="color: black;">;</span></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>private<span style="color: black;"> </span>static<span style="color: black;"> </span>final<span style="color: black;"> String </span><span style="color: #0326cc;">METHOD</span><span style="color: black;"> = </span><span style="color: #3933ff;">"GET"</span><span style="color: black;">;</span></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>private<span style="color: black;"> </span>static<span style="color: black;"> </span>final<span style="color: black;"> String </span><span style="color: #0326cc;">CONTENT_TYPE</span><span style="color: black;"> = </span><span style="color: #3933ff;">"application/json"</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> RestUtil() {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> Quote getQuote(String <span style="color: #7e504f;">types</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #7e504f;">jsonFromRestCall</span> = getJson(<span style="color: #7e504f;">types</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Gson <span style="color: #7e504f;">gson</span> = <span style="color: #931a68;">new</span> Gson();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Quote <span style="color: #7e504f;">quote</span> = <span style="color: #931a68;">null</span>;</div>
<div style="color: #7e504f; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #931a68;">if</span><span style="color: black;"> (</span>jsonFromRestCall<span style="color: black;"> != </span><span style="color: #931a68;">null</span><span style="color: black;"> && !</span>jsonFromRestCall<span style="color: black;">.isEmpty()) {</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">quote</span> = <span style="color: #7e504f;">gson</span>.fromJson(<span style="color: #7e504f;">jsonFromRestCall</span>, Quote.<span style="color: #931a68;">class</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.<span style="color: #0326cc;">out</span>.println(<span style="color: #7e504f;">jsonFromRestCall</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #7e504f;">quote</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">private</span> String getJson(String <span style="color: #7e504f;">types</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #7e504f;">urlPath</span> = <span style="color: #0326cc;">URLPATH</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">if</span> (<span style="color: #7e504f;">types</span> != <span style="color: #931a68;">null</span> && !<span style="color: #7e504f;">types</span>.isEmpty()) {</div>
<div style="color: #7e504f; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>urlPath<span style="color: black;"> = </span>urlPath<span style="color: black;"> + </span><span style="color: #3933ff;">"?limitTo="</span><span style="color: black;"> + </span>types<span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuilder <span style="color: #7e504f;">resp</span> = <span style="color: #931a68;">new</span> StringBuilder();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>BufferedReader <span style="color: #7e504f;">bufferedReader</span> = <span style="color: #931a68;">null</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">try</span> {</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>HttpURLConnection <span style="color: #7e504f;">conn</span> = getConnection(<span style="color: #7e504f;">urlPath</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">bufferedReader</span> = <span style="color: #931a68;">new</span> BufferedReader(<span style="color: #931a68;">new</span> InputStreamReader(</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">conn</span>.getInputStream()));</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #7e504f;">lne</span> = <span style="color: #931a68;">null</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">while</span> ((<span style="color: #7e504f;">lne</span> = <span style="color: #7e504f;">bufferedReader</span>.readLine()) != <span style="color: #931a68;">null</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">resp</span>.append(<span style="color: #7e504f;">lne</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} <span style="color: #931a68;">catch</span> (Exception <span style="color: #7e504f;">e</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">e</span>.printStackTrace();</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span>finally<span style="color: black;"> {</span></div>
<div style="color: #7e504f; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="color: #931a68;">if</span><span style="color: black;"> (</span>bufferedReader<span style="color: black;"> != </span><span style="color: #931a68;">null</span><span style="color: black;">) {</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">try</span> {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">bufferedReader</span>.close();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} <span style="color: #931a68;">catch</span> (Exception <span style="color: #7e504f;">e2</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">e2</span>.printStackTrace();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">return</span> <span style="color: #7e504f;">resp</span>.toString();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">private</span> HttpURLConnection getConnection(String <span style="color: #7e504f;">urlPath</span>) <span style="color: #931a68;">throws</span> IOException {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>URL <span style="color: #7e504f;">url</span> = <span style="color: #931a68;">new</span> URL(<span style="color: #7e504f;">urlPath</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>HttpURLConnection <span style="color: #7e504f;">conn</span> = (HttpURLConnection) <span style="color: #7e504f;">url</span>.openConnection();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">conn</span>.setRequestMethod(<span style="color: #0326cc;">METHOD</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">conn</span>.addRequestProperty(<span style="color: #3933ff;">"Context-Type"</span>, <span style="color: #0326cc;">CONTENT_TYPE</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #7e504f;">conn</span>.setDoOutput(<span style="color: #931a68;">true</span>);</div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
<span style="color: black;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span>return<span style="color: black;"> </span><span style="color: #7e504f;">conn</span><span style="color: black;">;</span></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div>
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<br /></div>
Step 7: Create a new class called Test.java and call the new RestUtil getQuote method passing in the types of quotes you wish to be queried after reviewing the rest api from the link above.<br />
<br />
<div style="font-family: Monaco; font-size: 11px;">
<span style="color: #931a68;">package</span> com.broadlyapplicable.icndb;</div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="color: #931a68; font-family: Monaco; font-size: 11px;">
public<span style="color: black;"> </span>class<span style="color: black;"> Test {</span></div>
<div style="font-family: Monaco; font-size: 11px; min-height: 15px;">
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #931a68;">public</span> <span style="color: #931a68;">static</span> <span style="color: #931a68;">void</span> main(String[] <span style="color: #7e504f;">args</span>) {</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>String <span style="color: #7e504f;">types</span> = <span style="color: #3933ff;">"nerdy"</span>;</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>RestUtil <span style="color: #7e504f;">restUtil</span> = <span style="color: #931a68;">new</span> RestUtil();</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Quote <span style="color: #7e504f;">quote</span> = <span style="color: #7e504f;">restUtil</span>.getQuote(<span style="color: #7e504f;">types</span>);</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.<span style="color: #0326cc;">out</span>.println(<span style="color: #7e504f;">quote</span>.getValue().getJoke());</div>
<div style="font-family: Monaco; font-size: 11px;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: Monaco; font-size: 11px;">
</div>
<div style="font-family: Monaco; font-size: 11px;">
}</div>
<div>
<br /></div>
<div style="font-family: Monaco; font-size: 11px;">
<br /></div>
<div>
Step 8: Run the Test class and you should see output similar to below:<br />
{ "type": "success", "value": { "id": 529, "joke": "Chuck Norris doesn't use Oracle, he is the Oracle.", "categories": ["nerdy"] } }<br />
Chuck Norris doesn't use Oracle, he is the Oracle.</div>
<br />
<br />
<div>
I hope you enjoyed this tutorial, if you have questions or comments please leave them below, happy coding!</div>
</div>
David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0tag:blogger.com,1999:blog-4487066978449658272.post-25964612800071451252014-09-03T09:12:00.001-04:002014-09-11T11:54:52.837-04:00Welcome<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Hello and welcome to the Broadly Applicable blog. I have created this blog to dump out code, concepts, and ideas while doing Java, Groovy, Scala, Swift, Javascript, and other language programming. </span><br />
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;"><br /></span>
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">I have always repeated the saying that if you love what you do you don’t work a day in your life. With computer programming I have had the luxury of feeling like that for years and hopefully I am blessed with many more. So welcome to this blog! I hope you find the content meaningful and please reach out if you have any comments or concerns!</span><br />
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;"><br /></span>
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Thanks,</span><br />
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">David Bell</span><br />
<span style="background-color: white; color: #111111; font-family: Verdana, sans-serif; font-size: 13px; line-height: 20px;">Broadly Applicable LLC Founder/Engineer</span><br />
<a href="http://www.broadlyapplicable.com/" target="_blank">www.broadlyapplicable.com</a>David Bellhttp://www.blogger.com/profile/11287676301594838253noreply@blogger.com0