Ignored By Dinosaurs 🦕

You've all seen it. It's right under the to: field when you compose an email. No, not CC, but BCC. That stands for “Blind Carbon Copy”. The purpose of this little feature isn't just to send copies of important emails to yourself for archival purposes. Let's have an example...

Let's say you have a really enthusiastic bud-die that's always sending links to music that he's uploaded to all his friends. You hugely appreciate the thought every time you get one of his treats. But then it happens. Someone accidentally hits “reply all” on the email. Pretty soon one person's personalized shout out is sent to the entire list, even though the intended recipient is only one person. How best to avoid this faux pas petit? Blind Carbon Copy.

Ideally, you'd put yourself in the to: field and everyone else in the BCC field. This way, not only are you not exposing the email addresses of all of your friends to the whole world, when someone inevitably hits the “reply all” button, it's cool. They don't have any names on the list except the original sender, and the world is just that much happier.

Thus concludes today's lesson in etiquette and irony from yours truly.

“When U2 takes the stage in Los Angeles' Rose Bowl Stadium this Sunday, fans in the United States and 15 other countries will be able to watch the whole show, live and for free, on YouTube — the first time the website has ever broadcast a complete concert live.”

Are you kidding me? This is the first time that YouTube has broadcast a concert live? Did I somehow get teleported back to 2006? I would think that news of this nature would seem a lot more like news back then, but seriously?

The first time ever?

Maybe I'm not as late to the party as I thought with all this, y'know, technology stuff. I guess giant-mega-corp will always move this slowly. Is it already time to add Google to the Dinosaur List?

U2 to Play Free Concert on YouTube (Via Epicenter.)

This is not for programmers. This is for myself, because when I first started poking at Rails 6 months ago, I didn't have any idea why I needed to edit a migration file, much less what a migration was, except that it must have something to do with a database. I only knew that because of the command

$>rake db:migrate

that I was told to perform and the fact that it had the letters “db” in it.

So here's the deal. This morning I talked about version control and it's place in the life cycle of your application. What version control does is keep track of the changes that you make to your applications source code from start to finish (whenever that is). The only problem with this is that a big chunk of the data and functionality of a modern web application doesn't reside in the app's source code, it resides in the database, and nobody has invented an efficient version control system for a database yet. Some friends of mine have tipped me off to different methods that they've used – mostly around writing down DB schema changes into a text file that then gets placed under version control with the rest of the source. That's not entirely efficient, though, is it?

Ruby on Rails has come up with a system called “migrations”. Actually, someone surely came up with this way before Rails was invented, but I'm new here, so feel free to correct me in the comments section down there. Let's say you create a new rails app (This is directly from the awesome book “Agile Web Development with Rails” by a bunch of smart folks, and this example is the beginning of building a shopping cart system) :

$>rails newapp

This generates a load of boilerplate code which makes up the bones of any Rails app. That means that instead of spending the first week of the development cycle sitting there writing low-level code that provides primordial programmatic structure, you can spend it writing code that actually does something that you (or your client) can interact with. Let's keep it as simple as possible and say that you are going to have three fields that will be stored in the database to start. Rails let's you run this scaffold generating command:

$>ruby script/generate scaffold product title:string description:text image_url:string

This command runs a ruby script that builds a LOT of code for you, so much that you're only minutes away from tinkering around and you only started a few minutes before that. This command creates the “products model”, which is how a programmer says that they are going to start by creating some place for the admin to store the products that they want to sell online. The fields that were initially created were for the name of the product, the description, and the URL where you're storing the picture of the product. Don't worry about it too much, but take a look at the command up there, it'll make sense if you know what a string is. Just know that the data entered into these fields is going to get stored in a database. Wait, how are we gonna store this stuff in our database? Have we even created the tables for the database yet? No. Rails does it for us. Here's how.

One of the files that is created when we run that scaffold generator is called a “migration file”. This migration file is what actually creates the tables in the database, the columns in the tables, and can even populate the tables with data (used for testing), depending on what you do to the migration file. There is a command (or method if you're OOP savvy) created when the scaffold is run called the “up method”. That's the one that changes your database. There is also a “down method”, which is what undoes the changes to your database. When you run the good old rake db:migrate command Rails goes applies the appropriate changes to your database for you, and provides a way to undo them later. So, your client comes in and wants to add a Price column to the store. In the old days, you'd execute this SQL statement :

ALTER TABLE products ADD column price DECIMAL (8,2) NOT NULL;

Now, what if you wanted to undo that? That's a command you ran there, not some source code that you can save and delete later if you change a few things. You can't place SQL statements under version control. You'd have to go and type that statement into the text file that was under version control, and then hope that you could effectively backtrack to it later if you wanted. If your application and it's database have come a ways since that command you're going to have a good time figuring out how to undo it. Rails doesn't make you do that. In fact, you almost never are going to talk directly to your database in Rails. Instead, you go to the most recent migration file (which is source code and thus under version control) and alter a line to look like this:

add_column :products, :price, :decimal,
  :precision => 8, :scale => 2, :default => 0

Then you run a script that alters the database for you. Below this add column instruction, or “up method”, you add the remove column instruction, or “down method”:

remove_column :products, :price

This is the undo button for your database and any schema changes along the way. Since this command is under version control, and since you're not directly interacting with your database, and since Rails knows how and which migrations to apply and in what order if you ever want to go back to a previous version, you've just made your life a LOT easier. Now if you only understood what the hell you were talking about!!

For a vastly better explanation, try here. Good luck.

#rails #general-development

It appears that the creative fire feels like being spent on writing again, finally. So if may I impart a bit of what I've learned in the last few months...

Before you set up that Blogspot account, I just want to call your attention to a few of the other offerings out there. Blogger/Blogspot is an extremely simple way to get going, but there are even simpler ways to get going, if that's what you're going for. There are also offerings out there that will allow you a much greater amount of flexibility in what you do with your new blog, should you want to go bigger. And now...

My new favorite social website is Tumblr, hands down. Right there on the front page of the site, in 40 pt font is the slogan “the easiest way to blog”. I'd have to agree. You don't have to give them anything about your identity if you don't want, and you can create your own subdomain, just like Blogger. What Tumblr has over Blogger is a much more refined design. There are a bunch of templates to choose from, just like Blogger, but I find them to be a little more easy on the eyes, and thus easier to read and navigate – all important to the blogging experience, wouldn't you say? If all you want to do is start letting some of your thoughts out of your head in blog form, give it a whirl. Oh yeah, you can point your own domain at Tumblr instead of using whatever.tumblr.com as your URL.

If you need to build something a little more extensive, say a website for your classroom's parents to keep up with their kids and their activities, I'd highly recommend Wordpress.com. They too have a number of different design templates to choose from (though not as many as Tumblr), so setting up a blog that feels like you isn't too much of a challenge. The great thing about Wordpress, the framework on which this website also runs, is that you can build outward. Say you want to have a contact page, and a calendar of events on another page, etc, you can do that pretty easily (and quickly) with Wordpress. Hopefully my buddy Jimmy doesn't mind my linking to his classroom website as a fantastic example of what a smart person can do with WordPress in a short amount of time.

You really should have a blog by this point. Make it recipes or pictures or whatever, but it's free and it's fun. Just do it...

So it's been a while, eh? Not too much in the mood to write about what I've learned when most of what I've learned is how much I have to learn, y'know? Anyway, I've been back into Ruby on Rails lately, since Ruby has got to be the dead simplest real programming language out there. Oh yeah, and I have a major project cooking on Rails, but I'll elaborate later. Let's talk about version control...

Let's pretend you're typing that last term paper in college. This is the modern era, so we're using a word processing program. That program has eaten a few of our papers over the course of our college career, so we know to save our paper often. This is a huge paper, so we've also decided that it'd be prudent to save it under different names as it progresses so that we can go back in time to an earlier version with no hassle, y'know just in case we stray too far from the objective in the future. This is basically the same idea behind version control.

When dudes or dudettes are sitting at their text editors coding away at whatever they're coding, in whatever language, they're typing characters into a keyboard, just like I am now. The difference with software is that there are usually numerous files that all relate to each other in some way, and a change in any one of those files will impact the entire application. So say you make one little change here and another little change there, and then you skip over to another file and make a change there, and then you skip over to another file and make a couple of changes there. How the hell are you supposed to keep track of all that? Version control.

Whatever the flavor – CVS, Subversion, Git – all version control systems track changes made to the files in your fledging (or production) application. The manner in which they do this varies from system to system, and they all have their proponents and detractors, but that you have GOT to be familiar with at least one of them is beyond dispute. These will give you the ability to hack around all you want in the comfort of knowing that you can roll these changes back if you're not getting anywhere.

Now, the only problem with all of these version control systems is that they don't track changes to databases. The reason that this is a big deal is that the vast majority of large, modern, dynamic websites store a lot of data in their database. Some content management systems like Drupal actually store templates that determine how the website gets rendered to your browser in their database by default. You can change this if you know what you're doing, and that assumes a lot. Nothing is going to change the fact that many database powered websites have to occasionally make changes to the layout (schema) of their database to incorporate new features and the like. The new Like feature on that site probably has it's value stored in a column somewhere in a database. What if that feature sucks or is buggy? How can you roll back a database to an earlier state without using up your quota of blood pressure meds too soon? Under traditional version control systems, you can't.

Luckily, someone has figured this out for us. It's called a “migration”. I'll be back. I promise...

#general-development

Finding Your Co-Founders: “The hardest part of starting from scratch is finding the right co-founders. Ideas, comparatively, are easy. You may spend three years finding your co-founders while you'll come up with a solid idea every 3 months or so. Luckily, once you settle into a great founding team you'll be able to execute much faster on that killer idea you all come up with – beating those ten other folks who came up with the same idea at the same time.”

Yes.

(Via TechCrunch.)

Communities of Creators: “What I've found, though, is that being part of an active, ambitious, supportive and diverse community of peers is just as valuable, if not more so, than any of the more prosaic prerequisites for success.”

I'll bet that's true. Maybe I'll find out someday.

(Via Anil Dash.)

It's been an inordinately long break, friends, and for that I apologize. I've been engaged on a weeks-long bender of brain expanding self-education on many fronts, plotting medium and long term career paths, taking stock of the current situation and options. For fans of the band I'm in, have no fear, I have no options at this point. The dearth of verbiage here goes hand in hand with the intense push to expand the possibilities there.

A f-ing killer free programming class that some kind dude just started yesterday on Reddit. Anyone who's at all curious about how computers work or and of this stuff might want to have a look...

Programming Classes.

Traveling, of course. By myself, of course. In Georgia. Train terminal in middle GA, taking a train to Europe. Forgot my wallet – had to go back and get it. got lost. Couldn't find my way, repeatedly. Ended up in McDonough, but it was huge and congested. Met some hippy kids. Ended up at a music store. Ended up in the rain. Ended up outside McDonough and it was a giant city on a hill. Beautiful.

Was telling Michelle about it and she said it sounded like my life.