Facebook Javascript API

The new Facebook Javascript API handles the following methods :

Core methods

  • FB.init : Initializes the library
  • FB.login : Login/Authorize/Permissions
  • FB.logout : Logout the user in the background
  • FB.api : Make a API call to the Graph API
  • FB.ui : Method for triggering UI interaction with Facebook as iframe dialogs or popups, like publishing to the stream, sharing links
  • FB.getLoginStatus : Find out the current status from the server, and get a session if the user is connected
  • FB.getSession : Synchronous accessor for the current Session (less overhead as the asynchronous access)

Data Access Utilities

  • FB.Data.query : Performs a parameterized FQL query and returns a FB.Data.query object which can be waited on for the asynchronously fetched data
  • FB.Data.waitOn : Wait until the results of all queries are ready

Event Handling

XFBML methods

Canvas methods

Some useful tutorials about the new Facebook Javascript SDK are listed hereafter :

  • Mahmud Ahsan on Thinkdiff.net: Graph api & javascript base Facebook Connect tutorial
  • Abu Ashraf Masnun on masnun.com : Using The Facebook Graph API with js-sdk : An explanatory Tutorial
  • timware on Hyperarts : How to Add Facebook’s XFBML Like Button & Social Plugins to Your Web Pages & WordPress Posts

A very useful development tool is the Test Console made available by Facebook.

IYOUIT – Share Life Blog Play

IYOUIT gathers data around users and about users. This data is called context. Context is centered on places user visit and people they meet and can grow to include all kinds of things that surround users.

IYOUIT is a mobile application developed in Python, and running on Nokia Series 60 phones. Its aim is to make it easy for an end-user to automatically record, store, and use context information, e.g. for personalization purposes, as input parameter to information services, or to share with family, friends, colleagues or other relations, or just to log them for future use or to perform statistics on their own life.

Personal context : Location – Place – Experience – Photo – Sound – Observation – Books and Products – Weather – Marker

ipconfig /release /renew

screenshot ipconfig

Sous Windows, la commande Ipconfig affiche toutes les valeurs actuelles de la configuration du réseau TCP/IP et actualise les paramètres DHCP (Dynamic Host Configuration Protocol) et DNS (Domain Name System). Utilisé sans paramètres, ipconfig affiche l’adresse IP, le masque de sous-réseau et la passerelle par défaut de toutes les cartes.

ipconfig /release
Envoie un message DHCPRELEASE au serveur DHCP pour libérer la configuration DHCP actuelle et annuler la configuration d’adresse IP de toutes les cartes ou d’une carte spécifique si le paramètre Carte est inclus.

ipconfig /renew
Renouvelle la configuration DHCP de tous les cartes (si aucune carte n’est spécifiée) ou d’une carte spécifique si le paramètre Carte est inclus.

Les commandes sont entrées dans la fenêtre Command Prompt de Windows. Le recours à ces commandes est notamment nécessaire sous Windows Vista pour configurer un lapin Nabaztag si on n’arrive pas à se connecter sur l’adresse IP 192.168.0.1. Comme indiqué sur les pages help de Nabaztag, la séquence de commandes

ipconfig  /release
ipconfig  /renew

règle le problème.

Playlist formats : m3u, pls, xspf and others

Last update : June 16, 2012;
M3U is a file format to store multimedia playlists. It was first used by Winamp. PLS does the same, but is a more expressive format than basic M3U, as it can store  information on the song title and length (this is supported in extended M3U only). With PLS version 2, playlists also include a PLS version declaration.

iTunes, QuickTime Player, Real player, Winamp, XBMC, XMPlay, VLC media player and many other programs play PLS files without any extra codecs.

Xiph.Org Foundation, a non-profit organization that produces free multimedia formats and software tools, created in 2004 the XML Shareable Playlist Format (XSPF, called spiff) for sharing the kind of playlist that can be played on every personal computer or portable device. The home of XSPF is the website xspf.org.

XSPF is supported by the DLNA server Seviio. The playlists handle not only audio, but also video or other multimedia files.

Google Text-to-Speech (TTS) support

Last update : 30 April 2011

On november 16th, 2009, Google announced on their official blog that english text-to-speech was added to the translation tools.  Google used eSpeak, which is an open source software speech synthesizer for this service.

In may 2010,  Google Translate added more audio translations languages, including Afrikaans, Albanian, Catalan, Chinese (Mandarin), Croatian, Czech, Danish, Dutch, English, Finnish, French, German, Greek, Haitian Creole, Hindi, Hungarian, Icelandic, Indonesian, Italian, Latvian, Macedonian, Norwegian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Spanish, Swahili, Swedish, Turkish, Vietnamese and Welsh.

The speech audio is in MP3 format and is queried via a simple HTTP GET (REST) request. For english, an example url is:

http://translate.google.com/translate_tts?tl=en&q=how are you?

The TTS web service is restricting the text to 100 characters and the service returns 404 (Not Found) if the request includes a Referer header.

December 3, 2010, Google acquired Phonetic Arts, a company specialised in speech synthesis. Phonetic Arts Limited delivers technology that generates natural expressive speech. The products include Phonetic Morpher,  Phonetic LipSync  and Phonetic Synthesizer. Phonetic Arts, formerly known as Tayvin 356 Limited, was founded in 2006 and is based in Cambridge, UK.  The Phonetic Arts technology generates natural computer speech from small samples of recorded voice and should improve the voice output quality of Googles text-to-speech applications.

Google does not only provide speech output tools, but also speech input tools (Voice Search, Voice Input, Voice Actions), mainly in relation with the mobile phone OS Android.

Version 11 of the Google Chrome browser includes the HTML5 Speech Input API.

An amusing application of the Google TTS system is the Google Translate Beatbox.

Errror-reporting in php

The error_reporting() function sets the error_reporting directive at runtime. PHP has many levels of errors, using this function sets that level for the duration (runtime) of your script. If the optional level is not set, error_reporting() will just return the current error reporting level. Some examples are given hereafter:

// Turn off all error reporting
error_reporting(0);

// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

PHP-Developers appreciate the 

// Reporting E_NOTICE can be good too (to report uninitialized variables or catch variable name misspellings ...)
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);

// Report all errors except E_NOTICE
// This is the default value set in php.ini
error_reporting(E_ALL ^ E_NOTICE);

// Report all PHP errors
error_reporting(E_ALL);

PHP-Developers appreciate SimpleTest, a PHP unit test and web test framework. The most recent version is 1.0.1 released 2008-04-08, available at SourceForge. JAVA-Developers are  familiar with JUnit, originally written by Erich Gamma and Kent Beck. SimpleTest Interfaces are similar to JUnit.

Mozilla Messaging : Thunderbird 3.1 with IMAP

Mozilla Thunderbird Mail Client

Mozilla is a global community of people creating a better Internet. As a wholly owned subsidiary of Mozilla, Mozilla Messaging organizes the development and marketing of email and messaging products encouraging choice, innovation, and opportunity in messaging on the Internet. Thunderbird, as a messaging system, is uniquely positioned as the tool that users can use to integrate as many of their communications as they want.

By combining an open architecture, a powerful extensibility and customization framework, and a person-centric perspective on communications, Thunderbird is a powerful yet enjoyable tool to help individuals manage their online interactions, whether that’s email, instant messaging, social networking messages, or other types of message.

Today, I installed version 3.1 of  Thunderbird on my PC running Vista.

The profiles are saved to C:/Users/username/AppData/Roaming/Thunderbird/..

To import the messages from my Windows Mail Client, I installed the ImportExportTools from Kosmos Website. This is done with the menu Tools >> AddOns in the Thunderbird Client. I added a folder “WindowsMail” under “Local Folders” with three subfolders Inbox, SentItems and DeletedItems. After installing the ImportExportTools, a new Menu Import/Export appears when right clicking on a folder tab. All .eml files in the Windows Mail Folder are imported, even with the option of including subfolders.

The Windows Mail messages are located at C:/Users/username/AppData/Local/Microsoft/Windows Mail/Local Folders/…

Finally I installed the freeware MozBackUp 1.4.10 to MozBackup, a simple utility for creating backups of Mozilla Firefox, Mozilla Thunderbird, Mozilla Sunbird, Flock, SeaMonkey, Mozilla Suite, Spicebird, Songbird and Netscape profiles. It allows you to backup and restore bookmarks, mail, contacts, history, extensions, passwords, cache etc.

I configured the Thunderbird Client to use IMAP (Internet Message Access Protocol ) for incoming messages. The current version, IMAP 4 revision 1 (IMAP4rev1), is defined by RFC 3501. IMAP supports both on-line and off-line modes of operation. E-mail clients using IMAP generally leave messages on the server until the user explicitly deletes them. This and other characteristics of IMAP operation allow multiple clients to manage the same mailbox.

Web-Sniffer : View HTTP Requests and Responses

Last update : October 21, 2016

HTTP Response Headers are just lines of text sent from the server to the browser before the page content. They are terminated with a blank line, after which the page content is deemed to begin. HTTP Requests are lines of text sent from the browser  to the server.

A very useful tool to check HTTP Request and Response Headers is available at the web-sniffer.net website.

A typical output of a HTTP Request Header by the web-sniffer is shown below :

HTTP Request Header

Connect to 80.90.45.105 on port 80 ... ok

GET / HTTP/1.1[CRLF]
Host: www.saraproft.net[CRLF]
Connection: close[CRLF]
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; 
rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1 
( .NET CLR 3.5.30729; .NET4.0C)[CRLF]
Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF]
Cache-Control: no[CRLF]
Accept-Language: de,en;q=0.7,en-us;q=0.3[CRLF]
Referer: http://web-sniffer.net/[CRLF]
[CRLF]

HTTP Headers are strings terminated by a CR (carriage return) and LF (Line feed) character (‘rn’ string). The order of header lines withing the HTTP header has no significance. Any header fields which are not understood should be ignored. A CRLF string after the last header is followed by the content part of the webpage.

Web-Sniffer is also available as free desktop app for Windows and Mac (version 1.0.0 Beta, Build 26, released on June 23, 2013).

Web-Sniffer App on Mac OS X El Capitan

Web-Sniffer App on Mac OS X El Capitan

ECLIPSE and TOMCAT (web applications)

Apache Tomcat & Eclipse Platform make a great Web development platform. Tutorials about this development environment are available on the following websites:

I use the Tomcat version 5.5.23 as localhost because this version is available on my hosted website provided by my ISP Visual Online. My Eclipse version is Galileo (3.5.2). The Java SDK is 1.6.

Web applications are deployed on the Tomcat server with a WAR file (which stands for “web application archive” ) A WAR file is a ZIP file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages that together constitute the Web application.

There are special files and directories within a WAR file.

  • The /WEB-INF/classes directory contains the .class files (servlets, …)
  • The /WEB-INF/lib directory contains the .jar files with the Java librairies
  • The /WEB-INF directory contains a file named web.xml which defines the structure of the web application

The main elements of the web.xml file are shown below :

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_ID” version=”2.4″ xmlns=”http://java.sun.com/xml/ns/j2ee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”>

<display-name>MyExampleWebProject</display-name>
<description>Describe What the application is doing and add comments</description>

<servlet>

<servlet-name>MyServlet</servlet-name>
<servlet-class>saraproft.com.servlet.FirstApp</servlet-class>
<description>Une application très simple</description>

<init-param>
<param-name>size</param-name>
<param-value>123</param-value>
</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>echo</url-pattern>
</servlet-mapping>

</web-app>

The elements of a web.xml file are :

  • the name of the application : <display name>
  • the name, class and parameters of the servlet : <servlet>
  • the mapping of the servlet : <servlet-mapping>
  • context parameters : <context-param>
  • session parameters : <session-config>
  • list of index files : <welcome-file-list>
  • MIME mapping : <mime-mapping>
  • other parameters referring to security, errors, filters, …

The other files (html, jsp, iamges, …) are stored in the root or in folders located in the root of the WAR file. They can’t be included in the WEB-INF directory.