00:00:14.839
Right, we'll start with lightning talks. I don't know what they are, but they're in a line, and so they're just going to talk and tell you who they are and what they're talking about. All right, I'm David Brady, and my timer is now behind. Oh well!
00:00:20.640
So last year, my New Year's resolution was to ship code every single day, and it was pretty awesome, actually. I never wanted for a lightning talk at any of the conferences. I started about 30 projects on GitHub, contributing to many other projects as well, and it was a really good experience. I didn't go all year; I ended the experiment about 115 days in. I didn't give up; I just decided I learned what I wanted from this, and I'm done.
00:00:47.160
If it's all right with you guys, I'm going to tell you how to do this. I'm going to recommend that you learn how because it's actually kind of awesome, and then I'm going to suggest when you might not want to. So step one is just to do it once. There's no trick to this. Anytime somebody says there's no trick, they usually end up saying, 'But it's just hard work.' And anybody who knows me knows that if it's hard work, I'm out. This is not hard work.
00:01:05.478
Okay, it's really easy. All you have to do is have clear rules, lower your standards, and then lower your Epsilon. Clear rules mean you need an absolutely crystal clear definition. Because when the alarm goes off, or when you wake up at 11:45 p.m. and realize you haven't shipped code today, you've got only 15 minutes to ship code, you have to have very clear rules that say, 'Okay, I'm done. I win. I get to go back to bed.' For me, a clear rule was to have a working feature.
00:01:31.079
Okay, I'm glad Jim W isn't here because I did not have a rule that said it had to be tested. Now, which gets into the next point: lower your standards. Now, that's the funny version of lowering your standards, but the serious version is that if you stop and think, the thing that's going to stop me from shipping code every single day is that it's just too hard. Code is big, right? Okay, no. The reason code is big is because you have too high standards. You have decided that you can't ship this until you've finished the account manager, the account class, the user class, the logging class, and the no-one feature.
00:02:11.440
Get it down just one layer, one piece, push it in. And that's also what I mean by Epsilon: Epsilon is just a unit of work, a coherent thing that you would consider to be a commit or a check-in—something that you're willing to push. As long as the project is coherent and your specs pass, you're golden. So Epsilon is a small unit of work.
00:02:41.519
Two years ago, actually four or five years ago, it was not uncommon for me to hold work for a week or more before pushing up—or rather, committing in Subversion. Two years ago, it was usually daily, and now, honestly, it's rare that I go more than an hour or two without pushing. This is kind of a change that happens to you as you start doing this, and it's very useful.
00:03:12.599
Step two is just keep doing it. Don't break the chain. Go look up streak time management or calendar about nothing.com, which is fantastic. If you're doing this on GitHub, just honor your commitment. At 11:45, get out of bed and go push your stupid code. Don't miss today! Don't break the chain. Okay, trick three: listen to your pain. If it's 11:45 and you haven't got your stuff done, and you don't know how you're going to get this done because you're freaking out, listen to yourself and ask why.
00:03:36.760
This is what I would end up doing. I'm like, 'Why have I not pushed code?' I actually coded for six hours one day and then said, 'Screw it!' and wrote a 15-minute thing and checked it in. I threw away what I'd worked on for six hours, and then I stepped back and I kind of listened to myself. What was wrong? That's kind of where I found out that you need to lower your Epsilon, lower your standards, and just do one feature at a time.
00:04:08.000
You will—oh, I recommend this: do it outside of work. You're going to work on work stuff every single day. You want this to be special. You want this to be something you have to get done, that you're willing to get out of bed and go do. If you just make it a habit every single day that you're going to get out of bed and do this that way, you're going to run out of ideas.
00:04:35.680
So be open to new ones. Look at Project Euler. Tinker with your development environment. There's a bit. I have a project on GitHub called bin, and it's just the files that are in my bin directory—just my GitHub hacks, all that kind of crap. Start projects; go for it! That's really all there is to it. How long does it take to form a habit? Two weeks? Two to four weeks? No, this is going to take you 90 days because you're not forming a habit.
00:05:05.720
You're not just remembering to brush your teeth; you're building a mental tool. You need to do this. This is a fantastic tool to have on ship day, when it's 8:45 and you're still stuck at the office when you need to gear down into a lower gear. Running granny gear is perfect for it.
00:05:49.960
But you should stop once you have this tool because only perfect practice makes perfect, and you're not going to have perfect practice. You're going to have practice building quick and dirty stuff and getting it out the door, which is great at 8:45 p.m., but not so good at 10:00 on Monday morning. I recommend anybody take the time to learn this until you have the tool, and then I recommend you stop.
00:05:27.639
Thanks. All right, this presentation on NoSQL and SQL is about a database toolkit for Ruby. Basically, NoSQL is for non-SQL databases, and I'm Jeremy Evans, the SQL maintainer. Now MongoDB is a NoSQL document store, and SQL is a MongoDB driver for SQL. How does this work? SQL uses a DSL instead of literal SQL strings. The DSL produces objects that represent concepts, and we treat those objects specially in the SQL Mongo driver.
00:05:50.240
We compile filter objects to JavaScript instead of SQL. Let's see how this works. Again, you're just selecting records with a typical SQL command—select star from TDB, find, and it returns the same results. Inserting records is basically the same; SQLLight gives you an integer primary key, while Mongo gives you an object ID, but otherwise, it's pretty much the same.
00:06:02.800
Updating records is again a different incantation on the backend, but the same SQL code works on both and yields the same results. Deleting records follows the same pattern. Deleting in SQL is much like removing in Mongo, but it gives you an integer that doesn't really mean anything. Let's add more data and try things like ordering—order by B descending. Again, it works in SQL and gives the same results.
00:06:57.920
How about equals? You can filter with a hash. ‘A equals 5’ in Mongo translates to ‘A equals 5’ in SQL, and it gives the same results. Not equals also works the same way. Filtering with inequality works as well; both versions yield similar results.
00:07:17.800
So we can check for is null or not defined; you have to use nil value in the hash. To check if A is null in Mongo, you would write 'A is null', while SQL uses 'A is undefined' or 'not equals undefined', and you still get the same results.
00:07:34.480
Counting? It works. Count star as count in SQLLight just goes back to the count function and gives the same results. Using mathematical operators, like A+1 * 5 - B > 0, works about the same way in both as well. Let's add some strings and see what string operations we can do.
00:08:10.560
Searching with regular expressions actually does not work on SQL because SQL doesn't support that, but it would work on MySQL and PostSQL. You can use ‘like’ instead in SQLLight, which compiles to a regular expression. String concatenation works about the same in both SQL and SQLLight, returning the same results.
00:08:28.799
Using 'not in' with an array works similarly. For example, in Mongo, filtering for 'not equals -1' should function the same way.
00:08:36.600
Complex expressions using AND and OR work just the same. Simple cases like simple or fine work easily, and even more complex expressions can be evaluated without limits to the depth, as long as memory allows for it.
00:09:22.600
In closing, you can't have a NoSQL presentation without a completely flawed benchmark, so here it is, a bunch of numbers that don't mean anything.
00:09:27.040
And that's it. You can find SQL on GitHub. NoSQL is also available at that page. Do I have time for questions?
00:09:42.780
Questions? Hello!
00:09:50.240
Hello, everybody! I'm Chad Woolley; I work for Pivotal Labs. So let's start with a poll: who writes tests?
00:10:01.279
All right, who thinks it's a good idea to keep your tests green? About the same number. How many of you use a continuous integration machine that runs your tests every time you check in code?
00:10:12.200
Okay, how many of you have a prominent visible display of that continuous integration in your work environment? All right, pretty good!
00:10:22.760
That's what this is. Pivotal wrote this for internal use. We have all of our internal projects up on a huge TV in multiple places in the office, so everybody knows when somebody's project is broken.
00:10:37.560
This is the public one we have, and it just runs several projects that we either wrote or use. As you can see, it's mostly green. We've open-sourced this now; it's on GitHub, so feel free to use it and improve it.
00:10:52.079
It only works with CCRB now, so that brings me to the Rails CI. For probably a couple of years now, I have tried to set up a CI environment for Rails and tried to run it, but it's not green. And you know, that's a sad thing.
00:11:02.760
So, we'll look at this sad dog from here on out and just discuss. Why is this bad? It's broken windows: somebody checks in something that breaks a build. That may be a minor test, but the next check-in might be something majorly broken, and you don't know because it's just red.
00:11:19.640
You could go look at it, but you shouldn't need to know. This notifies them in the Campfire room they have for Rails core, but it's hard for them to keep it green. Why is it hard? Because CI ties everything together; pretty much everything comes together. It runs on most of the supported databases, it runs on the three interpreters, and not everybody tests that when they check in on the core team.
00:11:41.360
So Rails core, especially Yehuda and Carl—who are great guys, by the way—want to keep this green, but they need help. They need your help, they need everybody's help! If you have an interest in Rails or CI or Ruby or anything, this is also a great way— like if you're looking to get into open source—to get some Rails commits under your belt and grab that coveted position on the Rails committer list.
00:12:11.760
You know, just fix things. All you need to do is watch CI at ci.ruby on Rails. If it goes red, try to fix it. Patch it if you can; ask for help if you can't. If it's gone for a while, 'git bisect' is your friend. It seems really hard, but it's not; it's really easy to pinpoint exactly what broke something by using git bisect. If you're confused, first of all, you can email me, Chad Woolley, or email the Rails core list.
00:12:38.320
You can also get on the Carl, Yehuda IRC list and bug them about it; there’s also the Rails contrib list.
00:12:58.720
We’ll go back to that sad dog, and that's pretty much it. The environment needs some love, especially Ruby 1.9. I set it up about a year ago, and it dies sometimes. The CCRB is just a single Mongrel. If a bunch of people hit it with RSS, which happened, it kills it. I have some caching in my branch.
00:13:16.800
My original goal was for this to be completely reproducible so anybody could set it up on a virtual machine or an EC2 instance and basically eliminate the excuse that 'It only breaks on CI.' So I wanted to have this thing that you could run with one bash command against some hostname that is a Bare-Machine 2 or Debian instance, and you’d end up with a working Rails CI.
00:13:33.840
I wrote a bootstrap Ruby script and CI in a Box, and that was really a flawed approach. Now, there's RVM and Chef, which you heard about today, which are way more awesome ways to do this; I haven't done it yet, so help with that would also be very welcome.
00:14:04.240
That’s pretty much it! If you’re working on Rails and you're interested in Rails, if you want to get a patch on your belt, help out!
00:14:26.080
So, I wanted to show off something I've been working on for the past couple of weeks with a couple guys up there, Joe and Jake. You can check it out at MPR.com demo. It's basically a web-based heat visualizer and leak analyzer for Ruby. Right now, we're working on 1.8 support, but you get a bunch of views. I'm just going to walk through some interesting things.
00:14:55.440
If anybody has questions or specific things they want to look at, we can look at them real quick. There are three basic views: there’s namespace, subclasses, and grouping. This is a dump of a simple script that just requires the standard library and then dumps out the heap. You can see a lot of interesting things in here.
00:15:29.079
For instance, let’s look at the subclasses view. We can see the root object, which is 'Object,' and then we can see a bunch of subclasses defined in your process, such as the entire exception hierarchy in Ruby. You can get a sense of what’s on your heap, and if you find stuff that’s not supposed to be there, you can get rid of it and save some memory.
00:15:52.880
The real power here is that you can analyze different objects. If I click on CGI, I can see that CGI has a bunch of constants, no instances in this case, and a bunch of methods defined on it. We can look at its meta-class; you'll get even more information. There are methods defined on the meta-class.
00:16:21.040
We can click on CGI.rb and take a look at all the objects defined inside that file. We can group them by line or by type. Here we see some classes, and we could click on a class to drill down and see the actual classes defined in that file. This is useful for finding memory leaks or for seeing what is holding onto references.
00:16:46.560
For example, if we look at Thread, we can see it has two instances: the main thread and another one allocated in timeout.rb. So you get a lot of power.
00:17:08.920
I want to show off one quick example. A couple weeks ago, Carl asked me why bundler was taking up so much memory. This is just a heap dump—you can see there are 500,000 objects here, and we can group by file. This file has the most number of objects.
00:17:27.760
So we can drill down into that file; we see there are about 50,000 objects—all gem version objects. We can get a list of them by clicking on one and seeing, via the references tab, what's holding a reference to this gem version object. You can drill down and see.
00:17:54.760
In this case, we can see that the bundler index holds on to an instance variable named specs, which is a huge hash with entries for the gems on Ruby Forge. It has to download and populate the hash for lookups to see what gems to install or download. This is why it's using so much memory.
00:18:25.120
So this is MPR. Check it out; it's available. We have a little survey we just put up, and if you have time, please fill it out. We're trying to gauge which Rubies people use, what problems they've run into, and what features they'd like to see. Finally, Joe will be giving a talk tomorrow that goes into more detail on how MPR works.
00:18:46.560
Any questions? That’s it!
00:19:02.080
Awesome! Hello, my name is Jade Meskill. I'm the founder of Integram Technologies. We're a Phoenix-based Ruby on Rails and iPhone consulting shop. What I'm here to talk to you about is how many of you have had to do user-generated video on a site? How many of you hate yourself for it? It's hard, right? It's kind of a pain.
00:19:20.120
One of our clients is Sorenson Media, based here in Salt Lake City, and they have a really awesome system for video distribution as well as in-browser video capture. I want to show you a little video wall for Mountain West that I built in just a few minutes with a few lines of Ruby.
00:19:44.000
This little gem here sets up the view. The internet is very slow, so please bear with me! I’m on it now—setting up to capture some video. Let's capture a little video.
00:19:59.239
Here we go! Three, two, one... Hello, everybody! I'm at Mountain West RubyConf, yay!
00:20:15.320
Short little video captured. I can preview it and trim it down, and then I can start processing. It's going to upload to Sorenson's 360 service and post back to my Rails app.
00:20:40.000
I’ll show you that code while waiting for it to post. I have it going to a secondary step, which processes it right here. Can you see that? So this uses the Sorenson gem to go out using the GID to fetch all the metadata from 360, pulls it down, and now I have...
00:20:56.960
Oh great! The internet failed. What should have happened is that I upload my handsome face several times. It will give me thumbnails, URLs to the video, and an embed code that I can easily reuse.
00:21:14.000
So it's a stupid simple way to handle user-generated video for clients or websites. Just a few lines of Ruby and you're up and running! This literally took me about ten minutes to implement. The hardest part was stealing the CSS from the Mountain West site and reimplementing it on my own.
00:21:31.360
Any questions? I don't know how much time we have left. I have a minute? Thank you!
00:21:45.000
Oh, there’s a question back there? An example? Oh, right! If you want to learn more, you can go to developer.sorensonmedia.com to learn more about the API.
00:22:03.000
This demo is posted up on mountainwest.integramdemo.com. I will put up all the stuff on GitHub.
00:22:15.000
Mike is going to add a link to it on the Mountain West site, and it should be available now.
00:22:30.239
Sorenson is giving away free accounts for developers to test, so you can sign up on developer.sorensonmedia.com. If you email MLS at sorensonmedia.com, they will upgrade your account and give you a little extra access for free.
00:22:48.000
It supports Flash and MP4, so it'll re-encode all kinds of other videos.
00:23:10.000
All right, thank you!
00:23:36.000
So, I'm going to talk about HTML5 today, but what I'm actually addressing is offline capabilities.
00:23:43.680
When I say offline, I don't mean only apps that need to run offline; I mean reducing downloads in general.
00:23:50.680
Carl and I noticed an issue with how many people were making mobile sites. For instance, I work on the unofficial Apple web blog. They are officially mobile sites, but every time you go to a page, they download all the HTML again.
00:24:03.680
When we started investigating why that was, we discovered that most people don't know how to prevent this unnecessary downloading of HTML.
00:24:20.600
I want to show you how to do it, and hopefully, we'll have something that makes it easy.
00:24:37.160
Here's the HTML that gets downloaded when you go to the unofficial Apple web blog. Each time, it amounts to about 6k with every visit. Before it can show anything, it has to ask for HTML.
00:24:54.160
If you have flaky internet, you will find that while you'd like to see something you already saw, you cannot. It uses a normal client-server model where it simply requests to download the entire page each time.
00:25:07.800
So, let's explore this trick. Instead of always having to request the entire page and downloading potentially useless amounts of HTML, we can save some time.
00:25:30.480
Instead of traditional requests, we can use a common HTTP request that accepts application JSON.
00:25:51.400
In your Rails controller, instead of returning HTML, you can return JSON. That's like the normal way that you would do APIs.
00:26:06.160
The JSON blob would simply present data rather than a full HTML document.
00:26:20.800
Using jQuery, you can retrieve this JSON blob with a simple call. With JavaScript, you can manipulate this data and update parts of your HTML as necessary.
00:26:37.720
This allows for smoother loading times and less clutter on the user's device. This way, the server only sends what's necessary.
00:26:53.080
You get to keep the cash manifest. The client takes note of all the files that are meant to be stored locally.
00:27:10.240
With local storage, you can easily store articles. If there are articles locally stored, you load those, fetch any potentially new articles, and you can handle them accordingly.
00:27:25.280
This way, when users return, they won’t see an empty page but rather a fully populated page with the previously downloaded data.
00:27:41.200
The trick saves a lot of unnecessary download time and achieves a much quicker responsiveness.
00:28:00.240
This technique should eventually culminate into a Rails plugin to make it easier.
00:28:17.040
So this is how I believe mobile web apps should be integrated, rather than always displaying HTML.
00:28:28.320
Thank you!
00:28:43.960
I'm going to show off some fun stuff I've been doing with e-commerce lately, but to be honest, I hate dealing with e-commerce.
00:29:00.320
On a few projects recently, I've played around with Active Merchant. Most of you are probably familiar with it; it's very popular for doing e-commerce in your apps.
00:29:14.360
But I got tired of the mundane tasks it still does not handle well. I wanted my apps to accept credit cards quickly, even if the forms look icky. Sure, I could work on the aesthetics later.
00:29:33.840
All my code will be up at GitHub under a Mountain West RubyConf 2010 lightning talk, so you can look there.
00:29:45.840
This app we will be looking at is actually a Rack middleware for doing e-commerce stuff; it's called rack-payment.
00:30:00.240
I’ve created a simple application that holds a hash of products. We have a Sombrero for sale and some oatmeal.
00:30:15.120
What I'd like people to be able to do is buy these. On the homepage, we currently just show the products list, and by clicking one, we should get some information on it.
00:30:31.960
We first want to include our rack-payment middleware, which will allow for quick payment handling.
00:30:49.920
I need to initialize payment. Using Sinatra means I should set up helper methods and dispatch whatever's necessary.
00:31:02.440
This means integrating with the authorized payments bridge, perhaps using Bogus Gateway for testing.
00:31:17.240
While using rack-payment, we can return a status code of 402 to indicate that payment is required. However, our application may need to enable some session middleware for a smooth experience.
00:31:50.480
When reattempting the purchase process, rack-payment will provide a preformatted checkout interface.
00:32:06.720
You can customize the experience as needed.
00:32:17.880
I want to showcase that we can complete a purchase through rack-payment as we recently set our card processing.
00:32:28.200
Begin by completing the purchase request with some mock details, and if everything is correct, the payment will go through smoothly.
00:32:51.800
I might have some errors during this demonstration, but typically such an implementation is working effectively in production.
00:33:16.680
Hi, managing projects with G Screen—what is it? No, no, no, this is a terminal multiplexer that lets you do cool stuff.
00:33:32.880
Why do you want to use G Screen? It helps you split your screen, and if you drop your connection while working on a server, your work persists.
00:33:55.480
You can also have conversations while doing work. Let’s have a live demo! Let’s hope this works well.
00:34:05.880
I’ll clone a template to set up a bunch of files! Just checking out Ruby 1.9 right now—I’m currently on 1.8.
00:34:22.440
If I want to create a screen session for a project, I’ll begin by editing my files. Let’s load Ruby 1.9 in our session!
00:34:38.000
I will comment out sections as needed, and configure anything I want activated! I’ll also have some services like MongoDB running.
00:34:59.000
Now, I’ll see what needs to be included so my screen session works smoothly.
00:35:17.680
Upon saving my newly scripted commands, I can run the environment; hopefully, everything will initialize properly.
00:35:37.440
This creates a MongoDB server session; then I can back it up smoothly to ensure something arises.
00:35:55.760
Let’s look for a log, and after launching, we can register this against the database server.
00:36:07.920
Thank you for this wonderful framework, and I appreciate seeing how it permits easy transition across multiple identities.
00:36:17.920
Hi, I’m Brando Connor and I’m the engineer at Simple Geo. We want to build all these cool games!
00:36:30.720
We started creating a solution for geotagging using tools like Heroku. But for geolocation, we’re faced with the limitation of data providers, with some pricing shocks. We decided to create our own solution to allow access to infrastructure with no costs.
00:37:05.760
To top it off, we have an open-source library that allows developers to hack into it and operate freely. We have tons of data to access and a realistic system for implementations.
00:37:20.960
You may have heard of StickyBits—its functionality rests on our service! What we build is real-time access to Geo-networked services.
00:37:37.920
Check it out live and experiment with using real data in your web applications. Plus, we provide free development keys! Ask for one today.
00:37:55.760
It’s real easy to get into depending on interest. How can you build projects outside of typical structure?
00:38:10.440
Feel free to mingle with us after this talk to discuss how you can use this data.
00:38:20.360
So, I'm Jacqu, and I’d like to introduce an app called Rails Gen! It is focused on Rails 3 and holds many features helping with project setup.
00:38:43.040
With Rails Gen, you can integrate designs, web servers, and deployment efficiently. It leans towards a collaborative approach!
00:39:08.000
Once it’s available, you can create stacks and Fork structures that can be reused.
00:39:25.680
This framework is open-source and can be used from the command line to easily start new apps with integrated solutions.
00:39:45.260
This is essentially the same as Rails boost, just focused on Rails 3. The invite is to come to hackfest, so we will meet up!
00:40:10.720
Hi, my name is Chris Smith. I’m a Rails developer living in Salt Lake, and I’d like to share my experience migrating from Java to Rails/Ruby. I spent about a year and a half in Ruby and Rails professionally.
00:40:45.840
In my early days of Java, I was a moderately hardcore test-first developer. I wanted to understand the human factor in programming that contributes to a successful project.
00:41:25.239
As a part of that process, I started to focus on getting the right tools in place, so the barriers to writing tests were minimal.
00:41:50.440
Once I arrived at Rails, I discovered an important tool: IRB. The console changed how I could interact with code.
00:42:10.680
However, upon working with Ruby, I realized my need for a solution—a test recorder implemented for IRB.
00:42:45.240
It would ultimately allow my past efforts in testing to flourish amongst the simplicity of Ruby.
00:43:05.820
The potential impact would be enormous! Something like this would help programmers of all backgrounds harness testing more effectively.
00:43:25.040
Finally, coffee script is a great addition to Ruby's popularity! As a funny note, it compiles to JavaScript—offering some syntax improvements. It allows for elegant programming that saves time in managing JavaScript.
00:43:53.760
The developer community will certainly benefit from this integration, and it helps in realizing a common workflow.
00:44:20.599
If you’re a Ruby hacker, Coffee script is a fun option worth checking out. It's just for fun as it provides a different syntax, while making transitions between Ruby and JS seamless.
00:44:50.400
With Coffee script, you’ll see similarities with Ruby, and also increased productivity in development!
00:45:15.920
Thank you! We’re on a countdown to create an app. What would you like to call it?
00:45:30.960
Mountain West Ruby Conf Demo is available! I'm logged in as a test user called J Ruby.
00:45:45.520
Now we'll set it up—a basic app. This process will inquire about creating an app with the Google App Engine.
00:46:02.440
Using the app configuration generation process will set a structure in place.
00:46:20.720
Preview against the local server, a process that takes mere moments!
00:46:37.920
It confirms that our configured app is available. If I want to publish it?
00:46:53.920
I need to update my credentials to kick off the deployment on the Google platform.
00:47:09.760
Everything is inclusive of required libraries, and integrating everything as needed.
00:47:27.240
From here, deploy like any traditional app; when it’s live, I can access it readily.
00:47:43.960
As it continues to build on the backend, I can finalize larger adjustments.
00:47:57.520
While waiting for the final touches, it’s worth noting how great of a structure emerged during this process!
00:48:13.760
Suddenly, it became about whether you are realizing your projects' opportunities and implementations in real-time!
00:48:29.440
As we wrap it up, it’s all about being engaged with the tools you can actively utilize!
00:48:41.480
And, that’s a wrap! Let’s not forget all our implementations through the system, and where it took us in accomplishing.
00:48:56.160
It's been a pleasure, and I look forward to connecting!
00:49:09.760
Thank you very much!