nostromos bLog
   


"bLog means boring-Log"

* get indexed
* get rss-fed
* get atomized


may 2013
sun mon tue wed thu fri sat
     
 


archives...

* april 2013 (2)
* march 2013 (2)
* december 2012 (3)
* november 2012 (2)
* october 2012 (1)
* september 2012 (1)
* august 2012 (22)
* may 2012 (2)
* september 2011 (4)
* august 2011 (1)
* june 2011 (1)
* may 2011 (2)
* april 2011 (2)
* march 2011 (1)
* february 2011 (1)
* november 2010 (1)
* october 2010 (2)
* september 2010 (14)
* august 2010 (1)
* july 2010 (2)
* june 2010 (4)
* april 2010 (16)
* march 2010 (6)
* january 2010 (6)
* december 2009 (4)
* november 2009 (1)
* october 2009 (6)
* september 2009 (11)
* august 2009 (2)
* july 2009 (2)
* june 2009 (1)
* april 2009 (10)
* february 2009 (1)
* january 2009 (5)
* december 2008 (2)
* august 2008 (1)
* july 2008 (13)
* june 2008 (2)
* may 2008 (3)
* february 2008 (2)
* january 2008 (3)
* december 2007 (5)
* november 2007 (1)
* july 2007 (22)
* june 2007 (5)
* may 2007 (3)
* april 2007 (2)
* january 2007 (1)
* december 2006 (1)
* november 2006 (1)
* october 2006 (7)
* september 2006 (1)
* august 2006 (4)
* july 2006 (5)
* june 2006 (4)
* may 2006 (6)
* april 2006 (1)
* march 2006 (4)
* february 2006 (5)
* january 2006 (3)
* december 2005 (4)
* november 2005 (2)
* october 2005 (3)
* september 2005 (4)
* august 2005 (3)
* july 2005 (2)


writing activity stats

   
Wed, 01 Jun 2011

site css


ok, after a veeeeeeery long time here's a tiny bit of nerdy
tech bLog blabla. just a itsy bitsy nerdy one - i promise.

well, i always thought about giving my homepage an additional
inverted colour look, since loads of people always complained
it's so dark and gothic and whatever. problem was, there are -
by now - tons of galleries, or other links on my homepage. so
this would mean a lot of changes if i would go through all those
files by hand. but... of course there must be a better and also
easier way out. and there was... luckily.
i already had cleaned out the gallery sites to use only one css
file a while ago - that was a big messy sed-battle that took my
brain quite a while to process and get it right. also i had the
css file itself cleaned (though i'm not a master of css styling,
to be honest). same applied to the bLog css files - cleaned a
while ago. so everything was ready for the big switch to be im-
plemented. and here's how the trick works...

1. cgi scripts:
for each css file, put a cgi-script in place that delivers all
content of type "text/css". for me there were three files: the
main sites css file, the gallery css and the bLog css file. also
include some nice query_string and referer processing to deliver
alternative css styles.  perl (with "-w" and, of course, "use
strict;") did the trick here - what else?

2. apache2 config:
next, do some mod_rewrite + apache2 magic. create a rewrite rule
that meets the following requirements: a) the query_string does
not contain any alternate-style index ("a=<style_index>", where
"style_index" can be one of "n"ormal, "i"nverted, "r"otated, or
"f"lipped), b) the request_uri is not for a css, jpg, gif, png,
or ico file, since there's no css to apply to those file types
anyway, c) the http_referer contains some alternate-style index.
if all those criteria meet, rewrite the url and append the al-
ternate-style index to the request_uri to have the perl script
from 1. deliver the right css content again. simple as that,
here's what it looks like in the apache2 config file:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} !^a=[irfn]$
    RewriteCond %{REQUEST_URI}  !^/(.*)\.(css|jpg|gif|png|ico)$
    RewriteCond %{HTTP_REFERER} ^(.*)(\?a=[irfn])$
    RewriteRule ^/(.*)$ $1%2    [R,L]

3. apache2 mod_expires:
set expire headers in apache2's mod_expires config for css files
to zero, since they now are highly dynamical.

    ExpiresByType  text/css     A0

4. inverted random images:
modify the cgi script that delivers the random images at the
bottom of the page to provide inverted images in the inverted
mode, or deliver colour inverted post-graph on the bLog site.

5. make links on the main page to the alternative styles:
easy.

this all worked surprisingly well, only the css magic for the
rotate and flip effect are... still a bit messy and unpredict-
able when it comes to browser compatibility. but... since this
is just a nice bonus i hadn't planned to implement anyway, i'm
fine with that.

so, feel free to enjoy the new site in inverted, rotated,
or flipped style. or the inverted bLog. but no rotated or
flipped one, since the css here really totally messes the site
layout up.

oh, and i think the inverted style looks awful. but, that's what
people get when they complain about the wonderful, beautiful,
nice, well balanced, eye pleasing & catching, well thought out,
lovingly assembled cyan/black combination. don't blame me.

permanent link ]