<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>&#60;Angered Brackets /&#62; &#187; weekend project</title>
	<atom:link href="http://www.angeredbrackets.com/category/weekend-project/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.angeredbrackets.com</link>
	<description>Angle brackets get angry too! &#62;:-]</description>
	<lastBuildDate>Tue, 01 Dec 2009 00:40:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>DIY: $5 bicycle dashboard and GPS</title>
		<link>http://www.angeredbrackets.com/2009/12/diy-5-bicycle-dashboard-and-gps/</link>
		<comments>http://www.angeredbrackets.com/2009/12/diy-5-bicycle-dashboard-and-gps/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 00:33:49 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[weekend project]]></category>
		<category><![CDATA[bike]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[phone]]></category>

		<guid isPermaLink="false">http://www.angeredbrackets.com/?p=149</guid>
		<description><![CDATA[Riding my bicycle for over an hour a day as I make my way to work and back and around the city, I've often felt the need for a GPS. At other times, I would want a speedometer, so I'd have some idea at what speed I'm taking that slope. In this post, I'll show [...]]]></description>
			<content:encoded><![CDATA[<p>Riding my bicycle for over an hour a day as I make my way to work and back and around the city, I've often felt the need for a GPS. At other times, I would want a speedometer, so I'd have some idea at what speed I'm taking that slope.<br />
In this post, I'll show you how to safely attach your cell phone to your handlebar for less than $5.<br />
<img class="alignnone size-full wp-image-151" title="MGMaps on my phone, on my bike" src="http://www.angeredbrackets.com/wordpress/wp-content/uploads/2009/12/dsc06678.jpg" alt="MGMaps on my phone, on my bike" width="600" height="450" /><span id="more-149"></span></p>
<p>Ever since I got my Nokia 5800, it dawned on me that this device would be a great addition to my bike. Like many other smartphones, it has a built in GPS and a huge screen. If only there were some way of easily and safely attaching it to the bike...<br />
In my search for a solution to this need, I found this cheap <a href="http://www.dealextreme.com/details.dx/sku.15544~r.55113731">universal cell-phone mount</a> and went and ordered it. Unfortunately, this mount is really bulky and as a result shakes wildly with every bump in the road. I did not feel safe having my phone in it. In addition, its big thumb screw makes it an easy target for thieves. This was clearly not the solution for my needs. I envisioned the phone flush with the handlebar. This was far from it.</p>
<p>I ended up making my own phone-mount, and it was as easy and cheap as can be. I took a detachable flashlight mount (similar, though not identical to <a href="http://www.dealextreme.com/details.dx/sku.18889~r.55113731">this one</a>), and glued it onto a silicone case I bought for my phone.</p>
<p>Remove the clamp that's meant to hold the flashlight. I used a pair of scissors to cut off most of the unneeded plastic, and then sanded the rest down with a leatherman. If you buy <a href="http://www.dealextreme.com/details.dx/sku.18889~r.55113731">this one</a> ($2.98, free shipping), it looks like the clamp unscrews, and you can use it for some other project (attach it to your helmet, maybe?)</p>
<p><img class="alignleft" title="Glued together" src="http://www.angeredbrackets.com/wordpress/wp-content/uploads/2009/12/dsc06701-300x225.jpg" alt="glued together" width="300" height="225" />I lightly sanded down the area on my silicone case where I was planning to glue the mount, in order to make sure the surface was free from chemicals &amp; coatings, and to make it a little rougher, so the glue sticks better. Apply a thin, even layer of superglue, and firmly press the mount into place. Let it dry for about 20 minutes, and slide your phone into your new bike accessory.<br />
You can find good silicone cases for almost every imaginable phone <a href="http://www.dealextreme.com/products.dx/category.500~search.silicone%20case~r.55113731">here</a>; many for under $2.<br /><br /><br /><br /></p>
<p><img src="http://www.angeredbrackets.com/wordpress/wp-content/uploads/2009/12/dsc06681-300x225.jpg" alt="Nokia Sports tracker" title="Nokia Sports tracker" width="300" height="225" class="alignright size-medium wp-image-152" />So what does one do with a large-screen dashboard on one's bike? I've used <a href="http://www.mgmaps.com/">MGMaps</a> to get directions and navigate unfamiliar neighborhoods; <a href="http://sportstracker.nokia.com/">Nokia Sports Tracker</a> as a big-lettered speedometer and odometer (and as a bonus, it records your route so you can later analyze and share it); and <a href="http://www.waze.co.il">Waze</a> for voice turn-by-turn navigation. In addition, having your phone on your handlebar rather than your pocket allows you to see who's calling you. Video calls also work with the phone on the handlebar, pointing up at you.<br /><br /><br /></p>
<p>I've been stopped by fellow cyclists on several occasions and asked about the GPS on my bike. I hope that this guide will get some of you guys out there to try this for yourselves. Just the bewildered looks you'll get from drivers around you will be worth it.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/angeredBrackets?i=http://www.angeredbrackets.com/2009/12/diy-5-bicycle-dashboard-and-gps/" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.angeredbrackets.com/2009/12/diy-5-bicycle-dashboard-and-gps/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>XKCD Knockout Comic Downloader</title>
		<link>http://www.angeredbrackets.com/2009/06/xkcd-knockout-comic-downloader/</link>
		<comments>http://www.angeredbrackets.com/2009/06/xkcd-knockout-comic-downloader/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 10:00:57 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[Geek Culture]]></category>
		<category><![CDATA[weekend project]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[comics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[xkcd]]></category>

		<guid isPermaLink="false">http://www.angeredbrackets.com/?p=93</guid>
		<description><![CDATA[XKCD, for those of you who don&#8217;t know, is a webcomic about (as it testifies of itself) romance, sarcasm, math, and language. In my opinion, it&#8217;s the best webcomic out there. I wanted to download the complete comics archive, for the sake of a local backup, and as an idea for a printed, coffee-table style [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xkcd.com">XKCD</a>, for those of you who don&#8217;t know, is a webcomic about (as it testifies of itself) romance, sarcasm, math, and language. In my opinion, it&#8217;s the best webcomic out there. I wanted to download the complete comics archive, for the sake of a local backup, and as an idea for a printed, coffee-table style book. However, I didn&#8217;t want just the comic&#8217;s image file &#8211; the best part of XKCD is often the alt-text that shows up as a tooltip when you mouse-over the comic. And of course there&#8217;s the comic&#8217;s title, as well.</p>
<p>There are several scripts out there that others have written before me that download the comic, and some even do a pretty good job of getting some of the extra data. However, I wanted more. I wanted a downloader that would get ALL the data available about the comics, and store it in an easily-retrievable, transformative manner.<span id="more-93"></span></p>
<p>This led me to write my own downloader, which I have dubbed the XKCD Knockout Comic Downloader (or XKCD, for short). I have relied to some degree on those who have come before me, and have modified their code.<br />
Off the top of my head, I used some code by <a href="http://blog.johnlawrence.net/2008/10/yet-another-xkcd-download-script/">John Lawrence</a> to find the latest comic number; and this discussion on <a href="http://ubuntuforums.org/showthread.php?t=867649">Ubuntu forums</a> got me started with getting the meta-data.</p>
<p>My downloader the most complete I&#8217;ve seen so far. of it&#8217;s notable features:</p>
<ul>
<li>Store meta&#8211;data, including path to image, in XML file.</li>
<li>Choice of downloading the images or not.</li>
<li>Can append to an existing XML file, and update it since you last downloaded your personal batch of XKCD.</li>
<li>Will store all data about the comic, including seldom or never before used attributes, such as href, src, etc. (more on that later.)</li>
</ul>
<p>Sure, this script isn&#8217;t a nifty one-liner that does all the work, but instead, it does more work, and does it well:</p>
<p><code>#!/bin/sh<br/><br/>#-----user configurable-----<br/>append_to_file=true # continue from previous download<br/>download_path=~/xkcd/<br/>image_path=images<br/>xmlfile=xkcd.xml<br/>download_images=true<br/>#---------------------------<br/>#------configuration--------<br/>i=1<br/>latest=`wget -q -O - http://www.xkcd.com | grep 'link to this comic' | sed 's/.*xkcd.com.\([^\/]*\).*/\1/'` <br/>#---------------------------<br/><br/>if [ ! -d $download_path ]<br/>then<br/>&nbsp;&nbsp;&nbsp;&nbsp;mkdir $download_path<br/>fi<br/>cd $download_path<br/><br/>if $download_images &#038;& [ ! -d $image_path ]<br/>then<br/>&nbsp;&nbsp;&nbsp;&nbsp;mkdir $image_path<br/>fi<br/><br/>if $append_to_file &#038;& [ -f $xmlfile ]<br/>then<br/>&nbsp;&nbsp;&nbsp;&nbsp;sed -i '/\/xkcd/ d' $xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;i=$(tail -8 $xmlfile | grep '&lt;id>' | sed 's/^.*>\([0-9]\+\).*/\1/')<br/>&nbsp;&nbsp;&nbsp;&nbsp;i=`expr $i + 1`<br/>else<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "﻿&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "&lt;?xml-stylesheet type=\"text/xsl\" href=\"xkcd.xsl\"?>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "&lt;xkcd>">>$xmlfile<br/>fi<br/><br/>while [ $i -le $latest ]<br/>do<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&lt;comic>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id>$i&lt;/id>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;wget http://xkcd.com/$i/<br/>&nbsp;&nbsp;&nbsp;&nbsp;img=$(grep http://imgs.xkcd.com/comics/ index.html | head -1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;params=$(($(echo $img | tr -dc '"' | wc -c)/2))<br/>&nbsp;&nbsp;&nbsp;&nbsp;for ((j = 1; j &lt;= $params; j++))<br/>&nbsp;&nbsp;&nbsp;&nbsp;do<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;param=$(echo $img | cut -d\" -f$(($j*2-1)) | sed 's/>*&lt;*[a-z]*\ \([a-z]*\)\=/\1/')<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;val=$(echo $img | cut -d\" -f$(($j*2)))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;$param>$val&lt;/$param>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if [ $param = src ]<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;filename=$(echo $val | cut -d\/ -f5)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if $download_images<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wget $val<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mv $filename "$image_path"/"$i"_"$filename"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;filename>$i"_"$filename&lt;/filename>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fi<br/>&nbsp;&nbsp;&nbsp;&nbsp;done<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo "&nbsp;&nbsp;&nbsp;&nbsp;&lt;/comic>">>$xmlfile<br/>&nbsp;&nbsp;&nbsp;&nbsp;rm index.html<br/>&nbsp;&nbsp;&nbsp;&nbsp;i=`expr $i + 1`<br/>done<br/>echo "&lt;/xkcd>">>$xmlfile</code></p>
<p>Rather than explain all the regexs used, and the logic in the script, if you have any specific questions, please ask.<br />
What distinguishes this script from others (of the rare few that download the meta-data) is that I&#8217;m not assuming any attributes exist, but am downloading all of them. This is useful for the irregular comics such as <a href="http://xkcd.com/472">House of Pancakes</a> or <a href="http://xkcd.com/191">Lojban</a>. In fact, I just ran a search for href in the XML file I created today, and found a few nuggets I&#8217;ve missed in the past.</p>
<p>The fact the data is stored in an XML file means it&#8217;s transformative. write a script to tweet the alt-text (why you would do that is beyond me), or create a tag cloud of frequently used words. My intention is to create an XSTL file that will display all the comics in a pleasing manner and bring it to print. (Dealing with Randal&#8217;s irregular image sizes is something I&#8217;m still working on, and am open to suggestions).</p>
<p>Let me know if you use this script and what creative ideas you have in mind for your stash of XKCD.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/angeredBrackets?i=http://www.angeredbrackets.com/2009/06/xkcd-knockout-comic-downloader/" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.angeredbrackets.com/2009/06/xkcd-knockout-comic-downloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>‫החדרת תגי תמיכה בדו-כיווניות (BiDi) בשדות טקסט‬</title>
		<link>http://www.angeredbrackets.com/2009/06/%e2%80%ab%d7%94%d7%97%d7%93%d7%a8%d7%aa-%d7%aa%d7%92%d7%99-%d7%aa%d7%9e%d7%99%d7%9b%d7%94-%d7%91%d7%93%d7%95-%d7%9b%d7%99%d7%95%d7%95%d7%a0%d7%99%d7%95%d7%aa-bidi-%d7%91%d7%a9%d7%93%d7%95%d7%aa/</link>
		<comments>http://www.angeredbrackets.com/2009/06/%e2%80%ab%d7%94%d7%97%d7%93%d7%a8%d7%aa-%d7%aa%d7%92%d7%99-%d7%aa%d7%9e%d7%99%d7%9b%d7%94-%d7%91%d7%93%d7%95-%d7%9b%d7%99%d7%95%d7%95%d7%a0%d7%99%d7%95%d7%aa-bidi-%d7%91%d7%a9%d7%93%d7%95%d7%aa/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 14:38:25 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[weekend project]]></category>
		<category><![CDATA[BiDi]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[hebrew]]></category>

		<guid isPermaLink="false">http://www.angeredbrackets.com/?p=84</guid>
		<description><![CDATA[הקדמה: פוסט זה הוא תגובה לפוסט של לירון נוימן בנושא הנ&#8221;ל. לירון שואל &#8220;מכירים את זה שאתם כותבים בעברית באתר בינלאומי כלשהו שלא תומך בכיווניות טקסט (למשל פייסבוק), ואז, לא רק שסימני הפיסוק שלכם יוצאים בצד הלא נכון, אלא גם שאם עירבתם גם אנגלית בטקסט, כל הסדר שלו מתחרבש?&#8221; הוא מסיים את הפוסט שלו ושואל [...]]]></description>
			<content:encoded><![CDATA[<div style="direction:rtl; text-align:right;">
<p>הקדמה: פוסט זה הוא תגובה ל<a href="http://eesh.net/blog/?p=234">פוסט של לירון נוימן</a> בנושא הנ&#8221;ל. לירון שואל &#8220;מכירים את זה שאתם כותבים בעברית באתר בינלאומי כלשהו שלא תומך בכיווניות טקסט (למשל פייסבוק), ואז, לא רק שסימני הפיסוק שלכם יוצאים בצד הלא נכון, אלא גם שאם עירבתם גם אנגלית בטקסט, כל הסדר שלו מתחרבש?&#8221; הוא מסיים את הפוסט שלו ושואל &#8220;מי מתנדב להרים את הכפפה ולבנות איזה תוסף לשועל שיאפשר להוסיף את התווים האלה איפה שצריך&#8230;?&#8221;<br />
ובכן, התשובה שלי היא &#8216;טוב, נו, אני אעשה את זה&#8230;&#8217;</p>
<p>הקדמה 2: פוסט זה הוא תרגום לעברית של ה<a href="http://www.angeredbrackets.com/2009/06/inserting-bidi-support-tags-in-online-textareas/">פוסט הקודם שלי</a>, למקרה ואתם רוצים לקרוא את זה באנגלית או לחלוק עם אנשים בניכר.</p>
<p>הנה דוגמא לבעיה המתוארת:</p>
<input style="direction: ltr; width: 200px;" type="text" value="יש בעיה עם הכיוון של ה-text הזה" />
<p>ובכן, הפתרון (הנכון) לבעיה הזו היא כזו: יש לעטוף את הטקסט שאנחנו רוצים לשנות את הכיווניות שלו בתווי היוניקוד המציינים הטמעת כיווניות <a href="http://www.fileformat.info/info/unicode/char/202b/index.htm">ימין לשמאל</a> (או לחילופין <a href="http://www.fileformat.info/info/unicode/char/202a/index.htm">שמאל לימין</a>) בתחילת המחרוזת, ותו היוניקוד שמציין את <a href="http://www.fileformat.info/info/unicode/char/202c/index.htm">סוף הכיווניות</a> בסופה.<br />
למידע נוסף, ראו <a href="http://www.w3.org/International/questions/qa-bidi-controls.en.php">כאן</a>.</p>
<p>בשעתו, כשלירון כתב את הפוסט שלו, חשבתי לעצמי שזה עשוי להיות פרוייקט קטן וחביב &#8211; לכתוב תוסף לשועל, או סקריפט לקוף הגריז שמאפשר לך לעטוף טקסט שאתה כותב בתווים האלה, לטובת אלה שיבואו אחריך ויקראו את הטקסט שלך. אך מאז התוודעתי לבוקמרקלטים (סימניונות? יש לזה שם בעברית?), ולמדתי להעריך אותם עד מאד. אני חושב שסימניונת היא הדרך הטובה ביותר לפתור את הבעיה הזו, מאחר והן קטנות, קלות להתקנה ועריכה, ו(לפחות בתיאוריה) נתמכות על ידי כל הדפדפנים.<br />
<span id="more-84"></span></p>
<p>כשניגשתי לפתור את העניין, ידעתי שאני צריך להחדיר מחרוזת של תווים לפני ואחרי הטקסט המסומן בשדה-טקסט. ידעתי שראיתי את זה נעשה איפהשהו&#8230; אה, כן! ממש כאן, במערכת של WordPress, כשרוצים לסמן טקסט כמודגש או נטוי.<br />
אז הלכתי למצוא את קוד הג&#8217;אווהסקריפט שעומד מאחורי היכולת הזו (זו פונקציה בשם edInsertTag), והוצאתי את החלקים שרלוונטיים לצורך שלי ולפיירפוקס (הרבה מהפונקציה המקורית נועדה לתאימות דפדפנים).</p>
<p>ללא דיחוי נוסף, אני גאה להציג בפניכם את <a href="javascript:function B(){var s=document.activeElement.selectionStart;var e=document.activeElement.selectionEnd;var v=document.activeElement.value;document.activeElement.value=v.substring(0,s)+'\u202B'+v.substring(s,e)+'\u202C'+v.substring(e,v.length);document.activeElement.selectionStart=s;document.activeElement.selectionEnd=e+2};B();">RTL</a> ואת <a href="javascript:function B(){var s=document.activeElement.selectionStart;var e=document.activeElement.selectionEnd;var v=document.activeElement.value;document.activeElement.value=v.substring(0,s)+'\u202A'+v.substring(s,e)+'\u202C'+v.substring(e,v.length);document.activeElement.selectionStart=s;document.activeElement.selectionEnd=e+2};B();">LTR</a>.</p>
<p>פשוט קחו את הקישורים האלה, וגררו אותם לסרגל כלים של הסימניות שלכם (אני יצרתי לעצמי תיקיה של סימניונות שימושיות), ובפעם הבאה שאתם כותבים טקסט דו-כיווני, סמנו את הקטע שזורם בכיוון הלא-נכון ולחצו על הסימניונת הרלוונטית.<br />
תוכלו לנסות זאת כאן:<br />
<textarea style="direction: ltr; width: 300px;">לחץ על RTL על מנת לתקן</textarea><br />
<textarea style="direction: rtl; width: 300px;">use the LTR כדי לתקן this text</textarea></p>
<p>אשמח לקבל משוב על הסימניונות האלה. הן נוסו אך ורק בפיירפוקס, ולדעתי לא יעבדו בדפדפנים אחרים, מאחר ומהפונקציה שלקחתי מ-WP השארתי רק את החלקים שרלוונטיים לשועל. אם הם עובדים גם בדפדפנים אחרים, או לא עובדים כראוי בשועל, אנא יידעו אותי.</p></div>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/angeredBrackets?i=http://www.angeredbrackets.com/2009/06/%e2%80%ab%d7%94%d7%97%d7%93%d7%a8%d7%aa-%d7%aa%d7%92%d7%99-%d7%aa%d7%9e%d7%99%d7%9b%d7%94-%d7%91%d7%93%d7%95-%d7%9b%d7%99%d7%95%d7%95%d7%a0%d7%99%d7%95%d7%aa-bidi-%d7%91%d7%a9%d7%93%d7%95%d7%aa/" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.angeredbrackets.com/2009/06/%e2%80%ab%d7%94%d7%97%d7%93%d7%a8%d7%aa-%d7%aa%d7%92%d7%99-%d7%aa%d7%9e%d7%99%d7%9b%d7%94-%d7%91%d7%93%d7%95-%d7%9b%d7%99%d7%95%d7%95%d7%a0%d7%99%d7%95%d7%aa-bidi-%d7%91%d7%a9%d7%93%d7%95%d7%aa/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Inserting BiDi support tags in online Textareas</title>
		<link>http://www.angeredbrackets.com/2009/06/inserting-bidi-support-tags-in-online-textareas/</link>
		<comments>http://www.angeredbrackets.com/2009/06/inserting-bidi-support-tags-in-online-textareas/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 12:34:44 +0000</pubDate>
		<dc:creator>Ethan</dc:creator>
				<category><![CDATA[weekend project]]></category>
		<category><![CDATA[BiDi]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.angeredbrackets.com/?p=71</guid>
		<description><![CDATA[In order to properly write bidirectional text that flows against the direction of the textarea in which you're typing, you should wrap your text in the unicode characters for the correct embedded directionality.
I wrote a bookmarklet that makes doing so a piece of cake.]]></description>
			<content:encoded><![CDATA[<p>This post will only be relevant to readers of right-to-left languages, and to developers who develop for such languages. As such, my next post will be a translation of this one into Hebrew.<br />
A bit over a year ago, a friend of mine <a href="http://eesh.net/blog/?p=234">wrote about embedded unicode right-to-left and left-to-right characters in a flow of text</a>. In a nutshell, when writing text that contains both LTR characters (like English) and RTL characters (like Hebrew), the flow of the text can wind up messed up. Here&#8217;s an example:</p>
<input style="direction: rtl; width: 200px;" type="text" value="The flow of this טקסט is broken" />
<p>The (proper) solution to this conundrum is this: wrap your text, which you want flowing in the opposite direction from it&#8217;s encapsulating element, in the unicode characters for <a href="http://www.fileformat.info/info/unicode/char/202a/index.htm">left-to-right embedding</a> (or <a href="http://www.fileformat.info/info/unicode/char/202b/index.htm">right-to-left embedding</a>), and the <a href="http://www.fileformat.info/info/unicode/char/202c/index.htm">Pop Directional Formatting</a> character. For further reading, go <a href="http://www.w3.org/International/questions/qa-bidi-controls.en.php">here</a>.</p>
<p>Back when Liron wrote that post of his, I thought it would be a nice little project to tackle &#8211; write a Firefox plugin or Greasemonkey user-script that allows you to encapsulate your text in these characters, for the sake of all those who will follow and read it. I have since then become familiar &#8211; and very fond of &#8211; bookmarklets. I think a bookmarklet is the best way to distribute the solution to this problem, because it&#8217;s lightweight, easy to install and modify, and (at least in theory) cross browser.<span id="more-71"></span></p>
<p>Coming to tackle this issue, I knew I needed to insert a string of characters in front of and after the selected text in a textarea. Where have I seen this done before?&#8230; Oh, right, right here in WordPress, when I want to make text I&#8217;m writing bold or italicized.<br />
So I went about finding the Javascript behind that functionality (it&#8217;s the function edInsertTag), and I pulled out of it the bits that are relevant to this situation, and to Firefox.</p>
<p>With no further ado, I present to you <a href="javascript:function B(){var s=document.activeElement.selectionStart;var e=document.activeElement.selectionEnd;var v=document.activeElement.value;document.activeElement.value=v.substring(0,s)+'\u202B'+v.substring(s,e)+'\u202C'+v.substring(e,v.length);document.activeElement.selectionStart=s;document.activeElement.selectionEnd=e+2};B();">RTL</a> and <a href="javascript:function B(){var s=document.activeElement.selectionStart;var e=document.activeElement.selectionEnd;var v=document.activeElement.value;document.activeElement.value=v.substring(0,s)+'\u202A'+v.substring(s,e)+'\u202C'+v.substring(e,v.length);document.activeElement.selectionStart=s;document.activeElement.selectionEnd=e+2};B();">LTR</a>.</p>
<p>Simply drag those two links to your bookmark toolbar (I actually have a bookmark folder just for bookmarklets), and next time you&#8217;re writing bidirectional text, select the wrongly-flowing part, and align it properly.<br />
You can try them out here:<br />
<textarea style="direction: ltr; rows:1; width: 300px;">לחץ על RTL על מנת לתקן</textarea><br />
<textarea style="direction: rtl; rows:1; width: 300px;">use the LTR כדי לתקן this text</textarea></p>
<p>I&#8217;d be happy to get feedback on these bookmarklets. They&#8217;ve only been tested in Firefox, and I think they will not work in other browsers, seeing how I only used one of the three cross-browser-compatibility parts of the wordpress JS I cannibalized. If they do work in other browsers, or do not work as expected in Firefox, please let me know.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/angeredBrackets?i=http://www.angeredbrackets.com/2009/06/inserting-bidi-support-tags-in-online-textareas/" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.angeredbrackets.com/2009/06/inserting-bidi-support-tags-in-online-textareas/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
