V.I.Lenin with Mao balancing on his head and myself.

March 8, 2010

Filed under: Philosophy, Photos — Andrew @ 10:43 pm

Full name of this sculpture
Mysef, Lenin and Mao
is “Miss Mao Trying to Poise Herself at the Top of Lenin’s Head”. It is installed here in Richmond, BC, Canada.

Standing near it was thinking a lot. The idea has something in it. I grew up with these names everywhere in USSR. And it is history now. Sic transit gloria mundi?

HTML5 Working Drafts have been published today:

March 4, 2010

Filed under: Web Application Techologies — Andrew @ 6:40 pm

HTML5
HTML+RDFa
HTML Microdata
HTML Canvas 2D Context
HTML5 differences from HTML4
HTML: The Markup Language

Printing support in Sciter.

February 19, 2010

Filed under: Sciter, Web Application Techologies — Andrew @ 11:51 pm

Sciter is getting print and print preview support. At the moment architecture and core functionality is established. Here is a screenshot of one of test pages demonstrating print preview:

Print preview widget

Print preview widget

Print preview is implemented as a native behavior that by default is assigned to any <frame type="pager"> element. Print Preview by its nature is a frame containing other document, that is why <frame> is used. The <frame> element may contain page-template="page.htm" DOM attribute that contains URL of so called page template document.

Here is an example of such page template.

<html>
  <head>
    <title></title>
    <style>
          frame#content-box  { size:*; }
          text#header { border-bottom: 1px solid gray; }
          text#footer { border-top: 1px solid gray; }

          :root[page-parity=odd] text#footer  { text-align:left; }
          :root[page-parity=even] text#footer { text-align:right; }
          :root[page-parity=odd] frame#content-box
          {
            margin-left:10pt;
                margin-right:20pt;
          }
          :root[page-parity=even] frame#content-box
          {
            margin-left:20pt;
                margin-right:10pt;
          }
        </style>
  </head>
<body>
  <text #header>Header....</text>
  <frame #content-box />
  <text #footer>Page <span #page-no /></text>
</body>
</html>

<frame #content-box /> here defines area where source document will be printed. Such page template may contain arbitrary markup and styles and is accessible/modifiable by script on the host page.
It is possible to style the template for even/odd pages, even for the page with particular number.

Print Preview Schema

Print Preview Schema

CSS or just MESS?

January 27, 2010

Filed under: HTML and CSS — Andrew @ 11:50 pm

I believe that CSS (Cascading Style Sheets) in its development has reached some point that could be classified as a mess.
I suspect that quantity of features has changed the quality of the whole foundation. And not exactly in good direction.

Look, CSS used to have simple and regular construction:

selector
{
  attribute1: value[s];
  attribute2: value[s];
  ...
}

Pretty neat and clear if you would ask me. Simple list of name:value pairs separated by ‘;’ and enclosed by ‘{’,'}’ brackets.

At some point people decided to add media-queries that required new level of block containment:

@media <media-expr> {
   selector {
     attribute1: value[s];
    ...
   }
}

which is not that bad – still manageable by some tools like ANTLR parser generator.

But please note that media-expr above. It has its own micro-format with AND, OR and peculiar ONLY operators. Even media-expression specific length units… But no arithmetic operations there. Hmm, wait, there are arithmetic operations in CSS now! In the calc() function. But there are no AND, OR and friends in this place.

So we have at least two places in CSS where expressions are used but with different notations.
Seems like as different strangers passed by this X-Mas tree and have left their own decoration on it.

CSS design principle fig

And those lists in CSS …

First of all I do not know any other language but CSS that uses space (’ ‘) as an operator. Space here is a) token delimeter and b) an operator that glues two tokens into a list. So value of the attribute border: 1px solid red; is a list of three values ‘1px’, ’solid’ and ‘red’. That is again fine. We can live with this.
But here another stranger passes by our tree who needed e.g. list of fonts. So one list should contain another one. In good mood that stranger would introduce brackets and write something like this:

font: 12pt (Arial Verdana sans-serif)

But sudden voice from the Heaven: “brackets and other programming stuff are not for CSS – John the Web Designer will not get them”. So our stranger decided to add ‘,’ (comma) as another list-gluing-operator. And we’ve got this:

font: 12pt Arial, Verdana, sans-serif;

Note that comma here is an operator of higher priority than space as Arial, Verdana, sans-serif here is a single value (list by itself) of <font-family> attribute.

Story continues…. Another girl was swinging around that tree and suddenly decided that ‘/’ (slash) would also look extremely cool as another list-gluing-operator of her own. And so, voila!, we have:

p { font: x-large/110% "New Century Schoolbook",serif }

.
with the hope that this in principle better comprehensible than something like font: (x-large 110%) ("New Century Schoolbook" serif).

Well, our beautiful in its ugliness CSS tree was standing this way for years. But now new people are singing Jingle Bells around it. New times – new ideas, e.g. of multiple backgrounds. So instead of single list of values defining various background attributes (like positions, repeat, url, color, etc) we will have list of list of values.

Yeah! So another list-gluing-operator is coming, right?

Nope. There are simply no characters left after 10 years of CSS development. So another creative approach was introduced – to reuse ‘,’ (comma) again but with the brand new meaning.

In the background we are getting this:

background: url(a.png) top left no-repeat,
            url(b.png) center / 100% 100% no-repeat,
            url(c.png) white;

Note that comma is a different operator here as its priority is less than space. That is clearly different from the ‘font’ attribute we saw above. And yet note that clever use of ‘/’ again …

Yes, it is just a mess. It is not possible to write a parser that will handle ‘font’ and ‘background’ by using the same code as e.g. ‘font’ and ‘background’ attributes are written in different languages.

If you think that this is over then no. Another creative team is entering the stage with the Wobble song:

@keyframes 'wobble' {
    0% { left: 100px;  }
    40% { left: 150px; }
    60% { left: 75px;  }
    100% { left: 100px;  }
  }

Yeah, why not? Indeed, values in place of name tokens are really nothing if to compare with those lists …

And while our party is going on there is another group of modest people is busy printing their own stuff on other side of the tree:

@page :first {
  color: green;
  @top-left {
    content: "foo";
    color: blue;
  }
  @top-right {
    content: "bar";
  }
}

At the moment CSS looks like a patch quilt where each tile uses its own language with distinct notation and grammar. Am I alone who think that this is a sign of bad language design [process]?

It appears that all successful programming and data definition languages were created by single persons or compact groups of like-minded people. Java, C/C++, Pascal, SQL, you name it. Is this mess because of CSS has no central author[ity] or why?

Vancouver winter sunset

January 10, 2010

Filed under: Photos — Ivan @ 2:39 pm

Now, could the rain stop more often around here?

Tree Of Life by IvanAndreevich

Aero, Windows V/7

December 2, 2009

Filed under: HTMLayout, Sciter — Andrew @ 9:00 pm

In the middle of adding Windows Aero DWM support to HTMLayout and Sciter:
htmlayout-aero-w7

This is standard sample htmlayoutsdk/html_samples/border-radius/rounded-tabs.htm from the SDK

Seems like I need to add “aero” as an additional value to CSS @media selector in order to support such screens. This document is using simple html { background-color:transparent; } declaration to make it transparent.

And w7aero sample application is calling this function

void ExtendFrameIntoClient(HWND hwnd)
{
   // Negative margins have special meaning to DwmExtendFrameIntoClientArea.
   // Negative margins create the "sheet of glass" effect, where the client area
   //  is rendered as a solid surface with no window border.
   MARGINS margins = {-1};
   HRESULT hr = S_OK;
   // Extend frame across entire window.
   hr = DwmExtendFrameIntoClientArea(hwnd,&margins);
   assert (SUCCEEDED(hr)); hr;
}

Pretty easy I would say…

Next Page »