Hello, during the last weeks we have been working on Knitlib and Knitpat, a knitting machine control library and a standardized format that allows for exchange and storage of patterns.
In order to achieve a common platform for knitting machine development we have the need to abstract away implementation details that can difficult the generic usage of the lib, while keeping extensible and powerful control features. Among the most important abstractions developed for Knitlib is the Knitting Machine Finite State Machine, an abstract representation of the procedures needed to operate a knitting machine.
The architecture of Knitlib allows for easy integration of different knitting machine plugins for varied use cases, hardware, and software protocols. All functions of the plugin are non blocking except for .knit(), which is blocking due to the physical interaction needed in order to execute this command. To ease usage and to enable more versatile behaviour from the .knit() function, without limiting the interaction facilities needed for operation, the callback infrastructure allows for blocking and non-blocking callbacks from the Plugin to the machine operator (the Knitlib client), such as Information, Warnings, Error Notifications or Mechanical Required Actions (moving spools, switches, needles, etc). Callbacks abstract away the notification and interaction paradigms from the plugin, allowing for simpler behaviour, a more elegant design and ease of testing. Callbacks also allow for future plugins to not take care into implementing user interfaces, but to focus on functionality.
The pending remaining challenge is to standardize configuration options, flags and settings in order to allow for UI that respond to each plugin requirements and options, and to specify which features are supported on each machine plugin. Insofar, most of the standardization has been done on Knitpat, but some specifications such as physical resource assignation (Serial Ports, input streams, etc) are still to be implemented soon.
Thank you, and I hope this article helps you to understand the software architecture and design patterns of the implementation of Knitlib.
Well. I’ve been selected for GSoC under organization FOSSASIA and I am working on the project sTeam Collaboration platform, mentored by awesome guys Martin and Aruna.
It is mid term already and as planned I am half way through the project. If you haven’t seen my past blogposts, go check them out to get clear idea of the project.sTeam is a document based collaboration platform. There is already an existing web interface for the platform. Interestingly REST APIs are being developed for the same and we planned to rewrite the web interface with AngularJS and make calls to the REST APIs.
bower for easy management of external modules. There are a lot of sub modules which are to be loaded and are not part of the angular itself. Though, some of the modules are bloated. The unnecessary files will be removed by using bower prune task with gulp.
angular-ui-router for handling deep nested routes. Interesting thing is, angular-ui-router works on state based concept and is very handy to maintain and route to certain state.
angular-ui-bootstrap gives us easy to use, clean and responsive UI blocks.
angular-local-storage We use it for saving the user’s login credentials and are sent to the API with every REST based call. This would be changed in future and session maintenace should be developed.
textAngular is lightweight and two way bound WYSIWYG Text Editor for handling plain text files. It can also handle source code, markdown, etc ..
ng-audio and ng-video for viewing audio and video files respectively.
login and workarea are two base templates. And the router loads one of these based on the login credential value stored in local storage.
With workarea as base template, at this level, two nested views. Groups, which displays the groups which the user is part of and Private, where the user’s private documents are displayed.
The options view has various options like, permission management for the current level, copy, link, etc.. and also create room and document modals.
comments view fetches the comments for the current path. It is hidden if no permission to comment.
loginCtrl for passing the credentials to the API, authenticate and parellely store them in localStorage. And all the other calls will use the stored value along with its payload. You know, REST is stateless! Session management is scoped to the API and is planned for future.
handler has functions for CRUD operations on the API. The functions do GET, PUT, POST, DELETE, .. on the passed paramater (which is the path to the room/document) and will return the value.
router handles the routes. It has base states with views loaded into each states with its own templates and controllers.
The run methods load are used for state change control.
workareaCtrl handles the scope for options loading and current level display in breadcrumb.
workspaceCtrl fetches and controls the main workspace which has the rooms, documents and containers displayed.
config has the hostname where the sTeam is deployed and change here is reflected systemwide for easy deployment.
Note: The project is heavily under development and things might break.
Sign-up API is not implemented yet. Find some of the working screenshots below
The REST APIs are under development and a lot of features are yet to be developed. I have a brief listing of the yet to be developed APIs and the list grows eventually as we figure out something is missing.
My FOSSASIA project is taking a big transitioning step from the starting plan. In milestone 3 and 4, rather than focusing on statistical retrieval and API documentation wepapp, my mentors – Mario (@mario) and Andreas (@andibraeu) are guiding me towards integrating fossasia api data in other services. The main goal remains the same though : getting more people to use and to know about the API.
Integrating our set of data into external services can be tricky, but this is also what makes the task so exciting. Currently, we’re already started the integration process into loklak, a distributed searching & harvesting server. You can find out more about loklak via their well detailed about page. But the plan doesn’t stop there. We’re targeting popular web platforms : WordPress, Drupal, Github Pages.. so that users can access our data with ease, and use our services / plugins in their websites within simple steps. That would be a big win for us, so I’m very impatient to get going with the code to brings these ideas to life.
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.
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.
Pixelated pattern can be generated from available yarn colours that used for knitting.
Cropping tool for load necessary parts from the pattern.
Rectangular/Free Hand selection of loaded pattern.
Editing colour details of a selected area of the pattern.
Drawing tool for the loaded pattern. 
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.
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 :).
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.
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.
I 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.
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 🙂
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 :
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.
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.
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.
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.
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 method makes a simple button using Morph adds label and control to it.
The open method defines as to how the game/TicTacToe class would open. Here we have defined it to open in a dialog box.
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.)
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.
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.
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.
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.
A subclass TicTacToeModel is defined in the Matrix class with filledCellCount , currentFill and winner as the instance variables.
This initialize methods defines that initially no cell in the grid is filled and there is no winner as of now.
The updateRowAt: Col: method takes two arguments r and c used to update the currentFill and filledCellCount variables.
The method checkWinCondition is self explanatory. It is used to check if we have a winner or not at every move.
Now , we have made the game. To open the game , simply execute the following in the playground/workspace.
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.
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 :
There are other use cases where this syntax applies as well
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=ics. ics 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, from, to 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).
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 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)
* Installation on Windows (32bit, 64bit)
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.