/srv/irclogs.ubuntu.com/2011/03/02/#ubuntu-classroom.txt

NijaboIs there some IRC I should turn to with questions regarding getting into "Getting started"00:03
NijaboI have one regarding TestDrive00:03
NijaboWrong room sorry00:05
=== AndrewMC is now known as SpockVulcan
=== Jamie is now known as Guest48124
=== SpockVulcan is now known as AndrewMC
kaydsofthi04:20
xiaoganybody home?05:21
JackyAlcineHey05:22
xiaogIm from china05:22
JackyAlcineCool, I'm in the US. :D05:23
xiaogit's not the time to discuss?05:23
xiaogI'm pool in english05:23
chalcedonyi just got here05:24
xiaogme too05:24
JackyAlcineWell, it's a bit early, I don't think that the next class starts any time soon.05:26
xiaogyeh, difference of time05:29
xiaoglet's have a look the class list.05:30
chalcedony while waiting Full Circle Magazine: http://fullcirclemagazine.org/issue-46/05:38
chalcedony Direct: http://dl.fullcirclemagazine.org/issue46_en.pdf05:38
=== msnsachin12 is now known as msnsachin
dholbachgood morning07:43
xiaogIt's time to say "good night" in our country ~ hehe08:09
=== msnsachin12 is now known as msnsachin
=== qwebirc86266 is now known as geco2
sriramAny Discussions?09:11
tdelvsriram, if you mean the classes they do not start for another 7 hours09:19
sriramtdelv, schedule please?09:20
head_victim!schedule09:22
ubot2To view the upcoming Ubuntu Classroom schedule, visit the Learning Events Calendar at http://people.ubuntu.com/~nhandler/classroom.html09:22
=== msnsachin12 is now known as msnsachin
=== nmsnsachi is now known as msnsachin
ranjanhey what time the today session is starting ? I am from India...14:39
nigelbranjan: 2130 IST14:40
=== andreserl is now known as RoAkSoAx_
ranjannigelb, thanks :P)14:40
=== RoAkSoAx_ is now known as RoAkSoAx
ranjancan anybody give me the link of yesterdays' session log ?14:43
ranjanzeitgeist's log14:43
dholbachall on https://wiki.ubuntu.com/UbuntuDeveloperWeek14:43
ranjandholbach, thanks :)14:44
kajali am new to IRC14:45
kajalcan say ubuntu participation on GSOC?14:45
ElMago29hey guys .. can you tell me why i cannot install with "sudo apt-get install openssh-server" in ubunto 10.04 Lucid?15:32
fisch246!support15:33
ubot2For general questions or support, please use our support channel, #ubuntu15:33
nigelbYou should probably ask in #ubuntu which is the support channel15:33
ElMago29ok thanks!15:33
techbreakwhat is this sesion like ? "test drive " ??15:53
techbreakare we going to learn testing ?15:53
acarpinetechbreak, yes15:54
techbreakacarpine, testing of what ?15:54
acarpineI think we are going to learn testdrive tool15:54
techbreakacarpine, what is that tool for  ? tool like ?15:54
nigelbhey folks, keep chat to #ubuntu-classroom-chat, sessions will be happening here :)15:54
acarpineops right...15:55
dholbachHELLO MY FRIENDS! IT'S DAY 3 of UBUNTU DEVELOPER WEEK! WELCOME! :)15:58
dholbachif you need any information about the event at all, check out https://wiki.ubuntu.com/UbuntuDeveloperWeek15:58
fisch246!caps | dholbach15:58
ubot2dholbach: PLEASE DON'T SHOUT! We can read lowercase too.15:58
fisch246:P15:58
dholbachalso, please make sure you join #ubuntu-classroom-chat15:58
dholbachbecause that's where all the chatter goes15:58
dholbachand questions too - please make sure you prefix your questions with QUESTION:15:59
dholbachie: QUESTION: RoAkSoAx: was Pisco invented in Peru or in Chile?15:59
RoAkSoAxdholbach, Peru of course!15:59
RoAkSoAx:)15:59
dholbachtoday we'll start of the day with RoAkSoAx aka. Andres Rodriguez who will introduce you to TestDrive and how to run virtual machines (including the Ubuntu development release) in a sane manner16:00
dholbachRoAkSoAx, the stage is yours16:00
dholbachenjoy!16:00
RoAkSoAxthanks dholbach16:00
RoAkSoAxGood Morning Everybody! My name is Andres Rodriguez (as dholbach already saud) and I'm the upstream developer of TestDrive.16:00
RoAkSoAxSo Who is here for the TestDrive Session?16:01
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: TestDrive - Instructors: RoAkSoAx
RoAkSoAxraise your hands in #u-c-chat16:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html following the conclusion of the session.16:01
RoAkSoAxPerfect then.16:01
RoAkSoAxThis session is divided as follows:16:01
RoAkSoAx 1. Introduction16:01
RoAkSoAx 2. How to use TestDrive (its different uses)!16:01
RoAkSoAx 3. Do you want to help TestDrive become better? - Development Opportunities!16:01
RoAkSoAx 4. Questions/Comments/Suggestions?16:01
RoAkSoAx== Introduction ==16:02
RoAkSoAxTestDrive was originally created by Dustin Kirkland to test the Ubuntu Daily ISO's of the development release. It was originally a command line application, a shell script, that was later rewritten to python. At this point, it was only a command line application. Nowdadays we have a GTK UI as well. The GTK was my Google Summer of Project with the objective of not only be able to test the Daily ISO Image of the Development release, but to be16:02
RoAkSoAx able to test other ISO's in a simple way. I believe that the original objectives were achieved and there's also the opportunity to do more cool stuff.16:02
RoAkSoAxSo the initial sole purpose of TestDrive was to be able to test Ubuntu Daily ISO's, to help with the Testing when new Ubuntu pre-releases were available and others, such as start a VM in a quick manner with no configuration based in any Ubuntu Daily ISO Available. These daily ISOs were only the Ubuntu development release16:04
RoAkSoAxSo now you may wonder... what else can I do with TestDrive?16:05
RoAkSoAxTestDrive can be used for the following:16:06
RoAkSoAx * Test Ubuntu Development Releases - Daily ISO's16:06
RoAkSoAx * Test Older Ubuntu Releases16:06
RoAkSoAx * Test flavors(Kubuntu/Xubuntu/Edubuntu/Mythbuntu/Ubuntu Studio)16:06
RoAkSoAx * Test any *other* ISO from any Other Distribution16:06
RoAkSoAx * Test Ubuntu Cloud Daily Images16:06
RoAkSoAx * Test qcow2 disk images.16:06
RoAkSoAx * Ubuntu ISO Download Manager :)16:06
RoAkSoAx * And of course, test if any of our packages is fixed in any release.16:06
RoAkSoAxSo at this point I'm assuming everybody is running TestDrive (and for those who are running natty, you'll notice a notification a few seconds right after you start TestDrive and I'll get to that in a bit)16:07
RoAkSoAxIf you are not running it yet, please go ahead16:07
RoAkSoAxlet me know when you all have TestDrive ready :)16:08
RoAkSoAx!question16:09
RoAkSoAx!q16:09
RoAkSoAx!y16:09
ClassBottechbreak asked: how to get testdrive ready ?16:09
ClassBotmonish001 asked: how to start testdrive?16:10
RoAkSoAxsorry my bad16:10
RoAkSoAxFrom the command line: sudo apt-get install testdrive16:10
RoAkSoAxthat comman will install both, TestDrive GTK and the command line application16:10
RoAkSoAxOr you guys can go to Software Center and search for TestDrive and Install it16:10
RoAkSoAxThen (for those running gnome Maverick + Applications > System Tools > TestDrive an Ubuntu ISO16:11
ClassBotmonish001 asked: terminal says - You will have to enable the component called 'universe'16:12
RoAkSoAxmonish001, yes you need to enable though by default it should be.You can also do it from Gnome but I can't seem to recall what to launch :)16:13
RoAkSoAxIf you are running Maverick I believe it is in System > Preferences > Software Sources16:13
RoAkSoAxIf you are running Ubuntu Software Center > Edit > Software Sources16:14
RoAkSoAxmonish001, ^^16:14
RoAkSoAx(sorry I don't really use much Ubuntu Software Center)16:15
RoAkSoAxSo anyways, let's move on otherwise time might run out16:16
RoAkSoAxSo how can we Test Ubuntu Development Releases? It is easy. When you launch TestDrive, by default it will provide all the available ISO's of the current development release. In this case, Natty. The testing procedure is even easier. Simply 1. Select, 2. Sync, 3. Launch. So we can select either 1 or more ISO's. Sync means that It will download the ISO's form the repository automatically. And once an ISO is synced completely we can Launch it.16:16
RoAkSoAx dholbach has setup a nice wikipage that show's this behavior: https://wiki.ubuntu.com/UsingDevelopmentReleases/16:16
RoAkSoAxtechbreak_, Please do so :)16:17
RoAkSoAxNow, I understand not everybody has the same hardware as I do, and not everybody has the same virtualization techonlogy16:18
RoAkSoAxTestDrive Fully supports 2 virtualization technologies (In the latest release included in Natty, or in Maverick PPA)16:18
RoAkSoAxSo for those who are running maverick do this in the command line:16:19
RoAkSoAxsudo apt-get install python-software-properties16:19
RoAkSoAxsudo add-apt-repository ppa:testdrive/ppa16:19
RoAkSoAxsudo apt-get update16:19
RoAkSoAxsudo apt-get install testdrive16:19
RoAkSoAxwith that all in maverick/natty should have the latest release16:19
RoAkSoAxnow, if you are using KVM as your virtualization technology or your CPU supports KVM, when you installed TestDrive everything should be ready to launch16:20
RoAkSoAxif you use virtualbox , you'll first have to install it: sudo apt-get install virtualbox-ose16:21
RoAkSoAxso anyways, how can I choose what virtualization technology to use: Simple TestDrive > Edit > Preferences > Virtualization > Hypervisor (and select the hypervisor of your preference and click SAVE)16:21
RoAkSoAxSo by now I'm assuming you guys are downloading the ISO. Now we know how to change the Hypervisor. Please all take a look to https://wiki.ubuntu.com/UsingDevelopmentReleases/16:22
RoAkSoAxyou'll see the nice screenshots16:22
RoAkSoAxso while the ISO downloads, I;ll continue to explain what other things we can do with TestDrive, so let's just leave TestDrive to do the work for a while16:23
RoAkSoAxSo, what else can I do with TestDrive besides testing the Ubuntu Development releases.... We can test *Older* Ubuntu releases. So, how can we do it?  It is also simple. Edit > Preferences > Ubuntu Releases. If you notice, there's two things to consider. The Repository and the Release itself. The repository can either be http://cdimage.ubuntu.com or http://releases.ubuntu.com and the releases would be the available releases for each reposito16:24
RoAkSoAxry. You just select the desired Repository and the desired release in the repository, and click save.16:24
ClassBotdarkdevil75 asked: if i have already downloaded the iso, how do i point to the location?16:24
RoAkSoAxdarkdevil75, I'll get to that in a bit16:25
RoAkSoAxSo how we select older Development Releases in the command line? Somthing like this: testdrive -p cdimage -r maverick16:26
RoAkSoAxwe specify the desired repository and the desired release16:26
RoAkSoAxif you only run "testdrive" in the command line, it will default to "cdimage" and "ubuntu development release (in this case, natty)"16:26
RoAkSoAxSo, another thing we can do with TestDrive, is to also test different Ubuntu flavors, from both a previous release or the current development release. So now, how can we test different them? By default Ubuntu/Kubuntu/Xubuntu/Other are the flavors enabled. We can also test Edubuntu/Mythbuntu/UbuntuStudio. For that we go to  Edit > Preferences > Distributions > (Select the desired ones). Then we save and the available flavors in the selected16:28
RoAkSoAxrepository/release will be appear.16:28
RoAkSoAxfrom the command line we do something like: "testdrive -p releases -r maverick -l kubuntu"16:29
RoAkSoAxor "testdrive -l kubuntu" -> For Kubuntu Natty16:29
ClassBotstefwal54 asked: is there a way to solve the problem that the virtual machine crashed16:30
RoAkSoAxSteap, not with testdrive :(16:30
RoAkSoAxstefwal54, not with testdrive :(16:31
RoAkSoAxtestdrive in the case of KVM only uses kvm command to launch the ISO's16:31
ClassBotchilicuil asked: what if I pause downloading an iso, testdrive will continue downloading where I leave it?, what if I want to test the ubuntu dev version iso everyday, will it download all the iso again, or it will do a diff between the 2 isos?16:31
RoAkSoAxchilicuil, TestDrive will only download the diff and not the whole iso. However the progress will always go from 0 to 10016:31
RoAkSoAxFpor all of those concerned, TestDrive to download all Ubuntu ISO's will use rsync16:32
RoAkSoAxNow, TestDrive Also allows us to to download and launch ISO's that might not be Ubuntu ISOs or are located in other repositories/servers/or Even the local machine. So how can we do this? Simple. In the GTK main interface you'll notice that there's the"Other". Once the "Other" tab is selected, the "Add ISO" button will become enabled. Then we enter a simple description, the URL where the ISO is located, and the protocol to use, which is eith16:34
RoAkSoAxer rzync, or zsync. If you notice there's also a file procotol. This can be used when the ISO is in our machine, and to be able to add it, we need to provide the absolute path of the ISO as URL.16:34
RoAkSoAxSo, "Add Other ISO" will launch another dialog to be able to add the ISO16:35
RoAkSoAxIn this case, we could use the URL of any ISO there, let's say a Fedora ISO, select zsync or rsync (if the server of the URL supports it), then click on "Add" and then "Save"16:37
RoAkSoAxthis will make available the ISO under the "Other" tab, and we can select it, click Sync, and once it finished download, we can just click Launch16:37
RoAkSoAxeasy huh?16:37
RoAkSoAxbut wait, did you just mention we can also add ISO's already downloaded??? Yes you can ( darkdevil75 ). There's a few ways to do this16:38
ClassBotfisch246 asked: "Unable to validate Virtualization Method [virtualbox]" i have virtualbox installed... anyway i can fix this?16:39
RoAkSoAxfisch246, We'll hold that question for the end :)16:39
RoAkSoAxSo anyways, how can be run with TestDrive ISO's that I already downloaded16:40
RoAkSoAxsimple: With the GTK we can use TestDrive > File > Open16:40
RoAkSoAxTestDrive > File > New16:40
RoAkSoAxand notice that TestDrive > File >  New is the same as "Add Other ISO"16:40
RoAkSoAxso as URL we just give the full path of the ISO16:41
RoAkSoAxhowever, we can also do this from the command line16:41
RoAkSoAxtestdrive -u rzync://www.youriso.com/download.iso16:41
RoAkSoAxor testdrive -u /path/to/iso/ubuntu.iso16:42
ClassBotchadadavis asked: 3D driver support?16:42
RoAkSoAxchadadavis, that's hypervisor side of things, not TestDrive's :(16:42
RoAkSoAxso anyways, what else can we do with TestDrive?16:43
RoAkSoAxwe can also Test Ubuntu Cloud Images16:44
RoAkSoAxwait what? Cloud Images?? Yes, cloud images that run in the cloud can be tested in the local machine16:44
RoAkSoAxunfortunately for now it will just work for daily images and it only works in testdrive command line16:44
ClassBottechbreak asked: what is cloud image ? image of cloud ubuntu OS ?16:45
RoAkSoAxtechbreak_, the Cloud Image is the Ubuntu Image used in cloud computing for either Eucalyptus Cloud or Amazon EC2. In other words, whenever you launch Ubuntu in the Cloud it uses a cloud image (i.e. a disk file with some other components that have Ubuntu pre-loaded)16:46
RoAkSoAxNow, to be able to test Ubuntu Cloud Daily Images we will need to use the command line application. So, we can open a command line and just do the following to obtain the latest Daily UEC/Cloud Images available:16:46
RoAkSoAxtestdrive -p uec-daily -l uec-server16:46
RoAkSoAxWe can also specify the release (i.e. Maverick)16:46
RoAkSoAxtestdrive -p uec-daily -l uec-server -r maverick16:46
RoAkSoAxNow, a cool feature that was added lately is to be able to launch the Cloud Image in the local terminal/console. But what does this mean? Instead of launching the image in a separate KVM window it will display it in the terminal from where you are launching testdrive. The command is as follows:16:47
RoAkSoAxtestdrive -p uec-daily -l uec-server --curses16:47
RoAkSoAxNOTE: Running cloud images only work with KVM16:47
* RoAkSoAx running out of time16:48
RoAkSoAxas I mentioned before we can also run images located in the machine16:48
RoAkSoAxNow we can also launch images that are located in the machine. With TestDrive GTK you can do it by using the "Other" tab - "Add ISO" (Equivalent to File > New) or simply  File > Open. The local images that can be launched can be either ISO Images, Disk Images (QCOW2) and Cloud Images. We can also do this from the command line as follows:16:48
RoAkSoAxtestdrive -u /local/path/to/image.iso16:48
RoAkSoAxtestdrive -u /local/path/to/image.img16:48
RoAkSoAxtestdrive -u /local/path/to/uec-image.tar.gz16:48
RoAkSoAxtestdrive -u /local/path/to/uec-image.tar.gz --curses16:48
RoAkSoAxlast but not least, for those running Natty, we have recently added an Indicator Applet (if you notice) that will appear and notify the user whenever there are available pre-release candidate ISO's available for testing. These ISOs are the ISOs that are being tested towards the next Ubuntu release. (i.e. ISO's for Tomorrow's Alpha3).16:49
RoAkSoAxthe idea behind that was to make aware people who were using TestDrive that there's an Ubuntu pre-release available for testing16:49
RoAkSoAx== How to Contribute ==16:49
RoAkSoAxNow, we've given an overview of the things we can do with TestDrive. What about if you want to contribute to TestDrive and make it better. Well it is simple, you can either contribute with ideas, fixing bugs or implementing new features. Though if you have an idea and can submit a patch, that's more desirable :). Some of the new reported feature requests are:16:49
RoAkSoAx"Re-run this program with TestDrive" https://bugs.launchpad.net/testdrive/+bug/70467516:49
RoAkSoAx"Quicklist and progressbar support" https://bugs.launchpad.net/testdrive/+bug/71191516:49
RoAkSoAx"GUI Option for zsync" https://bugs.launchpad.net/testdrive/+bug/70181816:49
RoAkSoAx"Support VMWare" https://bugs.launchpad.net/testdrive/+bug/52716116:49
RoAkSoAx== Questions/Comments/Suggestions? ==16:50
RoAkSoAxSince I only have 10 mins left16:50
RoAkSoAxlets do questions/comments/suggestions and try to get up a machine up and running16:51
ClassBotThere are 10 minutes remaining in the current session.16:51
ClassBottechbreak asked: ok if I am not funny what is this kvm ?16:51
RoAkSoAxtechbreak, indeed KVM is one of the varios methods to create Virtual Machines16:51
RoAkSoAxand the one pre-ferred in Ubuntu16:51
ClassBotacarpine asked: why i should run a cloud image?16:52
RoAkSoAxacarpine, you don't have to, but if you would like to test it, you are more than welcome to do so!! :). Adding the support to TestDrive was a feature requested to be able to easily test Cloud Images by the Developer16:53
ClassBotstefwal asked: is there a difference between a second machine and testdrive? If some one has a second machine of course!16:53
RoAkSoAxstefwal: Of course, TestDrive uses a Vritualization Technology to run an ISO image (mainly) in a Virtual Machine16:54
RoAkSoAxyou could also burn that ISO in a USB Stick and then test it in real HW16:54
ClassBottechbreak asked: what are we supposed do after testing ? what if we found some error or bug or something ? where to submit ? how ?16:54
RoAkSoAxtechbreak_, if you found a error/bug with Ubuntu, just file the bug http://launchpad.net/ubuntu16:54
RoAkSoAxif you found a bug in TestDrive file a bug in launchpad.net/testdrive16:55
ClassBotVikash asked: I have one que. I may be off the topic because i have just come to the session... Which OS is better Ubuntu or Ubuntu-derivative16:55
RoAkSoAxVikash, you can test that yourself with TestDrive :)16:55
RoAkSoAxand use whichever you like better16:55
ClassBotThere are 5 minutes remaining in the current session.16:56
RoAkSoAxSo anyways, anyone has anything else for the last 5 minutes of the session?16:56
ClassBotstefwal asked: any good ways to test?16:57
RoAkSoAxstefwal, refer to https://wiki.ubuntu.com/UsingDevelopmentReleases/ for the steps on how to test techbreak_ shows how to run the download ISO16:57
RoAkSoAxstefwal, but that's the point, testing involves trying to do things16:58
RoAkSoAxyou can always follow ISO testing if you would like to contribute16:58
RoAkSoAxand it will show step by step on how to do it and you can use TestDrive for that16:58
RoAkSoAxstefwal, refer to iso.qa.ubuntu.com16:58
ClassBottechbreak asked: what after i finish downloading ? any link if get stuck ?16:59
ClassBottechbreak asked: can I burn cd /dvd from the downloaded image from testrive ?16:59
RoAkSoAxtechbreak_, yes: Slect the Image you'd like to burn and click on "Create USB disk"17:00
RoAkSoAxwhich will launch USB creator17:00
RoAkSoAxto finish please for more help you cn find me in channel #testdrive17:00
RoAkSoAxI believe my time is over. Thank you all for attending17:00
RoAkSoAxProject website: launchpad.net/testdrive IRC Channel: #testdrive17:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: LoCo Directory Hacking - Instructors: mhall119, cjohnston
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html following the conclusion of the session.17:01
mhall119Hello everyone17:02
mhall119my name is Michael Hall, and I'm one of the developers of the Ubuntu LoCo Directory17:02
mhall119I hope you've all been to http://loco.ubuntu.com already, but does anybody not know what it is?17:03
mhall119alright, quick overview then17:04
mhall119the loco directory is a community-driven project, meaning decisions and implementation are determined by the community, not Canonical17:05
ClassBottechbreak asked: mhall119, idk what is this sessoin about ? loco directory ???17:05
mhall119techbreak_: http://loco.ubuntu.com17:05
mhall119this session is going to get you ready to start hacking and contributing to it17:05
mhall119the loco-directory is written in Python, and uses the Django web framework17:06
mhall119you will need at least working knowledge of python, and some basic understanding of Django to work on LD17:06
mhall119if you don't currently have Django knowledge, don't worry, it's very easy and I'll go over some of it this hour17:07
mhall119the main developers of LD are myself, cjohnston, dholbach, Ronnie and daker17:07
mhall119we all hang out in #ubuntu-locoteams, and that's usually where we discuss LD development17:07
mhall119since loco.ubuntu.com is hosted on one of Canonical's servers running Ubuntu 10.04, we're restricted to the versions software in those repositories17:08
mhall119specifically python 2.6, Django 1.1, jQuery 1.3 and jQuery-ui 1.717:09
mhall119if you're running Lucid, you're all set17:09
mhall119if you're running Maverick or Natty, you'll need to grab those versions manually17:09
mhall119< YoBoY> QUESTION : we can't develop with earlier versions of python, django, ... or17:11
mhall119               it's just recomended ?17:11
mhall119since we develop on 2.6, and it'll be running 2.6 in production, it's generally a good idea for you to use 2.617:12
mhall119I can't say for sure that it won't work with 2.4, but it's likely17:12
mhall119I'm assuming you have all been introduced to the basics of bzr by now, but if not just ask about it as I go17:13
mhall119alright, lets get the code!17:13
mhall119cd to where you want it to live17:13
mhall119then run: bzr branch lp:loco-directory17:13
mhall119that'll get you a copy of the latest trunk17:13
mhall119trunk is almost always stable17:14
ClassBotRawChid asked: IS there a manual or webpage which describes how to do this?17:14
mhall119not that I know if, but ask us in #ubuntu-locoteams (after this session) and we can help you with it17:14
=== cmagina is now known as cmagina-lunch
mhall119okay, by now you should all have a local branch of loco-directory17:15
mhall119so cd loco-directory and let's take a look17:15
mhall119quick Django info:17:16
mhall119Django projects are divided between the root 'project' folder, and sub 'application' folders17:16
mhall119in the root of the branch, 'loco_directory' is the django project folder17:17
mhall119so cd loco_directory17:17
mhall119under there you'll see 'common', 'events', 'meetings', 'services', 'teams', 'userprofiles' and 'venues'17:17
mhall119those are all of the Django applications that make up LD17:18
mhall119'common' is just what it sounds like, it's for things that don't fit elsewhere17:18
mhall119'teams' contains all the code for LoCo Team records17:19
mhall119ls ./teams/17:19
mhall119a Django app typically has several standard files17:19
mhall119models.py is where you define your data models, Django will automatically turn these into SQL tables for you (you'll see that later)17:20
mhall119views.py is where you write the code that is responsible for responding to an HTTP request17:20
mhall119and urls.py maps a URL pattern to a view17:21
mhall119any questions so far?17:21
mhall119ok, moving on17:21
mhall119the 'events' and 'venues' are the apps that handle LD's event tracker, if you've used LD before you'll know what they do17:22
mhall119they have the same basic structure as 'teams', with models.py, views.py and urls.py17:22
mhall119same for 'meetings' and 'userprofiles'17:23
mhall119now, Django has a built-in templating system that we use.  Our views.py code will usually make use of one or more templates in rendering an HTTP response17:23
mhall119templates live under the 'templates' directory in the project folder17:24
mhall119if you ls ./templates/ you'll see that they're separated out by app as well17:24
mhall119so, to recap17:24
mhall119if you want to change data structures, it'll likely be in a models.py17:25
mhall119if you want to change the logic behind a display, it'll likely be in a views.py17:25
mhall119and if you want to change the interface (html), it'll likely be in the templates17:25
mhall119everybody with me so far?17:25
mhall119alright, let's get you guys setup with a working instance of LD17:26
mhall119first things first, lets look at settings.py in the project folder17:27
mhall119there's a lot of stuff in here, but the key piece is down around line 116: INSTALLED_APPS17:27
mhall119this is a list of apps that Django will use for this project17:27
ClassBotmonish001 asked: does Django works on MVC (model view controller framework)?17:28
mhall119yes, though they call it Model-View-Template, and things are slighting shifted17:28
mhall119specifically, the typical 'controller' logic is in the view, and most of the display stuff is in the templates17:29
mhall119okay, lets loot at INSTALLED_APPS17:29
mhall119the first 4 are the standard Django apps, auth gives us User and Group models, plus permissions17:29
mhall119contenttypes is really internal stuff you won't likely ever need to worry about17:30
mhall119sessions gives us automatic session tracking, just like any good web framework should17:30
mhall119admin is the best of them all, it'll give you a fully functional interface to manage the data in your database for all your defined models17:30
mhall119if you look in most of the application folders, you'll see amdin.py, which tells the admin app how to present your models17:31
mhall119the next 6 items in INSTALLED_APPS are the LD apps we've already gone over17:31
mhall119django_openid_auth is what let's us tie our users and groups to the Ubuntu Single Signon17:32
=== Mkaysi is now known as OmgBot
mhall119south is a special Django app, by default Django will create DB tables based on your models, but it won't change existing tables, which means once you create them you have to make any future changes manually17:32
=== OmgBot is now known as Guest83509
mhall119south lets you track your model structure, and will provide migration scripts whenever you make changes to them17:33
mhall119we make good use of south in the loco directory17:33
=== Guest83509 is now known as Mkaysi
mhall119if you look under most of the application folders, you'll see a 'migrations' folder, these are the south scripts17:33
mhall119ok, that's all for settings.py17:33
mhall119next step, copy local_settings.py.sample to local_settings.py17:34
mhall119we use local_settings.py for settings that are specific to a running instance of LD, they aren't checked into bzr17:34
mhall119there's not really anything you need to do with it right now, except make the copy17:35
mhall119everyone with me still?  The next part is setting it all up17:35
mhall119alright, lets get our database17:36
mhall119from the project folder, run "./manage.py syncdb"17:36
mhall119it will ask you for a superuser, select yes and give it a username, email and password17:36
mhall119syncdb is the Django command that created your initial database tables17:37
mhall119by default, LD will use a local sqlite3 file for it's database17:37
mhall119in production, it runs against postgres17:37
mhall119you're also free to use MySQL17:38
mhall119when syncdb finishes, you'll see a message about some apps not being synced because they're under south's migration control17:38
mhall119so after syncdb, run: ./manage.py migrate17:38
mhall119this will cause South to run through all  of it's migration scripts17:39
mhall119which will leave you with the proper table structures17:39
mhall119if you're using sqlite, you'll see some warnings because it doesn't support some contraints, don't worry about those17:39
mhall119finally, we'll need to initialize your setup, so run: ./manage.py init-ld17:40
mhall119init-ld does several things, it'll setup a group in your database for the LoCo Council, it will create necessary symlinks for jquery, and finally it'll grab a copy of lp:ubuntu-website/light-django-theme17:41
mhall119that last bit is important17:41
mhall119light-django-theme provides the base templates and CSS for several Django powered Ubuntu sites17:41
mhall119loco.ubuntu.com (of course), but also summit.ubuntu.com and 10.cloud.ubuntu.com17:42
mhall119everybody run all of those steps okay?17:42
* mhall119 looks at the clock17:42
mhall119okay, typically the next step is to either refresh your database with data from Launchpad,or refresh it with data from loco.ubuntu.com17:44
mhall119but, both of those take a while to run, so we're going to skip them and I'll just have you download a copy of loco_directory.db17:44
mhall119http://ubuntuone.com/p/fn1/17:44
mhall119put that into your project folder (over-writing the one you made with syncdb)17:44
mhall119for reference, "./manage.py lpupdate" will refresh teams and some users from Launchpad, but won't get events, venues or meetings17:45
mhall119"./manage.py import-live-data" will use LD's REST/Json services to download data from loco.ubuntu.com17:45
mhall119once you have the database file, run: ./manage.py runserver17:46
mhall119this will run django's built in webserver on localhost:800017:46
mhall119which you can then visit in your browser to see your local instance running17:47
mhall119oh yes, Ronnie brings up a point that I missed17:48
mhall119INSTALL file in the root of the branch has instructions for getting things setup17:48
mhall119one of the lines is a long apt-get install, which will get you all the dependencies17:48
mhall119okay, hopefully I've gotten you guys a working (or mostly working) isntance of the LD code17:49
mhall119the next step is to find a bug at https://bugs.launchpad.net/loco-directory to work on17:50
mhall119if you need help figuring out what needs to be done, just ask us in #ubuntu-locoteams17:50
ClassBotThere are 10 minutes remaining in the current session.17:51
mhall119but remember, data=models.py, logic=views.py, UI=templates17:51
mhall119that'll get you to the right place 90% of the time17:51
mhall119after you make the fix, test it locally first17:51
mhall119once you're happy with it, run: bzr commit -m "You message" --fixes lp:1234517:51
mhall119where 12345 is the bug number you're working on17:51
mhall119that'll help launchpad associate your code with that bug17:52
mhall119then: bzr push lp:~you/loco-directory/fixes-1234517:52
mhall119agian, I hope you've all been introduced to bzr and distributed development, so this should be familiar17:52
mhall119then go to https://code.launchpad.net/loco-directory, select your branch, and click the "Propose for merging" link17:53
mhall119then one of the main developers will review your code (when we have time, we all have actual jobs too)17:54
mhall119< chadadavis> QUESTION, doe the push statement make a new branch as well, or just17:54
mhall119                    upload the current branch?17:54
mhall119it will create a new branch in Launchpad, based off the lp:loco-directory branch17:55
mhall119these are very lightweight in launchpad, so don't hesitate to push stuff17:55
mhall119we typically have one branch per fix or feature17:55
ClassBotThere are 5 minutes remaining in the current session.17:56
mhall119once your code bases a review, we will merge it into lp:loco-directory17:56
mhall119from there it will get translated and wait for the next release of LD17:56
mhall119anything that lands in trunk will be in the next release17:56
mhall119we don't have a fixed release schedule though, so it's hard to say if it'll take days or weeks to get it out17:57
mhall119< YoBoY> QUESTION : can you point us some easy bugs to start working on ?17:57
mhall119we try to mark small/easy fixes as 'bitesize' in launchpad, you can get a list of them from https://bugs.launchpad.net/loco-directory/+bugs?field.tag=bitesize17:58
mhall119if you get stuck or have other questions, come find one of us in #ubuntu-locoteams17:58
mhall119and happy hacking!17:58
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Ubuntu ARM and the OMAP4 images - Instructors: ogra
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html following the conclusion of the session.18:01
ograhey hey18:02
ograso i will give a short insight into Ubuntu ARM, the team and the images we care for, i dont expect this to take much time so there should be plenty of time for questions (if there are any)18:03
ograthe ubuntu arm team (as the name suggests) cares for the arm port in ubuntu18:04
ograwe build images for different types of arm hardware18:04
ogratarget audience for these images are endusers18:04
ograand we try to make them an identical experience to any other ubuntu architecture, so you can expect identical functionallity as in any other ubuntu install18:05
ograinitially the ubuntu arm team consisted of 8 developers that cared for the whole archive18:06
ograall builds (and their failures) as well as all images had to be maintained by this small bunch of people18:06
=== daker is now known as Ghost_of_daker
ograrecently ARM recognized how important ubuntu was for them, so they started linaro ...18:07
ogralinaro is a consortium of companies taking care of improving arm and the arm experience18:07
ograi.e. nowadays if you get an arm board you will need a linux kernel from the vendor, a so called BSP18:08
ograusually that has tons of incompatible changes so the kernel couldnt be merged upstream in linus tree18:08
ograand you will also not run a kernel for board A on board B18:08
ogralinaros mission is to fix such issues18:09
ograso that at some point you have someting like the linux-generic package that runs on all arm hardware18:09
ograthey also care about the toolchain and compiler to get the best optimization out of them18:09
ograand they help a lot with failures to build from source18:10
ograso since linaro is around, the work of the ubuntu-arm team got a lot easier, we stand on their sholders now18:10
ogra...18:10
ograover the recent releases we built images for a variety of boards ... starting with freescales imx51 babbage board, marvells dove board (which is known from the press as armada board nowadays) and the very popular beagleboard from TI18:11
=== cmagina-lunch is now known as cmagina
ograwith maverick we started to work closely with TI to make ubuntu the reference platform for their OMAP4 pandaboard18:12
ograthis was released in 10.10 and gets improved in 11.04 now18:12
ograas architectures come and go the babbage and dove architectures vanished from our list of ports, omap 3 and 4 persist18:12
ograif you want to help out with arm development i would highly suggest to take a look at the pandaboard on http://pandaboard.org18:13
ograits is available for $175 and has all HW you can imagine18:13
ograwith the ubuntu install and the TI addons it is fully capable of playing 1080p video18:14
ograso if you are intrested in arm development on ubuntu a beagleboard (see beagleboard.org) or a panda is the way to go18:14
ografor people that cant afford hardware we also worked out cross ways of building and testing arm packages, the qemu-kvm-extras-static package brings all you need to run an arm chroot on your x86 boax18:15
ografor testing and devevlopment thats a good start18:15
ografor the highly embedded thinking people linaro offers a cross toolchain and the xdeb packages that makes it possible to cross build packages for arm on an x86 host18:16
ograif you are intrested in tryinf out our images you can find install instructions and download links at https://wiki.ubuntu.com/ARM/OMAP it sill always list links to the different release centric instructions18:17
ograok, enough of me babbling i think :)18:17
ograthere are some questions18:18
ClassBotdarkdevil75 asked: arm?18:18
ograyes :)18:19
ClassBotmonish001 asked: arm port means arm hardware architecture platform?18:19
ograright, it means the CPU you carry in your mobile phone, tablet or (rarely) in your netbook18:19
ClassBotmonish001 asked: why is arm hardware important?18:19
ograheh, well, as you see above it runs very transparently in many devices ... you can find arm in your dishwasher as well as in your mobile phone or the ipad18:20
ograeven in TVs18:20
ograARM CPUs usually eat a tenth of the power of an x86 CPU while providing the same computing power18:21
ograthat means you usually dont need a fan for example18:21
ograwithin the last years ARM CPUs turned from very low profile embedded things into powerful CPUs18:22
ograi'm currently typing on a netbook (toshiba ac100) that is powered by an arm dual core cpu and can easily take it up with an atom18:22
ograbut it only weights 700garms and has no fans18:22
ograin the next years you will very likely see arm approaching the server market18:23
ograin a datacenter the most power is used to keep the air condition running ... wirth arm CPUs that cost will drop significantly18:23
ogra...18:23
ograthats why arm is an important arch18:24
ogra(and in my personal opinion the future)18:24
ClassBotbeachbrake asked: Why are ARM development boards more expensive? (from the point of view of a student)18:24
ograwell, i dont think the beagle or pandaboards are much more expensive than and intel mainboard+cpu+graphics card+network card18:25
ClassBotchadadavis asked: are compiler developers (i.e. GNU) also involved, or is Linaro also taking that upon themselves?18:25
ogralinaro is working with gcc upstream and if you know a bit about arm you will know about codesourcery, they are part of linaro18:25
ograso all work done on the compiler is done very closely with all entities that are involved in arm gcc nowadays18:26
ClassBotbullgard asked: "recently ARM recognized how important ubuntu was for them" <- Why is ARM important for Ubuntu end users?18:26
ograwell, once you can buy netbooks with arm cpu and have a battery life of 3days you will know ;)18:27
ograhonestly though, tablets, netbooks and mobile phones are the future18:27
ograwhile ubuntu doesnt offer any UI options for the latter two, having the distro running on such platforms enables the developer community to work on them18:28
ograso you can work on your concept of porting unity to a mobile phone if you are intrested for example ;)18:29
ClassBotfisch246 asked: when will Ubuntu Server support ARM?18:29
ograwell, theoretically it already does18:29
ograyou can turn a pandaboard into a server and i.e. use it as webserver etc18:29
ograpractically we might work on server images in future releases, server has always been on our list of devices to support, currently we only focus on netbook though18:30
ClassBotbullgard asked: What do you mean by "low profile" in "ARM CPUs turned from very low profile embedded things into powerful CPUs"? ("low profile" appears to have several meanings in English.)18:30
ograwell, i actually meant "underpowered"18:30
ogra:)18:30
ograarm CPUs in the past were designed exactly for a low power task ... i.e. run your dishwasher or your TV settop box18:31
ograthere was no focus in running a desktop or full server on them18:31
ogra(though there were many embedded servers around ... your router might run an embedded arm with a webserver UI)18:32
ograover the recent years arm simply "grew up" your smartphone is as powerful as your PC was 5 years ago nowadays and you can play games you wouldnt have imagined a few years ago18:33
ogra(or watch HD movies or ... or ...)18:33
ClassBotbullgard asked: Is a Ubuntu image enough software or does one need additional software to run Ubuntu from an ARM board?18:33
ogradepends what hardware you look at18:33
ograthe omap3 and 4 images we provide also offer you the missing bits and pieces (closed source drivers etc) in an easy way so you can get up and running within minutes18:34
ograthough the bare image is always good enough to start working right away18:35
ograthe install isnt harder than on x86 and it doesnt behave different in userspace18:35
ClassBotbalau asked: Debian is working on ARM ports, too. Is Ubuntu (and Linaro) coordinated with Debian on this front?18:35
ograINDEED !!!18:35
ograi just returned from the emdebian sprint this weekend where debian, linaro, ubuntu and genesi met for working on improvements of the arm port18:36
ograand as with x86 debian is our upstream for packages, even though ubuntu is optimized more18:36
ograubuntu builds focus only on the last two generations of arm cpus while debian tries to be backwards compatible for a lot more boards18:37
ograbut that goes at the cost of performance18:37
ograthe first arm port in ubuntu was a nearly unmodified rebuild of debian18:38
ograoptimizations and architecture specific improvements happened since though18:38
ClassBotjderose asked: what hardware do you recommend for uTouch + ARM?18:38
ograoh, thats hard to say since i dont know what HW utouch supports yet, i would recommend talking to the utouch guys for this18:39
ogratheoretically all hardware that runs on x86 will also run on arm18:39
ograi.e. a usb touchscreen you attach to x86 that is supported by utouch will definitely also work on an arm device18:40
ClassBotchadadavis asked: Are licenses required to distribute the necessary drivers?18:40
ograyes18:40
ograpowervr (which you might know as poulsbo from the intel world) is the most sold 3D chip in the arm world18:41
ograsadly the situation isnt much better than with nvidia drivers here18:41
ograthe drivers are freely usable but not distributable in images18:41
ograso we have a set of PPAs for these and a process that automatically installs them after first boot if you chose so18:42
ograin cases where you have to accept an EULA this is shown and you can approve or decline it18:43
ClassBotjderose asked: speaking of drivers, embedded graphics drivers are a big concern for me... looking at ARM website, I got the impression the Mali-T604 might have fully open-source drivers... do you know if this is true?18:43
ograi know there are plans that all drivers should go opensource but i dont know if this is already the case18:43
ograin fact there is only one board that just came out that uses the mali engine, the linaro guys might know more about this board18:44
ClassBotabhinav19 asked: so your work involves working at the kernel level or user space packages also need to be modified ? and also, how can new developers get started if they are interested in contributing or learning ?18:44
ograour work involves everything that makes up ubuntu18:44
ografrom the kernel up to UI we make sure everything works on the platform18:45
ograwhile i'm not particulary a kernel guy we gave persons in the team that cover that area and we have community developers that help out as well18:46
ograif you want to get started i would suggest dropping by ion #ubuntu-arm, this is the channel where we all hang out18:46
ograand there is also the #linaro channel if you are more intrested in the hardcore lowlevel stuff ... like assembler, hacking on toolchains or any other bit thats very close to the hardware18:47
ograjederose said he was hoping i could give him a recommendation for a touchscreen regarding his question above18:48
ograi cant really, what i know is that the liliput displays work quite well18:48
ograthey are mainly for car entertainment, but they are cheap and can do full HD18:49
ogra(and come with a USB touchscreen by default)18:49
ograafaik there is no actual recommendation from TI for pandaboard touchscreens18:49
ograyou could ask in #pandaboard though :)18:50
ograso there are 10min to go but no questions left18:50
ograi hope i could give some insight in the ubuntu world of arm, linaro and the omap images, thanks for the questions :)18:51
ClassBotThere are 10 minutes remaining in the current session.18:51
ogratsimpson, i think i'm done, feel free to take the stage18:51
tsimpsongive me a minute to get my notes :)18:52
ograoh, there is another question ...18:53
ograi can answer while tsimpson gets his notes18:53
ClassBotjderose asked: have the Linaro members (TI, Freescale, IBM, Samsung, etc)... been sympathetic to the importance of fully open-source drivers?  Are you optimistic about improvements on this front?18:53
ograi think tehy see the need but after all they are all business people indeed18:53
ograin fact though, the powervr situation changed a lot during the last year18:54
ograpart of that is because of TI pushing for more openess18:54
ClassBotabhinav19 asked: thanks. well I dont have the capacity to buy ARM hardware right now. So if one wants to do application level development, is there some thing like a simulator or emulator to run on PC ?18:55
ograyes, as i noted above, there is the qemu-kvm-extras-static package that gives you a chroot ... and indeed you can run qemu VMs18:55
ClassBotThere are 5 minutes remaining in the current session.18:56
ograif there are remaining questions, feel free to come by in #ubuntu-arm at any time, the team is there and happily helps18:57
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: How supybot killed my mind - Instructors: tsimpson
tsimpsonHello everyone \o19:01
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html following the conclusion of the session.19:01
tsimpsonmy name is Terence Simpson, and I'm lead developer of the Ubuntu Bots project (that's the one that gives us ubottu and friends)19:01
tsimpsonI'm also an IRC operator in several Ubuntu channels, and a councillor on the Ubuntu IRC Council19:01
tsimpsonso I have come to know IRC quite well over the years19:01
tsimpsonand contrary to some reports, I haven't been hacking on IRC bots since I was 5, I'm just not that 1337 ;)19:01
tsimpsonthis is the Launchpad project for Ubuntu Bots: https://launchpad.net/ubuntu-bots19:01
tsimpsontoday I'm going to talk to you a bit about the IRC protocol, and creating a simple plugin for the supybot IRC bot19:02
tsimpsonso you may want to 'sudo apt-get install supybot' now if you want to play along19:02
tsimpsonthe IRC bot most of you will be familiar with is ubottu, or one of its ubot* and lubotu* clones19:02
tsimpsonthese bots are all standard supybot IRC bots with our custom plugins, which are developed in the launchpad project above19:03
tsimpsonlater, I'll go through creating a custom plugin, some python knowledge is required for that part19:03
tsimpsonbefore that though, you should know a something abou the IRC protocol itself19:03
tsimpsonsome of what I'm going to discuss may not be necessary for developing a supybot plugin, but it's useful to understand what's actually going on19:03
tsimpsonalso, other IRC bots may require more/less knowledge than others, or you may be feeling particularly insane and want to write your own IRC bot/client19:04
tsimpsonhttp://www.irchelp.org/irchelp/rfc/ contains lots useful information about the IRC protocol, as well as the RFC (the document describing the IRC protocol)19:04
tsimpsonthe general way IRC works is, you send a command to the IRC server, followed by carriage-return new-line, and it responds in some way19:04
tsimpsonin this way we say IRC is an "event driven" protocol19:04
tsimpsonthe carriage-return and new-line characters are represented by "\r" and "\n" in character strings, new-line is also known as line-feed19:04
tsimpsonand the server uses those two characters to determine when you're done sending your commands19:05
tsimpsonthe IRC command you'll care most about when developing an IRC bot, or plugins for IRC bots, is the "PRIVMSG" command19:05
tsimpsona PRIVMSG is how I'm talking to you now, it how clients send messages, and despite its name, it's not inherently a PRIVate MeSsaGe.19:05
tsimpsonwhen you type a message into your IRC client, and hit enter, the client will send a PRIVMSG command to the server19:05
tsimpsoncommand in IRC usually have some arguments/parameters that go along with them19:06
tsimpsonfor PRIVMSG, you'll want to tell the server where you want the message sent to19:06
tsimpsonand what the message is19:06
tsimpsonin IRC each argument is separated by a space19:06
tsimpsonif you need to send an argument with a space in it, it has to be the last argument and it needs to be prefixed with a ':' character19:06
tsimpsonour messages usually contain spaces, so that's an instance of where you need to do that19:06
tsimpsonso here's an example19:06
tsimpsonif I wanted to send the message "Hello World!" to the channel "#mychannel", this is what my client would send:19:07
tsimpsonPRIVMSG #mychannel :Hello World!\r\n19:07
tsimpsonthe way the server responds to this is to forward that message to all of the other servers it's connected to and clients connected to it19:07
tsimpsonhowever, when the server forwards these messages, it adds something called a "prefix" to the message19:07
tsimpsonhis prefix tells everyone who receives the message where it came from, it's made up of your nick name, user/ident, and host. then prefixed with a ':'19:07
tsimpsonthe format is ':nick!ident@host', so the prefix for me is ":tsimpson!~tsimpson@ubuntu/member/stdin"19:07
tsimpsonwhen your client sees the "Hello World!" message from me, it would receive this:19:07
tsimpson:tsimpson!~tsimpson@ubuntu/member/stdin PRIVMSG #mychannel :Hello World!\r\n19:08
tsimpsonthe only difference between a public channel message and a private one-to-one message is the "target"19:08
tsimpsonthe target is either a channel, as #mychannel is above, or a nick of another user19:08
tsimpsonthere are lots of commands in the IRC protocol, like NICK, JOIN, PART, QUIT, PRIVMSG, NOTICE, MODE, and many numeric commands19:08
tsimpsonall the numeric commands come from the server and are usually informational or indicate errors19:08
tsimpsonall these messages have the same form when you receive them19:08
tsimpson:<prefix> <command> <arg0..argN> :<last>19:08
tsimpsonwhere each item after the <command> is optional (depending on the command)19:09
tsimpsonit's also worth noting that when you get a message from the server, rather than another person, the <prefix> is the server rather than a user mask19:09
tsimpsonfor instance, if you connect to someserver.freenode.net, that will be the prefix when you get a message from the server.19:09
tsimpsonusing the information in the IRC RFC you could create your own IRC client, and have that do whatever you wanted19:09
tsimpsonand IRC bot is just an IRC client that reacts to the messages in some custom way19:09
tsimpsonreally, there is no difference between a "real" IRC client, and some script that connects to an IRC server19:09
tsimpsonanother thing to note about IRC, is that it has no character encoding. that is, it's not ASCII, or UTF-8, or anything19:10
tsimpsonit is up to the client to figure out what each particular message is encoded in19:10
tsimpsonbut most clients are UTF-8 aware by default, and that's what you should use19:10
tsimpsonIRC is also case insensitive, that is "PRIVMSG #MyChannel" and "privmsg #mychannel" are exactly the same command with exactly the same destination19:10
tsimpsonthe only exception to this is the characters '{', '}', and '|', which are considered the lower-case forms of '[', ']' and '\', respectively19:10
tsimpsonthe reason for that has to do with IRCs Scandinavian origin, and it's something you'll need to be aware of when comparing nick names etc19:11
tsimpsonfrom that, you should have a good idea of how ubottu works when responding to factoid requests19:11
tsimpsonit receives a PRIVMSG command from the server, looks at the message target (a channel or itself)19:11
tsimpsonif the message is in a channel, it checks that it starts with the '!' character19:11
tsimpsonthen it goes looking in its database for that factoid reply, and sends that off to either the channel or the nick name19:11
tsimpsonubottu does more complicated things than that19:11
tsimpsonlike prefixing a nick in the "!factoid | nick" form, and sending the messages in private with the "!factoid > nick" form19:11
tsimpsonthat's a little more complicated, but it all starts with a PRIVMSG command.19:12
tsimpsonthere's lots more I could tell you about the IRC protocol19:12
tsimpsonbut I wanted to give you an example of how to write a plugin for supybot19:12
tsimpsonsome Python knowledge is required here on in, but you should get the general idea even if you don't know Python19:12
tsimpsonif you've installed supybot, you can see its files in /usr/share/pyshared/supybot/19:13
tsimpsonthe first thing you need to do, after installing supybot, is to choose a directory where your bot is going to live in19:13
tsimpsonthis will be where all the config file and plugin will go19:13
tsimpson~/bot is a good example, and that's what I'm going to use in this example19:13
tsimpsonyou need to have a terminal open for this, as supybot is set-up via the command-line19:13
tsimpsonirst you create the directory; "mkdir ~/bot", then change to that directory; "cd ~/bot"19:14
tsimpsonthen you run though the supybot set-up with the "supybot-wizard" command from ~/bot19:14
tsimpsonyou can just hit enter for the first question about bolding, and then 'y' if it works19:14
tsimpsonchoose 'n' for the question "Are you an advanced supybot user?"19:14
tsimpsonyou can look through that later if you want, but it's not necessary right now19:14
tsimpsonthen hit enter to create the directories in the current (~/bot) directory19:14
tsimpsonfor the "IRC network", enter: freenode19:14
tsimpsonfor the server: irc.freenode.net19:15
tsimpsonthen hit enter (or choose 'n') for "Does this connection require connection to a non-standard port?"19:15
tsimpsonthen you need to choose a nick name for your bot, remember that it needs to be unique on the network (so don't choose ubottu ;)19:15
tsimpsonfor this example, I'll refer to the nick "mybot", but you should choose something different19:15
tsimpsonpress enter, or choose 'n', for the question about setting a server password19:15
tsimpsonnext it'll ask if you want the bot to join some channels when it connects, you'll want to choose 'y' here19:15
tsimpsonyou should now get yourself a temporary channel, this is easy enough, you just join an empty channel19:15
tsimpsona good idea is to create one based on your nick, so if you are "someone", you'd /join ##someone19:15
tsimpsonthe double-# on freenode indicates it's an "about" or unaffiliated channel, anyone is free to create that kind of channel on freenode19:16
tsimpsonso, once you're in your new channel, type the name into the supybot wizard and press enter19:16
tsimpsonsupybot comes with many plugins pre-installed, you can look at them later19:16
tsimpsonfor now just answer 'n' when it asks if you want to look at them individually19:16
tsimpsonnext, it will ask if you want to add an owner for the bot, you do19:16
tsimpsonsupybot will only accept certain commands from an owner or an admin19:17
tsimpsoncommands that make it join/part channels or change nicks or quit for example19:17
tsimpsontype in your IRC nick for the user-name and then pick a password you'll use19:17
tsimpsonit'll ask twice for the password to make sure you don't mistype19:17
tsimpsonthe next question is about the "prefix char", this is a character that the bot will use to recognise when you are giving it a command19:17
tsimpsonpress 'y', then enter, then you can choose a character. a good choice is the '@' character19:17
tsimpsonand that's it, a basic set-up for a working supybot IRC bot19:17
tsimpsonto start the IRC bot and get it connected to IRC, you run the command "supybot mybot.conf" (where "mybot" is the nick you chose for your bot)19:18
tsimpsonyou'll see it connecting from the console, it'll print lots of information there so you can monitor it19:18
tsimpsonas a note, you can run a supybot instance in "daemon" mode by adding '-d' to the command19:18
tsimpsonthat will make the supybot instance run in the background and log messages to ~/bot/log/messages.log19:18
tsimpsonfor now though, we will want to see the messages in case there are any errors when we start developing a plugin19:18
tsimpsonwhich is quite common19:19
tsimpsonyou should see something like "Join to ##someone on freenode synced in 1.15 seconds.", that means the bot has successfully joined the channel you gave it19:19
tsimpsonand you should see it sitting there in your channel19:19
tsimpsonthe first thing you need to do is let the bot know you are the owner, you do this in /msg as it requires you sending a password19:19
tsimpsonso you do /msg mybot identify someone my_password19:19
tsimpson(changing "someone" and "my_password" for the name of the owner and the password you gave to supybot-wizard)19:19
tsimpsonyou should get a message back with "<mybot> The operation succeeded."19:20
tsimpsonthe bot knows you are the owner now19:20
tsimpsonnext you should type this in the channel where the bot is: @config supybot.reply.whenNotCommand False19:20
tsimpson(replacing '@' with the prefix character you choose)19:20
tsimpsonI'll come back to why you did that that later19:20
tsimpsonwith its default set-up, the bot won't do very much19:20
tsimpsonso we are going to make a plugin for the bot to do something :)19:20
tsimpsonyou'll want to open another terminal window/tab and navigate to ~/bot/plugins (cd ~/bot/plugins)19:21
ClassBotabhinav19 asked: are there any additional dependencies or requirements for running supybot-wizard as I got some errors ?19:21
tsimpsonthere shouldn't be19:21
tsimpsonit just requires the basic python stuff19:21
tsimpsonwhich should be pre-installed19:22
tsimpsonok, so we're in ~/bot/plugins19:22
tsimpsonhat is where the bot will look for plugins you create for it19:22
tsimpson*that19:22
tsimpsonwe are going to create a plugin, called Say, that will make the bot say something when we tell it to19:22
tsimpsonit will have one command in it, "say", which will repeat everything after the command19:22
tsimpsonso when we do "@say Hello, World!", our bot will reply with "Hello, World!"19:23
tsimpsonhow exciting :)19:23
tsimpsonto start we run the command "supybot-plugin-create"19:23
tsimpsonit'll ask what the name of the plugin should be19:23
tsimpsonet's choose "Say"19:23
tsimpson(plugin names should usually start with an upper-case character)19:23
tsimpsonthe question about if it should be threaded is for more advanced plugins, that may be doing many things at the same time. we don't need that so we choose 'n'19:23
tsimpsonit'll then ask for your real name, so it can add a copyright and licensing information, go ahead and enter that19:23
tsimpsonand choose 'y' to use the Supybot license19:24
tsimpsonyou can choose another license for your plugins if you wish, but the supybot license is an open-source license19:24
tsimpsonthe template for the plugin should now be in the "Say" sub-directory at ~/bot/plugins/Say, so navigate there19:24
tsimpsonyou'll see 5 files and one directory, "config.py", "__init__.py", "plugin.py", "README.txt", and "test.py" are the files19:24
tsimpsonthe directory is there in case you want to create custom python modules19:24
tsimpsonwe won't be using it in this example, but it does no harm being there19:24
tsimpson"config.py" is where all the configuration for the plugin will go, we don't need any configuration for this plugin, so we won't modify that19:24
tsimpson"__init__.py" is there to make that directory a python module, you can put some things in there if you wanted, but we don't need to do anything special here19:25
tsimpson"plugin.py" is where our actual plugin code will be, we'll come back to that in a second19:25
tsimpson"README.txt" is pretty self-explanatory, it's where you'll put some information about your plugin, like a description and any set-up information19:25
tsimpson"test.py" is for testing, for complex plugins you can use that with the supybot-test script to run tests on the plugin19:25
tsimpsonnow go ahead and open plugin.py in your favourite editor or python IDE19:25
tsimpsonthe comment block at the top is the your copyright and the supybot license19:26
tsimpsonthen it has some default imports followed by our plugin class "class Say(callbacks.Plugin):"19:26
tsimpsonall supybot plugin classes need to derive from supybot.callbacks.Plugin in some way, and there are a few special sub-classes too19:26
tsimpsonthen is the line "Class = Say"19:26
tsimpsonwhen supybot imports a plugin module, it looks for "Class" in that module to identify the plugin19:26
tsimpsonand in __init__.py it imports "plugin", and sets Class = plugin.Class19:26
tsimpsonnow we should change the doc-string to something meaningful19:27
tsimpsonsupybot uses the doc-strings of classes and methods to provide the "@help" command19:27
tsimpsonso it's good practice to always document as you go19:27
tsimpsonsomething like """A plugin to say something when told to""" is good enough for this plugin19:27
tsimpsonwhen supybot receives a command from the IRC server, it looks for a corresponding method in the plugins it has loaded19:27
tsimpsonthe command is lower-cased and capitalized, so "PRIVMSG" becomes "Privmsg"19:27
tsimpsonthe method supybot looks for is "do" followed by the command19:28
tsimpsonso, if we want to listen for channel/private message, we need to create an "doPrivmsg" method19:28
tsimpsonfor all of these kinds of method, supybot passes 2 arguments19:28
tsimpsonan instance of the supybot.irclib.Irc class (or a wrapper class), which represents the IRC client/bot, remember there's really no difference19:28
tsimpsonand an instance of the supybot.ircmsgs.IrcMsg class, which represents and IRC message19:28
tsimpsonin our method the Irc class we get will be a 'supybot.callbacks.ReplyIrcProxy'19:28
tsimpsonit just adds some convenience methods for replying to messages19:29
tsimpsonthe Irc instance will contain information such as the network connected to19:29
tsimpsonnick name of the bot on that network19:29
tsimpsonand state information, like what channels are joined and what users are in those channels etc19:29
tsimpsonas I mentioned earlier, when you want to compare channels or nicks in IRC, there are some special characters to consider19:29
tsimpsonsupybot has some utility function that help us, they are located in the supybot.ircutils module, which is already imported as "ircutils"19:29
tsimpsonback to the plugin19:30
tsimpsonin you plugin class (Say), remove the line "pass"19:30
tsimpsonthen create a method called "doPrivmsg" taking 3 arguments, "self", "irc", and "msg"19:30
tsimpsonyou should now have something similar to http://people.ubuntu.com/~tsimpson/botdev/plugin.1.py19:30
tsimpsonstill nothing useful there, but we're about to change that19:30
tsimpsonthis doPrivmsg method of our plugin class will be called when ever the bot sees a message19:30
tsimpsonnow, we need some way to tell if the message was addressed to the bot or not19:31
tsimpsonwe don't want our bot to respond to random messages after all19:31
tsimpsonour bot is addressed for example, if the message starts with the bots nick or command character you set19:31
tsimpsonnow we could write some code to do all that19:31
tsimpsonbut I'm lazy ;)19:31
tsimpsonand besides, we don't need to19:32
tsimpsonthere is a "addressed" function in the 'supybot.callbacks' module which will do all that for us19:32
tsimpsonand supybot.callbacks is already imported as 'callbacks' for us19:32
tsimpsonwe give it the bots nick, and the IRC message ('msg' parameter)19:32
tsimpsonit will either return an empty string, in which case the bot wasn't addressed19:32
tsimpsonor it will return the message without the part of the message used to address the bot19:32
tsimpsonfor example, if the message way "mybot: this is a message", and we executed this code:19:32
tsimpsonmessage = callbacks.addressed(irc.nick, msg)19:32
tsimpsonthe result in 'message' would be "this is a message"19:32
tsimpsonf the message was just "this is a message", then 'message' would be an empty string ''19:33
tsimpsonby the way, as I mentioned above the 'irc' parameter contains information, such as the bots nick. that's what 'irc.nick' gives us19:33
tsimpsonin the 'msg' parameter there is the property 'args'19:33
tsimpsonthat holds a tuple with all the arguments of the message19:33
tsimpsonremember that PRIVMSG has 2 arguments19:33
tsimpsonthe "target" (a channel or nick), and the message19:33
tsimpsonthe target is in 'msg.args[0]' and the message is in 'msg.args[1]'19:33
tsimpsonwhen we call 'callbacks.addressed', it looks at both msg.args[0] and msg.args[1]19:33
tsimpsonit will check if msg.args[0] (the target of the message) is the bots nick, in which case it is a private message19:34
tsimpsonso, the first thing we do in our doPrivmsg method, is this:19:34
tsimpsonmessage = callbacks.addressed(irc.nick, msg)19:34
tsimpsonthen we can check if 'message' is empty and, in that case, just return19:34
tsimpsonthis is the code:19:34
tsimpsonif not message:19:34
tsimpson    return19:34
tsimpsonthat way our plugin will just ignore all the messages which are not addressed to it19:34
tsimpsonnext we will need to check that the message is our "say" command19:34
tsimpsonwe can do this by splitting off the first word of 'message' and checking that it equals 'say'19:35
tsimpsonwe'll also want to remove it from the 'message' string, as it's not part of what we are supposed to repeat19:35
tsimpsonthis is the code:19:35
tsimpsonbot_cmd = message.split(None, 1)[0]19:35
tsimpsonmessage = message[len(bot_cmd):].strip()19:35
tsimpsonhere we're also slicing the 'message' to remove the command, and calling strip on that19:35
tsimpsonthe command could well just be one word, so we can't just split it and assign to two variables19:35
tsimpsonwe need to use strip() so that we don't have any leading space if/when we reply19:35
tsimpsonnow we check if the command in 'bot_cmd' is the one we are looking for19:35
tsimpsonthis is the code:19:36
tsimpsonif bot_cmd.lower() != 'say':19:36
tsimpson    return19:36
tsimpsonwe lower-case the command and check if it's "say", if not we just return as we aren't interested in other commands19:36
tsimpsonthe next thing we need to do is check if we were actually given a message to repeat19:36
=== mrjazzcat is now known as mrjazzcat-lunch
tsimpsonthere's not much point calling a command that repeats a message without a message to repeat!19:36
tsimpsonif we weren't give a message, then we need to respond with an error message indicating that we need more arguments19:36
tsimpsonremember that 'message' is now whatever was left after we removed the command19:36
tsimpsonthis is the code:19:36
tsimpsonif not message:19:36
tsimpson    irc.error("I need something to say")19:36
tsimpson    return19:36
tsimpson'error' is a method on the 'irc' object that lets us respond with an error message19:37
tsimpsonit will prefix "Error: " to whatever message you pass to it19:37
tsimpsonif we get past that part of the code, then we know three things19:37
tsimpson1) we know the bot was addressed in some way19:37
tsimpson2) we know the command is "say"19:37
tsimpson3) we know we have the message to repeat19:37
tsimpsonthe only thing left to do, is actually repeat the message!19:37
tsimpsonthis is the code:19:37
tsimpsonirc.reply(message)19:37
tsimpsonthat's it, the 'reply' method does exactly what you think it does, replies to the message we got19:37
tsimpsonnow our plugin is ready to be used, it should look something like this: http://people.ubuntu.com/~tsimpson/botdev/plugin.2.py19:38
tsimpsonthat's around 12 lines of python we've added, and it does exactly what we want :)19:38
tsimpsonto tell you bot to load that plugin, you issue the command "@load Say" in the channel it's in, or in a /msg19:38
tsimpsonyou should see a "The operation succeeded." message from the bot19:38
tsimpsonif you get an error message, you probably have some typo in the code19:38
tsimpsonnow you can test the plugin out19:38
tsimpsonI'll have nubotu join here to show you how it should work19:39
tsimpsonnubotu is my general testing/development bot19:39
tsimpson@load Say19:39
nubotutsimpson: The operation succeeded.19:39
tsimpson@say Hello, World!19:39
nubotutsimpson: Hello, World!19:39
tsimpsonthe bot won't respond to this message, callbacks.addressed() will return an empty string19:39
tsimpson@the bot won't respond to this either, as "the" is not the "say" command we want19:39
tsimpsonnubotu: and it won't respond here, as "and" isn't the "say" command either19:39
tsimpsonthis will cause nubotu to respond with an error, as I'm leaving out the message19:40
tsimpson@say19:40
nubotutsimpson: Error: I need something to say19:40
tsimpsonnifty ey?19:40
tsimpsonnow, even though that's only around 12 lines of code19:40
tsimpsonit's still an awful lot of code for a simple repeater command19:40
tsimpsonfortunately supybot can help us some more here19:40
tsimpsonin the above example, we didn't really create a command19:40
tsimpsonat least not in the sense supybot cares about19:40
tsimpsonremember we did "@config supybot.reply.whenNotCommand False"?19:40
tsimpsonif we set that back to True, you'll see what I mean19:41
tsimpson@config supybot.reply.whenNotCommand True19:41
nubotutsimpson: The operation succeeded.19:41
tsimpson@say19:41
nubotutsimpson: Error: "say" is not a valid command.19:41
nubotutsimpson: Error: I need something to say19:41
tsimpson@say Hello, World!19:41
nubotutsimpson: Error: The "Say" plugin is loaded, but there is no command named "Hello," in it.  Try "list Say" to see the commands in the "Say" plugin.19:41
nubotutsimpson: Hello, World!19:41
tsimpsonthat's not so good :(19:41
tsimpsonin supybot, we create command by defining a method of the same name, and then "wrapping" it19:41
tsimpsonI'll talk more about wrap in a second19:41
tsimpsonso now go ahead and delete the entire "doPrivmsg" method from your plugin.py19:41
tsimpsonthe whole thing19:42
tsimpsonwe don't need it19:42
tsimpsonand replace it with this:19:42
tsimpsondef say(self, irc, msg, args, message):19:42
tsimpson    """<message>19:42
tsimpson    Repeats <message>19:42
tsimpson    """19:42
tsimpson    irc.reply(message)19:42
tsimpsonand that's our 'say' command19:42
tsimpsonthe doc-string describes how to use the command, we take only one argument '<message>', so that goes on the first line19:42
tsimpsonthen we have a blank line, followed by a description of the command.19:42
tsimpsonthis will be shown when we do @help say19:42
tsimpsonthe irc and msg parameters are pretty much the same as in our previous doPrivmsg method19:42
tsimpsonexcept that 'irc' will usually be a supybot.callbacks.NestedCommandsIrcProxy, that' not something you really need to care about though19:43
tsimpsonyou don't need to worry about the 'args' parameter for now, it's for more advanced commands19:43
tsimpsonthe 'message' parameter is what is going to hold the message we are supposed to say, we don't need to do anything special like with doPrivmsg19:43
tsimpsonwhen our command method is called, we *will* have a message to repeat, 'wrap' will make sure for us19:43
tsimpsonnext we need to tell supybot that that method is a command, we do this using the 'wrap' function, which is imported from supybot.commands19:43
tsimpsonput this under you method:19:43
tsimpsonat the same indentation as "def"19:43
tsimpsonsay = wrap(say, ['text'])19:44
tsimpsonthe 'wrap' function takes a method, and then a list of so-called "converters"19:44
tsimpsonin this case, we only want some text, we don't care what it is as long as it's there19:44
tsimpsonby the way, if you are creating a command that doesn't take any parameters, you can use wrap as a method decorator by putting '@wrap' before the definition19:44
tsimpsonbut you'll usually want to have some parameters for your commands19:44
tsimpsonnow your plugin.py should look like this: http://people.ubuntu.com/~tsimpson/botdev/plugin.3.py19:44
tsimpsonwithout all the comments and doc-strings, it's just 3 lines. nice :)19:44
tsimpsonlet's reload the plugin so the changes take effect19:45
tsimpson@reload Say19:45
nubotutsimpson: The operation succeeded.19:45
tsimpsonnow we test19:45
tsimpson@help say19:45
nubotutsimpson: (say <message>) -- Repeats <message>19:45
tsimpson@say Hello, World!19:45
nubotutsimpson: Hello, World!19:45
tsimpson@say19:45
nubotutsimpson: (say <message>) -- Repeats <message>19:45
tsimpsonnubotu: say hello to all the people19:45
nubotutsimpson: hello to all the people19:45
tsimpsonit works!19:45
tsimpsonby the way, if you do '@config supybot.reply.withNickPrefix False', it won't prefix your nick to the response19:45
tsimpson@config supybot.reply.withNickPrefix False19:46
nubotutsimpson: The operation succeeded.19:46
tsimpsonnubotu: say hello to all the nice people19:46
nubotuhello to all the nice people19:46
tsimpsonand that's the _basics_ of building plugins for supybot19:46
tsimpsonthings can get a lot more complicated very quickly, have a look at our plugins at: http://bazaar.launchpad.net/~ubuntu-bots/ubuntu-bots/devel/files19:46
tsimpsonthat's basically ubottu right there19:46
tsimpsonthere's also some useful documentation for using supybot at http://supybook.fealdia.org/latest/ and http://ubottu.com/supydocs/19:46
tsimpsonand the documentation that comes with supybot in /usr/share/doc/supybot/, especially the USING_WRAP.gz document19:46
tsimpsonoh, and come join us in #ubuntu-bots-devel if you want to help make ubottu even better :)19:47
tsimpsonI'll answer any questions you may have now19:47
tsimpson(but please don't expect me to know the details of other IRC bot programs, I'll do my best though ;)19:47
tsimpsonnubotu: part19:47
tsimpsonhey, I just zoomed through the IRC protocol and bot plugin development in 47 minutes19:48
tsimpsonno one has questions?19:49
ClassBotThere are 10 minutes remaining in the current session.19:51
ClassBotMkaysi asked: Doesn't Supybot require pysqlite ?19:52
tsimpsonno19:52
tsimpsonnot the basic supybot19:52
tsimpsonbut as the plugins are just python modules19:52
tsimpsonthey can, and do, have their own dependencies19:53
tsimpsonEncyclopedia (the factoid plugin for ubottu), does use it, for example19:53
tsimpsonwe plan to change that though :)19:54
tsimpsonI should probably end by saying that supybot isn't the only IRC bot out there19:55
tsimpsonthere are many others19:55
tsimpsonin different languages19:55
tsimpsonand with different capabilities19:55
ClassBotThere are 5 minutes remaining in the current session.19:56
tsimpsonwe use supybot mostly because it's the easiest to develop in, as Ubuntu comes with python anyway19:56
tsimpsonbut other bots can be, and are, just as good or better for you19:56
ClassBotMkaysi asked: What things I should tell supybot to forget from Encyclopedia? In example op ops calltheops owner.19:56
tsimpsonthere is detailed use info on the bot wiki19:57
tsimpsonhttp://ubottu.com/devel/wiki19:57
tsimpsonand we can help in #ubuntu-bots too19:57
ClassBotchadadavis asked: Can a I configure a plugin to load on start (myplugin.conf)?19:57
tsimpsonby default supybot loads all the plugins that were running when the bot shut down19:58
tsimpsonso unless you @unload a plugin, it will auto-load19:58
tsimpsonif you have any more question, the bots team hangs out in #ubuntu-bots and #ubuntu-bots-devel19:59
tsimpsonwe'll help you there :)19:59
tsimpsonthanks for listening, and I hope you'll all come help us make ubottu rock! :D20:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: Ubuntu Developer Week - Current Session: Rocking out with libunity - Instructors: kamstrup
=== Ghost_of_daker is now known as angeldaker
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html following the conclusion of the session.20:01
kamstrupHi all, so I guess I'm next one up...20:02
kamstrupAnd thanks to Terence Simpson for the cool talk20:02
kamstrupI am Mikkel Kamstrup Erlandsen20:02
kamstrupand I work on the DX team for Canonical20:02
kamstrupI am working on the backend side of all things unity20:03
kamstrupMy work is primarily around the "places"20:03
kamstrupand in my spare time I hack on Zeitgeist20:03
kamstrupso its all searching and backend code for me :-)20:04
kamstrupSo for today20:04
kamstrupIt's about libunity20:04
kamstrupHere's what I plan to go over:20:04
kamstrup - libunity background20:04
kamstrup - libunity feature set20:04
kamstrup - the unity launcher integration20:04
kamstrup - the unity places integration20:05
kamstrup - some working examples of ^^20:05
kamstrup - and finally a bit about what you can expect for the future of libunity20:05
kamstrupHopefully this should empower you all to go out and rock the world with awesome unity integration20:05
kamstrupSo first item on the agenda: About libunity20:06
kamstrupIt's a native library  written in Vala20:06
kamstrupWe use Vala to generate GObject Introspection files so we can have automagic bings for Python and friends20:06
kamstrupIt's important to underline that libunity is strictly a client side library20:07
kamstrupthat is20:07
kamstrupUnity itself does *not* link to it20:07
kamstrupWe focus on making the API simple and fun20:07
kamstrupSo we've chosen to very "property based"20:07
kamstrupso you get access to a bunch of object on which you set properties20:08
kamstrupand that is automatically reflect on unity20:08
kamstrupall of the communication it does is pretty much DBus20:08
kamstrupand it leverages libdbusmenu and libdee20:08
kamstrupto perform some of the more complex dbus-stuff20:08
kamstrupNow let's move on to talk about the feature set of libunity20:09
kamstrupRight now there are 2 main things supportedd20:09
kamstrup - the launcher inetgration20:09
kamstrup   - with progress, counter, emblems, and quicklist attached to application tiles in the launcher20:10
kamstrup - and then place inetgration20:10
kamstrup    - which allows you to hook into the place framework and write you own places20:10
kamstrupMaybe some of you already saw the wiki page about the launccher API: https://wiki.ubuntu.com/Unity/LauncherAPI20:11
kamstruplet's slowly step through it20:11
kamstruplooking at the first screenshot20:11
kamstrupyou'll see the progress bar and counter in action20:12
kamstrupand the screenie below is a quicklist20:12
kamstrupSo if you scroll down to the Vala example20:12
kamstrupyou can see it's all property based20:12
kamstrupall of the attributes has a _visible cousin20:13
kamstruplike emblem_visible20:13
kamstrupthese allow you to keep the state of you variables around20:13
kamstrupby just hiding the overlay20:13
kamstrupthere is one thing worth mentioning here20:14
kamstrupit is that the quicklists are not 100% wired up on the unity side yet20:14
kamstrupthere are 2 ways to write quicklists20:14
kamstrup"static quicklists" are there even when your app is not running20:14
kamstrupthese are defined inside the .desktop files for the apps20:15
kamstrupthen there are "dyanmic quicklists"20:15
kamstrupdynamic20:15
kamstrupthese are created at runtime by your app20:15
kamstrupand can be very funky20:15
kamstrupthey use the Dbusmenu API which some of you may already know from the indicators20:15
kamstrupit's a powerful api that let's you create arbitrarily complex menus20:16
kamstrupif you want to compile the vala example you'll need the very latest libunity from the archives20:16
kamstrupthat would be 3.4.6 i believe20:17
kamstrupif you run the example as is, you'll need to start evolution before you run the example20:17
kamstrupif you want to use the python example20:18
kamstrupmake sure you have the packages:20:18
kamstrupgir1.2-unity-3.020:18
kamstrupgir1.2-dee-0.520:18
kamstrupso i hope you don't have trouble running that if you try20:18
kamstrupdon't hesitate to ask if you have trouble20:19
kamstrupchances are that 50% of the other people here have the same problem20:19
kamstrupOk, that was hopefully pretty light20:19
kamstrupThe next thing we'll look at is the places20:19
kamstrupas you may expect that's more complex20:20
kamstrupThere is a wiki page which gives a rought overview of the places architecture: https://wiki.ubuntu.com/Unity/Places20:20
=== photerran is now known as lz0
kamstrupit probably can't stand for itself though20:20
kamstrupThe first thing unity will look for when integrating with a place is a ".place file"20:21
kamstrupThe .place files define the basic access point for your place20:21
kamstrupIt's a standard .ini or .desktop format what ever we call it20:22
kamstrup[Place]20:22
kamstrupDBusName=Well known bus name the place can be found under20:22
kamstrupDBusObjectPath=DBus object path the place object lives at20:22
kamstrupThis is the main section20:22
kamstrupdefining the dbus name and dbus object path your place can be found on20:22
kamstrupdoing it like this allows you to have more than one place inside the same process20:22
kamstrupalthough noone is doing that right now20:22
=== marnux_ is now known as marnux
kamstrupA "place" consist of a set of "place entries"20:23
kamstrupA place in itself has no icon in the launcher - it's just a container for place entries20:23
kamstrupFor each Place Entry you implement there will be one icon in the launcher20:23
kamstrup(or you can hide it if you want)20:23
kamstrupSo in the .place files you specify each of the place entries you expose20:24
kamstrupIt can look like:20:24
kamstrup[Entry:Stuff]20:24
kamstrupDBusObjectPath=DBus path for the place entry (must be a direct child of Places' DBusPath)20:24
kamstrupIcon=Icon for the place entry20:24
kamstrupName=Display name for the entry20:24
kamstrupDescription=Short description of what the entry provides. Suitable for display as tooltip or other20:24
kamstrupShowGlobal=True|False (defaults to True)20:24
kamstrupShowEntry=True|False (defaults to True)20:24
kamstrupIn theory Unity could just as well look all this up over DBus once it has your address from the main [Place] group in the .place file20:24
kamstrupbut20:25
kamstruphaving it in the .place file allows unity to put icons on screen even before you place has started up20:25
kamstrupso this is good for startup time20:25
kamstrupSo going over the [Entry:Stuff]20:25
kamstrupThere is another dbus path for the place entry itself20:25
kamstrupAnd you can assign an icon, name, and description20:26
kamstrupShowGlobal tells unity whether or not this entry has search result to show in the Dash20:26
kamstrupDash - aka the homescreen20:26
kamstrupyou get when you click the ubuntu button in the top left corner20:26
kamstrupso setting ShowGlobal=False will make unity not call you when it needs to update the results for the Dash20:27
kamstrupLikewise the SHowEntry20:27
kamstrupit determines whether you have a tile in the Launcher on the right20:27
kamstrupYou can check out your  current .place files in /usr/share/unity/places20:28
kamstrupYou'll also notice a "Shortcut" entry in the .place files you have20:28
kamstrupIt defines the letter you need to press in combo with <super> to bring up the dash showing your particular place20:28
kamstrupAnd you'll also notice20:29
kamstrupthat since the groups in the .place file are formatted like [Entry:NameOfEntry]20:29
=== mrjazzcat-lunch is now known as mrjazzcat
kamstrupYou can define more than one entry per .place file20:29
kamstrupso far so good - given a .place file unity can now find you20:29
kamstrupso before we proceed I need to talk to you about how unity shares datamodels with the place daemons20:30
kamstrupThere is a central library called Dee (or libdee if you will)20:30
kamstrupDee implements a set of datamodels you can share across dbus20:31
kamstrupAnd they are like peer-2-peer models20:31
kamstrupSo both unity and the place daemon can modify the models20:31
kamstrupalthough in practice it's mostly just the place daemons20:31
kamstrupThis makes implement searching and all that very convenient20:32
kamstrupSo when you search (fx. with Zzeitgeist) you don't have to collect a result set an send it to unity20:32
kamstrupyou simply update your model20:32
kamstrupthis gives a neat way to implement "incremental searches" if you want20:32
kamstrupmeaning - iteratively removing hits from the result set as the user types20:33
kamstrupso we don't have to send the entire result set over and over20:33
kamstrupyou just update your model removing the rows that no longer match20:33
kamstrupunder the hood Dee basically sends a "diff" to all the peers sharing the model20:33
kamstrupSo Dee is very powerful20:34
kamstrupIf we go back to the wiki page...20:34
kamstruphttps://wiki.ubuntu.com/Unity/Places20:34
kamstrupWe need to establish the "terminology" on the top of the page20:35
kamstrupThere are three words you need to know the meaning of:20:35
kamstrup - result model20:35
kamstrup - groups model20:35
kamstrup - sections model20:35
kamstrupIt's probably easiest if we take the Apps place as an example20:36
kamstrupThe "result model" here is (surprise!) what you see when you search20:36
kamstrupThe "groups model" defines the user visible grouping of the result model20:36
kamstrupIf you open the apps place20:36
kamstrup(super-a)20:37
kamstrupYou'll see two groups there20:37
kamstrupor wait - maybe you don't just yet20:37
kamstrup... sorry20:37
kamstrupBut there are 3 groups - let me write them for you20:37
kamstrupInstalled20:37
kamstrupAvailable for Install20:37
kamstrupand Most Popular Apps20:37
kamstrupThese partition the result set in 320:38
kamstrupSo on to the "sections"20:38
kamstrupSections in the apps place are like "Accesories", "Media", "System", ...20:38
kamstrupIe they partition not the result set, but more the "browsable space"20:38
kamstrupor the entire set of items you can potentially find20:38
kamstrupI think it'll be most easy for all if I spring my surprise now20:39
kamstrupSo the surprise is that just today I have a fully working stack supporting place daemon implementations in Python!20:39
kamstrupThis makes playing around with this stuff so much easier20:40
kamstrupSo let me point you to a fully working place implemented in Python20:40
kamstrupHere: http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/files20:41
kamstrupSo let's dig into unity-place-pythhon.py20:41
kamstrupLet's start at line 28 http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/unity-place-python.py#L2820:42
kamstrupHere we create the Place Entry i talked about20:42
kamstrupwe give it some random dbus path20:42
kamstrupThe models we create are all DeeSharedModels20:42
kamstrupOn each of the models we need to call set_schema()20:43
kamstrupThe schema *must* be like this20:43
kamstrupyou can see the definitions on https://wiki.ubuntu.com/Unity/Places#Results%20Model20:43
kamstrupThe "model schemas" is really just a list of GVariant or DBus signatures20:44
kamstrupone signature for each column you want to have in the model20:44
kamstrupand you can even shove arbitrarily complex variants in the schema20:44
kamstrupit works20:44
kamstrupbut for unity places we only use simple types such as strings "s" and uints "u"20:44
kamstrupOn line 4220:45
kamstrupI create the sections model20:45
kamstrupi give it a bus name20:45
kamstrupwhich the model will use to rendevouz with other models with the same name20:45
kamstrupand sync up with them20:45
kamstrupand on line 44 i tell the place entry that i want to use this model as my sections20:45
kamstrupditto for all the other models created in there20:46
=== neversfelde_ is now known as neversfelde
kamstrupnotice the models with a _global in the variable names20:46
kamstrupthese models will be used for searches via the Dash20:46
kamstrupwhile those without global_ will be used when you search dedicated within this particular place20:47
kamstrupLet's skip a bit forward an look at line 73: http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/unity-place-python.py#L7320:47
kamstruphere I connect to a bog standard Gobject signal from the place entry20:48
kamstrupThe notify signal when the "active-search" property changes20:48
kamstrupOn line 127 http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/unity-place-python.py#L12720:48
kamstrupyou'll see the callback i connect to this signal20:48
kamstrupHere i simply figure out what the new search string is and I start updating the model20:49
kamstrupthe results model that is20:49
kamstrupTo keep this example simple i always just call model.clear()20:49
kamstrupthe "real" places - files and apps - don't do this, but they iteratively narrow down the results_model as you type20:50
kamstrupbut that's quite a lot more complex and it works very well without it20:50
kamstrupSo what does this particular place do..?20:50
ClassBotThere are 10 minutes remaining in the current session.20:51
kamstrupIt simply just splits the search string into letters and adds a hit for each letter pointing to the wikipedia article for that letter20:51
kamstrupYou can see it splits the results into different groups20:51
kamstrupok, I need to start wrapping up20:51
kamstrupOne important note:20:52
kamstrupIf you want to run the Python example you need a small hack for now20:52
kamstrupbecause all the latest jazz isn't in the package archives just yet20:52
kamstrupThe hack you need is to take this file: http://bazaar.launchpad.net/~unity-team/dee/trunk/view/head:/bindings/python/Dee.py20:52
kamstrupand then:20:52
kamstrupdownload it somewhere and copy it to the right location like so:20:53
kamstrupsudo cp Dee.py /usr/lib/pymodules/python2.7/gi/overrides/Dee.py20:53
kamstrupThis is needed to make Dee play well with Python20:53
kamstrupWith that in place you should follow the guidelines in http://bazaar.launchpad.net/~unity-team/unity-place-sample/unity-place-python/view/head:/README20:53
kamstrupWe probably don't have a lot of time to debug any problems now, but if you poke at it  and find problems don't hesitate to ping me on the #ayatana channel20:55
kamstrupWhile I'm throwing links around - the most basic Vala example is lp:unity-place-sample20:55
kamstrupbut you can dig in and find an example a tad more complex - doing youtube searches20:56
ClassBotThere are 5 minutes remaining in the current session.20:56
kamstrupYou can see the list of example places here https://code.launchpad.net/unity-place-sample20:56
kamstrupI'll try and put all illustrative examples there20:56
kamstrupwhen new ones crop up20:56
kamstrupSo quickly on the future of libunity:20:57
kamstrup - We'll have API docs for C, Python, and Vala up very soon20:57
kamstrup - Dee already have good docs for C in the libdee-doc package . but we'll have Vala and Python docs for it too20:57
kamstrup - the longer term goal for libunity is to be able to integrate and instrument the entire Unity shell from top to bottom20:58
kamstrupSo launcher and places is just the prelimanry goodies we can deliver for Natty20:58
kamstrupFor N+1 you see some nice APIs to work with the various indicators and menus20:58
kamstrupAnd lastly - a disclaimer20:59
kamstrupSorry to end with that20:59
kamstrupBut we can't guarantee API or ABI stability at this point20:59
kamstrupwe hope there will be no landslide changes20:59
kamstrupbut small changes will trickle in20:59
kamstrupbut we we'll provide stability at some point21:00
kamstrupMaybe N+1 or +221:00
kamstrupand that's a wrap!21:00
kamstrupAny questions can go in #ayatana21:00
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/03/02/%23ubuntu-classroom.html21:01
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||
=== med2 is now known as medberry
=== lz238 is now known as semiotic
=== msnsachin12 is now known as msnsachin
=== mrjazzcat is now known as mrjazzcat-afk

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!