Archive for the 'General' Category

Seven of Diamonds

Saturday, November 4th, 2006

Lying in the dark, lit only by the glare of my MacBook I suddenly had one of those “Woah!!”, shoot-out-of-skin experiences, as, flicking through Cal Evans PHP Community Playing Cards, I suddenly came face-to-face with this one.

It seems these cards were an actual 3D freebie at the [Zend/PHP Conference and Expo](](http://zendcon.com/ “Zend/PHP Conference and Expo”) which means that I was there in an odd, fakey kind of way.

Apparently only those at the conference or featured on the cards got a copy so …erm, let’s just say I was playing blackjack for M&M’s with the kids the other day and it would have been great to see the proud look on their little faces every time the seven of diamonds was pulled out …ahem, cough, hint…

Collaboration Markup

Thursday, July 6th, 2006

I work in plain text a lot, from using Markdown or more specifically PHP Markdown on this WordPress setup and elsewhere, as well as doing HTML markup and programming PHP. It is therefore not surprising that this article on Collaboration Made Simple with Bracket Notation caught my eye (linked via Lifehacker).

It’s a simple but clever idea that eschews a specific software solution for collaborative content editing in favour of notations in plain text. I don’t want to steal anyone away from reading the article but I did want to note a simple way of remembering their idea…

[delete][replace with][comment]

…so if we take the text…

The Bat in the Hat

…and apply some collaborative revision markup…

The [Bat][Cat][less sinister?!] in the Hat

…it would be revised to…

The Cat in the Hat

It’s a useful trick to to remember e.g., for passing edits around in text format via IM or Email. Whether I use it or not is another thing but I certainly like the inventive use of simple tools.

A Networked Virtual Hosting Party on Mac OS X

Wednesday, June 28th, 2006

There are plenty of articles on setting up virtual hosts on Mac OS X but I’d not found a simple one that showed you how to set up named virtual hosting that could be read across your LAN. The aim for me is to be able to type in e.g., http://myparty/, in any browser on our small local network and get to the locally hosted site.

My requirements are pretty minimal, needing only to have one or two other Macs running OS X (Tiger) access the development server. I’m not going to go into too much detail, partly as I’m too lazy, but also as your setup and needs will be different to mine anyhow. Instead I’ll just give a general run through and point to further reading.

Decide where we’re going to host the party

The first thing we need to establish is the main server which requires that that server have a static IP address. In my case this involved going to System Preferences > Network > TCP/IP and setting Configure IPv4 to “Using DHCP with manual address”. In that same dialog I then set an IP address of 192.168.1.100 and clicked “Apply Now”. That now means that this machine has a consistent address that others on the network will refer to.

Tell everyone where the party is

When the other OS X machines on the network type http://myparty/ in their browsers the first thing their machines do is check in the file /etc/hosts to see if there’s an IP address that matches “myparty”. If there isn’t things won’t go very far. So if you take a look at my one…

127.0.0.1   localhost
127.0.0.1   myparty
255.255.255.255 broadcasthost
::1             localhost

…you’ll see that http://myparty/ maps to my localhost IP address 127.0.0.1 which is fine as my machine is the host. In order that the other machines know where to go for “myparty” we have to edit their /etc/host files to send requests to the static IP address I set earlier:

127.0.0.1   localhost
192.168.1.100   myparty
255.255.255.255 broadcasthost
::1             localhost

Set up the virtual hosts

Now that everyone knows where myparty is being hosted we need to prepare. First you need to edit the Apache web server configuration file httpd.conf which by default lives here /private/etc/httpd/httpd.conf. I’ve installed Apache2 in /usr/local/ which is the more generally expected place for it to be and since this is my notepad I’m going to go with that. So first I need to open httpd.conf as the all powerful root user so I need to type…

$ sudo vim /usr/local/apache2/conf/httpd.conf

…whereas you could go…

$ open -a TextWrangler.app /private/etc/httpd/httpd.conf

…or whatever your personal setup/preference is. Once open you might like to use this little tip I picked up of having your specific settings in a separate file so e.g. at the end of my httpd.conf I have the following…

include /Users/nicklo/Sites/apacheconf/users

…that points to a directory which contains the file nicklo.conf. Inside that file are my virtual host settings. Having those settings separate from the main httpd.conf makes them more easy to backup along with all my other projects. It also potentially keeps them out of harms way in case a Software Update decides it’s time to fiddle with your httpd.conf file.

In keeping with the example my nicklo.conf could then have the following…

NameVirtualHost *:80

<Directory "/Users/nicklo/Sites">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot /Users/nicklo/Sites
</VirtualHost>

<VirtualHost *:80>
    ServerName myparty 
    DocumentRoot /Users/nicklo/Sites/myparty
</VirtualHost>

You’ll notice the settings specific to “myparty” are the last ones. These basically say if you get any requests for “myparty” on any IP address (* wildcard) via port 80 then send them through to /Users/nicklo/Sites/myparty.

Party on!

All that’s left now is restart Apache via System Preferences > Sharing > Services > Personal Web Sharing or…

$ sudo apachectl graceful

…which is actually better as it will at least tell you if there are any issues rather than just sit there.

Actually, we we still have to build the myparty website/web application in /Users/nicklo/Sites/myparty/public_html but hey, that’s the easy part right?!

Now in an even more perfect world I would be able to tell you how to set up a proper DNS Server on the host machine, that would replace the somewhat hacky need for individually configured /etc/host files. However, right now I’m just too stupid and honestly, a bit scared, to even attempt that. If anyone can give me a simple and if possible metaphorical run through I’d be very interested.

Further Reading

Virtual Hosting on Mac OS X I need to give credit to the comments by “Mats” on that page for much of my setup above.

Staging websites on Mac OS X

Virtual Hosts for Dummies

Location, Location, Location: Tips for Storing Web Site Files

Apache Virtual Host documentation

VirtualHost Examples

Natural Sequence Farming

Monday, May 22nd, 2006

Growing up in Scotland and Northern England surrounded by farms gave me a decent respect for the work involved in farming. I still remember desperately pulling on my “wellington” (gum) boots and running to catch up with the local shepherd’s tractor as he passed by our house.

Under the advice of the very same shepherd, I did not to go into farming, however, I’m still drawn by stories like this ABC episode of Australian Story on Peter Andrews:

Peter Andrews is a racehorse breeder and farmer credited with remarkable success in converting degraded, salt-ravaged properties into fertile, drought-resistant pastures. His methods are so at odds with conventional scientific wisdom, that for 30 years he has been dismissed and ridiculed as a madman. He has faced bankruptcy and family break-up.

The programme and the Natural Sequence Farming website are a good read for anyone interested in the uniqueness of the Australian landscape and the ways in which traditional European agricultural methods have worked against it.

Carrot

Monday, May 22nd, 2006

Like most people in search of info, I have endured the old Google routine of clicking through page after page of results, to find a site that is not just trying to sell me something. It is therefore quite refreshing when you find a simple one like the search results for “carrot” and the first link is to the World Carrot Museum which has more information about carrots than you could (or should?!) probably ever need.

Of course not everyone is in need of enormous amounts of information about carrots, but for those of us that are, Google and the internet have served us well!