March 22, 2013

35 arguments in favor of Google Glasses -Part 3-


And finally, my last 15 arguments in favor of Google Glass, inspired on Edward Champion's "Thirty-Five arguments against Google Glass". If you haven't read the the previous ones, you can go to the first part of this article.

- " ARGUMENT TWENTY-ONE
It will turn more strangers into stalkers. "
This is a common concern with geo tag applications like Foursquare, and it could be actually dangerous if used without proper care on who we share the information with, same applies to Facebook, Google+, Twitter, etc. Also, just like with Foursquare, you choose when and if you want to share your position.

Foursquare has demonstrated the convenience of this kind of Apps but it takes it to a whole new level... they are great because they allow us to share information about good spots in the city and therefore, it makes easier to find the best places around just by checking the reviews, and since the users are the ones who posts locations and reviews, it is a more reliable way to find "hot spots" compared with regular advertisement. 

Also the ability to help you find your nearby contacts has other potential users, from finding your date on a crowded place to always keeping "an eye" on your children when they are at the mall. Yeah, it is an expensive gadget to give to your kid, but I'm sure there are plenty of parents who would appreciate the possibility to know were they're children are and maybe even what they are looking and hearing, this is priceless to prevent child abductions and abuse! if you are a worried parent, just think about the possibilities. At the same time glasses could provide useful signals for children, warning them not to cross the street, touching something or simply helping them find they're parents, because children also get scared when they notice they are alone and can't see were they're parents are (usually pretty close by of coarse).

One can even develop an App that will help you find potential stalkers! Glasses can recognize people, and they are good to remember peoples faces, so if they see the same person over and over, an App may be created to alert you something like "hey, this guy is always around, do you know who he is?" or if you have already tagged a stalker, it might be able to alert you if he spots him or her.

- " ARGUMENT TWENTY-TWO
It will create more cyber-bullying and stress. "
Cyber-bullying (and regular, old-school bullying) has always been around, and not only on humans! I have a beautifull 7kg (big and strong) tabby-orange cat called Midi, he is so sweet... with humans and relatives (my other 5 cats) but he is a bully with strange cats! He is very territorial (even though he was castrated a long time ago).

On the other hand, one can use Google Glasses to help you find guidance and/or help if you have problems with a bully, if you are careful you can also use it to gather evidence against him or her and use it to get help, maybe even a restrain order (depending on the authorities criteria).

- " ARGUMENT TWENTY-THREE
It could make you more willing to believe lies. "
It all boils down to each individuals criteria, but on the other hand, having a device that allows you to verify data by automatically and manually "googling" everything you see and hear will start creating the habit of always "backing up your statement" or double check information you've just heard or read, and this is a very good thing for man kind in general, we really need to do this more and stop spreading or believing unfounded data, just because you watched it on TV, read on a magazine or heard from someone (even if it is a teacher), I'm not saying that internet it's a 100% trusted source of data, but you can cross-reference data to be make it more likely to be accurate.

- " ARGUMENT TWENTY-FOUR
It will create more needless distraction. "
Or might help the use stay more aware of his or her surroundings, actually there are plans to make Apps that will use the technology to help blind people be more aware of they're surrounding  using the GPS and by being able to recognize things, it could give sound cues to make them more aware about what surrounds them, also help them avoid crossing red traffic signals and many other dangers to help them navigate safely around the streets, even on places they don't know making tourism a much more comfortable experience.

Google Glass doesn't use traditional headphones but it uses a technology called Bone induction, so it transfers audio directly to your inner ear without blocking your ears so it doesn't interfere with our natural sound source position awareness, this is a great thing for all users.

- " ARGUMENT TWENTY-FIVE
It will expand the Streisand effect to an unprecedented level. "
The Streisand effect is a curious modern phenomena, the mexican president Enrique Peña Nieto has learned it the hard way, several times (he likes being consistent hehe) creating trending topics on Twitter and other popular social media networks, maybe the worst was in the "Universidad Iberoamericana" incident were in an attempt to manipulate media, students started a national movement callled #YoSoy132, and maybe the Google Glass would open the door to such Streisand effects, but it is up to each person's criteria to consider exposing things like authority abuses or lies a good or a bad thing...

- " ARGUMENT TWENTY-SIX
It could prevent people from discovering themselves. "
Or use it to change your life completely and start something new, something you actually enjoy, like a famous video blog. This happened to Shane Dawson, and his story is a great example of how social networks can create new ways for artists to express themselves and make a living out of it, even people close to him like Shanna Malcolm has started a new life thanks you the opportunities this kind of technology opens.

- " ARGUMENT TWENTY-SEVEN
It will discourage people from seeking unfamiliar viewpoints. "
Or give people the opportunity to see the world from someone else perspective, it could be an artist, reporter, child, teenager, sky diver, rappel professional, etc. Eventually there will be a wide collection of videos from all kinds of people allowing us to see the world from a different perspective, this will help us better understand each other, and it is one more step towards a much more united world.

- " ARGUMENT TWENTY-EIGHT
It could create another place where advertisement takes over our lives. "
Maybe, but it could choose "useful advertisement", based on our preferences, habits, location... depending on the Apps we use and the information we choose to gave them.  also I'm sure there is going to be "Add-Blockers" for those who doesn't want to be disturbed by publicity (no matter how well chosen it is).

- " ARGUMENT TWENTY-NINE
It will create needless competition over who has the most worthwhile life experience. "
It is true that people are always finding excuses to compete... and competing about who makes the most out of they're life, might not be a bad thing if done with responsibility and kept positive, encourage people (especially Geeks, who are the first ones targeted to get one) to get out of the couch, go outside and think of new ways to create a worth-sharing moment... Doing exercise, seeing the world and at the same time staying connected just like they want. Even some especial video games could be developed to work on glass and encourage people to go out and do "real-life" quests... finding hidden virtual objects, or performing all kind of things on the virtual world placed on top the real one... much healthier than just staying home in front of a screen, and it has more substance and challenge than anything you could do with any in-door console. Imagine getting enrolled on a game which has hidden virtual clues on the public areas throughout  the city (or even the country). Gyames like this will promote people knowing they're city and going to other city's to try the quests or advance in a national quest, or even international for those who travel a lot far and wide... Everyone wins right?

- " ARGUMENT THIRTY
It will discourage people from striking up conversations with strangers. "
Or connect us all to a whole new level... let's get this pretty far to glimpse the big picture here, currently handouts support 10 people, so you could gather with people from other 9 different country's, start a hangout and each one share something, and they could understand each other thanks to speech-to-text and Google translate, all done live, just like Google+ with the translate app.

- " ARGUMENT THIRTY-ONE
It could discourage companies from hiring people. "
Or allow people to be productive from day 1 on a new job, imagine a salesman who knows all the prices, all the storage inventory, remembers all related merchandise, all the offers, all the policies and even recognizes all the frequent customers name and preferences... now imagine all your employees are like that, even the new ones... This is possible with Google Glass, the right Apps and enough personnel to keep all your customers happy and well attended, yes, Google Glass it's expensive, but it is a great investment for many stores that will pay itself from better employee performance and will also please the customers.

- " ARGUMENT THIRTY-TWO
It will create unfair advantages for online retailers. "
It is more likely to create new ways for online retailers to show they're merchandise, imagine you see something you like, but it is not inside a store or it is not for sale... but you liked it!, well Google Glass may find it for you and tell you the people who are selling it, how far they are and the price of each one.

- " ARGUMENT THIRTY-THREE
It could usher in a new form of vertical integration and that does not compensate talent. "
Living only on what you get out of Add-Sense or YouTube is not easy at all, but there is so many people out there that it is natural that the scene is quite competitive, but the internet is a fast ever-growing source of viewers and it is an always open chance for anyone to show they're talents to the world.

- " ARGUMENT THIRTY-FOUR
It will make driving dangerous. "
One has to be very responsible when using this kind of devices, writing on the mobile phone while driving it's a very bad idea, also changing the radio station, air conditioner, etc, but one can create some "driving" profile, to turn off e-mail and social media alerts and tag you as "busy" or "driving" and start the GPS, also it doesn't require you to stop looking at the road to check the map and signals, also it has voice control and text to speech features, as an added bonus, it is possible to create devices to make your car "Glass compatible" and give you information about your vehicle like the alarm if you are away from it or the current speed and how much fuel you have left, also alert you from engine problems, it is also possible to install infrared and give you proximity alerts, along with the actual distance of the object, maybe even a rear camera... there are endless possibilities for car accessories made for Google Glass users.

- " ARGUMENT THIRTY-FIVE
It could attempt to erase people in need from existence, as well as serious problems that we cannot ignore. "
There are lots and lots of people around the world who feels that no one understands they're point of view, no one knows who they are, etc. Google Glasses can open new ways for this people to conect to the world, to meet others and to express themselves in new ways using networks like YouTube, Google+, Facebook and having Google Hangout. This could make some people realize how valuable they are and how they can contribute and connect to the world.

This are just a few examples of how this technology could benefit a lot of people and help to make even deeper positive changes in society, arts, science, healthcare, sports, journalism, government and people all around. It will be very exciting to see all the unexpected uses people find for this to push the reach of the technology even further.

I hope you enjoyed reading this as much a I enjoyed writing it, and I really want to thank Edward Champion for inspiring me and I hope that people who share his fears find some insight between the lines of this article, I also hope they inspire other developers to help creating more Apps that will enhance the applications for this device in everyone's benefit.

Good day everyone, and thank you for your time.

March 19, 2013

35 arguments in favor of Google Glasses -Part 2-

@reicek



Let's continue (hopefully) having fun with my 35 arguments in favor of Google Glasses, inspired on Edward Champion's "Thirty-Five arguments against Google Glass". If you haven't read the first 10, you can read the first part of this article.


- " ARGUMENT ELEVEN

It could be hacked. "
Even though this is possible, same applies to your mobile phone, digital camera, laptop, email, Facebook, etc... It is also important to note that Glasses, so far, don't store data like your mobile, it is more a broadcasting system, and it is possible to intercept and decode a Bluetooth transmission, but it would be much more useful to go for your mobile instead than intercepting your camera feed and GPS location. And hacking the service won't be any different that stealing your Google account password, I use the word stealing since it's almost impossible to hack Google in a traditional way, with a creepy guy watching letters of code on a second screen and running a program the "deciphers your password number by number" this is movie stuff, usually a hacker or a cracker (very different things by the way) would trick you into making YOU give him your password by asking you to register into something else or with a fake sign-in page.

- " ARGUMENT TWELVE

It will discourage anonymity. "
One of the first things I always hear about using Google Glasses as a camera is "but I won't appear on the pictures!" and one can always log-in using a Nickname and you choose which things you choose to share. Also, the current social trend is trying to escape from anonymity, this is a very competitive era for most professionals who are trying to stand out above the rest, since it is now possible to work online, artists and professionals now need to face international competition so they have to be creative and show they're talents to the world. Also, the popularity of the social networks shows that lots of people doesn't want to stay in the shadows, they want the world to notice them (for good or bad).

- " ARGUMENT THIRTEEN

It isn't distinct enough from the body. "
If I go visit my grand mother wearing Google Glasses, the first thing she will notice right when she sees me at the gate, is that I'm wearing some Glasses, and close, she will notice the weird looking glass over it and the camera on the side and will definitely ask me what is that all about...

Google Glasses are designed to be comfortable I imagine James Bond trying to use Google Glasses as a hidden camera and expecting no one to notice it... especially for the red blinking light. Still, if you feel that your Glasses are not obvious enough, you can always make a shirt that says something like "Check it out! My Glasses has a camera and I am broadcasting live on YouTube" on the front and the back, that should do it. Or maybe you want to please "Stop the Cyborgs" and put something like "Warning! Cyborg broadcasting live on YouTube" you can even add some blinking lights on it... damn, now I want Google Glasses AND a cool "Look, I am a Cyborg" shirt... if you have kids, chances are that they will LOVE the idea or RoboDad or CyberMom.

- " ARGUMENT FOURTEEN
It could give the police far more details about you than you can possibly know. "
Besides what I already post on YouTube, Foursquare, Facebook, Twitter, Google+, etc... police has access to my public records and that's from your personal address all the way to criminal records, and more if a judge asks for it. Also, most people are not wanted criminals who needs to keep what they are doing (and themselves) hidden in the shadows.

On the other side, you can use them to show the police illegal activities, and help make your living hood a safer place. I live in a Mexico, and I know a lot of people who would wear them to be more protected from police abuse, like the people from the movement #YoSoy132 who would love to get the chance to use Google Glasses as a tool to expose authorities, and there are many other counties with social problems (like Egypt) that could be frighted in part by simply exposing what can be seen on the streets.

- " ARGUMENT FIFTEEN

It will discourage kindness and respect. "
It is true that some people can be rude with they're cameras, paparazzi's are a great example of a somewhat irrespectful use of a camera, and I usually understand artists complaints, and sometimes I feel they deserve some of the aggression they receive, but not everyone is like that, I remember having more trouble with strangers trying to appear in the photo than people getting mad at me because I am taking photos or videos. Again, there are places to do so, it is forbidden to take pictures and/or videos at some public places and there are signs posted on the walls. Also filming you inside your property without permission might be illegal in some places.

On the other hand, Google Glasses are an extension of the social media, which it's breaking lots of boundaries like social, geographical, cultural and even language (Google translate currently supports 64 languages) all this is bringing people closer than ever before, opening the path for a more pacific and united future for humans.

- " ARGUMENT SIXTEEN
Artists will be held more accountable for material that “offends.” "
Artists are (or trying to become) public figures, and as many have learned the hard way, they must be very careful about what they do in public and specially what they do on-stage. Also, in any kind of artistic expression, chances are that some people will find your work offensive. Michelangelo's work on the Sistine Chapel was once found offensive and he had to censor his work because the pope had a different point of view. Even today, you will find a lot of people who will find it offensive, but that doesn't mean it's wrong.

On the other hand, artists can find many ways to express and share they're art with the introduction of this new device, just like the camera did, and the video camera, and even mobile phones with cameras are a basic tool for modern artists who explores new ways to create art, a clear example would be Shane Dawson who is very skilled at producing some of his very popular content for YouTube simply using his iPhone.

- " ARGUMENT SEVENTEEN
It may kill off what remains of the movie-going experience. "
Recording movies at the cinema is a criminal offense in most places, and chances are that the cinema won't let you use Google Glasses while inside the movie. Also it is not a very good idea since it might distract you from the movie. Of coarse some people doesn't care and do annoying things like using mobile phones while the movie is playing, even texting can be annoying for other people since the screen is very bright and the cinema is very dark.

Oh the other hand, if someone is going to be reading things from a mobile phone inside the cinema (which is rude), it is way better to do so using Google Glasses since the light probably won't bother the rest of the audience, or at least, not so much.

- " ARGUMENT EIGHTEEN
It will create problems with consent. "
This again falls back in the user's responsible use of the device, and the same applies for pretty much anything, even a rock on the floor could be used for the wrong things. But Google Glasses, just like most cameras, has a red blinking light that let's other people know when the device is broadcasting. Again, if you don't like being taken on video, avoid public urban areas, they are filled with cameras! stop signs, ATM's, malls, streets, mobile phones, helicopters... (and some of them are even fed directly to the police). Maybe better stay indoors, some satellite with a high resolution camera might be looking your way, no wait! some what about IR satellites in surveillance planes? Hmm... go deep underground, remember simple holes on the ground are not good hiding places anymore... if someone had just warned Saddamn Hussein about it.

- " ARGUMENT NINETEEN

Cool places will be outed by boors. "
I don't think Google Glasses will attract poorly educated individuals to cool places at all, but some of the people who goes to cool places might be wearing a Google Glass and share the view to the world, it might be used to show the beauty of some natural places to help spread the importance of protecting it's beauty without the need to carry heavy equipment. The people at National Geographic might find it really useful.

- " ARGUMENT TWENTY
It will discourage people from paying attention."
Most people are very bad observers and can be easily distracted by less imporant things, Magicians use this human quality all the time. Machines on the other hand, are really good at paying attention, and Google Glasses can help you notice relevant spots and find useful information about your surroundings, especially when you are at unfamiliar places, so they might actually help people pay more attention on the details that might otherwise pass ignored.

The final 15 arguments will be discussed on " 35 arguments in favor of Google Glasses -Part 3- "

March 18, 2013

35 arguments in favor of Google Glasses -Part 1-



I remember when I saw (on YouTube) the live presentation of Google Glasses I was marveled at the ability to broadcast a hangout from a skyfall... I was even more excited when I heard about it's advanced enhanced reality system, giving you information about the things around you by just looking at them.

As a Google developer I was even more excited about the API that would allow me to use the Glasses power for my own Apps... All kinds of stores could benefit from it in so many ways, from security guards being able to spot "known thieves" automatically just by looking at them to sales people getting instant information about products just by holding them, allowing for much faster and accurate service.

The platforms possibilities are endless... I'm sure mobile real-world based Game Apps will find it really appealing and I can't wait to see the ideas that emerge... But it's impossible to please everyone, and people will always find (or make) reasons to complain about new stuff, and by creating an even more globally connected community it's normal to scare globaliphobics and related...

One of such groups created a campaign against the use of Google Glasses! (for the joy of the competition) called "Stop the Cyborgs", inspired by Edward Champion's "Thirty-Five arguments against Google Glass" and I had so much fun reading them, that I want to share my view about this arguments:

- " ARGUMENT ONE

It could destroy whatever shreds of privacy we have left."
Unless you or someone you invite to your home wears Google Glasses, you're privacy will be intact, privacy on public places it's an odd concept, for it implies that you accept been seen by the people who happens to be physically there but not the rest of the world, somehow complaining about being "too public" on a public place. I'm not against it, I just find it odd, if you feel uncomfortable you can go away from people with Google Glasses, just like you would with a place with too much people, an scenario or any place with cameras (like malls, stop signs, ATM machines, schools, tourists, etc.)...

What Google Glass does is to allow people to store (or share if they find appropriate precious private moments that might fade otherwise.

- " ARGUMENT TWO
It will turn the United States into a surveillance state."
First, Google Glasses are not only sold in the United States of America, and as far as I know, there are plenty of public and private security cameras in most major cities of that country, I don't see how this will make a bigger impact than the mobile phones with embedded cameras and Internet access, or any camera or video recorder whatsoever.

By allowing the average person to do live broadcasting it's possible to enhance social security in many scenarios by making possible to have lots of other persons from around the glove as witnesses and even saving the information in a secure place, even if the device is taken away and broken. This partially protects the user in abuses from authorities or other civilians. In Russia it has become a necessity to install a camera in the car to have evidence in the case of an accident to over come reckless driving problems, such videos are very popular on YouTube, I don't know about the rest of the world, but Russians will certainly appreciate Google Glass.

- " ARGUMENT THREE

It will hold more people needlessly accountable for easily pardonable activities. "
The law it's clear and mandated, and only an authorized public authority can decide the penalty of each fault or grant a pardon. Like it or not, it is implied by the Social Contract you acquire by living inside some nation. If this device will help reduce criminal behavior It means that just by wearing it, you are helping to make your city a safer place!.

- " ARGUMENT FOUR
It is remarkably easy to steal a pair of glasses. "
And stealing it's against the law, and its also easy to steal a purse, mobile phone, wallet or even a car if you know how... But that still, most people find it very convenient to possess (and actively use) purses, mobile phones, wallets and cars... In the case of Glasses, most people wears them because they need them for medical reasons. Same could apply for some future Google Glasses users as well.

Apps could (and will) be created to aid people with certain illnesses, E.G. people with certain levels of Asperger could benefit from a device that would help them notice certain body, face and voice cues that would be otherwise ignored by the user, helping them integrate better into society.

- " ARGUMENT FIVE

It gives Google far more personal information than it needs to know. "
You choose when and how to use them, and you can read the Service Agreements of the Apps that are going to run inside the device and decide to accept them or not. If you decide to broadcast a public hangout the next time you get diarrhea, you will be giving the world more information than they even want to have, even then, it will be up to the world if they decide to watch such broadcast. And hey, if you have the right App, Google Glasses may help you find and order the right pill or get you in contact with the right kind of doctor. Again, it is up to you how and when to wear the device.

On the other hand, it allows smart advertising based on were you are and/or what you see, so instead of just pointless (and sometimes annoying) adds, you will get useful data in the form of publicity like the menu and prices of the restaurants in the area or to help you spot a nice shop that sells stuff you like.

- " ARGUMENT SIX
It will open new possibilities for online sexual extortion. "
Sexual extortion its another criminal offense, and there are authorities to deal with it, and there is very little difference between this and a phone with an embedded camera. If you choose to engage sexual intercourse with someone wearing such an obvious device you can infer what's going on, worst case scenario, there are laws to handle this as well.

On the other hand, it may protect a person who is victim of sexual harassment by exposing the aggressor in fraganti.

- " ARGUMENT SEVEN

It may increase violence. "
Web-enabled video cameras may inspire criminal thoughts for some people, it is up to those people if they succumb to those thoughts and usually authorities get involved shortly afterward. If you get this kinds of thoughts too often or they are starting to get overwhelming, please refer to a professional psychiatrist as soon as possible to help you before it becomes a problem that may affect your personal liberty and other peoples well-being.

Actually cameras are used to decrease violence in most public places. Having cameras on everyone's head, statistically promises less violence.

- " ARGUMENT EIGHT

It will discourage personal risk. "
Actually it may encourage some people to take unnecessary risks just to show-off, but if you read the author's reasons he mentions a experiment on 2011 that proved that security cameras discourage students from cheating... Bad, bad cameras... those poor students may not have studied well enough for the test and may now have to face the consequences... If they had just read that essay... Nah, it was the cameras fault... right?

Certain high-risk activities could be shared by professionals via YouTube and Hangouts so other's could see the experience, and a new-comer to extreme sports could benefit from watching this kind of shows, so when they go for it, they will have a better idea of what to expect (and hopefully do).

- " ARGUMENT NINE

We have no idea what health problems Glass will create."
Google Glasses, just like any other licensed product need to be approved by the FCC, and its build using proven technology. Here is the link to the filling of Google Glasses in the FCC. One can read about the technology involved in making the device work and the RF exposure information that comes with the documentation.

On the other hand, Google may assist health service personnel, medicine students and even general public by providing valuable information to the user as needed, or one doctor could start a hangout with many other specialist so they can all see and work with a patient without being all gathered around him or her (which could be bad for the patient's health).

- "ARGUMENT TEN

It may increase violations of doctor-patient confidentiality and attorney-client privilege. "
If a professional publishes a video or photo about sensitive information using glasses, they will be published by his or her name, and will be a very strong evidence to support a demand that may cost the professional license of the aggressor.

On the other hand, just like doctor's could benefit from Google Glasses in so many ways, lawyers could also think of ways to get valuable evidence that may be used to facilitate justice enforcement.

I decided to split the 35 arguments in a series of 3 posts, the next 10 arguments will be discussed in "35 arguments in favor of Google Glasses -Part 2-"

March 16, 2013

Insights about ScriptDB


ScriptDB it's a great way to store and share JSON data for your Apps Script web apps! It's fast, free, flexible, and also provides plenty storage for most cases.

Let's start by pointing out ScriptDB's performance... inserting, updating and deleting data it's very fast and the time basically depends on the amount of objects we are working with regardless of the overall Database size, being consistent in performance from start and until you fill out your quota makes it suitable for many applications were other approach (like querying data from a large Spreadsheet) are just too slow.

ScriptDB does has a quota (limit), and it's set per user, so the quota space is shared by ALL your web apps. However, it is possible to connect to other user's ScriptDB by sharing Script DB libraries.

ScriptDB's query and storage it's quite flexible for storing and retrieving data from your DataBase. You find data by querying a specific subset of the JSON objects and it has methods that resembles the logical AND, OR and NOT, comparison operators and even facilitates sorting and pagination of the results, all this to allow you to adjust the output to your code's needs.

It also allows you to do the results iterations in many ways, and the one you choose mostly depends on your code's needs and your personal style. It has the  next() & hasnext() methods if you like using While loops or you can use the result.getSize() method if you prefer the For loops.

One last thing I'd like to mention about ScriptDB is it has something called "locks" which are used mostly for certain transactions were you don't want two instances running at the same time (to avoid over-writing) like in accumulators. There are two kinds of locks, public and private. In short, the difference is that public only allows 1 instance of the APP to run at any given time and the private lock only allows each USER to run 1 instance of the App at any given time.

Feel free to post your ideas, suggestions, requests, etc at the bottom of this article.

Happy coding!

March 9, 2013

How to easily code your Spreadsheet filters for Google Charts with the Javascript Visualization API


Google Chart's are pretty cool! they help you easily add charts to your web pages/apps with a very professional and clean output, even better, when they make updates to the Charts, the improvements get's applied to your page or app automatically and most of the time with no or very little modifications to your code.

There's also the Google Chart's Playground that will help you to easily code and test your charts, and it's full of very useful examples. If you haven't tried already, I suggest you to check it out when you get a chance.

But hand-writing static data for your charts it's not what you are looking for in most cases, luckily the guys at the Google Charts team provided many ways to import your data, on this article I will focus on what I believe it's  the most powerful/flexible feature of Google docs which is Spreadsheets. With a capacity of 400,000 cells it's more than adequate for most small/medium size DB needs and it's pretty fast if used properly! With the added benefit that you can see, share and edit the DB itself directly from the spreadsheet, it's like a 1,000 times more natural for any normal human than reading it from raw code and/or having to make query's to get some data like with SQL or even Google Cloud Storage (which it's usually CSV data).

Also you can use split your data in different Spreadsheets to leverage size and improve speed and readability if your handling tons of data, and it's all for free, BUT you do need to get that information, put it all together, filter it and get it ready to display on your favorite chart/s and finding the right way to do so can be annoying at first, so let's explore a simple and very flexible way to do this using the Visualization API and some Javascript parsing.

First we need to see our data, let's imagine we have a few Salesman and we record the every sale in a spreadsheet saving the salesman's name, the amount he/she sold and the date.


Before we start coding,we need to publish the Spreadsheet we've just created, we are going to need the public URL to query it's contents from Javascript.



Important Note: Be careful on this part, only the people who has access to the spreadsheet will be able to use your HTML/Javascript Charts, so be extra careful if you choose to make it public to the web or just available to specific users. 




Now let's hit the code! We need to send a query to the public URL of the spreadsheet to pass it's contents to a Javascript function, so let's write a function specifically to do this:



It's a best-practice to start the function that will parse the response with an error handler, this could be easily done using an if-clause like this.


Assuming we didn't received an error (I've never seen it actually happening), we have to get our data table and it's a good time to sort it so let's sort it by Platform, it's quite easy!



Now we have to build the filter, assuming we want to change the order to |Date|Salesman|Sale|. This is a very simple way to plan the filter by analysing our Spreadsheet's headers:



To do this filter, first we name the variable, then we call the Visualization's API data class to group and rearrange our data, this method requires the name of the variable containing the original data (in this case data), then we write the number of the columns in the order we want to show/group, finally we want to sum the last column (Sales) to show the total sale of each salesman, each day.



It's ready to draw! for this kind of data a Tabla Chart it's the most suitable one. (We'll discuss how to take the most out of a Date|Object|Sum piece of data parsing it to properly display inside a Line Chart) but first we need to add the $ prefix to the Sales column, here's how to do it:
Note: Use the column number of the filtered data table (chartFilter).



But just plain numbers inside a Table Chart it's boring right? to get that you can just use an iframe to display the data and save yourself all the trouble... But a Table Chart can do so much more, let's just scratch the surface by embedding some HTML formatting to the cells to give it a little bit more flavor, let's embed a Bar Format to make your Table more meaningful for the user.



Well, it's time to put it all together, let's get a look at it!



To see it in action (and check the complete HTML), click on the following image:


Also, if you like the contents of this article there is a public folder with all the documents, pictures and the example page in the following link:

https://docs.google.com/folder/d/0B_RClkFMLkcpVHljWk53ZEhzU2s/edit?usp=sharing

Feel free to post your ideas, suggestions, requests, etc at the bottom of this article.

Happy coding!

March 3, 2013

How to easily embed a Google Calendar to your Drive hosted HTML using iframes

@reicek
Google Drive Developer Expert

Embedding a calendar on your webpage or web-app it's quite fast and easy thanks to Google's Calendar i-frame creator. And you can even decide who has access to the Calendar, this allows you to share a calendar inside a webpage with your friends, family, co-workers  etc. without worrying about some other people finding your website and looking at the calendar.






First create a calendar at http://calendar.google.com using the "Quick add" option, you can find it next to the label CREATE at the left of the page. Only assign a name to the calendar you are going to share, and click "Add".

Now find your calendar in the "My Calendars" tab, click the small icon at the right of the name of the calendar you've just created and finally click on the "Share this Calendar" option.





Now it's time to decide if you are going to make the Calendar "Public" or to only "Share with specific people". Be careful when using the "Public" setting since anyone with access to the i-frame address will be able to see it. If you choose to "Share with specific people" you must enter the Gmail address of the people you wish to grant access to the calendar, in this case it's necessary to use a browser already logged into one of the authorized Google Accounts.

In this same page we also need to check the "Permission Settings" here you can individually choose the permissions of the people that you gave access the calendar, usually one uses "See all event details". The "See only free/busy (hide details)" option it's useful when you only want to share if there is space available on that period or not, without giving details about the events stored in the calendar. This is very useful for administering your agenda with your clients.




Now go to the "Calendar Details" tab, here you can check the "Name" once again and also you can setup a "Description" of the calendar along with the "Location", setting up the description and location of a calendar it's optional, so you can leave them blank if you don't require them. In the "Auto-accept invitations" tag you can decide if the calendar should add requests automatically from other users or not, "Auto-accept invitations that do not conflict" it's the most common one, it will allow people to add new events as long as they're not at the same time with a previously added one. Once you are done with the settings, find the "Embed This Calendar" tag, here you can find a Default iframe, but I suggest to click on the "Customize the colour,  size, and other options" legend to create a custom iframe tag for your HTML code.

This is where you personalize the calendar inside the iframe to match your needs and style. You can set a "Calendar Title" to show in your iframe (this is independent of the name of the calendar and it's only a text frame to optionally draw on top of your calendar), there are many other options you can play with in the "Show" check list, personally I prefer to unselect all the options to give the calendar a more stylish look, this becomes a necessity in at a resolution of  300 x 300 or lower, you can set-up any resolution you see fit, usually 150 x 150 it's the minimum for a month calendar to display properly with all the "Show" options disabled. Once you are done customizing your iframe, copy the HTML inside your page, remember you can host it for free with you Google Drive account.



This is the HTML code we got for our example iframe and it's ready to add it to your own webpage or webapp inside an iframe tag:

src="https://www.google.com/calendar/embed?showTitle=0&showNav=0&showDate=0&showPrint=0&showTabs=0&showCalendars=0&showTz=0&height=400&wkst=2&bgcolor=%23FFFFFF&src=fh28avieusq7r47mbm5lskimgk%40group.calendar.google.com&color=%235229A3&ctz=America%2FMexico_City" style=" border-width:0 " width="400" height="400" frameborder="0" scrolling="no"

Here you can see it in action:



Feel free to post your ideas, suggestions, requests, etc at the bottom of this article.

Happy coding!

March 2, 2013

Tips on how to stop being a "cow" in Travian


Travian it's one of the most popular browser games in the world, I've played it myself for more than 5 years already and I know that it can really be quite addictive, I remember some of the membersof my "Guild"  and myself staying up until 4 am just waiting an attack's arrival, coordinating with 300 people to get payback from some enemy attack or going into war with the #1 guild in the server... You make friends, enemy's, ally's... and even moles! (what kind of war would be complete without some spys?)... so there's a lot to this game and there are so many ways to play it... but there are lot's of "professional" players who are very aggressive and they feast on the new-comers lack of experience on the game, effectively frustrating new-comers by "over milking the cow", meaning, they attack & steal over and over, not letting the player develop his/her village(s) to the point they decide to close the account...

I know it can be a very frustrating situation and it might seem that the only way out it's to close the account... but most of the times, there's actually a way out, and with time and planning, it can be so elegant that you may get a respectful "Nice travian" message from your aggressor.

First, let's start by pointing out the things you should NOT do:
  1. Don't talk to your attacker. I can't state this enough, don't ever send your aggressor a DM (Direct Message), this will make him notice you, and it will make it more fun or even personal for him/her, so... No Talking.
  2. Don't offer him/her a pact. Every now and then, a cow or even a heard (when a player/ally takes a whole ally as a cow) offers to pay tribute in exchange for some breath, some attackers even demand a cow or heard to pay him in return for protection from other players (and him/her), this can sometimes be used to mount a strategy, but that will most likely piss off the attackers guild and end up real bad for you, it's best to just ignore all the messages you may receive, so... No Talking!.
  3.  Do not try to defend yourself. Most people try to mount some defence, but there is no way you can build troops fast enough for this, so the few troops you manage to create will become experience for the attackers hero, and for him that's even more valuable than resources!. Even if you coordinate a defence with your ally, chances are it will only become into more EXP for his/her hero. If you are a cow, it's a fact that your ally its not a "professional" guild, and a veteran player could provoke your ally to mount a big defence, get a lot of EXP out of it, and once that single resistance it's broken, he/she's free to take you and your friends as cows, so... Do not engage in anyway.
  4. Do not try to attack!. It will be just a lot of easy EXP for your enemy, this WILL make it personal, it's almost a fact that you will get your villages wiped out or taken away, and the worst of this is that it will make the game much more fun for your attacker, so... Do not engage in anyway!.
  5. Do not use traps!. It will make him attack back with all his army or worse, simply use you to "store" his troops and pay for the cereal, while he makes uses that extra cereal to build a bigger army (and use it to take his troops back, plus some EXP), so... Do not engage in anyway!!.
  6. Do not let him find you with a full storage and not enough cranny. This is what makes someone a cow, always use all the possible resources before an attack arrives, expand your cranny and traps, accept any offer you find from the market with the left overs (even if it's a bad one), so... Don't let him/her take your resources.
Now, let's mention some of the things you should do:
  1. Build and expand your cranny space. Your cranny space should be 1/3 bigger  than your storage space to avoid being stolen. Always returning empty handed from your village it's usually the best way to make an aggressor to stop harassing you. Plus it will let you keep expanding and also let's you get ready to build your next village in a safer area. Only assign the buildings you need to get ready for making settlers, use ALL the other space to build Crannys, once you have your first on level 10, place a level 1 cranny in all the free spaces to give you a nice cranny storage boost. You can demolish a few later (if really needed), so... Fill your village with crannys.
  2. Create troops and send them away. It is important to have troops in Travian, but one thing is having and other thing is wasting... if your are being attacked by a bigger player, just send your troops to a far away village (24 hours its the best) as reinforcements, to avoid a penalty, remove your troops as soon as they arrive and always send enough food for at least 1 hour to feed the troops you sent. It's of good etiquette to send a tiny amount of resources as well. Once you have enough troops, look for your own cows (but far away), this will get a few extra resources, you don't need to send cereal or be ready to return the troops as soon as they arrive. The idea is to keep your troops travelling to avoid wasting lots of unused cereal by not having troops and also reduces the change of getting your troops killed, it can be a little bit complicated at first, but it's the safest way, so... Keep your troops on the road.
  3. Keep your main building at least on level 10. This will allow you to build faster and most important, to destroy buildings if needed, if there are catapults involved, this will be one of the first things a "professional" player will attempt to destroy, so... Keep an eye on your main building's level.
  4. Keep your storage capacity 1/3 under your cranny capacity. Do not hesitate on dropping down your warehouse and granary a few levels, you can build them back once you have enough cranny capacity, so... Don't store more than you can hide.
  5. Build crannys. Once you have a level 10 cranny, fill all the empty spaces with a level 1 cranny, if you have some un-essential building, demolish it and place a cranny instead, once you have filled all the possible spaces with a level 1 cranny, upgrade them one by one up to level 10, so... Keep empty spaces filled with crannys.
  6. Upgrade your wall. Once you are done with the crannys it's time to make your wall stronger... it's a good investment for the future since it will greatly improve your village's defence when you have enough troops (at least 200).
  7. Build everything your race needs to make spys. You will need them to detect other spys and mostly, to find potential cows for yourself.
There are some players that will not stop until they make a player close his/her account... fortunately most players are simply looking for resources so they will stop assaulting your village after a week or two without any profit.

Once you have noticed that you don't receive more attacks, it's time to prepare yourself for future "cowboys", if you are a Gaul its time to start upgrading and creating traps. You need at least 200 troops in your village to stay with relative calm. Beware that some players only want EXP for the hero, and in later stages of the server 200 troops won't stop the big ones.

Be patient, think forward, learn from your enemy and mostly, enjoy the game... if you are constantly under attack, enjoy developing your defensive strategy and pay attention to your enemy's actions, you can learn useful tricks that will help you in future servers.

Hope you find this tips useful, feel free to post your opinions and requests at the bottom of the page! If you are willing to learn new defensive strategies in Travian, feel free to contact me for instructions on how to join me in the server I'm playing at the moment. Beware that my ally "300-HLV" runs on spanish servers and its a training/full defence one that settles in a far away territory, usually around (200|200) since I only follow a the "Super Cell" strategy (wich I will describe in detail in later posts) and that we are 100% neutral, we do  not do anything outside our "territory", at the later stages of the server some players start appearing around our territory, but we work hard to keep it all clean from any intruder...
Happy Travian!