<?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>Open Source Technical Blog</title>
	<atom:link href="http://techblog.zabuchy.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.zabuchy.net</link>
	<description>GNU/Linux, Open Source and 42</description>
	<lastBuildDate>Sat, 28 Jan 2012 10:24:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Install soapUI on Ubuntu 11.10</title>
		<link>http://techblog.zabuchy.net/2012/install-soapui-on-ubuntu-11-10/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-soapui-on-ubuntu-11-10</link>
		<comments>http://techblog.zabuchy.net/2012/install-soapui-on-ubuntu-11-10/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 09:35:32 +0000</pubDate>
		<dc:creator>Joanna Muras</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=923</guid>
		<description><![CDATA[Introduction This post describes how to install soapUI on Ubuntu 11.10 and solve potential issues with installation. Installation Download linux version (soapui-4.0.1-linux-bin.zip file) of soapUI 4.0.1 Unpack it to desired location Add execute permission to bin/soapui.sh file: chmod +x bin/soapui.sh Run soapUI ./soapui.sh Troubleshooting If you get following exception after running and your application closes: [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This post describes how to install <a href="http://www.soapui.org/">soapUI</a> on <a href="http://www.ubuntu.com">Ubuntu 11.10</a> and solve potential issues with installation.</p>
<h2>Installation</h2>
<ol>
<li>Download linux version (soapui-4.0.1-linux-bin.zip file) of <a href="http://sourceforge.net/projects/soapui/files/soapui/4.0.1/">soapUI 4.0.1</a></li>
<li>Unpack it to desired location</li>
<li>Add execute permission to <code>bin/soapui.sh</code> file: <code>chmod +x bin/soapui.sh</code></li>
<li>Run soapUI <code>./soapui.sh</code></li>
</ol>
<h2>Troubleshooting</h2>
<p>If you get following exception after running and your application closes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># A fatal error has been detected by the Java Runtime Environment:</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  SIGSEGV (0xb) at pc=0x00007f6490c0a5f1, pid=28611, tid=140070162761472</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># JRE version: 6.0_29-b11</span>
<span style="color: #666666; font-style: italic;"># Java VM: Java HotSpot(TM) 64-Bit Server VM (20.4-b02 mixed mode linux-amd64 compressed oops)</span>
<span style="color: #666666; font-style: italic;"># Problematic frame:</span>
<span style="color: #666666; font-style: italic;"># C  [libgconf-2.so.4+0x175f1]  __float128+0xc01</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># If you would like to submit a bug report, please visit:</span>
<span style="color: #666666; font-style: italic;">#   http://java.sun.com/webapps/bugreport/crash.jsp</span>
<span style="color: #666666; font-style: italic;"># The crash happened outside the Java Virtual Machine in native code.</span>
<span style="color: #666666; font-style: italic;"># See problematic frame for where to report the bug.</span>
<span style="color: #666666; font-style: italic;">#</span></pre></div></div>

<p>add <code>-Dsoapui.jxbrowser.disable=true</code> flag when executing soapUI.</p>
<p>In order to do so edit <code>soapui.sh</code> file and add the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">JAVA_OPTS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$JAVA_OPTS</span> -Dsoapui.jxbrowser.disable=true&quot;</span></pre></div></div>

<p>Enjoy soapUI running.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2012/install-soapui-on-ubuntu-11-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Alfresco development environment with Tomcat and Eclipse</title>
		<link>http://techblog.zabuchy.net/2012/alfresco-development-environment-with-tomcat-and-eclipse/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=alfresco-development-environment-with-tomcat-and-eclipse</link>
		<comments>http://techblog.zabuchy.net/2012/alfresco-development-environment-with-tomcat-and-eclipse/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 17:08:44 +0000</pubDate>
		<dc:creator>Joanna Muras</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[alfresco]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=859</guid>
		<description><![CDATA[Introduction This post describes how to set up environment to be able to code and debug Alfresco on Tomcat in Eclipse. To start with make sure you have downloaded and installed the following: Eclipse Indigo &#8211; download it here Tomcat 7.0 &#8211; download it here Sysdeo Eclipse Tomcat Launcher plugin &#8211; download it here Oracle [...]]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>This post describes how to set up environment to be able to code and debug <a href="http://www.alfresco.com">Alfresco</a> on <a href="http://tomcat.apache.org">Tomcat</a> in <a href="http://eclipse.org">Eclipse</a>.</p>
<p>To start with make sure you have downloaded and installed the following:</p>
<ul>
<li><a href="http://eclipse.org">Eclipse Indigo</a> &#8211; download it <a href="http://eclipse.org/download">here</a></li>
<li><a href="http://tomcat.apache.org">Tomcat 7.0</a> &#8211; download it <a href="http://tomcat.apache.org/download-70.cgi">here</a></li>
<li><a href="http://www.eclipsetotale.com/tomcatPlugin.html">Sysdeo Eclipse Tomcat Launcher plugin</a> &#8211; download it <a href="http://www.eclipsetotale.com/tomcatPlugin.html#A3">here</a></li>
<li><a href="http://www.oracle.com/technetwork/java/index.html">Oracle Java JDK 1.6</a> &#8211; download it <a href="<br />
http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-download-346242.html">here</a></li>
<li><a href="http://www.alfresco.com">Alfresco</a> source code from <a href="http://svn.alfresco.com">svn.alfresco.com</a> &#8211; follow the instructions <a href="http://wiki.alfresco.com/wiki/Alfresco_SVN_Development_Environment">here</a></li>
<li><a href="http://www.eclipse.org/subversive/">Subversive Ecplipse plugin</a></li>
<li><a href="http://ant.apache.org/bindownload.cgi">Ant 1.7</a></li>
</ul>
<p>Also make sure that you have appropriate environment variables set up:</p>
<ul>
<li>JAVA_HOME</li>
<li>JAVA_JDK</li>
<li>CATALINA_HOME</li>
<li>CATALINA_BASE</li>
<li>TOMCAT_HOME</li>
<li>APP_TOMCAT_HOME</li>
<li>ANT_HOME</li>
<li>JBOSS_HOME</li>
</ul>
<p>Make sure that you allocate enough memory otherwise it will not run or you get various errors like &#8216;OutOfMemory: PermGen&#8217;. The setup certainly works with the following parameters.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">JAVA_OPTS=&quot;-XX:MaxPermSize=1024m -Xms512m -Xmx4096m&quot;</pre></div></div>

<h3>Import projects into Ecplise</h3>
<p>In order to add alfresco projects into Eclipse import &#8216;root/projects&#8217; directory that you checked out from <a href="http://svn.alfresco.com">svn.alfresco.com</a>. In Eclipse select: File -> Import -> Existing Projects into Workspace</p>
<p>You should be able to see the window presented below. Select all the projects. You do not have to copy them into the work space.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/import_projects.jpg" alt="Import Projects" /></p>
<p>If you are successful you should be able to see the projects in your package explorer as pictured below.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/projects_imported.jpg" alt="Projects Imported" /></p>
<p>Now you should be able to track the changes that you do in your code using <a href="http://www.eclipse.org/subversive/">Subversive Ecplipse plugin</a> which is very handy.</p>
<h3>Do Alfresco build</h3>
<p>Go to &#8216;root/projects&#8217; directory and run:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">ant build</pre></div></div>

<p>When you are successful you should be able to locate alfresco.war (alfresco repository) and share.war (Slingshot web interface) files in the following locations:</p>
<ul>
<li>root/projects/web-client/build/dist/alfresco.war</li>
<li>root/projects/slingshot/build/dist/share.war</li>
</ul>
<h3>Create web projects in Eclipse</h3>
<p>To deploy alfresco.war and share.war files separate web projects should be created. I am going to describe only share.war installation. alfresco.war installation should be done analogically.</p>
<p>Select:</p>
<p>File -> New -> Dynamic Web Project</p>
<p>Enter war name as project name (in our case &#8216;share&#8217;). The project will be deployed under project name URL. If necessary it can be changed in &#8216;Properties&#8217; of the project &#8211; Web Project Settings &#8211; Content root. Select Tomcat 7 &#8216;Target runtime&#8217; or choose &#8216;New runtime&#8230;&#8217; if you do not have Tomcat 7 added in your server list. This will enable the addition of Tomcat 7 runtime environment.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/dynamic_web_project.jpg" alt="Dynamic Web Project" /></p>
<p>This should create Dynamic Web Project with the following structure.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/dynamic_web_project_structure.jpg" alt="Dynamic Web Project Structure" /></p>
<p>Unpack your share.war file and copy its content to WebContent folder of &#8216;share&#8217; project. Refresh project in Eclipse. All Alfresco jar files you will find in the following path: </p>
<p>WebContent/WEB-INF/lib/alfresco-*.jar</p>
<p>Instead of having static alfresco jar files we can generate them automatically from our projects in Eclipse. In that way when we change some code we can check the outcome in convenient way by automatic deployment of new jar files. Let&#8217;s say that we want to change some code in &#8216;Core&#8217; project, which corresponds to &#8216;alfresco-core-x.jar&#8217;. In order to do so we remove alfresco-core-x.jar from WebContent/WEB-INF/lib, so old version will not be used. Following that we edit Properties of the project and change:</p>
<p>&#8216;Project references&#8217; to include Core project:</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/project_references.jpg" alt="Project References" /></p>
<p>&#8216;Deployment assembly&#8217; to include source code from &#8216;Core&#8217; project. Click &#8216;Add&#8230;&#8217;, select Project and &#8216;Core&#8217; project. Node that Core.jar will be created and this jar will be added to your deployment.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/deployment_assembly.jpg" alt="Deployment Assembly" /></p>
<p>&#8216;Java build path&#8217; to include source code from &#8216;Core&#8217; project. Click &#8216;Add&#8230;&#8217; and select &#8216;Core&#8217; project. It might also be necessary to change order of exported libraries in some projects, e.g., Repository project, in case of compilation errors. Put system libraries first.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/build_path.jpg" alt="Build Path" /></p>
<h3>Run project on Tomcat</h3>
<p>Once the project (share) is set up not we can add it to Tomcat server and run it. In order to do so go to &#8216;Servers&#8217; view (Window -> Show view -> Servers). Right mouse click on Tomcat 7 server and select &#8216;Add and Remove&#8230;&#8217;. Add share project to be run on Tomcat. Publish data and start server.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/add_remove.jpg" alt="Add and Remove" /></p>
<p>If everything is successful you should be able to access your application via web browser: localhost:8080/share.</p>
<p>If you want to see all the files that were actually deployed you can find them in the following path: &#8216;workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/share&#8217;</p>
<p>You can change Tomcat configuration, e.g., increase memory by double clicking on appropriate server in &#8216;Servers&#8217; view. Select &#8216;Open launch configuration&#8217;.</p>
<p><img src="http://techblog.zabuchy.net/wp-content/uploads/2012/01/tomcat_settings.jpg" alt="Tomcat Settings" /></p>
<p>If there is no Tomcat 7 server you can add it by right mouse click and selecting &#8216;New -> Server&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2012/alfresco-development-environment-with-tomcat-and-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make star (*) to match hidden (dot) files</title>
		<link>http://techblog.zabuchy.net/2012/make-star-to-match-hidden-dot-files/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=make-star-to-match-hidden-dot-files</link>
		<comments>http://techblog.zabuchy.net/2012/make-star-to-match-hidden-dot-files/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 21:37:48 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=839</guid>
		<description><![CDATA[To make star character in bash to match hidden files, use dotglob option: $ shopt -s dotglob If directory contains both normal and hidden (.*) files, here what you will get without and with dotglob set: $ ls * file1.txt file2.txt $ shopt -s dotglob $ ls * file1.txt file2.txt .htaccess .htpassword]]></description>
			<content:encoded><![CDATA[<p>To make star character in bash to match hidden files, use dotglob option:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> dotglob</pre></div></div>

<p>If directory contains both normal and hidden (.*) files, here what you will get without and with dotglob set:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>
file1.txt  file2.txt
$ <span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> dotglob 
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>
file1.txt  file2.txt  .htaccess  .htpassword</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2012/make-star-to-match-hidden-dot-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show full path to the current file in vim</title>
		<link>http://techblog.zabuchy.net/2012/show-full-path-to-the-current-file-in-vim/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=show-full-path-to-the-current-file-in-vim</link>
		<comments>http://techblog.zabuchy.net/2012/show-full-path-to-the-current-file-in-vim/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 23:12:56 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=846</guid>
		<description><![CDATA[I find this one very useful, when you press just CTRL-G in vim you will get some basic file information: &#34;abc.tmp&#34; 165 lines --36%-- When you use put count (a number) 1 before that command, the path will get expanded to full path (but shortened with ~ for the home directory). So when pressed: 1 [...]]]></description>
			<content:encoded><![CDATA[<p>I find this one very useful, when you press just CTRL-G in vim you will get some basic file information:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #ff0000;">&quot;abc.tmp&quot;</span> <span style="color: #000000;">165</span> lines --<span style="color: #000000;">36</span><span style="color: #000000; font-weight: bold;">%</span>--</pre></div></div>

<p>When you use put count (a number) 1 before that command, the path will get expanded to full path (but shortened with ~ for the home directory). So when pressed:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">1</span> CTRL-G</pre></div></div>

<p>The output will change to:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #ff0000;">&quot;/tmp/abc.tmp&quot;</span> <span style="color: #000000;">165</span> lines --<span style="color: #000000;">36</span><span style="color: #000000; font-weight: bold;">%</span>--</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2012/show-full-path-to-the-current-file-in-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xargs, find and escaping pipe and semicolon</title>
		<link>http://techblog.zabuchy.net/2011/xargs-find-and-escaping-pipe-and-semicolon/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xargs-find-and-escaping-pipe-and-semicolon</link>
		<comments>http://techblog.zabuchy.net/2011/xargs-find-and-escaping-pipe-and-semicolon/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 21:34:19 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=826</guid>
		<description><![CDATA[I wanted to iterate over set of directories and calculate total number of files inside each of them (recursively). xargs &#038; find would do it just fine but you can not easily escape pipe inside xargs command. Here is the solution: ls &#124; xargs -n1 -I&#123;&#125; sh -c 'echo -n &#34;{} &#34;; find {} -type [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to iterate over set of directories and calculate total number of files inside each of them (recursively). xargs &#038; find would do it just fine but you can not easily escape pipe inside xargs command. Here is the solution:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-n1</span> -I<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'echo -n &quot;{} &quot;; find {} -type f | wc -l'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/xargs-find-and-escaping-pipe-and-semicolon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Send email from command line without x-mailer tag</title>
		<link>http://techblog.zabuchy.net/2011/send-email-from-command-line-without-x-mailer-tag/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=send-email-from-command-line-without-x-mailer-tag</link>
		<comments>http://techblog.zabuchy.net/2011/send-email-from-command-line-without-x-mailer-tag/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 20:36:51 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=821</guid>
		<description><![CDATA[I usually set my postfix to relay via gmail SMTP to allow me for reliable external email delivery from my gmail address, with the convenience of the command-line. To send an email using mail utility I can simply use: $ cat email.txt &#124; mail email@example.com This will generate an email with default X-Mailer tag, like: [...]]]></description>
			<content:encoded><![CDATA[<p>I usually set my postfix to <a href="http://ubuntu-tutorials.com/2008/11/11/relaying-postfix-smtp-via-smtpgmailcom/">relay via gmail SMTP</a> to allow me for reliable external email delivery from my gmail address, with the convenience of the command-line. To send an email using <em>mail</em> utility I can simply use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> email.txt <span style="color: #000000; font-weight: bold;">|</span> mail email<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>This will generate an email with default X-Mailer tag, like:</p>
<pre>
X-Mailer: mail (GNU Mailutils 2.2)
</pre>
<p>To disable it, create a .mailrc configuration file in your home directory and unset <em>xmailer</em> option:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> noxmailer <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.mailrc</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/send-email-from-command-line-without-x-mailer-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ext2/ext3 partition block group error</title>
		<link>http://techblog.zabuchy.net/2011/ext2ext3-partition-block-group-error/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ext2ext3-partition-block-group-error</link>
		<comments>http://techblog.zabuchy.net/2011/ext2ext3-partition-block-group-error/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 18:37:31 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=816</guid>
		<description><![CDATA[Here is the error from dmesg I&#8217;ve got when trying to mount external HDD: &#91;345826.197335&#93; EXT3-fs error &#40;device sdd1&#41;: ext3_check_descriptors: Block bitmap for group 1920 not in group &#40;block 0&#41;! &#91;345826.198130&#93; EXT3-fs &#40;sdd1&#41;: error: group descriptors corrupted Trying to mount as ext2 didn&#8217;t change anything: &#91;346348.544459&#93; EXT2-fs &#40;sdd1&#41;: error: ext2_check_descriptors: Block bitmap for group 1920 [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the error from dmesg I&#8217;ve got when trying to mount external HDD:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">345826.197335</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> EXT3-fs error <span style="color: #7a0874; font-weight: bold;">&#40;</span>device sdd1<span style="color: #7a0874; font-weight: bold;">&#41;</span>: ext3_check_descriptors: Block bitmap <span style="color: #000000; font-weight: bold;">for</span> group <span style="color: #000000;">1920</span> not <span style="color: #000000; font-weight: bold;">in</span> group <span style="color: #7a0874; font-weight: bold;">&#40;</span>block <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">345826.198130</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> EXT3-fs <span style="color: #7a0874; font-weight: bold;">&#40;</span>sdd1<span style="color: #7a0874; font-weight: bold;">&#41;</span>: error: group descriptors corrupted</pre></div></div>

<p>Trying to mount as ext2 didn&#8217;t change anything:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">346348.544459</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> EXT2-fs <span style="color: #7a0874; font-weight: bold;">&#40;</span>sdd1<span style="color: #7a0874; font-weight: bold;">&#41;</span>: error: ext2_check_descriptors: Block bitmap <span style="color: #000000; font-weight: bold;">for</span> group <span style="color: #000000;">1920</span> not <span style="color: #000000; font-weight: bold;">in</span> group <span style="color: #7a0874; font-weight: bold;">&#40;</span>block <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">346348.544470</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> EXT2-fs <span style="color: #7a0874; font-weight: bold;">&#40;</span>sdd1<span style="color: #7a0874; font-weight: bold;">&#41;</span>: group descriptors corrupted</pre></div></div>

<p>fsck didn&#8217;t want to help and was stopping after this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> fsck.ext3 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd1           
e2fsck 1.41.14 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">22</span>-Dec-<span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
fsck.ext3: Group descriptors look bad... trying backup blocks...
fsck.ext3: A block group is missing an inode table <span style="color: #000000; font-weight: bold;">while</span> checking ext3 journal <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd1</pre></div></div>

<p>What you can try to do to recover at least some data is to use backup superblock. Run mke2fs command (as root):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> mke2fs <span style="color: #660033;">-n</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd1
mke2fs 1.41.14 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">22</span>-Dec-<span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Filesystem <span style="color: #007800;">label</span>=
OS <span style="color: #7a0874; font-weight: bold;">type</span>: Linux
Block <span style="color: #007800;">size</span>=<span style="color: #000000;">4096</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">log</span>=<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Fragment <span style="color: #007800;">size</span>=<span style="color: #000000;">4096</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">log</span>=<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">Stride</span>=<span style="color: #000000;">0</span> blocks, Stripe <span style="color: #007800;">width</span>=<span style="color: #000000;">0</span> blocks
<span style="color: #000000;">24420352</span> inodes, <span style="color: #000000;">97677200</span> blocks
<span style="color: #000000;">4883860</span> blocks <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">5.00</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> reserved <span style="color: #000000; font-weight: bold;">for</span> the super user
First data <span style="color: #007800;">block</span>=<span style="color: #000000;">0</span>
Maximum filesystem <span style="color: #007800;">blocks</span>=<span style="color: #000000;">4294967296</span>
<span style="color: #000000;">2981</span> block <span style="color: #c20cb9; font-weight: bold;">groups</span>
<span style="color: #000000;">32768</span> blocks per group, <span style="color: #000000;">32768</span> fragments per group
<span style="color: #000000;">8192</span> inodes per group
Superblock backups stored on blocks: 
	<span style="color: #000000;">32768</span>, <span style="color: #000000;">98304</span>, <span style="color: #000000;">163840</span>, <span style="color: #000000;">229376</span>, <span style="color: #000000;">294912</span>, <span style="color: #000000;">819200</span>, <span style="color: #000000;">884736</span>, <span style="color: #000000;">1605632</span>, <span style="color: #000000;">2654208</span>, 
	<span style="color: #000000;">4096000</span>, <span style="color: #000000;">7962624</span>, <span style="color: #000000;">11239424</span>, <span style="color: #000000;">20480000</span>, <span style="color: #000000;">23887872</span>, <span style="color: #000000;">71663616</span>, <span style="color: #000000;">78675968</span></pre></div></div>

<p>Notice the numbers at the end, let&#8217;s try fsck with one of the superblock backups:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> fsck.ext3 <span style="color: #660033;">-b</span> <span style="color: #000000;">71663616</span> <span style="color: #660033;">-y</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd1
e2fsck 1.41.14 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">22</span>-Dec-<span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd1 was not cleanly unmounted, check forced.
Resize inode not valid.  Recreate? <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
Pass <span style="color: #000000;">1</span>: Checking inodes, blocks, and sizes
...</pre></div></div>

<p>It did work for me, good luck and let me know how did you do! </p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/ext2ext3-partition-block-group-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursively find the latest updated file</title>
		<link>http://techblog.zabuchy.net/2011/recursively-find-the-latest-updated-file/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=recursively-find-the-latest-updated-file</link>
		<comments>http://techblog.zabuchy.net/2011/recursively-find-the-latest-updated-file/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 22:23:57 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=813</guid>
		<description><![CDATA[Here is the command: find . -type f -printf '%TY-%Tm-%Td %TT %p\n' &#124; sort -r &#124; head]]></description>
			<content:encoded><![CDATA[<p>Here is the command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-printf</span> <span style="color: #ff0000;">'%TY-%Tm-%Td %TT %p\n'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/recursively-find-the-latest-updated-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically equalize brightness of several images</title>
		<link>http://techblog.zabuchy.net/2011/automatically-equalize-brightness-of-several-images/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automatically-equalize-brightness-of-several-images</link>
		<comments>http://techblog.zabuchy.net/2011/automatically-equalize-brightness-of-several-images/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 22:15:46 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=760</guid>
		<description><![CDATA[Introduction I have a collection of 160 photos that I would like to montage into a movie. Each photo was done on a different day and the brightness of each photo varies. This will definitely not look good on the photo, so I&#8217;ve decided to &#8220;normalize&#8221; the brightness across the images. That is: Find a [...]]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>I have a collection of 160 photos that I would like to montage into a movie. Each photo was done on a different day and the brightness of each photo varies. This will definitely not look good on the photo, so I&#8217;ve decided to &#8220;normalize&#8221; the brightness across the images. That is:</p>
<ul>
<li>Find a value for average brightness of my images.</li>
<li>Brighten those too dark, and darken those that are too bright. Contrast should also be adjusted.</li>
</ul>
<h3>Calculate average image brightness</h3>
<p>I have used utility called <strong>identify</strong> from ImageMagick package</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> identify <span style="color: #660033;">-format</span> <span style="color: #ff0000;">&quot;%[mean] %f<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">*</span>JPG <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-rn</span> 
<span style="color: #000000;">44153.8</span> 2011.06.22.JPG
<span style="color: #000000;">37955.8</span> 2011.06.11.JPG
<span style="color: #666666; font-style: italic;">#...many more...</span>
<span style="color: #000000;">23019.2</span> 2011.06.01.JPG
<span style="color: #000000;">21256.8</span> 2011.06.06.JPG</pre></div></div>

<p><strong>-format</strong> option allows for specifying what kind of information about the image we want to output. In this case I went for average brightness &#8211; <strong>%[mean]</strong> and filename &#8211; <strong>%f</strong>, see the <a href="http://www.imagemagick.org/script/escape.php">full documentation</a> if you&#8217;re interested in other possibilities.</p>
<p>The difference between top and bottom photos is quite big: <strong>21256.8</strong> for <strong>2011.06.06.JPG</strong> and <strong>44153.8</strong> for <strong>2011.06.22.JPG</strong> &#8211; see the photos below.</p>
<div class="gallery">
<dl class="gallery-item gallery-columns-2">
<dt class="gallery-icon"><a href="http://techblog.zabuchy.net/?attachment_id=766" title="The darkest photo" rel="attachment"><img src="http://techblog.zabuchy.net/wp-content/uploads/2011/08/2011.06.06.jpg" alt="The darkest photo" class="gallery-image attachment-thumbnail"></a></dt>
<dd class="gallery-caption">The darkest photo</dd>
</dl>
<dl class="gallery-item gallery-columns-3">
<dt class="gallery-icon"><a href="http://techblog.zabuchy.net/?attachment_id=765" title="The brightest photo" rel="attachment"><img src="http://techblog.zabuchy.net/wp-content/uploads/2011/08/2011.06.22.jpg" alt="The brightest photo" class="gallery-image attachment-thumbnail"></a></dt>
<dd class="gallery-caption">The brightest photo</dd>
</dl>
</div>
<p>Now let&#8217;s calculate the average value of brightness &#8211; awk to the rescue!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> identify  <span style="color: #660033;">-format</span> <span style="color: #ff0000;">&quot;%[mean] %f<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">*</span>JPG <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-rn</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'BEGIN {FS=&quot; &quot;} { sum += $1; } END { printf &quot;%s&quot;,sum/NR}'</span> 
<span style="color: #000000;">29481.9</span></pre></div></div>

<h3>Equalize the brightness</h3>
<p>So I need to bring all the photos to the mean brightness of about 29481.9. The best option I&#8217;ve found to do that is to use <strong>-sigmoidal-contrast</strong> from ImageMagick. I don&#8217;t know what values for <strong>-sigmoidal-contrast</strong> I need to use, to get from one brightness to another, so I wrote a simple script that will try to do that using binary search algorithm. It&#8217;s really very quick &#038; dirty script but it does the job. The main loop is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">do</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$current</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$min</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$brightness</span> <span style="color: #339933;">=</span> adjust<span style="color: #009900;">&#40;</span><span style="color: #000088;">$current</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$diff</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$target</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$brightness</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$diff</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//we need to make it lighter</span>
<span style="color: #000088;">$min</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$current</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//we need to make it darker</span>
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$current</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">abs</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$diff</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>adjust function basically calls external convert utility to perform the adjustment:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">convert <span style="color: #007800;">$file</span> <span style="color: #660033;">-sigmoidal-contrast</span> <span style="color: #ff0000;">'$value,0%'</span> <span style="color: #007800;">$tmpfile</span></pre></div></div>

<p>and then checks and returns the brightness after conversion. I use <strong>-sigmoidal-contrast</strong> option to increase brightness and <strong>+sigmoidal-contrast</strong> to decrease. Now, that&#8217;s much better:</p>
<div class="gallery">
<dl class="gallery-item gallery-columns-2">
<dt class="gallery-icon"><a href="http://techblog.zabuchy.net/?attachment_id=766" title="The darkest photo after script run" rel="attachment"><img src="http://techblog.zabuchy.net/wp-content/uploads/2011/08/2011.06.061.jpg" alt="The darkest photo after script run" class="gallery-image attachment-thumbnail"></a></dt>
<dd class="gallery-caption">The darkest photo after script run</dd>
</dl>
<dl class="gallery-item gallery-columns-3">
<dt class="gallery-icon"><a href="http://techblog.zabuchy.net/?attachment_id=765" title="The brightest photo after script run" rel="attachment"><img src="http://techblog.zabuchy.net/wp-content/uploads/2011/08/2011.06.221.jpg" alt="The brightest photo after script run" class="gallery-image attachment-thumbnail"></a></dt>
<dd class="gallery-caption">The brightest photo after script run</dd>
</dl>
</div>
<p>Here is <a href='http://techblog.zabuchy.net/wp-content/uploads/2011/08/equalize.php_.txt'>the complete script</a> &#8211; as I&#8217;ve said: quick &#038; dirty job.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/automatically-equalize-brightness-of-several-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to find the widest image</title>
		<link>http://techblog.zabuchy.net/2011/how-to-find-the-widest-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-find-the-widest-image</link>
		<comments>http://techblog.zabuchy.net/2011/how-to-find-the-widest-image/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 21:56:06 +0000</pubDate>
		<dc:creator>Tomasz Muras</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://techblog.zabuchy.net/?p=756</guid>
		<description><![CDATA[Recently I had to locate the widest image in the set of photos in a directory. Here is how you can easily do it with identify command, from ImageMagick suit: % identify -format '%w %f\n' * &#124; sort -rn &#124; head -n1 563 2010.12.30.JPG You can see in the output that the widest image is [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to locate the widest image in the set of photos in a directory. Here is how you can easily do it with identify command, from ImageMagick suit:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">%</span> identify <span style="color: #660033;">-format</span> <span style="color: #ff0000;">'%w %f\n'</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-rn</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-n1</span>
<span style="color: #000000;">563</span> 2010.12.30.JPG</pre></div></div>

<p>You can see in the output that the widest image is <strong>563</strong> pixels wide and the filename is <strong>2010.12.30.JPG</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.zabuchy.net/2011/how-to-find-the-widest-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

