Updating the badge in a Windows 8 JavaScript App

Windows 8 apps can have notification badges in the tiles. It’s easy to update the badge, but it’s still not well documented, so here is a small snippet to show you how it’s done:

var Notifications = Windows.UI.Notifications;
var updater = Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication();
var xml = Notifications.BadgeUpdateManager.getTemplateContent(

xml.getElementsByTagName('badge')[0].setAttribute('value', 5);

var notification = Notifications.BadgeNotification(xml);

Replace the 5 in line 7 with the number of your choice. The end result looks like this:

Badge update example

More info on badge updates is available in the Windows.UI.Notifications namespace of the WinRT and the Badge Update XML Schema.

StickyTiles: A Windows Phone app to pin sticky notes!


StickyTiles is a simple Windows Phone Mango app that lets you pin short sticky notes to your start screen! Choose text, color, and back side of the sticky tile. Pin all the sticky tiles you want.

StickyTiles is open source, fork the code at GitHub!

StickyTiles is now available in the Windows Phone Marketplace and is compatible with all Mango phones. Click the button below to download it.

Download StickyTiles

Sierpinski’s Tetrahedron!


For my Computer Graphics class we had to do Sierpinski’s Triangle in OpenGL. As optional extra credit, we could expand it to 3D. I took up the challenge, and this was the result. It’s not perfect, but it looks really cool!

As always, grab the code at Gist. Comments, forks and improvements are appreciated. :)

New versions of Postponer and ChromeMilk released

screen-gmailI’ve released new versions of my Chrome extensions Postponer and ChromeMilk.

Postponer 0.4 add a one-click add mode to Adder and customizable popup size to Manager, as well as a few bug fixes.

ChromeMilk 0.9.6 features a brand new icon as well as numerous bug fixes.

As always, you can get them from the Chrome extensions gallery:

Postponer Adder

Postponer Manager


Thanks to everyone that reported bugs, and a special thanks to Camila González for the new icon in ChromeMilk.

Please let me know of any bugs, issues, feature requests or just general comments you may have. Enjoy the extensions!

Code snippet: Get a weather condition using Python and Google Weather API

Here’s a simple Python code snippet for finding the weather condition of any given city using Google’s Weather API. It’s also published on GitHub if you want to clone it.

import urllib2

def getWeather(city):

    #create google weather api url
    url = "http://www.google.com/ig/api?weather=" + urllib2.quote(city)

        # open google weather api url
        f = urllib2.urlopen(url)
        # if there was an error opening the url, return
        return "Error opening url"

    # read contents to a string
    s = f.read()

    # extract weather condition data from xml string
    weather = s.split("<current_conditions><condition data=\"")[-1].split("\"")[0]

    # if there was an error getting the condition, the city is invalid
    if weather == "<?xml version=":
        return "Invalid city"

    #return the weather condition
    return weather

def main():
    while True:
        city = raw_input("Give me a city: ")
        weather = getWeather(city)

if __name__ == "__main__":

Update: GitHub is awesome because it allows very easy forking. Beau Martínez has made a fork of my script that includes Python 3 support, XML parsing instead of RegEx searching, and temperature reporting.

© 2021 Juliana Peña

Theme by Anders NorénUp ↑