tag:webdev.shared.arty.name,2011:index.atomЗаписи о веб-разработке, рекомендованные Артемием ТрегубенкоАртемий Трегубенкоme@arty.namehttps://arty.name2010-03-01T09:56:42Ztag:google.com,2005:reader/item/0dd038b64f4a7044
Яндекс поддерживает микроформат hCard
2010-03-31T18:59:02Z2010-03-31T18:59:02Z
<a href="http://help.yandex.ru/webmaster/?id=1111670">Яндекс поддерживает микроформат hCard</a>: <p>Сегодня мы начинаем поддерживать микроформат hCard, предназначенный для разметки контактных данных. Эти данные используются для пополнения нашего справочника организаций и в дальнейшем отображаются на Яндекс.картах и странице результатов поиска.</p>
(author unknown)
10202714043885511706
tag:google.com,2005:reader/item/39fe473619c4dc4c
Flash Player будет интегрирован в Google Chrome
2010-03-31T07:29:24Z2010-03-31T07:29:24Z
Последний девелоперский билд (5.0.360.4 для Windows и Mac, 5.0.360.5 для Linux) уже включает в себя Adobe Flash Player версии 10.1.51.95 (10.1 beta 3). Для его активации необходимо прописать --enable-internal-flash в ярлыке, либо в командной строке.<br>
<br>
З.Ы. Ещё на dev ветке в about:plugins добавили менеджер плагинов (так что теперь любой из них можно отключить).
(author unknown)
tag:google.com,2005:reader/item/5e50b7192ae75b37
OpenSSL 1.0.0 released
2010-03-29T20:12:14Z2010-03-29T20:12:14Z
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/yaroslav"><img src="http://friendfeed-media.com/p-2bc16ad6fd3211dcb52c003048343a40-medium-1001" alt="yaroslav" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/yaroslav" style="font-weight:bold;text-decoration:none;color:#00c">yaroslav</a>
</div>
<div style="margin-top:2px;color:black">OpenSSL 1.0.0 release, <a style="text-decoration:none;color:#00c" rel="nofollow" href="http://www.openssl.org/news/">http://www.openssl.org/news/</a> 29 Mar 2010 (started 23 Dec 1998). 11+ years in the making</div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/yaroslav/5545ce77/openssl-1-0-release-29-mar-2010-started-23-dec" style="color:#737373;text-decoration:none">5 hours ago</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://twitter.com/yaroslav/statuses/11253902284">Twitter</a>
- <a href="http://friendfeed.com/yaroslav/5545ce77/openssl-1-0-release-29-mar-2010-started-23-dec" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/yaroslav/5545ce77/openssl-1-0-release-29-mar-2010-started-23-dec" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/gluek" style="color:#7777cc;text-decoration:none">Gluek</a>, <a href="http://friendfeed.com/arty" style="color:#7777cc;text-decoration:none">arty</a>, <a href="http://friendfeed.com/dreikanter" style="color:#7777cc;text-decoration:none">dreikanter</a> and 3 other people liked this</td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">Зачем таким продуктам вообще нужна версия 1.0? Их можно нумеровать от 1 до ∞ и праздновать встречающиеся по пути простые числа :) - <a href="http://friendfeed.com/corvin" style="color:#7777cc;text-decoration:none">Alexey Melchakov</a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
tag:google.com,2005:reader/item/8635ff7a1a8649f1
Jeremy Zawodny: pwnat - NAT to NAT client-server communication
2010-03-29T04:09:07Z2010-03-29T04:09:07Z
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/jzawodn"><img src="http://i.friendfeed.com/p-a75a9f1da98d4c8d92d2e2e560f4b81e-medium-1" alt="Jeremy Zawodny" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/jzawodn" style="font-weight:bold;text-decoration:none;color:#00c">Jeremy Zawodny</a>
</div>
<div style="margin-top:2px;color:black">pwnat - NAT to NAT client-server communication - <a style="text-decoration:none;color:#00c" rel="nofollow" href="http://samy.pl/pwnat/">http://samy.pl/pwnat/</a></div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/jzawodn/e1812bc7/pwnat-nat-to-client-server-communication" style="color:#737373;text-decoration:none">March 28</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://delicious.com/jzawodn">delicious</a>
- <a href="http://friendfeed.com/jzawodn/e1812bc7/pwnat-nat-to-client-server-communication" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/jzawodn/e1812bc7/pwnat-nat-to-client-server-communication" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/isaach" style="color:#7777cc;text-decoration:none">Isaac Hepworth</a>, <a href="http://friendfeed.com/9000" style="color:#7777cc;text-decoration:none">9000</a>, <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a> and 2 other people liked this</td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">very interesting... - <a href="http://friendfeed.com/jzawodn" style="color:#7777cc;text-decoration:none">Jeremy Zawodny</a></td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">a brilliant time-exceeded hack. - <a href="http://friendfeed.com/9000" style="color:#7777cc;text-decoration:none">9000</a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
02508356558166959398
10202714043885511706
tag:google.com,2005:reader/item/993e3d521b06a5f4
SQL Injection
2010-03-25T10:55:14Z2010-03-25T10:55:14Z
<img src="http://pit.dirty.ru/dirty/1/2010/03/25/26248-135514-5fccedf55e58b03c1ee084869cef62be.jpg"><br><br>Уже сравнительно давно появились технические средства, которые позволяют определить скорость автомобиля и распознать его скорость (не автомобилист, не знаю, как они у вас называются). Соответственно, они должны использовать базы данных. А где есть базы данных, там можно попытаться атаковать их с помощью SQL Injection, например! <a href="http://files.posterous.com/rickmans/Io09h373y6BO9GEg8R4LBbzj1cWk1XnzFiaj9nPsNEekbngWjdW40MXt9Amv/hxxYn.jpg.scaled.1000.jpg?AWSAccessKeyId=1C9REJR1EMRZ83Q7QRG2&Expires=1269514494&Signature=3x6OjJ%2FQ159buvdgiXHUYV6lrF8%3D">Крупнее</a>
MarvinHeemeyer
11718453020157511097
tag:google.com,2005:reader/item/e94b39bd33fbbe0d
Q: What's the difference between Ant and Maven? A: The creator of Ant has apologized.
2010-03-25T10:17:28Z2010-03-25T10:17:28Z
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/ashalynd"><img src="http://friendfeed-media.com/p-e568cf254bd3476faff7157ee618184a-medium-1001" alt="Ashalynd" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/ashalynd" style="font-weight:bold;text-decoration:none;color:#00c">Ashalynd</a>
</div>
<div style="margin-top:2px;color:black">:-D RT @<a style="text-decoration:none;color:#00c" rel="nofollow" href="http://twitter.com/johlrogge">johlrogge</a>: RT @<a style="text-decoration:none;color:#00c" rel="nofollow" href="http://twitter.com/technomancy">technomancy</a> Q: What's the difference between Ant and Maven? A: The creator of Ant has apologized.</div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/ashalynd/09a2fbe4/d-rt-johlrogge-technomancy-q-what-difference" style="color:#737373;text-decoration:none">9 hours ago</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://twitter.com/ashalynd/statuses/11003234307">Twitter</a>
- <a href="http://friendfeed.com/ashalynd/09a2fbe4/d-rt-johlrogge-technomancy-q-what-difference" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/ashalynd/09a2fbe4/d-rt-johlrogge-technomancy-q-what-difference" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/arty" style="color:#7777cc;text-decoration:none">arty</a> and <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a> liked this</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
tag:google.com,2005:reader/item/2adae33e12132b41
Firefox stops development for Windows Mobile
2010-03-24T14:32:34Z2010-03-24T14:32:34Z
<a href="http://blog.pavlov.net/2010/03/22/stopping-development-for-windows-mobile/">Stopping Development for Windows Mobile</a>: <p>Microsoft has unfortunately decided to close off development to native applications. Because of this, we won’t be able to provide Firefox for Windows Phone 7 at this time.</p>
(author unknown)
tag:google.com,2005:reader/item/12de32c4613dec8c
Video on the Web - Dive Into HTML5
2010-03-24T08:57:35Z2010-03-24T08:57:35Z
<blockquote>Shared by arty
<br>
хорошее введение в тему</blockquote>
<div><p><a href="http://diveintohtml5.org/video.html">Video on the Web—Dive Into HTML5</a>. Everything a web developer needs to know about video containers, video codecs, adio containers, audio codecs, h.264, theora, vorbis, licensing, encoding, batch encoding and the html5 video element.</p>
</div>
(author unknown)
хорошее введение в тему
arty
tag:google.com,2005:reader/item/3570ae80594b10c9
Internet Explorer / [Ссылка] Amazon.com прекращает поддержку IE6
2010-03-23T07:28:51Z2010-03-23T07:28:51Z
Уже и они!
ayambit
09839130476010812097
17770990729915871553
01486805804346866309
11099047615320147044
00187455999812290279
16468233250959714547
07185305411520460552
12120132740706562429
02417018409390751869
04924791205597468907
04577328167438650485
12457765973349184237
07722126519967172098
16878870608407552398
15428581036578268378
15799627401954744935
02679400837951181882
11073017092178032616
02596940586286743283
16584923321889736413
10202714043885511706
15532540447976148811
12273134720207705791
08850254296448410826
00352463858805324523
tag:google.com,2005:reader/item/7718cc418e944efd
Peer-to-peer connections
2010-03-22T21:42:32Z2010-03-22T22:59:17Z
<div><p>After the <code><device></code> element (see <a href="http://blog.whatwg.org/whats-next-in-html-episode-1">What’s Next in HTML, episode 1</a>) Ian sketched out an interface in the WHATWG HTML draft that builds on that, which looks quite interesting. <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#peer-to-peer-connections">Peer-to-peer connections</a> (URL bound to change):</p>
<blockquote>
<pre>[NoInterfaceObject]
interface AbstractPeer {
void sendText(in DOMString text);
attribute Function ontext; // receiving
void sendBitmap(in HTMLImageElement image);
attribute Function onbitmap; // receiving
void sendFile(in File file);
attribute Function onfile; // receiving
attribute Stream localStream; // video/audio to send
readonly attribute Stream remoteStream; // video/audio from remote peer
attribute Function onstreamchange; // when the remote peer changes whether the video is being sent or not
attribute Function onconnect;
attribute Function onerror;
attribute Function ondisconnect;
};
[Constructor(in DOMString serverConfiguration)]
interface PeerToPeerServer : AbstractPeer {
void getClientConfiguration(in PeerToPeerConfigurationCallback callback);
void close(); // disconnects and stops listening
};
[Constructor]
interface PeerToPeerClient : AbstractPeer {
void addConfiguration(in DOMString configuration);
void close(); // disconnects
};
[Callback=FunctionOnly, NoInterfaceObject]
interface PeerToPeerConfigurationCallback {
void handleEvent(in PeerToPeerServer server, in DOMString configuration);
};</pre>
</blockquote>
<p>You will still need some kind of intermediary (i.e. a server in almost all practical scenarios) to exchange the address, but after that things can get pretty interesting I think. I was hoping people would be willing to share their thoughts on the interface sketch above and the general idea of having access to peer-to-peer connections from Web pages and the Web platform in general.</p></div>
(author unknown)
10202714043885511706
tag:google.com,2005:reader/item/9af0b7f3185497a1
Поисковые машины и технологии / Автоматический парсинг товаров с сайтов магазинов
2010-03-22T14:14:28Z2010-03-22T14:14:28Z
Мы все время от времени покупаем какие-либо товары. Перед покупкой чего-нибудь более-менее дорогого или редкого, мы, как правило, сперва ищем товар в интернете. Сейчас на рынке поиска товаров доминируют Яндекс.Маркет и Price.ru, однако большая часть их баз данных — товары из интернет-магазинов. Интернет-магазины — замечательное изобретение, но зачастую требуется потрогать товар руками перед покупкой, сравнить с другими товарами, подумать… Возникает необходимость найти оффлайновый магазин с искомым товаром и желательно как можно ближе (учитывая московские проблемы с транспортом) и дешевле. Периодически сталкиваясь с этой проблемой, я пришел к мысли, что неплохо бы создать удобный сервис, способный осуществлять поиск по всем возможным каталогам и прайс-листам, доступным в интернете, и выводить эту информацию наглядно на карте города.<br>
<br>
Основная задача при создании такого сервиса — как собрать всю эту информацию и вовремя обновлять. Просить у магазинов предоставить данные в своем формате, как это делают Price.ru и Я.М, — крайне затратный и медленный путь. Я пришел к единственному возможному и разумному варианту — индексация сайтов магазинов в автоматическом режиме. Как вы понимаете, задача совсем не тривиальная…<br>
<br>
<img src="http://i41.tinypic.com/14j4zte.png"><br>
<div> <a href="http://habrahabr.ru/blogs/search_engines/88470/#habracut">Читать дальше →</a> </div>
P_r_i_m_a_t
16842193737754013048
17558775520215432119
15563614779517724519
07274538743814901068
14999141994168474868
13964726244488542150
00141436450621023568
16732906613508439847
10202714043885511706
15505822422567678348
14024196045507641005
tag:google.com,2005:reader/item/4badcfc96d16b29e
Opera: The media=all of the industry!
2010-03-22T11:38:18Z2010-03-22T11:38:18Z
I think Molly just came up with a <a href="http://twitter.com/mollydotcom/status/10863918923">new slogan for Opera</a>:
<br>
<br><strong><span style="font-size:medium"><i>"Opera: The media=all of the industry!"</i></span></strong>
<br><p>Originally posted by Molly:</p><blockquote><p>Opera on your desktop, your phone, in your truck, on your Wii and coming soon: television. We are the media="all" of the industry.</p></blockquote>For some background, look up <a href="http://www.w3.org/TR/CSS2/media.html#media-types">CSS Media Types</a>: <i>"all - Suitable for all devices."</i>
<br>
<br>Since Opera probably runs on more types of platforms, devices and operating systems than any other browser, this slogan seems fitting for Opera. Geeky, but fitting.
address-withheld@my.opera.com.invalid (Haavard)
15021698697977826521
02239546685243249690
02508356558166959398
10202714043885511706
tag:google.com,2005:reader/item/c2cc92707a3ff86e
Computer Code as a Medium for Human Communication: Are Programming Languages Improving?
2010-03-21T02:34:04Z2010-03-21T19:34:28Z
<a href="http://www.google.com/search?q=pdf+Are+Programming+Languages+Improving">http://www.google.com/search?q=pdf+Are+Programming+Languages+Improving</a><br><h2>Computer Code as a Medium for Human Communication:<br><br>Are Programming Languages Improving?</h2><br><h3>Gilles Dubochet, 2009</h3><br>В спорах по поводу языков программирования часто встречается аргумент про "поняность" или "непонятность" кода. Подразумевается, что если код более понятен, то его легче сопровождать и развивать.<br><br>Важной вариацией на тему понятности кода является вопрос о том, легче ли понимать более короткий код, или краткость кода может предъявлять слишком много требований к читающему. В своём крайнем выражении аргумент звучит так: что лучше, сидеть и целый час корпеть, пытаясь понять, что делают эти компактные пять строчек программы, или же это час можно затратить на то, чтобы не спеша и не напрягаясь разобрать два-три экрана эквивалентного "несжатого" кода.<br><br>Разумеется, когда мы говорим о кратком коде, мы не имеем ввиду синтаксическую краткость — отсутствие лишних пробелов, переводов строк, упаковывание повторяющихся последовательностей операций в текстовые макросы, etc. Краткость, которую имеет смысл рассматривать, достигается использованием абстракций более высокого уровня. Например, использование свёрток списков или деревьев вместо ручного их обхода.<br><br>Аргумент от Java/C++ программистов — использование слегка более многословного кода позволяет быстрее и эффективнее донести суть алгоритма до читателя кода. Реакция Java программистов на Haskell-код — этот ваш хаскель сложно понимать, ибо в нём нездоровое количество функциональности на единицу текста.<br><br>Аргумент от программистов на языках, допускающих написание существенно более коротких программ — короткий код позволяет человеку выражать более высокоуровневые концепции, наверняка более приближенные к предметной области, и поэтому понимание кода происходит быстрее и эффективнее. Реакция Python программистов на Java код — за деревьями не видно леса: большое количество церемоний вокруг простейших вещей напускает ненужный туман на ту мысль, которую программист пытался этим кодом донести.<br><br>В итоге, как всегда, каждый остаётся при своём мнении, ибо без каких-либо эмпирических данных противоположные аргументы выглядят одинаково правдоподобно.<br><br>Gilles Dubochet в своей статье принимает точку зрения, что код является механизмом обмена информацией — моделями, пониманием предметной области — между <em>людьми</em>. Базируясь на этом, он конструирует две гипотезы, и организует эксперимент, чтобы проверить состоятельность каждой из них.<br><br><b>Гипотеза номер один.</b> Понимание кода улучшается, когда программист читает более компактный код, разумеется, если у программиста и писателя есть более-менее общее понимание предметной области. Возможный вывод из этой гипотезы, если она подтверждается — если программисты знают, что они делают, то компактный код позволяет им понимать более компактный код эффективнее менее компактного.<br><br><b>Гипотеза номер два.</b> Намёки на модель предметной области, выраженные в типах, именах переменных, и т. п., позволяют привязаться к модели предметной области. Например, понятие объединения из реляционной алгебры может быть выражено через функцию по имени join, а может быть через функцию с похожим названием (enhance_with?), но не имеющую названия, взятого напрямую из предметной области.<br><br>Gilles дал некоторому количеству испытуемых код на Scala, по-разному реализующий некий набор алгоритмов из реляционной алгебры. Вот такие три варианта были разработанны:<br><br><table border="1" cellpadding="5" cellspacing="0">
<tr><th align="center" width="33%">S/G</th><th align="center" width="33%">D/U</th><th align="center" width="33%">D/G</th></tr>
<tr><td align="center">Sparse/Grounded</td><td align="center">Dense/Ungrounded</td><td align="center">Dense/Grounded</td></tr>
<tr><td>Код на Scala, использующий только конструкции, доступные в Java.<br>Этот код имеет привязки к реляционной алгебре с помощью имён переменных, функций, типов, etc.</td><td>Компактный код на Scala, использующий более высокоуровневые конструкции, доступные в Scala. Код не имеет явных привязок к реляционной алгебре.</td><td>Компактный код на Scala, имеющий привязки к реляционной алгебре</td></tr></table><br><br>Читателям кода давались на ознакомление концепции реляционной алгебры, а затем следовала просьба изучить предлагаемые варианты кода, реализующие некоторые алгоритмы из неё: natural join, left outer join, cartesian product. После вникания в код (обычно испытуемые справлялись с этим за 45-60 минут), испытуемые должны были написать "контракты", которым следует код: списки предусловий и постусловий, которым отвечает логика алгоритмов. Этим проверялась степень понимания кода. Параллельно использовался специальный девайс для слежения за глазами, чтобы понять, какие языковые конструкции привлекают максимум внимания на этапе изучения кода.<br><br><table border="0" cellpadding="5"><tr><td><br><img src="http://lionet.info/ljimg/gilles-fig3.png" width="244" height="174"><br></td><td><br><img src="http://lionet.info/ljimg/gilles-fig4.png" width="244" height="174"><br></td></tr>
<tr><td><br><small><b>Рис. 3.</b> Для каждого стиля программирования показано нормализованное время, затраченное на чтение кода алгоритма.</small><br></td><td><br><small><b>Рис. 4.</b> Для каждого стиля программирования показаны среднее нормализованное время, затраченное на рассматривание одного лексического токена в программе, независимо от его природы.</small><br></td></tr></table><br><br><table border="0" cellpadding="5"><tr><td><br><img src="http://lionet.info/ljimg/gilles-fig9.png" width="474" height="225"><br></td></tr><tr><td><br><small><b>Рис. 9.</b> Снимок экрана с кодом, как он был показан испытуемым во время эксперимента, с картой распределения концентрации внимания. Алгоритм слева — S/G, читаемый испытуемым 7, алгоритм справа — D/U, читаемый испытуемым 12. Обратите внимание на то, что фиксация внимания на именах идентификаторов, наблюдаемая для кода в стиле S/G, в коде стиля D/U отсутствует.</small><br></td></tr></table><br><br>Статья даёт развёрнутую интерпретацию полученных экспериментальных результатов. Попробую дать выжимку. По поводу состоятельности первой гипотезы Gilles замечает следующее:<br><br><blockquote style="font-style:italic">Экспериментальные результаты показывают, что код на Scala, написанный с использованием продвинутых, абстрактных конструкций, лучше чем код, написанный в стиле, схожем с Java. Разница во времени понимания испытуемыми материала статистически значима, несмотря на малый размер выборки. Касательно достигаемого степени понимания, неформальные замечания, сделанные испытуемыми, дают субъективное подтверждение этому — использование продвинутых конструкций упрощает задачу понимания кода. Интересно отметить, что преимущества использования Scala были видны даже в группе, состоящей из программистов с ограниченным пониманием общих концепций Scala.<br>[…]<br>Неожиданностью оказалось наблюдение, что <b>время понимания смысла токена не отличалось, несмотря на разный когнитивное содержание токена</b>. (<em>Шрифт мой — lionet</em>). Если это свойство может быть обобщено, это дало бы дизайнерам языков точную цель: чем короче код, тем лучше. Это также может объяснить, почему языки предметной области (DSL) так эффективны.<br></blockquote><br><br>По поводу второй гипотезы (привязка к доменной области упрощает восприятие кода) эксперименты не смогли ни подтвердить, ни опровергнуть этого. Испытуемые, которым требовалось создать концептуальную модель того, что происходит, тратили больше времени на чтение привязок к доменной области (имён переменных, etc), чем те, которые составляли более техническую модель кода. В целом можно сказать, что поставленный эксперимент не очень подходил для того, чтобы иметь возможность установить состоятельность второй гипотезы.
(author unknown)
08885947659958411616
03834949597904428657
11558259761667988534
02508356558166959398
10202714043885511706
10113498618269975167
tag:google.com,2005:reader/item/2a5eef6e7ba67e0c
Исследование показало, что 90% посетителей сайта www.mozilla.org используют…
2010-03-19T06:45:03Z2010-03-19T06:45:03Z
Исследование показало, что 90% посетителей сайта <a href="http://www.mozilla.org">www.mozilla.org</a> используют браузер Internet Explorer.
(author unknown)
02508356558166959398
tag:google.com,2005:reader/item/242db35b11cae992
Сокращатели ссылок тормозят Интернет
2010-03-18T13:00:43Z2010-03-18T13:00:43Z
<p>Самым главным «тормозом» был признан fb.me – сервис социальной сети Facebook. Для переадресацию на страницу ему требуется целых 2 секунды.</p>
<p><a href="http://webplanet.ru/news/service/2010/03/18/srtn.html">Далее</a></p>
admin
02508356558166959398
10202714043885511706
tag:google.com,2005:reader/item/a30884ae40487b32
Alex Russell: If HTML is just another bytecode container and…
2010-03-18T06:54:30Z2010-03-18T06:54:30Z
<blockquote>Shared by arty
<br>
кратко: раньше яваскрипту можно было учиться на примерах реального веба, а теперь HTML — контейнер байткода, типа SWF, и может им проиграть</blockquote>
<div><blockquote><p>If HTML is just another bytecode container and rendering runtime, we’ll have lost part of what made the web special, and I’m afraid HTML will lose to other formats by willingly giving up its differentiators and playing on their turf.</p></blockquote><p> - <a href="http://alex.dojotoolkit.org/2010/03/view-source-follow-up/">Alex Russell</a></p>
</div>
(author unknown)
02508356558166959398
кратко: раньше яваскрипту можно было учиться на примерах реального веба, а теперь HTML — контейнер байткода, типа SWF, и может им проиграть
arty
tag:google.com,2005:reader/item/c0bdf24db577d6e2
Microsoft's IE9 standards tests vs. reality
2010-03-17T13:22:07Z2010-03-17T13:22:07Z
The good news is that Internet Explorer 9 supports SVG!
<br>
<br>The bad news is that their <a href="http://samples.msdn.microsoft.com/ietestcenter/">standards support table</a> could mislead people into thinking that IE9 is more standards compliant than other browsers.
<br>
<br>Since I'm already talking about SVG, let's look at that as an example. If you read the description on their page, you will notice that it doesn't actually show SVG compliance as such. It shows how each browser does when running the 31 tests Microsoft created, when even the SVG 1.1 Tiny test suite has more than 150 different tests.
<br>
<br>CodeDread has a published list detailing <a href="http://www.codedread.com/svg-support.php">SVG support in different browsers</a>. As you can see, IE9 still does poorly compared to other browsers. So while Microsoft's own page would give you the impression that IE9 has excellent SVG support, that is not the reality.
<br>
<br>It's great that IE9 will support SVG, but I think Microsoft's page is rather misleading. Let's hope they are planning to make use of the full test suite at some point.
(author unknown)
02508356558166959398
tag:google.com,2005:reader/item/13fc652f6b9a8b5f
Огненный лис / [Перевод] Расширение «Context Font» («Шрифт контекста»)
2010-03-17T09:27:37Z2010-03-17T09:27:37Z
<a href="https://addons.mozilla.org/en-US/firefox/addon/91136"><img src="http://harthur.files.wordpress.com/2010/03/cfont1.png?w=460&h=265" alt="[скриншот Context Font]"></a><br>
<br>
<a href="https://addons.mozilla.org/en-US/firefox/addon/91136">расширение</a> · <a href="http://github.com/harthur/fontsinyourface">github</a>
Mithgol
07734004151999099036
01486805804346866309
11576626231517878887
07608794608127428761
16154902689913755210
14293037375839846695
08550341002792979446
02508356558166959398
10202714043885511706
06496463670937250184
tag:google.com,2005:reader/item/44d8dcbbf4b7bd7f
WidgetSpecs
2010-03-15T21:16:27Z2010-03-15T21:16:27Z
<a href="http://www.w3.org/2008/webapps/wiki/WidgetSpecs">WidgetSpecs</a>: <p>The document enumerates the set of the specifications that constitute the Web Application WG’s Widgets Family of Specifications.</p>
(author unknown)
10202714043885511706
tag:google.com,2005:reader/item/57096e72dbe6ed8f
Яндекс: Хостинг Javascript-библиотек
2010-03-15T17:59:49Z2010-03-15T17:59:49Z
<blockquote>Shared by arty
<br>
о, теперь и яндекс</blockquote>
<p>Сегодня мы запустили новый сервис для веб-разработчиков — <a href="http://api.yandex.ru/jslibs">хостинг популярных Javascript-библиотек</a> на серверах Яндекса.</p><br>
<p>Используя загрузку библиотек из CDN Яндекса, вы получаете следующие преимущества:</p><br>
<ul>
<li>Снижается нагрузка на ваш сервер.</li>
<li>Браузеры, следуя рекомендациям спецификации HTTP 1.1, обычно устанавливают не более 2 одновременных соединений с одним хостом (в современных браузерах — 6). Библиотеки загружаются с домена Яндекса, поэтому не блокируют загрузку данных с вашего домена.</li>
<li>Правильное кэширование и использование gzip.</li>
<li>Если пользователь уже посещал какой-либо сайт, который использует библиотеки Яндекса, ему не надо будет заново загружать файлы на вашем сайте — они сохраняются в кэше.</li>
<li>При использовании нашего загрузчика вы получаете неблокирующую загрузку JS и Яндекс.Метрику в подарок.</li>
<li>Каждая библиотека доступна как в сжатом виде, так и в стандартном (версия для разработки). Например, последнюю версию jQuery можно загрузить по такому адресу: <a href="http://yandex.st/jquery/1.4.2/jquery.min.js">http://yandex.st/jquery/1.4.2/jquery.min.js</a></li>
</ul><br>
<p>Мы будем размещать свежие стабильные версии библиотек сразу после их выхода, старые версии будут сохраняться на неограниченный срок.</p><br>
<p>Новости проекта будут публиковаться в нашем <a href="http://clubs.ya.ru/jslibs">клубе</a>, там же вы можете задать вопросы и оставить отзывы.</p><br>
<strong><em>Алексей Андросов и Леонид Хачатуров, ускоряем интернет</em></strong><img src="http://clck.yandex.ru/click/dtype=blogpost/path=company.23439/*http%3A//clubs.ya.ru" alt=".">
(author unknown)
02508356558166959398
о, теперь и яндекс
arty
tag:google.com,2005:reader/item/1b01fbdee8e5e864
Вам, разработчики.
2010-03-15T16:27:04Z2010-03-15T16:27:04Z
<img src="http://pit.dirty.ru/dirty/1/2010/03/15/16651-192704-3dc9b4d6c14e7ebddfb72c77c70b7ef7.jpg"><br><br><a href="http://www.uistencils.com/">Инструменты</a> для разработки.
Yagre
02508356558166959398
10202714043885511706
tag:google.com,2005:reader/item/e3f05257c0c7532b
удобная работа с классами
2010-03-15T07:14:25Z2010-03-15T07:14:25Z
<p><a href="http://www.w3.org/TR/html5/dom.html#classes">в спеке html5 есть удобный интерфейс <code>classList</code> для работы с классами</a> (и другими подобными строками из разделённых пробелами слов). Естественно, он базируется на том, что яваскрипт-библиотеки давно уже сделали удобным и привычным, поэтому переходник сделать очень легко в качестве развлечения на пять минут:</p>
<pre><code>Element.addMethods({
getClassList: function(element) {
element = $(element);
return element.classList || (element.classList = {
has: attach('has'),
add: attach('add'),
remove: attach('remove'),
toggle: attach('toggle')
});
function attach(name) {
return element[name + 'ClassName'].bind(element);
}
}
});
</code></pre>
<p>если же очень горит максимально приблизиться к спецификации даже в той части, которую никто никогда не использует, то можно добавить ещё пару методов:</p>
<pre><code> item: function(index){ return element.classNames()[index]; },
length: function(){ return element.classNames().length; },
</code></pre>
<p>в целом, конечно, это очень похоже на <a href="http://blog.arty.name/2008/skryityie-dannyie-v-html5/">переходник к не менее удобному <code>dataset</code>, который я делал пару лет назад</a>. </p>
(author unknown)
05531175658843090857
10202714043885511706
tag:google.com,2005:reader/item/717ab828c139551b
YUI Theater — Douglas Crockford: “Crockford on JavaScript — Episode IV: The Metamorphosis of Ajax” (93 min.)
2010-03-13T10:58:29Z2010-03-13T10:58:29Z
<blockquote>Shared by arty
<br>
вот чего у Крокфорда не отнять, так это таланта увлекательно ругать существующие технологии, и отстранённо смотреть на их историю : ) Хотя, конечно, не всему нужно слепо верить. Если кто не любит видео, вот транскрипт: <a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4">http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4</a></blockquote>
<p><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4"><img src="http://yuiblog.com/assets/crockonjs-4-20100306-184434.jpg" alt="Douglas Crockford delivers the fourth lecture in his his Crockford on JavaScript lecture series at Yahoo on March 3, 2010." width="510"></a></p>
<p>Last week, Yahoo! JavaScript architect Douglas Crockford delivered the fourth installment of his <a href="http://yuiblog.com/crockford/" title="Crockford on JavaScript: A Public Lecture Series at Yahoo!">Crockford on JavaScript</a> series:</p>
<ol>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1">Volume One: The Early Years</a></li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-2">Chapter 2: And Then There Was JavaScript</a></li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-3">Act III: Function the Ultimate</a></li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4">Episode IV: The Metamorphosis of Ajax</a></li>
<li>Part V: The End of All Things (March 31 — <a href="http://crockford-style.eventbrite.com/" title="Crockford On JavaScript: Style and Performance in... - Eventbrite">RSVP</a>)</li>
</ol>
<p>In this session, Douglas tackles the DOM. On the one hand there was JavaScript, he says, and JavaScript is “what made the browser work.”</p>
<blockquote><p>On the other hand, there was the Document Object Model, also known affectionately as the DOM. It is what most people hate when they say they hate JavaScript. Most of the people who say they hate JavaScript don’t know JavaScript, might have never seen JavaScript, but they’ve felt the DOM alright. If you don’t know what the difference is and you say, “JavaScript is the stupidest thing I’ve ever seen,” you’re not talking about JavaScript, you’re talking about the DOM. The DOM is the browser’s API. It is the interface. It provides JavaScript for manipulating documents.</p>
</blockquote>
<p>The DOM may be imperfect, but it’s nonetheless crucial to what frontend engineers do when they write web applications. In this talk, Douglas provides an overview, situated historically, of where the DOM came from, how it achieved ascendance with Ajax, and what the future might hold. In Douglas’s inimitable fashion, this history starts with <a href="http://en.wikipedia.org/wiki/John_Harington_(writer)" title="John Harrington - Wikipedia, the free encyclopedia">Sir John Harrington</a> and takes us up to the present day. A few choice words for CSS are among the many applause lines for veteran developers:</p>
<blockquote><p>I find within the community of people who use CSS great affection for it. They’re totally invested in CSS, they love it. They can’t imagine any other way of doing formatting in a document. It’s it. It’s sort of like watching an episode of <em>Cops</em> where the cops come in and break up the family dispute, and there’s this “CSS ain’t bad, you just don’t understand it like I do. I know it hurts me, but I make mistakes, I’m wrong.” CSS is awful, and it amazes me the way people get invested in it. It’s like once you figure it out, kind of go “oh, OK, I see how I might be able to make it work,” then you flip from hating it to loving it, and despising anybody who hasn’t gone through what you’ve gone through. It doesn’t make sense to me.</p>
</blockquote>
<p>If the video embed below doesn’t show up correctly in your RSS reader of choice, be sure to <a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4">click through to watch the high-resolution version of the video on YUI Theater</a>.</p>
<p>
<div><iframe src="http://reader.googleusercontent.com/reader/embediframe?src=http://d.yimg.com/m/up/ypp/default/player.swf&width=510&height=287&flashVars=vid%3D18534728%26" width="510" height="287"></iframe></div>
</p>
<ul>
<li><a href="http://bit.ly/av38LC">Download HD video (480p ~720MB)</a></li>
<li><a href="http://yuiblog.com/yuitheater/crockonjs-4.m4v">Download video (m4v)</a></li>
<li><a href="http://www.slideshare.net/douglascrockford/crockford-on-javascript-episode-iv-the-metamorphosis-of-ajax">Download slides</a></li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4">A high-resolution, transcripted version of this talk is available on the YUI Theater site</a></li>
</ul>
<h3>Other Recent YUI Theater Videos:</h3>
<ul>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-3"><strong>Douglas Crockford:</strong> Crockford on JavaScript — Act III: Function the Ultimate</a> — Yahoo!’s JavaScript architect Douglas Crockford continues his lecture series on the JavaScript programming language with a discussion of functions in JavaScript. ‘Functions are the very best part of JavaScript,’ Crockford says. ‘It’s where the power is, it’s where the beauty is.’ Watch the video to learn why.</li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-2"><strong>Douglas Crockford:</strong> Crockford on JavaScript — Chapter 2: And Then There Was JavaScript</a> — Yahoo!’s JavaScript architect Douglas Crockford surveys the features of the JavaScript programming language.</li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-1"><strong>Douglas Crockford:</strong> Crockford on JavaScript — Volume 1: The Early Years</a> — Douglas Crockford puts the JavaScript programming language in its proper historical context, tracing the language’s structure and conventions (and some of its quirks) back to their roots in the early decades of computer science.</li>
<li><a href="http://developer.yahoo.com/yui/theater/video.php?v=heilmann-yql"><strong>Christian Heilmann:</strong> YQL and YUI: Building Blocks for Quick Applications</a> — The Yahoo! Developer Network’s international evangelist Christian Heilmann discusses his philosophy for creating fast, powerful, compelling applications using the Yahoo Query Language (YQL) and the Yahoo User Interface Library (YUI).</li>
</ul>
<h3>Subscribing to YUI Theater:</h3>
<ul>
<li><a href="http://feeds.feedburner.com/yuiblog/yui-theater">YUI Theater RSS feed</a></li>
<li><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=263846173&s=143441">YUI Theater on iTunes</a></li>
</ul>
<div>
<a href="http://feeds.yuiblog.com/~ff/YahooUserInterfaceBlog?a=4i6uPiprOFs:SuJyw3rimdo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/YahooUserInterfaceBlog?d=yIl2AUoC8zA" border="0"></a> <a href="http://feeds.yuiblog.com/~ff/YahooUserInterfaceBlog?a=4i6uPiprOFs:SuJyw3rimdo:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/YahooUserInterfaceBlog?d=dnMXMwOfBR0" border="0"></a> <a href="http://feeds.yuiblog.com/~ff/YahooUserInterfaceBlog?a=4i6uPiprOFs:SuJyw3rimdo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/YahooUserInterfaceBlog?i=4i6uPiprOFs:SuJyw3rimdo:D7DqB2pKExk" border="0"></a> <a href="http://feeds.yuiblog.com/~ff/YahooUserInterfaceBlog?a=4i6uPiprOFs:SuJyw3rimdo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/YahooUserInterfaceBlog?i=4i6uPiprOFs:SuJyw3rimdo:F7zBnMyn0Lo" border="0"></a>
</div>
(author unknown)
вот чего у Крокфорда не отнять, так это таланта увлекательно ругать существующие технологии, и отстранённо смотреть на их историю : ) Хотя, конечно, не всему нужно слепо верить. Если кто не любит видео, вот транскрипт: <a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4">http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4</a>
arty
tag:google.com,2005:reader/item/fbf24842e7191090
flashblockdetector
2010-03-13T10:44:58Z2010-03-13T10:44:58Z
<div><p><a href="http://code.google.com/p/flashblockdetector/">flashblockdetector</a>. Mark Pilgrim’s JavaScript library for detecting if the user has a Flash blocker enabled, such as FlashBlock for Firefox and Chrome or ClickToFlash for Safari. One good use of this would be to inform users that they need to opt-in to Flash for unobtrusive Flash enhancements (such as invisible audio players) to work on that page.</p>
</div>
(author unknown)
17682858120572803218
00269998345104922853
05690229047086915053
13885598797767922370
07434470118983677177
14177014194085893048
10202714043885511706
08492471103338500423
tag:google.com,2005:reader/item/972e3f963720cfa2
Facebook Adds Code for Clickjacking Prevention
2010-03-13T10:42:17Z2010-03-13T10:42:17Z
<div><p><a href="http://theharmonyguy.com/2010/03/13/facebook-adds-code-for-clickjacking-prevention/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A%20theharmonyguy%20%28Social%20Hacking%29">Facebook Adds Code for Clickjacking Prevention</a>. Clever technique: Facebook pages check to see if they are being framed (using window.top) and, if they are, add a div covering the whole page which causes a top level reload should anything be clicked on. They also log framing attempts using an image bug.</p>
</div>
(author unknown)
00618464977444485428
09766010033553623676
08537932877058015386
15213357477338739738
14613423002842127351
02240698951620832195
09413895889909808995
07607191457032118444
00269998345104922853
05690229047086915053
13885598797767922370
14177014194085893048
10202714043885511706
08492471103338500423
tag:google.com,2005:reader/item/81a9a5ad7ece5658
Speed Tracer by Google (layout profiler included!)
2010-03-13T10:39:19Z2010-03-13T10:39:19Z
<a href="https://chrome.google.com/extensions/detail/ognampngfcbddbfemdapefohjiobgbdl">Speed Tracer by Google (layout profiler included!)</a>: <p>Speed Tracer is a tool to help you identify and fix performance problems in your web applications. It visualizes metrics that are taken from low level instrumentation points inside of the browser and analyzes them as your application runs. Speed Tracer is available as a Chrome extension and works on all platforms where extensions are currently supported (Windows and Linux).</p>
<p>Using Speed Tracer you are able to get a better picture of where time is being spent in your application. This includes problems caused by:</p>
<ul>
<li>Javascript parsing and execution</li>
<li><strong>Layout</strong></li>
<li>CSS style recalculation and selector matching</li>
<li>DOM Event handling</li>
<li>Network resource loading</li>
<li>Timer fires</li>
<li>XMLHttpRequest callbacks</li>
<li>Painting</li>
<li>and more …</li>
</ul>
(author unknown)
10202714043885511706
tag:google.com,2005:reader/item/7bbef9d5a19a0b59
Рисовалка от дизайнера Рикардо Кабелло. Фантастика какая-то.
2010-03-13T09:39:42Z2010-03-13T09:39:42Z
<a href="http://mrdoob.com/projects/harmony">Рисовалка</a> от дизайнера Рикардо Кабелло. Фантастика какая-то.
(author unknown)
02463447952817617945
02508356558166959398
tag:google.com,2005:reader/item/d81c71d62564ba35
это же бубльгум (программистское)
2010-03-11T18:58:40Z2010-03-11T18:58:40Z
<blockquote>Shared by arty
<br>
очень круто!</blockquote>
<a href="http://www.cs.brown.edu/people/acb/codebubbles_site.htm">Code Bubbles</a> - интересная идея фундаментально нового устройства IDE. Отдельные пузырьки для методов/классов/данных, которые легко группируются и разъединяются, и существуют на одной огромной виртуальной рабочей площади. По ссылке есть 8-минутное видео, которое все объясняет. <br><br>Оригинальная идея. На первый взгляд похоже на среду разработки в Smalltalk - например в Squeak. Но хотя принцип отдельного окошка для каждого метода схожий, в Code Bubbles особенно полезным видится возможность их как угодно ориентировать (они еще и растут сами, когда текст добавляешь), и двигать по виртуальной плоскости, на которой очень легко организовать отдельные "проекты". И все запоминает на будущее. И кстати замечания легко прикреплять. <br><br>Возможно, не так хорошо подойдет для других языков, кроме Джавы. В Джаве часто бывает много небольших классов с полу-тривиальным кодом, но надо сквозь них пройти в иерархии, чтобы добраться до чего-то интересного. Пузырьки тут больше помогают, чем в других языках, думаю.<br><br>В общем, красиво. Я бы может даже попробовал, чтобы почувствовать, как это. Давно я, кстати, не пользовался IDE как следует. Весь код пишу в vim'е. Хотя ежели кто хочет в IDE - пожалуйста. Священную войну по этому поводу не люблю.
(author unknown)
очень круто!
arty
tag:google.com,2005:reader/item/51501ac590612820
Go language vs. Algol-68
2010-03-10T19:34:46Z2010-03-10T19:34:46Z
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/kkapp"><img src="http://i.friendfeed.com/p-6ff7b0a2dc7111dc9e22003048343a40-medium-2" alt="Алексей Капранов" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/kkapp" style="font-weight:bold;text-decoration:none;color:#00c">Алексей Капранов</a>
</div>
<div style="margin-top:2px;color:black">On Go - <a style="text-decoration:none;color:#00c" rel="nofollow" href="http://www.cowlark.com/2009-11-15-go/" title="http://www.cowlark.com/2009-11-15-go/">http://www.cowlark.com/2009-11...</a></div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/kkapp/321def00/on-go" style="color:#737373;text-decoration:none">4 hours ago</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://delicious.com/kapr">delicious</a>
- <a href="http://friendfeed.com/kkapp/321def00/on-go" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/kkapp/321def00/on-go" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/asdonair" style="color:#7777cc;text-decoration:none">øv</a>, <a href="http://friendfeed.com/ashport" style="color:#7777cc;text-decoration:none">Andrew Shitov</a>, <a href="http://friendfeed.com/citrin" style="color:#7777cc;text-decoration:none">Anton Yuzhaninov</a> and <a href="http://friendfeed.com/arty" style="color:#7777cc;text-decoration:none">arty</a> liked this</td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">Go language vs. Algol-68 - <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
02508356558166959398
tag:google.com,2005:reader/item/250a39489ea4a03d
Google / Google Apps Marketplace
2010-03-10T10:10:01Z2010-03-10T10:10:01Z
<img src="http://2.bp.blogspot.com/_derMn5U940g/S5aZ6tdrx8I/AAAAAAAAAAM/rnNnMVMJCio/s200/apps_mp.png" alt="image"><br>
Google реализовала на мой взгляд давно очевидный механизм. Теперь каждый разработчик имеет возможность продавать свой онлайн сервисы через легкий и удобный <a href="http://www.google.com/enterprise/marketplace/home">магазин</a>.<div> <a href="http://habrahabr.ru/blogs/google/86994/#habracut">Читать дальше →</a> </div>
otaqsun
13607041433971249190
17829089289248082210
01107974126239066378
15563614779517724519
09394339315386117608
18425899868649387184
01981613693112414153
06475416992507539257
04321236261124159122
04473405598059976565
10202714043885511706
04949566512112262416
14024196045507641005
03598477619245495972
tag:google.com,2005:reader/item/ab2d465159cddd22
NTT docomo is now an OpenID Provider
2010-03-10T07:37:39Z2010-03-10T07:37:39Z
<blockquote>Shared by arty
<br>
Directed Identity, естественно, поддерживается: <a href="https://i.mydocomo.com/">https://i.mydocomo.com/</a></blockquote>
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/kkapp"><img src="http://i.friendfeed.com/p-6ff7b0a2dc7111dc9e22003048343a40-medium-2" alt="Алексей Капранов" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/kkapp" style="font-weight:bold;text-decoration:none;color:#00c">Алексей Капранов</a>
</div>
<div style="margin-top:2px;color:black">NTT docomo is now an OpenID Provider | OpenID - <a style="text-decoration:none;color:#00c" rel="nofollow" href="http://openid.net/2010/03/09/ntt-docomo-is-now-an-openid-provider/" title="http://openid.net/2010/03/09/ntt-docomo-is-now-an-openid-provider/">http://openid.net/2010...</a></div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/kkapp/4823a3b4/ntt-docomo-is-now-openid-provider" style="color:#737373;text-decoration:none">8 hours ago</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://friendfeed.com/share/bookmarklet">Bookmarklet</a>
- <a href="http://friendfeed.com/kkapp/4823a3b4/ntt-docomo-is-now-openid-provider" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/kkapp/4823a3b4/ntt-docomo-is-now-openid-provider" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/romanzolotarev" style="color:#7777cc;text-decoration:none">Roman Zolotarev</a>, <a href="http://friendfeed.com/lusever" style="color:#7777cc;text-decoration:none">luseverchik</a>, <a href="http://friendfeed.com/orie" style="color:#7777cc;text-decoration:none">orie</a> and 2 other people liked this</td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">Половина населения Японии одним махом получила OpenID-идентификаторы. - <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a></td>
</tr>
</table>
</div>
<div style="margin-top:6pt;padding-left:19px;font-size:10pt"><a href="http://friendfeed.com/kkapp/4823a3b4/ntt-docomo-is-now-openid-provider" style="color:#7777cc;text-decoration:none;font-style:italic">2 more comments</a></div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle">Ага. «Click here if you are a DoCoMo user». - <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a></td>
</tr>
</table>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:5px;padding-top:2px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-comment.png?v=1fa9" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a rel="nofollow" href="https://i.mydocomo.com/" style="color:#7777cc;text-decoration:none">https://i.mydocomo.com/</a> у меня в блоге уже сработало - <a href="http://friendfeed.com/arty" style="color:#7777cc;text-decoration:none">arty</a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
Directed Identity, естественно, поддерживается: <a href="https://i.mydocomo.com/">https://i.mydocomo.com/</a>
arty
tag:google.com,2005:reader/item/2d8d6f03b06ed4bb
9000: «Why I switched to Pylons after using Django for six months» (reddit)
2010-03-08T23:47:54Z2010-03-08T23:47:54Z
<div style="font-size:10pt;font-family:Arial,sans-serif;color:black"><div>
<table style="border:0;border-collapse:collapse">
<tr>
<td style="line-height:0;border:0;padding:0;vertical-align:top"><a href="http://friendfeed.com/9000"><img src="http://i.friendfeed.com/p-ccbfe264e7de11dc8e9e003048343a40-medium-1" alt="9000" style="border:1px solid #ccc;width:50px;height:50px"></a></td>
<td style="border:0;padding:0;vertical-align:top;padding-left:8px;font-family:Arial,sans-serif;font-size:11pt">
<div style="margin-bottom:1pt;color:black">
<a href="http://friendfeed.com/9000" style="font-weight:bold;text-decoration:none;color:#00c">9000</a>
</div>
<div style="margin-top:2px;color:black">«Why I switched to Pylons after using Django for six months» (reddit) - <a style="text-decoration:none;color:#00c" rel="nofollow" href="http://www.reddit.com/r/programming/comments/bat7q/why_i_switched_to_pylons_after_using_django_for/" title="http://www.reddit.com/r/programming/comments/bat7q/why_i_switched_to_pylons_after_using_django_for/">http://www.reddit.com/r...</a></div>
<div style="margin-top:2px;color:#737373;font-size:10pt">
<a href="http://friendfeed.com/9000/7f6fb74f/why-i-switched-to-pylons-after-using-django-for" style="color:#737373;text-decoration:none">March 8</a>
from <a style="color:#737373;text-decoration:none" rel="nofollow" href="http://friendfeed.com/share/bookmarklet">Bookmarklet</a>
- <a href="http://friendfeed.com/9000/7f6fb74f/why-i-switched-to-pylons-after-using-django-for" style="color:#77c;text-decoration:none">Comment</a>
- <a href="http://friendfeed.com/9000/7f6fb74f/why-i-switched-to-pylons-after-using-django-for" style="color:#77c;text-decoration:none">Like</a>
</div>
<div style="margin-top:6pt">
<table style="border-spacing:0;border-collapse:collapse">
<tr>
<td style="border:0;padding:0;padding-right:3px;vertical-align:top"><img src="http://friendfeed.com/static/images/n-smile.png?v=2343" width="16" height="16"></td>
<td style="border:0;padding:0;font-family:Arial,sans-serif;font-size:10pt;color:#737373;vertical-align:middle"><a href="http://friendfeed.com/arty" style="color:#7777cc;text-decoration:none">arty</a>, <a href="http://friendfeed.com/silpol" style="color:#7777cc;text-decoration:none">A.T.</a> and <a href="http://friendfeed.com/kkapp" style="color:#7777cc;text-decoration:none">Алексей Капранов</a> liked this</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</div>
</div>
(author unknown)
10202714043885511706
tag:google.com,2005:reader/item/ac3f41b34581d36b
HTML5 apps
2010-03-08T14:45:15Z2010-03-08T14:45:15Z
<p>Right now nobody’s interested in a mobile solution that does not contain the words “iPhone” and “app” and that is not submitted to a closed environment where it competes with approximately 2,437 similar mobile solutions.</p>
<p>Compared to the current crop of mobile clients and developers, lemmings marching off a cliff follow a solid, sensible strategy. Startling them out of this <a href="http://www.quirksmode.org/blog/archives/2010/02/the_iphone_obse.html">obsession</a> requires nothing short of a new buzzword.</p>
<p>Therefore I’d like to re-brand standards-based mobile websites and applications, definitely including W3C Widgets, as “HTML5 apps.” People outside our little technical circle are already aware of the existence of HTML5, and I don’t think it needs much of an effort to
elevate it to full buzzwordiness.</p>
<p>Technically, HTML5 apps would encompass all websites as well as all the myriads of (usually locally installed) web-standards-based application systems on mobile. The guiding principle would be to write and maintain one single core application that uses web standards, as well as a mechanism that deploys that core application across a wide range of platforms.</p>
(author unknown)
06836422528150126485
06056730815072438377
05110201764566074088
02770659803209154219
01072042347546003267
03802956875579145346
00917967490124578166
12996006324666661986
14873880954690837362
14917131568007853936
09001021195358874434
03950526336887799561
02550599650158348779
10818560190838135030
05325327707497594110
03234870073832063328
12396821166824851793
01595479084522392124
16453512156139315449
02508356558166959398
18080777655804085924
03861706176307479567
10202714043885511706
13213593308719194322
15697964137554176684
13256246518157161128
tag:google.com,2005:reader/item/169f6b65aaf078fd
Экран выбора браузера -> 3х загрузок Оперы
2010-03-04T16:05:42Z2010-03-04T16:05:42Z
<p>За два дня, прошедших с выпуска обновления для европейских Windows-пользователей, число закачек браузера Opera существенно выросло.</p>
<p><a href="http://webplanet.ru/news/soft/2010/03/04/ballotscreen.html">Далее</a></p>
(author unknown)
02508356558166959398
tag:google.com,2005:reader/item/c0d2a1ec8577edde
Ambilight для тэга video
2010-03-04T01:23:12Z2010-03-04T01:23:12Z
<p>В некоторых топовых моделях телевизоров Philips есть такая прикольная штука, как <a href="http://en.wikipedia.org/wiki/Ambilight">Ambilight</a>. По сути, это светодиодная подсветка телевизора, которая меняет цвет в зависимости от цвета картинки. Смотреть кино на таком телевизоре — одно удовольствие.</p>
<p>На флэше уже есть реализации такой подсветки, ну а чем мы — фронтовики — хуже? Дабы в очередной раз разобраться, на что способны современные браузеры, на свет появился очередной эксперимент:</p>
<p><a href="http://chikuyonok.ru/ambilight/">Ambilight для тэга <video></a> <span style="font-size:0.75em">(Firefox 3.5, Opera 10.5, Safari 4, Google Chrome 4)</span></p>
<p>Далее рассмотрим, как это было сделано.</p>
<h2>Алгоритм</h2>
<p>Прежде, чем начать что-то писать, нужно составить алгоритм, по которому будет работать наша подсветка.</p>
<p>Настоящая подсветка в телевизоре работает примерно так. На задней панели располагается ряд ярких светодиодов, которые светятся разными цветами. Причём цвет диода примерно соответствует цвету области изображения, напротив которой он находится. Когда картинка меняется, светодиод плавно меняет свой цвет на другой.</p>
<p>Исходя из этого описания, нам нужно проделать следующее: определить цвет каждого диода для текущего кадра и отрисовать его свечение. Что ж, приступим.</p>
<h2>Определяем цвет диода</h2>
<p>Для удобства предположим, что в нашем «телевизоре» всего по 5 светодиодов с каждой стороны. Соответственно, нужно взять фрагмент кадра, разделить его на области по количеству диодов и найти усреднённый цвет в каждой области — это и будут цвета подсветки:</p>
<p><img src="http://chikuyonok.ru/u/2010/03/get-color.png" alt="get-color" title="get-color" width="403" height="106"></p>
<p>Чтобы получить изображение текущего видео-кадра, достаточно отрисовать его в <code><canvas></code> через метод <code>drawImage()</code>:</p>
<pre>
var canvas = document.createElement('canvas'),
video = document.getElementsByTagName('video')[0],
ctx = canvas.getContext('2d');
// обязательно выставляем размер холста
canvas.width = video.width;
canvas.height = video.height;
// рисуем кадр
ctx.drawImage(video, 0, 0, video.width, video.height);
</pre>
<p>Текущий кадр получили, теперь нужно узнать, какого цвета пиксели сбоку изображения. Для этого воспользуемся методом <code>getImageData()</code>:</p>
<pre>
/** Ширина области, которую будем анализировать */
var block_width = 50;
var pixels = ctx.getImageData(0, 0, block_width, canvas.height);
</pre>
<p>В объекте <code>pixels</code> есть свойство <code>data</code>, в котором содержатся цвета всех пикселей. Причём хранятся они в немного необычном формате: это массив RGBA-компонетнов всех пикселей. К примеру, чтобы узнать цвет и прозрачность первого пикселя, нужно взять первые 4 элемента массива <code>data</code>, второго пикселя — следующие 4 и так далее:</p>
<pre>
var pixel1 = {
r: pixels.data[0],
g: pixels.data[1],
b: pixels.data[2],
a: pixels.data[3]
};
var pixel2 = {
r: pixels.data[4],
g: pixels.data[5],
b: pixels.data[6],
a: pixels.data[7]
};
</pre>
<p>Нам нужно разделить все полученные пиксели на 5 групп (по количеству светодиодов, которое мы выбрали ранее) и проанализировать каждую группу по очереди:</p>
<pre>
function getMidColors() {
var width = canvas.width,
height = canvas.height,
lamps = 5, //количество светодиодов
block_width = 50, // ширина анализируемой области
block_height = Math.ceil(height / lamps), // высота анализируемого блока
pxl = block_width * block_height * 4, // сколько всего RGBA-компонентов в одной области
result = [],
img_data = ctx.getImageData(0, 0, block_width, h),
total = img_data.data.length;
for (var i = 0; i < lamps; i++) {
var from = i * width * block_width;
result.push( calcMidColor(img_data.data, i * pxl, Math.min((i + 1) * pxl, total_pixels - 1)) );
}
return result;
}
</pre>
<p>В этой функции мы просто пробегаемся по анализируемым блокам и считаем для них усреднённый цвет с помощью функции <code> calcMidColor()</code>. Нам не нужно применять всякие хитрые формулы, чтобы посчитать усреднённый цвет на области исходя из интенсивности цветов в ней, достаточно посчитать среднее арифметическое для каждого цветового компонента:</p>
<pre>
function calcMidColor(data, from, to) {
var result = [0, 0, 0];
var total_pixels = (to - from) / 4;
for (var i = from; i <= to; i += 4) {
result[0] += data[i];
result[1] += data[i + 1];
result[2] += data[i + 2];
}
result[0] = Math.round(result[0] / total_pixels);
result[1] = Math.round(result[1] / total_pixels);
result[2] = Math.round(result[2] / total_pixels);
return result;
}
</pre>
<p>Итак, мы получили цвета для светодиодов, но они слишком тусклые: ведь диоды светят очень ярко чтобы добиться достаточного уровня свечения. Нужно увеличить яркость цветов, а также увеличить насыщенность, чтобы добавить глубины свечению. Для этих целей очень удобно пользоваться цветовой моделью HSV — hue, saturation, value, — достаточно домножить два последних компонента на некий коэффициент. Но цвета у нас хранятся в модели RGB, поэтому сначала конвертируем цвет в HSV, увеличиваем яркость и насыщенность, а затем обратно конвертируем в RGB (формулы конвертирования RGB→HSV и обратно легко находятся в интернетах):</p>
<pre>
function adjustColor(color) {
color = rgb2hsv(color);
color[1] = Math.min(100, color[1] * 1.4); // насыщенность
color[2] = Math.min(100, color[2] * 2.7); // яркость
return hsv2rgb(color);
}
</pre>
<h2>Рисуем свечение</h2>
<p>Светодиоды — это всенаправленные источники света. Для их отображения лучше всего подходят радиальные градиенты: для каждого диода свой градиент. Однако для достижения хорошего визуального результата придётся делать очень много сложных расчётов: нужно учитывать позицию диода, диаметр и затухание свечения, смешивание соседних цветов и так далее. Поэтому мы немного сжульничаем: нарисуем обычный — линейный — градиент, а сверху наложим специальную маску, которая создаст ощущение правдоподобного свечения.</p>
<p>Градиент рисуется просто: сначала создаём его с помощью <code>createLinearGradient()</code>, а потом добавляем цвета через <code>addColorStop()</code> и отрисовываем его:</p>
<pre>
// для свечения создаём новый холст
var light_canvas = document.createElement('canvas'),
light_ctx = light_canvas.getContext('2d');
light_canvas.width = 200;
light_canvas.height = 200;
var midcolors = getMidColors(), // полчаем усреднённые цвета
grd = ctx.createLinearGradient(0, 0, 0, canvas.height); // градиент
for (var i = 0, il = midcolors.length; i < il; i++) {
grd.addColorStop(i / il, 'rgb(' + adjustColor(midcolors[i]).join(',') + ')');
}
// рисуем градиент
light_ctx.fillStyle = grd;
light_ctx.fillRect(0, 0, light_canvas.width, light_canvas.height);
</pre>
<p>Получим что-то вроде этого:</p>
<p><img src="http://chikuyonok.ru/u/2010/03/gradient.png" alt="gradient" title="gradient" width="200" height="327"></p>
<h2>Маска</h2>
<p>Маску мы нарисуем в фотошопе. Есть замечательный фильтр Lightning Effects (Filters→Render→ Lightning Effects…), который позволяет создавать источники света. Заливаем слой белым цветом и вызываем этот фильтр примерно с такими настройками:</p>
<p><img src="http://chikuyonok.ru/u/2010/03/lightning.png" alt="lightning" title="lightning" width="500" height="458"></p>
<p>Получим вот такое световое пятно:</p>
<p><img src="http://chikuyonok.ru/u/2010/03/spot.png" alt="spot" title="spot" width="400" height="400"></p>
<p>Меняем режим наложения на Lighten, дублируем, крутим, меняем масштаб, играемся с прозрачностью, правим уровни и получаем вот такой результат:<br>
<img src="http://chikuyonok.ru/u/2010/03/spot-grid.png" alt="spot-grid" title="spot-grid" width="310" height="310"></p>
<p>Так как изображение чёрно-белое, из него очень легко получить маску, где белый цвет будет прозрачным. И если эту маску наложить поверх градиента, то получим вполне себе симпатичное свечение:</p>
<p><img src="http://chikuyonok.ru/u/2010/03/result.jpg" alt="result" title="result" width="585" height="240"></p>
<p>Но самое главное — мы легко сможем менять внешний вид и интенсивность свечения, не прибегая к программированию.</p>
<p>Свечение для левой стороны готово, осталось проделать то же самое для правой стороны, добавить плавную смену подсветок и написать контроллер, который с определённым интервалом будет эту подсветку обновлять. Расписывать это — долго и нудно, проще посмотреть <a href="http://chikuyonok.ru/ambilight/ambilight.js">исходник</a>.</p>
<p><strong>UPD:</strong> как показал эксперимент, далеко не у всех нормально работает HD-видео (изначально размер ролика был 1280×544), снижение разрешения до 592×256 решило проблему.</p>
<img src="http://chikuyonok.ru/wp-content/plugins/feed-statistics.php?view=1&post_id=633" width="1" height="1"><img src="http://feeds.feedburner.com/~r/chikuyonok/vikk/~4/8Kxt9koIx84" height="1" width="1">
Сергей Чикуенок
15819293532503016763
17199052365469143539
09168642464399332972
01306949741325288092
09413663730171558753
02480044899494396240
13388273673933585454
14838110274718916524
10983841058388766935
09900014746611473283
14777332836183431748
01222822538293080238
02695960674163188954
07792315075738604391
08163264192213899520
05508000148862066273
05628741838436802971
00351520683499603307
02039502775787063515
17694170566035752120
16845890194114453798
16564236855539814639
01280151271548113235
09886420939275822741
02508356558166959398
15409222817950735692
04753221362890523224
15543334721053597685
11260076853857956025
04321236261124159122
10202714043885511706
04649364546221413566
13295956234594942826
08280887084007581422
11376596860520175769
06967781812732581788
03140116885714088694
13482702470931672183
tag:google.com,2005:reader/item/cd5243300673adee
Some People Can't Read URLs
2010-03-03T08:47:20Z2010-03-03T08:47:20Z
<div><p><a href="http://jonoscript.wordpress.com/2010/02/18/some-people-cant-read-urls/">Some People Can’t Read URLs</a>. Commentary on the recent “facebook login” incident from Jono at Mozilla Labs. I’d guess that most people can’t read URLs, and it worries me more than any other aspect of today’s web. If you want to stay safe from phishing and other forms of online fraud you need at least a basic understanding of a bewildering array of technologies—URLs, paths, domains, subdomains, ports, DNS, SSL as well as fundamental concepts like browsers, web sites and web servers. Misunderstand any of those concepts and you’ll be an easy target for even the most basic phishing attempts. It almost makes me uncomfortable encouraging regular people to use the web because I know they’ll be at massive risk to online fraud.</p>
</div>
(author unknown)
02508356558166959398
tag:google.com,2005:reader/item/92ada7540783d3f0
Internet Explorer: Global Variables, and Stack Overflows
2010-03-02T09:21:26Z2010-03-02T09:21:26Z
<div><p><a href="http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-variables-and-stack-overflows/">Internet Explorer: Global Variables, and Stack Overflows</a>. An extremely subtle IE bug—if your recursive JavaScript function is attached directly to the window (global) object, IE won’t let you call it recursively more than 12 times.</p>
</div>
(author unknown)
02485799664351032395
08885947659958411616
13792922837996823028
04885234074518850848
03800243883685471454
05690229047086915053
11503100639032564589
02508356558166959398
10202714043885511706
tag:google.com,2005:reader/item/e63160c9e8f59eef
Google Acquires Photo Editor Picnik
2010-03-01T21:03:30Z2010-03-01T21:03:30Z
<p><a href="http://blogoscoped.com/files/picnik-sample-large.jpg"><img src="http://blogoscoped.com/files/picnik-sample.png" alt=""></a></p>
<p>Online photo editor Picnik has been acquired by Google, as the Picnik blog <a href="http://blog.picnik.com/2010/03/google-acquires-picnik/">announces</a>. The Picnik team is excited, writing that “It means we can think BIG. Google processes petabytes of data every day, and with their worldwide infrastructure and world-class team, it is truly the best home we could have found.” TechCrunch <a href="http://techcrunch.com/2010/03/01/google-buys-up-online-photo-editing-site-picnik/">comments</a> that “Interestingly, Picnik is Flickr’s default photo editor”... Flickr being a competitor to Google’s Picasa Web Albums.</p>
<p>A built-in image editor would make some sense in a whole lot of Google tools. Blogger, for instance, or Picasa Web Albums, or Google Presentations (beyond just vector-based editing), even Google image search (for, say, a quick contrast increasing of a pic you’ve found). A stand-alone photo editing app could be interesting too; for one thing, you can’t just install Photoshop on Google Chrome OS. Not sure if we’ll see the existing Picnik app itself surface in Google world, but it seems at least the skill set of the Picnik team could come in handy for Google if they plan any of these efforts.</p>
<p>[Thanks <a href="http://www.last.fm/user/RiyAndroid">RiyAndroid</a>!]</p> <p><strong>[By Philipp Lenssen | Origin: <a href="http://blogoscoped.com/archive/2010-03-01-n18.html">Google Acquires Photo Editor Picnik</a> | <a href="http://blogoscoped.com/forum/find/?postId=9012">Comments</a>]</strong></p><br><em>[Advertisement] <a href="http://blogoscoped.com/ad/?id=24&isFeed=1" rel="nofollow">Directory Journal: Search Engine Friendly Directory</a></em>
Philipp Lenssen
04112488889542072385
16869745641614086221
16862207362563903733
09861010378999536985
09472433369893834066
11913864522260945229
12073657920470232565
15542687213291930501
13909884461790595627
06128961955920085438
04449782256732618470
12960342761950556145
02508356558166959398
09318702010703989872
07958266726433105629
05772313688979348665
10202714043885511706
15950531570017365149
11776359656991262303
10863619911705336431
tag:google.com,2005:reader/item/9dec0feebca1716e
What the JavaScript RegExp API Got Wrong, & How to Fix It
2010-03-01T09:56:42Z2010-03-01T09:56:42Z
<p>Over the last few years, I've occasionally commented on JavaScript's RegExp API, syntax, and behavior on the <a href="https://mail.mozilla.org/listinfo/es-discuss">ES-Discuss mailing list</a>. Recently, JavaScript inventor <a href="http://web.archive.org/web/20000815055653/people.netscape.com/brendan/" title="Everything about this page is awesome! :)">Brendan Eich</a> suggested that, in order to get more discussion going, I write up a list of regex changes to consider for future <abbr title="ECMAScript is the official name of the JavaScript language standard.">ECMAScript</abbr> standards (or as he humorously put it, have my "95 [regex] theses nailed to the <abbr title="ECMAScript 3rd Edition">ES3</abbr> cathedral door"). I figured I'd give it a shot, but I'm going to split my response into a few parts. In this post, I'll be discussing issues with the current RegExp API and behavior. I'll be leaving aside new features that I'd like to see added, and merely suggesting ways to make existing capabilities better. I'll discuss possible new features in a follow-up post.</p>
<p>For a language as widely used as JavaScript, any realistic change proposal must strongly consider backward compatibility. For this reason, some of the following proposals might <em>not</em> be particularly realistic, but nevertheless I think that <em>a</em>) it's worthwhile to consider what might change if backward compatibility wasn't a concern, and <em>b</em>) in the long run, all of these changes would improve the ease of use and predictability of how regular expressions work in JavaScript.</p>
<h3 style="margin-bottom:0">Remove RegExp.prototype.lastIndex and replace it with an argument for start position</h3>
<p style="margin-top:0"><em>Actual proposal: Deprecate RegExp.prototype.lastIndex and add a "pos" argument to the RegExp.prototype.exec/test methods</em></p>
<p>JavaScript's <code>lastIndex</code> property serves too many purposes at once:</p>
<dl>
<dt>It lets users manually specify where to start a regex search</dt>
<dd>You could claim this is not <code>lastIndex</code>'s intended purpose, but it's nevertheless an important use since there's no alternative feature that allows this. <code>lastIndex</code> is not very good at this task, though. You need to compile your regex with the <code>/g</code> flag to get <code>lastIndex</code> to be used this way; and even then, it only specifies the starting position for the <code>regexp.exec</code>/<code>test</code> methods. It cannot be used to set the start position for the <code>string.match</code>/<code>replace</code>/<code>search</code>/<code>split</code> methods.</dd>
<dt>It indicates the position where the last match ended</dt>
<dd>Even though you could derive the match end position by adding the match index and length, this use of <code>lastIndex</code> serves as a convenient and commonly used compliment to the <code>index</code> property on match arrays returned by <code>exec</code>. Like always, using <code>lastIndex</code> like this works only for regexes compiled with <code>/g</code>.</dd>
<dt>It's used to track the position where the next search should start</dt>
<dd>This comes into play, e.g., when using a regex to iterate over all matches in a string. However, the fact that <code>lastIndex</code> is actually set to the end position of the last match rather than the position where the next search should start (unlike equivalents in practically all programming languages) causes a problem after zero-length matches, which are easily possible with regexes like <code>/\w*/g</code> or <code>/^/mg</code>. Hence, you're forced to manually increment <code>lastIndex</code> in such cases. I've posted about this issue in more detail before (see: <em><a href="http://blog.stevenlevithan.com/archives/exec-bugs">An IE lastIndex Bug with Zero-Length Regex Matches</a></em>), as has Jan Goyvaerts (<em><a href="http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/">Watch Out for Zero-Length Matches</a></em>).</dd>
</dl>
<p>Unfortunately, <code>lastIndex</code>'s versatility results in it not working ideally for any specific use. I think <code>lastIndex</code> is misplaced anyway; if you need to store a search's ending (or next-start) position, it should be a property of the target string and not the regular expression. Here are three reasons this would work better:</p>
<ul>
<li>It would let you use the same regex with multiple strings, without losing track of the next search position within each one.</li>
<li>It would allow using multiple regexes with the same string and having each one pick up from where the last one left off.</li>
<li>If you search two strings with the same regex, you're probably not expecting the search within the second string to start from an arbitrary position just because a match was found in the first string.</li>
</ul>
<p>In fact, Perl uses this approach of storing next-search positions with strings to great effect, and adds various features around it.</p>
<p>So that's my case for <code>lastIndex</code> being misplaced, but I go one further in that I don't think <code>lastIndex</code> should be included in JavaScript at all. Perl's tactic works well for Perl (especially when considered as a complete package), but some other languages (including Python) let you provide a search-start position as an argument when calling regex methods, which I think is an approach that is more natural and easier for developers to understand and use. I'd therefore fix <code>lastIndex</code> by getting rid of it completely. Regex methods and regex-using string methods would use internal search position trackers that are not observable by the user, and the <code>exec</code> and <code>test</code> methods would get a second argument (called <code>pos</code>, for position) that specifies where to start their search. It might be convenient to also give the <code>String</code> methods <code>search</code>, <code>match</code>, <code>replace</code>, and <code>split</code> their own <code>pos</code> arguments, but that is not as important and the functionality it would provide is not currently possible via <code>lastIndex</code> anyway.</p>
<p>Following are examples of how some common uses of <code>lastIndex</code> could be rewritten if these changes were made:</p>
<p>Start search from position 5, using <code>lastIndex</code> (the staus quo):
<pre>var regexGlobal = /\w+/g,
result;
regexGlobal.lastIndex = 5;
result = regexGlobal.test(str);
<span>// must reset lastIndex or future tests will continue from the
match-end position (defensive coding)</span>
regexGlobal.lastIndex = 0;
var regexNonglobal = /\w+/;
regexNonglobal.lastIndex = 5;
<span>// no go - lastIndex will be ignored. instead, you have to do this</span>
result = regexNonglobal.test(str.slice(5));
</pre>
<p>Start search from position 5, using <code>pos</code>:</p>
<pre>var regex = /\w+/, <span>// flag /g doesn't matter</span>
result = regex.test(str, 5);
</pre>
<p>Iteration, using <code>lastIndex</code>:</p>
<pre>var regex = /\w*/g,
matches = [],
match;
<span>// the /g flag is required for this regex. if your code was provided a non-
// global regex, you'd need to recompile it with /g, and if it already had /g,
// you'd need to reset its lastIndex to 0 before entering the loop</span>
while (match = regex.exec(str)) {
matches.push(match);
<span>// avoid an infinite loop on zero-length matches</span>
if (regex.lastIndex == match.index) {
regex.lastIndex++;
}
}
</pre>
<p>Iteration, using <code>pos</code>:</p>
<pre>var regex = /\w*/, <span>// flag /g doesn't matter</span>
pos = 0,
matches = [],
match;
while (match = regex.exec(str, pos)) {
matches.push(match);
pos = match.index + (match[0].length || 1);
}
</pre>
<p>Of course, you could easily add your own sugar to further simplify match iteration, or JavaScript could add a method dedicated to this purpose similar to Ruby's <code>scan</code> (although JavaScript already sort of has this via the use of replacement functions with <code>String.prototype.replace</code>).</p>
<p>To reiterate, I'm describing what I would do if backward compatibility was irrelevant. I don't think it would be a good idea to add a <code>pos</code> argument to the <code>exec</code> and <code>test</code> methods unless the <code>lastIndex</code> property was deprecated or removed, due to the functionality overlap. If a <code>pos</code> argument existed, people would expect <code>pos</code> to be <code>0</code> when it's not specified. Having <code>lastIndex</code> around to sometimes screw up this expectation would be confusing and probably lead to latent bugs. Hence, if <code>lastIndex</code> was deprecated in favor of <code>pos</code>, it should be a means toward the end of removing <code>lastIndex</code> altogether.</p>
<h3 style="margin-bottom:0">Remove String.prototype.match's nonglobal operating mode</h3>
<p style="margin-top:0"><em>Actual proposal: Deprecate String.prototype.match and add a new matchAll method</em></p>
<p><code>String.prototype.match</code> currently works very differently depending on the whether the <code>/g</code> (<code>global</code>) flag has been set on the regex provided as the first argument:</p>
<ul>
<li>For regexes with <code>/g</code>: If no matches are found, <code>null</code> is returned; otherwise an array of simple matches is returned.</li>
<li>For regexes without <code>/g</code>: The <code>match</code> method operates as an alias of <code>regexp.exec</code>. If a match is not found, <code>null</code> is returned; otherwise you get an array containing the (single) match in key zero, with any backreferences stored in the array's subsequent keys. The array is also assigned special <code>index</code> and <code>input</code> properties.</li>
</ul>
<p>The <code>match</code> method's non-global mode is confusing and unnecessary. The reason it's unnecessary is obvious: If you want the functionality of <code>exec</code>, just use it (no need for an alias). It's confusing because, as described above, the <code>match</code> method's two modes return very different results. The difference is not merely whether you get one match or all matches—you get a completely different kind of result. And since the result is an array in either case, you have to know the status of the regex's <code>global</code> property to know which type of array you're dealing with.</p>
<p>I'd change <code>String.prototype.match</code> by making it always return an array containing all matches in the target string. I'd also make it return an empty array, rather than <code>null</code>, when no matches are found (an idea that comes from Dean Edwards's <a href="http://code.google.com/p/base2/">base2</a> library). If you want the first match only or you need backreferences and extra match details, that's what <code>regexp.exec</code> is for.</p>
<p>Unfortunately, if you want to consider this change as a realistic proposal, it would require some kind of language version or mode based switching of the <code>match</code> method's behavior (unlikely to happen, I would think). So, instead of that, I'd recommend deprecating the <code>match</code> method altogether in favor of a new method (perhaps <code>RegExp.prototype.matchAll</code>) with the changes prescribed above.</p>
<h3 style="margin-bottom:0">Get rid of /g and RegExp.prototype.global</h3>
<p style="margin-top:0"><em>Actual proposal: Deprecate /g and RegExp.prototype.global, and add a boolean replaceAll argument to String.prototype.replace</em></p>
<p>If the last two proposals were implemented and therefore <code>regexp.lastIndex</code> and <code>string.match</code> were things of the past (or <code>string.match</code> no longer sometimes served as an alias of <code>regexp.exec</code>), the only method where <code>/g</code> would still have any impact is <code>string.replace</code>. Additionally, although <code>/g</code> follows prior art from Perl, etc., it doesn't really make sense to have something that is not an attribute of a regex stored as a regex flag. Really, <code>/g</code> is more of a statement about how you want methods to apply their own functionality, and it's not uncommon to want to use the same pattern with and without <code>/g</code> (currently you'd have to construct two different regexes to do so). If it was up to me, I'd get rid of the <code>/g</code> flag and its corresponding <code>global</code> property, and instead simply give the <code>string.replace</code> method an additional argument that specifies whether you want to replace the first match only (the default handling) or all matches. This would have the additional benefit of allowing replace-all functionality with nonregex searches.</p>
<p>Note that SpiderMonkey already has a proprietary third argument ("flags") for <code>string.replace</code> that this proposal would conflict with. I doubt this conflict would cause much heartburn, but in any case, a new <code>replaceAll</code> argument would provide the same functionality that SpiderMonkey's flags argument is most useful for (that is, allowing global replacements with nonregex searches).</p>
<h3 style="margin-bottom:0">Change the behavior of backreferences to nonparticipating groups</h3>
<p style="margin-top:0"><em>Actual proposal: Make backreferences to nonparticipating groups fail to match</em></p>
<p>I'll keep this brief since David "liorean" Andersson and I have previously argued for this on ES-Discuss and elsewhere. David posted about this in detail on his blog (see: <em><a href="http://web-graphics.com/2007/11/26/ecmascript-3-regular-expressions-a-specification-that-doesnt-make-sense/">ECMAScript 3 Regular Expressions: A specification that doesn't make sense</a></em>), and I've previously touched on it here (<em><a href="http://blog.stevenlevithan.com/archives/es3-regexes-broken">ECMAScript 3 Regular Expressions are Defective by Design</a></em>). On several occasions, Brenden Eich has also stated that he'd like to see this changed. The short explanation of this behavior is that, in JavaScript, backreferences to capturing groups that have not (yet) participated in a match always succeed (i.e., they match the empty string), whereas the opposite is true in all other regex flavors: they fail to match and therefore cause the regex engine to backtrack or fail. JavaScript's behavior means that <code>/(a|(b))\2c/.test("ac")</code> returns <code>true</code>. The negative implications of this behavior reach quite far when pushing the boundaries of JavaScript regular expressions.</p>
<p>I think everyone agrees that changing to the traditional backreferencing behavior would be an improvement—it provides far more intuitive handling, compatibility with other regex flavors, and great potential for creative use. The bigger question is whether it would be safe, in light of backward compatibility. I think it would be, since I imagine that more or less no one uses the nonintuitive JavaScript behavior intentionally. The JavaScript behavior amounts to automatically adding a <code>?</code> quantifier after backreferences to nonparticipating groups, which is what people already do explicitly if they actually want backreferences to nonzero-length subpatterns to be optional. Also note that Safari 3 and earlier did not follow the spec on this point and used the more intuitive behavior, although that has <a href="http://bugs.webkit.org/show_bug.cgi?id=14931">changed</a> in more recent versions (notably, this change was due to a <a href="http://blog.stevenlevithan.com/archives/npcg-javascript">write up</a> on my blog rather than reports of real-world errors).</p>
<p>Finally, it's probably worth noting that .NET's ECMAScript regex mode (enabled via the <code>RegexOptions.ECMAScript</code> flag) indeed switches .NET to ECMAScript's unconventional backreferencing behavior.</p>
<h3 style="margin-bottom:0">Make \d \D \w \W \b \B support Unicode (like \s \S . ^ $, which already do)</h3>
<p style="margin-top:0"><em>Actual proposal: Add a /u flag (and corresponding RegExp.prototype.unicode property) that changes the meaning of \d, \w, \b, and related tokens</em></p>
<p>Unicode-aware digit and word character matching is not an existing JavaScript capability (short of constructing character class monstrosities that are hundreds or thousands of characters long), and since JavaScript lacks lookbehind you can't reproduce a Unicode-aware word boundary. You could therefore say this proposal is outside the scope of this post, but I'm including it here because I consider this more of a fix than a new feature.</p>
<p>According to current JavaScript standards, <code>\s</code>, <code>\S</code>, <code>.</code>, <code>^</code>, and <code>$</code> use Unicode-based interpretations of <em>whitespace</em> and <em>newline</em>, whereas <code>\d</code>, <code>\D</code>, <code>\w</code>, <code>\W</code>, <code>\b</code>, and <code>\B</code> use ASCII-only interpretations of <em>digit</em>, <em>word character</em>, and <em>word boundary</em> (e.g., <code>/na\b/.test("naïve")</code> unfortunately returns <code>true</code>). See my post on <em><a href="http://blog.stevenlevithan.com/archives/javascript-regex-and-unicode">JavaScript, Regex, and Unicode</a></em> for further details. Adding Unicode support to these tokens would cause unexpected behavior for thousands of websites, but it could be implemented safely via a new <code>/u</code> flag (inspired by Python's <code>re.U</code> or <code>re.UNICODE</code> flag) and a corresponding <code>RegExp.prototype.unicode</code> property. Since it's actually fairly common to <em>not</em> want these tokens to be Unicode enabled in particular regex patterns, a new flag that activates Unicode support would offer the best of both worlds.</p>
<h3 style="margin-bottom:0">Change the behavior of backreference resetting during subpattern repetition</h3>
<p style="margin-top:0"><em>Actual proposal: Never reset backreference values during a match</em></p>
<p>Like the last backreferencing issue, this too was covered by David Andersson in his post <em><a href="http://web-graphics.com/2007/11/26/ecmascript-3-regular-expressions-a-specification-that-doesnt-make-sense/">ECMAScript 3 Regular Expressions: A specification that doesn't make sense</a></em>. The issue here involves the value remembered by capturing groups nested within a quantified, outer group (e.g., <code>/((a)|(b))*/</code>). According to traditional behavior, the value remembered by a capturing group within a quantified grouping is whatever the group matched the last time it participated in the match. So, the value of <code>$1</code> after <code>/(?:(a)|(b))*/</code> is used to match <code>"ab"</code> would be <code>"a"</code>. However, according to ESS3/ES5, the value of backreferences to nested groupings is reset/erased after the outer grouping is repeated. Hence, <code>/(?:(a)|(b))*/</code> would still match <code>"ab"</code>, but after the match is completed <code>$1</code> would reference
a nonparticipating capturing group, which in JavaScript would match an empty string within the regex itself, and be returned as <code>undefined</code> in, e.g., the array returned by the <code>regexp.exec</code>.</p>
<p>My case for change is that current JavaScript behavior breaks from the norm in other regex flavors, does not lend itself to various types of creative patterns (see one example in my post on <em><a href="http://blog.stevenlevithan.com/archives/multi-attr-capture">Capturing Multiple, Optional HTML Attribute Values</a></em>), and in my opinion is far less intuitive than the more common, alternative regex behavior.</p>
<p>I believe this behavior is safe to change for two reasons. First, IE does not implement this rule and follows the more traditional behavior on this point. And second, this is generally an edge case issue to all but hardcore regex wizards, and I'd be surprised to find regexes that rely on this bit of behavior as currently mandated by JavaScript.</p>
<h3 style="margin-bottom:0">Add an /s flag, already</h3>
<p style="margin-top:0"><em>Actual proposal: Add an /s flag (and corresponding RegExp.prototype.dotall property) that changes dot to match all characters including newlines</em></p>
<p>I'll sneak this one in as a change/fix rather than a new feature since it's not exactly difficult to use <code>[\s\S]</code> in place of a dot when you want the behavior of <code>/s</code>. I presume the <code>/s</code> flag has been excluded thus far to save novices from themselves and limit the damage of runaway backtracking, but what ends up happening is that people write horrifically inefficient patterns like <code>(.|\r|\n)*</code> instead.</p>
<p>Regex searches in JavaScript are seldom line-based, and it's therefore more common to want dot to include newlines than to match anything-but-newlines (although both modes are useful). It makes good sense to keep the default meaning of dot (no newlines) since it is shared by other regex flavors and required for backward compatibility, but adding support for the <code>/s</code> flag is overdue. A boolean indicating whether this flag was set should show up on regexes as a property named either <code>singleline</code> (the <a href="http://blog.stevenlevithan.com/archives/singleline-multiline-confusing">unfortunate name</a> from Perl, .NET, etc.) or the more descriptive <code>dotall</code> (used in Java, Python, PCRE, etc.).</p>
<h3>Personal preferences</h3>
<p>Following are a few changes that would suit my preferences, although I don't think most people would consider them significant issues:</p>
<ul>
<li>Allow regex literals to use unescaped forward slashes within character clases (e.g., <code>/[/]/</code>). This was already included in the abandoned <a href="http://wiki.ecmascript.org/doku.php?id=proposals:extend_regexps#regexp_scanning">ES4 change proposals</a>.</li>
<li>Allow an unescaped <code>]</code> as the first character in character classes (e.g., <code>[]]</code> or <code>[^]]</code>). This is allowed in probably every other regex flavor, but creates an empty class followed by a literal <code>]</code> in JavaScript. I'd like to imagine that no one uses empty classes intentionally, since they don't work consistently cross-browser and there are widely-used/common-sense alternatives (<code>(?!)</code> instead of <code>[]</code>, and <code>[\s\S]</code> instead of <code>[^]</code>). Unfortunately, adherence to this JavaScript quirk is tested in <a href="http://acid3.acidtests.org/">Acid3</a> (test 89), which is likely enough to kill requests for this backward-incompatible but reasonable change.</li>
<li>Change the <code>$&</code> token used in replacement strings to <code>$0</code>. It just makes sense. (Equivalents in other replacement text flavors for comparison: Perl: <code>$&</code>; Java: <code>$0</code>; .NET: <code>$0</code>, <code>$&</code>; PHP: <code>$0</code>, <code>\0</code>; Ruby: <code>\0</code>, <code>\&</code>; Python: <code>\g<0></code>.)</li>
<li>Get rid of the special meaning of <code>[\b]</code>. Within character classes, the metasequence <code>\b</code> matches a backspace character (equivalent to <code>\x08</code>). This is a worthless convenience since no one cares about matching backspace characters, and it's confusing given that <code>\b</code> matches a word boundary when used outside of character classes. Even though this would break from regex tradition (which I'd usually advocate following), I think that <code>\b</code> should have no special meaning inside character classes and simply match a literal <code>b</code>.</li>
</ul>
<h3>Fixed in ES3: Remove octal character references</h3>
<p>ECMAScript 3 removed octal character references from regular expression syntax (although <code>\0</code> was kept as a convenient exception that allows easily matching a NUL character). However, browsers have generally kept full octal support around for backward compatibility. Octals are very confusing in regular expressions since their syntax overlaps with backreferences and an extra leading zero is allowed outside of character classes. Consider the following regexes:</p>
<ul>
<li><code>/a\1/</code>: <code>\1</code> is an octal.</li>
<li><code>/(a)\1/</code>: <code>\1</code> is a backreference.</li>
<li><code>/(a)[\1]/</code>: <code>\1</code> is an octal.</li>
<li><code>/(a)\1\2/</code>: <code>\1</code> is a backreference; <code>\2</code> is an octal.</li>
<li><code>/(a)\01\001[\01\001]/</code>: All occurences of <code>\01</code> and <code>\001</code> are octals. However, according to the ES3+ specs, the numbers after each <code>\0</code> <em>should</em> be treated (barring nonstandard extensions, which are allowed) as literal characters, completely changing what this regex matches.</li>
<li><code>/(a)\0001[\0001]/</code>: The <code>\0001</code> outside the character class is an octal; but inside, the octal ends at the third zero (i.e., the character class matches character index zero <em>or</em> <code>"1"</code>). This regex is therefore equivalent to <code>/(a)\x01[\x00\x31]/</code>; although, as mentioned just above, adherence to ES3 would change the meaning.</li>
<li><code>/(a)\00001[\00001]/</code>: Outside the character class, the octal ends at the fourth zero and is followed by a literal <code>"1"</code>. Inside, the octal ends at the third zero and is followed by a literal <code>"01"</code>. And once again, ES3's exclusion of octals and inclusion of <code>\0</code> could change the meaning.</li>
<li><code>/\1(a)/</code>: Given that, in JavaScript, backreferences to capturing groups that have not (yet) participated match the empty string, does this regex match <code>"a"</code> (i.e., <code>\1</code> is treated as a backreference since a corresponding capturing group appears in the regex) or does it match <code>"\x01a"</code> (i.e., the <code>\1</code> is treated as an octal since it appears <em>before</em> its corresponding group)? Unsurprisingly, browsers disagree.</li>
<li><code>/(\2(a)){2}/</code>: Now things get really hairy. Does this regex match <code>"aa"</code>, <code>"aaa"</code>, <code>"\x02aaa"</code>, <code>"2aaa"</code>, <code>"\x02a\x02a"</code>, or <code>"2a2a"</code>? All of these options seem plausible, and browsers disagree on the correct choice.</li>
</ul>
<p>There are other issues to worry about, too, like whether octal escapes go up to <code>\377</code> (<code>\xFF</code>, 8-bit) or <code>\777</code> (<code>\u01FF</code>, 9-bit); but in any case, octals in regular expressions are a confusing cluster-cuss. Even though ECMAScript has already cleaned up this mess by removing support for octals, browsers have not followed suit. I wish they would, because unlike browser makers, I don't have to worry about this bit of legacy (I never use octals in regular expressions, and neither should you).</p>
<h3>Fixed in ES5: Don't cache regex literals</h3>
<p>According to ES3 rules, regex literals did not create a new regex object if a literal with the same pattern/flag combination was already used in the same script or function (although this did not apply to regexes created by the <code>RegExp</code> constructor). A common side effect of this was that regex literals using the <code>/g</code> flag did not have their <code>lastIndex</code> property reset in some cases where most developers would expect it. Several browsers didn't follow the spec on this nonintuitive behavior, but Firefox did, and as a result it became the <a href="http://whereswalden.com/2010/01/15/more-es5-incompatible-changes-regular-expressions-now-evaluate-to-a-new-object-not-the-same-object-each-time-theyre-encountered/">second most duplicated</a> JavaScript <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=98409">bug report</a> for Mozilla. Fortunately, ES5 got rid of this rule, and now regex literals must be recompiled every time they're encountered (this change is coming in Firefox 3.7).</p>
<p>———<br>So there you have it. I've outlined what I think the JavaScript RegExp API got wrong. Do you agree with all of these proposals, or would you if you didn't have to worry about backward compatibility? Are there better ways to fix the issues I've pointed out than what I've proposed? Got any other gripes with existing JavaScript regex features? I'm eager to hear feedback about this.</p>
<p>Since I've been focusing on the negative in this post, I'll note that I find working with regular expressions in JavaScript to be a generally pleasant experience. There's a hell of a lot that JavaScript got right.</p><img src="http://feeds.feedburner.com/~r/badassery/~4/gJ3qENXQg3o" height="1" width="1"></p>
(author unknown)