Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Tuesday, August 20, 2013

CityGrams - Google Maps and Instagram mashup

One of my hobbies is photography. I like it very much, as it allows me to freeze a moment in time. It helps me revive memories of my travels. Besides the more traditional photography, I like to do just "snaps". A few years ago, when I got my old Galaxy S phone I found an application named Retro Camera which simulates old classics like Lomo, Holga, Polaroid, Diana, etc. Nowadays the most popular app is, without a doubt, the Instagram, with million of users around the world.

You can see some of my shots here, or maybe follow me. :)
http://instagram.com/halufa#

Some of my insta-shots
I needed to check some of the possibilities of the google maps API. Coding and testing without a real purpose is boring, so I came up with the idea of showing instagram photos placed on the map, as soon as they are uploaded.

My approach was really simple: I thought it would be more common for people to georeference photos when in cities, because of the number of users and the better 3G signal. I guess I was right! In cities like London, Paris or New York several dozens of pictures are uploaded each minute.

The little app has an input box to allow the user to search for the city he wants and it asks instagram to give the photos from the last 30 seconds, refreshing with the same interval. I added a rollover event handler to bring the focus picture to the front and a click handler to display the original size.

I think the ending result was interesting and allowed me to confirm the awesomeness of google maps API.

If you don't see  photos for the place you have chosen, wait a bit or try a new location.


You can see the app working, here:
http://citygrams.googlecode.com/svn/trunk/CityGrams.html

You can grab the code, and change it as you want, here:
http://code.google.com/p/citygrams/

If you like the idea, please give me some feedback.



Monday, May 9, 2011

Hypnotic kamikaze burst in HTML5

Today, inspired by japanese kamikazes created another experiment using Canvas of HTML5.

Move the mouse around for some cool and hypnotic effect.

Saturday, April 2, 2011

HTML5 VideoWall Experiment

As an experiment video on HTML5, I made a VideoWall in Javascript. It copies the imageData from a video hidden outside the screen and creates some cool effects. Also added a reflection using CSS3 which makes a great effect and it's very easy. The video is in WebM format.

The developing was really straightforward, and the performance is not that bad.

Watch it here.

Only tested it on Chrome, not sure it will work on other browsers.



Video credits to Benny Benassi.

Thursday, March 17, 2011

SECURITY_ERR on Chrome using getImageData()

When playing a little with Canvas HTML5, I stumbled upon a Javascript exception SECURITY_ERR. After some search I found out that Chrome throws this exception if you're running it on as local file ( file:/// ) or using on a image from different domain.

If you want to disable this for a while just to make your development, you can start Chrome from command line with the switch --allow-file-access-from-files.

Example for Mac OS X:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files&

Saturday, February 26, 2011

Resistor value calculator in HTML5

A resistor is a two-terminal electronic component which implements electrical resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R further "resists" the flow of current I as given by Ohm's law.


Most axial resistors use a pattern of colored stripes to indicate resistance. Surface-mount resistors are marked numerically, if they are big enough to permit marking; more-recent small sizes are impractical to mark. Cases are usually tan, brown, blue, or green, though other colors are occasionally found such as dark red or dark gray.
Early 20th century resistors, essentially uninsulated, were dipped in paint to cover their entire body for color coding. A second color of paint was applied to one end of the element, and a color dot (or band) in the middle provided the third digit. The rule was "body, tip, dot", providing two significant digits for value and the decimal multiplier, in that sequence. Default tolerance was ±20%. Closer-tolerance resistors had silver (±10%) or gold-colored (±5%) paint on the other end.


Four-band identification is the most commonly used color-coding scheme on resistors. It consists of four colored bands that are painted around the body of the resistor. The first two bands encode the first two significant digits of the resistance value, the third is a power-of-ten multiplier or number-of-zeroes, and the fourth is the tolerance accuracy, or acceptable error, of the value. The first three bands are equally spaced along the resistor; the spacing to the fourth band is wider. Sometimes a fifth band identifies the thermal coefficient, but this must be distinguished from the true 5-color system, with 3 significant digits.
For example, green-blue-yellow-red is 56×104 Ω = 560 kΩ ± 2%. An easier description can be as followed: the first band, green, has a value of 5 and the second band, blue, has a value of 6, and is counted as 56. The third band, yellow, has a value of 104, which adds four 0's to the end, creating 560,000 Ω at ±2% tolerance accuracy. 560,000 Ω changes to 560 kΩ ±2% (as a kilo- is 103).

To try out EaselJS (a javascript library for working with the html5 canvas element) and inspired by Resistor Colour Wheel I wrote a small experiment, that can help finding the value of resistors: HTML5 Resistor calculator.




ALERT! This experiment won't work at all in Internet Explorer. You need Chrome, Firefox, Safari or any other browser supporting HTML5.