Friday, 12 December 2008

Merry Christmas Blog?

I don't know what happened...
But people are accessing this "almost empty blog" searching "merry christmas" or similar...

Friday, 28 November 2008

Ubuntu Linux x64

I am working on Ubuntu 8.10 x64 since 2 weeks ago.
This last release is something not comparable to other distribution I ever used.
Fedora Core 8 or openSuse could compete against it, but Ubuntu wins:
  • for the excellent package manager (synaptic)
  • because of the O.S. watches for user actions, always prompting the safest thing to do
  • for the ease of installation process
  • for gnome balance between performances and eyecandy stuff
  • because of derived from debian
  • ... much more!
What do you think about it? Let me know. Leave a comment!

Tuesday, 25 November 2008

When everyone would like to be a developer.

Some time ago, I was following the development of "Prince of Persia: Assassin's Creed" game.
An interview at GameTrailers.com caught my attention...
Impressive technical details, indeed...
Awful gameplay...
Jade Raymond as Game Producer...


What a Game Producer!

[UPDATE!] My access counter is listing this entry:
25.11.08 @ 15:24:48 Host ISP:Ubisoft entertainment - Canada

Tuesday, 11 November 2008

Context switching...

Thanks to my thesis supervisor, I received a proposal for a project involving Linux kernels, ARM SoCs (and maybe x86 systems) and Android Framework.
I accepted immediately, cause of this is another chance for working on something real.
Obviously, this time I'll work at a lower level. No Java but advanced C language and compiling options on Makefiles.
So, in future, there will be some posts containing some info about linux kernel, unix drivers and so on.

Wednesday, 29 October 2008

Assembly language

...

MOV AX, 0 ;is weird
XOR AX, AX ;is l33t

... is just an example, or ...

MOV AX, WORD PTR [BX]
MOV DX, 10
MUL DL ;is weird
MOV DX, WORD PTR [BX]
SHL DX, 1
MOV AX, DX
SHL AX, 1
SHL AX, 1
ADD DX, AX ;is l33t

... sigh!

I'll never win.

Thursday, 9 October 2008

Android Developers. Thread Opened.

I choose to open a thread regarding Sun JavaMail, JAF and Android.
I hope it would be useful for all developers whose encountered issues or difficulties using JavaMail on Android.
There were few troubles:
  • java.awt.Datatransfer class was missing (and related interfaces): they are available in the Apache Harmony SVN. There were some java.awt.Image dependancies, which have been removed.
  • The lastest Sun JavaMail API was not working on Android: at build time, the APK popped up an error within an IMAP class. I downloaded source code of it (now Sun JM is opensource) and I fixed some classes.
  • Sun JavaMail was working, but not at 100%: it was unable to manage Multipart elements of an email (so most of the email we receive). This API stored MIME-Types to/from Java Object association (a sort of mapping between them) in 2 files within the JAR file. Android is unable to read files in the classic way (due to security policy), so I decided to add the "MIME mapping" programmatically.
You can find the post on Android Developers here.

Wednesday, 24 September 2008

T-Mobile G1 is OUT!

First Android-based mobile phone has been released in US!
It will be sold from the 22th of October, priced 179$ (plus taxes and fees; two-year agreement required).
You can know more on this at www.t-mobileg1.com. Unfortunately, it will be SIM-Locked.
Some specifications:
  • 3.2" Touchscreen display (480x320)
  • QWERTY keyboard
  • GPS
  • 3.1Mpixel Camera
  • Qualcomm MSM7210A running @ 528 MHz CPU
  • 256MB ROM / 192MB RAM
  • GSM/GPRS/EDGE
  • UMTS/HSDPA (3G)
  • WiFi 802.11 b/g
  • Bluetooth 2.0 with EDR
  • microSD Card Slot
I hope Politecnico di Torino will buy some of these devices. I'll ask if there's a way for getting a G1 for me (I'll pay it, I swear).

Wednesday, 10 September 2008

Android Developers Google Group - A focus on ContentProvider

As requested here, I'm posting some example code for implementing a ContentProvider on which is possible to call openOutputStream and openInputStream.
My only question is: why must I store file path in a database field called '_data', if openFile implementation is programmer's burden?

ElementProvider.java

/*
Copyright (C) 2008 Luca Belluccini

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see
.
*/

package polito.mailandroid;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;

public class ElementProvider extends ContentProvider {
private static final String DATABASE_NAME = "poli";
private static final String DATABASE_TABLE = "elements";
private static final int DATABASE_VERSION = 1;
public static final String KEY_ID = "_id";
public static final String KEY_DATA = "_data";
public static final String KEY_MIMETYPE = "mimetype";

private DatabaseHelper mDbH;

private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
}

public void onCreate(SQLiteDatabase db) {
db.execSQL("create table " + DATABASE_TABLE + " (" +
KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
KEY_MIMETYPE + " TEXT, " +
KEY_DATA + " TEXT" +
" );");
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
onCreate(db);
}
}



public static final int ELEMENTS = 1;
public static final int ELEMENT_ID = 2;
public static final Uri CONTENT_URI = Uri.parse("content://polito.mailandroid/elements");
private static final UriMatcher URI_MATCHER;
private static HashMap
ELEMENTS_LIST_PROJECTION_MAP;
static {
URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
URI_MATCHER.addURI("polito.mailandroid", "elements", ELEMENTS);
URI_MATCHER.addURI("polito.mailandroid", "elements/#", ELEMENT_ID);

ELEMENTS_LIST_PROJECTION_MAP = new HashMap
();
ELEMENTS_LIST_PROJECTION_MAP.put(KEY_ID, KEY_ID);
ELEMENTS_LIST_PROJECTION_MAP.put(KEY_DATA, KEY_DATA);
ELEMENTS_LIST_PROJECTION_MAP.put(KEY_MIMETYPE, KEY_MIMETYPE);
}

public boolean onCreate() {
mDbH = new DatabaseHelper(getContext());
return true;
}

public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
String[] projection = new String[] {
ElementProvider.KEY_DATA
};
Cursor c = query(uri,projection,null,null,null);
c.moveToFirst();
String file = c.getString(c.getColumnIndexOrThrow(ElementProvider.KEY_DATA));
c.close();
File f = new File(file);
int m = ParcelFileDescriptor.MODE_READ_ONLY;
if (mode.equalsIgnoreCase("rw"))
m = ParcelFileDescriptor.MODE_READ_WRITE;
ParcelFileDescriptor pfd = ParcelFileDescriptor.open(f,m);
return pfd;
}

public Uri insert(Uri uri, ContentValues initialValues) {
if (URI_MATCHER.match(uri) != ELEMENTS) {
// !!!
}
ContentValues values;
if (initialValues != null) {
values = new ContentValues(initialValues);
} else {
values = new ContentValues();
}

if (!values.containsKey(KEY_MIMETYPE))
values.put(KEY_MIMETYPE, "plain/text");

SQLiteDatabase mDb = mDbH.getWritableDatabase();
long rowID = mDb.insert(DATABASE_TABLE, "notnull", values);
if (rowID > 0) {
if (!values.containsKey(KEY_DATA)){
try {
String filename = rowID + "";
getContext().openFileOutput(filename, Context.MODE_PRIVATE).close();
String path = getContext().getFileStreamPath(filename).getAbsolutePath();
values.put(KEY_DATA, path);
update(uri,values,KEY_ID + "=" + rowID, null);
} catch (Exception e) {
// !!!
}
}
Uri newUri = ContentUris.withAppendedId(ElementProvider.CONTENT_URI, rowID);
getContext().getContentResolver().notifyChange(newUri, null);
return newUri;
}
// !!!
return null;
}

public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch (URI_MATCHER.match(uri)) {
case ELEMENTS:
qb.setTables(DATABASE_TABLE);
qb.setProjectionMap(ELEMENTS_LIST_PROJECTION_MAP);
break;
case ELEMENT_ID:
qb.setTables(DATABASE_TABLE);
qb.appendWhere(KEY_ID + "=" + uri.getPathSegments().get(1));
break;
default:
throw new IllegalArgumentException("Unknown URL " + uri);
}
SQLiteDatabase mDb = mDbH.getReadableDatabase();
Cursor c = qb.query(mDb, projection, selection, selectionArgs, null, null, "_id DESC");
c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}

public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
int code = URI_MATCHER.match(uri);
int count = 0;
SQLiteDatabase mDb = mDbH.getWritableDatabase();
switch (code) {
case ELEMENTS:
count = mDb.update(DATABASE_TABLE, values, selection, selectionArgs);
break;
case ELEMENT_ID:
String id = uri.getPathSegments().get(1);
count =
mDb.update(DATABASE_TABLE, values, KEY_ID + "=" + id
+ (!TextUtils.isEmpty(selection) ? " AND ("
+ selection + ')' : ""), selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URL " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}

public int delete(Uri uri, String where, String[] whereArgs) {
int code = URI_MATCHER.match(uri);
int count = 0;
SQLiteDatabase mDb = mDbH.getWritableDatabase();
switch (code) {
case ELEMENTS:
// !!! REMOVE ALL FILES
count = mDb.delete(DATABASE_TABLE, where, whereArgs);
break;
case ELEMENT_ID:
String id = uri.getPathSegments().get(1);
// !!! REMOVE ASSOCIATED FILE
count =
mDb.delete(DATABASE_TABLE, KEY_ID + "=" + id
+ (!TextUtils.isEmpty(where) ? " AND (" + where
+ ')' : ""), whereArgs);
break;
default:
// !!!
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}

public String getType(Uri uri) {
String[] projection = new String[] {
ElementProvider.KEY_MIMETYPE
};
Cursor c = query(uri,projection,null,null,null);
c.moveToFirst();
String mimetype = c.getString(c.getColumnIndexOrThrow(ElementProvider.KEY_MIMETYPE));
c.close();
return mimetype;
}

}

Friday, 5 September 2008

Antivirus roundup by AV-Test

Here you are a table containing a roundup of several antivirus software.

You can find more here.

Wednesday, 3 September 2008

Google Chrome browser SHORT review

Surfing the web by using GBrowser...
Fast, indeed. Uses Webkit, so webpages are displayed correctly... More or less.
Used memory is very low. That could be a great advantage on not very fast machines.
It is a BETA: it is not possible to manage bookmarks... No plug-ins. No extensions.
I think Google released this browser with the aim of provide a fast browser for netbooks and implement some optimization (and integration) with Google Apps (Google Gears).
It cannot replace Mozilla Firefox, now.

Official Google Blog: Google Chrome now live

Tuesday, 2 September 2008

Google Chrome

... Unexpected news from big G ...
Google Chrome will be released as Beta version within few hours from now.
Some features I caught on the net seem to be:
  • optimized "Task - Process" management
  • optimized JavaScript engine
  • uses WebKit (as Safari and the Android Browser)
  • designed from scratch, based on nowadays needs
  • optimized Garbage collector
  • (?) maybe based on VMs
Here you can read a clear and easily readable document, explaining why Google is releasing that browser.

Thursday, 14 August 2008

OBSOD: Olympic BSOD

From Gizmodo

Chinese staff could not manage a BSOD during Olypics games opening ceremony...
It seems a IRQL_NOT_LESS_EQUAL error, as usual.

Firefox alphas...

A new Mozilla Firefox Alpha version is out: you can read relase notes here.
It contains a little taste of the future Gecko rendering engine: an improved web standards compliancy.
W3C is a consortium developing and publishing web specifications, guidelines, software (etc.) to improve Web fruition in the most efficient way.
The W3C's core business is to standardize and make software, websites, protocols, browsers interoperable.


To check your browser W3C compliancy, let it take these 3 test:
I hope HTML5 will solve issues and remove the old HTML retrocompatibility burden.

Facebook account!

I've joined Facebook.
You'll find my account here...
I think it will become my "personal website": I found photo albums very useful... And I hope to have a feast by using Facebook for advertising it.
[OT]Today there will be a great party on the beach, lasting the entire night, until sunrise! Don't try to find me on 15th of August! You could meet a zombie, not me.

Saturday, 26 July 2008

Holidays

On the 14th of July I leaved Turin. I'm at home!
...
Here I discovered how much human being became a sort of animal of fixed habits.
Wake up, dress up, quick breakfast (or any), a running session, shower, lunch.
After that usually follows a short break and a whole afternoon to the beach.
The night is the worst part of the day: always and forever in this little town.
No changes.
So, I'm trying a new way of scheduling my time. No long term deadlines or decisions.
ToDo lists aren't always the right solution.
Here a link to time management and organization. (I hope to add as soon as possible a link to an useful whitepaper I picked long time ago)

Thursday, 10 July 2008

Mail Android: now rendering rich content!

Mail Android is complete!


The application is a small mail client, capable of retrieving emails both using POP3 and IMAP protocols. Both protocols can be used under SSL Security enhancement.
It supports multiple user accounts and mail accounts. Even if a mobile phone is usually a personal device, this feature could be useful within a company.
In fact, these phones are shared by different employees and each one has different email accounts to keep track of.

RadioHead: Nude song reinvented?

Tuesday, 1 July 2008

Mail Android updated


In this screenshot is shown the content of a POP3 Folder. Notice that only Subject and From field were fetched from the entire message (less data to transfer).

Mail Android screens


A small preview... Login screen of "Mail Android" application.

It is a screenshot of the account list. From there, you can edit, create or access to your email account. Mail Android supports both POP3 and IMAP protocols.

Monday, 30 June 2008

Wall-E

Yesterday, I added the "Pixar blog" to the blog roll...
On 27th of June was released "Wall-E" on movie theaters.
You can watch trailers on the Apple Trailers website.


This time, animation, models and lights are awful! Better than Ratatouille...
I'll try to watch the movie in English language, as soon as possible.

Saturday, 28 June 2008

Tuesday, 24 June 2008

Mobile war

Nokia acquires Symbian, creating the Symbian Foundation.
iPhone is equipped by Apple OS.
Google is late in releasing Android on the market.
OpenMoko sold out its first device (the Neo 1973) and is preparing a 2nd launch, with the new Freerunner.

So... Who will win the race to the best OS for mobile devices?
Two of the four OSes are open source. It will be a great fight.

Monday, 23 June 2008

Play Nintendo 8bit games... Online

Worried about your incoming test / project_submitting_deadline /whatever_makes_you_anxious ?


Play Nintendo games and waste your time !

I am not responsable of the consequences deriving from this post.

Wednesday, 18 June 2008

Geek comic strip



XKCD is a website containing a huge amount of comic strips... Sometimes they're too nerdy... They involve romance, sarcasm, math, and language.

Saturday, 31 May 2008

Thursday, 13 March 2008

Android

I'll write my monograph for deegree about Android!
Exactly, I will develop a mail client.

=)

Economic Models via '2 cows example'

SOCIALISM
You have 2 cows.
You give one to your neighbour.

COMMUNISM
You have 2 cows.
The State takes both and gives you some milk.

FASCISM
You have 2 cows.
The State takes both and sells you some milk.

NAZISM
You have 2 cows.
The State takes both and shoots you.

BUREAUCRATISM
You have 2 cows.
The State takes both, shoots one, milks the other, and then throws the milk away.

TRADITIONAL CAPITALISM
You have two cows.
You sell one and buy a bull.
Your herd multiplies, and the economy grows.
You sell them and retire on the income.

AN AMERICAN CORPORATION
You have two cows.
You sell one, and force the other to produce the milk of four cows.
Later, you hire a consultant to analyse why the cow has dropped dead.

ENRON VENTURE CAPITALISM
You have two cows.
You sell three of them to your publicly listed company, using letters of credit opened by your brother-in-law at the bank, then execute a debt/equity swap with an associated general offer so that you get all four cows back, with a tax exemption for five cows.
The milk rights of the six cows are transferred via an intermediary to a Cayman Island Company secretly owned by the majority shareholder who sells the rights to all seven cows back to your listed company.
The annual report says the company owns eight cows, with an option on one more.
You sell one cow to buy a new president of the United States , leaving you with nine cows.
No balance sheet provided with the release.
The public then buys your bull.

A FRENCH CORPORATION
You have two cows.
You go on strike, organise a riot, and block the roads, because you want three cows.

A JAPANESE CORPORATION
You have two cows.
You redesign them so they are one-tenth the size of an ordinary cow and produce twenty times the milk.
You then create a clever cow cartoon image called 'Cowkimon' and market it worldwide.

A GERMAN CORPORATION
You have two cows.
You re-engineer them so they live for 100 years, eat once a month, and milk themselves.

AN ITALIAN CORPORATION
You have two cows, but you don't know where they are.
You decide to have lunch.

A RUSSIAN CORPORATION
You have two cows.
You count them and learn you have five cows.
You count them again and learn you have 42 cows.
You count them again and learn you have 2 cows.
You stop counting cows and open another bottle of vodka.

A SWISS CORPORATION
You have 5000 cows. None of them belong to you.
You charge the owners for storing them.

A CHINESE CORPORATION
You have two cows.
You have 300 people milking them.
You claim that you have full employment, and high bovine productivity.
You arrest the newsman who reported the real situation.

AN INDIAN CORPORATION
You have two cows.
You worship them.

A BRITISH CORPORATION
You have two cows.
Both are mad.

AN IRAQI CORPORATION
Everyone thinks you have lots of cows.
You tell them that you have none.
No-one believes you, so they bomb the sh1t out of you and invade your country.
You still have no cows, but at least now you are a Democracy.

AN AUSTRALIAN CORPORATION
You have two cows.
The one on the left looks very attractive.