for Android Mobile Adam M Dille Masters Project Fall 2010 Masters of Engineering in Software Engineering University of Colorado at Colorado Springs Department of Computer Science Agenda ID: 742951
Download Presentation The PPT/PDF document "Pocket Beer Reference Application" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Pocket Beer Reference Application for Android Mobile
Adam M.
Dille
Masters Project - Fall 2010
Masters of Engineering in Software
Engineering
University of Colorado at Colorado Springs
Department of Computer ScienceSlide2
AgendaWhat is Homebrewing?
All About Beer Styles
Problem Statement
The SolutionDevelopmentDemonstration/Implementation/Related WorkFuture EnhancementsLessons LearnedConclusion
November 10, 2010
Pocket Beer Reference Application for Android Mobile
2Slide3
What is Homebrewing?Refers to brewing beer at home
Estimated 750,000 households in the US
Pure hobby; Illegal to sell
Complete control over all characteristicsQuality rivals expensive commercial craft brewNovember 10, 2010
Pocket Beer Reference Application for Android Mobile
3Slide4
DifficultiesMany variables to consider:
Sanitization
Temperature
TimeIngredient QualityEquipmentProcedureTechnique
November 10, 2010
Pocket Beer Reference Application for Android Mobile
4Slide5
Addressing DifficultiesForums, Wikis and Knowledge Bases
Inventions
Practice and Experience
Software ApplicationsBeer StylesNovember 10, 2010
Pocket Beer Reference Application for Android Mobile
5Slide6
All About Beer StylesProvides framework when creating a beer
Allows entry into most brewing competitions
Objectives/Assurances for characteristics
Ex: Lite Lager, Oatmeal Stout, American IPADifferent criteria for categorizationMost popular styles published by the Beer Judge Certification Program (BJCP)
November 10, 2010
Pocket Beer Reference Application for Android Mobile
6Slide7
BJCP Styles
Numerical Ranges for:
Original and Final Gravities (OG/FG)
Bitterness Level (IBU)Color (SRM)Alcohol Percentage By Volume (ABV)Text Descriptions for:
November 10, 2010
Pocket Beer Reference Application for Android Mobile
7
Aroma
Appearance
Flavor
Mouthfeel
Overall Impression
History
Comments
Ingredients
Commercial ExamplesSlide8
Project EvolutionOriginal idea was Android Beer Recipe App
Select a BJCP Style
Select Ingredients
See how closely recipe matches selected styleIn August “Brewzor Pro” was releasedPopulation and Browsing of Styles was already implemented
Didn’t want to re-invent the wheelBegan searching for new problem
November 10, 2010
Pocket Beer Reference Application for Android Mobile
8Slide9
Problem DiscoveryExperimented with filtering Styles by commercial example names
Result was very useful, but many examples weren’t included with Styles
Only around 10 examples per Style
Infrequent BJCP updates make examples staticNo reverse path from example to StyleNovember 10, 2010
Pocket Beer Reference Application for Android Mobile
9Slide10
ChallengesCommercial examples provided with BJCP styles are static and inadequate
Tough to identify BJCP Style of a specific beer
Tracking down the source of an “off flavor” in a beer is not an intuitive process
November 10, 2010
Pocket Beer Reference Application for Android Mobile
10Slide11
The SolutionFinding Commercial Examples for a BJCP Style
Use BeerAdvocate database of commercial beers
U
ses its own style listEvery beer must have an associated styleMap each BeerAdvocate Style to a BJCP StyleManual one-time mapping in CSV formatEasily updated/appended using Excel
Easily parsed by software during database population
November 10, 2010
Pocket Beer Reference Application for Android Mobile
11Slide12
The Solution
Finding Commercial Examples for a BJCP Style
Known BeerAdvocate URLs for
List of all StylesDetails of any given beerPaged listing of all beers in any given styleTop 50 beers in any given StyleFull details of any given beer
Physical image of any given beer
November 10, 2010
Pocket Beer Reference Application for Android Mobile
12Slide13
The Solution
Finding Commercial Examples for a BJCP Style
For a given BJCP Style
Pull associated BeerAdvocate Style(s) from mappingRetrieve top commercial examples of BA Style(s)Access to BeerAdvocate data uses parsingBeerAdvocate.com owners have mentioned that they hope to publish a web service API in the future
November 10, 2010
Pocket Beer Reference Application for Android Mobile
13Slide14
The SolutionFinding BJCP Style of a Specific Beer
User enters search term (Beer/Brewery name)
Google API used to search for term
Results restrained to BeerAdvocate siteApplication filters results down to beer pages onlyUser chooses a resultResult’s BA Style is found on beer pageMapping used to determine associated BJCP Style
Beer Details contain link(s) to BJCP Style DetailsBeer Details also provides link to list of similar beers
November 10, 2010
Pocket Beer Reference Application for Android Mobile
14Slide15
The SolutionNovember 10, 2010
Pocket Beer Reference Application for Android Mobile
15Slide16
The Solution
Finding BJCP Style of a Specific Beer
November 10, 2010
Pocket Beer Reference Application for Android Mobile
16
Pattern
REGEX_GoogleBeerResult
=
Pattern.
compile
(
getResources
().
getString
(
R.string.
url_BeerAdvocateBaseUrl
)
+
getResources
().
getString
(
R.string.
url_BeerAdvocateBeerBaseUrl
)
+ "/\\d+/\\d+",
Pattern.
CASE_INSENSITIVE
);
m_examples
=
new
ArrayList
<Beer>();
BufferedReader
reader =
null
;
int
maxResults
= 56;
int
resultsPerPage
= 8;
int
maxPages
=
maxResults
/
resultsPerPage
;
try
{
searchTerm
=
URLEncoder.
encode
(
searchTerm
,
getResources
().
getString
(R.string.
http_UTF8Encoding
));Slide17
The Solution
Finding BJCP Style of a Specific Beer
November 10, 2010
Pocket Beer Reference Application for Android Mobile
17
for
(
int
queryNdx
= 0;
queryNdx
<
maxPages
;
queryNdx
++) {
String
googleSearchURL
=
String.
format
(
getResources
().
getString
(
R.string.
url_GoogleRESTBeerAdvocateSearchFormat
),
searchTerm
,
resultsPerPage
,
queryNdx
*
resultsPerPage
);
reader = HTMLUtilities.
GetUTF8ReaderForURL
(
googleSearchURL
,
BeerSearchListView.
this
, "");
String
inputLine
= "";
while
((
inputLine
=
reader.readLine
()) !=
null
) {
JSONObject
obj
=
new
JSONObject
(
inputLine
);
if
(
obj.has
("
responseStatus
") &&
obj.getInt
("
responseStatus
") == 200) {
if
(
obj.has
("
responseData
")) {
JSONObject
responseData
=
obj.getJSONObject
("
responseData
");
if
(
responseData.has
("results")) {
JSONArray
results =
responseData.getJSONArray
("results
");Slide18
The Solution
Finding BJCP Style of a Specific Beer
November 10, 2010
Pocket Beer Reference Application for Android Mobile
18
for
(
int
ndx
= 0;
ndx
<
results.length
();
ndx
++) {
JSONObject
result =
results.getJSONObject
(
ndx
);
String
url
=
result.getString
("
unescapedUrl
");
if
(
REGEX_GoogleBeerResult.matcher
(
url
).matches()) {
Beer
newExample
=
new
Beer();
newExample.setProperty
(
Beer.Property.
BeerUrl
,
url
);
newExample.setProperty
(
Beer.Property.
RefererURL
,
googleSearchURL
);
String title =
result.getString
("
titleNoFormatting
");
newExample.setProperty
(
Beer.Property.
BeerName
,
title.substring
(0,
title.indexOf
(" - ")));
String content =
Html.
fromHtml
(
result.getString
("content"))
.
toString
();Slide19
The Solution
Finding BJCP Style of a Specific Beer
November 10, 2010
Pocket Beer Reference Application for Android Mobile
19
Matcher
breweryMatcher
=
Pattern.
compile
(
"from (.*?)(( in)|(<b>\\.\\.\\.</b>))").matcher(
content);
if
(
breweryMatcher.find
()) {
newExample.setProperty
(
Beer.Property.
BrewerName
, Html
.
fromHtml
(
breweryMatcher.group
(1).trim())
.
toString
());
}
m_examples.add
(
newExample
);
}
}
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=New+Belgium+site:beeradvocate.com&rsz=8&start=0Slide20
The SolutionDiagnosing “Off flavors” in a Beer
Application stores database of known flavors
Name of Compound at fault, or flavor title
Skunky, Soapy, Acetaldehyde, Diacetyl, etcFlavor characteristics/descriptors
Tart, Sweet, Medicinal, Bitter, Vinegary, etcCause
RemedyPhonetic encoding of all descriptors and titleTart = TRT, Medicinal = MTSNL, Bitter = PTR
November 10, 2010
Pocket Beer Reference Application for Android Mobile
20Slide21
The SolutionDiagnosing “Off flavors” in a Beer
User searches flavors using descriptive words
Application uses phonetic search algorithm to find possible matches
ExampleWithout phonetic encoding, searching for “Vinal” would return 0 resultsWith phonetic encoding, searching “
Vinal” would match the flavor “Chlorophenol” which contains the characteristics “Plastic, Vinyl
, Iodine”
November 10, 2010
Pocket Beer Reference Application for Android Mobile
21Slide22
DevelopmentDeveloped on Windows 7 PCs
Subversion for source control
Running on Windows 2008 Server
Remote access using public IP and domain nameNightly hotcopy backups of repository dataGoogle Tasks for project tasks and issuesAndroid SDKs for targeted versions
Eclipse IDE with Google Plug-in called ADT
November 10, 2010
Pocket Beer Reference Application for Android Mobile
22Slide23
Demonstration
November 10, 2010
Pocket Beer Reference Application for Android Mobile
23Slide24
Future EnhancementsBeerAdvocate Reviews
More useful than using mobile web browser
Pull reviews for given beer
Show using lazy loading on Beer Details ViewBeerAdvocate Brewery DetailsUse location to show nearby breweriesFor a given style, show examples brewed nearby
November 10, 2010
Pocket Beer Reference Application for Android Mobile
24Slide25
Future EnhancementsCaching of Web Data
Store Style Top Examples in database
Give entries an expiration date
Retrieve examples using non-expired cache data first, and internet data secondPhonetic Search ImprovementsOrder results by match relevanceMatches with more non-matching characters fall lower on results list
November 10, 2010
Pocket Beer Reference Application for Android Mobile
25Slide26
Lessons LearnedMy first mobile application
First Java/Eclipse work in 6 years
Resources Are Your Best Friend
Especially for database table and column namesNovember 10, 2010
Pocket Beer Reference Application for Android Mobile
26Slide27
Lessons Learned
Thread All Data Operations
UI thread alone makes performance sluggish
Android provides abstract AsyncTask classHandles Thread wiring automaticallyNotify user with Progress
Dialogs in Pre/Post functionsMakes for a snappy UI
November 10, 2010
Pocket Beer Reference Application for Android Mobile
27Slide28
Lessons Learned
Thread All Data Operations
November 10, 2010
Pocket Beer Reference Application for Android Mobile
28
private class
SearchForBeerTask
extends
AsyncTask
<String, Void, Void> {
@Override
protected void
onPreExecute
()
{
ViewUtilities.
DisplayProgressDialog
(
BeerSearchListView.
this
,
getResources
()
.
getString
(
R.string.
BeerSearch_DialogMessage
));
}
@Override
protected void
onPostExecute
(Void result) {
PopulateBeers
();
ViewUtilities.
DismissProgressDialog
(
BeerSearchListView.
this
);
}
@Override
protected Void
doInBackground
(String...
params
) {
SearchForBeer
(
params
[0]);
return null;
}
}Slide29
Lessons Learned
Use
onRetainNonConfigurationInstance
()OS re-creates View when orientation changesWithout special consideration, requires data to be downloaded each time rotation occursOverriding onRetainNonConfigurationInstance
allows return of any object for use when View is re-created in these special circumstancesBetter performance, power savings
November 10, 2010
Pocket Beer Reference Application for Android Mobile
29Slide30
Lessons Learned
Generalize as much as possible
Many views have similar structure
Consolidate common Views and associated eventsProvide class with static functions for setting element visibility and wiring up eventsWorked well for Styles List, Top Examples, Beer Search and Flavor Search viewsMakes addition of new inheriting views simple
November 10, 2010
Pocket Beer Reference Application for Android Mobile
30Slide31
Lessons Learned
Mashups
Require Special Considerations
Beer styles didn’t always map one-to-oneOne BJCP to many BeerAdvocate Style mappingsAffects fetching of Top ExamplesRoll examples of multiple BA Styles into one View
One BeerAdvocate to many BJCP Style mappingsAffects showing BJCP Style for a specific beerShow all possible BJCP Styles on Beer Details View
November 10, 2010
Pocket Beer Reference Application for Android Mobile
31Slide32
ConclusionDeveloped an Android application with useful
mashup
features to simplify certain aspects of homebrewing process
Usability of the applicationCommercialization StepsAndroid Development Impressions
November 10, 2010Pocket Beer Reference Application for Android Mobile
32Slide33
Questions
?
November 10, 2010
Pocket Beer Reference Application for Android Mobile
33Slide34
References
Published References
Speckmann
, B. (2008) The Android Mobile Platform. MSCS Masters Candidacy Review Paper. Department of Computer Science, Eastern Michigan University.
http://www.emich.edu/compsci/projects/Master_Thesis_-_Benjamin_Speckmann.pdf
Knutsen, J. (2009) Web Service Clients on Mobile Android Devices. A Study on Architectural Alternatives and Client Performance.
MSCS Masters Candidacy Thesis.
Norwegian University of Science and Technology Department of Computer and Information Science.
http://ntnu.diva-portal.org/smash/get/diva2:348784/FULLTEXT01
Ableson
, F. (2010)
Using XML and JSON with Android, Part 1: Explore the benefits of JSON and XML in Android Applications.
Technical Library.
IBM
DeveloperWorks
.
http://public.dhe.ibm.com/software/dw/xml/x-andbene1/x-andbene1-pdf.pdf
Burns, J. (2008)
Developing Secure Mobile Applications For Android. An introduction to making secure Android applications.
Technical Publication.
iSEC
Partners.
https://isecpartners.com/files/iSEC_Securing_Android_Apps.pdf
Philips, L. (2000).
The double
metaphone
search algorithm
.
C/C++ Users
J. 18, 6 (Jun. 2000),
38-43.
Web References
How
many homebrewers are there in the United States?
Talking Points.
American Homebrewers Association.
http://www.homebrewersassociation.org/pages/government-affairs/talking-points
How many gallons of homebrew in 2009?
Forum Topic.
Homebrew Talk.
http://www.homebrewtalk.com/f14/how-many-gallons-homebrew-2009-a-99440/index184.html
Google Search: ‘beer’
http://www.google.com/search?q=beer
Beer Styles.
Beer Advocate.
http://beeradvocate.com/beer/style
BJCP Competition Beer Styles.
(2008) Beer Judge Certification Program.
http://www.bjcp.org/2008styles/catdex.php
Palmer, J. (1999)
Is My Beer Ruined? Common Off-Flavors
How to Brew
http://www.howtobrew.com/section4/chapter21-2.html
Platform Versions
–
Android Developers
http://developer.android.com/resources/dashboard/platform-versions.html
Activity.onRetainNonConfigurationInstance
-
Android Developers
http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance
()
November 10, 2010
Pocket Beer Reference Application for Android Mobile
34Slide35
Demo – Activity Screen
November 10, 2010
Pocket Beer Reference Application for Android Mobile
35Slide36
Demo – Activity Screen
November 10, 2010
Pocket Beer Reference Application for Android Mobile
36Slide37
Demo – Browse Styles
November 10, 2010
Pocket Beer Reference Application for Android Mobile
37Slide38
Demo – Browse Styles
November 10, 2010
Pocket Beer Reference Application for Android Mobile
38Slide39
Demo – Browse Styles
November 10, 2010
Pocket Beer Reference Application for Android Mobile
39Slide40
Demo – Browse Styles
November 10, 2010
Pocket Beer Reference Application for Android Mobile
40Slide41
Demo – Beer Search
November 10, 2010
Pocket Beer Reference Application for Android Mobile
41Slide42
Demo – Beer Search
November 10, 2010
Pocket Beer Reference Application for Android Mobile
42Slide43
Demo – Beer Search
November 10, 2010
Pocket Beer Reference Application for Android Mobile
43Slide44
Demo – Flavor Search
November 10, 2010
Pocket Beer Reference Application for Android Mobile
44Slide45
Demo – Flavor Search
November 10, 2010
Pocket Beer Reference Application for Android Mobile
45