<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>termios &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/termios/</link>
	<description>Feed of posts on WordPress.com tagged "termios"</description>
	<pubDate>Sun, 27 Dec 2009 11:07:54 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Ruby on Rails: A Newbie's Journey, Part 3]]></title>
<link>http://facetsquared.wordpress.com/2008/04/02/ruby-on-rails-a-newbies-journey-part-3/</link>
<pubDate>Wed, 02 Apr 2008 23:48:27 +0000</pubDate>
<dc:creator>godflesh</dc:creator>
<guid>http://facetsquared.wordpress.com/2008/04/02/ruby-on-rails-a-newbies-journey-part-3/</guid>
<description><![CDATA[Looking for parts 1 or 2? So finally I settled on using Dan Benjamin (Hivelogic)&#8217;s method of i]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Looking for parts <a title="Ruby on Rails Part 1" href="http://facetsquared.wordpress.com/2008/03/30/ruby-on-rails-a-newbies-journey-part-1/">1</a> or <a title="Ruby on Rails Part 2" href="http://facetsquared.wordpress.com/2008/03/31/ruby-on-rails-a-newbies-journey-part-2/">2</a>?</p>
<p>So finally I settled on using <a title="Hivelogic" href="http://hivelogic.com/articles/ruby-rails-mongrel-mysql-osx/" target="_blank">Dan Benjamin (Hivelogic)</a>&#8217;s method of installing Rails. This promised a set-up on Mac OSX (Tiger) of Ruby, Rails, <a title="Subversion" href="http://subversion.tigris.org" target="_blank">Subversion</a> (version control), <a title="Mongrel" href="http://mongrel.rubyforge.org" target="_blank">Mongrel</a> (web server) and <a title="MySQL" href="http://mysql.org" target="_blank">MySQL</a> (database). There were a couple of pre-requisites detailed that I needed to attend to first.</p>
<p>Firstly, I installed XCode 2.4.1 off the Mac DVD that came with my system. I didn&#8217;t do anything beyond complete the installation though. Next I read Dan&#8217;s comments on using the <a title="Using /usr/local" href="http://hivelogic.com/articles/using_usr_local/" target="_blank">/usr/local</a> path for software installs. Some of it flew past me a bit but he did enough to convince me this was the way to go, especially as it appeared his method wouldn&#8217;t work if I didn&#8217;t! After a couple of false starts I wanted to try and follow the route to the letter. The upshot with this is that Dan states to edit the .bash_login file by adding the following to the end:</p>
<p><code>export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"</code></p>
<p>Great I thought, where the Dickens is that? The period at the start of the file name should be a clue as this means it is a hidden file. Turns out showing hidden files on a Mac is no straightforward task (well, not if you don&#8217;t know how to do it that is). Anyway, a quick trip to the net told me that the following script is needed (I set this up in Automater):</p>
<p><code>defaults write com.apple.finder AppleShowAllFiles TRUE<br />
killall Finder</code></p>
<p>To hide them again you simply run a script as above but with FALSE instead of TRUE. So I did that but no sign of the .bash_login file. Nothing else for it then I just created one in Textedit with the export PATH command as above and saved this to my home folder (no file extension). Checking the permissions on the file, though, shows that I needed to create full read, write and execute permissions on the file (using chmod):</p>
<p><code>computer:~ user$ ls -l ~/.bash_login<br />
-rw-rw-r--   1 user  user  72 Mar 30 18:38 /Users/user/.bash_login<br />
computer:~ user$ chmod 755 ~/.bash_login<br />
computer:~ user$ ls -l ~/.bash_login<br />
-rwxr-xr-x   1 user  user  72 Mar 30 18:38 /Users/user/.bash_login<br />
computer:~ user$</code></p>
<p>Executing the file just returns the command prompt as expected:</p>
<p><code>computer:~ user$ ~/.bash_login<br />
computer:~ user$</code></p>
<p>So groundwork done, on to running the Rails environment install. The full instructions are on Dan&#8217;s site so I am not going to unnecessarily repeat them here; I will however point out how each bit went.</p>
<p><strong>Setting Up</strong></p>
<p>Followed this to the letter.</p>
<p><strong>Ruby</strong></p>
<p>Again, followed as instructed. Each step progressed without any errors. I did of course already have Ruby on my system but I still did the Ruby install part (installing 1.8.6 as expected).</p>
<p><strong>RubyGems</strong></p>
<p>As told, not a hitch.</p>
<p><strong>Ruby on Rails</strong></p>
<p>Again no errors, although did notice that Rails 2.0.2 installed (significantly as it turns out later&#8230;).</p>
<p><strong>Mongrel</strong></p>
<p>All went fine, selected Ruby version 1.1.4 when prompted.</p>
<p><strong>Subversion</strong></p>
<p>Installed this as instructed (version 1.4.3) although got a warning message in the Terminal:</p>
<p><code>configure: WARNING: we have configured without BDB filesystem support<br />
You don't seem to have Berkeley DB version 4.0.14 or newer<br />
installed and linked to APR-UTIL.  We have created Makefiles which<br />
will build without the Berkeley DB back-end; your repositories will<br />
use FSFS as the default back-end.  You can find the latest version of<br />
Berkeley DB here:</p>
<p>http://www.sleepycat.com/download/index.shtml</code></p>
<p>This didn&#8217;t appear to make any difference so I have ignored it for now (but will return to it later I guess).</p>
<p><strong>Capistrano (and termios)</strong></p>
<p>Both installed without a hitch.</p>
<p><strong>MySQL</strong><br />
Obtained the Mac OS X 10.4 (x86) file from mysql.com (version 5.0.51a) and installed as instructed. I also started the server at this point. No problems were encountered.</p>
<p><strong>MySQL Native Bindings Gem</strong></p>
<p>Installed as instructed. I did notice that the latest Ruby version was higher than those listed on Dan&#8217;s site, so I selected this (didn&#8217;t note what it was though). No problems.</p>
<p><strong>Fix MySQL</strong></p>
<p>Did without a hitch.</p>
<p>And so that was that &#8211; everything seemed fine. Thanks Dan! There were a couple of things still not quite right but they only came to light when I tried to set up my first basic application. More on this in Part 4.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Implementazione semplice (e sporca?) di getch() su UN*X]]></title>
<link>http://emanuelecipolla.net/2008/03/18/implementazione-semplice-e-sporca-di-getch-su-unx/</link>
<pubDate>Tue, 18 Mar 2008 21:40:40 +0000</pubDate>
<dc:creator>Emanuele Cipolla</dc:creator>
<guid>http://emanuelecipolla.net/2008/03/18/implementazione-semplice-e-sporca-di-getch-su-unx/</guid>
<description><![CDATA[getch() è una funzione che restituisce un carattere ricevuto in input: è abbastanza comoda, ma non t]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">getch() è una funzione che restituisce un carattere ricevuto in input: è abbastanza comoda, ma non troppo portabile. Ho trovato questa reimplementazione in giro su Internet, e funziona. Con un po&#8217; di accortezza, e usando una semplice direttiva di pre-processore, si può anche evitare di fare dei controlli di conformità nel momento in cui servirebbe usarla. Questo pezzetto di codice è tanto più importante se si pensa l&#8217;unica alternativa praticabile sarebbe quella di scrivere un&#8217;applicazione usando la libreria curses, che la prevede &#8211; ma solo all&#8217;interno di un programma che ne faccia uso interamente.</p>
<pre class="brush: cpp;">#include &lt;stdio .h&gt;
#include &lt;unistd .h&gt;
#include &lt;termios .h&gt;

int unix_getch()
{
    struct termios oldt,newt;
    int ch;

    tcgetattr( STDIN_FILENO, &amp;oldt );

    newt = oldt;
    newt.c_lflag &amp;= ~( ICANON &amp;#124; ECHO );

    tcsetattr( STDIN_FILENO, TCSANOW, &amp;newt );

    ch = getchar();
    tcsetattr( STDIN_FILENO, TCSANOW, &amp;oldt );

    return ch;
}</pre>
<p style="text-align:right;">[da <a href="http://cboard.cprogramming.com/archive/index.php/t-27714.html">qui</a>]</p>
<p></termios></unistd></stdio></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
