App Spotlight: Hero

The skilled engineers at the development shop Apptooth recently launched a new iOS application, Hero. When in distress, this innovative app helps you share your location and your surroundings with your friends and family. Using the geolocation and file upload capabilities of our SDK, Apptooth was able to build this entire app on Parse. Whether you decide to snap a picture, take a quick video or simply write a message, the app is able to upload the content and location directly to Parse. Hero also utilizes Parse’s powerful push notification platform to alert loved ones of your situation. With only a few lines of code, Push can enable an app to quickly reach a very large audience.

Apptooth was able to create both an iOS and an Android version of their app in record time without worrying about cross platform issues. Since the Android and iOS SDKs interact with the same data store and push platform, the integration between their two apps is seamless. A user on an iPhone can have heroes spread across a range of Android and iOS devices.

Creating a dependable and robust backend for mobile apps is at the core of our vision, and we are excited to be a part of Apptooth’s innovative step forward in the field of personal security. Hero has been featured on CNN, KUTV and even endorsed by Elizabeth Smart. So check out the app on the iTunes App Store or Google Play and don’t forget to like Apptooth on Facebook!

Mattieu Gamache-Asselin
June 29, 2012

Free Automated Cross-Browser JavaScript Testing

JavaScript has become the lingua franca of web development. But like any language, there are different dialects depending on just where you’re speaking. One of the most challenging tasks when developing sophisticated JavaScript applications is making sure they work across users’ sundry browsers.

For the Parse JavaScript SDK, we’ve put together a framework that automates just this. For every release of the JavaScript SDK and backend, we run our entire test suite across five different browsers. Here’s how.

Basics

This guide assumes you are running your tests on Mac OS X. Much of what we describe will work on other systems, but Mac OS X is a requirement if you want to run tests on the iOS simulator. We also assume your tests are written in QUnit. Using a different test framework should be a straightforward.

Mozilla Firefox

Firefox is the simplest browser to start building your automated testing framework. We recommend using Selenium WebDriver to do the actual browser automation. WebDriver has lots of language bindings that you can use to write your tests. To automatically run tests using the ruby driver, do something like:

require 'selenium-webdriver'
driver = Selenium::WebDriver.for :firefox
driver.get url
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
begin
    wait.until { driver.title.downcase.start_with? "u2714" }
    puts "* Passed! :)"
rescue Selenium::WebDriver::Error::TimeOutError => e
    puts "* Failed! :("
end
driver.quit

The driver.title.downcase.start_with? "u2714" condition is specific to qunit. It waits for the checkmark to appear in the page title. Depending on your test framework, you may want to use some other condition. It’s always good to have a timeout when testing JavaScript, because many JavaScript errors will cause your tests to hang indefinitely.

Google Chrome

Automating Google Chrome is only slightly more difficult. You just need to install the WebDriver driver for Chrome, and put it in your PATH. Then follow the Firefox instructions, changing :firefox to :chrome.

iOS

To get the iOS browser working, you just need to start up the iOS Simulator and run the WebDriver app inside it. The most reliable way to do that is to checkout the driver project and run it from Xcode.

svn checkout http://selenium.googlecode.com/svn/trunk/ selenium-read-only

Open the iphone/iWebDriver.xcodeproj project and click the play button. Then follow the Firefox instructions, changing :firefox to :iphone.

Android

Running tests in Android is a similar process to iOS. Install the Android SDK, create an emulator instance, and run it. Download the Android WebDriver APK and install it and run it inside the emulator. If you run into problems connecting to the driver, try different versions of Android, as the driver is most stable in some than others. We’ve had the most luck with version 2.3, Gingerbread.

Then follow the Firefox instructions, changing :firefox to :android. One extra caveat with virtual machines such as this: if you want to connect to another server running on your test machine, you can’t connect to localhost. Instead, you have to connect to the default gateway, typically 10.0.2.2.

Internet Explorer

Okay, so Chrome, iOS, and Android are all Webkit-based. If your JavaScript works in one of them, it probably works in all of them. But Internet Explorer is the black sheep of the browser world. If your tests fail in just one browser, well, you get the picture. Accordingly, automating testing in Internet Explorer is much more involved than any other browser.

Start by downloading and installing VirtualBox, which will host the virtual machine where you can run Windows. Now, you can install your own copy of Windows in a new virtual machine, or you could use the free images Microsoft provides for Internet Explorer testing, using ievms. These Windows installs are already expired, so you can’t use them for very long at a time, but they work fine for automated JavaScript tests.

To set up the Windows environment, start up the virtual machine image. Install the VirtualBox Guest Additions from the menu. Download and install the Java runtime from Oracle. Download the Selenium Server Standalone Driver and verify that it works by running it manually from the Command Prompt. You can automate running the driver with VirtualBox using a command such as:

VBoxManage guestcontrol IE8 exec 
      --image C:/Windows/System32/java.exe 
      --username IEUser --password Password1 
      -- -jar C:/Users/IEUser/Desktop/selenium-server-standalone-2.20.0.jar

You also need to set up port forwarding so that your driver can connect to the server. This should be as simple as:

VBoxManage modifyvm IE8 --natpf1 WebDriver,tcp,,4444,,4444

Finally, follow the Firefox instructions, changing the driver initialization to:

driver = Selenium::WebDriver.for(:remote, :desired_capabilities => :firefox)

As with the Android virtual machine, if you want to connect to another server running on your test machine, you can’t connect to localhost. Instead, you have to connect to the default gateway, typically 10.0.2.2.

Conclusion

That’s all you have to do to run the test suite once. If you use GitHub, you can have your tests run after every commit with CruiseControl.

Getting automatic cross-browser JavaScript testing working is a complex affair, and bound to involve some amount of trial and error. We hope that this guide will help you get started, and save you some time by giving you a framework for success.

Bryan Klimt
June 28, 2012

JavaScript SDK Now Supports Facebook Login

Using Facebook to authenticate your users has long been a favorite feature amongst Parse developers. Today, we’re happy to announce that this capability has been added to our JavaScript SDK, so your users can log into your website using their Facebook identities and your Facebook-linked user accounts can be shared between your mobile and web applications.

If you upgrade to the latest Parse JavaScript SDK, Parse.FacebookUtils has been added in order to provide support for authenticating via Facebook, and will create or log in Parse.User objects automatically. See our updated Parse Facebook documentation to see how simple we’ve made it.

For example, this is the code to sign up or log in a Facebook user:

Parse.FacebookUtils.logIn(null, {
  success: function(user) {
    if (!user.existed()) {
      alert("User signed up and logged in through Facebook!");
    } else {
      alert("User logged in through Facebook!");
    }
  },
  error: function(user, error) {
    alert("User cancelled the Facebook login or did not fully authorize.");
  }
});

Just as with our iOS and Android versions of Facebook support, the following happens when this code is executed:

  • The user is shown the Facebook login dialog.
  • The user authenticates via Facebook, the data is passed back to the Parse libraries.
  • Our library then saves the data to a Parse.User. If it’s a new user based on the Facebook ID, then that user is created, if not, they are simply logged in.

Allowing your users to log into your Parse-powered web app using their Facebook identities is now easier than ever!

David Poll
June 26, 2012

App Spotlight: Trivi.al

Trivi.al Screenshots

When it comes to mobile gaming, turn-based apps are the perfect venue for creating fun and interactive multi-player experiences. Developers who are busy creating innovative gameplay and user-centered designs don’t tend to have resources to spend developing the complex server architectures required for these apps. So, it’s no surprise that the talented team at MobileFWD built their trivia turn-based iOS game, Trivi.al, using Parse. Freed from the burden of a server, they were able to implement Trivi.al in a fraction of the time they expected.

Originally we told our investors that we would build our MVP in 4 months with 3-5 developers. We were going to use Windows Azure or a VMWare type solution. Instead we were able to built our MVP plus chat functionality, email search and sign on, an administrative tool, and an app that GONGs every time we get 5 users in 3 minutes! I believe Parse has multiplied our productivity by a factor of 2 and a half. Less developers, less hosting fees, and less time to build.

- Matt Hudson, Founder of MobileFWD

For developers like Matt Hudson, founder of MobileFWD, delegating the entire server stack to a third party was not a decision to be taken lightly. Along with a wide breadth of features, the right platform requires flexibility, high performance, and the reliability expected from today’s competitive app market. These factors played a significant role in Matt’s decision to adopt the Parse platform to power his company’s apps.

We knew our app had the potential for growth and we wanted to be ready for it. [...] Parse had all of the things we needed: queries, user management, on all platforms, and a server system that could handle a large amount of requests. [...] Trivi.al is heavily dependent upon Parse to persist our data.  All of the questions are stored in the database along with the answers that were answered correctly. We also rely heavily on Parse for user management.  Our administration panel that shows our growth for our VCs is built on the JavaScript SDK and we use User roles to limit usage to admins.

- Matt Hudson, Founder of MobileFWD

Trivi.al app
Trivi.al is already one of the top 10 trivia applications in the iOS app store, and Matt and his team are hard at work on improving their game. Head over to the app store to download Trivi.al or check out their website to see what all the fuss is about!

Mattieu Gamache-Asselin
June 25, 2012

New Atomic Operations for Arrays

Atomically changing an object is great when multiple clients might be trying to simultaneously modify the object or when you want to make a small change to a field without first refreshing the object. Our atomic counter increment feature has gotten some great usage so far, and today we are excited to release new atomic array operations to give you even more ways to atomically modify your Parse objects.

The three array operations we provide are:

  • “add” appends an object to the end of an array
  • “add-unique” adds an object to an array only if it is not already
    contained in the array
  • “remove” removes all instances of an object from an array

Keep in mind that you can only perform one type of array operation per field between saves. For example, an RPG could atomically add the “flying” skill for a player object using:

[player addUniqueObject:@"flying" forKey:@"skills"];
[player saveInBackground];

We hope this helps you get the most out of arrays in your app!

Brian Jacokes
June 22, 2012

AWS Resiliency Improvements

Parse is hosted on AWS US-East, so we had an exciting night last Thursday when large swaths of US-East went down or experienced degraded services. Since then we’ve been working hard to improve replication and redundancy of our services across as many regions as possible.

Here are some of the things we’ve done to improve our resilience to any AWS failures:

  • redistributed our Nginx/HAProxy servers across three AZs, and added another 30% capacity. We also configured a standby ELB to use as a hot spare.
  • verified that our Mongo instances are balanced across three AZs
  • added more Resque processing capacity, and spread coverage out over three AZs
  • brought up a MySQL slave in an additional availability zone
  • brought up a Redis slave in an additional availability zone
  • verified that our iOS push servers, Android push servers, and Unicorn app servers are evenly balanced across all four AZs

All of the elements of our infrastructure are now redundant across at least two availability zones.

We’ve also spent more time fleshing out our Chef server roles, so we can provision banks of new servers on the fly. However, we also learned Thursday that we can’t count on having the ability to provision new servers during an outage — no one was able to create new instances on US-East for the duration of the outage. So we need to make sure we have enough spare capacity to absorb an outage at all times.

We are always working to improve Parse’s reliability, even in the face of underlying AWS failures.

Charity Majors
June 21, 2012

The New App Dashboard

Parse lets you easily manage the backend for all your apps through a powerful dashboard. This is an important interface where developers spend a lot of time completing tasks like setting up classes, permissions, data, and push notifications.

Today we’re introducing a redesign of our dashboard that we hope will simplify your daily workflow. It’s friendlier and focuses on the important aspects of managing your application with less visual clutter. Also, switching between apps is now easier than ever.

As developers, we know it’s important for some folks to have a dark theme on a tool they’re using on a daily basis. So we’re also added the ability to switch between a light and a dark theme on your dashboard. Check out the little switch on the bottom left of the interface.

As always, we’re working hard to design the best possible tools to manage your apps, and your feedback is very important to us. If you have questions or suggestions, feel free to contact us.

Christophe Tauziet
June 18, 2012

Even More Ways to Protect Your Data

Protecting access to your applications’ data is something we know you care about, so we’re
constantly working to improve the flexibility you have with Parse to do this. Recently, we added some new class- and application-level switches to help you prevent unauthorized changes to your application’s data. Today, we’re following that up with finer-grained control of these permissions that integrates with your applications’ existing users and
roles.

You can access these settings in the Data Browser for your application by clicking the “Permissions” link in the “More” drop-down:

For each action, you can now grant permission to all users (which remains the default), or lock permissions down to a list of roles and users:

Use these settings to protect your data, and keep building safe, robust apps with Parse!

David Poll
June 15, 2012

Recent Query Improvements

The Parse query framework is constantly getting new features and it’s sometimes hard to keep track of all the new functionality that is added. We decided to highlight two exciting features that allow you to reduce the number of queries that were previously needed.

First, we added multi-level include support. This means that you can include objects that are pointed to by an object that was included. For instance, if you store the Post that a Comment is for on the Comment and stored the Author of the Post on the Post object, you can do

PFQuery *query = [PFQuery queryWithClassName:@"Comment"];
[query includeKey:@"post.author"];

to fetch the post and the authors of the post for comments returned by the query.

We also added a new query constraint that allows joins on non-PFObject fields. For instance, if you wanted to find all users with hometown teams with winning records, you can do it in one query like this:

PFQuery *teamQuery = [PFQuery queryWithClassName:@"Team"];
[teamQuery whereKey:@"winPercent" greaterThan:[NSNumber numberWithDouble:0.5]];
PFQuery *userQuery = [PFUser query];
[userQuery whereKey:@"hometown" matchesKey:@"city" inQuery:teamQuery];
[userQuery findInBackgroundWithBlock:^(NSArray *results, NSError *error) {
  // results contain users with hometown teams with winning records.
}];

For more information on these query features and the Parse Framework, please look at the Relation Section of the iOS Guide. Android developers can look at the Relation Section of the Android Guide for information and examples for Android. If you have questions, feel free to contact us!

Shyam Jayaraman
June 13, 2012

Parse and Box Partner to Innovate in the Enterprise


Today, we’re thrilled to announce our official partnership with Box, the platform that makes it easy for people inside organizations to access and share their content in the cloud. They’ve been leaders in this space for a while, and have transformed how organizations conduct business online.

At Parse, we share the same goals, and are laser focused on building the ultimate data platform for developers. Data has been increasingly moving to the cloud for both the enterprise user and app developer. Parse and Box are at the forefront of this revolution.

Now, whenever you go to the app settings page for you Box app, you’ll see an option to use Parse to build your app. Just click on the icon and you’ll be on your way to setting up your Parse account:

Using the Parse and Box platforms together, it’s never been easier to build powerful and disruptive enterprise apps for your organization. We can’t wait to see what you build.

James Yu
June 13, 2012

Archives

Categories

RSS Feed Follow us Like us