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).
I’ve been through a few programming languages over the years, and I can say without hesitation that Ruby is my favorite. Not the “best” (there is no “best” programming language), but my favorite. Here’s why: You can get the same…
The post Why Ruby is Awesome appeared first on Treehouse Blog.
Every Wednesday, new courses and workshops are added to the growing Treehouse Library! Read more about our new course Ruby Basics course and our two new workshops below. Also check out course coming later this month, and watch our weekly video update…
The post New Treehouse Course & Workshop Highlights appeared first on Treehouse Blog.
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.
A friend of mine recently asked how to do default route arguments and route specific configuration in Slim, so I thought I’d write up how to do it.
Consider a simple Hello route:
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.
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.
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.
Kill 0 Octal Prefix
I’m limiting this list to backward compatible changes, but this is one exception. It technically breaks backward compatibility, but in reality, it’s far more likely to quietly fix bugs than to introduce them.
Here’s a quick quiz. What does this code print:
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!