<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tim Babych&#039;s thoughts</title>
	<atom:link href="http://blog.clear.com.ua/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.clear.com.ua</link>
	<description>Thoughts on web, things and so on</description>
	<lastBuildDate>Wed, 30 Jun 2010 10:47:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CleverCSS</title>
		<link>http://blog.clear.com.ua/2009/09/clevercss/</link>
		<comments>http://blog.clear.com.ua/2009/09/clevercss/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:37:47 +0000</pubDate>
		<dc:creator>tim</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://blog.clear.com.ua/?p=68</guid>
		<description><![CDATA[Never, ever I will write plain old CSS, 
nesting rules over and over and renaming all the stack 
when the root element has to be changed.

Imagine this monstrosity



.featured_retailers {
    border: 2px solid #FFC77B;
    margin-bottom:10px;
    width: 626px;
    position: relative;
    }
  [...]]]></description>
			<content:encoded><![CDATA[<p>Never, ever I will write plain old CSS, 
nesting rules over and over and renaming all the stack 
when the root element has to be changed.</p>

<p>Imagine this monstrosity</p>

<div>
<pre class="brush: css;">
.featured_retailers {
    border: 2px solid #FFC77B;
    margin-bottom:10px;
    width: 626px;
    position: relative;
    }
    .featured_retailers table { width: 626px; }
        .featured_retailers td {
            padding: 0;        
            border-top: 2px solid #FFC77B;
            }
        .featured_retailers td table {
            width: 440px;
            }
            .featured_retailers td table td {
                border: 0;
                padding: 1px 5px;
                }
    .featured_retailers p {
        font-weight:bold;
        color: #333;
        position: absolute;
        top: -30px;
        right: 0;
        }
        .featured_retailers p img {
             vertical-align:middle 
             }
</pre>
</div>

<p>turning into</p>

<div>
<pre class="brush: css;">
$bgcolor=#FFC77B
.featured_retailers:
    border: 2px solid $bgcolor
    margin-bottom:10px 
    width: 626px
    position: relative
    table: width: 626px 
        td:
            padding: 0        
            border-top: 2px solid $bgcolor
            table:
                width: 440px
                td:
                    border: 0
                    padding: 1px 5px
                
    p:
        font-weight:bold
        color: #333
        position: absolute
        top: -30px
        right: 0
        img:
             vertical-align:middle 
</pre>
</div>

<p>That magic is done by <strong><a href="http://sandbox.pocoo.org/clevercss/">cleverCSS</a></strong>.
It is written by maniacs (they added variable and 
expression support but went a bit too far: who would ever want to calculate sqrt of length?)
but it gets the job done.</p>

<p>Original authors seem to have abandoned it, but it is supported by community.
I added my two cents too:</p>

<ul>
<li>its calculation feature was not aware of negative numbers, trying to calculate the sum 
, so <em>margin: -2px -2px</em> was transformed into <em>margin:-4px</em></li>
<li>its support for /* multiline comments */ was not working, unless they were on the same line</li>
</ul>

<p>And for integration of CleverCSS into your Django site there is <a href="http://github.com/dziegler/django-css">django-css</a> project. 
It is a CSS and JS compressor, but the compression is not what you would be after. 
The point is that django-css compiles CSS with external compilers,
and caches the output in a clever way.</p>

<p>There were few things that could be improved there:</p>

<ol>
<li>It was relying on binary commands, 
while using Pythonic compiler in Python would be more logical.</li>
<li>It was leaving compiled files not only in cache, but in my source tree, 
near the originals.</li>
</ol>

<p>Also, I often use inline STYLE blocks for specific templates. 
Why have the hassle of separating them into files? The only reason can be that
if page-specific CSS is large, the browser constantly redownloads it, and it is not nice.</p>

<p>So I added that feature to django-css too, 
and now it is almost perfect tool for complex Django CSSing.
You can have extended CSS files compiled and cached, no matter where it is, 
in LINKS or in STYLE blocks.</p>

<p>All you have to do is surround your STYLE or LINK with {% compress css %} tag.</p>

<div><pre class="brush: css">
{% compress css %}
&lt;style type="ccss"&gt;
h1:
    color:red
&lt;style&gt;
{% compress css %}
</pre>
</div>

<p>Forked Repos:</p>

<ul>
<li><a href="http://github.com/tymofij/clevercss">CleverCSS</a></li>
<li><a href="http://wiki.github.com/tymofij/django-css">Django-CSS</a></li>
</ul>

<p>PS: Github is a very nice collaborative tool, it is fun to work with. I just like BitBucket more <img src='http://blog.clear.com.ua/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.clear.com.ua/2009/09/clevercss/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rebuilding the friendship between Firefox and eBooks</title>
		<link>http://blog.clear.com.ua/2009/09/firefox-and-ebooks/</link>
		<comments>http://blog.clear.com.ua/2009/09/firefox-and-ebooks/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 22:06:33 +0000</pubDate>
		<dc:creator>tim</dc:creator>
				<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://blog.clear.com.ua/?p=23</guid>
		<description><![CDATA[
This is a story about the passion. One that changes life, and one that is obviously is going to change the world. It already does.

I loved books since I was a child. They allow you to travel to the places distant in time and space, to see the worlds that disappeared long ago or did [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.clear.com.ua/wordpress/wp-content/uploads/2009/09/sony-reader-prs505.jpg" alt="sony-reader-prs505" title="sony-reader-prs505" width="120" height="160" class="alignleft size-full wp-image-22" style="float:left;margin-right:10px;"/>
This is a story about the passion. One that changes life, and one that is obviously is going to change the world. It already does.</p>

<p>I loved books since I was a child. They allow you to travel to the places distant in time and space, to see the worlds that disappeared long ago or did not even exist. They tell stories that fascinate people all over the world and shape our common knowledge like Bible did thousands years ago. And of all modern ways to fill your mind with a fascinating reading the most prominent one is e-books.</p>

<h2>History note</h2>

<p>There was a time when monks used to rewrite them by hand, and by the mistakes they made in the process we can now get hints on what language did they actually speak besides canonical one. Later, mr. Gutenberg created his famous invention, pretty much killing that little monastery business.</p>

<p>I wonder if there were lawsuits then.</p>

<p>Six centuries later, hand rewriting and retyping made an interesting comeback, when in our country the ability to print was blocked not by technical shortcomings, but by political circumstances.
It is known as Samizdat books, funny name coined by resemblance of official publishing houses names, but meaning &#8220;My own Publishing House&#8221;.</p>

<h2>Authors and Publishers</h2>

<p>Interestingly, but we are approaching the same destination just having taken other route. These days anyone can be his own publishing house and easly print his own book, or reprint someone else&#8217;s.</p>

<p>Of course, that gives traditional publishing houses a hard run for their money and may even eventually kill them. Who cares? In the brave new world we will have the ability to buy books directly from the Author, saving the cost on printing and saving the space on our bookshelves. Everybody wins, and, btw,  publishers will have their niche anyway: print-on-demand, illustrated books, atlases, etc.</p>

<p>But the books that are &#8220;just text&#8221; will soon be arranged only inbetween the Author and the Reader. May be with a little help of some web-service, but soon to sell a book will be as easy as to sell a photo, font, drawing or some other work of art.</p>

<p>And even more. There are several books that I and many other people <em>want</em> written, and I see no reason why the community can not prepay their writing. We prepay opensource software, right? There were lots of cases, when people collected needed sum to pay the developer, funding his work for a promise to release the result into the world. This model will surely work for book developers too.</p>

<h2>The modern reading</h2>

<p>Ok, now you surely know how wonderful e-books are and how bright our future will be, <img src='http://blog.clear.com.ua/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  . Time for some gory details.</p>

<p>Whatever you use to read your library (I very very much recommend some eInk based device, your eyes will thank you a thousand times), standards matter.</p>

<p>And looks like the standard for e-books is finally settled, it is called ePub, and is based on open technologies. With Google promizing to <a href="http://www.readwriteweb.com/archives/google_opens_up_its_epub_archive_download_1_million_books_for_free.php">release a million ePub books into the wild</a>, and <a href="http://news.sel.sony.com/en/press_room/consumer/computer_peripheral/e_book/release/41343.html">Sony commiting</a> to that format there is no question on who the winner is.</p>

<p>I feel a little sad for other open XML-based e-book format, called <a href="http://en.wikipedia.org/wiki/FictionBook">FictionBook</a>, because it was much stricter on ruling out the presentation details, caring only about the structure of the book, and leaving the style to the reader.</p>

<p>But, as it was for early HTML, presentational details won. Not as bad as it was for HTML3, through. ePub just lets creator to specify the look in CSS, and does not require the book text to have special DTD, allowing plain XTHML. Still there is special DTD, called DTBook, it is just not required for book chapters, only for TOC.</p>

<p>Not to mention that Fb2 format was our local, Eastern Europe only invention, and was not backed by any big worldwide player.</p>

<p>But hey, ePub is standartized and open: so when one would want to read it the way he wants, it is all up to the extending the reading application. Just like the approach we take to the Open Web.</p>

<h2>The task</h2>

<p>And here comes the task I chose myself for Mozilla technology course: to add ePub and Fb2 support as an extension to Firefox. That would make interaction with ePub books easier and provide readers with more viewing options.</p>

<p>The problems I have to solve to make the extension work like it should are:</p>

<ol>
<li>registering the extensions .epub and .fb2, handling their rendering</li>
<li>unzipping the content (both are container formats)</li>
<li>actual presentation</li>
<li>TOC navigation</li>
<li>book metainformation display</li>
<li>some library features</li>
</ol>

<p>The good news for me that there was an ePub extension once, that did handle points 1-3, called <a href="https://addons.mozilla.org/en-US/firefox/addon/5275">Openberg Lector</a>. Unfortunately, it died two years ago, having never made it to Firefox 3.</p>

<p>Still, it provided me with lots of hints, and reviving it in some form is one of the goals of this project. I am sure it will be useful as people are still eagerly waiting for an update on its AMO page.</p>

<p>And for FB2 format (which is not going away soon in near future in our part of the world) there has not been an extension yet, despite it was asked for on forums several times.</p>

<p>Stay tuned, dear e-book lovers <img src='http://blog.clear.com.ua/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.clear.com.ua/2009/09/firefox-and-ebooks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Link widgets Greasemonkey script</title>
		<link>http://blog.clear.com.ua/2009/08/link_script/</link>
		<comments>http://blog.clear.com.ua/2009/08/link_script/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 13:48:32 +0000</pubDate>
		<dc:creator>tim</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://blog.clear.com.ua/?p=3</guid>
		<description><![CDATA[

There is such a great, but unfortunately underused accessibility feature, called navigational links.

They go into the HEAD of the page, and tell people that this page is part of the sequence, giving clues what previous, next, first, last, upper in hierarchy page is. Very helpful. Always present on documentation pages, like docs.python.org

Opera provides navigational buttons [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.clear.com.ua/wordpress/wp-content/uploads/2009/links.png" /></p>

<p>There is such a great, but unfortunately underused accessibility feature, called navigational links.</p>

<p>They go into the HEAD of the page, and tell people that this page is part of the sequence, giving clues what previous, next, first, last, upper in hierarchy page is. Very helpful. Always present on documentation pages, like <a href="http://docs.python.org">docs.python.org</a></p>

<p>Opera provides navigational buttons using those links, Seamonkey too. For Firefox to use it, one have to install <a href="https://addons.mozilla.org/firefox/addon/2933">Link Widgets addon</a></p>

<p>It understands the LINK elements, and tries to guess page sequences on URLs, but that does not always help, and this is where The Script comes in. It reads html A&#8217;s on a page, and then inserts Links to the head.</p>

<p>So. Walkthrough:</p>

<ol>
<li>Install <a href="https://addons.mozilla.org/firefox/addon/748">Greasemonkey</a></li>
<li>Install <a href="https://addons.mozilla.org/firefox/addon/2933">Link Widgets</a>.</li>
<li>Disable link guessing in its preferences.</li>
<li>Install <a href="http://userscripts.org/scripts/source/56430.user.js">the script</a></li>
<li>Go to the some comic, and enjoy unified always-present site navigation <img src='http://blog.clear.com.ua/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ol>

<p>Supported:  <a href="http://sinfest.net">Sinfest</a> , <a href="http://dilbert.com">Dilbert</a>,  <a href="http://sexylosers.com">Sexy Losers</a> ,  <a href="http://menagea3.net">Menage a 3</a> ,  <a href="http://xkcd.com">XKCD</a>,  <a href="http://thenoobcomic.com">The Noob</a></p>

<p>Future plans: More sites, some way of site-schemes updating, integration with Link Widgets addon?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.clear.com.ua/2009/08/link_script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
