Category Archives: computers

Gödel, Escher, Bach

I just finished reading Gödel, Escher, Bach by Douglas R. Hofstadter. I’ll wait for you to at least read the wikipedia description of the book.

Done? Ok… The main surprise for me was how many seemingly unrelated topics the book touches. Logic (Gödel), graphic art (Escher), music (Bach) to start with. But also mathematics, molecular biology, genetics, philosophy, zen buddhism, formal systems, artificial intelligence, programming, recursion and self-reference, various paradoxes, and much much more.

It is easily the best book I’ve ever read, although I can’t claim to have understood everything. If you want to borrow my copy, I’d be glad to help (the book is sort of expensive and really hard to get in Czechia).

Firefox productivity tips

If you are like me, you spend a lot of time using firefox. Chances are that you don’t use it as effectively as I do. :)

Let’s start with the look. First, use a minimalistic theme. I use full flat, but whiteheart is also kind of cool. Such themes simply don’t get in your way, which is exactly what you need.

You probably use several toolbars which take way too much of your screen space. Right-click on a toolbar and select “customize”. Then you can drag everything around and hide the unused toolbars. I currently have three rows of toolbars:

  • First toolbar has File, Edit, View menu and others, back, forward, reload, cancel, home icons, location bar, and finally a search bar.
  • Second toolbar contains quick bookmarks – just the pictures without any text, so that I can fit in as many as possible.
  • Third toolbar is shared google toolbar (used mostly just for PageRank), webdeveloper toolbar, user agent switcher and adblock settings.

I often see people wasting their screen space by using the default configuration with menus in the first toolbar and action icons and location bar in the second one.

Speed up firefox by installing fasterfox or simply google around a bit to find out (enable pipelining, disable ipv6, etc.).

Learn to use keyboard shortcuts:

  • ctrl+T — open new tab
  • ctrl+L — go to location bar
  • ctrl+K — go to search box
  • ctrl+up/down — switch search engines when in search box (don’t forget to order them in a way that suits you)
  • alt+enter — open the search from search box in a new tab
  • ctrl+shift+T — open an accidentally closed tab (you can even repeat this shortcut — superb!)
  • ctrl+b — bookmarks
  • ctrl+h — history

If you use a mouse, install and learn to use mouse gestures. At least the few ones for back/forward and open/close tab. I personally prefer FireGestures, as that is the only gesture extension that actually knows what I mean when I perform the gestures. 8-)

Out of the helpful extensions that I use, I must mention at least Download Statusbar, Customize Google and Adblock Plus.

And I almost thought I wouldn’t make another post in March. ^^

New look again

I was thoroughly bored with the previous theme, and although I tried to revive it with the new header image, it was still bugging me. So I created a new one.

I had a draft of a new theme lying around for quite a long time, so I made few adjustments to it: made the code much longer and much less clean. But it seems to work.

Features of the new design include, but are not limited to:

  • big letters in headings (big letters rock)
  • even less images (none, except the two links to flickriver, smilies and images in posts)
  • half-fixed-width half-fluid design (the design is fixed width, but the sidebar is fluid — works well for many different widths of browser (800px — the sidebar isn’t displayed, it’s accessible through scrolling; 1024px — sidebar in one column, 1280px — two columns, more px — more columns (it is capped at three columns)))
  • emphasis on typography (lists, blockquotes, etc. are styled properly)
  • lines vertically in synch (left column, middle column and sidebar)
  • the old color scheme, I mostly like it and more importantly — couldn’t find a better one at the moment :)
  • justified text (I’m still very unsure here — justified looks way better, but left-aligned is more readable)

Bugs of the new design include, but are not limited to:

  • IE6 sometimes messes up the sidebar, not quite sure why
  • Opera doesn’t keep lines in synch when there are smileys (and I thought I had the solution, sigh…)
  • IE doesn’t align the comment date in the comment list (will look into that later)

Also, I spent ages dealing with various bugs in IE that caused things to disappear.
One such bug caused the sidebar not to appear (it was an absolutely positioned element next to a floated element — don’t ever do that), another sometimes caused titles to disappear (they were relatively positioned, now that they are static it seems ok, but I have no idea why). When repairing the sidebar, I had to move it in front of the actual content in the markup, which is wrong and I know it. I am sorry to all lynx/links users out there.

Bug reports, remarks and suggestions are welcome! ;-)

Square thumbnails — are they evil?

The first time I saw square thumbnails (ie. thumbnails which are downsized and cropped to square) I thought they were the best thing since sliced bread.

The advantages of square thumbnails are obvious:

  • they are really easy to align and never mess up your layout
  • the layout will look more uniform and better than with irregular thumbnails
  • they do not show everything so they invite the visitor to view the full sized picture

But there is a downside. Square thumbnails alter the composition of the picture. In some cases, when the photographer hasn’t thought much about composition, it can often actually improve the picture. But in other cases, when the composition is deliberate and well thought out, the square thumbnail can destroy it completely.

I use square thumbnails in my photo gallery (have you seen the pictures from my recent cross-country skiing trip?). And I keep wondering whether I should change it to normal thumbnails (normal = scaled down so as to fit into a given rectangle while preserving the aspect ratio).

Do you personally prefer photo galleries with square thumbnails (cropped) or with normal ones?

Choosing a laptop

I am very picky.

I need a laptop which I will carry with myself on my journey accross Poland and then to the Netherlands. It should have screen with a nice resolution, lots of memory, large enough hard drive, and several other things. So far I picked up three candidates, which are incidentally more or less the same price (19k czk):

HP 6830s
17″ 1680×1050, ATI Mobility Radeon HD 3430, 4gb ram, 250gb hd, Intel Dual Core T1600, Intel 802.11abgn, keyboard with numpad

HP 6730s
15″ 1680×1050, Intel GMA 4500MHD, 4gb ram, 250gb hd, Intel Dual Core T1600, Intel 802.11abgn

Clevo M765TU (Verified By Intel)
15″ 1680×1050 glare display, nVidia 9300GS, 4gb ram, 320gb hd, Intel Core Duo T3200, Intel 802.11abgn

So, while I’d like the 17″ display, I’m scared of the ATI graphics. And I hate numpads.

And I’d like the faster processor and bigger hard disk offered by VBI, but I’m unsure whether nVidia or Intel is better. And I absolutely hate glare displays.

I tried finding more about ati, nvidia, and intel on linux laptops, and among other things I found a very interesting benchmark. Reading all the discussions, I can see that everyone complains about ATI, some people complain about nVidia’s 2d capabilities (I also had some problems with that), and some other people complain that Intel cards are “not nearly as good as nVidia and ATI”). Intel seems like the safe choice — maybe it’s slightly worse, but it should work, and could be more energy-efficient.

Please do tell me if you know anything about current graphic cards in linux. Even better if you know something about the particular ones mentioned above.

I just sold my soul

After pondering about it for a long time, I’ve finally decided to sell my soul. Yes, this blog, the place where I share my thoughts and opinions with you, my dear readers, this very blog has become polluted by ads.

Now, before you leave for good, here are some quick tips on how to avoid being exposed to ads:

  • don’t browse old posts or
  • browse as a registered user or
  • use holy water to protect you from the devil

Any one of the above mentioned tips will help you stay on the safe side. The third one is the best option, as it will also protect you from the devil on most other websites…

Touch typing

I started trying to touch type about two months ago. I used Klavaro (if you are on linux it’s most probably in your distribution’s repositories) to learn, and I’ve also learned by trying to use the right fingers for typing and not to look at the keyboard whenever typing.

My typing speed was promised to increase dramatically in few weeks while practicing a little every day. No such thing happened, although I’ve practiced almost all the time. I still write considerably slower than I did before I started touch typing. Am I unhappy that I started touch typing? Not at all — let me explain:

The advantage is that I can just look at the screen while typing. That might seem like a single advantage, but it’s actually several in one.

First, I can read other stuff while typing or look at people who are talking to me while I type (I learned that from a colleague, it’s real intimidating).
Second, I don’t have to switch display, keyboard, display, keyboard, display, keyboard… I just look at the display. This is much cooler than it sounds — it enabled me to move the monitor cca 40cm above the keyboard (both home and at work). So I can finally sit straight instead of bending over the keyboard.

On a completely unrelated note, I finally switched from czech qwerty (writing !@#%$&^% characters with alt) to standard english keyboard layout. A lot of stuff in vim has become much more comfortable — such as the ; right under my pinky, which means that repeating f/F/t/T has just gotten even easier and better.

On a semirelated note, I never knew that to write the capital X you can press the right shift plus the x. It’s not that I thought you couldn’t do that, I just never realised it could be useful and no one ever told me “you are doing it wrong”.

Best free fonts

Many posts have been written on the topic of best free fonts. Therefore, I’d like to approach it differently.

Here, have a picture:

free typefaces

You should click on that picture to see the large version. And if your screen isn’t big enough and your browser thinks the image would look better downsized — your browser is wrong: click on the zoom button and view the picture in its original size.

As you can see, there are only 14 fonts. Surely there must be more quality fonts available for free? Yes, there are. This is a small selection of only the best of the best.

Now that you have the original picture open, let’s have a look at those 14 fonts (all available either in otf or in ttf):

  • Antykwa Toruńska is a very original typeface created by Polish type designer Zygfried Gardzielewski in 1960. It was digitised by Janusz Marian Nowacki. The font contains many obscure glyphs (various diacritical marks, math symbols, etc.) and is available in light, regular, medium and bold versions, each of which has its own italics.
  • Typo Latin Serif is a slab serif (egyptian) typeface with an extremely large x-height. It was created by a German type designer Manfred Klein.
  • The DejaVu fonts are based on the excellent Bitstream Vera typefaces and extended by additional glyphs. They are well hinted so they preserve their onscreen readability even in small sizes.
  • Palatino is a typeface by Hermann Zapf, a pioneer of computer typography. Palladio L is a free Palatino clone created by URW in cooperation with Hermann Zapf. You can download it in URW fonts pack (together with 79 other fonts).
  • Gentium, a typeface for the nations by Victor Gaultney, extensive unicode support.
  • Optima is another wonderful typeface by Hermann Zapf. You can download it as MgOpen Cosmetica.
  • Bembo is a dynamic antiqua created by Francesco Griffo in 1496. The font Cardo, based on Bembo typeface, was created by David Perry.
  • Vollkorn is an old style numerals featuring typeface which was created by Friedrich Althausen. Old style numerals own.
  • Computer Modern is a Didone typeface created by professor Donald Ervin Knuth.
  • Avant Garde by Herb Lubalin can be downloaded in the above mentioned URW font pack where it is known as URW Gothic L.
  • Goudy Bookletter 1911 is a reincarnation of Frederic Goudy’s Kennerley Old Style by Barry Schwartz (funny thing, another Barry Schwartz… there is also Barry Schwartz the SEO and Barry Schwarts the psychologist from Paradox of choice). By the way, have I mentioned that old style numerals own?
  • Helvetica by Max Miedinger. Perhaps the most famous and most abused typeface ever (seriously, fuck Arial). Helvetica isn’t any less awesome now than it was 50 years ago. This version was created by Magenta Ltd. and is available in the MgOpen pack as MgOpen Moderna.
  • Geo Sans Light is a font by Manfred Klein, which is based on Futura, a geometric typeface created by Paul Renner in 1926.
  • Garamond. The best serif typeface ever. For the third time, URW font pack.

The picture was created with Inkscape. Inkscape rocks. For anything that you think might be vector use Inkscape. Generally, GIMP for photo editing, Inkscape for everything else. It enables very easy manual kerning, and after you are done, you can convert the letters to paths (Bezier), and continue making changes (not sure whether that was clear — anyway go and try it out :)).

Ah, I almost forgot — you can get the SVG source file (already converted to paths, as I don’t suppose you have all the fonts installed).

Got other excellent free fonts? Feel free to leave a comment! ;-)

Nothing is random, everything has a meaning.

Nothing is random.

Everything has a meaning.

The scene fits in under 100 lines of code (with comments! :)), so I decided to publish it here.


/**
* Simple POV-Ray scene with reflective pillars
*
* @author Vit 'tasuki' Brunner
* @license GNU GPL, http://www.gnu.org/copyleft/gpl.html
* @version 2.7, 2008-11-05
*/

// dark and reflective texture
#declare ShinyDark =
texture {
pigment { rgb 0 }
finish {
ambient 0
// reflection .3 // dark version
reflection .6 // light version
specular 3
}
}

// create a pillar of specified height
// kind of hackish, but I can't find a better way
#macro pillar(xx, yy, height)
#declare counter = height * 2;

#while (counter > -1)
superellipsoid {
<.3, .3>
texture { ShinyDark }
translate y * counter * .5
translate x * xx * 2.2
translate z * yy * 2.2
}

#declare counter = counter - 1;
#end
#end

// just some random (random, really?) pillars
pillar(-3, 3, 2)
pillar(-1, 3, 4)
pillar( 0, 3, 3)
pillar( 2, 3, 0)
pillar( 3, 3, 2)
pillar( 0, 2, 2)
pillar( 1, 2, 1)
pillar(-1, 1, 3)
pillar(-1, 0, 2)
pillar( 0, 0, 1)
pillar( 2, 0, 3)
pillar(-2,-1, 2)
pillar(-1,-1, 3)
pillar( 1,-1, 0)
pillar( 3,-1, 2)
pillar(-1,-2, 1)
pillar( 0,-2, 2)
pillar( 2,-2, 1)
pillar( 3,-2, 0)
// there's no such thing as random...

// the sphere everything is wrapped in
sphere {
<0, 100, 0>, 100
hollow
pigment { rgb 1 }
finish {
ambient .6
reflection .05
}
}

// get light quality from clock (+K in params)
#declare qualight = clock;

// back right less bright white light
light_source {
<30, 25, 40> rgb .5
area_light <0, 10, 0>, <0, 0, 10>, qualight, qualight
adaptive 1 jitter circular orient
}

// front right white light
light_source {
<30, 20, -30> rgb .7
area_light <0, 10, 0>, <0, 0, 10>, qualight, qualight
adaptive 1 jitter circular orient
}

// front left blue light
light_source {
<-15, 25, -15> rgb <.3, .7, .9>
area_light <0, 20, 0>, <0, 0, 20>, qualight, qualight
adaptive 1 jitter circular orient
}

camera {
location <7, 9, -14>
look_at <2, 1, 0>
}

To render the picture, you should run something like:


povray +Ifilename.pov +FN +W1024 +H768 +Q9 +QR +A0.5 +AM2 +K11

Well, that’s it. Hope you enjoyed ^^

Oh, you actually want to see the picture? Please check it out on deviantart.

And remember: Nothing is random, everything has a meaning…

.htaccess, document root and Zend Framework

It’s funny but I couldn’t find anyone having this issue. It certainly isn’t limited to Zend Framework, it affects everyone who doesn’t have access to apache configuration and wants to have document root in a deeper directory. Maybe I just can’t google very well.

Imagine a shared host. You can’t choose your document root, it’s firmly set to one particular directory. Now you want to install Zend Framework. Imagine you’d like to follow the standard directory structure (that means you more or less have these directories in your project: application (the application), library (zend and other libraries) and public (stuff accessible from the outside, images, css etc.)). Normally, you’d want to point your document root to the public directory, but when you can’t do that you can use .htaccess in the project directory to redirect everything to public.

RewriteEngine On
RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L]
RewriteRule ^(.*)$ public/$1 [L]

This was the first thing I wrote, and it works on certain servers. Other servers will kindly remind you that “Request exceeded the limit of 10 internal redirects due to probable configuration error.” Which kind of makes sense when you think about it. Makes me wonder how comes the above code actually worked on two different configurations.

Now here’s the code that works (and in my humble opinion it also should work, as opposed to the one above):

RewriteEngine On
RewriteRule !\.(js|gif|jpg|png|css|txt)$ public/index.php [L]
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]

And finally a disclaimer: I am not sure about the security implications. If someone knows more about possible security issues with this, please do leave a comment.