io
about
blog
community
docs
downloads
issues

    2008 10 11         HttpServer

    Cliff Wells performance tests serving dynamic content with Io.

    Link

    2008 08 27         Io on .NET

    A project at Synrc to port Io to .NET.

    Link

    2008 03 31         TokyoCabinet

    A TokyoCabinet binding was recently added. Here are the results for the performance test run on a first generation MacBook Pro.

    287265 group transactional writes per second
    166683 reads per second
    118523 cursor reads per second
    374672 group transactional removes per second
     13654 individual transactional writes per second 
     14484 individual transactional removes per second
    
    This test was in B-Tree mode and for reads and write the number of keys was 10,000, the key size is 22 bytes and the value size is 8 bytes. Order is random except for cursor reads, which are sequential.

    Note: those "transactions" must be syncing to the OS buffers and not the disk.

    2008 02 27         Screenshot

    Some sample code for taking a screenshot in an OpenGL app:

    First, let us add a Image method to help:

      Image grabScreen := method(
         data := Sequence clone 
         width  := glutGet(GLUT_WINDOW_WIDTH)
         height := glutGet(GLUT_WINDOW_HEIGHT)
         glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data)	
         self setDataWidthHeightComponentCount(data, width, height, 4)
         self flipY
      )
    
    Now we can use it (within a running GL application):
    Image clone grabScreen save("screenshot.jpg")
    

    2008 01 09         Constants

    Kevin Greer posted this to LtU recently and I though it was worth repeating due to the recent interest in dynamic features:

    Constant := Object clone do (
      with := method(msg, 
        self msg := msg
        self activate := method(call message setName(msg asString); msg)
      )
    )
    
    // Lets try it out: Make PI a regular number
    PI := 3.1415926
    
    // Make b a method that uses it
    b := method(PI+PI)
    writeln(b) // -> 6.283185
    
    // Inspect bs "source" code
    writeln(getSlot("b") code) // -> block(PI +(PI))
    
    // Make PI a constant
    PI := Constant with(3.1415926)
    writeln(b) // -> 6.283185
    writeln(getSlot("b") code) // -> block(3.141593 +(3.141593))
    
    // Still works but when we look at the code of b we see that
    // the PIs have been replaced with PIs value!!!
    

    2007 07 26         Cairo Binding

    Trevor Fancher has added binding for the Cairo graphics library which is now available in the repo. Thanks Trevor!

    2007 07 18         Multiple Dispatch

    Multiple-dispatch or multi-methods is the feature of some object-oriented programming languages in which a function or method can be specialized on the type of more than one of its arguments. - Wikipedia

    A typical multiple-dispatch example is a game with Asteriods, Bullets and Ships that have collision methods for each combination of interactions. In this case (and perhaps almost all cases), we only care about the first argument. And the problem is having to write switch statements like this:

    Ship collideWith := method(other,
       if(other isKindOf(Ship), ....; return)
       if(other isKindOf(Asteriod), ....; return)
       if(other isKindOf(Bullet), ....; return)
    )
    

    Here is a simple solution provided by Rich Collins:

    Ship collideWith := method(other, other collideWithShip(self))
    Ship collideWithShip := method(aShip, ....)
    Ship collideWithAsteriod := method(anAsteriod, ....)
    Ship collideWithBullet := method(aBullet, ....)
    
    // with similar implementations for other objects
    
    which also works with inheritance, delegation and proxies without the need for any formal type system.

    next  |  prev  |  +  |  rss