My First Glassware, QSL Query, is in Production!

QSL Query

My first Google Glass app, QSL Query, is now available for use! Its purpose is to look up USA-based amateur (“ham”) radio call signs using the FCC database, and returning the address information associated with those callsigns. This information is often used by ham radio operators to complete QSL cards to acknowledge contact via amateur radio.

When using this application, the call sign information can be shared via email, Google+, and Facebook.  Twitter sharing does not yet work properly, as the information returned exceeds 140 characters.

This Glassware was written using Go (also known as “golang”), an open source programming language originally developed at Google in 2007.

QSL Query

Merge Request Accepted for Google Glass Starter Project!

Github Merge Request Accepted!

An update on my Google Glass post from this morning:

I submitted a pull request to include my code into the Go Quick Start Project and they merged it into Google’s master branch!

So if you download the Go version of the project now, it will include this code. I have submitted similar pull requests for the Python, Java, PHP, and .NET versions as well and am awaiting acceptance for those.

Github Merge Request Accepted!

Deleting Google Glass Timeline Items Using the Go Quick Start Project

Go (golang) logo

(Note: This has been merged into the main project!)

A Google Glass user interacts with Glassware using timeline items, also known as cards. Currently the Quick Start Projects do not include a method for manually deleting these items, but the Mirror API does provide a way to do this.

I am developing Glassware using the Go (AKA golang) version of the Quick Start Project.

In the index.html file, I added a button using this block of code:

<form action="/" method="post">
<input name="itemId" type="hidden" value="{{ $item.Id }}" />
<input name="operation" type="hidden" value="deleteTimelineItem" />
<button class="btn" type="submit">Delete Item</button>
</form>

To this block:

          {{ range $item.Attachments }}
            {{ if HasPrefix .ContentType "image" }}
            <img src="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}" width="150" />
            {{ else }}
            <a href="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}">Download</a>
            {{ end }}
          {{ end }}
        
      
      {{ end }}
    
    <div style="clear:both;"></div>

Resulting in this block:

          {{ range $item.Attachments }}
            {{ if HasPrefix .ContentType "image" }}
            <img src="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}" width="150" />
            {{ else }}
            <a href="/attachmentproxy?attachment={{ .Id }}&timelineItem={{ $item.Id }}">Download</a>
            {{ end }}
          {{ end }}
        </li>
        <li>
           <form action="/" method="post">
              <input type="hidden" name="itemId" value="{{ $item.Id }}" />
              <input type="hidden" name="operation" value="deleteTimelineItem" />
              <button class="btn" type="submit">Delete Item</button>
           </form>
        </li>
      </ul>
      {{ end }}
    </div>
    <div style="clear:both;"></div>
  </div>

Secondly, add this method to the main.go file:

// deleteTimelineItem deletes a timeline item.
func deleteTimelineItem(r *http.Request, svc *mirror.Service) string {
        itemId := r.FormValue("itemId")
		err := svc.Timeline.Delete(itemId).Do()
        if err != nil {
                return fmt.Sprintf("An error occurred: %vn", err)
        }
        return "A timeline item has been deleted."
}

Lastly, add the last line to the block defining the operations variable in main.go, adding the deleteTimelineItem method:

// Map of operations to functions.
var operations = map[string]func(*http.Request, *mirror.Service) string{
	"insertSubscription":   insertSubscription,
	"deleteSubscription":   deleteSubscription,
	"insertItem":           insertItem,
	"insertItemWithAction": insertItemWithAction,
	"insertItemAllUsers":   insertItemAllUsers,
	"insertContact":        insertContact,
	"deleteContact":        deleteContact,
	"deleteTimelineItem":   deleteTimelineItem,
}

Save the files and redeploy your project to AppEngine. Once your reload your application in the browser, a button will appear underneath each timeline item that will delete it!