Dev Week -- Adding Ubuntu One support to your applications -- aquarius -- Wed, Jan 27


   1 [17:00] <ttx> next up is...
   2 [17:00] <aquarius> me. :-)
   3 [17:00] <ttx> "Adding Ubuntu One support to your applications" :)
   4 [17:01] <ttx> Led by the incredible Stuart Langridge
   5 [17:01] <aquarius> [SLIDE 1]
   6 [17:02] <aquarius> hm, that didn't work, that's kees's talk. never mind :)
   7 [17:02] <aquarius> Hi! I'm Stuart Langridge, from the Ubuntu One team, and this talk is called "Adding Ubuntu One support to your applications".
   8 [17:02] <aquarius> You can ask questions at any time in #ubuntu-classroom-chat. Please write QUESTION at the beginning of your question so I can see it more easily. I'll stop at the end of a section and answer some questions.
   9 [17:02] <aquarius> During this talk I'm going to explain the different ways your applications can take advantage of Ubuntu One...
  10 [17:03] <aquarius> about why you'd want to do that...
  11 [17:03] <aquarius> ...and give a couple of sneak previews of things that you can't *quite* do yet but will be able to do for Lucid 10.04, so you can be ready!
  12 [17:03] <aquarius> Firstly, though, remember that "integrating with Ubuntu One" isn't really the point; the point is to give features to your users that make their lives easier.
  13 [17:03] <aquarius> Now, obviously, using Ubuntu One will make you taller, it'll make you more attractive to the appropriate sex, and it'll make the sun shine more brightly, but remember that it's all about providing things that your users want...
  14 [17:04] <aquarius> ...and Ubuntu One gives you the infrastructure you need to do that. If it doesn't, come talk to us!
  15 [17:04] <aquarius> OK, so, the first thing is: files.
  16 [17:04] <aquarius> As you know, Ubuntu One automatically synchronises files in your Ubuntu One folder to Ubuntu One itself in the cloud and to all your other machines.
  17 [17:04] <aquarius> This means that you can take advantage of automatic file backup just by having your application save things to the filesystem!
  18 [17:05] <aquarius> Imagine that you want attachments that you receive by email to be stored online and backed up so you can get at them later.
  19 [17:05] <aquarius> [SLIDE 2]
  20 [17:05] <aquarius> (bah. ignore the slides. they're not my slides)
  21 [17:05] <aquarius> Most mail clients will already let you do this in some way. So, change the folder that these attachments are saved in to be an Ubuntu One folder and suddenly all your attachments are backed up online and available on every machine!
  22 [17:06] <aquarius> For example, there is a Thunderbird attachment called "Attachment Extractor" (
  23 [17:06] <aquarius> Install it, select "Automatically extract attachments on email receipt" in Tools > AttachmentExtractor settings > Auto-Extract, and set the "Save Path for Attachments" to /home/YOU/Ubuntu One/Mail Attachments, and that's all you need!
  24 [17:07] <aquarius> Similarly, if you want off-site backups of your computer, then you can install one of the many simple backup programs, like backintime ( and choose the backup folder to be inside your Ubuntu One folder.
  25 [17:07] <aquarius> With no extra effort you've got off-site online backups which you can get at from any of your machines or from the web.
  26 [17:07] <aquarius> As another example, imagine you've built yourself a digital picture frame out of an old laptop, which is a pretty cool project for your weekends. How do you get the photos on it?
  27 [17:08] <aquarius> [SLIDE 3]
  28 [17:08] <aquarius> Well, when I did this, I created a new Ubuntu One user for the picture frame, and then I shared a folder with that picture frame user through Ubuntu One.
  29 [17:08] <aquarius> The picture frame just did this: eog --slideshow "/home/pictureframe/Ubuntu One/Shared With Me/pictures from Stuart Langridge"
  30 [17:09] <aquarius> and then to add new pictures to the frame, I just copy them into the folder that I shared.
  31 [17:09] <aquarius> I could share that folder with anyone else, too, and allow them to write to it, and then they'd be able to add pictures to the frame too!
  32 [17:11] <aquarius> The way I'll do this from 10.04 Lucid onwards is to use the new User Defined Folders feature, where any folder, anywhere, can be designated as an Ubuntu One synced folder
  33 [17:11] <aquarius> and you can elect to have some folders but not others synced to particular machines
  34 [17:11] <aquarius> So I'd create my "digital picture frame" folder in my home folder (or wherever), and then mark it as a UDF.
  35 [17:11] <aquarius> Then on the picture frame itself, I'd sign into Ubuntu One, and say that I only want to subscribe to that particular UDF and not any of the others.
  36 [17:12] <aquarius> so then files that I put into "digital picture frame" on my laptop will be synced to the picture frame
  37 [17:12] <aquarius> and the picture frame just displays all the files in that folder
  38 [17:12] <aquarius> ta daaah, it Just Works.
  39 [17:12] <Pendulum> QUESTION: Is there a full GObject U1 API for storing data, settings etc. or do we have to make use of ~/Ubuntu One/ for now?
  40 [17:13] <aquarius> A much-requested feature which will be available in Lucid is "public files", the ability to publish an Ubuntu One-synchronised file to a public URL so anyone can get at it.
  41 [17:14] <aquarius> This is useful for the user directly; they can easily make a file available to the world.
  42 [17:14] <aquarius> It's also really useful for applications, because you can now build one-click publish-to-the-world directly into your apps.
  43 [17:14] <aquarius> Imagine that your app is Shutter, which is like the standard Gnome Screenshot tool on steroids.
  44 [17:14] <aquarius> If you install Shutter and then hit the Print Screen button, it'll take a picture of your screen.
  45 [17:15] <aquarius> One of the main reasons people take screenshots of their screen is to show them to other people, which makes this a perfect case for publishing the screenshot to a URL so anyone can see it.
  46 [17:15] <aquarius> So, in Shutter (or your similar app), provide a "Publish with Ubuntu One" button.
  47 [17:15] <aquarius> [SLIDE 4]
  48 [17:15] <aquarius> That button should do the following:
  49 [17:15] <aquarius> 1. Save the file into the user's Ubuntu One folder (just save, as normal)
  50 [17:15] <aquarius> 2. Call the publishing API
  51 [17:15] <aquarius> The publishing API will be D-Bus; I can't confirm exactly how it will work, yet, because the team are still constructing it, but keep your eyes open for more details!
  52 [17:15] <aquarius> This shows a basic principle of Ubuntu One's design; pretty much anything you can do explicitly, like publish a file, or share a file, can also be done using the D-Bus API from applications.
  53 [17:16] <aquarius> I'll answer some questions here about using Ubuntu One file sync in your apps.
  54 [17:16] <aquarius> kklimonda|lernid> QUESTION: Is there a full GObject U1 API for storing data, settings etc. or do we have to make use of ~/Ubuntu One/ for now?
  55 [17:17] <aquarius> Data and settings are best stored in desktopcouch if you want to take advantage of all that lovely synchronization goodness; there are benefits to doing it that way, and I'll talk about desktopcouch in a bit.
  56 [17:17] <aquarius> But you can certainly store settings files in ~/Ubuntu One if you want to
  57 [17:17] <aquarius> and obviously actual data *content* that your apps work on, your documents and so on, are stored in ~/Ubuntu One
  58 [17:18] <aquarius> mhall119|work> QUESTION: in 10.04 you will be allowed to have multiple sync folders outside of ~/Ubuntu One/ ?
  59 [17:18] <aquarius> mhall119|work, yep, you sure will. UDFs (user defined folders) are a big feature that'll land in 10.04.
  60 [17:18] <aquarius> strycore89> QUESTION : will we be able to share single files and not whole directories ?
  61 [17:19] <aquarius> No. Sharing is done folder-by-folder, and we're not planning on changing that.
  62 [17:19] <aquarius> mhall119|work> QUESTION: right now the local folder names match the online folder names.  With the ability to have multiple sync folders, how are naming conflicts resolved?
  63 [17:19] <aquarius> I'm not sure what you mean here by "naming conflicts"; maybe we can pick that point up after the session, or later on?
  64 [17:19] <aquarius> foobob> QUESTION: are you thinking of giving some GB more to the free plan?
  65 [17:20] <aquarius> I don't believe we are at the moment, no.
  66 [17:20] <aquarius> yltsrc> QUESTION: will be ready symlincs in U1?
  67 === zen is now known as Guest25466
  68 [17:21] <aquarius> yltsrc, UDFs, being able to mark any folder as Ubuntu One synchronized, takes the place of symlinks. If you use, er, some alternative to Ubuntu One and you're used to putting a symlink in, say, ~/SyncedFolder which points at ~/SomeOtherFolder to get SomeOtherFolder synced, you don't need to do that in Ubuntu One; you just mark SomeOtherFolder as a UDF and it will be synced for you.
  69 [17:22] <aquarius> lantash49> QUESTION: Will there be more detailed specification w.r.t storing settings in ~/Ubuntu\ One? Storing them there directly seems to conflict with the XDG directory specs.
  70 [17:22] <aquarius> lantash49, one obvious approach to this is to mark XDG_CONFIG_DIR and XDG_DATA_DIR as UDFs, so they're synchronized across your computers.
  71 [17:23] <aquarius> yltsrc> QUESTION: i want participate in testing U1, how can I do it?
  72 [17:23] <aquarius> Drop into #ubuntuone and talk to the team about what's going on and how you can help; we've had some really helpful community members already, like rtgz, who's done tons of stuff
  73 [17:23] <aquarius> taj> QUESTION: Are there any plans to make U1 cross-platform?
  74 [17:24] <aquarius> There's a sprint at PyCon US to port Ubuntu One file sharing to Windows:
  75 [17:24] <aquarius> and mandel, another incredible community member, is currently porting desktopcouch to Windows:
  76 [17:25] <aquarius> both of those projects are great, and if you can help that'd be wonderful
  77 [17:25] <aquarius> mhall119|work> QUESTION: If I put a symlink inside of a UDF, that points elsewhere, does U1 sync that as a link, or as a copy of what is linked to?
  78 [17:25] <aquarius> it's synced as a symlink.
  79 [17:26] <aquarius> right, let's carry on :)
  80 [17:26] <aquarius> The second leg of Ubuntu One for developers is desktopcouch, the CouchDB on your desktop.
  81 [17:26] <aquarius> If you missed my last Ubuntu Developer Week talk about the basics of desktopcouch and what it's for, you can read it at
  82 [17:26] <aquarius> In fact, you can read all the desktopcouch documentation at, and you should do so :-)
  83 [17:27] <aquarius> The bit that's most likely to be relevant here is the "I am a developer, and I want the applications I write to store data in and work with desktopcouch" section. It contains much that is relevant to this talk!
  84 [17:27] <aquarius> is a really great guide, written by segphault, of how to support cloud synchronization of data in your applications.
  85 [17:27] <aquarius> Essentially, if you use desktopcouch to store your application's data, instead of using sqlite or flat files, then the data will be synchronised between all your machines *without you having to do anything*.
  86 [17:27] <aquarius> [SLIDE 5]
  87 [17:28] <aquarius> So your app will work the same on all your machines with no effort.
  88 [17:28] <aquarius> To store a record in desktopcouch, simply do:
  89 [17:28] <aquarius> >>> from desktopcouch.records.server import CouchDatabase
  90 [17:28] <aquarius> >>> from desktopcouch.records.record import Record
  91 [17:28] <aquarius> >>> db = CouchDatabase('testing', create=True)
  92 [17:28] <aquarius> >>> r = Record({'key':'value'}, record_type='')
  93 [17:28] <aquarius> >>> record_id = db.put_record(r)
  94 [17:28] <aquarius> and to get it back, by record ID:
  95 [17:28] <aquarius> >>> fetched = db.get_record(record_id)
  96 [17:28] <aquarius> >>> print fetched['key']
  97 [17:28] <aquarius> 'value'
  98 [17:28] <aquarius> The Quickly project, for writing Ubuntu apps, have created "widgets" that use desktopcouch without you having to think about it. CouchGrid, for example:
  99 [17:29] <aquarius> >>> from desktopcouch.records.couchgrid import CouchGrid
 100 [17:29] <aquarius> >>> keys=["key","another key"] # to label the columns
 101 [17:29] <aquarius> >>> couchgrid = CouchGrid(db_name, record_type=record_type, keys=keys)
 102 [17:29] <aquarius> >>> mywindow.pack_start(couchgrid)
 103 [17:29] <aquarius> and then you have a CouchGrid, which is a data table where all the data is automatically retrieved from desktopcouch and stored back into desktopcouch when changed
 104 [17:30] <aquarius> has a video demonstrating couchgrids
 105 [17:30] <aquarius> You don't have to know anything about desktopcouch at all for this! Just use the widget and your data will be saved to the database and synced to your different machines with no effort or code on your part at all.
 106 [17:31] <aquarius> has a few more examples of using desktopcouch from Python and from Quickly apps.
 107 [17:31] <aquarius> So, cloud-enable your apps! Let's see my song ratings in Rhythmbox or Banshee or Amarok or Exaile or Quod Libet appear on all of my machines. Let's see my Chrome bookmarks appear everywhere, like my Firefox bookmarks already do.
 108 [17:31] <aquarius> Remember, too, that apps can share data. If you want to store song ratings for Amarok in desktopcouch, don't make that storage Amarok-specific; that way, if I decide to switch to Quod Libet I don't have to re-rate all my songs!
 109 [17:31] <aquarius> I'm happy to answer questions about sharing of data between apps if you have them.
 110 [17:31] <aquarius> Also, I'll stop now to take some questions about desktopcouch generally.
 111 [17:32] <aquarius> andypiper> QUESTION: what is Quickly....?!
 112 [17:32] <aquarius> Quickly is an app that helps you make Ubuntu apps really...quickly
 113 [17:33] <aquarius> it takes care of putting together the framework of an application for you, and it makes a deb package for you and uploads the code to launchpad, etc. All the boring stuff that you don't care about when you just want to get your app done
 114 [17:33] <aquarius> the next session, by didrocks, is about quickly, so I'd stick around for that :-)
 115 [17:34] <aquarius> has more
 116 [17:34] <aquarius> yltsrc> QUESTION: is available any standard for database name? And how resolve conflicts with different application?
 117 [17:34] <aquarius> yltsrc, there isn't a standard, as such, for database names, because what the desktopcouch project is trying to avoid is laying down lots of standards that you Must Comply With
 118 [17:34] <aquarius> we're a "rough consensus and running code" sort of group :-)
 119 [17:35] <aquarius> the best place to have discussions about that sort of thing is at which is the desktopcouch mailing list
 120 [17:35] <aquarius> dekstopcouch records are deliberately set up to have two sections, a "main section" and an "application specific" section
 121 [17:36] <aquarius> so the idea is that apps co-operate on the main section and store app-specific data in the app-specific section
 122 [17:36] <aquarius> for example, Evolution contacts sync in Ubuntu One is done by Evolution storing your contact data in desktopcouch
 123 [17:36] <aquarius> but the format for a contact has been defined
 124 [17:37] <aquarius> and the contacts are stored in a database in desktopcouch called "contacts"
 125 [17:37] <aquarius> so Thunderbird, for example, could *also* sync its contacts to that same database, in the same format
 126 [17:37] <aquarius> and Evolution stores Evo-specific data (like, say, an internal ID) for a contact record in the app-specific part of the contact record
 127 [17:37] <aquarius> and Thunderbird would do the same
 128 [17:38] <aquarius> what this means is that if you decide to switch from Evolution to Thunderbird, you've still got your addressbook! You don't have to export it and re-import it every time you move between applications
 129 [17:38] <aquarius> yltsrc> QUESTION: U1 require python (2.6). Is any plans to run it on python3?
 130 [17:38] <aquarius> I don't believe there is, at the moment, no.
 131 [17:38] <aquarius> b1ackcr0w> QUESTION: SpiderOak is said to be going Open Source soon, are there oppertunities to integrate their services with U1?
 132 [17:39] <aquarius> There could be, certainly. I haven't looked into that in detail myself, but I'll be sure and bring it up!
 133 [17:39] <aquarius> mhall119|work> QUESTION: I want to hack on the server-part of U1, short of becoming a Canonical employee, what can I do?
 134 [17:39] <aquarius> At the moment, you can't, I'm afraid. The source code for the server part of file synchronization is closed.
 135 [17:40] <aquarius> The source code for the server part of desktopcouch is CouchDB, though, and work on that is perfectly doable.
 136 [17:40] <aquarius> We worked closely with the CouchDB upstream project to make sure that all the changes we needed to use CouchDB in Ubuntu One were part of the main CouchDB trunk.
 137 [17:40] <aquarius> yltsrc> Is avalably any FEATURE ROADMAP for U1?
 138 [17:41] <aquarius> that's...sorta what this talk is :) I can see how it might be useful to have a more formal statement of "what's coming up", though. I'll bring that up with the team.
 139 [17:42] <aquarius> yltsrc> QUESTION: is U1 uses dbus? and how i can extend my application to use it?
 140 [17:43] <aquarius> Yes. The syncdaemon, which is the bit that handles file synchronization, exposes D-Bus commands for almost everything it does.
 141 [17:43] <aquarius> OK, I'll carry on.
 142 [17:43] <aquarius> Since desktopcouch is a CouchDB, and since your data is synchronised not only to your other machines but up to the cloud as well, this opens up the intriguing possibility that you can build a web app that can share data with your desktop app.
 143 [17:43] <aquarius> Ubuntu One's CouchDB uses OAuth for authentication.
 144 [17:43] <aquarius> This means that your web app can ask permission from the user to read your desktop app's CouchDB data directly from Ubuntu One.
 145 [17:44] <aquarius> So the data that appears in your desktop app can also be available to that user on the web.
 146 [17:44] <aquarius> This is a pretty new area, so nobody's using it yet, but it's possible.
 147 [17:44] <aquarius> You use OpenID to log the user in to your web app using Ubuntu One -- you may have seen "log in with Twitter" buttons, or "Facebook Connect", which work on the same principle.
 148 [17:44] <aquarius> Once that's done, your web app can then request permission to read the user's CouchDB database to get at the data that your *desktop* app stored there.
 149 [17:44] <aquarius> So, if we think about the song ratings example above, you can build a web application that can show all the song ratings that the user has entered and allow them to be edited.
 150 [17:45] <aquarius> Your users can then manage their song ratings or playlists or whatever else you've stored directly from a web interface if they're not at their actual computer.
 151 [17:45] <aquarius> Sharing data between web apps and desktop apps is quite hard, and not many people are doing it, so this is a chance to offer a feature that no-one else has!
 152 [17:46] <aquarius> DesktopCouch plus web apps give you the ability to share that data without you having to do any extra work.
 153 [17:46] <aquarius> This also gives you the ability to offer mobile apps as a web interface, so people can work with their data from their smartphone and see their work reflected on their desktop when they get back to it.
 154 [17:47] <aquarius> Are there any questions about how linking up desktop apps and web apps would work?
 155 [17:48] <aquarius> mhall119|work> QUESTION: how does it handle when a file is edited on2 different computers before syncing?
 156 [17:49] <aquarius> If that happens, you'll get a .u1-conflict file showing you that there was a conflict, for file synchronization.
 157 [17:49] <aquarius> In desktopcouch, there will be a conflict record for the data.
 158 [17:50] <aquarius> One of the things that we have on our Big List Of Stuff To Do is some sort of graphical conflict management to make dealing with these situations even easier, but that won't be done for 10.04.
 159 [17:51] <aquarius> So at the moment, handling data conflicts is done by the applications that use the data; the applications have a better idea about how to merge/overwrite/handle conflicts than Ubuntu One does most of the time anyway, because Ubuntu One just moves the data around, it doesn't always understand it.
 160 [17:51] <aquarius> qense> (late) QUESTION: When you define a UDF outside the Ubuntu One directory, where will it be synced to when you enable/install Ubuntu One on a different computer?
 161 [17:51] <aquarius> It'll be synced to the same path, so if you mark ~/myfolder as a UDF on computer 1, it'll appear as ~/myfolder on computer 2.
 162 [17:52] <aquarius> duanedesign> QUESTION: Where can I find documentation on the U1 API
 163 [17:52] <aquarius> the desktopcouch API is defined (mostly) in the desktopcouch documentation at
 164 [17:53] <aquarius> the file sync API isn't defined anywhere yet, I don't believe, because we haven't had a chance to do it, so it's reading the source, I'm afraid. has some details, though.
 165 [17:53] <aquarius> emoreno> QUESTION: Is there any way to use a Private Cloud rather than U1 with the same API
 166 [17:54] <aquarius> Not at the moment. The protocol that the syncdaemon uses to talk to the cloud isn't secret, though, so it would be possible to implement a private cloud.
 167 [17:54] <aquarius> mhall119|work> QUESTION: does U1 offer any kind of versioning on it's data, like the ability to retrieve an older version?
 168 [17:54] <aquarius> Not at the moment, no. We've talked about that, but it isn't available now.
 169 [17:55] <aquarius> OK, that's a brief tour of what services Ubuntu One can bring to your apps. You can make the files your app uses be synchronised, you can publish those files publically, you can store data from your apps that will be available everywhere, and you can share that data with web applications.
 170 [17:55] <aquarius> [SLIDE 6]
 171 [17:55] <aquarius> Are there any further questions before I hand over to our next speaker?
 172 [17:56] <aquarius> nealmcb> QUESTION: Re the question on working on the U1 server end - Elliot Murphy recently talked about your open file storage protocol, noted his "build no silos" policy for U1, and talked about e.g. Tomboy integration.  Can you expand on the places that people can work on servers that integrate with U1 protocols?
 173 [17:57] <aquarius> desktopcouch is a CouchDB, so it can replicate data with any CouchDB, including other desktopcouches on your LAN -- see the desktopcouch-pair tool for this, in the desktopcouch-tools package -- and so doesn't even need a server at all
 174 [17:57] <aquarius> Tomboy notes sync was done by us implementing the Snowy API -- Snowy is a Django server to which you can sync your notes, designed by the Tomboy team, and they're looking at doing their own deployment of it
 175 [17:58] <aquarius> qense> QUESTION: Any change there will be a small collection of snippets showcasing webintegration of Ubuntu One?
 176 [17:58] <aquarius> if someone does that I'll love them forever.
 177 [17:58] <aquarius> I'd certainly like to, it's just finding the time :-)
 178 [17:58] <aquarius> OK, if you have other questions, feel free to ping me, or chat on #ubuntuone

MeetingLogs/devweek1001/AddUbuntuOne (last edited 2010-01-27 09:14:11 by i59F71233)