A Bare Bones, Simple Unity Player Controller (Top Down, C#)

I'm working on prototyping a top-down game and wanted to start off with a bare-bones/boilerplate player controller. I found one on the forum that got me up and running quickly, but it had a little extra code and was not using Input.GetAxis or Input.GetButton. It's recommended to use these rather than Input.GetKey, because it can also apply to game controllers or other input devices. Then you can set the keys in an options screen. I'm planning on testing with an Xbox controller, so I wanted to start it off properly.

Common .htaccess Rules for SEO and Rackspace Cloud Sites

Every site we build on the Rackspace Cloud ends up needing a lot of similar rules in the htaccess file. On my local PC I've collected them in a text file, that I copy paste sections from almost every day. Most of the below examples will work on your average Linux-based server with Apache and mod_rewrite enabled. A few are RS Cloud Sites specific (as noted). In case you've never messed with this stuff before, note that this isn't a single file to copy in its entirety. Each section has a different purpose.

Fix HTML5 Validator Error “Bad value X-UA-Compatible for attribute http-equiv on element meta.”

If you are using the X-UA-Compatible meta tag, then you'll probably run into this error when attempting HTML5 validation at the W3C. It's common to use X-UA-Compatible to set Internet Explorer to edge mode (forcing the latest rendering engine), and to enable Google Chrome Frame for visitors with that IE plugin. To make the validation error go away (perhaps it is your only remaining error?), the meta tag can be removed and the value can be sent through the HTTP headers instead. Depending on the web technology you're using and your server settings, this can be done in different ways, and I thought it'd be a good idea to collect the syntax in one place...

Get the Thumbnails of a YouTube Video: Standard URL and File Names

All the different thumbnail sizes of a YouTube video are accessible from a standard format. All you need is the unique video ID (viewable in the URL of your video). Thumbnail Image Format: http://img.youtube.com/vi/THE-VIDEO-ID/FILENAME.jpg The file name depends on which thumbnail size you are looking for. There are several to choose from...

10 Yii Framework and MVC “Beginner” Questions & Problems Solved

Sometimes "experience" means all the little stuff that no one ever bothered to write down. Learning code through doing will lead you on a zig-zag path from one problem to the next, that is different per-project. In starting a big website made with Yii, having never touched the framework before, I took notes on some of the issues and questions that arose while developing...

Yii: Adding Title Tags, Meta Descriptions, and Other SEO-Related Tags

As a followup to my post about SEO-Friendly URLs using Yii, I figured I would post this function I created for displaying SEO-related tags in the layout.Using the Gii generator with the Yii Framework, a custom base controller is created that is a parent for the others. It already contained a property called pageTitle that was used in some of the views. I decided to keep this location and expand upon it by adding in some more properties related to search engine optimization, and then create a function to display the HTML...

Yii: How to Search a HAS_MANY relation using CDbCriteria Compare()

Using Yii's implementation of ActiveRecord makes querying a database much easier for simple queries. For more complex situations, you will still find yourself having to write some straight SQL on occasion. In this case, using a custom query was not necessary. I was trying to add another search parameter, using the AR compare() method, to search a relation with a HAS_MANY relationship, and it was displaying an "unknown column" error. Without a proper example, it wasn't clear at first how to get this work...

Clean SEO-Friendly URLs for Yii Pages

Creating SEO-friendly permalinks for an application built using the Yii Framework was a multi-step process. I figured I would outline each part. First, you can use slugs to access your view actions with the help of an extension and entries to your urlManager. Removing "index.php" is as simple as adding a few htaccess rules and changing two options. To Force trailing slashes, some code can be added to your base controller. And lastly, to give yourself cleaner "/site/page/" URLs, some more entries can be added to your urlManager...

Huge Email Delays on Rackspace Cloud Sites – Don’t Use PHP Mail()

Starting last month, Rackspace Cloud Sites has not been delivering mail sent through PHP's mail() function in a timely matter, and sometimes not at all. The company I work at has been using RS Cloud Sites for a few years now, and while mail delivery has always been slower than average, emails tended to arrive within 20 minutes. Now we have emails showing up 3 days late, and there were some tests that I never received. Why is there no uproar about this? And why has Rackspace failed to notify its customers of this ongoing issue? Most websites rely critically on scripts that send email for their contact forms and web applications. For any brochure-type website, the main goal is to get the visitor to contact them. Call to actions point to a contact form. The contact form submits to a script that either sends mail via PHP's mail() (sendmail) or via SMTP.

Using Different JavaScript / jQuery on Old Versions of Internet Explorer

I was adding a nice hover overlay to some images, which faded in and out nicely with jQuery, in FireFox. Unfortunately, the effect in IE7 and IE8 was not looking too good. The text was either not fading correctly, or text was popping and looking shoddy. This had to do with some transparent elements and handling of transparent PNGs. Rather than fighting with it or degrading it for everyone, I realized it'd be simple to do a little progressive dehancement by doing a simpler show/hide for IE versions less than 9.

CSS Print Media Query

Using the @media rule in your CSS allows you to target different media types, and screen sizes, from a single stylesheet. Using media queries with max-widths is integral to the current push towards responsive design. This can also be used to create your print styles using @media print. You'll notice this used on modern base-templates such as the HTML5 BoilerPlate:

Yii Framework Intro: Starting a New Database-Driven Website

In creating my first Yii application, there were a few hurdles and stumbling blocks along the way. One of the first guides/tutorials that a new user to the Yii PHP framework is directed to is the "Creating Your First Yii Application" in the "Definitive Guide to Yii" . This is kind of a companion piece that has extra explanation, plus the first steps I made to start turning the example app (generated skeleton) into my custom web application.

Website Build Guidelines for Freelance Developers

While managing a few projects that were built by freelancers, I came up with a list of guidelines for the build and for WordPress used as a CMS. I've added reminders to it based upon the mistakes that fly in the face of what I consider a "good" build. Note that some of this is a matter of preference and opinion. I thought I would put this out there as a starting point for anyone trying to put together their own guidelines...

Hot Sauce Review Site In the Works

A few months ago, I went online in search of a new hot sauce. I'd tasted a few habanero-based sauces here and there, and was looking to start a collection of my own with something more intriguing; with a richer flavor and some intense heat. I found a helpful blog or two, and some storefronts, but was surprised at the lack of a modern hot sauce-related site; somewhere where I could find a new interesting sauce. Why wasn't there a site like beeradvocate.com? I see the same passion from a lot of people. The addicts even call themselves chiliheads. So, I decided to create a user review site for hot sauces...

Add a Subscribe to MailChimp Newsletter Option on Your Contact Form in 5 Minutes

Adding a “Subscribe to Newsletter” checkbox or radio button to an existing contact form is incredibly painless using the MailChimp API. Include one library file, and you’ll have access to all functions the API has to offer. In this example, I added a Yes/No radio selection. You could easily change this to be a checkbox. When "Yes" is selected, and the form is submitted, the contact form does its thing, and then the user is added to a MailChimp List.

Check if Email Username Exists with CodeIgniter and jQuery Validation Plugin

A common feature of most new user registration forms is a message telling you whether your chosen username or e-mail is already taken. The check is done through an AJAX request. Using the jQuery Validation plugin, the remote option can be used to request a URL that returns JSON data. Using CodeIgniter, this URL is a new function in the controller used for registration. In this example, the register_email_exists() function returns true or false, after checking the entered form value against the database. See the following example code for the basic PHP and JavaScript you'll need to make this work.

jQuery One-Liners and Reuseable Code Snippets for Common Tasks

For the last few weeks I've been collecting tiny morsels of jQuery and straight JavaScript that I've needed for building sites. I had found myself needing the same small scripts over and over. Rather than rewriting and checking an API/plugin reference, now I can just copy from this list. Most of these snippets are a few lines each. Some are simple. Some aren't.

Create a New WordPress Admin User from PHP

If you're locked out of WordPress and can't reset your password, the official docs list several options that allow you to access your administrator account again. But what if you want to create an entirely new admin user? For blogs that I have FTP access to, but no working WordPress password, I threw together the following script to create admin users.

Launching a Codeigniter Site: 3 Steps to Disable Database Errors

Turning off error reporting is often mentioned as a standard security precaution when switching to a production environment. After all, you don’t want those precious database table and field names out in the open, for sneaky little hobbitses to view. If someone is rummaging through your site, trying to find vulnerabilities, this severely limits the […]