Knitting machine abstractions for Knitlib

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. Regards, Sebastian

Continue ReadingKnitting machine abstractions for Knitlib

GSoC 2015 with FOSSASIA – Mid-term report

TL;DR No Chicken Little, the sky is not falling. 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. Technology stack 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. Views 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. Controllers 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…

Continue ReadingGSoC 2015 with FOSSASIA – Mid-term report

API Integration

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. References : Loklak site https://blog.fossasia.org

Continue ReadingAPI Integration

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. 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. 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

How to create simply posts website in Flask framework?

I have used Django framework so far, but because of my participation in Google summer of code. We decided to use something new. It was Flask. And Now I want to share it with you. It is a microframework, which allows us in really short time create a nice app. I'd like to share my experience in this area to teach you how you can create an app. You will have a possibility to add, delete and update posts. First of all you need to install flask framework via pip in your command line: pip install flask Next step it will be prepare a files structures My structure of files looks: forms( will contain all form objects in our case only post form) templates will contain all app views(listing posts and possibility to create post) We want to manage posts, so we have to define database model Post in app.py. I only defined title and text fields.  Next step will be create a routes. The main purpose of routes is to recognize urls and execute actions. We need four methods to display list of posts(index), delete post(delete_post), add post(new_post) and update post(edit_post) That's all to run your first posts application. Additionally I attach link to project on github, where you can trace whole project code. Have a nice coding!

Continue ReadingHow to create simply posts website in Flask framework?

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.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…

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

Using Material Design for the Open Event App

This week I had the chance to go into more depth on the material design principles and I must say that the design itself is awesome. So, I got  started building the user interface of our event app. After looking at a lot of apps. I decided to make a recycler view list of cardviews. Cool right? Looks awesome too. I did this by put an imageview, relative layout and a linear layout in a linear layout. In the second linear layout I added the textviews for the position, organization. Finally the description textview was added in the relative layout. This is how I designed the card layout. Now for the recycler view of cardviews, I added cardview layout to the recycler view adapter to make the list of cardviews. I also wrote unit tests for the database this week as suggested by Mohit. At first, they were failing and since I didn't have any experience writing tests for databases, I wasn't able to debug them. So, I took help from mohit who ended up identifying the problems which was arising due to the singleton in the database. Apparently, You can't use singletons in a test because we don’t control the creation of the singleton object, as it is performed inside a static method. There is no way to mock the object in order to test the behavior of our method in isolation. So for now mohit has used dependency injection to make the tests work but I am working on a way to remove the injection. This is pretty much all from this week. Adios !!

Continue ReadingUsing Material Design for the Open Event App

Selecting a data API

As I had already mentioned in the earlier post as a part of our GSoC project we are making a framework that lets Event/Conference organisers easily generate their own Webapps and Androi Apps for the event. So the initial step was the concur on a data API. Because for the framework to work seamlessly for multiple events, all of them must be able the collate their data in form of a single API, so that the core components of the web/mobile app that display the data can be consistent. Fortunately, there existed already an effort to create a standard API for event data - the re-data API made by OpenDataCity for the re:publica event. While trying to remain compliant with the re-data API we started off with a simplified subset of it. Our API will have semantic versioning, and initially we are establishing v1 of it. So all API endpoints have the prefix /get/api/v1/ There is one top level /event endpoint that lists the basic info of all the events. If further details of an event is needed, we need to navigate into the namespace /event/<event-id>/ As you can see listed on your API docs here there are endpoints in the form of /event/<event-id>/sessions /event/<event-id>/speakers /event/<event-id>/tracks and so on, to return a list of sessions, speakers etc for the given event-id.

Continue ReadingSelecting a data API

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 ;) 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. 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…

Continue ReadingTicTacToe Tutorial #FunWithPharo