subscribe
Tags:
 
2012
2011
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
2012-05-16

On February 9, 2012 I showed off the Freedom Jar, a coin jar for my pocket change, that when full will be donated to a non-profit organization that promotes freedom. Well guess what?

The Jar is Full

This is all of the change in the jar.

For some reason, I had the uncontrollable desire to dump the change on the floor. Messy is good.

It's Not Going Back In

Try as I might, I couldn't get all of the change back in the jar.

How does that happen? It doesn't matter. The change was put in a bag and off I petaled to the nearest Coinstar machine. Hey Coinstar, please put the EFF on your machines as a charity.

$35.97

In total, the jar held about 39 dollars, and after Coinstar took their cut I had $35.97 to give to a non-profit organization that promotes freedom.

When I handed my receipt to a cashier in order to collect my loot, the cashier asked if I had 3 pennies. Hey, if I had 3 pennies, I would have put them in the Coinstar machine.

There was a 1958 dime that was rejected by the machine so I decided to keep it.

When I petaled home, I got online and donated $35.97 to the Electronic Frontier Foundation, an organization that fights for internet freedom.

Thank you EFF. Thank you very much.

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
3 plus 6
Answer:
required
2012-05-14

While working on MuttonChop, I was unhappy with the way that the Web UI updated based on the state of of the player. The reason for my displeasure, was the use of polling to determine the player state.

In pseudo-code, the polling is something like the following:

function check_player_state
    //get the player state
    state = get_player_state
    //parse the state and update the UI accordingly
    update_web_ui ( state )
    //sleep for 2 seconds
    sleep 2
    //check the state again
    check_player_state

Every 2 seconds, the Web UI checks the player state and then updates the UI.

Obviously I could shorten the polling time, but this leads to two issues that I'd rather not deal with.

  1. Constant polling creates far too much network traffic for my tastes.
  2. The steady amount of pulled data forces the client to work to much. If the client is running on a mobile device, this will cause unnecessary battery usage.

The solution, at least for me while coding MuttonChop, was to use a push technology known as Server Sent Events, which are part of the HTML5 specification.

In a nutshell, Server Sent Events work as follows:

  1. a client makes a connection to a server
  2. when the server has new data for the client, the server sends the data over the connection for the client to process

When not processing events, the client can be idle and save battery life (hopefully).

A Real World Scenario

While listening to music, when the track changes, the client interface should show the new track title and artist.

With polling, it may take 2 seconds for the UI to display the change.
With Server Sent Events, the update is almost in realtime.

The usage of Server Sent Events can make a sluggish polling based UI much more responsive to user interaction, and when dealing with Web apps, this speed up in responsiveness is very noticeable.

Client Support

Not all clients support Server Sent Events (in JavaScript terms, it is called EventSource). For example, the browser on my n900 doesn't support EventSource, and apparently the next version Internet Explorer doesn't support it either. fancy that.

In the case of MuttonChop, both polling and Server Sent Events are used. When the Web UI is first accessed, a line of JavaScript detects if the client can use EventSource. If the client can not use EventSource, the UI falls back to using polling.

Since the connection for using Server Sent Events uses HTTP and the data is transferred as text, it should be fairly easy to write programs to process the events using any language that has an HTTP library.

To see what the events look like for MuttonChop (if you are interested in such things), open the command line and curl the "events" url of a playing muttonchop machine.

curl MUTTONCHOP_HOST:2876/events

Taking this a step further, open a few connections to a MuttonChop server using a web browser or the curl method mentioned above, and change the volume on one client; the other clients should update the volume bar almost instantaneously. sweet sauce!

A great introduction to coding using Server Sent Events is available at http://www.html5rocks.com/en/tutorials/eventsource/basics/

Until later, happy hacking!

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
7 minus 4
Answer:
required
2012-05-11

After putting together the rotary phone beaglebone machine, I decided that I still needed to do something with the extra pinouts on the beaglebone. Since I had recently started using MyTinyTodo to keep track of my todo list, I thought it would be nice to have a quick visual display of how many things are still on my todo list.

To Accomplish this my goal, I would need to add some LEDs to the beagle bone and then hack some code to do what needs doing. First thing first: add the idea to the todo list.

Gather Some Components

In order to get this project going, a trip to the nearby electronics store was in order. After returning home with 10 green LEDs ( the plan was to use 6, but I figured buying extra would let me fry a few), I realized that there was a lack of 100 Ohm resistors in my home.

Fortunately, I had some 50 Ohms that I soldered in series to handle the job.

This is a very boring pictures; don't look at it.

Solder 6 of These

This is the basic circuit that get's wired to the BeagleBone. The extra length of wire will get cut off and the entire thing will be wrapped in a bit of electrical tape.

While I was at the electronics store, I bought some fans to replace the fans in the clock server because I think it runs too hot.

The Finished Circuit

Well looky looky! The circuit is finished. Six LEDs with a common ground, with a 100 Ohms of resistance for each LED.

Time to wrap these babies up with electrical tape and hot glue them into the BeagleBone's case.

Glued in Place

On the third attempt, I managed to almost get the LEDs glued into place where I wanted them. Yea, it took me a few time of gluing, and then prying the LEDs from the case a regluing before things were working properly.

As it is, one of the LEDs still doesn't let the box close very easily. Terrible terrible design. That's it! I'm firing myself.

Oh hey! This is probably the best picture that shows off the flowers etched in the glass.

7 Things On The ToDo List

At the time this picture was taken, there were 7 things on my todo list. But there are only 3 LEDs lit up. That's right, the LEDs need to be counted in binary from left to right.

With this setup, using 6 LEDs, the ToDo List will max out at 63 items; and I if I have that many things to do, something is very wrong.

Every 5 minutes, the LEDs run a simple animation sequence, parse the ToDo List RSS feed and then turn on or turn off LEDs as necessary.

Since there is still plenty of room in the box, I'm thinking of adding another something-or-other that is controlled by the BeagleBone pins. I'm not sure what it will be, but I can guarantee I'll have fun making it.

Hack on!

PS. I really want to have 15 things on my ToDo list, just so I can say "THERE...ARE...FOUR...LIGHTS" Ha hahahaha, I crack me up.

Comments
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
1 minus 0
Answer:
required