May 14

I have a problem: I don’t have enough mp3’s in my laptop. I use to listen music while I’m programing and I’m getting bored of them. So during last 3 or 4 months I’ve been listening music from youtube or last.fm.

Less than a month was enough to me to realize that I was losing too much time every day choosing next song so I tried something longer, I listening conferences and speeches.

Last week I made a post about git which contains a video that I re-watched after some months (Julipedia’s recommendation)

This time I dedicate this post to David and Ferran (DFWiki creators) who are designing and developing the new Moodle API and Webservices.

Here is a YouTube video from a Google TechTalk about designing APIs. Joshua Bloch is the speaker, the Principal Engineer at Google. He also led the design of numerous Java platform features as Java Collections Framework, java.math package and the assert mechanism. This guy knows about what is talking about…..

May 13

Ludo has created a new blog in this domain: Google at Barcelona?. He wants to initiate a discussion about why Barcelona must be chosen by Google to open a new office.

I’m going to add my opinion to this initiative, but first of all I would like to introduce I little bit my situation and the computer science labour market at Spain.

Few years ago I got my Diploma in Computer Software at FIB - UPC and now I about to get a Degree in Informatics Engineering. Last two years I’ve been working at university on the command of Ludo as a developer and researcher. I like to research, investigate and innovate with our software. I love to participate in this kind of projects, as a developer, as an analyst or as a designer.

At this moment, at Spain, the major part of the software companies are IT consultants. I don’t want to work in this kind of companies, don’t want to jump from project to project. When I start a new line of development I’m always very involved in it, I like to watch my applications grow and improve.

For all this reasons, several people that studied with me is staying at our Faculty, working at research groups and developing open source software. For instance, Juli is working at Computer Architecture Department and contributing to NetBSD project. Joan, with some friends, won a Business Ideas Contest and created his own company, Dexma Sensors. Jordi is the second classic adventure games fan in the world (I’m the first ;) ) and he is contributing to ScummVM project to add compatibility with mythical Sierra games (King’s Quests, Larrys, etc).

These are only three examples of people here in Barcelona that are doing great things. There are much more!!!

Marc said in his first post the following sentence:

Thinking about it, Barcelona is the favorite destiny of European Students in the Erasmus and Galileo programs (I don’t have the data, but I’m pretty sure ), the IT companies here are full of consultants from the north of Europe who choose to live here…

I’m able to add more people to the group that has chosen Barcelona. Few day ago I was listening the radio and I heard the news that Barcelona is the city of Spain with more congresses every year, more than Madrid or Valencia. Since the CCIB (Centre de Convencions Internacional de Barcelona) opened the number of conventions has risen very fast. You have to wait more than a year to reserve a conference room.

CCIB

This is another fact to take into account. Barcelona is becoming a center of research and knowledge and Google must be here! ;)

May 09

Here’s a video of Linus Torvalds talking to Google developers about git.

In my opinion it’s not the correct way to make a great advertising campaign:

  1. you can not insult a big sector of developers (cvs and svn users), and potential customers of your software.
  2. you can not say that you have developed the best SCM in the world in 2 weeks… You have an ego problem, Linus.
  3. what a horrible slides….

However, we are going to forgive him for that. He has created Linux, the greatest and biggest Open Source project. If he is using git in this enormous project and works fine, if because he has all the reason and git rules. During his speech, he does a good observation, you don’t need to branch very fast, you to merge very fast.

Apr 23

Two days ago Google announced the accepted student proposals list at their project home page. Yes, I’ve been accepted!! :)

I was at my weekly poker game when I remembered that April 21 was the Day. Staring at laptop screen instead of at opponents is not a good strategy in this game. Wasting 20 mins pressing F5, were enough to loose nearly all my chips. 2 or 3€ it doesn’t matter :) :D :) :D

SoC

It will be a great summer!

Apr 08

Today have been a strange day.

This morning I entered to my boss office like every Monday: we usually make the working planning for all week and also we meet some of his grad students that need help, orientation or (even) more work.

Today was a little different, we had a Campus project meeting at 9h. So we talk about weekend, music and finally about work (not too much). We also attended Gonzalo, he wanted to explain us last improvements that he have made to the WikiBook.

I don’t know what time was when we left FIB (at UPC north campus) to take the bus to the UOC buildings but I’m sure about one thing, we were late.

When we arrived to the meeting Pablo Casado was speaking about problems they faced during the implementation of OKI-bus and we discussed about the chosen solutions. After his speech, was Marc’s turn. He was supposed to talk about our implementation of Moodle gateway using OKI OSIDs, but he told about our next Moodle contribution instead. Moodle headquarters asked us to design and develop their new API and web services layer. It’s cool, it’s great, it’s exciting… but it was not the topic. It has a lot of relevancy on this project but it has not at same time… I love Marc, he can improvise a speech and liven up a meeting.

After having some coffee, Dr Chuck Severance one of Sakai guru guys talked us about IMS TI solutions. I was wondering what was going to say because I have never been in a meeting with him (nop, I’ve been in one few month ago but I had to leave to go somewhere). Some new ideas and people in these boring “official” meetings are welcome.

He was talking about how does IMS TI take 2 works when I started freaking out. He was explaining how great would be to convert Moodle into a IMS TI producer. Marc and I have been working in this idea around OKI during last year!! It can be possible… Using a hacked Moodle with our 3 modules to avoid new development and extra problems to fulfill our compromise with Campus project was the solution that Marc proposed to me some month ago. After a big effort of time and drafts I found the way to incorporate my boss idea without hacking Moodle core. We created some kind of OKI Compliant Activity Service Oriented Moodle. That’s the same that Chuck was explaining us! Ludo, you are absolutely brilliant.

After the meeting I have been talking with my boss and wondering how great would be to get a Google Summer of Code to develop something that people at IMS are designing. “Tomorrow I’ll ask Chuck if is he as interested as us to work together in this project” he said.

This evening I was in a bar drinking some beers with a couple of friend when my telephone rang. “Ooops, I’t my boss!” I said. “Do not respond” said one of my friends. I picked up it.

“I’ve been speaking with Chuck and you must go to SoC web page and apply for an IMS project, deadline for applications is in few hours!!” What!?!?! Now? So I got out my Vaio from its bag and booted my Ubuntu while I was crossing my fingers to find a wireless connection. When project application page was shown on the screen the first thing I saw was project abstract (2000 chars) and project description (7500 chars). Buff, “Waiter, another beer please, I’m going to be here for a while…”

I have nearly 0 documentation about the work I have done for Campus and I have heard about IMS TI about 3 or 4 times. Great, I had nothing to explain!! So I digressed along a plenty of lines about our work in Campus and in Moodle with NWiki and with Web Services layer. I suppose that my application would be an excellent example of rusty English and emptiness of content :)

In few weeks I will know if not to savor my beer was worth to it.

Apr 04

After deploying a new process I sure that you would like to run it ;)

It’s easy. First of all, you must create a new process instance:

        jbpmContext = jbpmConfiguration.createJbpmContext();
        processInstance = jbpmContext.newProcessInstance("processname");

Then you can initialize it by adding some variables to the process:

        contextInstance = processInstance.getContextInstance();
	contextInstance.setVariable("var", myVar);

To start it you have to send a signal to the process first token :

	processInstance.getRootToken().signal();

          
Apr 04

I’m glad to announce that I have just published a new Moodle activity.

This time I shelved NWiki project few weeks to design and to develop this new activity.

Most of you will know del.icio.us and I’m sure that some of you are using this service. So installing this module in your Moodle, you would be able to create mini-delicious activities inside your courses to do some kind of WebQuest.

Bookmarks screenshot

The main idea is that students search information about a topic using the World Wide Web and share whatever they find with their partners. Using this tool, links can be tagged and organized easily.

Currently our module is fully implemented and works fine, I have no reported bugs to solve. But there are some pending task to do: implement course backup/restore and add some evaluation method.

Backups will be implemented as soon as I have a couple of hours and grading tool must be designed. I suppose that a drop-down menu used to chose a scale value would be great (like in standard Moodle’s forum). I would take into account any suggestion.

Here is a link to the download page. Enjoy it.

Mar 17

Deploy a process via java program not using Eclipse interface is very easy. You only need to write this lines.

JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();

ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/xxx/definitions/yyy/processdefinition.xml");

jbpmContext.deployProcessDefinition(processDefinition);

jbpmContext.close();

It is very useful when you have to write a setup program for your application.

Mar 14

jBPM Task node

jBPM task nodes are designed to interact with users. The main utility of this kind of nodes is to treat forms data. When a process arrives to a task node, it waits until the required actor makes an action.

Task nodes are the most complex nodes, you will have to implement two handlers: one to assign the task to an actor and another to define this task.

Lets start with the AssignmentHandler.

Using Eclipse interface you can setup your task node as it follows, specifying where is your class.

jBPM AssignmentHandler

ExampleAssign must be something like that:

public class ExampleAssign implements AssignmentHandler{
....
}

Implementing this interface means that you will have to develop an assign method.

public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception;

Inside this function you will need to assign the current task(assignable) to somebody using assignable.setActorId(actor).

The responsibility of this method does not finish here. When you came into a task node, you will have to save all process state and variables to stop the process. You can not assume that the actor will be waiting for the assignment and neither you will want to wait until he logins into the application. System must continue running normally.

Calling this two functions you will save the execution context into database using Hibernate.

executionContext.getJbpmContext().save(executionContext.getTaskInstance());
executionContext.getJbpmContext().close();

Next step is to configure and develop a task controller.

jBPM task controller config

This class must look like this:

public class ControlExample implements TaskControllerHandler{
...
}

It must implement this two methods:

public void initializeTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token);
public void submitTaskVariables(TaskInstance taskInstance, ContextInstance contextInstance, Token token);

First one is used to initialize task variables, you can set default values or whatever you need.

Second one treat all task variables. This is the main function of the task nodes. Remember to invoke token.signal(); when all treatment is done.

Thats all, but you will be wondering how does it work, how can I wake up the sleeping process…

Somewhere in your program, in a from treatment function or in a button event, for example, you will have to make some extra work. You will need to identify the user and the process instance. Functions like:

 List l = jbpmContext.getTaskMgmtSession().findTaskInstances(user);

will help you. When you have the correct TaskInstance you will have to invoke ti.end();. This function will wake up the process and the associated state from database using Hibernate and call submitTaskVariables(). Workflow will continue normally at this point.

Thats all I wanted to explain of jBPM nodes. I’m not normally using Fork and Join nodes in my projects, so I will not write a guide for them. They are very easy to include in your workflows but if somebody ask for it, I will write a mini how-to.

Feb 15

jBPM mail node

jBPM mail nodes are simple nodes designed only to send mails. This time you don’t have to implement any handler or function, jBPM libraries provide nearly all you need.

In mail info tab you can set the destination e-mail address, the subject and the mail body that is going to send. This will be useful when you know destination e-mail address, orders@mycompany.com, for instance.

If you need to send mails to workflow actors, you can set a user variable in context:

executionContext.setVariable("user", workflowActor);

and configure mail info as it follows:

jBPM mail info

jBPM address resolver will check for user e-mail address from database and send him the mail, you will have to do nothing!

This is a great node but I had some requirements that it didn’t provide to me, so I re-implemented it, adding some new methods.

You can download new implementation here.

Now I can send mails using a gmail account. To explain it in a simple way, my implementation read some extra parameters from jbpm.cfg.xml file before sending the mail.

  <string name="jbpm.mail.smtp.host" value="smtp.gmail.com" />
  <bean   name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
  <string name="jbpm.mail.from.address" value="yourMail@gmail.com" />
  <string name="jbpm.mail.user" value="yourUser@gmail.com" />
  <string name="jbpm.mail.pass" value="yourPassword" />
  <string name="jbpm.mail.port" value="465" />
  <string name="jbpm.mail.smtp.socketFactory.port" value="465" />
  <string name="jbpm.mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory" />
  <string name="jbpm.mail.smtp.auth" value="true" />
  <string name="jbpm.mail.smtp.starttls.enable" value="true" />
  <string name="jbpm.mail.debug" value="true" />
  <string name="jbpm.mail.smtp.socketFactory.fallback" value="false" />
  <string name="jbpm.mail.advanced.config" value="true" />
  <string name='mail.class.name' value='FastSign.mail.Mail' />

If jbpm.mail.advanced.config is set to false it works as the original mail node. Setting it to true, activates the extra parameters. In this case, 465 is gmail port, I suppose you can change it to use other system. Note that you have to define mail.class.name with the correct package.

I hope this will be useful.