Archive

Archive for the ‘Google’ Category

Google Cookie Monster, Part Deux – Where Is The Debate??

Wednesday, 22 February 2012 1:45 am 1 comment

I’m rather disspointed by thispost on GigaOm, responding to Microsoft’s Dean Hachamovitch’s post doing a little Google Privacy exposé of his own. .

The GigaOm post, it seems, blames Microsoft for pulling Google up on its failure to adhere to an old standard, in this case the P3P standard. This standard is meant to allow a site to notify a browser, and hence the user, on what it will do with the information it collects from you. In other words, the standard is meant to solve the very problem that started Google Cookiegate.

Instead of blaming Microsoft for jumping into the fray and touting its own browser, rather we should be pointing out that not only is Internet Explorer the only browser to implement this privacy related standard, but the fact that Google has highlighted the need for it to be improved.

Why is it that no other browsers implement this standard?? Why is it that there is no movement for it to be improved? All those bloggers calling bloody murder over this Google Cookiegate should be urging the updating and wider adoption of this standard.

Far from being a damp squib, Hachamovitch’s post is an important contribution to the debate. It may be self serving, but who else would have known of the existence of this standard if it wasn’t for that post.

Come on GigaOm – I expect better than blindly bashing any contribution Microsoft makes.

Categories: Google, Microsoft, Rants

LINQ + Google Charts + MVC : Pie Chart

Tuesday, 1 November 2011 3:52 pm 1 comment

A couple of weeks ago, I pointed out a LINQ snippet that was running against the Google Charts API.

This week, I’m back with my implementation of  the Pie Chart.

I’ve started with the Pie chart because its relatively simple and will lay the foundation for dealing with the complexities of the other charts.

Building Blocks

Since this is MVC, I created a new ChartsService class in the Services namespace of the project.

If you look at the snippets in the original ACM article, you’ll notice an extension method called “SeparatedBy”. So our first task is to create this extension method.

There are, of course, a number of ways to concatenate a list of string with a separator. This being an exercise in LINQ, we are going to use the LINQ Aggregate method.

   
public static string SeparatedBy(this List<String> list, string seperator)
{ 
return list.Aggregate((current, next) => current + seperator + next); 
}

 

I’m sure that you’ll agree with me when i say that it’s a nice and clean approach to what could be a messy block of code.

However, that extension method will only concatenate the list of strings passed to it. Why is this a problem? Because we are going to want to concatenate lists of int objects as well. So that extension method will just not do. We  could do some fancy work with generics, but the simplest thing to do is to supply to an overloaded method that accepts lists of type int.

public static string SeparatedBy(this List<int> list, string seperator)

List<string> thelist = list.ConvertAll<string>(x => x.ToString());

 return thelist.Aggregate((current, next) => current + seperator + next); 
}

There is one additional difference between these and our original method – the call to ConvertAll. Rather than have a foreach loop that does the conversation, we simply supply an inline lambda function that gets executed against each item  in the list and returns a list of the desired type. Again, very clean.

 

So, armed with these extension methods, we can now declare our classes.

Data

Google charts offers a wide range of functionality and many different kinds of charts. Each chart has a host of differing options and settings available to it. So when creating classes to represting thse charts kinds we have to bear in mind that there will be unique functionality not common to other charts that will come up.

Charts logically are made up of a number of  smaller complements:  bar charts have columns, pie charts have slices and so on and so forth. So we’ll represent these first.


public class Slice
{
public int Value { get; private set; }
public string Legend { get; private set; }

public Slice(int value, string legend)
 this.Value = value;
this.Legend = legend;
}

} 

Lets first look at the Pie class itself now.

Pie Class


public List<Slice> Slices { get; set; }
public string Title { get; private set; 
public Double Height { get; private set; }
public Double Width { get; private set; }

public Pie(string title, double height, double width)
{
this.Slices = new List<Slice>();
this.Title = title;
this.Height = height;
this.Width= width;
}

We start by declaring a number of properties and a constructor. In the constructor we initialize our list of Slices. This is where we see a departure from the snippets of he ACM article.  We do not pass the slices into the constructor. Of course, this is an issue of style over substance. There is no reason why we could not have generated the slices before the creating the chart and then passed the slices.


public string Compile()
{
var tt = Title.Split(' ').ToList().SeparatedBy(' ');
var p = new List<string>(){
this.Slices.Select(slice =>slice.Legend).ToList().SeparatedBy("|"),
this.Slices.Select(slice =>slice.Value).ToList().SeparatedBy(",")};

return string.Format(@"http://chart.googleapis.com/chart?cht=p&chtt={0}&chs={3}x{4}&chl={1}&chd=t:{2}", tt, p.ElementAt(0), p.ElementAt(1), this.Width, this.Height)
}

This is where all the important stuff happens.

Line 3 properly formats the title by putting a + sign to signify spaces between words. Note that we are using the extension method we wrote earlier.

Line 4 creates a new list of strings, each string being the comma or | delimited list of values and legends. Using a List gives us greater flexibility later on when our implementation will handle multiple data series and legends

Line 8 uses String.Format to merge all this data into a url that we can use to call the Google Charts API with. For an explanation of what each of these parameters mean, see the Google Charts API Parameter List

 

ViewModel

Now, this being MVC, the way to display stuff is by using a ViewModel. So lets create one:


public class MonthlyReportsViewModel
{
public MonthlyReports Details { get; set; }
public Pie Chart { get; set; }
 }

The one property we are interested in here is the Chart Property.

Now that we have our ViewModel, we have to populate it. So, in our ActionResult method:


<pre>Pie chart = new Pie("This is my chart",200);
chart.Slices.Add(new Slice(25, “Slice 1”));
chart.Slices.Add(new Slice(25, “Slice 2”));
chart.Slices.Add(new Slice(25, “Slice 3”));
chart.Slices.Add(new Slice(25, “Slice 4”));
model.Chart = chart;
return View(model);

 

View

In our View itself, we’re going to have to render out the chart. Since the call to Google Charts API will return an image, we can simply do the following:


<img src = "@Model.Chart.Compile()" alt ="">

 

What one could do is to put the actual rendering code in a Helper Method and call the Helper Method from your view, like so:


@GoogleCharts.PieChart(@Model.Chart)

That, of course, further abstracts the code. It does have the advantage of being much cleaner and easier to do.

 

Conclusion

As you can see, using LINQ to abstract away the complexity of what your code is actually doing is not just the province of database code. One thing what I’ve enjoyed about working with LINQ is how code always comes out looking fresh, clean and crisp. Having worked extensively with LINQ and Lambda expressions, using foreach loops  to process Lists looks so much messier.

Next time, we’ll take a look at the somewhat more complicated Bar Chart. I’ll not cover every single possible piece of functionality, but I’ll cover the basics. All I want to show is how the foundation laid down today can easily translate over. My current implementation of bar charts is sufficient only for the limited functionality the app needs and nothing more. 

At some point in the future, I’d also like to implement Line charts.

 

Postscript

I must say that apart from working with LINQ, its been a very satisfying experience for me to implement a C# version of a web API.

There is GoogleChartsSharp on Codeplex that Implements a whole lot more of the functionality of Google Charts. I did indeed use it for a while before implementing it on my own.

So its been a satisfying experience for me to implement an API that allows me to work the way I want to work. Not only did I write something simpler and easier to work with, but I dropped a dependency in the process and that made me happier than I think its safe to admit. 

Writing against something requires you, the writer, to pay extra attention to the small details. It requires you to think of the relationship between your code,the web API  calls and the documentation that supports it. When one uses an already baked implementation such as GoogleChartSharp, its like working with a giant black box  you have no idea what goes on inside. And you really don’t want to know the finer details. But writing the API, you create a white box. And you HAVE to understand those finer details.

So while the LINQ is nothing special in and of itself,nothing earth shattering or ground-breaking, it is the experience and the satisfaction gained from it that makes this a worthwhile post to write.

Categories: Google, LINQ, MVC, Programming, Projects, Tech, Web

One of the things that makes Google+ so great

Tuesday, 6 September 2011 11:20 am Comments off

I’ve been thinking about this for a few weeks, and never really got a handle on how to articulate it.

Till today.

 

I was commenting on Scoble’s post. He says in the post  that importing tweets into Google+ is a very bad idea.

Now, apart from being very pleased that me and him see eye to eye on this, I commented:

Agree with you +Robert Scoble No tweets in here.
Keeping Google + free of imported stuff has encouraged/forced people to post original material rather than reuse from twitter, facebook, friendfeed, flickr, etc.
Its one of those things that make Google+ interesting and different from all the other social networks around. Its made google + a destination in and of itself, rather than simply a portal or an aggregator (like Friendfeed is)

 

This is part of, shall we say, a philosophy around which Google+ is built. A philosophy which, dare i say it, is socially engineering us.

 

For example, the fact that comments and posts are not limited to 140 characters and allow rich formatting actually encourages people to comment. And not just comment – to comment substantially.  That is why Google+ has such a great reputation (already) for interaction.

 

Google has taken a very different approach to the other social networks. It is attempting to fulfil a very different version of what a social network should be.

And so far, its succeeding.

Core Competencies and Cloud Computing

Thursday, 9 September 2010 4:56 pm Comments off

Wikipedia defines Core Competency as:

Core competencies are particular strengths relative to other organizations in the industry which provide the fundamental basis for the provision of added value. Core competencies are the collective learning in organizations, and involve how to coordinate diverse production skills and integrate multiple streams of technologies. It is communication, an involvement and a deep commitment to working across organizational boundaries.

 

So, what does this have to do with Cloud Computing?

I got thinking about different providers of cloud computing environments. If you abstract away the specific feature set of each provider what were the differences remaining that set these providers apart from each other.

Now, I actually starting thinking about this backwards. I asked myself why Microsoft Windows Azure couldn’t do a Google App Engine and offer free applications. I had to stop myself there and go off to wikipedia and remind myself of the quotas that go along with an App Engine free application:

 

Hard limits

Apps per developer
10

Time per request
30 sec

Blobstore size (total file size per app)
2 GB

HTTP response size
10 MB

Datastore item size
1 MB

Application code size
150 MB

Free quotas

Emails per day
2,000

Bandwidth in per day
1,000 MB

Bandwidth out per day
1,000 MB

CPU time per day
6.5 hours per day

HTTP Requests per Day
1,300,000*

Datastore API calls per day
10,000,000*

Data stored
1 GB

URLFetch API calls per day..
657,084*

Now the reason why i even asked this question, was the fact that I got whacked with quite a bit of a bill for the original Windows Azure Feed Reader I wrote earlier this year. That was for my honours year university project, so I couldn’t really complain. But looking at those quotas from Google, I could have done that project many times over for free.

This got me thinking. Why does Google offer that and not Microsoft? Both of these companies are industry giants, and both have boatloads of CPU cycles.

Now, Google, besides doing its best not to be evil, benefits when you use the web more.  And how do they do that? They go off and create Google App Engine. Then they allow the average dev to write an app they want to write and run it. For free. Seriously, how many websites run on App Engine’s free offering?

Second, Google is a Python shop. Every time someone writes a new Library or comes up with a novel approach to something, Google benefits. As Python use increases, some of that code is going to be contributed right back into the Python open source project. Google benefits again. Python development is a Google Core competency.

Finally, Google is much maligned for its approach to software development: thrown stuff against the wall and see what sticks. By giving the widest possible number of devs space to go crazy, the more apps are going to take off.

So, those are all Googles core competencies:

  1. Encouraging web use
  2. Python
  3. See what sticks

And those are perfectly reflected in App Engine.

Lets contrast this to Microsoft.

Microsoft cater to writing line of business applications. They don’t mess around. Their core competency, in other words, is other companies IT departments. Even when one looks outside the developer side of things, one sees that Microsoft office and windows are all offered primarily to the enterprise customer. The consumer versions of said products aren’t worth the bits and bytes they take up on disk. Hence, windows Azure is aimed squarely at companies who can pay for it, rather than enthusiasts.

Secondly, Windows Azure uses the .Net Framework, another uniquely Microsoft core competency.  With it, it leverages the C# language. Now, it  is true that .net is not limited to Windows, nor is Windows Azure  a C# only affair. However, anything that runs on Windows Azure leverages the CLR and the DLR. Two pieces of technology that make .Net tick.

Finally, and somewhat  related, Microsoft has a huge install base of dedicated Visual Studio users. Microsoft has leveraged this by creating a comprehensive suite of Windows Azure Tools.

Hopefully you can see where I’m going with this. Giving stuff away for free for enthusiasts to use is not a Microsoft core competency. Even with Visual Studio Express, there are limits. Limits clearly defined by what enterprises would need. You need to pay through the nose for those.

So Microsoft core competencies are:

  1. Line of Business devs
  2. .Net, C# and the CLR/DLR
  3. Visual Studio

Now, back to what started this thought exercise – Google App Engines free offering. As you can see its a uniquely Google core competency, not a Microsoft one.

Now, what core competencies does Amazon display in Amazon Web Services?

Quite simply, Amazon doesn’t care who you are or what you want to do, they will provide you with a solid service at a very affordable price and sell you all the extra services you can handle. Amazon does the same things with everything else, so why not cloud computing. Actually, AWS is brilliantly cheap. Really. This is Amazon’s one great core competency and they excel at it.

So, back to what started this thought exercise – a free option. Because of its core Competencies, Google is uniquely positioned to do it. And by thinking about it, Microsoft and Amazon’s lack of a similar offering becomes obvious.

Also, I mentioned the cost of Windows Azure.

Google App Engine and its free option mean that university lecturers are choosing to teach their classes using Python and App Engine rather than C# and Windows Azure.

Remember what a core competency is. Wikipedia defines Core Competency as:

Core competencies are particular strengths relative to other organizations in the industry which provide the fundamental basis for the provision of added value. Core competencies are the collective learning in organizations, and involve how to coordinate diverse production skills and integrate multiple streams of technologies. It is communication, an involvement and a deep commitment to working across organizational boundaries.

I guess the question is, which offering make the most of their parent companies core competencies? And is this a good thing?

James Gosling on The Google v Oracle Java patent (war?)

Monday, 16 August 2010 4:19 pm Comments off

The term “money quote” best describes this paragraph:

There are no guiltless parties with white hats in this little drama. This skirmish isn’t much about patents or principles or programming languages. The suit is far more about ego, money and power.

The rest of James’ post is worth a read.

Categories: Google, Quotes, Software, Sun, Web

(AdMob)Comment of the Day

Thursday, 10 June 2010 9:29 am Comments off

Not from here, but rather from Kara Swishers post on Apple barring AdMob.

David K makes this excellent point:

Really? I never realized how I was held hostage. I could swear that I am completely free to buy any smart phone I want if I don’t like the iPhone. I wasn’t aware that I Apple would come send its iPolice after me if I walked into a Verizon store tommorow and picked up a Droid…

Since basically the argument in the preceding comments was along the lines that iAd was yet another instance of the closed ecosystem.

By the same token, devs aren’t held hostage as regards to their choice of Ad provider. This is made clear by the language in the new ToS. They just can’t use AdMob.

Quite frankly, Jobs has every right to bar Admob. To do anything else would be like Microsoft selling Lotus Notes in their stores. Not gonna happen.

Categories: Apple, Google, iPhone, Rants, Software, Web

@Arrington and the Crunchpad.

Saturday, 5 December 2009 6:25 pm 1 comment

The internet is awash with the news that the CrunchPad is dead. More accurately, dead on arrival.

I won’t regurgitate all the original details, which you can find here

crunchpadfinal

This morning (or this afternoon, depending where you are), Mike posted an update.

The letters attached make for interesting reading (even if they are long on legalese).

Originally I wrote a couple of long paragraphs before confusing even myself.  But I’ll quote Mike:

There is just no way to argue that TechCrunch is not the joint owner of all intellectual property of the CrunchPad, and outright owner of the CrunchPad trademark. The CEO of Fusion Garage has spent nearly six months this year working from Silicon Valley and our offices. Most of the Fusion Garage team has spent the last three months here working with our team on the project. And our key team members have spent time in Singapore working directly on the hardware and software that powers the device. Fusion Garage emails and their own blog, before it was deleted, acknowledge this. We have also spent considerable amounts of money creating the device, paying the vendor and other bills that Fusion Garage wasn’t able to.

What’s even more absurd is the idea that we somehow knew about Fusion Garage’s intentions to break off the partnership before a couple of days prior to the device launching. Until November 17 we had every reason to believe that Fusion Garage was our trusted ally in creating the CrunchPad. We received nearly daily emails confirming that everything was on track. Raising funding for the project was a goal but wouldn’t have been necessary for some time; besides, we had U.S. investors lined up and ready to put money into the venture. Fusion Garage admitted to us on November 18 that the news of them pulling out of the partnership was “out of the blue.”

There is quite simply no way we will allow this company to move forward on this project. The extent of their fraud is only now becoming clear to me. The audacity of their scheme is staggering. We believe that they engaged with us until the last possible moment to get press attention and access to our development resources and cash, and then walk away hoping that we’d do nothing.

Other Options

 

Disclaimer: What I’m about to do here is be incredibly naive and view the world for a moment the way a programmer does: neat, ordered and sensible.

I wonder what solutions there are to this mess (besides legal proceedings). One is to throw money at the problem. And no, I’m not suggesting mike buys the company, or the rights.

Its interesting that Mike planned to have ChromeOS running on the CrunchPad at the launch. Although the CrunchPad predates the relase of ChromeOS, it is the the very epitome of the types of devices the creators of ChromeOS envisioned running ChromeOS on.

So I think that Google, indirectly, has a stake in the success of the CrunchPad.

So, and this may seem un-orthodox, but I suggest that Google should buy out FG. Google has the money, after all.

It’s a win-win for everyone involved. Mike gets on with his Crunchpad. Google gets a posterchild for its ChromeOS (plus being able to contribute significantly to the device software to make sure the Google Experience is up to standard).

ChromiumOS is opensource. The crunchpad started out is short life as an opensourced, crowdsourced project. I can’t imagine a better match.

There is a market.

There is a market for that device, even with the iTablet looming on the horizon. I.e, Me. I’m sitting on my couch right now as I type this. A CrunchPad would be much easier than my Dell Laptop. 

Knowing Apple, the iTablet will be expensive (even if its a contract device). The CrunchPad will be far cheaper (between $300 to $400 as far as i know).

Besides the price issue (and the little matter of a global recession), rumour, as well as logic has it that that Apple will impose an App Approval Process for the iTablet. And an App Store. The pros and cons of a such a move are for another post when we have more substantial information.

This stands in stark contrast with the CrunchPad

Mike says that the CrunchPad can be hacked to run Windows 7 (that would be awesome) and ChromeOS (and by extension any Linux based OS including Android).

(Actually I think Mike should have a version with no OS preloaded)

I’d much rather buy a Crunchpad I can write my own apps for. And before anyone accuses me of hypocrisy (since I like the App Store), I will not tolerate an App Store for anything approaching a work machine.

And after all the problems developers are having with the App Store, I have no intention of writing Apps for the iPhone (Apple does have the chance to change this, mind you).

Not being able to write apps for my iPhone frustrates me to no end. There are too many roadblocks.

However, with the promise of the CrunchPad, I drool at the App possibilities. Being a totally open platform, the possibilities are endless. Whether one uses ChromeOS ( more properly, ChromiumOS), Linux or Windows 7, the underlying hardware will be exposed for the developer to use.

Public Opinion is heavily in favour of the CrunchPad. Public Opinion is squarely behind Mike Arrington (yes, this includes me).

Hopefully it will live.

PS. For a fascinating discussion on the CrunchPad, listen to MacBreak Weekly 169: This Is What Happens Larry


Google’s Chrome

Tuesday, 2 September 2008 8:15 pm Comments off

Google today launched a new browser, called Chrome.

And you can get it from www.google.com/chrome

Its lightweight, refreshing and has a few nice features I’ve been looking for Mozilla to implement in FF. Namely that you can move tabs between windows. And it has a spellchecker built in (I’m too lazy to install THAT FF plugin). And a privacy mode ( why on earth one would want to use it is beyond me). And its based on Webkit, like Safari.

Some screenshots:

chrome 1 

chrome 2

chrome 3

Now thats as far as I’ve got with using the new browser.

Its already good enough for me to consider making it my default browser.

The Friendfeed bookmarklet works (although it detects that I’m using Safari).

There is no Delicious plugin yet (critical to me I can’t imagine not having it).

And Firebug would be nice as well – it would make developing with yet another browser slightly easier.

Robert Scoble has reported over on friendfeed that Google properties appear to be faster on Chrome ( not sure abut that yet).

And Yuvi, of statbot.com, reports that some Sliverlight apps load, but the heavy ones hang.

I’m betting that Microsoft offices are a touch louder than usual.

Lets see what happens here.

Aprils Fools 2008 (and a little late at that)

Thursday, 3 April 2008 4:55 pm Comments off

I think its becoming a tradition here to list some of the funnier April Fools Day pranks:

  • Read – Space bot demands to be called “Dextre the Magnificent”
  • Read – Google’s gDay with MATE searches the future
  • Read – Think Geek’s Betamax to HD-DVD Converter
  • Read – Qualcomm’s HandSolo
  • Read – Virgin and Google form Virgil for Mars expedition
  • Read – Xbox 360 Wireless Helmet, Board Game

More Google pranks here.

TUAW has a round up of the Apple Pranks.

Three from Sun Microsystems:

Google Business Roundup

Tuesday, 4 December 2007 1:43 pm Comments off

Thought the following Fake Steve Jobs list might be interesting funny:

  • Word processor in the cloud. Status: Done. Income: Negligible.
  • Spreadsheet in the cloud. Status: Done. Income: Negligible.
  • Photo storage in the cloud. Status: Done. Income: Negligible.
  • Calendar in the cloud. Status: Done. Income: Zero.
  • Google Earth. Status: Extremely cool.
  • Google Maps. Status: Done. Income: Zero.
  • Google Street View. Status: Not illegal, but should be.
  • Google Talk. Status: Done. Income: Zero.
  • Google Pack. Status: I know it’s around here someplace.
  • Google Ride Finder. Status: Still waiting to get picked up.
  • Google Transit. Status: Lost.
  • TV ads. Status: Uncertain.
  • Radio ads. Status: See “TV ads.”
  • Video game ads. Status: See “Radio ads.”
  • Patent searches. Status: Who cares?
  • RechargeIT hybrid car thing. See here. Status: Hybrid cars, dude.
  • Clean energy. See here. Status: Nice gesture.
  • Google Checkout. Status: Um …
  • Google SketchUp, 3-D modeling. Status: Alpha? Beta?
  • Robots on the moon prize. See here. Status: Robots, dude. On the freaking moon!
  • Google NASA. See here. Status: Awesome!
  • Neven Vision. Image recognition. (Acquired.) Status: Mindblowing.
  • YouTube videos. Status: Done. Income: Negligible.
  • Scanning books. Status: In process. Income: Zero.
  • Blogger. Status: Done. Income: Negligible.
  • RSS Reader. Status: Done. Income: Zero.
  • Google PC. Status: Vapor. Income: Zero.
  • Google OS. Status: Vapor. Income: Zero.
  • Gmail. Status: Done. Income: Negligible or zero.
  • Orkut. Status: Done. Income: Don’t know, I don’t speak Brazilian.
  • OpenSocial. Status: Pipe dream. Income: Zero.
  • VaporPhone ™. Status: Release-ware. Income: Zero.
  • Storage in the cloud. Status: Pre-alpha. Income: Negative.
  • Electricity. Status: Pre-vapor. Income: GBH. (Gonna Be Huge.)
  • Radio airwaves. Status: Bidding. Income: Zero.
  • Categories: Comedy, Google, Tech, Web
    Follow

    Get every new post delivered to your Inbox.