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.

dimanche 24 juin 2012

Scaling Web apps

When we talk about scaling we can be running a program on multiple machine, storing huge data, managing the set of resources we are using to serve thousands users.
Well for serving more requests concurrently and faster, to store more data (your data may not fit in one machine or database), and to be more resilient to failure for example replicating your database or your running program.

Displaying information on maps

MappedTweets is a demo that uses Google AppEngine (Python SDK) to pin latest Twitter posts on a CloudMade map with server side scripting in Python. 
Two external APIs are used, one for submitting search queries to Twitter via its  Search API, another one for displaying map and geocoding CloudMade API.

The html map page reads the tweets data using a JSON format feed created by a Python script. Updates are made using HTML forms with Python scripts handling the HTTP POSTs to search for latest tweets.
The project code is open source, it can be found here at github.
Here is the demo itself. You can find here another GAE demo of displying and searching for information (herein images) on map.

samedi 23 juin 2012

Using Twitter Search API

Twitter Search API allows us to run searches against the real-time index of recent Tweets. 
Here is sample Python code showing how to search in twitter without using any Python third party library like twython, tweepy, python-twitter, tweetstream, etc.
Twitter search URL is http://search.twitter.com/search.format we will be using json as format for requested data.
import urllib
import json
query = "euro+2012" 
lat = str(37.781157)        
lng = str(-122.398720)
rd  = str(10000)
search = urllib.urlopen("http://search.twitter.com/search.json?geocode="+lat+","+lng+","+rd+"mi"+"&q="+query)
dict = json.loads(search.read())
for result in dict["results"]:         
    print result, "\n"
    print "*******************************" 
Printing result["text"] should give you the corresponding tweet message. To get the location from where the tweet was posted user result["location"].
You can get more information about the parameters (e.g. size of the returned result) to use in your search query here.

dimanche 17 juin 2012

Handling events on Android



In this post, we will see how to listen for some events (e.g. call related events) on Adroid devices in order to perform a certain action:




samedi 16 juin 2012

HTML5 versus Android



Native apps or mobile web? It's often a hard choice when deciding where to invest your mobile development resources. While the mobile web continues to grow, native apps and App Stores are incredibly popular. 
Reto Meier and Michael Mahemoff present at Google I/O 2011 both perspectives in an app development smackdown.


vendredi 15 juin 2012

Multi-path TCP invited at Google


MPTCP (Multipath TCP) is an extension of TCP to handle multiple paths between two endpoints. An IETF working group has recently been created to specify a multipath protocol for the transport layer.
MPTCP is designed with three major goals:
  1. Improve throughput: the performance of a multipat how should be at least as good as this of a single path how on the best route.
  2. Do no harm: a multi-path how should not take up any more capacity on any one of its paths than a single path how using that route.
  3. Balance congestion: a multi-path how should move as much tra c as possible away from the most congested paths.

Costin Raiciu one of people working in MPTCP at its early age, along with Christoph Paasch who is part of the team who made a Linux kernel patch for using MPTCP, they made a Google Talk for presenting MPTCP, the motivation behind, the design of this communication protocol and  its congestion control.

A project was made on NS-3 simulator for enabling researchers to study the behaviour of MPCTP transport protocol in different scenarios. Here is a link to the Google project hosting the MPCTP code. Also an active discussion group can be found here.

For further reading, here is a list of some publications on MPCTP:

dimanche 3 juin 2012

The long way toward getting CCNA


The Cisco Certified Network Associate (CCNA) certification is a very popular Cisco certification and covers skills necessary to administer Cisco devices on small or medium-sized networks. You can find here more information about Cisco Certifications including CCNA.


In these few posts, I will try to give the required knowledge to get ready for passing Exam 640-802 and getting CCNA certification.




I recommend to read the excellent book by Todd Lammle: CCNA Cisco Certified Network Associate Study Guide 6th Edition, Exam 640-802, 2007.

Configuring Ruby on Rails (RoR)

Here are the steps you need to configure your environment to start building Rails web applications:
      • Installing Git
      • Installing Ruby
      • Installing RubyGems
      • Installing Rails

Here are the steps you need to configure your environment to start building Rails web applications.

Installing Git

Rails ecosystem depends tremendously on Git a very powerful version control system. Git must be installed at first as you will see it every time you google any Rails package.
on a Debian-based distribution like Ubuntu, you have to type following instruction to install Git:

$ apt-get install git-core

You may find detailed installation instructions for your platform at the Installing Git section of the book Pro Git.

Installing Ruby

Next thing to do is to install Ruby, for this you need first to install Ruby Version Manager (RVM). RVM primary goal is helping you to install and manage multiple versions of Ruby on the same machine. Following are the steps for installing RVM on Linux, more details can be found in RVM Installation.

You need curl, if you don't have you can installed on Ubuntu by typing:
$ apt-get install curl
Then download RVM
$ curl -L get.rvm.io | bash -s stable
Load RVM
$ source ~/.rvm/scripts/rvm
Check requirements for installing RVM and follow the instructions:
$ rvm requirements
Finally, now you can install Ruby (1.9.3 is latest version)
$ rvm install 1.9.3

For Windows (using Cygwin) check this tutorial.

rbenv is another ruby sandboxing tool lighter and faster than rvm, you can use both in similar way.

Installing RubyGems

RubyGems is a useful package manager for Ruby projects that may save you a lot of time as there are many useful libraries (including Rails) available as Ruby packages, or gems. RubyGems should be automatically installed if you had successfully installed RVM easy once you install Ruby. You may use following command to check its availability:
$ which gem
/Users/mhartl/.rvm/rubies/ruby-1.9.3-p0/bin/gem

Installing Rails

Finally, we are ready for installing Rails framework and star building great web applications. Rails can installed as follows:

$ gem install rails -v 3.2.3

To check Rails installation, run following command to see version number:
$ rails -v
Rails 3.2.3

If you’re running Linux, you might have to install a couple of other packages at this point:

$ sudo apt-get install libxslt-dev libxml2-dev libsqlite3-dev # Linux only


You want to configure Ruby on Rails on a virtual machine based on Bodhi Linux 1.4.0 Stable which is a light distro based on Ubuntu 10.04 LTS. I may be useful to use configure_image.sh which is  configuration file that will install most of the things described earlier and other useful gems.
These are the instruction for configuring your vm and testing a sample web applications:

  1. Create a new VM with 256 MB RAM and 4GB HD (VirtualBox > New)
  2. Mount bodhi_1.4.0.iso as a live CD (VirtualBox > Settings > Storage)
  3. Install Bodhi Linux (VirtualBox > *your_VM* > Start)
  4. sudo apt-get update, sudo apt-get upgrade
  5. sudo apt-get install git-core (there's no git on Bodhi preinstalled)
  6. mkdir -p Documents (there's no Documents directory/folder by default)
  7. wget -O configure_image.sh http://pastebin.com/download.php?i=WTXF7g7F
  8. chmod +x configure_image.sh
  9. ./configure_image.sh (setups the necessary development environment ~ 2h!)
  10. cd Documents
  11. mkdir -p hw2_rottenpotatoes_2012 (for my fork of the official repo)*
  12. git clone git://github.com/saasbook/hw2_rottenpotatoes.git
  13. cp -r hw2_rottenpotatoes hw2_rottenpotatoes_2012
  14. cd hw2_rottenpotatoes_2012
  15. bundle install --without production
  16. bundle exec rake db:migrate
  17. rails server
  18. http://0.0.0.0:3000/movies 

Resources

You may have to look for other useful resources: