00:00:19
Hello everyone! If you're here for the Matina of The Breakfast Club, prepare to be disappointed. Actually, that’s not bad advice for the rest of you. Hi, I’m Chris Morris. I work for Living Social, focusing on our International Group. Living Social is an unusual startup, but we still grapple with the same challenges.
00:00:34
Like any startup, you have to feed the business what it likes to eat. Building actual spreadsheets can be a pain, so a clever developer might figure out that you can toss some CSV views their way and everyone will be happy. This works as long as you’re in the U.S., but once you start making international acquisitions, problems arise.
00:00:46
Suddenly, the French are screaming that their llots look like chewed croissants! So, I did a little research and found out that you can slam a byte order mark in front of your content, and everyone is happy—at least if you're on Windows. But if you’re a Mac user, you’re still out of luck. After more research, I realized I had to suck it up and do it right.
00:01:04
In my case, that meant a lot of CSV views. After much work, we created some "secret sauce" and packaged it into a gem called Eelinator. We’re using this in production now, and if your controller code looks like this, you can add a one-liner and have a real spreadsheet generated from your CSV views.
00:01:30
Unfortunately, a lot of our controller code resembled the first example, and I was not keen on writing four lines of code for each of 70 to 80 controllers. So, I pondered what it would take to eliminate the need to write any controller code at all.
00:01:43
Today, I’ll share my findings with you. Given this report, we can create a controller without any explicit code, using just a simple full HTML view. We’re shifting from CSV to HTML, and the dirty little secret of Excel is that if you feed it an HTML table, it will automatically grok the table cells and convert them into spreadsheet cells.
00:02:00
This trick doesn’t work with many alternative spreadsheet programs, though. Our goal is to make both the default HTML format and the XLS format work together without needing to write code.
00:02:21
Before we implement our hacks, there’s a fundamental task: we need to register the XLS mime type. Now, let’s discuss the hacks. The first step is to alter the mime response collector. You might be wondering, what exactly is the mime response collector? It’s the part that is yielded from the respond_to method in Rails.
00:02:39
We can tweak it by ensuring that the XLS mime type is always available. After that, we can get rid of those four lines of code. However, that is only part of the solution; we also need to modify the lookup context.
00:02:56
The lookup context is an internal Rails object containing all the information needed to find your view. If you’ve encountered a missing template exception, most of the data in that exception arises from the lookup context.
00:03:08
We need to hack the lookup context so that when the XLS format is specified, it defaults back to the HTML view.
00:03:21
Technically, that's all you need to make this work, but there are some side effects. One common issue is that you probably don’t want your layout appearing in your spreadsheet. Although Excel handles that somewhat adequately, we’re aiming for a cleaner result.
00:03:39
To avoid this, we’ll override the normalized options of the Abstract Controller layouts module. This effectively nullifies the search for your layout when it’s an XLS request.
00:03:57
Finally, we need to inform Excel about the encoding. This step involves embedding an HTML encoding declaration and prepending it with the appropriate meta tag in the HTML.
00:04:10
This is a good place to include our MIME type as well. By mixing these two modules into ActionController::Base, we can transform our browser output into an Excel-friendly format.
00:04:27
In my demonstration, Tony Romo is now a happy man, along with all my friends here, and that's the gist of the internationalization aspect. So, can you do this? Should you do this? There are pros and cons.
00:04:45
On the plus side, you’ll gain a deeper understanding of how things work behind the scenes. This knowledge can be invaluable when dealing with a leaky abstraction. However, be prepared for the potential pitfalls. It’s time-consuming, especially when there are excellent tutorials for setting up a rendering engine properly.
00:05:04
On the downside, you risk introducing issues by modifying every request. Changes in Rails internals could cause unforeseen problems. In my case, I managed to cut down the code from 23 lines to just three, and after that, it’s been smooth sailing!
00:05:25
In summary, the top link here is Eaccelerator, the gem we use in production; the middle link is the code I presented today, and that's my Twitter handle. Thank you!
00:05:42
Hi, I'm Tom Brown, and I will be discussing a gem called Rack OAuth 2. This gem supports both OAuth providers and clients, but I'll primarily focus on providers during this five-minute talk.
00:05:54
You can find me on Twitter, and here's a link to the gem on Big Ruby at bigrubyr2.heroku.com. The mantra for OAuth is simple: get a token, use a token. To illustrate, I’ll reference a neat payment service called Duala, which exposes an OAuth API.
00:06:10
In the process of getting a token, the client redirects the user to the provider's authorization form, where they decide whether to accept the required permissions. In Duala's case, the client requests permission to make payments on behalf of the user.
00:06:26
Once the client obtains a token, the next step is to use that token. Simply take the token received from the first step and make a POST request to the bill recipient.
00:06:43
To summarize, the key points are: get a token and use a token. At Lone Star Ruby Conference 5, James Edward Gray delivered an excellent keynote emphasizing the need for skepticism.
00:07:04
We should be cautious of OAuth gems because OAuth was meant to be a protocol, not a framework. It should operate similarly to HTTP, simply handling protocol-level tasks.
00:07:22
If your gem is doing more than that, it’s worth questioning its reliability. Furthermore, many advocates suggest ignoring the details of authorization or authentication when using code. However, it’s important to remember that these details could hide well-known vulnerabilities.
00:07:39
This leads us to a discussion of a gem by NoVu called Rack Module. It’s a straightforward rack module, and he provides an example project demonstrating how to implement it in a Rails project.
00:08:00
Moving on, I want to discuss OAuth’s role in authentication versus authorization. While OAuth is essentially an authorization protocol, people often mistakenly attempt to use it for authentication.
00:08:14
A critical question to pose is whether the gem addressing the 'licit Grant' threat assessment in the security spec. Often, these gems come up short.
00:08:34
A user can be easily lured into providing credentials to a rogue OAuth client, obtaining a token that could be misused on another client.
00:08:50
Sometimes, clients even expose their database of tokens, as was the case with face.com when exposed by Facebook.
00:09:04
When approaching a new gem, though it may seem intimidating initially, I suggest focusing on using the token first before worrying about obtaining one.
00:09:29
In step two, attempt transactions using the received token. Configure your rack module in your application, ensuring you validate this token before it reaches your Rails application.
00:09:45
Below is an outline for how to handle user access using the access token. This method ensures you establish user credentials as if they had logged in.
00:10:07
Returning to step one, the form must be presented when the user visits it, and after they submit, it will return to be approved.
00:10:18
Mic on, please.
00:10:27
Hi, I don’t work with Ruby, but I still attend these events because they’re a lot of fun! I used to regularly attend Dallas RB, so I recognize some of you, and I must say that attending lightning talks has led me to speak at conferences worldwide over the past three years, which is amazing!
00:10:55
Recently, I began working on several projects, with my latest being the creation of a new programming language. I’ll give you a brief overview of it today.
00:11:20
My language aims to facilitate interactive learning while coding actively.
00:11:36
Designed to be minimalistic, it takes inspiration from Ruby, JavaScript, and Lua. The goal is to make programming more accessible to beginners.
00:11:56
Previously, while teaching Ruby to elementary students at Dallas RB, I observed they grasped it quickly. I aimed for a language simpler than both Ruby and JavaScript.
00:12:06
This new language is straightforward: no prototypes, no classes, no dynamic scope, just functions and closures. I plan to develop backends that run both on the web and natively.
00:12:25
Let's take a glance at the syntax: variables include null, true, false, integers, and strings, while a buffer primitive allows embedding binary data directly.
00:12:40
Furthermore, the function literals use curly braces for defining arguments and body, similar to Ruby lambdas.
00:12:56
I’ve included custom looping mechanisms. You can loop over objects as key-value pairs or lists, and even general functions until null returns, allowing for custom lazy generators.
00:13:05
Basic arithmetic, if-else statements, and while loops are included—essentially encapsulating the language's entirety.
00:13:22
Congratulations! You’ve just learned it all, and you can now say, 'I know Jack', as that’s the name of the language!
00:13:36
Instead of continuing with syntax presentation, let's jump to a demo. I’ve invited two participants to demonstrate this language in action.
00:13:50
I’ve decided to use my Linux laptop for this demo, as Linux seamlessly manages IO devices like files.
00:14:03
As an example, I’ve developed a small program called Gamepad. This program opens various input devices and creates a few bot functions that interact with users.
00:14:17
Let me demonstrate this by plugging it in; one participant can control it while I observe.
00:14:30
The program will process input from the joysticks, allowing participants to engage in interaction while I showcase how everything works.
00:14:55
Now you can see the joystick input in real-time, capturing all the events, so everyone can see the controls in action.
00:15:14
I should point out that this program can be translated easily into Ruby, particularly using an event-driven paradigm with EventMachine.
00:15:35
With just a few minutes left, that concludes my time. Thank you all for listening!
00:15:50
Next up, I'd like to introduce Keith Bennett, who will discuss JRuby—a blend of Ruby and Java.
00:16:35
JRuby provides the synergy of Ruby’s elegance with Java’s stability, exploiting its multithreading capabilities and extensive libraries.
00:16:52
One library worth mentioning is Apache Tika, an open-source Java library I contributed to during my previous tenure.
00:17:06
Tika seamlessly integrates various open-source libraries to parse diverse document types, presenting an excellent resource for Ruby developers.
00:17:24
Let’s try running a demo in IRB to encounter Tika’s capabilities in action. It’s designed to retrieve content and metadata from documents.
00:17:42
Tika’s parser libraries represent a significant amount of work by numerous contributors, delivering invaluable tools to Ruby.
00:17:52
Switching gears, let’s delve into multithreading within JRuby. Unlike MRI Ruby, which is limited by a Global Interpreter Lock (GIL), JRuby can fully utilize CPU resources.
00:18:11
To demonstrate, I’ll run a thread function that generates random numbers while displaying CPU utilization.
00:18:24
First, I’ll run a test in standard MRI Ruby, and we should see it running at a single CPU capacity.
00:18:42
Next, I’ll run the same code in JRuby to notice the significant increase in CPU usage, illustrating JRuby’s strengths.
00:19:01
With visual tools at our disposal, we can monitor Java virtual machines for clarity on concurrent performance.
00:19:11
For instance, VisualVM highlights the active threads while showcasing their states and performance metrics.
00:19:31
This presentation emphasizes the capabilities of JRuby through interaction with existing Java libraries, such as visualizing a Game of Life implementation.
00:19:50
Using Java's robust internationalization support means Ruby developers gain native localization benefits as well.
00:20:06
I also crafted an integer formatting function to address locale-specific number formats, thus enhancing visuals.
00:20:25
Let’s wrap things up by exploring a short script displaying the available locales within the Java runtime.
00:20:42
We can observe how effectively JRuby can globalize output, providing adaptability for Ruby applications.
00:21:00
Thank you for your attention!
00:21:10
Now, let’s return to the beginning.
00:21:20
I’m Marshall Yount, a developer who enjoys tackling scalability and performance issues during my day job. There's a creative side of me that leads me to create art projects like the one I'll address next.
00:22:00
My latest art project was designed for Burning Man 2012, titled "Connectible Pipe." Burning Man is an event I truly adore because, like the Ruby community, we celebrate ingenuity and creativity.
00:22:20
The main distinction is that we often burn our creations at the end of the event!
00:22:50
My art project from last year involved constructing a large ball of light—composed of aluminum rings measuring 25 feet in diameter, featuring 12 intersection points.
00:23:10
Around these points, I mounted computer-controlled DJ lights and used Microsoft’s Kinect sensor for interaction.
00:23:30
As part of my research, I discovered OpenNI, a C++ library that had several complications. My goal was to work around these limitations—specifically the language barrier and licensing issues.
00:23:50
I aimed to write Ruby gems aligned with this project to create more accessible tools. This involved writing minimal C++ code just to enable JSON output.
00:24:10
This process produced some less-than-ideal code, but it encapsulated only the essentials needed for interaction.
00:24:30
Eventually, after much work, I achieved an output that worked, capturing data points for each user interacting with the Kinect device.
00:25:00
Here’s a demonstration: I’ll get a volunteer to approach the Kinect so that it can detect their movements. This device can observe gestures at around 30 frames per second.
00:25:30
As a result, the data streams in rapidly, allowing for gesture and movement recognition.
00:25:55
I'll just switch back to my slides now.
00:26:20
This project allows for participant detection and basic gesture recognition. Over the summer, I hustled to complete this in time for Burning Man and face the tight deadline!
00:27:00
To summarize, I'd love help refining these ideas and projects during a local hack night coming up soon on March 19th.
00:27:30
I’ll bring gear and would love to collaborate with anyone interested!
00:27:45
If you're into cool toys, please join! You can find my contact information on the last slide.
00:28:15
Now, back to Chris for a brief follow-up.
00:28:35
Hi, I'm Chris again. As long as dhh hasn't fired me yet, I’d like to continue with the theme I introduced earlier.
00:28:55
We’ve all heard of technical debt; today I’d like to discuss technical intimidation. Let's reflect: do you know Rails, Sinatra? Can you program concurrently, or stream hypermedia asynchronously?
00:29:15
Can you tell the difference between xss, CSS, scss? How about injecting SQL into a canoli or handling closures with your monads? It can get overwhelming!
00:29:40
Believe me, if you think you know all of these details, you're probably fooling yourself! Some prominent voices in our industry have shared similar feelings—fear of judgment when asking questions.
00:29:55
This leads to feelings of inadequacy. Let's recognize that adaptability and acceptance are crucial traits in this field.
00:30:15
Technical challenges can leave us all in deep feelings of shame, but it’s acceptable to admit knowledge gaps.
00:30:37
Jerry Weinberg pointed out that programmers need to maintain good mental health alongside their technical skills.
00:31:00
Software development demands considerable cognitive effort across vast abstraction levels. Steve McConnell states the enormity of our field is unlike any other profession.
00:31:15
Great design is hard. As you focus closely on features, you reveal rough edges that need polishing.
00:31:40
So let's reframe our perspectives on these challenges, knowing that we won't learn it all. Learning from those around you is key—seek out those more knowledgeable.
00:32:05
Consider Pat Mathis' wisdom: always be the least skilled member in any team to promote personal growth. As we conclude, remember, it's essential to appreciate your technical struggles while remaining humble.
00:32:30
Finally, I'd like to recommend Brené Brown's insightful TED Talks on exploring topics of shame—wonderful resources for us all. That’s my time, and here’s my Twitter info. Thank you!