Wednesday, July 30, 2008

Week 9 of GSOC - FreeCAD/Croquet

1) What did you do in the past week?
-Added new camera controls e.g. tilt,forward,rotate etc
-Added tool to rotate objects around X,Y and Z
-Set up website to publish FreeCAD/Croquet and provide instructions

2) What do plan to do this week?
-Implement a grid plan on the drawing board to act as a ruler and guide when drawing.
-Add the much needed and delayed Joints to connect two markers

3) What can possibly stand in the way of your work?
-Still, 3D transforms are complicated but I'm getting the hang of it

OpenNARS - End of July Status

I've spent the last 2 weeks giving more love to the wiki and polishing what was ported since the start of the project. It was done in conjunction with design and comprehension decisions.

Until now, the main entities are ported as the primitives inference functions that acts on 2 special NARS arithmetic entities (TruthValue and BudgetValue).

What's missing are the inference rules as the glue with the existing entities in particular Memory who is the central class that implements the reasoning process. It has also on its state all the storage entities (NARS Bag) and organize their contents interaction. NARS bags are not only usual collection. They have in this design the responsabilies of pickOut and putIn (driven by a probabilistic selection using BudgetValue).

So here is a summary ot what was done recently:


reorganization around the following sections :

Code Section For all code aspect of the port
  • Code Browser
    • ajax based - scriptaculous version extended
      • read-only
    • Squeak and Java Doc
      • gives package and class comment
      • shortcut to the last java version, and to the squeak one
    • Java structure and design discussion
NARS Section


A blog to ask questions, relates actuality of the port...


Section in relation to the timeline and objectives of the GSoC Prject

Functional test applications

I haven't made a lot of unit tests yet mainly because my understanding of the system was not really clear (until now?). Instead I did two functional test applications (seaside). They allow testing most of the inference primitives methods on TruthValue and BudgetValue. I plan to continue this kind of functional test with the inference rules and if possible providing a seaside application that will do an inference cycle step by step (kind of WATask).

What's next ?

I also had a reflection on how to implement the rule dispatcher and the rule body. Given our objective (mainly syllogistic rules as we deal only with atomic terms), there are not too many classes and methods but they are quite long. The discussion we had with Klaus was whether to dispatch or not :).

The conclusion is to stick to the actual implementation for several reasons:

  • Pei wants the code in one place as the NARS is not stabilized yet (AGI research project)
  • Refactoring is quite uncertain now.
  • Writing rules with Smalltalk ifTrue:'s isSometing's and:[]'s, the code will be quite shorter and so a bit more readable. For instane, see there (the java version is commented below).
  • we keep our ideas for later. Dispatching would surely making look a bit nicer but it could be worthless if there is a major move (like using prolog - having rule in a declarative language).

So next steps are, finishing and fixing language statement class and subclasses. Then I'll have to port 3 inference classes. I think 3 weeks is reasonable to have the system starting to work as a whole (still far form doing all kind of inference and logic expression). At this time, we'll have to test, optimize the reasoning process and in the same time I'll do seaside interfaces. I also would like to do a screencast with the Java version to show how NARS behave and can be used. I plan to do this tutorial.

That's it for now.

Happy squeaking ;-)

Wednesday, July 23, 2008

Week 8 of GSOC - FreeCAD/Croquet

1) What did you do in the past week?
-Fixed drawing movement with mouse. Drag and move properly enabled now. Drag and rotate is also fixed.
-Experimenting with camera movements. Tilt, forward, back, rotate are some of the motions enabled on keyboard.
-Added a pop up info board that shows the position of the mouse on the drawing board to enable better and more accurate drawing. Pop up also added to drawing when dragged and moved to show the position of the drawing.

2) What do plan to do this week?
-Finalize camera movement and try to integrate some of it with the mouse.
-Implement a grid plan on the drawing board to act as a ruler and guide when drawing.

3) What can possibly stand in the way of your work?
-No feedback and no one trying out the things I have done puts me in the dark about how user friendly the controls are.

Tuesday, July 22, 2008

squeakGtk Omnibrowser

I've updated the squeakGtk website look at :

Here is the first release of the Omnibrowser with Gtk :

At this time this is only read-only and there is not menu support.

I've solved the problem of the active waiting with a thread in C in which gtk waits
for an event and when there is an event send a signal to a semaphore and wake up
the Smalltalk process, it works but I should remove the Morphs because X events
handling is not thread safe.

I'll create an image without the morphs if it possible...

Thursday, July 17, 2008

OpenNARS - Development Progress - 2nd phase

The port of NARS is now getting in the more complex/interesting part ie. porting inference rules and make the whole thing work.

It hasn't been possible to focus on simple inference as there's not a clear distinction in the rules implementation. So I did choose to port the maximum I could understood. Most of the stable classes that are not evolving much are ported. Some are tested, some are not as I need other parts to make them work.

We had also a discussion with Klaus to agree on the objectives and ways to tackle some problems. I also had to read again documentation on the NARS approach as it's still difficult to me to explain to others. Also, java code is not always explaining by itself :).

I've extended an overview document with picture to explain relation between statement (logic expression), sentence, reasoningItems (tasks that encapsulates sentences, judgment, question goal...) and reasoning artefacts (memory...bags...). See here.

Where I'm right now is thinking about the implementation choice of Inference rules.
Indeed, Pei choose to implement inference rules, as some utility functions and the memory as static methods only in several distinct classes. I understand his choice as it's easier for him to find and modify them (java world), but this is another difficulty for me to understand the system. It's therefore kind of mixed because several methods should belong to others objects and so, hard to port as I ask myself whose object responsibility it is... I've started that for all Utility functions (that are really stable). All three classes don't exist anymore and are either extension method.

Also dispatching them in Smalltalk is less problematic as I can use Pragma or even flags to access them quickly... Besides the static'ness of these methods, I find they are too long... which makes them hard to have a global view. Over the 4 inferences classes (+ a kind of rule dispatcher - RulesTable), there around 10 reasonning method per class which is not much but they are quite long... So fisrt, I'll port skeletton, bypass the parts in relation to complex inference (temporal, structural...) and I'll try to see common parts so as to create convenience methods etc...

That's why I'm spending this week getting a better understanding of the system to propose an alternative design. I think for instance that the memory class is the reasoning controller. It has links to several bags (Nars bags), that are the real storage of the working memory (names can be very confusing sometimes). I find I need some more abstraction and one of them is a reasoning controller which will hold the reasoning process (an inference engine?). I'm also discussing that point with Pei on the Nars mailing list.

The other missing parts is the full implementation of NARS language (NARSESE) that allows to express logics expression (input belief, outputs). I'll focus on implementing first simple statements like "swan is black" "yoyo is a swan" etc... The inference engine would be already usable for more complex expression. Still the future seaside interface will only focus on simple statements, presenting inference and result(s).

To deal with language terms, I may use a visitor pattern, or at least a better dispatch but I'll focus on that later.

So, next objectives are:
-port CompoundTerms, Statements and relations subclasses (inheritance, equivalence, implication, instance...) to be able to express tasks - statement which is a logic statement with a truth value plus some meta information that allow to deal with priority, decay, life of the belief in the working memory ...
-then make NAMemory work, maybe split it into 2 classes. I need to implement inference rules (some not all)

See you all... Feel free to leave comments, give pointers on pattern or application that use rule and inference (SOUL ? NeOPUS ?)...


Wednesday, July 16, 2008

Week 7 of GSOC - FreeCAD/Croquet

1) What did you do in the past week?
-Experiment with different camera movements
-Implemented keyboard keys with avatar motion e.g. tilt, move around etc
-Experiment with solid transformation, trying to put in better control of solids with mouse movement

2) What do plan to do this week?
-Continue to work on avatar movement with keyboard and applying different movements to have a better CAD view of assembly
-Restructure drawing of solids for better integration with mouse movement

3) What can possibly stand in the way of your work?
3D transform theories are really complicating!!

Tuesday, July 15, 2008

Safarà status: New commands and a new SATextMorph

These week I added some support to implement commands based on multiple cursors.
As an example I provided commands to move the current point of editing between words (e.g. next-word, previous-word, etc.).

The second issue I attacked was the one related with how present the characters. Now we use a custom morph to present the content of a buffer.

The next step will be to define a GUI-independent model for styles and interactions with ranges of text. This will enable us to provide some features like text-selection, syntax-highlighting or "Do it".

As in the last post and from now on, I will try to provide a snapshot:

Monday, July 14, 2008

Cairo support under SqueakGtk

Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System, Quartz, Win32, image buffers, PostScript, PDF, and SVG file output. Experimental backends include OpenGL (through glitz), XCB, BeOS, OS/2, and DirectFB.

for more informations go to the cairo website :

The support of Cairo under squeakGtk is not complete but most of the functions are supported, it lacks the support of the transformations functions, ...

May be it will be possible to use cairo for the morphs ?

SqueakGtk status

Here are some news of the SqueakGtk project :

I've extended the Gtk support with new widgets :
  • GtkAboutDialog (added some fields)
  • GtkFontSelectionDialog
  • GtkAccelLabel
  • GtkLinkButton
  • GtkScaleButton
  • GtkVolumeButton
  • WebKit
  • ...
I've corrected a bug with the memory management, it seems that Gtk doesn't like
g_object_unref when there is a parent widget. The support of Gtk
is more stable but there are others problems in the events handling
this is an active waiting so it uses a lot of cpu times, an other problem
is when the user save the image a "Gtk" object in Squeak only contains
a pointer in a C structure and I need to save and restore this structure.

I'm working on the Omnibrowser support and in the improvement of the
new tools :p

Some basic tools :

Squeakzilla a new browser :p

Wednesday, July 9, 2008

Safarà Status

A first prototype of Safarà is ready at last.

Currently it supports basic ascii text editing, that can seem not so much.

Actually I am really happy for the work done as I think (and I hope) I met several goals:
  1. extensibility in terms of features: you can add features (commands gestures syntaxes) to Safarà at runtime, without interfering or having to interact with other layers;
  2. portability over implementations: the model does not know anything about the UI as they are completely decoupled and communication between them occurs by using announcements. Thus, you can write also a non-morphic UI for example. Just make your UI objects subscribe to the right announce and write a bridge to translate the GUI-dependent events to the Safarà events;
  3. Classes and methods are well categorized, documented and tested.
So, what are the next steps?

For the Morphic UI: Do not use TextMorph as base class but a custom morph

For the model: Integrate into Safarà some code wrote by Lukas for syntax-aware commands

You can find the latest snapshot here. There is also a developer mailing list, you can subscribe to. As Safarà partecipate to the ESUG 2008 awards you can find additional documentation about the project goals and design here.

For the most curious, this is a snapshot

Week 6 of GSOC - FreeCAD/Croquet

1) What did you do in the past week?
-Created handles to interactively draw objects.
-Handles allows extending and rotating the drawing.
-Putting in markers and selecting them so that Joints can be created and linked to them.
-2D drawing detection to move drawings and to select it

2) What do plan to do this week?
-Will continue work to create Joints that will reference 2 markers for simulation purpose
-Look into how the camera view can be adjusted for better viewing angles. Any suggestions on this is much appreciated

3) What can possibly stand in the way of your work?
3D transformation is quite complex and i'll need some time to understand it better in order to create better functions.

Here's a video showing some of the work I did:

Tuesday, July 8, 2008


As promised, some news of the project!

So far, the bot framework is on the good way... I tried as much as possible to have an easy public interface so that it should be easy for anyone to develop with the framework. The base is maturing and shouldn't change much in the future.
I've developed some basic functionalities: an administration interface, a help system, a greeting (a bot has to be polite) and a simple infobot that can memorise definitions.

At the moment, the IRC protocol is handled by the existing IRC client in Squeak. Unfortunately it relies on Morphic ( in short; the gui ). I've abstracted it so that the bot isnow completely indenpendant of it. It is planned to develop a clean IRC library which wont rely on any gui.

So what next ?
  • Continue the real world tests (yesterday was the first attempt on freenode :),
  • Polish the admin and help,
  • Add logging functionalities
  • Develop a web interface (with Aida or Seaside)
  • Develop a clean IRC library
  • Write docs

Stay tuned!
(if you see squeakbot on freenode, introduce yourself to him :)

Saturday, July 5, 2008

Squeak - Impressions


The more i code, the more i fall in love with Squeak and Smalltalk in general. I've properly started my gsoc project after my last exam (20 June) and i'm already addicted to the different Smalltalk tools. Iknew quite well the classic System Browser but was a little bit intimidated by the other ones.

Little by little, i've started to code in the debugger (i can imagine non smalltalkers shocked while reading this but it _really_ is an eyes opening experience) and guess what...I like it! I've learned to appreciate the refactoring, senders, hierarchy, variables and versions broswers. Most of the modern IDEs have those functionalities but Smalltalk had those for years and they are so well integrated in the environment. All those tools encourage you to explore the image. It feels like reading wikipedia: you start to look at an article about something and link after link you end up reading about the Pyongyang metro...

The only drawback is that you are quickly overwhelmed with windows popping up everywhere... especially on a 12 inches screen :)

Another common problem for beginners is the syndrom of 'Where the hell do i have to start?'. Interesting opinions can be found in the comments of a Ramon Leon's post. Now, there's a fantastic open book that everyone willing to learn Squeak/Smalltalk should read: 'Squeak By Example'.

More news about the project itself very soon!