Jocellyn's Blog

Why Ruby is slow? Apr 16 (2017)

I recently bought a book ‘Ruby Performance Optimization’ by Alexander Dymo and this showrt article is a result of my enthusiasm over this book. However I am still at the beginning of reading, so there may be more content comming! :)

So, why Ruby is slow? When it comes to slow code in general, people tend to come to conclusion that algorithmic complexity is here to blame. Those of us, who had some...

D3 simple visualization (Visu homework V) Nov 13 (2015)

    var years = [2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014

Interesting visualization (Visu homework IV.) Oct 29 (2015)

What is an interesting vizualization? for me, it is this you draw it project. It is not the resulting line chart what would be so stunning, that is fairly standard:


It is the interactivity which is really amazing. Yoy can see it all over - today’s visualizations are full of interacitivty - you can hover over the bar chart to see the labels, you can click few buttons to switch the data beying...

What is wrong with that graph? (Visu homework III.) Oct 21 (2015)

Not every visualization which is out there is a good one. There is an article trying to summarize criteria for judging good or bad visualization called “Junk charts trifecta checkup” and which can be found here. According to this framework, visualization should be judged based on 3 questions:

  1. What is the question?
  2. What does the data say?
  3. What does the visualization say?

Some visualizations could...

Cleaning data for visualization (Visu homework II.) Oct 19 (2015)

Before you can start with any vizualization, you usually need to clean up the data a bit. You will almost never got the data in the exact format and shape which you need. Take my homework as an example - we were suppose to do simple vizualization in Excel, but we got a huge amount of data. This is the original data source which we got:

It comes from the Czech statistical...

Data visualizations by hand (Visu homework I.) Oct 13 (2015)

I got an interesting assignment at my University this week - to draw a variety of data visualisations of one boring dataset. We should think about the possible representations and about what kind of chart would fit the best to be A) visually pleasing and at the same time B) informative and clear.

It was not a hard exercise but it got me think about multiple stories that can be told with the same...

Lazy versus Eager Jul 3 (2015)

There are two main strategies when it comes to evaluation of en expression, regardless of programming language. This article explains the difference using Haskell and then discusses it with comparison to Ruby.

Lets start with a very simple example:

  sqrt (2+4)

This function counts a square root of an expression 2+4. It can do it in two ways:

-- 1. variant
sqrt (2+4)
= 2+4
= 6
= let x = 6 in

Rails queries with Arel Sep 29 (2014)

This article is focusing on basics of building up queries in Rails. What is a query? Well, we can imagine that as a question to our database which gets us some subset of what is stored there. When we do Model.first or Model.all we are building up a simple queries. But what if you want something more complex and possible something involving more than one model?

Well, there are several ways how...

Ruby function arguments explained Aug 3 (2014)

There are several types of variables in Ruby, each of these has a different use and different naming conventions. We will closely examine local variables and their usage in methods in this article, but just to be sure, this table should briefly summarize all Ruby variables as well as other identifiers like constants, keywords and methods names.

Type Naming convention When to...

Best gems for beginners Jul 28 (2014)

Ruby Gems are essential for every Ruby on Rails programmer. They are a small pieces of already written and tested code which provide some functionality. For example, there are many gems which provides admin interface for your app. It means that you instal the gem, make some basic setup and you are all set to use the admin section. You can manage your resources there. This of course doesn’t mean...

Simple charts with C3 - in 5 minutes! Jul 25 (2014)

This article aims to explain how to use a cool library called C3 for building simple charts. C3 is a javascript library which builds on top of famous D3. You can find plenty of good sources (online or printed) on how to learn D3 and make complex visualizations with it, but for many people, these would be too advanced. Often you just need to add a simple graph to a webpage to show some statistics...

Why do I love Haskell more than Ruby? Jul 22 (2014)

When I started to learn Ruby, I was excited. It was so great and so easy! The code was readable almost as English and the language allowed me to do everything I wanted. Well, Rails was a bit magical for me, but it was also a very effective. Maybe I did not exactly know why, but it worked and I was able to build an application.

Here am I, two years later, and I still love doing in Ruby. I have...

Learning Ruby and Rails crossroads Jul 9 (2014)

Ruby on Rails is so popular, that there are merely thousands of good sources of how to learn it. You can choose if you prefer online courses, video courses, live courses, tutorials, blog posts, books, screencats, podcasts or another way. You can learn Ruby and then Rails, you can learn both together, you can even learn only Rails without knowing much about the underlying language. So why to write...

What should you learn together with Ruby on Rails?? Jul 4 (2014)

This article is here to clarify some of the “other” skills that you should know besides Ruby on Rails, if you want to build a web app. It will also give you a direction to where to learn these.

When I was learning programing for the very first time, I though that I will read a few books and then I will know how to do it and I will just… do it. Well, I was wrong. Learning the basics is just a start...

Hash with indifferent access May 3 (2014)

Hash with indifferent access is the actual class of Rails params, so technically speaking it is not just a hash, as I wrote :) The “indifferent access” sounds scary but I am sure you all know what it means. When you want to get a value based on a key, the key can be written as string as well as symbol.

# We will set our new hash with i.a. with one key/value pair
dogs = ActiveSupport::HashWithIndifferentAccess

What is an API? May 1 (2014)

When someone tries to explain me “what is an API”, he always says something like: “well, it is a programming interface, when you want to gain some information from a app, you can do it via API”. I really did not understand that. I finally got it when I started to work on a rails app with an API used for frontend. So, what is an API?

When you build your web app, you generally do it for humans ...

Attributes are just methods Apr 24 (2014)

I am not sure how many beginners know that, because I did not, but attributes in rails are just a methods. It is not anything fancy and special, really. Let’s explain it with an example.

Imagine situation that you are receiving params, which are not exactly matching with your model’s attributes. (Well, this is of course nonsense when you are sending the data on your own from a form, but consider...

Mongoid and me Apr 22 (2014)

A month ago I got a new amazing job as a junior Ruby on Rails programmer. Everything is great except the fact that I am very often struggling with things which school and guides did not teach me. For example, let me speak a bit about MongoDB and the “amazing” mongoid.

I was very shocked when I realized that switching to another database means that all the active record stuff which I am used to...

Rails params - it is just a hash Apr 21 (2014)

I am learning Ruby on Rails for over a year and today I finally understood params. It has been a long way. I have no idea if only I was struggling with such a simple concept or if is the cause of confuse for many beginner programmers like me, but I decided to write about it anyway.

At first impression I thought that params are something magical. I thought that I can get something from params only...

From one beginner to another Apr 15 (2014)

I have recently started to dive into the beautiful world of programming. It started kind of innocent, I discovered codecademy followed by other great online courses and tutorials and I learnt HTML, CSS, jQuery and finally Ruby on Rails. It has been almost a year now and I still feel like a absolute newbie, despite the fact that I am successfully studying at IT University (with scholarship) and I...