Hackdance & Second Government

Dru and I participated in Hackdance this past weekend. It was a 48 hour hackathon at the Deer Valley Lodges in Park City as a part of Collective's Disruptfilm event at Sundance Film Festival. From the site:

Hackdance: the first celebrity-driven social impact hackathon kicks off on January 16th, & you're invited to take part in this historical event! Your mission: partner your tech skills w a celebrity passionate about changing the world to design apps/hacks that use technology to create social impact.

We took school and work off on Thursday and Friday, not quite sure what we'd gotten ourselves into. Dru brought her product management and design skills to the game and I came in with my iOS and Android background. The event started with the celebrities sharing their ideas for social impact. There were a lot of good ideas, including the use of Plexi APIs for reporting and preventing cyber-bullying, an ambitious but thoughtful idea for virtual second government, and a movement for improving the Plant-a-Fish donation collection, among other ideas. Dru and I liked a few of the projects, and ended up joining our first choice with Alex Ebert for the idea of Second Government.

Dru and I teamed up with two "serial hackathoners" who were invited out from Silicon Valley. I think they've done something like 15+ hackathons in the past year, placing top 3 in over half of them. It was pretty cool getting teamed up together...until I realized how serious about hacking they were. With no hackathons under my belt, my most similar experiences were the BYU Mobile App Competition and Startup Weekend. Joining with a team of hackers was quite an adjustment.

The main difference was that both the mobile app competition and SW had an end goal to build a complete product or business, not just put something together for demo purposes. We had significantly different theories on how to tackle the weekend, but overall ended up with a pretty good balance. We ended up creating a semi-functional Reddit- and Stack Overflow-inspired website and iOS app, featuring proposals for governmental change and a system of comments and upvotes.

The goal of the platform is to provide an open system for proposing governmental change without all the bureaucracy and pessimism. Ideas are then voted, vetted, and refined, with the most popular suggestions rising to the top. While most people don't bother voicing their opinions on government because of little hope it will ever be heard, SecondGov provides the platform to test out ideas in a virtual world without the worry of what can or can't be accomplished. Ultimately, proven, popular ideas from SecondGov can be taken (with their tens or hundreds of thousands of upvotes) to the real government to make real change happen.

The team

The team

Alex, who won a golden globe for best original score just last week, was awesome to work with. He was definitely the most hands-on and supportive of the celebrities from my perspective. He spent a lot of time working with us on the direction of the app, design, and prepping for our pitch. Plus, he's an artist, a writer, and a performer... he knows how to make a point with some conviction.

Dru making an awesome face

Dru making an awesome face

Our pitch to the judges went well. We definitely bit off more than we could chew by working on a web app, iOS app, exploring a virtual reality platform, and trying out a pre-release iOS motion-tracking SDK by Plantronics in the two days. Our demo included a piece from all four, but my personal favorite was the Plantronics concept headset. We used it in conjunction with the iOS app to view proposals hands-free and upvote or downvote them with a nod or shake of the head. It wasn't necessarily a cornerstone piece to the premise of SecondGov, but it was fun to work with one of the hackathon sponsors and brought a little wow factor into the pitch. I'll post a video later if I get my hands on it.

Pitching to the judges

Pitching to the judges

The result was awesome. We won first place for social innovation, including a 5k cash prize and a 10k investment from the Sorenson Global Impact Investing Center.

Alex sharing the vision

Alex sharing the vision

Awesome projects from every single team. Other final products included a Google Chrome extension for reporting cyber-bullying, YoungStarter, improvements to the Plant-a-Fish donation system, Rah Rah's tech truck, a SHFT mobile app, and a Lead and Pledge movement to end domestic violence.

Related links

Growing Pains is Making a Comeback

If you know me personally, you probably knew that I worked on an app called Growing Pains for last year's BYU Mobile App Competition. It's a photo journal designed to help you easily capture photos of your growing child. The interface is designed to allow you to quickly browse through and see your child's growth over various time periods (ideal for newborns and toddlers -- or puppies). While Growing Pains was a success in the competition, winning over $2000 value in awards and placing 5th overall, unfortunately it has not yet seen the light of day.

A partner on the project and I have been talking recently about bringing it back to life, and last week while at Cocoa Camp Apple challenged us to bring our own ideas to work on, so I did just that. On Monday of last week I ctrl+shift+N'ed a new project in Xcode and started clean. Did this for several reasons, firstly, because Cocoa Touch changes so much from year to year that I'm sure our existing code base would require some amount of updating to get in line with the latest conventions and best practices. Secondly, and the bigger reason, is that while SDK changes have been semi-significant, changes to iOS design patterns have been EXTREMELY significant. Take the example below.

You've probably seen and heard all about iOS 7, so I'll save my personal thoughts on the change for another discussion, the important points to note are the focus on simplicity, utility, and depth. With the greater population generally familiar with smartphones, as an app designer & developer I can now eliminate the use of some of the more cutesy effects that previously communicated "tap here", "I am a menu", "this is a button", and so on. Apple has also stressed depth in the new design, despite it looking more flat than before. By adding blurs, realistic motion effects, and new levels of perspective, iOS 7 is inherently more realistic than before, albeit far less skeuomorphic.

Growing Pains is now undergoing its own transformation from the old world to the new. Here are a few of the design concepts for the new UI, shown alongside the original designs. Please feel free to jump in if you have any thoughts or suggestions. These designs are being iterated on almost daily at this point.

 

What do you think? Are there any elements of the old design that you like better, or feel are missing in the new versions? Is it any more or less intuitive than before?

Mobile App Competition Results

timeline.png

This post is long in the coming... actually should have been written at the end of November.  Brief recap about Growing Pains and how it took home some awesome awards in the BYU Mobile App Competition.  We had big plans for Growing Pains, but at the time of the submission deadline we were probably only 40-50% done with our first iteration feature set. I honestly was not expecting to take home much from the competition.  The one award I was fairly confident about was the best Ruby on Rails backend, mostly because I was guessing that we were one of the only RoR backends.

My sister Kandace and I were there and were pumped when they announced Growing Pains as a top-16 semifinalist out of 25, with a guaranteed $250 cash prize.  Dru couldn't make it because it was during the day and she would have to miss work.  All 16 semi-finalists gave a 2 minute demo and presentation on their app, which was exciting for me.  I've never made a pitch to 500 people before.

Then the awards... Kandace and I were super stoked when the first award they gave out -- BizVector award for business potential from MokiNetworks -- was given to Growing Pains!  $100 gift card.  Sweet!  Next up the finalists.  Again, the very first app they announced (which just added to the excitement and surprise) was Growing Pains, 5th place with a $1000 cash prize.  Other top apps included a couple games and 2 business productivity apps, with a top cash prize of $3000.  We also won the Ruby on Rails API award, which was a iPad for each team member.  In total we came away with $2100 in awards and prize money, plus a heavy dose of validation and encouragement about our idea and the direction Growing Pains was heading.

finalists.png

We've continued working on Growing Pains and recently started beta testing with couple family members.  If you're interested in giving us some pre-release feedback - let me know!

Cow Tipping Updates

I decided to put a few hours into my very first Android app, Cow Tipping, over the weekend (originally released 8/1/2011).  If you haven't seen it before, the gameplay consists of tapping on cows repeatedly to make them tip over, trying to tip as many as you can in 20 seconds.  It was a pretty fun first-timer project for me, and since pushing out a bug-patched version 2 last fall, it has now gone untouched for 13 months. After getting familiar with my old code again (which included a lot of "huhs" and "why in the worlds"... n00b mistakes), I started getting pretty excited again.  Believe it or not, Cow Tipping has averaged about 1000 downloads a month since its release, totaling nearly 14,000 total downloads today.   While the app itself doesn't provide much value to anyone, really, and only sits at about 1700 active installs, I started to imagine the possibilities if I invested some time into adding new modes of gameplay or some system of levels.

Screen Shot 2012-10-16 at 9.00.47 AM

Screen Shot 2012-10-16 at 9.00.47 AM

I decided to give it a test run by adding a "Frenzy Mode" in addition to the classic gameplay.  In frenzy mode, cows tip over with a single click, as opposed to the variable number of clicks in the original release (random number between 2 and 5).  Took me about 5 hours to clean things up, add the new gameplay mode, update the high scores screen, and add a Twitter share.  I pushed out the update Monday night at about 7 PM and noticed it live at 9 PM. If it goes well then maybe it'll be worth adding more levels.

Get Cow Tipping on Google Play!

Twitter Share - Android

Been working on a twitter share using the ACTION_SEND intent rather than the more cumbersome Twitter APIs. [css]

// Call find twitter client to get the twitter clients to post to 
Intent shareIntent = findTwitterClient();
shareIntent.putExtra(Intent.EXTRA_TEXT, "test");
startActivity(Intent.createChooser(shareIntent, "Share"));

findTwitterClient will call this method, which will search the phone for various Twitter clients, and launch the tweet through the first client it successfully matches:

public Intent findTwitterClient() {
final String[] twitterApps = {
// package // name - nb installs (thousands)
"com.twitter.android", // official - 10 000
"com.twidroid", // twidroid - 5 000
"com.handmark.tweetcaster", // Tweecaster - 5 000
"com.thedeck.android" }; // TweetDeck - 5 000 };
Intent tweetIntent = new Intent();
tweetIntent.setType("text/plain");
final PackageManager packageManager = getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(
tweetIntent, PackageManager.MATCH_DEFAULT_ONLY);

for (int i = 0; i < twitterApps.length; i++) {
for (ResolveInfo resolveInfo : list) {
String p = resolveInfo.activityInfo.packageName;
if (p != null && p.startsWith(twitterApps[i])) {
tweetIntent.setPackage(p);
return tweetIntent;
}
}
}
return null;
}

Using PHP and LDAP to Authenticate Against BYU's Servers

Been working on a BYU project at the law school where I only want to let BYU students post on a message board.  I needed an authentication solution and decided to give LDAP a try since I've heard it's relatively simple.  Here's the two step process: 1) Create a form that accepts a username and password as follows.

<form action=login.php method=post name=Auth>

Please log in using your NetID and password:<p>

<table cellspacing=3 cellpadding=3> <tr> <td>Username: </td> <td><input type=text name=username size=16 maxlength=15></td> </tr> <tr> <td>Password: </td> <td><input type=password name=password size=16 maxlength=15></td> </tr> <tr> <td colspan=2><input type=submit value=Authenticate style='width:100'></td> </tr> </table> </form>

 2) Create a login.php file.  This file accepts the username and password from the form, then connects to BYU's LDAP server (ldap://ldap.byu.edu - port 389).  After connecting, it binds the connection using the username (NetID) and if successful returns true.  Below, the authenticate function is called and if successful sets the 'loggedin' session variable to 'true' (not a boolean).  It then redirects back to the previous page, which, in this example is the message board I'm working on.

<head> <?php session_start(); ?> </head>

<?php

echo "test"; echo "</br>";

// get username and password from form $username = $_POST['username']; $password = $_POST['password'];

/* * checks the credentials against the LDAP server * $user - RouteY * $pass - password */ function authenticate($user,$pass){

echo "</br>"; echo "Authenticating..." . $user;

// prevents guest account access if($pass == ""){ return false; }

try{

$Yldap_location = "ldap://ldap.byu.edu"; $ldap_port = 389;

// call the ldap connect function $Ydatabase = ldap_connect($Yldap_location, $ldap_port);

// bind the connection $good = @ldap_bind($Ydatabase, "uid=".$user.",ou=People,o=BYU.edu", $pass);

if($good){ // valid credentials return true; } else{ // invalid credentials return false; }

} catch(Exception $e){ return false; } }

// call authenticate function if(authenticate($username,$password)){

// authenticate successful echo "</br>"; echo "SUCCESS";

// set session $_SESSION['loggedin'] = 'true';

// redirect echo $_SESSION['loggedin']; $url = "http://www.law2.byu.edu/page/messageboard.php"; //$url = "http://www.law2.byu.edu/page/messageboard.php"; header("Location: ".$url); } else{

// authenticate fails echo "</br>"; echo "FAIL";

// redirect to login header("Location: http://www.law2.byu.edu/page/messageboard.php"); } ?>

Candy Jar Estimator Launches

unnamed.png

Yesterday Bryce (my business partner) and I launched "Candy Jar Estimator" on the Android Market.  It's designed to help you win candy guessing competitions - it takes your candy, the jar type, any custom jar measurements, and computes the expected number of candies in the jar.  Basically it means automatic WIN if you use it the next time a candy estimating competition rolls around at work, church, holiday festivities, etc.  so... it's pretty awesome.

Anyway we've also entered our app in the BYU mobile app competition.  The competition runs through November 16 and there are several prizes that we could potentially take home, including $6000 grand prize, $3000 judge's prize, and a local company's choice: brand new iPads for all team members.  If you'd like to help our team out here a few things you could do.

unnamed
  1. If you have an Android phone, download the app (yes it costs a dollar), l eave a 5 star rating and a SUPER AWESOME comment.
  2. Tell your Android friends to download it and leave some awesome reviews for us.  Say "my brother is entering his android app into BUY's mobile app competition. check...it...OUT! http://bit.ly/tmlitR" (and then make sure they download it and not just look at it)
  3. Even if you don't have an Android, you can help us by +1-ing our app on the Android Market. go here (http://bit.ly/tmlitR) and click the +1 button on the top right of the screen.

The biggest help will probably be sharing, so if you want to tweet it, Facebook it, or blog it that would be very helpful.  Also - if you have friends that are big blogger's a little spotlight from their blog goes a LONG way.

Available in Android Market

Dropdown Menu in PHP

Browsing around the web you'll notice tons of drop-down menus that let you navigate to different areas of that web site.   Drop down menu navigation is great because it lets you add a lot of navigation options, without taking up much space.  I know, for the web dev buffs out there you would probably never want to do this in PHP alone, but I found a cool tidbit of info on this and wanted to share.  So if you're looking for how to do this on a large-scale you probably want to turn to JavaScript.

With that said, one way to replicate a drop down menu with PHP is to setup an HTML form somewhere on your page and have it pass the site's URL to a PHP page when you submit it.  For example:

<form action="jump.php" method="post"> <select name=url> <option value="http://php.about.com">About PHP</option> <option value="http://www.identity.st">Identity</option> </select> <input type="submit" value="Go"> </form>

Then have the PHP file jump.php use basic redirection to send them to the right page.  For example:

<?php $url = $_POST["url"]; header("Location: $url"); ?>

Give it a shot!

Android Toast Example

Android lets you "toast" a display message that pops up on top of the current window. This usually occurs on some condition and is generally simple in nature, something like "OK", or "File submitted", etc. The code below can be plugged into any android class to launch a toast.

    Toast toast = Toast.makeText(getApplicationContext(), "Invalid Parameter", Toast.LENGTH_SHORT);
    toast.show();

This bit of code will launch a short toast that displays the text "Invalid Parameter". The length of the toast is 2 seconds, and can be changed to a longer 3.5 second toast by changing the duration(Toast.LENGTH_SHORT) to Toast.LENGTH_LONG.

Toast away!

PHP - What and Why

Who invented PHP? Rasmus Lerdorf, a guy who wrote it as CGI binaries in C in order to help manage his personal webpages (back in 1994). Lerdorf named it PHP for "Personal Home Page". Later it was renamed "PHP: Hypertext Preprocessor" by some of the colleagues Lerdorf teamed up with in order to improve on PHP and make it more standardized. Why use PHP?

  • Open source/FREE
  • Cross platform (Windows, Mac, Linux)
  • Powerful, robust, scalable (it'll be able to handle the traffic growth)
  • Web development specific (unlike java, ruby on rails, c, and others)
  • Large developer community
Resources:

Getting Started Project as a "Web Specialist"

Starting my new job as a web specialist for the BYU Law School this week.  The getting started project is as below... super stoked. Create a page using php, mysql and html where users can login or sign up and fill in forms about themselves (first name, last name, age, email address). Provide a spot for them to upload a document of type pdf, reject other types of uploads. Also, create a field that uses CKeditor to get a quick "user blurb" or description of themselves. After they are logged in, have a page in which all users are listed and linked to their profiles which will appear in a Colorbox when clicked upon. Be sure to style everything using CSS. Things you will need to know to do this:

    • How to create a form and use php post variables
    • How to upload and check uploaded documents
    • Session variables in php
    • How to create and use a correctly structured MYSQL database
    • How to use Colorbox
    • How to use CKeditor
    • How to do CSS styling

Tip: We highly recommeded thoroughly completing Lynda.com's PHP with MySQL Essential Training course to assist in preparing for the training exercise.

 

Dec 2011 update: See my mini content management system - still a work in progress.

So excited I can't sleep

Seriously, I can't sleep.  I'm sitting here in Eclipse messing with these layouts and getting stoked for the BYU Mobile App Competition.  A partner and I are developing a super awesome Android app that is going to be a blast.  Too bad I can't say what it is yet.  But, in about three weeks we should be ready to push it out.  We're under way right now and will be working on it as much as possible to get it ready for the competition. Man, I feel like saying more but I guess I won't for now.  People could be out there snatching up our idea as we speak.  That sucks.  But believe me once it's out there I'll be all about spreading the news.  The cool thing is that this app has never been done before on Android, it's a fresh market!  There's one on the iOS app store, but it's lame.  Maybe we'll try xcode and iphone development if this goes well.

Here's how the BYU mobile app competition works:

  • Teams of 1 to 4, with at least one member a current BYU student
  • Build your app for Android, iOS, WP7, or Blackberry
  • Release it to the Market/App Store November 2-16
  • Cash prizes as follows:
  • Grand Prize: $6,000
  • Analytics 1st Place: $3,000
  • Judged 1st Place: $3,000
  • Analytics 2nd Place: $1,500
  • Judged 2nd Place: $1,500
  • Audience Choice: All team members will be awarded with an iPad 2 (or 3). This award will be based on audience input at the final event
Basically there's a grand prize, a first and second for most popular based off the analytics, and a first and second based off the judge's opinions.  Then there's iPad prizes for audience choice.  So there's a good chance of winning something if you have a good idea, successful implementation of that idea, and a killer marketing strategy.  Assuming we get the product we want we're going to spread the word like wildfire.  I'm talking BYU, UVU, Utah State booths, and spreading the word all across the map... up in Washington, back in Georgia, Michigan, out in Hawaii.   I'm pumped about the whole project.
In other exciting news, Mango's came out yesterday, the $250 Amazon tablet is being announced today, and iPhone 5 is set to come out in less than a week.  This is huge!  I want an Amazon Kindle Fire tablet (or whatever it's going to be called) already.

Cow Tipping on the Steady Rise

Cow Tipping has been live on the Android Market for a month and a half now!  It's been pretty exciting to see it happen.  Granted, it's my first app and it's extremely simple, but I'm happy with it.  The app's making about a quarter a day now in admob ads and has almost 2500 downloads, 36% retention.  Trying to push out an update - possibly tonight - when I get to it.

Notes on some features to add:

  • Back button - from finished gameplay
  • Hint - for new users
  • Size Optimization - drop from 3.6 MB to under 2.0 MB
  • New finishing messages
  • Sheep - to distract from tipping the cows
  • Levels with different objectives, background, etc.

Any suggestions?  How can I make it something worth using?

Building a Web Scraper

ISYS 403.  Business oriented programming.  Goal: Program a news aggregator. Project statement: Program a news aggregator that scrapes a news page and posts the top news stories.  The assignment gives a view into how search engines and other scrapes work online.

Many sources publish the news: local radio and TV stations, the Associated Press, national and international sources, and aggregators.  Aggregators like Google News don’t actually create news stories; instead, they parse the news stories created by other sources, discover like stories, and publish a combined view.

The problem is each site on the web publishes in HTML — a plain-text, free-flowing format.  You’ll have to code a technique called page scraping.  Page scraping is programatically going through a retrieved HTML source file and picking specific data pieces, such as news headlines and links, from the HTML.

Regular expressions are one of the best text parsing techniques available.  Beyond parsing HTML, they are useful for searching through all types of free-form text.

Completed project using businessweek.com/technology:

I thought this project was awesome!  I've been wanting to see how Java interfaces with the web and this was it.  My first time using java to hit the web and it really wasn't too bad.  Downloading the URL's HTML to a string was surprisingly simple.  My code looked something like this:

        String lineOfHTML = "";         String content = "";         //download home page         try {             URL url = new URL("http://www.businessweek.com/technology/");             BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));             while ((lineOfHTML = reader.readLine()) != null) {                 content += lineOfHTML;             }             reader.close();         }  catch (IOException e) {             e.printStackTrace();         }

As you can see the hard part really isn't that hard.  I used the URL library to grab the webpage and a buffered reader to read in all the HTML, then just stored it as a string.  The samples out there on bing made it really easy to.  Try searching "download webpage in java" on bing.  You'll get a lot of hit, trust me.

Parsing the HTML to find the new stories meant looking up businessweek's HTML source code, finding the tags surrounding news stories, and using regex to grab the information we wanted, which was the name, link, and description in our case. My regex expression ended up looking like this in order to get the top two stories: String regex = ".*?href=\"(.*?)\".*?>(.*?).*?

(.*?)

.*?href=\"(.*?)\".*?>(.*?).*?

(.*?)

";  Fun eh?

So that was it.  Put it together and you have the news parser as pictured above!

ERROR: the user data image is used by another emulator. aborting

Got this error message after I restarted my system following an install prompt for another program (did not shut down the emulator first): "ERROR: the user data image is used by another emulator. aborting."  I fixed it, but had to try a couple different things.  Suggestions:

  1. If the Emulator is open, restart it
  2. If the Emulator is not opened (my case) try Run configurations > Target > Wipe user data > Run
  3. Another way to try "Wipe user data" is to click the Android SDK Manager icon in Eclipse, click the AVD you want to start, make sure you check wipe user data, then Launch.

Number 3 worked for me.