{January 29, 2008}   another busy day.

so sunday and monday I did nothing. dunno why, just didn’t feel like doing *anything*. :(
this morning I got woken up (multiple times) by my friend phoning me. I thought I was never going to see here again; turns out there was a mixup with the dates she’d told me, and she had gone to hainan earlier than I expected, but now she’s back for a few more days :) yay.

so eventually I decided it was time to get up, and went out with her for a fancy lunch. yummy kiwi drink, mushroom soup, veggies with cream sauce, a chocolate cake-like dessert… all of it was amazingly delicious. :) tourist prices of course, but well worth it.

after that we went to the hairdresser – she was scared to go alone in case they misunderstood and messed up her hair, and I’d been avoiding it for the same reason. now I wish I’d gone months ago; it was great :) they washed our hair, and I got a massage before my haircut, and then afterwards I chatted with some of the hairdressers ’cause my friend’s hair still wasn’t done (straightening takes aaages). and all that for only 20 kuai each (about $3); in canada I’d have to pay $20 just for a normal haircut.

after that I had to go shopping, urgh. I hate shopping. I was a little stressed when I couldn’t find the right type of batteries at haoyouduo (type C is always a hassle) but the third salesperson I talked to went to a pile of boxes and started searching; I think he was on the tenth box when he finally found them :) so now I have my batteries, and a mini adaptor plug for my laptop so I don’t have to lug a whole power bar up to beijing with me (uhh, now let’s hope the thing I bought does work in beijing!).

I should have stopped for dinner on the way home, really. I almost forgot about food again. guess I’ll head back out now… urgh, but I’m just so drained. I wish I could just pull something out of a freezer and microwave it…
still, today was fun. so yay. and there’s still a bit of snow on the ground, sorta.

{January 26, 2008}   busy busy

whew. thursday and friday were long days. in the middle of redownloading my email thursday, kontact crashed, and when I started it back up and it started redownloading email, the whole system went down. heard some weird beeps, kontact was frozen, then everything was frozen, then I lost my mouse pointer… hitting ctrl-alt-delete made a beep but didn’t actually shut down, so I had to do a hard reboot. when it came back up, I had filesystem damage, and had to reisefsck –rebuildtree :( the upside of this is that it forced me to do a backup beforehand. now I guess I should back up the repaired filesystem. :)

so anyways, I also had to do some minor shoe repairs before heading out to meet my friend – I left the computer happily downloading mail again, and went out and had a fun evening. ended up meeting some guys in a bar… when they saw my harmonica they insisted I come back for a jam session on wednesday, even though I can’t really play… hehe. well, it’ll be interesting. if only I could remember whether they said 7 or 9…

the next day I had to wake up early to meet a chinese friend and sort out travel plans. my phone was out of money and he was delayed, so it was a while before we actually met up, but his travel agent friend was quite nice… unfortunately she was having trouble getting me any of the places I was interested in going, so now I have a list of packaged tours and her phone number. I’ll have to figure out later whether I’m actually interested in any of them.

after that it was a hurried lunch and off to see a teacher for some last-minute bureaucracy. seems the messages finally filtered through, and now I have to fill out forms before I can leave this school. after filling them out, I had to bike around campus getting them stamped… china really likes its stamps :P

I was feeling pretty tired after that, and I ended up sleeping through dinnertime and missing a poker game… oh well. missed a chance to lose a bunch of money, I guess :) then I woke up just before midnight – sleeping through dinnertime is really bad – and saturday moprning I slept in past 1pm :/ after finishing up a patch and dealing with bugzilla/mailinglist stuff the day was pretty much over. I went out for dinner (see, I’m still eating at least one meal a day) and discovered it had been snowing :) there was enough snow on the ground to make snowballs! :D

now it’s sunday morning, and I’m wearing gloves it’s so cold in here. this makes it a bit hard to type without sliding onto other keys, but it reduced the problem of hittingthe the wrong keys because of my fingers being numb :P it seems my touchpad doesn’t like this, though. I can move the mouse a little but not scroll.

I need to debug an annoying twitter engine bug today, and I’m procrastinating. I don’t like this bug. maybe I can procrastinate by making a separate account for testing purposes…

{January 24, 2008}   no mail for me.

ugh. so gmail’s pop3 randomly stopped working earlier today, and wordpress deleted instead of saving the post I made about it. and I have to fill out forms for the school tomorrow apparently, and today’s generally being a stressful day.

gmail randomly stops sending messages over pop sometimes, telling the client there are 0 (so you don’t notice any problems at first), and there are only two ways to fix it: reset it to send you mails after the reset time (meaning any mail between the failure and then is only stored on their server, never sent to you) or reset it to send you *all* your mail ever.

I ended up choosing the second option, because I need my local archive, so I’m going to be unable to use mail for a while. last time I had to do this it took at least a day, iirc. since gmail limits how many messages you can download (it seems the more you check mail the less you get) and I’m not on a very fast connection, this could take a long, long time.

I can’t read my mail while it’s doing this – webmail can mess up gmail’s pop sometimes too – so I won’t be responding to mail until this is all done. I can still read panel-devel via the web archive, though.

does anyone know of a reliable pop3 server that’s willing to respond to (and maybe even fix) server problems? I guess it’d have to be one that does *not* have a bajillion users already.

{January 21, 2008}   hello planet sine!

well, planet sine can’t see the title ’cause it has the same bug as planet kde. but oh well.
so, um, yeah. I’m on two planets now. yays.
does this mean I’ll have to go through the cycle of reviving one of my freetures projects, rewriting a bit of it and dropping it again? ;)

obligatory totally-offtopic-comment: I had an exam today. the last one is tomorrow. that means I’m almost done. I think it’s gonna be confusing for a while, being done with the chinese stuff. will probably take a few days to unbreak my mind and actually start getting things done.

{January 19, 2008}   code style n’stuff

some people may have noticed I’m being a bit of a style nazi recently. I don’t mean to annoy (ok, today I’m in a crappy mood and *do* want to annoy people, but I’m trying not to let it show) but I really think coding style is important. it’s a little thing that makes a big difference.
I was thinking about writing a blog about it, but it seems there are a couple of good blog posts on the subject already. the second one is aimed towards companies, but I think this is an even more important thing in free software – anyone can read our code, so it’d be nice if they don’t cringe when they see it :)

anyways… that kinda cuts my blog post short. no need for me to repeat what they’ve said.

hey, so trolltech’s finally ready to license qt under gpl3 as well as the existing licenses. yay! :) awesomeness.

it seems most people are having lots of fun at the release party, too (how dare they have fun without me! ;). all the talk about the release party makes it really hard for me to want to study. but my most important exam is on monday… just a few more days, then I’ll be freeee! despite trying not to spend all my time on plasma stuff, I still ended up fixing a few bugs, and writing stuff, and things… hey, if I’m gonna procrastinate, I might as well procrastinate by doing something useful, right?

ugh. I’m feeling burnt out.
I spent most of yesterday looking for hostels, taking notes and comparing and trying to get maps n’stuff, and also making several attempts at booking a flight home.
today, after my exam, I spent the afternoon making several *more* attempts to book a flight – never have I run into so many goddamn problems. if it wasn’t the website ui’s themselves, it was something in the visa part… in any case, I eventually gave up and sent my dad an email asking him to do it. at least if things go wrong on his end he can call a phone number that’ll *exist*.

there was one nice thing today – it was snowing in the morning. if I hadn’t had an exam I would’ve slept through that – it was all melted and gone by lunchtime. now it’s just bloody cold, without the pretty snow.

I don’t want to think, I don’t want to do… I just want to curl up in bed and rest. or do go problems. in highschool I could spend hours doing math contest problems, and now it seems go problems fill the same desire for nice little solvable puzzles :) I don’t have to worry about running into something that’s too hard or unsolvable or anything, so they’re perfect for these times when I’ve already had my fill of frustration for the day.

I’m going to be flying back on march 6th, btw. before that I’ll probably spend the first half of february relaxing and coding (and preparing to leave), and the second half wandering about the country. I still kinda have to figure out where I’ll actually go, other than beijing and xi’an :)

it seems I haven’t been writing about china much lately. funny that – my nonkde posts aren’t on planetkde any more, and suddenly there are hardly any of them anyways. maybe because I don’t expect anyone to read them now.

anyways, my brain is going a mile a minute tonight for no apparent reason, so I need to braindump again. normally I’d be quite happy about this, but I was just starting to get into study mode and now I fear that this will derail that by switching me into creative mode. I want to write about plasma, I want to figure out what I’m gonna be working on, I wanna fix bugs, I wanna play go – but no, I should study, because I’m horribly behind and chinese requires actual studying to pass.

I’ve been spending far too much time alone in my room lately. it’s not good – but now it’s exam season, so everyone else is busy too, so it’s a bit late to deal with that. just gotta hold on to some form of sanity until exams are over :) although when they’re done I might want to dive back into plasma anyways, which reduces the socialization time… on the other hand, I might not, and then I’d be sad about not wanting to code when there’s so much to be done.

sometimes it seems like I have a social life here, sometimes it doesn’t. there are a couple of chinese comp sci people who were assigned to me and pete back in summer, and I enjoy hanging out with them, but they’re often busy with school and of course they’re way out at zijingang. I still haven’t got around to making them teach me to play mahjong – damn, I’ve forgotten the proper characters for it too. pronounced something like ma jiang, but of course I’ve forgotten the tones…

anyways, there’s also a 2nd cohort ddp guy I hang out with sometimes (he introduced me to the restaurant that puts potatoes on its pizzas – yum!) and there’s a german girl here at my campus (although our taste in food is almost completely different, so we can rarely agree on somewhere to eat) and just before new years I met some fun people at another campus who I haven’t talked to since their awesome new years party… it was really nice to be at a good party; hadn’t actually enjoyed one in china before that. can’t remember if I blogged about it. they had all sorts of food, including potato salad, and they had music and dancing, and even a few fireworks that supposedly were quite hard to get :)

maybe I shouldn’t be swatting away rsibreak. not good for my wrists, but I don’t wanna stop typing :P

oh god, am I ever sick of the konqueror wordpress bugs. I had to go back to kde3’s konq because of the proxy breakage (hey Andreas, how’s that going? never got a reply to my email) and it seems I’ve still got 3.5.7 here; I wanna get off feisty, but gutsy has too many breakages that would affect me, and I’m not in the mood to try new distros right now. when I get home I’m definitely gonna use my desktop system for testing out some other distros; I’ve had quite enough of this. I just hope I can actually find something that works better for me than kubuntu feisty.

but enough about my poor dying laptop. um. where was I? I still have too much in my head. a lot of it is about plasma. looks like people are going to be actually doing some planning soon, so I wanna do some too. however, I’m reluctant to commit to anything. I’ve just been bouncing around too randomly. maybe committing to something would help stop that now actually, since I soon won’t have to worry about school. march – august will be 6 fun months of mostly programming, if all goes well. :) …I still worry about the ‘if’ part, though. I have these fears that one of the universities is going to screw me over somehow. they’re already saying they’ll still charge me for the spring semester than I’m in the process of withdrawing from.

there’s gonna be a hell of a lot for me to do soon. that’s good and bad, I suppose. mostly good. I need to plan out where I’m going to travel, organize some kde materials in case these crazy chinese actually really *do* expect me to speak about it in beijing, book a flight back to canada, look into housing… also have to do some maintenance on the poor old laptop so that it stays usable until I get home, and track down a really annoying elusive bug… oh yeah, and I was kinda planning to do coding and socializing once exams are over :P

when I get back to canada I’ll be busy too. I’ll have to do apartment-hunting for real (I’m hoping to get into a really nice co-op in new west, but they seem unlikely to have space by then, so I’ll probably have to find other co-ops and see if they have fun people). I’ll have to revive my social life (yay, one thing that’s guaranteed to be fun). I won’t have to get a new phone, yay, because robin uncancelled my old one. although I might anyways, when other things are dealt with. I’ll have to write a soc proposal. I’ll have to figure out travel plans for akademy. I’ll probably have to do a bunch of tech support for my mum. I’ll have to get back in shape, because with the price of bus fares these days i’ll probably be riding my bike a lot – not having a upass until september will suck. :( and I’m also hoping to do lots of reading, and learn more about qt, and permaculture stuff (I really, really wanna grow some raspberries), and get better at playing go and juggling and a bazillion other things. :) no idea how I’ll fit all that in, but I guess I’ll have to figure that out later. and then of course there’s still plasma. and certain people that I’ll need to spent a lot of time with. :)

whee, so many exciting things coming up. I just hope I can keep the enthusiasm and not sink back into apathy.

lately I’ve taken to practicing juggling while I wait for food. I can’t do it everywhere, because some places have too much food nearby or don’t seem clean enough, but it often seems to impress the staff :) at one place it turned out that one of the guys could juggle, too. I’ve also been trying to practice playing my harmonica a bit more, although I really need to find a c# one so that I’m not stuck in the key of C :P

aand my train of thought just got derailed by someone on jabber adding me and trying to talk to me in a language I don’t understand. huh. second time that’s happened to me recently. they start with english, but then go off into something else, and I never know who they are or how they found me.

mmm, nutella. I brought back a second jar of nutella in september, because real chocolate here is rare and the same price as in canada (snickers bars use the fake waxy stuff). originally I was saving it for spring semester, but since I’m now leaving soon, I’ve suddenly got this big jar that needs eating! :)

my mind appears to be slowing down a bit, now. bit of a shame, but maybe it means I can get some food and study a bit. or maybe I’ll return to irc procrastination – I’ve been doing far too much of that. :)

the first sentence of this paragraph seems to have vanished. huh. it was something about plasma planning, I think. I already organized my plasma basket yesterday (free layout is fun at first but gets so messy!). I think I need to sort out which ideas and bugs in there are actually being worked on by others, which I’d like to work on, and which I actually expect to work on. and get the ones I expect to work on onto techbase, along with a clearer version of my plasma braindump. maybe I can make up some private pages and mess around on those. I wish I could be at the release event… but I’m looking forward to akademy already :)

{January 5, 2008}   what I’ve learnt about plasma

warning: the majority of this post is basically just a braindump of random data. it may or may not make any sense. if it looks too long, then just don’t read it.
[this post was written over several weeks. if it sounds a little disjointed, that’s why.]

I feel like I’ve been learning a lot about how plasma works recently. it’s like some tipping point has been reached, and suddenly I *get it*. I see code that’s kinda ok and working, but really doesn’t look Right – and find out that my feelings about the code are correct.

in the interests of not forgetting what I’ve learnt, and helping other people to learn it with less pain, I’m gonna just kinda braindump here. some of this is random trivia, some of it is really important concepts that affect whether your applet is a buggy mess or a nice happy simple thing.

this information really should get onto techbase or something asap, but I feel like I need to have it written up more nicely before I put it there, and if I wait until I can write it up nicely I’ll have forgotten half the stuff; I need somewhere I can do a few drafts first.

sizing: when you’re an applet doing your own stuff, you want to use functions with Content in them, so that you don’t have the borders added in. when you’re acting on another applet, you use the ones without, so that the border is taken into account. other than that, I’m really quite confused. I feel like we really shouldn’t need two functions for every type of sizing. but I don’t have time to investigate that right now.
If you need to be notified when your plasmoid is resized, then implement constraintsUpdated() and check for a sizeconstraint. your new size is given by contentSize().
avoid reimplementing functions that return a size. only override contentSizeHint if you really need to (eg. controlling the aspect ratio).
if you know you’ll always need a certain amount of space, then setMinimumContentSize

when creating an applet, do as little as possible in the constructor. set a default size, and preferably no more. your ui creation, config reading, etc. should all go in init() instead. don’t read your size from the config, it’s done for you.
if your applet is useless without some configuration, then there’s a special thing you should set, but I forget what it is; I should do this for twitter at some point.
however… layouts may not like not being in the constructor. can someone explain how these two bits of information fit together?

don’t sync the config; that’s plasma’s responsibility. you can, however, emit configNeedsSaving().

there’s stuff to be done when accepting mouseclicks so that the event doesn’t get completely swallowed all the time – but I’ve forgotten the details and just can’t find the information any more.

setVisibility() does the same thing as show() and hide() – so don’t use both at once :P

if your function name starts with “got”, or you’re having trouble commenting the function in the header, chances are your design is suboptimal.

if your applet gets data regularly, don’t use a qtimer to poll the data engine. have the data engine alert you when it’s got stuff, and set an update interval when you connect to the source. reducing the number of timers makes laptops happy. :)
there’s no need to worry about connecting to the same source twice, it won’t hurt.
if you use Plasma::AlignToMinute, you won’t get any updates until the minute rolls around – if your first update was a fake empty one and the actual data was downloaded 5 seconds later, you’ll have to wait another 55 seconds for it.

if you were trying to work on a dataengine in the past, and wondering why the update interval wasn’t always updating – it was probably the timing bug that I just fixed, so you can go revisit that code now :)

remember that if the dataengine creates a source, it hangs around until it’s explicitly killed off, but if an applet requests a source it only stays as long as something’s connected to it.

if you really really want to send data from an applet to an engine, the current awful hack is to abuse Q_PROPERTY… but please don’t. hopefully we’ll have guidelines on a non-awful way to deal with this for 4.1.

I think I know enough about dataengines that i could write something on how to use them, but figuring out what to say is hard.

The general idea of the dataengine is that it provides data in a nice, easy-to-use way, so that writing applets is easier. if you have 5 different clocks on your desktop, they’re not all polling for the time individually; they just connect to the time dataengine, tell it how often they want updates, and it’ll send them a regular signal with the data they need (in this case, the time). this means the clock applets don’t need to each have their own QTimer. reducing the number of timers is always a good thing.

if you just want to make use of an existing dataengine, it should be fairly straightforward. the documentation of DataEngine is good; read it. First off you’ll want to create a dataengine with Applet::dataEngine() – this goes through the engine manager, which makes sure there’s only one of each engine running, and kills it off when nobody’s using it any more.
you should probably check that you actually got a valid engine back before doing anything with it, just in case something funny happened.

once you’ve got your engine pointer, you can query the list of sources, connect to sources, etc – all the stuff mentioned in the DataEngine API. what the API doesn’t tell you, of course, is what kinds of sources are offered by the particular engine you want to use. the sources may not be created until you request them, the engine may expect source names to follow a certain format, etc… these things depend on the individual engine, and I don’t know whether there’s a standard way to document them yet. twitter has a big comment in the .h file right before the engine class; otoh, the time engine only has this mysterious comment: “This class evaluates the basic expressions given in the interface.” I had to read the source code to see that it has sources named by timezone.

so, what if you want to actually *write* an engine?
well, you’re going to have to provide data to the applets requesting those sources. there’s two general concepts here: data that can be returned immediately, and asynchronous data that has to be downloaded or something. the first is, of course, easier.
here, again, DataEngine docs come in handy.
updateSource is called whenever it’s time to update a source. pretty straightforward, right? so, this function is generally where you figure out what your data is, and setData() on the source. if you’re doing something asynchronous, you’ll want to set that in motion and return false (to show that you don’t really have anything useful yet).
sourceRequested generally wants to call updateSource(), to get the ball rolling on the new source. asynchronous engines don’t want to bilndly return the return value from updateSource(), because here returning false means that no source was created at all (something you might want if you’re expecting, say, a timezone, and the applet requests “mars”).
also, for asyncronous engines, when the data finally does come in you should just need to setData() (you remembered to keep track of what source it’s for, right?) and… well, that’s it. see? sending data to applets is easy :)

oh, and you might also want to give some thought to how long information is held in the engine. do you want to clear out all the old data from a source when you update it? or would you be better off just appending to it – and then making sure that it doesn’t grow too big, of course. :) sources created for an applet request are removed when nobody’s using them any more – but if your engine creates new sources on its own, should it remove them on its own eventually, or let them hang around until it’s deleted?

if you want data to go the other direction… well, best to wait until that’s been figured out properly.

strange, I was quite opposed to the thought of writing tutorials a week ago, but now that I have some paragraphs together it’s starting to look like a tutorial anyways.

detour! let’s talk about *using* plasma.
keyboard shortcuts: ctrl+f12 brings up the dashboard. this brings all the desktop widgets to the front. whether or not panels should also be raised hasn’t been decided afaik.
new thing in today’s plasma: thanks to Alex, holding ctrl while resizing allows you to change the aspect ratio. dunno how this actually works in practice since I haven’t svn upped yet.

I think that’s it for keyboard shortcuts. someone needs to add more someday. preferably in a sane manner, not just at random. :) apparently such information belongs in kdebase/workspace/doc – but I’m just dumping raw information right now, I’m not gonna write actual real docs unless someone tells me how :)

oh, and if you right-click on the little gap between two tasks in the taskbar, you get the standard applet contextmenu. this was supposed to also be added to the menu you get when you right-click any task, but I think that turned out to be harder than expected and isn’t done yet.

wow, it’s amazing how much I get done when I’m avoiding studying. :P

it seems to me that this is a time of beginnings.

KDE 4.0.0 has been tagged. at least, I think it has. the last minute commits were dizzying, so I ran off and got some chores done. I’ve never seen a tagging in progress before, and I imagine the only thing that could compare to this one would’ve been 2.0 :) last-minute commits everywhere, last-minute compile failures and fixes, everyone scrambling to get one last thing in… it’s nutty :) I can see how they’d need a week to straighten things out before release.

this is the start of something big. KDE 4 has now truly begun. we have a brand new foundation here, with all sorts of possibilities. over the next few years we’ll see applications turn those possibilities into all sorts of cool new realities :) as more code takes advantage of what KDE 4 makes available, KDE will get even *more* amazing. in the next year we’ll probably see a lot of bugs being trampled. features that didn’t make it into 4.0.0 will return. eventually the stability and completeness we got used to with 3.5 will return – but with ten times the awesome. ;) and at the same time new features will emerge, probably ones we haven’t even dreamt of yet, crazy stuff that’s only possible because of the wonderful design of this foundation we’re tagging today.

I’d like to specifically congratulate everyone who’s been working their ass off on plasma recently – aseigo obviously, without whom we’d probably still be stuck with a traditional 90’s desktop for the next 5+ years. jstubbs, who’s been madly fixing bugs and seemed to be everywhere at once while aaron was on vacation – scratch that, he *still* seems to be everywhere at once. ;) gamma, for that cool new look on the toolbox; notmart, the icon fixer-upper; spstarr and his weather plasmoid… and whoever else I’ve forgotten – there’s always someone I forget. you guys have made something amazing here. for all the whiners complaining about the problem-of-the-day, there are more people silently enjoying your work, watching it grow… and it sure is going to grow. this is the beginning. this is the first release, and it’s only going to get better from here, and everyone who’s been a part of that is going to be able to look back on this someday and see that they have had a part in shaping the desktop of the future. :) and one of the things I love about open source – years from now, you’ll still randomly have people thanking you for your work :) and the complainers will probably have moved on to pick on something else.

another beginning I’ve noticed is the arrival of olpc and eee (oh yeah, and that classmate thing, and the gPC). olpc was ridiculed for trying to bring small, affordable, laptops to children in developing countries – and now everyone wants to either get one or sell their own brand of… what are these things called, exactly? sub-notebooks? whatever. they’re cheap, they’re portable, they’re opensource (mostly), they’re shiny and I WANT ONE! …but it’s too late to buy an olpc, and my laptop is still limping along, so I’m gonna wait a bit. in any case, their popularity seems like a great thing to me; finally it’s been proven that there’s a market for cheaper, slower computers. you wouldn’t believe what my mum paid to get a new work pc fast when hers was fried. the new machine is horribly overpowered for word processing. if one of these things were available back then, she would have saved a lot of money.

it’s gonna be a new beginning for me too, soon. I’ve finally let my advisor know that I don’t want to stay in china. I’m going to finish up this semester (less than 2 weeks of class left), hang around for the new years celebrations, go travel a bit, then go home. this should leave me with most of spring and summer to focus on programming, plus a few other things I wanna do in vancouver… so, SoC project ideas, anyone? :)

It’ll be nice to have lots of time to code then… but… right now, I’m trying to take Yet Another break. I kinda have these exams coming up, you see. I can’t seem to focus on chinese properly when there’s code dancing through my head, and I can’t focus on code properly when I know I should be studying, so I’m really going to try to disappear for a couple of weeks. my twitter stuff got committed, and since it took longer than I expected I didn’t actually start anything else, so all the unstarted things are going to have to be dumped into basKet again… I have way too much stuff in there :)

so, happy new year everyone :) may 2008 bring many new adventures. we live in interesting times, and we may as well enjoy it :)

et cetera