Jared Hocutt

<?php if ($is_geek) { echo 'geek' } ?> // output = geek

Malachi Liam

A few years back in 2008, I met one of my best friends while we were both studying Computer Science at NC State. His name is Will Davidson. We had many late nights studying and trying to get projects done before they were due the next morning.

Will is one of the most genuine people you will ever meet and isn’t afraid to tell you when you’re wrong :) During this time we were in college, he met his beautiful wife April while on a flight (she’s a flight attendant). I can remember the days when Will would mention that April was flying in to hang out for the day. To this day, that still sounds very weird that someone flies somewhere for a day! But it worked for them. Many times she would have a layover in Raleigh so that’s how they were able to spend time with one another.

The next thing you know, Will and April were getting married! I remember how excited Will was, but also very nervous because they were doing this during the middle of a semester. This meant that Will would be missing more than a week of class! Luckily for his friend Jared (that’s me), I was in history class, voice recorder and pencil in hand to help out with the notes! After Will got back from the honeymoon, things were back to “normal” except that now April was now permanently in Raleigh. read more…

Change Ubuntu Hostname

Have you ever set the hostname on your Ubuntu installation only to want to change later? Here is an easy way to accomplish this and only requires changing a single line in a configuration file.

To begin, open the file /etc/hostname as root:

sudo gedit /etc/hostname

Change the text in that file to what you would like your new hostname to be and restart your computer. When the computer reboots, you will have a new hostname!

Subdomains on localhost using Apache / XAMPP

This post will show you how to create a subdomain similar to http://subdomain.localhost/ on your local install of Apache. For this tutorial, I will be focusing on how this accomplished in the Apache install that is part of XAMPP. These steps should also work for a standalone install of Apache except that the file locations may be different.

I am going to assume that you have already downloaded and installed XAMPP in it’s default location at C:\xampp\. If you have XAMPP installed in a different location, then change any paths to files accordingly.

The first file that you need to edit is C:\xampp\apache\conf\extra\httpd-vhosts.conf.

You need to make 2 edits to this file. First, uncomment the following directive to tell Apache you are going to use a subdomain:

NameVirtualHost *:80

Next, you want to setup your subdomain. Add the following code to the end of the file:

<VirtualHost *:80>
	ServerName localhost
	DocumentRoot "C:/xampp/htdocs"

	DirectoryIndex index.php

	<Directory "C:/xampp/htdocs">
		Options Indexes FollowSymLinks Includes ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

<VirtualHost *:80>
	ServerName subdomain.localhost
	DocumentRoot "C:/Users/Jared/Documents/web/subdomain"

	DirectoryIndex index.html index.php

	<Directory "C:/Users/Jared/Documents/web/subdomain">
		Options Indexes FollowSymLinks Includes ExecCGI
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

The first VirtualHost will allow you to still put files in the normal htdocs folder and serve those using Apache. The second VirtualHost is the one for your subdomain. The things that you need to update are the following:

  • ServerName: this should be the subdomain you want to setup.
  • DocumentRoot: this should be where the files that should be served by Apache are located
  • Directory: this should match the DocumentRoot

The second file that you need to edit is C:\Windows\System32\drivers\etc\hosts.

Add the following to the end of the file to tell Windows that when you navigate to subdomain.localhost that is should look for it locally instead of trying to resolve the domain name. Note that this should match the ServerName from the Apache configuration.

127.0.0.1		subdomain.localhost

That’s all there is to it. Restart Apache and your subdomain should be working. If you want to add multiple subdomains, repeat the steps in this article, minus the VirtualHost for localhost as that is only needed once.

If you have any trouble getting this setup or suggestions, please leave them in the comments.

VirtualBox Guest Additions on CentOS

VirtualBox is a great free, open source virtualization platform from Sun Microsystems (well, now Oracle). After installing an operating system in VirtualBox, there is an add-on product that can be installed inside of the guest operating system called Guest Additions that enables a more integrated experience between the host and guest operating systems as well as improves performance in the guest operating system. In most Windows and Linux operating systems, this is a simple install that already has all of the prerequisites needed to install Guest Additions.

However, in a standard CentOS installation, this is not the case as it is missing a few dependencies needed by the Guest Additions installer.  Unfortunately, the error given by the Guest Additions installer only tells you what is missing, but not what package(s) you need to install that will satisfy the dependencies needed.

Fortunately, it’s a pretty easy fix.  All you need to do is install a few packages using yum and you’re set to go.

Run the following command as root to install the dependencies needed by Guest Additions.

yum install gcc-c++
yum install kernel-headers
yum install kernel-devel

Of course, you could always combine these into one command by running:

yum install gcc-c++ kernel-headers kernel-devel

Once this has finished, it is best to go ahead and restart CentOS to ensure that the latest kernel headers are loaded. After restarting, you should be able to run the install for Guest Additions without a problem.

Android Screenshots

This is a quick tip that shows you how to use the Android SDK to capture screenshots from your Android device.