<?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>Makura no Soshi &#187; english</title>
	<atom:link href="http://mschuette.name/wp/category/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://mschuette.name/wp</link>
	<description>枕草子</description>
	<lastBuildDate>Mon, 06 Feb 2012 12:41:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Sizing a Swap Partition</title>
		<link>http://mschuette.name/wp/2012/01/sizing-a-swap-partition/</link>
		<comments>http://mschuette.name/wp/2012/01/sizing-a-swap-partition/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 19:42:09 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[partitioning]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=773</guid>
		<description><![CDATA[It is still one of the first questions when installing a unixoid OS: do you still need a swap partition and how big should you make it. In the old days™ this was an important question because disk space was expensive and the OS memory management had several constraints. Today both memory and disks are [...]]]></description>
			<content:encoded><![CDATA[<p>It is still one of the first questions when installing a unixoid OS: do you still need a swap partition and how big should you make it. In the old days™ this was an important question because disk space was expensive and the OS memory management had several constraints.</p>
<p>Today both memory and disks are cheap enough to make this question insignificant in many cases. One can usually buy enough memory to prevent swapping, and with terrabyte disks it makes no real difference whether the swap partition is 1 Gb or 4 Gb in size.</p>
<p>I still use the old rule of thumb and allocate twice the size of RAM for a swap partition. But the intention is not so much to swap memory pages but rather to always have enough space for kernel core dumps. My basic reasoning is:</p>
<ol>
<li>In case of kernel errors I want to get a core dump.</li>
<li>A later RAM upgrade is relatively cheap and easy, thus probable over a system&#8217;s lifetime.</li>
<li>A later disk re-partitioning is more difficult, thus to avoid.</li>
<li>Disk space is cheap, allocating ≤ 5% for a mostly unused swap partition has no significant cost.</li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2012/01/sizing-a-swap-partition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dying &#8216;try&#8217; processes</title>
		<link>http://mschuette.name/wp/2011/11/dying-try-processes/</link>
		<comments>http://mschuette.name/wp/2011/11/dying-try-processes/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 06:51:17 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=736</guid>
		<description><![CDATA[Note: This syslog entry is puzzling if the system has no program named try, but no cause for concern: 2011-11-19T01:31:21 frodo kernel: pid 47812 (try), uid 0: exited on signal 10 (core dumped) Source of the program is Perl&#8217;s Configure script, which compiles its C library test cases into programs named try. And apparently amd64 [...]]]></description>
			<content:encoded><![CDATA[<p>Note: This syslog entry is puzzling if the system has no program named <code>try</code>, but no cause for concern:</p>
<blockquote><p><code>2011-11-19T01:31:21 frodo kernel: pid 47812 (try), uid 0: exited on signal 10 (core dumped)</code></p></blockquote>
<p>Source of the program is Perl&#8217;s Configure script, which compiles its C library test cases into programs named <code>try</code>. And apparently amd64 systems need to use the function <code>va_copy()</code> because the test case without this function leads to a segfault.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2011/11/dying-try-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Design and Implementation of an IPv6 Plugin for the Snort Intrusion Detection System</title>
		<link>http://mschuette.name/wp/2011/10/design-and-implementation-of-an-ipv6-plugin-for-the-snort-intrusion-detection-system/</link>
		<comments>http://mschuette.name/wp/2011/10/design-and-implementation-of-an-ipv6-plugin-for-the-snort-intrusion-detection-system/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 08:08:52 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Uni]]></category>
		<category><![CDATA[diplom]]></category>
		<category><![CDATA[diplomarbeit]]></category>
		<category><![CDATA[ids]]></category>
		<category><![CDATA[idsv6]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[snort]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=714</guid>
		<description><![CDATA[Nach einem Schreib-Endspurt im August und folgender Schreib-Faulheit im September soll es auch hier mal wieder weitergehen. Und bevor sich wirklich neue Themen finden, gibt&#8217;s noch ein paar übriggebliebene Notizen zu meiner Diplomarbeit: Design and Implementation of an IPv6 Plugin for the Snort Intrusion Detection System. [Short english explanation:] I finished my diploma thesis: Design [...]]]></description>
			<content:encoded><![CDATA[<p>Nach einem Schreib-Endspurt im August und folgender Schreib-Faulheit im September soll es auch hier mal wieder weitergehen. Und bevor sich wirklich neue Themen finden, gibt&#8217;s noch ein paar übriggebliebene Notizen zu meiner <a href="/files/uni/110901-Diplomarbeit-SnortIPv6.pdf">Diplomarbeit: <em>Design and Implementation of an IPv6 Plugin for the Snort Intrusion Detection System</em></a>.</p>
<p><em>[Short english explanation:]</em> I finished my <a href="/files/uni/110901-Diplomarbeit-SnortIPv6.pdf">diploma thesis: <em>Design and Implementation of an IPv6 Plugin for the Snort Intrusion Detection System</em></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2011/10/design-and-implementation-of-an-ipv6-plugin-for-the-snort-intrusion-detection-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSX Lion Impression</title>
		<link>http://mschuette.name/wp/2011/08/osx-lion-impression/</link>
		<comments>http://mschuette.name/wp/2011/08/osx-lion-impression/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 10:01:24 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Digital]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[lion]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=699</guid>
		<description><![CDATA[Finally got around to read the OSX Lion review on ars technica&#8230; The most interesting feature is the new process model with automatic and sudden termination (at least in regard to OS design; without having a Mac I no longer care about the UI). Both techniques give the OS more control over processes and the [...]]]></description>
			<content:encoded><![CDATA[<p>Finally got around to read the <a href="http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars">OSX Lion review</a> on ars technica&#8230; The most interesting feature is the <a href="http://arstechnica.com/apple/reviews/2011/07/mac-os-x-10-7.ars/8">new process model</a> with <a href="http://developer.apple.com/library/mac/documentation/General/Conceptual/MOSXAppProgrammingGuide/CoreAppDesign/CoreAppDesign.html#//apple_ref/doc/uid/TP40010543-CH3-SW27">automatic and sudden termination</a> (at least in regard to OS design; without having a Mac I no longer care about the <a href="http://geekandpoke.typepad.com/geekandpoke/2011/08/apple-job-interview.html">UI</a>).</p>
<p>Both techniques give the OS more control over processes and the ability to kill running applications. At first sight this looks scary and a loss of control over your computer. But it is viable for the OS to provide better resource management. Think of it as <a href="http://en.wikipedia.org/wiki/Paging">Swapping</a> 2.0 &#8212; only instead of moving virtual memory pages to disk and back, the application is simply killed to free its memory pages.</p>
<p>It might get even more interesting if developers accept this new model and design their application accordingly. Then there could be quite an incentive to reduce startup times (maybe also to reduce the overall size of a process&#8217;s state and use transaction safe I/O). Finally: <a href="http://roc.cs.berkeley.edu/">Recovery-Oriented Computing</a> on the desktop :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2011/08/osx-lion-impression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl and Python under Windows</title>
		<link>http://mschuette.name/wp/2011/01/perl-and-python-under-windows/</link>
		<comments>http://mschuette.name/wp/2011/01/perl-and-python-under-windows/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 23:38:09 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Digital]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[cava]]></category>
		<category><![CDATA[dde]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[py2exe]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=639</guid>
		<description><![CDATA[Perl and Python are not only useful for Unix programming. Both languages work on Windows, have modules for Win32 APIs and their programs can be packaged into .exe files. Once upon a time I had to extract some application data using the antiqe DDE API and send it to a webservice. Once I found the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.perl.org/">Perl</a> and <a href="http://python.org/">Python</a> are not only useful for Unix programming. Both languages work on Windows, have modules for Win32 APIs and their programs can be packaged into <code>.exe</code> files.</p>
<p>Once upon a time I had to extract some application data using the antiqe <a href="http://en.wikipedia.org/wiki/Dynamic_Data_Exchange">DDE</a> API and send it to a webservice. Once I found the <a href="http://www.bribes.org/perl/win32ddeclient.html">Win32::DDE::Client</a> it was quite easy to write 200 lines of Perl for the task. Because the script should not require a Perl installation on every machine it is used on, I used the <a href="http://www.cava.co.uk/">Cava Packager</a> to put everything into an <code>.exe</code> file. (Now I have to extend that old script and find that Cava is no longer free, but requires a subscription for commercial use.)</p>
<p>In order to know my alternatives I tried the <a href="http://starship.python.net/crew/mhammond/win32/">Python Win32 extensions</a> and <a href="http://www.py2exe.org/">py2exe</a> and these seem to be just as good (or in case of the undocumented DDE module: just as bad) as their Perl counterparts. (Py2exe is not as easy to use as Cava; but not too difficult either.)</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2011/01/perl-and-python-under-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Measuring PHP code complexity</title>
		<link>http://mschuette.name/wp/2010/09/measuring-php-code-complexity/</link>
		<comments>http://mschuette.name/wp/2010/09/measuring-php-code-complexity/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 16:23:37 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[measure]]></category>
		<category><![CDATA[metric]]></category>
		<category><![CDATA[pdepend]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpcs]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=612</guid>
		<description><![CDATA[What makes good code and why is some code better than others? One quantitative approach to answer this is the use of software metrics. These metrics try to capture the size and complexity of code in numbers (e.g. &#8216;lines of code&#8216;, &#8216;cyclomatic complexity&#8216;) and can be useful indicators for maintainability and simplicity (or more often [...]]]></description>
			<content:encoded><![CDATA[<p>What makes good code and why is some code better than others? One quantitative approach to answer this is the use of <a href="http://en.wikipedia.org/wiki/Programming_Complexity">software metrics</a>. These metrics try to capture the size and complexity of code in numbers (e.g. &#8216;<a href="http://en.wikipedia.org/wiki/Lines_of_code">lines of code</a>&#8216;, &#8216;<a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">cyclomatic complexity</a>&#8216;) and can be useful indicators for maintainability and simplicity (or more often the lack thereof).</p>
<p>I found three ways to get complexity measures for PHP code.</p>
<p>The most advanced technique is to use a continuous integration server. One good example is the server at <a href="http://test.pear.php.net:8080/cruisecontrol/">test.pear.php.net</a> which uses <a href="http://cruisecontrol.sourceforge.net/">CruiseControl</a> (a Java CI server) with <a href="http://phpundercontrol.org/">phpUnderControl</a> for the PHP specific parts. Certainly a nice solution for big projects, but nothing to use on your own laptop to improve a single package.</p>
<p>Often the easiest way is to use <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer</a>, which includes checks for cyclomatic complexity and nesting level (causing warnings and errors above some thresholds). If you already use it to maintain a uniform coding style (e.g. PEAR, Zend) then you just have to add these checks to your standard definition. These commands add metrics to the PEAR standard:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cd /usr/local/share/pear/PHP/CodeSniffer/Standards
sudo cp -R Generic/Sniffs/Metrics PEAR/Sniffs
sudo sed -I .bck -e 's/Squiz_/PEAR_/' PEAR/Sniffs/Metrics/*</pre></div></div>

<p>The program <a href="http://pdepend.org/">PDepend</a> creates a more detailed analysis of methods, classes, and projects (see this <a href="http://manuel-pichler.de/archives/28-PHP_Depend-0.8.0beta1-released.html">release note</a> for details). Because it is intended as a component within a CI server its primary output is in XML. So I wrote myself a small wrapper (<a href="/files/pdepend_summary.phps">pdepend_summary.php</a>) to format the data as an ASCII table. This allows for quick edit-check-cycles and now I run it along with phpcs and phpunit before I commit PEAR code.</p>
<p>Example output:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Package              Class                                  LoC %Comment Variables Methods Class_SiZe   WMC
-------              -----                                  --- -------- --------- ------- ----------   ---
Payment_DTA          DTA                                   1084     36.3         3      15        114   111
Payment_DTA          DTAZV                                  757     37.1         1      12         72    71
Payment_DTA          DTABase                                563     33.0         6      19         33    27
Payment_DTA          Payment_DTA_ChecksumException            3      0.0         0       0          0     0
Payment_DTA          Payment_DTA_FatalParseException          3      0.0         0       0          0     0
Payment_DTA          Payment_DTA_Exception                    3      0.0         0       0          0     0
Payment_DTA          Payment_DTA_ParseException               3      0.0         0       0          0     0
&nbsp;
Package/Class             Method                                   LoC %Comment    CCN    NPath
-------------             ------                                   --- --------    ---    -----
Payment_DTA/DTA           _generateCrecord                         158     25.9     13     1600
Payment_DTA/DTA           _parseCextension                          81     30.9     13       93
Payment_DTA/DTA           _processCextension                        47      2.1      8        8
Payment_DTA/DTA           parse                                     59     35.6      7       36
Payment_DTA/DTAZV         _exchangeFillSender                       33      0.0      7       64
Payment_DTA/DTAZV         parse                                     41     17.1      7       36
Payment_DTA/DTAZV         _exchangeFillReceiver                     26      7.7      6       24
Payment_DTA/DTA           _exchangeFillArrays                       31      0.0      6       32
Payment_DTA/DTA           _parseCrecord                            109     27.5      6       72
Payment_DTA/DTAZV         setAccountFileSender                      41      0.0      5       15
Payment_DTA/DTA           _parseErecord                             49     30.6      5       16
Payment_DTA/DTABase       getStr                                    18      0.0      4        8
Payment_DTA/DTAZV         __construct                               19     10.5      4        4
...</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/09/measuring-php-code-complexity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A virus in plain ASCII</title>
		<link>http://mschuette.name/wp/2010/09/a-virus-in-plain-ascii/</link>
		<comments>http://mschuette.name/wp/2010/09/a-virus-in-plain-ascii/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 22:21:48 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[bibtex]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tex]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=609</guid>
		<description><![CDATA[This is a nice idea and proof of concept: spreading malware in BibTeX files. Probably every TeX-User knows the advocacy about how powerful the language is&#8230; but do (or can) you proofread everything before you compile it?]]></description>
			<content:encoded><![CDATA[<p>This is a nice idea and proof of concept: <a href="http://cseweb.ucsd.edu/~scheckow/papers/tex2010.html">spreading malware in BibTeX files</a>.</p>
<p>Probably every TeX-User knows the advocacy about how powerful the language is&#8230; but do (or can) you proofread everything before you compile it?</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/09/a-virus-in-plain-ascii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>M0n0wall vs. pfSense vs. NanoBSD</title>
		<link>http://mschuette.name/wp/2010/06/m0n0wall-vs-pfsense-vs-nanobsd/</link>
		<comments>http://mschuette.name/wp/2010/06/m0n0wall-vs-pfsense-vs-nanobsd/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 23:10:02 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[appliance]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[m0n0wall]]></category>
		<category><![CDATA[nanobsd]]></category>
		<category><![CDATA[packet filter]]></category>
		<category><![CDATA[pf]]></category>
		<category><![CDATA[pfsense]]></category>
		<category><![CDATA[soekris]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=570</guid>
		<description><![CDATA[Recently I replaced my office&#8217;s filtering network bridge which still ran on an old FreeBSD 4.11 box for the last eight years or so. The new system is based on a Soekris 5501, and because it took some time to choose the right software I decided to publish my notes on the tested BSD firewall [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I replaced my office&#8217;s filtering network bridge which still ran on an old FreeBSD 4.11 box for the last eight years or so. The new system is based on a <a href="http://soekris.com/net5501.htm">Soekris 5501</a>, and because it took some time to choose the right software I decided to publish my notes on the tested BSD firewall products.</p>
<p><a href="http://m0n0.ch/wall/">M0n0wall</a>: I have already used this as a NAT router and liked the web-based configuration (which I percieved as convenient but not limiting), so it was the first candidate. But I found it to be &#8216;too small&#8217; for my plans. It allows neither the installation of additional software, nor does it allow ssh login for scriptable configuration changes. It also does not use <a href="http://www.openbsd.org/faq/pf/">pf</a>, which I tend to prefer for its concise configuration and dynamic tables.</p>
<p><a href="http://pfsense.org/">pfSense</a>: M0n0wall&#8217;s big brother; bigger, more complete, and more customizable. But with one major problem: no IPv6 support. It is 2010, with only 1-2 years until the <a href="http://www.potaroo.net/tools/ipv4/">IPv4 address pool exhaustion</a>&#8230; deploying network infrastructure without IPv6 support is ridiculous and not an option. – Another problem seems to be a limited support for bridge setups: There are always a number of standard pf rules, which are hard to circumvent in case of problems. I nearly settled to use the web-interface for IPv4, and insert my own IPv6 rules into the PHP scripts. But this would have made it even harder to maintain than a solution without any web-interface.</p>
<p><a href="http://www.freebsd.org/doc/en/articles/nanobsd/index.html">NanoBSD</a>: So I finally took the chance to build my own small FreeBSD system for the task. NanoBSD is basically a script to do a FreeBSD &#8216;make world&#8217;, allow for some customization, and finally put everything into a CF-ready disk image. Of course the first attempt required several changes after installation (it&#8217;s really hard to think of all configuration steps beforehand), but everything went well without major problems.</p>
<p>Thus I chose NanoBSD. YMMV, and I would not recommend it for anyone not familiar with BSD. – But with four other BSD servers the additional maintenance effort is really small; possibly even easier than with any non-standard or web-based configuration.</p>
<p>[<strong>Update, 2011-02-24</strong>: If you use NanoBSD yourself then take a look at the useful <a href="http://bsdrp.net/documentation/technical_docs/nanobsd#bsdrp_patches_for_nanobsd">scripts and patches from BSDRP</a>.] </p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/06/m0n0wall-vs-pfsense-vs-nanobsd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Mailman Logo</title>
		<link>http://mschuette.name/wp/2010/05/new-mailman-logo/</link>
		<comments>http://mschuette.name/wp/2010/05/new-mailman-logo/#comments</comments>
		<pubDate>Thu, 27 May 2010 00:14:15 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Mailman]]></category>
		<category><![CDATA[logo]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=564</guid>
		<description><![CDATA[I like the new logo for Mailman.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" title="GNU Mailman Logo" src="/wp/wp-upload/mailman_logo_2010.jpg" alt="GNU Mailman Logo" width="301" height="125" /></p>
<p style="text-align: center;">I like the <a href="http://www.wefearchange.org/2010/05/we-have-winner.html">new logo</a> for <a href="http://www.list.org/">Mailman</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/05/new-mailman-logo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for handling big SQL dumps</title>
		<link>http://mschuette.name/wp/2010/05/tips-for-handling-big-sql-dumps/</link>
		<comments>http://mschuette.name/wp/2010/05/tips-for-handling-big-sql-dumps/#comments</comments>
		<pubDate>Sat, 15 May 2010 17:19:08 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[split]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=553</guid>
		<description><![CDATA[Recently I had to work with SQL dumps to recover a database server and to update a MySQL installation. Because complete SQL dumps are too big to handle them with diff and vi (with enough memory vim actually works on large files, but it is really slow) I needed more traditional tools to compare them [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to work with SQL dumps to recover a database server and to update a MySQL installation. Because complete SQL dumps are too big to handle them with <code>diff</code> and <code>vi</code> (with enough memory <code>vim</code> actually works on large files, but it is really slow) I needed more traditional tools to compare them and to extract only the parts I needed.</p>
<p>To extract single DB dumps from a complete dump find the line numbers where the single DB dumps start. Then use <code>sed</code> to print only the lines from the start of the searched DB and the next one. <code>mysqldump</code> seems to use separate passes for data, stored routines, and  triggers &#8212; so there may be multiple ranges of lines in a complete  dump:</p>
<blockquote>
<pre>fgrep -n 'Current Database: ' dump_all.sql
sed -n -e '86226,93282p' -e '123249,123254p'
  dump_all.sql &gt; db_test.sql
</pre>
</blockquote>
<p><code>diff</code> loads the files it works on into memory, thus it cannot be used for large files (&gt;= 1Gb). To extract multiple DBs or to compare dumps it is useful to <code>split</code> the SQL dump at DB boundaries:</p>
<blockquote>
<pre>split -p 'Current Database: ' dump_all.sql</pre>
</blockquote>
<p>The resulting partial files can be renamed/concatenated to one file per DB (using tcsh syntax here):</p>
<blockquote>
<pre>foreach f ( x?? )
  set dbname=`head -1 $f
  | sed -e 's/^-- Current Database: .(.*).$/1/'
    -e 's/^-- MySQL dump.*$/dumpheader/'`
  test $dbname &amp;&amp; cat $f &gt;&gt; part-${dbname} &amp;&amp; rm $f
end
</pre>
</blockquote>
<p>If we did this with two SQL dumps in $dir1 and $dir2, then we can compare them chunk by chunk (assuming every DB on itself is small enough to fit into memory for diff):</p>
<blockquote>
<pre>foreach f ($dir1/part-*)
  diff --ignore-case --ignore-space-change
    --ignore-blank-lines -u
    $dir1/$f $dir2/$f &gt;&gt; /tmp/diff.out
end
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/05/tips-for-handling-big-sql-dumps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

