 All right, so last year I showed the binary lottery, but I didn't actually show It running so when people watch the video, they don't know what it does So for the sake of the video, I'll go ahead and run it again, but we won't This won't count for anything. So I just I kick it off I'm I wrote it in shoes this year because I didn't want to do another console one I actually wanted to do something a lot fancier, but I did this I think between 11 and 3 a.m So I'm not sure how good it is This is how it runs. We just got a bunch of random flickering ones and zeros with each key. I press We really reveal one more of the binary of the The positions for the number and then after all eight have been revealed. We show who the winning person is You didn't win anything So This is pretty much exactly what we had last year I've got a YAML file with everybody's name We pulled this from Activa when you registered through it into a spreadsheet gave everyone a increasing number and change that to the eight-digit binary number And then I just keep that in the YAML file and then what I'm going to do is I'm going to randomly Choose one of these entries in the YAML file That's going to be the winner and then the app is all about the reveal So we're not randomly flipping coins like we do with a real binary lottery and Here's the implementation I Wish I was just ignore this for now. Don't worry about that So we're using YAML Can I get this thing smaller? Okay So I'm basically I create my users. That's just going to be the Opening of that YAML file then I'm just going to pick one. I do that here where I pick random user And then I make sure that I actually have a winner and I make sure that the eligible field on that object is Is not false I guess and then I start count and this is kind of a clue just is real hacky So I apologize for it But it's a shoes app And so if you've ever looked at wise shoes this should look pretty familiar On key press all I'm going to do is I'm an increment count right and then Later on I'm going to be animating everything else. So I create a stack I've got a paragraph that says not unless Ruby conference binary lottery new winner is and I couldn't figure out the styling because I was really tired So I just hard-cutted it Then I have an empty Paragraph which is for the name which is also fairly big and then I have a flow A through H because I really not very creative on naming And then that's just going to be some random number of one and zero And again those are very big and then I had an animation loop. So 60 times a second I'm just going to update the digit I'm going to do it for my a paragraph my B paragraph my C paragraph. I'm going to pass in the current count I'm going to pass in what position of the binary number I want to display and then I'm going to pass that number So that's the eight-digit number there and Then if the count is greater than or equal to eight I'm going to go ahead and place that label that name paragraph I'm going to replace its empty string with the winner's name and then also if the counts greater than eight Not if it's equal to eight But if it's greater than eight then what I'm going to do is I'm going to mark that paragraph of the name as red I'm going to set the eligibility of that winner defaults and then I'm going to save That yaml file and what that means is that if you win once you're not going to win again So whoever I've got who I just drew. I didn't you didn't turn red So you didn't get saved and you'll be eligible to win again but That's it any questions Nope good Okay, so I'm just here to demonstrate guest method which is something I wrote for IRB You have tab completion, but I don't always Use it because I think I can type faster So if you you know misspell something it just get a name error and it's sort of annoying if you're in a long method chain or within a within a method definition so I I created guest method which Replaces and tells you what it's doing so I misspelled string, but I actually get the string objects back and So and you know does it for constants and And methods It uses the Levenstein distance to determine if something is close enough It's a slightly modified a weighting system for it that I thought worked better for typos and So if it finds multiple things within Within the threshold that match the distance it will it will tell you, you know What what were the possibilities and then it just raises the name error? That would have got raised anyway, so that for methods and And constants and so if you're outside of Outside the threshold it just you know gives you that that message so one of the things I did was I tried to test this really well and So one of the One of the specs looks like looks like this Which passes? So actually my my favorite part is I always misspell exit and so that fixes that for me once I had Once I had that working. I realize that I'll also often forget the name of a rake task or I'll just know approximately what it is and so I created A great which Just just does it so I want to run the specs, but but I misspell it and this is what it looks like when it runs But you can see up here. It tells you that it's invoking something else And that's a that's it the specs are really clear about about what it can do In console if you You have to do you have to do this in console so that guest method doesn't interfere with rails Method missing and cons missing business Guest method has to be last what it does is it Takes method missing runs an original method missing catches the name error and then runs its thing so rails has to do all of its first and And I've tried putting into rails, but it's a really bad idea. This is totally not for production That's all that's important So that's it that's that's all I got I Was told you were going to be asked if you wanted this or not did anybody get asked Did you ask anybody It's active scaffold Where's Tim There you are Tim and I are not on the core team per the discussion this morning We're on we're contributors to active scaffold, but we are no longer on the core team That was supposed to be a joke It does say core team out on our website, but we'll change that shortly What active scaffold does it basically puts a scaffolding on top of tables so in this Oh, let me see if I can zoom this so that it fits there we go So I have a customer table it has all the crud operations It's all a jacks oriented the Sorting it Also, let's get something more interesting. I've added a couple of add-ons. It's pretty extendable. I've added on Customize ability Tim, you're working on a sort ability that actually uses Ajax, which is pretty cool I don't have that to demonstrate right here. I've also got a PDF Plug-in that I've added on to it that allows you to print the table It's rails as well the It does nesting So You get a complete set of nesting capability for subordinate table relationships It's kind of been a limbo a little bit here as of recently and we are Pursuing getting get working on the the the plug-in so that we can keep the Actually get the community more involved because the core team is Like all of us. We're not getting paid to do the open source and until we get Projects that will pay us it kind of sits there for a while. Any questions? Yes That's the plug-in The export that's there are a couple plugins out there the one that I maintain is called active scaffold tools allows you to customize the list and do export it also that also gives you the ability to just print HTML so that Basically gets rid of the layout. I also Maintain a localization plug-in. Oh I didn't mention the RF PDF. It's completely localizable. It's UTF-8. We've done some Japanese installations of it and Hopefully in the future. I'll get right to left working as well other questions so I'm Josh Sesser and This is I'm going to talk about migration concordance, which is a plug-in that I wrote and I blogged about recently If you're interested in this it's up on github under my Josh Sesser account and what does it do well We all know about migrations in rails and how cool they are and also what a pain they are sometimes Especially when you're working on a team and people go and change migrations and you don't notice it so I wrote this thing that Has a Kind of weird approach to checking out what's going on. So let's see screwed up all of my window spacings the What I what I do is Let's just see what this is the one I want So here if I I'll show you this in action Yes That better that didn't help Why is the Mac so weird today so let's say you're working on a team and somebody checks in a migration and You don't notice that they checked in the migration and then you go run tests and everything blows up. That's a pain. So I There's a there's a something in rails that will actually Force you to run migrations If you are running tests and the migration the schema version and the number of the latest migration are different But I find that a pain So the I like to know a little bit more plus there are occasions when somebody edits an existing Migration that's been previously run and then just checking the version numbers is not going to help you So I wrote this plug-in to check and see a number of Conditions so the way you get it going is There's a one line that you put in the end of your of your environment to call this check concordance thing in the my in the In the environment and Then you what you want to add Let's see You want to add a file to your git ignore or SVN ignore? Because you want to make sure that this stuff isn't checked into version control Otherwise that would ruin the point of the whole thing Let me make colloquy go away because it's being annoying So what I do is I create a Snapshot file that holds an MD5 hash of every migration File that is in your migrations directory when you run migrations and that will that makes it very easy to detect The next time you go to run your application or run tests To see if anyone's changed an existing migration or deleted one or added a new one So I'll show you how it works here so It runs just when you run the environment So now I get a message here that says you need to need to migrate the schema from This from version one So I can go and look and see I got this version one here. It's a whole bunch of stuff in there So now if I go rake db migrate Reset that just goes and reruns all my migrations and then The nice thing about doing the check in the environment is that it'll happen when you run console or test or anything So here you can see it tells me everything's cool now really Okay, so I'll show you the other two things. So if I If I generate a new migration, this is just like you've checked out a new migration and then I look and see what's up It'll tell me Hey, you got a new file that you need to run rake db migrate and if I look here I can see in the snapshot The file isn't there yet, but if I rake db migrate I can go back here and I can see I have this for the new file and if I Check the environment. It'll tell me everything's Jake again So that's it. There's a there's a long debate to be had about whether or not you want to be editing old migrations If this tool is useful to help you go and hunt down and kill your team members who have edited old migrations That's your choice or you can go and figure out how to work with editing the history. So that's it. Thanks Okay I'm going to be talking about some framework components that I'd like to build I've been building domain specific frameworks Which are basically Web frameworks that I've built on top of rack that are for specific client projects and I've been doing this mostly for Clients that want a web application that they can extend but they don't necessarily have the programmer manpower to really devote to it I'm giving a full talk on that whole concept of the Ruby fringe if any of you guys are going to be there They're basically DSLs for the web. They're just kind of DSLs that generate a web application One of them might look like this. It's sort of a simplified version one that I've actually built The page method is a block that has different methods in it to put things on the page And this would generate an HTML page And if they requested a PDF page, then it would generate a PDF on the fly and spit that out and On the application that it's actually from it would live at reports slash whatever the RB file is And so if they need to add a new report, they would just go in and create a new file I'll create one of these page blocks and they can have multiple pages to that would they're paginated So they would link to each other If they're HTML or they would create a page to PDF file The project that I'd like to start that I kind of what you guys help with is Reusable components for things like this and I kind of have like a small pool of things that I've done myself Like a router that's about as powerful as rails router, but it only is about 120 lines instead of Like 1200 or whatever rails is now And it's really just so we can improve them together if we Extracted things like the router out of most web frameworks or out of the small ones that we've built and then we improve them We can commit them back to our own projects and make it better If you're working on a new project, you know, I that's why I built a small pool of things that I have is I don't want to Sit around reinventing the wheel It would be a lot quicker to get things like this launched and this could even be for general web frameworks Are coming out like a Sinatra and things like that could snag these reusable components and put them in their own projects and If they are extracted out of other projects then we can contribute new features back to these projects and improve them a lot more I registered a Ruby project about three or four hours ago It's called framework that we can ditch all these components on if you want to contact me via Email or I'm on IRC usually I'm in the back channel and I'll be around the rest of today and tomorrow So if you want to grab me and talk about it If you've been doing something like I've been doing or if you want to get involved with doing something like that then Just let me know. Thanks. So I started working for reductive labs recently. I'm working full-time on this product It's released as an open source project. So anyone who wants to go play with this can do it I think it's got some pretty neat stuff and I'm still learning Everyone else here probably knows more about Ruby than I do and I've already learned some stuff today And I'm gonna learn more but this is what I'm working on So pop it what lets you do a lot of cool things and hopefully by the end of this you'll see that and maybe you can go play with it puppets rating in Ruby right now. There's a 46,000 lines of Ruby code in the library and about 48,000 lines in the in the test code that this is I pulled from the head of the release branch with there's a get repository you guys can grab from that's on our website and Puppet is essentially three things. It's it's a language parser that builds these abstract parse trees Let you do some stuff. I'm going to show you some language in a minute. It's a client server There's a centralized server that has your repository for all the nodes in your systems all the nodes in your network and what they are supposedly supposed to be doing and Then there's a resource abstraction layer that gives you portability between different systems And it's all it it only runs on Unix based systems Maybe someday someone will make it work on Windows, but it won't be me. So Yeah, what does that mean and why should you care? Well, let's see So I don't know what everyone's background is in a lot of places the developers and the sys admins are Kind of they're separate creatures and they don't necessarily interact but in in place. I've worked in place I've seen there's a there's sort of an ad hoc Management system in place. It's been rolled and kind of grown organically over time and that creates a lot of issues At least in the places. I've I've had experience with and maybe you guys have have great operational guys everywhere and or everything's in the cloud and you don't ever have to touch it but There tends to be this theme of pain and really, you know, except for maybe package management. There hasn't been a real ink or evolution of System administration tools compared to what's evolved with respect to other development tools So public is a declarative centralized configuration framework bill on transparent extent extensible abstractions and you get this inheritance composition dependency structure that lets you do some cool things. So here's an example I pulled off their website. You can go to this. This is a recipe written in puppet that lets you basically manage a rail stack so you the important thing on this one is that you're gonna have this Include here which is rail stack and Rail stack is going to include some other classes. Those are a web server mongrel You're gonna have my sequel And you're gonna make sure that these packages are installed. There's this concept of a provider so you'll see the my sequel and rails are provided by gems and So that needs a dependency on the package Ruby gem So you're setting up these dependencies Explicitly every system in the world knows that I can't stall this package till this other package is installed if I if I change this file I have to restart the service, but those aren't expressed explicitly in your tools So this gives you a way to go from you know Just doing this stuff and maybe have some SSH and for loop stuff going on But this is an explicit model that gives you a declarative Model of every every system in your network. So then this is a class mongrel If you if you set up mongrel this probably looks familiar, you know, you're gonna have your packages You're gonna have certain files and then down at the bottom. You'll see that it's gonna re subscribe to the file mongrel cluster So if that file changes, you're gonna get your service mongrel cluster restarted And if anyone has any questions about the coder, whatever we can maybe talk it track me down. Let me later It's highly portable It's already running and supported on these systems and you know, we're basically taking advantage of the the ruby VM to do that There's there's maybe 50 lines of code that you need to write to to provide that portability for the different providers for packages Or what have you from different systems because you know, every system has SSH but sometimes it says SSH and sometimes SSHD and sometimes it's OpenSH and Who cares these people care these people are running puppet right now and some regarding their In organizations, it's in it's running production systems right now and You might not want to use Papa if your systems don't change you don't need to scale and you enjoy Rube Goldberg's legacy but your competition might and It gives you away Ruby and Papa give you a way to manage your services not your servers So going from managing 10 servers 200 servers is very easy And like I said anyone who wants to track me down and talk about it feel free Yes, sir It's not What would the advantages of developing a custom language parser instead of doing the dimensions of language learning Ruby do that If you know anything about this project and you can go researcher and talk about it Luke was an operational sys admin he wrote 99% of this code and He had these ideas that he wanted to do because he'd been working with CF engine Which is written in C and he wanted to change it and he wanted to make it better And he thought I had all these ideas, but he couldn't really you know get the community there was one person who's academic and So he decided okay. I want to do something different He tried to do it and pearl I try to do it in these other languages and couldn't do it But his background wasn't really as a developer It wasn't really as a Ruby programmer and then Ruby just let him do it I mean he basically that's a testament to Ruby's flexibility and and what it allows you to do because he Went from you know not really being a developer background to having a working prototype in a couple days with Ruby So so maybe there's something and there's probably in those 40,000 lines of code There's probably a lot of stuff that we could we could trim down You know we could get probably get more performant We could probably get cleaner abstractions and cleaner idioms and that's definitely something we're working on doing My name is David South Lloyd Moser and I have a small company up in Logan so that means we're the chief cook and bottle washer We have a project where we have to upload a lot of photographs And as everybody knows that's kind of a pain Especially on the web, you know, you're typically you would have the Brows You'd find a photograph you want to upload Open you to upload the image you would upload it to the server and then you read some repeating You might be able to have 10 fields and have them upload 10 pictures at a time But if they're large photographs, you can your browser might time out you have issues of it just not feeding back So what we found was this thing called Swift upload. It's SWF upload org It's a library written for a wide variety of platforms. There's a PHP implementation and a dot-net implementation It's basically a very simple system that uses a hidden flash movie file to Select The files in other words if I click select images. This is a flash open file file open dialogue box When I select the images I want I can select as many as I want and Hit go It will give you a real-time upload It's hard to see down here because there's obviously no time to upload to a local system But I'll give you a real-time upload indicator and it'll continually Send the files one at a time to the server. So as far as rails is concerned. It's just receiving One picture sent to it at a time as if the person was at the computer doing it manually When it's done, it says all images are received you can return to the index or they are The nice thing about it is it doesn't actually use flash for any of its styling it uses javascript calls That do all the styling the progress bar the everything is basically javascript the system itself is really simple they have a simple flash file that you have to load and Two javascript files this SWF javascript file is just a library And then there's the handler javascript file which you have to do a small amount of hacking to make it work with rails The big trick is in your new You need to have a little bit of javascript that defines Where the information is that you need it to load for example the upload URL is SWF upload photos path that was said in routes if I go to the photo controller SWF upload It's hard to do this on the screen. I got the test didn't I hold on guys There we go. Basically SWF upload receives a post From javascript that says here's the file we want to upload Flash monitors the uploading progress on the client side Continually sending javascript updates to your browser. So all the Java flash handles the selecting of the files and Monitoring the upload the javascript is what updates the browser. So the browser never gets out of date The browser is constantly being updated When it's done, I render this text which is the name of the thumbnail It goes back to the javascript handler Which we're just rich just renders the thumbnail and then the flash movie sets another File up for Q and then just posts it to rails. This is using attachment foo SWF upload and rails. It's pretty simple project. We set up a Sample this sample actually we put it on our website under app design slash rails underscore SWF upload I don't think so. It basically it's as if I was selecting the file and uploading it one at a time That's really what this is is just a cue All right. Thank you. Wow It's big So how many you guys ate those cat those candies? I Didn't I don't know can I Command shift plus awesome Yeah, I didn't realize the candies had caffeine in them, so I'm way jittery right now That big enough I Want to do I Demonstrate something that we've been cooking up at lead media partners. It's called the Ruby amp text mate bundle And I'm sorry you the PC guys. It hasn't been ported over for e yet But in a nutshell, it's just a collection of commands That I help you use the Ruby debugger and it also implements a lot of things that Really make it a lot more efficient to work with text me and Ruby. I started off using Radrails for a long time And I really liked it and I made the switch to the Mac and the eclipse kind of stinks on a Mac I don't know if you've ever tried it and so I I gave text me to try and and really loved it But I missed quite a bit of features and there's also a couple of features. I've always wanted as well so I I'm I started on this bundle and Now I'm going to demonstrate it to you first off one thing that I Really missed about text mate was or Radarils was the ability to auto-complete from other files. So say you have In In here, I've got this method called median in this class that I'm specking against and if I'm working on a spec in another file, I can Push the shortcut key and it just scans the words in all the open tabs and completes from it It's extremely handle handy if you're Working with active record objects and you have the annotations at the top Another thing is you can point your cursor at any Anything in the in the project and if it resembles a file name or a path You push the hot key to go to it. It will look for anything that matches that so you can go to it directly So partial this works for partials any anything it's it's really useful and very generic and Then another thing is you can jump to Any any class under your cursor So Say we we are Using this. Oh wow that is way too big. I can't see it. Maybe I can get rid of my drawer. There we go Okay Still too big. Can you guys read it? Is it? How do I get a smaller? That's not working Geez, okay Shift command. Oh That makes sense. Okay, cool. Can you read it? Okay, well um spec So if you have a class and you don't know really where it is you can push the hot key and It will grab through your whole project find anything that looks like that and jump right to it This is extremely handy for methods as well like Let's see Say we've got Well over here in the median for example If I want to go to a method called median, I just put my cursor over it press the command and Oh, it finds it. It takes you right there It works for Delegators aliases and all the other different ways of Defining methods, so it's pretty intelligent and it recognizes a lot of the patterns for so should be able to find it It doesn't understand the purple code and in some instances Purple code is that stuff with the here doc and then finally I just wanted to show you on You can debug in real-time and And evaluate inside of text mate Which is Makes it possible to kind of have an IRB console session going on while you're writing your code And this has helped me to be incredibly more productive You push the key to for the debugger, which is command D And that does a couple of things it it launches a Ruby process for your current file In in debug modes, and then it fires up the TCP IP port So it listens for commands and then it fires up a terminal terminal for you So you have a a debug session Well, I can type TM here that brings me back to text mate where the con the context is and I can start to write code Just like that the control I and so Will out evaluate that so a equals what's that? Okay So we're going to post a page about that later on and we'll have it written out on the The whiteboard how you guys can get that. Thank you. Hi, my name is David Koontz Myself and a few other people wrote a little library called monkey bars and we're going to attempt to write a GUI application in five minutes so monkey bars For one who's never heard of it It's a JRuby application or JRuby library that allows you to interface with swing So the idea is we're going to use everything that Java gives us The platform without writing any job. So what I've done is I've used the monkey bars command It's just like rails. You'd say monkey bars space my app. You generate a bunch of stuff for you Okay, I've done that and then gone and created a project inside net beans just to save us some time So we're gonna start off We're gonna create a new form we'll call this Hello, we got Just a basic swing form here, of course, this is way too big So we'll toss a label on here We'll go ahead and we're gonna name this this thing text Actually, I'm sorry. We'll call this message And then we'll create a button and just gonna set up some Set up the text value Okay, so that's it. That's this is jerry java of course behind the scenes But we don't have to deal with that Net beans is taking care of that for us. So now that we've got this we're gonna go We're gonna generate What monkey bars is going to use so there's a rake task generate we want To see what we're typing Okay, so we want all three we it's a model view controller type systems We want all three it's gonna be in source and we'll call it greeter and there's Like no actual good Board oh because I'm on the wrong tab. Haha. So this is gonna generate a model view and a controller for us Which eventually we'll pop up. Okay, so here it is. Here's our model view and our controller First thing we want to do is in our view We want to set our class and we name that class. Hello, so we're gonna say that's the name of our class and then the way this works is You have some stuff in your model The model shovels shovels it into the view and then when it action happens the view shovels it back into the model And then the controller decides what to do with it. So we have to put something in here Okay, so we just got a basically empty message and now in our control in our view What we do is we tell The view how to associate the stuff in the model with the stuff in the view Okay, so you're we're gonna map is also like super fast So hopefully you get like the general gist of what's going on here. So in the view we had a field and it was called Label and it was called message And we're saying the text property and that's coming from the model and it's coming from the message Attribute So make this smaller. So that's that's all the mapping that we need and then over here in the controller We had a button and it was named button. So we want we want to find a method called button action performed This will do all the like adding action handlers and callbacks and all that it just does it automatically It knows that you want to action handler because you call the method action performed and knows you want it on the Thing name button because you that's the the convention here and what we want to do is we want to say the models message Is And when we're done we tell that to update the view So you go ahead and we run this People are talking about me. Okay, and that's the wrong project. Of course, I forget to switch it Does anyone see it to do to pop up? Oh, I'm sorry. I yeah, I never told it to actually run in our main file. We actually have to require What do we call it breeder? Show this and we're done. So there we go. There's our there's our field. You agree. Boom pops up so and the bit the good nice thing here is you can come over here and you can say rake RAR jar and Yeah, RAR is another library wrote for packaging and now you come over here to package deploy double click on this And it just ran from a jar file So now here's your your application that you can just hand to someone who doesn't have all they have is Java And you just hand them a GUI application that runs out of jar files double click