Monday, November 30, 2015

Perf

Perf isn’t just about how fast your framework runs.

Perf is also about:


  • how fast you can set up a dev environment for it
  • how fast you can train people to use it
  • how fast they become productive in it
  • how fast it can be deployed
  • how fast someone new looking at it 3 years later can begin to maintain it

Thursday, March 5, 2015

Friction

Every app needs one primary metric - Friction. This is a function of how easy it is for users of the app to do what they came to do and how long it takes them to do it. Every other metric flows from that, even revenue earned - because if your users encounter too much friction, you're not gonna get any revenue.

Thursday, January 1, 2015

Monday, November 11, 2013

Creating a "Master Page" for your Go Web App

Most web apps share a common layout across different views. This common layout may include a header or a footer and even a navigation menu. Go's batteries-included standard library provides an easy way to create these common elements that can be reused in different views to create a "Master Page"-like effect.

This basic example demonstrates how:

Let's create a simple web app that has 2 views - a Main view and an About view. Both these views have the same header and footer sections.

The header template is defined in a file named header.html

The footer template is defined in a file named footer.html

The Main template is defined in a file named main.html

The About template is defined in a file name about.html

And here's the code that serves it up.

Each of the above templates has a name defined using the {{define "name"}} action. The Main and About templates include the header and footer templates using the {{template "name" .}} action. The '.' passes in the context to the named template. Now whenever the Main and About templates are executed, the header and footer will get included and inserted at the required location. That's all there is to it.

This is how the 2 views look.


This technique can also be used to create different layouts for different sections of the web app; for example, the administration section may look different from the user section. We just need to name our templates appropriately and include them where required.

Saturday, November 9, 2013

On Google's social layer.

Every once in a while, there is a major outrage over Google trying to "shove Google+ down our throats" as one more of its properties is integrated with Google+. There are accusations of Google wanting to inflate its active user count by "forcing" more people into Google+.

Google+ is one of the most misunderstood pieces of the Google puzzle. It is popularly considered as Google's wannabe answer to Facebook/Twitter and as yet another attempt at "getting" social.

Yet Google+ is more than just a mere social network. Google+ is literally Google + You (and your juicy details).

Google's goal is to become your perfect personal assistant - the ultimate handheld/wearable Star Trek computer. To do this, it has to understand your behavior/preferences. Google+ is a fabric that is being built around Google's other properties to do just that.

It is also important to understand this in the context of Google's business model. Google provides a number of services (mostly for free) in return for showing you advertisements (yes, there's no real free lunch). So, while attempting to become your Star Trek computer, it also has to stay relevant to advertisers - the people who spend money to keep it going.

Advertisers want to make sure that the money they spend, results in ads being shown where there is the greatest chance of success. People who see the ads (users like you and me) don't like ads, but would rather see relevant ads than irrelevant ones.

Understanding you, your behavior, preferences and social interactions helps Google achieve both objectives - becoming your Star Trek computer as well as becoming the ultimate advertising platform.

Judging from the outrage, a lot of people don't like this setup. The good thing about this, is that you don't have to use Google or any of its properties. There are alternatives. Be prepared to discover though, that these alternatives are not all that different, or if they are, are unviable from a long term perspective.

Friday, July 26, 2013

Windows Service with Go - the easy way

This is a quick and dirty way to create a Windows Service using Go.

First, you create a normal Go program with a main() function. This calls another method where the actual work gets done. This function runs in an infinite loop (if you're writing a Go web server, you don't need this loop as the http listener will take care of this).

package main

func main() {
 //Call this function where the action happpens
 doStuff()
}

func doStuff() {
 for {
  //the actual stuff happens here.
 }
}

Once you build this to an exe file, register it as a service using the wonderful NSSM (the Non-Sucking Service Manager). In our case, that would be -

nssm install MyService d:\MyService.exe

(where d:\MyService.exe is the full path to the exe file).

This will register the exe as a Windows Service named MyService. You can change the settings of this service by typing Services.msc and choosing MyService from the services list.


You can delete this service using either NSSM or the native service control sc.exe

sc delete MyService

This method is pure Go and does not use any native Windows APIs directly. The advantage of this is that the same Go program can be run on another OS, if required.

If you want to write something Windows-specific and take advantage of native APIs, like writing to the Windows Event Log, you can use this package from +Alex Brainman.

Thursday, June 13, 2013

Printing from your Android device.

Though things are going largely paperless, there are those times when you need to have a dead-tree edition of that important document. As we go increasingly mobile, a 'Print' feature on your device becomes necessary. That is where Google Cloud Print comes to the rescue.

Google Cloud Print is a service that lets you print a document using any Cloud Print-enabled printer over the web. If you have a normal (classic) printer, you can use that too. You just need to connect your PC to the printer and enable Google Cloud Print using the Chrome browser on it. To do this, go to your Chrome Settings page, click on Show Advanced Settings and then on the Add Printers button under the Google Cloud Print heading.


This will display a list of printers your PC has access to and you can select one or more of them.

Next, you need to install the Google Cloud Print app on your Android device. Once you do this, you can print from your device using the Share option. For example, to print a webpage from Chrome, select Share and then Cloud Print.





This will display a list of printers you can print to. You can also save the webpage to your Google Drive.