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 :


There are other use cases where this syntax applies as well

  • get comments of a feed
  • get feeds of an user

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

Continue Reading Get 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 Reading A 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 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)
* 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 Reading Knitting Library to support numerous Knitting Machines

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 🙂

Continue Reading searchQuick 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.


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.



Continue Reading Starting with Smalltalk, Pharo and Spec

searchQuick Apprise: ONE #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.


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



  • 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 Reading searchQuick Apprise: ONE #GoogleSummerOfCode #FOSSASIA

Calendario: Another JS calendar library

Calendario is a lightweight calendar library that I happen to find on the net. Their approach to calendaring solution is rather unique : it’s not a full-blown library like jQuery FullCalendar where everthing is ready to be used. With Calendario, calling init function simply generates plains html source code. The styling part is completely up to user.

Another plus is it’s lightweight (350 lines of code more or less). It’s easy to dive into the source and make advanced adaptations to specific use-case.

But what’s really remarkable is their examples. As I said the styling is out-sourcing to user, and they provide stunning examples that demonstrate how to do it. For me (a developer “designing” stuffs), readily beautiful examples are a crucial selling point.

But (there’s always a but..), Calendario is very poorly documented. A pointer to the same blog post all over again is not enough ! I was very confusing about how things work at first, especially about the data model. This blog contains what I found out (rather painfully) about Calendario library :


<div id="calendar_id"></div>

Available options

Option Purpose* Default
weeks weekday labels [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’]
weekabbrs weekday short labels [‘Sun’, ‘Mon’, ‘Tue’, ‘Wed’, ‘Thu’, ‘Fri’, ‘Sat’]
months month label [‘January’, ‘February’, ‘March’, ‘April’, ‘May’, ‘June’, ‘July’, ‘August’, ‘September’, ‘October’, ‘November’, ‘December’]
monthabbrs monday short labels [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’, ‘Jul’, ‘Aug’, ‘Sep’, ‘Oct’, ‘Nov’, ‘Dec’]
displayWeekAbbr display week short labels false
displayMonthAbbr display month short labels false
startIn 1
fillEmpty true
zone ‘00:00’
events [[‘click’], [focus’]]
checkupdate true
weekdays ‘MON, TUE, WED, THU, FRI’
weekends ‘SAT, SUN’
caldata calendar events data

Most of them you can safely ignore, I enlisted them all for the sake of completeness. Checkout the next section for interesting ones.

Option format


A list of json objects. The list’s keys and values contain following information :

  • key : the event date in MM-DD-YYYY format
  • value : an array of event values that occured on the given date. Each case of the array can have following fields :
Option Purpose Value type
content title of the event string
url Link to event page string
note added note for the event, will be included in the html as inside tag string
startday string, in MM-DD-YYYY format
endday string, in MM-DD-YYYY format
allDay true for all day event boolean


var events = {
	'06-06-2015' : [{content: 'Important Meeting at 4', startTime: '04:00', endTime: '06:00', note : 'Everyone please gather at Markketing Department'}],
	'06-07-2015' : [{content : 'First event of July 7', allDay : true}, 
	                {content : 'Second event of July 7', allDay : true}
	'07-01-2015' : [{content: 'All day event', allDay: true, note : 'So loongg !'}]

Wrap-up : Pros and cons of Calendario

  • Pros :
    • lightweight
    • fully customizable design
    • beautiful examples
  • Cons
    • poor documentation
    • lots of work undone, not recommended for those who want a powerful library that just work

That’s about it ! Found something wrong, or just want to help completing this unofficial calendario documentation ? Send me a PR here

*NOTE : this documentation is based on Calendario v4.0.0

References :

Continue Reading Calendario: Another JS calendar library

Knitting Web App FrontEnd with Pattern Editor Knitting Simulator

Hi everyone, I am Sameera Gunarathne and I am a computer science undergraduate of University of Moratuwa, Sri Lanka. This is the first time I have applied for the GSoC and FossAsia and I am quite excited to  give my contribution to FashionTec as it’s a whole nice new experience that programming is applied with real world applications in fashion and technology paradigm. I have selected for developing a Graphical User Interface which runs as a web application which is intended to provide a common platform to give input for the knitting machine firmware.

As the first step I had to research on the existing knitting applications that are available online commercially and what they provide as features that still need to be included in open source knitting applications. I have looked into both knitting pattern design softwares and knitting machine embedded softwares including knitbird, EnvisioKnit ,Stoll knitting software, ShimaSeiki SDS One Knit. The most significant feature I have noticed is the feature rich pattern editor provided with the software. They provide features like loading patterns from different formats(jpeg, png,gif,pdf), transform patterns(crop,replicate etc) to create new patterns, drawing tools to create a pattern from scratch, Provide colour palette with available yarn carrier colours, Saving and loading the work done by the user in the application storage etc.

Therefore in this GSoC period I am developing the assigned Web User Interface with consisting of following components.

Web App FrontEnd

  • Work Space + Pattern Editor
  • Knitting Simulator
  • Project Manager

Web App Back End

  • Web Client Server component(REST Api to communicate with knitlib interface)
  • Request Handler for back end logic
Screenshot from 2015-06-02 09:37:09
Logical Architecture Diagram

Knitting Simulator is used to simulate the knitting process through the user interface while the knitting is going on. It will display the carriage details, current knitting progress and a graphical simulation of the current knitting position of the pattern with row details. Project Manager component is to save knitting works as projects and load them later as the user preference.

The selected technologies for the project implementations are mainly JavaScript(node js for back end and angular js for front end implementations), HTML & CSS (render static content). REST Api for communicating with knit lib interface will be implemented in node js. The offline usage of the app will be implemented using Electron Framework.

This project consists of 4 milestones and under the first milestone I am working on the pattern editor features. Currently I have implemented loading different types of patterns into the workspace and pixelate them according to the number of rows and stitches allowed for the knitting. Following tasks will completed end of this week.

  • Identifying individual pixel in the grid as a stitch and add operations such as change colour, size etc.
  • Adding pattern editor tools for selecting pattern area, colour picker, crop-cut-paste tools for pattern replicating.
Screenshot from 2015-06-05 11:41:15
Current Implementation of Pattern Editor

I hope this GSoC will be a fruitful one to spend with a successful implementation of the knit web app and looking forward to provide a competitive open source knitting software at the end of the development :).




Continue Reading Knitting Web App FrontEnd with Pattern Editor Knitting Simulator

Simpler Control of Knitting Machines with knitting machine abstraction library and JSON based knitting file format

Hello everyone, my name is Sebastian Oliva. I am a developer from Guatemala and part of the team of students currently in Google Summer of Code ’15 working on Fashiontec. During last year’s GSoC I built a GUI interface for the AYAB project, allowing for easier control for knitting machines supported by AYAB (Brother KH-930, KH-910).

When I started getting involved with Fashiontec and FOSSASIA last year I was not aware of the large community related to textile and open fabrication projects. Since then, I have found many projects that have focused on different techniques and have had different approaches to fabrication and in particular the operation of knitting machines. Such as projects that emulate existing functionality of an existing machine, projects that entirely replace or enhance the machine’s inner workings, and projects that build machines from scratch.

Currently I am working on developing a knitting machine abstraction library and JSON based knitting file format that can enable the use of a single API to control a varied number of knitting machines. A knitting machine library allows us to create even more advanced software to control and operate machines, while a standardized and open format for knitting patterns allows us to create pattern collections such as the common pattern books usually shared by knitting communities, as well as enabling pattern editors and ecosystem.

Currently I am:

  • Working on designing and implementing Knitlib’s API design.
  • Writing tests for Knitlib’s desired behaviour.
  • Starting work on defining Knitpat, the open knitting file format.

I hope that this year’s GSoC brings a lot of advances to the machine knitting community, and I am happy to be a part of it.

Continue Reading Simpler Control of Knitting Machines with knitting machine abstraction library and JSON based knitting file format

Optimize React-Redux App

React is advertised as quite fast out of the box. In extreme cases when your app hits performance problem, you just have to optimize the re-rendering process by shallow comparing React props and state inside shouldComponentUpdatelifecycle function. The strategy for optimizing seems quite straight-forward.

However I found that this strategy is less clear in a React/Redux environment. Here are some advices that you should considering when dealing with your app performance:

Use Immutable data

This one should be a no-brainer with any React app. shouldComponentUpdate can only be useful when all the props can be shallow-compared. So as a rule of thumb, your components props can only be of 3 types:

  • Immutable
  • Primitive type (number, boolean, etc.)
  • Function type (e.g. callback event)

I didn’t mention how you should handle React state. That is because Redux uses a separate store as application state. But sometimes, you need to use both React’s state and Redux’s store. In that case, both props and state are shallow-compared so state elements should follow mentioned rules as well.

Do not use ownProps

When you create stateful components (containers) using connect function from react-redux library, shouldComponentUpdate is declared implicitly, so you normally don’t have to implement it yourself.

However the implementation of shouldComponentUpdate is such that if you uses ownProps in your mapStateToProps or mergeProps function, it will always return false, so the component will always be updated.

This means that if you want your component to be optimized, you can’t use information from passed props to get other information from the store. Why the implementation has to be this way is still unclear to me.

Avoid connect on frequently-called elements

connect function wraps the component inside another component with lots of decorated elements. These heavy overheads should be avoided on components that are called a lot in your application, for e.g. an element of a list.

Use Performance Tools

Finally, here are some excellent tools from the React team. Use them to identify the bottleneck in your React application:

Continue Reading Optimize React-Redux App