Jose C Gomez on November 23rd, 2010

As many of you I am tired of paying too much for cable television. We currently pay 150$ a month of cable and internet something which I find outrageous. So the plan is to go completely over the top. I am going to blog here about the experience and about how much money we are or we are not saving.

Here is the plan

  • Get NetFlix streaming only service for 7.99 that gives us access to unlimited streaming movies and TV Shows
    which takes care of the “On Demand” needs
  • Get PlayOn.tv which gives us direct access to Hulu, NetFlix, Comedy Central , CBS, ESPN, Nick, and TBS
  • Get Hulu Plus for a few extra Perks
  • Cut off the cable completely and see if I can survive
  • Get “Over the Air” some of the channels we can

Here are the shows that me and my family watch and where they are available

Parenthood – Hulu
House – Hulu (Plus) Day after Air
Biggest Looser  – Hulu (Day after Air)
Law and Order SVU – Hulu
Law and Order LA – Hulu
Undercover-boss – CBS
Fringe – Hulu (Day after Air)
The Walking Dead – N/A (AMC)
Merlin – Hulu
Leverage – N/A TNT
HawthoRN – N/A TNT
V – Hulu
Covert Affairs – Hulu (USA)

We start today! I’ll post on what progress / problems we run into

Jose C Gomez on October 17th, 2010

Day 0

So a friend of mine is trying out Shawn T’s Insanity workout and after looking into it I decided to give it a try myself. Tomorrow at 5 AM I begin my first work out with the Fitness Test. I will update here every time after my work out and at night I will update the information on the meals I’ve had throughout the day. Leave a comment or a suggestion and cheer me on!

Jose C Gomez on September 29th, 2010

The Obligatory Hello World for GO.

I won’t go int too much detail at the moment, in future posts I will make sure to revisit everything shown here. This is more or less a test

[gist id=602926 file=golang-hello.go]

Tags: , ,

Jose C Gomez on September 8th, 2010

Last year Google introduced Golang (GO) a system programming language.

“No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously”

GOlang takes a fresh spin at something we are all familiar with, it does it with class and performance. I have recently had the chance to delve into the intricacies of GO for class and decided to dedicated part of my blog to it as a resource for future programmers.

I have acquired the ONLY GO Programming book available and will be posting a review shortly. I will also start to develop a library of simple examples to help everyone out!

GO’s official site is located at http://golang.org

The book which has been facilitated to me can be found at http://www.goprogrammingbook.com/

GO Lang

Tags: , , , ,

Jose C Gomez on May 25th, 2010

As you probably saw either on Google, my site or any of the thousands of sites that reported it. In order to celebrate Pacmas 30th anniversary the folks at our favorite company Google, made their first ever animated doodle which let you play Pacman with its original sounds and levels. The blog at rescuetime.com has speculated that this awesome little stunt may have cost us $298,803,988.

If we take Wolfram Alpha at its word, Google had about 504,703,000 unique visitors on May 23. If we assume that our userbase is representative, that means:

  • Google Pac-Man consumed 4,819,352 hours of time (beyond the 33.6m daily man hours of attention that Google Search gets in a given day)
  • $120,483,800 is the dollar tally, If the average Google user has a COST of $25/hr (note that cost is 1.3 – 2.0 X pay rate).
  • For that same cost, you could hire all 19,835 google employees, from Larry and Sergey down to their janitors, and get 6 weeks of their time. Imagine what you could build with that army of man power.
  • $298,803,988 is the dollar tally if all of the Pac-Man players had an approximate cost of the average Google employee.

I don’t believe this numbers to be anywhere near accurate and I still appreciate and enjoyed thoroughly what Google did. I wonder if anyone ever calculated how much money we loose on Facebook every day?

Tags: ,

Jose C Gomez on May 21st, 2010

If you visit Google today you are greeted by the standard Google doodle. Today it represents the 30th anniversary of Pack Man

As usual Google has chosen to use, it’s logo to honor what could be considered one of the biggest games of all times. However, this time there is a twist. If you stay in the page long enough and click around. The doodle comes alive allowing you to control the pacman and play the game with the original sounds and all.

The interactive doodle — a first for Google — is the brainchild of senior user experience designer Marcin Wichary, whose earliest exposure to Pac-Man came at age five while traveling across his native Poland with his father, a game technician, to repair arcade machines. Wichary worked with Google doodler (yes, it’s a real job) Ryan Germick to create the finished design. more…

This right here, is why I love Google!

Update: Google has just posted an entry on their blog about the pacman game and its significance.

When I was growing up, my dad had the best job I could possibly imagine: he was an arcade game and pinball technician. For me, that meant summer trips through Poland’s coastal cities with their seasonal arcade parlors; peeking inside cabinets to learn programming and engineering secrets; and—of course—free games!

One of my favorites was PAC-MAN, whose popularity transcended the geopolitical barriers of that time. During the heyday of space shooters, Tōru Iwatani’s creation stood out as one of the first video games aimed at a broader audience, with a cute story of pizza-shaped character gobbling dots in a maze, colorful (literally!) characters, friendly design, very little violence and everlasting fun.

Today, on PAC-MAN’s 30th birthday, you can rediscover some of your 8-bit memories—or meet PAC-MAN for the first time—through our first-ever playable Google doodle. To play the game, go to google.com during the next 48 hours (because it’s too cool to keep for just one day) and either press the “Insert Coin” button or just wait for a few seconds.

Google doodler Ryan Germick and I made sure to include PAC-MAN’s original game logic, graphics and sounds, bring back ghosts’ individual personalities, and even recreate original bugs from this 1980’s masterpiece. We also added a little easter egg: if you throw in another coin, Ms. PAC-MAN joins the party and you can play together with someone else (PAC-MAN is controlled with arrow keys or by clicking on the maze, Ms. PAC-MAN using the WASD keys).

Tags: , , ,

Jose C Gomez on May 11th, 2010

Ever wanted to have an easy way to get the most recent entry for any given key on a massive database? I ran into this problem a few days ago at work and I wanted to attempt to explain how I solved it.

We have a large database that contains the lifetime history of our trucks GPS locations. The data in these tables is entered once every 10 seconds per truck, given the fact that we have about 30 trucks on average there are about 31536000 entries into this table per year and we have been running this program for several years now. We need a quick way to get the most recent location for every truck on the fleet regardless of whether it was last reported 10 seconds ago or 10 days ago.

For a while we had created a simple SQL query that returned the MAX(date) record for each given truck and this seemed to work all right. That is until yesterday evening, at that time the query that I just mentioned was taking somewhere in the realm of 10-15 minutes to execute, just long enough for our program to time out. Our table now contains somewhere in the realm of two billion records and this query is just not efficient enough. We attempted to optimize the query and gained some performance but not nearly enough to make a sustainable difference in the future.

The program that relies on this query is a real time monitoring system and we cannot sit there and wait for this to process during several minutes. An idea I had was to intercept the incoming stream and tag it as “most-recent” before insertion thus allowing a simple query such as “SELECT * FROM TABLE WHERE MOST-RECENT=true” would work. The challenge with this approach was, the interception of the data. We knew that we could write a simple database trigger, but had no idea if  would allow us to modify the incoming data stream.

Most of the database triggers happen after insertion, or update so this may have posed a problem. However it appears that Microsoft had thought about this for us and gave us “Instead of Insert” triggers. This triggers take the incoming data and allow you to do something with it other than actually inserting it into the database. We decided to take the incoming data, update the table to clear the “most-current” flag and then insert the data while updating the current records most-current flag. See the implementation below, we went from a 10 minute query to a milliseconds long query. And the overhead placed on the insert hasn’t posed a problem for the amount of data we receive.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Jose C Gomez
-- Create date: 5/10/2010
-- Description:	Trigger that allows us to keep track of the Vehicles most recent location
-- =============================================
CREATE TRIGGER InsteadofInsert
   ON  dbo.current_location
   INSTEAD OF INSERT
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for trigger here
--CLEAR THE OLDER MOST-RECENT FLAG
UPDATE current_location
SET most_current=0
WHERE most_current =1 AND  Device_ID in (SELECT Device_ID from Inserted);

--INSERT THE RECORD WITH THE MOST-RECENT FLAF SET TO TRUE (1)
INSERT INTO current_location
	SELECT Device_ID, Lat, Lon, date, ip_address, direction, speed ,1 
	FROM Inserted



END
GO

Tags: , , , , ,

Jose C Gomez on May 4th, 2010

As a follow up to my earlier post, I would like to make a jar library available that should allow you to access any RESTFull service that uses JSON. Simply import this jar file into your project and you should be good to go.

Please note that the attached jar file contains a compiled copy of the GSON library available at http://code.google.com/p/google-gson/.

Click here to download the jar file.

Once you have downloaded the above file and added it to your project you may use the following code to access a JSON web service.

The example shown here returns a collection of JSON objects in the form

[
{"alertid":"1","alerttext":"This is test","alertdate":"2010-02-11 09:03:40"},
{"alertid":"2","alerttext":"Another alert","alertdate":"2010-02-11 09:11:04"},
{"alertid":"3","alerttext":"This is third test","alertdate":"2010-02-11 11:00:57"},
{"alertid":"4","alerttext":"message from starbucks","alertdate":"2010-02-11 18:00:22"}]

The class I implemented to hold these object is as follows

public class alerts {
	
	public int alertid;
	public String alerttext;
	public String alertdate;
	
	@Override
	public String toString()
	{
		return "Alert ID: "+alertid+ " Alert Text: "+alerttext+ " Alert Date: "+alertdate;
		
	}
}

With the above class implemented, we can used the provided library to access the web-service available at http://www.sumasoftware.com/alerts/GetAlerts.php and parse its JSON repose back into our above mentioned java class.

import josecgomez.com.android.webservices.json.WebService;
//Instantiate your web service call
WebService webService = new WebService("http://www.sumasoftware.com/alerts/GetAlerts.php");

//Pass the parameters needed to the service
Map params = new HashMap();
params.put("var","");
//Please note that this service doesn't have any required parameters and I am only passing these as an example
params.put("firstName", "yName");
params.put("isActive", false);
//If you need to pass a JSON object as a parameter you may do so as follows
params.put("requiredObject", WebService.Object(myObject));

//Using GET
String response = webService.webGet("", params);
//You may pass it a method name if there is one as such
//String response = webService.webGet("METHODNAME", params);

//To retrieve an collection of objects
Type collectionType = new TypeToken>(){}.getType();
List lst= new Gson().fromJson(response, collectionType);

//Note that the above object alerts has to match the structure of our JSON object, please see the beginning of the post for an example. 

//To retrieve a single item instead of a collection
alerts alert = new Gson().fromJson(response, alerts.class);

//To use POST instead of get 
webService.webInvoke("", params);

I hope this helps, feel free to use this library anywhere you want, the source code for it is available in an earlier post so if you’d like to modify it feel free to do so.

Tags: , , ,