jeudi 12 juillet 2012

WebRTC: an introduction

WebRTC brings webcam access, p2p, and rich audio/video communication capabilities to the browser. In this talk, we'll give an overview of the WebRTC technologies available today, show how to build WebRTC apps, and discuss the potential this technology adds to the Web Platform.
With more than 10 years experience in audio/video communication, Justin Uberti is a tech lead on Chrome WebRTC team, he was behind Google+ Hangouts, Google Video Chat, and Gmail Call Phone. During Google I/O 2012, Justin gave a great talk explaining the features of WebRTC.

vendredi 6 juillet 2012

Jinja4j a template engine for Java

ANTLR is a powerfull tool for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. An important feature of ANTLR is that it has a sophisticated grammar development environment called ANTLRWorks that helps a lot when debugging grammars.

I tried to get started with ANTLR by building a Jinja-like template engine for Java which I called Jinja4j. Jinja is one of the most used template engines for Python. It extends Django's templating system with an expressive language that gives template authors a more powerful set of tools. On top of that it adds sandboxed execution and optional automatic escaping for applications where security is important.
The Jinja4j grammar can be found here. The project is open source, any pull requests for imporving the template engine are welcome. Code source can be found at github.

Debugging with ANTLRWorks

When working with the grammar under ANTLRWorks I was getting in the console erros like NoViableAltException and "no start rule (no rule can obviously be followed by EOF)". When I googled the error message, I found an intersting post explain that the problem. In fact Antlr was trying to identify the "start" rules (ones that can end with EOF) by looking for rules that are not used anywhere else in the grammar. So if you have recursion on the "start" rule ANTLR will promot NoViableAltException and the debug will fail. An thus, I added this rule page : html EOF; to fix the problem.

Another kind of problems I was getting is mismatch errors. This happens when for a given input word there are more than one possible token that can be created. Antlr prompt the identifiers of mismatched tokens that can be found in output/gramar_name.tokens file.

mardi 3 juillet 2012

Using Speech Input API

The Android SDK provides support for an easy integration of speech input into native applications. We need just to send out an intent RecognizerIntent (no permission is required) to call any available voice recognition service in the phone (e.g. Google Voice, Nuance Dragon API for mobile). Then, a list of recognized word is send back to the application which can capture them in the onActivityResult method.