<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Juliana Peña &#187; Programming</title>
	<atom:link href="http://julianapena.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://julianapena.com</link>
	<description>Musings of a computer science student</description>
	<lastBuildDate>Thu, 01 Jul 2010 20:50:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<atom:link rel='hub' href='http://julianapena.com/?pushpress=hub'/>
		<item>
		<title>New versions of Postponer and ChromeMilk released</title>
		<link>http://julianapena.com/2010/03/new-versions-of-postponer-and-chromemilk-released/</link>
		<comments>http://julianapena.com/2010/03/new-versions-of-postponer-and-chromemilk-released/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 01:23:01 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://julianapena.com/2010/03/new-versions-of-postponer-and-chromemilk-released/</guid>
		<description><![CDATA[I’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 <a href="http://julianapena.com/2010/03/new-versions-of-postponer-and-chromemilk-released/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://julianapena.com/wp-content/uploads/NewversionsofPostponerandChromeMilkrelea_11090/screengmail.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border: 0px;" title="screen-gmail" src="http://julianapena.com/wp-content/uploads/NewversionsofPostponerandChromeMilkrelea_11090/screengmail_thumb.png" border="0" alt="screen-gmail" width="225" height="235" align="right" /></a>I’ve released new versions of my Chrome extensions <a href="http://julianapena.com/projects/chrome-postponer/">Postponer</a> and <a href="http://julianapena.com/projects/chrome-rtm/">ChromeMilk</a>.</p>
<p>Postponer 0.4 add a one-click add mode to Adder and customizable popup size to Manager, as well as a few bug fixes.</p>
<p>ChromeMilk 0.9.6 features a brand new icon as well as numerous bug fixes.</p>
<p>As always, you can get them from the Chrome extensions gallery:</p>
<p><a href="https://chrome.google.com/extensions/detail/pggmlienkcoenodbjpkbidlmmedgonai">Postponer Adder</a></p>
<p><a href="https://chrome.google.com/extensions/detail/mmfblgljgoaokhbcjnddgcnaielcpjeb">Postponer Manager</a></p>
<p><a href="https://chrome.google.com/extensions/detail/chieodlkhimccchlojdmiondhiggkhmf">ChromeMilk</a></p>
<p>Thanks to everyone that reported bugs, and a special thanks to <a href="http://aconitehikaru.deviantart.com/">Camila González</a> for the new icon in ChromeMilk.</p>
<p>Please let me know of any bugs, issues, feature requests or just general comments you may have. Enjoy the extensions!</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/03/new-versions-of-postponer-and-chromemilk-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Code snippet: Get a weather condition using Python and Google Weather API</title>
		<link>http://julianapena.com/2010/02/code-snippet-get-a-weather-condition-using-python-and-google-weather-api/</link>
		<comments>http://julianapena.com/2010/02/code-snippet-get-a-weather-condition-using-python-and-google-weather-api/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 17:09:17 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Code snippet]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://julianapena.com/2010/02/code-snippet-get-a-weather-condition-using-python-and-google-weather-api/</guid>
		<description><![CDATA[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)

    try:
    <a href="http://julianapena.com/2010/02/code-snippet-get-a-weather-condition-using-python-and-google-weather-api/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Here’s a simple Python code snippet for finding the weather condition of any given city using Google’s Weather API. It’s also <a href="http://gist.github.com/308912">published on GitHub</a> if you want to clone it.</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:8f6cfd24-50f5-4569-a63a-46d12fc1a212" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: python;">import urllib2

def getWeather(city):

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

    try:
        # open google weather api url
        f = urllib2.urlopen(url)
    except:
        # 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("&lt;current_conditions&gt;&lt;condition data=\"")[-1].split("\"")[0]

    # if there was an error getting the condition, the city is invalid
    if weather == "&lt;?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)
        print(weather)

if __name__ == "__main__":
    main()</pre>
</div>
<p><strong>Update: </strong>GitHub is awesome because it allows very easy forking. <a href="http://gist.github.com/beaumartinez">Beau Martínez</a> has made a <a href="http://gist.github.com/309222">fork</a> of my script that includes Python 3 support, XML parsing instead of RegEx searching, and temperature reporting.</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/02/code-snippet-get-a-weather-condition-using-python-and-google-weather-api/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to build a Chrome extension, Part 4: Background pages and scheduling requests</title>
		<link>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-4-background-pages-and-scheduling-requests/</link>
		<comments>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-4-background-pages-and-scheduling-requests/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:45:24 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://julianapena.com/?p=409</guid>
		<description><![CDATA[One of the most common uses for an extension is as a notifier. For example, the Google Gmail Checker, an official Google extension and the most popular one in the gallery, constantly checks your Gmail inbox for new unread mail.
This functionality is easy to add into your own extension. You need to add a background <a href="http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-4-background-pages-and-scheduling-requests/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>One of the most common uses for an extension is as a notifier. For example, the <a href="https://chrome.google.com/extensions/detail/mihcahmgecmbnbcchbopgniflfhgnkff">Google Gmail Checker</a>, an official Google extension and the most popular one in the gallery, constantly checks your Gmail inbox for new unread mail.</p>
<p>This functionality is easy to add into your own extension. You need to add a background page, which is easily added by adding the background_page option to your manifest.json:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:08cde715-f4bd-49b2-a7d2-ad7ff4ca5738" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">{
	"name": "My Extension",
	...
	"background_page": "background.html",
	...
}</pre>
</div>
<p>Like almost every other component in a Chrome extension, background.html is a standard HTML file. However, it can also do things most web pages cannot, such as <a href="http://code.google.com/chrome/extensions/xhr.html">cross-origin requests</a> if permissions are correctly added to the manifest. For example, if your extension is a Gmail checker, it would need permissions to <a href="http://www.google.com">http://www.google.com</a> and <a href="https://www.google.com">https://www.google.com</a>. To add these permissions, the manifest.json would be edited to:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:babaf12b-186f-4c66-a12c-a6ae946caef4" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">{
	"name": "My Extension",
	...
	"background_page": "background.html",
	"permissions": ["http://www.google.com/", "https://www.google.com/"],
	...
}</pre>
</div>
<p>A background page runs at all times when the extension is enabled. You cannot see it, but it can modify other aspects of the extension, like setting the browser action badge. For example, the following example would set the icon badge to the number of unread items in a hypothetical service:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:44a4f7d6-b513-4ff9-9f16-df573150bdc6" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">function getUnreadItems(callback) {
	$.ajax(..., function(data) {
		process(data);
		callback(data);
	});
}

function updateBadge() {
	getUnreadItems(function(data) {
		chrome.browserAction.setBadgeText({text:data.unreadItems});
	});
}</pre>
</div>
<p>So now you can make a request, but how can you schedule it so the data is retrieved and processed regularly? Luckily, JavaScript has a method called window.setTimeout to do just that:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:1b5ebf9b-6c9c-428e-96ef-deb92b76b987" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">var pollInterval = 1000 * 60; // 1 minute, in milliseconds

function startRequest() {
	updateBadge();
	window.setTimeout(startRequest, pollInterval);
}</pre>
</div>
<p>That was easy! Now just slap a</p>
<pre class="brush: html">onload='startRequest()'</pre>
<p>on the background page’s body tag and that should do it!</p>
<p>But what if you want to stop the request? That can easily be done as well, by chaging the startRequest function a little and adding a stopRequest function:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:b44225b5-3eb1-438d-a29f-0c02c893b8c7" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">var pollInterval = 1000 * 60; // 1 minute, in milliseconds
var timerId;

function startRequest() {
	updateBadge();
	timerId = window.setTimeout(startRequest, pollInterval);
}

function stopRequest() {
	window.clearTimeout(timerId);
}</pre>
</div>
<p>And that’s about it on building background pages that can schedule requests. Now go! Make an awesome notifier! You can even make things like a timer with this (Facebook addiction control, anyone?). Just remember to leave a comment telling everyone of your awesomeness.</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-4-background-pages-and-scheduling-requests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to build a Chrome extension, Part 3: Loading any web page in a popup</title>
		<link>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/</link>
		<comments>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 03:40:18 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/</guid>
		<description><![CDATA[Chrome allows extensions that use its page action or browser action API to show popups when clicked. To add this popup, you’d add a popup.html file to your extension and the following to the manifest.json for browser actions:
{
	"name": "My Extension",
	...
	"browser_action": {
		"default_icon": "myicon.png",
		"popup": "popup.html"
	}
	...
}
Or for page actions:
{
	"name": "My Extension",
	...
	"page_action": {
		"default_icon": "myicon.png",
		"popup": "popup.html"
	}
	...
}
However, the popup page is <a href="http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Chrome allows extensions that use its <a href="http://code.google.com/chrome/extensions/pageAction.html">page action</a> or <a href="http://code.google.com/chrome/extensions/browserAction.html">browser action</a> API to show popups when clicked. To add this popup, you’d add a popup.html file to your extension and the following to the manifest.json for browser actions:</p>
<pre class="brush: js">{
	"name": "My Extension",
	...
	"browser_action": {
		"default_icon": "myicon.png",
		"popup": "popup.html"
	}
	...
}</pre>
<p>Or for page actions:</p>
<pre class="brush: js">{
	"name": "My Extension",
	...
	"page_action": {
		"default_icon": "myicon.png",
		"popup": "popup.html"
	}
	...
}</pre>
<p>However, the popup page is static and cannot be changed while the extension is running. Also, only a local extension page can be put into a popup; you can’t load an external page.</p>
<p>So how can you fix this? Using a relatively old web technique called an iframe. Inline frame, or iframe, is an HTML element that can load any web page inside another in a type of box. So, even though you can’t load an external web page as your popup, you can load it <em>within</em> it.</p>
<p>A simple example for a Bing search extension would be:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a5285258-32cb-435a-8157-9dbedd4ca7ff" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: xml;">&lt;html&gt;
&lt;head&gt;
	&lt;style type="text/css"&gt;
	body {width:200; height:300;}
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;iframe src="http://m.bing.com" width="100%" height="100%" frameborder="0"&gt;
	&lt;/iframe&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
</div>
<p>As you can see, I have loaded the mobile version of Bing, <a title="http://m.bing.com" href="http://m.bing.com">http://m.bing.com</a>. Because of the small amount of screen real estate available on the popups, loading mobile versions of a page is a good idea as they are minimalistic and require less space.</p>
<p>I’ve also explicitly declared the size of the page (200 by 300) and the iframe (100% of the page). You can change this to what fits your extension best.</p>
<p>(Yeah, I know it is ironic to build a Chrome extension centered on Bing, but I couldn’t get <a href="http://www.google.com/m">Google’s mobile search</a> to load correctly in an iframe.)</p>
<p>On Chrome, the Bing search extension would look like this:</p>
<p><a href="http://julianapena.com/wp-content/uploads/HowtobuildaChromeextensionPart3Loadingan_13EA3/image.png"><img style="margin: 0px auto 5px; display: block; float: none; border-width: 0px;" title="image" src="http://julianapena.com/wp-content/uploads/HowtobuildaChromeextensionPart3Loadingan_13EA3/image_thumb.png" border="0" alt="image" width="390" height="367" /></a></p>
<p>You can download the completed Bing extension from the <a href="https://chrome.google.com/extensions/detail/dkjkkandkknagonejgliebkekfkkofad">Chrome Extensions Gallery</a> and the source code (under the <a href="http://creativecommons.org/licenses/GPL/2.0/">GPLv2</a>) from <a href="http://mfi.re/?imwxngtdkhg">Mediafire</a>.</p>
<p>Now, what if you want to load a different page depending on an <a href="http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-2-options-and-localstorage/">extension option</a>? You can easily do this by constructing the iframe element dynamically when the page loads, like this code excerpt from <a href="http://julianapena.com/projects/chrome-rtm/">ChromeMilk</a>:</p>
<div id="scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:dc0221eb-6196-4a17-96b4-eb1d29d48b94" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">
<pre class="brush: javascript;">$(document).ready(function() {
	var popup = localStorage.popup || 'igoogle';

	var frame = document.createElement('iframe');

	frame.setAttribute('width', '100%');
	frame.setAttribute('height', '100%');
	frame.setAttribute('frameborder', '0');
	frame.setAttribute('id', 'rtmframe');

	if (popup == 'gmail') {
		// open gmail gadget
		$('body').height(300).width(200);
		frame.setAttribute('src', 'http://www.rememberthemilk.com/services/modules/gmail/');
	}
	else if (popup == 'iphone') {
		// open iphone web app
		$('body').height(480).width(320);
		frame.setAttribute('src', 'http://i.rememberthemilk.com/');
	}
	else if (popup == 'mobile') {
		// open mobile web app
		$('body').height(300).width(200);
		frame.setAttribute('src', 'http://m.rememberthemilk.com/');
	}
	else {
		// igoogle and default
		$('body').height(400).width(400);
		frame.setAttribute('src', 'http://www.rememberthemilk.com/services/modules/googleig/');
	}

	document.body.appendChild(frame);
});</pre>
</div>
<p>This way, the extension sets the popup size and the iframe location based on a setting saved by the user.</p>
<p>There are a few limitations of this method. Most importantly, you can’t manipulate the iframe once it is loaded, as this is <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross-side scripting</a> and is prevented by the browser for security reasons.</p>
<p>That’s about it on loading external web sites in popups. You can use this for a number of things. I’ve mentioned mobile sites, but things like iGoogle widgets also work well.</p>
<p>Do you have any tips on building Chrome extensions based on popups? Or are you having trouble building your extension? Leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to build a Chrome extension, Part 2: Options and localStorage</title>
		<link>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-2-options-and-localstorage/</link>
		<comments>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-2-options-and-localstorage/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 20:57:39 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://julianapena.com/?p=399</guid>
		<description><![CDATA[An important aspect of almost all extensions is being able to save user settings. This can be achieved in Chrome easily by using the localStorage object and Chrome’s extension API options page.
Adding an options page
To add an options page to your extension, make an options.html file in your extension’s folder and add the “options_page” line <a href="http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-2-options-and-localstorage/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>An important aspect of almost all extensions is being able to save user settings. This can be achieved in Chrome easily by using the localStorage object and Chrome’s extension API options page.</p>
<h3>Adding an options page</h3>
<p>To add an options page to your extension, make an options.html file in your extension’s folder and add the “options_page” line to your manifest.json like so:</p>
<pre class="brush: js">{
  "name": "My Extension",
  ...
  "options_page": "options.html"
  ...
}</pre>
<h3>localStorage</h3>
<p>localStorage is an HTML5 object used for storing web page data locally using JavaScript. Chrome gives extensions the option of using localStorage to save options and data.</p>
<h3>Saving options</h3>
<p>To save a string to localStorage, use the following code, replacing mysetting and myvalue with your own:</p>
<pre class="brush: js">localStorage["mysetting"] = "myvalue";</pre>
<p>Or, equivalently:</p>
<pre class="brush: js">localStorage.mysetting = "myvalue";</pre>
<h3>Loading options</h3>
<p>To load an option, just access the setting member in the localstorage object:</p>
<pre class="brush: js">myvar = localStorage["mysetting"];</pre>
<p>Or, equivalently:</p>
<pre class="brush: js">myvar = localStorage.mysetting;</pre>
<p>It’s always a good idea to make sure you’ve loaded a valid setting. For example, the following code loads a favorite color, but if the current color is not valid, it loads the default value:</p>
<pre class="brush: js">var defaultColor = "blue";

function loadFavColor() {
	var favColor = localStorage["favColor"];

	// valid colors are red, blue, green and yellow
	if (favColor == undefined || (favColor != "red" &amp;&amp; favColor != "blue" &amp;&amp; favColor != "green" &amp;&amp; favColor != "yellow")) {
		favColor = defaultColor;
	}

	return favColor;
}</pre>
<h3>Erasing options</h3>
<p>You can erase an option by removing it from the localstorage object, like so:</p>
<pre class="brush: js">localStorage.removeItem("mysetting");</pre>
<h3>Building an options page</h3>
<p>Continuing with the favorite color example, lets now build a complete options page for our color-choosing extension. The options.html page would look like this:</p>
<pre class="brush: xml;">&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Options for Color Chooser&lt;/title&gt;
	&lt;script type="text/javascript" src="options.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="loadOptions()"&gt;
	&lt;h1&gt;Favorite Color&lt;/h1&gt;
	&lt;select id="color"&gt;
		&lt;option value="blue"&gt;Blue&lt;/option&gt;
		&lt;option value="red"&gt;Red&lt;/option&gt;
		&lt;option value="green"&gt;Green&lt;/option&gt;
		&lt;option value="yellow"&gt;Yellow&lt;/option&gt;
	&lt;/select&gt;
	&lt;br /&gt;
	&lt;button onclick="saveOptions()"&gt;Save&lt;/button&gt;
	&lt;br /&gt;
	&lt;button onclick="eraseOptions()"&gt;Restore default&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>For the behavior of the page, options.js would look like this:</p>
<pre class="brush: javascript;">var defaultColor = "blue";

function loadOptions() {
	var favColor = localStorage["favColor"];

	// valid colors are red, blue, green and yellow
	if (favColor == undefined || (favColor != "red" &amp;&amp; favColor != "blue" &amp;&amp; favColor != "green" &amp;&amp; favColor != "yellow")) {
		favColor = defaultColor;
	}

	var select = document.getElementById("color");
	for (var i = 0; i &lt; select.children.length; i++) {
		var child = select.children[i];
			if (child.value == favColor) {
			child.selected = "true";
			break;
		}
	}
}

function saveOptions() {
	var select = document.getElementById("color");
	var color = select.children[select.selectedIndex].value;
	localStorage["favColor"] = color;
}

function eraseOptions() {
	localStorage.removeItem("favColor");
	location.reload();
}</pre>
<p>And that’s about it! You can also save and load localStorage data elsewhere in your extension, as the data is shared between all your extension’s files.</p>
<p>Any question, remark, or addition? Please leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-2-options-and-localstorage/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How to build a Chrome extension, Part 1: Basics</title>
		<link>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-1-basics/</link>
		<comments>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-1-basics/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 17:21:08 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[extension]]></category>

		<guid isPermaLink="false">http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-1-basics/</guid>
		<description><![CDATA[
Building Chrome extensions is super-easy. I’ve already made two: ChromeMilk and Postponer. I wanted so share my method of building extensions, so I’m going to write a series of posts. This one will cover the basics on how to set up a good development environment and how to begin writing the extensions.
1. Install Chrome dev <a href="http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-1-basics/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://julianapena.com/wp-content/uploads/HowtobuildaChromeextensionPart1Basics_ADA5/image.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto; border-width: 0px;" title="image" src="http://julianapena.com/wp-content/uploads/HowtobuildaChromeextensionPart1Basics_ADA5/image_thumb.png" border="0" alt="image" width="442" height="353" /></a></p>
<p>Building Chrome extensions is super-easy. I’ve already made two: <a href="http://julianapena.com/projects/chrome-rtm/">ChromeMilk</a> and <a href="http://julianapena.com/projects/chrome-postponer/">Postponer</a>. I wanted so share my method of building extensions, so I’m going to write a series of posts. This one will cover the basics on how to set up a good development environment and how to begin writing the extensions.</p>
<h3>1. Install Chrome dev channel</h3>
<p>The <a href="http://dev.chromium.org/getting-involved/dev-channel">Chrome dev channel</a> has the latest technologies and the best developing tools. <a href="http://www.google.com/chrome/eula.html?extra=devchannel">Install it</a> and use it to debug extensions.</p>
<h3>2. Get a text editor to write the code in</h3>
<p>If you’re really Spartan you can use regular Notepad. I use <a href="http://www.flos-freeware.ch/notepad2.html">Notepad2</a> because it’s light but has syntax highlighting and other features. There are many available, so take your pick.</p>
<h3>3. Learn HTML, CSS and JavaScript</h3>
<p>Chrome extensions are made using the same techniques used to make web pages. HTML for content, CSS for presentation and JavaScript for behavior and interaction. I highly recommend the tutorials at <a href="http://w3schools.com/">W3Schools</a> if you are just starting out. If you’ve been building web pages for a while, you can probably skip this step.</p>
<h3>4. Follow the official Getting Started tutorial</h3>
<p>Google has a <a href="http://code.google.com/chrome/extensions/getstarted.html">very good tutorial for writing your first extension</a>. This tutorial shows you how to build a simple extension and test in on your browser. After this, you should be ready to build your own extension!</p>
<h3>5. Now what?</h3>
<p>Now that you know how to build a basic Chrome extension, it’s time to let your imagination run wild! Read the <a href="http://code.google.com/chrome/extensions/devguide.html">extension documentation</a> and see what you can build with it. Start small and don’t be afraid to be wrong. When your extension is ready, you can submit it to the <a href="https://chrome.google.com/extensions/">Chrome Extensions Gallery</a> so that everyone can use it!</p>
<p>I’ll be writing more posts on this, so stay tuned.</p>
<p>Do you have any tips for building Chrome extensions? Have your made an extension after following these steps? What other resources do you use to make extensions? Leave a comment and tell us all about it!</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/01/how-to-build-a-chrome-extension-part-1-basics/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New Project: Postponer, Read It Later extensions for Google Chrome</title>
		<link>http://julianapena.com/2010/01/new-project-postponer-read-it-later-extensions-for-google-chrome/</link>
		<comments>http://julianapena.com/2010/01/new-project-postponer-read-it-later-extensions-for-google-chrome/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 09:41:36 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://julianapena.com/?p=392</guid>
		<description><![CDATA[I’ve published a new project on my Projects page: Postponer.
Postponer is a pair of Chrome extensions to manage your Read It Later items.
You can read more about Postponer and download it on its project page.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://julianapena.com/wp-content/uploads/NewProjectPostponerReadItLaterextensions_41EF/PostponerManagerScreen.png"><img style="margin: 0px 15px 0px 0px; display: inline;" title="PostponerManagerScreen" src="http://julianapena.com/wp-content/uploads/NewProjectPostponerReadItLaterextensions_41EF/PostponerManagerScreen_thumb.png" alt="PostponerManagerScreen" width="240" height="212" align="left" /></a>I’ve published a new project on my <a href="http://julianapena.com/projects/">Projects page</a>: <a href="http://julianapena.com/projects/chrome-postponer/">Postponer</a>.</p>
<p>Postponer is a pair of Chrome extensions to manage your Read It Later items.</p>
<p>You can read more about Postponer and download it on its <a href="http://julianapena.com/projects/chrome-postponer/">project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2010/01/new-project-postponer-read-it-later-extensions-for-google-chrome/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Project: Metal Vs Pop!!, a platformer for Java phones</title>
		<link>http://julianapena.com/2009/12/new-project-metal-vs-pop-a-platformer-for-java-phones/</link>
		<comments>http://julianapena.com/2009/12/new-project-metal-vs-pop-a-platformer-for-java-phones/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 16:24:38 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://julianapena.com/2009/12/new-project-metal-vs-pop-a-platformer-for-jave-phones/</guid>
		<description><![CDATA[
I’ve published a new project on my Projects page: Metal Vs Pop!!
Metal Vs Pop!! is a platformer game for Java-enabled phones.
You can read more about Metal Vs Pop!! and download it on its project page.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://julianapena.com/wp-content/uploads/NewProjectMetalVsPopAplatformerforJaveph_9264/image.png"><img class="    alignleft" style="display: inline; border: 0px initial initial;" title="Metal Vs Pop" src="http://julianapena.com/wp-content/uploads/NewProjectMetalVsPopAplatformerforJaveph_9264/image_thumb.png" border="0" alt="image" width="175" height="240" align="left" /></a></p>
<p>I’ve published a new project on my <a href="http://julianapena.com/projects/">Projects page</a>: <a href="http://julianapena.com/projects/metal-vs-pop/">Metal Vs Pop!!</a></p>
<p>Metal Vs Pop!! is a platformer game for Java-enabled phones.</p>
<p>You can read more about Metal Vs Pop!! and download it on its <a href="http://julianapena.com/projects/metal-vs-pop/">project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2009/12/new-project-metal-vs-pop-a-platformer-for-java-phones/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Project: ChromeMilk, a Remember the Milk extension for Google Chrome</title>
		<link>http://julianapena.com/2009/12/new-project-chromemilk-a-remember-the-milk-extension-for-google-chrome/</link>
		<comments>http://julianapena.com/2009/12/new-project-chromemilk-a-remember-the-milk-extension-for-google-chrome/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 00:43:53 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://julianapena.com/2009/12/new-project-chromemilk-a-remember-the-milk-extension-for-google-chrome/</guid>
		<description><![CDATA[
I’ve published a new project on my Projects page: ChromeMilk.
ChromeMilk is a Chrome extension to manage your Remember the Milk tasks.
You can read more about ChromeMilk and download it on its project page.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://julianapena.com/wp-content/uploads/NewProjectChromeMilkaRemembertheMilkexte_106A6/screen2.png"><img class=" alignleft" style="margin-top: 0px; margin-right: 15px; margin-bottom: 0px; margin-left: 0px; display: inline; border: 0px initial initial;" title="ChromeMilk" src="http://julianapena.com/wp-content/uploads/NewProjectChromeMilkaRemembertheMilkexte_106A6/screen2_thumb.png" border="0" alt="screen2" width="240" height="240" align="left" /></a></p>
<p>I’ve published a new project on my <a href="http://julianapena.com/projects/">Projects page</a>: <a href="http://julianapena.com/projects/chrome-rtm/">ChromeMilk</a>.</p>
<p>ChromeMilk is a Chrome extension to manage your Remember the Milk tasks.</p>
<p>You can read more about ChromeMilk and download it on its <a href="http://julianapena.com/projects/chrome-rtm/">project page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2009/12/new-project-chromemilk-a-remember-the-milk-extension-for-google-chrome/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>N-Body Simulations con GPGPU, CUDA y Open CL</title>
		<link>http://julianapena.com/2009/11/n-body-simulations-con-gpgpu-cuda-y-open-cl/</link>
		<comments>http://julianapena.com/2009/11/n-body-simulations-con-gpgpu-cuda-y-open-cl/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 16:09:19 +0000</pubDate>
		<dc:creator>Juliana Peña</dc:creator>
				<category><![CDATA[CUDA]]></category>
		<category><![CDATA[En Español]]></category>
		<category><![CDATA[gpgpu]]></category>
		<category><![CDATA[OpenCL]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://julianapena.com/2009/11/n-body-simulations-con-gpgpu-cuda-y-open-cl/</guid>
		<description><![CDATA[Una presentación que hice hace poco para el grupo de cómputo paralelo del Tec de Monterrey explicando el ejemplo del SDK de Nvidia para CUDA y OpenCL.

]]></description>
			<content:encoded><![CDATA[<p>Una presentación que hice hace poco para el grupo de cómputo paralelo del Tec de Monterrey explicando el ejemplo del SDK de Nvidia para CUDA y OpenCL.</p>
<p align="center"><iframe height="342" src="http://docs.google.com/present/embed?id=dfc8gvz5_246df55f4cd" frameborder="0" width="410"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://julianapena.com/2009/11/n-body-simulations-con-gpgpu-cuda-y-open-cl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.488 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-28 21:31:10 -->
