infrastructure

March 8, 2013

India: Using Global Technology to Go Hyper-Local

Bill Gates once told a journalist that everyone should care about developments in India because the world's largest democracy (of 1.2 billion people) and tenth-largest economy is quickly catching up with us. I recently had the opportunity to see those developments first-hand, and I wholeheartedly agree with Bill's sentiment. Innovation and technology breakthroughs are not owned by or limited to the United States, and as international markets mature, we're going to see more and more entrepreneurship and startup activity overseas. Now I don't mean to imply that the demise of Silicon Valley is imminent, but its influence will be greatly diminished in the future, and that's not necessarily a bad thing.

I just returned from a round-the-world trip that included nearly two weeks in India as part of a 500 Startups-sponsored market exploration tour called Geeks on a Plane. The tour stopped through Bangalore, Mumbai and New Delhi, with meetups for local entrepreneurs, startups, investors and some of the most influential companies in India's technology ecosystem. While in India, I had the chance to meet several SoftLayer customers — including Zoomin, PowerWeave, and Vidya Mantra — and their insight into the growing technology culture in the region was eye-opening.

India

One of the most interesting characteristics shared by many of the entrepreneurs I spoke with was that they were building businesses with a "hyper-local" focus: Unique business models that are specifically geared toward serving local communities while leveraging the latest technologies in mobility and e-commerce. This distinction is particularly noteworthy because they didn't assume that they'd need to succeed in the US market or compete with companies in the US to build their businesses ... And they're absolutely right. The opportunities that exist for hyper-local entrepreneurs in these emerging markets are staggering.

FlipKart is known as "The Amazon of India." It's very similar to the online shopping giant most of us know and use regularly, but with some unique regional twists. For example, because credit card and electronic payments in India are not as prevalent or reliable as they are in much of the world, orders are taken via both an online ordering system and through FlipKart call centers. Once processed, a highly developed network of "scooters" delivers about 50 percent of FlipKart's orders, and the payment is provided at the customer's door — IN CASH. While that might seem simplistic, each courier has a smartphone that allows them to become a geo-located, connected, data sharing entity. Hundreds of millions of dollars in FlipKart orders are delivered each year with very few issues, despite the fact that most of us can't even imagine how the company could operate that way in the US.

Another great example of how innovators are using technology to redefine businesses is redBus, India's largest bus ticketing company. A huge percentage of travel in India is done very inexpensively by bus, and before redBus came on the scene, travelers took their chances by buying tickets through middlemen and ticket brokers, often getting ripped off or becoming victims of double-booking. By centralizing the ticketing process, redBus is able to provide a reliable way to book a seat on any of India's vast system of buses via phone, online or in person. redBus offers the largest selection of bus seats in the country with over 350 bus operators and a flexible network of boarding points, timing and bus types. It's an incredibly simple service that meets a clear need for a hyper-local audience by leveraging the technologies being built and improved around the world.

If my two weeks in India taught me one thing, it was that the startups don't need to conquer international markets ... They can strive to service their local communities and interests, and they'll be just as successful (if not more). Our Catalyst program has just begun its international expansion into India, and the future certainly looks bright. In fact, I'm proud to announce that we've already signed up our first Catalyst program member in India with many more to come!

As we continue working with startup communities around the globe, I learn more and more about how the world is changing, and I get a stronger appreciation for the cultural and economic ties that bind us all together.

Stay tuned!

-@gkdog

March 8, 2013

Server Challenge II: Strata Conference 2013

If you want to find the Server Challenge II on an exhibit hall floor, just look for a crowd in one of the aisles and listen for cheers. When SoftLayer partnered with Supermicro to build a retro upgrade for our original Server Challenge, we knew the results would be phenomenal, and we haven't been disappointed. Other booths are chatting with one or two attendees while we've got the attention of 20+ as we explain what the Server Challenge II is all about and how it relates to what we do.

Strata Conference

About a dozen Strata Conference attendees asked where the Server Challenge II would show up next, and upon hearing that we'd have it at SXSW next week, one (semi-jokingly) begged us to let him rent the unit so he could practice beforehand. It almost seems like the competition is getting a cult following. And we love it.

Beyond the simple fact that the Server Challenge II affords us to talk about SoftLayer's differentiators as a cloud infrastructure provider, the competition actually brings flocks of attendees to our booth at the *end* of a show when other booths are already starting to packing up to go home. At Strata, the top four times were set in the last two hours of the show, and the very last attempt (which started right when the lights were flashing to signal the end of the show) was less than five seconds for taking the top spot.

In the end, Jonathan Heyne Galli bested the competition to take home bragging rights and a MacBook Air with a speedy time of 1:04.45. To showcase the winning attempt in a unique way, I grabbed my phone and fired up Vine:

If you have twelve more seconds to watch two other attempts, the Second Place and Third Place attempts were also captured with Vine.

In the midst of all of this competition, I've been blown away at the sportsmanship between competitors. I know how cheesy that sounds given the fact that we're talking about a game with a server rack in an expo hall, but it's true. Carson, the third place finisher, actually beat Jonathan's 1:04.45 toward the end of the show, but one of the drive tray arms wasn't clipped closed when he stopped the timer. We explained that we couldn't give him the top spot but that we could wipe that score and give him one more chance to replicate the result (with no errors), and he was quick to agree. He wouldn't want someone else to win with an "incomplete" build if he were in first place, so he didn't want to win that way.

Here was the final leader board from Strata 2013:

Strata Leader Board

Given the floods of traffic to our booth wherever the Server Challenge II turns up, it's only a matter of time until someone makes a documentary on the Server Challenge like The King of Kong: A Fistful of Quarters. I can see it now ... The Server Sultan: Get in Line to Bring Servers Online.

-@khazard

March 7, 2013

Script Clip: HTML5 Audio Player with jQuery Controls

HTML5 and jQuery provide mind-blowing functionality. Projects that would have taken hours of development and hundreds of lines of code a few years ago can now be completed in about the time it'll take you to read this paragraph. If you wanted to add your own audio player on a web page in the past, what would it have involved? Complicated elements? Flash (*shudders*)? It was so complicated that most developers just linked to the audio file, and the user just downloaded the file to play it locally. With HTML5, an embedded, cross-browser audio player can be added to a page with five lines of code, and if you want to get really fancy, you can easily use jQuery to add some custom controls.

If you've read any of my previous blogs, you know that I love when I find little code snippets that make life as a web developer easier. My go-to tools in that pursuit are HTML5 and jQuery, so when I came across this audio player, I knew I had to share. There are some great jQuery plugins to play music files on a web page, but they can be major overkill for a simple application if you have to include comprehensive controls and themes. Sometimes you just want something simple without all of that overhead:

Oooh... Ahhh...

That song — Pop Bounce by SoftLayer's very own Chris Interrante — is written in five simple lines of HTML5 code:

<audio style="width:550px; margin: 0 auto; display:block;" controls>
  <source src="http://cdn.softlayer.com/innerlayer/Interrante-PopBounce.ogg" type="audio/ogg">
  <source src="http://cdn.softlayer.com/innerlayer/Interrante-PopBounce.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

If IE 9+, Chrome 6+, Firefox 3.6+, Safari 5+ and Opera 10+ would all agree on supported file formats for the <audio> tag, the code snippet would be even smaller. I completely geek out over it every time I look at it and remember the days of yore. As you can see, the HTML5 application has some simple default controls: Play, Pause, Scan to Time, etc. As a developers, I couldn't help but look for a to spice it up a little ... What if we want to fire an event when the user plays, pauses, stops or takes any other action with the audio file? jQuery!

Make sure your jQuery include is in the <head> of your page:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

Now let's use jQuery to script separate "Play" and "Pause" links ... And let's have those links fire off an alert when they are pressed:

$(document).ready(function(){
  $("#play-button").click(function(){
   $("#audioplayer")[0].play();
   alert('You have played the audio file!');
  })    
 
  $("#pause-button").click(function(){
   $("#audioplayer")[0].pause();
   alert('You have paused the audio file!');
  })    
})

With that script in the <head> as well, the HTML on our page will look like this:

<div class=:"audioplayer">
  <audio id="audioplayer" name="audioplayer" controls loop>
    <source src="http://cdn.softlayer.com/innerlayer/Interrante-PopBounce.ogg" type="audio/ogg">
    <source src="http://cdn.softlayer.com/innerlayer/Interrante-PopBounce.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
  </audio>
 
  <a id="play-button" href="#">Play!</a>
  <a id="pause-button" href="#">Pause!</a>
</div>

Want proof that it works that simply? Boom.

You can theme it any way you like; you can add icons instead of the text ... The world is your oyster. The bonus is that you're using one of the lightest media players on the Internet! If you decide to get brave (or just more awesome), you can explore additional features. You're using jQuery, so your possibilities are nearly limitless. If you want to implement a "Stop" feature (which returns the audio back to the beginning when "Stop" is pressed), you can get creative:

$("#stop-button").click(function(){
    $("#audioplayer")[0].currentTime = 0; // return the audio file back to the beginning
}

If you want to include some volume controls, those can be added in a snap as well:

$("#volumeUp").click(function(){
    $("#audioplayer")[0].volume +=0.1;
}
 
$("#volumeDown").click(function(){
    $("#audioplayer")[0].volume -=0.1;
}

Try it out and let me know what you think. Your homework is to come up with some unique audio player functionality and share it here!

-Cassandra

March 5, 2013

Startup Series: Kickback Tickets

The very first client I recruited to Catalyst when I joined the CommDev team about a year ago happens to be one of Catalyst's most interesting customer success stories ... and I'm not just saying that because it was the first partner I signed on. Kickback Tickets — an online ticketing platform that utilized crowdfunding — has simplified the process of creating and funding amazing events, and as a result, they've made life a lot easier for the startup, developer and networking organizations that fuel Catalsyt.

Anyone who's organized events knows that it often involves a financial risk because it's hard to know whether the event will be well-enough attended to cover the costs of putting on the event. With Kickback Tickets, an event is listed an funded ahead of time, and when it reaches its "Tipping Point" goal of tickets ordered, it's completely funded, the early supporters are charged, and the ticket sales continue.

The process is simple:

Kickback Tickets

Event updates, guest registrations and QR-coded tickets are provided to attendees to make check-in seamless, so the hosts of each event don't have hassle with those details. Kickback's revenue comes from a small fee on each ticket for each successfully funded event, and they've got a ton of momentum. After signing on with Catalyst in March 2012, Kickback went live with an open beta in November 2012, and they launched their out-of-beta site in February 2013. They've successfully funded more than 20 events, and new events are added daily.

Kickback Tickets

When I met the Kickback founders Jonathan Perkins and Julian Balderas, I was attending SF Beta (my first official event as a SLayer). At the time, Jonathan and Julian were a couple of bankers with an innovative idea to help organizations alleviate the financial risk of planning and putting on events by enlisting community support. I told them about my experience as the COO of a small non-profit startup up called Slavery Footprint (also a Catalyst partner), and I guess they could relate to the challenges SoftLayer helped us overcome because they were excited to join.

In their own words, Jonathan and Julian explain that their partnership with Softlayer and the Catalyst program has been extremely valuable:

SoftLayer provides a rock-solid technical foundation and allows us to focus more resources on business development. On the technical side, what Softlayer offers is impressive — super fast speeds and an intricate level of control over the hardware. On the personal side, the mentorship and networking benefits of the program have been very helpful. We've always found the Catalyst team to be available to chat about any questions we had, ranging from development to biz dev to fundraising.

As they continue to expand their platform, it's going to be exciting to watch Kickback become a true force in the events space. Organize your next event with Kickback and make sure it's a success.

Oh, and if you want to speak to Jonathan and Julian, just reach out to me and I'll happily make the introduction.

-@JoshuaKrammes

February 27, 2013

The Three Most Common Hosting-Related Phobias

As a member of the illustrious the SoftLayer sales (SLales) team, I have the daily pleasure of talking with any number of potential, prospective, new and current customers, and in many of those conversations, I've picked up on a fairly common theme: FEAR. Now we're not talking about lachanophobia (fear of vegetables) or nomophobia (fear of losing cell phone contact) here ... We're talking about fear that paralyzes users and holds them captive — effectively preventing their growth and limiting their business's potential. Fear is a disease.

I've created my own little naming convention for the top three most common phobias I hear from users as they consider making changes to their hosting environments:

1. Pessimisobia
This phobia is best summarized by the saying, "Better the devil you know than the devil you don't." Users with this phobia could suffer from frequent downtime, a lack of responsive support and long term commitment contracts, but their service is a known quantity. What if a different provider is even worse? If you don't suffer from pessimisobia, this phobia probably seems silly, but it's very evident in many of the conversations I have.

2. Whizkiditus
This affliction is particularly prevalent in established companies. Symptoms of this phobia include recurring discomfort associated with the thought of learning a new management system or deviating from a platform where users have become experts. There's an efficiency to being comfortable with how a particular platform works, but the ceiling to that efficiency is the platform itself. Users with whizkiditus might not admit it, but the biggest reason they shy away from change is that they are afraid of losing the familiarity they've built with their old systems over the years ... even if that means staying on a platform that prohibits scale and growth.

3. Everythingluenza
In order to illustrate this phobia of compartmentalizing projects to phase in changes, let's look at a little scenario:

I host all of my applications at Company 1. I want to move Application A to the more-qualified Company 2, but if I do that, I'll have to move Applications B through Z to Company 2 also. All of that work would be too time-consuming and cumbersome, so I won't change anything.

It's easy to get overwhelmed when considering a change of cloud hosting for any piece of your business, and it's even more intimidating when you feel like it has to be an "all or nothing" decision.

Unless you are afflicted with euphobia (the fear of hearing good news), you'll be happy to hear that these common fears, once properly diagnosed, are quickly and easily curable on the SoftLayer platform. There are no known side effects from treatment, and patients experience immediate symptom relief with a full recovery in between 1-3 months.

This might be a lighthearted look at some quirky fears, but I don't want to downplay how significant these phobias are to the developers and entrepreneurs that suffer from them. If any of these fears strike a chord with you, reach out to the SLales team (by phone, chat or email), and we'll help you create a treatment plan. Once you address and conquer these fears, you can devote all of your energy back to getting over your selenophobia (fear of the moon).

-Arielle

Categories: 
February 20, 2013

Global Game Jam: Build a Video Game in 48 Hours

You're a conflicted zombie that yearns to be human again. Now you've got to dodge grandma and babies in an 8-bit side-scroller. Now you're Vimberly Koll, and you have to stop Poseidon from raining down on the Global Game Jam. At the end of Global Game Jam Vancouver, teams of developers, 3D artists, level designers and sound engineers conceptualized and created these games (along with a number of others) in less than 48 hours. Building a game in a weekend is no small task, so only the best and brightest game developers in the world converge on over 300 sites in 63 countries to show off their skills.

For the fifth annual Global Game Jam, more than 16,000 participants committed a weekend to learning from and collaborating with their peers in a worldwide game development hackathon. I was lucky enough to get to sit in on the action in Vancouver, and I thought I'd give you a glimpse into how participants make game development magic happen in such a short period of time.

Vancouver Global Game Jam

Day 1 (Friday Night): The Brainstorm
More than 260 participants poured into an open study area of the Life Sciences building at the Univerity of British Columbia to build the next best distraction ... er, video game. The event kicked off with a keynote from Brian Proviciano, a game development prodigy, who shared his history and offered sage advice for those interested in the industry. Following a comical 20-second idea pitch session, the caffeine began to flow and the brainstorm commenced.

Inspiration could come from anywhere, and a perfect example is the "Poseidon" game I mentioned above: GGJVancouver organizer Kimberly Voll had sprinklers rain on her office a few days prior to the event, so someone decided to make a game out of that situation. This year, the Global Game Jam introduced an interesting twist that they called "diversifiers." Diversifiers are side-challenges for extra credit, and two of my favorites were "Atari Age" — the game has to be smaller than 4kb — and "May the (Web) Force be With You" — the game has to run in a browser.

Fast-forward two hours, and as you look around, you see storyboards and scripts being written, characters being born, and a few intrepid developers starting to experiment with APIs, game engines , and external controllers to find some additional flair for their final products. You wouldn't expect a game made in 48 hours to incorporate an iOS Eye Tracking API or the Leap Motion gesture controller, but these developers are ambitious!

As the concepts are finalized, team members rotate in and out for sleep, and some even go home to get some rest — a good idea on the first night since everyone usually pulls an all-nighter on Saturday.

Vancouver Global Game Jam

Day 2 (Saturday): Laying the Foundation
It was cool to walk the aisles and peer over peoples' shoulders as musical scores, wrangled code and character models were coming together. However, the scene wasn't all smiles and hugs; a few groups were wrestling quirky bugs and integration issues, and in some cases, they ended up having to completely reboot their approach. Day 2 set the course for all of the teams. A few teams disbanded due to disagreements or unfixable bugs, and some developers peeled off from their teams to follow an untamed passion. In the Global Game Jam, there are no rules ... only games.

Vancouver Global Game Jam

Day 3 (Sunday): Sleep, What's That?
By Day 3, the building starts feeling like a college dorm during finals week when everyone is staying up all night to study or finish their comp-sci assignments (I know it wasn't just me...). Running on various vehicles of caffeine, teams worked heads-down all day to meet their 3pm deadline. Sighs of relief and high fives were exchanged when the games were submitted, and the event concluded with a pizza party and demo session where everyone could see and share the fruits of their labor.

Vancouver Global Game Jam

As I left the conference, teams were given the opportunity to showcase their games on the big screen to a chorus of laughter and applause. It was an awesome experience, and I'm glad SoftLayer sponsored it so that I could attend, take it all in and meet a ton of outstanding up-and-coming game developers. If you're into making games (or you've thought about it), check out the Global Game Jam one of these years.

Just don't forget to bring deodorant ... for your neighbor's sake.

-@andy_mui

Photo Credit Shout-Outs: Alex Larente, Ligia Brosch, Naz Madani. Great shots!

February 18, 2013

What Happen[ed] in Vegas - Parallels Summit 2013

The Las Vegas Convention and Visitors Authority says, "What happens in Vegas, stays in Vegas," but we absconded from Caesars Palace with far too many pictures and videos from Parallels Summit to adhere to their suggestion. Over the course of three days, attendees stayed busy with presentations, networking sessions, parties, cocktails and (of course) the Server Challenge II. And thanks to Alan's astute questions in The Hangover, we didn't have to ask if the hotel was pager-friendly, whether a payphone bank was available or if Caesar actually lived at the hotel ... We could focus on the business at hand.

This year, Parallels structured the conference around three distinct tracks — Business, Technical and Developer — to focus all of the presentations for their most relevant audiences, and as a result, Parallels Summit engaged a broader, more diverse crowd than ever before. Many of the presentations were specifically geared toward the future of the cloud and how businesses can innovate to leverage the cloud's potential. With all of that buzz around the cloud and innovation, SoftLayer felt right at home. We were also right at home when it came to partying.

SoftLayer was a proud sponsor of the massive Parallels Summit party at PURE Nightclub in Caesar's palace on the second night of the conference. With respect to the "What Happens in Vegas" tagline, we actually powered down our recording devices to let the crowd enjoy the jugglers, acrobats, drinks and music without fear of incriminating pictures winding up on Facebook. Don't worry, though ... We made up for that radio silence by getting a little extra coverage of the epic Server Challenge II competition.

More than one hundred attendees stepped up to reassemble our rack of Supermicro servers, and the competition was fierce. The top two times were fifty-nine hundredths of a second apart from each other, and it took a blazingly fast time of 1:25.00 to even make the leader board. As the challenge heated up, we were able to capture video of the top three competitors (to be used as study materials for all competitors at future events):

It's pretty amazing to see the cult following that the Server Challenge is starting to form, but it's not very surprising. Given how intense some of these contests have been, people are scouting our events page for their next opportunity to step up to the server rack, and I wouldn't be surprised to see that people are mocking up their own Server Challenge racks at home to hone their strategy. A few of our friends on Twitter hinted that they're in training to dominate the next time they compete, so we're preparing for the crowds to get bigger and for the times to keep dropping.

If you weren't able to attend the show, Parallels posted video from two of the keynote presentations, and shared several of the presentation slide decks on the Parallels Summit Agenda. You might not get the full experience of networking, partying or competing in the Server Challenge, but you can still learn a lot.

Viva Las Vegas! Viva Parallels! Viva SoftLayer!

-Kevin

February 15, 2013

Cedexis: SoftLayer "Master Model Builder"

Think of the many components of our cloud infrastrucutre as analogous to LEGO bricks. If our overarching vision is to help customers "Build the Future," then our products are "building blocks" that can be purposed and repurposed to create scalable, high-performance architecture. Like LEGO bricks, each of our components is compatible with every other component in our catalog, so our customers are essentially showing off their Master Model Builder skills as they incorporate unique combinations of infrastructure and API functionality into their own product offerings. Cedexis has proven to be one of those SoftLayer "Master Model Builders."

As you might remember from their Technology Partner Marketplace feature, Cedexis offers a content and application delivery system that helps users balance traffic based on availability, performance and cost. They've recently posted a blog about how they integrated the SoftLayer API into their system to detect an unresponsive server (disabled network interface), divert traffic at the DNS routing level and return it as soon as the server became available again (re-enabled the network interface) ... all through the automation of their Openmix service:

They've taken the building blocks of SoftLayer infrastructure and API connectivity to create a feature-rich platform that improves the uptime and performance for sites and applications using Openmix. Beyond the traffic shaping around unreachable servers, Cedexis also incorporated the ability to move traffic between servers based on the amount of bandwidth you have remaining in a given month or based on the response times it sees between servers in different data centers. You can even make load balancing decisions based on SoftLayer's server management data with Fusion — one of their newest products.

The tools and access Cedexis uses to power these Openmix features are available to all of our customers via the SoftLayer API, and if you've ever wondered how to combine our blocks into your environment in unique, dynamic and useful ways, Cedexis gives a perfect example. In the Product Development group, we love to see these kinds of implementations, so if you're using SoftLayer in an innovative way, don't keep it a secret!

-Bryce

February 14, 2013

Tips and Tricks – Building a jQuery Plugin (Part 2)

jQuery plugins don't have to be complicated to create. If you've stumbled upon this blog in pursuit of a guide to show you how to make a jQuery plugin, you might not believe me ... It seems like there's a chasm between the "haves" of jQuery plugin developers and the "have nots" of future jQuery developers, and there aren't very many bridges to get from one side to the other. In Part 1 of our "Building a jQuery Plugin" series, we broke down how to build the basic structure of a plugin, and in this installment, we'll be adding some usable functionality to our plugin.

Let's start with the jQuery code block we created in Part 1:

(function($) {
    $.fn.slPlugin = function(options) {
            var defaults = {
                myVar: "This is", // this will be the default value of this var
                anotherVar: "our awesome",
                coolVar: "plugin!",
            };
            var options = $.extend(defaults, options);
            this.each(function() {
                ourString = myVar + " " + anotherVar + " " + coolVar;
            });
            return ourString;
    };
}) (jQuery);

We want our plugin to do a little more than return, "This is our awesome plugin!" so let's come up with some functionality to build. For this exercise, let's create a simple plugin that allows truncates a blob of text to a specified length while providing the user an option show/hide the rest of the text. Since the most common character length limitation on the Internet these days is Twitter's 140 characters, we'll use that mark in our example.

Taking what we know about the basic jQuery plugin structure, let's create the foundation for our new plugin — slPlugin2:

(function($) {
    $.fn.slPlugin2 = function(options) {
 
        var defaults = {
            length: 140,
            moreLink: "read more",
            lessLink: "collapse",
            trailingText: "..."
        };
 
        var options = $.extend(defaults, options);
    };
})(jQuery);

As you can see, we've established four default variables:

  • length: The length of the paragraph we want before we truncate the rest.
  • moreLength: What we append to the paragraph when it is truncated. This will be the link the user clicks to expand the rest of the text.
  • lessLink: What we append to the paragraph when it is expanded. This will be the link the user clicks to collapse the rest of the text.
  • trailingText: The typical ellipses to append to the truncation.

In our jQuery plugin example from Part 1, we started our function with this.each(function() {, and for this example, we're going to add a return for this to maintain chainability. By doing so, we're able to manipulate the segment with methods. For example, if we started our function with this.each(function() {, we'd call it with this line:

$('#ourParagraph').slPlugin2();

If we start the function with return this.each(function() {, we have the freedom to add further manipulation:

$('#ourParagraph').slPlugin2().bind();

With such a simple change, we're able to add method calls to make one massive dynamic function.

Let's flesh out the actual function a little more. We'll add a substantial bit of code in this step, but you should be able to follow along with the changes via the comments:

(function($) {
    $.fn.slPlugin2 = function(options) {
 
        var defaults = {
            length: 140, 
            moreLink: "read more",
            lessLink: "collapse",
            trailingText: "..."
        };
 
        var options = $.extend(defaults, options);
 
        // return this keyword for chainability
        return this.each(function() {
            var ourText = $(this);  // the element we want to manipulate
            var ourHtml = ourText.html(); //get the contents of ourText!
            // let's check if the contents are longer than we want
            if (ourHtml.length > options.length) {
                var truncSpot = ourHtml.indexOf(' ', options.length); // the location of the first space (so we don't truncate mid-word) where we will end our truncation.
 
   // make sure to ignore the first space IF the text starts with a space
   if (truncSpot != -1){
       // the part of the text that will not be truncated, starting from the beginning
       var firstText = ourHtml.substring(0, truncSpot);
 
       // the part of the text that will be truncated, minus the trailing space
       var secondText = ourHtml.substring(truncSpot, ourHtml.legnth -1);
                }
            }
        })
    };
})(jQuery);

Are you still with us? I know it seems like a lot to take in, but each piece is very straightforward. The firstText is the chunk of text that will be shown: The first 140 characters (or whatever length you define). The secondText is what will be truncated. We have two blobs of text, and now we need to make them work together:

(function($) {
    $.fn.slPlugin2 = function(options) {
 
        var defaults = {
            length: 140, 
            moreLink: "read more",
            lessLink: "read less",
            trailingText: "..."
        };
 
        var options = $.extend(defaults, options);
 
        // return this keyword for chainability
        return this.each(function() {
            var ourText = $(this);  // the element we want to manipulate
            var ourHtml = ourText.html(); //get the contents of ourText!
            // let's check if the contents are longer than we want
            if (ourHtml.length > options.length) {
                var truncSpot = ourHtml.indexOf(' ', options.length); // the location of the first space (so we don't truncate mid-word) where we will end our truncation.
 
   // make sure to ignore the first space IF the text starts with a space
   if (truncSpot != -1){
       // the part of the text that will not be truncated, starting from the beginning
       var firstText = ourHtml.substring(0, truncSpot);
 
       // the part of the text that will be truncated, minus the trailing space
       var secondText = ourHtml.substring(truncSpot, ourHtml.legnth -1);
 
       // perform our truncation on our container ourText, which is technically more of a "rewrite" of our paragraph, to our liking so we can modify how we please. It's basically saying: display the first blob then add our trailing text, then add our truncated part wrapped in span tags (to further modify)
       ourText.html(firstText + options.trailingText + '<span class="slPlugin2">' + secondText + '</span>');
 
       // but wait! The secondText isn't supposed to show until the user clicks "read more", right? Right! Hide it using the span tags we wrapped it in above.
       ourText.find('.slPlugin2').css("display", "none");
                }
            }
        })
    };
})(jQuery);

Our function now truncates text to the specified length, and we can call it from our page simply:

<script src="jquery.min.js"></script>
<script src="jquery.slPlugin2.js"></script>
<script type="text/javascript">
$(document).ready(function() {  
    $('#slText').slPlugin2();  
});
</script>

Out of all the ways to truncate text via jQuery, this has to be my favorite. It's feature-rich while still being fairly easy to understand. As you might have noticed, we haven't touched on the "read more" and "read less" links or the expanding/collapsing animations yet, but we'll be covering those in Part 3 of this series. Between now and when Part 3 is published, I challenge you to think up how you'd add those features to this plugin as homework.

-Cassandra

February 12, 2013

From the Startup Trenches to the Catalyst War Room

Before joining SoftLayer, I was locked in a dark, cold room for two years. Sustained by a diet of sugar and caffeine and basking in the glow of a 27" iMac, I was tasked with making servers dance to the tune of Ruby. The first few months were the toughest. The hours were long, and we worked through holidays. And I loved it.

If that work environment seems like torture, you probably haven't been on the front lines of a development team. I was a member of a band of brothers at war with poorly documented vendor APIs, trying to emerge victorious from the Battle of Version 1.0. We operated (and suffered) like a startup in its early stages, so I've had firsthand experience with the ups and downs of creating and innovating in technology. Little did I know that those long hours and challenges were actually preparing me to help hundreds of other developers facing similar circumstances ... I was training to be a Catalyst SLayer:

Catalyst Team

You probably know a lot about Catalyst by now, but one of the perks of the program that often gets overshadowed by "free hosting" is the mentorship and feedback the SoftLayer team provides every Catalyst participant. Entrepreneurs bounce ideas off of guys like Paul Ford and George Karidis to benefit from the years of experience and success we've experienced, and the more technical folks can enlist our help in figuring out more efficient ways to tie their platforms to their infrastructure.

When I was forging through the startup waters, I was fortunate to have been supported by financially reinforced walls and the skilled engineers of a well-established hosting company in Tokyo. Unfortunately, that kind of support is relatively uncommon. That's where Catalyst swoops in. SoftLayer's roots were planted in the founders' living rooms and garages, so we're particularly fond of other companies who are bootstrapping, learning from failure and doing whatever it takes to succeed. In my role with Catalyst, I've effectively become a resource for hundreds of startups around the world ... and that feels good.

Five days before my official start date, I receive a call from Josh telling me that we'd be spending my first official week on the job in Seattle with Surf Incubator and Portland with Portland Incubator Experiment (PIE). While the trip did not involve carving waves or stuffing our faces with baked goods (bummer), we did get to hear passionate people explain what keeps them up at night. We got to share a little bit about SoftLayer and how we can help them sleep better (or fuel them with more energy when they're up at night ... depending on which they preferred), and as I headed back to Los Angeles, I knew I made the right choice to become a SLayer. I'm surrounded by energy, creativity, passion, innovation and collaboration on a daily basis. It's intoxicating.

TL;DR: I love my job.

-@andy_mui

Pages

Subscribe to infrastructure