RSS

Intra-site Server Hopping

0 Comments | This entry was posted on Nov 25 2008

Have you ever had to add dynamic features to an existing website that ran on a webserver that only supported static HTML?  I’ve been presented with this situation twice in the last six months, and I’ve solved it the same way.  I use a different server with the capabilities I need, clone the layout, and host the few dynamic pages on this other server.  Here’s the two examples.

bakercollege.net was running on JSP/Tomcat when I inherited it.  I’d never written a JSP before and I didn’t see any need to spend the time, so I just threw some static HTML pages up with a fresh Layout.  At the beginning of the academic year, the college president asked me to add a couple “Anonymous E-mail” forms.  The only way I knew how to do this was with PHP’s mail function.  So I threw up a couple new pages in a directory on THIS site, http://justinfaulkner.com, I copied the layout from the main site so as not to throw off the users, and I linked to the forms from bakercollege.net.

Here’s some screens.  First, here’s bakercollege.net, the static webserver:

 

bakercollege.net running on a static webserver

bakercollege.net running on a static webserver

 

 

Now, here’s the cloned layout on a page on justinfaulkner.com.

 

Here's a form from bakercollege.net sneakily hosted on justinfaulkner.com

Here's a form from bakercollege.net sneakily hosted on justinfaulkner.com

 

And here’s the other (more recent) example.  The Rice Computer Science Club Website runs on Rice’s RUF (Rice Unix Facility)  servers.  As far as I know, it doesn’t support any server-side scripting languages.  When we needed a Polling application, I immediately sought a way to host PHP, and temporarily converted http://justinlol.com into our Poll Booth.  Once again, I cloned the site look-and-feel and hosted a couple pages on justinlol.com that I linked to from http://www.ruf.rice.edu/~geeks .  Here are the shots:

This is the Rice Computer Science Club Website:

 

The Rice CS Club Website.  Notice the Look & Feel and URL

The Rice CS Club Website. Notice the Look & Feel and URL

And now here’s the cloned pages running on justinlol.com

 

Here I'm trying to hide the fact that this page is on a different server than the main CS Club Website

Here I'm trying to hide the fact that this page is on a different server than the main CS Club Website

So I guess my question now is, “Is this ethical?”  

There is a certain trust between the Look & Feel of a site, and the identity of that site.  Am I allowed to define the Rice CS Club Website to exist on both the Rice RUF and on JustinLOL.com?  I would say so: I’m the webmaster, I define where the pages are stored.  

But then again, am I weakening that trust in website brand identity by legitimately splitting up the site between servers/domains like this?  These two independent servers may both host content from the same party (me) but who’s to say that other people won’t copy the Rice CS Club layout and try to pretend like they’re legitimate off-server clones?  And even scarier, what if you were to arrive at one of these clones from a link on my site?  Would you even notice?  What if, say, a text-based ad from AdSense on bakercollege.net just happened to point to a bakercollege.net illegitimate clone?

I feel like my uses of multiple servers to host dynamic content and static content for the same site is fair, although perhaps I should warn the user that they are technically leaving the Rice-managed web-world, lest someone notice on their own and feel like I’ve breached their privacy.

MySQL INSERT Syntax Error key

2 Comments | This entry was posted on Nov 24 2008

Problem

I was working on the Vote page for the Rice Computer Science Club for a Tshirt design and I got this error.

Error inserting into databse: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) VALUES ('asdfasd','asdfasdf','283a7384578c2')' at line 1


And here’s the whole query…

INSERT INTO users (netid,name,key) VALUES ('asdfasd','asdfasdf','283a7384578c2')

The users table structure:
-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `userid` int(11) NOT NULL auto_increment,
  `netid` varchar(7) NOT NULL default '',
  `name` varchar(40) NOT NULL default '',
  `key` varchar(64) NOT NULL default '',
  PRIMARY KEY  (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
For the life of me, I couldn’t figure out what was going on.  I read through the entire MySQL Manual on doing INSERTS.  As far as I could tell, I was doing everything exactly right.

 

Solution
Turns out it’s the word “key”.  There’s obviously other meanings for “key” than just the name of my table column, and unless you distinguish the column name from the other “key”, MySQL will get confused.
Surround your potentially-confusing column names with `s, like so:

 

INSERT INTO users (netid,name,`key`) VALUES ('asdfasd','asdfasdf','283a7384578c2')
` <- the apostrophe-ish mark sharing a key with the ~.

How popular are File Sharing sites?

0 Comments | This entry was posted on Nov 23 2008

I was curious how much traffic Bittorrent tracker sites actually got, so I headed over to Alexa.com and checked out their Top-100 Rankings for the United States.  The top two tracker sites in the States are The Pirate Bay and mininova.org, but they rank in at a surprisingly low 91 and 99 out of 100 for traffic rank (defined here).

Non-Bittorrent sharing site RapidShare Ranks in at an impressive 31.