DigitalSound Production Services
August 5, 2011 in Programming
August 5, 2011 in Programming
August 5, 2011 in Programming
As I’ve been working more with open source CMS (Content Management System) solutions I’ve had to work with PHP more than usual. Recently a client of mine was having an issue with spam being sent through the contact form on his website. The previous developer had used client-side JavaScript to validate the form submission, but what most people don’t realize is that spam can be sent through your site without hitting the form. Any valid post request to your .php file will work. So I developed a means of blocking these messages from sending server-side.
The code simply checks to see what domain posted the request, and if it doesn’t match your site, the request is denied. Just place this at the top of your ?php code and replace ‘heyjones.com’ with your domain:
$url = $_SERVER['HTTP_REFERER'];
$uri = parse_url($url);
if($uri['host'] != 'heyjones.com'){
header('location:' . $url);
exit();
}
May 4, 2011 in Programming
WARNING: THIS POST IS REALLY NERDY.
While developing a calendar application, I ran into an issue that took hours to diagnose and nearly prompted me to wrap my car around a tree. The issue is this…
I was taking a date from SQL, using the DATEPART function to return an integer value for the day of the week, then comparing that to the result of the DayOfWeek function in VB.NET. Here’s how it should work:
SQL
DECLARE @KillMe AS datetime;
SET @KillMe = ‘5/4/2011’;
SELECT DATEPART(d, @KillMe);
VB.NET
Dim KillMe As Date = CDate(‘5/4/2011’);
Return KillMe.DayOfWeek
So assuming that SQL considers Sunday = 1, it will return an integer value of 4, and since I’m using the same date, VB.NET should return a 4 as well… right?
Wrong.
Apparently, GETDATE() in SQL returns 1 for Sunday and goes from there, while VB.NET starts at 0 for Sunday and ends at 6 for Saturday. Don’t ask my why this took so long to figure out, but I suspect that four failed attempts at a passing grade in Intermediate Algebra might be only partially at fault, while Microsoft holds the lions share of the blame. All that having been said, here’s the fix:
VB.NET
Dim KillMe As Date = CDate(‘5/4/2011’);
Return CInt(KillMe.DayOfWeek) + 1
It’s hinky and lame, I know, but I decided that correcting SQL by subtracting 1 was more complicated.
December 7, 2010 in Programming
Programming may in fact be transforming into an art, one that requires a skilled hand and a creative mind to achieve a happy medium between problematic extremes.
October 29, 2010 in Programming
The Event Company is a one-stop shop for everything you need to host an unforgettable event. They wanted a clean and simple site so that their clients could focus on the visual aspects of their services and we delivered. The photo transitions use jQuery so that the effect is compatible with most browsers and mobile devices.
October 29, 2010 in Programming
October 3, 2010 in Programming
I always recommend Google Apps to my clients. It’s free for up to 50 users, and expanded functionality is available for $50 per account annually. Feel free to give us a call if you have any questions about how to go about setting that up.
September 28, 2010 in Programming
Since switching the majority of my clients over to Google Apps I have enjoyed the speed, reliability and accessibility of their free service. Unfortunately when things don’t go as expected, dealing with Google’s “customer service” is a less than comforting experience. I have found one thing you can do on your own to clear up most issues before attempting to get the boys up in Mountain View to help you out.
Google is very strict when it comes to taking measures to prevent spam in their system, so they rely heavily on captcha to verify human interaction with their service. Follow these steps to unlock your Google Apps account:
1) Go to https://www.google.com/a/yourdomain.com/UnlockCaptcha, replacing “yourdomain.com” with your domain name
2) Enter your username, password and the captcha text
3) Click the Unlock button
July 29, 2010 in Programming
If your iPhone 3G or 3GS has been running slow since the iOS4 update, this one modification has made a dramatic difference in how quickly my iPhone responds. This should tide you over until Apple figures out what the issue is.
1) Go to Settings > General
2) Click “Spotlight Search”
3) Uncheck everything
Finally, reboot your phone by holding the Home and Sleep/Wake buttons until the Apple logo comes on the screen.