As you probably have not noticed but will now recognize since I'm pointing it out, I haven't really posted here since June or so. Why? I have been far to preoccupied with other things to post anything, and far too bitter to be bothered when I'm not. Considering that, as well as the fact that people don't ask me things I'd share for free anymore, and GnuJersey.org's imminent shutdown, I see no reason to pretend like I'm ever going to post again.
I have other interesting things in mind for the future, but we'll see what happens.
*Poof*, suckas!
Showing posts with label website. Show all posts
Showing posts with label website. Show all posts
15 October 2007
15 April 2007
Background Bookmarklets
To summarize for the sake of brevity: [How can I load a page with a browser bookmarklet without actually viewing the page?] – Dave
First, to provide a little background, Dave wanted to save bookmarks to a server on the Internet (like del.icio.us) but at a location under his control. More importantly, leaving the current page to do so (like del.icio.us) was unnecessary and unwanted.
So, how do we do that? If you said AJAX like I did at first, your wrong! The
The
So, here is the code.
But wait! Where is the URL we want to bookmark? Easy, its in the referrer header sent to the target web server. If you don't want to trust referrers, all you need to do is escape and use the
Now, there are a few things you can do with this. Start the entire thing off with
If you are interested, here is the mailing list thread this was discussed in.
First, to provide a little background, Dave wanted to save bookmarks to a server on the Internet (like del.icio.us) but at a location under his control. More importantly, leaving the current page to do so (like del.icio.us) was unnecessary and unwanted.
So, how do we do that? If you said AJAX like I did at first, your wrong! The
XMLHTTPRequest
object Ajax uses won't operate across domains for security reasons. So, what is the solution then? We need to use JavaScript to ensure a one-click affair, but the champion of JavaScript and Web 2.0 has left us out in the cold. We must use the old stand by of JavaScript and DHTML, the Image object.The
Image
object provides some very useful behavior for us.- Unless you are crossing the HTTPS boundary, there aren't really any security mechanisms around by default to get in our way.
- We can create an manipulate Image objects without every displaying them, or anything else, to the user.
- Image objects are fairly cheap to create an use, unlike trying to fire up ActiveX, Java, or Flash.
- Image objects will load any arbitrary URL we give them immediately and in the background, providing us with flexible, asynchronous behavior.
So, here is the code.
var img = new Image();
img.src = "http://localhost/bookmark/";
But wait! Where is the URL we want to bookmark? Easy, its in the referrer header sent to the target web server. If you don't want to trust referrers, all you need to do is escape and use the
location.href
property.var img = new Image();
img.src = "http://localhost/bookmark/" + escape(location.href);
Now, there are a few things you can do with this. Start the entire thing off with
javascript:
and you've got a suitable bookmarklet. Wrap that in a
tags and you have a click-able link you can embed in pages.If you are interested, here is the mailing list thread this was discussed in.
10 April 2007
6 Steps for Moving Websites
How do I move my web site to another host? - DFRI, and others
If you have a 100% static web site, moving from one host to another is fairly easy. Of course, how often do we get to do things the easy way? Assuming a dynamic web site with some database-housed content (say, a content management system or forum software) there is very particular sequence of events that needs to happen to minimize pain. Some of the steps below only apply to web sites with database-backed content, and can be skipped for sites without it.
This step is obvious to anyone in the web hosting universe, but is not apartment to others. Moving a web site takes time. If you try and shut down your old service without having a new spot ready, you can wind up in web server limbo. Give your new host 24 hours to get your account set up, and DNS records propagated to their outward-facing DNS servers. Some hosts only update their DNS records once every 12 to 24 hours!
If you aren't the only person updating your web site data, you'll need to lock it temporarily. If something changes after you have copied your data, but before you have finished, you'll have two separate versions of your data! If you don't want to get a stack of e-mails that say “Where did my post go?”, don't skip this step.
All of your files and database data will need to copied to your new web host. This should be fairly easy, so long as you don't forget the incidentals. Be mindful of file permissions, as some files may be created by the web server, and a loss of proper permissions could break your web site. The biggest culprits here are upload directories, uploaded files, and cache files. Consult your original deployment instructions or setup manuals if you are unsure about file permissions. Also, keep a close eye on database host names, database names, user names, and passwords. If any can't be copied exactly, you'll need to note the changes for later.
If you have any dynamic content, you will need to point the code on your old host to the database on your new host. Keep in mind that this is against the terms of service for many web hosts, and not even possible with many. If your new web host won't let you do this, find another one and go back to step 1. If your old web host won't let you do this, well, its a good thing you are moving. A few quick edits to configuration files should be all that is necessary. When you are done, unlock your existing web site, but leave any file uploads disabled. It's OK, all of those edits to the database are happening on your new web host.
You've already copied files, now you need to reconfigure your code. Make the same edits to files you did in step 4. Some options may be a little different (
The final step is to update your DNS information to point to your new web host. In most cases, this means changing your domain's name servers to the values provided by your new web host. Those with third party DNS hosting (or DNS hosting from the domain registrar) can update the DNS records for the domain. Your new host can provide you with all of the necessary information.
That's it! Your done! It make take up to 72 hours for the switch to be complete, but since you carefully followed the above instructions, it doesn't matter! It will all come together. After you are satisfied that no one is being pointed to the old web host, cancel your old account.
What? You want to move e-mail accounts too... Well, that is a different story...
If you have a 100% static web site, moving from one host to another is fairly easy. Of course, how often do we get to do things the easy way? Assuming a dynamic web site with some database-housed content (say, a content management system or forum software) there is very particular sequence of events that needs to happen to minimize pain. Some of the steps below only apply to web sites with database-backed content, and can be skipped for sites without it.
Step 1: Set up the new hosting account.
This step is obvious to anyone in the web hosting universe, but is not apartment to others. Moving a web site takes time. If you try and shut down your old service without having a new spot ready, you can wind up in web server limbo. Give your new host 24 hours to get your account set up, and DNS records propagated to their outward-facing DNS servers. Some hosts only update their DNS records once every 12 to 24 hours!
Step 2: Lock your existing web site.
If you aren't the only person updating your web site data, you'll need to lock it temporarily. If something changes after you have copied your data, but before you have finished, you'll have two separate versions of your data! If you don't want to get a stack of e-mails that say “Where did my post go?”, don't skip this step.
Step 3: Copy your data.
All of your files and database data will need to copied to your new web host. This should be fairly easy, so long as you don't forget the incidentals. Be mindful of file permissions, as some files may be created by the web server, and a loss of proper permissions could break your web site. The biggest culprits here are upload directories, uploaded files, and cache files. Consult your original deployment instructions or setup manuals if you are unsure about file permissions. Also, keep a close eye on database host names, database names, user names, and passwords. If any can't be copied exactly, you'll need to note the changes for later.
Step 4: Connect your old web site to your new database.
If you have any dynamic content, you will need to point the code on your old host to the database on your new host. Keep in mind that this is against the terms of service for many web hosts, and not even possible with many. If your new web host won't let you do this, find another one and go back to step 1. If your old web host won't let you do this, well, its a good thing you are moving. A few quick edits to configuration files should be all that is necessary. When you are done, unlock your existing web site, but leave any file uploads disabled. It's OK, all of those edits to the database are happening on your new web host.
Step 5: Connect your new web site to... your new web site.
You've already copied files, now you need to reconfigure your code. Make the same edits to files you did in step 4. Some options may be a little different (
localhost
vs sql.hostdomain.tld
, for example.) Wow, this step was short.Step 6: Updating DNS information.
The final step is to update your DNS information to point to your new web host. In most cases, this means changing your domain's name servers to the values provided by your new web host. Those with third party DNS hosting (or DNS hosting from the domain registrar) can update the DNS records for the domain. Your new host can provide you with all of the necessary information.
That's it! Your done! It make take up to 72 hours for the switch to be complete, but since you carefully followed the above instructions, it doesn't matter! It will all come together. After you are satisfied that no one is being pointed to the old web host, cancel your old account.
What? You want to move e-mail accounts too... Well, that is a different story...
Subscribe to:
Posts (Atom)