Atom Publishing, Wordpress, and Dreamhost
September 14th, 2009
I’ve been working on automating the system my church uses for publishing sermons. When trying to publish podcast entries via WordPress Atom support, I discovered an issue with Dreamhost and http basic auth described here.
As you can see, his solution requires both some ModRewrite love and some PHP script changes. Well those lovely fellas on the Wordpress team already picked up their end of the deal, so all I ended up having to do is add this segment to the .htaccess file in the root of my WordPress installation.
1 2 3 4 |
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule |
Now I can automagically publish sermons from my command line. I feel a power trip coming on.
writing an HTTP response to a file as it is read (in ruby)
August 20th, 2009
You have yourself a URI.
URI.parse("http://theophil.us") |
You probably know how to grab a file via GET with ruby:
Net::HTTP.get(target) |
But what if the result is HUGE, like say, 300mb of xml? you probably want to flush the response to disk as it is handed to you, like this: (not immediately obvious to me from the docs)
1 2 3 4 5 6 7 8 9 10 11 |
def write_to_file(target, file_name) Net::HTTP.start(target.host, target.port) do |http| File.open( file_name, 'w') do |file| http.request_get(target.request_uri) do |response| response.read_body do |body| file.write(body) end end end end end |
Charging my RAZR, on my Mac, via USB
July 27th, 2009
I know, I should have an iPhone by now. As an iFanBoy it’s really an embarrassment. But this fellow here done me right.