How To

CodeIgniter URL Rewrite with .htacccess AND populated $_GET variables

Posted in CodeIgniter, How To, PHP, Web Development on December 7th, 2010 by j3nnings – Be the first to comment

Everytime I start a new CodeIgniter project on Dreamhost I face the same two problems.

  1. How can I get URL rewriting to work properly?
  2. How can I repopulate $_GET variables once they are stripped by CodeIgniter?

The problem with this pair of tasks is that task 2 is dependent on how you solve task 1. I’ve solved both problems (on dreamhost) with the following fixes:

Make sure your config.php has these values set:

$config['base_url'] = "http://domain.com/";
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['enable_query_strings'] = TRUE;

Your .htaccess looks like this:

RewriteEngine on
RewriteCond $1 !^(index\.php|public|favicon\.ico|static|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

And add this to the top of any Controller you wish to use $_GET variables in.

function __construct() {
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
parent::Controller();
}

Now you’ll be able to access the $_GET variables as you would expect:

echo $this->input->get('foo');

Play a XBOX 360 game with broken disc

Posted in Hardware, How To, Tips, Xbox 360 on December 1st, 2009 by admin – 3 Comments

My 360 fell off my dresser last night, went vertical, and then to the floor. Luckily the Xbox is fine, but as most people know by now, if you move your Xbox 360 while a disc is spinning in the tray, it leaves a nice round scratch around the disc, leaving it unreadable.

However! You may get lucky! In my case I was only left with a partial, shallow scratch. My game will load, but I can not read from the disc to say, load a multiplayer map.

I solved this by borrowing my friends game, and installing it to the hard drive. I then gave my friend back his game, popped my scratched cd in the tray, and fired up multiplayer. Everything has been working fine so far. Below is a more detailed guide on solving the problem.

  1. Get another copy of the broken disc
  2. Pop the good copy into your xbox hard drive
  3. On the Xbox dashboard (where you would normally launch the game), Press Y
  4. Select “Install To Hard Drive”
  5. Wait for Xbox to finish copying the disc to the hard drive
  6. Pop out the good disc
  7. Put your scratched disc back in
  8. Try and launch game
  9. Celebrate
  10. Give old disc back

Dreamhost PS Optimization

Posted in Dreamhost, How To on November 27th, 2009 by admin – Be the first to comment

I have been wondering about this myself for a while. For many people, a Dreamhost PS is going to be the first private server they have ever dealt with.

If you’re on a budget, chances are you will max out the available resources on your PS at one time or another. Your server will go unresponsive. Dreamhost will tell you that the only way to correct this, is to “increase your maximum resources,” or to restart your server. In some cases, neither of these options will help.

I had to waist a couple hours with support in order to get a hold of the following link. The dreamhost optimization guide will guide you through the steps you need to hunt down the problem source, fix it, and maybe even speed your little PS up.

How to check if PHP is in safemode

Posted in How To, PHP on April 29th, 2009 by j3nnings – Be the first to comment

Simple, all you need to do is create a new php document, and paste the following into it.

<?php phpinfo(); ?>

Load the page in your browser, and then press Control + F and search for “safe_mode.”

How To Add Desktop Shortcut Icons Back To Google Gears Applications

Posted in How To, Windows on April 24th, 2009 by j3nnings – Be the first to comment

I’m a fan of Google Gears, but things still tend to be a bit buggy. If you accidentally delete the desktop shortcuts to your Google Gears services, here is how you get them back.

  1. Log out of the online service
  2. Go to Tools > Gears Settings (or the equivalent in your browser)
  3. Click Remove next to the url of the service you are trying to repair
  4. Click Apply at the bottom of the window
  5. Clear your cookies and other offline data
  6. Log back into the service
  7. You should be prompted to enable Google gears and install desktop icons

I just spent my whole morning trying to figure this one out. Good luck.

Find SQL Bottlenecks With CodeIgniter

Posted in CodeIgniter, How To, PHP, Web Development on April 6th, 2009 by j3nnings – 3 Comments

I have been using my latest project, VentStatus, as a an opportunity to learn a new framework: CodeIgniter. It has treated me well so far, most problems encountered only required a short workaround. Lately I’ve been concerned with the scale-ability of VentStatus, it’s my first project on this large of a scale. Luckily, CodeIgniter has some benchmarking classes built in, and it really helped me cut down my load times.
read more »