<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="Tiki CMS/Groupware via FeedCreator 1.7.2" -->
<?xml-stylesheet href="http://old.falconpl.org/wiki/lib/rss/rss-style.css" type="text/css"?>
<?xml-stylesheet href="http://old.falconpl.org/wiki/lib/rss/rss20.xsl" type="text/xsl"?>
<rss version="2.0">
    <channel>
        <title>Tiki RSS feed for weblogs</title>
        <description></description>
        <link>http://old.falconpl.org/wiki/tiki-blogs_rss.php?ver=2</link>
        <lastBuildDate>Thu, 17 May 2012 21:52:08 +0100</lastBuildDate>
        <generator>Tiki CMS/Groupware via FeedCreator 1.7.2</generator>
        <image>
            <url>http://old.falconpl.org/wiki/img/tiki.jpg</url>
            <title>tikiwiki logo</title>
            <link>http://old.falconpl.org/wiki/tiki-index.php</link>
            <description><![CDATA[Feed provided by http://old.falconpl.org/wiki/tiki-index.php. Click to visit.]]></description>
        </image>
        <language>en-us</language>
        <item>
            <title>Blog moved</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=35</link>
            <description><![CDATA[My personal Falcon development blog is now kept on my main blog site at <a class="wiki"  href="http://www.niccolai.cc">http://www.niccolai.cc</a>.<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Sat, 07 Jun 2008 21:29:03 +0100</pubDate>
        </item>
        <item>
            <title>Functional programming and Bitwise operators change on the run</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=34</link>
            <description><![CDATA[I was reviewing a bit of common LISP documentation in search for possible design flaws of our functional programming support. I realized that we have actually something a bit more powerful than the original LISP, as we have the ability to inspect and change the processing lists after they are created and even while they are being processed, and we hold an overall control of their processing sequence, which can be managed by both the scripts and the embedding applications.<br />
<br />
However, we miss a relevant feature: automatic binding of symbols in lists. We have substituted that with pass-by-reference semantics, as in the following example:<br />
<pre>
val = nil
eval( .[times $val .[.[printl $val]]] )
</pre><br />
This works, but all the symbols needed in the list evaluation must be declared in advance, and they cannot be "closed" (as in functional closure). This limit the potential of our model.<br />
<br />
I have found a way to provide arrays with symbol tables, as if they were functions or objects; also, it theoretically possible to access an array by object accessor like this:<br />
<pre>
sequence = .[printl ]
sequence. = "Hello world"
eval( sequence )
</pre><br />
This would be quite a leap forward in our model, as we could externally bind anything with a variable in a functional construct, including other functional sequences. Also, this would allow inspecting functional sequences after their evaluation, exploiting at the fullest the "impure" functional model we picked.<br />
<br />
The problem was... how to declare a symbol so that it stays local to the array sequence? (There are other smaller problems as well, as deciding the scoping of the declared variables, but one problem at a time).<br />
<br />
The character "&amp;" came immediately to my mind, but it was busy for the bitwise "and" operator. After a fast check, I realized that I have used up all the available one-character operator-like symbols commonly available on computer keyboards.<br />
<br />
So, I realized that occupying three important "symbols" as "&amp;", "cap" and "|" for operations that are rarely used was far from wise. We won't probably be able to stack this latest evaluable lists symbol table idea in this version we're releasing, but as I want the language and the engine to be somewhat stable for a long period before starting the work on 0.8.12 (and then 0.9), I decided to change the binary bitwise operators into "&amp;&amp;", "||" and "cap cap"; also the unary "not" bitwise operator is changed to the tilde symbol "~".<br />
<br />
I know this may create a bit of confusion in C programmers coming to Falcon, but bitwise operators are a very rare feature in scripting languages anyhow, so rare that they may probably be declared through pseudofunctions, as bAnd( a, b), and few would complain (if someone at all). This frees up "&amp;" for our needs, and also frees up "cap" and "|" which can be used for a whole lot of interesting features. Operator combinations as our dot-bracket ".[" are a good way to increase the number of available symbols, so "cap" may be used to modify the meaning of a following operator, making room for more things.<br />
<br />
In this way, we'll be able to add the "&amp;var" support as a drop-in somewhere after the release, without having to make incompatible the previous scripts.<br />
<br />
<br />
<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Fri, 16 May 2008 08:46:25 +0100</pubDate>
        </item>
        <item>
            <title>Last thoughts on version 0.8.10</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=33</link>
            <description><![CDATA[Version 0.8.10 has been officially "complete" for about a couple of weeks now; however, before releasing, I wanted to stuff in three last features.<br />
<br />
This is because after the release I want to keep the core system stable for a while, and concentrate on the module development and on the site management. We need libraries, we need a more falconized site and we need more people joining. So, the activity in the next months will be that of adding libraries and advertising Falcon around.<br />
<br />
This Piuma version addresses a series of issues both in the language and in the engine, and adds some very important feature which complete the support for the programming paradigms we support. I am quite happy with it, and I think it can be a good base to develop modules. Just, before going on with the rest, I wanted to prepare the core and the VM systems for the tasks needed between release of 0.8.10 and the starting of 0.8.12.<br />
<br />
Version 0.8.12 shall be the last of the 0.8 series, and will complete the engine, the internal API and the API of core and RTL. It's tentative name is now "Condor", as the intention is that to take a look from afar, fly high and placidly to view the ground from high above. A complete and final review of the code before starting series 0.9, that is final optimization steps before 1.0.<br />
<br />
So, in the time between the Piuma release and the starting of works on the Condor engine, I wanted to have this three features ready:<br />
<tt>  - Multithreading pluggable support.</tt><br />
<tt>  - Internationalization support with i"" strings</tt><br />
<tt>  - Hooking for Virtual File System providers.</tt><br />
<br />
We have achieved the first two items; now, the engine has a slot for atomic reference counting and global locking (the latter currently unused) that can be hot-swapped by loaded-in modules. Multithreading module sets in its own "lock providers" so that atomic reference counting and proper locking are available when MT is used, and are linked with MT libraries only through the plug-in module. The way the mechanism is done is currently not very elegant, but it works (well) and it can stand till we review all the code on the Condor release.<br />
<br />
About the last point, Falcon will have Virtual File System support plugged in the engine. In the beginning, I thought to provide a map of VSF providers, generating Streams based on the URI they received, directly on the VM, as the service system. But working at the MT pluggable support, I realized that the best way to do that is to review the whole pluggable system and give the ownership and control of all the pluggable support to the ENGINE (that is, the main Falcon DLL loaded by the embedding program). As such, the review of this and other aspects (as the Engine data, the Service system and the new MT support), is delayed as the very first activity of the Condor release.<br />
<br />
So, the release is complete as it is now. The only "code" missing is a small installer utility that I wanted to be ready by the time of release, but being a separate project and being dedicated to modules, we can work at that right after the release.<br />
<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Sun, 11 May 2008 10:21:24 +0100</pubDate>
        </item>
        <item>
            <title>Putting falcon on-line</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=32</link>
            <description><![CDATA[We're setting up a falcon-powered site, through a Falcon module for Apache.<br />
<br />
From the chatlog of this night...<br />
<br />
--<br />
<br />
Ok, I write here what I have done, because it's better if we're in 2 or 3 to know that.<br />
I have that cute hosting.<br />
On a USA virtual hosting server (inmotion<br />
They are cute, but I have a fairly old fedora core 6 with support for virtual machines compiled.<br />
So, upgrading is a delicate matter, and you got to live with the software you have on.<br />
The point is that... we have apache 1.3 there.<br />
And I have developed our extension for apache 2. Docs for apache 1.3 are sparse and outdated, and developing a new module from scratch for it is madness; also the module plant is TOTALLY different, so there is no re-usable code that may be used...<br />
long story short, we're not doing things on apache 1.3<br />
But I have that cute server...<br />
So, I compiled from source apr-1.2, apr-utils and apache-2.2<br />
Apr-1 lives well with apr-0.9; they have all separated.<br />
But on a redhat based distro, where apache is called httpd and all its paths are mangled, it's a bit of hell.<br />
So, I have installed apache2 under /usr/apache2.<br />
Then, I have apache 2 running on localhost:8080, and our front end apache 1.3 proxies /newsite to 8080.<br />
Problem was that the official apache server for fedora doesn't come with the proxy module.<br />
So I had to download the sources of apache 1.3, and compiled the proxy module in shared mode.<br />
I have created a startup script called http2 in /etc/init.d that ensures that our apache2 is loaded at startup.<br />
this is actually an advantage. falcon 0.8.9 (the experimental piuma) is... experimental. In this way, if we crash or messup the back-end server, the front-end with the old site is still active;<br />
when all will be ready, we'll simply switch the proxy target from /newsite to / and we'll have everything up and running.<br />
site home is in /home/falcon10/newsite, owned by falcon10<br />
Index document have been redefined to index.ftd<br />
the second apache2 process is completely dedicated to serving that area. Also, since we are running on 2 physical CPUs, we won't incour in particular performance hit due to the proxying.<br />
I would recommend a complete backup of /etc/httpd/conf and /usr/apache2 to preserve this setting.<br />
(we have auto-backups included in the hosting price, but one can never know).<br />
Fine; now it's time to make it work. tomorrow, I will start to work on the site. A bit of basic content and user management are a must.<br />
The boring thing is that I have to compile everything there; i.e. I have to recompile dbi, hoping that devel packages on site are compatible with ours.<br />
And now, I get a bit of rest.<br />
Goodnight!<br />
--<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Wed, 30 Apr 2008 21:46:52 +0100</pubDate>
        </item>
        <item>
            <title>Empty loop tests</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=31</link>
            <description><![CDATA[Yesterday I did a bit of speed tests.<br />
<br />
I stacked up many things in the main VM loop, as i.e. preemption in functional context, end-frame callbacks, and even the generic vector as stackl; and it was long since I did an empty loop speed test.<br />
<br />
I run the following (pseudo) code:<br />
<pre>
a = 0
for num in [0:100000000]
   a = a + 1
end
</pre><br />
<br />
Here are the results, using "time", for several scripting engines:<br />
<br />
<pre>
C: 0m0.257s  (gcc -O0)
LUA: 0m8.021s
Falcon: 0m9.776s
PHP5: 0m14.923s
Python: 0m22.576s
Perl: 0m27.068s
Ruby: 1m25.947s
</pre><br />
<br />
Now; an empty loop test doesn't mean anything in term of overall performance, but it's nice to see we have one of the fastest VM loop around... when it's still heavily under-optimized!<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Fri, 25 Apr 2008 19:00:10 +0100</pubDate>
        </item>
        <item>
            <title>VM Stack</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=30</link>
            <description><![CDATA[One of the things that needs a review in 0.9 version is the VM stack. To code that fast and safe, I recently used a GenericVector<a href="tiki-editpage.php?page=GenericVector" title="Create page: GenericVector" class="wiki wikinew">?</a>, but this is suboptimal by far. First of all, representing the stack as a long linear vector poses relocation problems when the depth of the stack grows too much; secondly, the access and copy of single elements is dead slow with respect to the two mov eXX asms that an item copy requires.<br />
<br />
Since there was also the problem that last call parameter count was limited to one byte in the stack frame structure, I took that occasion to do a bit of experimentations. An efficient call stack is a must for a functional language, so I took a bit of time to think how to make it better.<br />
<br />
I tried a per-frame structure which holds only the local stack frame, and uses a list of frames, one per call. That seemed a good idea, but creating an instance (also, not a light one) for each call is definitely not a way to go.<br />
<br />
Also, I took some time to do some experiment with the longtests:<br />
Falcon unit test package.<br />
<br />
Version 0.8.9 (piuma)<br />
2g: success. ( 11.749 secs, 2553408.801 ops/sec)<br />
2j: success. ( 15.906 secs, 1886080.724 ops/sec)<br />
2h: success. ( 11.938 secs, 2512983.749 ops/sec)<br />
<br />
2g, 2j and 2h tests calls functions respectively with depth of 100, 1000 and 10000 recursions; the total calls in each of them is the same, only the maximum depth of the calls varies. This experiment shows that there is a big performance hit when depth of the stack goes beyond a critical mass; then the application (i.e. faltest) is given some extra memory, and the it even recovers performance in the following steps.<br />
<br />
So, while embedded scripts won't probably never break the 128 pre-allocated items in the linear stack, this performance (2.5M calls per seconds, plus some opcodes in each call), seems adequate even for functional based heavier applications in this 0.8 step.<br />
<br />
So, experiments on the VM stack are closed till 0.9, where we'll perform massive optimizations. In that occasion, the stack will be turned into a specific wrapped Item*, and we'll experiment again for optimal growth strategies.<br />
<br />
I suspect both the call sequence and the access to stack performance can be easily doubled (each item is pushed in the stack through a memcpy instead of a "=" operator that would be optimized in two movs), and reads require extra checks, that is branches, that an Item* won't need).<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Thu, 27 Mar 2008 10:49:08 +0100</pubDate>
        </item>
        <item>
            <title>How errors can be ... fun</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=29</link>
            <description><![CDATA[In the "funny / peculiar" meaning. I am developing the SDL module, and with that I am reinforcing the app-falcon integration mechanisms. I wrote a new item type called "membuf", which allows to do interact directly with binary data coming from SDL images through Falcon VM statements. But that's not the point here.<br />
<br />
The point is that, running a funny test of this feature on a test that already loaded and displayed an image (our project logo :-) I run sporadically on this error:<br />
<pre>
RangeError RT0047 at sdl_logo.__main__:37(PC:272): Access array out of bounds (STV)
  Traceback:
   sdl_logo.__main__:37(PC:272)
</pre><br />
The code generating this was...<br />
<pre>
   pixels = screen.pixels

   for y = 0 to 479
      for x = 0 to 639
         n = x + y * 640
         pixels[ n ] = 0xFFFFFFFF
      end
   end
</pre><br />
There was no memory corruption; just, at a spot the value of N went mad. Further investigation shown that inspecting its value cleared the error.<br />
I started thinking there was a problem in nested fors; in fact, using a for-in on range cured the problem. I wanted to remove the for loops for a long time now, and since we have ranges that may store 3 values now, that is one thing I am loosely considering. However, before removing this statement, I wanted to be sure there wasn't another error hidden somewhere else.<br />
<br />
I discovered that changing the patterns of garbage collection cleaned the error too. In the beginning, I thought the GC was ripping too much memory, or messing it up. But the thing seemed so clean. Then, I had a look at the VM code:<br />
<pre>
        PUSH    639
        PUSH    0
        FORI    _label_304, $*x, 0
.line 36
_label_240:
        MUL     $*y, 640
        ADD     $*x, A
        LD      $*n, A
.line 37
        STV     $*pixels, $*n, 268435455
        FORN    _label_240, $*x
</pre><br />
The LD $*n, A instruction is the one that does the trick, moving the value of the pixel index in the variable that is then used to store the data. I started to think that the GC collection loop destroyed the A register and put something in that. A fast check proved I was right; there was an object instance in A by the time STV was called. Also, saving A before the GC call and restoring it right after did the trick.<br />
<br />
But, the Garbage Collector is not supposed to change registers, and if it did it, then the whole thing would have blown out. I had a suspect, but to confirm it I added a data watchpoint to the A register right before entering the GC and... I got it.<br />
<br />
GC scans object properties using CoreObject<a href="tiki-editpage.php?page=CoreObject" title="Create page: CoreObject" class="wiki wikinew">?</a>.getProperty(). SDLScreen is a reflective class, and this means its <a title="UserData" href="tiki-index.php?page=UserData" class="wiki">UserData</a>.getProperty() method gets called instead. Surface <a title="UserData" href="tiki-index.php?page=UserData" class="wiki">UserData</a> creates a small object to store the rectangle in a property. Apart the fact that the object was re-created when not needed, the function doing this small step was...<br />
<pre>
CoreObject *MakeRectInst( VMachine *vm, const ::SDL_Rect &rect )
{
   Item *cls = vm->findWKI( "SDLRect" );
   fassert( cls != 0 );
   CoreObject *obj = cls->asClass()->createInstance();
   RectToObject( rect, obj );
   vm->retval( obj );
}
</pre><br />
And vm->retval() changes the A register. I am so accustomed to do falcon extension functions (that are void and return data to VM through this mechanism) that I didn't realize I wrote that code instead of the correct return obj. Moreover, the compiler (g++4.x) didn't even warn me about this non-void function not returning. The thing worked normally as, after this function returns, normally, the value that it returns is really stored in A and then passed to the script. Just, when this happened in the GC loop this turned out in a disaster.<br />
<br />
Someone may think this means that Falcon code is frail (well, no VM can be handed without care) but none of this would have happened if just the compiler told me I wasn't returning anything.<br />
<br />
<br />
<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Fri, 21 Mar 2008 10:53:17 +0100</pubDate>
        </item>
        <item>
            <title>Packaging hell</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=2&amp;postId=28</link>
            <description><![CDATA[Lately, we're feeling good. So good that we decided to go distro, and we're submitting packages like crazy.<br />
<br />
This brings up another interesting "hellish documentation" topic. You remember I said the worst doc around was Apache? &mdash; well, that's still true, but debian packaging nears it.<br />
<br />
The problem with Debian docs on packaging (and with other docs you may find around, as i.e. Ubuntu guides), is that they SEEM good. They are so verbose, pointy, rich, that you are leaded to think that they are good docs. But when you get to do things you learn soon that the glue is missing. The basic overall informations on how to do things and why things are done in such ways is nowhere to be found.<br />
<br />
Possibly, they seemed obvious to the first ones that invented the system.<br />
<br />
I think the very basic point is the "policy" document, which is a very pointy and pitchy document stating what a Debian package should be and what it must be avoided. However, those rules descend from an overall mystic knowledge that remains precluded to the most, until you learn it by osmosis living in the environment formed by other packagers.<br />
<br />
From the "policy", a set of learn-by-doing examples are extrapolated by various sources, as I.e. the Ubuntu packaging wiki. They are good, but usually they are partial and fail in explaining everything but the trivial cases. Worst of all, they too fail to explain the reasons behind things, and why tools works the way they do, so it is rather impossible to extend the usage of the tools beyond the mere samples that are shown.<br />
<br />
I agree that doing good packaging (and so, good distros) is an arcane art, but even arcane arts have their grimoires. Even an absurd mass of laws as the Italian Civil Code is based on principles that can be read in books and learned before hitting against the wall of the minute details.<br />
<br />
Another lesson learned about how *not* to write docs.<br />
]]></description>
            <author>jonnymind</author>
            <pubDate>Thu, 17 Jan 2008 13:25:44 +0100</pubDate>
        </item>
        <item>
            <title>PgSQL, MySQL and SQLite3</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=4&amp;postId=27</link>
            <description><![CDATA[As of about ten minutes ago, the DBI system in SVN now contains working drivers for PgSQL, MySQL ad SQLite3! This is a huge step. It also contains the beginnings of object persistence:<br />
<br />
<pre>
class Person(nName, nDob) from DBIRecord
  _tableName = "people"
  _primaryKey = "id"

  id   = nil
  name = nName
  dob  = nDob

  function age()
    // return computed age from dob
  end
end

p = Person( "John", lastYear )
p.insert()
p.name = "Jim"
p.update()
p.delete()
</pre><br />
<br />
In the last post, you also saw that you can query objects:<br />
<br />
<pre>
rs = db.query( "SELECT * FROM people" )
while ( let p = rs.fetchObject( Person() ) )
  > p.name, " is ", p.age(), " years old"
end
rs.close
</pre><br />
<br />
So, check out the SVN copy of the DBI module and let us know what you think!<br />
]]></description>
            <author>jeremy_c</author>
            <pubDate>Thu, 03 Jan 2008 05:12:42 +0100</pubDate>
        </item>
        <item>
            <title>DBI is becoming usable!</title>
            <link>http://old.falconpl.org/wiki/tiki-view_blog_post.php?blogId=4&amp;postId=26</link>
            <description><![CDATA[Well, after 5 long days, the DBI module is becoming usable! The most recent SVN commit (r46 right now) has some very cool samples that show off how to use the DBI. Here are a few highlights:<br />
<br />
<pre>
class Person
  ... attrs ...
end

rs = dbh.query( "SELECT * FROM people WHERE name LIKE $1", "%Smith" )
while ( let p = rs.fetchObject( Person() ) )
  > p.name, " was born on ", p.dob
end
rs.close()
</pre><br />
<br />
Or, how about this one, query expansion by name from an object?<br />
<br />
<pre>
p = Person( 12, "John", "2005-10-20" )
dbh.execute( "UPDATE people SET name=$name, dob=$dob WHERE id=$id", p )
</pre><br />
<br />
Or, one more. Transactions...<br />
<br />
<pre>
tr = dbh.startTransaction()
try
   tr.execute( "SQL CODE" )
   tr.execute( "MORE" )
   tr.commit()
catch DBIError in err
   tr.rollback()
end
tr.close()
</pre><br />
<br />
So, that's just a quick run down. A few more things have to take place before I start working on other DBI drivers:<br />
<br />
<ul><li> A bit more error checking
</li><li> dbh/tr insert/update methods (dbh.insert( tableName, dict ))
</li><li> dbh/tr queryOne (dbh.queryOne( "SELECT max(id) FROM people" ))
</li><li> unit tests
</li></ul>
<br />
However... please use svn, do a check out and report what you find! Currently, the only available DBI driver for the DBI module is PostgreSQL, but soon you will see others crop up such as MySQL, Sqlite3, Firebird/Interbase, ODBC, MS-SQL and hopefully more!<br />
]]></description>
            <author>jeremy_c</author>
            <pubDate>Sun, 30 Dec 2007 07:00:03 +0100</pubDate>
        </item>
    </channel>
</rss>

