<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:534344548;
mso-list-type:hybrid;
mso-list-template-ids:-815098508 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Having made the statement a few times over the last few months that Rebar is not compatible with Windows, I was challenged on this. My statement was based on my one-off experience with Rebar one or two years ago, so it was time I retried it. I decided to use the discussion about HTTP servers to try out Cowboy, which requires Rebar.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Rebar installed just fine on Windows. I downloaded the zip file from Git Hub and unzipped it into my Erlang lib directory. I ended up with a directory named “basho-rebar-32e67ef” in my lib, which is kind of nonstandard naming, but I could have renamed it to “rebar-...” if I had bothered to look up the correct version number to put there. Failing that, I could have just renamed it “rebar”, but it worked as it was, so I was unconcerned.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>I ran the Rebar <i>bootstrap.bat,</i> which generated a <i>rebar</i> file and a <i>rebar.cmd</i> file to run it. So far I was quite encouraged, with the provision of a Windows “bat” file and now a “cmd” file. It would appear that Rebar was built to work on Windows. <span style='font-family:Wingdings'>J</span><o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>I downloaded Cowboy from Git Hub the same way I did Rebar. The resulting directory was again named “extend-cowboy-1f9d71c” in the nonstandard way of Git Hub, but it still works.<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Here I ran into some problems, but it turned out they were mine rather than Windows’s. I tried a “rebar compile” on Cowboy, but got an error about the dependency on Ranch not being available. It should have been available, since I had previously downloaded it, and even if I hadn’t, the <i>rebar.config</i> told it where it could get it from. Turns out, however, that I have to explicitly tell it to get dependencies. Tuncer Ayaz – bless his soul – gave me a hand here and explained that I should use the command “rebar get-deps”, “rebar get-deps compile”, or abbreviated to “rebar g-d com”. With that, it downloaded Ranch and compiled fine. Yay!<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>5.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Interestingly enough, Rebar does not download the dependencies into the Erlang lib directory, but rather into a “deps” subdirectory of your application. This means <i>erl.exe</i> and <i>werl.exe</i> cannot see it, but this can easily be rectified by either copying the downloaded applications up into the lib directory, or using the “-pa” option on the command line. If anyone has any suggestions as to which is better for their workflow, please let me know.<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>6.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>At this point, Cowboy was working, but I figured I should try to get it to do something useful. I couldn’t find a whole lot of documentation on its API, but I did find that it came with a few examples in the <i>examples</i> subdirectory. I decided to give the static example a whirl, and Rebarred it and then ran it, and it worked. Fine. Out of the box. Yay!<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>7.<span style='font:7.0pt "Times New Roman"'> </span></span><![endif]>Unfortunately, when it served up the <i>test.txt</i> sample file, Chrome treated it as a download rather than text to be displayed in the browser. Usually when I encounter an issue where I want to see what’s coming down the wire, I just telnet to the appropriate port and send a “GET /” to see what is returned. I don’t think Cowboy handles HTTP 1.0, though I couldn’t find any record of that. At any rate, I just had to do some extra typing in order to send a minimal HTTP 1.1 request, and after some poking around, I discovered my problem was related to the MIME type being sent in the HTTP response. So I added the “mimetypes” application to the example’s Rebar dependencies, modified the <i>static_app.erl</i> file to use the function <i>mimetypes:path_to_mimes</i> to choose the correct MIME type and then restarted it – or at least tried to. Try as I may, I could not get it to work for the longest time. In the end, I determined that mimetypes’s lexer was built for Unix only, not Windows, so it was not recognizing the line endings in the provided <i>mime.types</i> file. The solution then was to modify mimetypes’s <i>mimetypes_scan.xrl</i> to recognize a CRLF as a newline, too. I suppose I should figure out how to use Git Hub so I can submit that patch. At any rate, now it all works like champ.<o:p></o:p></p><p class=MsoListParagraph><o:p> </o:p></p><p class=MsoNormal>So I can confirm that both Rebar and Cowboy work on Windows 7 system. Thank-you all for your work on these.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>David Mercer<o:p></o:p></p><p class=MsoNormal>Director, Technology & Research<o:p></o:p></p><p class=MsoNormal>MedWorth<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>