I just discovered MiniMagick. It is exactly what I was looking for in a ruby-language wrapper for ImageMagick.
I’ve been using ImageMagick forever. Like, more than 20 years foreer. Maybe 30 years; I don’t know when it was first developed, or how old it was when I discovered it.
Some of the time, I use ImageMagick from the command line: just convert a file or montage a couple of them, or whatever. But sometimes, I do the same three things to an image and expect to do it over and over again for multiple images, I’ll write a shell script.
Writing shell scripts is hard. (Like, do you use trap? Of course you don’t.)
Writing Ruby is easy. But the only Ruby wrapper for ImageMagick I knew about was RMagick, which is big and complex and the first couple of times I tried to use it I had build problems (this was back before gems and github).
So there I was. Use bash and keep it simple, or use ruby with some crazy backtick `convert foo.png foo.jpg` shell escape there instead of doing it right.
But MiniMagick is just a well-designed wrapper around those backticks. Kudos!
I just discovered pandoc. Well, I first bookmarked it in 2008, and again in 2016, so I guess I rediscovered it. But what I mean is that I finally discovered what to use it for: converting Word files to Markdown. It’s dead easy:
I’ve been using Antiword for years to convert Word 2006 (DOC) files to text, but it doesn’t do DOCX, and, instead of producing Markdown or something more neutral, it tries to recreate the DOC experience in text by centering lines, etc. Not complaining: it gets me plain text and I can take it from there, but Markdown is a big improvement. DOCX is even better, since, apart from pandoc, the only way I knew to read those at the command line was via Libre/OpenOffice:
(I see — now, when it is too late — that there is also code to do this in ruby: antiword-xp-rb. I hope that’s an awesome tool, but it took me 9 years to figure out what to do with pandoc so don’t wait for me to tell you.)
Years ago, when XML was the new hotness, I kept meaning to learn it. (I mean, I learned it, except the headers and CDATA, but I never figured out how to use XPath or XQuery or XSLT or do anything useful with it. I learned just enough to write a toolchain that emits an RSS feed that iTunes is happy with and stopped there. Tidy is your friend.)
Maybe I dodged a bullet. The other day Manton Reece and Brent Simmons came up with JSON Feed, a replacement (or at least an alternative to) Atom and RSS. Suits me. I prefer YAML to JSON, but I’d take either one over XML even if I could only see them upside down in a mirror.
It’s not there any more, but in their first announcement (quoted here), Reese and Simmons committed a gaffe and said what they thought:
developers will often go out of their way to avoid XML. JSON is simpler to read and write, and it’s less prone to bugs.
Duh. But the rationale they state now is still true, if a little less transparent.
While I’m thinking about it: a pet peeve. RSS says that <pubDate> wants an RFC 822 compliant timestamp for feeds, but good luck if you’re in Alaska, which is part of the US not in the big four time zones. (Use Zulu -0900 instead.)
Reece and Simmons decided the time was right to build an updated syndication format, as more and more developers are refusing to work with XML.
“I believe that developers (particularly Mac and iOS developers, the group I know best) are so loath to work with XML that they won’t even consider building software that needs an XML parser,” Simmons said. “Which says to me that JSON Feed is needed for the survival of syndication.”
Microsoft promises that you can clean install Windows 10 after upgrading. Hanselman confirms, but look at the questions in people’s comments. Someone at Microsoft should be asking, why don’t they trust us, and what do we have to do so they start?
Google’s new build tool: Bazel. What are the odds I’d switch when I’m still learning Rake?
Sequel: the database toolkit for Ruby. (Here’s an introductory screencast at RubyTapas.) I keep thinking I should do something with sqlite. Well, really I think I should do something with a database, but I’d rather put it on Drobox than try to figure out how to have a mysql server out on the internet and not regret it.
Bjarne Stroustrup outlines changes in store for C++ in v17. I can barely remember how awesome I used to think C++ was back in 1986. And compared to C, I guess is was, then. Today—forget about it. Just give me a scripting language.
Finally: During the 1990’s I used to be a DIY system builder, but the past decade or two I’ve been too busy and too impoverished. And there’s a lot to be said for buying something small. Still, I might get around to building something again someday. This sounds like fun:
A couple of weeks (months?) ago, my podcast feed quit including a publication date, and I couldn’t figure it until just the other day. The problem was that my publication tags looked like this:
<pubDate>Sun, 05 Apr 2015 19:18:25 AKDT</pubDate>
but that won’t validate. It never has, but something must have changed in Apple land (either on their servers, or in iTunes) to make the times quit working.
The problem is that AKDT isn’t a RFC-822 compliant time zone. (It assumes that time zones in North America have names that are 3-character strings.) Instead you have to use ‘-0800’. (AKST isn’t compliant either, so you have to use ‘-0900’.)
I’ve got a podcast and it’s a chore to update. I’ve built some tools to help me produce an RSS feed for the podcast, which is a good thing, since RSS = XML = too persnickety to do by hand. But I’ve had to do some of the work by hand, specifically, tagging the .MP3 files with the appropriate ID3 tags. I was using iTunes, which has never been very fun, and seems to get worse with each iteration.
Also, did you know that mp3info lets you get the length of an audio file from the command line? I didn’t, until I read it on the internet, and durned if it’s not true. That’s pretty nifty. And there’s even a Ruby API for it!
I also learned about something called mutagen, which is like eyed3 but for arbitrary types of audio files.
I spent the day learning all this, so my tools still need to be updated to do what I now know can be done programmatically. But I’ve done the hardest part, viz.: