<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Vayanis &#187; Web</title>
	<atom:link href="http://www.vayanis.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vayanis.com</link>
	<description>... a little piece of my mind.</description>
	<lastBuildDate>Wed, 02 Feb 2011 05:05:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting up LAML (Linux, Apache, MySQL, Lua) with MAMP</title>
		<link>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/</link>
		<comments>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 05:00:04 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Guides]]></category>
		<category><![CDATA[Lua]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[LAML]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/?p=48</guid>
		<description><![CDATA[As a weekend project I decided to set up a LAML, (Linux, Apache, MySQL, Lua) stack on my computer. I never worked with Lua before, but I figured it wouldn&#8217;t be too hard to get it working with my MAMP setup. Getting started, I spent some time reading any articles I could find on the [...]]]></description>
			<content:encoded><![CDATA[<p>As a weekend project I decided to set up a LAML, (Linux, Apache, MySQL, Lua) stack on my computer.  I never worked with Lua before, but I figured it wouldn&#8217;t be too hard to get it working with my MAMP setup.  Getting started, I spent some time reading any articles I could find on the web that talked about setting up or using using Lua for web development.  I quickly ran into the <a href="http://www.keplerproject.org/">Kepler Project</a> which as their website points out:</p>
<blockquote><p>
is an open source platform that brings the power of Lua to web development
</p></blockquote>
<p>While this was my goal, I wanted to start from scratch since I haven&#8217;t had any experience with the language and didn&#8217;t want to learn it on a specific platform just yet.  So, I went on to figure out how to install and configure Lua with MAMP.  To accomplish this yourself, you will need: Xcode, MAMP, Lua, LuaRocks, MAMP source, and mod_fcgid.<br />
<span id="more-48"></span></p>
<h3>Step 1: Install Xcode</h3>
<p>This one is pretty straight forward.  You can easily install Xcode if you have an OS X install DVD.  Otherwise you can download it from the <a href="http://developer.apple.com/technology/xcode.html">Apple Developer Center</a>.</p>
<h3>Step 2: Install Lua</h3>
<p>Installing Lua is also straight forward.  Download the source from <a href="http://www.lua.org/ftp/">Lua&#8217;s FTP site</a>.  I chose the current version (5.1.4).  After extracting the source run the following commands:<br />
<code><br />
cd /path/to/source/<br />
make macosx<br />
sudo make install<br />
</code><br />
This should install the Lua interpreter into your /usr/local/bin/</p>
<h3>Step 3: Install LuaRocks</h3>
<p>To install LuaRocks, you first need to download the <a href="http://luarocks.org/releases/">source</a>.  The current release is 2.0.1.  After downloading the source run the following commands:<br />
<code><br />
cd /path/to/source/<br />
make<br />
sudo make install<br />
</code><br />
This should install luarocks in /usr/local/bin/ .  You can test your installation with:<br />
<code>luarocks help</code><br />
You should be presented with a list of commands to use luarocks.</p>
<h3>Step 4: Install Lua MySQL support</h3>
<p>This part is a little tricky as you need to make sure you have the source for your MAMP installation.  You can download the <a href="http://sourceforge.net/projects/mamp/files/mamp/1.8.2/MAMP_components_1.8.2.dmg.zip/download">MAMP source</a> from the <a href="http://www.mamp.info/en/index.html">MAMP website</a>.  Running the .dmg should extract the source.  After extracting the source run the following:<br />
<code><br />
mkdir /Applications/MAMP/Library/Include/<br />
mv /path/to/extracted/mamp/source/ /Applications/MAMP/Library/Include/<br />
</code><br />
Once you have moved your source over, extract the MySQL package then run the following commands:<br />
<code><br />
cd /Applications/MAMP/Library/include/mysql-5.1.37/<br />
./configure<br />
make<br />
</code><br />
Once you have finished building MySQL, you will want to move the mysqlclient into the current MySQL location:<br />
<code><br />
cp /Applications/MAMP/Library/include/mysql-5.1.37/libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql/<br />
</code><br />
You will now be able to install the luasql-mysql package from luarocks with the following command:<br />
<code><br />
sudo luarocks install luasql-mysql 2.2.0-1 MYSQL_INCDIR=/Applications/MAMP/Library/include/mysql-5.1.37/include MYSQL_LIBDIR=/Applications/MAMP/Library/lib/mysql<br />
</code></p>
<h3>Step 5: Install Lua fcgid wrapper</h3>
<p>This is an easy one:<br />
<code><br />
luarocks install lua wsapi-fcgi 1.1<br />
</code></p>
<h3>Step 6: Install Apache mod_fcgid</h3>
<p>This part was a bit tricky for me since I don&#8217;t have much experience compiling Apache modules.  First, you will need to extract the httpd source, for me this was httpd-2.0.63.tar.gz.  Next, you will want to build Apache into a separate directory.  Use the following to build Apache:<br />
<code><br />
./configure --prefix=/path/to/target/Apache<br />
make<br />
make install<br />
</code><br />
While running the make command, you may get the following error:</p>
<p><code><br />
sendrecv.c:965:2: error: #error APR has detected sendfile on your system, but nobody has written a<br />
sendrecv.c:966:2: error: #error version of it for APR yet. To get past this, either write apr_sendfile<br />
sendrecv.c:967:2: error: #error or change APR_HAS_SENDFILE in apr.h to 0.<br />
</code></p>
<p>Fixing this is simple, all you need to do is edit /Applications/MAMP/Library/include/httpd-2.0.63/srclib/apr/include/apr.h and make the following modifications:<br />
<code><br />
-#define APR_HAS_SENDFILE  1<br />
+#define APR_HAS_SENDFILE  0<br />
</code></p>
<p>I know its taken quite some time now, but you are almost done!  All that&#8217;s left is to build mod_fcgid and configure Apache.  To build mod_fcgid run the following commands:<br />
<code><br />
APXS=/path/to/target/Apache/bin/apxs ./configure.apxs<br />
make<br />
make install<br />
cp /path/to/target/Apache/modules/mod_fcgid.so /Applications/MAMP/Library/modules<br />
</code></p>
<h3>Step 7: Configure Apache for mod_fcgid and Lua</h3>
<p>Now that you have everything built and in place, you just need to configure Apache and then you will be ready to start building Lua web apps!</p>
<p>Open /Applications/MAMP/conf/apache2/httpd.conf with your favorite text editor and add the following to the load modules section:<br />
<code><br />
LoadModule fcgid_module modules/mod_fcgid.so<br />
</code><br />
While you are at it, you can comment out the following lines if you like (I am not sure if it is possonlble to run mod_cgid with mod_fcgid, so I just took them out).<br />
<code><br />
#LoadModule cgi_module modules/mod_cgi.so<br />
#LoadModule cgid_module modules/mod_cgid.so<br />
</code><br />
Next, find the IfModule mod_fcgid directive, and add the following under it:<br />
<code><br />
<ifModule mod_fcgid.c><br />
	AddHandler fcgid-script .lua<br />
	FcgidWrapper /Users/avayanis/.luarocks/bin/wsapi.fcgi .lua<br />
	Options +ExecCGI<br />
</ifModule><br />
</code><br />
Finally, restart Apache through the MAMP application and test it out!  Here is a sample lua script to test out your Lua environment:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">module<span style="color: #66cc66;">&#40;</span>..., package.seeall<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #b1b100;">function</span> run<span style="color: #66cc66;">&#40;</span>wsapi_env<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> headers <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;Content-type&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;text/html&quot;</span> <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">local</span> <span style="color: #b1b100;">function</span> hello_text<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">coroutine.yield</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hello World!&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">200</span>, headers, <span style="color: #b1b100;">coroutine.wrap</span><span style="color: #66cc66;">&#40;</span>hello_text<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Standards &#8211; Not really standard</title>
		<link>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/</link>
		<comments>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 21:24:09 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[XHTML/CSS]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/</guid>
		<description><![CDATA[As defined by wikipedia, Web standards is a general term for the formal standards and other technical specifications that define and describe aspects of the World Wide Web. In recent years, the term has been more frequently associated with the trend of endorsing a set of standardized best practices for building web sites, and a [...]]]></description>
			<content:encoded><![CDATA[<p>As defined by wikipedia,</p>
<blockquote><p><strong>Web standards</strong> is a general term for the formal <a href="http://en.wikipedia.org/wiki/Internet_standard" title="Internet standard">standards</a> and other technical <a href="http://en.wikipedia.org/wiki/Specification" title="Specification">specifications</a> that define and describe aspects of the <a href="http://en.wikipedia.org/wiki/World_Wide_Web" title="World Wide Web">World Wide Web</a>. In recent years, the term has been more frequently associated with the trend of endorsing a set of standardized <a href="http://en.wikipedia.org/wiki/Best_practices" title="Best practices">best practices</a> for building <a href="http://en.wikipedia.org/wiki/Web_site" title="Web site">web sites</a>, and a philosophy of <a href="http://en.wikipedia.org/wiki/Web_design" title="Web design">web design</a> and development that includes those methods.</p></blockquote>
<p>I have been a proponent of Web standards ever since I created my first web site back in early 2000.  Back then, I was only following what I thought was the correct way to do things, and having the word &#8216;standards&#8217; seemed to make this <em>movement</em> official for me. As I learned more about these web standards, the importance of the best practices set forth along with the concept and goals of creating markup that would display the same across browsers, the more it all seemed to make sense.</p>
<p>However, seven years later, I am still creating web sites/applications using PHP, XHTML and CSS, but I am getting ever so frustrated with these so called <em>&#8220;web standards,&#8221; </em>mainly due to the quirks and lack of support in IE6 and to some degree IE7.  I am not an XHTML or CSS guru, but I think I know enough to write decent markup and styles to be effective (please don&#8217;t judge me using this site, after all, this theme was found on a wordpress theme site and I haven&#8217;t had the time to clean it up).  Just the other day, I was working on a site that required a three column layout, with columns of equal height, so I decided to use alistapart&#8217;s <a href="http://www.alistapart.com/articles/holygrail" title="Holy Grail">Holy Grail</a>.</p>
<p><span id="more-17"></span></p>
<p>This worked great in Firefox, Safari, IE6/7 and even Opera, until I tried to accomplish my next task, adding a picture gallery created by floated elements.  As most of you might have guessed, everything was fine except with IE6.  Now why is it that I always have to find ways to hack my styles just to get them to work with IE6 or 7?  Why can&#8217;t Microsoft finally create a decent browser.  Well, on this day, I had had enough. I decided to scrap the <em>Holy Grail</em> layout and create my three columns using a table.  Yes, thats right, I used a table layout to accomplish my three columns and it worked great.  Not to mention I got it done without any hassles from any of the browsers I was testing with.
<p>Before anyone begins the flaming, I will start by stating that I know this isn&#8217;t semantic. I also know that this use of tables is deemed inappropriate by the w3c whom states:</p>
<blockquote><p>Tables should not be used purely as a means to layout document content   as this may present problems when rendering to non-visual media. Additionally,   when used with graphics, these tables may force users to scroll horizontally   to view a table designed on a system with a larger display. To minimize these   problems, authors should use style sheets to control layout rather than tables.</p></blockquote>
<p>I merely decided to save myself the agony of debugging IE6/7 issues. I still support web standards, but I don&#8217;t see how it is completely feasible to follow them blindly when we all know well and good that the most prevalent browser used worldwide, just doesn&#8217;t fully support them.  Until these set of best practices are adopted by all the major browsers, to their full extent, they will never be more than best practices, and even then the term will be somewhat misleading.</p>
<p>Maybe I have been a bit slow to come to this conclusion, after all, most things can be successfully conquered utilizing web standard, but I am not the first to point out its flaws.  Of course these really aren&#8217;t flaws of the standards set forth, but rather one prominent browser that fails to adhere to them.  As a young developer, and as a developer who plans to be in this field for a good portion of his working career, what can I do to further along the goals of standardizing XHTML/CSS best practices?  What is the rest of the community doing? And how well is it going?</p>
<p><em>Sorry for the rambling, but I have a dream&#8230; A dream that one day, all browsers will be created equal and all developers will blissfully enjoy writing clean concise markup and all users will see the same beautiful interface into what we call the world wide web.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/08/06/web-standards-not-really-standard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

