HeyCarsten


What If SMS Was Your Internet Connection?

May 22, 2009

3 Comments

WARNING: This is a total rant, I don’t know how cell networks actually work. If you know what you are talking about please explain why it makes sense to charge 15 cents per message in the comments.

There are a lot of things that piss me off about Canada’s cellphone providers, and lots of people have touched on them in detail already. What pisses me off the most though is what they charge for SMS messaging.

SMS is low priority data, meaning it gets there when it gets there. It’s almost obscene that they even charge us to send SMS messages at all. Let’s look at this a different way, what if you relied on SMS as your internet connection?

  • A packet is 160 bytes plus some overhead, let’s say 256 bytes.
  • Lets say on average it takes 4 seconds to go from source to destination: (256 / 4) = 64 bytes per second
  • That translates to 512 bps (bits per second)
  • 512 bps is about 90 times slower than your average 56k modem (assuming an actual connection speed of 46000 bps) and about 5 times slower then your 2400 baud modem circa 1987.

So your Internet connection would be ridiculously slow and unreliable, but how much would it cost? Well let’s assume Rogers' standard rate of 15 cents per message (or every 256 bytes in our case.) Last month I used 18 GB of download bandwidth and 4 GB of upload bandwidth so it would have cost me $138,412.03… Oh, and it would have taken me 719 years to download.

Unobtrusive Auto-Completing Text Fields With Prototype & Scriptaculous

December 17, 2008

2 Comments

I recently had to add some auto completion behavior to a few text fields in a Rails project. Rails used to have a view helper for this baked-in, it’s a plugin now, but I never really liked working with it. I hate farting <script> elements throughout my HTML for functionality like this, it looks dirty and just feels wrong to me.

My goal was to go from something nasty like this:


<input type='text' name='school[name]' id='school_name_1' />
<div class='autocompleter-choices' id='school_name_1_completer'></div>
<script type='text/javascript'>
//<![CDATA[
new Ajax.Autocompleter(
  'school_name_1',
  'school_name_1_completer',
  '/schools/autocompleter/search',
  { 'paramName' : 'q' }
);
//]]>
</script>

To something simple and elegant like this:


<input type='text' name='school[name]' autocompleter='/schools/autocompleter/search' />

My solution was to do it unobtrusively with some straight-forward Javascript:


Helpers.TextFieldAutocompleters = {

  init : function()
  {
    $$('input[autocompleter]').each(function(input) {
      var url = input.readAttribute('autocompleter');
      var container = new Element('div', { 'class' : 'autocompleter-choices' });
      input.insert({ 'after' : container });
      new Ajax.Autocompleter(input.identify(), container.identify(), url, {
        'paramName' : 'q'
      });
    });
  }

}

Event.observe(window, 'load', function() {
  Helpers.TextFieldAutocompleters.init();
});

Lets have a quick look at what I am doing here:

  • I use Prototype’s $$ utility method to grab all of the <input> elements on the page that have an autocompleter attribute.
  • I insert an anonymous <div> below each <input> to contain the <ul> of results returned by the server.
  • I use Prototype’s Element.identify() method to automatically generate DOM IDs for the anonymous/potentially anonymous container <div> and <input> elements.
  • I create a new Scriptaculous Ajax.Autocompleter that will submit to the path indicated in the <input> element’s autocompleter attribute and use ‘q’ as the param name.

That’s all there is to it!

The Rest Of It

This is the controller action:


def autocompleter_search
  @schools = School.name_like(params[:q]).all(:limit => 8)
  t = []
  t << '%ul'
  t << '  - @schools.each do |school|'
  t << '    %li= highlight h(school), h(params[:q])'
  template = t.join("\n")
  respond_to do |format|
    format.js   { render :inline => template, :type => :haml }
    format.html { render :inline => template, :type => :haml }
  end
end

The named_scope I'm using for the above School finder:


named_scope :name_like, lambda { |name|
  { :conditions => ['`name` LIKE ?', "%#{name}%"],
    :order => '`name` ASC' } }

And the styles I use for the choices list:


.autocompleter-choices
  :background #fff
  :border 1px solid #8caddd
  :margin-top -1px
  ul
    :padding 2px
    li
      :padding 3px
      em
        :font-weight bold
        :font-style normal
      &.selected
        :background #f6eda9

That didn’t hurt one bit!

Waking Up The Brain

October 26, 2008

7 Comments

Before the first revision of a comp or the first passed test, I find the biggest problem I face is finding a way to harness my creative wit and direct it towards a new problem. Getting focused when there are all kinds of ideas, deadlines, demands and expectations floating around your noggin is a must, but it’s not always easy.

I'm going to share some methods that I use to get back on track and focus my creative and analytical energy. Sometimes I follow my process start to end and sometimes I jump straight to brainstorming, it depends on my state of mind at the time. I hope you enjoy!

Contour Drawing

Contour drawing is often my first step when I've been extremely focused on other things and in need of a reset. I find it really cleans my mind’s slate, sort of like shaking an Etch-A-Sketch. I like to start off blind contour and then move my way to modified contour.

Freestyle (Writing & Drawing)

I find it necessary to turn up the crazy and focus in on something new and offbeat to get myself in the mood for some design and analysis. I usually put on my headphones and queue up some music. I start writing and doodling arbitrarily at first, and then gradually transition towards the topic I'm going to be brainstorming.

I sometimes write a dialog between two characters with opposing opinions or about a feeling or experience that I've never felt or had. I will often draw haphazardly; creating a form and then just adding other forms onto it transforming it into whatever. Sometimes if I really need to think differently, I’ll draw a Rube Goldberg machine in some form.

They key with freestyle I find is to avoid stopping and thinking about something else so you don’t interrupt your flow of ideas. Freestyle is a preparatory process for me that leads to brainstorming.

Brainstorming

After contour drawing and/or some freestiling, I start focusing in again. I feel refreshed and I find it much easier to form and output tangible ideas. At this stage I’ll use a little color to spice things up, but often it’s just black ink on layout stock. You could get fancy and use a four color ballpoint like Ed Fella, but that seems like a lot of work to me.

Brainstorming for me is sort of like a formal form of freestyle, I force myself to stay on topic, and I create things that I might show other people. These range from the infamous word cloud, to comprehensive wireframes, and sometimes even code. It’s not uncommon for me to draw a wireframe and also the structure of it’s markup.

Often times I brainstorm my initial ideas independently and in silence. However, when I'm far enough along in the creative process I like to share the activity with other designers and developers, and sometimes friends or other coworkers.

Final Thoughts

I found it tough at first to be this raw. It wasn’t easy until I came to the realization that it’s okay to be bogus. Just because I draw or write something doesn’t automatically make it a direct reflection of who I am and I don’t have to put everything I make on public display. After those realizations I was free to experiment, and able to let myself wander areas of my mind that I'd never been.

Seven Ways To Get Out of The Basement

October 10, 2008

6 Comments

I am really happy where I am right now. It’s hard to think that not too long ago, I was in my parents' basement dreaming of working in the big city and building an awesome product —– stuck in a rut of sorts. I'm going to share the values that I feel helped me get out of that rut and move beyond the basement.

1. You Must Have Passion

Passion is your fuel, you need passion! It’s the only way you will be disciplined enough to be able to fight down the odds. If you’re not thinking about it day and night, living and breathing it, then it might not be for you. Passionate people enjoy the company of other passionate people, you want to know passionate people… see where I'm going with this?

2. ‘No’ is a Statement, Not An Answer

Before I decided to take a different approach I tried to get into YSDN two times and Ryerson Image Arts once. It was at the end of my second interview at YSDN that I was told to stop learning on my own until I get the first few years of a BA out of the way, then try applying again.

You will meet a lot of different people along the way, many of which will not share your passion. Politely thank them for their opinion, then visualize yourself in the future telling them they were wrong. You’re on the fringe with your scary, self-disciplined ways, and you are going to be going against the grain of many people.

3. Get Out There And Mingle

A lot of people in my life have just finished university or college and want to get started doing something they love, but how? From my experience handing out resumes and the like won’t get you nearly as far as mingling with the people in your industry.

I'm lucky that there is a very visible technology community in Toronto and tons of free or almost free events all of the time. I met my first employer at a free event, and I met John and Malgosia at a moving party for the company that organizes that event.

I always thought the best events were the free ones, my opinion changed this summer though. I attended a conference that was worth every dollar. I've also attended some other conferences that were not worth their weight in silly clown noses. I will say that for the most part, you get back what you put into these things.

Take a chance, get out there and meet people! Even if it means spending some money that you might not have. I'm sure you've spent money on less important things.

4. Don’t Turn Down Any Opportunity

My first job in Toronto was at a company called TSOT, their product was a social network for fraternities, not really something I'm personally interested in. However, for a guy with pretty much zero programming experience at the time it was a rare opportunity. If I brushed it off, I might still be in basement land.

5. You Know Nothing

Humility is your best friend! You are surrounded by people who know a lot more than you, and if you aren’t then maybe it’s time to smarten up. As soon as you start to feel comfortable, be terrified. You’re not all that great at whatever it is you do, and you have a lot to learn from a lot of people. Embrace it, love it.

Another part of this is accepting criticism gracefully. It’s only criticism, you don’t have to act on it, but it should always cause you to think twice. If you don’t listen to other peoples' opinions about your work then you are missing out on a huge amount of opportunity. The twist to this is that you can really learn a lot about someone in the way that they deliver their criticisms to you.

6. Don’t Let The Haters Get You Down

You are always going to encounter toxic people that simply don’t like you. Maybe they are jealous and feel threatened by you and your kind or maybe they were born without genitalia and are just generally miserable, or maybe you can be a bit of a condescending asshole at times. Whatever the case, being pissed off is not going to help. So bitch about it on Twitter and move on.

7. Stay Absolutely Positive

You’re doing what you love, after all! And if not, then why not?