Tuesday, August 30, 2011

Tinkering with Javascript Libraries on jsfiddle.net

Man I'm out of it. Such great tools that I missed during my post-2.0 slumber.

jsfiddle allows you to quickly and easily make and test JavaScript apps using some of the cool libraries out there (e.g. jQuery or mootools).

Just go to http://jsfiddle.net and start hacking in your HTML, Javascript and CSS. Press Ctrl+Enter to run and your app will, er, run!

I think it's cool.

Check out my sandbox application which says hello to you via ajax. Oh the wonders of modern technology.

Monday, August 29, 2011

Mongoose: Free Easy Web Server

I've always been an IIS fan but the move to Windows 7 and IIS7 has shown me that I'm getting old. I can't get IIS to do anything right and so I've decided: let's re-rethink this. Back to basics. KISS!

I googled "simple http server" and discovered mongoose.

It's Simple™. It Works™. I Like It™.

Download the mongoose.exe and run it and you've just started your webserver.

By default, mongoose serves from C:\ so if you browse to http://localhost/ you should see a directory listing.

Mongoose is configurable via the command line or via a configuration file.

Example: Server on Port 81
C:\>mongoose.exe -p 81

or, via config file you create a mongoose.conf file with the following content:
p 81


You'll probably do something wrong at some stage so you need to tell mongoose where to log errors. This is done via the e parameter:
C:\>mongoose.exe -e error.log -p 81

or
e error.log


Check out the full manual explaining all commands.

This thing can even run PHP! Just tell it which file extensions you want to be processed via CGI:
c .php

Next, tell it where your php executable lies:
I c:\\php\\php-cgi.exe

(The double backslashes are required for windows PCs like mine)

Here is my sample/example mongoose.conf:
# Error Log
e error.log

# Ports (csv)
p 80

# Root directory
r c:\\mywebsite\\html

# Default documents
# (disabled with # comment)
#i index.htm,index.html

# Add your special mime types here
m .manifest=text/cache-manifest,.asp=text/html

# CGI File extensions (csb)
c .php

# Location of CGI interpreter (e.g. PHP)
I c:\\php\\php-cgi.exe


Happy serving!