September 12, 2014

Ryan DavisOne Reservoir Nerd Left

2014/09/12 07:00 PM

reservoir_nerd.png

And then there was one. (2,060 days later, a bit slower than the movie).

Unlike last time, this time it’s just me. 23 years experience, 14 (next month) in ruby, I’m available and looking.

I would love to wind up doing more open source work, or helping to optimize your people/processes/codes. I’ll be speaking at gogaruco next week. If you’re nearby, you should come talk to me.

August 28, 2014

O'Reilly RubyFour short links: 28 August 2014

Nat Torkington @ 2014/08/28 01:13 PM
PlotDevice — A Python-based graphics language for designers, developers, and tinkerers. More in the easy-to-get-started + visual realm, like Processing. (via Andy Baio) Scumblr and Sketchy Search — Netflix open sourcing some scraping, screenshot, and workflow tools their security team …

August 15, 2014

O'Reilly RubyThoughtful Machine Learning

O'Reilly Media, Inc. @ 2014/08/15 04:30 PM

Apply a fully test-driven approach to machine-learning algorithms, and save yourself the pain of missing mistakes in your analyses. Just because and analysis runs doesn’t mean it’s correct. This book shows software developers, business analysts, and CTOs how to write tests and build checks into their work. Using the Ruby programming language, you'll learn how to test machine-learning code, and understand what’s happening "behind the scenes."

August 08, 2014

O'Reilly RubyMetaprogramming Ruby 2

O'Reilly Media, Inc. @ 2014/08/08 04:28 PM

Write powerful Ruby code that is easy to maintain and change. With metaprogramming, you can produce elegant, clean, and beautiful programs. Once the domain of expert Rubyists, metaprogramming is now accessible to programmers of all levels. This thoroughly revised and updated second edition of the bestselling Metaprogramming Ruby explains metaprogramming in a down-to-earth style and arms you with a practical toolbox that will help you write your best Ruby code ever.

July 23, 2014

O'Reilly RubyReddish-Greenish-Refactor

Hew Wolff @ 2014/07/23 01:31 PM
“Red-Green-Refactor” is a familiar slogan from test-driven development (TDD), describing a popular approach to writing software. It’s been both popular and controversial since the 2000′s (see the recent heated discussions between David Hansson, Bob Martin, and others). I find that …

June 04, 2014

RubyLoveIntro to my possible Ruby Book

2014/06/04 07:00 AM

My own history

I have been coding since I was thirteen, when my Father came home with old IBM clone that he traded for during the 80’s barter craze. Being nearly forty years old now, I have stubbed my toe and left it bleeding in more than a dozen languages now. If I were a construction worker instead of a knowledge worker, I would probably be missing fingers, toes, and possibly a hand or leg.

When I look at my whole career in code, I see a common theme. From BASIC, to C to C++, to VB, to Javascript to C# to Ruby I have been writing imperative, stateful code for my whole career. I have lived with loops, state mutation, and C syntax, and was blissfully unaware of anything else as I had skipped the CS degree and opted to go directly into the workforce at eighteen.

I worked through the 90s as the Internet was in it’s very early years. I had a Geocities page for my Warcraft tips and strategies. It probably didn’t blink, but it must have been fugly. I worked for companies that turned email into snail mail, companies who turned snail mail into email, and companies who made adware for Windows machines and a little bit of everything in between.

When I coded in C, we hated those ‘weird’ C++ guys. We would tease them about using a language before the improvement, since it wasn’t ++C. Then I joined that group to write DCOM and COM+ for Intel. We made fun of the VB programmers. Then I became a VB programmer when ASP exploded, since it was essentially VBScript, and I don’t like context switches. Then it was semi-colons that were stupid.

By the time I got to Ruby I hated working with the Microsoft stack. The guy that introduced me to Ruby in 2006 was working in C# with me, and constantly opined at the lack of jobs in Ruby and LISP. We hacked a bit during lunches, but I never had time to get serious about Ruby, as I worked at a startup. Like 80 hours a week worked at a startup.

He never made fun of anything in languages. He didn’t point out differences in the languages in a snide way. Every tool had uses, and every language had interesting points and beautiful aspects. It was almost his attitude alone that made me want to work with Ruby. The language seemed very much like this programmer. Friendly, smart, concise, and there wasn’t a lot of, no you cannot do this, you shouldn’t do that.

I was introduced to the concepts in LISP and some functional programming by him as well. He also was a versed smalltalker. He really opened my eyes. Then I got a Ruby job and moved to Amsterdam for it. I can’t even remember this guy’s name beyond Courtney, but I will forever be grateful to what he shared with me.

Debugging

I have spent more hours in my life with debug statements, than probably anything else, except possibly sleeping or growing older. I used to think that this was just the state of things. You wrote some code, then you ran it, and it either, A) ran and acted as expected or B) politely suggested I write some debug statements to what was really going on.

Debugging is basically detective work. When the code you interact with is convoluted, and obfuscated through constant laziness and ignorance, you constantly have new mysteries to solve. The mystery you really are solving here is not syntax, it is not structure, it is almost always state, and the way that state is formed and managed.

Why state is hard to reason and debug

When I speak of state what I am really speaking of, are memory addresses. In the early days of computers, memory was very pricey and in limited supply due to space. This meant programmers were forced to write efficient code, and efficiency meant small size and fast speed. So developers wouldn’t think twice about reusing a memory address instead of allocating more, it was in fact preferred given the space you needed was equal or less to what was already allocated.

Still today, programmers will reassign a variable over and over, changing it’s state. Memory is now very cheap and machines have lots of capacity, and yet variables are rewritten habitually. And not just setting something else to that memory address, but also changing what was there originally.

So imagine we have a Person class. The class has several pieces of internal state, we will just focus on ‘name’ and ‘favorite_color’, for our example, I will use my Uncle Bob, because he has taught me so much.

So I create a person class instance, Bob. Then I save him off to a database, the how doesn’t really concern us, so I will just use a descriptive stand-in double.

Then later on, I find that I need to fill in the last name as well and then re-save it:

But then later on again, I alter it again, but adding some other field and overwrite it again. And so on and so forth.

Now trying to rationalize about the state of that object is difficult because it changes and changes and there is no audit trail of what it used to be like. It is like a video stream that cannot be rewound.

Immutability

I will now do the same thing as above, but this time, I will create new copies of Bob before I alter his state:

I now need to change his name to his full name, so I create a clone, alter that clone, then save.

Now I change it again, this time because we find out my Uncle’s favorite color is, in fact, green.

But you might say, what about in the database we are ignoring? What about primary keys? It isn’t the concern here, but you could use last updated at and update a join table with a static guid, and the current id, but again, not the point here.

Now I want you to think of this process not as a video stream that cannot be rewound, but a set of many still snapshots. If you were combine the stills, you could recreate the stream again. However, if you want to, you can lay these versions of my Uncle together out in front of you on a desktop and see all states of Uncle Bob before you at once, and not be stuck debugging the current state of him.

In a way, this style of state management gives you an almost superhuman power of all seeing, where you can look at a person and instead of seeing them as they are you can see all versions of them as any given state of time. Pretty cool, next you might be able to dodge bullets!

The death of a generation of programmers

For the entirety of computing up until 2012-2013, memory and speed were doubling every year as noted by “Moore’s law”. During that time, the amount of abstraction, or layer on layer of code to make dealing with the complexities of voltages and gates and registers easier on up to windowing tools and the GUI.

These two have gone at about the same pace, the latter being limited by the former. However, seeing “ahead” of time by measuring the slow of growth per cycle, the CPU industry changed gears and instead of making the single core much faster, they bundled cores together to create a multi-core architecture.

Programmers who do not adapt to this new age of multi-core will cease to be hireable and their families will starve like in a Dickens’ novel. Do not let this happen to you!

The multi-core, memory address problem

Now that processors are no longer growing exponentially, and multi-core architecture has taken over, we have threads that operate against different cores. One core can accessed at the same time as other cores, which is where they get their speed improvement over the single core.

Yet there is only one memory register. Well, this is not entirely true, but there is likely only one memory register your application has access to. That means you could have something like the following:

So I create Bob again, but this time, pretend this is going to happen on core 1:

Bob’s favorite color is about to change again, but it will be done by core 2:

Then core 1 tries to access their copy again, but wait…. it is not in an unexpected state. It was modified by another core, and this can create race conditions that include memory corruption.

That is a highly over-simplified explanation because I am not a hardware engineer nor are the absolute internals of the CPU our domain. What you should gather here is that a developer can no longer ignore threads and multiple cores or how they might interact with each other. We need to write software that naturally works in this brave new world.

To do so, we dig into the braver old world, where smart people have already figured out the problem and the solution before it even existed. In this book I will help guide you on a path from the imperative to the explicit, and the object oriented to the functional. These concepts are not polar, they are orthogonal, that is, you can plug them into each other for a hybrid experience.

Let’s embark into the magical world of value objects, immutability, hybrid functional programming, threads, and homoiconicity, but do so in the comfortable and familiar, friendly world of Ruby!

June 01, 2014

RubyLoveRubyLoveLive Sunday Sessions

2014/06/01 07:00 AM

This week we started to outside-in, TDD some code towards a static website generator. Here is the video!

May 31, 2014

RubyLoveRefactoring conditionals out of your code

2014/05/31 07:00 AM

Today I will be doing something a little different.

I have prepared some Ruby code to show how conditionals can breed like rabbits, and how to spay and neuter those bunnies before it gets out of control.

Along with the code, there is a screencast or as I will call it, a RubyLovecast. In the video, I will walk you through several revisions of the code, first showing how conditionals grow, then how to take a weedwacker to them.

I am looking for feedback, so tweet that shit at @thatrubylove and hit me hard. My plan is to take a weeks worth of feedback and then ‘reshoot’ the screencast, taking your input into account.

So until next week’s rubylovecast…. love and hacking

May 26, 2014

RubyLoveI am now a till time Ruby/Rails coach

2014/05/26 07:00 AM
  • Please note, I am not accepting students…. unless I suppose you have an exceptional mind.

I have to apologize for being away so long. I ended a relationship that had drug on for far too long and going nowhere, and at the same time I decided that I will no longer accept clients that refuse to place the proper amount of importance on quality and training.

The two of those catalysts essentially derailed my life and then gave me a hovercraft instead! I started mentoring @ codementor.io and then was convinced by a friend of mine to also become a full time mentor @ bloc.io.

Needless to say, I have been very, very busy.

Along with now mentoring about 12 people from various sources (we do 2 hour sessions monday through thursday and students chose from the morning or evening session) I have been speaking with awesome developers who have been my heroes.

I have been gleening their thoughts about my thoughts and about their own and others thoughts… honestly, it is a lot like Primer of the mind for developers. It has been a blast. For instance, here is myself and one of my heroes, J.B. Rainsberger discussing my Ruby Manifesto.

I promise I will post another in depth very soon. My question for my readers…. What do you want to learn? Also, would you like to join me every Sunday 12pm to 2pm CST for live sessions?

Let me know on twitter please. @thatrubylove

May 21, 2014

Charles Oliver NutterJRubyConf.eu 2014!

Charles Nutter (noreply@blogger.com) @ 2014/05/21 11:44 AM
I'm thrilled to announce that we'll have another edition of JRubyConf.eu this year!

Last year's event was a great success. We had a two-day conference in Berlin immediately before Eurucamp 2013, with two speakers from the core team (myself and Tom Enebo) and a whopping fifteen non-core speakers. A great event was had by all.

This year, we've decided to pull the event back to its roots, as part of Eurucamp 2014. We'll return to the single-track, single-day event co-located with and immediately preceding Eurucamp on 1st August. We really wanted to bring JRuby back to Rubyists, and we're looking forward to hanging out at Eurucamp the whole weekend!

Why not visit Eurucamp early and spend a day learning about JRuby with the best JRubyists in Europe?

If you're interested in attending, tickets are available for only €99 at the Eurucamp ticket site now!

We're also looking for speakers from the JRuby community. You can submit to the CFP (which ends Sunday 28 May) using the Eurucamp CFP app.

Looking forward to seeing you at JRubyConf and Eurucamp this summer!

May 02, 2014

Ryan DavisCatching Up

2014/05/02 07:00 PM

I realize that is has been a hellishly long time since I last updated this thing.

When last we met I brain-dumped most of my emacs setup and then promptly disappeared. I know that at least a few of you have used that to good effect and that’s been encouraging.

But since then, I’ve had some fun.

Gems:

I’ve done 63 gem releases in the last 6ish months, mostly thanks to a bunch of generous contributors. In all it includes 6 major, 109 minor, and 65 bug fixes. Fan-fucking-tastic! This brings a bunch of my more stable projects up to date for 2.0 & 2.1: autotest-rails, flog, graph, image_science, minitest-bacon, minitest-focus, minitest_tu_shim, omnifocus, omnifocus-github, rubygems-sandbox, RubyInline, vlad, ZenTest, and ZenWeb.

I spent a lot of time focusing on 2 of my favorite gems: hoe & minitest.

Hoe & Minitest

Hoe makes it a breeze to manage all my gems and really is the reason why I can do what I do with so many projects. It is incredibly important to me that my projects don’t have any duplication across them. By using Hoe, any changes that happen across my projects happen in one place only. DRY at its finest.

Minitest went through a complete rewrite for version 5 early last year. Thanks to a lot of people for contributing to minitest and helping make it what it is today. The architecture is vastly improved over minitest 4 and it shows. Ever since the v5 rewrite, I absolutely love this project and thank you all for it.

Language Love

ruby_parser has seen some serious love in that time, as well as some love for its supporting projects.

For the supporting projects, sexp_processor got some nice refactorings from other projects, including adding MethodBasedSexpProcessor from Flog. ruby2ruby was extended to 2.0 and 2.1 support. The nice thing about these guys was how cleanly designed they were to begin with so they didn’t see too much over the last year.

But… For ruby_parser… which saw 17(!!) releases in 2012 but only 5 in 2013… I got a bit burnt out on the project, but I’ve had a bit of a comeback. I’ve done 5 releases already this year. I’ve added support for 2.0 and initial support for 2.11. But most importantly, I rewrote the hand-written lexer from scratch using a brand new project: oedipus_lex.

Oedipus Lex

Oedipus Lex is my independent lexer fork of Rexical. Rexical was in turn a fork of Rex. While Oedipus Lex is a cleanroom re-implementation of rexical, but it is also massively extended including proper ruby regexp support, predicate method prerequisites, grouping for extra performance, shortcuts on state changes, and action methods. I love this project for what it has done to the maintainability of ruby_parser, but more importantly, Oedipus Lex makes ruby_parser roughly 60% faster than my highly-optimized hand-written lexer.

Talks:

I had a lot of fun on the conference circuit in the last year.

Last year, I gave Let’s Write an Interpreter! at both MWRC and GoGaRuCo. I spoke about Minitest & Rails in Chicago. And I spoke about craftsmenship and tools at cascadia.

So far this year I’ve given one talk at MWRC, Nerd Party v3.1, which was my take on Seattle.rb’s format and how it can work for you.

  1. Please! if you want to help out with ruby_parser (or flog/flay/etc), I could use a PR for the new rational & imaginary lexemes!

April 18, 2014

O'Reilly RubyRails 4 Application Development HOTSHOT

O'Reilly Media, Inc. @ 2014/04/18 03:32 PM

In Detail

Rails is a rapidly moving, open source, web development framework, and keeping up to speed with it is a big task. You might have already built applications using it, but there have been significant changes in the syntax and semantic of the Rails framework in the latest upgrade. Upgrading applications needs an approach that not only helps the upgrade, but also helps to improve on what has already been built, so that it performs even better.

Presenting a practical approach to upgrading your knowledge for Rails 4, this guide shows you how to build the most popular types of applications using Rails 4, and highlights new ways to do things. The book also closely follows lots of the best practices, gems, and popular solutions already known to the community, and tracks the changes in these based on Version 4 of Rails. This book brings new ideas to refactor and restructure code to make it perform better in production, and enables you to write production-ready code.

The book starts off with relatively simple application, demonstrating the new application structure, the testing framework, and several day-to-day tasks. The complexity of applications will increase with each chapter.

In the first half of the book, you will learn to build a recipe sharing website, a conference and RSVP management application, an online Pinboard similar to Pinterest, a SaaS-based application, and a customizable content management system demonstrating concepts. In the later half, you will get to know MongoDB by building an analytics dashboard using MongoDB and Rails. You will also create a mash-up of some common APIs such as Google Maps and Twitter and make them work with one another. One of the new features we will look at in this book is an API-only application with no frontend. At the end of the book, you will learn how to use HTML5 concepts to your advantage and extend the Rails framework with reusable engines.

This book is designed to update, upgrade, and improve your knowledge of Rails 4, as well as your applications.

Approach

Attractive practical projects to polish your application building skills, through a straightforward, highly focused and interesting approach towards application development.

Who this book is for

If you are a developer who is already familiar with the basics of the Rails framework and have previously worked with Rails 3.2 or earlier, then this is the ideal book for you. It is assumed that you have some prior experience with the development of applications. This book will help you to upgrade your existing knowledge and also ensure its applicability. You will be expected to setup Rails, MySQL / PostgreSQL, Mongodb and required dependencies themselves.

March 26, 2014

O'Reilly RubyCustomizing Chef

O'Reilly Media, Inc. @ 2014/03/26 03:32 PM

Learn how to customize Chef by examining the internal structure this configuration management tool and navigating its source code. This practical book also shows you how to integrate external tooling with Chef via the API, and takes a look at more advanced customization. By the time you finish this book, you'll have a thorough understanding of how Chef fits together and be able to position your customization in the most appropriate place.

December 19, 2013

O'Reilly RubyLearning Mongoid

O'Reilly Media, Inc. @ 2013/12/19 08:34 PM

In Detail

Mongoid helps you to leverage the power of schema-less and efficient document-based design, dynamic queries, and atomic modifier operations. Mongoid eases the work of Ruby developers while they are working on complex frameworks.

Starting with why and how you should use Mongoid, this book covers the various components of Mongoid. It then delves deeper into the detail of queries and relations, and you will learn some tips and tricks on improving performance. With this book, you will be able to build robust and large-scale web applications with Mongoid and Rails.

Starting with the basics, this book introduces you to components such as moped and origin, and how information is managed, learn about the various datatypes, embedded documents, arrays, and hashes. You will learn how a document is stored and manipulated with callbacks, validations, and even atomic updates. This book will then show you the querying mechanism in detail, right from simple to complex queries, and even explains eager loading, lazy evaluation, and chaining of queries. Finally, this book will explain the importance of performance tuning and how to use the right indexes. It also explains MapReduce and the Aggregation Framework.

Approach

A step-by-step tutorial with focused examples that will help you build scalable, high performance Rails web applications with Mongoid.

Who this book is for

If you are an application developer who wants to learn how to use Mongoid in a Rails application, this book will be great for you. You are expected to be familiar with MongoDB and Ruby.

November 16, 2013

O'Reilly RubyCrafting Rails 4 Applications

José Valim @ 2013/11/16 05:36 AM

Get ready to see Rails as you've never seen it before. Learn how to extend the framework, change its behavior, and replace whole components to bend it to your will. Eight different test-driven tutorials will help you understand Rails' inner workings and prepare you to tackle complicated projects with solutions that are well-tested, modular, and easy to maintain.

This second edition of the bestselling Crafting Rails Applications has been updated to Rails 4 and discusses new topics such as streaming, mountable engines, and thread safety.

Rails is one of the most extensible frameworks out there. This pioneering book deep-dives into the Rails plugin APIs and shows you, the intermediate Rails developer, how to use them to write better web applications and make your day-to-day work with Rails more productive.

Rails Core developer Jose Valim guides you through eight different tutorials, each using test-driven development to build a new Rails plugin or application that solves common problems with these APIs. You'll learn how the Rails rendering stack works and customize it to read templates from the database while you discover how to mimic Active Record behavior, such as validations, in any other object. You'll find out how Rails integrates with Rack, the different ways to stream data from your web application, and how to mix Rails engines and Sinatra applications into your Rails apps, so you can choose the most appropriate tool for the job. In addition, you'll improve your productivity by customizing generators and responders.

This book will help you understand Rails' inner workings, including generators, template handlers, internationalization, routing, and responders. With the knowledge you'll gain, you'll create well-tested, modular, and robust solutions for your next project.

O'Reilly RubyBuild Awesome Command-Line Applications in Ruby 2

O'Reilly Media, Inc. @ 2013/11/16 05:35 AM

Speak directly to your system. With its simple commands, flags, and parameters, a well-formed command-line application is the quickest way to automate a backup, a build, or a deployment and simplify your life. With this book, you'll learn specific ways to write command-line applications that are easy to use, deploy, and maintain, using a set of clear best practices and the Ruby programming language. This book is designed to make any programmer or system administrator more productive in their job. Now updated for Ruby 2.

November 13, 2013

O'Reilly RubyRuby Under a Microscope

O'Reilly Media, Inc. @ 2013/11/13 07:37 AM

Ruby Under a Microscope gives developers an inside, hands-on look at Ruby's core, using simple diagrams coupled with clear explanations.

October 24, 2013

Ryan Davis9000 Commits

2013/10/24 07:00 PM

I just committed the 9000th commit to my perforce repo. Woot!

% p4 counter change
9000

Time between 1000s. You can see some burnout/slowdown between 2009-06 to 2012-02, but it’s been maintaining >1000 per year since then.

% p4 changes | grep "Change .000" | cut -f4 -d\   | ruby -rdate -e 'puts $stdin.read.lines.map { |s| Date.parse s }.each_cons(2).map { |a, b| [a, (a - b).to_i].join " " }'
2013-10-24 335
2012-11-23 294
2012-02-03 436
2010-11-24 540
2009-06-02 358
2008-06-09 489
2007-02-06 655
2005-04-22 1065

Granted, # of commits or commits / day is a stupid metric to follow if you’re trying to measure productivity… but since I’m not trying to game my own system, this ain’t bad.

October 18, 2013

Ryan DavisTime Machine Repair

2013/10/18 07:00 PM

Turn off time machine on all involved parties, then:

% sudo chflags -R nouchg greed.sparsebundle
% sudo emacs -q -nw greed.sparsebundle/com.apple.TimeMachine.MachineID.plist

  # Setting VerificationState to 0 and removing RecoveryBackupDeclinedDate

% sudo hdiutil attach -nomount -noverify -noautofsck -readwrite greed.sparsebundle
% tail -f /var/log/fsck_hfs.log

  # wait for regular check to finish... if it passes, go for it, otherwise:

% sudo fsck_hfs -drfy /dev/diskXs2

  # once you're done:

% hdiutil detach  /dev/diskXs2

For me, everything fixed itself so I was able to skip the last step.

From: http://www.garth.org/archives/2010,07,16,124,fixing-time-machine-sparsebundle-network-backup-errors.html

October 15, 2013

Ryan DavisHappy Birfday to me!

2013/10/15 10:04 PM

Today is my Thirteen Year Anniversary with Ruby! Yay!

780 gem releases (up by 150), 8982 commits (up by 1146), and bazillions of test runs later, and I’m still going strong. Rawr!

Last updated at 2014/09/16 09:19 AM | Presented by Aredridel and Christoffer Sawicki | Hosted at The Internet Company