<?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"
	>

<channel>
	<title>HALCODE</title>
	<atom:link href="http://www.halcode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.halcode.com</link>
	<description>Computer Science Reviews: Passion for (my badly written) code</description>
	<pubDate>Wed, 17 Sep 2008 17:08:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>In Web We Trust</title>
		<link>http://www.halcode.com/archives/2008/09/18/in-web-we-trust/</link>
		<comments>http://www.halcode.com/archives/2008/09/18/in-web-we-trust/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 17:02:11 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Computer Science]]></category>

		<category><![CDATA[analysis]]></category>

		<category><![CDATA[bbc]]></category>

		<category><![CDATA[berners-lee]]></category>

		<category><![CDATA[evolution]]></category>

		<category><![CDATA[internet]]></category>

		<category><![CDATA[large hadron collider]]></category>

		<category><![CDATA[privacy]]></category>

		<category><![CDATA[scientific american]]></category>

		<category><![CDATA[trust]]></category>

		<category><![CDATA[trust models]]></category>

		<category><![CDATA[web]]></category>

		<category><![CDATA[web science]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=349</guid>
		<description><![CDATA[
The BBC has an interesting news report,  Warning sounded on web's future, on the worries of Tim Berners-Lee about the spreading of disinformation using the web. The article also touches on other related topics such as extending the reach of the web and improving the web's usability.  
Regarding the problem of publishing insincere [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://www.halcode.com/images/spider_web.jpg" alt="Spíder's Web" /></p>
<p>The BBC has an interesting news report,  <a href="http://news.bbc.co.uk/1/hi/technology/7613201.stm" title="Warning sounded on web's future" onclick="javascript:pageTracker._trackPageview ('/outbound/news.bbc.co.uk');">Warning sounded on web's future</a>, on the worries of <a href="http://en.wikipedia.org/wiki/Tim_Berners-Lee" title="Tim Berners-Lee" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Tim Berners-Lee</a> about the spreading of disinformation using the web. The article also touches on other related topics such as extending the reach of the web and improving the web's usability.  </p>
<p>Regarding the problem of publishing insincere or <span class="meaning">unfounded </span>information on the web, Berners-Lee cites a recent campaign started because of the activation of the Large Hadron Collider. Specifically, some groups used the web for communicate invalid beliefs about the world being destroyed by effect of the LHC. This use of the web is, in first instance, unethical. Further, it may transmit fears, and additionally, the information posted by such groups has no scientific grounds. This a typical example of misusing a system.  </p>
<p>This kind of problem arises because of the web's intrinsic nature. The web is a different system... a system which is now inevitably linked to the behavior and trends of human society. The web is an <em>open</em> and <em>complex</em> system. It's open because we can add as much information as we want, and it's complex because it's composed of a huge amount of producers and consumers of information, and their interactions. There is other factor that shapes the web complexity: <strong>evolution</strong></p>
<p>The web changes at very high rates. The web's technologies an content change so quickly, that it's impossible for any person to assimilate all this evolution. After all, the user only wants to open her browser and read the news. Typically, she is interested neither in the technical details behind the publishing platform, nor in the path followed by the information until arriving to the final form on the online media. There is a tool the user recurs to in order to fight complexity: <strong>trust</strong>.<br />
<span id="more-349"></span><br />
The user of the web has some expectations about her relationship with information: veracity, reliability, availability and security. However, these expectations are sometimes hard to meet in a system so open and complex such as the web. We are relatively accustomed to reading about privacy and copyright issues on the web. For example, the September 2008 Scientific American is a special issue on <a href="http://www.sciam.com/sciammag/?contents=2008-09" onclick="javascript:pageTracker._trackPageview ('/outbound/www.sciam.com');">The Future of Privacy</a>, loaded with plenty of excellent articles.</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.halcode.com/images/cover_2008-09.jpg" alt="Spíder's Web" /></p>
<p>Disruption of privacy and copyright certainly undermines trust. Nevertheless, the web has too much power over the whole world. It can modify the behavior of social groups. Our modern dependence on the web makes us very vulnerable to the plots of groups and interested corporations. Therefore, structures for identifying trustworthiness of a site may be desirable. But I believe that the web itself tends to its own well-being. Precisely, its complexity and openness makes it very resilient to attacks and fake information. The web empowers the people and, in  turn, is empowered by people. Ultimately, fake data will be identified and disregarded. It's the same idea behind Wikipedia's trustworthiness.  </p>
<p>Finally, there are other interesting challenges identified by Berners-Lee. First, we have to look at extensions of the current web infrastructure in order to improve access to information (easier and broader access). We also have to protect the web of groups or corporations pretending to abuse the web to meet their egoist goals. We have to care for the web because, after all, our future and evolution is inextricably linked to the web's.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/09/18/in-web-we-trust/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Computer Science Questions 2</title>
		<link>http://www.halcode.com/archives/2008/09/14/computer-science-questions-2/</link>
		<comments>http://www.halcode.com/archives/2008/09/14/computer-science-questions-2/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 02:09:27 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[C]]></category>

		<category><![CDATA[Computer Science]]></category>

		<category><![CDATA[Digital Signal Processing]]></category>

		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Speech Technologies]]></category>

		<category><![CDATA[acoustic]]></category>

		<category><![CDATA[const]]></category>

		<category><![CDATA[distributed systems]]></category>

		<category><![CDATA[formants]]></category>

		<category><![CDATA[glottis]]></category>

		<category><![CDATA[impedance]]></category>

		<category><![CDATA[networks]]></category>

		<category><![CDATA[resonances]]></category>

		<category><![CDATA[sound]]></category>

		<category><![CDATA[speech]]></category>

		<category><![CDATA[stub]]></category>

		<category><![CDATA[tube]]></category>

		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=280</guid>
		<description><![CDATA[Again, I'll be answering some questions I've received in my inbox, just like in the previous post of this series.

I want to know how to declare a const variable in one file and access it from other files? (C++) by Ricardo Orozco (Venezuela).
It's a fairly basic question, and reveals that you have to study more [...]]]></description>
			<content:encoded><![CDATA[<p>Again, I'll be answering some questions I've received in my inbox, just like in <a href="http://www.halcode.com/archives/2008/08/23/computer-science-questions/">the previous post of this series</a>.</p>
<ol>
<li><strong>I want to know how to declare a const variable in one file and access it from other files? (C++)</strong> by Ricardo Orozco (Venezuela).
<p>It's a fairly basic question, and reveals that you have to study more C++. What you want is to define a <code>const</code> variable at global scope. Unlike non-<code>const</code> variables (which are <code>extern</code> by default), <code>const</code> variables are local to the file in which they are defined. Therefore, you cannot access them from other files unless you specify that the variable is <code>extern</code>. </p>
<p>For instance, if you specify <code>extern</code> when defining the variable</p>
<p><code>bufferSize</code> in file1.cc<code>extern const int bufferSize = 512;</code></p>
<p>you can access <code>bufferSize</code> from any other file, say, file2.cc</p>
<p><code>extern const int bufferSize; // we are using bufferSize from file1.cc</code></li>
<li><strong>I'm just starting to study speech synthesis, and I'm faced with the calculus of resonances in an uniform acoustic tube. The glottal end is closed, but the mouth is open. Could you expand on this?</strong> by Bakuman.
<p>This is the configuration you are studying:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://www.halcode.com/images/tubounif.png" alt="" /></p>
<p>The acoustic tube is uniform, and its length is L. The glottis, located at x=-L, is closed (infinite impedance) and the mouth, located at x=0, is open (impedance zero). Now, pressure variation p(x) along this uniform acoustic tube is expressed as:</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=%5Cfrac%7Bd%5E2p%7D%7Bdx%5E2%7D+%2B+%5Cleft%28%5Cfrac%7B2%5Cpi+f%7D%7Bc%7D%5Cright%29%5E2p+%3D+0+%7E%7E%28I%29&bg=FFFFFF&fg=000000'  alt="\frac{d^2p}{dx^2} + \left(\frac{2\pi f}{c}\right)^2p = 0 ~~(I)" /></p>
<p>where f represents frequency in Hz, and c is the speed of sound: <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=3.53+%5Ctimes+10%5E4+cm%2Fs&bg=FFFFFF&fg=000000'  alt="3.53 \times 10^4 cm/s" /> at 37° C.</p>
<p>According to the boundary conditions (the impedances at both ends), the solution is:</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=p%28x%29+%3D+P_m+%5Csin%7B%5Cfrac%7B2%5Cpi+f%7D%7Bc%7Dx%7D+%7E%7E%28II%29&bg=FFFFFF&fg=000000'  alt="p(x) = P_m \sin{\frac{2\pi f}{c}x} ~~(II)" /></p>
<p>where <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=P_m&bg=FFFFFF&fg=000000'  alt="P_m" /> is the peak in sound pressure. On the other hand, we have a relation between pressure and volume velocity</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=%5Cfrac%7Bdp%7D%7Bdx%7D+%3D+-%5Cfrac%7Bj2%5Cpi+f+%5Crho%7D%7BA%7DU+%7E%7E%28III%29&bg=FFFFFF&fg=000000'  alt="\frac{dp}{dx} = -\frac{j2\pi f \rho}{A}U ~~(III)" /></p>
<p><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=A&bg=FFFFFF&fg=000000'  alt="A" /> is a constant representing the tube's area. Now, volume velocity can be expressed as</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=U%28x%29+%3D+jP_m+%5Cfrac%7BA%7D%7B%5Crho+c%7D+%5Ccos%7B%5Cfrac%7B2%5Cpi+f%7D%7Bc%7Dx%7D+%7E%7E%28IV%29&bg=FFFFFF&fg=000000'  alt="U(x) = jP_m \frac{A}{\rho c} \cos{\frac{2\pi f}{c}x} ~~(IV)" /></p>
<p>where <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=%5Crho&bg=FFFFFF&fg=000000'  alt="\rho" /> equals the average atmospheric density  (<img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=1.14+%5Ctimes+10%5E%7B-3%7D+gm+%2F+cm+%5E+3&bg=FFFFFF&fg=000000'  alt="1.14 \times 10^{-3} gm / cm ^ 3" /> at 37°C). </p>
<p>As U(−L) = 0, resonances Fn of the acoustic tube are</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=Fn+%3D+%5Cfrac%7B2n+-+1%7D%7B4%7D%5Cfrac%7Bc%7D%7BL%7D+%7E%7E%28V%29&bg=FFFFFF&fg=000000'  alt="Fn = \frac{2n - 1}{4}\frac{c}{L} ~~(V)" /></p>
<p>where n=1, 2, 3... And that's it. We can see that the area function does not affect the location of resonances. Finally, remember that, in average, the male oral tract has a length of 16.9 cm, and the female tract has an average length of 14.1 cm.</li>
<li> <strong>What's an stub?</strong> by Dani Hoffmann (Colombia).
<p>It really, really depends on the context. Your question is too ambiguous. A Stub may even be a relative of the Danish poet <a href="http://en.wikipedia.org/wiki/Ambrosius_Stub" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Ambrosius Stub</a>. After all, <a href="http://wordpress.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/wordpress.org');">code is poetry</a>.</p>
<p>In computing, I know of 4 contexts where the word <strong>stub</strong> has a well-established meaning:</p>
<ol>
<li> <strong>Web Sites</strong>: A stub is a web page in progress, i.e., a page which provides minimal information and is intended for later development. For instance, a <a href="http://en.wikipedia.org/wiki/Wikipedia:Stub" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Wikipedia stub</a> is a short article in need of expansion.</li>
<li> <strong>Coding</strong>: During development, we sometimes use a "skeleton" function (or procedure, or method) to simulate some intended (but not yet implemented) functionality. For instance, the function may stand in for a complex algorithm to be developed later, or simulate a procedure running on a remote host. Such placeholder function is called a <strong>stub function</strong>. Stub functions come in handy for quick prototyping and testing.</li>
<li> <strong>Distributed Systems</strong>: In distributed systems, a <strong>service interface</strong> defines the services available to programs. These services are distributed among several networked machines. In distributed systems, a program in <em>machine A</em> may request a service by calling a procedure. However, the procedure may be offered by a remote host, say, <em>machine B</em>. Remote Procedure Calls (RPC) are a paradigm of distributed systems aimed at abstracting the communication between hosts in a network. The goal of RPCs is to hide the details of the remote call. The remote call should look like a local one, i.e., the program in machine A would invoke the procedure in machine B as it would invoke a procedure locally. Under the hood, though, it's obvious that we have to transmit information from the client (caller) to the server (callee), and in the other direction. Now, how to hide the fact that we are calling a procedure located in other machine? This is the basic idea of RPCs:
<ul>
<li>In the address space of the client, we represent the server procedure by means of a local procedure called <strong>client stub</strong>. Likewise, the server is also linked to a <strong>server stub</strong>, which will receive the message from the client stub.</li>
<li>When machine A requests a service which is provided by machine B, a call is made to the client stub (which has the same name as the procedure in B). As the client stub lies in the same address space of the caller, the invocation is handled locally, and the program sees this invocation as a local one. However, the client stub <em>marshalls</em> the received parameters and sends them, throught the network, to the server stub. In turn, the server stub <em>unmarshalls</em> the parameters and perform the call to the real procedure in the server. When the server procedure finishes, results or exception data travels back, from server to client. By the way, marshalling is the process of taking a collection of data items (such as the procedure name and its arguments) and grouping them according to some predefined representation, suitable for transmission over the network. The server should know and conform to this representation in order to unmarshall the received data and recover the transmitted information.</li>
</ul>
<p>Albeit conceptually simple, there are some interesting (nasty) problems for implementing RPCs, such as passing pointer arguments (remember that client and server have different address spaces).
</li>
<li><strong>Computer Networking</strong>: A <strong>stub network</strong> is a network or part of network with only one communication path to external networks (non-local hosts). For instance, if we connect to our Internet Service Provider using only one router, our local network is a stub network with respect to our provider.</li>
</ol>
<p>There is other related context for stubs: in electronics, we identify <a href="http://en.wikipedia.org/wiki/Stub_(circuit)" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Stub sections</a>, which are mostly used for impedance matching in transmission lines. But I'm not too familiar with this "stub" meaning.</li>
</ol>
<p>As always, it was a pleasure to answer your questions. Thank you very much.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/09/14/computer-science-questions-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Central Abstraction: The Process (I)</title>
		<link>http://www.halcode.com/archives/2008/08/30/a-central-abstraction-the-process-i/</link>
		<comments>http://www.halcode.com/archives/2008/08/30/a-central-abstraction-the-process-i/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 16:01:46 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Speech Technologies]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[cpu]]></category>

		<category><![CDATA[hardware]]></category>

		<category><![CDATA[ipc]]></category>

		<category><![CDATA[process]]></category>

		<category><![CDATA[program]]></category>

		<category><![CDATA[scheduling]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[von neumann]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=218</guid>
		<description><![CDATA[Abstractions
I do strongly believe in abstraction being the root of computing (however, you may want to read Is abstraction the key to computing? as a motivation for a different perspective on the role of abstraction in computing). Modern hardware and software systems include a lot of features and perform so many tasks that it is [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Abstractions</strong></p>
<p>I do strongly believe in <em>abstraction</em> being the root of computing (however, you may want to read <a href="http://doi.acm.org/10.1145/1232743.1232745" title="Is Abstraction the Key to Computing?" onclick="javascript:pageTracker._trackPageview ('/outbound/doi.acm.org');">Is abstraction the key to computing?</a> as a motivation for a different perspective on the role of abstraction in computing). Modern hardware and software systems include a lot of features and perform so many tasks that it is impossible to understand, build and use them without recurring to abstractions. For instance, let's take a look at the CPU: it is the central part of a general purpose computing system, and is also an extremely complex system in itself. Functionally, a CPU is an <em>instruction-crunching device</em>: it processes one instruction after another, following the steps of <strong>fetch</strong>, <strong>decode</strong>, <strong>execute</strong> and <strong>writeback</strong> (in <a href="http://en.wikipedia.org/wiki/Von_Neumann_architecture" title="von Neumann architectures" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">von Neumann architectures</a>). In other words, the CPU retrieves the instruction from memory, decodes it, executes it, and put the results of the operation back into memory. Further, the CPU has no clue (and actually does not care) about the higher-level semantics of the instruction it may be executing at a specific time. For example, the CPU may be executing an instruction related to a spell-checking task, and a few instructions later it may be executing an instruction related to other task, say, MP3 playing. It only follows orders, and just execute the instruction it is told to execute.</p>
<p>Nowadays, computing systems are expected to do more tasks on behalf of its users. Several tasks must be performed concurrently. As in the previous example, the system might be running the spell-checker and the media player simultaneously. In multiprogrammed systems we can achieve <em>pseudoparallelism</em> by switching (multiplexing) the CPU among all the user's activities (<em>true parallelism</em> is only possible in multi-processor or multi-core systems). Remember that multiprogramming requires the CPU being allocated to each system's task for a period of time and deallocated when some condition is met.<br />
<span id="more-218"></span><br />
<strong>The Process</strong></p>
<p>So far, we've spoken about <em>activities</em> and <em>tasks</em>, comprising a sequence of instructions. Moreover, the CPU will be multiplexed among such tasks in order to execute them in a pseudoparallel fashion. However, in order to to harness such computing power, we cannot think of long sequences of instructions, which may jump from one instruction to another at any time. We require to abstract such processing into some convenient concept or model. That model, the central unit of work of operating systems, is <strong>the process</strong>. Considering a program or code as a sequence of instructions which implement some algorithm, we can state that</p>
<p style="text-align: center;"><strong>a process is a running instance of a program</strong></p>
<p><strong>Passive and Active Entities</strong></p>
<p>Code does nothing unless it's executed by a CPU. But a process is a program <em>in execution</em>. A web browser being run by an user is a process. A compiler analyzing some input files is a process. Nevertheless, it is very important to realize that a program or raw code is not a process. A program is a <em>passive</em> entity, whereas a process is an <em>active</em> entity, for which the operating system allocates structures for controlling it and handling its resources and control information.</p>
<p><strong>Further details</strong></p>
<ul>
<li>Unlike passive entities, processes use <em>resources</em>: CPU time, memory, files and I/O devices. Such resources may be requested at creation time or during the process execution. When the process finishes its task, the operating system should reclaim or retrieve any unused resource.</li>
<li>Execution of a process is <em>sequential</em>. Instructions are executed one after another, until the process finishes. Moreover, a process may spawn many subprocesses during its execution, by means of some system calls.</li>
<li>Some processes execute <em>system code</em> (operating system processes) and other processes only execute <em>user code</em> (user processes).</li>
<li>Among other responsibilities, process management involves:
<ul>
<li>creation and termination of processes,</li>
<li>scheduling,</li>
<li>suspension and resuming,</li>
<li>interprocess communication,</li>
<li>synchronization,</li>
<li>allocation and freeing of resources,</li>
<li>setting and retrieving processes' attributes.</li>
</ul>
</li>
</ul>
<p>In a forthcoming installment, we'll delve into the finer details of process management.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/08/30/a-central-abstraction-the-process-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Retrieving system time: gettimeofday()</title>
		<link>http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/</link>
		<comments>http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 01:52:31 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[C]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[epoch]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[GetSystemTimeAsFileTime]]></category>

		<category><![CDATA[gettimeofday]]></category>

		<category><![CDATA[mingw]]></category>

		<category><![CDATA[posix]]></category>

		<category><![CDATA[randomize]]></category>

		<category><![CDATA[srand]]></category>

		<category><![CDATA[system]]></category>

		<category><![CDATA[time]]></category>

		<category><![CDATA[timer]]></category>

		<category><![CDATA[unix]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=167</guid>
		<description><![CDATA[Today, a friend of mine reported a problem with gettimeofday() under MinGW. It was a relatively common error: 'gettimeofday' undeclared (first use this function). Cause and solution of this problem is kind of easy, and we'll present it at the end of the post. However, what's that function gettimeofday()?
gettimeofday() is a function for retrieving system [...]]]></description>
			<content:encoded><![CDATA[<p>Today, a friend of mine reported a problem with <code>gettimeofday()</code> under MinGW. It was a relatively common <code>error: 'gettimeofday' undeclared (first use this function)</code>. Cause and solution of this problem is kind of easy, and we'll present it at the end of the post. However, what's that function <code>gettimeofday()</code>?</p>
<p><a href="http://www.opengroup.org/onlinepubs/009695399/functions/gettimeofday.html" onclick="javascript:pageTracker._trackPageview ('/outbound/www.opengroup.org');">gettimeofday()</a> is a function for retrieving system time in <a href="http://en.wikipedia.org/wiki/POSIX" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">POSIX</a>-compliant systems. Unlike the <a href="http://www.opengroup.org/onlinepubs/009695399/functions/time.html" onclick="javascript:pageTracker._trackPageview ('/outbound/www.opengroup.org');">time()</a> function, which has a resolution of 1 second, <code>gettimeofday()</code> has a higher resolution: microseconds. Specifically, the prototype of <code>gettimeofday()</code> is:</p>
<p><code>int gettimeofday (struct timeval *tp, struct timezone *tzp)</code></p>
<p>The function retrieves the current time expressed as seconds and microseconds since the <strong>Epoch</strong>, and stores it in the <code>timeval</code> structure pointed to by <code>tp</code>. The struct <code>timeval</code> has the following members:</p>
<p><code>long int tv_sec</code>: Number of whole seconds of elapsed time.<br />
<code>long int tv_usec</code>: The rest of the elapsed time (a fraction of a second), represented as the number of microseconds.</p>
<p>Thanks to the <code>tv_usec</code> member, we have a resolution of microseconds. It's also important to remember what the <strong>Epoch</strong> is. The Epoch is just an arbitrary starting date set by the system in order to compute time, i.e., it's a <em>reference</em> or <em>base</em> time. For instance, POSIX-compliant systems measure system time as the number of seconds elapsed since the start of the epoch at 1970-01-01 00:00:00 Z.</p>
<p>On its side, the struct <code>timezone</code> was used to return information about the time zone. However, using this parameter is obsolete (e.g., it has not been and will not be supported by libc or glibc). Therefore, <code>tzp</code> should be a null pointer, else the behavior may be unspecified (check your system's specifications).</p>
<p><code>gettimeofday()</code> returns 0 for success, or -1 for fail. Simple. Further, this function should be available in <code>sys/time.h</code>. But my friend's installation of MinGW only included the following in <code>sys/time.h</code>:</p>
<pre class="c">&nbsp;
<span style="color: #339933;">#include &lt;time.h&gt;</span>
&nbsp;
<span style="color: #339933;">#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */</span>
<span style="color: #339933;">#define _TIMEVAL_DEFINED</span>
<span style="color: #993333;">struct</span> timeval <span style="color: #66cc66;">&#123;</span>
  <span style="color: #993333;">long</span> tv_sec;
  <span style="color: #993333;">long</span> tv_usec;
<span style="color: #66cc66;">&#125;</span>;
<span style="color: #339933;">#define timerisset(tvp)	 ((tvp)-&gt;tv_sec || (tvp)-&gt;tv_usec)</span>
<span style="color: #339933;">#define timercmp(tvp, uvp, cmp) \</span>
	<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>tvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_sec != <span style="color: #66cc66;">&#40;</span>uvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_sec<span style="color: #66cc66;">&#41;</span> ? \
	<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>tvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_sec cmp <span style="color: #66cc66;">&#40;</span>uvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_sec<span style="color: #66cc66;">&#41;</span> : \
	<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>tvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_usec cmp <span style="color: #66cc66;">&#40;</span>uvp<span style="color: #66cc66;">&#41;</span>-&gt;tv_usec<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #339933;">#define timerclear(tvp)	 (tvp)-&gt;tv_sec = (tvp)-&gt;tv_usec = 0</span>
<span style="color: #339933;">#endif /* _TIMEVAL_DEFINED */</span>
&nbsp;</pre>
<p><span id="more-167"></span><br />
No <code>gettimeofday()</code>. That's why gcc complained. For solving it, we can define <code>gettimeofday()</code> as a wrapper around <code>GetSystemTimeAsFileTime()</code>, which is the function for retrieving system time in Windows (Windows 2000, XP and Vista). <a href="http://msdn.microsoft.com/en-us/library/ms724397(VS.85).aspx" onclick="javascript:pageTracker._trackPageview ('/outbound/msdn.microsoft.com');">GetSystemTimeAsFileTime()</a> has a resolution of 100 nanoseconds. The complete sys/time.h (and more details) can be found in <a href="http://www.bioinformatics.org/molekel/wiki/Main/OpenBabel" onclick="javascript:pageTracker._trackPageview ('/outbound/www.bioinformatics.org');">this excellent page</a> which explains how to build <a href="http://en.wikipedia.org/wiki/OpenBabel" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">OpenBabel</a> with MinGW. Basically, you have to append the following to the original sys/time.h:</p>
<pre class="c">&nbsp;
<span style="color: #808080; font-style: italic;">/* Provided for compatibility with code that assumes that
   the presence of gettimeofday function implies a definition
   of struct timezone. */</span>
<span style="color: #993333;">struct</span> timezone
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #993333;">int</span> tz_minuteswest; <span style="color: #808080; font-style: italic;">/* of Greenwich */</span>
  <span style="color: #993333;">int</span> tz_dsttime;     <span style="color: #808080; font-style: italic;">/* type of dst correction to apply */</span>
<span style="color: #66cc66;">&#125;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">/*
   Implementation as per:
   The Open Group Base Specifications, Issue 6
   IEEE Std 1003.1, 2004 Edition
&nbsp;
   The timezone pointer arg is ignored.  Errors are ignored.
*/</span> 
&nbsp;
<span style="color: #339933;">#ifdef	__cplusplus</span>
&nbsp;
<span style="color: #993333;">void</span>  GetSystemTimeAsFileTime<span style="color: #66cc66;">&#40;</span>FILETIME*<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">inline</span> <span style="color: #993333;">int</span> gettimeofday<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">struct</span> timeval* p, <span style="color: #993333;">void</span>* tz <span style="color: #808080; font-style: italic;">/* IGNORED */</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #993333;">union</span> <span style="color: #66cc66;">&#123;</span>
	    <span style="color: #993333;">long</span> <span style="color: #993333;">long</span> ns100; <span style="color: #808080; font-style: italic;">/*time since 1 Jan 1601 in 100ns units */</span>
		FILETIME ft;
	<span style="color: #66cc66;">&#125;</span> now;
&nbsp;
    GetSystemTimeAsFileTime<span style="color: #66cc66;">&#40;</span> &amp;<span style="color: #66cc66;">&#40;</span>now.<span style="color: #202020;">ft</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
    p-&gt;tv_usec=<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">long</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>now.<span style="color: #202020;">ns100</span> / 10LL<span style="color: #66cc66;">&#41;</span> % 1000000LL <span style="color: #66cc66;">&#41;</span>;
    p-&gt;tv_sec= <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">long</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>now.<span style="color: #202020;">ns100</span>-<span style="color: #66cc66;">&#40;</span>116444736000000000LL<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>/10000000LL<span style="color: #66cc66;">&#41;</span>;
	<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #339933;">#else</span>
    <span style="color: #808080; font-style: italic;">/* Must be defined somewhere else */</span>
	<span style="color: #993333;">int</span> gettimeofday<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">struct</span> timeval* p, <span style="color: #993333;">void</span>* tz <span style="color: #808080; font-style: italic;">/* IGNORED */</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #339933;">#endif</span>
&nbsp;</pre>
<p>Finally, an interesting remark. My friend uses <code>gettimeofday()</code> to initialize <code>srand()</code>. The most common initialization one finds in books and Internet is <code>srand((unsigned)time(0))</code>, but that's a rather poor initialization. Do you want details? Read this excellent explanation by <a href="http://csl.sublevel3.org/" onclick="javascript:pageTracker._trackPageview ('/outbound/csl.sublevel3.org');">Christian Stigen Larsen</a>: <a href="http://csl.sublevel3.org/c++/" onclick="javascript:pageTracker._trackPageview ('/outbound/csl.sublevel3.org');">Never use time() to initialize srand()</a>.</p>
<p>Thank you for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Computer Science Questions</title>
		<link>http://www.halcode.com/archives/2008/08/23/computer-science-questions/</link>
		<comments>http://www.halcode.com/archives/2008/08/23/computer-science-questions/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 02:26:26 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Computer Science]]></category>

		<category><![CDATA[brooks's law]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[computing]]></category>

		<category><![CDATA[device drivers]]></category>

		<category><![CDATA[nasals]]></category>

		<category><![CDATA[phonemes]]></category>

		<category><![CDATA[reentracy]]></category>

		<category><![CDATA[reentrant]]></category>

		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=118</guid>
		<description><![CDATA[I have been receiving several questions in my email, and I've been doing my best to answer (I cannot afford to neglect my job... yet  ). I think that it would be more interesting to answer a few of these questions publicly, as I'm no expert and by answering in public others could point [...]]]></description>
			<content:encoded><![CDATA[<p>I have been receiving several questions in my email, and I've been doing my best to answer (I cannot afford to neglect my job... yet <img src='http://www.halcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). I think that it would be more interesting to answer a few of these questions publicly, as I'm no expert and by answering in public others could point out my errors, and ultimately, we all would learn. Therefore, this post inaugurates a series to answer some computer science-related questions of the readers of this blog. You may send your questions to my email (jose at halcode.com). Of course, I can only answer those questions at my reach. Let's start with the following 3 questions, which I had received several days ago:</p>
<ol>
<li><strong>Hi, Jose. Please, could you expand on the reasons why adding people to a late software project makes it later?</strong> by José Rodríguez (Venezuela).</li>
<p>That statement is known as <a href="http://en.wikipedia.org/wiki/Brooks%27s_law" title="Brooks's Law" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Brooks's Law</a>, and it was coined by the renowned computer scientist and software engineer <a href="http://en.wikipedia.org/wiki/Frederick_Brooks" title="Fred Brooks" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Frederick P. Brooks</a>. Concretely, the original statement found in his 1975 classic <a href="http://en.wikipedia.org/wiki/The_Mythical_Man-Month" title="The Mythical Man-Month" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">The Mythical Man-Month</a> is "adding manpower to a late software project makes it later". Basically, the idea is that adding more analysts, designers or programmers to a project running behind the original schedule will delay it even more.</p>
<p>Broadly speaking, the rationale of Brooks's law is related to knowledge management. First, when new personnel is added to the project, some resources have to be diverted into training or informing the newcomers about the project's status, vision and philosophy. That will delay the project. Further, when the number of people participating in a project increases, so does the number of communication paths. Thereby, more resources (including time) are required in order to distribute the information. Regarding this point, you may be interested in reading my entry on "Knowledge Sharing" in <a href="http://www.halcode.com/archives/2008/08/07/software-design-trials-and-errors/" title="Software Design, Trials and Errors">Software Design, Trials and Errors</a>.</p>
<li><strong>What is a Reentrant Routine?</strong> by Ricardo Orozco (Venezuela)</li>
<p>A routine or procedure P is reentrant (or <em>pure code</em>) if it can be "re-entered" after it is already in execution. Basically, it means that P can be executed two or more times simultaneously, or alternatively, that P can be safely executed concurrently. There are some conditions P must follow in order to be reentrant, and you may check them in the Wikipedia entry for <a href="http://en.wikipedia.org/wiki/Reentrant" title="Reentrant functions" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">reentrant functions</a>.</p>
<p>Some programs necessarily have to be reentrant. For instance, device drivers. A device driver has to be reentrant because another interrupt may be raised while the driver is running. This means that reentrancy allows for code sharing. For example, if a program consists of 600 KB of code and 200 KB of data, and <em>n</em> users are simultaneously using the program, we would require <em>n</em> x 600 KB of physical memory for the code if the program is not reentrant. But if the code is reentrant we can share it among the <em>n</em> users, saving a lot of memory.</p>
<li><strong>How to characterize </strong><strong>nasal consonants </strong><strong>acoustically?</strong> by Rajeev Ranjan (India)<strong><br />
</strong></li>
<p>A good answer to this question would require plenty of explanations. I suggest you to check on pages 487-514 of <a href="http://www.amazon.com/Acoustic-Phonetics-Current-Studies-Linguistics/dp/0262692503" title="Acoustic Phonetics" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Acoustic Phonetics</a> by Professor Kenneth Stevens. But I'll provide you with some hints, anyway.</p>
<p>Nasal consonants are sonorant phonemes, but they exhibit significant losses due to the nasal tract coupling. Further, nasal spectra is relatively very stable during the oral tract closure (there are minimum acoustic alterations). Typically, F1 is located near to 250 Hz, F2 is weak, and F3 is near to 2 kHz. Remember that for these phonemes the acoustic energy also transits the nasal cavities. Such nasal cavities have different frequency properties. But the oral tract, albeit closed, also alters the acoustic transfer function. This transfer function, for simple phonemes such as vowels, includes only poles. However, when the oral tract is closed, the acoustic transfer function also includes zeros. And that changes the output in a great deal. The location of the first spectral zero of nasal consonants depends on the point of oral closure (for instance, the point of closure for /m/ is more anterior than /n/'s).</ol>
<p>Thank you very much for your questions, and for reading. I encourage you to send more questions to my email account. So long.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/08/23/computer-science-questions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introduction to Digital Signal Processing (I)</title>
		<link>http://www.halcode.com/archives/2008/08/21/introduction-to-digital-signal-processing/</link>
		<comments>http://www.halcode.com/archives/2008/08/21/introduction-to-digital-signal-processing/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 20:22:20 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Digital Signal Processing]]></category>

		<category><![CDATA[continuous]]></category>

		<category><![CDATA[digital signal]]></category>

		<category><![CDATA[discrete]]></category>

		<category><![CDATA[discrete-time]]></category>

		<category><![CDATA[dsp]]></category>

		<category><![CDATA[frequency]]></category>

		<category><![CDATA[period]]></category>

		<category><![CDATA[sampling]]></category>

		<category><![CDATA[signals]]></category>

		<category><![CDATA[sinewave]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=32</guid>
		<description><![CDATA[Digital Signal Processing (DSP) comprises the techniques and algorithms for transforming, filtering and representing digital signals (DSP is a subfield of the more general Signal Processing topic).
Continuous and Digital Signal Processing
A signal is a measurement of a process, an observation of the behavior of some system. Numerically, a signal is a time-varying or spatial-varying quantity [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Digital Signal Processing</strong> (DSP) comprises the techniques and algorithms for transforming, filtering and representing digital signals (DSP is a subfield of the <a href="http://en.wikipedia.org/wiki/Signal_processing" title="Signal Processing" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">more general Signal Processing topic</a>).</p>
<p><strong>Continuous and Digital Signal Processing</strong></p>
<p>A signal is a measurement of a process, an observation of the behavior of some system. Numerically, a signal is a time-varying or spatial-varying quantity (in the following, for simplicity, we'll assume that the independent variable is time <em>t</em>). Some physical signals, such as speech and image are <strong>continuous</strong> in time. For instance, the speech signal is a continuously varying acoustic pressure wave. Sometimes, continuous signals <em>x(t)</em> are referred to as continuous or analog waveforms (continuous and analog are typically interchangeable terms albeit analog is a kind of absolute term, and we will not be using it in the following). Continuous signals vary at an uncountable infinite number of times. On its side, digital processing units can only handle sequences of numbers, i.e., they are discrete devices. In order to harness the benefits of digital processing units, continuous signals have to be first discretized (sampled). After sampling, we get a <strong>digital</strong> signal, which we might use as a representation of the original continuous signal. This sampling process is performed by a <em>Continuous-to-Discrete</em> (C/D) converter.</p>
<p>Summarizing, <strong>sampling</strong> is the process by which a digital representation of a continuous time signal is obtained. Basically, during sampling we select a finite number of data points (in a finite time interval) to represent the infinite amount of data that the continuous signal contains (within the same interval). If sampling is periodic, we sample <em>x(t)</em> at uniformly spaced time instants. Sampling is by no means a trivial issue, and we have to be careful in selecting the discrete data values... how well does this discrete sequence represent the continuous signal? (We'll study this question in an upcoming post).</p>
<p><span id="more-32"></span>This is other important theoretical subtlety of sampling. The C/D sampler that produces the discrete signal is (theoretically) able to handle infinite amplitude precision. Thereby, although the digital signal <em>x[n]</em> is discrete in time, it is continuous in amplitude. This type of signal is called <strong>discrete-time signal</strong>. Nevertheless, this C/D is an ideal device. In practice, we recur to an <em>Analog-To-Digital</em> (A/D) converter which quantizes each amplitude to a finite set of values closest to the actual continuous signal amplitude. This is the <strong>digital signal</strong>, which has both the independent time variable and its amplitude quantized. In practice, we work mostly with digital signals.</p>
<p><strong>The Continuous Sinewave</strong></p>
<p>One of the most simple yet useful signal is the sinewave, which is a member of the family of functions expressed as:</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=x%28t%29+%3D+A%5Csin%282+%5Cpi+f_0+t%29&bg=FFFFFF&fg=000000'  alt="x(t) = A\sin(2 \pi f_0 t)" /></p>
<p>A is the amplitude, and we can discard it for the time being. Needless to say, theses are periodic functions whose frequency is given by <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=f_0&bg=FFFFFF&fg=000000'  alt="f_0" /> (in Hz). For instance, if <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=f_0+%3D+2+Hz&bg=FFFFFF&fg=000000'  alt="f_0 = 2 Hz" />, our sinewave would complete two oscillations in 1 second. The duration of an oscillation (the period) is the reciprocal of its frequency, <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=1%2Ff0&bg=FFFFFF&fg=000000'  alt="1/f0" />.</p>
<p>Now, in order to derive a digital representation of such sinewave, we will take regularly spaced samples. The time elapsed between samples is given by the parameter <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=t_s&bg=FFFFFF&fg=000000'  alt="t_s" /> (the <strong>sampling period</strong>) whose reciprocal, <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=1%2Ft_s&bg=FFFFFF&fg=000000'  alt="1/t_s" />, is the sampling frequency <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=f_s&bg=FFFFFF&fg=000000'  alt="f_s" />. Then, our discrete signal is:</p>
<p style="text-align: center;"><img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=x%5Bn%5D+%3D+A+%5Csin+%282+%5Cpi+f_0+n+t_s%29&bg=FFFFFF&fg=000000'  alt="x[n] = A \sin (2 \pi f_0 n t_s)" /></p>
<p><em>x[n]</em> is just a sequence of numbers. The first number of such sequence is <em>x[0]</em>, the second is <em>x[1]</em>, and so further. Therefore, <em>n</em> takes on only integer values 0, 1, 2, ... Notice that similarly to <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=2+%5Cpi+f_0+t&bg=FFFFFF&fg=000000'  alt="2 \pi f_0 t" />, <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=2+%5Cpi+f_0+n+t_s&bg=FFFFFF&fg=000000'  alt="2 \pi f_0 n t_s" /> is also an angle expressed in radians. In an upcoming post, we'll be revisiting how the selection of <img style="border:0px;vertical-align:middle;" src='http://l.wordpress.com/latex.php?latex=ts&bg=FFFFFF&fg=000000'  alt="ts" /> determines the quality of our sampling.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/08/21/introduction-to-digital-signal-processing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Software Design, Trials and Errors</title>
		<link>http://www.halcode.com/archives/2008/08/07/software-design-trials-and-errors/</link>
		<comments>http://www.halcode.com/archives/2008/08/07/software-design-trials-and-errors/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 16:11:14 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Software Engineering]]></category>

		<category><![CDATA[computing]]></category>

		<category><![CDATA[design]]></category>

		<category><![CDATA[engineering]]></category>

		<category><![CDATA[problem-solving]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[robert glass]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[software design]]></category>

		<category><![CDATA[solution]]></category>

		<category><![CDATA[trial and error]]></category>

		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=31</guid>
		<description><![CDATA[Good software design always consider potential scenarios of failure. That's easier said than done. Frequently, even detecting the failure may be a hard task. That's other reason why design should always favor software construction based on low-coupled components: theoretically, it should be easier to isolate and identify the part at fault. Now, if a failure occurs, what will the system do? Mask the failure? Inform the user about the failure and ask her for directions? Try to automatically recover from failure? Nice questions, even prettier core dumps.]]></description>
			<content:encoded><![CDATA[<p>Recently, I read a succinct and instructive article by <a href="http://www.robertlglass.com/" title="Robert Glass" onclick="javascript:pageTracker._trackPageview ('/outbound/www.robertlglass.com');">Professor Robert L. Glass</a>, published in Communications of the ACM, Volume 51, Number 6 (2008). Professor Glass is a widely respected expert in the Software Engineering area, and his prose is always very eloquent and a pleasure to read. The specific article is <a href="http://doi.acm.org/10.1145/1349026.1349031" title="Software Design and the Monkey's Brain" onclick="javascript:pageTracker._trackPageview ('/outbound/doi.acm.org');">Software Design and the Monkey's Brain</a>, and it attempts to capture the nature of software design. By the way, if you enjoy that article, you may also like a recent book by Professor Glass: <a href="http://www.developerdotstar.com/books/software_creativity_glass.html" title="Software Creativity" onclick="javascript:pageTracker._trackPageview ('/outbound/www.developerdotstar.com');">Software Creativity 2.0</a>, in which he expands on the role of creativity in software engineering and computer programming in general.</p>
<p>Essentially, the article <a href="http://doi.acm.org/10.1145/1349026.1349031" title="Software Design and the Monkey's Brain" onclick="javascript:pageTracker._trackPageview ('/outbound/doi.acm.org');">Software Design and the Monkey's Brain</a> deals with two intertwined observations:</p>
<ol>
<li>Software Design is a sophisticated trial and error (iterative) activity.</li>
<li>Such iterative process mostly occurs inside the mind (at the speed of thought).</li>
</ol>
<p>In the following, I'll present my own appreciations on this topic. Regarding the first observation, I think that <strong>trial and error</strong> (I've also found the expression <strong>trial by error</strong>) is the underlying problem-solving approach of every software engineering methodology, <em>like it or not</em>. Alas, there is no algorithmic, perfectly formalized framework for creating software. In his classic book <em>Object-Oriented Analysis and Design</em>, <a href="http://en.wikipedia.org/wiki/Grady_Booch" title="Grady Booch" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Grady Booch</a> says:</p>
<blockquote><p>The amateur software engineer is always in search of magic, some sensational method or tool whose application promises to render software development trivial. It is the mark of the professional software engineer to know that no such panacea exists.</p></blockquote>
<p>I totally agree. Nevertheless, some people dislike this reality. Referring to Software Engineering, a few (theorist) teachers of mine rejected calling it "Engineering". These people cannot live without "magic". Indeed, there are significant conceptual differences between software practitioners and some (stubborn) computer scientists, with regards to Software Engineering's nature. These scientists are not very fond of the trial and error approach. In his article, Professor Glass presents some past investigations which verified that <strong>designing software was a trial and error iterative process</strong>. He also reflects on the differences in professional perceptions:</p>
<blockquote><p>This may not have been a terribly acceptable discovery to computer scientists who presumably had hoped for a more algorithmic or prescriptive approach to design, but to software designers in the trenches of practice, it rang a clear and credible bell.</p></blockquote>
<p>I like to think of software construction as a <strong>synthesis process</strong>. Specifically, there are two general factors in tension: <em>human factors</em> and <em>artificial factors</em>. The former, mostly informal, the latter, mostly formal. From the conflict, software emerges. Let's remember that the synthesis solves the conflict between the parts by reconciling their commonalities, in order to form something new. It's the task of the software designer to conciliate the best of both worlds. Software designers have to evaluate different trade-offs between human and artificial factors.</p>
<p>As a problem-solving activity, software construction is<strong> solution-oriented</strong>: the ultimate goal of software is to provide a solution to some <strong>specific problem</strong>. Such solution is evaluated by means of a model of the solution domain. But before arriving to such <em>solution domain model</em>, we have to form the <em>problem domain model</em>. The problem domain model captures the aspects of reality that are <em>relevant to the problem</em>. Later, designers look for a solution, as told, by <strong>trial and error</strong>. Additionally, the resources available to the designer, including <strong>knowledge</strong>, are limited. More often than not, empiricism and experience lead the search for a solution. This has an important consequence: software construction is a <strong>non-optimal process</strong>; we rarely arrive to the <em>best</em> solution (and which is the <em>best</em> solution?).</p>
<p>On its side, <strong>knowledge acquisition</strong> is other interesting process. During the entire cycle of development, designers have access to an incomplete knowledge. Gradually, designers learn those concepts pertinent to the problem domain model. And, when we are building the problem domain model, it often occurs that the client perspective of the problem changes, and we have to adjust to the new requirements. Interestingly enough, knowledge acquisition is a nonlinear process. Sometimes, a new piece of information may invalidate all our designs, and we must be prepared to start over.</p>
<p><span id="more-31"></span>According to Professor Glass' article, the software design activity comprises the following stages (bold text in the below list is literally taken from Professor Glass' article):</p>
<ol>
<li><strong>Develop a complete understanding of the problem to be solved.</strong> It comprises formulation and analysis of the problem, which in fact, should complete the problem domain model.</li>
<li><strong>Build a mental model of a proposed solution to the problem.</strong> It corresponds to a search for the solution. Thereby, the final product should be the solution domain model.</li>
<li><strong>Mentally execute the model on a sample input to see if it does indeed solve the problem.</strong> Clearly, we are validating our solution domain model.</li>
<li><strong>If the output of the execution is incorrect (as will often be the case in the early stages of design), expand the model to correct the deficiencies, then execute again.</strong> We detected an error in the trial, therefore, we will alter our model in order to conform to the problem specifications.</li>
<li><strong>Once the output of the execution of the model is correct, choose a different sample input and repeat the process.</strong> Keep validating the solution domain model.</li>
<li><strong>Eventually, the expectation is that a strongly enhanced mental model will be able to solve all of the sample inputs considered.</strong> Thereafter, we can specify the solution.<strong><br />
</strong></li>
</ol>
<p><strong>Software Design Considerations</strong></p>
<p>During all these trial and error iterations, software designers have to keep plenty of factors in their minds in order to solve the tension between human and artificial factors. Software design offers plenty of opportunities, mostly opportunities for being wrong. The following are some of such factors that may force us to readjust our hypothesis in the light of new facts:</p>
<ul>
<li><strong>Heterogeneity</strong> - Software runs over heterogeneous resources. Software design must take into account the variety and difference in hardware, networks and other support software systems. Some of those "external" systems may be very mutable on specifications and implementations.</li>
<li><strong>Design Envelope</strong> - A design envelope is the framework on which the solution is defined. Essentially, this framework comprises all the design decisions and trade-offs. As such, the framework also establishes the bounds for the solution. A good design should try its best in order to anticipate change. Nevertheless, foreseeing any possible modification to the system's specification is totally impossible. For instance, plenty of specification's errors can only be discovered when users start working with the system. There may be several other causes for modifications, such as technology changes, market's dynamics, performance or usability problems, implementation constraints, and so further. Sometimes, we are lucky enough and we can introduce changes to our design, with relatively few problems, within the current design envelope. However, more often than not, modifying an existing design can be quite an arduous task, which might require a significant or total redefinition of our design framework. A clearer explanation of the notion of Design Envelope can be found in Facts 19 and 44 of <a href="http://www.amazon.com/exec/obidos/ASIN/0321117425/developerdots-20" title="Facts and Fallacies of Software Engineering" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Facts and Fallacies of Software Engineering</a>, also by Professor Glass.</li>
<li><strong>Information Hiding -</strong> Building software implies describing a system at different levels of abstraction. By using abstraction, we hide any unnecessary internal details. Regarding such information hiding, David L. Parnas, in his classic paper "<a href="http://www.cs.umd.edu/class/spring2003/cmsc838p/Design/criteria.pdf" title="On the Criteria to Be Used in Decomposing Systems into Modules" onclick="javascript:pageTracker._trackPageview ('/outbound/www.cs.umd.edu');">On the Criteria to Be Used in Decomposing Systems into Modules</a>", suggests that modularity, understood as an assignment of functional responsibilities to system's modules or components, helps software design to keep a bigger flexibility and comprehensibility, and promotes a lowering of costs. Each system's module should hide some design decision.  Nevertheless, information hiding introduces an interesting paradox, which also involves the design envelope. When designing, we proceed to decompose the system into modules, assigning each some responsibility. For handling complexity, we would like small software pieces, and ideally, modifying any of such pieces should have a minimum impact in other parts of the system. That is, we strive to arrive to a clean design framework. But, at the same time, such well-structured framework will likely turn into an obstacle to accept future changes!</li>
<li><strong>Security</strong> - Primarily, a software system manages and is comprised of information. Such information may have a high value to the software's users. Therefore, software design must consider the security risks. I recall that security in software systems has three parts: <em>integrity</em> (preventing data corruption), <em>confidentiality</em> (preventing access to unauthorized users) and <em>availability</em> (preventing that access to the system may be maliciously interfered). However, it's impossible to think in advance of all possible hostile acts against the system.</li>
<li><strong>Failure handling</strong> - Good software design always consider potential scenarios of failure. That's easier said than done. Frequently, even detecting the failure may be a hard task. That's other reason why design should always favor software construction based on low-coupled components: theoretically, it should be easier to isolate and identify the part at fault. Now, <em>if a failure occurs, what will the system do?</em> Mask the failure? Inform the user about the failure and ask her for directions? Try to automatically recover from failure? Nice questions, even prettier core dumps.</li>
<li><strong>Usability</strong> - Pretty systems are prettier. However, "pretty" depends on subjective appreciation, and ultimately, on the target market's characteristics. Personally, I think that <em>the most usable systems are those that just behave like expected</em>. Albeit a simple observation, it means a lot for designers. For instance, usability means that system's resources should be accessed using <em>consistent</em> operations and procedures. Here's an informal metric that I love to use to assess our design quality: when, during the software cycle, we have to expand our design to comprise new functionality, and suddenly the consistency of our operations is lost, we can be sure that something is <em>very wrong</em>.</li>
<li><strong>Reusability</strong> - Clean, modular software design almost automatically leads to software reuse. And software reuse offers plenty of benefits: quality improvements, cost and effort reductions, and a very important (yet sometimes neglected) opportunity: <em>rapid prototyping</em>. Building on reusable components, we can quickly develop some prototypes, and receive early feedback from our clients. Further, prototypes may help to uncover previously unnoticed requirements.</li>
<li><strong>Knowledge Sharing</strong> - Software is a multicolor creature. Besides being a product, a good software design is also an invaluable learning tool for new and future designers. Good software design is immortal. We should be fully aware of such fact. Further, knowledge sharing also considers communication among project's members. Typically, designing software systems requires dealing with a lot of complexity, too much information to be handled by any one person. Development requires collaboration of people from different technical backgrounds and knowledge domains. Therefore, a proper handling of communication paths is vital for the success of the project. Yet, we should proceed carefully, as there is other confirmed observation regarding communication: albeit staff size always affects development time, it must be realized that, the more the staff, the more resources will have to be assigned to handle the communication paths in order to distribute the information. And remember that an uncontrolled communication path is also an opportunity for problematic misunderstandings.</li>
<li><strong>Maintainability</strong> - Software is rarely immutable. Sooner or later it has to be modified for correcting errors, adapting to new hardware or software interfaces, improving performance, or extending its functionality. A good design should allow for lower maintenance costs.</li>
<li><strong>Marketability</strong> - I'd love not to think about markets. Nevertheless, markets are the typical reason why software is built. Even the design of non-profit software is ultimately influenced by the market's trends. Therefore, most of design decisions should always be studied in the light of market's nature and expected behavior.</li>
</ul>
<p><strong>What about the monkey?</strong></p>
<p>In <a href="http://doi.acm.org/10.1145/1349026.1349031" title="Software Design and the Monkey's Brain" onclick="javascript:pageTracker._trackPageview ('/outbound/doi.acm.org');">Software Design and the Monkey's Brain</a>, the "Monkey" refers to a January (2008) news about a group of scientists in the U.S. and Japan which have successfully used a monkey's brain activity to control a robot, transmitting the signals over the Internet. <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=9057319" title="Monkey's brain" onclick="javascript:pageTracker._trackPageview ('/outbound/www.computerworld.com');">You can read the full news here</a>. The most interesting achievement of that research is twofold: first, there is the ability to separate mental activity from its natural actuators, and then we have the possibility of transmitting the mental signals (of the monkey) to remote robotic articulations. In a future, this kind of research is expected to arrive to beautiful results: it could be possible to restore mobility to paralyzed people, by enabling them to use their thoughts to control auxiliary movement structures (artificial exoskeletons).</p>
<p>It's obvious that thoughts are what propels every human activity, naturally including software design. Thinking allows us to model the reality of the problem and that of the solution. However, the iterative trial and error process required for creating software occurs inside the mind, at the speed of human thought. And the mind is much faster than any "external" tools and procedures we may use for software design. And that's a BIG problem for software design: first we have to "extract" all the ideas, rationale and models from our heads, and thereafter translate them to several common visual and written languages. That takes a lot of time and effort.</p>
<p>What if we had a device like the one used with the monkey? The device would recover our brain signals, converting them automatically into models and code. Wonderful. Rationale management (registering all our design assumptions and context) would be also magically recorded. This scheme would indeed be very helpful, and will likely await for us in the long (?) road. Nevertheless, I see an interesting problem: Peopleware. <strong>Most systems are too complex to be understood by just one designer</strong>. Communication is mandatory. How would we coordinate all those mental signals? Such signals would travel from mind to mind? I think that sending a signal from the mind to an exoskeleton is a very different thing to sending the signal from mind to mind.</p>
<p>But it will be quite interesting to know how Software Engineering will adapt to the new "mental" schemes.</p>
<p><strong>Author</strong> Take a look at <a href="http://www.halcode.com/docs/jb_resume.pdf">my profile here</a>.</p>
<p><strong>Meta</strong></p>
<p>2008 - August, 8th</p>
<p>I removed the entries for Scalability and Soft Skin, and replaced them with the proper terms Design Envelope and Information Hiding, respectively. I'd like to thank Professor Robert Glass and the commenters for some specific suggestions and corrections. All remaining errors are, of course, my sole responsibility.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/08/07/software-design-trials-and-errors/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hints at Speech Inverse Filtering of Fricative Phonemes</title>
		<link>http://www.halcode.com/archives/2008/07/28/hints-at-speech-inverse-filtering-on-fricative-phonemes/</link>
		<comments>http://www.halcode.com/archives/2008/07/28/hints-at-speech-inverse-filtering-on-fricative-phonemes/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 00:48:45 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Speech Technologies]]></category>

		<category><![CDATA[articulatory synthesis]]></category>

		<category><![CDATA[childers]]></category>

		<category><![CDATA[matlab]]></category>

		<category><![CDATA[mermelstein model]]></category>

		<category><![CDATA[speech inverse filtering]]></category>

		<category><![CDATA[speech synthesis]]></category>

		<category><![CDATA[toolboxes]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=30</guid>
		<description><![CDATA[For my thesis, I developed my own inversion toolbox. But no matter the toolbox, you require a "source" of information for inversion. That information may be spectral energy distribution, formants, etc.]]></description>
			<content:encoded><![CDATA[<p>Is it possible to invert fricatives by using Childers' Toolboxes?</p>
<p>In first instance, I think that the answer is that you can't. IIRC, <a href="http://www.halcode.com/archives/2008/06/10/resources-for-articulatory-synthesis-research/" title="Articulatory Synthesis">Childers' toolbox</a> allowed for inversion of the sentence "we were away a year ago". But that's a very convenient sentence to invert, because most of its relevant acoustic information can be clearly seen with a formants analysis. Nevertheless, that's not the case for fricatives (and nasals, for instance, have other interesting problems too).</p>
<p>For my thesis, I developed my own inversion toolbox. But no matter the toolbox, you require a "source" of information for inversion. That information may be spectral energy distribution, formants, etc. For fricatives, formants are out-of-question. Fricatives' spectrum differs importantly from voiced phonemes', as you know. When we utter fricatives, the oral tract naturally adopts a specific "constriction" configuration... and such configuration would yield a formantic structure. The problem is that turbulence generated in the oral tract hides resonances, and that's why formant tracking is misleading in such cases.</p>
<p><span id="more-30"></span>My approach then was to use other type of information. I analyzed the spectrum of fricatives, locating those frequencies with the higher concentration of energy. During inversion, I favored articulatory configurations which would yield a higher concentration of energy in those detected "zones" of energy. Acoustic energy follows some relatively evident patterns. For example, /f/ exhibits a relatively uniform distribution of energy, whereas /s/ reveals an energy peak about 5kHz.</p>
<p>You could improve inversion further by harnessing a simple observation. Remember that short acoustic tubes have resonances in higher frequencies. You could tell your articulatory model to adopt configurations yielding short frontal acoustic tubes (which should lead the model to adopt an "anterior constriction" configuration). The only problem this approach has is that you're providing the inversion method with some "extra" information. It depends on the goals of your research. If you don't have to invert by using information coming from the analysis of "real" utterances (which is rarely the case, though) you may directly instruct your inversion algorithm to invert directly a frequency of 5kHz for the /s/ and of 18 kHz for the /f/... that is a cheap inversion, but would confirm your model's relative suitability for inverting such fricative phonemes.</p>
<p>I'll expand on this in upcoming posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/07/28/hints-at-speech-inverse-filtering-on-fricative-phonemes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Resources for Articulatory Synthesis Research</title>
		<link>http://www.halcode.com/archives/2008/06/10/resources-for-articulatory-synthesis-research/</link>
		<comments>http://www.halcode.com/archives/2008/06/10/resources-for-articulatory-synthesis-research/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 21:50:26 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Speech Technologies]]></category>

		<category><![CDATA[acoustic phonetics]]></category>

		<category><![CDATA[anatomy]]></category>

		<category><![CDATA[articulatory synthesis]]></category>

		<category><![CDATA[fant]]></category>

		<category><![CDATA[flanagan]]></category>

		<category><![CDATA[formants]]></category>

		<category><![CDATA[machine learning]]></category>

		<category><![CDATA[maeda]]></category>

		<category><![CDATA[models]]></category>

		<category><![CDATA[phonetics]]></category>

		<category><![CDATA[physiology]]></category>

		<category><![CDATA[síntesis articulatoria]]></category>

		<category><![CDATA[spectrum]]></category>

		<category><![CDATA[speech]]></category>

		<category><![CDATA[speech signals]]></category>

		<category><![CDATA[vocal tract]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=29</guid>
		<description><![CDATA[A list of important documents for Articulatory Speech Synthesis and Inversion research.]]></description>
			<content:encoded><![CDATA[<p>Recently I've been asked for some leadings to more resources about Articulatory Speech Synthesis. The articulatory approach is a very captivating research topic, but it's relatively hard, and is based on a hefty amount of multidisciplinary documents and results. Some involved papers and books are somewhat old or difficult to find. This is my list of selected resources:</p>
<p><strong>Books</strong></p>
<ul>
<li>Gunnar Fant - <a href="http://www.amazon.com/Acoustic-Production-Description-Analysis-Contemporary/dp/9027916004" title="Fant Acoustic Theory of Speech Production" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Acoustic Theory of Speech Production</a></li>
<li>James L. Flanagan - Speech Analysis, Synthesis and Perception</li>
<li>Kenneth N. Stevens - <a href="http://www.amazon.com/Acoustic-Phonetics-Current-Studies-Linguistics/dp/0262692503" title="Stevens Acoustic Phonetics" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Acoustic Phonetics</a></li>
<li>Paul Boersma - Functional Phonology</li>
<li>J. M. Pickett - <a href="http://www.amazon.com/Acoustics-Speech-Communication-Fundamentals-Perception/dp/0205198872/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1213044654&amp;sr=1-1" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');"> The Acoustics of Speech Communication</a></li>
<li>D. G. Childers - <a href="http://www.amazon.com/Speech-Processing-Synthesis-Toolboxes-Childers/dp/0471349593" title="Speech Processing and Synthesis Toolboxes" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Speech Processing and Synthesis Toolboxes</a></li>
<li>A. Seikel, D. King and D. Drumright - <a href="http://www.amazon.com/Anatomy-Physiology-Speech-Language-Hearing/dp/1401825818" title="Anatomy and Physiology for Speech" onclick="javascript:pageTracker._trackPageview ('/outbound/www.amazon.com');">Anatomy and Physiology for Speech, Language and Hearing</a>. Lovely book.</li>
</ul>
<p><span id="more-29"></span><strong>Papers, Theses and Slides<br />
</strong></p>
<ul>
<li>P. Mermelstein - <a href="http://www.halcode.com/docs/mermelstein.pdf" title="Merrmelstein Articulatory Model">Articulatory Model for the Study of Speech Production</a>. Mermelstein's paper is a classic, and a mandatory read for anyone interested in the subject of articulatory synthesis and inversion. It describes the most used articulatory model to date. Albeit 3D articulatory models are the current trend, Mermelstein's model is still very useful for research. This version has some low-quality pages. I'll provide a better scanned version later.</li>
<li>Michael Portnoff - <a href="http://www.halcode.com/docs/portnoff.pdf" title="Portnoff">A Quasi-one-dimensional Digital Simulation for the Time-varying Vocal Tract</a></li>
<li>J. Dang and K. Honda - <a href="http://www.halcode.com/docs/dang_honda.pdf" title="Physiological Articulatory Model">Construction and Control of a Physiological Articulatory Model</a></li>
<li>I. Howard and M. Huckvale - <a href="http://www.halcode.com/docs/howard.pdf" title="Howard articulatory synthesizer">Learning to control an articulatory synthesizer by imitating real speech</a></li>
<li>Olov Engwall - <a href="http://www.halcode.com/docs/engwall.pdf" title="Engwall 3D model">Vocal tract modeling in 3D</a></li>
<li>R. Sproat, M. Ostendorf and A. Hunt (Editors) - <a href="http://www.halcode.com/docs/sproat.pdf" title="The Need for Speech Synthesis Research">The Need for Increased Speech Synthesis Research</a></li>
<li>W. Hess - <a href="http://www.halcode.com/docs/hess.pdf" title="Wolfgang Hess Slideshows">Artikulatorische und akustische Phonetik</a> (German) This concrete presentation of articulatory and acoustic phonetics by professor Wolfgang Hess is one of the best in the web.</li>
<li>Qiguang Lin - Speech Production Theory and Articulatory Speech Synthesis.</li>
</ul>
<p><strong>A few of my own documents</strong></p>
<p>My research is just a drop compared to the above oceans. Although some of the ideas and assumptions I followed are already old, someone may find them useful:</p>
<ul>
<li>J. Brito - <a href="http://linkinghub.elsevier.com/retrieve/pii/S1568494606000639" title="Brito Genetic Learning of Vocal Tract Area Functions" onclick="javascript:pageTracker._trackPageview ('/outbound/linkinghub.elsevier.com');">Genetic Learning of Vocal Tract Area Functions for Articulatory Synthesis of Spanish Vowels</a>.</li>
<li>J. Brito and W. Rodríguez - <a href="http://ieeexplore.ieee.org/iel5/10898/34297/01635777.pdf?tp=&amp;isnumber=&amp;arnumber=1635777" title="Brito Multipopulation Learning Articulatory Models for Speech Synthesis" onclick="javascript:pageTracker._trackPageview ('/outbound/ieeexplore.ieee.org');">Multipopulation genetic learning of midsagittal articulatory models for speech synthesis</a>.</li>
<li>J. Brito - Técnicas de Aprendizaje Artificial Aplicadas al Problem Inverso de la Síntesis Articulatoria de Voz por Computadora (Spanish) My doctoral dissertation. I'll upload it later... I don't remember where it is <img src='http://www.halcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>Finally, please notice that the list is by no means complete or comprehensive. Some very important papers are missing, such as Flanagan and Ishizaka vocal fold modeling, Maeda's simulation of the vocal tract, Rubin's description of a synthesizer, Sorokin's model and others. I'll be adding more items in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/06/10/resources-for-articulatory-synthesis-research/feed/</wfw:commentRss>
		</item>
		<item>
		<title>coLinux, int 80 on Windows and other rants</title>
		<link>http://www.halcode.com/archives/2008/06/02/colinux-int-0x80-on-windows-and-other-rants/</link>
		<comments>http://www.halcode.com/archives/2008/06/02/colinux-int-0x80-on-windows-and-other-rants/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:41:18 +0000</pubDate>
		<dc:creator>Jose</dc:creator>
		
		<category><![CDATA[Assembler]]></category>

		<category><![CDATA[C]]></category>

		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Operating Systems]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[abi]]></category>

		<category><![CDATA[api]]></category>

		<category><![CDATA[assembly]]></category>

		<category><![CDATA[colinux]]></category>

		<category><![CDATA[cpu]]></category>

		<category><![CDATA[cygwin]]></category>

		<category><![CDATA[interruption]]></category>

		<category><![CDATA[kernel]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[parameters]]></category>

		<category><![CDATA[system call]]></category>

		<category><![CDATA[tips]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[virtualization]]></category>

		<category><![CDATA[vmware]]></category>

		<category><![CDATA[win32]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.halcode.com/?p=27</guid>
		<description><![CDATA[Generally speaking, an Application Binary Interface (ABI) is the interface between an application program and the operating system. Conceptually, it's related to the more well-known API concept. But ABIs are a low-level notion, while APIs are more leaned toward the application source code level.]]></description>
			<content:encoded><![CDATA[<p>Recently, a reader sent me an email exposing some problems he faced when trying to assemble on <a href="http://en.wikipedia.org/wiki/Cygwin" title="Cygwin" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Cygwin</a> a code originally targeted at Linux. The problem, as he stated, was that <code>int 0x80</code> didn't perform as expected. Well, plenty of explanations are pertinent:</p>
<p><strong>Cygwin</strong></p>
<p>Cygwin allows to run a collection of Unix tools on Windows, including the GNU development toolchain. However, at its core, cygwin is a library which translates the <strong>POSIX system call API</strong> into the pertinent Win32 system calls (system calls are often abbreviated as <strong>syscalls</strong>). Therefore, cygwin is a software layer between applications using POSIX system calls and the Win32 operating systems, which allows <em>porting</em> some Unix applications to Windows. This way you can, for instance, have the Apache daemon working as a Windows service. Other very attractive feature of Cygwin is its interactive environment: you can run your shell quite nicely, and run your Autoconf scripts, for example. However, <strong>porting means recompiling</strong>. There is no binary compatibility, and your program cannot run in computers without Cygwin (without <code>CYGWIN1.DLL</code>, more precisely). Furthermore, albeit some progress has been made, Cygwin is relatively slow (it's a POSIX compatibility<em> layer</em>, after all.) If possible, I prefer to recompile my applications directly with MinGW. For me, this allows for a faster development cycle. Note, though, that Cygwin can compile MinGW-compatible executables. It's just that, as aforesaid, I prefer to work with MinGW directly. I only work on Windows if I have to develop applications for Windows. But Linux's development tools are the best, and we can access several of them by using MinGW. I think that Cygwin is best suited for general cross-development and for handling complicated software porting.</p>
<p><strong>System Calls and int 0x80</strong></p>
<p>A system call is a request by an <em>active process</em> for a service performed by the operating system kernel. Remember that a process is an executing (running) instance of a program, and the active process is the process currently using the CPU. The active process may perform a system call to request creation of other process, for instance. Or perhaps the process needs to communicate with a peripheral device. In Linux on x86, <code>int 0x80</code> is the assembly language instruction that is used to invoke system calls. int 0x80 is a software interrupt, as it will be raised by a software process, not by hardware devices. Before invoking such interruption, our program have to store the <strong>system call number </strong>(which allows the operating system to know what service your program is specifically requesting ) in the proper register of the CPU. Every interrupt is a signal to the operating system, notifying it about the occurrence of an event that must be computationally handled.</p>
<p><span id="more-27"></span><strong>Application Binary Interface</strong></p>
<p>Generally speaking, an Application Binary Interface (ABI) is the interface between an application program and the operating system. Conceptually, it's related to the more well-known API concept. But ABIs are a low-level notion, while APIs are more leaned toward the application source code level. If your program uses an specific API, you will be able to <em>compile</em> it on any system which implements that API. Similarly, a program (or more generally, a compiled object code) which uses a specific ABI will run (without the need for recompilation) on any system offering that ABI. Specification of ABIs includes, but is not limited to, details such as:</p>
<p>1. How applications make system calls to the operating system.</p>
<p>2. System call numbers.</p>
<p>3. Calling conventions (how parameters are passed to functions, and how their return values are received).</p>
<p>4. The format of the object code (COFF/PE, ELF, etc.)</p>
<p>To consolidate ideas, notice that a relatively backward-compatible ABI is which has allowed several older applications to run on newer versions of Windows.</p>
<p>Now a few things should be quite clear. First, Cygwin is a software layer at the API level. Second, interrupts are a concept from the ABI level. And it's obvious that Linux syscalls are entirely different from Windows syscalls. Further, in Cygwin you don't make raw system calls... it's CYGWIN1.DLL which does the needed Windows system calls according to your program requirements. The ABI of software compiled with Cygwin is that of Windows systems. You cannot use a Linux ABI's thing, such as int 0x80, and expect that your program runs fine on Windows.</p>
<p>If you're programming in assembly, <code>0x80</code> only works in Linux. For DOS/Windows, you must use <code>0x21</code>, <code>0x25</code>, <code>0x26</code>, etc. That's the rationale behind my decision for using a function of the C library, printf, in order to avoid this problem in the example code of <a href="http://www.halcode.com/archives/2008/05/11/hello-world-c-and-gnu-as/" title="hello world, c and gnu as">this post</a>.</p>
<p><strong>The Truth Reflected in the Mirror</strong></p>
<p><em>You cannot use a Linux ABI's thing, such as <code>int 0x80</code>, and expect that your program runs fine on Windows</em>. That's not entirely true. Under Windows, you can install a <a href="http://msdn.microsoft.com/en-us/library/ms681411(VS.85).aspx" title="Vectored Exception Handler" onclick="javascript:pageTracker._trackPageview ('/outbound/msdn.microsoft.com');">vectored exception handler</a> which traps the interruption request, and with some coding translate the trapped information into the Windows equivalent. But that amounts to writing an Linux kernel emulator.</p>
<p>If you are in a hurry, perhaps you'll prefer the wise path of virtualization. By using a virtualization engine like <a href="http://en.wikipedia.org/wiki/VMware" title="VMWare" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">VMWare</a> and <a href="http://en.wikipedia.org/wiki/Xen" title="Xen" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');">Xen</a> you can install and execute a guest operating system on a host system. Such virtual machines offer a full resources abstraction which allows you to use the guest operating system almost at its full. For some tasks, the <a href="http://www.colinux.org/" title="coLinux" onclick="javascript:pageTracker._trackPageview ('/outbound/www.colinux.org');">coLinux</a>'s approach may be preferable.  Cooperative Linux (coLinux) allows the Windows and Linux kernel to run simultaneously on the same machine, but unlike traditional virtual machines, coLinux shares resources that already exist in the host.</p>
<p>coLinux is a very elegant and exciting project. However, installing and configuring coLinux may be a hard task. After installing your Linux distro, it's not easy to configure the window manager, the networking facilities, and other things. The best resource I've found in the net for such chores is this post by Sofeng: <a href="http://iwiwdsmi.blogspot.com/2008/04/install-colinux-and-ubuntu-gutsy-on-win.html" title="Sofeng coLinux" onclick="javascript:pageTracker._trackPageview ('/outbound/iwiwdsmi.blogspot.com');">Install coLinux (and Ubuntu Hardy) on Win XP using Slirp to internet and TAP to host behind a corporate firewall/proxy server</a>. It's a very recommended reading.</p>
<p>Nevertheless, I have a couple of quick tips for those who want to start programming in assembly as soon as possible. <em>Please, notice that software is constantly evolving and the following tips may be obsolete for the time you're reading them. Review the excellent coLinux documentation beforehand</em>. During coLinux setup, select the Ubuntu distribution. After installation, go to the folder where you installed it, and decompress the file Ubuntu-7.10.ext3.2GB.7z. Also put <a href="http://www.halcode.com/docs/UbuntuSlirp.bat" title="UbuntuSlirp">UbuntuSlirp.bat</a> and <a href="http://www.halcode.com/docs/colinux.conf" title="coLinux">coLinux.conf</a> into your colinux directory (these files may require some tweaking according to your system.) Run coLinux by executing UbuntuSlirp.bat. Linux should boot nicely. Use <code>root</code> as login and password. And that's it. You'll have Linux on Windows. But developers need the GNU development tools. Install them by executing apt-get install gcc</p>
<p>At this point, you should have the GNU assembler (as) installed. Now you can type your programs, and assemble/run them. And you can use <code>0x80</code> in your assembly program! For example, I typed the hello, world program of the <a href="http://database.sarang.net/study/linux/asm/linux-asm.txt" title="Miyagi's Assembly Tutorial" onclick="javascript:pageTracker._trackPageview ('/outbound/database.sarang.net');">tutorial by Miyagi</a>, and it assembled and ran just fine.</p>
<p>As always, your feedback is welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halcode.com/archives/2008/06/02/colinux-int-0x80-on-windows-and-other-rants/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
