2007-03-28 17:28

Son of bartleblog 5: Menus

Added a Yahoo! Ui menubar generator. It turns this:

a
b
c
 1
 2
  x
  y
d

Into this:

bartleblog4

Or this if you are using links:

bartleblog5

Or rather into this, which explains why it's necessary (consider this is a very simple menu!):

System Message: ERROR/3 (<string>, line 30)

Cannot find pygments lexer for language "HyperText"

.. code-block:: HyperText

    <script type="text/javascript">
    YAHOO.example.onMenuBarReady = function(p_oEvent)
    {
        // Instantiate and render the menu bar

        var oMenuBar = new YAHOO.widget.MenuBar("None",
            {   autosubmenudisplay:true,
                hidedelay:750,
                lazyload:true
            });

        oMenuBar.render();
    }

    // Initialize and render the menu bar when it is available in the DOM
    YAHOO.util.Event.onContentReady("None", YAHOO.example.onMenuBarReady);
    </script>
            <div id="None" class="yuimenubar">
                <div class="bd">
                    <ul class="first-of-type">
                        <li class="yuimenubaritem first-of-type">a </li>
                        <li class="yuimenubaritem">b</li>
                        <li class="yuimenubaritem"> c
                            <div id="c" class="yuimenu">
                                <div class="bd">
                                    <ul>
                                        <li class="yuimenuitem"> 1</li>
                                        <li class="yuimenuitem"> 2
                                            <div id=" 2" class="yuimenu">
                                                <div class="bd">
                                                    <ul class="first-of-type">
                                        <li class="yuimenuitem">  x</li>
                                        <li class="yuimenuitem">  y</li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </li>
                        <li class="yuimenubaritem">d</li>
                    </ul>
                </div>
            </div>

Still some missing features, but a neat thingie already.

2007-03-27 12:49

Son of Bartleblog IV

Another morning, another feature: archive

bartleblog3

Now I'm working on the image tool, importing PyDS's images and uploading to flickr, etc.

2007-03-26 18:28

Son of Bartleblog III

A couple more hours of hacking, and the templates are all new, and more functional then ever.

bartleblog2

I am making heavy use of Yahoo's UI library, which makes lots of things much simpler:

  • Layout using Yahoo Grids

    I spent hours making the layout you see now, and the one with Grids works better and was done in minutes. Avoid reinventing the wheel works for webpages, too.

  • Calendar using Yahoo Calendar

    Isn't it neat? And it works, too. Since the linking is handled by javascript I may make it so it loads the posts for a month without reloading the page.

  • Styling using their reset.css stylesheet.

    That stylesheet removes all styling from your page. That way, if there's something there, you put it.

    I used that, added a slightly simplified stylesheet based on Firefox's default, Restructured Text's and Silvercity's, and all the customizing I needed to do to achieve a simple but functional layout were 30 lines of CSS, compared to the rather monstrous pyds.css my blog currently uses.

  • Modular thingies.

    I turned all Technorati/HaloScan/FeedBurner/Talkr thingies into macros that take as configuration your personal data (for example, HaloScan ID) and if necessary a post.

If the styling was a little more done and a few bugs were ironed, I may even start uploading the site using bartleblog instead of PyDS soon :-)

2007-03-25 12:53

Son of Bartlebog II

After a few more hours hacking, it's got the following working:

  • CherryTemplate templates that do about the same as the Cheetah templates in PyDS
  • Generates the whole site and it looks just the same
  • Advogato import (my blog should go all the way back to 2000 when I switch!)
  • PyDS import

The main missing things are:

  • Do a decent templating system (right now they are embedded in the code)
  • Do a decent config system (right now, global variables)
  • Do uploading (or just trust lftp)
  • Do post/story creation
  • Port the RSS template
  • Flickr integration
  • Integration with all those neat little gadgets: feedburner flares, HaloScan comments which are currently kinda grafted (only work for my account ;-)
  • Look into Yahoo UI toolkit for things like the calendar and menus.
  • Add the extra stuff to Restructured Text so it:
    • Fixes automatically links to posts/stories in the blog
    • Pretty-prints code using SilverCity
  • Lots of UI stuff

All in all, not really a huge amount of work, but I am taking it easy.

When KDE4 is out, a version with a full-fledget KHTML in it will be a whole lot nicer.

2007-03-24 09:16

A little project, son of BartleBlog

I have been posting this blog using PyDS for over 4 years now. Sadly, the PyDS author seems to have abandoned it. Which is sad, because it's nifty software.

However, keeping it working is getting harder every year, and I don't expect to be able to do it soon.

Also, the data is in a Metakit database, which is the most annoying DB ever (no real schema! columnar instead of record oriented! gouge my eyes with a breadstick!)

So, since I have all the data, and my blogging needs are modest, and no tool does exactly what I want, I decided to write my own.

I could make it a web app, maybe using TurboGears, but what the heck, I haven't done a decent GUI app in ... ok, arguably, I never have done a decent one, and my PyQt4 needs some work, and I am kinda in a groove for actually finishing things lately (I am rather proud of RaSPF).

And I have a neat name (BartleBlog) reserved from another aborted app.

So, here's the mandatory screenshot after a couple hours hacking:

bartleblog

And here are the goals:

  • Generate static pages, so it can be used by anyone with a little web space (I am a gipsy)
  • Simple templating (Using cherrytemplate right now, but should be modular)
  • Restructured Text as input mechanism (again, modular)
  • Good support for code snippets
  • Should support static pages (like the ones I have in the Stories link)
  • Integrate with Flickr for images
  • Integrate "chunks" in the templating, where you can do things like setting the right Haloscan comment/trackback links easily
  • Simple category mechanism, with a regexp-based autotagger without creating per-category copies of everything.
  • RSS feed generation, global and per-category.
  • A way to import all my PyDS blog (and maybe my older advogato things)
  • Use sqlite and SQLObject for sane storage.

So far, it's doing some things, I can import, edit, save (by instant application, there is no "save" here).

I can't yet generate the site, or create a new post, and it should take months to make it useful, but let's see how it goes.

2007-03-22 19:53

History of KDE: A generous offer...

Back in october of 1996, when everyone was saving for the flying car we would buy in 5 years, and KDE was starting, slowly, to take shape in the minds of a few.... there was a generous offer...

Matthias Ettrich ([email protected]) wrote:*
>         -------------------------------------------
>         New Project: Kool Desktop Environment (KDE)
>         -------------------------------------------
>
>                     Programmers wanted!

Freedom Software would be willing to contribute with
the source code of Freedom Desktop Light for this effort.
Please don't subestimate the task of building a
desktop manager. Several Years have been spent building
Freedom Desktop.  We could also contribute with
other pieces of technology (i.e Freedom Rt - Object oriented
toolkit). For more information about Freedom Desktop,
please visit http://www.fsw.com

Freedom Software is about to announce a free version
of the software for Linux (personal use only). This version
is called Freedom Desktop Light for Linux.

If I were you, I wouldn't restrict the project to a specific
toolkit (at least for now). There are many pieces of public
software that can be reused easily. It could take a long
time to rebuild everything from scratch. Try to reuse
the more you can now. You can standarize on a single
toolkit later.

Also keep in mind that Motif  is the defacto standard.
Most Unix platform ship with Motif. It would be nice
if your desktop work on all the versions of Unix

Edgar Galvis
Freedom Software
http://www.fsw.com/motif.html - Home of Freedom Desktop for Motif
[email protected]

UPDATE: I had not bothered checking, but freedom desktop's site has been available until very recently. There is still something in the internet archive, too.

2007-03-22 13:36

A day at the movies (March 21, 2007)

I have this agreement with Rosario: we will go to the movies together. But not, under any circunstances, to see something like Crank.

So, on wednesdays (cheap tickets, yipee!) if I am downtown, I will go see that kind of things.

Two weeks ago, it was Rocky Balboa. Yesterday it was Crank.

Crank

This is a special movie. It may seem on the surface to be an ordinary brainless action/violence/sex spectacle, the kind many take for granted nowadays. However, there are some things noone thinks about when watching it.

When I was a kid, this movie's cinematography would have been impossible. It shows how action films made 20 (maybe 10) years ago look cheap today, because technical advance has been massive.

The script may be dumb, and medically incomprehensible (like the alternative uses of ephedrine and epinephrine for the same thing. They are not.), but you know what? It's an excuse to have a guy that can't stop. The movie is about a bad guy that can't stop, not about "Haitian hardcore shit. Made of plant shit, man!". Come on, is radioactive spider bite any better? Or brain cloud in Joe versus the Volcano any better? (Ok, bad example there).

No one complains that Spidey makes no sense. Or that Kong is too large. And that's OK. Then why is the idea of a guy that needs constant adrenaline stupid?

I think that this movie is seen as stupid speaks more about how many things we have already seen. This is not even the first movie about a poisoned character guaranteed to die looking for revenge I saw (That would be D.O.A. which is actually a pretty decent movie).

Look at action movies like Die Hard. Is it any less stupid? Maybe (and maybe not). But it was there first.

And at least Crank doesn't take itself too seriously.

As a bonus, it contains the best spoken-portrait-that-looks-just-like-the-guy-scene ever.

BTW: it's really not a good movie.

Rocky Balboa

Warning: this below is a little personal, rambling, and probably not a movie review.

You can make a case for this actually being a good movie. It may not get all the way there, but it's a decent job, done by competent craftsmen. You have to consider the movie as part of a larger thing, the sports movie genre. In particular, the boxing movie.

Everyone has seen them ... Underdog ... Long Odds ... Training Montage ... Final Fight .. Last Round ... it's almost like the conventions lie besides conventional narrative, just a series of cliches waiting for you, coming at you like a river. You can hear the upper case initials like waves hammering at your temples.

But I have many soft spots. And one of them is for boxing, and it's for purely personal, subjective, undefensible reasons.

My dad had a stroke many years ago. He was always a dry man. Affection with him was not exactly a simple matter. We had very little in common.

But on late friday nights we would watch the fights. We would talk about them, he with the difficulty of not being used to talk to me, later that of the hemiplegic, me with the difficulty of talking to him.

After a while, I started living alone, but kept watching the fights, and when I visited him, we would do it together. Until Benn-McClellan, which cured me from any enjoyment of boxing I ever had.

But I can still appreciate exactly how hard boxing is. Any sport at a high level requires skills I don't have, and is hard. Now think about practicing a sport (Any sport. Figure skating, if you will!) while another guy, just as strong and quick as you is trying to beat the crap out of you. That's boxing. You are not going to convince me there is anything harder in sports (except maybe some other combat sport).

And Rocky Balboa is a tale about a guy whose heart is so broken he can only think about that skill he used to have, and he gets a miraculous chance at doing that again, and it's a goddamn fairy tale, and nothing else, but I know how the eyes of a guy who would die, who would kill for a chance at doing something he can't possibly do look like.

And that kills me. And this movie killed me. And I got shivers at the end. And I am a goofball.

2007-03-20 14:16

Finally a half-decent look for this

I spent another couple of hours tweaking the blog templates, and the latest is half-reasonable. Still a few problems:

  • The banner is very ugly on IE
  • Stuff is misaligned (too much margin/padding tweaking)

But hey, it works, and it looks ok, which is more than the usual.

I am also trying feedburner's site stats service, which is pretty decent.

2007-03-15 07:59

Official RaSPF page

Ok, time to go a little more public with this.

Here's a page for it (click on "read more") and I will ask the openspf guys to put it on the implementations list (let's see how that goes).

2007-03-13 11:04

RaSPF on its way to release

I have been able to work some more on RaSPF and the results are encouraging.

Thanks to valgrind and test suites, I am pretty confident it doesn't leak memory, or at least, that it doesn't leak except on very rare cases.

I think I found a neat way to simplify memory management, though, and that's what I wanted to mention.

This is probably trivial for everyone reading, but I am a limited C programmer, so whenever something works unexpectedly right, I am happy ;-)

One problem with C memory management is that if you have many exit points for your functions, releasing everything you allocate is rather annoying, since you may have to do it in several different locations.

I compounded this problem because I am using exceptions (yeah, C doesn't have them. I used this).

Now not only do I have my returns but also my throws and whatever uncaught throw something I called has!

Hell, right?

Nope: what exceptions complicated, exceptions fixed. Look at this function:

bstring spf_query_get_explanation(spf_query *q, bstring spec)
{
    bstring txt=0;
    struct bstrList *l=0;
    bstring expanded=0;
    bstring result=0;
    struct tagbstring s=bsStatic("");

    try
    {
        // Expand an explanation
        if (spec && spec->slen)
        {
            expanded=spf_query_expand(q,spec,1);
            l=spf_query_dns_txt(q,expanded);

            if (l)
            {
                txt=bjoin(l,&s);
            }
            else
            {
                txt=bfromcstr("");
            }
            result=spf_query_expand(q,txt,0);
            throw(EXC_OK,0);
        }
        else
        {
            result=bfromcstr("explanation: Required option is missing");
            throw(EXC_OK,0);
        }
    }
    except
    {
        if(expanded) bdestroy(expanded);
        if(txt) bdestroy(txt);
        if(l) bstrListDestroy(l);
        on (EXC_OK)
        {
            return result;
        }
        if(result) bdestroy(result);
        throw(EXCEPTION.type,EXCEPTION.param1);
    }
}

It doesn't matter if spf_query_expand or spf_query_dns_txt throw an exception, this will not leak.

Nice, I think :-)

Contents © 2000-2019 Roberto Alsina