Archive pour la catégorie 'English'

WordPress As Back End For Posh Widgets and OpenSocial Gadgets

Mercredi 26 août 2009

I developed for percolab.com, under the supervision of my friend Yves Otis a framework that can generate interfaces for OpenSocial gadgets (Orkut, iGoogle), widgets (Portaneo Posh) and HTML.

The goal of this framework is to offer to Québec’s immigrants a way to show to others and themselves their abilities. These abilities are regrouped in activities, themselves grouped under broader terms like Practical Life, Learning French, Experiences, About Me, Working Outside Québec and so on.

The idea is for the immigrant to be able to edit a widget in Posh, or a gadget in Orkut or iGoogle that is generated by the framework. The same core templates are used to generate all the interfaces.

Here’s two examples:

gadget.orkut.png
gadget.igoogle.png

You will note that nothing is really styled or designed. This is an early stage of the project where the designers have not yet worked on the templates.

The framework is based on the marvelous CodeIgniter. Fundamentally, here how it works. Sorry, I’m not very good at modelling, but you will get the basic idea.

schema_simple_epimm.png

Ok, it’s much more complicated than that. I’ll post about it later because the framework use MySQL 5.1 XML capabilities as an almost free form database, where the all the values populating the forms are filtered using a mix of SQL/XPath, XSLT and jQuery, bypassing PHP to do this work. Basically, you drop a form in the framework, and it just work, you don’t have to write new PHP code to handle the values, you don’t need to modify the database schema, you don’t need to edit a config file for the database like in Rails.

To get back to my schema, the first request to the framework is done by a GET from Posh/Orkut/iGoogle, and then, CodeIgniter throw back at the host of the widgets/gadgets a chunk of XHTML where all interactions (create, update, delete )are done with Ajax. In a way, the widget/gadget contains a self-contained mini application.

Some activities are basically resources where the user does not need to edit anything. The only thing he/she can do to contribute is to comment about the resource and add some pointer to other resources on the Internet. Yves, being what he is, asked me, why not using WordPress, so, average people who are not programmers will be able to edit the resources and control/approve the comments? Since WordPress offer a nice interface that almost anybody can use, I plugged WordPress for some activities on the framework.

Here’s an example of an activity of the kind « ressource ».

The top of the gadget.

orkutdico1.png

The bottom of the same gadget.

orkutdico2.png

The content of this gadget is coming from WordPress, and the comment fields, while done in the template that generate the gadget are done in the framework, are hook to WordPress.

When for example, Orkut load this particular gadget, the framework do an XML-RPC request to WordPress using the WordPress XML-RPC API with the methods metaWeblog.getPost and get the content of a specific WordPress post related to the resource needed. The framework also does a request to get all the approved comments for this post with the method wp.getComments. Then the framework throws back the content to the Orkut gadget.

When a user press the button to submit a comment, the values of the comment fields are send to the framework via Ajax (gadget.io.makeRequest() on Orkut/iGoogle and jQuery/$.ajax with Posh). Then the framework does an XML-RPC request with the method wp.newComment to the WordPress blog. The comment is inserted in the WordPress blog, and an email is sent to the administrator to approve this comment.

Here’s another schema that shows what is happening. (Gee, I should really learn how to use OmniGraffle.)

schema_simple2_epimm.png

Letting the framework doing the XML-RPC calls to WordPress is the way to bypass the troubles you get with Ajax and the same origin policy. Also, it’s easier to program this way, than trying to do this from the Orkut gadget or Posh widget, because these kind of environments are quite hard to debug.

So, to sum it up, the user of the gadget never goes to the WordPress blog, she/he never knows in fact that we are using a WordPress blog. We post the comment anonymously, and set WordPress to accept XML-RPC requests, and also allow commenter not to be registered in WordPress.

There was a catch that I have too figured out how to post comment under the name of the commenter on WordPress. In fact the solution was provided kindly by Joseph Scott on one of the WordPress forums. The basic idea, is to leave blank the name and password of the owner of the blog (param 2 and 3) with the method wp.newComment and install a plugin that will implement a filter to allow XML-RPC anonymous comment.

Sylvain Carle will be guest speaker at an event on using WordPress beyond the blog. I’ll guess I will now have to attend :) .

Update (2009-08-27): This conf is just too expensive for me (300 $ to 400 $ for 4 hours).

Rami G. Khouri: Two opposing trends, the same failure

Mercredi 12 août 2009

Very good piece by Rami G. Khouri:

The clash between the colonialism of Israel and the incompetence of Fatah is one of the great tragedies of the modern Middle East, but like all such dynamics it does not pass unnoticed. The rise of Hamas and other militant Palestinian movements has been a direct response to both of these trajectories, an organic Palestinian determination to resist both the pain of perpetual occupation and the added pain of Palestinian complicity in perpetuating this condition.
(…)
The three strategies on show – Israeli colonialism, Fatah’s acquiescence, and Hamas’ resistance – all reflect short-term approaches that are unlikely to generate lasting, just solutions to this conflict, while inflicting more moral pain and physical suffering on all concerned. There are no easy exits from this corner, though the starting point for any movement toward more effective and mutually beneficial policies is to accept that current approaches have been universally catastrophic for all concerned. This lesson is especially relevant for external mediators who try their hand at peace-making.

Rami G. Khouri, Two opposing trends, the same failure, The Daily Star

Ken Brill: An Energy Paradox

Mardi 17 mars 2009

On the use and misuse of the Internet Data Centers. Some are so big that the power they use can power a small town. Ken Brill of the Uptime Institute talk about solution to lower their carbon footprint.

Ken Brill: An Energy Paradox, ITConversations, MP3

In praise of Frontier

Samedi 31 janvier 2009

oldfrontier2.gif

This is funny. Two peoples (Brent Simmons, Matt Neuburg) whom where involved with UserLand Frontier have built their own Web content management system inspire by it and won’t release the sources :) .

oldfrontier3.gif

Anyway, I have learned programming in Frontier a while ago (when Frontier was Mac only). I must say that Dave Winer, Doug Baron and others have built an incredible system with Frontier, very sophisticated, and still very innovator even by today’s standard. UserTalk is a very elegant language, and when they introduced it, the web framework that was built on top of Frontier was prefiguring much stuff that we take for granted now. I must say that I learned a lot about MVC at that time (around 1996-1998). But it was not called like that.

I wish that Mark Aldritt of Script Debugger fame would took the Frontier source (now open source) and build a new Frontier for OS X only for scripting the system (the web stuff can’t be catch now when you have Ruby on Rails, PHP Code Igniter and others).

oldfrontier.jpeg

Amira Hass on Gaza

Vendredi 16 janvier 2009

Amira Hass: The earth shaking under your feet, clouds of choking smoke, explosions like a fireworks display, bombs bursting into all-consuming flames that cannot be extinguished with water, mushroom clouds of pinkish-red smoke, suffocating gas, harsh burns on the skin, extraordinary maimed live and dead bodies.

All of this is being caused by the bombs Israel is dropping on the inhabitants of the Gaza Strip, according to reports and testimonies from there. Since the first day of the Israeli aerial attack, people have been giving exact descriptions of the side effects of the bombing, and claiming that Israel is using weapons and ammunition that they have not seen during the past eight years.

Furthermore, the kinds of grave injuries doctors at hospitals in the Strip have reported are providing yet another explanation for the overwhelming dread inhabitants are experiencing in any case. It is precisely for this reason that Marc Garlasco, a senior military analyst at Human Rights Watch (HRW), has come to Israel. His mission: to examine whether the weapons that both sides are using are themselves legal and whether the use of them is legal.

Is Israel using illegal weapons in its offensive on Gaza?, haaretz.com

Khaled Diab on Gaza

Dimanche 11 janvier 2009

Khaled Diab: At one time, war for Israel meant economic paralysis and crisis, but was sustained by a mesmerising ideology, the fresh memory of persecution and a large array of potentially frightening enemies. But even with Israel as the undisputed regional military superpower and its former enemies falling one by one by the wayside, Israeli violence has risen significantly in recent years, especially towards the Palestinians.

This is partly because a durable peace with the Palestinians requires more fundamental compromises than with the Egyptians and Jordanians as a fair settlement raises issues that strike at the heart of Zionism. Another reason is that, after so many generations, conflict has not only become intrinsically interwoven into Israel’s social fabric, it has also become hardwired into its economy.

During the Oslo years, Shimon Peres – who favoured a « peace of markets » before a « peace of flags » – and the Labour party were backed by influential members of the business community who were lured by the peace dividend Israel could earn from a resolution to the conflict. But under rightwing stewardship in recent years, the Israeli economy has been profiting from its own and global conflict and insecurity.

In fact, for the past few years, Israel has enjoyed one of the highest economic growth rates in the world, and is still registering healthy growth even as western economies falter. Much of this growth has been fuelled by the high-tech « Silicon Wadi » sector, much of it security-related technologies, and arms.

Profits of war, guardian.co.uk

forward.com: Timeline: The Gaza Strip, From Disengagement to Operation Cast Lead

Vendredi 9 janvier 2009

forward.com: This timeline of events leading up to the war describes the tit for tat that took place in Gaza in recent years.

Timeline: The Gaza Strip, From Disengagement to Operation Cast Lead

Guardian: Obama camp ‘prepared to talk to Hamas’

Vendredi 9 janvier 2009

Suzanne Goldenberg: Richard Haass, a diplomat under both Bush presidents who was named by a number of news organisations this week as Obama’s choice for Middle East envoy, supports low-level contacts with Hamas provided there is a ceasefire in place and a Hamas-Fatah reconciliation emerges.

Another potential contender for a foreign policy role in the Obama administration suggested that the president-elect would not be bound by the Bush doctrine of isolating Hamas.

Obama camp ‘prepared to talk to Hamas’, guardian.co.uk

Amira Hass: Hamas executes collaborators and restricts Fatah movement

Jeudi 8 janvier 2009

Amira Hass: Executions are carried out secretly. In Rafah, for example, at least some of the victims were killed in a caravan erected in the area formerly occupied by the Rafiah Yam settlement, and the victims’ relatives were invited to take away the bodies.

Hamas executes collaborators and restricts Fatah movement, haaretz.com

Roger Cohen on Gaza

Jeudi 8 janvier 2009

Roger Cohen: The heroic Israeli narrative has run its course.

The Dominion of the Dead, nytimes.com