Rebooting at Randa

Hello,

Since LaKademy post, many changes happened, i will not tell you ALL my life, but here some points related to KDE and FLOSS. You can jump to my small resumé or directlly to Randa part if you want ;-)

First, here in Brazil, almost all universities and federal institutes (a kind of tecnical school) was at strike until some weeks ago. This mean that i still giving the class about development practices and now i am using the Rocs all days on the data structures class (we are talking about graphs);

Second this week (yesterday), i sent my master’s thesis. Now i have one less ‘worry’ and is just one more step (i must defend it in about one month) to get my master’s degree \o/

And the last one, at FISL (http://softwarelivre.org/fisl13) i met some old friends from kde-Brasil (Filipe, Sandro, Tomaz, Diogo, Melissa,…), Knut from Qt (this is the 4º year in a row that we met, and this year he dance a lot :-D ). Off course that i don’t forget about new faces, some designers (Iaina, Viviane, Julia and Bruna), Sebas, many new faces from Brazil (Daker and his crowed talk, André Loureiro) and many others. And how i will forget the Konqui? (and yes, i cannot resist to became Konqui)

Enough of personal experiences, let’s talk about KDE. :)

Just a small background about my life and KDE relationship

I start to colaborate to KDE in 2009. In 2010 i participated the GSoC. In 2011, my master’s course starts to take more time and i began to work as Professor at UNIPAMPA. I contribute very little that year.

This year i am back. I made a new plugin to Rocs (rooted tree data structures), fix some crashs and i still trying to involve my students with KDE or FLOSS (there is just one JJ in Nepomuk fixed until now. They are also contribuing to other small FLOSS projects). But, i feel that i can do more. Now that i finished my thesis, i will have more time to work on KDE. I want to revive the KDE-RS (our local group, an arm (or finger) of KDE-Brasil), give more talks about ‘How KDE and FLOSS can help the students in thiers homework’ and some talks in elementary schools about how the teachers can use all the power of our softwares (just a small point, here in Brazil, almost all school have labs running KDE, an ancient version 4.4, even 3.5 in some cases, but still being KDE :) ). We did that courses to teachers las year, was great and kde on windows(tm) was very helpfull (teachers isn’t used to Linux). To do this, i need to review my priorities. Used to be Master’s degree, now i want to Focus KDE again, and not only in Rocs, i want to spread my wings.

Randa meetings

To those that are arriving from Moon today and don’t yet read the news, friday starts the Randa Meetings 2012. As you can read in all these other blog posts, Randa is a SMALL village sorrounded by mountains, isolated from the outter world (but we will have internet access. It’s Magic! In my city, internet is a luxury :( ). One place like Randa is wonderfull to do intelectual work (like hack and planning).

I will attend to Randa this year, and it will be GREAT. First because it’s my first sprint outside Brazil (it’s not my first sprint, i participate from Akademy-BR and LaKademy). I will meet peoples that i only have contact by internet. I will know more about others KDE projects by it’s own authors, what is good if you want to fix a bug or even start to help the projetct. And last but not least, i will know europe (at least it’s airports :) )

I have some plans to do in Randa, most related to Rocs, other to kde-edu module:
-Create a ‘non-gui’ mode (or cmake target) to run batch tests in Rocs;
-Create a comparation framework to help professors to evaluate students works;
-Fix the annoying crash in Rooted tree (‘I hate my life’);
-Separate dynamic properties to use new type system. (create new type of property: ‘Global in Type’, or a better name);
-Verify with ‘kde-edu’ers, the unmaintained projects;
-Know more about others projects

The title of this post is what i’m felling. I will reboot at Randa and start a new upgraded system :)

This post was to be wrote some weeks ago, but i had many activities to do before leave to Randa (we are at and of semester on university so tests, works, many doubts from students,…). But, i love my life (i’m looking at you, Sebas :p )

As final word, i want to thank Mario and other organizers for theirs great job organizing this Randa Meetings, and also to every one that colaborated (or that will colaborate) with our Pledgie. You still have time to donate, so if have conditions, please support the KDE Hackers to enhance our so loved KDE.

LaKademy Day 0 and Rocs

Hello people,

First, i was a bit away of blogs (near a year now), but not away from KDE.

At the end of the last year, I and my wife (a newcomer here in LaKademy), started to work as teachers. A good way to spread the FOSS among students. As result of being teacher, i wrote a new plugin to rocs, the Rooted tree data structure to teach trees to my students. Also, in this period, i am giving a class about development tools and good practices (all using FOSS tools and communities as examples). I hope to see some patchs in KDE’s review board from my students.

The rooted tree plugin was presented to other students (another class) and they like a lot (they can ‘see’ the pointers), but i will talk more about it in another post (maybe with some photos).

Well, as you all should know (unless you live in another planet), today LaKademy started, here is some pics http://t.co/PL70O7a0 and http://t.co/PL70O7a0 .

Today i moved the Rooted tree plugin, that was in my scratch repo, to rocs source, so give a try and tell me what you think. There is a example script that implements a simple BST (with rotation, search and insert).

Well, our day started at 8:00 and we still have some hours of work, so I still working in some tests cases.

Bye for now!

LaKademy Logo

KDE on FISL 12

Hello people
We from KDE-Brasil (or Brazil to foreigners) will be at FISL 12  as user group.
Also, i will give a talk about free softwares in education (Thursday, 30 at 12:00 – “Softwares Livres na Educação”) where i will present KDE-EDU’s softwares.
if you are in Porto Alegre this week, come talk about KDE or anything else with us :)
See you there

=-=-=-=-=
Powered by Blogilo

Linked List of Rocs

Well, long time without post in planet ( sorry ppl :( )

So, let me make a little resumé of work in Rocs during this winter (yeah, is winter here in Brazil) :

  • Rocs now can use the existing scripts ( first step to KGHN :) );
  • Rocs now can open/write Dot (graphviz), KML and GML files;
  • Rocs support data structu plugins (for now graphs and linked list);
  • Rocs receive some minor improvements like support multiple opened documents and execute a script after load a  file (bonnus :) );

below  is a video that show Rocs starting from a graph, then converting  to a linked list, add some nodes and link then. Of course, that not only  using mouse, but also with the script (that is the final objective).

The script in this example is a simple one that walk over the list to the end and add the new node to end.

list = graphs[0]
var n = list.createNode("NewNode")
var prev = list.front();
while (prev.front()  !=  0){
   prev =prev.front();
}
prev.pointTo(n);

As you can see, when we are using linked list plugin, the API of script is diferent from graph API (no make sense we have front(), for instance, when we are working with graphs). A data structure plugin use as base a graph struture to avoid extra work to create a new plugin. To create a new data structure plugin, developer write need write only 2 classes: the plugin it self and a base of data structure as show bellow (some code like constructors and code to kservice was removed to make it short):

class TreeDSPlugin : public DSPluginInterface{
  Graph* changeToDS ( Graph* graph) {
     return new TreeStructure(*graph);
  }
  Graph* createDS ( GraphDocument* parent ){
     return new TreeStructure(parent);
  }
};
class TreeStructure : public Graph{
 Edge * addEdge(Node* from, Node to){
   if (from->out_edges().count == 2){
     from->out_edges().at(0)->self_remove();
   }
   return Graph::addEdge(from, to);
 }
};

The first class is only a class to provide a library to load at run time ( using kservice ) and build the objects using a specific data structure class. To present a small example, the data structure plugin in second class is a binary tree and the method overwrited is addEdge(), to ensure that a node has only two childs. But this example provide only this basic behavior, no providing any new methods to be used in scripts, no graphics items to be drawn nor new itens to properties windows.

The data structure system, was developed to make easy to write new plugins (few code to be write) but also it can be very powerfull, allowing the new plugins to provide extra methods to be used in scripts, own graphics item (take a look in video to edges), and extra itens in properties window. See images bellow:

All this code is allready in Rocs’ trunk and i’m working now in some details like removing not used members and some refactoring (Graph should be called as BaseDataStructure or something like this). if you want to try it and create you own data structure plugin, ask me how to begin.

Near of the end (not yet de GSoC)

End of semester sucks! End of the last semester sucks^2! This week i’ll drop my final paper and after it (friday) the things will start to move faster^2.

Last week, i took a look at kgraphviewer to see how it implements the parser. At first glance, kgraphviewer have a complete parser for dot file. In next weekend (after drop my final paper), i will take a good look in kgraphviwer to see what i can use and try to create the plugin to open dot files.

I want to thank to every comment in my last post (including the one about the post title )

Now back to Kile and the final touchs in the final paper

A weekend full of Lex / Yacc

As part of my GSoC, i have to build a plugin to Rocs read dot files (graph files from graphviz, so i start it in this weekend.
.dot files have a singular format, it’s not a xml and can have a kind of complex structure (a graph can have nodes, edges, subgraphs, edges like nodes and also graphs, can have 0 or more properties, a graph also can be a digraph and as basic types we have integers, strings (quoted and not) )

First, i need the grammar to this file format. The first one that i found is here, is a simpliffied grammar but have all the basic graph representation. A complete grammar, can be found in graphviz site but, in this first version i will use the first one, so when all the stuff is running, just will need to update the grammar.

Ok, at that moment i got the grammar, but how parse a file? at university i’m having a class about compillers and talking about predictive parser, that can be used to read this file, off course, will need a great job to write the parser and will need a lexical analizer. Until saturday’s morning that was the plan, and now i see that i will lose many days with that.

‘What a waste of time’ i thought. Someone must have gone through it and must have writeen a tool for that. With a little more of search, i found the couple lex/yacc (replaced in GNU by tools flex/bison), and what couple!
To those that don’t know what is lex/yacc:
lex generate a lexical analiser following regular expressions defined by user;
yacc generate a parser following some user’s grammar.
and we can use the results from lex as input of yacc, making all the nasty work of writing lexer/parser.
But lex/yacc are complex (and complete) tools, i will not explain how it work, but you can take a look in this tutorial , but i will show some pitfalls that i found in my way. At end i will show a lex/yacc running up CMake to generate files to be compiled by g++ compiler (lex/yacc generate a C code).

REGEX order:
To this lex input file

[a-z]+ printf("Found a word.");
graph printf("Found the 'graph' word.");

‘graph’ will be considered as a word. Lex folow the order of it input file. Exchange those 2 lines to

graph printf("Found the 'graph' word.");
[a-z]+ printf("Found a word.");

‘graph’ now is considered the graph word.

Use C++ in parser
Who use c++ for a time get adicted to it and refuses to use other language (including c ), but yacc and lex generates c codes, so how we can use our beloved C++ in parser? simple, insted of generate a file with c extension, we generate a file with cc (or cpp, c++) extension (as the same to header file generated by yacc). The content of file will remais the same, but now gcc will treat as c++ source. Just it? you may ask. Off course not! if you do it and try to compile you will got a lot of undeclared functions.

a workaroud presented in the first reference is to embrace all function declaration into an ‘extern “C” {}’ in the yacc input file (file.y), like this:

%{
#include
#include "DotParser.h" //My include with c++ code

extern "C" {
void yyerror(const char *str){
fprintf(stderr,"error: %s\n",str);
}
int yyparse(void);
int yylex(void);
int yywrap(){
return 1;
}
void myFunctionToParseFile(){
printf("Doing something!\n");
yyparse();//start parse
}
}

%}
%%
GRAMMAR
%%

and in the lex input file (file.l) also need some love:

%{
extern "C" {
int yylex(void);
}
#include "y.tab.hh"

%}
%%
[0-9]+       printf("NUMBER");
%%

Using CMake to glue all the things
Here Andy explain how to generate files with lex/yacc. I found some errors (maybe by outdated). Changes are in bold:
# Create target for the parser
ADD_CUSTOM_TARGET(FooParser echo “Creating parser.c”)

# Create custom command for flex/lex (note the outputs)
ADD_CUSTOM_COMMAND(
SOURCE ${Foo_SOURCE_DIR}/src/lexer.l
COMMAND lex
ARGS -o${Foo_BINARY_DIR}/src/lexer.cc
${Foo_SOURCE_DIR}/src/lexer.l
TARGET FooParser
OUTPUTS ${Foo_BINARY_DIR}/src/lexer.cc)

# Create custom command for bison/yacc (note the DEPENDS)
ADD_CUSTOM_COMMAND(
SOURCE ${Foo_SOURCE_DIR}/src/parser.y
COMMAND yacc
ARGS -d ${Foo_SOURCE_DIR}/src/parser.y
-o ${Foo_BINARY_DIR}/src/parser.cc
TARGET FooParser
DEPENDS ${Foo_BINARY_DIR}/src/lexer.cc
OUTPUTS ${Foo_BINARY_DIR}/src/parser.cc)

# Add parser.c to the list of sources
SET(Foo_SRCS ${Foo_SRCS} ${Foo_BINARY_DIR}/src/parser.cc ${Foo_BINARY_DIR}/src/lexer.cc)

# Since parser.c does not exists yet when cmake is run, mark
# it as generated
SET_SOURCE_FILES_PROPERTIES(${Foo_BINARY_DIR}/src/parser.cc GENERATED)

# Include binary directory to include lexer.c in parser.c
INCLUDE_DIRECTORIES(${Foo_BINARY_DIR}/src)

with this, now i have mylex/yacc files compiled along my sources. Now is just fill up the grammar with the OO codes and merge with rocs source. When i merge with the rocs, i will not use cmake to generate lex/yacc files, i will commit the generated files only, avoiding to user that will compile the rocs to depends of lex/yacc. I am now used this format to move from me to CMake this whole set of commands.

Rocs’ include system – include (firstPost.js)

First sorry people by my late in report something in GSoC, but now i have some results to show to you.
This is my first post about GSoC with some progress, here i will describe a little of the include system in development.
The idea behind Rocs’ include system is to make the user capable of reuse the algorithms without copy paste (this make a simple algorithm file become huge and is not guaranteed that a method is the most actual).
To over with all this copy/paste and update all the files with some method, we bring to you this feature.

Now just put your algorithms in a directory and tell to Rocs where is it and just:

include ( my_file.js)

and you got it! all that methods and algorithms very useful :)

Now to the questions:

How Rocs know where is my files?
To make more confortable to user, he/she just say to Rocs to seek in some directories, like /home/homie/JsScripts;/other/path/.
Rocs will search in that two folder. now beyond: If you saved your working script in other directory, Rocs wiil seek first in directory of your plugin and, only if not found the file in that directory, pass to other in list.

And if some of my files have cyclic includes?
Rocs make a deep first search, avoiding clycles (if exists) for instance if:

a.js includes -> b.js and b.js -> includes a.js

only b.js will be inserted in a.js

Inseted?!, what you mean?
Yeah, Rocs’ script engine process only one file, so when you say include (foo.js), the content of foo is copied replacing the include line.

So, is it working right now?

Yeah, look the video above:

Just explaing a little ( i am new to kdenlive and recordmydesktop and the quality is far from good :( ) :
I have a script file in my home directory. First i need to tell to Rocs where it’s will search from files (for now i can put more than one directory separated by ‘;’).

After it i can call the plugin just by include (coloring_.js). In this case, this script do all the job (find the colors and pu the colors) but this can only walk by graph and mark the position of node in graph and after i write my own method to use this information and fill the colors.

But, i still have some issues, like:

  • Commented includes still being processed (inline comments is solved (if starts with // don’t process)). I should fix it in a couple of days (just remove comments before search for includes).
  • The screen to user inform the paths to seek for plugins is far from what i desire (i whant a list with an add, remove and edit buttons).
  • To include a file with the path (include (/path/to/file.js) need some love in it, but is working to full path.

Clustering plugin runnig in Rocs

Hi

As final paper in my graduation, i’m doing a survey in many clustering algorithms. Nothing better than visualize the results to find problems and take an overview of how ‘beauty’ is a solution.

To do it, i initially uses a interface build from scratch. But after today i will can do more than just overview the solution and some data like time taken, values of distances, i will start to interact with the result, doing analisys over the history of Solution construction. To make it possible, i write a first beta Rocs’ tool plugin that run my algorithms (writen in C++ because of speed thing).

I made a little video to show it running.

(sorry no .ogg for you :) )

This show the capability of Rocs that can be used to run algorithms that demands the velocity of C++using plugins and interact with the result with scripts.

To do it, i have made my personal classes to represent a graph and algorithms that uses its classes. So, my plugin is just 2 functions: one to convert Rocs’ graph format to my graph format and other to update Rocs’ graph from the solution of my algorithms.

Soon, i upload the plugin with algorithms and also make a tutorial of how you can do you very own plugin!

P.S. This plugin will not be shiped with Rocs :(

Akademy BR: Hacking with unknow friends

This is the end of the first day at Akademy – BR.  I met Tomaz, a guy that I already know ( just by mail and jabber ) and worked with me for
the last couple of months. At night we had a dinner and he started to talk how he pushed me to start KDE development.

I started using Qt 4.5, and one day  while I was looking for a tutorial or examples I found a text from him and his blog. I see something that I was thinking to implement by months, but never had the know how to do it: A Grpah IDE, the “Rocs” project. Programmed in C++ and using JavaScript for interaction! I think in that moment I had to know more about both. ( Tomaz and Rocs )
Time passed by, Live Blue was founded, and after FISL I decided to talk to him about how great Rocs was to me, at that moment I had a lot
of work and just followed kde-br list in read-only mode.
A few days passed, and I compiled Rocs and did some tests, reporting bugs as I found them, and asking for a few improvements, but no code
was made. I was still green at the time.
In december I said to tomaz that I was going to write some example scripts to be shipped with Rocs for tutorials and demonstrations, then
I found a bug using infinite loops inside of the script:  It froze the app. And what a end user should do when he finds a bug in the program? Report it! Well, in the next day there was an answer from tomaz in my e-mail:
“Do not fill a bug report if you can solve the bug.”
Well, that was a real needed spart to get me started developing Rocs. In the same day we talked about the problem and in a couple days I
send my first contribution to KDE.
So , today during breakfast,  i finally met the guy that sparkled-me to KDE Development. For now in Aka-BR we are hacking Rocs to solve some issues and also making some improvements.
I also met many others great people that helps kde each day, that I was used to see their names and texts in blogs and mailing lists,
let’s see how they look in real life. Keep tunned to news about Akademy-BR.

Pre-Akademy-BR Warmup

I’m in Salvador (Yeah!)

Bad news, it rains a lot since yesterday !

Good news, i meet some people from KDE-MG:

After that, we went to Praia do Forte, along with the remaining staff KDE-MG and Piauí.

After many Lady Gaga videos (ugh!) we arrive at hostel, time to a little rest and to remove some MS windows (mhua mhua mhua). To dinner we decide go to a near place.

Some more photos.

And stay tunned to posts about Akademy-BR

%d blogueiros gostam disto: