code
Category: code (8 posts) ![[RSS]](/xwiki/resources/icons/silk/feed.gif)
groovy (2)
javascript (1)
openremote (1)
xwiki (5)
Dec 17 2009
X10 Domotics With OpenRemote.org
My X10 integration patch made it through Open Remote B.O.S.S. 1.0, so I think I owe a blog post :)
Fun things first, here's a video demo of the whole thing :
X10 is an ancestor amongst domotics protocols. It is flawed by many ways and I guess pretty outdated if you are into modern domotics ; but it has two main advantages : it's cheap, and you don't have to re-wire your home. So that make it a good candidate for prototyping and experiments of all kinds. Which is exactly what I am using it for :)

Making OpenRemote talk to the X10 controller has been pretty smooth, thanks to Jesse Peterson's library. I guess next steps will be to support dimming commands, as well as status inquiring.
If you are interested in controlling X10 devices with OpenRemote, I've written a short HOWTO, you can read it here.
More OpenRemote fun on this blog coming in 2010 !
Sep 12 2009
XWiki + Groovy = ♥ : The 10 lines RSS aggregator macro
{{groovy}}
import java.util.TreeMap;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
def urls = [];
def entries = new TreeMap();
xcontext.macro.content.eachLine() { urls.add(it.trim()); }
urls.each() { rssUrl ->
def feed = new SyndFeedInput().build(new XmlReader(new URL(rssUrl)));
feed.entries.each() { entries.put(it.publishedDate, ["entry":it, "feed": feed]); }
}
println """|=Title|=Date|=Author|=Feed"""
(entries.keySet() as List).reverse()[0..10].each() {
def e = entries.get(it).entry, f = entries.get(it).feed;
println """|[[{{{${e.title}}}}>>${e.link}]]|{{{${xwiki.formatDate(e.publishedDate)}}}}|"""
print """{{{${e.author}}}}|{{{[[${f.title}}}}>>${f.link}]]"""
}
{{/groovy}}{{rssaggregator}}
http://feeds.feedburner.com/xwikicomblogen
http://feeds.feedburner.com/massol
http://feeds.feedburner.com/ludoblog
{{/rssaggregator}}May 10 2009
JavaScript Deprecation And Backward Compatibility Is Easy
The very nature of JavaScript makes it easy to implement such a strategy, and in our case no new framework is needed to help achieve that (although some exists, like jquery-aop). Prototype's Function#wrap comes to the rescue! As the doc says, it distills the essence of aspect-oriented programming into a single method, letting you easily build on existing functions by specifying before and after behavior, transforming the return value, or even preventing the original function from being called.For example, handling the compatibility of a method that has been moved from the global object to the XWiki namespace only takes the following:
/** Deprecated since 1.9M2 */
window.displayDocExtra = XWiki.displayDocExtra.wrap(
function(){
warn("window.displayDocExtra is deprecated since XWiki 1.9M2. Use XWiki.displayDocExtra instead.");
var args = $A(arguments), proceed = args.shift();
return proceed.apply(window, args);
}
);May 08 2009
Groovy Web Console In XWiki
The cool thing is that I know I will be using it for real by monday, on a project where I have large imports of data and images to run on a wiki.
The application is available for download on code.xwiki.org.
Mar 02 2009
XWiki At eLiberatica 2009
I will give a talk focused on enterprise usages of Application Wikis (Also known as "Second Generation Wikis"). My objective will be to attempt answering the following question :
Why, in 2009, you want to use an application wiki as foundation stone of your company's Intranet.Of course, this taking XWiki as an example (eLiberatica is all about Free and Open Source technologies), but the topic itself is generic.
Feb 19 2009
Why Working In The Open?
- "You get to work with the best developers out there". My take on this is that you'll find the same talented, maven, developers in the open and in the proprietary world, but it's probably easier and faster to get to work with them in the open. And never forget Peter Norvig's advice:
"be the best programmer on some projects; be the worst on some others"
- "You are one of the happy few that work on sexy, cutting-edge, software". Well, same argument, I don't think proprietary software programming sucks by essence, there are a lot of sexy software there too ; but might be easier to find this in the open.
- "You get more exposure and recognition for your work". This one is harder to argue with, since working for an Open Source project really means _working in the open_, it's part of the deal. But… it's a double-edged sword ; and there are jobs in the non-open that gives the good exposure as well.
Feb 14 2009
A Saturday Hack I Could Not Resist To...
#includeForm("XWiki.BespinEditorExtension")