<?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>Mario Carrion &#187; january</title>
	<atom:link href="http://blog.mariocarrion.com/tag/january/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mariocarrion.com</link>
	<description>personal blog</description>
	<lastBuildDate>Tue, 18 Oct 2011 00:03:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Die bug!</title>
		<link>http://blog.mariocarrion.com/2011/01/12/die-bug/</link>
		<comments>http://blog.mariocarrion.com/2011/01/12/die-bug/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 18:29:12 +0000</pubDate>
		<dc:creator>Mario Carrion</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[2011]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[january]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[resolutions]]></category>

		<guid isPermaLink="false">http://blog.carrion.mx/?p=647</guid>
		<description><![CDATA[Every once in a while I have to fix a bug that really drives me crazy. When this happens I usually recall one morning in the Computer Lab, back in college, one of my professors saying: &#8220;It doesn&#8217;t matter what you do, it doesn&#8217;t matter if you get upset or mad. You won&#8217;t beat the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/mariocarrion/5349091765/" title="Dead fly by Mario Carrion, on Flickr"><img src="http://farm6.static.flickr.com/5208/5349091765_7618eedc5b_m.jpg" width="240" height="160" alt="Dead fly" class="aligncenter" /></a></p>
<p>Every once in a while I have to fix a bug that really drives me crazy. When this happens I usually recall one morning in the Computer Lab, back in college, one of my professors saying: &#8220;It doesn&#8217;t matter what you do, it doesn&#8217;t matter if you get upset or mad. You won&#8217;t beat the computer&#8221;. That morning I didn&#8217;t understand what he was trying to say. Actually I thought he was making fun of us. Foolish Mario, he wasn&#8217;t trying to do that. He was trying to advice us: to always stay calm.</p>
<p>Software Development could be stressful sometimes, if you write software you already know that. Even if you are an experienced programmer knowing the tools and loving writing software you will eventually face a situation, usually fixing a bug, that will drive you crazy and this gets worse when time is constrained, which usually is. At that time is when you have to breath deeply and evaluate every single piece of the puzzle. That&#8217;s when you begin enjoying the situation.</p>
<p>Software programmers like to fix, create and understand stuff, specially people with technical background, like me. We are also kind of masochists and we never give up. In my case I like saving those tips because I&#8217;m certain that I will need that information in the future.</p>
<p>The following is a list of tips that I wanted to share (<strong>and save!</strong>) and might be useful when debugging and/or writing software on Linux. Almost all tips are for debugging shared libraries however most of them will work for anything else besides shared libraries. There might be similar alternatives for the other OSs, I&#8217;m not sure though. </p>
<h3>LD_DEBUG</h3>
<p>If you write shared libraries or if have built any package from source you might be familiar with LD_LIBRARY_PATH, an environment variable meant to be used for specifying directories where to search libraries first, recommended for <i>development and testing</i>, nothing else. Well there&#8217;s another environment variable called <i>LD_DEBUG</i>, really useful for debugging. It basically outputs all dl* function calls. Use <i>LD_DEBUG=help command</i> for help.</p>
<h3>nm and objdump</h3>
<p>GNU Binutils is fascinating and has several utilities, however most of the time you will use only those two commands. Reading the manual is the best way to understand them. Basically they help you by listing the symbols used and exported in object files. I&#8217;ve used this two commands to make sure the final file, after linking, doesn&#8217;t reference to any other library I don&#8217;t need, and to make sure my shared libraries export the functions that were meant to export.</p>
<h3>stop-on-solib-events</h3>
<p>One of the hidden gems of gdb. Setting <a href="http://sourceware.org/gdb/download/onlinedocs/gdb/Files.html#Files">stop-on-solib-events</a> to 1 will allow you to pause the execution of your program when a shared library is loaded. Really useful to know <i>why is my shared library loaded twice?</i> or <i>who is loading what library?</i>. See the other commands to specify files.</p>
<h3>ldd and pmap</h3>
<p>These are quite similar, both somehow tell you dependencies. The main difference is that <i>ldd</i> shows what libraries are required and <i>pmap</i> shows you process memory mapping, this means memory used and what libraries are actually used for the program.</p>
<h3>strace</h3>
<p>Traces all calls and signals used by the program. Using -e to define expressions is required unless you want to see lines and lines of calls. It could be useful if you want to profile you program.</p>
<h3>valgrind</h3>
<p>Required for profiling. In my previous job I used a lot since all applications were running 24&#215;7 and memory was one of the most important things. I usually leave the application running for days using the following arguments: <i>&#8211;leak-check=full &#8211;leak-resolution=high &#8211;show-reachable=yes</i> then I comeback <i>ctrl+c</i> and I see the results.</p>
<h3>Something else?</h3>
<p>I&#8217;m sure I&#8217;m missing more commands, some of them language/platform-specific however I&#8217;m also sure this list will help me recalling what to check first when debugging shared libraries.</p>
<h3>References</h3>
<ul>
<li><a href="http://tldp.org/HOWTO/Program-Library-HOWTO/index.html">Programming Howto</a></li>
<li><a href="http://www.gnu.org/software/binutils/">Binutils</a></li>
<li><a href="http://sourceware.org/gdb/download/onlinedocs/gdb/index.html">Debugging with gdb</a></li>
<li><a href="http://www.network-theory.co.uk/docs/valgrind/">Valgrind 3.3 &#8211; Advanced Debugging and Profiling</a>, you can buy the book on <a href="http://www.amazon.com/Valgrind-3-3-Debugging-Profiling-applications/dp/0954612051/ref=sr_1_1?ie=UTF8&#038;qid=1294854842&#038;sr=8-1">Amazon</a> too.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariocarrion.com/2011/01/12/die-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parallel Development Environments? Pulque!</title>
		<link>http://blog.mariocarrion.com/2010/01/25/parallel-development-environments-pulque/</link>
		<comments>http://blog.mariocarrion.com/2010/01/25/parallel-development-environments-pulque/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 03:15:59 +0000</pubDate>
		<dc:creator>Mario Carrion</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[january]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[pulque]]></category>
		<category><![CDATA[resolutions]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.carrion.ws/?p=634</guid>
		<description><![CDATA[By Claire L. Evans / CC BY-ND 2.0 This is an updated version of Multiple Parallel Mono Environments. What is Pulque? Pulque is a collection of applications written in Ruby and Bash scripting to maintain parallel development environments. Why does Pulque exist? Three reasons: I need to keep multiple versions installed of the same software, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/astro-dudes/2735367731/"><img title="¡Quiero pulque! by Claire L. Evans" src="http://farm4.static.flickr.com/3108/2735367731_73c00175a0_m.jpg" alt="¡Quiero pulque!" width="240" height="180" /></a></p>
<p><a rel="cc:attributionURL" href="http://www.flickr.com/photos/astro-dudes/">By Claire L. Evans</a> / <a rel="license" href="http://creativecommons.org/licenses/by-nd/2.0/">CC BY-ND 2.0</a></p>
<p><em>This is an updated version of <a href="/2009/07/01/multiple-parallel-mono-environments/">Multiple Parallel Mono Environments</a>.</em></p>
<h3>What is Pulque?</h3>
<p><em>Pulque</em> is a collection of applications written in Ruby and Bash scripting to maintain parallel development environments.</p>
<h3>Why does Pulque exist?</h3>
<p>Three reasons:</p>
<ol>
<li>I need to keep <em>multiple versions installed</em> of the same software,</li>
<li>I need to know what <em>Version Control System</em> is used by the software, and the most important</li>
<li>I want to keep myself <strong>sane</strong>.</li>
</ol>
<p>At work, I have to interact with different open source projects, most of them use <a href="http://subversion.tigris.org/">Subversion</a> and <a href="http://git-scm.com/">Git</a>, but some others use <a href="http://bazaar.canonical.com/en/">Bazaar</a> and <a href="http://mercurial.selenic.com/">Mercurial</a>. Keeping track of the current parallel development environment and the VCS used by the software is exhausting.</p>
<p>You spend time focusing on something that shouldn&#8217;t be that important: </p>
<ul>
<li>Managing your parallel environments and,</li>
<li>Keeping track of the VCS used by the software</li>
</ul>
<p>Is easy to get confused when interacting with the repository, for example, executing <em>svn update</em> when the software is stored in a <em>git</em> repository. Is silly, but <strong>it happens</strong>. Unless you are using an IDE that support Multiple Parallel Development Environments you will need the terminal to configure and build your projects.</p>
<p><em>Pulque</em> helps you maintaining parallel development environments by: </p>
<ul>
<li>Printing in the bash prompt the <em>name of the parallel development environment</em> and <em>the type of the VCS</em>, this information is updated depending on the working directory, </li>
<li>Defining aliases to the default commands used to configure and build the software project, to always prefix your projects using your parallel environment, and</li>
<li>Showing a failure or success alert when the command finishes.</li>
</ul>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/Fj3dsNwWOVQ&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fj3dsNwWOVQ&#038;hl=en_US&#038;fs=1&#038;color1=0x3a3a3a&#038;color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<h3>Installing and using Pulque</h3>
<p>Follow the instructions in <a href="http://github.com/mariocarrion/pulque/blob/master/INSTALL">INSTALL</a>, or if you are using openSUSE 11.2:</p>
<p style="text-align: center;"><a href="http://download.opensuse.org/repositories/home:/MarioCarrion/openSUSE_11.2/pulque.ymp"><img alt="OneClick Install" src="http://www.mariocarrion.com/icons/oneclick.png" title="OneClick Install" width="162" height="46" class="aligncenter"  /><br />Click here to drink Pulque!</a></p>
<p>Don&#8217;t forget to add the function <em>pswitch</em> to your <em>.bashrc</em>. Bash will autocomplete your environment name when using <em>TAB TAB</em>.</p>
<pre class="brush:bash">
function pswitch {
  source /usr/bin/__pswitch $1
}
</pre>
<p>Read the <a href="http://github.com/mariocarrion/pulque/blob/master/USING">USING</a> file to understand how to use <em>Pulque</em> in the daily basis. If you find something weird or interesting please <a href="http://github.com/mariocarrion/pulque/issues">create an issue</a> to fix it.</p>
<h3>Colophon</h3>
<p>According to <a href="http://en.wikipedia.org/wiki/Pulque ">Wikipedia</a>: &#8220;<em>Pulque, or octli, is a milk-colored, somewhat viscous alcoholic beverage made from the fermented sap of the maguey plant, and is a traditional native beverage of Mexico.</em>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariocarrion.com/2010/01/25/parallel-development-environments-pulque/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Ruby Programming Language</title>
		<link>http://blog.mariocarrion.com/2010/01/21/the-ruby-programming-language/</link>
		<comments>http://blog.mariocarrion.com/2010/01/21/the-ruby-programming-language/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 04:50:49 +0000</pubDate>
		<dc:creator>Mario Carrion</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[january]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[resolutions]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.carrion.ws/?p=635</guid>
		<description><![CDATA[A couple of days ago I finished reading: The Ruby Programming Language, book written by David Flanagan and Yukihiro Matsumoto. If I have to say anything about the book and, the language, of course, is: I am impressed. The syntax is pretty for writing and simple for reading. Its simplicity makes you understand the code, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/mariocarrion/4294063393/" title="Ruby by Mario Carrion, on Flickr"><img src="http://farm3.static.flickr.com/2758/4294063393_54d8564980_m.jpg" width="240" height="160" alt="Ruby" /></a></p>
<p>A couple of days ago I finished reading: <a href="http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177">The Ruby Programming Language</a>, book written by David Flanagan and Yukihiro Matsumoto. If I have to say anything about the book and, the language, of course, is: I am impressed. The syntax is pretty for writing and simple for reading. Its simplicity makes you understand the code, is like visualizing the goal of the program in your mind by reading it, not running it. It is like reading a well written letter. You just understand.</p>
<p>I must say, when I was reading the book, at the beginning. I did not feel comfortable with the weird, at that time, syntax. Method decorations such as <em>&#8220;!&#8221;</em> and <em>&#8220;?&#8221;</em>, and the support for methods aliases made no sense. Actually I thought I was wasting my time by trying to learn the language. I was wrong.</p>
<p>When I learned C++ several years ago, I did not have reference to object orientation or any object-oriented programming language. Learning it was difficult, but, at the same time, easy. Difficult because I did not know the paradigm, easy because it was my first time learning that kind of syntax. After learning C++ I decided to learn Java and after that, I decided to learn C#.</p>
<p>And I learned them all the same way. I <em>&#8220;translated&#8221;</em> the syntax. Translated it from the <em>&#8220;new language&#8221;</em> to the <em>&#8220;old language&#8221;</em>. I did learn them all. And I thought, for long time, that the rule was: <em>&#8220;Learn all the languages the same way: by translation&#8221;</em>. I was wrong. Again.</p>
<p>Learning a new programming language, in my opinion, is better when you do not translate the new language. Similar to learn to speak a new language. In both cases, you have <strong>to think in the language</strong>. I decided to think in the new language. To do it that way. The Ruby way. The results were amazing. Were so amazing that inspired me to write <a href="http://github.com/mariocarrion/pulque">a project</a> in Ruby. I wanted to try out the syntax, the platform and the community. To see if the language was that good as I thought. </p>
<p>After trying it out. No disappointments at all. Actually is interesting that C# and Ruby share a lot of things, syntactically speaking. Both of them are pretty languages. Probably they do not share goals. However, I&#8217;m sure they share one goal: to make the life of the software developer easier. And, to a software developer, a programming language, and everything around it, that makes your life easier is what matters the most.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariocarrion.com/2010/01/21/the-ruby-programming-language/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

