Páginas

sábado, 29 de janeiro de 2011

KML Optimization: Tip # 2 - Find out who your target audience

You need to think about who will be the consumers of your KML, to determine whether you need the most optimized content, or prefer it to be as compatible as possible between the three forms currently available for viewing a KML: Google Earth, Google Earth Plugin and Google Maps.

If you know in advance that her KML always will be consumed by Google Earth Plugin, you can give up certain elements will not be used by this tool, such as the element that controls whether an object will appear or not in the listview Google Earth. The presence of this tag in KML to be consumed by the GE Plugin will be innocuous, because it will not use this element for anything.
Now imagine a KML containing 500, 1000 or 10000 Placemarks and each containing an element . Consider:

1 placemark = 1 = 24 bytes 
500 placemarks = 24 x 500 = 12.000 bytes = ~11 Kbytes

We will have 11 Kbytes of waste with an element that is ignored during parsing and anything that will add to our content, and we're talking just a preview of this KML. If it is a KML NetworkLink that updates itself the waste is even greater. Assuming an hourly refresh, would be wasted 281 Kbytes per day or 8 megs for a 30-day month!

This waste is for only one user consuming a KML supplied by our server. If the infrastructure and clients that will consume this KML are internal (corporate), the situation is also bad, because link bandwidth of the company is being wasted and will affect the quality / availability of other services also depend on these links.

Let's hypothetically simulate some users consuming this KML:

1 user = 8 Mb waste / month
5 users = 5 x 8 = 40 Mb waste / month
10 users = 10 x 8 = 80 Mb waste / month
100 users = 100 x 8 = 800 Mb waste / month

And all these numbers here are based on the analysis of only one element of the KML is being generated unnecessarily. Imagine how much server processing and bandwidth of the link may be being wasted? How many other elements in your KML is being generated but will not be used?

Now when you do not know the target audience that will consume the KML or to generate content that is compatible with the GE, GE Plugin and Maps, the strategy is to use the normal tags to be processed by each tool. Will give up the optimization, but you can view the contents correctly on any platform that you desire.

My feeling is that most developers KML know in advance which platform for generating content and are therefore able to learn what elements make sense or not be present in your KML.

Below I build a table containing the elements and which platform makes sense for it to be exported in KML:

 KML version 2.2:

Element
Google Earth
Google Earth Plugin
Google Maps
<gx:altitudeMode>

<gx:AnimatedUpdate>

<BalloonStyle>

<gx:balloonVisibility>

<Camera>

<ColorStyle>
<Document>
<gx:duration>

<ExtendedData>

<gx:FlyTo>

<Folder>
<Icon>
<IconStyle>
<kml>
<LabelStyle>

<gx:LatLonQuad>

<LinearRing>

<LineString>

<LineStyle>

<Link>

<ListStyle>


<LookAt>


<Model>


<MultiGeometry>


<gx:MultiTrack>


<NetworkLink>


<NetworkLinkControl>


<PhotoOverlay>


<Placemark>
<Point>
<Polygon>

<PolyStyle>

<Region>

<Schema>

<ScreenOverlay>

<Style>
<StyleMap>

<TimeSpan>

<TimeStamp>

<gx:TimeSpan>

<gx:TimeStamp>

<gx:Tour>

<gx:Track>

<Update>


Of the three platforms presented, Google Maps is the least that supports KML, due to its 2D nature, and Google Earth is the most support.

Think about who will be the consumer of your KML and make the right choice.
Waste is a sign of inefficiency.

Good coding!

domingo, 23 de janeiro de 2011

KML Optimization: Tip # 1 - I need Namespaces?

Rule of thumb: if you do not need, do not use!
This rule is the principle that one should always keep in mind when coding a KML.
So, this is the way we started talking about optimizing content for rendering in Google Earth, Google Earth and Google Maps Plugin.
In this article we'll talk about namespaces and why we should use or not in the KML.

What is a namespace?
Namespace is a way of qualifying XML elements and attributes in order to avoid conflict with elements in XML using the same name. This qualification is the addition of a prefix before the name of element or attribute.

Why there is namespace in KML?
Using Namespaces in KML allows Google to add extensions to the Standard (OGC KML), without compromising the processing of old KMLs, including allowing the use of the same attributes with new values allowed which are not covered in the original specification. An example is the element that after update of Google Earth that gave support to view the ocean, was limited and the use of namespace enabled the element can have new values, without compromising the old versions that did not support.

I must use namespace or can I omit?
It depends.
I recommend you remove the namespace only at the end of the process of developing a new KML, as this will prevent you from receiving warning messages from Google Earth if you do use one feature that uses some extension.


What is the meaning of each namespace in KML?
Let's look at the namespaces we can find in a KML. Below is an excerpt from KML generated by Google Earth version 6.0.1.2032 (beta).

  • xmlns = "http://www.opengis.net/kml/2.2"
    This is the default namespace, which means that every element of the file that is not prefixed, will report to this namespace.
  • xmlns:kml = "http://www.opengis.net/kml/2.2"
    This namespace is the de facto standard, where all the elements that make up the language are defined in a schema (XSD file).
  • xmlns:gx = "http://www.google.com/kml/ext/2.2"
    This namespace refers to the extensions that Google has been doing to KML, after standardization of language (OGC KML). This statement says that all new elements will be prefixed with "gx".
  • xmlns:atom = "http://www.w3.org/2005/Atom"
    This namespace refers to elements that can be used to describe the KML generated content authoring.
  • xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"
    This namespace refers to element that can be use to geocode in Google Maps (currently not used in Google Earth).
So if we do not use any extension and we use values that are within the OGC KML specification, we can omit these declarations in the XML so that it becomes:



or being more radical:



That's it, folks! Good coding!

Honey, I Shrunk the KML !

In this post I will initiate a series of articles to provide tips on how to optimize content rendering (KML) viewed in Google Earth, Google Earth Plugin and Google Maps.
KML format is XML-based, so it tends to be very verbose and therefore the more features are generated in this format, the higher tends to be the final size of the generated content.

Why optimize?

  1. To reduce bandwidth consumption
    In a corporate environment where the server that provides the data and Google Earth are on different computers on the same network, save on bandwidth consumption is a good practice to enable up to other computers on the same network also consuming the same data and not create an impact in other applications.
  2. To reduce processing time
    A non-optimized KML consumes more processing (and hence the computer) than an optimized. This processing is reflected in the speed with which information is updated on Google Earth / Maps.
  3. To reduce battery consumption (mobile)
    Less processing will result in less battery consumption, therefore, more autonomy for the battery
What we will see:

  • KML optimization
  • Optimization for display in Google Earth
  • Optimization for display in Google Earth Plugin

Stay tuned !

sábado, 11 de dezembro de 2010

Saidinha do banco faz mais uma vítima - Dicas para diminuir o risco da próxima ser você

Amigos,

Mais uma pessoa morreu devido aos bandidos aplicarem a "saidinha do banco". Mais uma família marcada por um Natal triste, infelizmente.

http://cosmo.uol.com.br/noticia/70002/2010-12-10/homem-morre-em-assalto-no-centro-de-campinas.html

Quando entramos no banco, nunca percebemos que existem alguém ali mal-intencionado, mas deveríamos sermos mais prudentes, até para que não passemos uma falsa imagem para este "alguém" e ele ache que estamos com muito dinheiro quando na verdade não.

Eu aconselharia:

1) Prefira usar o cartão de crédito / débito. Se usar com sabedoria, o dinheiro de plástico é seu aliado.

2) Se for fazer saque, faça num montante que evite que você tenha que passar novamente em um caixa eletrônico dias depois. Evitar se expor ao risco é importante.

3) Se for fazer pagamentos altos, prefira fazer um DOC ou TEF no seu banco ou Internet
Embora o Itaú cobre por volta de R$ 8,00 para fazer um DOC, acho que vale a pena pelo conforto e segurança de vc fazer de sua casa a operação.

4) Se for usar cheque, sempre cruze ele e se possível faça nominal a pessoa.
Além de poder andar tranquilamente com este valor no bolso, você evita do seu cheque ficar passeando por aí se ele não for nominal, pois principalmente no comércio, os cheques são repassados a terceiros numa roda sem fim...

5) Se for receber o FGTS, no ato do recebimento no caixa na CEF, peça para fazerem a transferência do valor para seu banco/conta corrente. O caixa fará a operação normalmente e você evita o risco de sair da agência com um montante que chame a atenção, até porquê no local do recebimento, existe muita gente esperando e sabe-se lá se um "olheiro" não está ali só avaliando quem está sacando o FGTS...

Se você tiver mais alguma dica e quiser compartilhar, deixe um comentário, ok ?

Abraço!

domingo, 3 de outubro de 2010

Google Phone Gallery

O Google lançou o Google Phone Gallery que visa a reunir informações sobre os modelos de Android comercializados no Brasil. Existem vários filtros que podem ser utilizados, mas dada a pequena quantidade no site referente ao Brasil, digo que nem é preciso.
Evidentemente que a lista poderia ser maior, se fosse feita uma pesquisa informal sobre quais aparelhos estão se conectando aos serviços do Google como o Android Market e suas respectivas versões de sistema operacional. 
Então, se você quiser ver os aparelhos comercializados pelas operadoras, visualizar as especificações técnicas e poder comparar até 3 smartphones, visite o Phone Gallery.

sexta-feira, 1 de outubro de 2010

Acessando a Internet no PC através do Motorola Milestone

Já cheguei a passar aperto por querer acessar a Internet, mas o Speedy não funcionar.
Após comprar meu Android, já fui atrás de uma solução que me permitisse usar meu celular como modem GSM para eu poder acessar a internet dele pelo cabo, estando eu usando o micro desktop.
Encontrei Daí fui em busca de opção de tethering para o Milestone mas encontrei só o PDANet. Após algumas buscas, encontrei o Proxoid, que atende perfeitamente na questão de se usar o Milestone como modem 3G para acessa a internet através do PC.
A vantagem do Proxoid é a sua simplicidade e gratuidade,ao passo que o PDANet é pago...


Abaixo publico então a receita de bolo de como fazer:

Do lado do MileStone:

1) Faça o download do Proxoid 1.0.5 no link abaixo ou via o Android Market (vide QR-Code no final)
http://code.google.com/p/proxoid/downloads/list
2) Instale no Mile
3) Rode-o e habilite-o usando a opção Start/Stop
4) Vá ao menu de aplicativos, entre em Configurações
5) Entre na opção Aplicativos->Desenvolvimento
6) Ligue a opção Depuração USB
7) Pronto, do lado do Mile não precisa fazer mais nada

Agora o lado desktop:

1) Plug o Mile na USB
2) Execute as instruções desta página aqui:
http://code.google.com/p/proxoid/wiki/installationWindowsXP
3) Em resumo: Extraia o zip para um diretório
4) Execute o arquivo check-bat
5) Se tudo der certo, ele vai reconhecer um fone plugado na USB
6) Agora rode o start-tunnel.bat
7) Vá no seu browser, e "aponte ele" para usar o Mile como servidor proxy.
Por padrão, é localhost:8080
8) Pronto, agora é ir pro abraço, pois toda requisicao do desktop, será repassada
para o Mile!

Pra mim que tenho plano TIM ilimitado, é uma mão na roda me conectar sem me preocupar com o consumo. Usuários que não tem o mesmo benefício, estejam alertados que a conta de telefone pode vir salgada.

Recomendo fazer um ZIP do APK+Páginas do Google+ZIP do proxoid-adb, pois se o site sair do ar um dia, a gente não fica na mão. Outra dica é jogar o APK no SD-Card para facilitar futuras reinstalações via o Astro filemanager ou afins.

QR-Code do Proxoid:

quinta-feira, 30 de setembro de 2010

Como usar o Streetview no seu celular Android

Com a habilitação do Streetview no Google Maps brasileiro hoje (30/09/2010), me surgiu a vontade de acessá-lo no celular, para ver se a experiência no mobile era tão bacana quanto no desktop.
Me decepcionei.
O Google Maps para o Android, em sua versão 4.5.1 não oferece suporte decente ao Streeview.
Quando você o instala, ele habilita um ícone na sua lista de aplicativos, para você acessar o Streetview, só que é impossível estando nele, você digitar um endereço para encontrar algo, ou ir no Google Maps e encontrar alguma opção para colocar no modo Streetview !
O que fazer então ?
Fui então no Android Market, e após baixar uns 3 aplicativos diferentes, encontrei o Street View, desenvolvido pelo Wik Pun e que me atendeu no que eu queria, que era fornecer um endereço e ele me abrir no Streetview.
Se você quiser baixar o software, basta procurar no Android Market por "Stree View" ou pode executar o leitor de código de barras Barcode e mirar no código de barras logo abaixo que ele te leva até o aplicativo no Android Market:


Bons passeios no Streeview !