Dev Week -- Adding Ubuntu One to your applications -- aquarius -- Thu, 3rd Feb, 2012

   1 [18:03] <aquarius> Hi, everyone!
   2 [18:03] <aquarius> I'm Stuart Langridge, and I work on Ubuntu One
   3 [18:04] <aquarius> Now I'm here to talk about adding Ubuntu One to your applications.
   4 [18:04] <aquarius> Do please ask questions throughout the talk: in the #ubuntu-classroom-chat channel, write QUESTION: here is my question
   5 [18:04] <aquarius> We want to make it possible, and easy, for you to add the cloud to your apps and to make new apps for the cloud
   6 [18:04] <aquarius> So we do all the heavy lifting, and your users (and you!) get the benefits.
   7 [18:04] <aquarius> So, you've built an app which does things for you: let's say it's a todo list app, since lots of people are doing that, with Getting Things Done or something.
   8 [18:04] <aquarius> It'd be great to have your todo list on all your Ubuntu machines -- your desktop machine, your netbook, and so on.
   9 [18:04] <aquarius> To do that, just sync the folder that you store the todo lists in with Ubuntu One.
  10 [18:05] <aquarius> I'm going to talk about U1DB shortly, our in-progress effort to enable structured data sync, but you can also work with files quite happily.
  11 [18:05] <aquarius> Working with Ubuntu One file sync programmatically is done through the Python library
  12 [18:05] <aquarius> (If you're not using Python, then don't worry; SyncDaemonTool is only a wrapper around the Ubuntu One D-Bus API, so all this works from other languages too. I'll explain the Python version here, though, for simplicity.)
  13 [18:06] <aquarius> So: "pydoc" to see the documentation.
  14 [18:06] <aquarius> (Note: you'll need to be running precise for this, either right now or after it's released.)
  15 [18:06] <aquarius> Imagine, in your todo list app, you have a checkbox for "put my todo lists on all my machines", and you store your todo lists in ~/.local/share/mytodolist/lists.
  16 [18:06] <aquarius> So ticking the checkbox should mark that folder as synced with Ubuntu One, and then it'll be synced everywhere.
  17 [18:07] <aquarius> A simple example of how to do that is at
  18 [18:07] <aquarius> As you can see, we check whether the folder is *already* on your list of synced folders, and if not, we use create_folder to create it.
  19 [18:08] <aquarius> Everything that file sync can do, you can do with SyncDaemonTool or the underlying D-Bus API.
  20 [18:08] <aquarius> The Ubuntu One control panel, and the technical u1sdtool, both just talk to that D-Bus API.
  21 [18:08] <aquarius> So if you port your todo list app to Windows, or the web, or iOS or Android or Blackberry or all of them, they can all still get at the data.
  22 [18:09] <aquarius> File sync is about more than just the-same-files-on-all-my-machines, though.
  23 [18:09] <aquarius> You can use it for communication and distribution as well.
  24 [18:09] <aquarius> To pick an example, jonobacon and dholbach and I and others have recently been working on an Ubuntu Accomplishments system (
  25 [18:10] <aquarius> Most of this is all local stuff, which can be used to help people learn the Ubuntu desktop -- you send an email, you set your desktop background, and that's an accomplishment
  26 [18:10] <aquarius> or as a reward -- you complete a level in a game, for example
  27 [18:10] <aquarius> but there are also accomplishments which are to do with your activities on the wider internet
  28 [18:10] <aquarius> So, you filed your first bug about Ubuntu, for example.
  29 [18:11] <aquarius> Now, these need to be "verified" by another machine, something that isn't your computer, to prove you did it; that other machine checks with Launchpad that you've actually filed a bug and then says "yep, they did it".
  30 [18:11] <aquarius> One way to implement this would be to run a web service -- you can make requests to it saying "I filed a bug: verify that, please"
  31 [18:11] <aquarius> and the web service goes away and checks that you did and then says "yes, you did, and here's a token to prove it"
  32 [18:12] <aquarius> But that's got all sorts of problems -- you have to be online to talk to the web; if the web service gets popular it might crash a lot (think of Twitter, here), and so on
  33 [18:12] <aquarius> What you want is to work *asynchronously*.
  34 [18:12] <aquarius> So, instead of directly contacting a web service, put the stuff you want to check in a folder, sync that folder with Ubuntu One, and then *share* that folder with a specific U1 user account
  35 [18:12] <aquarius> That U1 user account is owned by a machine, and when your network comes back, your files will sync to U1, then they'll sync across to the machine's account
  36 [18:12] <aquarius> The machine can then look at those files, verify them at its leisure, and then add the "yes they did it" token, and then that token will sync back to your machine
  37 [18:13] <aquarius> So, you're working just like with a web service, but it *doesn't have to be real time*
  38 [18:13] <aquarius> Which means that you don't need to worry about having super hardware running the web service, really complicated load-balancing; you don't have to worry about the user being offline and queueing up requests; none of that
  39 [18:13] <aquarius> And this is all built in to Ubuntu. Anyone can have an Ubuntu One account.
  40 [18:14] <aquarius> So you can happily use this in your Ubuntu apps.
  41 [18:14] <aquarius> So, for example, imagine being able to instantly, one-click-ly, publish a file from your application to a public URL and then tweet that URL.
  42 [18:14] <aquarius> Instant get-this-out-there-ness from your apps.
  43 [18:15] <aquarius> The screenshot tool Shutter, for example, can do this already; PrtSc to take a screenshot, then "Export > Ubuntu One".
  44 [18:15] <aquarius> Your app could have a button to "store all my files in the cloud", or "publish all my files when I save them", or "automatically share files that are part of Project X with my boss".
  45 [18:15] <aquarius> So a backup program, for example, could back up your files straight into Ubuntu One and not sync them to your local machines, and that's exactly what the excellent Deja Dup does
  46 [18:17] <aquarius> Ubuntu's default backup system will back up your stuff straight to Ubuntu One, so you've got a safe offsite backup when you need it
  47 [18:17] <aquarius> That was entirely built on the Ubuntu One APIs.
  48 [18:17] <aquarius> The interesting thing here, of course, is that if you build your own web service to go alongside the app you're building, then you have to run that web service, keep it going, pay the bills for it, be a sysadmin.
  49 [18:17] <aquarius> But if your app uses Ubuntu One, then it's using the user's *own storage*, not yours.
  50 [18:17] <aquarius> So you get all the benefits of your app having a web service, and none of the downsides!
  51 [18:17] <aquarius> And of course being able to save things in and out of the cloud means that you can get an Ubuntu One sync solution on other platforms.
  52 [18:18] <aquarius> So you could work with your files from your mobile phone (we've already got Android and iOS clients for phones, but there are plenty of people with N9s or Windows Phone or Blackberry)
  53 [18:18] <aquarius> Build a fuse or gvfs backend for Ubuntu or Fedora or SuSE or Arch Linux. Build a WebDAV server which works with Ubuntu One and mount your Ubuntu One storage as a remote folder on your Mac.
  54 [18:18] <aquarius> And web apps can work with your cloud too, for files as well as data.
  55 [18:18] <aquarius> Imagine, say, a torrent client, running on the web, which can download something like a movie or music from and save it directly into your cloud storage.
  56 [18:18] <aquarius> So you see an album you want on that torrent site (say, Ghosts I by Nine Inch Nails) and go tell this web torrent client about it (and you've signed in to that web torrent client with Ubuntu One)
  57 [18:18] <aquarius> And the website then downloads that NIN album directly into your personal cloud -- which of course makes it available for streaming direct to your phone.
  58 [18:19] <aquarius> But it's not just about your content for yourself; think about sharing.
  59 [18:19] <aquarius> Ubuntu One lets you share a folder with people. This would be great for distribution.
  60 [18:19] <aquarius> Imagine that you publish an online magazine.
  61 [18:20] <ClassBot> There are 10 minutes remaining in the current session.
  62 [18:20] <aquarius> So, you create a folder on your desktop, and put issues of the magazine in it.
  63 [18:20] <aquarius> Then, you put a button on your website saying "Sign in with Ubuntu One to get our magazine".
  64 [18:20] <aquarius> When someone signs in, your website connects to the Ubuntu One files API, with your private OAuth token, and adds that signed-in user to the list of people that your magazine folder is shared with.
  65 [18:21] <aquarius> Then, whenever your magazine has a new issue, you just drop it into that folder on your desktop.
  66 [18:21] <aquarius> (Or even upload it to Ubuntu One directly through the website.)
  67 [18:21] <aquarius> All the subscribed people will get the new issue instantly, on all the machines they want it on, and in the cloud.
  68 [18:21] <aquarius> You could distribute anything like this. Imagine a podcast, or chapters of a novel.
  69 [18:22] <aquarius> (I keep imagining an online game which grows over time, but that's just me)
  70 [18:22] <aquarius> It would also work for paid-for content; when someone pays, have your code share a folder with them, and put their paid-for stuff in that folder. That's all doable through the files API.
  71 [18:22] <aquarius> We have the start on documentation for all the APIs at and we're working hard on updating that at the moment
  72 [18:22] <aquarius> (we've been moving the documentation to use the Sphinx docs system under the covers, so some of the more recent things aren't yet documented, and I'm working on that)
  73 [18:23] <aquarius> That about covers things for this talk; it's a quick tour through some of the things that Ubuntu One can do for your apps
  74 [18:23] <aquarius> There's, of course, another thing that you can do; bring U1 to new platforms
  75 [18:24] <aquarius> We've recently had people start building wrapper libraries for Ubuntu One files in loads of different environments... the most recent was .net
  76 [18:24] <aquarius> so that the chap can also build apps on windows which work with his files in Ubuntu One
  77 [18:24] <aquarius> OK, that's the brief summary.
  78 [18:25] <aquarius> If anyone has questions about this or about anything to do with Ubuntu One and app development, I'm happy to answer them
  79 [18:25] <ClassBot> There are 5 minutes remaining in the current session.
  80 [18:25] <aquarius> and I'm also talking about U1DB, our in-progress data sync thing, in an hour, so you may find that interesting too :)
  81 [18:26] <aquarius> melvster says: QUESTION: this sounds absolutely awesome, you've alluded to the fact there will be a standards compliant REST API with global URLs exposed, 1. will it expose correct and flexible MIME types, 2. cross origin headers for interop with apps,  3. will there be fine grained access control
  82 [18:26] <aquarius> 1. yes, there already is a REST API for your files in the cloud -- see
  83 === cmagina_ is now known as cmagina-lunch
  84 [18:27] <aquarius> 1b. mime types for your files are what you set them to be, if you upload them through the APIs
  85 [18:27] <aquarius> 2. CORS headers are an interesting one. I'd like to hear reasoning both for and against that. I've been thinking about it, and I'm leaning towards it being a good idea, but it's not done yet.
  86 [18:28] <aquarius> 3. fine grained access control -- granting an access token which can access only one folder, or one file, or have read but not write access to your files -- is something that we plan to build, but we haven't yet.
  87 [18:29] <ClassBot> burli asked: whats the status of u1db?
  88 [18:29] <aquarius> You want to be here in an hour to see the u1db talk for that :)
  89 [18:29] <aquarius> briefly, though, it's in progress, and you can start using it now in apps, and we'd love to hear from you about it :)

MeetingLogs/devweek1201/AddingU1ToYourApps (last edited 2012-02-03 09:47:00 by dholbach)