If you look at a feed, it contains things like authors, ids, links, dates, and text. Rails already knows about ids, links, and dates, so it can provide reasonable defaults for these that you can override if you need to, but otherwise generally don’t have to worry about. That leaves only authors and text for a minimal but complete feed. Author information generally either comes naturally from the data, or is something that you set once at the feed level. That leaves text.
Unless you are writing blog software, an ActiveRecord doesn’t have typically have “content”. This means that you have to synthesize a summary from the data. Of course, one can do this via string concatenation and interpolation, but this gets messy quick if you are talking about loops. Builder provides a much cleaner way.
atom_feed do |feed|
feed.title "Who bought #{@product.title}"
feed.updated @orders.first.created_at
for order in @orders
feed.entry(order) do |entry|
entry.title "Order #{order.id}"
entry.summary :type => 'xhtml' do |xhtml|
xhtml.p "Shipped to #{order.address}"
xhtml.table do
xhtml.tr do
xhtml.th 'Product'
xhtml.th 'Quantity'
xhtml.th 'Total Price'
end
for item in order.line_items
xhtml.tr do
xhtml.td item.product.title
xhtml.td item.quantity
xhtml.td number_to_currency item.total_price
end
end
xhtml.tr do
xhtml.th 'total', :colspan => 2
xhtml.th number_to_currency order.line_items.map(&:total_price).sum
end
end
xhtml.p "Paid by #{order.pay_type}"
end
entry.author do |author|
entry.name order.name
entry.email order.email
end
end
end
end
Dare Obasanjo: According to Zillow, our home is one of those that is currently “underwater” because it’s estimated value has dropped $25,000 since we bought it according to their algorithms.
The shape of the value curve is widely different here in Raleigh.
I’ve taken a first look at jQuery, and while I’m generally averse to frameworks, this truly is a library, one that you can use as little or as much as you like, and doesn’t try to do too much.
The net effect of jQuery is that you can “write less and do more”, as promised. But something that more fundamentally changes the way one writes scripts seems to have gone under-reported, at least to my quick scan of the web.
Roy Fielding: All of those points are rather small compared to my overall complaint that it isn’t appropriate to define a “REST” binding to a specific data model’s limitations. The whole point of REST is to avoid coupling between the client applications and whatever implementation might be behind the abstract interface provided by the server.
What matters most to me is not how they derive or express this specification, but on whether the operational behavior is such that a pure HTTP client can fully participate up to the limits of the HTTP specification, and AtomPub clients can participate to the limits of the AtomPub specification. Based on my discussion with Al last night, I’m cautiously optimistic that this will be the case.
Inside the feedparser is the following comment, originally by Mark Pilgrim:
# This will horribly munge inline content with non-empty qnames,
# but nobody actually does that, so I'm not fixing it.
The bad news is that continued further progress is difficult. The internal model for the feed parser for content is a serialized string. Such a string is repeatedly pulled apart using a SGML parser and put back together. It was the best technology at the time. Workable, but not ideal for HTML. Problematic for XHTML.
My proposal has been accepted for RubyConf 2008. Because of the presence of Ruby implementers, this is going to be a bit challenging as it will likely turn into two talks at once. One sharing experiences with fellow developers concerning things they may need to watch out for, and another with language designers about the impact of their changes. It also is likely to be true, as it was at OSCON, that there will be members of the audience who know way more about this subject than I do.
I had originally requested a slot on Saturday. My current slot requires me to shave a day off of ApacheCon. I’ve again asked that the slot be changed, but even if it doesn’t move, I can manage this. At least we are only talking about a short hop from New Orleans to Orlando.
Alf Eaton: Aside: if you’re reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn’t have to worry about it).
I don’t know what publishing software you use, but I see you provide an Atom feed, and Planet 2.0 and Venus both implement atom:updated as specified in RFC 4287.
Now that I have my weblog looking reasonably consistent between Gecko and WebKit based browsers, I’ve taken another look at Opera. Opera doesn’t have support for border-radius, but does have support for background images in SVG, which can be used to provide the same effect. My Nav Bar on my test site now employs this technique, and it requires two separate images: 039 on CCD and CCD on FFF.
Frankly, my first reaction to this was mixed. The pluses for SVG in CSS is that it doesn’t require either adjusting your markup or JavaScript to achieve these effects, a desirable characteristic that generally the other techniques don’t share.
Grand Opening is occurring this weekend. Took a tour yesterday, looks modern, clean, and should attract more businesses into downtown.
The facilities looks to be about a quarter the size of the combined Moscone Center (i.e., North, South, and West combined). I’d wager that the weak link in attracting major (international or even national) conferences is the airport, as Raleigh is neither a major destination nor a national hub.
One unique feature is the shimmer wall which is fun to look both at night and day.
Google Chrome gave view-source some much appreciated attention. I often want to take a look at the CSS or JavaScript or some related link, and control-U takes me to the source of the page in a separate tab, with all of the lengthy lines line wrapped and line numbered. Best of all, all of the links are active. I simply find what I’m looking for, and click on it, and I see that page in another tab.
This caused me to track down and fix a few WebKit compatibility issues, both with my weblog, and with my planet.
Is this feed valid? At the moment, the feedvalidator only issues a warning on the use of a text/plain mime type. At the time the feedvalidator was originally written, this was only a venial sin, primarily because browsers had no material feed support at the time, and because both desktop and web server based aggregators largely ignored the content type.
Eric Lawrence: Sending the new X-Content-Type-Options response header with the value nosniff will prevent Internet Explorer from MIME-sniffing a response away from the declared content-type.
I can’t can now reproduce this, either with the feeds I care about or and with the testcase provided.
I should have known better, but when I started to take a deep dive into Localizing Rails for the purpose of adding coverage to this in AWDwR3, I thought I could handle translating the dozen and a half phrases that appeared on the website.
That turned out to be much harder than I would have thought.
Excellent! I took a look with the thought of updating the feedvalidator to support this, but it turns out that there was nothing to be done. As Col. John “Hannibal” Smith would say, “I love it when a plan comes together”.
Internet Explorer 8 Beta: The Features: Internet Explorer 8 simplifies the use of standards-compliant XML-based webpages that support namespace features like scalable vector graphics, XML user interface language, mathematical markup language, and others.
A summary of changes to ECMAScript decimal support, based on input from the committee in the last week or so:
Operations (e.g., addition, subtraction, multiplication, ...) between 64-bit binary floating point and 128-bit decimal floating point quantities will proceed by first converting the 64-bit binary floating point number to 128-bit decimal floating point to the maximum required precision and then proceeding with the operation. Previously the proposal was to convert the other way, resulting in a 64-bit binary result.
“strict” equality operations (===, !==) will no longer return false when comparing two decimal values with different precisions (e.g., 1.10m and 1.1m)
Karl Dubost: We are happy to announce that W3C has integrated a version of HTML 5 conformance checker into a beta instance of the W3C Markup validator. That will help us to detect bugs, improve the user interface, and benefit from the large W3C communities.