Importance of a pattern editor for knitting applications

Hi Everyone, I am Sameera Gunarathne who is a participant for GSoC ’15 for FossAsia under fashion and technology. I am developing web based GUI for knitting applications. Today I am going to talk about importance of integrating a pattern editor inside knitting applications and little bit about my work on the pattern editor implementation.

Why knitting application should have a pattern editor? It’s to simply give the user capability of doing all the editing work on the pattern before it is sent for knitting. Therefore user will be able to proceed the whole knitting process using one application. User doesn’t have to use a separate application to edit the pattern and then import the pattern to the knitting software to get knitting done. Also most these pattern editor applications are commercially available which means user has to pay for the application and its updates. So that’s extra money. Some examples for available pattern editor softwares are knitbird , envisioknit , stitchmastery  etc.

KnitBird application
KnitBird application

So what about open source knitting machine software with a feature rich pattern editor? Cool right. I am working on integrating feature rich pattern editor for the knitting web application that I am developing for FossAsia this GSoC. Following features are already added to the pattern editor implementation.

  • Getting a loaded pattern to a pixelated grid to give user a easily editable interface.[1]
  • Pixelated pattern can be generated from available yarn colours that used for knitting.[2]
  • Cropping tool for load necessary parts from the pattern.[3]
  • Rectangular/Free Hand selection of loaded pattern.[4]
  • Editing colour details of a selected area of the pattern.[5]
  • Drawing tool for the loaded pattern. [6]

User is given capability to regenerate the pattern according to the available yarn colours for the knitting. This functionality allows user to understand how the actual knitting output will be there with the available yarn colours. Below are the some of screen shots of current implementation.

Loaded pattern in pixelated grid
[1] Loaded pattern in pixelated grid
Pixelated pattern can be generated from available yarn colours
[2] Pixelated pattern can be generated from available yarn colours
Cropping tool
[3]Cropping tool
Rectangular selection
[4]Rectangular selection
Free Hand selection
[4]Free Hand selection
Editing colour details of a selected area
[5]Editing colour details of a selected area
Drawing tool
[6]Drawing tool
I am very much enthusiastic on the project and working hard to get a good outcome for the knitting web application implementation. See you with the next blog post update. Thanks :).

Continue ReadingImportance of a pattern editor for knitting applications

FOSSASIA Google Code-In Students and Mentor at Googleplex Mountain View

Last week grand prize winners from FOSSASIA and other organizations that participated in Google Code-In 2014 attended a trip to the US accompanied by a guardian and a mentor. The grand prize trip is the crowning activity of Google Code In, the program organized by Google with the aim of introducing pre-university students to open source. I was fortunate enough to take part as the mentor representing FOSSASIA.

2014 was FOSSASIA’s first participation in GCI and it was a great success for us.

The trip kicked off on the evening of the 7th June with a ‘meet and greet’ at the hotel lobby. Stephanie Taylor and Mary Radomile from Google OSPO welcomed us. I met Namanyay Goel and Samarjeet Singh, the two winners from fossasia, and a bunch of other winning students and mentors. Groups of students were quick to engage in lively discussions, It was hard to believe that most of them met for the first time. I was glad to learn that both our winning students enjoyed the contest as much as I did. At the end of the two hours both students and mentors were holding on to some rewards from Google. As I was tired from the long flight I bid everyone an early goodbye to get a much needed sleep.

FOSSASIA Google Code-In 2014I met Namanyay and Samarjeet, Grand prize winners from FOSSASIA.

The next morning we met in the hotel lobby again. We were to spend the day in the Google headquarters in Mountain View. The San Francisco traffic delayed our buses a bit but we arrived at the Googleplex to a pleasant breakfast. In the morning we listened to talks from Engineers of Google projects Ara and Tango. A series of interesting questions from an enthusiastic audience followed each talk. Chris DiBona, the director of the Google OSPO presented winners their awards. After a lunch where students got to enjoy with Googlers from their respective countries, we were back for more talks. The one from Google’s rapidly evolving self driving cars, caught a lot of attention. We also got to visit the Google visitor center, where we met famous giant Androids, and to the Google store, where everyone bought a bunch of souvenirs to take back home.

Third day of the tour was the ‘fun day’. Each of us were to choose between visiting the Alcatraz island which was the home to the historic federal prison, the Exploratorium, a science and arts museum and a segway tour around San Francisco. About half of the group and I picked segways. We rode the brilliantly engineered machines around the city while our guide entertained us with interesting facts about the city. It was a novel experience for everyone. The three groups met for the lunch and set off to see the famous Golden gate bridge, where we spent the afternoon. A Yacht course across the San Francisco bay, during which we sailed under the Golden Gate, completed a day filled with amazing memories.

The final day was spent in the Google office in San Francisco. We got to listen to a talk about YouTube, which again followed some interesting questions and answers. Carol Smith introduced GSOC, the Sister program of GCI, to the students. Each of the mentors gave a brief introduction to their organizations. We were officially announced that GCI will continue in 2015 as well. The students presented Stephanie with a handmade thank you card inscripted by all of them, which I thought was pretty cool.

The trip was filled with both information and fun. It indeed was a Grand Prize. I hardly know how to thank Stephanie and co. for everything.

I hope, irrespective of being probably the best in their age, in their field, the winning students would stay humble and hungry for new knowledge. Looking forward to GCI 2015.

Link

See how GCI 2014 went: http://www.google-melange.com/gci/org/google/gci2014/fossasia

Continue ReadingFOSSASIA Google Code-In Students and Mentor at Googleplex Mountain View

searchQuick Apprise: THREE #GoogleSummerOfCode #FOSSASIA

banner-gsoc2015.png.pagespeed.ce.1-XG35qq3R8SQJ5DGgL9

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.

header



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.

Index

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 😉

UPCOMING:

  • 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 🙂


Continue ReadingsearchQuick Apprise: THREE #GoogleSummerOfCode #FOSSASIA

TicTacToe Tutorial #FunWithPharo

reposted from jigyasagrover.wordpress.com/tictactoe-tutorial-funwithpharo

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.

t

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.

TTT2

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.

TicTacToe>>#initialize 
container := Morph new 
              layoutPolicy: TableLayout new; 
              color: Color transparent.
model := TicTacToeModel new:3.
self addRows.
self addControls.
^self.

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.

TicTacToe>>#addRows
| 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.

TicTacToe>>#addControls
| 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.
^aCtrlButton.

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

TicTacToe>>#open 
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.

TicTacToe>>#restart
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.

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

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.

TicTacToeCell>>#onClickExecutionBlock
^[
(self label size) == 0
ifTrue:[
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.

TicTacToeModel>>#initialize 
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'. ]
ifFalse:[
currentFill == 'X'
ifTrue: [ currentFill := 'O'. ]
ifFalse: [ currentFill := 'X'. ]
].
self at: r at: c put: currentFill.
filledCellCount := filledCellCount + 1.
^currentFill.

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

TicTacToeModel>>#checkWinCondition
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
|set|
winner isNil
ifTrue: [
set := (self atRow: rowNum) asSet.
self checkWinConditionInSet: set
].
^winner.

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

TicTacToeModel>>#checkWinConditionInColumn: colNum
|set|
winner isNil
ifTrue: [
set := (self atColumn: colNum) asSet.
self checkWinConditionInSet: set.
].
^winner.
TicTacToeModel>>#checkWinConditionInDiagonals
|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.
].
^winner.
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!!'.
    ].
].

example2.

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

Continue ReadingTicTacToe Tutorial #FunWithPharo

Get Facebook comments with large user pictures

On the /user edge, user pictures url are not returned by default, and when users ask for it, the response image is not in biggest format. This query should get the largest user pictures associated with post :

	/user{picture.type(large)}

There are other use cases where this syntax applies as well

  • get comments of a feed
	/feed?fields='from{picture.type(large)}'
  • get feeds of an user
	/userid/feed?fields={from{picture.type(large)}}

Examples tested with Facebook Graph API > v2.0, using Graph Explorer and PHP SDK.

Continue ReadingGet Facebook comments with large user pictures

A glance at FOSSASIA Calendar API

I am a frequent user of popular social platforms API : Facebook, Twitter, Instagram.. Among others, Facebook Graph API is the API I’m most familiarized with, and despite its lack of documentation, Graph API makes me from time to time admire the engineering mind of those who built it. It’s simple, has a clear design, and communicates a consistent philosophy. I inspired a lot from it to implement Calendar API, a simple web service at FOSSASIA.

Why naming it API, and not web service ? I don’t know, I was always confused about the two, and as far as I concerns, they are the same. The only difference might be the word ‘web’ that tights web service to HTTP, and the scenario involving two distant machines, while API is somewhat more general (an API call of an in-app library for example).

This is my first time building a web service, and so far there wasn’t any technical challenge : it’s just simple & straightforward PHP script with echo $results; in the end. Mainly because the hard part is still ahead : getting people to know about it, and maintaining it while there are (hopefully) enough clients who care to yell at API developers when they do something wrong. The API I built supposed to parse the merged ics file of all communities event feeds, and expose it to users, in various formats, with filters and options.

Don’t worry if the last sentence doesn’t make sense. We’ll dive in the details right away.

There are currently two possible formats : .ics and .json. Users set the format with format parameter, for e.g. format=icsics format is suited for developers who want to import events to their calendar app / wordpress plugin. json format is for front-end developers who want to build a web / mobile web without the hassle of parsing ics feed.

A few filter parameters are possible to refine search results : source to filter by community, fromto to filter by events time, limit to limit number of events returned, and fields to custom select event fields. Finally, sort parameter is to order the results by certain criteria. Currently only datetime ordering (ascending or descending) are available.

As I said, the Calendar API is inspired a lot from Facebook API. Those are the ideas I pickpocketed from their design :

  • multiple values parameter. With source and fields, multiple values can be provided, separated using comma.
  • fields parameter. The motivation for event field filter is because the event has lots of different fields, and different users are interested in different information.

There is also the “linked edge” characteristic of Graph API that I find very interesting : connection between related data make them more useful. It is done that way mainly because the API reflects Facebook own data model, but there is nothing thats prevents unconnected data to be presented in a connected way. So I’ll hope to implement something similar for FOSSASIA Calendar API in the futur.

(Right now the API serves events from Freifunk community, not FOSSASIA, mostly because there are not enough event feeds from FOSSASIA community to collect. So if you want to help us, you can add ics feed of your open-source community to FOSSASIA API. Here’s how).

References :

Continue ReadingA glance at FOSSASIA Calendar API

Knitting Library to support numerous Knitting Machines

Hi everyone, I’m Shiluka Dharmasena, Computer Science and Engineering undergraduate from University of Moratuwa, Sri Lanka. Thanks very much for this great opportunity to get involves in FOSSASIA open source project and I’m keen to give my fullest contribution to the FOSSASIA.  For GSoC 2015, I am developing a library to support knitting machines. It’s great to work with FOSSASIA team under awesome mentors Mario Behling and Christian Obersteiner. This is the Initial suggestions for the project.

Library to support knitting machines

Basic abstraction of the library to create library as separate layers

  • Serial communication : open, configure, read and write to serial port
  • Machine definitions : machine initialization, load to machine, save from machine
  • Image handling functions : memory allocation, read image file, setter and getter for image pixels
  • File handling functions : read / write access
  • Common utility functions

Add dependencies for the library

There are several dependency libraries which ayab has such as pillow, pyserial, wsgiref, fysom and yapsy with relevant versions. These dependencies should be added to the library.

Functions for the library

For access hardware directly
* Identify existing libraries to interface with hardware
* Use libraries to deal with serial ports
* Ability to get all the functions via library (for an example functions in ayabControl.py and add more functions to support in more machines)
* Ability to send QT signals

Emulate file formats

* Create functions to emulate file format

Add Arduino support

Installation

Installation should be well documented in step by step. Additionally I suggest to add GUI based installation with usability improvements with standard installation procedures.

* Installation on Linux (32bit, 64bit)
* Prerequisites
* Setup
* Installation on Windows (32bit, 64bit)
* Prerequisites
* Setup

Tests on the library

Use a python test framework like unittest to test the python library. It supports test automation and aggregation of the tests into collection.

Documentation of the library

Documenting Class definitions, methods definitions and links to the given source codes.
Continue ReadingKnitting Library to support numerous Knitting Machines

searchQuick Apprise: TWO #GoogleSummerOfCode #FOSSASIA

banner-gsoc2015.png.pagespeed.ce.1-XG35qq3R8SQJ5DGgL9

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.

header



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)

LATEST MOCK UP OF GUI FOR sQuick

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.

UPCOMING:

  • Completion of GUI development
  • Commencement of Index build

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


Continue ReadingsearchQuick Apprise: TWO #GoogleSummerOfCode #FOSSASIA

Starting with Smalltalk, Pharo and Spec

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.

GETTING THE BASICS CLEARED

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.

INSTALLATION GUIDE

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.

RESOURCES

Visit http://pharo.org/documentationto to get more resources to study from.

INTERESTING READS

 

Continue ReadingStarting with Smalltalk, Pharo and Spec

searchQuick Apprise: ONE #GoogleSummerOfCode #FOSSASIA

banner-gsoc2015.png.pagespeed.ce.1-XG35qq3R8SQJ5DGgL9

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.

header



In the inceptive coding period of this project development the tasks achieved are as:

    • Designing the basic graphical user interface using Morphs in Pharo 4.0. The morphs elements utilized to make the interface elements included:
      – TextMorph for labels etc.
      – PluggableTextMorph to display the contents of the file
      – ImageMorph for background, header GIFs etc.
      – TextMorphForEditView to enter the search string.
      – SimpleButtonMorphs for creating buttons whose click will perform the desired action.
      – MenuMorph , MenuItemMorph to make the list of files available as ‘Browse’ menu.
      – DropListMorph to make a drop down list menu for the selection of languages.
    • Loading the files in the current Pharo image and making methods/classes that would directly access those files from the image and display their names as a menu list
    • Making a Metacello Configuration of the project for easy project loading in Pharo.
    • For further ease, the project configuration was directly added to the Meta Repo of Pharo 4.0 at SmalltalkHub.com and now the project can be directly loaded through Configuration Browser in Pharo 4.0

                  World > Tools > Configuration Browser > sQuick(jigyasa)

    • Removing the cache of the instance of the MainInterface so as to allow the users to open up many search/content windows simultaneously
    • Making of a content window that would display the file name and the file content when the file name is clicked from the ‘Browse Files‘ menu
    • Designing mock-ups for the UI for an enhanced user interface which include the latest search engine feel

mockup

UPCOMING:

  • Augmenting the UI for a pleasant user experience
  • Initiate working on the search tool / indexer build.

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


Continue ReadingsearchQuick Apprise: ONE #GoogleSummerOfCode #FOSSASIA