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.

samedi 30 juin 2012

Graph database: Neo4j

Neo4j  is a high-performance, NOSQL graph database with all the features of a mature and robust database. 
The programmer works with an object-oriented, flexible network structure rather than with strict and static tables — yet enjoys all the benefits of a fully transactional, enterprise-strength database. For many applications, Neo4j offers performance improvements on the order of 1000x or more compared to relational DBs.
A graph database stores data in a graph, the most generic of data structures, capable of elegantly representing any kind of data in a highly accessible way. Let’s follow along some graphs, using them to express themselves. We’ll “read” a graph by following arrows arond the diagram to form sentences.

vendredi 29 juin 2012

Introduction to Neo4j

Neo4j is an open-source graph database, implemented in Java.It is a part of the NoSQL movements. It is available in a GPLv3 Community edition, and  under AGPLv3 for the Advanced and Enterprise editions.
In this post we are going to see how to use the embedded Neo4j Community edition to manage graphs.

jeudi 28 juin 2012

Text to Speech in Android


To use the Android Speech to Text API you need to implement the TextToSpeech.OnInitListener interface. In the onInit() method, check the returned status to value, it ca be TextToSpeech.SUCCESS for initialization success or TextToSpeech.ERROR in case of failure. If the initialization succeeded then set your preferred language to US english (or FRANCE for french). 
Note that a language may not be available, check the documentation for more information.
Here is a complete example of how to use the Speech to Text API.
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import java.util.Locale;

public class MainActivity extends Activity implements TextToSpeech.OnInitListener {
 
 private String TAG = MainActivity.class.getSimpleName();
 private TextToSpeech mTts;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        
        setContentView(R.layout.main);
        
        mTts = new TextToSpeech(this, this);
    } 

 @Override
 public void onInit(int status) {
        if (status == TextToSpeech.SUCCESS) {            
            int result = mTts.setLanguage(Locale.US);            
            if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                Log.e(TAG, "Language data is missing or the language is not supported.");
            } else {                
               String text = "hello, do you hear me?";  
               mTts.speak(text,TextToSpeech.QUEUE_FLUSH, null);
}
        } else {
            Log.e(TAG, "Could not initialize TextToSpeech.");
        }
 }
}

mardi 26 juin 2012

LemonWash for Parrot's Asteroid Car Receiver

I had the chance to participate (and even win) to one of BeMyApp most great Hackathon week-ends that was about inventing the futre car and building Android applications to run on the first connected car receiver the Asteriod by Parrot.
During this hackathon (from May, 11st to 13rd 2012I was part of a team composed of three developers (including me), a designer, a community manager, and team leader. We developed LemonWach, an application for requesting car wash service.