Friday, November 7, 2014

Alfresco Summit 2014 - London - My Takeaways!

Alfresco summit 2014 started on 7th October (which was also my birthday and my Zaizi first year anniversary!!!) at London Hilton Metropole hotel.

This was my first Alfresco summit experience, which turned out to be very exciting and rewarding.

On the first day, I got the opportunity to attend full day Alfresco training by Rui Fernandes, Alfresco international trainer, to get hands-on experience with web scripts.

Then, we had the "partner drinks" event, which was a networking event for all the Alfresco partners. (Special thanks for Zaizi London friends who wished me for my birthday and and sang happy birthday song in the event to make me feel home, and also for Zaizi Colombo friends who sent me surprise birthday gifts!)

There, people were interested about Zaizi - Connecting Intelligence slogan and they were so curious to know what we are doing with semantics, NLP and machine learning at Zaizi.
.
The summit sessions were officially started next day followed by the product keynote by Thomas DeMeo, the VP of product management for Alfresco

The first session I attended was " Activiti in the Event-Driven Architecture" by Robin Bramley Chief Scientific Officer for Ixxus. It was about using complex event processing in BPM for business activity monitoring (infer co-related event or patterns). The solution uses Activiti, Apache Camel and Esper. It was interesting to see how organisations can gain meaningful insight for business operations using their day to day events.

The next session was "Whats new in Alfresco 5 search?” Andy Hind and Mike Farman from Alfresco
. There, the presenters explained the new search enhancements such as Alfresco faceted search, auto-suggest and spelling and performance improvements, achieved using new SOLR4 features.

The next session, namely "Declarative configuration of share session” by Dave Draper from Alfresco focused on creating dynamic UI component design using Akiue framework. There was thunderous applause from the audience, when the speaker created a simple 'things to do' UI application in 3 mins.

Next one was the lightening talks session. It was a challenging session for speakers, because the slides were auto playing and each speaker got only 5 mins to talk, yet it was fun for the audience. The "easy edit" application, which helps to open the documents in their native application itself (E.g., MS doc in MS Office) for edit was a cool feature. I exactly do not remember if this was the session which the speakers took off their shirts to release their new product. ;)

The last session for the day was "Top 10 tricks to improve Alfresco performance” by Sergio from Zaizi. Using his experience with Alfresco, he explained different SOLR settings, Alfresco configuration settings and clustering mechanisms for share and alfresco that should be in place to improve Alfresco performance.

Also, he mentioned one more important thing that applies not only with Alfresco performance, but with anything we do in our lives. That is…  “What ever you do, do it with passion!”

After that, we attended the awesome evening party at Palace Suite, with The band Sway Allstars.
Too bad I missed the Zaizi after party at Apres London, as I had to go back to hotel for my speech preparation for next day. #LastMinutePanic

Next day, I presented in the session “Set your content straight” which talks about applying machine learning techniques in Alfresco to enhance metadata and search capabilities.

Then, Ainga, CEO Zaizi explained few customer use cases where we can take the advantage of technologies such as content analytics, data linking, intelligence search and machine learning to solve business problems in his session "Content Intelligence: Advanced Information Technologies for Alfresco"
.
Another session that I was interested about was "Indexing and searching speech contained in audio and video content” by Romain Guinot from Alfresco.

There, they have integrated Pocketsphinx : speech-to-text engine with Alfresco transformations to enable video and audio content indexing and search. Audio and video provides better help when it comes to grasp a particular perception effectively, yet they are consuming more network bandwidth than other medias such as text.

So, this provides a nice solution for the above issue by indexing the actual content of the audio or video files and make them available for searching.

Then, Lucas was presenting the session on "Scale Audit & Reporting with a NoSQL Architecture”.

Last but not least: Bringing Alfresco to Google glass! In this presentation, it was demonstrated how google glass can be used as a wearable device to publish Alfresco content using GDK - Glass Development Kit for this. After the session, we could try out the Google glass too! :)

On the whole, it was a great opportunity to see how people are using cutting edge technologies and customising Alfresco to change the way enterprises manage and interact with their documents.

If you miss this event, the recorded sessions will be available in Alfresco summit site and Youtube after some time, so it’s worth downloading and watching them.




Java Game Development - Part 2: Developing multi user game



Extending the game as multi-user application


When extending this game as multi-user game, another player baby fish is added to the game. In addition to escaping from enemy fish and meeting friendly fish, the baby fish players should compete with each other to go home sooner than the other while getting maximum number of points.

Design

Client - server architecture

Client server architecture is used instead of peer-to-peer approach to due to its simplicity and ease of development. 

In a client-server architecture all the game players (baby fishes), or "clients", are connected to a central machine, the Fish game server. 

The server is responsible for important decisions such as creating game friend/ enemy fish collection, managing state and broadcasting this information (x, y coordinates of players and non-players) to the individual clients. 

As a result, the server becomes a key bottleneck for both bandwidth and computations.
However, this approach will consume more network bandwidth. 



Concurrent game playing using multi-threading


Multi- threading approach is used to enable multiple users to play the game concurrently. A separate thread will represent each client.

Network Access using socket communication


TCP/ IP Socket communication (low level network communication) is used for two-way communication between server and clients. Remote Method Invocation (RMI) approach is not used here, as it will incur additional processing overhead.
Using encapsulation to support multiple network protocols

FishServer class and FishClient interface do not include any TCP/ IP networking specific programming. This generic design will support different network protocols with out changing the core game logic. 

Class Diagram


 Sequence Diagram


Implementation

Threading in Java

Synchronized keyword

Since game server is accepting different threads that request or send messages, which access same resources (E.g., objects, variables), for preventing thread interference and memory consistency errors.

Runnable interface

Runnable interface is used to implement what each player client thread is supposed to do once executed.

Networking in Java

Serializable Interface

We need to send the game information such as game scores and player/ non-player x, y coordinates across network.

To achieve the above, state of the objects is transmitted across network by converting objects to byte arrays.

Classes are serialized before sending through network and de-serialized once received using Serializable interface.

Socket and ServerSocket


ServerSocket object is created to listen for incoming game player client connections.
The accept method is used to wait for incoming connections. 

The accept method returns an instance of a Socket class, which represents the connection to the new client.

ObjectOutputStream/ ObjectInputStream methods (writeObject, readObject) are used to get object streams to reading from and writing to the new client. 

UI









 



Java Game Development - Part 1: Developing a single user game using strategy design pattern

Introduction


The Game

The lost fish is a simple educational game for children to learn about behaviors and characteristics of different sea creatures such as fishes and plants in a fun and challenging way.

E.g., Dolphin is an innocent, friendly sea animal, whereas shark is harmful

Also, it is intended to make the children aware of common characteristics of the sea creatures, which belongs to a particular category.

E.g., harmful animals will scream furiously and look angry

In this game, player is a baby fish that has lost in the sea. Baby fish has to find its way home passing different barriers, while escaping from harmful animals.

Game Rules


Assume, before starting the game, baby fish will be given some knowledge on the sea creatures by its mother fish. But, mother fish will not be able to tell about “all” the sea creatures.

If the baby fish collides with a harmful creature, the baby fish will get weak. (Loose energy)

If the baby fish identifies and meet friendly fish it will gain energy. If energy level is below zero, baby fish will die and the game is over.

Baby fish will get bonus points if it reach/find home soon.

Win the Game


Baby fish has to reach home with maximum energy level with maximum bonus points, to win the game.

Design

This game is designed with the intention of improving further with a variety of sea animals with different appearances and behaviors. Then, game will keep the players interested and also this will lead to a good learning resource as well.

Design Decisions

OOP concepts such as encapsulation, inheritance and polymorphism are used to improve the reusability, maintainability and the extendibility of the game.

 Strategy Design Pattern

Strategy design pattern is used to effectively extend the game with new sea creatures with diverse behaviors, to keep the player entertained. Also, different behaviors can be dynamically invoked using this approach.

An example scenario is given below:

Assume we have to add two new sea animals (E.g., whale and jelly fish) with different/ existing sound behaviors to the game, with out doing major changes to the core game design and avoiding duplicate code. If we use the traditional inheritance approach, where all the sea animal behaviors (E.g., sound/ scream) inherit from parent class SeaAnimal, then the code will be duplicated for similar behaviors. But, the given approach will solve that problem using interface implementations for similar behaviors.

The current design supports the above scenario in two different ways.
•    Inheritance: New sea creatures can be created by extending “SeaAnimal” abstract class
•    Polymorphism: Novel sound behaviors can be added or existing sound behaviors can be reused using “Sound” interface.

Using Constants

Constant values are used wherever applicable to improve reusability and maintainability.

Class Diagram


Sequence diagrams






 UI Design


Here's the video: https://www.youtube.com/watch?v=ipv_6yYAUw4

References

[1] http://obviam.net/index.php/design-in-game-entities-object-composition-strategies-part-1/
-->