<?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>Autarchy of the Private Cavehow-to &#187;</title> <atom:link href="http://bogdan.org.ua/categories/how-to/feed" rel="self" type="application/rss+xml" /><link>http://bogdan.org.ua</link> <description>Tiny bits of bioinformatics, [web-]programming etc</description> <lastBuildDate>Tue, 15 May 2012 21:56:55 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>How to remotely convert live 1xHDD/LVM Linux server to 2xHDD RAID1/LVM (GRUB2, GPT)</title><link>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html</link> <comments>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html#comments</comments> <pubDate>Tue, 17 May 2011 13:23:05 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[GPT]]></category> <category><![CDATA[grub2]]></category> <category><![CDATA[LVM]]></category> <category><![CDATA[mdadm]]></category> <category><![CDATA[RAID]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1593</guid> <description><![CDATA[Assumptions: current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, &#8230;); LVM is properly configured, and system reboots with no problems your new drive is /dev/sdb, it is identical to /dev/sda, and [...]]]></description> <content:encoded><![CDATA[<p>Assumptions:</p><ul><li>current HDD is /dev/sda, it has a GPT (with bios_grub being /dev/sda1), separate /boot partition (/dev/sda2), and a physical LVM volume (/dev/sda3), where LVM holds all the remaining partitions (root, /home, /srv, &#8230;); LVM is properly configured, and system reboots with no problems</li><li>your new drive is /dev/sdb, it is identical to /dev/sda, and it comes empty from the manufacturer (this is important! wipe the drive if it is not empty, especially if it used to be a part of another RAID)</li><li>your system is Debian or Debian-based; in this exact example I&#8217;ve been using Ubuntu Server 10.04</li><li>your LVM volume group is named vg0</li><li>make sure you understand what each command does before executing it</li><li>you do have an external backup of all your important data, and you do understand that the following operations are potentially dangerous to your data integrity</li></ul><p>Inspired by: <a
href="http://www200.pair.com/mecham/raid/raid1-degraded-etch.html" rel="nofollow" >Debian Etch RAID guide</a>, <a
href="http://serverfault.com/questions/267819/convert-1x2tb-hdd-with-lvm-into-2x2tb-hdd-with-raid1lvm-or-with-lvm-mirroring" rel="nofollow" >serverfault question</a>.<br
/> <span
id="more-1593"></span></p><ol><li>Create the GPT on the new drive:<br
/> <strong>parted /dev/sdb mklabel gpt</strong></li><li>Get the list of partitions on /dev/sda:<br
/> <strong>parted -m /dev/sda print</strong></li><li>Create /dev/sdb partitions similarly to what you have on /dev/sda (my example numbers follow, use your numbers here):<br
/> <strong>parted /dev/sdb mkpart bios_grub 1049kB 2097kB</strong><br
/> <strong>parted /dev/sdb mkpart boot 2097kB 258MB</strong><br
/> <strong>parted /dev/sdb mkpart lvm 258MB 2000GB</strong></li><li>Set proper flags on partitions:<br
/> <strong>parted /dev/sdb set 1 bios_grub on</strong> (GPT doesn&#8217;t have MBR, so you create a 1-MB partition instead to hold grub2&#8242;s boot code)<br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 2 raid on</strong><br
/> <em>(possibly optional)</em> <strong>parted /dev/sdb set 3 raid on</strong></li><li><em>(possibly optional)</em> To make sure /dev/sdb1 (the bios_grub) indeed contains grub&#8217;s boot code, I did <strong>dd if=/dev/sda1 of=/dev/sdb1</strong></li><li><strong>apt-get install mdadm</strong></li><li>Note: at this point, older tutorials suggest adding a bunch of raid* kernel modules to /etc/modules and to grub&#8217;s list of modules to load. I&#8217;m not sure this is really necessary, but do see the tutorials mentioned at the top for more information. If you do modify the lists of modules &#8211; don&#8217;t forget to run <strong>update-initramfs -u</strong>.</li><li>Create two initially-degraded RAID1 devices (one for /boot, another for LVM):<br
/> <strong>mdadm &ndash;&ndash;create /dev/md0 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb2 missing</strong><br
/> <strong>mdadm &ndash;&ndash;create /dev/md1 &ndash;&ndash;level=1 &ndash;&ndash;raid-devices=2 /dev/sdb3 missing</strong></li><li>Store the configuration of your RAID1 to the mdadm.conf file (important! this is not done automatically!)<br
/> <strong>mdadm -Es >> /etc/mdadm/mdadm.conf</strong></li><li>Verify the contents of your mdadm.conf:<br
/> <strong>cat /etc/mdadm/mdadm.conf</strong><br
/> <strong>dpkg-reconfigure mdadm</strong>, and enable booting in degraded mode</li><li>Copy your current /boot (/dev/sda2) to the new /dev/md0 /boot partition:<br
/> (one can use dd here as well, but for some reason my attempt at dd failed writing 1 last byte of data)<br
/> <strong>mkdir /mnt/md0</strong><br
/> <strong>mount /dev/md0 /mnt/md0</strong><br
/> <strong>cp -a /boot/* /mnt/md0/</strong><br
/> <strong>umount /dev/md0</strong><br
/> <strong>rmdir /mnt/md0</strong></li><li>Now extend your existing volume group to include the newly-created /dev/md1:<br
/> <strong>pvcreate /dev/md1</strong><br
/> <strong>vgextend vg0 /dev/md1</strong></li><li>Verify the list of logical volumes you curently have: enter <strong>lvm</strong> shell, and type <strong>lvs</strong>. Here&#8217;s what I had:<br
/> LV   VG    Attr   LSize   Origin Snap%  Move Log Copy%  Convert<br
/> home vg0   -wi-ao   1.70t<br
/> logs vg0   -wi-ao   4.66g<br
/> root vg0   -wi-ao  10.24g<br
/> srv  vg0   -wc-ao 100.00g<br
/> swap vg0   -wi-ao   1.86g<br
/> tmp  vg0   -wi-ao   4.66g</li><li>Now, you can move all the logical volumes to new physical volume in one command: <strong>pvmove /dev/sda3 /dev/md1</strong>. Personally, remembering the problem I had with dd from /dev/sda2 to /dev/md0, I decided to move all logical volumes one-by-one; as this takes time, you may consider joining these operations with <strong>;</strong> or <strong>&#038;&</strong>, and putting the /tmp last (as the easiest one to re-create if it fails to move):<br
/> <strong>pvmove &ndash;&ndash;name home /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name srv /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name logs /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name swap /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name root /dev/sda3 /dev/md1</strong><br
/> <strong>pvmove &ndash;&ndash;name tmp /dev/sda3 /dev/md1</strong></li><li>To be safer, I ran FS check on a few volumes I could umount:<br
/> <strong>umount /dev/mapper/vg0-srv</strong><br
/> <strong>fsck -f /dev/mapper/vg0-srv</strong><br
/> <strong>mount /dev/mapper/vg0-srv</strong><br
/> <strong>umount /dev/mapper/vg0-tmp</strong><br
/> <strong>fsck -f /dev/mapper/vg0-tmp</strong><br
/> <strong>mount /dev/mapper/vg0-tmp</strong></li><li>Remove /dev/sda3 from the physical space available to your volume group:<br
/> <strong>vgreduce vg0 /dev/sda3</strong></li><li>Install grub2 to both drives, so as to make them both bootable in case of failure:<br
/> <strong>grub-install &#8216;(hd0)&#8217;</strong><br
/> <strong>grub-install &#8216;(hd1)&#8217;</strong></li><li>Edit <strong>/etc/fstab</strong>, pointing /boot to /dev/md0. You may use UUIDs here, but please do not use UUIDs from mdadm.conf &#8211; those are different from FS-UUIDs, instead do <strong>ls -l /dev/disk/by-uuid</strong> to find the UUID of /dev/md0. Personally, I had no problems just using /dev/md0.</li><li>Now is the time to add your original /dev/sda to the RAID1; be absolutely sure you have moved all the data off that drive, because these commands will destroy it:<br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md0 /dev/sda2</strong><br
/> <strong>mdadm &ndash;&ndash;manage &ndash;&ndash;add /dev/md1 /dev/sda3</strong><br
/> Re-syncing array will take some time.</li><li>To be on the safe side, you may want to run again <strong>update-initramfs -u</strong> and <strong>update-grub</strong>; I have also edited /etc/grub.d/40_custom, adding there 2 more boot options: from /dev/sda2 and /dev/sdb2 (/boot on both drives) &#8211; have no idea if that will work, but having more boot options didn&#8217;t hurt</li><li>Reboot into your new system. Actually, at this point reboot is only necessary to verify that your system is bootable &#8211; you may delay this reboot as long as you want to.</li><li>Many tutorials also suggest testing your RAID1 by manually &#8220;degrading&#8221; it, trying to boot, and then rebuilding it back. I haven&#8217;t done that, but you may want to.</li></ol><p>Improvement suggestions, criticism and thank-you are welcome in the comments.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F05%2F17%2Fhow-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html&amp;title=How%20to%20remotely%20convert%20live%201xHDD%2FLVM%20Linux%20server%20to%202xHDD%20RAID1%2FLVM%20%28GRUB2%2C%20GPT%29" id="wpa2a_4"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/05/17/how-to-remotely-convert-live-hdd-lvm-linux-server-to-raid1-grub2-gpt.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>How to truncate git history (sample script included)</title><link>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html</link> <comments>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html#comments</comments> <pubDate>Mon, 28 Mar 2011 18:17:21 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[git]]></category> <category><![CDATA[history]]></category> <category><![CDATA[truncate]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1481</guid> <description><![CDATA[Under a few assumptions (most importantly - you do not have any non-merged branches,), it is very easy to throw away git repository commits older than an arbitrarily-chosen commit. Here's a sample script (call it e.g. git-truncate and put into your ~/bin or whichever location you have in PATH). PLAIN TEXT CODE: #!/bin/bash git checkout [...]]]></description> <content:encoded><![CDATA[<p>Under a few assumptions (most importantly - you do not have any non-merged branches,), it is very easy to throw away git repository commits older than an arbitrarily-chosen commit.</p><p>Here's a sample script (call it e.g. <strong>git-truncate</strong> and put into your ~/bin or whichever location you have in PATH).</p><div
class="igBar"><span
id="lcode-2"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-2'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-2"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git checkout --orphan temp $<span
style="color:#800000;color:#800000;">1</span></div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git commit -m <span
style="color:#CC0000;">"Truncated history"</span></div></li><li
style="font-weight: bold;color:#26536A;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git rebase --onto temp $<span
style="color:#800000;color:#800000;">1</span> master</div></li><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">git branch -D temp</div></li></ol></div></div></div><p></p><p>Invocation: cd to your repository, then <strong>git-truncate <em>refspec</em></strong>, where <em>refspec</em> is either a commit's SHA1 hash-id, or a tag.</p><p>Expected result: a git repository starting with "Truncated history" initial commit, and continuing to the tip of the branch you were on when calling the script.</p><p>If you truncate repositories often, then consider adding an optional 2nd argument (truncate-commit message) and also some safeguards against improper use - currently, even if refspec is wrong, the script will <strong>not</strong> abort after a failed checkout.</p><p>Thanks for posting any improvements you may have.</p><p>Source: <a
href="http://support.github.com/discussions/repos/5751-how-to-truncate-the-history-of-a-repository" rel="nofollow" >Tekkub's post on github discussions</a>.<br
/> See also: <a
href="http://bogdan.org.ua/2009/02/13/git-how-to-remove-file-commit-from-history.html">how to remove a single file from all of git's commits</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F03%2F28%2Fhow-to-truncate-git-history-sample-script-included.html&amp;title=How%20to%20truncate%20git%20history%20%28sample%20script%20included%29" id="wpa2a_8"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/03/28/how-to-truncate-git-history-sample-script-included.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to fix: Nokia Ovi Suite could not connect to the Nokia account server</title><link>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html</link> <comments>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html#comments</comments> <pubDate>Thu, 10 Mar 2011 19:18:05 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Misc]]></category> <category><![CDATA[account]]></category> <category><![CDATA[nokia]]></category> <category><![CDATA[ovi]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1470</guid> <description><![CDATA[I've been getting this message for a long while, when trying to log into Ovi from within my Ovi Suite: Nokia Ovi Suite could not connect to the Nokia account server. Make sure the internet connection is working properly and try again. However, both my internet connection, and logging into ovi.com using a browser work [...]]]></description> <content:encoded><![CDATA[<p>I've been getting this message for a long while, when trying to log into Ovi from within my Ovi Suite:</p><blockquote><p>Nokia Ovi Suite could not connect to the Nokia account server. Make sure the internet connection is working properly and try again.</p></blockquote><p>However, both my internet connection, and logging into ovi.com using a browser work fine. Even looking for updates from within Ovi Suite works fine!</p><p>Here's the solution (tested on Nokia Ovi Suite 3.0.0.290):<br
/> <span
id="more-1470"></span></p><p><strong>Important</strong>: before trying the solution below, try downloading and running <a
href="http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/rootsupd.exe" rel="nofollow" >root certificates update program from Microsoft</a>, then restarting Ovi Suite to see if the problem is gone. (Thanks <a
href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html#comment-134937">Finn</a> for sharing this one.)</p><ul><li>Navigate to <em>Start - Control panel - Internet options</em> (or: start Internet Explorer - <em>Tools - Internet options</em>). It doesn't matter that your default browser is not IE.</li><li>Select <em>Content</em> tab.<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/content-tab.png" alt="" title="Content tab" width="413" height="528" class="size-full wp-image-1471" /></li><li>Click <em>Certificates</em>, select <em>Trusted root certification authorities</em> tab, and sort ascending by expiration date.<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/root-certificates.png" alt="" title="root certificates" width="509" height="464" class="size-full wp-image-1472" /></li><li>Now delete all <em>GTE CyberTrust</em> certificates whose expiration date has passed.</li><li>Click <em>Close</em>, then <em>OK</em></li><li>Restart Ovi suite.</li></ul><p>If that didn't help: try removing <strong>all</strong> expired certificates:<br
/> <img
src="http://bogdan.org.ua/wp-content/uploads/2011/03/all-expired.png" alt="" title="all expired" width="509" height="464" class="size-full wp-image-1473" /></p><p><strong>A word of warning</strong></p><blockquote><p>Deleting all expired trusted root certs is not a good idea. You could end up with vital parts of the system not working, or unable to access some documents (especially if you have encryption turned on). Thing is, expired certs can still be valid for anything signed or encrypted before they expired.</p></blockquote><p>Sources used:</p><ul><li><a
href="http://discussions.europe.nokia.com/t5/Nokia-Ovi-Suite/NOKIA-OVI-Suite-could-not-connect-to-the-nokia-account-server/m-p/878427#M8356" rel="nofollow" >http://discussions.europe.nokia.com/t5/Nokia-Ovi-Suite/NOKIA-OVI-Suite-could-not-connect-to-the-nokia-account-server/m-p/878427</a></li><li><a
href="http://betalabs.nokia.com/apps/nokia-ovi-suite-3-0-beta/bugreport/19143/ovi-sign-in-failed#comment-53041" rel="nofollow" >http://betalabs.nokia.com/apps/nokia-ovi-suite-3-0-beta/bugreport/19143/ovi-sign-in-failed</a></li><li><a
href="http://betalabs.nokia.com/node/5251" rel="nofollow" >http://betalabs.nokia.com/node/5251</a></li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F03%2F10%2Fhow-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html&amp;title=How%20to%20fix%3A%20Nokia%20Ovi%20Suite%20could%20not%20connect%20to%20the%20Nokia%20account%20server" id="wpa2a_12"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/03/10/how-to-fix-nokia-ovi-suite-could-not-connect-nokia-account-server.html/feed</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>How to easily install any PyPi/easy_install python module on Debian</title><link>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html</link> <comments>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html#comments</comments> <pubDate>Wed, 16 Feb 2011 17:22:20 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[debianize]]></category> <category><![CDATA[easy_install]]></category> <category><![CDATA[pycassa]]></category> <category><![CDATA[PyPi]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1430</guid> <description><![CDATA[Imagine you need to install pycassa (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu: if you don't have the python-stdeb package: sudo aptitude install python-stdeb pypi-install pycassa That's it. Refer to stdeb readme for more information. You will need that if [...]]]></description> <content:encoded><![CDATA[<p>Imagine you need to install <a
href="https://github.com/pycassa/pycassa" rel="nofollow" >pycassa</a> (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu:</p><ul><li>if you don't have the python-stdeb package: <strong>sudo aptitude install python-stdeb</strong></li><li><strong>pypi-install pycassa</strong></li></ul><p>That's it.</p><p>Refer to <a
href="https://github.com/astraw/stdeb#readme" rel="nofollow" >stdeb readme</a> for more information. You will need that if there are dependencies - which might not be resolved automatically by stdeb.</p><p>Before stdeb, it wasn't exactly trivial to <a
href="http://showmedo.com/videotutorials/video?name=linuxJensMakingDeb" rel="nofollow" >make a .deb from python module</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2011%2F02%2F16%2Fhow-to-easily-install-any-pypi-easy_install-python-module-on-debian.html&amp;title=How%20to%20easily%20install%20any%20PyPi%2Feasy_install%20python%20module%20on%20Debian" id="wpa2a_16"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2011/02/16/how-to-easily-install-any-pypi-easy_install-python-module-on-debian.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to relay outgoing postfix emails via another mail server (e.g. your ISP)</title><link>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html</link> <comments>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html#comments</comments> <pubDate>Sat, 04 Dec 2010 18:01:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[postfix]]></category> <category><![CDATA[relay]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1218</guid> <description><![CDATA[Here's a simple and clear guide for gmail, which also definitely works with other relay hosts. I've used it to configure my ISP's mail relay (they block outgoing port 25) on a Debian Squeeze laptop.]]></description> <content:encoded><![CDATA[<p>Here's a <a
href="http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/" rel="nofollow" >simple and clear guide for gmail</a>, which also definitely works with other relay hosts. I've used it to configure my ISP's mail relay (they block outgoing port 25) on a Debian Squeeze laptop.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F12%2F04%2Fhow-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html&amp;title=How%20to%20relay%20outgoing%20postfix%20emails%20via%20another%20mail%20server%20%28e.g.%20your%20ISP%29" id="wpa2a_20"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/12/04/how-to-relay-outgoing-postfix-emails-via-another-mail-server-isp-gmail.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How to replace newlines with commas, tabs etc (merge lines)</title><link>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html</link> <comments>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html#comments</comments> <pubDate>Tue, 16 Nov 2010 08:20:45 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[awk]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[paste]]></category> <category><![CDATA[sed]]></category> <category><![CDATA[sort]]></category> <category><![CDATA[tr]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1208</guid> <description><![CDATA[Imagine you need to get a few lines from a group of files with missing identifier mappings. I have a bunch of files with content similar to this one: ENSRNOG00000018677 1368832_at 25233 ENSRNOG00000002079 1369102_at 25272 ENSRNOG00000043451 25353 ENSRNOG00000001527 1388013_at 25408 ENSRNOG00000007390 1389538_at 25493 In the example above I need '25353', which does not have corresponding [...]]]></description> <content:encoded><![CDATA[<p>Imagine you need to get a few lines from a group of files with missing identifier mappings. I have a bunch of files with content similar to this one:</p><blockquote><p> ENSRNOG00000018677      1368832_at      25233<br
/> ENSRNOG00000002079      1369102_at      25272<br
/> ENSRNOG00000043451                            25353<br
/> ENSRNOG00000001527      1388013_at      25408<br
/> ENSRNOG00000007390      1389538_at      25493</p></blockquote><p>In the example above I need '25353', which does not have corresponding affy_probeset_id in the 2nd column.</p><p>It is clear how to do that:</p><div
class="igBar"><span
id="lcode-9"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-9'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-9"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span></div></li></ol></div></div></div><p></p><p>This outputs a column of required IDs (EntrezGene in this example):</p><blockquote><p> 116720<br
/> 679845<br
/> 309295<br
/> 364867<br
/> 298220<br
/> 298221<br
/> 25353</p></blockquote><p>However, I need these IDs as a comma-separated list, not as newline-separated list.</p><p>There are several ways to achieve the desired result (only the last pipe commands differ):</p><div
class="igBar"><span
id="lcode-10"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-10"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | gawk <span
style="color:#CC0000;">'$1=$1'</span> ORS=<span
style="color:#CC0000;">', '</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-11"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-11'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-11"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | tr <span
style="color:#CC0000;">'<span
style="color:#000099; font-weight:bold;">\n</span>'</span> <span
style="color:#CC0000;">','</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-12"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-12'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-12"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | sed <span
style="color:#CC0000;">':a;N;$!ba;s/<span
style="color:#000099; font-weight:bold;">\n</span>/, /g'</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-13"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-13'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-13"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | sed <span
style="color:#CC0000;">':q;N;s/<span
style="color:#000099; font-weight:bold;">\n</span>/, /g;t q'</span></div></li></ol></div></div></div><p></p><div
class="igBar"><span
id="lcode-14"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('code-14'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">CODE:</span><div
id="code-14"><div
class="code"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sort -u *_affy_ensembl.<span
style="">txt</span> | grep -v <span
style="color:#CC0000;">'_at'</span> | awk <span
style="color:#CC0000;">'{print $2}'</span> | paste -s -d <span
style="color:#CC0000;">","</span></div></li></ol></div></div></div><p></p><p>These solutions differ in efficiency and (slightly) in output. <strong>sed</strong> will read all the input into its buffer to replace newlines with other separators, so it might not be best for large files. <strong>tr</strong> might be the most efficient, but I haven't tested that. <strong>paste</strong> will re-use delimiters, so you cannot really get comma-space ", " separation with it.</p><p>Sources: <a
href="http://www.linuxquestions.org/questions/programming-9/sed-how-do-you-replace-end-of-line-with-a-space-637013/" rel="nofollow" >linuxquestions 1 (explains used sed commands)</a>, <a
href="http://www.linuxquestions.org/questions/programming-9/merge-lines-in-a-file-using-sed-191121/" rel="nofollow" >linuxquestions 2</a>, <a
href="http://www.cyberciti.biz/faq/linux-unix-sed-replace-newline/" rel="nofollow" >nixcraft</a>.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F11%2F16%2Fhow-to-replace-newlines-with-commas-tabs-etc-merge-lines.html&amp;title=How%20to%20replace%20newlines%20with%20commas%2C%20tabs%20etc%20%28merge%20lines%29" id="wpa2a_24"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/11/16/how-to-replace-newlines-with-commas-tabs-etc-merge-lines.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Batch-retrieve EntrezGene homologs using NCBI&#8217;s HomoloGene and R&#8217;s annotationTools</title><link>http://bogdan.org.ua/2010/10/27/batch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html</link> <comments>http://bogdan.org.ua/2010/10/27/batch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html#comments</comments> <pubDate>Wed, 27 Oct 2010 10:49:01 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[Bioinformatics]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[annotationTools]]></category> <category><![CDATA[HomoloGene]]></category> <category><![CDATA[NCBI]]></category> <category><![CDATA[R]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1168</guid> <description><![CDATA[Install the annotationTools R package: source("http://bioconductor.org/biocLite.R") biocLite("annotationTools") Download full HomoloGene data file from ftp://ftp.ncbi.nlm.nih.gov/pub/HomoloGene/current library(annotationTools) homologene = read.delim("homologene.data", header=FALSE) mygenes = read.table("file with one entrez ID of the source organism per line.txt") getHOMOLOG(unlist(mygenes), taxonomy_ID_of_target_organism, homologene) [alternatively, wrap the call to getHOMOLOG into unlist to get a vector] It might be easier to achieve the same [...]]]></description> <content:encoded><![CDATA[<ol><li>Install the <a
href="http://bioconductor.org/packages/release/bioc/html/annotationTools.html" rel="nofollow" >annotationTools</a> R package:<br
/> source("http://bioconductor.org/biocLite.R")<br
/> biocLite("annotationTools")</li><li>Download full HomoloGene data file from <a
href="ftp://ftp.ncbi.nlm.nih.gov/pub/HomoloGene/current" rel="nofollow" >ftp://ftp.ncbi.nlm.nih.gov/pub/HomoloGene/current</a></li><li>library(annotationTools)</li><li>homologene = read.delim("homologene.data", header=FALSE)</li><li>mygenes = read.table("file with one entrez ID of the source organism per line.txt")</li><li>getHOMOLOG(unlist(mygenes), <a
href="http://www.ncbi.nlm.nih.gov/taxonomy" rel="nofollow" >taxonomy_ID_of_target_organism</a>, homologene) [alternatively, wrap the call to getHOMOLOG into unlist to get a vector]</li></ol><p>It might be easier to achieve the same results with a Perl script calling NCBI's e-utils.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/10/27/batch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/10/27/batch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F10%2F27%2Fbatch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html&amp;title=Batch-retrieve%20EntrezGene%20homologs%20using%20NCBI%E2%80%99s%20HomoloGene%20and%20R%E2%80%99s%20annotationTools" id="wpa2a_28"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/10/27/batch-retrieve-entrezgene-homologs-using-ncbi-homologene-and-r.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Linux: how to label swap partition w/o losing swap UUID</title><link>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html</link> <comments>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html#comments</comments> <pubDate>Fri, 16 Jul 2010 12:41:13 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[swap]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1082</guid> <description><![CDATA[In short: sudo mkswap -L new_swap_label -U old_swap_UUID /dev/sd_swap_device. If you don't care about the UUID: just sudo mkswap -L new_swap_label /dev/sd_swap_device. Step-by-step: Identify current swap UUID: grep swap /etc/fstab ; you should see a line starting with UUID=b4e6e... - note that UUID; let us assume our UUID is b4e6e5d8-8854-4a3e-8edb-f423ded31e2a Identify swap partition device. If [...]]]></description> <content:encoded><![CDATA[<p>In short: <strong>sudo mkswap -L new_swap_label -U old_swap_UUID /dev/sd_swap_device</strong>.<br
/> If you don't care about the UUID: just <strong>sudo mkswap -L new_swap_label /dev/sd_swap_device</strong>.</p><p>Step-by-step:<br
/> <span
id="more-1082"></span></p><ol><li>Identify current swap UUID: <strong>grep swap /etc/fstab</strong> ; you should see a line starting with <strong>UUID=</strong>b4e6e... - note that UUID; let us assume our UUID is <em>b4e6e5d8-8854-4a3e-8edb-f423ded31e2a</em></li><li>Identify swap partition device. If you are using Debian or Ubuntu, device might have been shown to you when running command #1 as a comment of the form<br
/><blockquote># /dev/sdX4       none            swap    sw              0       0</p></blockquote><p> Just to be sure, run <strong>cat /proc/swaps</strong> (or <strong>sudo swapon -s</strong>), to be shown something like this:</p><p><code>Filename                                Type            Size    Used    Priority<br
/> /dev/sdX4                               partition       2104504 0       -1<br
/> </code><br
/> You can also use partition managers to identify swap device, e.g. <strong>sudo fdisk -l</strong>. Let us assume our partition device is <em>sdX4</em>.</li><li>If that swap partition is in use, you need to disable it first: <strong>sudo swapoff /dev/sdX4</strong></li><li>Now that you have both the UUID and the device, run<br
/> <strong>sudo mkswap -L new_swap_label -U b4e6e5d8-8854-4a3e-8edb-f423ded31e2a /dev/sdX4</strong><br
/> Do not forget replacing sample values above (label, UUID and device) with your actual values.</li><li>Enable swap: <strong>sudo swapon /dev/sdX4</strong></li></ol><p>Now, if you wish so, you may proceed to edit /etc/fstab and replace UUID=.... with LABEL=your_new_swap_label, leaving all other spaces and values in that line untouched.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F07%2F16%2Flinux-how-to-label-swap-partition-without-losing-swap-uuid.html&amp;title=Linux%3A%20how%20to%20label%20swap%20partition%20w%2Fo%20losing%20swap%20UUID" id="wpa2a_32"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/07/16/linux-how-to-label-swap-partition-without-losing-swap-uuid.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ntfstruncate binary for Debian (resetting NTFS bad clusters counter)</title><link>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html</link> <comments>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html#comments</comments> <pubDate>Mon, 01 Mar 2010 16:55:56 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[bad clusters]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[linux-ntfs]]></category> <category><![CDATA[NTFS]]></category> <category><![CDATA[ntfsprogs]]></category> <category><![CDATA[ntfstruncate]]></category> <category><![CDATA[partition]]></category> <category><![CDATA[pending sectors]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=1000</guid> <description><![CDATA[There is an excellent step-by-step instruction on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I've checked - it works as expected: Back up important data from partition just in case Find out size of '$Bad' attribute in $Badclus using ntfsinfo -i 8 partition (partition is for example /dev/sda1). It will [...]]]></description> <content:encoded><![CDATA[<p>There is an <a
href="http://www.linux-ntfs.org/doku.php?id=ntfsclone#reseting_the_bad_sectors_list_after_cloning" rel="nofollow" >excellent step-by-step instruction</a> on resetting the bad clusters counter of an NTFS partition with linux-ntfs tools. I've checked - it works as expected:</p><blockquote><ol><li>Back up important data from partition just in case</li><li>Find out size of '$Bad' attribute in $Badclus using <strong>ntfsinfo -i 8 <em>partition</em></strong> (<em>partition</em> is for example /dev/sda1). It will be the “Allocated size” value in the “Dumping attribute $DATA (0<code>x</code>80)” (there will be two 0<code>x</code>80 attributes. Only one has an “Allocated size” line). Let us write down (remember) this size as <em>ntfs_size</em>.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 '$Bad' 0</strong> to set $Bad's attribute length to zero.</li><li>Use <strong>ntfstruncate <em>partition</em> 8 0<code>x</code>80 '$Bad' <em>ntfs_size</em></strong> to set $Bad's attribute length back to proper value <em>ntfs_size</em> which was recorded in step 2.</li><li>Boot into Windows and run <strong>chkdsk -f <em>diskname</em></strong>. It will find errors and should fix them.</li></ol></blockquote><p>However, Debian's <strong>ntfsprogs</strong> package does not have the <strong>ntfstruncate</strong> binary.</p><p>Here's how you can easily build one yourself (you may need a few extra packages with build tools for that):<br
/> <span
id="more-1000"></span></p><ol><li><strong>apt-get source ntfsprogs</strong></li><li><strong>cd linux-ntfs-2.0.0</strong></li><li><strong>./configure &#038;& make extra</strong></li><li><strong>cd ntfsprogs &#038;& ./ntfstruncate</strong></li></ol><p>You can also install ntfstruncate system-wide, but I have no idea if that will interfere with the already-installed ntfsprogs package, so I just used this binary directly from linux-ntfs-2.0.0/ntfsprogs.</p><p>Bad clusters happen not only when cloning an NTFS partition between 2 physical hard disk drives. Once, after a brief blackout (with a turned on PC, and not on a UPS), the SMART status of my new HDD started showing 1 'Pending sector'. Correspondingly, all the SMART tests (performed with a <strong>smartctl</strong> utility) reported read errors. To help my HDD examine and fix the problem itself, I performed a write operation to that single unreadable sector, which restored it (and reset the 'Pending sector' counter back to zero). It was possible, because not the physical sector itself, but the hidden CRC field had errors after power failure; modern hard drives can detect and fix this kind of errors upon write operations (read operations only mark the sector as 'pending', because data read is not consistent with the stored CRC).</p><p>However, NTFS partition still had 4096 bytes in 'bad clusters'. A little research revealed the presence of internal NTFS bad clusters counter, which can be reset following the procedures above.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2010%2F03%2F01%2Fntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html&amp;title=ntfstruncate%20binary%20for%20Debian%20%28resetting%20NTFS%20bad%20clusters%20counter%29" id="wpa2a_36"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2010/03/01/ntfstruncate-binary-for-debian-resetting-ntfs-bad-clusters-counter.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Search and replace in a MySQL table</title><link>http://bogdan.org.ua/2009/10/27/search-and-replace-in-a-mysql-table.html</link> <comments>http://bogdan.org.ua/2009/10/27/search-and-replace-in-a-mysql-table.html#comments</comments> <pubDate>Tue, 27 Oct 2009 07:37:34 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[mysql]]></category> <category><![CDATA[replace]]></category> <category><![CDATA[search]]></category> <category><![CDATA[snippet]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=917</guid> <description><![CDATA[This query performs a table-wide search-and-repalce: UPDATE `table_name` SET `table_field` = REPLACE(`table_field`,'string to search for and replace','replacement string'); If you need a database-wide search-and-replace, you could try this script (I haven't tested/used it myself). Beware of the following gotchas: wrong query syntax may ruin the field you are performing replace on, so always backup first! [...]]]></description> <content:encoded><![CDATA[<p>This query performs a table-wide search-and-repalce:</p><blockquote><p>UPDATE `table_name` SET `table_field` = REPLACE(`table_field`,'string to search for and replace','replacement string');</p></blockquote><p>If you need a database-wide search-and-replace, you could try <a
href="http://blog.irmsgeekwork.com/phpmysql-full-database-search-and-replace" rel="nofollow" >this script</a> (I haven't tested/used it myself).</p><p>Beware of the following gotchas:</p><ol><li>wrong query syntax may ruin the field you are performing replace on, so <strong>always backup first!</strong></li><li>be sure to provide "search-for" string as specific as possible, or you will get<strong> unexpected replacements</strong> (e.g. replacing <em>mini</em> with <em>little</em> will also convert all <em>minivans</em> into <em>littlevans</em>); also, do use WHERE clause when necessary to limit the number of rows modified</li><li>the function in the example is <strong>case-sensitive</strong>, so replacing all <em>minivans</em> with <em>vehicles</em> won't replace <em>Minivans</em>. However, I believe there exists a case-insensitive version of REPLACE function</li></ol><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/27/search-and-replace-in-a-mysql-table.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/27/search-and-replace-in-a-mysql-table.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F10%2F27%2Fsearch-and-replace-in-a-mysql-table.html&amp;title=Search%20and%20replace%20in%20a%20MySQL%20table" id="wpa2a_40"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/10/27/search-and-replace-in-a-mysql-table.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>R under Debian testing/i386: permanently set pdfviewer option</title><link>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html</link> <comments>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html#comments</comments> <pubDate>Wed, 21 Oct 2009 14:06:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[pdfviewer]]></category> <category><![CDATA[R]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=909</guid> <description><![CDATA[If you get this message when opening vignettes: Error in openPDF(vif) : getOption('pdfviewer') is ''; please use 'options(pdfviewer=...)' and you are tired of running this command every time: > options(pdfviewer="okular") then you should check if your system-wide Renviron file has proper PDF viewer set: grep -i pdf /etc/R/Renviron R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/bin/pdflatex'}} R_RD4PDF=${R_RD4PDF-'times,hyper'} ## Default PDF viewer R_PDFVIEWER=${R_PDFVIEWER-''} [...]]]></description> <content:encoded><![CDATA[<p>If you get this message when opening vignettes:</p><blockquote><p>Error in openPDF(vif) :<br
/> getOption('pdfviewer') is ''; please use 'options(pdfviewer=...)'</p></blockquote><p>and you are tired of running this command every time:</p><blockquote><p>> options(pdfviewer="okular")</p></blockquote><p>then you should check if your system-wide <strong>Renviron</strong> file has proper PDF viewer set:<br
/> <span
id="more-909"></span><br
/> <strong>grep -i pdf /etc/R/Renviron</strong></p><blockquote><p>R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/bin/pdflatex'}}<br
/> R_RD4PDF=${R_RD4PDF-'times,hyper'}<br
/> ## Default PDF viewer<br
/> R_PDFVIEWER=${R_PDFVIEWER-''}</p></blockquote><p>It wasn't in my case.</p><p>To set one, either edit the system-wide Renviron (e.g. by editing the <strong>R_PDFVIEWER=${R_PDFVIEWER-''}</strong> line to look like <strong>R_PDFVIEWER=${R_PDFVIEWER-'/usr/bin/xdg-open'}</strong> - this will use MIME types to open your preferred PDF viewer), or one of the per-user/per-directory Renviron files to fix this minor annoyance (format is the same, e.g. R_PDFVIEWER=okular ).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F10%2F21%2Fr-under-debian-testingi386-permanently-set-pdfviewer-option.html&amp;title=R%20under%20Debian%20testing%2Fi386%3A%20permanently%20set%20pdfviewer%20option" id="wpa2a_44"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/10/21/r-under-debian-testingi386-permanently-set-pdfviewer-option.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>IOMMU: This costs you 64 MB of RAM</title><link>http://bogdan.org.ua/2009/09/30/iommu-this-costs-you-64-mb-of-ram.html</link> <comments>http://bogdan.org.ua/2009/09/30/iommu-this-costs-you-64-mb-of-ram.html#comments</comments> <pubDate>Wed, 30 Sep 2009 12:36:34 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[AGP]]></category> <category><![CDATA[AMD]]></category> <category><![CDATA[amd64]]></category> <category><![CDATA[GART]]></category> <category><![CDATA[IOMMU]]></category> <category><![CDATA[kernel]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[RAM]]></category> <category><![CDATA[x86_64]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=853</guid> <description><![CDATA[If you have happened to observe similar messages in your dmesg: [ 0.004000] Checking aperture... [ 0.004000] No AGP bridge found [ 0.004000] Node 0: aperture @ 20000000 size 32 MB [ 0.004000] Aperture pointing to e820 RAM. Ignoring. [ 0.004000] Your BIOS doesn't leave a aperture memory hole [ 0.004000] Please enable the IOMMU [...]]]></description> <content:encoded><![CDATA[<p>If you have happened to observe similar messages in your dmesg:</p><p><img
src="http://bogdan.org.ua/wp-content/uploads/2009/09/aperture.png" alt="aperture" title="aperture" width="540" height="184" class="aligncenter size-full wp-image-862" /></p><blockquote><p>[    0.004000] Checking aperture...<br
/> [    0.004000] No AGP bridge found<br
/> [    0.004000] Node 0: aperture @ 20000000 size 32 MB<br
/> [    0.004000] Aperture pointing to e820 RAM. Ignoring.<br
/> [    0.004000] Your BIOS doesn't leave a aperture memory hole<br
/> [    0.004000] Please enable the IOMMU option in the BIOS setup<br
/> [    0.004000] <strong>This costs you 64 MB of RAM</strong><br
/> [    0.004000] Mapping aperture over 65536 KB of RAM @ 20000000</p></blockquote><p>and you are using AMD-based system w/o AGP video, then my advice is: <strong>just leave that as is, do not bother "improving"</strong>! Any tinkering with kernel boot options won't do you any good, as the kernel has already done the best it could.</p><p>Just a note: all those messages at the top of the post should only happen if you have 4 or more GiBs of RAM. If you have less than that, and do have those messages – my experience might be inappropriate for your case.</p><p>Another note: my BIOS does not have any IOMMU settings (or “Memory hole remapping” settings), so I didn’t try that. You should check if your BIOS has IOMMU-related options first, just as kernel message suggests.</p><p>Read on for details.<br
/> <span
id="more-853"></span><br
/> My system's kernel at the moment of writing is 2.6.30-1-amd64 (Debian testing), running on MSI's 790GX-G65 with integrated Radeon HD 3300 video, with 4 GiB DDR3 RAM and a quad-core Phenom II CPU.</p><p>Following are the options you <strong>shouldn't try</strong> on a similar system:</p><ul><li>passing <strong>iommu=noagp</strong> kernel boot option. If you run <strong>dmesg|grep -i agp</strong>, most likely you will see something in the lines of<br
/><blockquote><p>$ dmesg|grep -i agp<br
/> [    0.004000] No AGP bridge found<br
/> [    0.392098] PCI-DMA: Disabling AGP.<br
/> [    0.392142] PCI-DMA: Reserving 64MB of IOMMU area in the AGP aperture<br
/> [    0.774847] Linux agpgart interface v0.103</p></blockquote><p>which tells you that your kernel has automatically discovered the absence of AGP bridge, disabled it and is using 64MB of AGP aperture for IOMMU. On my system, adding that boot option had no effect.</li><li>passing <strong>iommu=off</strong> kernel boot option. When I did this, there were loads of "nommu overflow" errors during boot, so I didn't wait until GDM start and rebooted immediately. Clearly, tons of "overflow" errors won't do any better than a harmless "This costs you 64 MB of RAM". Also, systems with over 3 GiB RAM do need IOMMU.</li><li>passing <strong>iommu=noaperture</strong> kernel boot option. On my system, this option has taken 1 more MiB from my available RAM (as reported by <strong>free -m</strong> or <strong>htop</strong>), and also enabled software double-buffering IOMMU method (in <strong>dmesg</strong>, a string similar to <strong>SW TIOLB</strong>). Performance-wise this is worse than AMD's GART-based IOMMU, and you loose 1 more MiB of RAM <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , so don't do this.</li><li>passing <strong>iommu=noagp,noaperture</strong> for me had the same effect as passing <strong>iommu=noaperture</strong> alone, for the reason from point #1 of this list.</li><li>I haven't tried any of the <strong>memaper=[1|2|3|...]</strong> options, as I had no problems with the default 64 MiB.</li><li>passing <strong>mem=4G</strong> may remove that message (I do not recollect if it did for me), but will eat a good deal more of your available RAM (might be because devices are now mapped within those 4G, and not above). So don't do this.</li></ul><p>I'm not aware of any other solutions to the missing 64 MiB RAM message. There were notices of using <strong>pci=nommconf</strong> boot option, but that is too much for such a simple message - unless you have problems booting.</p><p>Below I'm pasting IOMMU-relevant part of the <strong>linux-source-2.6.30/Documentation/x86/x86_64/boot-options.txt</strong> file, which I believe is the source of ultimate knowledge <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> You should read that file whenever you feel like tinkering with boot options of your AMD64 machine.</p><p>I ***highlighted*** some fragments, to support the points from the list above.</p><pre>IOMMU (input/output memory management unit)
 Currently four x86-64 PCI-DMA mapping implementations exist:
   1. <arch/x86_64/kernel/pci-nommu.c>: use ***no hardware/software IOMMU at all***
      (e.g. ***because you have < 3 GB memory***).
      Kernel boot message: "PCI-DMA: Disabling IOMMU"
   2. <arch/x86_64/kernel/pci-gart.c>: ***AMD GART based hardware IOMMU***.
      Kernel boot message: "PCI-DMA: using GART IOMMU"
   3. <arch/x86_64/kernel/pci-swiotlb.c> : Software IOMMU implementation. Used
      e.g. ***if there is no hardware IOMMU*** in the system and it is need because
      you have ***>3GB memory*** or told the kernel to us it (iommu=soft))
      Kernel boot message: "PCI-DMA: Using software bounce buffering
      for IO (SWIOTLB)"
   4. <arch/x86_64/pci-calgary.c> : IBM Calgary hardware IOMMU. Used in IBM
      ***pSeries and xSeries servers***. This hardware IOMMU supports DMA address
      mapping with memory protection, etc.
      Kernel boot message: "PCI-DMA: Using Calgary IOMMU"
 iommu=[<size>][,noagp][,off][,force][,noforce][,leak[=<nr_of_leak_pages>]
	[,memaper[=<order>]][,merge][,forcesac][,fullflush][,nomerge]
	[,noaperture][,calgary]
  General iommu options:
    off                Don't initialize and use any kind of IOMMU.
    noforce            Don't force hardware IOMMU usage when it is not needed.
                       (default).
    force              Force the use of the hardware IOMMU even when it is
                       not actually needed (e.g. because < 3 GB memory).
    soft               Use software bounce buffering (SWIOTLB) (default for
                       Intel machines). This can be used to prevent the usage
                       of an available hardware IOMMU.
  iommu options only relevant to the AMD GART hardware IOMMU:
    <size>             Set the size of the remapping area in bytes.
    allowed            Overwrite iommu off workarounds for specific chipsets.
    fullflush          Flush IOMMU on each allocation (default).
    nofullflush        Don't use IOMMU fullflush.
    leak               Turn on simple iommu leak tracing (only when
                       CONFIG_IOMMU_LEAK is on). Default number of leak pages
                       is 20.
    memaper[=<order>]  Allocate an own aperture over RAM with size 32MB<<order.
                       (default: order=1, i.e. 64MB)
    merge              Do scatter-gather (SG) merging. Implies "force"
                       (experimental).
    nomerge            Don't do scatter-gather (SG) merging.
    noaperture         Ask the IOMMU not to touch the aperture for AGP.
    forcesac           Force single-address cycle (SAC) mode for masks <40bits
                       (experimental).
    noagp              Don't initialize the AGP driver and use full aperture.
    allowdac           Allow double-address cycle (DAC) mode, i.e. DMA >4GB.
                       DAC is used with 32-bit PCI to push a 64-bit address in
                       two cycles. When off all DMA over >4GB is forced through
                       an IOMMU or software bounce buffering.
    nodac              Forbid DAC mode, i.e. DMA >4GB.
    panic              Always panic when IOMMU overflows.
    calgary            Use the Calgary IOMMU if it is available
  iommu options only relevant to the software bounce buffering (SWIOTLB) IOMMU
  implementation:
    swiotlb=
<pages>[,force]
<pages>            Prereserve that many 128K pages for the software IO
                       bounce buffering.
    force              Force all IO through the software TLB.
  Settings for the IBM Calgary hardware IOMMU currently found in IBM
  pSeries and xSeries machines:
    calgary=[64k,128k,256k,512k,1M,2M,4M,8M]
    calgary=[translate_empty_slots]
    calgary=[disable=<PCI bus number>]
    panic              Always panic when IOMMU overflows
    64k,...,8M - Set the size of each PCI slot's translation table
    when using the Calgary IOMMU. This is the size of the translation
    table itself in main memory. The smallest table, 64k, covers an IO
    space of 32MB; the largest, 8MB table, can cover an IO space of
    4GB. Normally the kernel will make the right choice by itself.
    translate_empty_slots - Enable translation even on slots that have
    no devices attached to them, in case a device will be hotplugged
    in the future.
    disable=<PCI bus number> - Disable translation on a given PHB. For
    example, the built-in graphics adapter resides on the first bridge
    (PCI bus number 0); if translation (isolation) is enabled on this
    bridge, X servers that access the hardware directly from user
    space might stop working. Use this option if you have devices that
    are accessed from userspace directly on some PCI host bridge.</pre><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/09/30/iommu-this-costs-you-64-mb-of-ram.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/09/30/iommu-this-costs-you-64-mb-of-ram.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F09%2F30%2Fiommu-this-costs-you-64-mb-of-ram.html&amp;title=IOMMU%3A%20This%20costs%20you%2064%20MB%20of%20RAM" id="wpa2a_48"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/09/30/iommu-this-costs-you-64-mb-of-ram.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>C: how to specify comparison operators floating precision</title><link>http://bogdan.org.ua/2009/06/11/c-how-to-specify-comparison-operators-floating-precision.html</link> <comments>http://bogdan.org.ua/2009/06/11/c-how-to-specify-comparison-operators-floating-precision.html#comments</comments> <pubDate>Thu, 11 Jun 2009 17:47:37 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[C]]></category> <category><![CDATA[comparison]]></category> <category><![CDATA[double]]></category> <category><![CDATA[example]]></category> <category><![CDATA[float]]></category> <category><![CDATA[floating]]></category> <category><![CDATA[operator]]></category> <category><![CDATA[precision]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=774</guid> <description><![CDATA[There is no way I'm aware of to do what the title says. However... I'm sure that you are aware of the fact that floats representation in any programming language is limited by the precision of the internal binary representations. In other words, you can never have an exact float representation - there will always [...]]]></description> <content:encoded><![CDATA[<p>There is no way I'm aware of to do what the title says. However...</p><p>I'm sure that you are aware of the fact that floats representation in any programming language is limited by the precision of the internal binary representations. In other words, you can never have an <strong>exact</strong> float representation - there will always be some precision associated with the float you are working with. The simplest example is the difference in precision between the <em>float</em> and <em>double</em> types in <strong>C</strong>.</p><p>Suppose I have the following code fragment:</p><div
class="igBar"><span
id="lc-18"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('c-18'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">C:</span><div
id="c-18"><div
class="c"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color: #b1b100;">if</span> <span
style="color: #66cc66;">&#40;</span> result.<span
style="color: #202020;">score</span> &gt;= input-&gt;raw_cut_off <span
style="color: #66cc66;">&#41;</span></div></li></ol></div></div></div><p></p><p>Both <em>result.score</em> and <em>input->raw_cut_off</em> are of type <strong>float</strong>, and can have positive and negative values. When compared with the greater than or equal ( >= ) operator, it is not always that condition is true - for the precision reasons shortly mentioned above.</p><p>As I already said, there is no precision specification for equality operators in <strong>C</strong>. But it is quite simple to "invent" precision specification; e.g. if I wanted to test for equality only, I could write</p><div
class="igBar"><span
id="lc-19"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('c-19'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">C:</span><div
id="c-19"><div
class="c"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color: #b1b100;">if</span> <span
style="color: #66cc66;">&#40;</span> fabsf<span
style="color: #66cc66;">&#40;</span> result.<span
style="color: #202020;">score</span> - input-&gt;raw_cut_off <span
style="color: #66cc66;">&#41;</span> &lt; <span
style="color: #cc66cc;color:#800000;">0</span>.<span
style="color: #cc66cc;color:#800000;">000001</span> <span
style="color: #66cc66;">&#41;</span></div></li></ol></div></div></div><p></p><p>In this example, I'm effectively asking for 6-digit precision for the equality comparison of floating-point values. Note, that if you replace that 0.000001 with the actual precision limit of the floating type you are using, you will be "exactly" comparing floating-point numbers - up to that type's precision, of course <img
src='http://bogdan.org.ua/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p><p>The first-most example with the >= operator can be rewritten as</p><div
class="igBar"><span
id="lc-20"><a
href="#" rel="nofollow"  onclick="javascript:showPlainTxt('c-20'); return false;">PLAIN TEXT</a></span></div><div
class="syntax_hilite"><span
class="langName">C:</span><div
id="c-20"><div
class="c"><ol><li
style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div
style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span
style="color: #b1b100;">if</span> <span
style="color: #66cc66;">&#40;</span> result.<span
style="color: #202020;">score</span> &gt; <span
style="color: #66cc66;">&#40;</span> input-&gt;raw_cut_off - precision<span
style="color: #66cc66;">&#41;</span> <span
style="color: #66cc66;">&#41;</span></div></li></ol></div></div></div><p> where <em>precision</em> is exactly what it is named, e.g. <em>precision</em> = 0.000001.</p><p>Sources used:</p><ul><li>comment by <a
href="http://bytes.com/topic/c-sharp/answers/233215-float-double-arithmetic-precision-error#post953273" rel="nofollow" >Randy A. Ynchausti</a></li><li><a
href="http://www.shokhirev.com/nikolai/abc/sciprog/sciprognum.html" rel="nofollow" >scientific programming</a></li></ul><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/06/11/c-how-to-specify-comparison-operators-floating-precision.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/06/11/c-how-to-specify-comparison-operators-floating-precision.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F06%2F11%2Fc-how-to-specify-comparison-operators-floating-precision.html&amp;title=C%3A%20how%20to%20specify%20comparison%20operators%20floating%20precision" id="wpa2a_52"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/06/11/c-how-to-specify-comparison-operators-floating-precision.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Best method to recursively chmod/process files or directories</title><link>http://bogdan.org.ua/2009/06/08/best-method-to-recursively-chmodprocess-files-or-directories.html</link> <comments>http://bogdan.org.ua/2009/06/08/best-method-to-recursively-chmodprocess-files-or-directories.html#comments</comments> <pubDate>Mon, 08 Jun 2009 14:33:51 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[chmod]]></category> <category><![CDATA[find]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[recursive]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=746</guid> <description><![CDATA[Found here. Recursively set directories only to drwx-rx-rx (755): find . -type d -exec chmod 755 {} \; Recursively set files only to rwx-r-r (644): find . -type f -exec chmod 644 {} \; Recursively remove carriage returns (^M) from the end of all *.php files: find . -type f -name "*.php" -exec /home/user/dos2unix.sh {} [...]]]></description> <content:encoded><![CDATA[<p>Found <a
href="http://movabletripe.com/archive/recursively-chmod-directories-only/#comment-50718" rel="nofollow" >here</a>.</p><p>Recursively set directories only to drwx-rx-rx (755):</p><blockquote><p>find . -type d -exec chmod 755 {} \;</p></blockquote><p>Recursively set files only to rwx-r-r (644):</p><blockquote><p>find . -type f -exec chmod 644 {} \;</p></blockquote><p>Recursively remove carriage returns (^M) from the end of all *.php files:</p><blockquote><p>find . -type f -name "*.php" -exec /home/user/<a
href="http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html">dos2unix.sh</a> {} \;</p></blockquote><p>In all these cases, <strong>{}</strong> is replaced with the filename/directory <strong>find</strong> has found matching your parameters; <strong>\;</strong> at the end just stops <strong>exec</strong> processing.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/06/08/best-method-to-recursively-chmodprocess-files-or-directories.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/06/08/best-method-to-recursively-chmodprocess-files-or-directories.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F06%2F08%2Fbest-method-to-recursively-chmodprocess-files-or-directories.html&amp;title=Best%20method%20to%20recursively%20chmod%2Fprocess%20files%20or%20directories" id="wpa2a_56"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/06/08/best-method-to-recursively-chmodprocess-files-or-directories.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>SQL injection walkthrough</title><link>http://bogdan.org.ua/2009/05/11/sql-injection-walkthrough.html</link> <comments>http://bogdan.org.ua/2009/05/11/sql-injection-walkthrough.html#comments</comments> <pubDate>Mon, 11 May 2009 13:41:22 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Web]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[injection]]></category> <category><![CDATA[security]]></category> <category><![CDATA[sql]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=697</guid> <description><![CDATA[SecuriTeam has an old, but still very useful article on SQL injection. I've created a PDF of that article, containing some of the comments (all the 'thank-you' and 'help-me-hack' comments were removed): sql injection walkthrough pdf download. Note: there were no specific license terms attached to the article; I believe that the word "free" on [...]]]></description> <content:encoded><![CDATA[<p>SecuriTeam has an old, but still very useful article on <a
href="http://www.securiteam.com/securityreviews/5DP0N1P76E.html" rel="nofollow" >SQL injection</a>.</p><p>I've created a PDF of that article, containing some of the comments (all the 'thank-you' and 'help-me-hack' comments were removed): <a
href="http://bogdan.org.ua/wp-content/uploads/2009/05/sql-injection-walkthrough.pdf">sql injection walkthrough pdf download</a>.</p><p><del
datetime="2009-05-13T08:16:21+00:00">Note: there were no specific license terms attached to the article; I believe that the word "free" on the SecuriTeam site logo refers to the "right of free use and copying". If you know this is not the case - please let me know to remove this PDF from public access.</del> (see Brian's comment)</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/05/11/sql-injection-walkthrough.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/05/11/sql-injection-walkthrough.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F05%2F11%2Fsql-injection-walkthrough.html&amp;title=SQL%20injection%20walkthrough" id="wpa2a_60"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/05/11/sql-injection-walkthrough.html/feed</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Using FTP usernames with @-symbol in midnight commander</title><link>http://bogdan.org.ua/2009/05/07/using-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html</link> <comments>http://bogdan.org.ua/2009/05/07/using-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html#comments</comments> <pubDate>Thu, 07 May 2009 12:44:07 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[ftp]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[mc]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=691</guid> <description><![CDATA[MC is a console file manager. It supports FTP connections, and in my experience is faster in FTP than both Krusader and Gnome Commander. However, the default FTP connection format string [username[:password]@]hostname has a drawback of not allowing the use of usernames with '@'-symbol in them - which is very common for virtual hostings. One [...]]]></description> <content:encoded><![CDATA[<p><abbr
title="midnight commander">MC</abbr> is a console file manager. It supports FTP connections, and in my experience is faster in FTP than both Krusader and Gnome Commander.</p><p>However, the default FTP connection format string [username[:password]@]hostname has a drawback of not allowing the use of usernames with '@'-symbol in them - which is very common for virtual hostings.</p><p>One of the solutions is (done in your home directory):</p><ol><li>if there is no <strong>.netrc</strong> file in your home directory -- <strong>touch  .netrc &#038;& chmod 600  .netrc</strong></li><li><strong>mcedit  .netrc</strong> (or use vi, nano, or any other editor you prefer)</li><li>add the following line to the file (replace all-caps words with your actual credentials): <strong>machine HOSTNAME login USER@HOSTNAME password PASSWORD</strong></li></ol><p>Now, start MC, choose FTP connect, and enter only the hostname. You will be automatically logged in to the remote FTP.<br
/> This will also work for console ftp clients like lftp.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/05/07/using-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/05/07/using-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F05%2F07%2Fusing-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html&amp;title=Using%20FTP%20usernames%20with%20%40-symbol%20in%20midnight%20commander" id="wpa2a_64"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/05/07/using-ftp-usernames-with-at-symbol-mc-midnight-commander-how-to.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Linux: how to remove trailing ^M (carriage return)</title><link>http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html</link> <comments>http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html#comments</comments> <pubDate>Mon, 30 Mar 2009 09:43:11 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Notepad]]></category> <category><![CDATA[carriage return]]></category> <category><![CDATA[files]]></category> <category><![CDATA[linux]]></category> <category><![CDATA[multiple]]></category> <category><![CDATA[remove]]></category> <category><![CDATA[trailing space]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=640</guid> <description><![CDATA[Imagine you have some styles.css transferred from Win machine to Linux via FTP in binary mode instead of ASCII mode; then cat styles.css &#124; tr -d &#34;\r&#34; > styles-nocarriage.css will create styles-nocarriage.css with ^M's removed. Alternative syntax: tr -d &#34;\r&#34; < styles.css > styles-nocarriage.css Most editors have global replace features which allow to get rid [...]]]></description> <content:encoded><![CDATA[<p>Imagine you have some <strong>styles.css</strong> transferred from Win machine to Linux via FTP in binary mode instead of ASCII mode; then</p><blockquote><p>cat styles.css | tr -d &quot;\r&quot; > styles-nocarriage.css</p></blockquote><p>will create<strong> styles-nocarriage.css</strong> with ^M's removed.</p><p>Alternative syntax:</p><blockquote><p>tr -d &quot;\r&quot; < styles.css > styles-nocarriage.css</p></blockquote><p>Most editors have global replace features which allow to get rid of control characters using regular expressions (exact instructions are editor-specific).</p><p>For <strong>multiple files</strong>, try this:</p><blockquote><p> for f<br
/> do<br
/> mv $f ${f}~ &amp;&amp; tr -d &quot;\r&quot; <${f}~ >$f<br
/> rm ${f}~<br
/> done</p></blockquote><p>Save this shell script as a file (e.g. <strong>dos2unix.sh</strong>), then do <strong>./dos2unix.sh</strong> <em><filename(s)></em>. This script accepts wildcards (e.g. <strong>./dos2unix.sh *.php</strong>), so be careful!</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F30%2Flinux-how-to-remove-trailing-control-m-carriage-return.html&amp;title=Linux%3A%20how%20to%20remove%20trailing%20%5EM%20%28carriage%20return%29" id="wpa2a_68"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/03/30/linux-how-to-remove-trailing-control-m-carriage-return.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to create custom Affymetrix CDF file</title><link>http://bogdan.org.ua/2009/03/23/how-to-create-custom-affymetrix-cdf-file.html</link> <comments>http://bogdan.org.ua/2009/03/23/how-to-create-custom-affymetrix-cdf-file.html#comments</comments> <pubDate>Mon, 23 Mar 2009 12:01:41 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[how-to]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[Science]]></category> <category><![CDATA[affy]]></category> <category><![CDATA[Affymetrix]]></category> <category><![CDATA[annotation]]></category> <category><![CDATA[CDF]]></category> <category><![CDATA[R]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=631</guid> <description><![CDATA[First, learn about custom CDFs and why they are needed. The aroma.affymetrix R package google group has a how-to: create a CDF annotation file from scratch. Also useful: how to convert CDF into an R package, which has all CDF data available (as a PDF with more details).]]></description> <content:encoded><![CDATA[<p>First, learn about <a
href="http://brainarray.mbni.med.umich.edu/Brainarray/Database/CustomCDF/cdfreadme.htm#Reasons_for_generating_custom_CDF_files_for_Affymetrix_GeneChips_" rel="nofollow" >custom <abbr
title="Chip Description File">CDF</abbr>s</a> and why they are needed.</p><p>The <a
href="http://groups.google.com/group/aroma-affymetrix" rel="nofollow" >aroma.affymetrix R package</a> google group has a <a
href="http://groups.google.com/group/aroma-affymetrix/web/creating-cdf-files-from-scratch" rel="nofollow" >how-to: create a CDF annotation file from scratch</a>.</p><p>Also useful: <a
href="http://rss.acs.unt.edu/Rdoc/library/makecdfenv/html/make.cdf.package.html" rel="nofollow" class="broken_link">how to convert CDF into an R package</a>, which has all CDF data available (as a PDF with <a
href="http://www.bioconductor.org/packages/2.3/bioc/vignettes/makecdfenv/inst/doc/makecdfenv.pdf" rel="nofollow" >more details</a>).</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/23/how-to-create-custom-affymetrix-cdf-file.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/23/how-to-create-custom-affymetrix-cdf-file.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F23%2Fhow-to-create-custom-affymetrix-cdf-file.html&amp;title=How%20to%20create%20custom%20Affymetrix%20CDF%20file" id="wpa2a_72"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/03/23/how-to-create-custom-affymetrix-cdf-file.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Intel i915 integrated graphics under Debian: how to get rid of sluggish 2D performance</title><link>http://bogdan.org.ua/2009/03/02/intel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html</link> <comments>http://bogdan.org.ua/2009/03/02/intel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html#comments</comments> <pubDate>Mon, 02 Mar 2009 20:41:03 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[Hardware]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Debian]]></category> <category><![CDATA[driver]]></category> <category><![CDATA[i915]]></category> <category><![CDATA[performance]]></category> <category><![CDATA[slow]]></category> <category><![CDATA[video]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=623</guid> <description><![CDATA[I assume you already have configured and working desktop environment, but want to improve performance. First of all, sudo aptitude install mesa-utils. Then run in a Terminal/Konsole glxgears, and wait for ~15 seconds; if your FPS is ~400 or less, then you do have sluggish video performance (usually manifesting itself as slow scrolling in Firefox/Iceweasel, [...]]]></description> <content:encoded><![CDATA[<p>I assume you already have configured and working desktop environment, but want to improve performance.</p><p>First of all, <strong>sudo aptitude install mesa-utils</strong>. Then run in a Terminal/Konsole <strong>glxgears</strong>, and wait for ~15 seconds; if your FPS is ~400 or less, then you do have sluggish video performance (usually manifesting itself as slow scrolling in Firefox/Iceweasel, slow window switching/minimziing/maximizing etc).</p><p>After reading through several forums and bug reports and blog posts, I've ended with the following modifications to my <strong>/etc/X11/xorg.conf</strong>:<br
/> <span
id="more-623"></span></p><ol><li>backup your current xorg.conf: <strong>sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.before-exa</strong></li><li>open your /etc/X11/xorg.conf with a favourite editor; I've added these lines to section "module":<br
/><blockquote><p> Load "dbe"<br
/> Load "xtrap"<br
/> Load "record"<br
/> Load "GLcore"</p></blockquote><p>These are <strong>not</strong> really <strong>performance-related</strong> and could be skipped; I'm giving them here, because they were suggested as default entries by dexconf or some other xorg.conf-generator utility. Again - they are not supposed to improve performance, so you can skip these.</li><li>my "Device" section is now:<br
/><blockquote><p> Section "Device"<br
/> Identifier	"Intel Corporation 82915G/GV/910GL Integrated Graphics Controller"<br
/> BoardName	"82915G/GV/910GL Integrated Graphics Controller"<br
/> Vendorname	"Intel Corporation"<br
/> #Driver		"i810"<br
/> Driver		"intel"<br
/> BusID		"PCI:0:2:0"<br
/> Option	"DRI"	"true"<br
/> Option	"AccelMethod"	"exa"<br
/> Option	"MigrationHeuristic"	"greedy"<br
/> Option	"ExaNoComposite"	"false"<br
/> EndSection</p></blockquote><p><strong>Driver i810</strong> (xserver-xorg-video-i810 package) was about 10-20 FPS slower than <strong>Driver intel</strong> (xserver-xorg-video-intel package) for me. The most important lines here are <strong>Option AccelMethod exa</strong> (which enables EXA acceleration instead of the older XAA; if you run 2.6.28 or later kernel, you can try UXA instead of EXA) and <strong>Option MigrationHeuristic greedy</strong>. <strong>Option ExaNoComposite false</strong> doesn't make a difference for me, and <strong>Option DRI true</strong> might be redundant (didn't bother trying to remove it).</li><li>at the end of xorg.conf I have two more sections:<br
/><blockquote><p> Section "DRI"<br
/> Mode	0666<br
/> EndSection</p><p>Section "Extensions"<br
/> Option	"Composite"	"enable"<br
/> Option	"MIT-SHM"	"Yes"<br
/> EndSection</p></blockquote></li><li><strong>sudo nano /etc/environment</strong>, and add one line: <strong>INTEL_BATCH=1</strong> (if you have graphics stability issues or screen corruption - try removing this change first)</li><li>you can test if your xorg.conf is syntactically correct by running X -config /etc/X11/xorg.conf (provided that you edited this exact file)</ol><p>This is it. Before these modifications, my FPS in glxgears was around 430; after these modifications it is ~915.</p><p>As time permits, I might try the XAA configuration, suggested at <a
href="http://foolcontrol.org/?p=181" rel="nofollow" >foolcontrol</a>.</p><p><ins
datetime="2009-04-13T09:53:47+00:00">Update</ins>: with compiz enabled, XAA configuration recommended at <a
href="http://foolcontrol.org/?p=181" rel="nofollow" >foolcontrol</a> is definitely faster in 2D.</p><p>Improvements, suggestions, corrections are welcome.</p><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/02/intel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/03/02/intel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F03%2F02%2Fintel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html&amp;title=Intel%20i915%20integrated%20graphics%20under%20Debian%3A%20how%20to%20get%20rid%20of%20sluggish%202D%20performance" id="wpa2a_76"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/03/02/intel-i915-integrated-graphics-under-debian-how-to-get-rid-of-sluggish-2d-performance.html/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>gitosis: how to add new repository</title><link>http://bogdan.org.ua/2009/02/20/gitosis-how-to-add-new-repository.html</link> <comments>http://bogdan.org.ua/2009/02/20/gitosis-how-to-add-new-repository.html#comments</comments> <pubDate>Fri, 20 Feb 2009 19:05:52 +0000</pubDate> <dc:creator>Bogdan</dc:creator> <category><![CDATA[*nix]]></category> <category><![CDATA[how-to]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[git]]></category> <category><![CDATA[gitosis]]></category> <category><![CDATA[project]]></category> <category><![CDATA[repository]]></category> <guid
isPermaLink="false">http://bogdan.org.ua/?p=606</guid> <description><![CDATA[I assume that you already have your gitosis-admin repository working (this is described elsewhere). cd gitosis-admin &#038;&#038; git pull - enter your gitosis administrative repository and ensure it is up-to-date $EDITOR gitosis.conf add [group newreponame] section (newreponame is the name of your new repository being added); add yourself with members = yourlogin@yourhost line; also add [...]]]></description> <content:encoded><![CDATA[<p>I assume that you already have your <strong>gitosis-admin</strong> repository working (this is described elsewhere).</p><ol><li><strong>cd gitosis-admin &#038;& git pull</strong> - enter your gitosis administrative repository and ensure it is up-to-date</li><li><strong>$EDITOR gitosis.conf</strong></li><li>add <strong>[group newreponame]</strong> section (<em>newreponame</em> is the name of your new repository being added); add yourself with <strong>members = yourlogin@yourhost</strong> line; also add <strong>writable = newreponame</strong> line:<br
/><blockquote><p>[group newreponame]<br
/> members = yourlogin@yourhost<br
/> writable = newreponame</p></blockquote></li><li>based on my assumption of a correctly setup <strong>gitosis-admin</strong> repository, you should already have the appropriate public key in the <strong>keydir</strong> directory, but if not - copy your user's ssh public key to <strong>keydir</strong> in the form of <strong>yourlogin@yourhostname.pub</strong>, then do <strong>git add keydir/yourlogin@yourhostname.pub</strong></li><li><strong>git commit -am 'new repository: newreponame'</strong>; <strong>git push</strong>;</li><li>now that you have the new repo permissions configured, let's actually create it. Navigate to the directory holding the files of your project (e.g. <strong>cd ~/newreponame</strong>), and do <strong>git init</strong>; <strong>git add .</strong> - this initializes empty git repository, and then adds all the files to it. If you have no files - you can skip the 'git add .' command, as it will do nothing for you.</li><li><strong>git commit -m 'initial commit'</strong>. If you had no files added to the commit, git will complain that it cannot create an empty commit. In this case use the command <strong>git commit &ndash;&ndash;allow-empty -m 'initial commit'</strong></li><li><strong>git remote add origin ssh://gitosis@yourGitosisServerName/newreponame.git</strong></li><li><strong>git push &ndash;&ndash;all</strong></li><li>final thing: <strong>git config &ndash;&ndash;add branch.master.remote origin &#038;& git config &ndash;&ndash;add branch.master.merge refs/heads/master</strong>; alternatively, <strong>cd .git &#038;& $EDITOR config</strong>, and then add these lines:<br
/><blockquote><p>[branch "master"]<br
/> remote = origin<br
/> merge = refs/heads/master</p></blockquote><p>Without these lines, you won't be able to <em>git pull</em>.</ol><p><a
class="a2a_button_google_plusone addtoany_special_service" data-href="http://bogdan.org.ua/2009/02/20/gitosis-how-to-add-new-repository.html"></a><a
class="a2a_button_facebook_like addtoany_special_service" data-href="http://bogdan.org.ua/2009/02/20/gitosis-how-to-add-new-repository.html"></a><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbogdan.org.ua%2F2009%2F02%2F20%2Fgitosis-how-to-add-new-repository.html&amp;title=gitosis%3A%20how%20to%20add%20new%20repository" id="wpa2a_80"><img
src="http://bogdan.org.ua/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://bogdan.org.ua/2009/02/20/gitosis-how-to-add-new-repository.html/feed</wfw:commentRss> <slash:comments>16</slash:comments> </item> </channel> </rss>
