System Status

Shortlink

Fletcher Nichol is an awesome chef!

We’ve always thought Blue Box software design engineer and Chef-extraordinaire Fletcher Nichol is fantastic.  A couple weeks ago the Opscode Chef community demonstrated its agreement by awarding him one of the three inaugural Awesome Community Chef awards at #ChefConf 2013!

Blue Box's Fletcher Nichol (r) wins Awesome Chef award (photo by Mark Wickens)

Opscode, #ChefConf conference organizer and creator of Chef, asked the Chef community to nominate those doing exceptional work and/or making a difference within the community. After sifting through tons of nominations, a committee chose three winners: Bryan Berry, Cycle Computing; Jamie Winsor, Riot Games; and Fletcher. The Awesome Community Chef awards were given out on April 26th at this year’s #ChefConf in San Francisco.

Fletcher is very active in the Chef community.  His work here at Blue Box and on his own includes Chef-Broker for Razor, creating Jamie/Test-Kitchen 1.0, Knife-Server, and contributing to many cookbooks.  Much of his work on Razor will help make deployments quicker and easier for Blue Box cloud hosting customers.

When asked why Fletcher was chosen for the award, Nathen Harvey of Opscode mentioned all of the contributions Fletcher has made to Chef and went on to state, “Not only is he writing great code, Fletcher embodies what it means to be a great citizen in the Chef community.”

In addition to the community recognition, Fletcher and the other winners each received an iPad mini, a personalized Chef track jacket, and an all expense paid trip to the Opscode Community Summit.

You can check out what Fletcher is up to on Twitter and GitHub, as well as occasional posts here.  

Congratulations to Bryan, Jamie and of course Blue Box’s own Fletcher!

Shortlink

New Ruby security tool–free to Blue Box customers!

Blue Box takes security very seriously.  So we are pleased to announce our customers now have access to our partner Code Climate’s fantastic new Security Monitor!

How does Code Climate work?

Code Climate provides continuous code inspection for your Ruby app, letting you fix quality and security issues before they hit production.

After each Git push, Code Climate analyzes your code to identify changes in quality and surface technical debt hotspots. Urgent notifications are sent immediately via Campfire chat, email or RSS so you can address potential quality issues as soon as they occur.

Code Climate’s new Security Monitor feature helps ensure the security of your Ruby app. It scans your application source code for potential vulnerabilities every few hours and emails you if a problem is found. It’s integrated with GitHub Issues, Pivotal Tracker, and Lighthouse to make resolving issues quick and easy.

How do I get my free Blue Box Customer account?

All Blue Box customers get a free Code Climate team account which includes the new Security Monitor. If you’ve already set up your free account, Security Monitor has automatically been added. If you would like to sign up for your free account, contact Blue Box Support for details!

Shortlink

South to Portland for RailsConf!

RailsConf is next week in Portland!  The Blue Box team is proud to be a silver sponsor for the conference.  We’re packing our bags and heading south, bringing people from many different departments so you may get the chance to meet someone you’ve worked with only electronically or on the phone.

Be sure to catch our panel presentation on Monday, April 29th, at 4pm in the P&S track.  Blue Box’s Fletcher Nichol will be leading a discussion on automating complex application deployments with panelist Andy Camp, Eric Lindvall, James Casey, Matt Kocher, and Dr. Nic Williams.  It promises to be a very interesting discussion!

We will have a booth in the exhibitor area Tuesday and Wednesday.  Please stop by to say hi, pick up some cool swag, and enter to win a pretty awesome prize!  Our friends from partner Code Climate will also be hanging out in the booth with us, offering a free help clinic for your Rails app.

We look forward to seeing you in Portland!

 

Shortlink

Passing on PaaS

Over the past weeks, a fascinating discussion has evolved within the Platform-as-a-Service (PaaS) community. This conversation started with a thoughtful post by AppFog’s CEO Lucas Carlson titled “Everybody Loves PaaS; PaaS is Failing.” In his post, he notes “early” PaaS “was created for developers, not for enterprises.” Lucas illustrates how these early PaaS offerings fit certain use cases extremely well:  fast initial deployment providing agility and velocity to new applications, lower initial investment in infrastructure, etc.  He also goes on to note that the economics of most PaaS offerings were not designed for large-scale production applications.  Lucas states: “If an application was successful and went into production, the price of operating it went up much faster than with traditional infrastructure.”

One of the drawbacks to PaaS offerings is the lack of visibility customers have into the operating methodologies of the platforms themselves.  Krishnan Subramanian of Rishidot Research documented these concerns in a recent blog post titled “Rap Genius Flap and PaaS Visibility.”  PaaS products today operate as a black box with defined inputs (your application) and expected outputs.  But if those outputs aren’t in line with what was expected, it’s impossible to know why.  As applications grow in complexity, this black box approach becomes a point of friction and difficulty. All of the frustration that started with Rap Genius’s blog post are perfect examples of that challenge.

This friction point is further compounded by the PaaS plugin ecosystem, which for development and greenfield applications provides an incredible technology opportunity, but at scale becomes a major source of heartache.  A company with a more sophisticated application may have to work with upwards of six different companies, all of whom have different SLAs, different support agreements, different billing methodologies and where an outage from any single one has the potential to bring the application to a grinding halt.

Don’t get us wrong. PaaS isn’t bad— its development is a phenomenal technological revolution.  The PaaS model is hugely beneficial to many apps and has dramatically lowered the barrier to entry for starting new companies. To be sure, PaaS offers significant benefits in terms of ease and speed of deployment, agile provisioning and more.

Our view at Blue Box is PaaS is overly constraining for larger scale deployments which are constructed with significant technical complexity and see substantial traffic.  This is a reality we live and breathe on a regular basis as clients feeling that constraint migrate to Blue Box.  Additionally, more of our new clients are now openly talking about these constraints, limitations and “black box” factors they’ve experienced elsewhere.

How To Get Out Of The “Black Box”? 

As a leading managed cloud hosting company, Blue Box offers a unique hybrid hosting solution engineered to meet the specific performance and scalability requirements that modern apps demand for responsive and agile app delivery.  At Blue Box, our team manages our infrastructure in our datacenters.   While engagements with Blue Box may not provide the point and click deployment simplicity of existing PaaS providers, we are able to deliver the customization and performance required for customers to support growing complexity and traffic volume because we own and control our own infrastructure.

Today’s PaaS-only providers rely on third-party infrastructure, limiting agility and responsiveness, and impacting the customer experience they’re able to deliver.  By contrast, the Blue Box model permits the customer infrastructure control and performance needed to scale.  Whether our customers need that scalability today or tomorrow, we ensure our solution grows with our customers.

Stay tuned to see how Blue Box can provide an application “cradle to grave” offering that delivers not just the simplicity of PaaS, but is coupled with the power of our hybrid offering.

Questions? Contact us and let Blue Box get you out of your Black Box. We’re happy to discuss your needs and how we can help you!

Shortlink

DevChix is now hosted by Blue Box!

Blue Box is pleased to announce its sponsorship of DevChix, an online community for female programmers.

DevChix began as an online message board and mailing list for women in the programming community. Initially, it was a small network where women could come for coding advice.  Today, it is a thriving community where women discuss coding projects and experiences in their daily work lives. DevChix provides a friendly environment to express ideas and opinions in a constructive way with only one rule—“Be Nice.”

Desi McAdam of thoughtbot, one of the community’s co-founders, says “One thing DevChix does well is make you self-aware and not just aware of the actions of others.  Makes you think!”

DevChix encompasses a variety of programming languages, including Ruby, Python, and PHP. Members are diverse as well, ranging from students to experienced developers to business owners.  Many in the DevChix community also organize or participate in events such as Railsbridge, a training workshop aimed at introducing more women to the Ruby programming language.

Kerri Miller, a senior software engineer at Blue Box, has been part of the DevChix community for over three years.  For Kerri, “DevChix is a powerful and collaborative space for women in STEM to come together and share their experiences, good and bad, and to encourage each other to grow in our careers.  It helps give women empowering tools to change our communities for the better.”

Blue Box is proud to support the developer community and the discourse, creativity, and drive that keep it innovative and thriving.  We see this as one of the ways we can “give back” to a community that has been a huge part of the growth and success of Blue Box.

Shortlink

Travis CI moves to Blue Box

We are pleased to announce Travis CI, the leading continuous integration service for the open source community, has selected Blue Box to power its Linux infrastructure. Travis CI cited flexibility, virtualization on the operating system level, and the access to fast, custom hardware as the keys to its decision.

Travis CI has run over 4.2 million tests for over 41,000 open source projects to date.  Originally developed as a service for the Ruby community in early 2011, it now offers support to many other technologies, including Rails, Rubinius, Rubygems, Bundler, Symfony and others. Travis CI also offers a private testing stream with Travis CI Pro.

“Blue Box’s private cloud using custom hardware allows us to get the best, most reliable performance for our users and customers,” said Josh Kalderimis of Travis CI. “With the move to Blue Box we’re able to iterate on the build environment much faster, introducing new features and updates to available services and languages a lot quicker than we could before. This is a big win for everyone using our platform. We trust the Blue Box team with our daily business of continuous integration.”

To read the full press release, click here.

Shortlink

Blue Box expands Seattle data center footprint in new Equinix SE3 facility

Blue Box is pleased to announce we are expanding our data center footprint in the Seattle area by leasing space in the new Equinix, Inc. SE3 data center opening in the downtown Seattle core.

SE3 is a purpose-built site that offers 24-hour operations and security as well as physical features such as 

a dedicated loading dock, freightelevator, and state-of-the-art amenities. It offers direct connectivity to the Seattle Internet Exchange. The new data center space is 51,000 sq feet and adds capacity for more than 1,000 cabinet equivalents to Equinix’s Seattle presence.

“Equinix provides some of the best facilities and operational support out there, which is critical in meeting our customers’ expectations,” said Jesse Proudman, Blue Box CEO. “With our newly deployed infrastructure in SE3, we have no doubt that the network proximity and growth opportunities that Equinix’s ecosystem offers will further solidify our competitive edge.”

Click here to read the full press release and learn more about the new Equinix data center.

Shortlink

Using Regular Expressions in Ruby (Part 3 of 3)

Nell Shamrell works as a Software Development Engineer for Blue Box. She also sits on the advisory board for the University of Washington Certificate in Ruby Programming. She specializes in Ruby, Rails, and Test Driven Development.  Prior to entering the world of software development, she studied and worked in the field of Theatre. The world of Theatre prepared her well for the dynamic world of creating software applications. In both, she strives to create a cohesive and extraordinary experience. In her free time she enjoys practicing the martial art Naginata.

This is the final installation in our three part series on regular expressions.  Read Part I and Part II.

Regular Expression Behaviors 

Regular expressions are powerful. As a famous superhero once said, with great power comes great responsibility.  To keep a regular expression from causing havoc, you need to know how to control its behavior.

Regular expressions have three distinct, recognizable behaviors: greedy, lazy, and possessive.  These words sound pretty negative but they’re not necessarily bad ways for your regular expression to behave.  These are descriptions of different types of behavior your regular expression might have.  Behavior you can recognize and control!  I’m going to show you how.

To understand these regular expression attitudes, we need to understand quantifiers. Quantifiers simply tell your regular expressions engines how many times a character or group of characters should appear in your string.

One of the quantifiers I use the most is the “+” quantifier.  When I add this to a character, it means that character needs to appear at least one time.  It can appear as many times as it wants, but it needs to be there at least once.

So this regular expression

/.+/

would match any character appearing at least once.  It guarantees a character will be there.

Quantifiers lie at the root of whether your regular expression is greedy, lazy, or possessive.  By default, they’re greedy.

greedy quantifier tries to match as much of the string as it can.  It grabs as much of the string as it can get its greedy little hands on and tries to make a match.  If the whole string doesn’t work, it backs up one character and tries again.  It repeats this process until there are no more characters for it to test.

Greedy quantifiers use maximum effort for maximum return.  A greedy quantifier will try as many ways as it can to find a match and will return the maximum characters that could possibly be a part of that match.

Let’s look at an example. I’m going to switch science fiction fandoms for this next string and use a quote from Star Trek: First Contact:

string = “There’s no time to talk about time we don’t have the time”
/.+time/

This regular expression matches any character appearing at least once followed by the word “time.”  Now if I run the match method on this regular expression, passing in the string:

/.+time/.match(string)
=> “There’s no time to talk about time we don’t have the time”

It matches our entire string.

When this regular expression sees the string, it tries to match the first part of the regular expression, the “.+,” first.  This matches the entire string.  Then it tries to match the second part of our regular expression, the word “time.”  Because it already has the entire string marked as a match, it’s going to first look for the word “time” beyond the end of the string.  It’s not going to find it since there’s nothing there, so it backtracks.  It moves back one character at a time until it finds a match.  When it finds it, it returns the whole match.   In this case, it’s our entire string.

Greedy quantifiers try to match the whole string, then backtrack.  Backtracking means if the entire string doesn’t match the entire regular expression, it will try as many ways as possible to find a match.  It needs to keep track of what ways it’s tried so it doesn’t repeat them.  This can potentially take up a lot of system resources, particularly when you have multiple matches running on large amounts of text.

Oniguruma has optimizations that make backtracking quicker.  Patrick Shaughnessy has a fantastic blog post  that goes into the details of how Oniguruma handles backtracking. Even with optimizations, however, a greedy regular expression will chew through a lot of resources.

When you want a more contained match that uses much less resources, you want a lazy quantifier. Also known as a reluctant quantifier, it starts at the very beginning of the string and tries to make a match with the very first character. If it doesn’t find a match, it grabs another character.  As an absolute last resort, it will grab the whole string to try and find a match.

A lazy quantifier uses minimum effort for minimum return.  It returns as few characters as possible to make match.  If it finds a match in the first character of the string, it will return just the first character. It’s lazy.  It does just enough to get by, nothing more.

You make a quantifier lazy simply by adding a question mark after it.

/.+?time/

If I run the match method on my string using this lazy regular expression

/.+?time/.match(string)
=> “There’s no time”

I only get “There’s no time” back.  It started at the very beginning of the string and delivered just enough to be a match.  Lazy regular expressions use much less backtracking and, therefore, fewer resources than greedy regular expressions.

What if you do want to match as many characters as possible, but don’t want backtracking to consume your resources?  There’s a third kind of quantifier, possessive quantifiers.   These are all or nothing.  Either there’s a match on the first try or they fail.  Like a greedy quantifier, they grab as much of the string as they can – the entire string- and try to make a match.  If that match fails, though, they won’t backtrack or try again.

Possessive quantifiers use minimum effort for maximum return.  They try to return as many characters as possible for the bare minimum effort – they give it one go then give up.

To make a quantifier possessive, you add a plus sign to it:

/.++time/

Let’s run match on the string using this possessive regular expression

/.++time/.match(string)
=> nil

It returns nil.  The match fails. Why would it fail?  It seems like our entire string should match this regular expression.  The reason this fails is because there is no backtracking.

The first thing our regular expression tries to match is the “.+.”  This matches the entire string.  When it tries to match the second part of our regular expression, “time”, it already has the entire string marked as a match for “.+.”  It looks for the word “time” AFTER our entire string.  This is the same thing a greedy quantifier does, but a greedy quantifier can go back earlier in the string and look for a match.  A possessive quantifier can’t go back in the string to look for a match because it can’t backtrack.  Therefore, it fails.

The main advantage Possessive quantifiers offer is  they fail fast.  They don’t backtrack, so they use minimal resources.  A greedy quantifier will try every possible way to try to make a match.  If it fails, all that work, all those resources, will be for nothing. A possessive quantifier prevents this. If it’s going to fail, it fails quickly.

Generally, you only want to use possessive quantifiers for very small regular expressions, usually when you have small sub expressions nested within larger expressions.  They’re very useful, but use with caution.

Conclusion

Regular expressions can seem overwhelmingly complex.  When I was learning to go beyond the basics of regular expressions, beyond the few tricks I knew for things like email validation, I found it helpful to think of it as writing a subprogram in another language.  In fact, that’s exactly what it is.  You are writing another program, in another language, within Ruby itself.  

Like any programming language, it really helps to write your regular expressions in small chunks.  If I’m writing a lookbehind, I first want to write the main pattern I will be matching.  I’ll make sure this works.  Then I will write a pattern for the lookbehind and make sure it works on it’s own.  Only after I’ve confirmed that both patterns work will I put them together and test.

Rubular is a fantastic site for both composing and testing your regular expressions.  Check it out.  Use it.  It’s made my life so much easier.

Like any software program, regular expressions come in drafts.  When you’re developing a regular expression, it’s okay for it to be ugly at first.  Get it working and, once you have it working, refactor.  It’s the same red, green, refactor process we use in test driven development.

Regular expressions are powerful.  So powerful they inspire fear in many of us.  That fear can be overcome.  As cryptic as they might seem, they do have a logical reasoning and structure.  Use them. Fire up Rubular and try some lookaheads and lookbehinds, experiment with greedy, lazy, and possessive quantifiers.  Explore the fantastic ways Ruby works with regular expressions.  I think you’ll be amazed at what you find.

Shortlink

Code School Joins Blue Box’s Growing List of Marquee Customers

We are pleased to announce Code School, a leading online learning platform, has chosen Blue Box to power its infrastructure.  Code School cited the unparalleled uptime and support Blue Box provides as a key factor in making the decision to move over from Heroku.

“In 2012, three million people participated in our online courses,” said Daniel McGaw, Marketing Lead, Code School. “With millions of people relying on Code School to learn programming and design, uptime and reliability are paramount in providing service that keeps them coming back. Blue Box provides the critical uptime and reliability we need to grow the number of students we serve and the number of courses we can offer.  We now have the scalable infrastructure to grow rapidly in ways that previously weren’t possible.”

Launched by Envy Labs and made public in 2011, Code School offers beginner to advanced courses that combine videos, coding in the browser and gamification principles to make learning programming enjoyable and effective.  They served over three million people in 2012.

To read the full press release, click here.

Shortlink

Using Regular Expressions in Ruby (Part 2 of 3)

Nell Shamrell works as a Software Development Engineer for Blue Box. She also sits on the advisory board for the University of Washington Certificate in Ruby Programming. She specializes in Ruby, Rails, and Test Driven Development.  Prior to entering the world of software development, she studied and worked in the field of Theatre. The world of Theatre prepared her well for the dynamic world of creating software applications. In both, she strives to create a cohesive and extraordinary experience. In her free time she enjoys practicing the martial art Naginata.

This is the second of three blog posts in this series.  Read the first one here and the third one here.

LookArounds

Lookarounds let me to do more than just match a pattern directly.  They let me to define a context for that match.  An expression with a lookaround only returns a match when it is surrounded by a certain context.

Let’s start with a new string, yet another Star Wars quote from Obiwan Kenobi.

string = “Who’s the more foolish?  The fool or the fool who follows him?”

I want to know all the places the word “fool” is used in this string.  I’m going to use the regular expression /fool/. In this case, I’m going to use Ruby’s scan method on my string.  The scan method will return all matches for my regular expression in my string:

string.scan(/fool/)
=> [“fool”, “fool”, “fool”]

Notice it matches the word “foolish” and the two uses of the word “fool.”

What if I only want to match the pattern /fool/ when it is part of the word foolish? I would use a positive lookahead.  This tells my regular expression engine to find every match for my pattern that is directly followed by a match for another pattern.  In Ruby, we designate something as a positive lookahead by using ?= operator:

/fool(?=ish)/

Here’s my modified regular expression.  Notice I have the primary pattern, which is the literal world “fool,” and directly to the right of it I have the lookahead pattern, the letters “ish”:

string.scan(/fool(?=ish)/)
>=> [“fool”]

This time, the scan method only returns one match – the one time the word “fool” is followed by the characters “ish”.

Let’s take this a step further and use the gsub method to change our string.  Anytime we match the pattern fool –followed by the letters “ish”, let’s replace it with the word “self”:

string.gsub(/fool(?=ish)/, “self”)
=> “Who’s the more selfish?  The fool or the fool who follows him?”

And with apologies to Obiwan Kenobi, we’ve modified the line to “Who’s the more selfish?  The fool or the fool who follows him?”

Technically, this is referred to as a zero width, positive lookaround assertion.  That’s a mouthful, isn’t it?  In The Well Grounded Rubyist, David Black breaks it down like this:

Zero-width means the lookahead pattern ( which is “ish” in our case) does not consume any characters.  This means it makes a match, but it doesn’t return that match.  It only returns whether there was match or not.  True or false.

Positive means a match for the lookahead pattern should be there, you’re expecting it.

Lookahead means something needs to be ahead of the match for our main pattern.  It needs to come after the match for the main pattern.

Assertion means our lookbehind isn’t meant to return a match, it’s only meant to assert whether a match exists or whether it does not.

What if I wanted to do something slightly different?  What if I wanted to match every time the word fool is NOT followed by the letters “ish”?  I would use a negative lookaheadTechnically, this is referred to as a zero-width negative lookahead assertion.  Negative means a match for our lookahead should NOT be present, we’re not expecting it to be there.  You use the ?! operator to designate a negative lookahead.

I’m going to run scan on my string again, but this time with a negative lookahead in my regular expression.  I want it to match every time the fool is NOT a part of the word foolish:

string.scan(/fool(?!ish)/)
=> [“fool”, “fool”]

It returns two matches, the two times the string uses the word “fool” without being part of the word foolish.

Let’s take it a step further and use it with the gsub method.  Anytime the we match the pattern fool – only when it is NOT followed by the letters “ish” – let’s replace it with the word “self”:

string.gsub(/fool(?!ish)/, “self”)
=> “Who’s the more foolish?  The self or the self who follows him?”

Once again, I’ve changed a classic line.  Now it reads “Who’s the more foolish?  The self or the self who follows him?”

These examples are great when I want to find a match based on what comes after it.  Again, let’s take it a step further.  What if I want to find a match based on what comes before? I need to use a positive lookbehind assertion. This means I want to match a pattern every time it is directly preceded by another pattern.

Let’s use another Star Wars quote for our string, this one from Yoda:

string = “For my ally is the force, and a powerful ally it is”

The main pattern I want to match is the word ally using the regular expression /ally/. I only want to match the word “ally” when the word “powerful” comes directly before it, however.  This is where the positive lookbehind comes in. Positive lookbehinds use the ?<= operator.  Let’s add it to our regular expression:

/(?<=powerful )ally/

This regular expression matches the word “ally” every time it is directly preceded by the word powerful. Notice the lookbehind is behind the main pattern. The lookbehind needs to come before the main match.  The word “powerful” needs to come before the word “ally.”

Now I’m going to use the gsub method on the string.  Every time the word “ally” is directly preceded by the world powerful, I want to replace it with the word “friend”:

string.gsub(/(?<=powerful )ally/, “friend”)
=> For my ally is the force, and a powerful friend it is.

It changes Yoda’s words a little bit:  “For my ally is the force, and a powerful friend it is.”

What if I want to do the opposite?  What if I want to match every time the word “ally” is NOT followed by the word “powerful?”  I would use a negative lookbehind.  This means I want to match my pattern every time it is NOT directly preceded by another pattern. Negative lookbehinds use the ?<! operator.  Let’s apply it to the regular expression:

/(?<!powerful )ally/

Let’s run gsub using this regular expression, replacing the word “ally” every time it is NOT directly preceded by the word “friend”:

string.gsub(/(?<!powerful )ally/, “friend”)
=> “For my friend is the force, and a powerful ally it is.”

Again, I changed Yoda’s words a little bit:  “For my ally is the force, and a powerful friend it is.”

Lookarounds provide a tremendous boost to your regular expressions because they help you define context.  Rather than being a static pattern that either matches or doesn’t, your regular expression becomes powerful, flexible, and capable of much more.

Please check back next week for the third installment of this three part series.