Join The Community

Wednesday, July 13, 2011

Welcome

The official Blog of GTUG Magazine.

First Beta Edition published and detailed information will be published soon. This magazine targets beginners, advanced users and developers based on GTUGers and Googlers experiences for publishing educational, technical and business articles. Wait our enhancements in the future.

For any questions/suggestions please contact Mohammed Farrag: mohammed@gtugs.org .

Special Thanks to Vardan Grigoryan from GTUG Armenia for designing the blog.

Tuesday, July 12, 2011

Google Plus. Today and Tomorrow

On June 28, 2011 I received an unexpected letter by gmail. Here are the first lines of the letter from Stephanie Liu. 

“Hi,
I'd like to invite you to an early Field Trial of the Google+ project, a new way to share with the people that matter the most.”

It was impossible to describe my feelings when I realized that I was one of those rare people who can explore the initial version of the system. I fell in love with it at first sight...
Everything was so clear, well organized and so easy to manage that even beginner users of the Internet would not need help. And I realized that Google-Plus is what we expected for a long time.

To be honest, we were expecting a system like this, but it was planned to called Google Me.
I’d like to express my opinion about the name of this project.  Google Me is a better name for a social network.  But let’s not forget that it is not a simple social network.  I am sure that as the network develops, it will have all the Google services and tools. Thus Plus is the best name for such a system.
I don’t want to write about the inner structure of the network, because it is already written inside the system.
I’ll try to mention what we have today, and what we will have in future.

                                               
Google Plus Today
Based on Paul Allen’s post and the note that I received the invitation on 4th of July, there were already more than 1.7 million people registered on the network only a week after I received the invitation. And also I must mention that the system was turned on for only 3 days.
We must agree that in one week 1.7 million registered profiles are a serious challenge to all other social networks, particularly to Facebook. So the struggle is just beginning.
Only after a few days we could see many interesting extensions and sites on the Internet, created by third parties.
Especially I would like to mention gplus.to , which allows users to create their short url addresses for their profiles (http://gplus.to/USERNAME), because G+ still doesn’t provide their users with their preferred urls and nicknames.

I also want to mention socialstatistics.com and I consider it as an important resource because it also took advantage of the fact that G + doesn’t have API, and created a rating system for  the profiles.

I am not going to tell more about the mentioned extensions. I will be glad to help with advice people who are interested, and if there are suck people, they may follow this link and read more about the sources.
In short, today we have 1.7 million users and a system that is growing minute by minute.


                                               Google Plus tomorrow
And here, perhaps, I should report my subjective opinion. So, what do I expect to see in G +


  1. I think the most important and urgent task is the API-creation. Personally, being a programmer, I'm already looking forward to the API. It will allow a sudden increase of the users. But I also realize that  for creating an API for such a system a lot of  time and human resources are required. So all we can do is wait.
  1. It is also important that other Google services will be integrated into Plus. Especially the upper toolbar notification number, as it is done with the help of Google + Enhancer
  2. . I look forward to the integration of Google Sites into user’s profile.  This will allow users to create their site or their organization's website within Google Plus. It is a step, which not a single social network can do better than Google Plus.
  3. . I also have great expectations for the Google Groups integration into Google Plus. It will allow filling in the gap of the groups in G+.
  4. . And with the last point, of course, I cannot forget the awaited integration of Google Music which is in experimental mode now.

Maybe I forgot to mention some facts or expectations; in any case, I hope Google Plus will surprise us with a lot more thing than a mentioned.

From Vardan Grigoryan (GTUG Armenia)
http://www.gtug.am

Google and Schools

Why school sucks?

Why kids have so much fun doing very tiresome activities but are bored to death at school?

Exploiting our natural intellectual talent is one of the most challenging activities in our life.
When we realize to have learned something new we feel more alive and strongly motivated.

And again ... ..
Why students are not allowed to copy? In real life it is the first thing to do, being the first step for innovation and intellectual evolution.

Why all school information is so stiff, crystallized, stolen of all the emotions that these strong life experiences aroused?

Why students should be ashamed when don't understand something, to the point that it is more fashionable to flaunt indifference and disinterest?

Young people that enjoy studying and playing with their minds are, most of the times, treated as careerists with a servile behavior with teachers.

It is totally wrong.

You would say ... what has to do all this with Google?

Internet and Google may represent powerful tools of freedom and individual expression.
They can help make learning a game, a creative fun.

Take for example the books.
Study of monolithic textbooks no longer makes any sense: besides all, are unnecessarily expensive.

I remember sad images of experiments in physics ... All that is now outdated, since we can access videos and simulations.

Why don't let and help students compose themselves virtual books?
Picking up material on the Internet (yes, copying) and working together with other people, of any age..capable of evolving, generation by generation.

Moreover: it is well known that the best way to learn is to teach.
Isn't it better to prepare and give lessons than to be interviewed?
And getting rated and  supported by schoolmates, too.


In other words, the Internet and Google (Apps, Google +) can be tools by which students can express their ideas and personalities. Together, learning how to collaborate.
Despite the rules, often inadequate, of the "adult world".  

This is the first in a series of articles in which, starting from the opinions and behaviour of young students, ideas and techniques will be collected, proposed and explained.

Each article will cover a subject (history, literature, other arts, mathematics, natural sciences, geography, ancient/modern foreign languages...), trying to highlight the interdisciplinary and social aspects.

Any ideas, suggestions and contributions are welcome.

http://ontracksystemsltd.blogspot.com

HTML5 Gaming Frameworks

So, everybody is talking about HTML5 right now.

Especially those who call themselves casual gamers, but have no time for long start screens, initializing maps and all the Nonsense, Schmonsens that “real games” bring along, will come to enjoy HTML5 sooner or later.

HTML5 offers new functionality such as, among other things, audio, video or local storage and dynamic 2D and 3D graphics, which were not supported in their original form in the past and required special plugins like Adobe Flash or Silverlight.

But the name HTML5 is a bit misleading, because it does not just describe a new version of HTML, or HyperTextMark- up-Language. It is much more a catch phrase for everything new and shiny in the world of Web Development.

There is a pretty nice graphic about the differences on focus.com
http://www.focus.com/images/view/11905/

Anyone who developed games for browsers in the past, had to do with either so-called browser games or Flash-based games.

Browser games are (most often) MMOG games based on taking turns or strategy games in which one builds up planets/villages/[insert name here] and then, either with an alliance or alone, one must go to war over other plants/villages/[insert name here] (Travian is a popular example in Germany). There are countless more Flash games and it feels like there is next to no possible game that has not already been done with Flash. Anyone interested can find a number of really good games at http://kongregate.com.

I know from painful personal experience that one can spend hours there.


The advantages of Flash were/are the simple implementation of graphic elements and a low entry threshold. The advantages of browser games were the lack of hardware limitations and the low cost of availability. All one needed was a Web server.

That brings us right to the point - the fact that one can get into game development very quickly with the new “HTML5” Game Engines. Things like hardware, the availability of licenses or distribution channels aren’t that important anymore. The only thing needed is a server to make the content available and a bit of basic knowledge about HTML, CSS and JavaScript, and there you go.

I will list three examples of popular gaming frameworks and/or the implementation of games using the new elements of HTML5.


www.kesiev.com/akihabara on www.kesiev.com

Akihabara is not only a game store mile in Tokyo and a Mecca for retro videogamers but also the name of a powerful libraries, tools and templates that Kesiev put together on the basis of JavaScript and some of the new HTML5 features.

Akihabara manages completely without Flash, plays music, offers routines for game worlds and is, just by the way, available on many mobile units. The drawing element “Canvas” is the most important element at this point.

A short example for two overlapping squares in Canvas:
<html>
<head>
<script type = ”application/javascript”>
function draw() {
var canvas = document.getElementById(“canvas”);
var ctx = canvas.getContext(“2d”);
ctx.fillStyle = “rgb(200,0,0)”; ctx.fillRect (10, 10, 55, 50);
ctx.fillStyle = “rgba(0, 0, 200, 0.5)”; ctx.fillRect (30, 30, 55, 50);
}
</script>
</head>
<body onload=”draw()”>
<canvas id=”canvas” width=”300” height=”300”></ canvas>
</body>
</html>


http://code.google.com/p/quake2-gwt-port/
Quake 2 GWT Port is an implementation of Quake 2 developed using GWT (Google Web Toolkit), which utilizes, among other things, the <audio>-Tag, Websockets und WebGL.

WebGL is one of the most interesting features because it allows access to the 3D accelerator of the computer’s graphic hardware directly from the browser without having to install additional plugins. The library is still partially in the early stages of development, but has been in Chrome since the last update and is always activated in the stable version.

An overview of possibilities of WebGL in the following GoogleCode Repository:
http://code.google.com/p/webglsamples

Andrew Woolridge, alias Tryptych blogs about various JS Engines and other ferocious things on the Web under: http://andrewwooldridge.com/blog - you should also have a look at his TwitterAccount and his Favorites.

You can find a list of currently available HTML5 Game Engines at https://gist.github.com/768272


http://playbiolab.com

Biolab is based on the ImpactJS Engine and is really WOW. With the help of the ImpactJS Engine, you can, at least according to the developers and also according to what I have seen in the source code up to now, implement your own game ideas relatively quickly. The only disadvantage of ImpactJS is the price tag of 99 US- Dollars. In relation to its performance, however, that is still a bargain.

from Nils Hitze, GTUG Munich, Germany
http://munich.gtugs.org

HTML5 Websockets for fun

During the development of our product jooink.com (the web platform that names our company and that is going to be released; if you’re interested you can ask for an invite at http://www.jooink.com) we faced the problem of letting users to interact smootly and to exchange information in real time. For the actual purposes of jooink long polling and a few tricks to let aggregation of messages in single responses is enough but we were interested and courious to experiment how the recently introduced html5’s websockets behave.
Preliminary experiments on the platform appeared to be really promising but measuring interactivity on jooink is hard because of the large codebase and because it has been optimized for long-polling, so  we started a tiny pet-project just to “measure” websockets behaviour.
The code has been presented at the GTUG session during Google Country Day that Firenze GTUG organized with Google Italia (goo.gl/sXpqb).

Being just a test we posed some rules to ourselves: weekend-app, no more than a couple of days of development (reads, ugly code), trivial graphics, an easy to understand application, interactive, GWT based.

Being unable to figure out a better application we ended developing a game, a classical game: pong

Interactivity in this game is vital and also it is quite obvious how to implement the program: we must share between the browsers the ball position and the players positions; somewhere we must have the code to let the ball bounce on borders and on players and to acknowledge the eventual winner.

Wrapping the javascript native object Websocket in GWT is quite trivial and we do not spend time here to describe the wrapper (our is almost identical to http://code.google.com/p/gwt-comet/source/browse/trunk/src/net/zschech/gwt/websockets/client/WebSocket.java ) what is important is to know that after opening the connection to the server (the uri is something like ws://hostname/...) we get an object able to send text messages, through a “send(String msg)” method, and to receive asynchronous messages through an handler (onMessage(String msg)) that is called by the browser.

Server-side we chosen to use jetty 8 (actually because jetty is the container we use in production so we feel comfortable with it). Even if we found that the online documentation is not so exhaustive, it is quite straightforward to write a serverside-websocket with jetty; the following is the echo responder websocket you can find searching google for “jetty websocket sample”, slightly modified to be jetty 8 ready.


EchoResponder:
public class EchoResponder extends WebSocketServlet {
   private static final long serialVersionUID = 1L;
   public EchoResponder() {
   super();
    }
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws       
                          ServletException, IOException {
   response.getWriter().println("EchoResponder");
   }
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws
                                     ServletException, IOException {
   getServletContext().getNamedDispatcher("default").forward(request, response);
   }
 public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) {
   return new TheWebSocket();
   }
 class TheWebSocket implements WebSocket, WebSocket.OnTextMessage {
   Connection outbound;
   @Override
   public void onClose(int arg0, String arg1) {
   System.out.println("CLOSE");
   }
   @Override
   public void onOpen(Connection connection) {
   System.out.println("OPEN");    
   outbound = connection;
   }
   @Override
   public void onMessage(String msg) {
try {
   this.outbound.sendMessage(msg);
   } catch (IOException e) {
   e.printStackTrace();
   }
}
   }
}


On the other hand a snippet of the client code using the websocket in gwt looks as the following:


private TinyHandler h = new TinyHandler() {

   @Override
   public void onOpen(JavaScriptObject o) {
...
   }

   @Override
   public void onClose(JavaScriptObject o) {
   ...
   }

   @Override
   public void onMessage(JavaScriptObject o,String data) {
Window.alert(“message:” + data);
}
   public void onError(JavaScriptObject o) {
}
   };

Websocket ws = Websocket(uri, onOpenHandlers,onCloseHandler,onMessageHandler);

ws.send(“Hello world”);



The “game logic” of pong is trivial and elastic collisions are really easy to code in 2D but we chosen to be lazy so we decided to base the game on a physics engine (actually, it is more fun because we can later develop different games): Jbox2d. JBox2D  is the java porting of
Box2D an impressive C++ library  that handles very well rigid body interactions (aka collisions) and physical simulations.

So, at the end of the first day of our two days project we ended with a code working as in fugure:




The code clien-side consisting of a few hundred of lines of java devoted to receive messages and to draw in a browser’s canvas.
Server-side the code was more chunky, because of the required threads to handle the physical simulation: nothing problematic but a bit more harder to code and to maintain that we would like.
The major drawback was: writing a different game require an almost completely new server-side component (ok, desiging better the code would help in reusing the it but does not solve the problem, an almost new server component for any new game).
Fortunately looking on code.google.com we found that someone did a great job for us: JBox2D has been GWT ported. We where so amused of this idea that we switched for our last day of game development to a new approach:  a generic server controlling the logic of playgrounds (i.e. places where players can start a game: enter and create a playground, join an available playground) and just working as a hub (an old network hub) in each playground, i.e.
for any given message received from a player send it to all the adversaries, nothing more.

On the other side, on the client, we embedded gwtBox2d and let one of the players’s browser to work as a master:






the result is at http://goo.gl/OzkLw (there must be 2 players that connect simultaneously so you must wait for another visitor or … ask a friend to connect).


Unfortunately where we reached this point the weekend ended so we had no opportunity of developing other multi-user games other than pong (we will come back asap) but as a side effect of the new approach we where able to build also a single user, browser only (i.e. no need of network connection to play, at least if you leave the game in a browser tab) you can try at: http://goo.gl/IqpCU.

Of course the next step is going to be to let the code on the client to fully take advantage of html5 using webworkets that may let us to better tune timing on the browser of the ‘master’ player: maybe next weekend :P

By: Alberto Mancini (Firenze-gtug mancini@gtugs.org)
Francesca Tosi (Firenze-gtug tosi@gtugs.org)