When Brains Fly

An Awesome Blog About Neuroscience, Computer Science, and Technology

Bandwidth

[ January 14th, 2009 ]

I have used 10.73 MB of bandwidth over the last three days based on my web access log. That feels like a lot. I think most of it is due to the large sizes of the WordPress admin php pages. Under NearlyFreeSpeech.NET (NFSN), I am paying based on how much bandwidth I use, which is good because I don’t expect to have many readers right now and so under NFSN’s payment plan, I predict paying substantially less than $6/month – a typical price for other cheap web hosting.

Right now, I am being charged at $1 per GB transferred. Since I have used 10MB from the website and another 20MB from downloads and uploads (mostly from installing Movable Type and WordPress), I have to pay $0.03 for the four days that I have had this site. With that trend, I would have to pay about $0.23/month for bandwidth. I also have to pay $0.01/day for MySQL and $0.02/day for email forwarding. Altogether, I would have to pay about $1.13/month. That’s pretty cheap! Thus, NFSN is awesome.

Edit: I forgot to mention that NFSN also charges for storage at the rate of $0.01 per megabyte-month, which isn’t much, unless I am storing like a GB of stuff on my account.

Edit 2: I’m using about 8mb right now, so $0.08 per month. Pretty good. =)

Setting Up AWStats

[ January 14th, 2009 ]

My webhost, NearlyFreeSpeech.NET (NFSN) made this pretty easy.

First, I made sure that my access log was enabled. Then, I made a cgi script in /home/public called awstats.cgi which had the following contents:

#!/bin/sh
exec nfsn-awstats

(Don’t forget the line break on the second line.)

Next, I set the file’s permissions to 755, opened up a browser to http://www.whenbrainsfly.com/awstats.cgi, and did what it told me, which was to enter into the shell:

cp -r /usr/local/www/awstats/icons /home/htdocs/.nfsn-awicons
ln -s /usr/local/www/awstats/icons /home/htdocs/.nfsn-awicons
# 2009-12-15: Replaced with cp because images were still broken. Thanks Barb!

Finally, I refreshed and it was all set up!

I wanted to change the time zone used by AWStats, so I went to http://www.whenbrainsfly.com and then in the shell, I entered:

tail /home/logs/access_log

to see what time it says the last visit to my site was. It says I visited at 19:27 and it is now actually 14:27, so it’s 5 hours early (or is it late?).

In the shell, I changed the permissions of /home/private/ to 711 to make my files there executable. Then I created a file named .awstats.conf there and changed its permissions to 644.

Within .awstats.conf, I put

SiteDomain="www.whenbrainsfly.com"
HostAliases="whenbrainsfly.nfshost.com www.whenbrainsfly.com"

LoadPlugin="timezone -5"

The first two lines let me combine stats from both aliases of my site into one, and the last line handles the time zone shift.

Then, I had to rebuild the monthly reports (of which there was only one), so I went to /home/tmp/ deleted all files that matched awstatsMMYYYY.txt, and re-opened http://www.whenbrainsfly.com/awstats.cgi in my browser.

I went down to the Hours section http://www.whenbrainsfly.com/awstats.cgi?framename=mainright#hours and it said “Hours (GMT -5)” and the visit times so far looked correct. Hooray!

To double-check that my configuration settings were applied, I looked at /home/tmp/nfsn-awstats.conf and confirmed that what I had written in .awstats.conf was there.

So now you can find my site stats at http://www.whenbrainsfly.com/awstats.cgi.

Reference:
https://members.nearlyfreespeech.net/wiki/HowTo/AWstats

Switch to WordPress

[ January 14th, 2009 ]

After using Movable Type for an hour or so and trying to customize it, I found it to be irritatingly slow. I tried installing the Open Source version, but it was not much faster. It would take around 30 seconds to publish and 20 seconds to go to a different admin page, which got really frustrating after a while, especially after installing Movable Type four times (see previous post).

So, I decided to switch to WordPress, one of the other two popular blogging applications (the other being Blogger). The install was very simple and very fast. For my reference and yours, here is what I did:

First, I created a MySQL database called wordpress. Then, I downloaded latest.tar.gz from the WordPress website onto my web server. Next, I unzipped that file and moved all of its contents to /home/public/. Then, I copied the file config-sample.php to config.php, and in config.php, I entered my database information and put in four security keys randomly generated from the wordpress random key generator. Finally, I opened a web browser and went to wp-admin/install.php where I entered a name for my blog and my email address, hit continue, and then I was done! Amazing.

I ran into some early problems with permissions, such as uploaded images not appearing. So I changed the group of all of the files in /home/public to web, changed all file permissions to 644 so my web server could write to them, and changed the permissions for /home/public/wp-content/ and /home/public/wp-content/uploads to 775 so that my web server could put my uploaded files in the uploads directory. I think that was it.

Finally, I searched for a brainy WordPress theme and first found Big Blue Brain Theme but later found Brain Power Theme, which is an awesome theme. I tweaked it in many places to make spacing, color, and other little things nicer to me, and this modified theme is what is currently styling this site. I hope you like it too!

WordPress is not lightning fast, but not agonizingly slow either, so I think I’ll stick with it. Plus, this theme rocks!

Reference:
http://codex.wordpress.org/Installing_WordPress

Installing Movable Type

[ January 13th, 2009 ]

Installing Movable Type is pretty simple. Unfortunately, I still messed it up, multiple times. So, for my reference and for yours, here are the steps to installing Movable Type on my web server.

This site is hosted on NearlyFreeSpeech.NET (NFSN), which is an awesome, pay-for-what-you-use hoster. It already has the right PHP and Perl things installed for Movable Type. Since I recently made this site, I had no MySQL databases yet, so first, I created a MySQL process via the NFSN admin pages and then made a database named “movabletype.”

Next, I downloaded the file MT-4.23-en.tar.gz onto my computer from the Movable Type Download Page under Movable Type Pro for Bloggers. (Note: the version offered at their .org website offers their open source version for developers, which is different.)

Then, since unzipping the file and copying its contents to the web server was taking too long, I aborted that and scp’d MT-4.23-en.tar.gz from my computer to my root web directory of my web server, /home/public/. (Note: I am running Windows with Cygwin installed.) I then ssh’d into the web server and unzipped the file there.

I then made the directory mt in /home/public, and based on some suggestion from somewhere, I moved mt-static out of /home/public/MT-4.23-en (which was just created) to /home/public/ and copied all of the other contents of MT-4.23-en/ into mt/.

Next, I changed the group of mt to web, changed permissions of mt-static/support to 777, and removed the empty directory MT-4.23-en.

Then, I opened http://www.whenbrainsfly.com/mt/mt.cgi in my browser and began the installation wizard. I entered /mt-static as the static web path and hit continue. My web server’s PHP and Perl requirements checked out so I hit continue. At the Database Configuration prompt, I changed the database server from localhost to my_mysql_process_name.db because NFSN requires it, entered the other database info, and hit continue. At the next prompt, the Mail Configuration prompt, I selected sendmail, put in the path to it, /usr/bin/sendmail/, sent a test email, received the test email, and hit continue. The configuration file was successfully created so I hit continue there, and the configuration was finished!

Finally, I created an account, named my website, chgrp web /home/public so that my web server could write to it, told the prompt that I wanted my site at /home/public, selected the Professional Website theme, hit continue, and it was all done!

I then signed in and made my first post! =)

Sadly, this took me four times to get right.

The first time, I made the directory /home/public/blog and told Movable Type that I wanted my site there, not realizing that Movable Type is also a full-fledged Content Management System and that it would create a subdirectory called blog within /home/public/blog where my blog would lie.

The second time, I forgot to drop the movabletype MySQL database.

The third time, I got an error saying that my web server could not write to /home/public/ which was true at the time. So, I chgrp’d it and continued, but the style changed to something other than Professional Website. I’m pretty sure I had changed it, so maybe this is a bug in Movable Type. I tried changing the style afterward but after selecting the Professional Blue style and publishing, the site was obviously missing elements and not how it was supposed to look.

The fourth time, I thought I had failed yet again because after the last step, I went to http://www.whenbrainsfly.com and got a 404. I thought that maybe if I wrote a post, it would appear, and sure enough, it did after saving my first entry.

References:
http://www.movabletype.org/documentation/installation/quick-start.html
http://www.movabletype.org/documentation/installation/detailed-instructions.html
http://www.superxm.com/2007/08/movable-type-4-installation-step-by-step-with-screenshots.html

Hello, World!

[ January 12th, 2009 ]

Hello, world!

Proudly powered by WordPress. Theme developed with WordPress Theme Generator.
Copyright © When Brains Fly. All rights reserved.