Awesometoast.com

Fixing stuff and maybe other things.

Posts by awesometoast

Getting CORS to work with Apache

Ok, if you’re reading this, I’m assuming you know what CORS means, so I won’t tell you that it stands for Cross Origin Resource Sharing. Or maybe I just told you.

Anyway, you want to enable it on your Apache server. Maybe, like me, you’re building an API-based web app. So you need some JavaScript to pull data from a remote server. (Or even, like in my case, a … Keep reading »

Posted under: Fixing Stuff, Web Design | 19 Comments »

OS X Yosemite, Core Storage, and partition woes

So when a new version of any OS comes out, I like to do a clean install. On Macs, this has usually been fairly easy, since HFS+ partitions are pretty flexible — they’ll let you add/remove/resize without a lot of hassle.

Until Yosemite.

In the past, I’ve made a new partition on my drive, installed the new OS X (like Mavericks), copied all my … Keep reading »

Posted under: Fixing Stuff | 75 Comments »

Variables not setting in Windows batch file?

Windows batch files (.bat) can be scripted, which means you can do all sorts of things like setting variables. But if you’re having a hard time getting those variables to set, this might be why.
SET var=Holy crap, it sets the variable!
Will work fine, but…
SET var = Holy crap, the space screws it up!
… will not. If you’re used to putting spaces after equals signs like I am, you can make … Keep reading »

Posted under: Fixing Stuff | No Comments »

Localize an SQL date using Javascript

So you have a date from your database and it looks like this: 2014-01-31 01:02:03. It so happens that your server is on UTC time. You want to:

Format the date into something prettier, and
Offset the date so it’s adjusted for a user’s local time zone.

Ok, great. You only have to SUFFER THE PAIN OF A THOUSAND MIGRAINES AND oh wait it’s actually sort of easy. But man, this … Keep reading »

Posted under: General Stuff | 1 Comment »

Using Sandbox always fails with PayPal IPN (PHP)

Warning: This post assumes you’re already familiar with IPN, and you’re just having trouble, well, troubleshooting it.

Okay, let’s say you’re setting yourself up with PayPal IPN. You’ve set up a PHP listener not unlike this one. You’re all set, right? Ready to test it out with PayPay’s IPN Simulator! Yeah!

Except it fails. It always fails. Why?

To try and figure it out, I set up … Keep reading »

Posted under: Fixing Stuff, Web Design | 3 Comments »

Access a mapped network drive from PHP (Windows)

So you want to do something on a mapped network drive using PHP, but it simply tells you it couldn’t find the drive? Worry not.
What’s going wrong?
The problem is that PHP runs under the SYSTEM account, and the SYSTEM account can’t access mapped drives.
The solution:
So, we need to map the drive from the SYSTEM account. You can do this from your PHP script, but if you need persistent access, we … Keep reading »

Posted under: Fixing Stuff, Web Design | 6 Comments »

Make MySQL’s UNIX_TIMESTAMP() work in PostgreSQL

And FROM_UNIXTIME(), too!

Maybe you’re like me, and you’re migrating something from MySQL over to PostgreSQL. Maybe, like me, you’re swearing a great deal and experiencing high blood pressure, too.
(Or maybe not.)

I’ve seen numerous threads that just tell you how you can change all your code to use Postgres’s epoch_something_something_aint_nobody_got_time_fo_dat() function instead, but epic hero Janusz Slota has a better way. He shows … Keep reading »

Posted under: Fixing Stuff | No Comments »

iTunes 11 and 12: Enable track skipping with Repeat One turned on (OSX)

In iTunes 10, you could skip to the next/previous track when Repeat One was turned on. In 11 & 12, they assume that by “skip ahead”, you somehow mean “rewind this track”.

This really bothers some people.
Do not judge us, we have our reasons!

And here’s one way to fix it.

It took some work, but I finally came up … Keep reading »

Posted under: Fixing Stuff | 3 Comments »

Ever met a chronic insomniac?

Posted under: General Stuff | No Comments »

How to downgrade to iTunes 10.7 from iTunes 11 [OSX – Even Mavericks!*]

iTunes 11 is out, and most people seem to think it’s great. You and I are different, however. We hate it, and we have our reasons. (Mine happens to be the inability to skip tracks while Repeat One is on. Yup, deal-breaker for me. UPDATE: Fixed that!) So let’s … Keep reading »

Posted under: Fixing Stuff | 16 Comments »
Page 2 of 712345...Last »