{"id":258557,"date":"2015-06-03T12:40:03","date_gmt":"2015-06-03T08:40:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=258557"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=258557","title":{"rendered":"\u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u0432 \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 Cackle"},"content":{"rendered":"<p>     \t<b>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/b> \u0412 \u043d\u0430\u0448\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/company\/cackle\/blog\/255013\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u043f\u0440\u043e \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 Cackle \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043e\u0431 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445 \u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 \u0432 \u0446\u0435\u043b\u043e\u043c. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0441\u0442\u043e\u043b\u044c \u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0443\u0436\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (30 000 000 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0441 2011 \u0433\u043e\u0434\u0430) \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0443 \u0434\u043b\u044f <a href=\"http:\/\/cackle.ru\">\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 Cackle<\/a>. \u041d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u0443\u043c\u0430\u044e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c.<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/259301\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b77\/eb9\/6d6\/b77eb96d604a0c68e775c5ee202c40ab.png\" alt=\"Cackle \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#144269\">\u041d\u0435 \u043c\u043d\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/font><\/h2>\n<p>  \u0417\u0430 \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b <a href=\"http:\/\/cackle.ru\/comments\">\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 Cackle<\/a>, \u0441 2011 \u0433\u043e\u0434\u0430, \u0431\u044b\u043b\u043e \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430 30 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432. \u0412 \u0441\u0443\u0442\u043a\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043b\u043e 100 000, \u0432 \u043f\u0438\u043a\u0438, \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e 1000 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. <\/p>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0432 \u0411\u0414 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 comment \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 15\u0413\u0431. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e \u043f\u043e\u043b\u044e site_id, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u0441\u0430\u0439\u0442\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0412\u0441\u0435\u0433\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043e 35 000 \u0441\u0430\u0439\u0442\u043e\u0432. \u0421\u0430\u043c\u044b\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u043f\u043e \u0447\u0438\u0441\u043b\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u044d\u0442\u043e rusvesna.su (9 \u043c\u043b\u043d), svpressa.ru (800 \u0442\u044b\u0441), 3dnews.ru (500 \u0442\u044b\u0441), carambatv.ru (450 \u0442\u044b\u0441).<\/p>\n<p>  \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u2014 \u044d\u0442\u043e \u0441\u0431\u043e\u0440 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043d\u0435\u0432\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430:  <\/p>\n<ul>\n<li>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 (\u0432\u0441\u0435\u0433\u043e, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0445, \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438, \u0441\u043f\u0430\u043c, \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445);<\/li>\n<li>\u041b\u0430\u0439\u043a\u043e\u0432 \u0438 \u0434\u0438\u0437\u043b\u0430\u0439\u043a\u043e\u0432;<\/li>\n<li>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043e\u0442 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u043e\u0432, \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0438 SSO (\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0435\u0434\u0438\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438).<\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0430\u0439\u0442\u0430, \u043a\u0440\u0443\u043f\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e.<\/p>\n<h2><font color=\"#144269\">\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 PostgreSQL<\/font><\/h2>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/cackle\/blog\/255013\/\">\u043f\u0438\u0441\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435<\/a>, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0411\u0414 \u0443 \u043d\u0430\u0441 PostgreSQL \u0441 \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0426\u041e\u0414\u043e\u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0420\u043e\u0441\u0441\u0438\u0438 \u0438 \u0415\u0432\u0440\u043e\u043f\u0435. PostgreSQL \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0442\u043e \u0441\u0431\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0432\u0430 \u044d\u0442\u0430\u043f\u0430.<br \/>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0437\u0430\u0448\u0435\u043b \u0432 \u043f\u0430\u043d\u0435\u043b\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u0431\u0440\u0430\u043b \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u0432 \u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0443:<br \/>   1. \u0415\u0441\u043b\u0438 \u0443 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438 \u043d\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u043d\u0438\u043c, \u0442\u043e \u0432 PostgreSQL \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c;<br \/>   2. \u0414\u0430\u043b\u0435\u0435 \u044d\u0442\u043e\u0442 \u0436\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432 \u0441\u043a\u0435\u0434\u0443\u043b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0435 15 \u043c\u0438\u043d\u0443\u0442 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3><font color=\"#0078b6\">1. \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0431\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c<\/font><\/h3>\n<p>  \u0418\u0442\u0430\u043a \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u043d\u0435\u0432\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0437\u0430 \u0432\u0441\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f: \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 (site_id), \u043f\u043e \u0432\u0441\u0435\u043c (total), \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u043c (approved), \u0432 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 (pending), \u0441\u043f\u0430\u043c (spam), \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u043c (deleted) \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c, \u043b\u0430\u0439\u043a\u0430\u043c (up), \u0434\u0438\u0437\u043b\u0430\u0439\u043a\u0430\u043c (down), \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0443 (vk, ok, fb, tw, gp, \u0438 \u0442.\u0434.), \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u043e\u043c\u0443 (anonym) \u0438\u043b\u0438 SSO (sso) \u044e\u0437\u0435\u0440\u0443 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b comment \u0438 mc_user (\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u044e\u0437\u0435\u0440\u043e\u0432). \u041f\u043e\u043b\u0435 comment.created \u2014 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f.<\/p>\n<pre><code class=\"sql\">SELECT DATE_TRUNC('day', t.created) as day, :siteId as site_id, COUNT(t) as total, SUM(CASE WHEN t.status = 1 THEN 1 ELSE 0 END) as approved, SUM(CASE WHEN t.status = 0 THEN 1 ELSE 0 END) as pending, SUM(CASE WHEN t.status = 3 THEN 1 ELSE 0 END) as spam, SUM(CASE WHEN t.status = 2 THEN 1 ELSE 0 END) as deleted, SUM(CASE WHEN t.rating &gt; 0 THEN 1 ELSE 0 END) as up, SUM(CASE WHEN t.rating &lt; 0 THEN 1 ELSE 0 END) as down, SUM(CASE WHEN t.provider = 'vkontakte' THEN 1 ELSE 0 END) as vk, SUM(CASE WHEN t.provider = 'odnoklassniki' THEN 1 ELSE 0 END) as ok, SUM(CASE WHEN t.provider = 'facebook' THEN 1 ELSE 0 END) as fb, SUM(CASE WHEN t.provider = 'twitter' THEN 1 ELSE 0 END) as tw, ... SUM(CASE WHEN t.provider = 'sso' THEN 1 ELSE 0 END) as sso, SUM(CASE WHEN t.anonym &gt; 0 THEN 1 ELSE 0 END) as anonym FROM (   SELECT c.id, c.created, c.status, c.rating, c.anonym, u.provider FROM comment c   LEFT JOIN mc_user u ON c.author = u.id   WHERE c.site_id = :siteId ) t GROUP BY DATE_TRUNC('day', t.created) ORDER BY DATE_TRUNC('day', t.created); <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0441\u0430\u0439\u0442\u0430 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<br \/>  1. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0434\u043e 100 000 \u2014 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e 5 \u0441\u0435\u043a;<br \/>  2. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0434\u043e 1 000 000 \u2014 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e 1 \u043c\u0438\u043d;<br \/>  3. \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0434\u043e 9 000 000 \u2014 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e 2 \u043c\u0438\u043d;<\/p>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0433\u043e\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 SQL \u2014 \u0441\u0430\u043c\u043e\u0443\u0431\u0438\u0439\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u044d\u0442\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c.<\/p>\n<pre><code class=\"sql\">CREATE TABLE comment_stats (   day date NOT NULL,   site_id bigint NOT NULL,   total integer,   approved integer,   pending integer,   spam integer,   deleted integer,   up integer,   down integer,   vk integer,   ok integer,   fb integer,   tw integer,   ...   sso integer,   anonym integer,   CONSTRAINT comment_stats_pkey PRIMARY KEY (day, site_id) ); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 SQL \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c INSERT INTO comment_stats.<\/p>\n<pre><code class=\"sql\">INSERT INTO comment_stats SELECT DATE_TRUNC('day', t.created) as day, :siteId as site_id, COUNT(t) as total, SUM(CASE WHEN t.status = 1 THEN 1 ELSE 0 END) as approved, ... <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b comment_stats:<br \/>  <code>select * from comment_stats where site_id = :siteId<\/code>.<\/p>\n<h3><font color=\"#0078b6\">2. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/font><\/h3>\n<p>  \u0421 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c SQL \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u0442\u043e, \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441 \u0411\u0414 \u0443\u0439\u0434\u0435\u0442 \u043d\u0430 \u043d\u0435\u0442.<\/p>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 comment_stats \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 comment_id, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 id \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0437\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. \u041f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0431\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u043e\u0433\u043e id. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0432\u0441\u0435 \u044d\u0442\u043e, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">INSERT INTO comment_stats SELECT DATE_TRUNC('day', t.created) as day, :siteId as site_id,  -- \u0431\u0435\u0440\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 id \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u0437\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c MAX(t.id) as comment_id,  COUNT(t) as total, SUM(CASE WHEN t.status = 1 THEN 1 ELSE 0 END) as approved, ... SUM(CASE WHEN t.anonym &gt; 0 THEN 1 ELSE 0 END) as anonym FROM (   SELECT c.id, c.created, c.status, c.rating, c.anonym, u.provider FROM comment c   LEFT JOIN mc_user u ON c.author = u.id   WHERE c.site_id = :siteId      -- \u0431\u0435\u0440\u0435\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0441 id \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 comment_id \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b comment_stats     AND c.id &gt; (SELECT COALESCE(MAX(comment_id), 0) FROM comment_stats WHERE site_id = :siteId) ) t GROUP BY DATE_TRUNC('day', t.created) ORDER BY DATE_TRUNC('day', t.created); <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043a\u0442\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>COALESCE(MAX(comment_id), 0)<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432 comment_stats \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c 0 \u0438 \u0441\u0431\u043e\u0440 \u0438\u0434\u0435\u0442 \u043f\u043e \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 comment \u0434\u043b\u044f site_id, \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0435\u0441\u0442\u044c, \u0442\u043e \u0441\u0431\u043e\u0440 \u0438\u0434\u0435\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e comment_id.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435 \u043e\u043a, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0432\u044b\u0437\u043e\u0432\u0435 \u0434\u043b\u044f \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c comment_stats_pkey. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443, \u043f\u0440\u043e\u0448\u043b\u043e 15 \u043c\u0438\u043d\u0443\u0442, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0441\u044f \u0441\u043a\u0435\u0434\u0443\u043b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c id &gt; \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e comment_id \u0438\u0437 comment_stats \u0438 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0442\u043e \u043d\u0430\u0448 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 day \u0438 site_id.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 (\u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 <a href=\"http:\/\/www.postgresql.org\/docs\/9.4\/static\/rules-update.html\">Rules on INSERT<\/a>) \u2014 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 comment_stats:<\/p>\n<pre><code class=\"sql\">DELETE FROM comment_stats WHERE   site_id = :siteId   AND   day IN (SELECT day FROM comment_stats WHERE site_id = :siteId ORDER BY day DESC LIMIT 1) <\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0430\u0431\u043b\u0438\u0446\u0430 comment_stats \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u0432\u0441\u0435\u043c \u0441\u0430\u0439\u0442\u0430\u043c:  <\/p>\n<pre><code class=\"sql\">CREATE TABLE comment_stats (   day date NOT NULL,   site_id bigint NOT NULL,   total integer,   approved integer,   pending integer,   spam integer,   deleted integer,   up integer,   down integer,   vk integer,   ok integer,   fb integer,   tw integer,   ...   sso integer,   anonym integer,   CONSTRAINT comment_stats_pkey PRIMARY KEY (day, site_id) ); <\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0431\u043e\u0440\u0430 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438:  <\/p>\n<pre><code class=\"sql\">INSERT INTO comment_stats SELECT DATE_TRUNC('day', t.created) as day, :siteId as site_id, MAX(t.id) as comment_id, COUNT(t) as total, SUM(CASE WHEN t.status = 1 THEN 1 ELSE 0 END) as approved, SUM(CASE WHEN t.status = 0 THEN 1 ELSE 0 END) as pending, SUM(CASE WHEN t.status = 3 THEN 1 ELSE 0 END) as spam, SUM(CASE WHEN t.status = 2 THEN 1 ELSE 0 END) as deleted, SUM(CASE WHEN t.rating &gt; 0 THEN 1 ELSE 0 END) as up, SUM(CASE WHEN t.rating &lt; 0 THEN 1 ELSE 0 END) as down, SUM(CASE WHEN t.provider = 'vkontakte' THEN 1 ELSE 0 END) as vk, SUM(CASE WHEN t.provider = 'odnoklassniki' THEN 1 ELSE 0 END) as ok, SUM(CASE WHEN t.provider = 'facebook' THEN 1 ELSE 0 END) as fb, SUM(CASE WHEN t.provider = 'twitter' THEN 1 ELSE 0 END) as tw, ... SUM(CASE WHEN t.provider = 'sso' THEN 1 ELSE 0 END) as sso, SUM(CASE WHEN t.anonym &gt; 0 THEN 1 ELSE 0 END) as anonym FROM (   SELECT c.id, c.created, c.status, c.rating, c.anonym, u.provider FROM comment c   LEFT JOIN mc_user u ON c.author = u.id   WHERE c.site_id = :siteId AND                 c.id &gt; (SELECT COALESCE(MAX(comment_id), 0) FROM comment_stats WHERE site_id = :siteId) ) t GROUP BY DATE_TRUNC('day', t.created) ORDER BY DATE_TRUNC('day', t.created); <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c:  <\/p>\n<pre><code class=\"sql\">DELETE FROM comment_stats   WHERE     site_id = :siteId     AND     day IN (SELECT day FROM comment_stats WHERE site_id = :siteId ORDER BY day DESC LIMIT 1) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u0435\u043d. \u0423 \u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0411\u0414. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0443 \u043d\u0430\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 2 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u0441\u0431\u043e\u0440), \u0438\u0434\u0435\u0442 \u0441\u0431\u043e\u0440 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043c\u043e\u0434\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 (\u043f\u043e\u0441\u0442\u043e\u0432) \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u0437\u044b\u0432\u043e\u0432 <a href=\"http:\/\/cackle.ru\/reviews\">Cackle Reviews<\/a>.<\/p>\n<h2><font color=\"#144269\">\u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u2014 HighCharts<\/font><\/h2>\n<p>  \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"http:\/\/www.highcharts.com\">HighCharts<\/a>. \u042d\u0442\u043e \u043f\u043b\u0430\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432. \u0421\u043a\u0430\u0436\u0443 \u0441\u0440\u0430\u0437\u0443, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0431\u043e\u0440\u043e\u043c HighCharts \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043c\u043d\u043e\u0433\u043e <a href=\"http:\/\/en.wikipedia.org\/wiki\/Comparison_of_JavaScript_charting_frameworks\">\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 Framework-\u043e\u0432<\/a> \u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u043d\u0435 \u0431\u044b\u043b \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p>  \u0418\u0437 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043b\u0430\u0433\u043e\u0432 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 33 000 \u0442\u044b\u0441. \u0442\u043e\u0447\u0435\u043a, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u0443\u043c\u043d\u043e\u0435 \u0441\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438, \u0445\u043e\u0440\u043e\u0448\u0435\u0435 API. \u041a\u0441\u0442\u0430\u0442\u0438, \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u043e\u0432 \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0441\u043a\u0438\u0434\u043a\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0435\u0451 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">JavaScript \u043a\u043e\u0434 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">new Highcharts.Chart({     chart: {         type: 'line',          \/\/\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 &lt;div id=&quot;chart&quot;&gt;&lt;\/div&gt;         renderTo: 'chart'     },     title: {         text: '',         style: {             \/\/title \u043d\u0435 \u043d\u0443\u0436\u0435\u043d             display: 'none'          }     },     xAxis: {         \/\/\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f days \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0442\u0430\u0431\u043b\u0438\u0446\u0430 comment_stats)         \/\/\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 ['2015-05-03', '2015-05-04', ... '2015-06-03']         categories: days     },     yAxis: {         min:0,         title: {             \/\/\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 Y \u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b             text: MESSAGES.comments         }     },     legend: {         layout: 'vertical',         align: 'right',         verticalAlign: 'middle',         borderWidth: 0     },      \/\/series \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:     \/\/\u0432\u0441\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043e\u0434\u043e\u0431\u0440\u0435\u043d\u043d\u044b\u0435, \u043b\u0430\u0439\u043a\u0438, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043e\u0442 \u0412\u041a, \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0438 \u0442.\u0434.     series: series      \/\/\u0443\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u0440\u0430\u0439\u0442     credits: {         enabled: false     } });  \/\/\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 series \/\/Params  - \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b var Params = [     {         name: 'total',         index: 3,         color: '#999'     }, {         name: 'approved',         index: 4,         color: '#9edd69'     }, {         name: 'pending',         index: 5,         color: '#ffbb3d'     }, {         name: 'spam',         index: 6,         color: '#ff95af'     }, {         name: 'deleted',         index: 7,         color: '#666'     }, {         name: 'up',         index: 8,         color: '#239600'     }, {         name: 'down',         index: 9,         color: '#ff2f2f'     }, {         name: 'vk',         index: 10,         color: '#6383a8'     }, {         name: 'ok',         index: 11,         color: '#eb722e'     }, {         name: 'fb',         index: 13,         color: '#4e69a2'     }, {         name: 'tw',         index: 14,         color: '#55acee'     },     ...     {         name: 'sso',         index: 22,         color: '#17c200'     }, {         name: 'anonym',         index: 23,         color: '#c6cde0'     } ];  for (var p in Params) {     \/\/stats \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430     \/\/\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: stats.total, stats.spam, stats.vk, stats.anony \u0438 \u0442.\u0434.     var param = Params[p], stat = stats[param.name];     if (stat) {         series.push({             nick: param.name,             name: MESSAGES[param.name],  \/\/\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0430             data: stat,             color: param.color         });     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u043e\u0432 \u043a\u0430\u043a \u044d\u0442\u043e \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442.<\/p>\n<p>  <a href=\"http:\/\/cackle.ru\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8cc\/48e\/1cb\/8cc48e1cb1522bd07640f7ede1e42548.png\" alt=\"Cackle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  <a href=\"http:\/\/cackle.ru\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e28\/61e\/519\/e2861e519fef20bb20c8f5792a0ca52a.png\" alt=\"Cackle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  <a href=\"http:\/\/cackle.ru\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f1a\/488\/854\/f1a488854932185eff150d218d7c4363.png\" alt=\"Cackle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  <a href=\"http:\/\/cackle.ru\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7c3\/198\/b96\/7c3198b9610535384e441a56a6cc4919.png\" alt=\"Cackle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  <a href=\"http:\/\/cackle.ru\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a73\/627\/66d\/a7362766d7e1136b34f6bdac077a3e5c.png\" alt=\"Cackle \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a><br \/>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0432\u044b\u0448\u0435\u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438\u043b\u0438 \u043f\u043e <a href=\"http:\/\/cackle.ru\">\u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435<\/a> \u0441 \u0440\u0430\u0434\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u0438\u043c hi@cackle.me.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/259301\/\"> http:\/\/habrahabr.ru\/post\/259301\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<b>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/b> \u0412 \u043d\u0430\u0448\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/company\/cackle\/blog\/255013\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u043f\u0440\u043e \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 Cackle \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043e\u0431 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435, \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445 \u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 \u0432 \u0446\u0435\u043b\u043e\u043c. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445 \u0441\u0442\u043e\u043b\u044c \u0441\u0438\u043b\u044c\u043d\u044b\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0438 \u0443\u0436\u0435 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 (30 000 000 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0441 2011 \u0433\u043e\u0434\u0430) \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0443 \u0434\u043b\u044f <a href=\"http:\/\/cackle.ru\">\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 Cackle<\/a>. \u041d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0434\u0443\u043c\u0430\u044e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d, \u0432 \u043f\u043b\u0430\u043d\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0432\u0441\u0435\u043c \u0442\u0435\u043c, \u043a\u0442\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0438, \u043d\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c.<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/259301\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b77\/eb9\/6d6\/b77eb96d604a0c68e775c5ee202c40ab.png\" alt=\"Cackle \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\" \/><\/div>\n<p><\/a>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-258557","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258557","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258557"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258557\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}