Building video game APIs with Goliath, Grape, and Rabl

Posted: 11th June 2013 by M. E. Patterson in Coding

I recently gave this presentation to both the Austin.rb Ruby users group and up at Gearbox Software. Check it out!

SQL/NoSQL Debate? Why?

Posted: 27th May 2011 by M. E. Patterson in Coding
Tags: , , ,

Short post here. I’m tired of hearing about the SQL/NoSQL “debate.” Seriously. I don’t really understand why there’s a need to stake out territory and then start a war over techno-ideologies.

In my opinion, this debate is like having a debate about cars vs. pickup trucks. There are valid pros/cons to buying cars and valid pros/cons to buying pickup trucks. In fact, it’s totally valid for one person to own both a car and a pickup truck! Gasp! I know, it’s mind-blowing!

I’ll add that, as a proponent of MongoDB, I definitely think the right NoSQL database is a better solution in many ways for much of the web-app databasing that was previously handled by relational DBs. But my saying that in no way indicates that I think SQL is dead, relational is dead, or anything of that sort. This is a classic ‘right tools for the job’ discussion.

If there’s any debate at all, maybe it’s around what, specifically, the best use cases are for each type of database, but I’d prefer that we stop referring to that as a debate and instead just see it as an ongoing evolution and discussion. Creating conflict where there doesn’t need to be any solves nothing and makes us all look bad.

Basic Linux Server Hardening

Posted: 18th February 2011 by M. E. Patterson in Coding
Tags: , , ,

Some excellent tools and tricks to consider when hardening the security on your Linux server, mostly listed here for my own benefit later:

  • Linux Malware Detector on a daily scan
  • mod_security for Apache
  • moving /tmp to a non-executable partition
  • daily scan with ClamAV’s clamscan utility
  • moving SSH to a nonstandard port
  • removing the ability for root to login through SSH
  • (even better) making SSH auth-key-based only, so no user/password logins at all!

This setup will at the very least harden your server against the bulk of irritating script-based assaults.  There’s lots more that can (and should) be done, but I’m starting to think that most of the things I’ve just listed are required nowadays (certainly the SSH ones are).

Mongoid + Carrierwave + Virus scanning!

Posted: 30th December 2010 by M. E. Patterson in Coding
Tags: , , , , ,

Ever wanted to have your app virus-scan uploads BEFORE you attach them to a model?  My app needed to do exactly that — I didn’t want some bozo uploading a virus-laden Word doc and then distributing to all the agents that log in to the site.  So I set to work… I thought this was a fun little implementation that I pulled off with relatively little code.

Read the rest of this entry »

Do you have a software team that is brilliant, hardworking, and yet seems to have difficulty producing a product that actually sells?

Perhaps your ultra-brilliant, hardworking software team is overvaluing the importance of technical genius and undervaluing some of the skills that actually make a viable product.

Good software executives and managers realize that not all programmers are created equal; that you need a well-evaluated mix of pros to build award-winning software.  To this end, they decide to give more of the hiring and evaluation power to either Development Managers or sometimes directly to Team/Tech Leads.  This, they reason, is the way to make sure that the evaluations are being done by “people who understand programming/programmers.”

While this is a great idea in principal, it can have unintended consequences…

Read the rest of this entry »

Cheating on Haml with Slim

Posted: 29th November 2010 by M. E. Patterson in Coding

I feel bad. I really didn’t mean for you to find out this way, Haml. I mean, Slim is really a lot like you. Really. It’s just… slimmer. And it does all the same stuff, plus some stuff you would never do for me. It fulfills me. It makes me feel like all is right with the world.

I still love you Haml, but you’ve grown a bit slow. I like Slim‘s sexier benchmarks. And it turns me on not to need to type % anymore. I mean, look at this:

  h4 class=klass title=title

Anyway, I know and love you, Haml. I won’t stop using you for all sorts of stuff. And I can tell you’ve had a lot of influence on Slim. But Slim’s the templating language for me. At least for right now.

It’s not you, it’s me…

HOW TO: get fuzzy and plural matches from Sunspot / Solr

Posted: 5th October 2010 by M. E. Patterson in Coding
Tags: , , ,

Looked all over the place for a simple way to get Sunspot to give me back some basic ‘fuzzy’ search results, including ye olde “things that sound kinda like what I typed, even if I misspelled it” and “plural versions of the keywords I typed in.”  It’s not that this is a super-hard problem that nobody’s solved.  It’s more that doing it really, really well involves some knowledge of how Solr works and monkeying with its configuration to get it to give up the goods the way you want for your use of the thing.

But that’s okay, I’m going to do you a kindness, Tony, and give you the config setup I used that’s giving me a good set of results per the above requirements:

Make sure this is what your <analyzer> section looks like in the /solr/conf/schema.xml file:

<analyzer>
  <tokenizer class="solr.StandardTokenizerFactory"/>
  <filter class="solr.StandardFilterFactory"/>
  <filter class="solr.LowerCaseFilterFactory"/>
  <filter class="solr.PorterStemFilterFactory"/>
  <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
</analyzer>

Now, let the commenting commence! I’m sure some folks out there would be happy to explain why the above is non-performant at large scales or that there’s a much better way to achieve my above requirements with some other method. I’d love to hear it! Lay it on me!

But for now, this is totally satisfying my requirements, and I ain’t gonna change it until I need to. And I hope the tip helps someone else get on the right path faster than I did.

While working on my upcoming BigAuthor project, I came upon an interesting challenge that turned out to be so simple with MongoMapper that I just have to share it here. Need to create a hash of multiple filter parameters on a MongoMapper document using a form that is cleanly resource-based, using InheritedResources? It’s not as difficult as you might think…
Read the rest of this entry »

Starting a new Rails app? Here’s my skeleton…

Posted: 15th February 2010 by M. E. Patterson in Coding
Tags: , , , , ,

Not meant to be a “this is what should be done” as much as a “this is what Matt uses, based largely on community popularity, best practice, and Matt’s personal tastes.”

Take it for what it is: a point of discussion.

Of course, the skeleton of any Rails app will vary from project to project, depending on needs.  Agile approach is to only add it to your framework if you actually need it right now, though some stuff tends to be easier to use (like authentication systems and databases) if you build it in up-front.  That tends to be my approach for green-fielding Rails apps.

If you’ve got some favorites that you use, feel free to post in the comments about it! I’m always interested in hearing about new stuff that makes my life easier/more fun.
Read the rest of this entry »

Why use HAML (and SASS)? I already know HTML.

Posted: 2nd February 2010 by M. E. Patterson in Coding
Tags: , , ,

The title of the post is more-or-less a verbatim quote from a coworker, as well as from an unrelated colleague of mine from a previous job. I was asked that question and, to be honest, I was a little thrown both times. I didn’t actually know why I use HAML.  I guess I’d never really considered it much after I started doing everything with it.  It just seemed better and more fun.

So I spent all last night thinking about the answer.  Why use HAML?  For that matter, why use SASS either?  It’s notable, I guess, that yesterday Chris Eppstein was polling his twitter followers on whether they wanted to break SASS and HAML apart to be separate gems … clearly others out there are using one but not the other.

And I suppose it’s not enough to answer that I use HAML and SASS because other luminaries in the Ruby world swear by it.  As my Mom was fond of saying, “If all the other kids jumped off a cliff…”  So I guess that’s not entirely a valid reason.

So, here’s my attempt to coalesce my various reasons for using HAML (and SASS) into a single post, and to try and convince you why I think it’s a great idea.  And to throw a bone to Eppstein, I’ll try to make a case for why, though I have no problem with them being split into separate gems, I still believe they should always go together, just like peanut butter and grape jam.

Read the rest of this entry »