<?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>Andrew Lisy's Blog &#187; project</title>
	<atom:link href="http://blog.ajlisy.com/tag/project/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ajlisy.com</link>
	<description>Linux, finance, rants, politics</description>
	<lastBuildDate>Mon, 17 May 2010 23:17:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Power of Ignorance, or, What an 8 Year Old Can Teach You About Risk</title>
		<link>http://blog.ajlisy.com/2009/03/the-power-of-ignorance-or-what-an-8-year-old-can-teach-you-about-risk/</link>
		<comments>http://blog.ajlisy.com/2009/03/the-power-of-ignorance-or-what-an-8-year-old-can-teach-you-about-risk/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 20:06:42 +0000</pubDate>
		<dc:creator>aj</dc:creator>
				<category><![CDATA[entrepreneurial]]></category>
		<category><![CDATA[internet media]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[careers]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://blog.ajlisy.com/?p=216</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><em>Cross posted on <a href="http://www.freeagentnet.com">The Free Agents</a>, a network for people between jobs.</em></p>
<p>When I was 8, I got a 14.4 modem and an AOL dialup subscription for my birthday. It was one of the best presents I&#8217;ve ever received, and I quickly started exploring all that AOL had to offer. Soon, I started to wonder how web pages actually got <em>on</em> the internet, so I found AOL Personal Publisher and started messing around.</p>
<p>In most cases, 8 year olds don&#8217;t have too much to contribute to the world, and I was no exception. I just wanted to create a web page for <em>something</em>, so I settled on one thing that was well known to me and friends &#8212; video games. I created <strong>AJ&#8217;s Code Page</strong> (specializing in infinite lives, double damage, god mode, and the like) hosted on the now-defunct members.aol.com, and started trying to figure out how to get users.<br />
<span id="more-216"></span><br />
It was near the beginning of the web (1993), and nobody really knew what was going on, so it was an amazing learning experience. I had never heard of Photoshop at that point, much less have any experience with it, so I found some graphic designer on a forum that made a [pretty cool] banner logo featuring a Playstation logo on the left, the words &#8220;AJ&#8217;s Code Page&#8221; in the middle, and the Nintendo 64 logo on the right. I scoured the web for links to the best code pages, and found, among others, <strong>hyper@ctive</strong> (also defunct), which had a seemingly endless supply of codes for nearly any game. </p>
<div id="attachment_229" class="wp-caption alignleft" style="width: 310px"><img src="http://blog.ajlisy.com/wp-content/uploads/2009/03/ajs_code_page-300x60.gif" alt="The AJ&#039;s Code Page Banner" title="ajs_code_page" width="300" height="60" class="size-medium wp-image-229" /><p class="wp-caption-text">The AJ's Code Page Banner</p></div>
<p>I kept trying new ways to get traffic, and signed up for some banner exchange programs which were an early form of banner advertising where people in a network would agree to show your banner (rotated among others in the network) in exchange for you showing their banner on your site. The goal was more to get traffic than to actually make any money, although I&#8217;m sure that some people figured out ways to profit from it. To a third grader, money isn&#8217;t the first thought when you&#8217;re just trying to get people to look at a site you&#8217;ve thrown up on the net. </p>
<p>I plugged along, and for months the counter at the bottom of my page registered barely any page views. I continually submitted my page to every search engine I could find, yet nothing really boosted my audience. I wasn&#8217;t discouraged &#8212; after all, my goal was first to see if I could make a cool page, and second to actually get visitors to that page. However, all of the sudden, one week something just &#8220;clicked&#8221;, and the counter had over 2000 hits! The next day, another 500!  A few weeks later, I was at 8000 hits, and I felt like I was on top of the video game code world!</p>
<p>Who cares? I had all but forgotten about &#8220;AJ&#8217;s Code Page&#8221; and the beginnings of my foray into creating a web community until several weeks ago. I was laid off from my job in Wall Street, and I wanted to set up a web site for people that were in the same position and just wanted a place to go and chat, and network informally with others. Not a job site, but a place where you could feel comfortable asking where to find a cheap drink or talking about interesting places you&#8217;ve traveled during your time between jobs. I took a quick look around the net, and soon <a href="http://www.freeagentnet.com">The Free Agents</a> was born.</p>
<p>It turns out that the biggest obstacle you have to overcome when beginning an undertaking like this is the self doubt that inevitable springs into your mind. Could I get any users? Would anyone care about the site? Why would someone visit my site when they could just as easily spend their time on Facebook? </p>
<p>The doubt almost doomed my project before I had put a single page up. But strangely, what motivated me was not anything I learned in college, or any encouragement from others. The final push that I needed was simply thinking back and remember that, 15 years ago, I set up a web page that people <em>actually visited</em>. If I could do it then, why not give it another shot now? </p>
<p>The whole idea here, and the title of this post, is <em>the power of ignorance.</em> Eight year olds don&#8217;t generally know that something is hard, or that they are almost definitely going to fail. They just go for it &#8212; if for no other reason, because they are <em>ignorant</em> of the possibility, or likelihood, of failure. Is <strong>AJ&#8217;s Code Page</strong> still around today? Nope. But that endeavor was enough to motivate me on another project, and convince me that failure isn&#8217;t a bad outcome. Will <a href="http://www.freeagentnet.com">The Free Agents</a> be a roaring success? I hope so, but probabilistically, no. However, I know that if it fails, one day I might look back and say, &#8220;I created this social network &#8212; its gone now, but it succeeded in convincing me that <em>[whatever]</em> is possible&#8221;. And that knowledge may very well eventually lead to something that <em>is</em> a roaring success.</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Andrew%20Lisy%27s%20Blog&amp;siteurl=http%3A%2F%2Fblog.ajlisy.com%2F&amp;linkname=The%20Power%20of%20Ignorance%2C%20or%2C%20What%20an%208%20Year%20Old%20Can%20Teach%20You%20About%20Risk&amp;linkurl=http%3A%2F%2Fblog.ajlisy.com%2F2009%2F03%2Fthe-power-of-ignorance-or-what-an-8-year-old-can-teach-you-about-risk%2F"><img src="http://blog.ajlisy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.ajlisy.com/2009/03/the-power-of-ignorance-or-what-an-8-year-old-can-teach-you-about-risk/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Talking Linux RSS Alarm Clock</title>
		<link>http://blog.ajlisy.com/2008/12/talking-linux-rss-alarm-clock/</link>
		<comments>http://blog.ajlisy.com/2008/12/talking-linux-rss-alarm-clock/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 22:30:04 +0000</pubDate>
		<dc:creator>Andrew Lisy</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[alarm clock]]></category>
		<category><![CDATA[festival]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://blog.ajlisy.com/?p=20</guid>
		<description><![CDATA[I don&#8217;t like to get up early. Therefore, I stay in bed as late as possible and, as a result, never really set aside any time to check the news or even the weather before I head out the door. Although it would only take me an extra 3 minutes or so to read though [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t like to get up early. Therefore, I stay in bed as late as possible and, as a result, never really set aside any time to check the news or even the weather before I head out the door. Although it would only take me an extra 3 minutes or so to read though stories or lookup the weather, the thought of turning on my monitor, entering my password, and going to the appropriate sites isn&#8217;t terribly attractive for me at 5:30 in the morning.</p>
<p>Combine the above with a general distaste for the jarring sound that my alarm <img src="http://blog.ajlisy.com/wp-content/uploads/2009/02/alarmclock.jpg" alt="alarmclock" title="alarmclock" width="238" height="250" align="left" /><br />
makes got me thinking that there had to be a better way to get my morning started. I searched a bit to find MP3 alarm clocks (of which there are many) and initially used <a href="http://pim.kde.org/components/kalarm.php">KAlarm</a> which served the purpose of waking me up with music quite adequately.</p>
<p>However, I work in the financial industry, where overnight news is advantageous to hear before getting to work. The markets might be up or down by large amounts (especially these days) based on what happened overnight, so at least figuring out what is going on before getting into the office is pretty helpful. This, combined with a day where I got stuck in the rain because I hadn&#8217;t checked the weather, got me thinking &#8212; how about an alarm clock that read news and weather from an RSS feed in addition to waking me up with a song.</p>
<p>Here&#8217;s how I created it:</p>
<p><strong>Basics:</strong><br />
- Python with urllib, <a href="http://effbot.org/zone/element-index.htm">ElementTree</a>, and re installed<br />
- cron<br />
- <a href="http://www.mplayerhq.hu/design7/news.html">mplayer</a> (available on portage and apt)<br />
- [optional] A playlist of MP3s or other songs that mplayer can play<br />
- <a href="http://www.cstr.ed.ac.uk/projects/festival/download.html">festival</a> &#8212; a text-to-speech program (available on portage for gentoo and probably on apt too)</p>
<p><strong>Steps</strong></p>
<p>1) Install the necessary software. Emerge or apt-get mplayer and festival. Install ElementTree for python by following the instructions <a href="http://effbot.org/zone/element-index.htm#installation">here</a>. The other packages, urllib and re were already installed on my python, but if thats not the case for you, a bit of Googling can help out here.</p>
<p>2) Pick one song at random from your playlist. The way I chose to do this was to use a quick bash line to pick a a random line from the playlist file (<code>playlist.m3u</code>), and then create a new playlist with only the one song (<code>single_song.m3u</code>). Another thought is to just start mplayer and play a random song directly from the big playlist, but this means that the music will keep playing until you kill mplayer. I wanted to have one song play and then have my news and weather start to be read, so I play only the one song from the small playlist.</p>
<pre>#alarm.sh -- pulls together elements of alarm clock
#Written by ajlisy, 2008
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

#Create file with single song
nlines=`cat playlist.m3u | wc -l`
random_line=`expr $RANDOM % $nlines + 1`
sed -n $random_line,${random_line}p playlist.m3u &gt; single_song.m3u

#Play that song
mplayer -playlist single_song.m3u

#  &lt;...&gt;</pre>
<p>3) Set up the basic scripts for fetching and parsing the weather from the Yahoo! RSS feeds. The idea is that 2 simple python scripts, <code>get _weather.py</code> and <code>get_news.py</code> are called from the main bash script to populate the &#8220;script&#8221; files that are read by festival.</p>
<pre>#get_news.py -- fetches headlines from RSS feed
#Written by ajlisy 2008
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

import urllib
import re
from elementtree.ElementTree import parse

def get_headlines(news_source,num_headlines):
  news_rss_feed=parse(urllib.urlopen(news_source)).getroot()
  raw_headlines=news_rss_feed.findall('channel/item')
  headlines=[]
  for i in range(0,num_headlines):
     try:
       headlines.append(raw_headlines[i].findtext('title').splitlines()[0])
     except:
       pass
  return headlines

print "Today's top news stories      "
YAHOO_NEWS = 'http://rss.news.yahoo.com/rss/business'
NYT_NEWS='http://www.nytimes.com/services/xml/rss/nyt/Business.xml'

print "Worldwide news from New York Times"
for element in get_headlines(NYT_NEWS,5):
  try:
    print element
  except:
    pass
print "Business news from Yahoo"
for element in get_headlines(YAHOO_NEWS,5):
  try:
    print element
  except:
    pass</pre>
<pre>#get_weather.py -- adapted from the tutorial on the Yahoo
#  developers page found at
#  http://developer.yahoo.com/python/python-xml.html

import urllib
from elementtree.ElementTree import parse

WEATHER_URL = 'http://xml.weather.yahoo.com/forecastrss?p=%s'
WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0'

def weather_for_zip(zip_code):
  url = WEATHER_URL % zip_code
  rss = parse(urllib.urlopen(url)).getroot()
  forecasts = []
  for element in rss.findall('channel/item/{%s}forecast' % WEATHER_NS):
    forecasts.append({
        'date': element.get('date'),
        'low': element.get('low'),
        'high': element.get('high'),
        'condition': element.get('text')
       })
    ycondition = rss.find('channel/item/{%s}condition' % WEATHER_NS)
    return {
        'current_condition': ycondition.get('text'),
        'current_temp': ycondition.get('temp'),
        'forecasts': forecasts,
        'title': rss.findtext('channel/title')
    }

weather=weather_for_zip(10038)
print "The current weather conditions are "+weather['current_condition']+" with a temperature of "+ weather['current_temp'] + " degrees."
print "Today's forecast is " + weather['forecasts'][0]['condition'] + " with a high of " + weather['forecasts'][0]['high'] + " degrees and a low of "+weather['forecasts'][0]['low'] + " degrees"</pre>
<p>4)  Link it all together with the <code>alarm.sh</code> script that calls the individual &#8220;subroutines&#8221; mentioned above and assembles them into the alarm.</p>
<pre>#alarm.sh

#Create file with single song
nlines=`cat playlist.m3u | wc -l`
random_line=`expr $RANDOM % $nlines + 1`
sed -n $random_line,${random_line}p playlist.m3u &gt; single_song.m3u

#Play that song
mplayer -playlist single_song.m3u

#Create file to read
python get_weather.py &gt; weather.txt
python get_news.py &gt; news.txt

festival --tts weather.txt
festival --tts news.txt</pre>
<p>Add the resulting script to your crontab for whenever you want to get up, and enjoy a better start to the day.</p>
<p class="addtoany_share_save_container">
    <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?sitename=Andrew%20Lisy%27s%20Blog&amp;siteurl=http%3A%2F%2Fblog.ajlisy.com%2F&amp;linkname=Talking%20Linux%20RSS%20Alarm%20Clock&amp;linkurl=http%3A%2F%2Fblog.ajlisy.com%2F2008%2F12%2Ftalking-linux-rss-alarm-clock%2F"><img src="http://blog.ajlisy.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>

	</p>]]></content:encoded>
			<wfw:commentRss>http://blog.ajlisy.com/2008/12/talking-linux-rss-alarm-clock/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
