Category Archives: Ruby

Removing Exif Data To Resolve IOS Issues

Related to my last post, I had a bug to fix. The images looked rotate 90 degrees locally, so I used Imagemagick’s convert command to rotate them 90 degrees. They looked right locally, and on the sight when viewed in chrome.

However, iOS was showing the images over-rotated by 90 degrees. It turns out after some digging that the pictures were taking on an iOS device and had saved Orientation data in the EXIF data of the image (metadata). The iOS browser was still honoring that metadata.

Because metadata also has date, time, and location info, a lot of people prefer not to publish EXIF data anyway. Photoshop offers options to remove this data when exporting. I believe GIMP may as well.

But I just wanted to make it part of my process. So I updated the Rakefile from the last post with the following command option from Imagemagick’s convert:

convert input.jpg -strip output.jpg

All is well now. Use your favorite EXIF viewer to confirm success.

Resizing Images in Bulk

I help maintain a site for a craft business. One of the challenges is multiple sizes of images for new stock each year. I used to go through and resize each image manually with a program like Gimp.

I finally got smart and installed ImageMagick.

With a Rakefile, I can pass each image into the convert command with the proper sizing, and get the output into a new folder, ready for upload. The code is shown here:

One catch to keep in mind if you work on a Mac. There can be orientation metadata from some images that OS X will honor, but a browser will not. If your images show up on the web in the wrong orientation, look into ImageMagick convert command’s -rotate option.

A Comforting Warning About Agile

“Beware of becoming an Agile zealout, because this can backfire and put people off. Don’t treat people who are not applying Agile as fools who just need to see the light! This is disrespectful, and people simply won’t listen to your rants.” -Rachel Davies in Agile Coaching1.

Why is this comforting? Good communities self-monitor. Many of today’s communities with momentum have some ego issues. Communities like Agile, Ruby and Mac folks. All three of those communities are great and everyone should be learning more about them, so this isn’t meant to start a flamewar. But what comes off as passion in an upstart community can be obnoxious in an established community. And it certainly doesn’t fly well with the 2nd and 3rd tier adopters that are often the target of such zealotry.

This isn’t an excuse for half-assed Agile. Go for “full-assed” commitment to whatever system a team uses, and in more cases than not, they should be doing a flavor of Agile (usually lean) throughout the software lifecycle.

But blind assertions and a condescending tone won’t win anyone over. No matter what is being sold. This can be a particularly hard trap to avoid when a person or their business are sold as Agile experts. Or… “I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail.” –Maslow

When leaders and authors in the community stand up for moderation, it is a sign of maturity.

  1. Note that Agile Coaching is written by Rachel Davies and Liz Sedley, but Rachel Davies only is cited above as the quote is in a “Rachel says” section.

Rake Tasks For NuGet

If you use NuGet, and only check-in your packages.config files to source control, then your source control repository will stay smaller, and checkout faster. Checking in binaries is usually a nice thing to avoid. However, you need new developers to be able to get those libraries locally easily, and to allow your build server (continuous integration or otherwise) to keep libraries up to date.

After all, that’s one of the advantages of NuGet, you only download a new library when you first need it for that solution, or when you change versions.

In order to solve this problem, I use a rake task, as we use rake for other setup tasks (creating or seeding databases, continuous integration, etc). Rake may sound like an odd choice for a .Net environment, but it’s very good for customing cmd line tasks, and all the .Net building and setup we have run into can be done from the command line. Anyway, assuming the directory structure below, I thought I’d share the Rake tasks…

  |-other files, etc
  |-other files, etc

Relevant tasks in the Rakefile below. Note the ci task using nuget task before it builds.

def nuget_for_project(project_dir)  
  sh "tools\\NuGet.exe " + 
    "i Source\\#{project_dir}\\packages.config " + 
    "-o Source\\Packages"

namespace :nuget do  
  desc "nuget for servicebus"  
  task "ServiceBus" do	
    nuget_for_project "SampleProject.ServiceBus"  

  desc "nuget for web"  
  task "Web" do	
    nuget_for_project "SampleProject.Web"  
  desc "nuget for all"  
  task "all" => ["nuget:ServiceBus", "nuget:Web"]

desc "continuous integration task"
task "ci" => ["clean", "nuget:all", "build", "test"]

Chad Fowler’s Keynote

Chad Fowler’s keynote at Codemash was excellent, and well timed to get me through the week. While I have really enjoyed my time there, and learned a lot the last 2 year’s attending, I run into a lot of attitudes that are hard for me to handle.

Simply put, I work in multiple dev communities (Ruby and .Net), and both can be dismissive of each other at times.

This manifests itself in a couple of ways:

  • not just making a case, but implying anyone who disagrees is stupid or ignorant
  • assuming that success with their tool (framework, methodology, ide) means that all other tools fail
  • judging a tool based on an experience where they never tried to learn the tool

Since the last one is vague, I’ll give an example. You learn how to use database VendorX’s product in college and in your first couple of year’s programming. You have read up, you know the product inside and out. You get a contract to do work on a project that will use VendorY’s database. You consider yourself a SQL expert and decide to learn on the job. However, DDL, Programmable Sql, and identities are handled differently, and you are frustrated by this, and declare VendorY sucks. But you never picked up a book or put in any of the effort for VendorY that you did for VendorX.

So what does this have to do with Chad?

He’s a part of a vocal Ruby community. And many in this community are the source of my frustrations above. (To be clear, I may agree with what they are saying, I just am turned off by how they say things). So when Chad started talking about his experience in corporate America and poking fun of Six Sigma, I thought “here we go”. (For the record, I have no experience with, or understanding beyond the basics of Six Sigma practice, and no reason to defend it).

But Chad showed a deep desire to learn about and understand what he was working with, whether he liked it or not. He revealed that he was a trained Six Sigma “black belt”. He explained his frustrations, but also talked about the pieces of it that he found effective, and it sounds like he carried over pieces that were useful into his future places of employment.

Why does this strengthen his my view of his credibility? First, he had the humility to realize his first impressions may have been wrong, and the practices of 6S deserved more investigation. Second, he made an attempt to understand the context, history, and motivations involved, so his end argument was full of salient points, not just “gut-feelings”.

That quality, like offering a solution when you complain about a problem shows a deeper level of maturity. I was glad my first impressions about Chad were wrong, and I chose to stick around for the keynote, it was worthwhile.