Archive

Archive for November, 2014

Learning By Doing

November 30, 2014 Leave a comment

Several months ago I made two resolutions. One was to learn how to program, the other was to write about it more on this blog. I’ve partly kept one of those. The other, not so much.

Part of the reason is that I don’t feel that I had quite as much to say as I expected I would. I was reading some books and following along in some online communities, and that didn’t really sound interesting.

Now, though, I have a project. A personal itch that needs scratching. It’s small, and it’s pretty banal in the scheme of things, but it is kind of gnawing at my brain.

For my job, I find myself sorting large numbers of PDFs pretty often. The details aren’t important, but suffice it to say that this is something I’m sure a computer can do much more quickly than I can. So I set about figuring out how to get this done.

My first inclination was to come up with a Python script. I’m sure that it is possible in Python, but if I wanted to get into the raw data inside the PDF, I thought I’d need something more powerful. My next thought was to write something in C. This seemed like it would be way more effort than it was worth, since my knowledge of C is… well, lets just say I read a book on it once, and still own that book, so at least I have that.

My next thought was Swift, but again, there’s a serious learning curve there. Finally, I decided on Objective-C. Xcode offers an option for “Command Line Utilities”, so why not actually create one?

This is exciting because it’s my first time diving into an Objective-C project without a net. I honestly have no way of knowing how far above my head this project is until I hit a wall, and at that point there’s no flipping to the back of the book.

I started my project on Wednesday, after preparing for Thanksgiving. After working for a few hours here and there over the weekend, I currently have two classes totaling a couple hundred lines of code. I roughly sketched out the plan. The first goal was to find all of the PDFs in a directory. I got that part down. It took me a while, figuring out when to use NSArrays and when to use NSMutableArrays.

Beyond that rather basic syntax, my biggest confusion so far has been navigating the file system from inside an app. You have NSFileManager available to you, but some methods take NSURLs, and some take paths. How exactly do they work? Can I convert between the two? Are they really giving me what I want? How do I check?

I think I have that more or less sorted out. But now comes the hard part. Digging into a PDF file and seeing what I can pull out. I know the raw bytes I’m looking for are there. My worry now is separating the signal from the noise.

Advertisement
Categories: Computer Blue

A Turkey By Any Other Name

November 27, 2014 Leave a comment

Thanksgiving is in trouble. First, there’s the unpleasantness of its origins. We’ve so tied Thanksgiving to Americas founding myth that, as we become more conscious of the atrocities committed against the Native Americans, it becomes harder to stomach. Secondly, the meal has become, for some, a chore. Many love turkey with all the fixings, but having to produce that for a dozen or more relatives can be stressful. Finally, Thanksgiving has become stale. It is a day of feasting, but the meaning isn’t clear, and except for grand dad’s speech before digging in, we don’t really take the time to be thankful for what we have. When do we have the time? The potatoes are going to burn, the kids can’t decide on a movie to watch, and uncle Harry is hitting on his sister-in-law again.

Thanksgiving needs a makeover. A rebranding. Here’s what I propose.

Thanksgiving Day

After umpteen repetitions, words and images tend to lose their meaning. That is why Pepsi has a new logo every 5 years. Traditions can be the same thing. What was once a comforting ritual can become repetitive, to the point where you are going through the motions. A slight change of emphasis can make all the difference. Imagine that the day isn’t named “Thanksgiving”. Instead it is designated to giving thanks. Just as Veterans Day isn’t named “Veterans”, having a slight twist here will change the way we think of it.

Also, it will relieve the burden on on the feast. We are no longer a country of farmers, and celebrating the harvest seems a little antiquated. Yes, farms are important, even in post-industrial America. In fact, farms large and small might be more important now that they have been in generations. But there are plenty of things to be thankful for. We all have our own list. Why shouldn’t we each have an opportunity to appreciate those things the way we want. Thanksgiving was about turkey. Thanksgiving Day is about whatever allows you to grateful for what you have. If that is turkey, then so be it. If that is a polar bear plunge, more power to you.

Finally, the new Thanksgiving Day will shift focus away from the original “pilgrims and natives” narrative. I’m not saying we should whitewash history, but we’ve got Columbus day to feel terrible about the raping of an entire continent. Thanksgiving Day can be more about the now. Every year’s celebration can be different, because as long as we’re on the right side of the dirt we always have new things to be thankful for.

Don’t get me wrong. I love Thanksgiving the old fashioned way. But we’ve done that. And lets face it, they sell turkeys 365 days a year. We can eat those any time we like. Lets bring this holiday into the 21st century by shifting the focus from the meal to the toast.

Categories: Uncategorized