searchQuick Apprise: FOUR #GoogleSummerOfCode #FOSSASIA


The intended “searchQuick” (sQuick) is an application to enable a user to search a set of books or texts, like an encyclopedia, or some other topical book collection offline built in the open source platform Pharo 4.0.


After indexing the content and the next task that was covered was searching for the user input string. The #queryString: does a fantastic job as of now.
The search results were printed in a scroll-able pane by iterating through a loop so as to cover each and every existence of the desired string. The search results window also enables the user to view the content of the chosen file.

02Search Results Display

Acting on the suggestion of my mentor, I have also loaded the Pharo image with text versions of large books (Thank You Project Gutenberg 🙂 )  to test the working of the search function.


  • GUI Modification
  • Integrated Exhaustive Testing
  • Addition of help/tutorial

PS: The GUI of the application is under constant evolvement, Kindly ignore the poorly structured window 😛

Stay tuned for more…
Post any queries , will be happy to help 🙂

searchQuick Apprise: THREE #GoogleSummerOfCode #FOSSASIA


The intended “searchQuick” (sQuick) is an application to enable a user to search a set of books or texts, like an encyclopedia, or some other topical book collection offline built in the open source platform Pharo 4.0.


After the GUI was designed with minimal features, the next task was to develop the cardinal search function.

Indubitably, a well-run search application/engine requires indexing.

Search Application/Engine Indexing basically collects, parses and stores data to facilitate fast and accurate information retrieval.

That being, the index for sQuick was built using the Dictionary data structure in Pharo which works like HashTable of other programming languages/platforms.

index := Dictionary new.

Pharo describes a Dictionary as: “I represent a set of elements that can be viewed from one of the two perspectives: a set of associations, or a container of values that are extremely named where the name can be any object that responds to =. The external name is referred to as the key. I inherit many operations from the Set. “

The contents of the text files present in the current Pharo image were split at whitespaces and added to the index along with the corresponding file title.

tokens := ‘ ‘ split: aDocument contents.

The method #indexFiles was used to iterate over all the text files in the current Pharo image to index all the files before the searching begins.


Dictionary Entries after File Content Indexing

The #queryString method has been temporarily build using #includesSubstring which matches the user input string with all the entries of the index and gives the result in an array form with #tally output as the number of search results.

Various test methods are now built to inspect the functioning of the methods designed. Continuous debugging is being done to check out and remove errors, if any 😉


  • Improve the indexing technique
  • Explore methods to quicken the search functionality
  • Integrate the search routine with the GUI already built
  • Design more test cases to develop a bug-free application

Stay tuned for more…
Post any queries , will be happy to help 🙂

TicTacToe Tutorial #FunWithPharo

reposted from

This tutorial has been included as a chapter in  Fun With Pharo!

Tic-tac-toe (or Noughts and crosses, Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.

Because of the simplicity of Tic-tac-toe, it is often used as a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence that deals with the searching of game trees. It is straightforward to write a computer program to play Tic-tac-toe perfectly, to enumerate the 765 essentially different positions (the state space complexity), or the 26,830 possible games up to rotations and reflections (the game tree complexity) on this space.


So , here we make a Pharo version of this well-known game by using Morph. This post provides a step-by-step approach on how to go about building this simple application.


A game package will be built having 3 subclasses :

  • TicTacToe
  • TicTacToeCell
  • TicTacToeModel

Initially , we have created TicTacToe a subclass of the Object class. The subclasses we will make will be combined in the package game as mentioned in the category: parameter.

Object subclass: #TicTacToe
instanceVariableNames: 'container model'
classVariableNames: ''
poolDictionaries: ''
category: 'game'

A category name is not required in order for the class to work, but you will not be able to access the class to make changes or to look at existing code unless you provide a category name. (The category name used can be a new category name or the name of an existing category.)

The poolDictionaries: parameter is seldom used and will not be discussed here, and the category: parameter specifies the category under which this class will be grouped in the system browser.

As we know, a class encapsulates data values and methods, and every object contains a set of the data values and can receive any of the methods as a message. The data values in each object are specified by providing a set of names of variables whose values will be an object’s internal data values. Each object has its own set of these values, and the set of data values for an object represents the object’s state (or value). The variables that contain the data values of an object are called the instance variables for the object, and the instanceVariableNames: parameter is a list of names, separated by blanks, for the instance variables. In the above code snippet , we have declared container and model as two instanceVariables.

The classVariableNames: parameter lists the identifiers that are the names of variables shared by the class and all of its objects. That is, there is only one set of these, and they are used by the class and all of its objects. Class variables (so called because they belong to the class, of which there is only one, rather than to the objects that are instances of the class) are rarely needed.

An example of a class variable that could be useful is in a case where we wanted a unique “serial number” to be assigned to each instance of the class as it is created. The variable containing the next available (or last used) serial number would appropriately be a class variable, and each time a new instance (object) is created the serial number would be recorded as an instance variable value in the object and the serial number in the class variable would be incremented. Thus, each object can be serially numbered as it is created (without using one of those nasty global variables!).

After executing the code above, class TicTacToe will exist. However, it will have no methods other than those that are inherited from class Object. To make it useful, we must add the methods that are needed for our implementation.

Adding methods to classes :

The subClasses interact by passing messages through objects only.

container := Morph new 
              layoutPolicy: TableLayout new; 
              color: Color transparent.
model := TicTacToeModel new:3.
self addRows.
self addControls.

The notation TicTacToe>>#initialize means that we have a method named initialize in the subclass TicTacToe.

In the initialize: method above , we have a container which is the instance of the class Morph (Morphic is the name given to Pharo’s graphical interface. ). We define the various attributes of the container such as layoutPolicy: and color:. model is another instance of the class TicTacToeModel which we will be creating further in this example.

self refers to the receiver of the message. It is usually used within a method to send additional messages to the receiver. self is frequently used when it is desired to pass the sender object (self), as a message argument, to a receiver who requires knowledege of the sender or who will in some way manipulate the sender.

In short, self refers to the object itself that defines the method.

| rowMorph aCell rowCol |
1 to:3 do:[ :row |
rowMorph := Morph new layoutPolicy: RowLayout new.
1 to: 3 do: [ :col |
aCell := TicTacToeCell new.
aCell setModel: (model) row: row col: col.
rowMorph addMorph: aCell.
container addMorph: rowMorph.

The method addRows (the name is self explanatory) is used to add rows in the Tic Tac Toe grid. It declares temporary (local) variables rowMorph , aCell and rowCol which can’t be used beyond this method.

1 to:3 do:[ :row |

rowMorph := Morph new layoutPolicy: RowLayout new.

1 to: 3 do: [ :col |

aCell := TicTacToeCell new.

aCell setModel: (model) row: row col: col.

rowMorph addMorph: aCell.


The above code snippet works as a nested loop that runs thrice for each three rows to create a 3X3 grid as per requirement.

| rowMorph newGameButton exitGameButton |
rowMorph := Morph new 
             layoutPolicy: RowLayout new; 
             color: Color transparent.
newGameButton := self createCtrlLabelled: 'New'    onClickExecutes: [self restart].
exitGameButton := self createCtrlLabelled: 'Exit'  onClickExecutes: [container delete].
rowMorph addMorph: exitGameButton.
rowMorph addMorph: newGameButton.
container addMorph: rowMorph.

This method adds controls to the game. The local variables are : rowMorph , newGameButton and exitGameButton.

rowMorph defines an instance of the class Morph which would be the placeholder for the two control buttons located at the top. The two control buttons are defined as New using the variable new GameButton which on click would restart the game , and Exit using the exitGameButton which on click would close the game. The buttons are created using a method createCtrlLabelled which we define next.

rowMorph addMorph: newGameButton adds the button to the Morph instance created earlier.

TicTacToe>>#createCtrlLabelled: aString onClickExecutes: aBlock
| aCtrlButton |
aCtrlButton := SimpleButtonMorph new label: aString.
aCtrlButton color: (Color black alpha: 0.2).
aCtrlButton extent: 120@50.
aCtrlButton on: #click send: #value to: aBlock.

TicTacToe>>#createCtrlLabelled: aString onClickExecutes: aBlock method makes a simple button using Morph adds label and control to it.

container openInWindow.

The open method defines as to how the game/TicTacToe class would open. Here we have defined it to open in a dialog box.

container delete.
Smalltalk garbageCollect.
TicTacToe new open.

It closes the game and calls for Garbage Collection (Garbage Collection (GC) is a form of automatic memory management. It finds data objects in a program that cannot be accessed in the future and reclaims the resources used by those objects.)

SimpleButtonMorph subclass: #TicTacToeCell
instanceVariableNames: 'parentModel rowNum colNum'
classVariableNames: ''
poolDictionaries: ''
category: 'game'

Here a subclass TicTacToeCell is defind in the SimpleButtonMorph class with parentModel , rowNum and colNum as the instance variables. This class defines the button for each cell of the grid.

super initialize.
self label: ''.
self extent: 80@80.
self color: Color yellow .
self on: #click send: #value to: (self onClickExecutionBlock).

This initialize method initialises the button size as 80X80 and gives it the color: yellow. An ‘onClick’ control is given to the button which then calls the onClickExecutionBlock method present in the same class.

TicTacToeCell>>#setModel: ticTacToeModel row: aRow col: aCol
parentModel := ticTacToeModel.
rowNum := aRow.
colNum := aCol.

The setModel: row: col: takes three arguments ticTacToeModel , aRow and aCol. The parentModel is assigned ticTacToeModel , roNum becomes the value of aRow and similiarly colNum has the value aCol.

(self label size) == 0
self label: (parentModel updateAtRow: rowNum 
                Col: colNum).
parentModel checkWinCondition.
self extent: 80@80.

This method defines what should happen when each cell in the grid is clicked. At every click , the label of the cell is changed to X or O depending upon whose turn it is , the row numbers and coloumn numbers are updated in the parentModel and win condition is checked by calling the checkWinCondition method of the class TicTacToeModel defined next.

Matrix subclass: #TicTacToeModel
instanceVariableNames: 'filledCellCount currentFill winner'
classVariableNames: ''
poolDictionaries: ''
category: 'game'

A subclass TicTacToeModel is defined in the Matrix class with filledCellCount , currentFill and winner as the instance variables.

super initialize.
filledCellCount := 0.
currentFill := nil.
winner := nil.

This initialize methods defines that initially no cell in the grid is filled and there is no winner as of now.

TicTacToeModel>>#updateAtRow: r Col: c
currentFill == nil
ifTrue:[ currentFill := 'X'. ]
currentFill == 'X'
ifTrue: [ currentFill := 'O'. ]
ifFalse: [ currentFill := 'X'. ]
self at: r at: c put: currentFill.
filledCellCount := filledCellCount + 1.

The updateRowAt: Col: method takes two arguments r and c used to update the currentFill and filledCellCount variables.

filledCellCount >= 5 "for optimization. Win can occur minimum at 5th turn"
ifTrue: [
Transcript show: 'Yes'.
1 to: 3 do: [:idx |
self checkWinConditionInRow: idx.
self checkWinConditionInColumn: idx.
self checkWinConditionInDiagonals.
checkWinConditionInRow: rowNum
winner isNil
ifTrue: [
set := (self atRow: rowNum) asSet.
self checkWinConditionInSet: set

The method checkWinCondition is self explanatory. It is used to check if we have a winner or not at every move.

TicTacToeModel>>#checkWinConditionInColumn: colNum
winner isNil
ifTrue: [
set := (self atColumn: colNum) asSet.
self checkWinConditionInSet: set.
|set1 set2 |
winner isNil
ifTrue: [
set1 := (self diagonal) asSet.
set2 := Set newFrom: {(self at: 1 at: 3). (self at: 2 at: 2). (self at: 3 at: 1)} asOrderedCollection.
self checkWinConditionInSet: set1.
self checkWinConditionInSet: set2.
TicTacToeModel>>#checkWinConditionInSet: aSet
aSet size == 1
ifTrue: [
(aSet includes: 'X')
ifTrue: [
        winner := 'P1'. 
        Transcript open. 
        Transcript show: 'Player 1 is the winner!!'.

(aSet includes: 'O')

ifTrue: [
        winner := 'P2'.  
        Transcript open. 
        Transcript show: 'Player 2 is the winner!!'.


Now , we have made the game. To open the game , simply execute the following in the playground/workspace.

TicTacToe new open.

The messages : ‘Yes’ , ‘Player x is the winner’ will be displayed in the Transcript.

PS – This was just the basic implementation. I plan to improvise it further with graphics and other functionality/features.

Do like the post if it was helpful.
For any queries/suggestions please comment below.

Thank You

searchQuick Apprise: TWO #GoogleSummerOfCode #FOSSASIA


The intended “searchQuick” (sQuick) is an application to enable a user to search a set of books or texts, like an encyclopedia, or some other topical book collection offline built in the open source platform Pharo 4.0.


After building various mock-ups for a user friendly graphical interface for the application, the rudimentary features which would be present in the first release were finalized.

The chief features would include :

  • Search for word(s)
  • Browse files in the current image
  • Help or Tutorial
  • About section
  • Feedback or Suggestion Aid
  • Explore the code ( Cardinally Open Source 😉 )

Main Screen (copy)


At this moment, the most viable options available (apart from the use of GTSpotter, Rubric or Bloc suggested by developers on the forum and #pharo IRC) include:

  • The use of Spec to build the UI which provides a comparatively easier option to implement Button Click Actions, User Input Search String Retrieval etc. But the graphical interface designed by placing the widgets is not a very fancy one and dependent on the current theme of the image.
  • The Morphic GUI gives the application a very pretty look in comparison, however the user input search string retrieval method is not a straight-forward one and is under construction.

After considering various pros and cons, the suitable alternative is considered to be the one made with Morph as it gives a refreshing look to the application.


  • Completion of GUI development
  • Commencement of Index build

Stay tuned for more…
Post any queries , will be happy to help 🙂

Starting with Smalltalk, Pharo and Spec

reposted from

Hi !

It’s been a few weeks since I started with Smalltalk, Pharo and Spec. Under the guidance of Mr. Martin Bähr, Mr. Sean DeNigris and people from the #pharo community (@thierry, @kilon, @maxleske) I have been able to learn Pharo in a systematic way. I have implemented the knowledge gained by building a few simple desktop applications using the resources available online.

This post intends to clear all your doubt regarding the basic definitions of Smalltalk, Pharo and Spec.


Smalltalk is an object-oriented, dynamically typed, reflective programming language. It was designed and created in part for educational use, more so for constructionist learning. The language was first generally released as Smalltalk-80.

A Smalltalk environment is its own little world, designed around a conception of a computer with a minimal operating system and populated with living objects. A Smalltalk implementation is composed of an image (binary code), a major source file and a ‘changes’ file. The image is called Virtual Image (VI) because is independent form the platform you use for running Smalltalk. Smalltalk systems store the entire program state (including both Class and non-Class objects) in an image file. The image can then be loaded by the Smalltalk virtual machine to restore a Smalltalk-like system to a prior state.

As Sean DeNigris wrote to me: You may not realize it, but you have opened a portal to some of the greatest minds in the history of our industry. You have in your hands, not a programming language, but a live, dynamic, turtles-all-the-way-down environment designed to provide ‘support for the creative spirit in everyone’. More practically, Smalltalk is a programming tool that allows productivity unimaginable in most systems. And, if you put in enough time and effort to actually think in it, it will help you program better in any language you use.” ; Smalltalk is more dynamic and powerful than what one can think of.

Pharo is an open source implementation of the programming language and environment Smalltalk. Pharo is not Smalltalk. Pharo is Smalltalk-inspired.

Pharo offers strong live programming features such as immediate object manipulation, live update, and hot recompilation. Live programming environment is in the heart of the system. Pharo also supports advanced web development with frameworks such as Seaside and more recently Tide.

The official Pharo website defines it as: Pharo is a pure object-oriented programming language and a powerful environment, focused on simplicity and immediate feedback (think IDE and OS rolled into one).

Pharo relies on a virtual machine that is written almost entirely in Smalltalk itself.

Spec is a simple framework for describing User Interface (UI) for Pharo Smalltalk. It takes a model and a layout description, runs it through an interpreter and a UI is produced as a result. All the widget implemented this can then immediately be reused as any other widget.

It also allows the separation of concerns between the different parts of the user interface as expressed in the MVP pattern. Spec emphasis the reuse of the widgets as well as their customization.

I hope now you have got the classifications of Smalltalk , Pharo , Spec all cleared up which remains a basic doubt in every beginners mind.


Visit the official Pharo website’s download tab to get the desired version of Pharo for the corresponding OS.

For a step by step tutorial describing various ways to install Pharo in your system visit the ‘Installing Pharo in many flavors’ blog written in a very systematic manner by Guille Polito.

Follow the steps as given in Spec Documentation to install Spec in a Pharo Image.


Visit to get more resources to study from.


PS  –  Watch out this blog for tutorials to build basic desktop applications in Pharo.

Do like the post if it was helpful.
For any queries/suggestions please comment below.

Thank You

How to join the FOSSASIA Community

We often get the question, how can I join the community. There is no official membership form to fill out in order to participate in the Open Tech Community. You simply start to contribute and you are already a member. So, let’s work together to develop to develop social software for everyone!

The FOSSASIA team welcomes contributors and supporters to Free and Open Source Software. Become a developer, a documentation writer, packaging maintainer, tester, user supporter, blogger, journalist writing about FOSSASIA or organize events and present Free and Open Source Software projects in Asia.

Women in IT discussion in the community

Here are some ideas how we can collaborate:

Read the blogs and support users in the mailing list

Many FOSS blogs are written by developers, contributors, volunteers, and staff of companies supporting the FOSSASIA network – stay up on free software related progress and news and start to get involved. Sign up for the FOSSASIA Mailing List and keep reading our Blog at:


Follow FOSSASIA on Twitter and retweet important updates:

FOSSASIA at Google+ and Facebook

Become a member on social networks:


Add your community in Asia to the FOSSASIA community network list

FOSSASIA is connecting communities throughout Asia and around the world. Please add communities in Asia to the community network list here:

Support the FOSSASIA network at Community Events

Set up a booth or a table about FOSSASIA at open source community events! There are many events of the open source community all over the world. The core team of FOSSASIA is simply not able to attend all events. You can support the cause by making the project visible. Register as a member of the FOSSASIA community at events, set up an info point and showcase Free and Open Source projects. Check out for example our meetup group in Singapore:

Download Open Source Software from the FOSSASIA Github repo, join as a developer or tester:

The first step of joining a project is always to download the software and try it out: and our project for big data:

Translate FOSS projects and their documentation

Do you speak more than one language? Most FOSS projects are 100% volunteer translated, which means you can be part of a translation team translating software and documentation thousands of people will use. The point to start is also our GitHub repo.

Mini Debconf Participants in Saigon

Richard Stallman from the Free Software Foundation and Hong Phuc Dang at the 31c3 Chaos Communication Congress in Hamburg

Richard Stallman FOSSASIA's Hong Phuc Dang, Free Software and Open SourceRichard Stallman (Free Software Foundation) and FOSSASIA‘s Hong Phuc Dang,

Richard Stallman and Hong Phuc Dang met at the 31c3 Chaos Communication Congress in Hamburg. Richard Matthew Stallman (RMS) is the founder of the GNU Project and the Free Software Foundation. Hong Phuc started the FOSSASIA community in 2009. The meeting during the “Congress” was a unique chance to discuss the progress of freedom and software in Asia.

“It is great to get Richard’s views on the development of software in Asia and learn about his ideas about Open Source and Free Software. I hope we will follow up soon about new projects and see more cooperation between the Free Software Foundation and the FOSSASIA community.”

A focus that is becoming more and more interesting is hardware and FashionTec development. One of the exciting projects taking place are knitting machines with a completely open design that are freely licensed. Richard advised to use the label “Free Hardware Design” modeled after “Free Software” for such projects.


Richard Stallman in the Wikipedia:

Personal Website:

Blog on the FSF:

Free Software Foundation:



FOSSASIA joining Google Code-In Program for Students Age 13-17

We are proud to announce that FOSSASIA has been chosen as a mentor organization for Google Code-In 2015. FOSSASIA is one of twelve global organizations participating in the program for students from the 13-17 years old.

Google Code-In is a global, online contest for 13-17 year old pre-university students interested in learning more about Open Source development. Students work on bite-sized tasks for real-world open source projects in a variety of categories.

Students can register and take over tasks starting from December 1, 2014 and work on tasks until January 19. All tasks are listed on the website at

Contest Timeline

December 1, 2014, 9:00 AM Pacific Time / 17:00 UTC: Contest opens for entries by student participants

January 18, 2015, 9:00 AM Pacific Time/ 17:00 UTC: No more tasks can be claimed by students after this time

January 19, 2015, 9:00 AM Pacific Time / 17:00 UTC: All work stops, Contest ends

January 26, 2015: Mentoring Organizations submit their grand prize winner nominees to Google Open Source Programs Office

February 2, 2015: Google Open Source Programs Office announces the grand prize winners via blog post

June 2015: Grand Prize trip to Google and northern California



* Google Code-In

* FOSSASIA at Google Code-In

OpenTech and Open Knowledge in the Mekong Delta and throughout Asia

The FOSSASIA organization has been very active and I would love to give you a few updates on our activities. One thing why we love to work in this community is because you get the chance to meet some of the most awesome and friendly tech people of the world. Jonas Smeedegaard from the Debian community is one of our guests who has been visiting us three times already and conducted workshops at our events and even stayed several weeks in Can Tho to train students using and developing Debian.

Jonas Smeedegaard at Workshop: Bringing Asian and International developers together

Meetups and Code Sprints

Of course we could not do all of this alone and we would like to thank some of the most outstanding folks we are working together with including HanoiLUG and Saigonlug in Vietnam, Singapore Hackerspace and the Beijinglug.

Coding Projects

We have recently involved and organized activities with the following projects and are glad to feature the following projects on this blog:

  • Wikipedia
  • OpenWrt
  • Crypto-Stick
  • LXDE
  • MoonOS
  • Android
  • Debian
  • Fedora
  • Gimp
  • Inkscape
  • Linux conversion libraries
  • OpenStreetMap
  • and many more

FOSSASIA Event in Ho Chi Minh City


In 2012 we welcomed interns in Can Tho. Fifteen students participated in the program as full time interns in the office of MBM International in the biggest city in the Mekong delta. The program took place for 2 months and a core part of it was to learn how to use collaborative tools liker issue trackers and contribute to OpenStreetMap. Our students also love the Wikipedia sprints and we got a lot of positive vibes as everyone was happy to learn how to set up the Mediawiki software, that empowers the encyclopedia, share their ideas and spread Open Knowledge and Open Data about the Mekong Delta.

Event activities

We also continued to organize the FOSSASIA OpenTechSummit in 2010 and 2011 in Raffles College and Van Lang University in Ho Chi Minh City Vietnam. Plus we had a Mini-Debconf in Saigon and organized the event series OpenDesign.Asia Weeks bringing together designers and Open Source developers. We have links to the LXDE project and GNOME community and we have sent developers to the GNOME.Asia Summit 2012 in Hong Kong and supported the TYPO3 conference 2012 in Phnom Penh.

Also globally FOSSASIA starts to receive more attention. We have received the opportunity to introduce Asian projects at the Libre Graphics Meeting in Montreal (2011) and Brussels (2011), at the Linuxtag in Berlin (2012) and many other community events.

Please Join us and Get in Touch

The FOSSASIA organization supports activities and Open Tech development and Open Knowledge projects of the community active in Asia. If you are interested to cooperate for a project, need support for a development sprint or an event, please contact us on the FOSSASIA mailing list:


Open Design Weeks 2011 Saigon

The Open Design Weeks Asia take place in Hochi Minh City and Cantho (Vietnam) from April 2-16, 2011. The program has been announced. There will be an Open Design Camp in Saigon and intensive workshops in Cantho.

The focus of the Open Design Weeks are on design, Free, Libre and Open Source software, open content and Free Culture practices. Events during the design weeks include workshops, design camps to share expertise an unconference, company meet ups to establish international cooperations, presentations in Universities and training workshops. The intensive workshops with local designers, software developers and typographers focus on collaborative font design, mapping and publication.

This will be a great chance to get involved in some new and exciting projects

Open Design Weeks: