Kristian's web log

July 29, 2009

Saint mode?

Filed under: Varnish — Tags: , , — kristian @ 16:08

Yet another implementation of saint mode part 3. With some luck, we can do this in trunk soon[tm]. The idea is to let VCL decide, based on the backend response, whether to used a cached object or a fresh one.

This is controlled in VCL ( if(beresp.http.foo == Yes) { set beresp.holdoff = 20s; } ). Not quite ready, but fun nevertheless.

16:56:09 200 OK Age: 0
16:56:10 200 OK Age: 1
16:56:11 200 OK Age: 2
16:56:13 200 OK Age: 4
16:56:14 200 OK Age: 5
16:56:15 200 OK Age: 0
16:56:16 200 OK Age: 1
16:56:17 200 OK Age: 2
16:56:19 200 OK Age: 4
16:56:20 200 OK Age: 5
16:56:21 200 OK Age: 0
16:56:22 200 OK Age: 1
16:56:23 200 OK Age: 2
16:56:25 200 OK Age: 4
16:56:26 200 OK Age: 5
16:56:27 200 OK Age: 0
16:56:28 200 OK Age: 1
16:56:29 200 OK Age: 2
16:56:31 200 OK Age: 4
16:56:32 200 OK Age: 5
16:56:33 200 OK Age: 0
16:56:34 200 OK Age: 1
16:56:35 200 OK Age: 2 <—- Set unwanted header on backend response
16:56:37 200 OK Age: 4
16:56:38 200 OK Age: 5
16:56:39 200 OK Age: 6 <— ’saint mode’ is in effect.
16:56:40 200 OK Age: 7
16:56:42 200 OK Age: 9
16:56:43 200 OK Age: 10
16:56:44 200 OK Age: 11
16:56:45 200 OK Age: 12
16:56:46 200 OK Age: 13
16:56:48 200 OK Age: 14
16:56:49 200 OK Age: 16
16:56:50 200 OK Age: 17
16:56:51 200 OK Age: 18
16:56:52 200 OK Age: 19
16:56:54 200 OK Age: 20 <— Return backend to normal.
16:56:55 200 OK Age: 22
16:56:56 200 OK Age: 23
16:56:57 200 OK Age: 24
16:56:58 200 OK Age: 25
16:57:00 200 OK Age: 0 <— Varnish catches up.
16:57:01 200 OK Age: 1
16:57:02 200 OK Age: 2
16:57:03 200 OK Age: 4
16:57:05 200 OK Age: 5
16:57:06 200 OK Age: 0
16:57:07 200 OK Age: 1
16:57:08 200 OK Age: 2
16:57:09 200 OK Age: 4

Btw, this is the output of:
$ while sleep 1; do FOO=`date +%H:%M:%S`; echo -n "$FOO "; GET -Use http://localhost/~kristian/index.cgi | egrep '(^Age|^200|^503)' | perl -e 'while () { chomp; print; print " " }; print "\n"'; done

July 23, 2009

New apartmenth

Filed under: /home/kristian — Tags: , — kristian @ 22:20

I recently bought an apartment on Lambertseter in Oslo, and have spent my summer vacation and evenings renovating it. The apartment is originally from 1959, and was in pretty bad shape. I spent at least two weeks tearing it down and preparing for painting (several layers of wall paper. Floor. Parts of a kitchen built to withstand nuclear war. Sparkle, etc…). I’ve gotten some help with the painting and tiles in the hall (Courtesy of my dad. Thanks dad.). Other than that, I’ve done it all myself (with some help on the floors in the living room and bed room from Kjetil. Thanks.). Oh, and I should probably thank my brother too, who’s helped me extensively (Transportation, ground work, kitchen, and various other tasks…)

Not quite done yet, nor have I gathered all my pictures yet, but here are some, with comments, taken on my lovely phone (from 2004?), so they are a bit grainy.

Living room

Living room, from the hall.

Living room 2

Living room, facing the ‘computer section’. Obviously, there’ll be more furniture.

Floot detail

The floors turned out quite well, though there are some details to finish. This is also from the hall, to the living room.

Kitchen 1

Kitchen, from the hall. Currently used as storage for large equipment/boxes/materials.

Kitchen 2

Kitchen again, wohoo… dish washer. It’s only 45CM wide, to leave some room near the door (to avoid walking into the bench). Hopefully I can get some tiles done this weekend. No floor here because of the inner most cabinet, which is original. It’ll be covered up by the time I’m done with the electrical work.

Kitchen detail

Funny detail in the kitchen :) This hatch is even brand new, I just didn’t remember that there would be a closet in front of it when I told the guys who helped me with the paint that they should replace the original instead of sealing it up. Oh well, can’t really see it unless you look for it.

What I didn’t get a picture of is the 13cm ‘corner’, the cabinet to the right is aligned along it, but it meant I couldn’t use any normal corner solution.

Kitchen detail 2

Same as above, but with the door open and zoomed out. Given the 13cm-annoyance, this worked out reasonably well.

Kitchen detail 3

An other detail from the kitchen: This is the only piece left of the original kitchen, though I changed the door. I didn’t really fancy moving the water heater. This, combined with the 13cm-corner/wall tha’s behind the door made for a little opening, but it doesn’t really look all that bad.

Walk-in closet

So yeah, this is a mess…. It’s the walk-in closet right next to the living room… Pretty ingenious, really. In the back, you can see my computer… And on the shelf, the broken raptor (37GB). I like the mixture of glue for the tiles, paint brushes and raptor disks. The shoes are my brothers, he was helping me on a daily basis while his daughter (my niece, lovely kid!) slept on my balcony.

Woooho

I love this detail :) I have no computer in my living room, but a hole in the brick wall. Which means no noise in the living room at no effort. Pretty neat.

I left out the bed room, which is in reasonably good condition, if it wasn’t for the complete lack of anywhere to put my cloths, so it’s basically an utter chaos. The bathroom can wait for when my camera deteriorates further and thus doesn’t reveal the nasty quite as clearly. Because that’s left ‘intact’.  (The bathroom pictures are actually up, if you look hard enough).

Edit: Added some old pictures

I dug up the original finn.no pictures (since I bought this apartment, I consider this to be fair use, morally acceptable etc. IANAL), which should tell you something about the work involved:

July 21, 2009

Window Managers – WMII and Awesome

Filed under: /dev/random, wm — Tags: , , , — kristian @ 13:57

I’ve been trying out wmii and awesome (wm) for a few months, and must say it’s a mixed pleasure switching from Compiz to wmii and awesome.

First let me tell you a little bit about wmii and awesome: They are both ‘dynamic tiling window managers’, which basically mean they resize windows for you so you always use the entire screen. Additionally, they both work on ‘tags’ instead of ‘workspaces’, which is just an other way of saying they work on workspaces, but diffrently. Really.  [Edit: The major difference is that you can have a window in more than one tag, where with traditional workspaces, your only option is to have a window in either one or all workspaces/viewports/thingamajings]

So why did I stop using Compiz? Because I didn’t have time to figure out why I had screen glitches when I was scrolling after upgrading to Ubuntu 9.04. I knew it probably wasn’t Compiz, but I also knew it was probably related to something that Compiz uses (like TFP or similar). It’s just too much dark magic at work, and it’s frankly not very mature (there, I said it. A long-time Beryl/Compiz-developer said that the technology that Compiz uses isn’t very mature).

So anyway, I’d heard good things about wmii, so I tried it.

I liked it.

I finally got used to navigating with hjkl, after using GNU+Linux for 10 years.

Let me tell you why I like it: I essentially use two programs for what a wm is concerned: urxvt and firefox.  And mplayer, but that’s hardly an issue. Firefox is usually maximized, and I quickly start and stop terminals. In Compiz, I wrote maximumize to make that easier. With WMII, terminals just worked.

Tags with wmii was also fun, but I didn’t feel that I really got to use them properly. You can’t view multiple tags at the same time, and if a window has multiple tags (ie: exist on multiple workspaces/viewports), you easily end up removing tags from it if you want to move one of the tags around. This typically means that if I tag all my firefox-windows with ‘f’, then decide to move the calendar-window from tag 2 to tag 3, it’s no longer tagged with ‘f’ unless I re-tag it.

However, one thing really ruled with wmii: Pretty much everything is a script, or oriented around scripts. The defaults were a little strange: by default, it used ALT as mod key, which is rather common to use for other apps. And it also had ‘exec’ as the first option if you used Mod+a to execute certain actions, which essentially meant I crashed/stopped the wm several times by accident.  But this was all based around simple shell scripting and piping. And it was easy to hack. Which I did. And it was great fun.

But here’s the problem: WMII has no notion of multihead. This was a major drawback, as I had to use multiple X screens, which isn’t nearly as dynamic. This essentially turned into the show stopper. I couldn’t move my windows around, and I had to restart X if I connected my laptop to a projector or external monitor.

So I turn to awesome. And immediately I notice a few issues: First of all, it uses x-terminal to start terminals. This is good. What’s not good is that this is set to gnome-terminal by default on Ubuntu 9.04. I wasn’t running GNOME. It didn’t start. There was no indication of why it didn’t start. I won’t really consider this an awesome-issue, but an ubuntu-issue.

Awesome handles itself similar to wmii, but it actually handles multihead in xinerama/xrandr/twinview/mergedfb/whateveryouwannacallit. It simply works. The tags seem simpler; Where in wmii I created tags with names easily (for instance a “mail” tag, or a “customer A”-tag) with Mod+shift+t/Mod+t, awesome seems to come with nine tags pre-created and no names (ie: tag one, two, three…). It does seem able to display multiple tags at once, though, which is nice. And better yet: It’s really easy to toggle what tags are shown.

Awesome and wmii is also different in that Awesome deals with “window layouts” where wmii deals with columns. In wmii, a column is just that: a column of windows. You can move your windows with mod+shift+hjkl, and moving them to the left/right will move or create a column. Awesome, on the other hand, has a number of layouts to select from, and will create columns and rows accordingly, which strikes me as more flexible. However, moving windows in awesome isn’t quite as nice: You don’t actually move them, you switch them with the next/previous window, which means you can’t intuitively move a window from left to right.

Awesome also has a nasty habit of displaying important windows (like the confirmation-dialog of nvidia settings) below other windows. This wasn’t an issue with wmii. However, the general feel of awesome is somewhat better.  It used the super-key by default as modifier-key, and it uses the F1/F2-key combos for help and running stuff, so fewer key-bindings to remember (although it uses mod+F1/F2, not Alt+F1/F2). Oh, and Mod+F1 is actually just a shortcut to open manual pages, and Mod+F3 is a shortcut to open ssh terminals (pretty cute, really).  I still haven’t felt the need to configure awesome much, but it seems fairly straigth forward.

What I miss most in awesome, that wmii had, was the ease of navigating windows. Awesome places all window-titles in the menu/status-bar at the top, which essentially means it’s impossible to tell what window has focus. I’m guessing I can improve that with a theme, but I shouldn’t have to.

So what window manager to use? Well, both awesome and wmii are good choices if you don’t need/want a full DE (KDE/GNOME/XFCE/…). I’d say that if you have two monitors, or are likely to use two monitors, you probably want awesome over wmii. Otherwise, I’d probably go with wmii, due to the window navigation and the ease of customizing it.

Summary

Awesome:  Better defaults, quirky window navigation, less dynamic tag-creation, better multihead. Seems more prone to bugs (dialogs below other windows, changing tag on one head seems to change it on the other too from time to time.)

WMII : Actual help on startup. NO multihead support. Powerful tag creation/deletion. No way to veiw multiple tags. Really nice window navigation. A tad too locked into coulmns.

All in all, something I miss in both of these is a way to switch focus between screens without using a mouse. Maybe I’m missing it somewhere in Awesome, but wmii will never be able to do this as long as it requires multiple X screens. Awesome was very intuitive: Things like moving windows with the mouse ‘just worked’.

[Edit: Awesome can switch between screens with Mod+Ctrl+j/k. Just goes to show you should read man files before hitting the "publish" button]

Oh yeah, I still haven’t given up on Compiz. I just took a break. Maybe I’ll work on wmii or awesome, or go back to Compiz… Who knows.

July 5, 2009

Pop Quiz!

Filed under: /dev/random — Tags: , — kristian @ 22:17

I like funny little problems – but more importantly: the different ways people solve them. Hope you do too. I’ve only got two questions this time around.

 Question 1: How do you delete a file named -foo ?

Ok, sorry, this is a mandatory question. It ALWAYS comes up. The well-documented answers are: rm — -foo and rm ./-foo. Do you have any other simple answers?

Question 2: How do you easily list all directories in a directory with both files and directories?

The easiest way I’ve found is «ls -d */», but you could always fall back to find («find -maxdepth 1 -type d»), but that’s boring. Piping and grepping on ls -l was suggested too…. Any other interesting solutions that I’m missing?

Powered by WordPress