<?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>rel=me &#187; greader</title>
	<atom:link href="http://rel.me/t/greader/feed/" rel="self" type="application/rss+xml" />
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Wed, 01 Feb 2012 07:26:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Javascript IE PNG fix</title>
		<link>http://rel.me/2007/02/26/javascript-png-fix-for-ie/</link>
		<comments>http://rel.me/2007/02/26/javascript-png-fix-for-ie/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 02:33:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[greader]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[png]]></category>
		<category><![CDATA[reader]]></category>

		<guid isPermaLink="false">/2007/09/03/javascript-png-fix-for-ie</guid>
		<description><![CDATA[I adapted the pngfix.js to be rails friendly. Not that I should be using image tags anyway. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 var arVersion = navigator.appVersion.split(&#34;MSIE&#34;); var version = parseFloat(arVersion[1]); if ((version &#62;= 5.5) &#38;&#38; (document.body.filters)) { var [...]]]></description>
			<content:encoded><![CDATA[<p>I adapted the <a href="http://homepage.ntlworld.com/bobosola/pnghowto.htm">pngfix.js</a> to be rails friendly. Not that I should be using image tags anyway.</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt>15<tt>
</tt>16<tt>
</tt>17<tt>
</tt>18<tt>
</tt>19<tt>
</tt><strong>20</strong><tt>
</tt>21<tt>
</tt>22<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">var arVersion = navigator.appVersion.split(&quot;MSIE&quot;);<tt>
</tt>var version = parseFloat(arVersion[1]);<tt>
</tt><tt>
</tt>if ((version &gt;= 5.5) &amp;&amp; (document.body.filters)) {        <tt>
</tt>  var i;<tt>
</tt>  var length = document.images.length;<tt>
</tt>    for(i = 0; i &lt; length; i++) {<tt>
</tt>      var img = document.images[i];<tt>
</tt>      var re = /\w+\.[Pp][Nn][Gg]\w*/;<tt>
</tt>      if (img &amp;&amp; re.exec(img.src)) {<tt>
</tt>        var imgTitle = img.title ? &quot;title='&quot; + img.title + &quot;' &quot; : &quot;title='&quot; + img.alt + &quot;' &quot;;<tt>
</tt>        imgStyle = img.parentElement.href ? &quot;cursor:pointer;&quot; : &quot;&quot;;<tt>
</tt>        imgStyle += &quot;width:&quot; + img.width + &quot;px; height:&quot; + img.height + &quot;px;&quot;;<tt>
</tt>        imgStyle += &quot;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src=\'&quot; + img.src + &quot;\', sizingMethod='scale');&quot;;<tt>
</tt>                <tt>
</tt>        var strNewHTML = &quot;&amp;lt;span &quot; + imgTitle + &quot; style=\&quot;display:inline-block; &quot; + imgStyle + &quot; \&quot;&gt;&lt;/span&gt;&quot;;<tt>
</tt><tt>
</tt>        img.outerHTML = strNewHTML;<tt>
</tt>        i = i - 1;<tt>
</tt>    }<tt>
</tt>  }<tt>
</tt>}</pre>
</td>
</tr>
</table>
<p><a href="http://dclicio.us/javascripts/pngfix.js">download</a></p>
<p>Then add this somewhere in your &lt;head&gt;</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">&lt;!--[if lt IE 7]&gt;<tt>
</tt>&lt;script defer type=&quot;text/javascript&quot; src=&quot;/javascripts/pngfix.js&quot;&gt;&lt;/script&gt;<tt>
</tt>&lt;![endif]--&gt;</pre>
</td>
</tr>
</table>
<p>The only other requirement is you specify a width and height on your image_tags</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre><tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">&lt;<span class="s"><span class="dl">%=</span><span class="k"> image_tag(&quot;fam/date.png&quot;, :alt </span><span class="dl">=</span></span>&gt; <span class="s"><span class="dl">&quot;</span><span class="k">ical</span><span class="dl">&quot;</span></span>, <span class="sy">:width</span> =&gt; <span class="s"><span class="dl">&quot;</span><span class="k">16px</span><span class="dl">&quot;</span></span>, <span class="sy">:height</span> =&gt; <span class="s"><span class="dl">&quot;</span><span class="k">16px</span><span class="dl">&quot;</span></span>) %&gt;</pre>
</td>
</tr>
</table>
<p>Though you should use CSS for most images, this is a fast way to make your png&#8217;s work in IE6.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/02/26/javascript-png-fix-for-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating iCalendar files in Ruby</title>
		<link>http://rel.me/2007/02/16/creating-icalendar-files-in-ruby/</link>
		<comments>http://rel.me/2007/02/16/creating-icalendar-files-in-ruby/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 06:51:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[greader]]></category>
		<category><![CDATA[ical]]></category>
		<category><![CDATA[icalendar]]></category>
		<category><![CDATA[ics]]></category>

		<guid isPermaLink="false">/2007/09/03/creating-icalendar-files-in-ruby</guid>
		<description><![CDATA[Using the iCalendar ruby library (gem install icalendar): From the Show model, I added a method to create an event: 1 2 3 4 5 6 7 8 9 10 11 class Show &#60; ActiveRecord::Base ... def to_ical_event event = Icalendar::Event.new event.dtstart = time ? time.to_datetime : date event.dtstamp = created_at.to_datetime event.summary = &#34;The title&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Using the <a href="http://icalendar.rubyforge.org/">iCalendar</a> ruby library (gem install icalendar):<br/><br />
From the Show model, I added a method to create an event:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="r">class</span> <span class="cl">Show</span> &lt; <span class="co">ActiveRecord</span>::<span class="co">Base</span><tt>
</tt>...<tt>
</tt>  <span class="r">def</span> <span class="fu">to_ical_event</span><tt>
</tt>    event = <span class="co">Icalendar</span>::<span class="co">Event</span>.new    <tt>
</tt>    event.dtstart = time ? time.to_datetime : date<tt>
</tt>    event.dtstamp = created_at.to_datetime<tt>
</tt>    event.summary = <span class="s"><span class="dl">&quot;</span><span class="k">The title</span><span class="dl">&quot;</span></span><tt>
</tt>    event.description = <span class="s"><span class="dl">&quot;</span><span class="k">The description</span><span class="dl">&quot;</span></span><tt>
</tt>    event.uid = <span class="s"><span class="dl">&quot;</span><span class="k">show-</span><span class="il"><span class="idl">#{</span>id<span class="idl">}</span></span><span class="dl">&quot;</span></span>   <tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<ul>
<li><code>dtstart</code> takes a Date or DateTime object (see Ruby cookbook recipe chapter 3.9 for to_datetime method).
</ul>
<p>From the Venue model, I added a method to create the calendar and add all the show events:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt>15<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="r">class</span> <span class="cl">Venue</span> &lt; <span class="co">ActiveRecord</span>::<span class="co">Base</span><tt>
</tt>  has_many <span class="sy">:shows</span>  <tt>
</tt>...<tt>
</tt>  <span class="r">def</span> <span class="fu">to_ical</span><tt>
</tt>    ical = <span class="co">Icalendar</span>::<span class="co">Calendar</span>.new<tt>
</tt>    ical.product_id = <span class="s"><span class="dl">&quot;</span><span class="k">-//dclicio.us//iCal 1.0//EN</span><span class="dl">&quot;</span></span><tt>
</tt>    ical.custom_property(<span class="s"><span class="dl">&quot;</span><span class="k">X-WR-CALNAME;VALUE=TEXT</span><span class="dl">&quot;</span></span>, name)<tt>
</tt>    ical.custom_property(<span class="s"><span class="dl">&quot;</span><span class="k">X-WR-TIMEZONE;VALUE=TEXT</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">US/Eastern</span><span class="dl">&quot;</span></span>)<tt>
</tt>    shows.each <span class="r">do</span> |show|<tt>
</tt>      event = show.to_ical_event<tt>
</tt>      ical.add_event(event)<tt>
</tt>    <span class="r">end</span><tt>
</tt>    ical<tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<ul>
<li>The <code>X-WR</code> custom properties are read by iCal and by google calendar.
</ul>
<p>Then a task to iterate through the venues creating the ics files:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="co">Venue</span>.find(<span class="sy">:all</span>, <span class="sy">:include</span> =&gt; [ <span class="sy">:shows</span> ]).each <span class="r">do</span> |venue|<tt>
</tt>  ical = venue.to_ical       <tt>
</tt>  file = <span class="co">File</span>.new(<span class="s"><span class="dl">&quot;</span><span class="k">/tmp/</span><span class="il"><span class="idl">#{</span>venue.name<span class="idl">}</span></span><span class="k">.ics</span><span class="dl">&quot;</span></span>, <span class="s"><span class="dl">&quot;</span><span class="k">w</span><span class="dl">&quot;</span></span>)<tt>
</tt>  file.write(ical.to_ical) <span class="c"># Allow myself to ... introduce ... myself :/</span><tt>
</tt>  file.close<tt>
</tt><span class="r">end</span></pre>
</td>
</tr>
</table>
<p>An ics file looks like:</p>
<table class="CodeRay">
<tr>
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt>5<tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt>15<tt>
</tt></pre>
</td>
<td class="code">
<pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">BEGIN:VCALENDAR<tt>
</tt>X-WR-CALNAME;VALUE=TEXT:Black cat<tt>
</tt>VERSION:2.0<tt>
</tt>CALSCALE:GREGORIAN<tt>
</tt>PRODID:-//dclicio.us//iCal 1.0//EN<tt>
</tt>X-WR-TIMEZONE;VALUE=TEXT:US/Eastern<tt>
</tt>BEGIN:VEVENT<tt>
</tt>UID:dclicio.us-243<tt>
</tt>DESCRIPTION:with \nhttp://dclicio.us<tt>
</tt>SUMMARY:<tt>
</tt>DTSTART:20070117<tt>
</tt>DTSTAMP:040425<tt>
</tt>SEQ:0<tt>
</tt>END:VEVENT<tt>
</tt>END:VCALENDAR</pre>
</td>
</tr>
</table>
<p>I then surface these files in public/ical/ and add a <code>ProxyPass /ical !</code> so apache can serve em up straight without hitting mongrel.<br/><br />
Check out <a href="http://dclicio.us">dclicio.us</a> to see it in action.</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2007/02/16/creating-icalendar-files-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

