<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8791498814807582586</id><updated>2012-02-16T13:52:46.926-06:00</updated><category term='ethernet'/><category term='PHP'/><category term='NaNoWriMo'/><category term='snippet'/><category term='MySQL'/><category term='CMake'/><category term='Clang'/><category term='Xcode'/><category term='Pages'/><category term='AppleScript'/><category term='Linux'/><category term='C'/><category term='tutorial'/><category term='Allegro'/><category term='TextEdit'/><category term='article'/><category term='Terminal'/><category term='LFS'/><category term='flixel'/><category term='r8101'/><title type='text'>Partition Seven</title><subtitle type='html'>a blog about programming</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-5579102462681877933</id><published>2011-07-30T02:43:00.007-05:00</published><updated>2011-07-30T03:14:38.754-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ethernet'/><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='LFS'/><category scheme='http://www.blogger.com/atom/ns#' term='r8101'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><title type='text'>Ethernet with r8101 module and RealTek 8101E in Linux with a HP 2000 219dx</title><content type='html'>&lt;div style="font: 12.0px Helvetica; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;HP has at least two laptop models that use the RealTek 8101E Fast Ethernet for their ports. One is the "g4 1117dx," and another is the "2000 219dx."&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;On a Dell mini 9 running Ubuntu 11.04 (2.6.38-10-generic), the r8169 module works out-of-the-box when an ethernet cable is plugged in. This is not the case with either HP laptop, even though &lt;a href="http://lxr.free-electrons.com/source/drivers/net/r8169.c?v=2.6.38"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;r8169.c&lt;/span&gt;&lt;/a&gt;&amp;nbsp;mentions the 8101 model.&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;It has been &lt;a href="http://webcache.googleusercontent.com/search?q=cache:eWnRn1vT004J:ubuntuforums.org/showthread.php%3Ft%3D551594+http://ubuntuforums.org/showthread.php%3Ft%3D551594&amp;amp;cd=1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&amp;amp;client=safari&amp;amp;source=www.google.com"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;discussed&lt;/span&gt;&lt;/a&gt; &lt;a href="http://webcache.googleusercontent.com/search?q=cache:0gBBKpPRcUgJ:ubuntuforums.org/showthread.php%3Ft%3D538448%26page%3D1+http://ubuntuforums.org/showthread.php%3Ft%3D538448%26page%3D5&amp;amp;cd=1&amp;amp;hl=en&amp;amp;ct=clnk&amp;amp;gl=us&amp;amp;client=safari&amp;amp;source=www.google.com"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;elsewhere&lt;/span&gt;&lt;/a&gt; that ethernet devices using the r8169 module may be disabled in Windows after a reboot. Enabling "Wake on LAN," removing the battery and power supply, and waiting for some time allows the hardware to work in Linux. While I did not try the suggested solution with the former HP model, it did not work with the latter.&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;As for wireless, it would have likely been easier to set up. While neither HP laptop works out-of-the-box with wireless in Ubuntu 11.04, using an &lt;a href="http://www.amazon.com/gp/product/B00333F2YU/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=partitionseve-20&amp;amp;linkCode=as2&amp;amp;camp=217145&amp;amp;creative=399369&amp;amp;creativeASIN=B00333F2YU"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;external adapter&lt;/span&gt;&lt;/a&gt; and running software update enables the internal wireless on both machines.&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;With the LFS LiveCD, it's a toss-up: wireless or wired? I wanted to save the adapter for another day, so ethernet it is.&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;I used a &lt;a href="http://forums.debian.net/viewtopic.php?f=16&amp;amp;t=42324"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;HOWTO on the Debian forums&lt;/span&gt;&lt;/a&gt; leading me to &lt;a href="http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&amp;amp;PNid=14&amp;amp;PFid=7&amp;amp;Level=5&amp;amp;Conn=4&amp;amp;DownTypeID=3&amp;amp;GetDown=false#2"&gt;&lt;span style="color: #002fee; text-decoration: underline;"&gt;this driver&lt;/span&gt;&lt;/a&gt;, and copied the tarball to an external flash drive. Mount the drive from LFS LiveCD and copy it to a convenient location like $LFS/opt.&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;i&gt;Make sure you have partition(s) on the hard drive set up before mounting the external.&lt;/i&gt; You'll be producing files during extraction and compilation, so you'll need a place to put them. The CD-R has already been written with the LiveCD OS; it can't be written to twice.&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Here's the order of commands I used:&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ mkdir -v /mnt/usb&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ mount -v -t ext3 /dev/sdb1 /mnt/usb&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ cp -v /mnt/usb/r8101-driver.tar.gz $LFS/usr/src &amp;amp;&amp;amp; cd $LFS/opt&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ tar xjf r8101-driver.tar.gz&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ cd r8101-driver.tar.gz/&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The LFS LiveCD uses kernel 2.6.22.5, while the current kernel version is something like 3.0. Between 2.6.22.5 and 2.6.38, the symbol DMA_32BIT_MASK changed to DMA_BIT_MASK. You'll need to change all references to DMA_BIT_MASK(xx) to DMA_32BIT_MASK in ./src/r8101_n.c, about seven in all. Otherwise, while compilation succeeds, modprobe results in a "Undefined symbol" error.&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Now you're ready to run the included shell script:&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ ./autorun.sh&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;The script will remove the r8169 module that was detected earlier, rename it as a backup file, and load r8101. If you're successful, the ethernet port will glow white. :) Use lsmod to confirm that r8101 is loaded, and lsmod | grep r8169 to make sure the old one is not.&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;Ping still won't detect a host, so&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ ifconfig eth0 up&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;$ dhcpcd&amp;nbsp;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 19.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 16.0px Times; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;And you should be in business - that is, downloading the programs for LFS 6.8.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-C58ikHf50wY/TjO4AiVjIwI/AAAAAAAAAEU/mqk0F3QfSeI/s1600/0730110240.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://4.bp.blogspot.com/-C58ikHf50wY/TjO4AiVjIwI/AAAAAAAAAEU/mqk0F3QfSeI/s200/0730110240.jpeg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-5579102462681877933?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/5579102462681877933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2011/07/ethernet-with-r8101-module-and-realtek.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5579102462681877933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5579102462681877933'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2011/07/ethernet-with-r8101-module-and-realtek.html' title='Ethernet with r8101 module and RealTek 8101E in Linux with a HP 2000 219dx'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-C58ikHf50wY/TjO4AiVjIwI/AAAAAAAAAEU/mqk0F3QfSeI/s72-c/0730110240.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-5637562156117963396</id><published>2011-03-24T02:16:00.007-05:00</published><updated>2011-10-30T00:41:39.885-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><title type='text'>Miniatures grid with PHP and MySQL</title><content type='html'>After reading "PHP &amp;amp; MySQL for Dummies," I created a miniatures grid for use via the browser:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-Gz_VRD07D68/TYrbwQbIhzI/AAAAAAAAADU/u4OJ26Mcuhs/s1600/grid.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="213" src="https://lh4.googleusercontent.com/-Gz_VRD07D68/TYrbwQbIhzI/AAAAAAAAADU/u4OJ26Mcuhs/s320/grid.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This article covers general patterns and suggestions for further improvement. The code is certainly refactorable.&lt;br /&gt;&lt;br /&gt;The strongest feature of PHP and MySQL is that it combines a server-side scripting language with a persistent data store. You can imagine the database as a global variable - and it might as well be, since it's as easily accessible as one. When to query the database is up to the programmer and his discipline.&lt;br /&gt;&lt;br /&gt;Here is a general flowchart of a typical user case through the PHP files:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh5.googleusercontent.com/-xw8gZjanfQI/TYrelIxGu3I/AAAAAAAAADY/Y3k6bcmv2ns/s1600/grid_drawing.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="https://lh5.googleusercontent.com/-xw8gZjanfQI/TYrelIxGu3I/AAAAAAAAADY/Y3k6bcmv2ns/s320/grid_drawing.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;The two biggest parts of the grid project involve user interaction: logging in, and doing actions with the grid. Squares can be blackened to represent walls, and miniatures can be added or removed. The primary view is an HTML table that dispgrid.php spits out. Only minor adjustments are needed to accommodate adding or removing miniatures, and for editing squares:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-iofQMEpXfVs/TYrhlI__MbI/AAAAAAAAADc/DrP2ALNjgig/s1600/similar_grid_view.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="224" src="https://lh6.googleusercontent.com/-iofQMEpXfVs/TYrhlI__MbI/AAAAAAAAADc/DrP2ALNjgig/s320/similar_grid_view.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Thanks to the database, I only have to worry about a small number of variables. That lets me collect and transfer data in two ways: through forms, and via session variables. I store database queries with an&amp;nbsp;&lt;i&gt;associative array&lt;/i&gt;, which is very useful in PHP: utterly convenient, as the code will show.&lt;br /&gt;&lt;br /&gt;I control access to individual PHP files by testing whether a username session variable has been set. It is only set at the beginning with a successful login. In any other circumstance, kick the user back to the login page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://lh3.googleusercontent.com/-AEKE-RhKqI0/TYrjzdQz0WI/AAAAAAAAADg/-Lhpphg3rYg/s1600/Screen+shot+2011-03-24+at+1.23.31+AM.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="54" src="https://lh3.googleusercontent.com/-AEKE-RhKqI0/TYrjzdQz0WI/AAAAAAAAADg/-Lhpphg3rYg/s320/Screen+shot+2011-03-24+at+1.23.31+AM.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Session variable 'loggedin' is only set here if password matches the one from the database.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-kS-hEQc6HhI/TYrj2w3AqaI/AAAAAAAAADk/jSB0I7xdC3U/s1600/Screen+shot+2011-03-24+at+1.22.21+AM.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="https://lh6.googleusercontent.com/-kS-hEQc6HhI/TYrj2w3AqaI/AAAAAAAAADk/jSB0I7xdC3U/s1600/Screen+shot+2011-03-24+at+1.22.21+AM.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Every PHP file checks for this session variable at the beginning, and boots the user out if it is not set.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;With PHP, I can generate dynamic content; in this case, an HTML table that populates relevant cells with information from the database. The &lt;span class="Apple-style-span" style="font-family: 'Courier New',Courier,monospace;"&gt;foreach&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times,'Times New Roman',serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial,Helvetica,sans-serif;"&gt;lets me iterate through the rows returned from a database query&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times,'Times New Roman',serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times,'Times New Roman',serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh6.googleusercontent.com/-pfVaDG3Af90/TYrk9D6f-6I/AAAAAAAAADo/85W2IMRQ-Z4/s1600/Screen+shot+2011-03-24+at+1.28.23+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="https://lh6.googleusercontent.com/-pfVaDG3Af90/TYrk9D6f-6I/AAAAAAAAADo/85W2IMRQ-Z4/s320/Screen+shot+2011-03-24+at+1.28.23+AM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Times,'Times New Roman',serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;With forms, session variables and a persistent store, "pseudo" multi-user interfaces like this grid can be simulated. Every refresh of the view is a new hit on the database, pulling in the most recent data. This works because the grid depends on the turn-based mechanic of these kinds of games.&lt;br /&gt;&lt;br /&gt;Hopefully this code helps get you started on the path to web apps, or to clear some assumptions. The best thing to do is to jump in! :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://lh4.googleusercontent.com/-vrCHF7S3VJI/TYrp6uyfkvI/AAAAAAAAADs/uK4VHY2sQrE/s1600/Screen+shot+2011-03-24+at+1.50.14+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="https://lh4.googleusercontent.com/-vrCHF7S3VJI/TYrp6uyfkvI/AAAAAAAAADs/uK4VHY2sQrE/s320/Screen+shot+2011-03-24+at+1.50.14+AM.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Go forth... and conquer.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Further Investigation&lt;/span&gt;&lt;br /&gt;AJAX for automatic refresh&lt;br /&gt;SVG and &amp;lt;canvas&amp;gt;&lt;br /&gt;jQuery drag-and-drop with pathfinding&lt;br /&gt;Refined user interface&lt;br /&gt;Colored squares&lt;br /&gt;Randomized dungeons&lt;br /&gt;Faster painting than checkboxes&lt;br /&gt;Additional tables in the database&lt;br /&gt;Zend, or object-oriented PHP&lt;br /&gt;&lt;i&gt;Security&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Code&lt;/span&gt;&lt;br /&gt;&lt;strike&gt;PHP files (grid.zip) [&lt;a href="http://www.mediafire.com/?jvkbxa8pi480ypv"&gt;MediaFire&lt;/a&gt;]&lt;/strike&gt;&lt;br /&gt;&lt;strike&gt;MySQL Database file [&lt;a href="http://www.mediafire.com/?0nro0arh9r3yjtm"&gt;MediaFire&lt;/a&gt;]&lt;/strike&gt;&lt;br /&gt;&lt;strike&gt;&lt;b&gt;Update August 2011&lt;/b&gt;: Old links died; uploaded as a folder. [&lt;a href="http://www.mediafire.com/?v35n40bye3d5b"&gt;MediaFire&lt;/a&gt;]&lt;/strike&gt;&lt;br /&gt;&lt;b&gt;Update October 2011&lt;/b&gt;: Old link died. SQL file included. [&lt;a href="http://www.mediafire.com/?bc4ioj855u5i3tr"&gt;MediaFire&lt;/a&gt;] &lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Reference&lt;/span&gt;&lt;br /&gt;"PHP &amp;amp; MySQL for Dummies" [&lt;a href="http://www.amazon.com/PHP-MySQL-Dummies-Janet-Valade/dp/0470527587?ie=UTF8&amp;amp;tag=partitionseve-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Amazon Affiliate Link&lt;/a&gt;&lt;img alt="" border="0" class=" fuitekuacrcfpjixbkhn" height="1" src="http://www.assoc-amazon.com/e/ir?t=partitionseve-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0470527587" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /&gt;]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-5637562156117963396?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/5637562156117963396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2011/03/miniatures-grid-with-php-and-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5637562156117963396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5637562156117963396'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2011/03/miniatures-grid-with-php-and-mysql.html' title='Miniatures grid with PHP and MySQL'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='https://lh4.googleusercontent.com/-Gz_VRD07D68/TYrbwQbIhzI/AAAAAAAAADU/u4OJ26Mcuhs/s72-c/grid.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-521344289895849187</id><published>2011-02-14T00:38:00.007-06:00</published><updated>2011-08-20T00:29:30.399-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flixel'/><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='Allegro'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><title type='text'>Tandem sprite movement in Allegro 5</title><content type='html'>My friends and I worked on a flixel game called "Deaf Bastard," which featured a composer who moved notes. The player controlled two sprites simultaneously. Pressing left made one note move left, and made the other note move right. The former was called the "direct note," and the latter was called the "inverse note." Our &lt;u&gt;&lt;a href="http://www.megaupload.com/?d=3JZBZTO1"&gt;last build here&lt;/a&gt;&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-JFW0BSHkp7Y/TVnnGklRfjI/AAAAAAAAADA/LT1Qtk7iDIk/s1600/db+0.2.1.5.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="228" src="http://2.bp.blogspot.com/-JFW0BSHkp7Y/TVnnGklRfjI/AAAAAAAAADA/LT1Qtk7iDIk/s320/db+0.2.1.5.3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We hit a technical challenge early on, because flixel as-is checked for collisions &lt;i&gt;after&lt;/i&gt; positions were updated. Both of the notes' positions were incremented even if one note collided against a wall. So you could bang the direct note repeatedly against the ceiling, and the inverse note would "creep" down. Without preservation of note positions, the game mechanics were inconsistent.&lt;br /&gt;&lt;br /&gt;Compounding this difficulty was the seeming complexity of determining which note would collide against a wall first. Each note was independently updated. The distance traversed in each frame was hard to predict, and therefore hard to undo.&lt;br /&gt;&lt;br /&gt;I never could figure it out, but with Allegro 5 I tried again.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-BVQ-Sq9JpZg/TVjN7vVPmUI/AAAAAAAAAC4/0PARALgnO2M/s1600/db.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="315" src="http://3.bp.blogspot.com/-BVQ-Sq9JpZg/TVjN7vVPmUI/AAAAAAAAAC4/0PARALgnO2M/s400/db.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This implementation uses two features to avoid creep and to maintain consistent note movement: states to permit a note's position to be updated (that is, to be moved), and events triggered by released keys.&lt;br /&gt;&lt;br /&gt;During each iteration of the game loop, we first determine the direction of the note. If the note is moving down, it is affected by a positive velocity along the y-axis. We predict the note's future position by adding the note's (current) y-position and its speed. There is a collision if the note passes the floor boundary, designated by the #define symbol HEIGHT.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-0fQiTJwpifI/TVjAzaDHG0I/AAAAAAAAACs/nKUdNQ4hFlw/s1600/setting+state+based+on+predicted+pos.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-0fQiTJwpifI/TVjAzaDHG0I/AAAAAAAAACs/nKUdNQ4hFlw/s1600/setting+state+based+on+predicted+pos.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;All of my drawing functions assume the sprite's position is at its center. In order to calculate boundaries, I have to add or subtract SPRITE_HEIGHT/2 or SPRITE_WIDTH/2 as needed.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;If there is an imminent collision, we do some bookkeeping: zero the note's speed, and reset its position to be flush with the floor. We set the note's vertical state to DO_NOT_UPDATE_V, which denies permission to update position, at least in this loop (explained next). We also prevent the player from moving the note with the left or right key. Since this is a floor collision, the player can't move left or right until he releases the up key (explained in last code snippet).&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ZLaAdZB0nBY/TVjGUw6DqLI/AAAAAAAAACw/E5Ibj7xMCAE/s1600/permissive+states.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-ZLaAdZB0nBY/TVjGUw6DqLI/AAAAAAAAACw/E5Ibj7xMCAE/s1600/permissive+states.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;This is the crux of the matter: one note collided, which means the other note should not move. We use a state variable to control permission. In our final code snippet, we look at reenabling the player's left-right input if he releases the up key. This by the design of the mechanic: the player should not be able to move notes further if they collide against any wall.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-5K8UCq82y00/TVjPXlKvgLI/AAAAAAAAAC8/BPGt3HBOs0M/s1600/key+released+event+handling.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-5K8UCq82y00/TVjPXlKvgLI/AAAAAAAAAC8/BPGt3HBOs0M/s1600/key+released+event+handling.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;We need the zerospeed() function call because the next iteration of the game loop leads directly back to the notes updating their positions. The player releases the up key, fine; but in the next frame the note's y-speed remains non-zero, therefore yspd &amp;gt; 0, therefore predy &amp;gt; HEIGHT, therefore lockedkeys = true. Perpetually so, which means the player is &lt;i&gt;never&lt;/i&gt; able to move the notes left or right. You can see this for yourself by commenting out zerospeed() above and re-compiling.&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Files&lt;/span&gt;&lt;br /&gt;&lt;a href="http://pastebin.com/mRNNFvhs"&gt;deaf.c&lt;/a&gt;&lt;br /&gt;&lt;a href="http://pastebin.com/EfBXp5Gi"&gt;deaf.h&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Compilation&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc deaf.c -o deaf.out -L/usr/local/lib -lallegro -lallegro_main -lallegro_primitives&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;(This is assuming your shared libraries are in /usr/local/lib/ directory.)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Further Investigations&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;ul&gt;&lt;li&gt;Does it work when notes are placed in different initial positions?&lt;/li&gt;&lt;li&gt;Implement checkpath().&lt;/li&gt;&lt;li&gt;Go back and do it in flixel.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Reference&lt;/span&gt;&lt;br /&gt;&lt;i&gt;Game Programming All-in-One, &lt;b&gt;3e&lt;/b&gt;&lt;/i&gt; by Jonathan Harbour [&lt;a href="http://www.amazon.com/Game-Programming-All-Jonathan-Harbour/dp/1598632892/ref=sr_1_1?ie=UTF8&amp;amp;qid=1313818111&amp;amp;sr=8-1"&gt;Amazon Affiliate Link&lt;/a&gt;]&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Credits&lt;/span&gt;&lt;br /&gt;Original flixel version: All of the architecture, design and initial coding was done by Josh Helpert, with co-design and graphics by dcb.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update&lt;/b&gt;. Added a link to the swf file.&lt;br /&gt;&lt;b&gt;Update August 2011&lt;/b&gt;. Added Reference section and an Amazon affiliate link.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-521344289895849187?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/521344289895849187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2011/02/tandem-sprite-movement-in-allegro-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/521344289895849187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/521344289895849187'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2011/02/tandem-sprite-movement-in-allegro-5.html' title='Tandem sprite movement in Allegro 5'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-JFW0BSHkp7Y/TVnnGklRfjI/AAAAAAAAADA/LT1Qtk7iDIk/s72-c/db+0.2.1.5.3.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-2695252534093179330</id><published>2011-01-15T21:07:00.003-06:00</published><updated>2011-01-16T01:34:16.128-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='snippet'/><category scheme='http://www.blogger.com/atom/ns#' term='Allegro'/><title type='text'>TrueType fonts in Allegro 5 and Mac OS X</title><content type='html'>I tried &lt;a href="http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Addons/Fonts"&gt;the font tutorial&lt;/a&gt;, but couldn't run it due to a failed assertion. Despite linking against liballegro_font.dylib and liballegro_ttf.dylib with the linker flags &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-lallegro_font&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;and &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-lallegro_ttf&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;, and subsequent success in compilation, the executable immediately quits with an "Abort trap":&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_DIia0iJGcQI/TTKfcQZVB5I/AAAAAAAAACk/KL6ZnMw3PiE/s1600/assertion+failed2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="23" src="http://3.bp.blogspot.com/_DIia0iJGcQI/TTKfcQZVB5I/AAAAAAAAACk/KL6ZnMw3PiE/s320/assertion+failed2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;While the tutorial uses a straight font name, on Mac OS X the font path must be fully specified. So if you want to use Arial, the string should be "/Library/Fonts/Arial.ttf".&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_DIia0iJGcQI/TTJiwOxgrvI/AAAAAAAAACg/kRHyKbOV-js/s1600/hello+world.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="287" src="http://4.bp.blogspot.com/_DIia0iJGcQI/TTJiwOxgrvI/AAAAAAAAACg/kRHyKbOV-js/s320/hello+world.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;A lot prettier fonts than the default in Allegro 4.x. :)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-2695252534093179330?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/2695252534093179330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2011/01/truetype-fonts-in-allegro-5-and-mac-os.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/2695252534093179330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/2695252534093179330'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2011/01/truetype-fonts-in-allegro-5-and-mac-os.html' title='TrueType fonts in Allegro 5 and Mac OS X'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DIia0iJGcQI/TTKfcQZVB5I/AAAAAAAAACk/KL6ZnMw3PiE/s72-c/assertion+failed2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-5205946154067275089</id><published>2011-01-14T23:50:00.014-06:00</published><updated>2011-01-22T21:29:05.820-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CMake'/><category scheme='http://www.blogger.com/atom/ns#' term='Allegro'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='Clang'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Compiling Allegro 5 with Mac OS X Snow Leopard (10.6.6)</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;This tutorial takes you through building Allegro 5.0.0rc4 and compiling your first Allegro program. You will need the following:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://sourceforge.net/projects/alleg/files/allegro-prerelease/5.0.0-rc4/"&gt;allegro-5.0.0rc4.tar.gz&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cmake.org/cmake/resources/software.html"&gt;cmake&lt;/a&gt; (cmake-2.8.3-Darwin-universal.dmg)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;The steps of the tutorial are as follows:&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Extract Allegro source files, and install CMake.&lt;/li&gt;&lt;li&gt;Use the CMake &lt;b&gt;&lt;i&gt;&lt;u&gt;GUI&lt;/u&gt;&lt;span class="Apple-style-span" style="font-style: normal; font-weight: normal;"&gt;&amp;nbsp;to specify the Clang compiler, and to generate the makefile.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Run make and make install at the command-line.&lt;/li&gt;&lt;li&gt;Write and run your first Allegro 5 program.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Extract Allegro source and install CMake&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Open Terminal.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd ~/Downloads/&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar xvzf allegro-5.0.0rc4.tar.gz&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd allegro-5.0.0rc4.tar.gz&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mkdir Build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd Build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Double-click on the cmake .dmg file and install CMake.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;The &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;command, change directory, takes you inside the Downloads/ folder. The command &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;with the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;x&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;option specifies an extraction operation. (&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;tar&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;can also list, add or create compressed files.) The additional options &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;v&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;, &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;z&lt;/span&gt;, &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;f&lt;/span&gt;&amp;nbsp;specify the following, respectively:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Show me what you're extracting.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;z&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;because it's a gzip file. Notice the filename has a .gz extension.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;f&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;because I'll supply you with the filename.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;The Allegro README recommends building in a separate build directory, so we make the directory with&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mkdir&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;If you mess up during the build process, you just have to delete one folder; it's cleaner. We then go into the Build/ directory so that everything is built in this location.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Installing CMake from a .dmg file should be self-explanatory.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Specify Clang as our compiler and generate the Makefile&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Launch the CMake application from your Applications folder.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In the Source field, enter /Users/&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;your-login-name&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;/Downloads/allegro-5.0.0rc4&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In the Build field, enter&amp;nbsp;/Users/&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;your-login-name&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;/Downloads/allegro-5.0.0rc4/Build&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Click Generate - and when you do, a dialog like this should appear:&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_DIia0iJGcQI/TTEqvbloC3I/AAAAAAAAACQ/MO6wNkylcsg/s1600/specifying+clang.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="227" src="http://3.bp.blogspot.com/_DIia0iJGcQI/TTEqvbloC3I/AAAAAAAAACQ/MO6wNkylcsg/s320/specifying+clang.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;If this dialog does not appear, make sure your Build/ directory is &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;empty&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;. This dialog needs to appear in order for you to specify Clang ("cee-lang") as your compiler of choice. It has to do with gcc being the default compiler and Snow Leopard being a 64-bit OS.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;When this dialog appears, be sure to select "&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Specify native compilers&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;." Clang comes with Snow Leopard; we just need to tell CMake that we will use Clang as our C compiler instead of the GNU C compiler. Click Continue.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;In the next dialog, in the C text field, enter the path to the clang tool:&amp;nbsp;&lt;/span&gt;&lt;u&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;/Developer/usr/bin/clang&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_DIia0iJGcQI/TTEwN4Yqb1I/AAAAAAAAACU/FDdQ7SfSXeE/s1600/specifying+path+to+clang.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="107" src="http://1.bp.blogspot.com/_DIia0iJGcQI/TTEwN4Yqb1I/AAAAAAAAACU/FDdQ7SfSXeE/s320/specifying+path+to+clang.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;Click Done, and CMake should create nine file&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;s in the build directory. You can use &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;ls&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;to list them.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_DIia0iJGcQI/TTJYUiaro9I/AAAAAAAAACY/2XGDrCF-qqs/s1600/after+cmake.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="18" src="http://2.bp.blogspot.com/_DIia0iJGcQI/TTJYUiaro9I/AAAAAAAAACY/2XGDrCF-qqs/s400/after+cmake.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Make and make install&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Still in the Build/ directory, type &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo cmake .&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo make&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sudo make install&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Alright, now take a look at the /usr/local/lib directory. Note the pattern of each filename:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;lib&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;allegro or allegro_&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;something&lt;/span&gt;&lt;/i&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;.dylib&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Write and run your first Allegro program&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Create a text file alleg5test.c and enter &lt;/span&gt;&lt;a href="http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays#Code"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;this code listing&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc alleg5test.c -o alleg5test -L/usr/local/lib -lallegro -lallegro_main&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;./alleg5test&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;You should get a window with a black background to show up. If you did, congratulations!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Check out the pattern of the flags: a&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-l &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;("dash-el") followed by &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;allegro_&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;. &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;I guess all of them are the .dylib files from /usr/local/lib. Hmm.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;You might be able to adjust this tutorial to work with Xcode, and then to create an Allegro template. (Hint: See my previous tutorial on Flixel.)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;I hope this saves you some time. Go through the tutorials, and go make some games!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;References&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Dennis Sarrazin's &lt;/span&gt;&lt;a href="http://www.allegro.cc/forums/thread/605691"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;post at 1:53 PM&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;README.txt, README_macosx.txt, README_cmake.txt, etc.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;a href="http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Displays"&gt;First Allegro 5 Tutorial&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Updates&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;1/15/2011: Removed &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-lz&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;option from the long&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&amp;nbsp;above. That would have told the linker to look for a library named "z." Lol.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;1/15/2011: Much shorter gcc invocation. Originally&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc alleg5test.c -o alleg5test -lallegro -lallegro_font -lallegro_main -lallegro_primitives -lallegro_image -framework AppKit -framework OpenGL /usr/lib/libIOKit.dylib -framework Cocoa&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;, but not all of these are needed (at least for our small program). Compare with Allegro 4.4, where you did &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc helloworld.c `allegro-config --libs`&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;. The output of allegro-config 4.4.1 was &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-L/usr/local/lib -framework Cocoa -lalleg-main -lalleg&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;. Similar, no?&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;1/15/2011: &lt;s&gt;I can't compile the &lt;/s&gt;&lt;a href="http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial/Bitmaps"&gt;&lt;s&gt;bitmap tutorial at the Allegro wiki&lt;/s&gt;&lt;/a&gt;&lt;s&gt;. My error message is, "Undefined symbols: _al_set_clear_to_color." Strange&lt;/s&gt;. Oops, typo. gg. There's a al_clear_to_color() function; I was just practicing my speed typing.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;1/15/2011: Added an extra step, sudo cmake ., because there's no Makefile after CMake creates its nine files.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;1/22/2011: Took out the "-framework Cocoa" switch in gcc. Don't need it.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;Now, if only there was a &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;allegro-config&lt;/span&gt;&amp;nbsp;that could do for Allegro 5 what it did for Allegro 4.4. (If you're up to it, write a program &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;allegro5-config&lt;/span&gt;&amp;nbsp;that outputs the appropriate arguments to gcc, place it in /usr/local/bin, and then try &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gcc alleg5test.c `allegro5-config [--libs]`&lt;/span&gt;. It might not even have to be a program, but just a shell script.)&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-5205946154067275089?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/5205946154067275089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2011/01/compiling-allegro-5-with-mac-os-x-snow.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5205946154067275089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5205946154067275089'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2011/01/compiling-allegro-5-with-mac-os-x-snow.html' title='Compiling Allegro 5 with Mac OS X Snow Leopard (10.6.6)'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_DIia0iJGcQI/TTEqvbloC3I/AAAAAAAAACQ/MO6wNkylcsg/s72-c/specifying+clang.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-5298748179986433921</id><published>2010-10-30T23:09:00.003-05:00</published><updated>2010-10-30T23:22:18.239-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='Xcode'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Passing code as a text stream into a program</title><content type='html'>A &lt;i&gt;text stream&lt;/i&gt;&amp;nbsp;is a line of text terminated by the newline character, '\n'. The standard library function &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;getchar()&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;retrieves one character at a time from the text stream.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the first chapter of Kernighan and Ritchie's&amp;nbsp;&lt;i&gt;The C Programming Language&lt;/i&gt;&amp;nbsp;2e, this function is used in programs of increasing complexity, from a character counter to a rudimentary syntax checker.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Testing these programs in Xcode's Debugger Console can only be very limited. As soon as the user presses Enter, the text stream is happily processed, and the program expects additional input. But what if you want to test input spanning multiple lines?&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_DIia0iJGcQI/TMzcx4PsdfI/AAAAAAAAABs/nC9lmPFiDZM/s1600/Screen+shot+2010-10-30+at+10.04.12+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_DIia0iJGcQI/TMzcx4PsdfI/AAAAAAAAABs/nC9lmPFiDZM/s1600/Screen+shot+2010-10-30+at+10.04.12+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In K&amp;amp;R C section 1.6, the first example program counts the frequency of different characters, like digits and blanks. Sample output is from "the program on itself." Near the end of the chapter, Exercise 1-23 asks to "write a program to remove all comments &lt;i&gt;from a C program&lt;/i&gt;." There has to be some way to pre-populate the text stream, so that your program processes it to an EOF.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Using &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cat&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;, we can pipe the output of a file, such as main.c, to our program. Since we're using Xcode, the path to our project directory can be pretty long to type every time. Instead, we'll write an AppleScript script to tell Xcode to build the project, and to tell Terminal to activate and execute the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cat&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;pipe:&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: auto;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_DIia0iJGcQI/TMzurHlweVI/AAAAAAAAACE/2y4w1G1BLeE/s1600/Screen+shot+2010-10-30+at+11.20.15+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_DIia0iJGcQI/TMzurHlweVI/AAAAAAAAACE/2y4w1G1BLeE/s1600/Screen+shot+2010-10-30+at+11.20.15+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: auto;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The script uses some parts from my &lt;a href="http://partitionseven.blogspot.com/2010/10/scrambling-text-for-nanowrimo-using.html"&gt;previous AppleScript tutorial&lt;/a&gt;. Fortunately, all paths are POSIX formatted rather than aliases formatted as HFS paths. &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The one new thing is the use of &lt;i&gt;quoted form&lt;/i&gt;, which&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;lets me pass a directory with spaces, like /Programming Exercises/, without escaping the blanks.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;With this script, the same program now processes a text stream all the way to EOF:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_DIia0iJGcQI/TMzqGA5vQsI/AAAAAAAAAB8/C-Y_97gcn68/s1600/Screen+shot+2010-10-30+at+11.00.59+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_DIia0iJGcQI/TMzqGA5vQsI/AAAAAAAAAB8/C-Y_97gcn68/s1600/Screen+shot+2010-10-30+at+11.00.59+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;And the output:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_DIia0iJGcQI/TMzqGhi_rII/AAAAAAAAACA/SwCCR8wYcxo/s1600/Screen+shot+2010-10-30+at+10.59.32+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_DIia0iJGcQI/TMzqGhi_rII/AAAAAAAAACA/SwCCR8wYcxo/s1600/Screen+shot+2010-10-30+at+10.59.32+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;I'm not sure how much use this will be beyond the first chapter, but now that I can pass text streams to EOF in my programs, I feel better about going through these exercises. Instead of one-liner "tests," I can pass whole files as representative input.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;References&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_classes.html%23//apple_ref/doc/uid/TP40000983-CH1g-246384"&gt;Quoted form property of the text object&lt;/a&gt;, &lt;i&gt;AppleScript Language Guide&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-5298748179986433921?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/5298748179986433921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2010/10/passing-code-as-text-stream-into.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5298748179986433921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/5298748179986433921'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2010/10/passing-code-as-text-stream-into.html' title='Passing code as a text stream into a program'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DIia0iJGcQI/TMzcx4PsdfI/AAAAAAAAABs/nC9lmPFiDZM/s72-c/Screen+shot+2010-10-30+at+10.04.12+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-4970626519247866236</id><published>2010-10-24T01:02:00.032-05:00</published><updated>2010-11-01T21:34:58.842-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pages'/><category scheme='http://www.blogger.com/atom/ns#' term='NaNoWriMo'/><category scheme='http://www.blogger.com/atom/ns#' term='TextEdit'/><category scheme='http://www.blogger.com/atom/ns#' term='article'/><category scheme='http://www.blogger.com/atom/ns#' term='AppleScript'/><title type='text'>Scrambling text for NaNoWriMo using AppleScript, Pages 09 and TextEdit</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;During National Novel Writing Month, or NaNoWriMo, people &lt;a href="http://www.nanowrimo.org/"&gt;try to write a 50,000-word novel in thirty days&lt;/a&gt;. You can upload a text file of your progress to get an official word count. Instructions are included on the web site for scrambling your work before submission, if there is any worry of "untrustworthy, word-counting goons." However,&lt;a href="http://www.nanowrimo.org/eng/node/402946"&gt; only the following methods&lt;/a&gt; are detailed.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Microsoft Word supports regular expressions, so a quick Save As to a .txt file, and a straightforward [a-zA-Z0-9] wildcard expression with Find and Replace, does the trick. However, you have to manually overwrite further scrambled text files.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Open Office works similarly, but again - you must manually delete a text file full of strings of the character 'a'.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Use Find and Replace twenty-five times.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;I have Pages '09, so i&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;n this article I discuss using AppleScript to generate a scrambled text file from that application.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;i&gt;Given a Pages '09 document, generate a scrambled .txt file to the Desktop for upload to NaNoWriMo. Any intermediate files should be deleted after use.&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;How would I do this by hand?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Save my Pages document as a plain text file using Save As.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Run a couple command-line programs to process the text.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Redirect the output to a "upload_me.txt" file.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Delete the text file that Pages made.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;(Upload to NaNoWriMo's word-counting thing.)&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Let's translate this to AppleScript. I will introduce each section and then give some explanations.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;You can &lt;a href="http://pastebin.com/qQbhjYzw"&gt;find the Pastebin source here&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and the&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://www.megaupload.com/?d=QMQNI56Z"&gt;script file itself on MegaUpload&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;. I encourage you to&amp;nbsp;&lt;a href="http://img16.imageshack.us/img16/7140/screenshot20101023at114.png"&gt;compile the script for yourself&lt;/a&gt;, or to just run it from the script editor.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_DIia0iJGcQI/TMO9YwFgYvI/AAAAAAAAABA/nZx1PfAYIW0/s1600/Screen+shot+2010-10-23+at+11.59.01+PM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_DIia0iJGcQI/TMO9YwFgYvI/AAAAAAAAABA/nZx1PfAYIW0/s1600/Screen+shot+2010-10-23+at+11.59.01+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Times;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Times;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;First, we ask the user to choose a .pages document with &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;choose file&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;. The &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;activate&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;keyword shifts focus to the file chooser dialog. We get the name and path of the chosen Pages document, and we &lt;b&gt;return&lt;/b&gt;&amp;nbsp;if the user cancels out. Note that the directories are separated by colons, and the presence of the word &lt;i&gt;alias&lt;/i&gt;. AppleScript formats paths in two ways, and this is one. The alias path is formatted as an &lt;i&gt;HFS path&lt;/i&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The file chooser repeats until a valid Pages document is chosen. Fortunately, even if a document is simply named "test," internally the file is recognized as "test.pages."&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;After we harvest the file information, we tell Pages to save the document as a plain text file, and we run &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cat&lt;/span&gt;&amp;nbsp;and &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sed&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;to process the text proper.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_DIia0iJGcQI/TMO_jaXuEXI/AAAAAAAAABE/SuCHJnKtSrw/s1600/Screen+shot+2010-10-24+at+12.07.36+AM.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_DIia0iJGcQI/TMO_jaXuEXI/AAAAAAAAABE/SuCHJnKtSrw/s1600/Screen+shot+2010-10-24+at+12.07.36+AM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;I tried redirection &amp;gt; to a file after &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sed&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;, but I received error message -10004, or that a "privilege violation" occurred. A Technical Note (referenced below) gives some advice on granting admin-level access, but I'm creating a text file. So I decided to use TextEdit. This is the power of scripting: chaining application abilities together into an automated process.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;There are more types than just SLDocumentTypePlainText. There's also&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;SLDocumentTypeMSWord,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;SLDocumentTypePDF,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;SLDocumentRichText, and&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;SLDocumentRichTextBundle.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;We name the new text file by using the ampersand operator to concatenate the file path and name to the ".txt" extension. The &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;POSIX path&lt;/span&gt;&amp;nbsp;&lt;i&gt;specifier&lt;/i&gt;&amp;nbsp;gives us the path with '/' as the directory separator. This is the second way paths are formatted in AppleScript. If you pass an HFS path to a Unix tool like &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cat&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;,&amp;nbsp;it will return the error "No such file or directory."&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Pages doesn't receive the &lt;b&gt;activate&lt;/b&gt;&amp;nbsp;command, but doesn't need to because its job is to simply Save As and close a file. The &lt;b&gt;open&lt;/b&gt;&amp;nbsp;command not only opens a document, but returns the document's id. This is very useful; exploit this as much as possible.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;With the scrambled text after &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cat&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;/&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sed&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;stored in the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;scramble_text&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;variable, we can now use TextEdit's features to generate a text file.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Question: at runtime, can an AppleScript variable store a string consisting of 50,000 words? I used a Pages document with 101,233 words spanning 278 pages consisting of 431,954 characters (excluding spaces), and the script took about three seconds.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_DIia0iJGcQI/TMPHd5A2VeI/AAAAAAAAABQ/mkB6HuyESkI/s1600/Screen+shot+2010-10-24+at+12.42.14+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_DIia0iJGcQI/TMPHd5A2VeI/AAAAAAAAABQ/mkB6HuyESkI/s1600/Screen+shot+2010-10-24+at+12.42.14+AM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_DIia0iJGcQI/TMPHhDcGcBI/AAAAAAAAABU/j8pbtIq6aMs/s1600/Screen+shot+2010-10-24+at+12.42.32+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_DIia0iJGcQI/TMPHhDcGcBI/AAAAAAAAABU/j8pbtIq6aMs/s1600/Screen+shot+2010-10-24+at+12.42.32+AM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Here we tell TextEdit to create a new document, to populate it with the scrambled text, and to save to Desktop. Now a user can visit NaNoWriMo and upload this text file. Successive uses of this script will overwrite the "upload_me.txt" file, so we no longer have to confirm a file overwrite as with Word or Open Office. Error number 0 indicates success. &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;And there you have it: a script to make your novel one long shout.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Try experimenting with AppleScript, and consider signing up for NaNoWriMo! :)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;References&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://developer.apple.com/library/mac/#documentation/OpenSource/Conceptual/ShellScripting/ShellInputandOutput/ShellInputandOutput.html%23//apple_ref/doc/uid/TP40004268-CH3-SW10"&gt;Basic File Redirection&lt;/a&gt;, &lt;i&gt;Shell Scripting Primer &lt;/i&gt;[developer.apple.com]&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html%23//apple_ref/doc/uid/TP40000983-CH218-SW28"&gt;Aliases and Files&lt;/a&gt;, &lt;i&gt;AppleScript Language Guide&lt;/i&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;i&gt;&lt;a href="http://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html%23//apple_ref/doc/uid/10000156-BCICHGIE"&gt;AppleScript Overview&lt;/a&gt;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://developer.apple.com/library/mac/#technotes/tn2002/tn2065.html"&gt;Technical Note TN2065&lt;/a&gt;: do shell script in AppleScript&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://lists.apple.com/archives/applescript-users/2004/Jan/msg00116.html"&gt;AppleScript Error Codes&lt;/a&gt; [lists.apple.com]&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://macscripter.net/viewtopic.php?id=27304"&gt;Export as RTFD with Pages&lt;/a&gt; [macscripter.net]&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://hints.macworld.com/article.php?story=20080917031839321"&gt;Easily Save TextEdit Documents via AppleScript&lt;/a&gt; [hints.macworld.com]&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://forums.macrumors.com/showthread.php?t=446171"&gt;Simple AppleScript: Create a .txt file&lt;/a&gt; [forums.macrumors.com]&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;Update 11/1/2010.&lt;/b&gt;&amp;nbsp;Had to use quoted form for the directory when passing in to the shell script. My file was called "Chapter 1.pages," and the script wouldn't work. The links to MegaUpload and to Pastebin have been updated. See screenshot:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_DIia0iJGcQI/TM94ZjFZPiI/AAAAAAAAACI/vIYhJ2MJJnQ/s1600/Screen+shot+2010-11-01+at+9.31.26+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_DIia0iJGcQI/TM94ZjFZPiI/AAAAAAAAACI/vIYhJ2MJJnQ/s1600/Screen+shot+2010-11-01+at+9.31.26+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-4970626519247866236?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/4970626519247866236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2010/10/scrambling-text-for-nanowrimo-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/4970626519247866236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/4970626519247866236'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2010/10/scrambling-text-for-nanowrimo-using.html' title='Scrambling text for NaNoWriMo using AppleScript, Pages 09 and TextEdit'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_DIia0iJGcQI/TMO9YwFgYvI/AAAAAAAAABA/nZx1PfAYIW0/s72-c/Screen+shot+2010-10-23+at+11.59.01+PM.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8791498814807582586.post-7668405260583805091</id><published>2010-10-13T01:23:00.010-05:00</published><updated>2010-10-30T16:26:46.483-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flixel'/><category scheme='http://www.blogger.com/atom/ns#' term='Xcode'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Setting up Flex, flixel and Xcode</title><content type='html'>&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In this tutorial, you will build and run a flixel project from Xcode.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;You will use Xcode to edit ActionScript 4 files, and you will see how Xcode uses an&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;i&gt;External Build Target&lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;to run the AS4 compiler&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mxmlc&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;, much like how Eclipse uses&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;javac&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;behind the scenes to compile .java files, or how Mac OS X uses&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;open&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;to launch Preview when you double-click on a PDF file&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;. At the end of this post, you will find links to three comprehensive, excellent flixel tutorials.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Flixel is a game development library created by Adam Saltsman that leverages the Adobe Flex framework. Both the flixel library and the Flex SDK will be needed. Additional files include the&amp;nbsp;&lt;i&gt;flixel template file&lt;/i&gt;&amp;nbsp;and the&amp;nbsp;&lt;i&gt;syntax highlighter specification folder (&lt;b&gt;SHSF&lt;/b&gt;)&lt;/i&gt;.&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The template file will make things easier for both of us: first, your project should build out of the box: you'll have a working flixel application right from the start, in Xcode. Second, many steps can be referenced rather than explicitly enumerated.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The &lt;b&gt;SHSF&lt;/b&gt; has files to enable syntax highlighting of AS4 files in Xcode. We will use the specification files of Nathan Roberton, a UX designer in CTO Product Incubation at Microsoft.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Before we begin, please note that this tutorial is for flixel 2.35, Adobe Flex 4.1.0.16076 and Xcode 3.2.2. I assume you have Xcode installed. Let's get started.&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;The tutorial has the following steps:&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Download files.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Move and rename files.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Open Xcode, start a new flixel project, and build.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Run the SWF in Safari.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;Step 1: Download files.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;We need to download the following:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://flixel.org/#downloads"&gt;flixel 2.35&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://www.adobe.com/cfusion/entitlement/index.cfm?e=flex4sdk"&gt;Adobe Flex 4 SDK&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.megaupload.com/?d=K1I1D7CN"&gt;flixel template for Xcode&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.nathanroberton.com/Site/thoughts/Entries/2007/12/22_xcode_and_as3.html"&gt;syntax highlighter specification folder&lt;/a&gt;*&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;* The last download goes to Nathan Roberton's own tutorial on Xcode and AS3. Scroll to the bottom, to step eight, and download the "Actionscript specification files."&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Extract any compressed files.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;Step 2: Move and rename files.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Next, move the flixel folder and the Flex SDK folder to the /Developer/Library/SDKs directory.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Move the "Flixel Game" folder to the ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/Other directory.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Move the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;individual&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;specification files into the ~/Library/Application Support/Developer/Shared/Xcode/Specifications directory.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;You will need to make folders, because some of these directories will not exist.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;At this point, you are free to rename the flixel library folder and the Flex SDK folder. For the purposes of this tutorial, rename them to "flixel_2.35" and "flex_4.1.0.16076," respectively. Omit the double quotes.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_DIia0iJGcQI/TLVJz9yWrqI/AAAAAAAAAAg/hboib4DwkII/s1600/Screen+shot+2010-10-13+at+12.54.36+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="85" src="http://4.bp.blogspot.com/_DIia0iJGcQI/TLVJz9yWrqI/AAAAAAAAAAg/hboib4DwkII/s200/Screen+shot+2010-10-13+at+12.54.36+AM.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Why these specific directories?&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;The Flex SDK is 273 MB, and I do not want Time Machine to back it up if I place it in my ~ (home) directory. The /Developer/SDKs directory is for "system SDKs," according to the &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Xcode Installation Guide&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Step 3:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Open Xcode, start a new flixel project, and build.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Launch Xcode. Go to File -&amp;gt; New Project. Choose "Other" under User Templates, select the "Flixel Game" template, and click Choose. Name your new project.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Under the Groups &amp;amp; Files sidebar, expand Targets, and then double-click on "mxmlc." Note the following:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the Build Tool field, the path leads to the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;mxmlc&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&amp;nbsp;program. This is the Adobe Flex compiler.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the Arguments field, there are two flags set: &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-compiler.source-path&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;, and &lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-static-link-runtime-shared-libraries=true&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;. The first flag refers the compiler to the flixel libraries, and the second fixes an obscure [Embed()] issue.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the Product Name field, note that spaces must be escaped, and that decimals are okay. Also notice the shorthand ${PRODUCT_NAME} used in the Arguments field.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;In the Build Settings section lower down, there is only PRODUCT_NAME. Most default Xcode projects will have GCC environment variables set here. They have been removed, because we are making SWFs. (Oh, and "Pass build settings in environment" is unchecked.)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Go to the Build Menu and click Build, or press Command+B. Xcode will invoke the Flex compiler. Build results may be viewed by clicking the right-most icon. This is where error messages will show up. See screenshots:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_DIia0iJGcQI/TLVOUoDbdCI/AAAAAAAAAAk/znhdf9oROoM/s1600/Screen+shot+2010-10-13+at+1.12.56+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="28" src="http://3.bp.blogspot.com/_DIia0iJGcQI/TLVOUoDbdCI/AAAAAAAAAAk/znhdf9oROoM/s200/Screen+shot+2010-10-13+at+1.12.56+AM.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_DIia0iJGcQI/TLVOXQuWVwI/AAAAAAAAAAo/SzNc9PAsYFY/s1600/Screen+shot+2010-10-13+at+1.14.02+AM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="79" src="http://3.bp.blogspot.com/_DIia0iJGcQI/TLVOXQuWVwI/AAAAAAAAAAo/SzNc9PAsYFY/s200/Screen+shot+2010-10-13+at+1.14.02+AM.png" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;A successful build creates a SWF file in the ./bin/ directory of your project.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;Step 4: Run the SWF in Safari.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;Drag the SWF file into a new Safari window. Your journey has just begun.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;b&gt;flixel Tutorials&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;a href="http://www.creativeapplications.net/flash/flixel-2-tutorial-flash-tutorials-games/"&gt;Andreas Zecher's Defender clone&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://wiki.github.com/AdamAtomic/flixel/seifer-tims-tutorial"&gt;Seifer Tim's Ninja assault&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.brighthub.com/hubfolio/matthew-casperson/blog/archive/2009/12/02/creating-a-flash-platform-game-with-flixel-and-flex.aspx"&gt;Matthew Casperson's Lessons with Mode&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Now go and make a game! :)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8791498814807582586-7668405260583805091?l=partitionseven.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://partitionseven.blogspot.com/feeds/7668405260583805091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://partitionseven.blogspot.com/2010/10/flex-flixel-and-xcode.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/7668405260583805091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8791498814807582586/posts/default/7668405260583805091'/><link rel='alternate' type='text/html' href='http://partitionseven.blogspot.com/2010/10/flex-flixel-and-xcode.html' title='Setting up Flex, flixel and Xcode'/><author><name>Coop</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_DIia0iJGcQI/TLVJz9yWrqI/AAAAAAAAAAg/hboib4DwkII/s72-c/Screen+shot+2010-10-13+at+12.54.36+AM.png' height='72' width='72'/><thr:total>6</thr:total></entry></feed>
