Posts about programming (old posts, page 9)

2007-04-27 13:30

BOP: Ball Oriented programming

Some of you may be familiar with weird programming languages. Some of you may even know about bidimensional languages. Some of you may have seen Flip, where computation is performed by balls bouncing off things.

Now you can see Flip using Qt. My Ra-Flip interpreter. I wrote it in a lark after finding out about Flip in Good Math, Bad Math and shares no code with the original, but it's a simple language ;-)

It's almost feature-complete. Missing are:

  • Levels (to make it threedimensional)
  • Input
  • Start-stop-pause-delay controls

Here is the mandatory screenshot:

flip.png

But that really doesn't do it justice, so here's a video:

The fun starts around 35 seconds in. The program prints an infinite series of even numbers and stores odd numbers in a ... I am not sure how to call that. A circuit?

I may think about writing a something-to-Flip compiler, so you can write your programs in some sort of simplistic imperative language and then see them as a pinball machine.

It may be cute if an artist could spend a few hours making nicer gadgets, before I do it (it won't be pretty ;-)

And yes, this is probably the most useless program written using Qt, right there with kyes.

2007-04-15 23:12

Y el gurú bajó de la montaña y dijo...

... bueno, el gurú dice muchas cosas, pero en particular, César Ballardini acaba de inaugurar su propio blog, http://katra.blogsavy.com/

Ni idea de qué va a hablar, pero es una persona que programa Forth para divertirse, así que es seguramente algo interesante.

This post is in spanish because so is César's blog.

2007-04-14 23:37

New project: Tobogan

As a result of my playing with mootools and creating powerpoint-style slideshows on webpages from restructured text, I am pretty much decided about turning this into a standalone, real application.

I am doing a PyQt4 frontend, and restructured text addons to generate the slides.

The native file format is restructured text itself, and it supports basic transitions between slides.

It still needs a ton of work, but here is a video showing how it looks after a couple of days hacking. You can see the current UI, a document's source, and a demonstration using firefox (only because Konqy doesn't suppose opacity, the rest of the transitions work even better on Konqueror)

It's Ogg/Theora and 3MB (thanks openomy.com!): the video

2007-04-12 17:35

New BartleBlog Feature: marketspeak!

Now, I don't know if this is useful, but I do think it's way neat.

Inspired by S5, rst2s5, and mootools I took an hour (or two) and hacked this neat little slide tool.

The goals differ from S5 in that I intend to write a frontend, so that you have a sort of very-poor-man's powerpoint, but also in that the output should be simple to embed in other pages so that I can eventually make this a part of bartleblog.

Check it out (click to go to next slide, move mouse to the top of the slideshow for controls):

<<   >>

Why use BartleBlog

(If you are a nerd)

Author: Roberto Alsina <[email protected]>

It's nerd-oriented

It's trivial to display source code, with proper syntax highlighting.

from base64 import *
def myFirstFunction():
      print b64decode ('YnllIHdvcmxkIQ==')

Even for things like shell sessions. Dammit, I am a nerd, I will try to add every nerd feature I deem cool.

It does things simply

Wanna show a flickr photo?

.. flickr:: myPhotoTitle

How about using openomy.com to share your files? And whatever else you can think of, it probably can be done.

It's very easy to extend

Really. It's simple python code.

  • The module to do syntax highlighting has 41 lines.
  • The module to do dynamic animated menus has 103.
  • The module to do calendars has 72.

If there is a python module or web service to do what you want, hooking it into BartleBlog is simple.

And it has kickass features

Like online, embedded, animated slideshows! Like this one! Done with 65 lines of simple almost-plain-text markup! Ok, it's not fully implemented yet, because it needs some manual code, but the hard part is done!

Or automatic SVN changelog display ( I admit that's somewhat niche ;-))

Now, who else has that kind of thing?

There may be an artifact when you slide out the syntax-highlighted boxes, but I have no idea how to fix it.

Also, I have not tested it at all in IE, so if it fails there, don't worry, that's to be expected!

Next time I speak in public, I may use this :-)

And, as a teaser... this is the source for the presentation you just saw:

Why use BartleBlog
==================

(If you are a nerd)
~~~~~~~~~~~~~~~~~~~

:author: Roberto Alsina <[email protected]>

It's nerd-oriented
------------------

It's trivial to display source code, with
proper syntax highlighting.

.. code-block:: python

  from base64 import *
  def myFirstFunction():
        print b64decode ('YnllIHdvcmxkIQ==')

Even for things like shell sessions.
Dammit, I am a nerd, I will try to add every nerd
feature I deem cool.


It does things simply
---------------------

Wanna show a flickr photo?

.. code-block:: rst

  .. flickr:: myPhotoTitle

How about using openomy.com to share your files?
And whatever else you can think of, it probably
**can** be done.

It's very easy to extend
------------------------

Really. It's simple python code.

* The module to do syntax highlighting has 41 lines.

* The module to do dynamic animated menus has 103.

* The module to do calendars has 72.

If there is a python module or web service to do what you
want, hooking it into BartleBlog is simple.

And it has kickass features
---------------------------

Like online, embedded, animated slideshows! Like this one!
Done with 65 lines of simple almost-plain-text markup!
Ok, it's not fully implemented yet, because it needs some manual
code, but the hard part is done!

Or automatic SVN changelog display ( I admit that's *somewhat niche* ;-))

Now, who else has that kind of thing?

2007-04-10 23:13

Son of BartleBlog XIV: Moo

A new gadget: Mootools based menus.

It takes the same data format I used for the Yahoo UI menubar, and creates a dynamic, sliding, animated, pretty, works-on-lynx menu.

No screenshot because it makes no sense without the movement. You can see it at the top of the sidebar (click on the darker items, outside the links... that needs work).

And yes, that means this blog has, right now, two menus with exactly the same data in them. And on a non-JS browser both are fully expanded.

But that's just temporary ;-)

2007-04-08 12:58

Using TinyURL in python

Isn't this neat?

import urllib

def makeTiny(url):

  url='http://tinyurl.com/api-create.php?'+urllib.urlencode({'url':url})
  return urllib.urlopen(url).read()

>>> makeTiny('http://www.kde.org')
'http://tinyurl.com/3cnthx'

2007-04-05 14:37

Son of bartleblog XI: the highlight of the syntax

I had a few minutes waiting for yum to do its thing and added a couple of easy features:

bartleblog9

The SilverCity-based code-block syntax highlighting directive was replaced with a version using Pygment which supports more languages and is (I think) nicer looking... and comes with several styles, as you can see above in the configuration dialog.

Other than that, I added support in the backend to:

  • Regenerate HTML from RST everywhere
  • Do the same only on items marked "dirty"
  • A model thingie that shows if there are posts or stories with RST errors
  • Some GUI love

I need to make the config dialog support more than one gadget at the same time, though ;-)

2007-03-30 08:41

Son of Bartlebog VII: the nuclear test site

A lot of new features going on, like openomy based file uploading and links that work like simple rst directives:

.. openomy:: my-file.ext

And you should get a link to the file, stored in the 1GB the openomy guys kindly provide.

Also, you can actually see how the test site looks at //ralsina.me/weblog (using the exact same data as this one).

I actually upload almost every change I do, so it breaks often ;-)

2007-03-29 18:43

Son of Bartleblog VI: The flickr directive

I added a Restructured Text directive that takes as argument the title of one of your (my) flickr pictures, like this:

.. flickr:: pa120071

And produces this:

Which is much nicer than my images have looked for a while.

It can still be improved, probably add a caption, link to image comments if available, etc.

The bad side is that if you don't have internet access the rendering fails.

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.

Contents © 2000-2019 Roberto Alsina