#ubuntu-classroom 2007-10-05
<dholbach> good morning everybody and welcome to another MOTU Q&A session!
<dholbach> I think we'll start again with a round of introductions
<dholbach> I'm Daniel Holbach, been MOTU for quite a long time already, am trying to make becoming a MOTU easier and to make Ubuntu Universe rock even harder
<norsetto> I'm Cesare Tirabassi, fresh MOTU
<dholbach> ... and great contributor :-)
<lool> I'm Loc Minier, would like to become MOTU
<norsetto> and living proof that anybody can become a MOTU :-)
<dholbach> norsetto: hahaha :)
<dholbach> lool: great to have you around
<dholbach> who else do we have?
* \sh  is Stephan Hermann, former MOTU, contributor and lurker for the first time ;)
<slangasek> I'm Steve Langasek, MOTU wannabe
<dholbach> heya slangasek, hey \sh
<dholbach> anybody else? :)
<dholbach> ok... seems we have only people around who are quite familiar with packaging already
<dholbach> do you have any questions yourself?
<dholbach> maybe about processes or how the MOTU team deals with things?
<lool> Yes; I'd like to know how build failures on buildd should be handled and why I receive such notices
<lool> For example I received two build failures for synaptic; it seems one arch was set to Needs-Build again (hppa IIRC)
<dholbach> good question
<dholbach> Soyuz (the buildd part of Launchpad) sometimes sends out build error mails when build-deps can not be properly installed, in a lot of cases this is not your fault at all
<dholbach> that's something the Soyuz folks should fix, it's a bit annoying to have to check the buildlog before just deleting the error mail
<lool> Am I supposed to do something with the notice?
<slangasek> roll it up and hit lamont over the head with it ;)
<dholbach> If you figured out that it's not your fault, no :)
<lool> Hehe
<lool> I wonder whether other bug reporters get similar spam and why?
<norsetto> lool: we all get ......
<lool> (I didn't prepare the synaptic upload, I only reported a bug)
<dholbach> lool: oh?
<lool> Ah wait I did
<dholbach> lool: maybe that's part of the ChangelogClosesUbuntuBug thing?
<lool> mvo didn't replace my name when he added his changes
<dholbach> oh good *phew* :-)
<dholbach> right
<lool> Ok, I'm relieved as well
<dholbach> in any case it's a good idea to talk to the folks on #launchpad if anything like that creeps up and is not explicable
<dholbach> any other questions?
<dholbach> do we have somebody here who's new to packaging and would like to benefit from the packaging experience we have gathered in #ubuntu-classroom right now? :)
<dholbach> a package review? build problem? something?
<lool> I have another question about attaching debdiffs to bug reports; is it ok to use "UNRELEASED" in the target dist or should I use gutsy?
<dholbach> lool: I personally would use 'gutsy' and also (LP: #123456)
<dholbach> that way it's just a matter of applying it, trying and uploading it
<dholbach> I personally find UNRELEASED only useful for VCS commits
<dholbach> lool: is that common for sponsored uploads in Debian?
<lool> What do you mean by "and also (LP: #123456)"?  You mean instead of "; LP: #123456." which I used?
<dholbach> oh, no - that's not what I referred to
<dholbach> "LP: #123456." should be fine too
<slangasek> dholbach: not IME; I agree with you that UNRELEASED is only useful when you're sharing around something in an intermediate state
<lool> dholbach: It's just that I saw a sponsor requesting an updated debdiff with s/UNRELEASED/gutsy and wondered whether this was a strict requirement
<dholbach> I just meant that if you make use of ChangelogClosesUbuntuBug and specify the upload target it's less work for the sponsor
<lool> Ok; naurally I close bugs in changelogs
<dholbach> lool: it's not strict afaik
<norsetto> I would say its good practice though
<dholbach> that's great - it's mainly new contributors who forget to use it, but you all know how to use it :-)
<dholbach> hey adam_b - how are you doing?
<dholbach> adam_b: here for the MOTU Q&A session?
<lool> Ok; I have a question about bug states when reporting: I think I now have the bug triaging capability, but I'm new to it and I'm sometimes in doubt with bug states: should I set a bug to "confirmed" after I report it?
<adam_b> dholbach: I'm doing ok, yep thought I might listen in
<norsetto> lool: no, we should never confirm our own bugs
<lool> (In order to avoid bug triage)
<dholbach> adam_b: rock on
<dholbach> adam_b: if you have any questions regarding packaging, becoming a MOTU or something else - just ask :)
<dholbach> lool: in some cases it's OK to do that - I think pitti's requestsync script for example sets to 'confirmed' automatically
<dholbach> but the archive admins will recognize your name on the bug report anyway and probably know that you know what you're doing
<dholbach> any other questions?
<lool> Hmm bash tells me requestsync is in devscripts, but I have devscripts and no requestsync script
<dholbach> lool: thanks for that - I'll tell mvo to update command-not-found-data
<dholbach> lool: it moved to ubuntu-dev-tools
<lool> Ok, thanks
<adam_b> dholbach: there's a package from debian 'mapnik' that is half in ubuntu, just wondered why that might be? there is .gz's but no .debs
<dholbach> adam_b: ok, let's take a look at http://launchpad.net/ubuntu/+source/mapnik together
<dholbach> it seems the source for mapnik 0.4.0-2 arrived in Ubuntu alright
<adam_b> cool
<dholbach> if you look at https://launchpad.net/ubuntu/gutsy/+source/mapnik/0.4.0-2
<dholbach> you will find that it failed to build on all architectures
<dholbach> let's take a look at the build logs
<adam_b> failed to build
<dholbach> python scons/scons.py PROJ_INCLUDES=/usr/include PGSQL_INCLUDES=/usr/include/postgresql PROJ_LIBS=/usr/lib DESTDIR=/build/buildd/mapnik-0.4.0/debian/tmp PREFIX=/usr BIDI=yes PYTHON=/usr/bin/python2.5 --clean
<dholbach> scons: Reading SConscript files ...
<dholbach> Checking for main() in C library m... no
<dholbach> Could not find header or shared library for m, exiting!
<dholbach> make: *** [clean]  Error 1
<dholbach> a scons build issue, it seems
<adam_b> its cpp app and build thinks its c?
<adam_b> oh no next line
<dholbach> it has problems in Debian as well, it seems
<slangasek> why do you say that? it's up-to-date on all archs in Debian
<lool> dholbach_: Missed some lines?
<adam_b> when I build it in a gutsy chroot I have to build with sudo python scons/scons GDAL_INCLUDES=/usr/include/ install
<dholbach_> adam_b: you shouldn't have to use sudo - try fakeroot
<adam_b> ok
<adam_b> even for the install part?
<slangasek> only for the install part
<dholbach> slangasek: I saw this http://bjorn.haxx.se/debian/testing.pl?package=mapnik
<slangasek> for the non-install part, you should deliberately avoid using fakeroot or sudo, to make sure the package builds cleanly as a normal user
<slangasek> dholbach: well, "waiting for boost" isn't a bug in mapnik
<lool> Here it cleans fine; perhaps it's a missing build-dep
<slangasek> (hmm, I immediately want to retract that comment after saying it, clearly depending on boost /is/ a bug ;)
<adam_b> so in ububut build its looking for 'm' which is math.h (in SConstruct)
<dholbach> I'm afraid I can't offer an answer to this one
<adam_b> fakeroot gives: scons: *** [/usr/local/lib/libmapnik.so]  /usr/local/lib/libmapnik.so: Permission denied
<dholbach> upstream have received a similar report: http://trac.mapnik.org/ticket/14 - but it's not of much help
<slangasek> adam_b: then you're missing the DESTDIR=$(CURDIR)/debian/tmp from the original
<dholbach> I think it might make sense to raise awareness of this failing to build on ubuntu-devel-discuss@lists.u.c
<dholbach> not sure we'll find an answer right here, right now
<dholbach> do we have any other questions?
<dholbach> adam_b: did you start to actively dive into MOTU things already?
<adam_b> dholbach: nope, just contemplating writing an app that will use mapnik
<dholbach> adam_b: ahh nice
<dholbach> hey huats
<huats> hey
<huats> dholbach: what a surprise to see you here
<dholbach> welcome huats, another soon-to-be-MOTU ;-)
<huats> dholbach: ;-)
<dholbach> huats: do you have any questions? anything we could take a look at together?
<huats> dholbach: yes I have
<dholbach> rock on
<dholbach> :-)
<huats> I am searching it :-)
<dholbach> I knew we could count on huats :-)
<huats> alwasy count on me where there are questions to ask
<dholbach> hehe
* dholbach hugs huats
* huats hugs dholbach, his Master
<huats> it is related to bug #137513
<dholbach> http://launchpad.net/bugs/137513
<huats> ubotu is down ?
<ubotu> Sorry, I don't know anything about is down ? - try searching on http://ubotu.ubuntu-nl.org/factoids.cgi
<lool> (Just for the record: I don't get the failure on mapnik in pbuilder)
<norsetto> bug 137513
<huats> the last comment from pkern bothers me a bit...
<dholbach> lool: me neither
<huats> hey norsetto
<norsetto> huats: hola, I have some info you you (later)
<dholbach> lool: we had weird scons problems in sbuild (at least I think so) before
<huats> norsetto: ?
<dholbach> huats: it's best to ask asac about that
<norsetto> huats: sorry, for you
<huats> norsetto: ok
<huats> dholbach: ok
<dholbach> huats: I don't know about a policy decision on iceweasel in package names
<huats> it is the only one apparently...
<dholbach> right
<dholbach> in debian there are lots of iceweasel-* binary packages
<dholbach> in ubuntu it would be just this one
* huats deserves a price : /me has asked a question about something that daniel doesn't know !!!
<dholbach> so best to check with asac and ask if it should be renamed to mozilla-torbutton or firefox-torbutton
<huats> dholbach: ok
<huats> dholbach: I will
<dholbach> super thanks
<dholbach> anything else? anything more we can review? :)
<huats> I have a second question to fire : can you explain me a bit the process to transmit bug fixes to debian... I know norsetto tried to many times, but I am sure it is someting interesting for many of us
<dholbach> soren wrote submittodebian (in ubuntu-dev-tools) maybe that'd help with it?
<huats> oh
<huats> great
<huats> I'll have a look
<norsetto> dholbach: I think huats has some problems about what should be sent to Debian, in particular re. debdiff
<huats> norsetto reads my mind
<dholbach> right... I think the diff the debian maintainer could apply to the current source in sid would be most useful
<dholbach> but we have two experienced Debian folks here, ... :-)
<norsetto> three ....
<dholbach> slangasek, lool: huats just asked " can you explain me a bit the process to transmit bug fixes to debian... I know norsetto tried to many times, but I am sure it is someting interesting for many of us" - do you have an answer for that?
<huats> dholbach: if you want we can have a look to a precise bug entry to see what is sendable to debian...
<dholbach> submittodebian is particularly useful for merges it seems
<lool> The best case would be to confirm the bug is still present in Debian by actually running a Debian and checking the bug and patch, then using reportbug to report the bug with the patch; that's probably a long process for simple bugs though
<dholbach> submittodebian has the advantage that you can edit the diff
<dholbach> and remove stuff that is ubuntu specific
<lool> So I guess one simpler case is simply checking whether the packages were patched in Debian or not
<huats> ok
<slangasek> dholbach: I was refraining from comment because my views on how Ubuntu should send bugfixes back to Debian seem to be at odds with the prevailing opinion within Ubuntu :)
<slangasek> but as a Debian maintainer, if someone in Ubuntu has made a change that they think fixes a bug, I would like to hear about it directly through the Debian BTS
<dholbach> slangasek: right, but given the question from somebody who wants to submit a patch to the debian bts? :)
<slangasek> btw, the actual submittodebian script seems to be missing from current ubuntu-dev-tools, only the manpage is there
<dholbach> oh?
<huats> dholbach: so I'll use the debian BTS ...
<dholbach> slangasek: I'll fix that in a sec - there's another change to it pending
<dholbach> (need to talk to Sren about that)
<dholbach> ok, asked him
<dholbach> if there are no more questions, this is the end of this MOTU Q&A session
<dholbach> we'll have one next week - I'll just ask for a proposal of a different time before :-)
<dholbach> thanks everybody for your questions and answers
<dholbach> have a nice day
<huats> dholbach: thanks to you
<lool> Thanks!
<slangasek> cheers
#ubuntu-classroom 2007-10-06
<leandro_> buon giorno a tutti :)
<jrib> !it
<ubotu> Vai su #ubuntu-it o su #kubuntu-it se vuoi parlare in italiano, in questo canale usiamo solo l'inglese. Grazie!
<episodic> hi
<episodic> can you ask questions here?
#ubuntu-classroom 2008-10-03
<patrick2901> hello, could you please upgrade the repository to install the stable partimage version 0.6.7 - currently, there is version 0.6.4 containing a "segmentation fault" on saving ntfs volumes. version 0.6.7 is available at http://www.partimage.org/Download, but I would prefer a package manager installation.
<persia> patrick2901: This isn't the best place to ask.  You could file an upgrade bug against https://bugs.launchpad.net/ubuntu/+source/partimage/+bugs , but the current release just hit beta, and is mostly frozen, so it's unlikely before the 9.04 release.
<patrick2901> ok, thanks. I will try it there.
#ubuntu-classroom 2008-10-04
<billisnice> #Openoffice.org
#ubuntu-classroom 2009-09-28
<Don56ish> It`s awfully quiet in here for a classroom.:-!
<virtuald> ssh! we're studying
#ubuntu-classroom 2009-09-29
<BorCh> Hi !!!
<BorCh> Prompt me Refs.s on sites where khranyat'sya separately all packages of Ubuntu-9 (type of Ftp-serverov) Beforehand thankful
#ubuntu-classroom 2009-10-02
<dael99> i want to assign a bug to myself, but i don't know how to start.
<dael99> (outside from launchpad)
<switchgirl> dael99, this is a classroom, questions to  #ubuntu
#ubuntu-classroom 2009-10-03
<hollman> clase de traducciones y reporte de bugs http://tiny.cc/ugbj
<hollman> Todos cordialmente invitados a charla de reporte de bugs y traducciones al proyecto Ubuntu en #ubuntu-classroom-es
#ubuntu-classroom 2009-10-04
<qwebirc14139> what's this?
<qwebirc14139> hello?
<starcannon> Hello
<soundray> Hi SealedWithAKiss
<SealedWithAKiss> soundray, hey.
<SealedWithAKiss> PM?
<soundray> How are you connecting to your router?
<soundray> No, this is not used for anything else atm, so we're fine here
<soundray> Ethernet or WiFi?
<SealedWithAKiss> soundray, I was using a wireless router but right now I have my NIC connected directly to my modem to eliminate the wireless router as the problem.
<SealedWithAKiss> So a direct wired connection.
<soundray> Good thinking :)
<soundray> Does your router have a Web interface for configuration/management?
<SealedWithAKiss> Of course, 192.168.1.1
<soundray> Can you get to a status page there?
<SealedWithAKiss> I'm not connected to a router though, I am connected to a modem. Unless your referring to a modem, I don't know what terms you use outside of the UK.
<SealedWithAKiss> I can yeah.
<SealedWithAKiss> That's 192.168.100.1
<SealedWithAKiss> I'll check it out now.
<SealedWithAKiss> I'm logged into the console.
<soundray> Your ADSL modem acts as a router, too. We'll call it modem if you prefer.
<SealedWithAKiss> To avoid confusion, I would prefer to use the term modem. Let me thank you in advance for offering to help.
<soundray> Can you get status information about the line?
<soundray> What we're particularly interested in is a value in dB, for the downstream signal-to-noise ratio, SNR, line noise or similar
<SealedWithAKiss> Would you like a link to a screenshot? Makes things much easier, I can upload to imageshack. If you prefer I can try to find the relevant information.
<soundray> Screenshot is fine
<SealedWithAKiss> Okay, instead I will paste some text to pastebin. It should serve the same purpose as the screenshot.
<SealedWithAKiss> http://pastebin.ca/1593207
<SealedWithAKiss> That's for downstream.
<SealedWithAKiss> Please let me know whether you need any more information.
<soundray> 39.5 dB
<SealedWithAKiss> That's the value.
<SealedWithAKiss> Means nothing to me, absolutely nothing.
<soundray> That's not terrible, and the "symbol rate" isn't too bad, either.
<soundray> If you have a poor splitter, or you're too far away from the exchange, those values go down
<soundray> So no easy hardware solution. Give me a minute
<SealedWithAKiss> Well I am paying for what was advertised to be 8MB broadband.
<SealedWithAKiss> Earlier my download speed dropped as low as 1.6Mb/s and my upload speed as low as 0.02Mb/s.
<soundray> I take it you've looked for troubleshooting info on virginmedia.com?
<SealedWithAKiss> I have tried troubleshooting using the most common troubleshooting methods.
<soundray> Well, they advertise an unrealistic maximum. When you read the smallprint, you'll find that they don't promise that :(
<SealedWithAKiss> I have also tried technical support, but these guys are just continuously disconnecting me.
<SealedWithAKiss> I understand that the service is advertised as 'up to 8MB'. Meaning that they're covered for anything below that value.
<soundray> You're renting the line from BT, right?
<SealedWithAKiss> Virgin Media is the only British ISP that doesn't require you to have an existing BT line. Virgin Media also supply my land line telephone connection.
<soundray> Yikes
<soundray> You were saying that your speeds came down recently. Before that it was good?
<soundray> I think the cause of the trouble could be contention
<SealedWithAKiss> My speeds weren't anything near 8Mb, but they were satisfactory for browsing/e-mailing/downloading music etc.
<SealedWithAKiss> Essentially, it wasn't noticeably slow.
<SealedWithAKiss> Since booting into Ubuntu my browsing speeds have significantly improved.
<soundray> If contention is the problem, your downloads will be faster in the early morning, when other users are presumably sleeping
<SealedWithAKiss> Though www.speedtest.net is reporting a similar results in both Ubuntu and Windows eliminating the OS as the source of the problem.
<SealedWithAKiss> Totally, but right now it's 11:22 PM and Monday tomorrow. I would expect many people to be in bed already, preparing to be awake for work etc.
<soundray> Anyway, I'm sorry I can't seem to help you on the technical side
<SealedWithAKiss> I have had a similar problem before, as it goes. Only last time it MUCH worse. I was only hitting 10 kb/s when downloading. After a modem reboot the connection would perform optimally for a few minutes, and then just sink. The modem needed replacing on that occasion.
<SealedWithAKiss> That was a SB5100 I think.
<soundray> Regarding Virgin Media support, try there geographic number: 01752 300300
<soundray> *their
<soundray> There are a few more listed on saynoto0870.com
<soundray> Ringing those sometimes gets you through to a higher support level
<SealedWithAKiss> I am already pissed about the customer service, so would prefer to use 150 from my land line which is free. They're already robbing me.
<SealedWithAKiss> On one occasion, I asked the advisor to connect me to 2nd line support.
<soundray> You don't have a call package with free UK landline calls?
<SealedWithAKiss> He said that nobody was available. Then I asked him to transfer me to a colleague, apparently none were available. Finally I asked to speak to his manager/supervisor and again, it wasn't possible. After that he hung up.
<SealedWithAKiss> I only have incoming calls on my land line because the bills were too expensive.
<soundray> Okay
<soundray> Yeah, these guys are trained to take the mickey out of you
<soundray> One thing that helped me once was to ring the press officer in a particularly unhelpful company.
<SealedWithAKiss> To say that the technical support personnel were incompetent would be an understatement.
<soundray> She gave them hell, and I had the most courteous and competent ringback :)
<SealedWithAKiss> Sounds like that one worked out particularly well for you!
<soundray> Yes, unexpectedly so.
<SealedWithAKiss> They appear to think that my current connection is acceptable. You know, I know that many of these guys get a hard time. So I'm nice on the phone, and always very polite. It just so happens that the 'nice guys' are usually the ones that are easily pushed aside and walked over.
<SealedWithAKiss> When I ran the speed test in Windows I was also getting ridiculous ping response times.
<SealedWithAKiss> Something in the region of 2000 ms.
<soundray> They must also get the most annoying callers. But if they were any good, they'd be able to distinguish stupid from smart requests.
<SealedWithAKiss> I guess yeah. Well this guy was adamant that my browser/P2P software was to blame.
<SealedWithAKiss> How my P2P software came into it I don't know.
<soundray> You probably don't want to spend any extra money on the problem, but if you did want to invest a little, you could book a "personal secretary" (usually also from India) to ring them for you.
<soundray> They might be more successful than you, since they know their own kind :)
<SealedWithAKiss> Well they're not usually Indian. They're Scottish. I don't know what has changed.
<SealedWithAKiss> Perhaps, yeah. Nice suggestion.
<soundray> Anyway, that's all I have for you... not much, sorry.
<soundray> When I lived in the UK, I had a similar problem, but mine was solved with a splitter upgrade
<SealedWithAKiss> Okie doke, well thank you anyway. I think that you did everything you could to diagnose the problem.
<soundray> Doesn't apply in your case, I know.
<SealedWithAKiss> What exactly is a splitter?
<soundray> It separates voice from data on an ADSL line
<soundray> so does not apply to your cable modem situation
<SealedWithAKiss> Oh right, I see.
<SealedWithAKiss> You seem as though you've worked as a network engineer at some point.
<soundray> You might get a little more from #networking as Slart suggested
<soundray> No, I'm just a hobbyist
<soundray> I'm a professionally trained diagnostician, though :)
<SealedWithAKiss> It appears as though the hobbyists usually turn out to be more technically knowledgeable than those with the fancy pieces of paper.
<soundray> Hobbyists' knowledge tends to be highly specialized, though
<soundray> I've been through all this ADSL stuff, but my son asked me a question about IPv6 the other day, and I had to pass
<SealedWithAKiss> I am quite the hobbyist myself, though I am also training for various IT related qualifications.
<SealedWithAKiss> Ah I see. Now I could tell you a little about IPv6 and a little about IPv4 but my knowledge doesn't run too deep.
<SealedWithAKiss> Though in other areas of networking I could probably tell you quite a lot. So yeah, sounds about right.
<soundray> Anyway, it's an hour later here, and I'm working tomorrow... need some rest
<soundray> Hope you find a solution!
<SealedWithAKiss> Sure, sorry.
<SealedWithAKiss> Take care, and thanks for your help!
<soundray> NP :)
<soundray> Bye
#ubuntu-classroom 2010-10-06
<koni_> o
<the_hydra> ok, I think I should just start now :)
<the_hydra> allow me to introduce myself. I am Mulyadi Santosa, 31 years old
<the_hydra> currently resides in Indonesia
* 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 || Current Session: Understanding fields in /proc/meminfo - Instructors: the_hydra
<the_hydra> and as you can easily guess, I use Linux daily ....
<the_hydra> ok, let's start with easy one "what is /proc/meminfo"?
<the_hydra> and to answer that, you need to know what /proc is....
<the_hydra> it's a pseudo filesystem
<the_hydra> meaning, it doesn't exist in your disk...be it your hard disk, SSD, floppy etc
<the_hydra> it is entirely created in memory...in run time,by the Linux kernel
<the_hydra> so you see the content of /proc, just like any other normal directory
<the_hydra>    /proc/meminfo holds almost all information you need about your virtual memory condition
<the_hydra> and, perhaps it  might surprise you, tools such as top, vmstat, atop, htop and others parse /proc/meminfo to gather information about virtual memory
<the_hydra> up to this point, any question?
<the_hydra> none? ok let's continue
<the_hydra> MemTotal....what is this field supposed to mean?
<the_hydra> your entire RAM?
<the_hydra> anybody wanna bravely guess?
<koni_> total RAM
<the_hydra> close...
<the_hydra> else?
<the_hydra> ok, it's actually total amount of RAM recognized and "mappable" by your kernel
<rsajdok> +swap
<the_hydra> this might sound like a rocket science for seconds :)
<mozer> 2^32
<the_hydra> what if I told you, that initially, linux kernel could only manage up to 896 MiB?
<the_hydra> this is due to ...what the geek call...virtual memory spliy
<the_hydra> split
<the_hydra> in 32 bit machine, in total, we could address up to 4 GiB...2^32
<the_hydra> in this address space, linux kernel split it into two
<the_hydra> 3 GiB for user space, 1 GiB for the kernel itself
<the_hydra> so within this 1 GiB space, kernel must fit everything regarding memory allocation
<the_hydra> and you might further ask "ok 1 GiB..but you say 896 MiB? how's that?"
<the_hydra> kernel...reserve more or less 128 for special needs
<the_hydra> so, enough to say that, without additional "hacks", Linux kernel...initially could only address up to 896 MiB
<the_hydra> so, for those of you who owns aging distro like redhat 5.2, don't scream if you put 4 GiB RAM module in your machine and scream "why on earth, it's just showing 896 MB? crap"
<the_hydra> luckily, modern distro now equipped with default kernel which is able to address up to 4 GiB
<the_hydra> this is called highmem
<the_hydra> how about machine with RAM up to 64 GiB?
<flan> Ooh! Virtual MMU!
<the_hydra> assuming your processor has PAE (Processor Address Extension) flag ( grep -i pae /proc/meminfo), just install pae kernel package
<the_hydra> and kazaam, 64 GiB room for you
<the_hydra> but wait, you said 64 GiB..but uhm, this is 32 bit you know?
<the_hydra> yeah, that's what PAE is...to "extend" addressing
<the_hydra> slight pause here...any question?
<the_hydra> this is a generic knowledge, so it's not limited for Ubuntu and its family only...
<the_hydra> every Linux distro apply the same thing here...
<the_hydra> flan, yeah MMU....
<the_hydra> flan, you got it right :)
<the_hydra> allow me to gently remind you, it's all described in my article...in Full circle magazine issue 39...page 14 to 20
<the_hydra> so, in case you need longer explanation, you might download and read it there
<the_hydra> ok guys...I move again..
<flan> Technical question, asked only out of curiosity and not for practical relevance: would PAE emulate MMU functionality for devices that have no real MMU of their own?
<flan> Like ancient Palms.
<the_hydra> nope AFAIK
<the_hydra> PAE is PAE
<the_hydra> MMU is MMU
<the_hydra> in other word, without MMU, there won't be virtual memory
<the_hydra> PAE just deal with addressing
<flan> Okay, so it's a pre-requisite.
<the_hydra> think like this: MMU is like your office rooms
<the_hydra> it segments a floor into smaller...ehm, how to say that..cubicles
<mhall119> where are you going to get intel hardware without an MMU anyway?
<flan> I was thinking ancient ARM.
<the_hydra> flan, nice question anyway
<flan> But this is getting off-topic.
<mhall119> PAE is an x86 only thing isn't it?
<the_hydra> ok, shall I continue?
<the_hydra> mhall119, AFAIK yes
<the_hydra> mhall119, but it could be named something else in other platform
<the_hydra> ok, memfree..this one is also confusing sometimes
<the_hydra> again, let me ask, what's your understanding about it?
<the_hydra> one person at a time, ok? :D
<the_hydra> nobody? ok.... memfree is total amount of your RAM...100% unused for nothing!
<flan> The amount of memory not occupied by anything cached or loaded by the kernel.
<the_hydra> sorry i mean, unused for every purpose
<the_hydra> flan, thanks...that's almost similar like mine :)
<the_hydra> ok, so, in memfree, not just your application's allocated memory determines it, but also how much kernel does caching and any other kind of allocation
<the_hydra> so if you see it and think "what? i just by my super dooper 16 GiB RAM stick and it is chewed down to 8 GiB in just few hours while I just sit and explore web using  my great firefox?"
<the_hydra> that's the answer....firefox allocates...kernel might do caching..and so on
<the_hydra> but that's good
<the_hydra> and you might say "are you nuts???"
<the_hydra> no I am not
<the_hydra> think like this: suppose you really have 16 GiB...and kernel use it to cache your recent read files for about 10 GiB (ok, this might sound exaggerating..)
<the_hydra> then, for next access, kernel will simply read from in-RAM cache instead of reading your disk
<the_hydra> isn't that nice?
<the_hydra> you get speed up, people! :D
<flan> But I like hearing my HDD thrash. :(
<the_hydra> flan, a strong magnetic iron will do that much quicker :D
<the_hydra> ehheheh
<the_hydra> coupling that, is buffer and cache
<the_hydra> actually, they are more or less same thing
<the_hydra> "page cache" a.k.a disk cache
<the_hydra> so you sum them both, and you get the amount of RAM used for disk caching...
<the_hydra> pretty simple...
<the_hydra> ok...no question so far?
<the_hydra> I shall jump to Committed_AS
<the_hydra> if you wanna know how much RAM your applications ask for memory, this is the indicator
<the_hydra> please notice, there is different between "how much an application ask" and "how much it is really allocated for now"
<the_hydra> committed_as reflect the first one...the "request"
<the_hydra> thus, the higher this field, you know there is a memory chewing application running..especially when it constantly increase
<the_hydra> but it never exceed commitlimit
<the_hydra> this is the upper limit, dynamically set by kernel...that denotes how much virtual memory you can ask
<the_hydra> so "great, you make me dizzy, please show me how much RAM is really allocated by my applications...."
<the_hydra> AnonPages tells you that
<the_hydra> Anon...short of Anonymous...is a technical way to say "a page that has no physical disk/file backing"
<the_hydra> ever use malloc() in C/C++, people?
<the_hydra> malloc() is one of the function that ask for anonymous pages
<flan> Also new and del for C++, mirrored by higher-level languages, like Java.
<the_hydra> page itself is a smallest unit of RAM that a processor+MMU deal with your RAM
<the_hydra> just like sector in disk...
<the_hydra> flan, yeap
<the_hydra> but...let me tell you, malloc() isn't directly allocate memory for you
<the_hydra> it's just "asking"
<the_hydra> the real deal happen when you access the allocated memory for the first, hence triggerring what the kernel geek calls "page fault"
<the_hydra> swap total and swap free...easy....swap total denotes your total *active* swap area
<the_hydra> the active ones...please notice that
<the_hydra> so if you swapoff a swap area...it will be out of ring
<the_hydra> swap free....the unallocated swap space from the active swaps
<flan> QUESTION: What happens if you swapoff a partition while it's in use?
<the_hydra> 'til now, questions?
<the_hydra> flan, first, kernel check if there is sufficient of free RAM that can contain the bits in there
<the_hydra> so say, it holds 128 MiB of data
<the_hydra> your free RAM, must at least have that amount
<the_hydra> because, if not, it must be kicked out again to swap....
<the_hydra> agree here?
<flan> Yes, thus far.
<flan> But I'm really asking because I've never tried it.
<the_hydra> and...dynamically, it will be swapped in to RAM
<the_hydra> relax, i did it hundreds of time :D
<the_hydra> and read the codes in linux kernel...so I can tell :)
<the_hydra> once it all in RAM, that swap is detached
<the_hydra> but your application "don't feel it"
<the_hydra> you just feel few glitches....if there's any
<the_hydra> in fact, doing swapoff -a followed by swapon -a (but please, do it carefully) is an easy way to bring all your swapped out pages back to RAM :D
<flan> So what if there isn't enough free RAM/other swap? Will the kernel refuse to complete the command?
<the_hydra> linux kernel has tendency to swap out inactive pages...slowly to swap areas
<flan> (Yay for vm.swappiness)
<the_hydra> thus freeing precious RAM..for more useful things
<the_hydra> flan, yes...correct
<the_hydra> flan, correct again...
<the_hydra> the lower vm.swappiness is, everything will last longer in RAM
<the_hydra> OTOH, the bigger it is (max is 100), it will be swapped out fairly fast
<the_hydra> which one is ideal? up to you...but IMHO 60..the default...is already a nice number
<the_hydra> did I say inactive?
<the_hydra> active?
<the_hydra> yes, kernel marks pages which has been inactive for certain interval
<the_hydra> and they are candidates to be swapped out
<flan> You were talking about active swap areas.
<the_hydra> nope, in-RAM
<flan> Oh, in terms of swap-propagation.
<the_hydra> for swaps, there is no active-inactive :)
<the_hydra> active..denotes portion of RAM that frequently accessed
<flan> I should probably stop derailing your lesson.
<the_hydra> the field itself is splitted into 2, anon..and file
<the_hydra> flan, we can continue in other related ubuntu chat room L)
<the_hydra> :)
<the_hydra> anon...is the anonymous
<the_hydra> and ...file? ok, remember when I talk about cache? this is it..along with the so called file memory mapping
<the_hydra> this sounds geek ...but really you see it everyday
<the_hydra> library loading...primarily :)
<the_hydra> so, big anon...aggresive malloc()
<the_hydra> big file (both active and inactive), could be aggresive library loading etc
<the_hydra> unevictable...mlocked..are portion of RAM that is made unswappable
<the_hydra> most likely, it is allocated by kernel for special need
<the_hydra> or if you're multimedia people who works on audio recording etc, this number might rise...
<the_hydra> it is a standard way to lessen latency
<the_hydra> by locking allocated memory to be always in RAM, it's guaranteed that the access time is fast...because if it hits swap..well you know the consequences :D
<the_hydra> ok, quite fast I guess...questions?
<the_hydra> i selected the most important fields so far...
<the_hydra> this is really linux memory management 101 :D
<the_hydra> i feel like mel gorman junior :D
<the_hydra> ok ...i guess time still permits
<the_hydra> "dirty"
<the_hydra> oh my god, dirty? dirt in my RAM
<the_hydra> enough to say that, when you write something to disk, it's not done right away
<the_hydra> most likely, it's deferred
<the_hydra> portion of RAM that contains bits that haven't been pushed back to the related files..is said to be dirt
<the_hydra> y
<the_hydra> thus, the higher this number might mean : your disk is busy...or something is not optimal with write back operation
<the_hydra> questions?
<flan> Nope.
<the_hydra> others?
* 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 ||
<flan> Thank you very much, the_hydra. I definitely learned a few things I didn't know about today. :)
<the_hydra> thanks
<the_hydra> :)
<the_hydra> that would be a great honour
#ubuntu-classroom 2010-10-07
<gac1> hello are their any Ubuntu specialists here ? Because I forget even the basic stuff I did know about using Ubuntu
<gac1> Like for example how to get an app that is marked for installation then applied to actually function. I forget the other step. Duh.
<gac1> I'm trying to get antivirus clam av to function
<gac1> It is downloaded but I forget the next step. I haven't had a lot of experience using Ubuntu and don't spend a lot of time trying to figure it out
<gac1> Is anybody here ?
<akashm> hi all
<akashm> i have question
<mhall119> if it's a support question, you should ask it in #ubuntu, that's where all the support people are
<mhall119> this channel is used for teaching classes
<akashm> k
<akashm> when i try try to gksudo ./myscript
<akashm> it doesnt run at all
<akashm> any suggestion?
<padhu> akashm: ask the same on #ubuntu
#ubuntu-classroom 2010-10-09
* 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: Beginners Team Dev Academy - Current Session: Introduction to Python: Part 4 - Instructors: pedro3005
<ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2010/10/09/%23ubuntu-classroom.html following the conclusion of the session.
<pedro3005> Hello folks
<pedro3005> Anybody out there?
<pedro3005> erm
<pedro3005> my fail
<pedro3005> ok, I'm in -chat now
<pedro3005> Alright, let's begin
<pedro3005> Last class we were talking about functions and list comprehension
<pedro3005> now these are difficult subjects
<pedro3005> I gave some examples but I realized they might've been unclear
<pedro3005> Functions are used a lot in programming
<pedro3005> List comprehension isn't used as much, but it still is used not rarely
<pedro3005> The purpose of functions is simple
<pedro3005> When we are doing one procedure over an over, we can direct it to a function to avoid code repetition
<pedro3005> For instance, suppose we are coding a little greeting program, which talks to the user
<pedro3005> the user gave you his name, something like "Mr. H" or "Mrs. K"
<pedro3005> Now, suppose you have many lines which are oriented by gender
<pedro3005> before each of these lines, you are doing:
<pedro3005> if name.startswith("Mr."):
<pedro3005> bla
<pedro3005> To avoid all this code being repeated over and over, you might use... functions!
<pedro3005> as we learned last class, you can define a function with the keyword def
<pedro3005> All functions return a value
<pedro3005> but some functions return Null
<pedro3005> Functions may or may not receive parameters, which are kind of like informations about the things it's supposed to do
<pedro3005> In our case, it makes sense that our function receives as a parameter the name of the person
<pedro3005> So it can determine the person's gender
<pedro3005> Enough talk, let's get dirty
<pedro3005> >>> def gender(name):
<pedro3005> ...     if name.startswith("Mr."):
<pedro3005> ...             return "male"
<pedro3005> ...     elif name.startswith("Mrs."):
<pedro3005> ...             return "female"
<pedro3005> ...
<pedro3005> you can observe it returning
<pedro3005> >>> gender("Mr. Rob")
<pedro3005> 'male'
<pedro3005> Now, let me share a dirty little secret with you
<pedro3005> In this function, we're just assuming the parameter <name> is a string
<pedro3005> what happens if we call it with an integer, for instance?
<pedro3005> >>> gender(2)
<pedro3005> Traceback (most recent call last):
<pedro3005>   File "<stdin>", line 1, in <module>
<pedro3005>   File "<stdin>", line 2, in gender
<pedro3005> AttributeError: 'int' object has no attribute 'startswith'
<pedro3005> But, worry not, my lad
<pedro3005> You, sir, are the programmer
<pedro3005> You know better than to pass an int into your function expecting a string
<pedro3005> But you must be careful with user values
<pedro3005> If the user typed a value, you should NEVER assume it is what it's meant to be
<pedro3005> We've discussed that previously, I just wanted to stress it again
<pedro3005> We can also have functions with no parameters
<pedro3005> As an example, we have the print_help function
<pedro3005> Our program could have a help message
<pedro3005> and we want to create a function to display it
<pedro3005> But I don't really have any parameters, I just want the damn thing to print it
<pedro3005> >>> def print_help():
<pedro3005> ...     print "rtfm"
<pedro3005> You may ask: what does this function return?
<pedro3005> I didn't tell it to return anything
<pedro3005> Well, we can tru to assign it to a variable
<pedro3005> try*
<pedro3005> >>> a = print_help()
<pedro3005> rtfm
<pedro3005> >>> print a
<pedro3005> None
<pedro3005> You can note that the function returns None
<ClassBot> TrueCryer45 asked: None as value? not Null?
<pedro3005> Yeah, I got the name wrong on the first time
<pedro3005> :P
<pedro3005> It's None
<ClassBot> matematikaadit asked: none is none
<pedro3005> >>> None is None
<pedro3005> True
<pedro3005> does that answer your question?
<pedro3005> We also talked about the scope of functions
<pedro3005> A function has its own scope of variables
<pedro3005> for instance, if you declare a variable inside a function, it doesn't exist outside that function
<pedro3005> if you declare variables outside the function, you can access the variable from within the function, but you cannot change it (unless if you call it global)
<pedro3005> let's go over that
<pedro3005> >>> def a():
<pedro3005> ...     n = 1
<pedro3005> ...
<pedro3005> >>> a()
<pedro3005> >>> n
<pedro3005> Traceback (most recent call last):
<pedro3005>   File "<stdin>", line 1, in <module>
<pedro3005> NameError: name 'n' is not defined
<pedro3005> Here, we can clearly see the effects of this
<pedro3005> n is not defined outside the function
<pedro3005> >>> n = 1
<pedro3005> >>> def a():
<pedro3005> ...     print n
<pedro3005> ...
<pedro3005> >>> a()
<pedro3005> 1
<pedro3005> here, we show that you can access the variable even though it wasn't defined in that very function
<pedro3005> >>> def a():
<pedro3005> ...     n = 2
<pedro3005> ...
<pedro3005> >>> a()
<pedro3005> >>> n
<pedro3005> 1
<pedro3005> But here, you see that you cannot change n
<pedro3005> When you try to define a new value to n, you are actually creating a new, different n
<pedro3005> this n exists only inside a()
<pedro3005> when you get out of that function
<pedro3005> there is another n
<pedro3005> which is still 1
<pedro3005> it was not changed
<pedro3005> We can use the global keyword to identify it as a global variable
<pedro3005> >>> def a():
<pedro3005> ...     global n
<pedro3005> ...     n = 2
<pedro3005> ...
<pedro3005> >>> n = 1
<pedro3005> >>> a()
<pedro3005> >>> n
<pedro3005> 2
<pedro3005> Are we clear on this, everyone?
<pedro3005> Good
<pedro3005> Let's introduce a new subject then
<pedro3005> Named parameters
<pedro3005> this is useful for holding default values
<pedro3005> for instance, suppose you have a help function
<pedro3005> if you call that with a certain command, it displays help about the command
<pedro3005> if you call it by itself, it displays a general help message
<pedro3005> we can accomplish this with named parameters
<pedro3005> >>> def p_help(command=None):
<pedro3005> ...     if command == None:
<pedro3005> ...             print "general help message"
<pedro3005> ...     else:
<pedro3005> ...             print "specific help about %s" % command
<pedro3005> ...
<pedro3005> >>> p_help("ls")
<pedro3005> specific help about ls
<pedro3005> >>> p_help()
<pedro3005> general help message
<pedro3005> if you don't pass anything, command gets the default value of None
<pedro3005> >>> def p_help(command=None, detailed=None):
<pedro3005> ...     if command == None:
<pedro3005> ...             if detailed:
<pedro3005> ...                     print "detailed general help message"
<pedro3005> ...             else:
<pedro3005> ...                     print "general help message"
<pedro3005> ...     else:
<pedro3005> ...             if detailed:
<pedro3005> ...                     print "detailed help message about %s" % command
<pedro3005> ...             else:
<pedro3005> ...                     print "help message about %s" % command
<pedro3005> ...
<pedro3005> >>> p_help(detailed=True)
<pedro3005> detailed general help message
<pedro3005> So as you see in this last function, you can use named parameters to only pass a certain value to the function
<pedro3005> Any questions?
<ClassBot> OttoBusDriver asked: Can you call functions with named parameters with positional paramters? EG p_help('command', True)
<pedro3005> Yes
<pedro3005> >>> p_help("ls", True)
<pedro3005> detailed help message about ls
<ClassBot> OttoBusDriver asked: And can you define a function with positional and named parameters?
<pedro3005> didn't we just do that?
<pedro3005> def p_help(command=None, detailed=None):
<pedro3005> Good
<pedro3005> It seems we are all clear on this subject
<pedro3005> Let me see if there's anything more of functions I should go through today
<pedro3005> Oh yes
<pedro3005> this looks hard but it is actually quite easy
<pedro3005> Python has a shortcut for easy, one-expression functions
<pedro3005> if you have a function that just grabs a value x and adds 2, for instance
<pedro3005> or grabs the value x and calls some_random_function(x)
<pedro3005> you can use lambda expressions
<pedro3005> >>> a = lambda x: x + 2
<pedro3005> >>> a(40)
<pedro3005> 42
<pedro3005> lambda of x is x + 2
<pedro3005> the syntax is a bit different from the def keyword
<pedro3005> you must assign it to a variable, as you see
<pedro3005> the x is actually the parameter
<pedro3005> not the function's name
<pedro3005> lambda expressions can take in multiple parameters
<pedro3005> >>> a = lambda x, y: x + y
<pedro3005> >>> a(2, 3)
<pedro3005> 5
<pedro3005> >>> a = lambda x=1, y=2: x + y
<pedro3005> >>> a()
<pedro3005> 3
<pedro3005> >>> a(2)
<pedro3005> 4
<pedro3005> And you have named parameters with lambdas ^
<pedro3005> Lambda comes from functional programming, which (obviously) bases itself heavily on functions
<pedro3005> so it was needed to create a shorter path to small functions
<pedro3005> thus lambda
<pedro3005> It's not used much outside of FP (functional programming), but I wanted to go over it because FP knowledge is important to any decent programmer
<pedro3005> Any questions?
<pedro3005> Alright
<pedro3005> this is it for functions
<pedro3005> I mean, there is more to it, but I think I have explained most of it
<pedro3005> you should play with functions, use them in your programs, get used to them
<pedro3005> they are really important in programming
<pedro3005> Also reference to last class where I explained functions as well
<pedro3005> (to find out that a function can receive another function as argument)
<pedro3005> But let us continue on exploring data structures
<pedro3005> We've been talking about lists
<pedro3005> they are ways of sequencing things
<pedro3005> you can create a list for instace
<pedro3005> instance*
<pedro3005> numbers = [1, 2, 3, 4, 5]
<pedro3005> And we went over various things you can do with lists
<pedro3005> grab elements
<pedro3005> numbers[0] being the first
<pedro3005> put in new elements, with numbers.append(6) or numbers.insert(0, 0)
<pedro3005> (insert 0 at the position 0)
<pedro3005> http://docs.python.org/tutorial/datastructures.html#more-on-lists
<pedro3005> those are all the methods you have with lists
<pedro3005> I want to go over a new type today
<pedro3005> it is called a dict
<pedro3005> short for dictionary
<pedro3005> let's think about real dicitonaries
<pedro3005> they have a word and a definition
<pedro3005> so they are kind of like mapping tools
<pedro3005> they link one thing to another
<pedro3005> in our case, a word to a definition
<pedro3005> In python, we have that
<pedro3005> we have dictionaries that map a string to an object
<pedro3005> but get this
<pedro3005> everything is an object
<pedro3005> a fuction is an object, a list is an object, they're all objects
<pedro3005> so a dict maps a string to pretty much anything
<pedro3005> let's go over the syntax
<pedro3005> imagine you have three users, Rob, Joe and Max
<pedro3005> and they have user ids of 1, 2 and 3 respectively
<pedro3005> let's create a dictionary which maps user to user id
<pedro3005> users = {"Rob":1, "Joe":2, "Max":3}
<pedro3005> Notice we use {}
<pedro3005> We can access an element of this dict by calling: users["Rob"]
<pedro3005> that will return 1
<pedro3005> because Rob is mapped to 1
<pedro3005> >>> users["Rob"]
<pedro3005> 1
<pedro3005> Questions?
<pedro3005> Good
<pedro3005> In Python terms, "Rob", "Joe" and "Max" are keys of the dict users
<pedro3005> And how do you get all the keys in users?
<pedro3005> >>> users.keys()
<pedro3005> ['Max', 'Rob', 'Joe']
<pedro3005> But hey, wait a minute!
<pedro3005> I put in Rob _first_
<pedro3005> Why did I get Rob in second?
<pedro3005> What the hell is python thinking?!
<pedro3005> It's simple
<pedro3005> they're random
<pedro3005> You see, Python doesn't guarantee that your dict will be in the order you left it
<pedro3005> The function of dicts is to relate string to anything
<pedro3005> and that function is kept
<pedro3005> I think python 3 will have ordered dicts
<pedro3005> or was that 2.7?
<pedro3005> not sure
<ClassBot> matematikaadit asked: is it possible a key related to nothing?
<pedro3005> well, sure
<pedro3005> but in python we call nothing None :)
<pedro3005> >>> a = {"a": None}
<pedro3005> >>> a["a"]
<pedro3005> Questions?
<pedro3005> Good
<ClassBot> matematikaadit asked: users.keys() is for calling the key, how about the value?
<pedro3005> As TrueCryer45 lovely pointed out, users.values()
<pedro3005> You can use the method .has_key() to check if a dict has a certain key
<pedro3005> >>> users.has_key("Rob")
<pedro3005> True
<pedro3005> example:
<pedro3005> >>> if users.has_key("Rob"):
<pedro3005> ...     print "Rob is here. His ID is %s" % users["Rob"]
<pedro3005> ...
<pedro3005> Rob is here. His ID is 1
<pedro3005> Here we are mapping a string ("Rob", "Joe", whatever) to an int (1, 2, 3 ..)
<pedro3005> But who's to say we can't map strings to lists, for instance?
<pedro3005> We can!
<pedro3005> >>> boxes = {"box1": ["a key", "an old cd"], "box2": ["three coins", "a phone"]}
<pedro3005> >>> boxes["box1"][0]
<pedro3005> 'a key'
<pedro3005> Hell, we can map strings to functions, other dicts, other dicts that have dicts within them, other dicts with dicts with dicts within..
<pedro3005> in short, we can map strings to practically anything
<pedro3005> with dictionaries
<pedro3005> What if we wanted to print each user's name and id?
<pedro3005> We need to iterate over this dict
<pedro3005> we would use a for loop (I hope you all remember the for loop class)
<pedro3005> >>> for user, id in users.iteritems():
<pedro3005> ...     print user, id
<pedro3005> ...
<pedro3005> Max 3
<pedro3005> Rob 1
<pedro3005> Joe 2
<pedro3005> now, let's analyze that
<pedro3005> do you guys remember tuples? they we're like (1, 2)
<pedro3005> sort of like lists
<pedro3005> I taught that we could unpack these tuples into variables
<pedro3005> x, y = (1, 2)
<pedro3005> x = 1 and y = 2
<pedro3005> this is exactly what happens in the for loop
<pedro3005> the function returns something like ('Max', 3)
<pedro3005> and it's unpacked into user and in
<pedro3005> id*
<pedro3005> then we print these
<pedro3005> Questions?
<pedro3005> Ok, good
<pedro3005> Now
<pedro3005> Let's turn our attentions to something more tangible
<pedro3005> Hang in there guys
<pedro3005> we're nearly getting over the basic python
<pedro3005> Programs usually have a functionality of reading and writing to files
<pedro3005> so let's learn how to do that in python
<pedro3005> All this time, you've been reading and writing to files and you didn't know it
<pedro3005> print "bla"
<pedro3005> this writes "bla" into the file stdout
<pedro3005> which in our case is the terminal
<pedro3005> when you call raw_input() you're reading from stdin
<pedro3005> how cool is that?
<pedro3005> When we change to other files, it's not much different
<pedro3005> We use the open() function to open a file
<pedro3005> We do it like this:
<pedro3005> f = open("some_text_file")
<pedro3005> notice that we didn't define a mode here
<pedro3005> by default, it is in reading mode
<pedro3005> that is equivalent to
<pedro3005> f = open("some_text_file", "r")
<pedro3005> now you can do things with f
<pedro3005> for instance, let's read our file
<pedro3005> f.read()
<pedro3005> this returns a string with the entire file
<pedro3005> it will not remove newlines ("\n") etc
<pedro3005> Let me quote the python docs
<pedro3005> To read a fileâs contents, call f.read(size), which reads some quantity of data and returns it as a string. size is an optional numeric argument. When size is omitted or negative, the entire contents of the file will be read and returned; itâs your problem if the file is twice as large as your machineâs memory. Otherwise, at most size bytes are read and returned. If the end of the file has been reached, f.read() will return an emp
<pedro3005> ty string ("").
<pedro3005> You may call f.readline() to read just one line
<pedro3005> and you can iterate over the file
<pedro3005> >>> for line in f:
<pedro3005> ...     print line
<pedro3005> ...
<pedro3005> this
<pedro3005> is
<pedro3005> a
<pedro3005> file
<pedro3005> iterating over f will give you line by line
<pedro3005> Questions?
<pedro3005> Good
<pedro3005> Writing to files is just as easy
<pedro3005> Open it in "w" mode
<pedro3005> f = open("some_file", "w")
<pedro3005> and then call write()
<pedro3005> f.write("blablabla")
<pedro3005> when you're done, don't forget
<pedro3005> f.close()
<pedro3005> remember that you must call write with a string
<pedro3005> so imagine you have
<pedro3005> answer = 42
<pedro3005> you can't do
<pedro3005> f.write(answer)
<pedro3005> because answer has type int
<pedro3005> convert it to string
<pedro3005> f.write(str(answer))
<pedro3005> There are more methods to files
<pedro3005> these are the most used
<pedro3005> http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects
<pedro3005> I recommend you read this
<pedro3005> Given this, I think now you are experienced enough to try your hands at a challenge
<pedro3005> http://ubuntuforums.org/showthread.php?t=884394
<pedro3005> OH, I forgot to mention
<pedro3005> files also havc the append mode
<pedro3005> which is similar to write
<pedro3005> but you begin writing where the file stop
<pedro3005> whereas the file is cleared if you open it in write mode
<pedro3005> f = open("bla", "w")
<pedro3005> and f = open("bla", "a")
<pedro3005> Is that clear?
<ClassBot> There are 10 minutes remaining in the current session.
<pedro3005> So just for recalling
<ClassBot> There are 5 minutes remaining in the current session.
<pedro3005> so far we went over variables, user input, outputting (print), types, type checking & conversion, boolean expressions, if blocks, for and while loops, functions, lists and dicts, list comprehension, files
<pedro3005> So it'd be good if you all were sharp on these subjects
<pedro3005> I think in the next class I will present a program, so we can study how to actually develop full stuff
<pedro3005> But anyway
<pedro3005> Time for us to call it a day
<pedro3005> I hope this was of some use
<ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2010/10/09/%23ubuntu-classroom.html
* 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 ||
#ubuntu-classroom 2011-10-06
<quanru> è¿é½æ²¡äººåè¨çå
<theos> hi
#ubuntu-classroom 2011-10-08
<sheroazura> halo
<jmarsden> !classroom
<ubot2> The Ubuntu Classroom is a project which aims to tutor users about Ubuntu, Kubuntu and Xubuntu through biweekly sessions in #ubuntu-classroom - For more information visit https://wiki.ubuntu.com/Classroom
<sheroazura> have we start the classroom?
#ubuntu-classroom 2011-10-09
<legodude3301> ...
<legodude3301> QUESTION: How to install tar.gz files?
<legodude3301> QUESTION:<How>
<hejibo> hi
<hejibo> I hope to know how to pack a pyside project to .deb. I watched the quickly video , http://developer.ubuntu.com/get-started/.  It is very easy to use quickly to pack pygtk project. Is there similar way to pack a pyside project? Thanks.
#ubuntu-classroom 2012-10-02
 * shookees hi
#ubuntu-classroom 2012-10-03
<shookees> hi
#ubuntu-classroom 2012-10-05
<shookees> hi
#ubuntu-classroom 2014-10-03
<SweetLips> hi
 * SweetLips a
