1.7.09
Воровской RubyСlub
Речь идет вот об этой теме на форуме: http://rubyclub.com.ua/messages/show/6559-Правила-форума
Весь смак находится в ответе пользователя Ruslan Voloshin. Это и есть хозяин форума.
Человек вместо того, чтобы удалить быстро всю ворованную литературу начинает переводить стрелки на... американцев. Оказывается это они считают нас "страной третьего мира" и "нещадно нас эксплуатируют". На этом основании и оправдывается воровство.
Ирония в том что нащу замечательную страну действительно имеют полное право считать страной третьего мира до тех пор пока ее люди будут себе позволять такие выходки.
Слова о том, что по просьбе авторов книги будут удаляться из каталога просто абсурдны. Представить, что Дэйв Томас будет писать лично на все файлопомойки где хранятся незаконные копии его книг можно только очень крепко ударившись. Ни один автор не захочет мараться о такие организации.
Но это далеко не все. Я могу понять тот факт, что у хозяина форума честность по приоритетам стоит ниже чем заработок от форума, но ведь с такой позицией согласны другие посетители форума. Им-то от барышей ничего не достается, но все равно эти люди молчаливо поддерживают воровство литературы.
Я могу все это объяснить очень простым и неприятным образом. Воровство для всех слоев населения - от депутатов и до дворников - стало нормой жизни. Сейчас эта норма не закреплена в уголовном и прочем кодексах, но уже есть в традициях народа. Традиция эта развивается: при СССР воровали у государства. Согласно Жванецкому: "граждане воруют - страна богатеет". Но сейчас-то начинают воровать друг у друга, у коллег по-сути дела. То есть не у абстрактного государства а у вполне конкретного коллеги который может работать в соседнем проекте или решать технологические проблемы похожие на те с которыми сталкивается и вор.
Хотелось бы закончить на какой-то оптимистической ноте но что-то не получается...
23.5.09
JetCharter problems
It was fun time of coding and chatting with Shawn Simpson (project owner). Project was finished. Client was glad about its finctionality and quality. I have received good feedback from Shawn and added project to my portfolio.
Few weeks later I have received information that other person pretends to be author of this project. I have told with Shawn and he have confirmed that I'm the creator of project. Today(24-May-2009) I know another one RoR developer who tries to steal this project for his portfolio.
This is not funny for me. I decided to create this post in my blog to collect all information about this strange situation. I'll give link to this post to each person who will need to understand situation.
This is the quote of the project owner related to the JetCharter project:
I don't have much control over what people put down as far as websites
that they are saying that they built, but I would be happy to clarify to a buyer
that you did a great job of converting that site from html/php -> ruby
and added some nice functionality.
People who tried to steal this project for their portfolio:
Yi Zheng from China
Oleg Zhurbiy (aka Oleg Keene) from Ukraine (http://www.odesk.com/users/~~779a459740e46bc3)
10.4.09
26.3.09
Database logger for Ruby on Rails
I have read old Recipes book once again recently. During reading recipe #59 (How to control all users actions) I have seen that it is actually far from ideal variant.
I'll make small step to the content of the recipe just to refresh its idea in your mind. In this recipe we are creating additional table called audit_trails with fields record_id, record_type, event, user_id and created_at. After that we can use sweepers to observe our models and create new audit trail when our model was changed.
This recipe works. It is just not DRY at all. When we are storing information about each event, object and subject we already have same information in the logs. I know, it can be in other format but all this information is already at our hard drives. Additionally, can you imagine sizes of audit_trails table content? I'm sure it will grow quickly in any application. So why should we duplicate all this data?
Solution for this problem can be a logger for Rails application that will write data not to the log files but to the DB. This data should be organised as ActiveRecord so we can use all its advantages. I have found some time for this experiment and here is result: http://github.com/shine/dblogger/tree/master
Shortly what it does: it redefines few methods in the Rails logger. New methods are parsing data and writing it to the DB. Logger works based on two models: LoggedEvent and LoggedRequest. LoggedEvent is the pure ActiveRecord model that just stores data about one event happened during request processing. LoggedRequest is the facade/collection for set of LoggedEvents. It provides several useful methods that can be used to get statistics about events and requests.
Requests received during last 3 days:
LoggedRequest.during_last 3.days #=> Array of LoggedRequest objects
Requests of index action in all controllers during last 10 minutes:
LoggedRequest.during_last 10.minutes, {:action => 'index'}
Requests with status ERROR and FATAL during last 10 minutes:
LoggedRequest.errors_during_last 10.minutes
Percent of the WARN, ERROR and FATAL messages in the whole message number during last 2 days:
LoggedRequest.percent_of_warn_during_last 2.days #=> 0.239 (23.9%)
Find latest error happened :
LoggedRequest.latest_error
There are few tricky details here
We should switch to the INFO level of logging in the environment.rb. We have to do this because writing to the DB is the DEBUG level of event. So if we will log all actions with DB then each LoggedEvent creation should be logged too and we are getting infinite loop of logging. So switch to INFO in the environment.rb
Note that when requesting LoggedRequests by its level you will get not only requests with exact this level but all requests with _higher_ levels too. For example, if you will want to find errors during last ten minutes then, actualy, you will really need to find more serious (FATAL) errors too. You will get it by default.
Is it all just for removing duplication? No. Removing duplication was just a motive. Generally, you can think about this logger as the tool for immediate feedback from your users that can be used inside application. For example, you can use it to check if some IP tries to enter 100 login/password variant per minute and block it. You can see that something is going wrong with showing details of model during last 2 minutes and redirect to the index page without showing big-red-error. You can find most popular resource in your application during last 15 minutes and use this information somehow.
Is is so perfect? No.
It is not fast logger. I have added it to my current project and runned rspecs (~900) at the Ruby 1.8.6 and Rails 2.1.1 . I have seen 40% additional time during using this type of logger. Meanwhile, I have to tell that I have not optimised its performance at all so, probably, it can work much faster. It is one of my nearest TODO tasks.
Finally. Please remember that it is just an experiment. Feel free to make your own experiments with this type of logger. You can send me your ideas about this logger using comments and email.
16.3.09
Дискомфорт jRuby
Какой в нем был смысл до последнего времени? Скорость и ужасающее количество Java-библиотек. С выходом 1.9 со скоростью стало гораздо лучше. Сейчас уже написано достаточно библиотек на Ruby чтобы мы могли обходится ими.
Кому хуже от еще одной дополнительной библиотеки? Если не задумываться что эта библиотека привязывает нас к чужеродной виртуальной машине, то - никому.
6.3.09
Смег
5.3.09
Ruby on Rails уже мэйнстрим
11.2.09
Гит - гад
16.12.08
Шарикус
Можно продеть сквозь 6 колец веревочки и дать их шестерым не очень трезвым людям. Они тянут за веревочки и постепенно железные шляпки вываливаются. Задача игроков остаться последним человеком не потерявшего связь с игрушкой. Этот человек на весь следующий год объявляется елкой и регулярно поливается пивом/водкой/кока-колой на выбор.