Tunneling and Port Forwarding Using SSH

Tue 25 Sep

2007

At the company I work for, we run services such as SSH, FTP, VNC, etc. on non-standard ports for security reasons. I frequently use client applications that allow me to connect to these services, but have a limitation of only being able to connect on standard ports. A way to get around this limitation is to use SSH’s port forwarding functionality.

Note: This tip will work on UNIX, Linux, and Mac OS X straight from the command line because they come with SSH clients out of the box. For Windows, another application such as PuTTY will be required.

So, let’s say that you want to be able to VNC into a remote system with a host name of my.host.com that runs VNC on port 9999, but your VNC client will only send traffic on the standard VNC port (5900). Provided that the remote system runs SSH on the standard port (to keep it simple for this example), you can run the following command:

ssh -L5900:my.host.com:9999 me@my.host.com

Next, the remote system should promt you for your password. After you’ve authenticated, a tunnel should be established. Then, just point your VNC client at your local machine (localhost or 127.0.0.1) on the standard VNC port (5900) and it will forward to the remote machine on port 9999.

You may not be running SSH on the server you wish to connect to, or the server may not be externally accessible. But, if you are running SSH on a machine that has access to the one you wish to connect to, here’s another option:

ssh -L5900:192.168.10.50:9999 me@my.host.com

In this example, the machine running the VNC server (192.168.10.50) is not accessible from outside of the network, but my.host.com is externally accessible and can communicate with 192.168.10.50 (because it’s on the same network). So, what we are actually doing is: 1) establishing an SSH tunnel to my.host.com and 2) forwarding the local port 5900 to 192.168.10.50’s port 9999 through the tunnel to my.host.com.

Hopefully you’ll get as much use out of this as I have.

Dell Customer Support Still Lacking Despite Supposed Efforts to Improve

Wed 19 Sep

2007

Over the past year or so, I’ve read several articles on how Dell has supposedly pumped millions into improving their customer service, among other areas of their business. Their stock was slipping - going from ~$40 in January of ‘05 to ~$20 in June of ‘07, and apparently, they realized that if they didn’t do something, they would get pushed under by their competitors.

Sadly, although Dell’s stock has rebounded somewhat, it doesn’t appear that their service has changed much. My brother purchased a laptop from Dell’s refurbished website a few days ago. After seeing his estimated ship date, he contacted Dell customer service. Below is the actual chat transcript:

09/18/2007 07:26:07PM System: “Your chat session will begin shortly.”
09/18/2007 07:26:09PM Session Started with Agent (Savitha Shetty)
09/18/2007 07:26:11PM Agent (Savitha Shetty): “Thank you for contacting Dell Customer Service Chat. My name is Savitha. How may I help you?”
09/18/2007 07:26:16PM Agent (Savitha Shetty): “Hi Matt, how are you doing today?”
09/18/2007 07:26:22PM Matt: “Good thanks”
09/18/2007 07:26:38PM Agent (Savitha Shetty): “How may I assist you today?”
09/18/2007 07:26:55PM Matt: “I just placed an order for a refurbished Inspiron, and it says on my email confirmation that my estimated ship date is not until 10/10/07″
09/18/2007 07:27:20PM Agent (Savitha Shetty): “I will personally review your records and will obtain the information for you.”
09/18/2007 07:27:30PM Agent (Savitha Shetty): “Please verify the full name on the account.”
09/18/2007 07:27:40PM Matt: “Matt *edit*”
09/18/2007 07:28:02PM Matt: “the billing name is *edit*”
09/18/2007 07:28:13PM Agent (Savitha Shetty): “Thank you for the verification.”
09/18/2007 07:28:25PM Agent (Savitha Shetty): “Is *edit*@*edit* your e-mail address?”
09/18/2007 07:28:32PM Matt: “yes”
09/18/2007 07:28:43PM Agent (Savitha Shetty): “Thank you for the information.”
09/18/2007 07:29:18PM Agent (Savitha Shetty): “I have researched on your order and see that, your order is in production stage with Estimated Ship Date on 10/10/07.”
09/18/2007 07:29:42PM Matt: “right, that’s the problem”
09/18/2007 07:30:01PM Matt: “one of the reasons i chose to buy from Dell Outlet is that the orders are supposed to ship quickly, most within 24 hrs according to the website”
09/18/2007 07:30:02PM Agent (Savitha Shetty): “It is just an estimated date and the order might get processed much earlier.”
09/18/2007 07:30:50PM Matt: “Aren’t the ones posted already refurbished…you can modify / customize them at all, so shouldn’t they be ready to go.”
09/18/2007 07:30:56PM Matt: “can’t modify that is”
09/18/2007 07:31:26PM Agent (Savitha Shetty): “I understand that you are upset over the Estimated Ship date.”
09/18/2007 07:31:37PM Agent (Savitha Shetty): “Whenever you place an order with dell, an estimated ship date is generated depending upon the availability of the item. The estimated ship date is a tentative date and the order can ship on or before the estimated date.”
09/18/2007 07:32:44PM Agent (Savitha Shetty): “I haven’t received a response in over a minute. Please respond within the next two minutes to allow the system to continue our chat. Please let me know if you’re there.”
09/18/2007 07:32:48PM Matt: “I understand that; however, there should not be a question of availability in this case, as the item was posted on the refurbished site. If it was not available, it should not have been posted. It’s not a custom order.”
09/18/2007 07:33:34PM Agent (Savitha Shetty): “Yes that is right but, I apologize for any inconvenience or frustration this matter caused. We value you as our customer and your satisfaction is very important to Dell. As a mail order rule company we can only provide the estimated ship date only.”
09/18/2007 07:34:37PM Agent (Savitha Shetty): “I haven’t received a response in over a minute. Please respond within the next two minutes to allow the system to continue our chat. Please let me know if you’re there.”
09/18/2007 07:35:12PM Matt: “I am going to be very unhappy if it takes three weeks for my computer to ship. I will wait for now.”
09/18/2007 07:35:26PM Agent (Savitha Shetty): “Thank you for your understanding.”
09/18/2007 07:35:28PM Agent (Savitha Shetty): “Are you satisfied with the level of services provided during the chat session?”
09/18/2007 07:36:05PM Matt: “Not particularly”
09/18/2007 07:36:16PM Agent (Savitha Shetty): “Is there any feedback for me or Dell as a company?”
09/18/2007 07:37:18PM Agent (Savitha Shetty): “I haven’t received a response in over a minute. Please respond within the next two minutes to allow the system to continue our chat. Please let me know if you’re there.”
09/18/2007 07:37:53PM Matt: “Sure…I am leaving this chat with no information beyond what I already knew. Some reassurance or explanation of why a product that should be ready has “availability” issues would be helpful.”
09/18/2007 07:38:08PM Agent (Savitha Shetty): “Thank you. We appreciate your feedback.”
09/18/2007 07:38:10PM Agent (Savitha Shetty): “Is there anything else that I can do for you ?”
09/18/2007 07:38:45PM Matt: “Nothing at all”
09/18/2007 07:38:50PM Agent (Savitha Shetty): “Thank you for visiting Dell Consumer Customer Service online chat and allowing me the opportunity to assist you. I have included your case # *edit* to reference our interaction today. Please keep this on file; it will assist you when contacting Dell Inc in the future. Also, feel free to visit us again at support.dell.com.
09/18/2007 07:39:13PM Agent (Savitha Shetty): “You’ve indicated that there are no other issues you need my assistance with. With that in mind, is it okay with you if I exit this chat now?”
09/18/2007 07:39:23PM Matt: “sure”
09/18/2007 07:39:30PM Agent (Savitha Shetty): “It was pleasant assisting you.”
09/18/2007 07:39:31PM Agent (Savitha Shetty): “Good bye.”
09/18/2007 07:39:33PM Session Ended

While I agree with Matt that refurbished units that are not available for shipment should not be displayed, it wasn’t Dell’s response to his concern that surprised me so much; it was the fact that his feedback seemed to have so little impact on the customer service rep. I mean, if you are going to sound concerned enough to ask for feedback, at least sound concerned when feedback is given - especially when the customer has just stated that you were of no help at all!

Problem Creating a New Rails Project with Aptana RadRails Eclipse Plugin

Sat 04 Aug

2007

Well, I’ve started exploring Ruby on Rails once again. I have been using TextMate and it has some pretty cool features, but after I saw the RadRails plugin for Eclipse, I decided to check it out. Unfortunately, I didn’t get very far before running into problems; however, I discovered a solution so I thought I would share.

The Problem:
After installing the plugin, I switched to the RadRails perspective and selected File > New > Rails Project. I named the project, then clicked Finish. The root project folder showed up in the Rails Navigator, but the create new project dialog didn’t go away. Clicking Finish again did nothing. Clicking Cancel made the dialog go away, but left only the root project folder, not the standard Rails sub-folder structure like you would get if you did a ‘rails <application_name>’ on the command line.

The RadRails plugin had detected only one of the two installations of Ruby on my machine (in /usr/bin), when in fact I had installed another copy with gems, etc. (in /usr/local/bin) that it should have been using.

The Solution:
Go to Eclipse > Preferences > Ruby > Installed Interpreters. Then click Add and show Eclipse where the correct version of Ruby is located (/usr/local/bin in my case). I ended up deleting the entry for the original version that it found, but you may be able to leave it and be ok.

That’s it! You should have a working RadRails create new project dialog. Try to create a new project again. The dialog should disappear when you click finish and you should have a complete folder structure in the Rails Navigator.

Cross-browser Testing Made Easy

Tue 19 Jun

2007

Have you ever wanted to test a newly developed site in a bunch of different browsers but didn’t have four or five spare computers with various OSs and browser versions laying around? Well, browsershots.org might be the solution to your problem.

Just go to the site, enter your site’s URL, then select the browsers you want to test in. Currently supported browsers are:

  • IE 5, IE 5.5, IE 7, and Firefox 2.0 for Windows
  • Firefox 2.0 and Safari 2.0 for Mac
  • A ton of browsers/versions for Linux

Then, choose your other options such as screen resolution, Javascript enabled/disabled and version, Java installed/not installed and version, Flash installed/not installed and version, color depth, media plugins, and the maximum time you are willing to wait for your screen shots. That’s all there is to it.

One dissapointing aspect of the site is that it is pretty slow to produce any results. I queued up a request for this site for IE 7 and set my maximum wait time to 30 minutes with all of the rest of the criteria set to “Don’t Care”. It ended up timing out of the queue before actually giving me anything. Hopefully the creator is working on speeding this up, because I don’t think there are too many instances where someone will want to wait 4 hours (the maximum wait time) to see a screen shot. The good thing is that the site caches recent requests, so if a screen shot has been recently taken, you don’t have to wait again. To see this in action, request a screen shot for microsoft.com or another popular site.

The Ultimate Way To Get Rich From Domain Name Typos

Sat 16 Jun

2007

I read this article in Business 2.0 magazine the other day and was amazed not only by how many domain names Kevin Ham owns, but also by his ingenious idea to grab traffic for unregistered domain names. Basically, he struck a deal with the Cameroon government to direct all of the traffic from unregistered .cm domain names to his company’s website where he hosts Yahoo ads.

If you’re like me, I’m sure you’ve fat fingered a URL and missed the ‘o’ in .com. So, for example beer.com becomes beer.cm. Now that this deal has been made, all Ham does is sit back and collect a check and kicks the Cameroon government a few bucks.

Filed Under: Business, Web | Leave a Comment 

Myspace Profile Editing 101

Sat 09 Jun

2007

The other day, I had the “pleasure” of updating a Myspace page for someone, so I thought I would share my experience. It’s not the first, and probably not the last, Myspace page I’ve been asked to edit. (Well, actually I kind of volunteered… doh!) Even if you’re not a Myspace user, someone you know will have an account. If they know that you know anything about web design, chances are they will try to recruit you to customize their page.

Unlike some other blogging/social networking sites, Myspace doesn’t ask you to choose a template for your page, but rather allows you to use CSS to style your page how you’d like. This flexibility is one of the reasons why Myspace has become so popular.

A few things before we get started:

  1. Following along with these instructions will require at least basic knowledge of HTML, CSS, and the DOM. If you are not familiar with these concepts, w3schools.com is probably one of the best places to start learning.
  2. If you are a standards-aware web designer, Myspace’s markup will drive you INSANE! From a standards point of view, it is the definition of horrible code. Lots of tables, embedded styles, font tags, you name it.
  3. Myspace doesn’t like # symbols. When saving your page, it will convert them to &#035;. This means no # symbols at the beginning of hex colors and no way to target elements by ID in your CSS.
  4. You may find it easier to find a theme or a profile code generator to give you a head start on your CSS. You can tweak it to your liking from there.
  5. You will need to put your CSS into one of the profile sections like “About me:” or “I’d like to meet:”. Normally, you would link to an external style sheet or (worst case) put it in the <head> of the document, but like I said, Myspace is not very standards-compliant.
  6. I highly recommend that you use a couple tools to help you edit. I will be using the Web Developer extension and Firebug for Firefox, so if you want to follow along, you’ll need to download and install them. I’ll explain how we’ll use them in a minute.

Now, here’s where we get started:

  1. Download and install Firefox, the Web Developer extension and Firebug.
  2. Find a theme that closely resembles the look you are shooting for. There a ton of themes on the web, as well as Myspace “code generators”. A quick Google search should find them. If you can’t find anything easily, don’t worry about it; you can still follow along, you’ll just be starting from scratch.
  3. If it’s not already running, fire up Firefox and install the plugins I mentioned in step 1.
  4. Go to the profile page you are trying to edit (the one that a normal user sees, not the one you see when you login).
  5. On the Web Developer toolbar at the top of Firefox, select Outline > Outline Current Element. This will turn your mouse pointer into crosshairs and will display a string just below the toolbar that represents the DOM structure of all of the ancestors of the element that your mouse is currently over. This is how you will figure out which element to target in your CSS.
  6. Since Myspace doesn’t let you use # to specify an ID of an element in your CSS, you will often need to use element names and classes to target objects that you could normally target by ID. So, given the following structure:
    html > body.bodyContent > table > tbody > tr > td.latestBlogEntry > table > tbody > tr > td#ctl00_Main_linkCategory > a
    you could normally use:
    #ctl00_Main_linkCategory a
    to target the anchor, but instead you are forced to use:
    .bodyContent .latestBlogEntry a
    Not a huge deal, but nevertheless, something to be aware of. It’s a little hard to illustrate here, but you’ll see what I mean when you start editing.
  7. Now, in the Web Developer toolbar, click CSS > Edit CSS. This will split your window horizontally into half browser, half CSS editor. You’ll want to go to the “Embedded Styles” tab. Once you figure out which element you want to customize using the “Outline Current Element” tool, you can edit the CSS real-time and see the page change as you edit. Make all of your changes and then copy everything to Notepad or TextEdit. This is what you will need to paste into one of the profile sections mentioned previously.
  8. Next, click “Home” at the top of the Myspace page, then “Edit Profile”. Find the “About me:” or “I’d like to meet:” section and paste the code you copied from the CSS editor at the bottom and surround it with opening and closing <style> tags (<style> and </style>). After you’ve inserted your code, you can preview your profile or save changes by clicking one of the buttons at the top of the page. The preview is not always 100% accurate, so I would just save them and then go look at your actual profile.
  9. Here’s where Firebug comes in. Firebug has a really cool feature that lets you inspect the DOM, click on an element, and see every style that is applied to the element and exactly where it came from. It shows inherited styles as well as styles that specifically target the element, and strikes through any that are overridden by a more element-specific style. You can use this to figure out why a particlar style isn’t getting applied, even though it appears for a particular element in your CSS. (See the image below.)
  10. After you have your page looking the way you want, you can go back and clean up the styles using the same tool described in step 9. It shouldn’t hurt to leave duplicate styles intact, but it’s good practice and cleaner if you remove them. Plus, it will make debugging easier in the future.

That’s it. You’re done. Happy Myspace-ing.

8 Tips to Boost Your Blog’s Search Engine Ranking

Tue 05 Jun

2007

  1. Use semantic markup.

    When ranking a page, search engines place a higher emphasis on text contained within certain HTML tags such as <title> and <h1>. Semantically speaking, these should be the most important pieces of information on the page and should convey the idea of the post in just a few carefully chosen words.

    Take a moment to view the source of your blog to make sure it is semantically well designed (top-level headings should be enclosed in <h1> tags, paragraphs within your body text should be contained within <p> tags, etc.). If not, you may be able to make a few tweaks that will help you out quite a bit.

  2. Link to posts in popular blogs.

    Part of the formula that search engines use to determine your ranking is based upon how many highly-ranked sites link to you. Most blogs allow pingbacks and/or trackbacks which will result in a link back to your website if you link to a post of theirs.

    Note: I wouldn’t recommend abusing this technique or you’ll just look like an idiot trying to get linkbacks. Post links to relevant articles, and not just for the sake of linking to something popular.

  3. Use the tools provided by the search engines.

    Google’s Webmaster Tools is a perfect example of this. One of the things you can do with it (aside from finding out a bunch of information on how your pages are crawled and indexed) is submit a sitemap. It only takes a few minutes and there’s even a sitemap plugin that does all the work for you if you use WordPress. (I’m sure there are plugins for other blogging software, but I’ve never used them personally). There are no official findings that I know of, but there is some speculation that Google gives your page rank a boost for providing a sitemap.

  4. Take the time to write good, keyword-rich content.

    Good content is a HUGE part of your ranking in more ways than one. It’s what the search engines are ultimately trying to find for their users. Sure, they use all kinds of complicated algorithms and crazy secret formulas, but it’s only because they can’t think like a human and have to rely on things like keyword density to determine relevance.

    Don’t just slap your posts together. If you don’t take the time to write them well, then nobody is going to take the time to read them. Use spell check. Think about the message you are trying to convey. Be informative, but concise, or your readers will get bored and leave. The more people who find your blog useful and/or enjoyable, the more traffic and backlinks you will get, and the higher your ranking will climb.

  5. Use stylesheets and external Javascript.

    Hundreds of lines of embeded styles and Javascript in the <head> tag of your page just gives the search engine more code to sort through before it gets to the important stuff (your content - in case you forgot #4 already). Linking to external files has other benefits as well, such as faster page load and bandwidth savings due to caching.

  6. Find a topic and stick to it.

    Make sure your blog stays focused. Writing about different breeds of dogs one day, then classic cars the next, then corporate finance the following day won’t keep your readers reading and won’t get you to the number one spot on Google for any of the three topics. The more you write consistently about the same subject, the more of your pages with the same keywords the search engines will index, and the more your site will make it to the results pages when someone searches for your blog’s topic.

  7. Clean up your URLs.

    Most blogging software has a way to rewrite your post’s URL so it’s not some ugly string of random gibberish like “http://example.com/?p=18&a=view”. Instead, it’ll look something like “http://example.com/how-to-clean-up-ugly-urls/”. Take a look at the URL of this post for another example. A clean human-readable URL gives the search engines one more place to find those oh-so-important keywords. Even if this gives you little or no boost in ranking, it looks prettier and more professional.

  8. Be the first to write about something.

    It’s often difficult to come up with topics that nobody else has written about, but there are those rare opportunities when you get the first look at a new technology or product, or have an original take on an existing topic. This is what happened to me with the new Google Analytics beta. My account was one of the first to be switched over, and I wrote a post about it. To my surprise, for a short time, I wound up at the top of Google for the keywords “google analytics beta”.

Are You Being Spied on Using Spyjax?

Mon 04 Jun

2007

It seems that someone has figured out a clever way to check up on website visitors to see where they’ve been - specifically whether or not they’ve been to competitors’ sites.

Of course, it’s well known that you can grab the referring URL via PHP, ASP, Javascript, etc., but this only works if the visitor came directly from another site (not likely if they are truly a competitor). Basically, this technique involves placing links to competitors’ sites on your site, so you can check the state of the link (whether or not it has been visited) once the page renders. Then, using AJAX, you can send the information back to your server without refreshing the page, and therefore not letting your visitors know that they have been spied on.

This is one of those questionable practices that I personally don’t agree with and has elicited some strong responses from the user community, but is nevertheless interesting. Check out the full article for more info and be sure to leave a comment to let me know how you feel about this technique.

Update: Seems that mashable.com had a post about Spyjax as well. One of its readers suggested the Stanford SafeHistory extension to help protect yourself. Honestly, I’m not too concerned if someone detects which sites I’ve been to; it’s more a matter of ethics than a security concern from my point of view. However, if you are truly concerned, you might want to check it out.

Filed Under: Web, Web Programming | 1 Comment 

Kill Bill’s Browser

Sat 02 Jun

2007

Came across this site and thought it was pretty clever. It uses the design from the popular movie “Kill Bill” to get users to switch to Firefox.

Kill Bill's Browser website screenshot
http://www.killbillsbrowser.com/

Monetize Your Blog by Encouraging Your Readers to Give IE the Boot

Fri 01 Jun

2007

If you’ve ever coded a web page and tried it out in Firefox or another standards compliant browser, then opened the same page in IE only to find an entirely different looking page, you’ll appreciate this Wordpress plugin. It encourages readers to make the switch to Firefox and puts money in your pocket if they do.

The plugin makes use of Google’s Adsense referral program and requires that you setup an Adsense account (a simple process - just click the button below to get started).


Once you setup your Adsense account, just paste the Firefox referral code into the plugin file according to the installation instructions.

By using your choice of three different levels, you can control how aggressively you push the switch. Here are the descriptions from the Explorer Destroyer site:

Level 1: Gentle Encouragement Rating: $$
Visitors using IE see a message encouraging them to download Firefox (with a download link) running across the top of the page.
Level 1 Demo >> (the demo will pretend you are using IE)

Level 2: Semi-serious Rating: $$$$
Visitors using IE get a friendly splash page encouraging them to download Firefox. There’s a download link, and a link to continue on to your site.
Level 2 Demo >> (the demo will pretend you are using IE)

Update: Xavier sent us this modified version of level 2 that will only show the splash page occasionally. Download it here and see a live demo here.

Level 3: Dead serious
Level 3 will not allow people using IE past a splash page. This level is very useful for sites that are not IE6 compatible. And there’s never been a more important moment to switch people to Firefox. Can you handle it? (At least try it for a day to see how good it feels.) Unfortunately, level 3 is a little too intense for the Adsense policies, so for this level you’ll have to use a regular, non-Adsense link to download Firefox.
Level 3 Demo >> (the demo will pretend you are using IE)

I’m still contemplating whether or not to use the plugin on this site. I’m a big Firefox fan, and yes, IE is a pain to code for, but some people may be put off, even by the Level 1 method. Let me know what you think.