Friday, March 30, 2012

Developing Android App in Scala



This is possible. The following links are useful if you plan to use Scala to develop Android app:

Use Gradle to build android app: https://github.com/jvoegele/gradle-android-plugin/wiki/ and http://www.gradle.org

Developing for ANdroid using Scala/Eclipse: http://www.assembla.com/wiki/show/scala-ide/Developing_for_Android

Example of developing for Android: http://chneukirchen.org/blog/archive/2009/04/programming-for-android-with-scala.html



Complete list of available Archetype Catalogs

Here is a list of Maven repositories:
http://scala-tools.org/repo-releases/


Run as follows:
mvn archetype:generate -DarchetypeCatalog=http://slim3.googlecode.com/svn/trunk/repository

Here is a list of all available Maven Archetype Catalogs:
Verified list:
https://oss.sonatype.org/content/groups/scala-tools/archetype-catalog.xml
http://slim3.googlecode.com/svn/trunk/repository

http://cocoon.apache.org
http://myfaces.apache.org
http://download.java.net/maven/2
http://oss.sonatype.org/content/repositories/appfuse



Not verified list:
http://repo.fusesource.com/maven2
http://tapestry.formos.com/maven-repository
http://www.terracotta.org/download/reflector/maven2/  (is empty)




Tuesday, March 27, 2012

Why you should use NIO for scalability


The key to scalability is NON-BLOCKING IO. Most operating systems support non-blocking I/O, which actually means that when you utilize an I/O resource for reading or writing (say the streams from a socket) there is no blocking operation. So if you read from a stream your read function would immediately return regardless of whether there is data available or not. In Java, non-blocking I/O is provided by the Java New I/O (NIO) library using Selectors and perhaps the Reactor pattern [F]  [F] A nice overview of NIO is athttp://gee.cs.oswego.edu/dl/cpjslides/nio.pdf. This has a major impact on scalability because the threads are only held as long as there is work to do. Once they’re finished with the available data, they are returned to the thread pool so that they may be reused for processing other requests. In this model the threads are allocated to connections only when data is available for processing, which inherently leads to better resource utilization.

Note: This is somewhat off-topic, but if you’re looking to do a lot of work with NIO and networking, we recommend looking at the Apache MINA project at http://mina.apache.org/. MINA provides some nice abstractions for NIO that allows you use a stateful approach to developing NIO applications without having to deal with a lot of the underlying details of using NIO.

Comet or Ajax ?

Which one you should choose ? Ajax or Comet ?
Comet changes the traditional model by using a long-polling HTTP request in the background that allows the server to push data to the browser without requiring additional requests. Essentially this is like AJAX, except in the opposite direction.
While the AJAX model increases the richness of the User Experience for a single client at a time, Comet can do the same for multiple users.

Friday, March 23, 2012

Problem to display characters from other language than English


If  you are, for example, unable to display Swedish characters, this can mainly means that you probably have the language file written in UTF-8 and not in ISO-8859-1. There is no way an ISO-8859-1 environment will display characters from a different charset like UTF-8.

You may have saved data in database in UTF-8 for example. If you want to display correctly the data must be converted to a ISO-8859-1.