giovedì 28 aprile 2011

Google Blogger : webmaster tools and sitemap

Dev-articles is more or less my blog. Initially I wanted to have people to write articles, but who am I to compete with wordpress or blogger. I don't care anyway because I like this website and I love to improve it as I learn a lot from it. One of the most rewarding thing is to find ways to increase traffic. So I got to know quite a bit about SEO, and google tools like webmaster tools or analytics.
Recently I started to play with blogger.... 

martedì 26 aprile 2011

Useful git commands

This is just a list of commands that I think are useful. I would like to keep here with a short description so I can go back to them whenever I need. Hopefully they are useful to someone else. Of course this is more for who is still exploring the git.

read more on "Useful git commands" 

venerdì 22 aprile 2011

Delete lots of entities in google app engine datastore

How I solve the problem of deleting lots of entities in google app engine

There are different solutions to delete all the entities from the datastore:
  • Delete the application and create a new one
  • A servlet that on calls goes and delete a group of entities
  • Map Reduce
  • Remote api
  • Tasks and queue

mercoledì 20 aprile 2011

TimerTask and Android Service

Services are one of the fundamental building blocks at your disposal to build nice android applications. Services main goal is to run long-running processes. From the android online documentaion there are two fundamental points to remember about services  ...

Google App Engine and Channel Api with Gwt

Sometimes you need to show updates straight forward. In this case you have two options: polling and pushing. Polling require you to call the server with a refresh period. Polling can be expensive especially if you need a small refresh period. To resolve this you can use pushing. In this case is the server that inform the user of a change. With website the push is implemented by keeping a channel open between client and server.

Google app engine xmpp managing the status

I'm playing with a chat. An I want to do it with Google App Engine. In a previous article I have show how to send messages. Now I want to show you what I have done to manage the status of a user so that from google talk other users are able to see your status.

venerdì 15 aprile 2011

Google App Engine indexes

Sometimes you need to add an index to you app. Even though most of the times is done atomticaly it is not rare. To manage indexes in app engine is straight forward, but first you need to understand a few basic points.
Every query need an index to run. And the index is ordered. The development server does this for you in most of the cases. It does that primarily because there are a group of automatic indexes. On top of that if you run a query it is checking for the index and if there is not an index to serve the query it is adding it.

Google App Engine sending messages with XMPP

Google app engine has an amazing list of services you can use to enrich your web application. One of them is the XMPP service. In the documentation is stating :
Important: An App Engine application can send and receive chat messages to and from any XMPP-compatible chat messaging service, such as Google Talk. An app can send and receive chat messages, send chat invites, request a user's chat presence and status, and provide a chat status.
In this sentence are listed all the functionalities of the XMPP service. This is how I have implemented the send of a message to a certain client.

Google OAuth 2 on google app engine

If you want to use some google api for example docs or contacts you probably need to use one of the authentication methods that google gives you. At the moment there are 4 implementations you can use:
  • Hybrid protocol
  • OAuth 1.0
  • OAuth 2.0
  • OpenID

Gwt EventBus (HandlerManager) the easy way

Gwt application get complicated very quickly. To fix this problem in the last three years there was some work done around MVP (Model View Presenter). MVP though is very complex, but on my opinion is useful when the complexity of the project reach a certain threshold. There are a couple of things that can be used in every small projects. The event bus for example is one.

Map Reduce over App Engine

App Engine Datastore is a NoSql that need to be scalable. To achieve scalability it has lots of limitations that generally push you towards duplication of data. As a consequence you need a good tool to manage, move, manipulate and transform your data into something that is easy to manage for your app. Map Reduce give you a tool to abstract all the details and problems of doing this kind of operations and give you the freedom to focus only on your application logic.

Moving away from App Engine domains

We all use app engine because is fast, easy and scalable even considering the limitations, and is free. There are really a lot of projects on app engine now and moving domain is becoming a very common thing to do. This are the steps to follow :
  • Buy domain on google apps
  • Add app engine project to your google apps account
  • Add the web site to google webmaster tools
  • Implement a redirect filter

giovedì 14 aprile 2011

Android Boot Receiver

Sometimes is useful to be able to intercept reboot events.
For example of you have to set up a service that run at different intervals using the AlarmManager You have to make sure to handle the reboot and reset the alarm because is lost otherwise.

Android Activity startActivityForResult

I think we are all familiar with intents and startActivity() method. At least, you are, if you have done something with android. But we often do not consider the method startActivityForResult. Just to have an introduction this is what you can find about startActivity on the online documentation:

The startActivity(Intent) method is used to start a new activity, which will be placed at the top of the activity stack. It takes a single argument, an Intent, which describes the activity to be executed.

Very often you need to know what was the result of an activity. Suppose you have a list of item and you can edit them in another activity, you may need to know the result of the edit. Was the item changed? or was the edit canceled? To do that we can use startActivityForResultActivity


Gwt canvas a small example

Html Canvas
The canvas is part of the new group of tags coming with html 5. In particular the canvas gives you a way to draw stuff using javaScript. Within a canvas you have tools for:
  • Drawing : rectangles, arcs, lines drawing and more
  • Effects : Shadows, Alpha transparency …
  • Transformations : Scaling, rotation, translation ...

In html 5 you can specify a canvas very easily like in this example: