It’s been a really long time since I had a post with a coding solution here. So today I thought I’d throw up something I needed earlier this summer for anyone else looking for similar code.
On an older site, still running Classic ASP, I needed to redirect anyone visiting a page with standard HTTP to the same page using HTTPS. Here’s the solution which I included at the very top of the page before any other code is called:
<%
if Request.ServerVariables("HTTPS") = "off" then
srvname = Request.ServerVariables("SERVER_NAME")
scrname = Request.ServerVariables("SCRIPT_NAME")
response.redirect("https://" & srvname & scrname)
end if
%>
Basically, whenever someone visits the page it checks to see if they came from http://www.example.com/page and then redirects them straight to https://www.example.com/page to ensure they’re visiting the page on a secure connection.
There are probably much better ways to do this but since this is what worked for me I thought I’d share.
The idea of a mashup, or a site built with pieces of content from other sites, is definitely not an unfamiliar idea to me or most people. I have a large network of such sites based around sports and I’m starting to branch out into other topics lately as well. My latest is a site about my favorite record label called Sub Pop Bands.
I’m a big fan of the mashup idea for two reasons: speed and simplicity.
Mashups Are Quick
I have a custom built content management system for my mashup sites but even if you don’t have that kind of programming knowledge making your own mashup site is relatively simple. There are so many widgets and free scripts to let you bring in fresh content that putting together your own mashup site should take no time at all.
Aside from the content from outside sources, my mashup sites also contain hand-written content that I have made unique for that site. Whether you write this content yourself or hire someone to write it for you is your decision to make. When I have the content in hand I simply copy and paste it into my CMS and the site is updated.
Mashups Are Simple
A mashup site isn’t a complicated e-commerce store, a frequently maintained blog or any other type of time consuming website. it’s really a simple content site that is augmented with automatically updating features to keep the site fresh with new content. How can it get much simpler than that?
It is that simplicity that makes it possible to produce, quite literally, dozens of these sites with little to no effort. For under $50 I can have all of the necessary content written for me and away I go. No fuss or hassle after I load up the site using the content management system.
The End Goal
The whole point of the mashup site, as with most things online these days, is to make some money. You can use something like phpBay Pro to add eBay listings to your sites like I do. I also include AdSense and sell private advertising on the sites when the time for that is right. It takes a bit of time but not a lot of effort to turn these sites into profit machines.
When news came out the other day about Google’s move to host some of the more popular JavaScript libraries on their servers I was going to write a post about the privacy implications. As I sat down this morning to write that very post I came across another JavaScript related news story that trumped the one from Google.
SocialHistory.js is a brand new piece of JavaScript code that, while clever, is also a little bit disconcerting at the same time. This script allows a site to determine what social networking (or regular sites) a visitor has previously visited. The creator of the script uses the example of implementing this to determine what social bookmarking links to provide on a page.
My first thought was the amount of market research a person could collect with this. What’s stopping me from taking the script, slightly modifying it so that it actually stores the data is collects and then using that data to determine if making pushes to promote my site on certain social networks would be worth my time? The answer is probably nothing.
But is that a good idea? The data is probably relatively harmless. For instance, the script can tell that I personally use sites like Facebook and del.icio.us but that’s true for, quite literally, hundreds of thousands of people. Maybe the data you could gather from SocialHistory.js to use for research means wouldn’t prove to be very valuable in the long term but I’m just not sure it’s any of my business to see that information in the first place.
When I first started getting involved in freelance web development the requests for building online stores were few and far between. In recent years this has totally changed, as people want more and more to begin selling their products and services online. This trend has increased just as quickly as people’s concerns and interests in Search Engine Optimisation.
I’ve used my fair share of Ecommerce Software in this time and, really, they’re all about the same. They come in two flavors: hosted and self-hosted. My preference is to always go with the hosted solution because while the costs are usually higher the headaches are few and far between. A lot of the hosted solutions also have really excellent hooks that let you tie into your own CMS or scripts.
The one big knock on hosted shopping cart packages is that you lose almost all control over the look and feel of the interface. This is unfortunate because the best Web Design firms out there didn’t exactly build most of these carts. This is where the hooks they provide or so important. With the right hooks and programming you can do as much as you can on your side of the equation to offset what’s lacking on the hosted side.
It took a long, long time but YouTube finally announced additions to their API that actually make it useful. With the release of the features listed below we’re about to see the floodgate open on third-party YouTube applications.
- Upload videos and video responses to YouTube
- Add/Edit user and video metadata (titles, descriptions, ratings, comments, favorites, contacts, etc)
- Fetch localized standard feeds (most viewed, top rated, etc.) for 18 international locales
- Perform custom queries optimized for 18 international locales
- Customize player UI and control video playback (pause, play, stop, etc.) through software
I hope someone combines this with the new iPhone SDK and makes a YouTube application for my iPod Touch that’s actually worth a damn.