Understanding Ruby Metaprogramming and DSLs

A DSL, or Domain Specific Language, is a language that has a specific purpose rather than a general purpose, like C or Java. One of the most popular DSLs is SQL because it’s the standard for querying a relational database and its syntax is specific to activities such as sorting, filtering, and displaying data.
SQL falls under the category of external DSLs, which means it requires its own parser and implementation of all of the necessary components. Other examples of external DSLs are Gherkin, for writing feature files, Make Files, for building C and C++ applications, and HTML, for declaring webpages).

Link: https://dzone.com/articles/understanding-ruby-metaprogramming-and-dsls?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Dealing With Ruby Dependency Conflicts

Dependency hell: If you’ve done any significant amount of programming or system administration, no matter which framework you used, you’ve been there — you’ve found yourself bogged down in cross-dependency and package configuration issues.
While a certain amount of dependency resolution is a fact of life for most developers, there are tools that can help to manage it. How you ask? This article discusses tools designed to mitigate dependency conflicts for Ruby programmers including ActiveRuby.

Link: https://dzone.com/articles/dealing-with-ruby-dependency-conflicts?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

I Dare You Not to Fall In Love

On the best parts of using Ruby on Rails for software development, thus spake its creator David Hansson:

You get to use Ruby, which, even in a world that has rediscovered the benefits of functional programming and immutability, remains the most extraordinarily beautiful and luxurious language I’ve yet to encounter. Just look at some code. I dare you not to fall in love.

Well, this is my exact opinion of Ruby, my most favorite programming language; but I couldn’t have articulated it any better than Hansson.

Link: https://dzone.com/articles/i-dare-you-not-to-fall-in-love?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

The Longest Email I Ever Sent (Programmatically)

It was a quiet day in July when I got a message from SendGrid about a service I run, CodeTriage, which helps people contribute to open source projects, had gone over its limits. Calls to send out emails were all failing. The fix was easy: bump up the limits by going to the Heroku dashboard, click “edit,” and adjust the plan. Previously I got notifications that I was almost out of credits for the service, but since it was SOOO close to the end of the month, I thought I could squeak by without having to upgrade. I was wrong. No biggie though, as soon as I upgraded my add-on emails started to flow again. It wasn’t until later that I got the bug report, while I was successfully sending out emails, they were MASSIVE. Some of the people who got them couldn’t even open the emails, they were causing the clients to crash. Before we can understand why we need to understand how the service sends out emails.
The service works by sending people links to open OSS issues in their inbox, or for Ruby apps links to methods that can be documented. It is an “email first” interface, and if emails aren’t working then the whole app is effectively down. The idea behind sending users open issues is that they can help “triage” them. Ask the reporter for specific version numbers, or for an app that reproduces the behavior. As such, when a core contributor to the project gets to that issue, there is less that needs to be done, the issue no longer needs triage and is ready to be worked on.

Link: https://dzone.com/articles/the-longest-email-i-ever-sent-programmatically?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Code Recipes Now on GitHub – 5,000+ Recipes for Python, Perl, Ruby and More

For more than a decade, ActiveState has hosted a vast repository of code recipes and discussions over at https://code.activestate.com/ – but in recent years it began to seem out-of-sync with the way developers shared code. New users and recipe updates had to be disabled to prevent spam and yet there remained a treasure-trove of interesting and useful pieces of code in this archive.
So, as the first phase of our ongoing effort to update and improve our community sites, we’ve migrated the entire library of code recipes (more than 5K recipes, 15K files and a mind-boggling >700K lines of code!) to GitHub. It’s become clear that GitHub is the central repository where developers share code, and to make it easier we’ve transferred all of the recipes, along with their descriptive text and original licensing terms to our new GitHub repo.

Link: https://dzone.com/articles/code-recipes-now-on-github-5000-recipes-for-python?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

How to Write a Lock-Free Queue

Update: I did mention that lock free data structures are really hard to write, it looks like there might be some issues that haven’t been addressed in the implementation of this LF Queue that we’re referencing. The rest of the analysis is still valid and hopefully useful to you, just know there’s actually more that needs to be done, don’t try to use that code for a mission critical application out of the box.

It’s said that locks keep honest people honest. In programming, locks keep multi-threaded programs honest by ensuring only one thread can access a resource at a time. Why would we want to get rid of locks then? In this post, I’ll revisit the queue that I wrote in C and instead look at a “lockless” queue implementation. We’ll talk about atomicity and the tradeoffs when choosing one strategy or the other, and end with some ways to write “lock-free” Ruby code. Prepare to unlock your imagination!

Link: https://dzone.com/articles/how-to-write-a-lock-free-queue?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev