Kyle D. Skrinak

Author Archive

Shared IIS Hosting, classic ASP and URL redirecting

by Kyle Skrinak on Aug.20, 2010, under Technology

I needed a way to redirect old and broken links, which Google Webmaster complains I have about 30, on external sites to correct pages on a site I manage that is a classic ASP site. There’s tons of posts on how to do URL rewriting for Classic ASP sites. After a bit of research, I’m pleased with the method I’m using.

This fellow here gave me the basis for what I did. Thanks, John!

First, shared IIS host most likely means that a) you don’t have access to the IIS management console, b) your web hosting service does expose a means whereby you can establish your own http error pages. Point b will help us get around point a. (I’d much rather handle this server-side, by the way)

Set up an error page. I’ve used this path off root: /error/http-redirect.asp. I’ve linked the 404 error page as provided by the host to this page. Set your page up as you would any 404 page, I used the advice from the ever-trusty A List Apart’s “The Perfect 404″ reference for that.

Next, add a script like the following to the top of your page. The fun is in the if/elseif statements. This is where you can add all broken URLs and redirect them to new, working paths.

<%
' John's original script called for QUERY_STRING although
' here, our URLs don't have this appendage, so we look
' for the HTTP_X_ORIGINAL_URL
strQuery = Request.ServerVariables("HTTP_X_ORIGINAL_URL")
strPage = Mid(strQuery, InStrRev(strQuery, "/") + 1)

' this item is sorted from most to least hit missing pages
' Spookora redirects was at 100
If strPage = "spookora.asp" or strPage = "sporkora.asp" Then
 Response.Status="200 OK"
 response.redirect("/products/sporkora.asp")
' spookora catalog was at 46 hits
ElseIf strPage = "spookora-cat.pdf" Then
 Response.Status="200 OK"
 response.redirect("/products/catalogs/spookora-cat.pdf")
Else
 'Put your normal error page here, so far I haven't used this statement
End If %>

Add ElseIf statements like the above to add as needed. Then be sure to test that the redirects work as expected.

While we’re at it, another page that is a help for those of us supporting legacy code is here, which adds a simple print() and break() classic asp function so you can see your variables.

Leave a Comment more...

Lingon, launchd, and updating my macports installation

by Kyle Skrinak on Aug.12, 2010, under Technology

Here’s the rub: the CLI application for updating MacPorts, “port” likes to have a home environment variable populated. Apparently this happens when executing port from a CLI. When running from launchd, however, $HOME is empty and thus the script dies.

The fix is trivial. You need to add the following to your user daemon (it needs to run as root, so user daemon it is):

    <key>EnvironmentVariables</key>
        <dict>
              <key>HOME</key>
       <string>/var/root</string>
       </dict>

Here is the full context. (the path to your user daemons is at:)

/Library/LaunchDaemons
System-wide daemons provided by the administrator.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>EnvironmentVariables</key>
        <dict>
              <key>HOME</key>
       <string>/var/root</string>
       </dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>com.ksk.updateMacports</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/update-port.sh</string>
    </array>
    <key>RunAtLoad</key>
    <false/>
    <key>StartInterval</key>
    <integer>43200</integer>
</dict>
</plist>

Hat-tip: Arno, here.

Leave a Comment more...

Upgrade to Ubuntu 10.4

by Kyle Skrinak on Apr.30, 2010, under Technology

I’ve updated my ubuntu 9.10 (insert whatever cutesy alliterative here) laptop to 10.4, albeit in a circumambulatory manner; all of my own doing. I took advantage of a nice, phat broadband connection to perform the update manager facilitated upgrade (these usually go smoothly) when the update process took much longer than expected, over 4 hours (the download was fast, the package update was slow. My watching twit.tv surely impacted performance.) So, hoping that the package installation would not be negatively affected by putting the OS to sleep, I did so and continued on with more interesting aspects of my life. I had figured on continuing the install at home. Only I didn’t. I forgot and returned to a computer that lost it’s power and had turned off. The machine booted into… 10.4, but that was a curve ball, as the core system was updated but not the myriad of packages.

So, back to a classic reformat and install, using the system I outline here. This allows me to wipe out and reinstall the OS without hurting my user data directory; which is very convenient. Here’s the screen shot from my install this morning, which will probably serve me in x months, as the screen shot for the prior link did.

Screen shot from my 10.4 Ubuntu installation

Screen shot from my 10.4 Ubuntu installation

Leave a Comment more...

Sure, it’s an ad, but, oh, the puffery

by Kyle Skrinak on Apr.06, 2010, under Technology

I’ve noticed a Quicken Intuit service for business websites on television. The premise of their ad is simple: they make business web sites simple and cheap. Sure; like everyone else before has. Anyhow, in one scene, a “mom and pop” couple “successfully” upload their site — dramatically and succinctly portrayed, of course. Immediately afterwards, we see the same couple “watching” a Google search window, and, voilà! their site magically bumps to the top. Of course it’s that easy.

So, either Quicken Intuit has paid Google handsomely for this “feature,” (making Google look very unethical) or, more likely, given the perceived importance of SEO by initiates, that’s a bit too much fantasy to stomach.

2 Comments more...

Upgrading Web2Project from 1.2.2 to 1.3

by Kyle Skrinak on Apr.05, 2010, under Technology

Wow, this was easier than I expected. Here’s roughly what I did:

  1. Backup your files and your database.
  2. Move your w2p root folder, i.e., “mv w2p w2p-old”
  3. Download and unpack 1.3: tar xvvf web2project-1.3.tar.gz -C ~/temporary-dir/
  4. copy over the w2p-1.3 to w2p, i.e., “mv web2project-1.3 webroot/w2p”
  5. (Optional: diff your custom style directory against the latest style/web2project directory for changes)
    1. Update: Sigh. I forgot about this.focus() in the body element. That brings the web2project page to the front, regardless of context. I love w2p, but I really don’t care for that “in your face” UI convention, who ever does it. Added during running diff, but now removed.
  6. Copy your config, files and style directories over:
    1. cp -r w2p-old/style/sci w2p/style
    2. cp -r w2p-old/files w2p/
    3. cp w2p-old/includes/config.php w2p/includes
  7. Go to your site. Confirm that you’re running 1.3 by going to the login page (which might mean logging out.)
  8. Note: I didn’t see any reference to this in any documentation about upgrading: After confirming #7, go to System Admin > System Status. Mine indicated that an upgrade was required (albeit cryptically). Running the upgrade updated my database.

That’s it.

1 Comment more...

GoDaddy, CentOS Virtual Server & Drupal Email Solved

by Kyle Skrinak on Mar.11, 2010, under Technology

I discovered through the silent scream of no updates from my drupal installation that drupal’s mail wasn’t working. I fired up google and found this excellent post that gets you nearly there. What’s missing, of course, is the enabling binary called “sendmail.”

Here’s how to enable a GoDaddy CentOS Virtual Server’s sendmail so that Drupal can send email:

  • Confirm whether senmail is working
    • service --status-all | grep sendmail
  • Install sendmail and sendmail-cf
    • yum install 'sendmail sendmail-cf'
  • Edit with your favorite editor (vim, no doubt):
    • vim /etc/mail/sendmail.mc
    • Search for ‘SMART_HOST’ and insert the line below just below it. Comment it for clarity’s sake.
    • define(`SMART_HOST',`k2smtpout.secureserver.net')dnl
    • Save and close file.
  • Run this command:
    • m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
  • Finally, start or restart your sendmail service:
    • service start sendmail

That did it for me.

Leave a Comment more...

MAMP update process

by Kyle Skrinak on Mar.09, 2010, under Technology

You be the judge whether this is a “best practice” but here’s my MAMP update process:

  1. Do a manual phpmyadmin backup of all sql dbs first.
  2. Stop the MAMP servers.
  3. Quit MAMP (and/or MAMP PRO)
  4. Rename the folder: /Applications/MAMP e.g. to /Applications/MAMP_old
  5. Copy the new MAMP folder to your Applications folder.
  6. Copy the databases and other files that you want to keep to the new MAMP folder from the old one. Databases are located under /Applications/MAMP/db but there are possibly also other files that you want to keep like the folder /Applications/MAMP/htdocs or configuration files within /Applications/MAMP/conf.
  7. Run kdiff3 on the MAMP/conf folders to bring over the customizations
    • Unless you’re an exquiste documenter of everything you do, it’s good to run a diff on the two files.
      • sites apache vhost config file
      • php.ini updates (but check, new libraries are added and versions modified)
  8. Copy the uploadprogress.so file, rather than recompile:
    • cp -v /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so -> /Applications/MAMP-1-8-4/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so
  9. Start new MAMP (or MAMP PRO).
Leave a Comment more...

Installing HTMLTidy for Mac OS X/Snow Leopard

by Kyle Skrinak on Mar.08, 2010, under Technology

The latest HTML Tidy has much goodness that the version that ships with Snow Leopard is missing. You’ll need to compile it to update your binary. It’s simple after you’ve done it once and easy to forget, so I’m documenting it this time.

  1. Test version
    1. Load Terminal
    2. tidy –version
      1. “HTML Tidy for Mac OS X released on 31 October 2006 – Apple Inc. build 15.3″
      2. No good, should say at least “HTML Tidy for Mac OS X released on 25 March 2009″
  2. Download the source code:
    1. cd to a directory you can track for cleanupcvs -z3 -d:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy co -P tidy
    2. cvs -d:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy login
      • Hit the enter key for password, i.e., no password
    3. cvs -z3 -d:pserver:anonymous@tidy.cvs.sourceforge.net:/cvsroot/tidy co -P tidy
      • This will create a directory, “tidy” in your current directory
  3. Compile
    1. cd into the tidy directory
    2. /bin/sh build/gnuauto/setup.sh
    3. sudo ./configure –prefix=/usr
    4. sudo make
    5. sudo make install
      • If you error, may the Google search engine be your best friend.
  4. Test version
    1. tidy –version
      • HTML Tidy for Mac OS X released on 25 March 2009
  5. Delete the “tidy” directory
    1. Wow that was easy.
2 Comments more...

MacPorts and and upgrading to Snow Leopard

by Kyle Skrinak on Mar.08, 2010, under Technology

I’m slow to upgrade my OS as I prefer stability to running the latest version of code. As of 2 days ago, however, I have taken the leap to Snow Leopard (now at 10.6.2) and I am very pleased with stability and the reduced footprint of the OS. Also among my upgrade concerns is my MacPorts installation. I have a few ports that I need to have available. This time, my MacPorts migration was the smoothest yet, too. After googling, I first found this blog post about the author’s upgrade, but after reading the blog’s comments found a more reliable (not necessarily more simple  but well worth the added time) way to make the upgrade:

  1. Reboot and boot using the Snow Leopard DVD.
  2. Before running Snow Leopard, perform a “Disk Repair” in disk utility.
  3. Run the Snow Leopard upgrade process. Both of mine were at least 45 minutes; I didn’t stick around for the upgrade.
  4. After completing the Snow Leopard installation install the XCode from the Snow Leopard DVD. (This step is important)
  5. Run Apple’s Software Update (have broadband ready or expect to wait for the download)
  6. Download the latest MacPorts for Snow Leopard disk image.
  7. Then follow the steps at the MacPorts migration page.
    1. port installed > myports.txt
    2. sudo port -f uninstall installed
    3. sudo port clean –work –archive all

This process does take up some time, but I reloaded my entire MacPorts without a hiccup, which was nice. Also nice is that my 10.5 MacPorts list contains a number of ports I no longer needed, so the cleanup was overdue. I saw none of the dependency or other issues that can happen with MacPorts.

Leave a Comment more...

Quickly noted: Phusion Passenger & PHP files

by Kyle Skrinak on Feb.04, 2010, under Technology

There’s so much more to this, but the details of such are outside of my normal scope; so I’m simply noting this:

If you have a apache 2.2.14-served directory from which you intend to have PHP script interpreted within your *.html files, you must except this directory from your Phusion Passenger environment.

The head-scratcher for us was this: http://www.website.com would show the HTML with the unintrepreted PHP code, BUT http://www.website.com/index.html would properly interpret.

This was a real head-scratcher for the CTO for one my clients and myself when we discovered that subdirectories of our main “web-brochure” site were under Phusion’s control. We simply moved that directory to a new location, outside the environment’s paths, and this solved the problem. It appears that  you can use apache directives to achieve the same result, though I couldn’t.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!