feed-abstract 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.rdoc +23 -0
- data/Rakefile +2 -0
- data/feed-abstract.gemspec +23 -0
- data/lib/feed-abstract.rb +33 -0
- data/lib/feed-abstract/channel/atom.rb +47 -0
- data/lib/feed-abstract/channel/rdf.rb +63 -0
- data/lib/feed-abstract/channel/rss.rb +91 -0
- data/lib/feed-abstract/feed.rb +74 -0
- data/lib/feed-abstract/item/atom.rb +50 -0
- data/lib/feed-abstract/item/rdf.rb +48 -0
- data/lib/feed-abstract/item/rss.rb +86 -0
- data/lib/feed-abstract/items/atom.rb +22 -0
- data/lib/feed-abstract/items/rdf.rb +20 -0
- data/lib/feed-abstract/items/rss.rb +20 -0
- data/lib/feed-abstract/mixins.rb +66 -0
- data/lib/feed-abstract/version.rb +7 -0
- data/spec/feed_abstract_channel_spec.rb +132 -0
- data/spec/feed_abstract_item_spec.rb +160 -0
- data/spec/feed_abstract_spec.rb +30 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/test_data/djcp.rss +229 -0
- data/spec/test_data/djcp_code.rss +320 -0
- data/spec/test_data/djcp_delicious.rss +1122 -0
- data/spec/test_data/doc.atom +321 -0
- data/spec/test_data/katanapg.atom +137 -0
- data/spec/test_data/oa.africa.rss +330 -0
- metadata +105 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
class Feed::Abstract
|
5
|
+
|
6
|
+
describe Feed do
|
7
|
+
|
8
|
+
it "should be able to instantiate" do
|
9
|
+
Feed.respond_to?(:new).should == true
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should recognize atom feeds properly" do
|
13
|
+
feed = Feed.new(File.open('spec/test_data/doc.atom'))
|
14
|
+
feed.channel.class.should == Channel::Atom
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should recognize rss feeds properly" do
|
18
|
+
feed = Feed.new(File.open('spec/test_data/djcp.rss'))
|
19
|
+
feed.channel.class.should == Channel::RSS
|
20
|
+
feed = Feed.new(File.open('spec/test_data/djcp_delicious.rss'))
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should recognize rdf feeds properly" do
|
24
|
+
feed = Feed.new(File.open('spec/test_data/oa.africa.rss'))
|
25
|
+
feed.channel.class.should == Channel::RDF
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<rss version="2.0"
|
3
|
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
4
|
+
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:atom="http://www.w3.org/2005/Atom"
|
7
|
+
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
8
|
+
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
9
|
+
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
|
10
|
+
>
|
11
|
+
|
12
|
+
<channel>
|
13
|
+
<title>Dan Collis-Puro</title>
|
14
|
+
<atom:link href="http://blogs.law.harvard.edu/djcp/feed/" rel="self" type="application/rss+xml" />
|
15
|
+
<link>http://blogs.law.harvard.edu/djcp</link>
|
16
|
+
<description>Tech. Open Source. Stuff that doesn't suck.</description>
|
17
|
+
<lastBuildDate>Tue, 02 Aug 2011 01:05:26 +0000</lastBuildDate>
|
18
|
+
<language>en</language>
|
19
|
+
<sy:updatePeriod>hourly</sy:updatePeriod>
|
20
|
+
<sy:updateFrequency>1</sy:updateFrequency>
|
21
|
+
<generator>http://wordpress.org/?v=3.2.1</generator>
|
22
|
+
<managingEditor>DJCP</managingEditor>
|
23
|
+
<category><![CDATA[Tech]]></category>
|
24
|
+
<category><![CDATA[Open Source]]></category>
|
25
|
+
<image>
|
26
|
+
<url>/foobar.gif</url>
|
27
|
+
<title>My image</title>
|
28
|
+
<link>http://blogs.law.harvard.edu/djcp</link>
|
29
|
+
</image>
|
30
|
+
<copyright>2011 DJCP</copyright>
|
31
|
+
<dc:subject>oa.africa</dc:subject>
|
32
|
+
<dc:subject>oa.test</dc:subject>
|
33
|
+
|
34
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
35
|
+
<item>
|
36
|
+
<author>djcp</author>
|
37
|
+
<title>S1:E7 – Justice</title>
|
38
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/08/s1e7-justice/</link>
|
39
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/08/s1e7-justice/#comments</comments>
|
40
|
+
<pubDate>Tue, 02 Aug 2011 01:05:26 +0000</pubDate>
|
41
|
+
<dc:creator>djcp</dc:creator>
|
42
|
+
<category><![CDATA[Uncategorized]]></category>
|
43
|
+
<category><![CDATA[tngwatchestng]]></category>
|
44
|
+
|
45
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=227</guid>
|
46
|
+
<description><![CDATA[“Everybody’s blonde – they’re all way too happy. I bet it will all be an animation. I bet that ship is making the whole planet. It’s sucking all the data out – of Data. They wear weird clothes. Eww. So … <a href="http://blogs.law.harvard.edu/djcp/2011/08/s1e7-justice/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
47
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“Everybody’s blonde – they’re all way too happy. I bet it will all be an animation. I bet that ship is making the whole planet. It’s sucking all the data out – of Data. They wear weird clothes. Eww. So the “god” just let them get away? What warp are they going to? Captain Picard didn’t say!”</p>
|
48
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
49
|
+
]]></content:encoded>
|
50
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/08/s1e7-justice/feed/</wfw:commentRss>
|
51
|
+
<slash:comments>0</slash:comments>
|
52
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
53
|
+
</item>
|
54
|
+
<item>
|
55
|
+
<title>S1:E6 – Lonely Among Us</title>
|
56
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/08/s1e6-lonely-among-us/</link>
|
57
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/08/s1e6-lonely-among-us/#comments</comments>
|
58
|
+
<pubDate>Tue, 02 Aug 2011 00:07:37 +0000</pubDate>
|
59
|
+
<dc:creator>djcp</dc:creator>
|
60
|
+
<category><![CDATA[Uncategorized]]></category>
|
61
|
+
<category><![CDATA[tngwatchestng]]></category>
|
62
|
+
|
63
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=224</guid>
|
64
|
+
<description><![CDATA[“It’s an evil power that’s making her want to control the bridge! The ones that had beards ate raw animals – that was gross.” TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star … <a href="http://blogs.law.harvard.edu/djcp/2011/08/s1e6-lonely-among-us/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
65
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“It’s an evil power that’s making her want to control the bridge! The ones that had beards ate raw animals – that was gross.”</p>
|
66
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
67
|
+
<div></div>
|
68
|
+
]]></content:encoded>
|
69
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/08/s1e6-lonely-among-us/feed/</wfw:commentRss>
|
70
|
+
<slash:comments>0</slash:comments>
|
71
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
72
|
+
</item>
|
73
|
+
<item>
|
74
|
+
<title>S1:E5 – Where No One Has Gone Before</title>
|
75
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/s1e5-where-no-one-has-gone-before/</link>
|
76
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/s1e5-where-no-one-has-gone-before/#comments</comments>
|
77
|
+
<pubDate>Sat, 30 Jul 2011 00:36:01 +0000</pubDate>
|
78
|
+
<dc:creator>djcp</dc:creator>
|
79
|
+
<category><![CDATA[Uncategorized]]></category>
|
80
|
+
<category><![CDATA[tngwatchestng]]></category>
|
81
|
+
|
82
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=219</guid>
|
83
|
+
<description><![CDATA[“Riker and Troi are friends! The intro to the show takes too long. I like Wesley, even though he’s a nerd. He’s a know-it-all but I like him. Referring to Kosinki, the warp-drive “consultant”: Self-confident, self-satisifed pig! I like the part … <a href="http://blogs.law.harvard.edu/djcp/2011/07/s1e5-where-no-one-has-gone-before/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
84
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“Riker and Troi are friends! The intro to the show takes too long. I like Wesley, even though he’s a nerd. He’s a know-it-all but I like him. Referring to Kosinki, the warp-drive “consultant”: Self-confident, self-satisifed pig! I like the part where everyone thought they were going crazy because what they were thinking was happening – you learned a little about each person.”</p>
|
85
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
86
|
+
]]></content:encoded>
|
87
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/s1e5-where-no-one-has-gone-before/feed/</wfw:commentRss>
|
88
|
+
<slash:comments>0</slash:comments>
|
89
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
90
|
+
</item>
|
91
|
+
<item>
|
92
|
+
<title>S1:E4 – The Last Outpost</title>
|
93
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/s1e4-the-last-outpost/</link>
|
94
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/s1e4-the-last-outpost/#comments</comments>
|
95
|
+
<pubDate>Fri, 29 Jul 2011 23:39:10 +0000</pubDate>
|
96
|
+
<dc:creator>djcp</dc:creator>
|
97
|
+
<category><![CDATA[Uncategorized]]></category>
|
98
|
+
<category><![CDATA[tngwatchestng]]></category>
|
99
|
+
|
100
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=216</guid>
|
101
|
+
<description><![CDATA[“It’s good because it says you shouldn’t battle each other. Commander Riker is pretty cool in this one. The Ferengi are sort of dumb and mean. Data is really funny when he gets his fingers caught in the Chinese finger … <a href="http://blogs.law.harvard.edu/djcp/2011/07/s1e4-the-last-outpost/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
102
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“It’s good because it says you shouldn’t battle each other. Commander Riker is pretty cool in this one. The Ferengi are sort of dumb and mean. Data is really funny when he gets his fingers caught in the Chinese finger trap.”</p>
|
103
|
+
<div>
|
104
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
105
|
+
</div>
|
106
|
+
]]></content:encoded>
|
107
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/s1e4-the-last-outpost/feed/</wfw:commentRss>
|
108
|
+
<slash:comments>0</slash:comments>
|
109
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
110
|
+
</item>
|
111
|
+
<item>
|
112
|
+
<title>S1:E3 – Code of Honor</title>
|
113
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/s1e3-code-of-honor/</link>
|
114
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/s1e3-code-of-honor/#comments</comments>
|
115
|
+
<pubDate>Fri, 29 Jul 2011 23:36:01 +0000</pubDate>
|
116
|
+
<dc:creator>djcp</dc:creator>
|
117
|
+
<category><![CDATA[Uncategorized]]></category>
|
118
|
+
<category><![CDATA[tngwatchestng]]></category>
|
119
|
+
|
120
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=214</guid>
|
121
|
+
<description><![CDATA[“Good story, I don’t remember too much. Lieutenant Yar shows how awesome she is.” TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.]]></description>
|
122
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“Good story, I don’t remember too much. Lieutenant Yar shows how awesome she is.”</p>
|
123
|
+
<div>
|
124
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
125
|
+
</div>
|
126
|
+
]]></content:encoded>
|
127
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/s1e3-code-of-honor/feed/</wfw:commentRss>
|
128
|
+
<slash:comments>1</slash:comments>
|
129
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
130
|
+
</item>
|
131
|
+
<item>
|
132
|
+
<title>S1:E2 – The Naked Now</title>
|
133
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/s1e2-the-naked-now/</link>
|
134
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/s1e2-the-naked-now/#comments</comments>
|
135
|
+
<pubDate>Fri, 29 Jul 2011 23:33:31 +0000</pubDate>
|
136
|
+
<dc:creator>djcp</dc:creator>
|
137
|
+
<category><![CDATA[Uncategorized]]></category>
|
138
|
+
<category><![CDATA[tngwatchestng]]></category>
|
139
|
+
|
140
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=212</guid>
|
141
|
+
<description><![CDATA[“This one sorta creeped me out. It was really weird. Most of them got cuckoo, the Doctor fell in love with the Captain. They get drunk, and even Wes! He takes over the ship, and Riker doesn’t get drunk, he … <a href="http://blogs.law.harvard.edu/djcp/2011/07/s1e2-the-naked-now/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
142
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“This one sorta creeped me out. It was really weird. Most of them got cuckoo, the Doctor fell in love with the Captain. They get drunk, and even Wes! He takes over the ship, and Riker doesn’t get drunk, he just keeps forgetting stuff. Weird episode, finally it has a good ending.”</p>
|
143
|
+
<div>
|
144
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
145
|
+
</div>
|
146
|
+
]]></content:encoded>
|
147
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/s1e2-the-naked-now/feed/</wfw:commentRss>
|
148
|
+
<slash:comments>0</slash:comments>
|
149
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
150
|
+
</item>
|
151
|
+
<item>
|
152
|
+
<title>S1:E1 – Encounter at Farpoint</title>
|
153
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/s1e1-encounter-at-farpoint/</link>
|
154
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/s1e1-encounter-at-farpoint/#comments</comments>
|
155
|
+
<pubDate>Fri, 29 Jul 2011 23:29:22 +0000</pubDate>
|
156
|
+
<dc:creator>djcp</dc:creator>
|
157
|
+
<category><![CDATA[Uncategorized]]></category>
|
158
|
+
<category><![CDATA[tngwatchestng]]></category>
|
159
|
+
|
160
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=210</guid>
|
161
|
+
<description><![CDATA[“It has a nice ending. It sorta said SOME true stuff about people, but we’re a little more advanced than Q thinks we are. This show is weird – at the end, they figure out that the people in Farpoint … <a href="http://blogs.law.harvard.edu/djcp/2011/07/s1e1-encounter-at-farpoint/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
162
|
+
<content:encoded><![CDATA[<p style="padding-left: 30px;">“It has a nice ending. It sorta said SOME true stuff about people, but we’re a little more advanced than Q thinks we are. This show is weird – at the end, they figure out that the people in Farpoint station are hiding a giant jellyfish thing that can change shapes into anything. How big is the ship, and why are kids on it?”</p>
|
163
|
+
<p><em>TNG watches TNG – an ongoing series where my almost 11 year old daughter discovers Star Trek.</em></p>
|
164
|
+
]]></content:encoded>
|
165
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/s1e1-encounter-at-farpoint/feed/</wfw:commentRss>
|
166
|
+
<slash:comments>0</slash:comments>
|
167
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
168
|
+
</item>
|
169
|
+
<item>
|
170
|
+
<title>TNG watches TNG</title>
|
171
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/07/tng-watches-tng/</link>
|
172
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/07/tng-watches-tng/#comments</comments>
|
173
|
+
<pubDate>Fri, 29 Jul 2011 23:23:05 +0000</pubDate>
|
174
|
+
<dc:creator>djcp</dc:creator>
|
175
|
+
<category><![CDATA[Uncategorized]]></category>
|
176
|
+
<category><![CDATA[tngwatchestng]]></category>
|
177
|
+
|
178
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=208</guid>
|
179
|
+
<description><![CDATA[My daughter knows NOTHING about Star Trek – she’s never seen an episode, doesn’t know what a Klingon or a Vulcan is. She does have the ability to enjoy large, complicated storylines as evidenced by her love of LoTR, Harry … <a href="http://blogs.law.harvard.edu/djcp/2011/07/tng-watches-tng/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
180
|
+
<content:encoded><![CDATA[<p>My daughter knows NOTHING about Star Trek – she’s never seen an episode, doesn’t know what a Klingon or a Vulcan is. She does have the ability to enjoy large, complicated storylines as evidenced by her love of LoTR, Harry Potter, and a whole bookshelf of young adult literature.</p>
|
181
|
+
<p>In this series of blog posts, I’m going to chronicle “Star Trek: The Next Generation” through her eyes.</p>
|
182
|
+
]]></content:encoded>
|
183
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/07/tng-watches-tng/feed/</wfw:commentRss>
|
184
|
+
<slash:comments>0</slash:comments>
|
185
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
186
|
+
</item>
|
187
|
+
<item>
|
188
|
+
<title>Bye bye ubuntu: hello debian!</title>
|
189
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/05/bye-bye-ubuntu-hello-debian/</link>
|
190
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/05/bye-bye-ubuntu-hello-debian/#comments</comments>
|
191
|
+
<pubDate>Tue, 10 May 2011 22:36:00 +0000</pubDate>
|
192
|
+
<dc:creator>djcp</dc:creator>
|
193
|
+
<category><![CDATA[Uncategorized]]></category>
|
194
|
+
<category><![CDATA[debian]]></category>
|
195
|
+
<category><![CDATA[linux]]></category>
|
196
|
+
<category><![CDATA[politics]]></category>
|
197
|
+
<category><![CDATA[ubuntu]]></category>
|
198
|
+
|
199
|
+
<guid isPermaLink="false">https://blogs.law.harvard.edu/djcp/2011/05/bye-bye-ubuntu-hello-debian/</guid>
|
200
|
+
<description><![CDATA[So I have been increasingly annoyed with the direction ubuntu has been taking recently: a vitriolic take here. In addition to some odd fiscal choices while trying to figure out how to pay their bills, they are going whole-hog into … <a href="http://blogs.law.harvard.edu/djcp/2011/05/bye-bye-ubuntu-hello-debian/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
201
|
+
<content:encoded><![CDATA[<p>So I have been increasingly annoyed with the direction <a href="http://www.ubuntu.com">ubuntu</a> has been taking recently: a vitriolic take <a href="http://slated.org/copygate_exposes_ugly_ubuntu">here</a>. </p>
|
202
|
+
<p>In addition to some odd fiscal choices while trying to figure out how to pay their bills, they are going whole-hog into their own window manager that looks completely disinteresting to me: Unity. I mean, the idea of a fully accelerated desktop makes sense but I don’t trust ubuntu to build it. My experience under lucid and then maverick with Ubuntu One was less than stellar: it utterly failed. Their own software in their own environment. Busted. The window manager and ubuntu one issues are just one small part: generally, it seems like I derive very little from ubuntu but annoyance.</p>
|
203
|
+
<p>An example: I upgraded from lucid to maverick and flash performance (which was never stellar anyway) TANKED. A page with a flash embed would take 30 seconds at least to render, with or without a plugin crash. Unfortunately, as a web developer that works with video a lot, performant flash is pretty important. I have no idea why it broke during the lucid – > maverick upgrade: bad QA is the only reason I can come up with.</p>
|
204
|
+
<p>So I’m back on debian stable for my laptops and desktops and I couldn’t be happier. Everything feels much faster (it could be the switch from ecryptfs to dm-crypt but I expect there is more to it, I didn’t feel io bound), everything works and I have rock solid kde terminals. My ideals just jibe better with debian, it feels like I am home again.</p>
|
205
|
+
]]></content:encoded>
|
206
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/05/bye-bye-ubuntu-hello-debian/feed/</wfw:commentRss>
|
207
|
+
<slash:comments>0</slash:comments>
|
208
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
209
|
+
</item>
|
210
|
+
<item>
|
211
|
+
<title>Spam software gone awry</title>
|
212
|
+
<link>http://blogs.law.harvard.edu/djcp/2011/03/spam-software-gone-awry/</link>
|
213
|
+
<comments>http://blogs.law.harvard.edu/djcp/2011/03/spam-software-gone-awry/#comments</comments>
|
214
|
+
<pubDate>Fri, 04 Mar 2011 18:28:54 +0000</pubDate>
|
215
|
+
<dc:creator>djcp</dc:creator>
|
216
|
+
<category><![CDATA[Uncategorized]]></category>
|
217
|
+
<category><![CDATA[spam]]></category>
|
218
|
+
|
219
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=157</guid>
|
220
|
+
<description><![CDATA[I like it when a spammer’s engine of destruction malfunctions and their tricks are laid bare. A recent spam comment had this username: The {sheer|utter|large} available {information|info|data|information and facts} online {makes|can make|tends to make|creates} {finding a|getting a|locating a|choosing a|selecting a} … <a href="http://blogs.law.harvard.edu/djcp/2011/03/spam-software-gone-awry/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
221
|
+
<content:encoded><![CDATA[<p>I like it when a spammer’s engine of destruction malfunctions and their tricks are laid bare. A recent spam comment had this username: </p>
|
222
|
+
<blockquote><p>The {sheer|utter|large} available {information|info|data|information and facts} online {makes|can make|tends to make|creates} {finding a|getting a|locating a|choosing a|selecting a} {good information|reliable information|straight answers} directory {reall</p></blockquote>
|
223
|
+
]]></content:encoded>
|
224
|
+
<wfw:commentRss>http://blogs.law.harvard.edu/djcp/2011/03/spam-software-gone-awry/feed/</wfw:commentRss>
|
225
|
+
<slash:comments>0</slash:comments>
|
226
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
227
|
+
</item>
|
228
|
+
</channel>
|
229
|
+
</rss>
|
@@ -0,0 +1,320 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<rss version="2.0"
|
3
|
+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
4
|
+
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:atom="http://www.w3.org/2005/Atom"
|
7
|
+
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
8
|
+
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
9
|
+
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
|
10
|
+
>
|
11
|
+
|
12
|
+
<channel>
|
13
|
+
<title>Dan Collis-Puro » code</title>
|
14
|
+
<atom:link href="http://blogs.law.harvard.edu/djcp/tag/code/feed/" rel="self" type="application/rss+xml" />
|
15
|
+
<link>https://blogs.law.harvard.edu/djcp</link>
|
16
|
+
<description>Tech. Open Source. Stuff that doesn't suck.</description>
|
17
|
+
<lastBuildDate>Wed, 17 Aug 2011 18:55:17 +0000</lastBuildDate>
|
18
|
+
<language>en</language>
|
19
|
+
<sy:updatePeriod>hourly</sy:updatePeriod>
|
20
|
+
<sy:updateFrequency>1</sy:updateFrequency>
|
21
|
+
<generator>http://wordpress.org/?v=3.2.1</generator>
|
22
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
23
|
+
<item>
|
24
|
+
<title>Diff’ing wordpress releases</title>
|
25
|
+
<link>https://blogs.law.harvard.edu/djcp/2011/02/diffing-wordpress-releases/</link>
|
26
|
+
<comments>https://blogs.law.harvard.edu/djcp/2011/02/diffing-wordpress-releases/#comments</comments>
|
27
|
+
<pubDate>Wed, 09 Feb -0001 20:10:23 +0000</pubDate>
|
28
|
+
<dc:creator>djcp</dc:creator>
|
29
|
+
<category><![CDATA[Uncategorized]]></category>
|
30
|
+
<category><![CDATA[code]]></category>
|
31
|
+
<category><![CDATA[svn]]></category>
|
32
|
+
<category><![CDATA[wordpress]]></category>
|
33
|
+
|
34
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=130</guid>
|
35
|
+
<description><![CDATA[A new wordpress release is out and you’d like to know what’s changed? Sure, you can read the changelog, but is that REALLY enough? Point your interweb box to: http://core.svn.wordpress.org/tags/ and then use svn to show you exactly what’s changed. … <a href="https://blogs.law.harvard.edu/djcp/2011/02/diffing-wordpress-releases/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
36
|
+
<content:encoded><![CDATA[<p>A new wordpress release is out and you’d like to know what’s changed? Sure, you can read the changelog, but is that REALLY enough?</p>
|
37
|
+
<p>Point your interweb box to: <a href="http://core.svn.wordpress.org/tags/">http://core.svn.wordpress.org/tags/</a> and then use svn to show you exactly what’s changed. Pick the URLs to the tags that represent the two releases you’d like to compare, and then:</p>
|
38
|
+
<pre>svn diff http://core.svn.wordpress.org/tags/3.0.4/ \
|
39
|
+
http://core.svn.wordpress.org/tags/3.0.5/ > ~/tmp/wp-3.0.4_to_3.0.5.txt</pre>
|
40
|
+
<p>Then inspect “~/tmp/wp-3.0.4_to_3.0.5.txt” to see what’s changed.</p>
|
41
|
+
]]></content:encoded>
|
42
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2011/02/diffing-wordpress-releases/feed/</wfw:commentRss>
|
43
|
+
<slash:comments>3</slash:comments>
|
44
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
45
|
+
</item>
|
46
|
+
<item>
|
47
|
+
<title>Pre-loaded Image Rollovers with jQuery</title>
|
48
|
+
<link>https://blogs.law.harvard.edu/djcp/2010/08/pre-loaded-image-rollovers-with-jquery/</link>
|
49
|
+
<comments>https://blogs.law.harvard.edu/djcp/2010/08/pre-loaded-image-rollovers-with-jquery/#comments</comments>
|
50
|
+
<pubDate>Tue, 24 Aug 2010 22:45:19 +0000</pubDate>
|
51
|
+
<dc:creator>djcp</dc:creator>
|
52
|
+
<category><![CDATA[Uncategorized]]></category>
|
53
|
+
<category><![CDATA[code]]></category>
|
54
|
+
<category><![CDATA[javascript]]></category>
|
55
|
+
<category><![CDATA[jquery]]></category>
|
56
|
+
|
57
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=113</guid>
|
58
|
+
<description><![CDATA[I despise implementing image rollovers, but this makes it almost tolerable. Any <img> tag with a “hover” attribute referring to an image URL will have a rollover behavior attached to it. For bonus points, the rollover image will be pre-loaded, … <a href="https://blogs.law.harvard.edu/djcp/2010/08/pre-loaded-image-rollovers-with-jquery/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
59
|
+
<content:encoded><![CDATA[<p>I despise implementing image rollovers, but this makes it almost tolerable. Any <img> tag with a “hover” attribute referring to an image URL will have a rollover behavior attached to it. For bonus points, the rollover image will be pre-loaded, so there’s no momentary delay the first time an on-state image is loaded.</p>
|
60
|
+
<p>In your HTML source:</p>
|
61
|
+
<pre class="brush: html">
|
62
|
+
<img src="/images/button.gif" hover="/images/button_on.gif" />
|
63
|
+
<img src="/images/another_button.gif" hover="/images/another_button_on.gif" />
|
64
|
+
</pre>
|
65
|
+
<pre class="brush: javascript">
|
66
|
+
jQuery(document).ready(function(){
|
67
|
+
jQuery('img[hover]').each(function(){
|
68
|
+
// Preload rollover
|
69
|
+
var imageEl = jQuery("<img alt="" />");
|
70
|
+
imageEl.attr('src',jQuery(this).attr('hover'));
|
71
|
+
|
72
|
+
jQuery(this).hover(
|
73
|
+
function(){
|
74
|
+
// swap the image.
|
75
|
+
var hoverSrc = jQuery(this).attr('hover');
|
76
|
+
var regSrc = jQuery(this).attr('src');
|
77
|
+
jQuery(this).attr('src',hoverSrc);
|
78
|
+
jQuery(this).attr('hover',regSrc);
|
79
|
+
}
|
80
|
+
);
|
81
|
+
});
|
82
|
+
});
|
83
|
+
</pre>
|
84
|
+
<p>Thanks jQuery for being so awesome.</p>
|
85
|
+
]]></content:encoded>
|
86
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2010/08/pre-loaded-image-rollovers-with-jquery/feed/</wfw:commentRss>
|
87
|
+
<slash:comments>0</slash:comments>
|
88
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
89
|
+
</item>
|
90
|
+
<item>
|
91
|
+
<title>A simple bash gpg “password safe”</title>
|
92
|
+
<link>https://blogs.law.harvard.edu/djcp/2010/03/a-simple-bash-password-safe/</link>
|
93
|
+
<comments>https://blogs.law.harvard.edu/djcp/2010/03/a-simple-bash-password-safe/#comments</comments>
|
94
|
+
<pubDate>Sat, 27 Mar 2010 23:07:04 +0000</pubDate>
|
95
|
+
<dc:creator>djcp</dc:creator>
|
96
|
+
<category><![CDATA[Uncategorized]]></category>
|
97
|
+
<category><![CDATA[bash]]></category>
|
98
|
+
<category><![CDATA[code]]></category>
|
99
|
+
<category><![CDATA[gpg]]></category>
|
100
|
+
<category><![CDATA[infosec]]></category>
|
101
|
+
|
102
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=86</guid>
|
103
|
+
<description><![CDATA[This is definitely not military quality – but if you need a simple way to manage a GPG-encrypted file containing info you want to protect this works pretty well for me. I use this to manage a set of passwords … <a href="https://blogs.law.harvard.edu/djcp/2010/03/a-simple-bash-password-safe/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
104
|
+
<content:encoded><![CDATA[<p>This is definitely not military quality – but if you need a simple way to manage a GPG-encrypted file containing info you want to protect this works pretty well for me. I use this to manage a set of passwords on a trusted machine that I can ssh to.</p>
|
105
|
+
<p>It assumes you’re using a bash-like shell and have a trusted private key available in the account you’re running it on.</p>
|
106
|
+
<pre class="brush: bash">
|
107
|
+
|
108
|
+
#!/bin/bash
|
109
|
+
|
110
|
+
KEYS=""
|
111
|
+
|
112
|
+
if [ ! -e "$HOME/private" ]
|
113
|
+
then
|
114
|
+
mkdir -m 700 "$HOME/private"
|
115
|
+
umask 77 "$HOME/private/"
|
116
|
+
fi
|
117
|
+
|
118
|
+
# Always delete the unencrypted file at the end of the session. We DO NOT want this hanging around.
|
119
|
+
trap "rm -f \"$HOME/private/${USER}_private_store.txt\"; chmod 600 \"$HOME/private/${USER}_private_store.txt\"*; exit" INT TERM EXIT
|
120
|
+
|
121
|
+
touch "$HOME/private/${USER}_private_store.txt"
|
122
|
+
chmod 600 "$HOME/private/${USER}_private_store.txt"
|
123
|
+
|
124
|
+
gpg --decrypt "$HOME/private/${USER}_private_store.txt.asc" > "$HOME/private/${USER}_private_store.txt"
|
125
|
+
vim "$HOME/private/${USER}_private_store.txt"
|
126
|
+
|
127
|
+
md5sum "$HOME/private/${USER}_private_store.txt.md5sum.new"
|
128
|
+
|
129
|
+
if [ -e "$HOME/private/${USER}_private_store.txt.md5sum" ]
|
130
|
+
then
|
131
|
+
if [ "`cmp "$HOME/private/${USER}_private_store.txt.md5sum.new" "$HOME/private/${USER}_private_store.txt.md5sum"`" == "" ]
|
132
|
+
then
|
133
|
+
clear
|
134
|
+
rm -f "$HOME/private/${USER}_private_store.txt.md5sum.new"
|
135
|
+
echo 'No changes, not re-encrypting'
|
136
|
+
exit
|
137
|
+
fi
|
138
|
+
fi
|
139
|
+
|
140
|
+
mv "$HOME/private/${USER}_private_store.txt.md5sum.new" "$HOME/private/${USER}_private_store.txt.md5sum"
|
141
|
+
|
142
|
+
echo 'File has changed. Re-encrypting. . .'
|
143
|
+
gpg -a --encrypt -r $KEYS "$HOME/private/${USER}_private_store.txt"
|
144
|
+
clear
|
145
|
+
</pre>
|
146
|
+
<p>First time it runs it’ll create a private directory, start vim, and encrypt the text you enter into vim. On subsequent runs it’ll prompt you for your private key passphrase and repeat the cycle. It won’t re-encrypt if there haven’t been any changes.</p>
|
147
|
+
<p>I’m betting wordpress messes up the code, so here’s the text file: <a href="http://blogs.law.harvard.edu/djcp/files/2010/03/edit_password_safe.sh">edit_password_safe.sh</a>.</p>
|
148
|
+
]]></content:encoded>
|
149
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2010/03/a-simple-bash-password-safe/feed/</wfw:commentRss>
|
150
|
+
<slash:comments>1</slash:comments>
|
151
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
152
|
+
</item>
|
153
|
+
<item>
|
154
|
+
<title>Play flac, ogg, anything from anywhere on your Pre with Ampache Mobile</title>
|
155
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/11/play-flac-ogg-anything-on-your-pre-from-anywhere-with-ampache/</link>
|
156
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/11/play-flac-ogg-anything-on-your-pre-from-anywhere-with-ampache/#comments</comments>
|
157
|
+
<pubDate>Wed, 18 Nov 2009 00:58:09 +0000</pubDate>
|
158
|
+
<dc:creator>djcp</dc:creator>
|
159
|
+
<category><![CDATA[Uncategorized]]></category>
|
160
|
+
<category><![CDATA[code]]></category>
|
161
|
+
<category><![CDATA[foss]]></category>
|
162
|
+
<category><![CDATA[palm pre]]></category>
|
163
|
+
|
164
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=57</guid>
|
165
|
+
<description><![CDATA[I was looking for a way to play my music collection (which is primarily ogg and flac) from anywhere, preferably with some sort of automatic transcoding feature. In the past I’ve just mounted my music collection via sshfs (more about … <a href="https://blogs.law.harvard.edu/djcp/2009/11/play-flac-ogg-anything-on-your-pre-from-anywhere-with-ampache/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
166
|
+
<content:encoded><![CDATA[<p>I was looking for a way to play my music collection (which is primarily ogg and flac) from anywhere, preferably with some sort of automatic transcoding feature. In the past I’ve just mounted my music collection via sshfs (more about that <a href="http://blogs.law.harvard.edu/djcp/2009/09/cool-stuff-you-can-do-with-ssh-and-fuse/">here</a>) and then played music with some heavyweight app like Amarok. This is fine, but flac files are too large to be streamed realistically.</p>
|
167
|
+
<p>So – along came <a href="http://ampache.org/">Ampache</a> – an open-source PHP app that is just CHOCK full of features. Just crazy. It’s got a responsive AJAX interface, creates many different types of playlists, can transcode on the fly to other formats / bitrates and was fairly easy to install. It’s just awesome, and pretty much any music player can read an Ampache stream.</p>
|
168
|
+
<p>THEN I discovered <a href="http://forums.precentral.net/homebrew-apps/200423-ampache-mobile.html">Ampache Mobile</a> (<a href="http://code.google.com/p/ampache-mobile/">google code page</a>) - a FOSS Palm Pre app that hooks into your Ampache instance via XML-RPC. Amazing! I get flac/ogg files transcoded to 96kbps MP3 streams on-the-fly, allowing me to listen to all my music anywhere I have a Sprint network connection. The app is beautiful, functional, and has made my Pre even more indispensible than it was before.</p>
|
169
|
+
<p>If you’ve got a Pre and a home server with even moderate upload speed, GET THIS WORKING. Now.</p>
|
170
|
+
<p><strong>Edit: </strong> Corrected Ampache Mobile link. Thanks, bjgeiser!</p>
|
171
|
+
]]></content:encoded>
|
172
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/11/play-flac-ogg-anything-on-your-pre-from-anywhere-with-ampache/feed/</wfw:commentRss>
|
173
|
+
<slash:comments>5</slash:comments>
|
174
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
175
|
+
</item>
|
176
|
+
<item>
|
177
|
+
<title>“Why I use the GPL” by Zed Shaw</title>
|
178
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/07/why-i-use-the-gpl-by-zed-shaw/</link>
|
179
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/07/why-i-use-the-gpl-by-zed-shaw/#comments</comments>
|
180
|
+
<pubDate>Tue, 14 Jul 2009 17:36:19 +0000</pubDate>
|
181
|
+
<dc:creator>djcp</dc:creator>
|
182
|
+
<category><![CDATA[Uncategorized]]></category>
|
183
|
+
<category><![CDATA[code]]></category>
|
184
|
+
<category><![CDATA[freedom]]></category>
|
185
|
+
|
186
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=37</guid>
|
187
|
+
<description><![CDATA[An interesting read that I think is spot-on. I don’t see any statement that clearly says “this rant is mainly because I chose the wrong license for Mongrel”, but beyond that his points about the GPL fostering contributions is 100% … <a href="https://blogs.law.harvard.edu/djcp/2009/07/why-i-use-the-gpl-by-zed-shaw/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
188
|
+
<content:encoded><![CDATA[<p><a href="http://zedshaw.com/blog/2009-07-13.html">An interesting read</a> that I think is spot-on.</p>
|
189
|
+
<p>I don’t see any statement that clearly says “this rant is mainly because I chose the wrong license for Mongrel”, but beyond that his points about the GPL fostering contributions is 100% correct.</p>
|
190
|
+
<p>I dunno. I tend to choose the “default license” of the language / framework I’m building in: maybe I’ll need to rethink that.</p>
|
191
|
+
]]></content:encoded>
|
192
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/07/why-i-use-the-gpl-by-zed-shaw/feed/</wfw:commentRss>
|
193
|
+
<slash:comments>0</slash:comments>
|
194
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
195
|
+
</item>
|
196
|
+
<item>
|
197
|
+
<title>mod_passenger error page includes external stylesheet.</title>
|
198
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/03/mod_passenger-error-page-includes-external-stylesheet/</link>
|
199
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/03/mod_passenger-error-page-includes-external-stylesheet/#comments</comments>
|
200
|
+
<pubDate>Wed, 18 Mar 2009 18:26:26 +0000</pubDate>
|
201
|
+
<dc:creator>djcp</dc:creator>
|
202
|
+
<category><![CDATA[Uncategorized]]></category>
|
203
|
+
<category><![CDATA[code]]></category>
|
204
|
+
<category><![CDATA[infosec]]></category>
|
205
|
+
<category><![CDATA[rails]]></category>
|
206
|
+
|
207
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=13</guid>
|
208
|
+
<description><![CDATA[No sir, I don’t like it. Not at all. The default mod_passenger “this app wouldn’t start” page includes an external CSS file:  http://www.modrails.com/error_pages/1.0/… which is odd, considering there’s a bunch of inline CSS. I guess it’s to include the images. … <a href="https://blogs.law.harvard.edu/djcp/2009/03/mod_passenger-error-page-includes-external-stylesheet/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
209
|
+
<content:encoded><![CDATA[<p>No sir, I don’t like it. Not at all.</p>
|
210
|
+
<p>The default mod_passenger “this app wouldn’t start” page includes an external CSS file:<br />
|
211
|
+
<a href="http://www.modrails.com/error_pages/1.0/error_page.css" title="http://www.modrails.com/error_pages/1.0/error_page.css" target="_blank">http://www.modrails.com/error_pages/1.0/…</a></p>
|
212
|
+
<p>which is odd, considering there’s a bunch of inline CSS. I guess it’s to include the images. . . but it also amounts to disclosing something unintentionally. Yuck.</p>
|
213
|
+
]]></content:encoded>
|
214
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/03/mod_passenger-error-page-includes-external-stylesheet/feed/</wfw:commentRss>
|
215
|
+
<slash:comments>0</slash:comments>
|
216
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
217
|
+
</item>
|
218
|
+
<item>
|
219
|
+
<title>Difference between “count” and “length” in Rails.</title>
|
220
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/03/difference-between-count-and-length-in-rails/</link>
|
221
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/03/difference-between-count-and-length-in-rails/#comments</comments>
|
222
|
+
<pubDate>Tue, 10 Mar 2009 01:34:31 +0000</pubDate>
|
223
|
+
<dc:creator>djcp</dc:creator>
|
224
|
+
<category><![CDATA[Uncategorized]]></category>
|
225
|
+
<category><![CDATA[code]]></category>
|
226
|
+
<category><![CDATA[rails]]></category>
|
227
|
+
|
228
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=9</guid>
|
229
|
+
<description><![CDATA[I made an interesting discovery the other day between how “count” and “length” function with an ActiveRecord model, one that can be exploited effectively to speed up an app, as long as you understand the consequences. Invoking “count” on an … <a href="https://blogs.law.harvard.edu/djcp/2009/03/difference-between-count-and-length-in-rails/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
230
|
+
<content:encoded><![CDATA[<p>I made an interesting discovery the other day between how “count” and “length” function with an ActiveRecord model, one that can be exploited effectively to speed up an app, as long as you understand the consequences.</p>
|
231
|
+
<ul>
|
232
|
+
<li>Invoking “count” on an array (or dependent relationship) will <strong>always</strong> hit the database, and do something similar to <strong>select count(id) as count_all from contacts</strong> every time you invoke it.</li>
|
233
|
+
<li>Invoking “length” on an array (or dependent relationship) will only hit the database once. If the relationship has already been populated (say by :include-ing the dependent objects in your Model.find method), the database won’t get hit at all.</li>
|
234
|
+
</ul>
|
235
|
+
<p>So – if you’re OK not getting a count that’s 100% accurate at the time of method invocation, “length” will do the right thing and run the necessary SQL statement the first time it’s run. Otherwise, it’ll give you the array count, which may be out of sync with the database.</p>
|
236
|
+
<p>This can have significant performance benefits if you’re iterating through many records and emitting counts of dependent objects. :include-ing the dependent objects and using “length” decreased the SQL expense of a page view 40 fold in one case.</p>
|
237
|
+
<p>Once again, it’s good to know your tools.</p>
|
238
|
+
]]></content:encoded>
|
239
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/03/difference-between-count-and-length-in-rails/feed/</wfw:commentRss>
|
240
|
+
<slash:comments>1</slash:comments>
|
241
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
242
|
+
</item>
|
243
|
+
<item>
|
244
|
+
<title>Rails.vim</title>
|
245
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/02/railsvim/</link>
|
246
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/02/railsvim/#comments</comments>
|
247
|
+
<pubDate>Tue, 10 Feb 2009 17:16:09 +0000</pubDate>
|
248
|
+
<dc:creator>djcp</dc:creator>
|
249
|
+
<category><![CDATA[Uncategorized]]></category>
|
250
|
+
<category><![CDATA[code]]></category>
|
251
|
+
<category><![CDATA[rails]]></category>
|
252
|
+
|
253
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=8</guid>
|
254
|
+
<description><![CDATA[Frequently a tool crops up that makes me feel foolish for not using it – that tool today is Rails.vim. It rocks in so many ways I am seriously considering having Tim Pope’s babies – were such a thing possible. … <a href="https://blogs.law.harvard.edu/djcp/2009/02/railsvim/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
255
|
+
<content:encoded><![CDATA[<p>Frequently a tool crops up that makes me feel foolish for not using it – that tool today is <a href="http://rails.vim.tpope.net/" target="_blank">Rails.vim</a>. It rocks in so many ways I am seriously considering having Tim Pope’s babies – were such a thing possible.</p>
|
256
|
+
<ul>
|
257
|
+
<li>Automatic method completion!</li>
|
258
|
+
<li>Automatic switching to fixtures, unit tests, and other context-sensitive actions!</li>
|
259
|
+
<li>Excellent syntax highlighting!</li>
|
260
|
+
<li>Hooks into your script/ directory!</li>
|
261
|
+
</ul>
|
262
|
+
<p>And really too much stuff to articulate here. Just use it! Yay for IDEs that don’t slow you down – I’m looking at you, <a href="http://www.aptana.com/rails" target="_blank">RadRails</a>.</p>
|
263
|
+
<p>Getting it working under modern <a href="http://www.ubuntu.com" target="_blank">Ubuntus</a> (ubunti?) is stupid easy (as a normal user):</p>
|
264
|
+
<pre> sudo aptitude install vim-rails
|
265
|
+
vim-rails-setup
|
266
|
+
</pre>
|
267
|
+
]]></content:encoded>
|
268
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/02/railsvim/feed/</wfw:commentRss>
|
269
|
+
<slash:comments>0</slash:comments>
|
270
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
271
|
+
</item>
|
272
|
+
<item>
|
273
|
+
<title>Rails 2.2, postgres, and testing</title>
|
274
|
+
<link>https://blogs.law.harvard.edu/djcp/2009/01/rails-22-postgres-and-testing/</link>
|
275
|
+
<comments>https://blogs.law.harvard.edu/djcp/2009/01/rails-22-postgres-and-testing/#comments</comments>
|
276
|
+
<pubDate>Wed, 14 Jan 2009 20:14:48 +0000</pubDate>
|
277
|
+
<dc:creator>djcp</dc:creator>
|
278
|
+
<category><![CDATA[Uncategorized]]></category>
|
279
|
+
<category><![CDATA[code]]></category>
|
280
|
+
<category><![CDATA[rails]]></category>
|
281
|
+
|
282
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=6</guid>
|
283
|
+
<description><![CDATA[If you’re using Postgresql with Rails 2.2, your testing database user needs to be a “superuser” for your tests to run. This is not a good thing. It’s the equivalent of running as root. But, if you’ve got a completely … <a href="https://blogs.law.harvard.edu/djcp/2009/01/rails-22-postgres-and-testing/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
284
|
+
<content:encoded><![CDATA[<p>If you’re using <a href="http://www.postgresql.org">Postgresql</a> with Rails 2.2, your testing database user needs to be a “superuser” for your tests to run. <strong>This is not a good thing.</strong> It’s the equivalent of running as root. But, if you’ve got a completely separate development/testing server it’s better than not being able to test at all.</p>
|
285
|
+
<p>If your postgres testing user isn’t a superuser, you’ll get errors like:</p>
|
286
|
+
<pre>ActiveRecord::StatementInvalid: PGError: ERROR: permission \
|
287
|
+
denied: "RI_ConstraintTrigger_17866" is a system trigger</pre>
|
288
|
+
<p>You can create a postgres superuser thusly:</p>
|
289
|
+
<pre>> su - postgres
|
290
|
+
> psql template1
|
291
|
+
> template1=# create user <strong>your username</strong> superuser;</pre>
|
292
|
+
<p>Update the testing stanza of your config/database.yml and you should be good to go.</p>
|
293
|
+
]]></content:encoded>
|
294
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2009/01/rails-22-postgres-and-testing/feed/</wfw:commentRss>
|
295
|
+
<slash:comments>3</slash:comments>
|
296
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
297
|
+
</item>
|
298
|
+
<item>
|
299
|
+
<title>GitTorrent – git repos with distributed file storage.</title>
|
300
|
+
<link>https://blogs.law.harvard.edu/djcp/2008/12/gittorrent-git-repos-with-distributed-file-storage/</link>
|
301
|
+
<comments>https://blogs.law.harvard.edu/djcp/2008/12/gittorrent-git-repos-with-distributed-file-storage/#comments</comments>
|
302
|
+
<pubDate>Thu, 04 Dec 2008 19:35:13 +0000</pubDate>
|
303
|
+
<dc:creator>djcp</dc:creator>
|
304
|
+
<category><![CDATA[Uncategorized]]></category>
|
305
|
+
<category><![CDATA[code]]></category>
|
306
|
+
<category><![CDATA[freedom]]></category>
|
307
|
+
<category><![CDATA[git]]></category>
|
308
|
+
|
309
|
+
<guid isPermaLink="false">http://blogs.law.harvard.edu/djcp/?p=3</guid>
|
310
|
+
<description><![CDATA[My mind has been sufficiently blown. Free software source code hosting with political resiliency baked right in – I guess you’re already immune to political strife when your code is “free as in speech.” This strikes me as fitting the … <a href="https://blogs.law.harvard.edu/djcp/2008/12/gittorrent-git-repos-with-distributed-file-storage/">Continue reading <span class="meta-nav">→</span></a>]]></description>
|
311
|
+
<content:encoded><![CDATA[<p><a href="http://advogato.org/article/994.html">My mind has been sufficiently blown.</a></p>
|
312
|
+
<p>Free software source code hosting with political resiliency baked right in – I guess you’re already immune to political strife when your code is “free as in speech.” This strikes me as fitting the “trust but verify” adage quite nicely.</p>
|
313
|
+
<p>The powers that be aren’t going to mess with my perfectly legal free software, but <caveats status=”applied”>restricting my ability to code what I want isn’t going to faze me when it’s replicated across a bajillion nodes. </caveats></p>
|
314
|
+
]]></content:encoded>
|
315
|
+
<wfw:commentRss>https://blogs.law.harvard.edu/djcp/2008/12/gittorrent-git-repos-with-distributed-file-storage/feed/</wfw:commentRss>
|
316
|
+
<slash:comments>0</slash:comments>
|
317
|
+
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/us/</creativeCommons:license>
|
318
|
+
</item>
|
319
|
+
</channel>
|
320
|
+
</rss>
|