Posted on 31 March 2010.
This is Meigakure, a Japanese Puzzle Game which utilizes the 4th dimension in puzzle solving. Confused? Just watch the video below and everything will be made completely perplexing. Be careful not to let your brain overheat.
Unfortunately there doesn’t seem to be a demo available for download yet, and there is no release date. Here is the official site.
To learn more about the time-space continuum, consult your local tesseract.
Posted in GameComments (0)
Posted on 30 March 2010.
As it turns out, forcing “www” in the URL was just the beginning. When they purchased your site, handturkey.com they got in over their heads. They hired you on as a consultant within weeks of the acquisition, and their first order of business was to lock down security. Handturkey.com has project management software, CRM, and ecommerce, after all. It seemed obvious that all the traffic in and out of the server needed to be encrypted.
“No problem.” You told them. You remembered that this can be accomplished with the mod_rewrite module in Apache. You tell them them that all they need is a few more lines in the .htaccess file in the root of handturkey.com, and that they should look like this:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.handturkey.com/$1 [R,L]
This instructs the server to take any traffic on port 80 (HTTP) and forward it to 443 (HTTPS), forcing the traffic onto a secure channel. The Duch are grateful, to say the least. A week later you receive an iPad in the mail, a personal thank you from the dutch CEO, Filibert Broos.
Posted in CodeComments (0)
Posted on 26 March 2010.
Your database is treasure trove filled with wonders and delights. It sure would be a real shame if something happened to it.
Back it up! You don’t even have to be there to do it! Why you could be lounging poolside at the Bellagio, beer in hand while your minions handle it for you. Didn’t know you had minions? You do. They’re called cron jobs and they will gladly bear your burden. Firstly, let’s talk about the mysqldump utility that comes with MySQL.
Just like it says, it will dump all you database data out, you just need to aim the firehose. We do that by piping it. (See what I did there?) A pipe is just this guy: | , and it sends the output of one process to another process. In this case, gzip.
This statement turns on the hose:
mysqldump -u USER -pPASS DATABASE
Where USER is the username, PASS is the password (yes, it is smashed against the -p), and DATABASE is the name of the database you want to dump. (Use “–all-databases” to snag ‘em all.) So then we pipe it to gzip:
mysqldump -u USER -pPASS DATABASE | gzip
and redirect the output to the file of our choosing.
mysqldump -u USER -pPASS DATABASE | gzip > /your/path/db_backup.sql.gz
Database backed up. But we want this to happen automatically. If we use this command, our database backup file gets rewritten each time. So let’s use some date magic to put in the current date.
mysqldump -u USER -pPASS DATABASE | gzip > /your/path/db_`date '+%Y-%m-%d'`.sql.gz
Marvelous, now the file comes out looking like this: db_YYYY-MM-DD.sql.gz. Now all that is left is to schedule the cron. A lot of hosts have built in cron schedulers, so go look in your control panel and add this command. I set my cron to go off every morning at 2:00am, and just like that, I’ve got piece of mind. Another Dos Equis, please?
Posted in CodeComments (0)
Posted on 24 March 2010.
The Form Validation class in CodeIgniter does a lot of fantastic things. Validating phone numbers isn’t one of them. Here is a script I’ve paraphrased to take in almost any format of U.S. phone number and use regular expressions to return it like this: (555) 555-1212.
function _validate_phone_number($value) { $value = trim($value); $match = '/^\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/'; $replace = '/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/'; $return = '($1) $2-$3'; if (preg_match($match, $value)) { return preg_replace($replace, $return, $value); } else { $this->form_validation->set_message('_validate_phone_number', 'Invalid Phone.'); return false; } }
Posted in CodeComments (0)
