click

Web Serving Made Easy Part 2

By: Jon Gales

Last we left it, we had Apache running like a champ. The downside was that
unless you were connected directly to the internet, you weren’t able to connect
to your server from the outside world. Today, this will change. We are going
to learn the joy of port forwarding.

We are going to tell your router the directions to send the right people (the
ones who want your web server) to the right place (your computer). There is
a little difference between different routers, but the first part is the same.

  1. Go to: System Preferences > Network
  2. Write down your IP address (should
    be something like: 192.168.1.100)
  3. Close up System Preferences

Now, the directions change depending
on what router you have. The two biggest choices are:

  • Apple Airport
  • LinkSys Cable DSL Router

For readers with an Airport, click here. For readers with a LinkSys or something
similar (IE not from Apple) click here.

Airport Configuration:

  1. Open Utilities > Airport Admin Utility
  2. Click the Port Mapping Tab
  3. Click add and set the Public Port to 80, Private
    IP Address
    to the IP address
    you wrote down, and Private Port to 80.

Make sure your screen looks something like this.

LinkSys Configuration:

If you are not using a LinkSys router, consult your manual. Try this though,
it might work.

  1. To visit the config page, visit http://192.168.1.1
  2. If you have not set-up another password, it is admin. There is no user
    name.
  3. Once there click on the Advanced tab
  4. Click Port Forwarding
  5. Type 80 into boxes opposite the ~ and the last three numbers of your local
    IP address (the one you wrote down) into the box on the far right. All
    three numbers should be on the same row.
  6. Click Apply.

Your set-up should look something like this.

Now, test the forwarding by typing in your REAL address into your link bar.You
can find this IP address by visiting WhatisMyIPaddress.com.
You should find the same thing you found last week. If not, go back over
the forwarding instructions above. Make sure you write down this address
if you’re likely to forget it.

A lot of people don’t understand what port forwarding is, so here’s my analogy.

Some people are lucky to live in a gated community. These gated communities
usually have a rent-a-cop that mans the gate. Your router is this rent-a-cop.
Port forwarding is just telling the guard that when he sees a delivery truck,
send it to his house. The web visitor (the one who wants your web site) is
the truck.

So now, that IP address is a pain to remember. Aren’t you glad you can type
in www.apple.com instead
of 17.254.3.183? Here’s how
to get an easy to remember name, without spending a penny.

DynDNS.org offers a service
that you can register for free that will allow you to have an address like:
yourname.dyndns.org. Pretty lame name, but it’s
better than numbers. there are a few other services like this, but I’ve had
the most success with DynDNS. It’s easy to setup too, you’ll just need info
like your IP address. You’ll be able to share this with friends. They will
probably think you’re really cool, but don’t expect them dissing you about
your plans next weekend–you’re now officially a nerd.

What to expect next week? Activate PHP, run CGI scripts and other cool stuff.
Maybe even installing MySQL!

Web Serving Made Easy Part 4

By: Jon Gales

Alright. By now you’ve got PHP running and know how to do CGI scripts. If
you’ve forgotten, check last
week’s
column. There is some good and bad news this week. The good news
is that this is a pretty darn long/good/amazing article. The bad news is that
it’s the end of the series. if you’ve enjoyed or even just followed this series
I’d like to hear from you. PowerUser Monday
isn’t going away–just the web serving series. Also, if you’ve gotten a website
set up from this I’d like to get your link so I
can
add them
to the bottom of this page (hopefully
get you some traffic as well).

Now we’re going to install MySQL. It’s the most popular open source database
in the world and it just rocks. It’s often used with PHP and web applications
because:

  • It’s free
  • It kicks serious butt
  • It runs on Windows, *nix and OS X

Instead of downloading source code and having the joys of learning how to
compile it, we’re going to cheat and use a package made by the MySQL people.
This is new to version 4.0 (just came out) and it rocks. Visit this
page
and
download the file. Be nice and give them your info–they aren’t spammers. They
have given a good chunk of their lives for this software… Give them honest
answers. It’s a 7.1 meg download which isn’t bad for what you get.

You’ll find the downloaded file in your default downloads folder called, “mysql-standard-4.0.12.dmg“.
Just double click on it like any other DMG. Inside you’ll find a package (yep,
that’s what that those box icon thingies are)–double click it. The installer
is self explanatory.

Since it’s unix software you won’t see a GUI application. To start it up you
must delve into the terminal. If you feel inclined (you should) install a
script by Marc
Liyanage
that boots MySQL at startup. To start it without having to restart
your computer just pop open the terminal and type the following:

shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(Enter your password)
(Press CTRL+Z)
shell> bg
(Press CTRL+D to exit the shell)

If you have problems, refer to MySQL’s
OS X installation guide
. It sums it
all up well.

Now, you need to set your password. Enter the terminal again and type:

mysqladmin -u root password YOURNEWPASSWORD

Try to make this secure, you won’t need to type it in much and it’s important.

Now, we want to do something with our newfound database. You can download
a great Cocoa app called YourSQL that will log in for you and let you muck
around a little easier than in the Terminal. It’s free and I use it all the
time. However, the remainder of this app will focus on setting up a CMS that
uses MySQL, not MySQL (that’s another week folks).

Weblogs are hot right now and a lot of people either have or want to have
one. If you’re one in the second category wish no longer. Go to pMachine.com and
download a copy (it’s free). I use it and love it. There are lots of other
great free Content Management Systems like MovableType, PHP Nuke, and B2 but
pMachine is just plain easy (and the programmer is a big Mac guy).

Go to /Library/WebServer/Documents/ and drag all of the files
from the pMachineFree2.2.1
folder to it. Once that’s done point your browser to http://localhost/pm/install.php
and follow the on screen directions. Below are some pointers.

It will probably say you have to mess with config.php. Just open it up (it’s
in the pm directory) in a text editor and make the following changes:

$hostname = "localhost";

$dbusername = "root";

$dbpassword = "YOURNEWPASSWORD";

Obviously YOURNEWPASSWORD is what you entered prior in the MySQL installation.
If all goes well you should see some green when you refresh step two. The rest
of the installer is self explanatory. When you get to the part where it asks
for the domain make sure you don’t leave it as localhost if you’ve registered
a domain. if you need help on this, check part
2
.

You’ve now got a dynamic database powered weblog hosted off your computer!
You can administer things via http://localhost/pm/.

If you don’t like the template, feel free to change it. All it takes is a
text editor (yes, Dreamweaver or GoLive will work) and mess with the files
in /Library/WebServer/Documents/. For instance, weblog.php is the main
page. It’s pretty easy hacking. My weblog is powered by pMachine if you want an example of what can be done (don’t use mine as a high bar, it sucks icon razz Web Serving Made Easy Part 4 ).

Again, let me know how it goes. I love
feedback.Many thanks to Marc for the great
reference
he’s got. Check it out–he’s
a God send.

User submitted sites:

Colin Lochhead

April Fool’s Pranks

By: Jon Gales

This is a special “holiday” version of PowerUser Monday. Supercharged with

lots of fun OS X pranks to pull on your family/friends/co-workers. You’ve probably

seen a few of these before, but some of these just got the go ahead from the

DOD (Department of Defense).

What’s That Number?

Go to the International pref pane and click the Numbers tab. For the

example

below I changed Symbol to 9, Decimal to 4 and Thousands to 6.

This

is

a

great

trick because if your victim uses the default calculator, all of the answers

will be off.

That’s Not What I Pressed!!!

Go to the International pref pane and click the Input tab. Check “Dvorak”

and then uncheck whatever was selected before. This will make the keyboard seemingly

go crazy. For example, MacMerc.com when written in the dvorak layout is: MajM.pjvjrm

Stop That Flashing

Go to the Universal Access tab and click the hearing tab. Check the

box next to “Flash the screen whenever an alert sound occurs”. This gets amazingly

annoying and almost no one knows where this jewel is stashed.

I Know What I Pressed Dammit

Go to the Universal Access tab and click Keyboard. Hit the radio button

for Sticky keys. Now try hitting command, control, option or shift. Muahaha.

Nooo… I Need My Friggin Keypad!

Go to the Universal Access tab and click Mouse. Hit the radio button

for Mouse Keys on. Try using that keypad now… If your company has an accountant

that uses a Mac, this is your chance to get back.

My Dock! My beautiful Dock!

Find a folder with 30-75 items and hit command-a to select all the items.

Now drag em to the Dock. The only way to get them out is one at a time… Don’t

try this unless you have a lot of free time (use it on your friend untested if

you have to)

That’s Not Photoshop!

This takes a lot of time, but it’s a quality trick. Think of an application

that your victim uses a LOT and one they don’t use very much (probably a Utility).

A

good

place

to

start

is

what

is

in

the

Dock.

  1. Take a screen shot (command-shift-3) so you’ll be able to make sure the

    end product looks right.

  2. Command-click the icon of an app in

    the

    Dock

    to

    find

    it

    in

    the

    Finder and choose your second app.

  3. Using get info (command-I)

    you can switch the icons all around. Just use the mouse and click

    on the icon in the info panel and use copy/paste. To do it without losing

    an icon, make a folder to store the icon temporarily. For instance, get info

    on Mail.app, copy the icon, go to the folder’s info and paste the icon, copy

    Word’s icon

    and paste it on Mail.app, grab the Mail.app icon from the folder and paste

    it to Word. Yes, this is pretty confusing but that’s what makes it fun.

  4. Once the icons are changed,

    switch

    the

    names

  5. Once the names are done arrange the icons correctly in the Dock

    (using the screen shot).

  6. Now trash the evidence.

If you can’t figure this out, don’t sweat it. If you can, I pity your friends.

User Submitted Tricks

Thanks to Simon Wheatley for these two tricks!

Create screenshot of a clean screen, no active apps or windows open.

- make that

screenshot your backdrop

– hide the dock to the left or right

– remove icons from the desktop (finder prefs)

– annoying but fun

2. Create a custom startup item in /library/startupitems/ that restarts

the computer each time it is booted. I took the time to create the

script and have posted it here.

I suggest that you make it a log-in item by going to System Preferences

> Login Items… If you make it a startup item most likely you’ll be

screwed over trying

to get rid of it. It is possible to force quit a log-in item (I have

tested this script). Enjoy! – Jon

Thanks to John Dough for this one (I swear that’s a real name icon razz April Fools Pranks )

  1. Take a screenshot of any state of the desktop [command-shift-3] Make

    sure Finder is active. Ed-Note: Probably be best to take a screen shot

    of what’s on the screen when you arrive to the desk.

  2. Open screen shot in photoshop.
  3. Select the path select tool (black arrow)
  4. Hit the F key until image is full

    screen.

  5. This will give the impression that the computer is frozen as clicking on

    any part of the image will do nothing.

Thanks to Slava for this one:

“Okay, here is a semi-mean way to torture your friends:

http://www.unsanity.org/slava/AppleBurnAlertNotifier-apr1.sit

Put it into Login Items for your friend or something. And we are not really that mean. We are just having fun. Our apologies if that actually scares anybody, even if it is April 1″

It’s genius… Just try it!

Thanks to Rick for this one:

I remapped my coworkers ExposÈ Desktop shortcut key to the Left Shift

button…only works for touch typists…hunt and peckers will be

looking at their keyboards when the windows are going crazy.

If you’ve got a killer trick please let me

know ASAP (before the 1st). And yes, I know about the

“Zoom” and “Black on White” features. They are just too well known to include.