Install Apache 2 and PHP 5 with MacPorts | 2 tablespoons 4/2/08 - Added php.ini settings to use the proper MySQL socket at /tmp/mysql.sock. 3/23/08 - After going through these instructions on a new Leopard system, I made a few minor updates. The steps should now work for Leopard as well as Tiger. While options abound, MacPorts may be the easiest option to configure a local web development environment on your Mac. Here are a few of the options Mac users have to set up a PHP development environment: Use the stock Apache 1.3 with a PHP package, like the one from www.entropy.chInstall everything but the kitchen sink with MAMP or XAMPPUse MacPorts to install Apache 2 and PHP 5 If you haven't already done so, install MacPorts. LightTPD: An Alternative to Apache I've read great things about LightTPD, a light-weight HTTP server. If you have MacPorts and your database of choice installed, let's get started. Install Apache 2 There aren't many port variants for Apache 2, and those that exist are probably not needed by most developers. Install PHP 5 to Try It!
C++ Web Programming What is CGI? The Common Gateway Interface, or CGI, is a set of standards that define how information is exchanged between the web server and a custom script.The CGI specs are currently maintained by the NCSA and NCSA defines CGI is as follows:The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers. The current version is CGI/1.1 and CGI/1.2 is under progress. Web Browsing To understand the concept of CGI, let's see what happens when we click a hyperlink to browse a particular web page or URL. Your browser contacts the HTTP web server and demand for the URL ie. filename.Web Server will parse the URL and will look for the filename. However, it is possible to set up the HTTP server in such a way that whenever a file in a certain directory is requested, that file is not sent back; instead it is executed as a program, and produced output from the program is sent back to your browser to display. First CGI Program
WebPlatform.org — Your Web, documented Apache 2.x Modules In C++ (Part 1) Introduction There are many resources available that describe building Apache modules in C (and Perl with mod_perl) but very little for the C++. This article is designed to address this situation and describe how to build an application as an Apache module using C++. It must be said at this point that there’s no escaping C, Apache and the APR are written in C and we’ll also be writing C to interface to it. The Development Environment As with all projects you must start somewhere. In my own setup, I have a dedicated server running CentOS6 but you could also use a virtual machine. To begin with we need to ensure our server is configured with all the packages we need. yum groupinstall 'Development Tools'httpd-2.2.15-15.el6.centos.1.x86_64httpd-devel-2.2.15-15.el6.centos.1.x86_64httpd-tools-2.2.15-15.el6.centos.1.x86_64 Note - if you are using a 32bit machine then ensure you load the correct 32bit packages. Next install Netbeans for C/C++ from and install onto your server.
Vi[m] Vi is an one of two powerhouse text editors in the Unix world, the other being EMACS. While obtuse, vi is extremely powerful and efficient. There may be times when vi is the only text editor available, so it helps to at least know the basics. On Mac OS X (and Linux), vi is symlinked to vim (vi improved), a more modern free software version. If you gave vi a whirl and don't see the beauty of it, give the nano editor a try. note: a chunk of this small guide came from a web page I found long ago, but I don't remember where so I can't give proper credit. Vi has two modes, command and insert (really, three if you count replace mode). Vi starts in command mode. You can precede most commands with a number indicating how many times to perform a command. Download Abyss Web Server for Mac - Free personal Web server Free personal Web server. Free Abyss Web Server X1 is a free personal Web server. Despite its small footprint, it supports secure SSL connections (HTTPS), download resuming, caching negotiation, logging, CGI/FastCGI, ISAPI extensions, Server Side Includes (SSI), custom error pages, password protection, URL rewriting, IP address control, aliases, custom MIME types, index files, custom directory listings, anti-leeching, and bandwidth throttling. It features also an automatic anti-hacking system and an intuitive multilingual remote Web management interface. With Abyss Web Server X1, hosting your site and your PHP, Perl, Python, or Ruby on Rails Web applications is a matter of a few minutes. What's New Requirements Intel/PPC, OS X 10.2.8 or later LiteSpeed Web... +6 Free Highly scalable Web delivery ...
Mac OS X keyboard shortcuts To use a keyboard shortcut you press a modifier key with a character key. For example, pressing the Command key (it has a symbol) and then the "c" key copies whatever is currently selected (text, graphics, and so forth) into the Clipboard. This is also known as the Command-C keyboard shortcut. A modifier key is a part of many keyboard shortcuts. Here are the modifier key symbols you may see in OS X menus: Startup shortcuts Press the key or key combination until the expected function occurs/appears (for example, hold Option during startup until Startup Manager appears). Sleep and shut down shortcuts Finder keyboard shortcuts Application and other OS X shortcuts Note: Some applications may not support all of the following application key combinations. *Note: If no text is selected, the extension begins at the insertion point. Universal Access - VoiceOver keyboard commands For information about VoiceOver key combination differences in Mac OS X v10.6, see this article. Full keyboard access
mongoose - Mongoose - easy to use web server Overview Mongoose is the most easy to use web server on the planet. A web server of choice for Web developers (PHP, Ruby, Python, etc) and Web designers. Mongoose is built on top of libmongoose embedded library, which can turn anything into a web server in 5 minutes worth of effort and few lines of code. Downloads, Docs and Source Code Features To accomplish it's mission, Mongoose keeps balance on functionality and simplicity by carefully selected list of features: Works on Windows, Mac, Linux/UNIX, iPhone, Android, eCos, QNX and many other platforms Support for CGI, SSL, SSI, Digest Auth, Websockets, WEbDAV, Virtual Hosting Resumed download, URL rewrite, IP-based ACL, Windows service, HTTP/HTTPS client support Small footprint: Mongoose core size is under 40 kB of x86 compiled code, and tiny runtime footprint Simple and clean embedding API, mongoose.h. User Guide In 4 Pictures Download, double-click to start, run browser -- that's all! Acknowledgements License Other Projects
Installing PHP and Apache on Mac OSX – that was (pretty) easy This posts is one of those "note to self" kinda posts. I just finished installing PHP and Apache on my Mac OS 10.5.6 and though I should document the experience should I (or you) need to do it again. It could already be there The default OS install came with goodies like ruby and php already there. Also turns out Mac comes with some version of Apache, looks like it's disabled by default, but if it isn't, disable it from System Preferences / Sharing / Web Sharing. Now let's start fresh with PHP5 and Apache 2, ignoring the PHP that's already there. Mac ports prerequisite Mac ports makes installing many software packages a breeze on the Mac. Ready? Log into the mac ports prompt: $ sudo port Password: MacPorts 1.700 Entering interactive mode... start/stop/restart Apache Here's how you start/stop/restart Apache: Or to stop and disable starting up every time you power on: $ sudo launchctl unload -w /Library/LaunchDaemons/org.macports.apache2.plist Verify that all is good echo "<?
RingoJS Before diving into Stick and the other awesome packages we just installed, I want to go through a short example with "raw Ringo". Just so you get a feel for what Ringo provides and the kind of error message you might get. If you are not familiar with exports and require(), better take a detour to the CommonJs Modules 101 explanation As a minimal starting point, consider the following web application: The above is a runnable Ringo application, it does two things: it defines a function "app", which returns an objectand it starts a Httpserver, with the "app" function and a "port" passed as configuration options Ringo's Httpserver calls the "app" function for every request it recieves; the "app" function gets called with one argument: "request". Let's start this application and see what it does. $ ringo main.js ...and open with a browser. Which brings us to the response object returned by the "app" function. Interlude: Quickstart a Httpserver But what about the port?
4. Testing TDD? The best way to make code testable is to start by writing the tests first - TDD style. Essentially, TDD boils down to: TDD is a set of rules for writing code: you write a failing test (red), then add just enough code to make it pass (green) and finally refactor where necessary (refactor). In this chapter, we discuss how to set up testing for your project using Mocha, how to do dependency injection for your CommonJS modules, and how you can test asynchronous code. Why write tests? Test driven development is not valuable because it catches errors, but because it changes the way you think about interfaces between modules. In most cases, you don't completely understand the system when you start writing it. What to test? Test driven development implies that tests should guide the development. I find that the greatest value comes from testing pure logic and otherwise-hard-to-replicate edge cases. Test frameworks Test runners basically use one of three different styles for specifying tests:
enginpost / node.js MySQL microsite example Sample abstract: This sample code demonstrates a few important node features: - How to setup a RESTful API using node.js express. - How to serve up static HTML via HTTP from a subfolder as the default URL root folder in your project. - How to connect to MySQL database and communicate via queries with that database. - How to send results from a MySQL query in the JSON format. - How to consume the RESTful API JSON results using jQuery in the static pages. To fiddle with this example, you will need: - A MySQL Server running with the ability to create a new DB and run a script to add content. - An understanding of basic SQL syntax (if you want to mess with the resultset). - Node.js up and running Note: You will use Apache to run phpMyAdmin for administration of your new MySQL database, but node.js will not use Apache to serve any pages. Once the example application is running, you should not need Apache running, but you will need MySQL up and running with your database.