October 27, 2009

mod_url without mod_url?

I know the title seems to make no sense but bear with me a minute. mod_url is an extension for the apache server that allows you to specify automatic routes for urls. So someone going to http://wheremy.feethavebeen.com/xangelo would see their profile page instead of going to http://wheremy.feethavebeen.com/profile?=xangelo It’s just a pretty way of formatting URLs. As an experiment, I decided to construct a handy little function that will allow you to parse links like http://wheremy.feethavebeen.com/index.php/profile/xangelo/view to create a more readable url structure.

<?php
function parse(){
		$self = $_SERVER['PHP_SELF']; 
		$e = explode('index.php',$self);
                $t = array();
		$t['base'] = $e[0]; 
		$x = explode('/',$e[1]); 
 
		foreach($x as $key=>$val){
			if($val == '')
				unset($x[$key]); 
		}
		$t = array_values($x); 
                return $t;
	}
?>

To create a link to the same page the array key ‘base’ can be used followed by a / and then the options you want. To create a link to my profile you could do this:

<?php
$url = parse(); 
echo '<a href="'.$url['base'].'/profile/xangelo/view">My Profile</a>';
?>
October 26, 2009

FTP (and it’s cousin, SFTP)

What is it?
From the techical side of things FTP stands for File Transfer Protocol. It’s just a fancy way of saying it’s a standard for transferring files between your computer and another computer, be it a web server, or just your friends pc. FTP isn’t something you generally need to worry about until you own a website, and then you’ll eventually realize that the file uploader that comes with your cPanel account by default just isn’t cutting it. When technical people refer to FTP they’re really saying FTP Program, which is a utility that you can install that can take advantage of the File Transfer Protocol and transfer some files from your PC to another one.

Do you have it?
ftpaccChances are, if you are the administrator of a server (even if it’s someplace you host your website online) you have access to FTP. Most hosting companies try to make it as easy as possible for people to set up their FTP accounts, and generally pouring through the help documents will ..well help. But if you log into your control panel (most likely cPanel) you can look for an icon that looks like this, or just says “FTP” on it
Setting it up
Essentially the page you are trying to get to will let you create and administer FTP accounts. The image below is what cPanel users will see. It’s a pretty straight forward form, and you just need to fill it out. The login is just the name that you will use to log in to your account. For my system, it’s set up to be login@feethavebeen.com, where “login” is a username that I created. The password is what you will need to enter to log in to your FTP account. Make sure it is something complicated, and if you’re not sure, just hit the Generate button and add a few characters onto the end. For some hosts, they automatically fill out the “Directory” setting. You should just delete this or set it to “public_html/”. That will ensure that the user you are logging in with can access all the files on your server. When you’re done just click the “Create FTP Account” button and wait for everything to be done. You’ll generally get to a confirmation page that will show you the username and password that you selected. Make sure you either write them down somewhere or remember them.

ftpaccsetup

Accessing your account
Now that your account is created, the next step is accessing your server using that account information. To do this you have a couple of options. IE users can log in through their browser by going to ftp://www.yoursite.com and then logging in using their username/password combination. That’s fine for downloading files, but when you want to start uploading them, I’d recommend and actual FTP client such as one of the following:

http://www.smartftp.com/
http://winscp.net/eng/index.php
http://fireftp.mozdev.org/ -   Firefox Addon Only
http://filezilla-project.org/ – Supports both SFTP, FTPS and FTP

You can download and install the FTP client and start it up. Generally when the clients start up they ask you for your account information to log in. You can set the host as your website, the username as the username you gave in the form, and the password that’s associated to it. Make sure that the PORT is set at 21. FTP utilizes port 21 to perform it’s functions. By default winSCP is set to PORT 22 (more on this in a second). Once that’s done, you can sign in to your ftp account.

Using FTP
Using FTP through one of the clients is very simple. You are normally presented with a split view. The files on your computer are on the left, and the files on your web server are on the right. To move files, you just drag them from your computer to the web server, or from the server to your computer. The files are then transferred over. There are many advanced functions that each FTP program offers, but that is something that is beyond the scope of this article.

SFTP?
By default, FTP transmissions are not encrypted. This means that your files and more importantly your passwords (thanks for pointing out that I missed this part Felipe) are passing in plain-text between you and your webserver. Most times this isn’t an issue, but if you are transferring sensitive data, or are just paranoid like me, you’ll want to use Secure FTP. Secure FTP encrypts all data that it transfers and therefore, is a little slower than standard FTP, but it is worth it (at least tome). Out of the FTP clients I mentioned, only winSCP can handle the SFTP. When using SFTP, you have to make sure that your PORT is at 22 instead of 21.

October 23, 2009

Feature Friday – Lifehacker.com – Complete Guide to Windows 7

Lifehacker is a website that I have been following for a number of years. They have a great knowledgeable reader base as well as very talented and informative writers. They cover tips, tricks and applications for every OS and for your every day life. Definitely one of my favourite places to be. With the launch of Widows 7 yesterday (one that introduces the best OS from Microsoft to date) this post was one that needs to be covered. Lifehacker presents a Complete Guide to Windows 7

win7

Windows 7 officially launches today, but we’ve been testing, tweaking, customizing, fixing, and writing about this OS for a year now. We present here a guide to everything we’ve learned about the OS, from first install to final settings change.

Whether you’ve played around with Windows 7 during its beta or release candidate versions, launch day is finally here, and Windows 7 is finally ready for widespread, public consumption. This guide will take you straight through from system requirements and upgrading your PC to highlighting Windows 7′s best new features to helping you hit the ground running with all of the awesome tweaks Windows 7 has in store for you.