Developers Club geek daily blog

Domain sharding: implementation on the Ruby on Rails and results of application

1 year, 3 months ago
I solved on the example of one project recently to learn, how strongly influences the speed of loading of the website domain sharding. I will remind, an essence of this optimization that static files are loaded from different domains (which, however, can indicate the same server), and it allows to bypass restriction of browsers for the number of simultaneous connections to one domain. Intuitively it seems that in case of a large number of small files it has to accelerate significantly loading of the website in general. Let's check, whether so it actually.

Read more »


Facebook threatens the security expert who cracked Instagram

1 year, 3 months ago
The independent security expert Wesley Weinberg (Wesley Wineberg) underwent serious pressure from the Facebook company. She did not pay for the found vulnerabilities on the Instagram server moreover threatens with a legal claim.

Wesley found vulnerability in infrastructure of Instagram by means of which downloaded practically all valuable that is on the Instagram servers: the source code of the latest version, SSL certificates and private keys for Instagram.com, keys for the signature of kuk of authentication, accounting data from the e-mail server and keys for some other products, including for the signature of mobile applications under iOS and Android.


Read more »


The automated testing of controllers in Rails

1 year, 4 months ago
Hi, Habr! Long ago monasteries attract me to be the author, and here, at last, that light hour when I dopinat myself came to provide my small opus on your court.
Studying at a leisure Ruby and Rails, trying RSpec, suddenly Minitest, I reached creation of a web application with a frontend on JavaScript and the backend on Ruby which is sticking out outside REST API based on normal Rails controllers. I use Rails though it is perfect not essentially. The approach described below can be applied to anything.
Here it is necessary to make small retreat. At heart I am a person exacting, and in every possible way I fight for the proved stability of a code (in words precisely). And when the speech comes about safety of users in my application, without tests at least showing that anyone will not obtain my data, I feel absolutely not comfortably. I begin to long and in general not to write any code. Even if I — the user one and only so far.
It would seem, everything is very simple: we take RSpec and we write tests. But same it is boring! For each controller, for each supported method to check, at least, that without the token issued earlier the user will get the heave-ho — it how many an identical code it is necessary to write! And further as? It is more and more controllers, it is boring to copy tests and in opportunities to change approaches I remain is limited. Go then rewrite all these tests if I want to transfer, for example, the API version not to URL, and in heading, or on the contrary. Generally, I conceived to write the generator.

Read more »


As Code Game Challenge is arranged

1 year, 4 months ago


Introduction


Code Game Challenge (CGC) — a format of competitions in which players practice writing of game strategy, units defining behavior under control to them in somebody the game world. This type of competitions — the eternal frequenter more — less large Olympic Games on programming.

In this article I will describe the vision of the structure of systems which do carrying out these competitions possible. I gained this knowledge when developing the similar project about which speech will go in the second part of article.

Read more »


How to keep difficult hierarchy of settings in the Redmine projects

1 year, 4 months ago
Within the last two months worked on redmine_intouch plug-in for the Centos-admin.ru company.

After completion of works decided to share some nuances which it was necessary to face in development process.

In this publication I will tell about a way which had to be passed to implement flexible system of various settings.

First of all I want to make a reservation. This article about implementation of logic of storage of settings of the project in a plug-in for Redmine.

Since it is a plug-in, it is extremely undesirable to use third-party gems in which this functionality is implemented, in order to avoid the conflicts with logic of Redmine.

Therefore in this publication it will be a question of implementation from scratch of storage system of settings with difficult hierarchy.

image

Apparently from a screenshot, it is necessary to store somehow data from three spoilers, in each of which on several tabs, and on each tab the mass of checkboxes.

Read more »


Transfer: as gitLab uses unicorn and unicorn-worker-killer

1 year, 4 months ago
I bring to your attention transfer of small article in which engineers of GitLab tell as their application works at Unicorn and that they do with memory which flows. This article can be considered as the simplified version of article of other author which is already translated to Habré.

Read more »


Recipes of testing of Ruby and Rails of applications

1 year, 4 months ago
image

In this post I would like to tell about approaches, acceptances and means of preparation of tests. I will tell how not to write superfluous, to duplicate less a code, to write tests so that they were easy to be supported and how to win in performance in some situations.

To whom will it be interesting?

  • If you began to write tests recently.
  • If you write tests and consider that in them there is a lot of kopipasta, or it is possible to improve them considerably.
  • If you write tests occasionally or do not write absolutely as it is not pleasant to you or consider that it long.
  • If you the master in writing of tests. Perhaps, you learn some subtleties or will find several useful trifles.

Read more »


The very best last article about setup of the server for Rails

1 year, 5 months ago
There were times for Habré when everyone respecting (and not really) itself relsovik for some reason spread the recipes of setup of the fighting server and deploya applications on the Ruby on Rails. Such articles there were 60% of all articles in Rails hub, and echoes of that time still emerge: so, for example, for August I found two articles about warm a rail.

Bothered.

$ gem install from-scratch
$ scratchify your_app_name your.host.com


What the magic is, read under a cat.



Read more »


Transfer. We cut off corners: why rails can kill with ruby

1 year, 5 months ago
Transfer of the article Piotr Solnica, pilot ruby of the developer and one of authors of popular Ruby Object Mapper is offered to your attention. The translator in general shares the author's position.

Read more »


Why I put on Elixir

1 year, 5 months ago
6 years I created applications in the Ruby language and framework of Rails. I felt any modern languages of programming in process of their output, but Elixir – the first of them who has really carried away me.

In due time Ruby has soiled all


The Ruby language and framework of Rails have completely changed way of creation of web applications. They have given rise to religion of values for community of programmers. They the first have offered idea according to which tools of the programmer have to be optimized for productive and joyful development.

They postulated that the problem of testing and bringing code to up state lies on developers. Other languages and frameworks sneered at such approach until it has started winning popularity. After that they began to include the principles inherent in community Ruby, in other languages and frameworks.

image

Ruby has passed way from the modest provision of unintelligible language to one of the most popular languages, generally because of framework of Rails and huge leader potential of such people, as DHH, Wycats, Aaron Patterson, Jose Valim and great number of others. But periodically, both here and there the artifacts which have remained because of such modest start of language start getting out.

The running-away memory


Zed Sho [Zed Shaw] in post "Rails is ghetto" talks profusely on problems with garbage collection because of which the first applications on Rails were restarted each 4 minutes.

One of the most popular servers for Rails is unicorn today. My web application is application for Rails, it quite simple, in comparison with other applications which I developed. I have transferred it to the server from 512 Mb of memory, and after several days of work my unicorn has eaten all available memory and application has started braking.

Solution? unicorn-worker-killer. Not too differs from earlier solutions.

Read more »