<?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>گنجه &#187; رایانه</title>
	<atom:link href="http://blog.ebrahim.ir/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ebrahim.ir</link>
	<description># tail -f /var/log/experience</description>
	<lastBuildDate>Wed, 25 Aug 2010 22:16:39 +0000</lastBuildDate>
	<language>fa</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>دست‌کاری بستهٔ deb</title>
		<link>http://blog.ebrahim.ir/1388/07/manipulating-deb-package/</link>
		<comments>http://blog.ebrahim.ir/1388/07/manipulating-deb-package/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 01:26:47 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[deb]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=301</guid>
		<description><![CDATA[شاید براتون پیش اومده باشه که بخواهید یک بستهٔ deb رو نصب کنید، ولی یکی از وابستگی‌0هاش مانع شده باشه. مثلاً چند وقت پیش می‌خواستم بستهٔ gparted رو نصب کنم، ولی gksu جزو وابستگی‌هاش بود. (الان در Debian sid درستش کرده‌اند و دیگه جزو وابستگی‌هاش نیست، بلکه جزو توصیه1‌هاشه.) پس چون می‌خواست به خاطر gksu [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>شاید براتون پیش اومده باشه که بخواهید یک بستهٔ deb رو نصب کنید، ولی یکی از وابستگی‌<sup><a href="http://blog.ebrahim.ir/1388/07/manipulating-deb-package/#footnote_0_301" id="identifier_0_301" class="footnote-link footnote-identifier-link" title="Dependency">0</a></sup>هاش مانع شده باشه. مثلاً چند وقت پیش می‌خواستم بستهٔ gparted رو نصب کنم، ولی gksu جزو وابستگی‌هاش بود. (الان در Debian sid درستش کرده‌اند و دیگه جزو وابستگی‌هاش نیست، بلکه جزو توصیه<sup><a href="http://blog.ebrahim.ir/1388/07/manipulating-deb-package/#footnote_1_301" id="identifier_1_301" class="footnote-link footnote-identifier-link" title="Recommend">1</a></sup>‌هاشه.) پس چون می‌خواست به خاطر gksu بخشی از GNOME رو نصب کنه، و از طرفی من هم به GNOME حساسیت دارم(!)، نمی‌تونستم با این اوضاع gparted رو نصب کنم. ولی یک نکتهٔ مهم این بود که من می‌دونستم که واقعا gksu رو نیاز ندارم و می‌تونم بدون اون هم از gparted استفاده کنم. در این شرایط راهی که به ذهن آدم می‌رسه اینه که بستهٔ deb مربوط به gparted رو دست‌کاری و gksu رو از فهرست وابستگی‌هاش حذف کنه.</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">$ apt-get install gparted -y --print-uris | grep '/gparted_'
$ wget http://ftp.debian.org/debian/pool/main/g/gparted/gparted_0.3.7-1_amd64.deb
$ mkdir gparted_0.3.7-1.mod_amd64
$ cd gparted_0.3.7-1.mod_amd64
$ dpkg-deb -x ../gparted_0.3.7-1_amd64.deb .
$ dpkg-deb -e ../gparted_0.3.7-1_amd64.deb
$ vim DEBIAN/control</pre></div></div>

<p>(برای پایین‌گذاری<sup><a href="http://blog.ebrahim.ir/1388/07/manipulating-deb-package/#footnote_2_301" id="identifier_2_301" class="footnote-link footnote-identifier-link" title="Download">2</a></sup> پروندهٔ deb می‌شه از debget موجود در بستهٔ debian-goodies هم استفاده کرد)</p>
<p>با ویرایش پروندهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/manipulating-deb-package/#footnote_3_301" id="identifier_3_301" class="footnote-link footnote-identifier-link" title="File">3</a></sup> control بسته، gksu رو از خطی که با Depends شروع می‌شه حذف می‌کنم. شمارهٔ نسخه رو هم توی خطی که با Version شروع می‌شه تغییر می‌دم.</p>
<p>حالا نوبت بازسازی پروندهٔ deb و نصبش هست:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">$ cd ..
$ fakeroot dpkg-deb -b gparted_0.3.7-1.mod_amd64
dpkg-deb: building package `gparted' in `gparted_0.3.7-1.mod_amd64.deb'.
$ sudo dpkg -i gparted_0.3.7-1.mod_amd64.deb</pre></div></div>

<p>به بقیهٔ پرونده‌های داخل پوشهٔ DEBIAN (و حتی بقیهٔ پوشه‌ها) هم نگاهی بندازید! <img src='http://blog.ebrahim.ir/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<ol start="0" class="footnotes"><li id="footnote_0_301" class="footnote">Dependency</li><li id="footnote_1_301" class="footnote">Recommend</li><li id="footnote_2_301" class="footnote">Download</li><li id="footnote_3_301" class="footnote">File</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/07/manipulating-deb-package/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>روشی برای تسریع dpkg</title>
		<link>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/</link>
		<comments>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 00:56:15 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[Ext4]]></category>
		<category><![CDATA[ReiserFS]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Tokyo Cabinet]]></category>
		<category><![CDATA[بهینه‌سازی]]></category>
		<category><![CDATA[سامانهٔ عامل]]></category>
		<category><![CDATA[سامانهٔ پرونده]]></category>
		<category><![CDATA[لوح سخت]]></category>
		<category><![CDATA[لینوکس]]></category>
		<category><![CDATA[محک‌زنی]]></category>
		<category><![CDATA[کارآیی]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=292</guid>
		<description><![CDATA[همون طور که احتمالاً می‌دونید dpkg توساخت0 مدیریت بسته‌ها1 در Debian است. یعنی APT و Synaptic و Aptitude و &#8230; همه روی dpkg بنا شده اند. dpkg برای نگه‌داری بعضی اطلاعات بسته‌های نصب‌شده، از تعداد زیادی (برای من حدود ۹۰۰۰ تا) پروندهٔ2 کوچک توی مسیر ‎/var/lib/dpkg/info استفاده می‌کنه. هر بار که بسته‌ای رو نصب یا [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>همون طور که احتمالاً می‌دونید dpkg توساخت<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_0_292" id="identifier_0_292" class="footnote-link footnote-identifier-link" title="Back-end">0</a></sup> مدیریت بسته‌ها<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_1_292" id="identifier_1_292" class="footnote-link footnote-identifier-link" title="Package management">1</a></sup> در Debian است. یعنی APT و Synaptic و Aptitude و &#8230; همه روی dpkg بنا شده اند.</p>
<p>dpkg برای نگه‌داری بعضی اطلاعات بسته‌های نصب‌شده، از تعداد زیادی (برای من حدود ۹۰۰۰ تا) پروندهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_2_292" id="identifier_2_292" class="footnote-link footnote-identifier-link" title="File">2</a></sup> کوچک توی مسیر ‎/var/lib/dpkg/info استفاده می‌کنه. هر بار که بسته‌ای رو نصب یا حذف می‌کنید dpkg همهٔ اون پرونده‌ها رو از روی لوح<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_3_292" id="identifier_3_292" class="footnote-link footnote-identifier-link" title="Disk">3</a></sup> می‌خونه. این کار روی سامانهٔ پروندهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_4_292" id="identifier_4_292" class="footnote-link footnote-identifier-link" title="File system">4</a></sup> مورد استفادهٔ من، که Ext4 هست، اولین بار بیست-سی ثانیه‌ای طول می‌کشه، که برای من مدت زیادی هست. این کار در دفعات بعدی به علت قرار گرفتن همهٔ اون پرونده‌ها در نهان‌گاه<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_5_292" id="identifier_5_292" class="footnote-link footnote-identifier-link" title="Cache">5</a></sup> سامانهٔ پرونده در حافظهٔ اصلی، بسیار سریع‌تر انجام می‌شه، تا وقتی که دوباره از نهان‌گاه خارج بشند.</p>
<p>این مشکل هر از گاهی یک سیخی بهم می‌زد و روی اعصابم راه می‌رفت. فکرهای مختلفی برای حلش به ذهنم رسید. از بسیار پیچیده، مثل طراحی و پیاده‌سازی مجدد dpkg روی Tokyo Cabinet یا SQLite، تا بسیار ساده:</p>
<p>شاید بدونید که سامانهٔ پروندهٔ ReiserFS در کار با پرونده‌های کوچک بسیار عالی عمل می‌کنه. علتش هم استفاده از فن «ته‌چِپانی»<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_6_292" id="identifier_6_292" class="footnote-link footnote-identifier-link" title="Tail packing">6</a></sup> است.<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_7_292" id="identifier_7_292" class="footnote-link footnote-identifier-link" title="http://en.wikipedia.org/wiki/ReiserFS#Performance">7</a></sup> فکر کردم شاید اگر پوشهٔ  ‎/var/lib/dpkg/info رو توی ReiserFS نگه دارم، مشکل حل بشه. این کار رو کردم، ولی به خاطر کارکرد<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_8_292" id="identifier_8_292" class="footnote-link footnote-identifier-link" title="Mechanism">8</a></sup> داخلی dpkg روی کل ‎/var/lib/dpkg:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;">$ sudo su -
# cd /var/lib
# tar cpzf dpkg.tar.gz dpkg
# dd if=/dev/zero of=dpkg.reiserfs bs=$((256*1024*1024)) count=1
# mkreiserfs -f dpkg.reiserfs
# mount -oloop dpkg.reiserfs dpkg
# tar xpf dpkg.tar.gz</pre></div></div>

<p>و بعد آزمودن و دائمی کردن با افزودن به fstab‏:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;"># echo 3 &gt;/proc/sys/vm/drop_caches
# apt-get install hello
# apt-get purge hello
# echo /var/lib/dpkg.reiserfs /var/lib/dpkg reiserfs loop,noatime 0 1 &gt;&gt;/etc/fstab</pre></div></div>

<p>فکره جواب داد و سرعت dpkg بسیار به‌تر شد. حالا حتی اولین بار هم dpkg اون کار رو در دو-سه ثانیه انجام می‌ده.</p>
<p>علاوه بر مهارت ReiserFS در کار با پرونده‌های کوچک، چند نکتهٔ دیگه هم قابل ذکر هست. یکی این که Ext4 به علت فن «حوزه»<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_9_292" id="identifier_9_292" class="footnote-link footnote-identifier-link" title="Extent">9</a></sup> در کار با پرونده‌های نسبتاً بزرگی که یک‌جا تخصیص<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_10_292" id="identifier_10_292" class="footnote-link footnote-identifier-link" title="Allocation">10</a></sup> می‌یابند بسیار سریع هست. برای همین به dd گفتم که کل پرونده رو یک‌جا بسازه.</p>
<p>از طرفی چون، در نتیجهٔ نکتهٔ قبل، کل پرونده‌های مربوط به dpkg روی لوح نزدیک به هم قرار می‌گیرند و پراکنده نیستند، با خونده شدن یک پرونده از اون حوالی، تعداد زیادی از بقیه‌شون هم توی نهان‌گاه لوح و تعدادی هم توی نهان‌گاه سامانهٔ پرونده قرار می‌گیرند. همین امر باعث می‌شه کلی زمان جویش<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_11_292" id="identifier_11_292" class="footnote-link footnote-identifier-link" title="Seek">11</a></sup> که قبلاً برای رسیدن به پرنده‌های پراکنده در اطراف و اکناف لوح هدر می‌رفت، صرفه‌جویی بشه.</p>
<p>به گزینهٔ<sup><a href="http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/#footnote_12_292" id="identifier_12_292" class="footnote-link footnote-identifier-link" title="Option">12</a></sup> noatime در fstab هم دقت کنید. رفتار معمولی سامانه‌های پرونده این هست که در هر دست‌رسی (اعم از خواندن یا نوشتن) به یک پرونده، زمان دست‌رسی رو ذخیره می‌کنند. این خیلی بده! هر دست‌رسی = حداقل یک عمل نوشتن روی لوح، و عمل نوشتن هم معمولاً کندتر از خوندن هست. نکته این جاست که برنامه‌های رایج امروزی معمولاً روی اون زمان ثبت‌شده برای آخرین دست‌رسی حساب نمی‌کنند و عملاً اون عدد بی‌استفاده است! گزینهٔ noatime به سامانهٔ پرونده می‌گه که کلاً قید ثبت اون زمان رو بزنه و به این ترتیب کلی عمل نوشتن صرفه‌جویی کنه.</p>
<ol start="0" class="footnotes"><li id="footnote_0_292" class="footnote">Back-end</li><li id="footnote_1_292" class="footnote">Package management</li><li id="footnote_2_292" class="footnote">File</li><li id="footnote_3_292" class="footnote">Disk</li><li id="footnote_4_292" class="footnote">File system</li><li id="footnote_5_292" class="footnote">Cache</li><li id="footnote_6_292" class="footnote">Tail packing</li><li id="footnote_7_292" class="footnote">http://en.wikipedia.org/wiki/ReiserFS#Performance</li><li id="footnote_8_292" class="footnote">Mechanism</li><li id="footnote_9_292" class="footnote">Extent</li><li id="footnote_10_292" class="footnote">Allocation</li><li id="footnote_11_292" class="footnote">Seek</li><li id="footnote_12_292" class="footnote">Option</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/07/a-technique-for-speeding-up-dpkg/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>توهم اکثریت بودن</title>
		<link>http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/</link>
		<comments>http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 15:24:49 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[دل]]></category>
		<category><![CDATA[رایانه]]></category>
		<category><![CDATA[سیاست]]></category>
		<category><![CDATA[مردم]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=285</guid>
		<description><![CDATA[گاهی که مدام بین ملت بازمنبع0 زندگی می‌کنم، اخبارشون رو پی‌گیری می‌کنم، تارنوشت1هاشون رو می‌خونم، مطلب می‌نویسم و خلاصه تو جوّ بازمنبعی‌ها هستم، فکر می‌کنم که اکثر کاربرهای رایانه2 با مقولهٔ نرم‌افزار آزاد3 و بازمنبع آشنا هستند. با خودم می‌گم حتماً اغلب کاربرها روی رایانه‌شون یک توزیع4 Linux نصب دارند. فکر می‌کنم همه حتی اگر [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>گاهی که مدام بین ملت بازمنبع<sup><a href="http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#footnote_0_285" id="identifier_0_285" class="footnote-link footnote-identifier-link" title="Open Source">0</a></sup> زندگی می‌کنم، اخبارشون رو پی‌گیری می‌کنم، تارنوشت<sup><a href="http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#footnote_1_285" id="identifier_1_285" class="footnote-link footnote-identifier-link" title="Weblog">1</a></sup>هاشون رو می‌خونم، مطلب می‌نویسم و  خلاصه تو جوّ بازمنبعی‌ها هستم، فکر می‌کنم که اکثر کاربرهای رایانه<sup><a href="http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#footnote_2_285" id="identifier_2_285" class="footnote-link footnote-identifier-link" title="Computer">2</a></sup> با مقولهٔ نرم‌افزار آزاد<sup><a href="http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#footnote_3_285" id="identifier_3_285" class="footnote-link footnote-identifier-link" title="Free Software">3</a></sup> و بازمنبع آشنا هستند. با خودم می‌گم حتماً اغلب کاربرها روی رایانه‌شون یک توزیع<sup><a href="http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/#footnote_4_285" id="identifier_4_285" class="footnote-link footnote-identifier-link" title="Distribution">4</a></sup> Linux نصب دارند. فکر می‌کنم همه حتی اگر از Linux یا یکی از BSDها استفاده هم نمی‌کنند، حداقل می‌دونند چیه. واقعاً باورم می‌شه که ما اکثریتیم!</p>
<ol start="0" class="footnotes"><li id="footnote_0_285" class="footnote">Open Source</li><li id="footnote_1_285" class="footnote">Weblog</li><li id="footnote_2_285" class="footnote">Computer</li><li id="footnote_3_285" class="footnote">Free Software</li><li id="footnote_4_285" class="footnote">Distribution</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/03/illusion-of-being-majority/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>جادوی یخ‌زن</title>
		<link>http://blog.ebrahim.ir/1388/02/magic-of-freezer/</link>
		<comments>http://blog.ebrahim.ir/1388/02/magic-of-freezer/#comments</comments>
		<pubDate>Fri, 08 May 2009 19:16:55 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[خرابی]]></category>
		<category><![CDATA[لوح سخت]]></category>
		<category><![CDATA[لوح لغزان]]></category>
		<category><![CDATA[یخ‌زن]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=276</guid>
		<description><![CDATA[چندی پیش در این مورد نوشته بودم که چگونه به کمک یخ‌زن0، لوح سختی1 احیا شد. چند روز بعدش یکی از دوستان پیامک2 زد که به همون روش، یک لوح لغزان3 رو احیا کرده! جالب‌تر این که چند روز پیش، یک MP3پخش‌کن4 که چند سالی بود کار نمی‌کرد، به همون روش احیا شد!!! FreezerHard diskSMSFloppy [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>چندی پیش در این مورد <a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/">نوشته بودم</a> که چگونه به کمک یخ‌زن<sup><a href="http://blog.ebrahim.ir/1388/02/magic-of-freezer/#footnote_0_276" id="identifier_0_276" class="footnote-link footnote-identifier-link" title="Freezer">0</a></sup>، لوح سختی<sup><a href="http://blog.ebrahim.ir/1388/02/magic-of-freezer/#footnote_1_276" id="identifier_1_276" class="footnote-link footnote-identifier-link" title="Hard disk">1</a></sup> احیا شد.<br />
چند روز بعدش یکی از دوستان پیامک<sup><a href="http://blog.ebrahim.ir/1388/02/magic-of-freezer/#footnote_2_276" id="identifier_2_276" class="footnote-link footnote-identifier-link" title="SMS">2</a></sup> زد که به همون روش، یک لوح لغزان<sup><a href="http://blog.ebrahim.ir/1388/02/magic-of-freezer/#footnote_3_276" id="identifier_3_276" class="footnote-link footnote-identifier-link" title="Floppy disk">3</a></sup> رو احیا کرده!<br />
جالب‌تر این که چند روز پیش، یک MP3پخش‌کن<sup><a href="http://blog.ebrahim.ir/1388/02/magic-of-freezer/#footnote_4_276" id="identifier_4_276" class="footnote-link footnote-identifier-link" title="MP3 player">4</a></sup> که چند سالی بود کار نمی‌کرد، به همون روش احیا شد!!!</p>
<ol start="0" class="footnotes"><li id="footnote_0_276" class="footnote">Freezer</li><li id="footnote_1_276" class="footnote">Hard disk</li><li id="footnote_2_276" class="footnote">SMS</li><li id="footnote_3_276" class="footnote">Floppy disk</li><li id="footnote_4_276" class="footnote">MP3 player</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/02/magic-of-freezer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>مقابله با ایرادهای فساد حافظه</title>
		<link>http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/</link>
		<comments>http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 01:03:31 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C++‎]]></category>
		<category><![CDATA[GCC]]></category>
		<category><![CDATA[Valgrind]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[ایرادزدایی]]></category>
		<category><![CDATA[برنامه‌نویسی]]></category>
		<category><![CDATA[سرریز میان‌گیر]]></category>
		<category><![CDATA[فساد حافظه]]></category>
		<category><![CDATA[هم‌گردان]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=261</guid>
		<description><![CDATA[مبنای بحث در این مطلب، زبان‌های C++‎ و C هستند، ولی مطالعهٔ آن برای برنامه‌نویسان هر زبانی که در معرض ایراد0های فساد حافظه1 است و حتی هر برنامه‌نویسی، احتمالاً خالی از سود نخواهد بود. برنامه‌ای نوشته‌اید که ایراد داره. اون رو حسابی آزموده‌اید و هر ایراد منطقی2 رو که فکر می‌کنید ممکن هست وجود داشته [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>مبنای بحث در این مطلب، زبان‌های C++‎ و C هستند، ولی مطالعهٔ آن برای برنامه‌نویسان هر زبانی که در معرض ایراد<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_0_261" id="identifier_0_261" class="footnote-link footnote-identifier-link" title="Bug">0</a></sup>های فساد حافظه<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_1_261" id="identifier_1_261" class="footnote-link footnote-identifier-link" title="Memory corruption">1</a></sup> است و حتی هر برنامه‌نویسی، احتمالاً خالی از سود نخواهد بود.</p>
<p>برنامه‌ای نوشته‌اید که ایراد داره. اون رو حسابی آزموده‌اید و هر ایراد منطقی<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_2_261" id="identifier_2_261" class="footnote-link footnote-identifier-link" title="Logical">2</a></sup> رو که فکر می‌کنید ممکن هست وجود داشته باشه بررسی و رفع کرده‌اید، ولی هنوز برنامه ایراد داره!<br />
برنامهٔ شما رفتارهای عجیبی از خودش نشون می‌ده. مثلاً اگر در حالت ایرادزدایی<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_3_261" id="identifier_3_261" class="footnote-link footnote-identifier-link" title="Debug">3</a></sup> بسازیدش<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_4_261" id="identifier_4_261" class="footnote-link footnote-identifier-link" title="Build">4</a></sup> کار می‌کنه، ولی در حالت انتشار<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_5_261" id="identifier_5_261" class="footnote-link footnote-identifier-link" title="Release">5</a></sup> یا اشتباه کار می‌کنه، یا کار نمی‌کنه و دچار سانحه<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_6_261" id="identifier_6_261" class="footnote-link footnote-identifier-link" title="Crash">6</a></sup> می‌شه. یا مثلاً با ورودی‌های مختلف، در جاهای کاملاً متفاوت و نسبتاً بی‌ربط از کد دچار سانحه می‌شه. یا مثلاً همیشه در پایان یک تابع<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_7_261" id="identifier_7_261" class="footnote-link footnote-identifier-link" title="Function">7</a></sup> بعد از همهٔ عملیات، ولی قبل از بازگشت (یعنی دقیقاً روی { !!!) دچار سانحه می‌شه.<br />
در چنین شرایطی هست که شما حدس می‌زنید برنامه‌تون دچار ایراد فساد حافظه<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_1_261" id="identifier_8_261" class="footnote-link footnote-identifier-link" title="Memory corruption">1</a></sup> شده.<br />
اگر برنامه همیشه در یک تابع خاص دچار سانحه می‌شه، حدس می‌زنیم که در یکی از متغیرهای محلی همون تابع خراب‌کاری شده و پشته<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_8_261" id="identifier_9_261" class="footnote-link footnote-identifier-link" title="Stack">8</a></sup> خراب شده؛ به همین دلیل در هنگام جمع کردن قاب پشتهٔ<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_9_261" id="identifier_10_261" class="footnote-link footnote-identifier-link" title="Stack frame">9</a></sup> تابع از روی پشته، به علت فساد نشانی بازگشت<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_10_261" id="identifier_11_261" class="footnote-link footnote-identifier-link" title="Return address">10</a></sup>، برنامه دچار سانحه می‌شه<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_11_261" id="identifier_12_261" class="footnote-link footnote-identifier-link" title="نوعی سرریز میان&zwnj;گیر (Buffer overflow)">11</a></sup>.<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_12_261" id="identifier_13_261" class="footnote-link footnote-identifier-link" title="البته این رفتار سانحه&zwnj;آمیز (!) بستگی به هم&zwnj;گردان داره، ولی هم&zwnj;گردان&zwnj;های جدید مثل GCCهای ۴ به بعد (و شاید بعضی قدیمی&zwnj;ترها)، به علت داشتن روش&zwnj;هایی برای مقابله با خرابی پشته، عمداً برنامه&zwnj;ای تولید می&zwnj;کنند که در این شرایط دچار سانحه بشه">12</a></sup> معمولاً با خوندن دقیق همون تابع، ایراد یافت و حل می‌شه. اگر نشد، متغیرهای محلی که روی پشته هستند رو به کومه<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_13_261" id="identifier_14_261" class="footnote-link footnote-identifier-link" title="Heap">13</a></sup> منتقل می‌کنیم (با استفاده از new یا malloc) و می‌ریم به سراغ روش‌های مربوط به فساد کومه که الان می‌خواهیم بگیم.<br />
اولین قدم برای یافتن ایرادهای فساد حافظهٔ کومه، استمداد از حضرت <a href="http://valgrind.kde.org">Valgrind</a> است (که در دبین<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_14_261" id="identifier_15_261" class="footnote-link footnote-identifier-link" title="Debian">14</a></sup> بسته‌اش valgrind است)):</p>
<div dir="ltr">

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #c20cb9; font-weight: bold;">valgrind</span> <span style="color: #660033;">--leak-check</span>=full <span style="color: #660033;">--leak-resolution</span>=high .<span style="color: #000000; font-weight: bold;">/</span>buggy</pre></div></div>

</div>
<p>برنامه با سرعتی بسیار کم‌تر از حد معمول اجرا می‌شه و هر دست‌رسی به حافظهٔ کومه که خارج از حافظهٔ تخصیص‌یافته<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_15_261" id="identifier_16_261" class="footnote-link footnote-identifier-link" title="Allocated">15</a></sup> باشه، با نام تابع و (در حالت ایرادزدایی) شمارهٔ خط کد منبع<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_16_261" id="identifier_17_261" class="footnote-link footnote-identifier-link" title="Source code">16</a></sup> گزارش می‌شه. البته Valgrind بسیار جای حرف و معرفی و ستایش و غیره داره که از موضوع این مطلب خارجه!<br />
اگر Valgrind مشکل رو یافت و ایراد رفع شد که خدا رو شکر می‌کنیم! اما اگر نه، با یک مورد بدخیم (!) طرف هستیم. یعنی دست‌رسی‌هایی داریم که به رغم ایراد داشتنشون، داخل حافظهٔ تخصیص‌یافته قرار گرفته‌اند. مثلاً دو آرایهٔ ۱۰۰تایی پشت سر هم در کومه گرفته‌ایم و به عنصر ۱۲۵ام از آرایهٔ اول دست زده‌ایم! دست‌رسی هنوز داخل حافظهٔ پردازهٔ<sup><a href="http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/#footnote_17_261" id="identifier_18_261" class="footnote-link footnote-identifier-link" title="Process">17</a></sup> خودمان است، ولی نادرست و ایراددار. اگر کسی تا این جای مطلب رو خونده باشه تعجب می‌کنم! البته کسی به جز خودم!<br />
ان‌شاء الله در مطلب بعدی شیوه‌ای برای یافتن این موارد بدخیم معرفی خواهد شد که از یکی از هم‌کاران باتجربه‌ترم (حفظه الله) آموخته‌ام.</p>
<ol start="0" class="footnotes"><li id="footnote_0_261" class="footnote">Bug</li><li id="footnote_1_261" class="footnote">Memory corruption</li><li id="footnote_2_261" class="footnote">Logical</li><li id="footnote_3_261" class="footnote">Debug</li><li id="footnote_4_261" class="footnote">Build</li><li id="footnote_5_261" class="footnote">Release</li><li id="footnote_6_261" class="footnote">Crash</li><li id="footnote_7_261" class="footnote">Function</li><li id="footnote_8_261" class="footnote">Stack</li><li id="footnote_9_261" class="footnote">Stack frame</li><li id="footnote_10_261" class="footnote">Return address</li><li id="footnote_11_261" class="footnote"><span dir="rtl">نوعی سرریز میان‌گیر (Buffer overflow)</span></li><li id="footnote_12_261" class="footnote"><span dir="rtl">البته این رفتار سانحه‌آمیز (!) بستگی به هم‌گردان داره، ولی هم‌گردان‌های جدید مثل GCCهای ۴ به بعد (و شاید بعضی قدیمی‌ترها)، به علت داشتن روش‌هایی برای مقابله با خرابی پشته، عمداً برنامه‌ای تولید می‌کنند که در این شرایط دچار سانحه بشه</span></li><li id="footnote_13_261" class="footnote">Heap</li><li id="footnote_14_261" class="footnote">Debian</li><li id="footnote_15_261" class="footnote">Allocated</li><li id="footnote_16_261" class="footnote">Source code</li><li id="footnote_17_261" class="footnote">Process</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/01/fighting-memory-corruption-bugs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>احیای لوح سخت</title>
		<link>http://blog.ebrahim.ir/1388/01/reviving-hard-disk/</link>
		<comments>http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 22:52:59 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[PowerMax]]></category>
		<category><![CDATA[SMART]]></category>
		<category><![CDATA[آزمون]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[اینترنت]]></category>
		<category><![CDATA[خرابی]]></category>
		<category><![CDATA[راه‌اندازی]]></category>
		<category><![CDATA[لوح سخت]]></category>
		<category><![CDATA[موعظه]]></category>
		<category><![CDATA[یخ‌زن]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=242</guid>
		<description><![CDATA[این مطلب در مورد زنده کردن لوح‌های سخت‌شدهٔ دل‌هامون به کمک موعظه یا چیزی شبیه اون نیست! (البته متأسفانه) لوح سختی0 دارم که خراب شده بود. وقتی رایانه1 رو روشن می‌کردم، هی سعی می‌کرد راه بیفته ولی موفق نمی‌شد و اصلاً دور بر نمی‌داشت2. در نتیجه رایانه هم همون اول کار، توی مرحلهٔ شناسایی لوح‌های [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>این مطلب در مورد زنده کردن لوح‌های سخت‌شدهٔ دل‌هامون به کمک موعظه یا چیزی شبیه اون نیست! (البته متأسفانه)</p>
<p>لوح سختی<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_0_242" id="identifier_0_242" class="footnote-link footnote-identifier-link" title="Hard Disk">0</a></sup> دارم که خراب شده بود. وقتی رایانه<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_1_242" id="identifier_1_242" class="footnote-link footnote-identifier-link" title="Computer">1</a></sup> رو روشن می‌کردم، هی سعی می‌کرد راه بیفته ولی موفق نمی‌شد و اصلاً دور بر نمی‌داشت<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_2_242" id="identifier_2_242" class="footnote-link footnote-identifier-link" title="این&zwnj;ها رو با لمس کردن لوح سخت می&zwnj;شه فهمید">2</a></sup>. در نتیجه رایانه هم همون اول کار، توی مرحلهٔ شناسایی لوح‌های سخت، گیر می‌کرد و راه‌اندازی<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_3_242" id="identifier_3_242" class="footnote-link footnote-identifier-link" title="boot">3</a></sup> نمی‌شد. تقریباً ازش قطع امید کرده بودم.</p>
<p>طبق معمول قبل از هر گونه تصمیم‌گیری، سری به اینترنت زدم تا ببینم ملت در این باره چی گفته‌اند. بعد از کمی جست‌وجو، با راه‌کاری غیرمنتظره مواجه شدم: لوح سخت رو بگذارید تو یخ‌زن<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_4_242" id="identifier_4_242" class="footnote-link footnote-identifier-link" title="Freezer">4</a></sup>! بله، <a href="http://www.trap17.com/index.php/hard-drive-freezer-trick_t26193.html">گفته</a> <a href="http://geeksaresexy.blogspot.com/2006/01/freeze-your-hard-drive-to-recover-data.html">بودند</a> که بعد از سرد کردن لوح سخت، باید بلافاصله اون رو به رایانه بزنید. اگر قسمت باشه<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_5_242" id="identifier_5_242" class="footnote-link footnote-identifier-link" title="این تیکه&zwnj;اش رو اون&zwnj;ها این&zwnj;جوری نگفته بودند!">5</a></sup> چند دقیقه فرصت دارید تا داده‌های مهم‌ترتون رو بر دارید.</p>
<p>از اون جا که چیز زیادی برای از دست دادن نداشتم، و در ضمن از این جور انگولک‌کردن‌ها خوشم می‌آد، تصمیم گرفتم این کار رو بکنم. لوح سخت رو توی یک کیسه پیچیدم تا برفک نزنه و خیس نشه و بعد داخل یخ‌زن گذاشتم. بعد از چند ساعت که لوح سخت قصهٔ ما حسابی یخ زد، درش آوردم و سریع به رایانه وصلش کردم.</p>
<p>رایانه رو روشن کردم و در کمال ناباوری دیدم داره کار می‌کنه! با نرم‌افزار PowerMax آزمون سریع SMART<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_6_242" id="identifier_6_242" class="footnote-link footnote-identifier-link" title="Self-Monitoring, Analysis and Reporting Technology">6</a></sup> رو انجام دادم و دیدم واقعاً سالمه<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_7_242" id="identifier_7_242" class="footnote-link footnote-identifier-link" title="کلیدواژه&zwnj;ها رو برای خنده نمی&zwnj;دم! برای این می&zwnj;دم که بتونی باهاش جست&zwnj;وجو کنی">7</a></sup>. با خودم گفتم شاید اگر در حالت خاموش گرم بشه، دوباره به همون روز بیفته. برای همین، رایانه رو خاموش نکردم و گذاشتم لوح سخت دائماً کار کنه تا در حال چرخش گرم بشه، باشد که سالم بمونه. نمی‌دونم کار این فکر بود یا نه، ولی هر چی بود جواب داد! برای این که مطمئن بشم که لوح سخت برای طولانی‌مدت سالم شده، رایانه رو خاموش کردم تا لوح کمی خنک بشه و بعد دوباره روشنش کردم. دوباره آزمودمش و دیدم که سالمه.</p>
<p>برای اطمینان از سلامت داده‌ها، از توی سامانهٔ عامل<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_8_242" id="identifier_8_242" class="footnote-link footnote-identifier-link" title="Operating System">8</a></sup>، چند تا پرونده<sup><a href="http://blog.ebrahim.ir/1388/01/reviving-hard-disk/#footnote_9_242" id="identifier_9_242" class="footnote-link footnote-identifier-link" title="File">9</a></sup> رو خوندم و بررسی کردم که شکر خدا سالم بودند.</p>
<p>سپاس خدای راست <img src='http://blog.ebrahim.ir/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ol start="0" class="footnotes"><li id="footnote_0_242" class="footnote">Hard Disk</li><li id="footnote_1_242" class="footnote">Computer</li><li id="footnote_2_242" class="footnote">این‌ها رو با لمس کردن لوح سخت می‌شه فهمید</li><li id="footnote_3_242" class="footnote">boot</li><li id="footnote_4_242" class="footnote">Freezer</li><li id="footnote_5_242" class="footnote"><span dir="rtl">این تیکه‌اش رو اون‌ها این‌جوری نگفته بودند!</span></li><li id="footnote_6_242" class="footnote">Self-Monitoring, Analysis and Reporting Technology</li><li id="footnote_7_242" class="footnote">کلیدواژه‌ها رو برای خنده نمی‌دم! برای این می‌دم که بتونی باهاش جست‌وجو کنی</li><li id="footnote_8_242" class="footnote">Operating System</li><li id="footnote_9_242" class="footnote">File</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1388/01/reviving-hard-disk/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>بهینه‌سازی هدایت‌شده با سابقه</title>
		<link>http://blog.ebrahim.ir/1387/12/profile-guided-optimization/</link>
		<comments>http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 03:57:45 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C++‎]]></category>
		<category><![CDATA[CMake]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[GCC]]></category>
		<category><![CDATA[PGO]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[برنامه‌نویسی]]></category>
		<category><![CDATA[بهینه‌سازی]]></category>
		<category><![CDATA[سابقه‌گیری]]></category>
		<category><![CDATA[لینوکس]]></category>
		<category><![CDATA[هم‌گردان]]></category>
		<category><![CDATA[ویندوز]]></category>
		<category><![CDATA[کارآیی]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=200</guid>
		<description><![CDATA[یکی از روش‌های نسبتاً متفاوت هم‌گردان0ها برای بهینه‌سازی1، روش «بهینه‌سازی هدایت‌شده با سابقه»2 است که گاهی اون رو کوتاهانه3 PGO هم می‌گویند. مؤثر بودن این روش رو می‌شه به چشم دید. مثلاً اگر از مرورگر Firefox هم در لینوکس4 و هم در ویندوز5 استفاده کرده باشید، حتماً تفاوت فاحش کارآیی6 رو حس کرده‌اید. دلیل این [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p>یکی از روش‌های نسبتاً متفاوت هم‌گردان<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_0_200" id="identifier_0_200" class="footnote-link footnote-identifier-link" title="Compiler">0</a></sup>ها برای بهینه‌سازی<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_1_200" id="identifier_1_200" class="footnote-link footnote-identifier-link" title="Optimization">1</a></sup>، روش «بهینه‌سازی هدایت‌شده با سابقه»<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_2_200" id="identifier_2_200" class="footnote-link footnote-identifier-link" title="Profile-Guided Optimization">2</a></sup> است که گاهی اون رو کوتاهانه<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_3_200" id="identifier_3_200" class="footnote-link footnote-identifier-link" title="به یاد استاد روحانی رانکوهی!">3</a></sup> PGO هم می‌گویند.</p>
<p>مؤثر بودن این روش رو می‌شه به چشم دید. مثلاً اگر از مرورگر Firefox هم در لینوکس<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_4_200" id="identifier_4_200" class="footnote-link footnote-identifier-link" title="Linux">4</a></sup> و هم در ویندوز<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_5_200" id="identifier_5_200" class="footnote-link footnote-identifier-link" title="Windows">5</a></sup> استفاده کرده باشید، حتماً تفاوت فاحش کارآیی<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_6_200" id="identifier_6_200" class="footnote-link footnote-identifier-link" title="Performance">6</a></sup> رو حس کرده‌اید. دلیل این تفاوت فاحش، استفاده از PGO در ساخت<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_7_200" id="identifier_7_200" class="footnote-link footnote-identifier-link" title="Build">7</a></sup> پروندهٔ<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_8_200" id="identifier_8_200" class="footnote-link footnote-identifier-link" title="File">8</a></sup> اجرایی<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_9_200" id="identifier_9_200" class="footnote-link footnote-identifier-link" title="Executable">9</a></sup> ویندوز و عدم استفاده ازش در ساخت اجرایی لینوکس بیان شده.</p>
<p>خوب، حالا که به اندازهٔ کافی انگیزوندمتون (!)، ببینیم این روش اصلاً چی هست و چه‌جوری می‌تونیم ازش استفاده کنیم.</p>
<p>اساس این روش، استفاده از اطلاعات کسب‌شده در زمان اجرا<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_10_200" id="identifier_10_200" class="footnote-link footnote-identifier-link" title="Run-time">10</a></sup>ی برنامه، برای بهینه‌سازی در زمان هم‌گردانی<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_11_200" id="identifier_11_200" class="footnote-link footnote-identifier-link" title="Compile-time">11</a></sup> هست. پس هم‌گردانی با این روش، سه مرحله خواهد داشت:</p>
<p>۱. هم‌گردانی برای تولید اجرایی مخصوص جمع‌آوری اطلاعات مورد نیاز برای بهینه‌سازی<br />
۲. اجرای برنامهٔ تولیدشده در مرحلهٔ ۱ و استفاده از موارد کاربرد<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_12_200" id="identifier_12_200" class="footnote-link footnote-identifier-link" title="Use case">12</a></sup> مورد نظر برای بهینه‌سازی<br />
۳. هم‌گردانی با بهینه‌سازی به کمک اطلاعات جمع‌آوری‌شده در مرحلهٔ ۲</p>
<p>هم‌گردان‌ها برای مراحل ۱ و ۳ گزینه‌های مخصوصی دارند که این‌جا فقط GCC رو می‌بینیم.</p>
<p>درGCC برای مرحلهٔ ۱ از گزینهٔ ‎-fprofile-generate و برای مرحلهٔ ۳ از گزینهٔ ‎-fprofile-use استفاده می‌کنیم. دقت کنید که گزینهٔ ‎-fprofile-generate رو هم باید برای هم‌گردانی<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_13_200" id="identifier_13_200" class="footnote-link footnote-identifier-link" title="Compiling">13</a></sup> بدید، و هم برای پیوند<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_14_200" id="identifier_14_200" class="footnote-link footnote-identifier-link" title="Linking">14</a></sup>.</p>
<p>من که معمولاً از CMake به عنوان سامانهٔ ساخت<sup><a href="http://blog.ebrahim.ir/1387/12/profile-guided-optimization/#footnote_15_200" id="identifier_15_200" class="footnote-link footnote-identifier-link" title="Build System">15</a></sup> استفاده می‌کنم، برای به کارگیری این روش، این چند خط رو به CMakeLists.txt اضافه می‌کنم:</p>

<div class="wp_syntax" dir="ltr"><div class="code"><pre class="none" style="font-family:monospace;"># profile::generate
#set(CMAKE_C_FLAGS &quot;${CMAKE_C_FLAGS} --profile-generate&quot;)
#set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} --profile-generate&quot;)
#set(CMAKE_EXE_LINKER_FLAGS &quot;${CMAKE_EXE_LINKER_FLAGS} --profile-generate&quot;)
# profile::use
#set(CMAKE_C_FLAGS &quot;${CMAKE_C_FLAGS} --profile-use&quot;)
#set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} --profile-use&quot;)
#set(CMAKE_EXE_LINKER_FLAGS &quot;${CMAKE_EXE_LINKER_FLAGS} --profile-use&quot;)</pre></div></div>

<p>برای مرحلهٔ ۱، سه تا set اول و برای مرحلهٔ ۳، سه تا set دوم رو فعال می‌کنم. راستی دقت کردید که به جای ‎-fprofile-folan می‌شه از  ‎-profile-folan- استفاده کرد؟!</p>
<ol start="0" class="footnotes"><li id="footnote_0_200" class="footnote">Compiler</li><li id="footnote_1_200" class="footnote">Optimization</li><li id="footnote_2_200" class="footnote">Profile-Guided Optimization</li><li id="footnote_3_200" class="footnote"><span dir="rtl">به یاد استاد روحانی رانکوهی!</span></li><li id="footnote_4_200" class="footnote">Linux</li><li id="footnote_5_200" class="footnote">Windows</li><li id="footnote_6_200" class="footnote">Performance</li><li id="footnote_7_200" class="footnote">Build</li><li id="footnote_8_200" class="footnote">File</li><li id="footnote_9_200" class="footnote">Executable</li><li id="footnote_10_200" class="footnote">Run-time</li><li id="footnote_11_200" class="footnote">Compile-time</li><li id="footnote_12_200" class="footnote">Use case</li><li id="footnote_13_200" class="footnote">Compiling</li><li id="footnote_14_200" class="footnote">Linking</li><li id="footnote_15_200" class="footnote">Build System</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/12/profile-guided-optimization/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>نقش برنامه‌نویس‌ها در گرمایش زمین</title>
		<link>http://blog.ebrahim.ir/1387/12/programmers-and-global-warming/</link>
		<comments>http://blog.ebrahim.ir/1387/12/programmers-and-global-warming/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 13:40:39 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[کلمات قصار]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C++‎]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[برنامه‌نویسی]]></category>
		<category><![CDATA[زمین]]></category>
		<category><![CDATA[طبیعت]]></category>
		<category><![CDATA[گرمایش]]></category>
		<category><![CDATA[‎.NET]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=197</guid>
		<description><![CDATA[با پرهیز از Java و ‎.NET (در مقابل C++‎ و C) در روند گرمایش زمین سهم کم‌تری داشته باشیم.]]></description>
			<content:encoded><![CDATA[<p>با پرهیز از Java و ‎.NET (در مقابل C++‎ و C) در روند گرمایش زمین سهم کم‌تری داشته باشیم.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/12/programmers-and-global-warming/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>اندر کرامات حضرت دبیَن</title>
		<link>http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/</link>
		<comments>http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 06:37:15 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Hurd]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[NetBSD]]></category>
		<category><![CDATA[Nexenta]]></category>
		<category><![CDATA[OpenSolaris]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[ZFS]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[تحریم]]></category>
		<category><![CDATA[سامانهٔ عامل]]></category>
		<category><![CDATA[سامانهٔ پرونده]]></category>
		<category><![CDATA[لینوکس]]></category>
		<category><![CDATA[نرم‌افزار آزاد]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=171</guid>
		<description><![CDATA[دبیَن0 سامانهٔ عامل1 محبوب من هست. موج زدن روح آزادی نرم‌افزار رو توی دبین حس می‌کنم. بخش عظیمی از همهٔ نرم‌افزارهای آزاد دنیا رو می‌شه توی مخزن2های دبین، آمادهٔ نصب پیدا کرد؛ الان حدود ۲۰۰۰۰ تا بسته3 در مخازن رسمی4 هست. سامانهٔ مدیریت بسته‌هاش5، به نام APT (مخفف «ابزار بسته‌بندی پیش‌رفته»6)، بسیار تمیز و خوش‌دست [...]]]></description>
			<content:encoded><![CDATA[<p><!--startnum=0--></p>
<p><a href="http://www.debian.org/">دبیَن</a><sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_0_171" id="identifier_0_171" class="footnote-link footnote-identifier-link" title="Debian">0</a></sup> سامانهٔ عامل<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_1_171" id="identifier_1_171" class="footnote-link footnote-identifier-link" title="Operating System">1</a></sup> محبوب من هست.</p>
<p>موج زدن روح آزادی نرم‌افزار رو توی دبین حس می‌کنم.</p>
<p>بخش عظیمی از همهٔ نرم‌افزارهای آزاد دنیا رو می‌شه توی مخزن<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_2_171" id="identifier_2_171" class="footnote-link footnote-identifier-link" title="Repository">2</a></sup>های دبین، آمادهٔ نصب پیدا کرد؛ الان حدود ۲۰۰۰۰ تا بسته<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_3_171" id="identifier_3_171" class="footnote-link footnote-identifier-link" title="Package">3</a></sup> در مخازن رسمی<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_4_171" id="identifier_4_171" class="footnote-link footnote-identifier-link" title="Official">4</a></sup> هست.</p>
<p>سامانهٔ مدیریت بسته‌هاش<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_5_171" id="identifier_5_171" class="footnote-link footnote-identifier-link" title="Package Management">5</a></sup>، به نام <a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool">APT</a> (مخفف «ابزار بسته‌بندی پیش‌رفته»<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_6_171" id="identifier_6_171" class="footnote-link footnote-identifier-link" title="Advanced Packaging Tool">6</a></sup>)، بسیار تمیز و خوش‌دست هست.</p>
<p>اگر سامانه‌ای حقیقتاً پایدار<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_7_171" id="identifier_7_171" class="footnote-link footnote-identifier-link" title="Stable">7</a></sup> بخوام، دبین stable رو نصب می‌کنم. اگر پایداری برام کم‌تر از به‌روز<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_8_171" id="identifier_8_171" class="footnote-link footnote-identifier-link" title="Up-to-date">8</a></sup> بودن نرم‌افزارها مهم باشه (مثلاً برای رایانهٔ منزل)، دبین unstable + experimental رو نصب می‌کنم. اگر روی سامانهٔ پایدارم آخرین نسخهٔ بسته‌های خاصی رو بخوام هم به سادگی می‌تونم بسته‌های deb رو جدا بگیرم و نصب کنم، یا با تنظیم ‎/etc/apt/preferences کار رو به دست استاد APT بسپارم (به man apt_preferences مراجعه کنید).</p>
<p>قبل از این که خبر انتشار KDE 4.2 توی پایگاه رسمی KDE اعلام بشه، بسته‌های KDE 4.2 توی مخزن دبین experimental بود و داشتم نصبش می‌کردم!</p>
<p>نرم‌افزارهای دوست‌داشتنی‌ای مثل <a href="http://www.virtualbox.org/">VirtualBox</a> رو که هم ویرایش آزاد دارند، و هم ویرایش غیرآزاد، و البته گاهی در پایگاه<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_9_171" id="identifier_9_171" class="footnote-link footnote-identifier-link" title="Site">9</a></sup> رسمیشون ایران عزیز رو تحریم کرده‌اند، از مخازن دبین به راحتی نصب می‌کنم بدون این که نگران تحریم و یا آلوده شدن رایانه‌ام به نسخهٔ غیرآزادشون باشم. همهٔ نرم‌افزارهای بخش<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_10_171" id="identifier_10_171" class="footnote-link footnote-identifier-link" title="Section">10</a></sup> main، آزاد هستند و به هیچ نرم‌افزار غیرآزادی وابستگی<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_11_171" id="identifier_11_171" class="footnote-link footnote-identifier-link" title="Dependency">11</a></sup> ندارند.</p>
<p>بعضی نرم‌افزارهای غیرآزاد مثل افزونهٔ<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_12_171" id="identifier_12_171" class="footnote-link footnote-identifier-link" title="Plugin">12</a></sup> Flash، که ناچار از استفاده‌شون هستم رو می‌تونم بدون به هم زدن یک‌پارچگی سامانه‌ام نصب کنم. بخش‌های contrib و non-free حاوی بعضی از نرم‌افزارهای غیرآزاد پراستفاده هستند.</p>
<p>یادم نره بگم که دبین برای تعداد زیادی معماری<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_13_171" id="identifier_13_171" class="footnote-link footnote-identifier-link" title="Architecture">13</a></sup> مختلف رایانه وجود داره. از x86 و AMD64 بگیر تا MIPS و ARM و PowerPC و SPARC و Alpha و &#8230; (برای فهرست کاملش http://www.debian.org/ports/‎ رو ببینید)</p>
<p>با دبین به هستهٔ لینوکس<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_14_171" id="identifier_14_171" class="footnote-link footnote-identifier-link" title="Linux">14</a></sup> محدود نیستم؛ می‌شه دبین رو با هستهٔ<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_15_171" id="identifier_15_171" class="footnote-link footnote-identifier-link" title="Kernel">15</a></sup> FreeBSD<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_16_171" id="identifier_16_171" class="footnote-link footnote-identifier-link" title="Debian GNU/kFreeBSD">16</a></sup> یا NetBSD<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_17_171" id="identifier_17_171" class="footnote-link footnote-identifier-link" title="Debian GNU/NetBSD">17</a></sup> یا Hurd<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_18_171" id="identifier_18_171" class="footnote-link footnote-identifier-link" title="Debian GNU/Hurd">18</a></sup> یا OpenSolaris<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_19_171" id="identifier_19_171" class="footnote-link footnote-identifier-link" title="Nexenta">19</a></sup> یا حتی<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_20_171" id="identifier_20_171" class="footnote-link footnote-identifier-link" title="GNU-Darwin">20</a></sup> Darwin/XNU (هستهٔ Mac OS X) استفاده کرد! شما رو نمی‌دونم، ولی این برای من خیلی مهم و هم‌چنین خیلی هیجان‌انگیزه! مثلاً به این فکر کنید که می‌تونید توی محیط آشنا و دوست‌داشتنی دبین، به کامل‌ترین پیاده‌سازی سامانهٔ پروندهٔ<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_21_171" id="identifier_21_171" class="footnote-link footnote-identifier-link" title="File System">21</a></sup> قدرت‌مند <a href="http://en.wikipedia.org/wiki/ZFS">ZFS</a> که توی OpenSolaris هست دست‌رسی داشته باشید.</p>
<p>راستی یادمون نره که اوبونتو<sup><a href="http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/#footnote_22_171" id="identifier_22_171" class="footnote-link footnote-identifier-link" title="Ubuntu">22</a></sup> بچهٔ دبین هست.</p>
<p>این‌جوری‌هاست که بهش می‌گم حضرت دبین!</p>
<ol start="0" class="footnotes"><li id="footnote_0_171" class="footnote">Debian</li><li id="footnote_1_171" class="footnote">Operating System</li><li id="footnote_2_171" class="footnote">Repository</li><li id="footnote_3_171" class="footnote">Package</li><li id="footnote_4_171" class="footnote">Official</li><li id="footnote_5_171" class="footnote">Package Management</li><li id="footnote_6_171" class="footnote">Advanced Packaging Tool</li><li id="footnote_7_171" class="footnote">Stable</li><li id="footnote_8_171" class="footnote">Up-to-date</li><li id="footnote_9_171" class="footnote">Site</li><li id="footnote_10_171" class="footnote">Section</li><li id="footnote_11_171" class="footnote">Dependency</li><li id="footnote_12_171" class="footnote">Plugin</li><li id="footnote_13_171" class="footnote">Architecture</li><li id="footnote_14_171" class="footnote">Linux</li><li id="footnote_15_171" class="footnote">Kernel</li><li id="footnote_16_171" class="footnote"><a href="http://www.debian.org/ports/kfreebsd-gnu/">Debian GNU/kFreeBSD</a></li><li id="footnote_17_171" class="footnote"><a href="http://www.debian.org/ports/netbsd/">Debian GNU/NetBSD</a></li><li id="footnote_18_171" class="footnote"><a href="http://www.debian.org/ports/hurd/">Debian GNU/Hurd</a></li><li id="footnote_19_171" class="footnote"><a href="http://www.nexenta.org/">Nexenta</a></li><li id="footnote_20_171" class="footnote"><a href="http://proclus.gnu-darwin.org/debian.html">GNU-Darwin</a></li><li id="footnote_21_171" class="footnote">File System</li><li id="footnote_22_171" class="footnote">Ubuntu</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/11/about-magneficence-of-the-great-debian/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>میمون چرب؛ دوست روباه آتشین</title>
		<link>http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/</link>
		<comments>http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 22:50:36 +0000</pubDate>
		<dc:creator>ابراهیم</dc:creator>
				<category><![CDATA[رایانه]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ابزار]]></category>
		<category><![CDATA[برنامه‌نویسی]]></category>
		<category><![CDATA[تار]]></category>
		<category><![CDATA[دست‌نوشته]]></category>
		<category><![CDATA[فارسی]]></category>
		<category><![CDATA[مرورگر]]></category>
		<category><![CDATA[نرم‌افزار آزاد]]></category>

		<guid isPermaLink="false">http://blog.ebrahim.ir/?p=123</guid>
		<description><![CDATA[از وقتی با Greasemonkey آشنا شده‌ام توقعم از تار1 خیلی بالا رفته. با این افزونهٔ Firefox می‌شه در طرف مخدوم2، به هر صفحه‌ای کدهای JavaScript دل‌خواه رو اضافه کرد. علاوه بر کلی دست‌نوشتهٔ3 آماده که توی http://userscripts.org براش وجود داره، خودمون هم می‌تونیم به راحتی براش دست‌نوشته بنویسیم. حالا اگر قدرت JavaScript رو بیاری تو [...]]]></description>
			<content:encoded><![CDATA[<p>از وقتی با <a href="https://addons.mozilla.org/firefox/748/">Greasemonkey</a> آشنا شده‌ام توقعم از تار<sup><a href="http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/#footnote_0_123" id="identifier_0_123" class="footnote-link footnote-identifier-link" title="Web">1</a></sup> خیلی بالا رفته.</p>
<p>با این افزونهٔ Firefox می‌شه در طرف مخدوم<sup><a href="http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/#footnote_1_123" id="identifier_1_123" class="footnote-link footnote-identifier-link" title="Client Side">2</a></sup>، به هر صفحه‌ای کدهای JavaScript دل‌خواه رو اضافه کرد. علاوه بر کلی دست‌نوشتهٔ<sup><a href="http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/#footnote_2_123" id="identifier_2_123" class="footnote-link footnote-identifier-link" title="Script">3</a></sup> آماده که توی <a href="http://userscripts.org/">http://userscripts.org</a> براش وجود داره، خودمون هم می‌تونیم به راحتی براش دست‌نوشته بنویسیم. حالا اگر قدرت JavaScript رو بیاری تو ذهنت می‌بینی که چه کارها می‌شه به کمک این میمون چرب (!) کرد.</p>
<p>برای شروع ماجراجویی، کمی از <a href="http://diveintogreasemonkey.org/">http://diveintogreasemonkey.org</a> رو خوندم. نقطهٔ شروع بسیار خوبی بود.</p>
<p>یک دست‌نوشته به نام <a href="http://userscripts.org/scripts/show/38610">فارسنده یا Persianizer</a> که به شیوهٔ بِکَن-بچسبون<sup><a href="http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/#footnote_3_123" id="identifier_3_123" class="footnote-link footnote-identifier-link" title="Copy-Paste">4</a></sup> ساخته‌ام، همهٔ رقم‌های انگلیسی و «ي» و «ك»های عربی توی صفحهٔ بارگذاری شده رو به معادل فارسیشون تبدیل می‌کنه. بس که اون صفحه‌های فارسی پر از «ي» حالم رو بد می‌کنه! فقط موقع استفاده حواست باشه پایگاه‌هایی که قراره فارسنده روشون کار بکنه رو خوب انتخاب کنی؛ پیش‌فرض‌هاش خوب نیستند.</p>
<p>البته یکی از شرایط من (و خیلی‌های دیگر) برای استفاده از یک فن‌آوری، انحصاری نبودنش هست که خوش‌بختانه افزونه‌هایی سازگار با Greasemonkey برای مرورگرهای مهم دیگه (از جمله Konqueror) هم وجود داره.</p>
<p>نکتهٔ پایانی این که اگر کاربر Greasemonkey باشی، افزونهٔ <a href="https://addons.mozilla.org/firefox/addon/8352">Greasefire</a> هم احتمالاً برات جالب هست.</p>
<p>این هم فهرست دست‌نوشته‌های محبوب من:<br />
<a href="http://userscripts.org/users/73214/favorites">http://userscripts.org/users/73214/favorites</a></p>
<ol class="footnotes"><li id="footnote_0_123" class="footnote">Web</li><li id="footnote_1_123" class="footnote">Client Side</li><li id="footnote_2_123" class="footnote">Script</li><li id="footnote_3_123" class="footnote">Copy-Paste</li></ol>]]></content:encoded>
			<wfw:commentRss>http://blog.ebrahim.ir/1387/09/grease-monkey-a-friend-of-fire-fox/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)

Served from: blog.ebrahim.ir @ 2012-02-07 00:31:19 -->
