<?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>blog@osd.se &#187; Web</title>
	<atom:link href="http://blog.osd.se/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.osd.se</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 19 Oct 2009 12:20:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prototype is a prototype?</title>
		<link>http://blog.osd.se/2007/08/13/prototype-is-a-prototype/</link>
		<comments>http://blog.osd.se/2007/08/13/prototype-is-a-prototype/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 21:46:44 +0000</pubDate>
		<dc:creator>Oskar</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.osd.se/2007/08/13/22/</guid>
		<description><![CDATA[In my quest to figure out why Prototype&#8217;s request method sent all my submit buttons, I stumbled upon this, not so pretty, piece of code:
if (value != null &#38;&#38; (element.type != 'submit' &#124;&#124; (!submitted &#38;&#38;
    submit !== false &#38;&#38; (!submit &#124;&#124; key == submit) &#38;&#38; (submitted = true)))) {
It&#8217;s from a changeset [...]]]></description>
			<content:encoded><![CDATA[<p>In my quest to figure out why <a href="http://www.prototypejs.org/">Prototype&#8217;s</a> request method sent all my submit buttons, I stumbled upon this, not so pretty, piece of code:</p>
<pre>if (value != null &amp;&amp; (element.type != 'submit' || (!submitted &amp;&amp;
    submit !== false &amp;&amp; (!submit || key == submit) &amp;&amp; (submitted = true)))) {</pre>
<p>It&#8217;s from <a href="http://dev.rubyonrails.org/changeset/7140">a changeset</a> in Prototype&#8217;s Trac page and is supposed to fix <a href="http://dev.rubyonrails.org/ticket/5031">this bug</a>.</p>
<p>The reason I started reading the code was that I&#8217;m using multiple submit tags with different names. Instead of just varying the value, I set the type tag to &#8220;submit&#8221;. Example:</p>
<pre>&lt;input name="create" value="Create New..." type="submit" /&gt;</pre>
<p>and in Rails I check if <code>params[:create]</code> is set to see if that button was pressed or not. Perhaps this is really bad for some reason that I have missed, I don&#8217;t know (it does work in my version of IE6 aswell), but <a href="http://dev.rubyonrails.org/changeset/7140">the fix</a> doesn&#8217;t solve my problem. It just solves when using multiple input tags with the name submit and vary the name. The reason I don&#8217;t like looking what the value attribute is set to, is that it&#8217;s part of the design and should be free to change, without having to modify the controller. Of course, hidden values are always an alternative, but requiring Javascript to use a simple form seems wrong.</p>
<p>Anyway, I opened up my prototype.js and started reading the code and found the above piece of code. Note the assignment in the end of the second row. I think it&#8217;s intentional.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.osd.se/2007/08/13/prototype-is-a-prototype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oskar on Rails</title>
		<link>http://blog.osd.se/2007/08/01/oskar-on-rails/</link>
		<comments>http://blog.osd.se/2007/08/01/oskar-on-rails/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 19:45:21 +0000</pubDate>
		<dc:creator>Oskar</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.osd.se/2007/08/01/oskar-on-rails/</guid>
		<description><![CDATA[Update : I was going to write a post about the changes I made to acts_as_taggable to get user support, but I just switched to has_many_polymorphs (HMP). I wanted self-referencing tags (being able to tag tags) and HMP provided that with little work. HMP also seems to work directly with will_paginate, which is great. The [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update :</strong> I was going to write a post about the changes I made to acts_as_taggable to get user support, but I just switched to <em>has_many_polymorphs</em> (HMP). I wanted self-referencing tags (being able to tag tags) and HMP provided that with little work. HMP also seems to work directly with will_paginate, which is great. The per user tags weren&#8217;t harder to get in HMP than in acts_as_taggable_on_steroids.</p>
<p>Oh the title, I&#8217;m so funny! I have to be the first one to ever think of that. Right&#8230;</p>
<p>This became another text in English, mainly because the follow up (if I write it) could possibly be useful to more people. We&#8217;ll see what happens.</p>
<p>Anyway, about a month ago, I decided to learn a bit of Ruby on Rails. I hadn&#8217;t tried Ruby before either, so learning Ruby was/is part of the process, but you can come a long way without having to study the language very deep. Most stuff works as you think they would, after learning the basics. In general I think it&#8217;s a nice language, but my knowledge isn&#8217;t very good yet.</p>
<p>Rails is wonderful to work with in general. I haven&#8217;t really done any web development in many years now (except for some minor WordPress hacking to modify it for my needs, but even that was more than a year ago, and a simple summer course two years ago). Back then I knew a lot less (doh!)  and most stuff I wrote was quite poorly written, I realize now, in terms of flexibility and security (Hello SQL injection!). I sure as hell wrote all my SQL statements by hand, though they were quite simple, and in general it usually became quite a mess quickly. I&#8217;m sure there existed some projects that the same idea as Rails, but I didn&#8217;t know about them then.</p>
<p>Something that is a bit annoying now, is that for my project I wanted two things; <a href="http://en.wikipedia.org/wiki/Taxonomy" title="Taxonomy">tags</a> and pagination (split up something over several pages, to give the user a better overview. Nothing fancy really). As it turns out, the built-in <a href="http://wiki.rubyonrails.com/rails/pages/PaginationHelper">paginate</a> module is deprecated and will be removed in the next version (it&#8217;s already gone from Edge Rails) and both the gem and plugin named <em>acts_as_taggable</em> are old and bad, in different ways (they aren&#8217;t the same).</p>
<p>The pagination wasn&#8217;t hard to solve. I found the plugin <em>will_paginate,</em> which works great. All good. For now&#8230;</p>
<p>The tagging wasn&#8217;t quite as easy. There are quite a few plugins that tries to (and does) fix what <em>acts_as_taggable</em> did, but better. One is <em><a href="http://blog.evanweaver.com/pages/has_many_polymorphs">has_many_polymorphs</a></em>, which is a fair bit more complex and flexible, but I didn&#8217;t really need that. The <a href="http://blog.evanweaver.com/articles/2007/01/13/growing-up-your-acts_as_taggable">guide he has, on his blog</a>, to use the plugin for tagging is about converting from <em>acts_as_taggable</em> to <em>has_many_polymorphs</em>, which includes a bit more work than it felt worth it for me. I ended up using <em>acts_as_taggable_on_steroids</em> (puh, long name) which is quite simple. It has (or had, I haven&#8217;t checked the last version yet) a bug with migrations, but in general it was easy to work with and to work around the bug.</p>
<p>I also wanted to tie my tags to users, because the project isn&#8217;t about a community and all user data is private to each user. There&#8217;s also a third plugin for tagging, <a href="http://geemus.devjavu.com/projects/geemus/wiki"><em>acts_as_taggable_redux</em></a>, and it has user support already, but it turns out that he ties the tagging (the connection between the tag and the item) to the user instead of the tag. That&#8217;s great for community like sites, like <a href="http://last.fm">last.fm,</a> where all tags are global, but that wasn&#8217;t what I wanted. I also found a post about a<a href="http://www.slashdotdash.net/articles/2006/04/29/acts_as_taggable-per-user-tagging">dding user support to<em> acts_as_taggable</em></a>, but it had the same user connections. Instead I decided that it was easy enough to do myself. I&#8217;m not saying that it&#8217;s hard, it&#8217;s not, but if someone else had done it already and had working plugin, I would rather use that).</p>
<p>It turned out to be even easier than I imagined at first. Rails has some really great tools. After adding a simple user_id column to the tag model, I could do things like</p>
<blockquote><p>user.tags.find_by_name(tag_name)</p></blockquote>
<p>which looks great in terms of readability. I might post a summary later on what I changed to get this working.</p>
<p>Now to the real problem: get them to work together. It wasn&#8217;t quite as easy to get <em>will_paginate</em> to work with <em>acts_as_taggable_on_steroids</em>. Find_tagged_with works directly on the type you want to tag, but will_paginate does that too. There might be easier ways than how I solved it, I don&#8217;t claim to be an expert after just a week (when I did this) with RoR. My solution wasn&#8217;t very nice either. I basically runs find_tagged_with, but returns the database request, instead of executing it and returning the result,  modify the SQL statement a bit and then use paginate_by_sql to turn it into a paginatable (cute word) object. The correct solution is probably to modify how <em>acts_as_taggable_on&#8230;</em> works and extend it with the things needed to paginate the results. If I understand the comments on the <em>acts_as_taggable_on_steroid</em> page, <a href="http://blog.wolfman.com/articles/2007/07/30/paginating-acts_as_taggable-with-will_paginate">someone might have done that now</a>. I have to read up on that.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.osd.se/2007/08/01/oskar-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joost &#8211; cool but a bit disappointing</title>
		<link>http://blog.osd.se/2007/05/10/joost-cool-but-a-bit-disappointing/</link>
		<comments>http://blog.osd.se/2007/05/10/joost-cool-but-a-bit-disappointing/#comments</comments>
		<pubDate>Thu, 10 May 2007 19:08:22 +0000</pubDate>
		<dc:creator>Oskar</dc:creator>
				<category><![CDATA[TV]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.osd.se/2007/05/10/joost-cool-but-a-bit-disappointing/</guid>
		<description><![CDATA[(This post is based on the content available in Sweden. We don&#8217;t get Comedy Central, for example.)
A couple of days ago I got myself a Joost beta invite from GigaOM, so I&#8217;ve been testing it out a bit. To start with, I miss sitting in the sofa and relaxing, because my chair isn&#8217;t nearly as [...]]]></description>
			<content:encoded><![CDATA[<p>(This post is based on the content available in Sweden. We don&#8217;t get Comedy Central, for example.)</p>
<p>A couple of days ago I got myself a <a href="http://www.joost.com">Joost</a> beta <a href="http://gigaom.com/2007/05/07/get-joost-invites-from-gigaom/">invite from GigaOM</a>, so I&#8217;ve been testing it out a bit. To start with, I miss sitting in the sofa and relaxing, because my chair isn&#8217;t nearly as comfortable as my sofa. I do have a computer hooked to my TV, but that computer runs <a href="http://www.ubuntu.com/">Ubuntu</a> and I have no plans to change that &#8211; at least not just to run Joost. There is a a Linux client planned for Joost, but it&#8217;s not yet available. Also, I think Joost gives you a better experience if you have a mouse to control the application with. Even if the available keyboard shortcuts worked well, they didn&#8217;t quite cover all my needs. I also missed the relaxing part with TV; just watching and letting someone else decide what to show. Being able to chose between lots of material is not the same as only having a bunch of channels to switch between, but I guess that&#8217;s what Joost wants to change too.</p>
<p>Something that they seem to have added more of lately is ads. Not like commercials on TV, but very short ones, lasting just a couple of seconds between the shows. Saying things like &#8220;brought to you by hp.com&#8221; while showing a blue screen with a hp logo on. There is also this small box popping up in the lower right corner every now and then. I&#8217;ve seen a couple of different company logos there and you can actually click the box and it seem to be a ordinary hyper link which opens in your browser.</p>
<p>I watched for a while, but besides some music videos, I didn&#8217;t find a lot of material that was interesting to me. Often what seemed to be a interesting program when reading about it, turned out to be a five year old crappy talk show clip, and it was harding knowing what was old and what was new. To guess that &#8220;Episode 152&#8243; is older than &#8220;Episode 160&#8243; is fairly obvious, but there&#8217;s nothing that tells you if it was recorded 1999 or 2006. I couldn&#8217;t find any interesting TV shows or movies that I&#8217;d like to watch (except possibly Fifth Gear). However, if you do like Lassie, Poker, Indy 500, MTV-like shows, silent movies, fighting and soccer, there&#8217;s stuff for you to watch. Unfortunately, I don&#8217;t really like any of those.</p>
<p>One should keep in mind that this is a beta version. I hope they add <em>a lot</em> of more content before release, because it&#8217;s needed. <a href="http://www.techcrunch.com/2007/05/01/joost-signs-deal-with-cnn-sony-nhl-prepares-to-launch/">Rumors say that a release is close</a>, so I hope for their sake that they have time to do it before that. (Their financial part seem to be working at least, because they <a href="http://www.techcrunch.com/2007/05/09/6022/">recently announced a $45 million funding</a> from various companies.)</p>
<p>Unfortunately the content isn&#8217;t Joost&#8217;s only problem. When I started watching today, some (old) <a href="http://fifthgear.five.tv/">Fifth Gear</a> episodes, it wasn&#8217;t smooth at all. The download speed wasn&#8217;t fast enough (I have a 10Mbit/s connection and wasn&#8217;t using it for anything else at the time), so it couldn&#8217;t fill its buffer to deliver smooth sound and video. It kept skipping for the first few minutes or so, then it got better for about ten minutes, and then the skipping started again and continued until I decided it wasn&#8217;t worth watching. To start with, I wish they would have used a larger buffer so it would download more data between the buffer underruns. The pauses would of course last longer then, but I think it would have been a better experience. <a href="http://newteevee.com/2007/05/10/joost-has-some-infrastructure-challenges/">NewTeeVee reports about infrastructure problems</a> with P2P and it could indeed be related to my own problems today. It will be interesting to see how this develop, because the hype in its own will probably keep Joost alive, at least for a while after the launch.</p>
<p>If you want an invite anyway, just let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.osd.se/2007/05/10/joost-cool-but-a-bit-disappointing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Reader and MSIE</title>
		<link>http://blog.osd.se/2007/05/08/google-reader-and-msie/</link>
		<comments>http://blog.osd.se/2007/05/08/google-reader-and-msie/#comments</comments>
		<pubDate>Tue, 08 May 2007 17:28:56 +0000</pubDate>
		<dc:creator>Oskar</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.osd.se/2007/05/08/google-reader-and-msie/</guid>
		<description><![CDATA[When do Google Reader check for new posts really? Not often enough in my opinion, but I guess that&#8217;s what you get if you want someone else to do it. Perhaps it&#8217;s time to check out some Firefox plugin or other program to keep track of my RSS flows.
Unrelated to Google Reader, but this made [...]]]></description>
			<content:encoded><![CDATA[<p>When do Google Reader check for new posts really? Not often enough in my opinion, but I guess that&#8217;s what you get if you want someone else to do it. Perhaps it&#8217;s time to check out some Firefox plugin or other program to keep track of my RSS flows.</p>
<p>Unrelated to Google Reader, but <a href="http://cdybedahl.livejournal.com/434324.html">this</a> made me remember how glad I am that I didn&#8217;t bother to expand <a href="http://www.osd.se">my own</a> WordPress theme to cover the blog features of WP. IE is a mess to work with (or rather against).</p>
<p>(Yes, www.osd.se does also run WordPress, but not the same installation. I was consider trying to do that, but I decided not to bother. It gives me some extra work on upgrades, but a lot to bother with now. Upgrading WP is usually <em>really</em> smooth anyway. I upgraded www.osd.se from 1.5.2 to 2.1.3 without basically any trouble at all. A third-party plugin needed an upgrade and another was made redundant (static first page). That was it.)</p>
<p>Firefox crashed on me while writing this text. Thanks WP for automatically saving the post while writing and reducing the amount of stuff I needed to rewrite. Shame on Firefox!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.osd.se/2007/05/08/google-reader-and-msie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
