December 26, 2014

VPN Client for Vista using Parallels

A recent client needed me to run some Windows-only software from their network. Since I have my lovely new MacBook with Parallels and Vista installed, I thought this should be no problem.

Famous last words.

Actually it wasn’t so bad. I don’t actively hate Vista, at least not since it is held captive in my MacBook. The problem was that I needed to connect to the client’s LAN using a Cisco VPN client and Vista didn’t like that software one bit. It would simply fail with no explanation or logging every time.

I found a solution, or at least a thread discussing possible solutions at Bill Evjen’s Blog and I crossed my fingers.

[Read more...]

Ajax remoting for Invisible Castle

happy Ajax remoting for Invisible CastleI offer the code for my Invisible Castle site under a GPL license. However, it is not the easiest code in the world to get running. Plus, it is really overkill for most people. Most people who ask for the code really just want a die-roller with database lookup for their site. They aren’t really prepared to provide a working Python/Cheetah/MySql install. That’s fine, I could help them out and pick up a new skill in one fell swoop.

Ajax to the rescue

I quickly wrote a simple remote interface to the die-roller, and then used the Prototype library to implement an Ajax interface to it. Simple simple simple. It worked beautifully, with one problem, that pesky restriction agains cross-domain XMLHTTPRequests. So, I wrote a simple little PHP proxy page, and it works perfectly!

All together, this was a pretty nice payoff for a couple hours of work, including ramping up from zero about XMLHTTPRequest objects. I already have two remote client sites functioning happily using the script, which has a working demo with install instructions here.
[tags]javascript,Ajax,cross-site scripting,xss,xmlhttprequest,prototype[/tags]

WordPress title suffix plugin

adapter Wordpress title suffix pluginI read some research recently which seems to show that keywords matter to search engines in your site’s “title” tag. Not only that, but position matters. Preferably your page title should precede your site title.

Unfortunately WordPress is coded to make that sort of ugly. If you simply reverse the wp_title and wp_bloginfo(‘name’) calls, you get ugliness in two ways. If what you want is “keyword – sitename”, then you have to live with the default title for your site looking like “- sitename”. Ugly. Then if you are on a titled page, you get “» keyword – sitename”. I don’t know about you, but I think that’s ugly too.

So, enjoy my tiny little WordPress plugin. It will strip out the leading “»” and will not put the dash in unless there is something preceding it. I’m no PHP god, but that was both easy and fun, due to the “hook” system WordPress implements so nicely. You’ll still have to reorder your themes to have “wp_title” listed before the sitename, but at least it will look prettier now.

Download: wp-title-suffix.zip

[tags]wordpress2,wordpress,plugins,seo[/tags]

Related posts

Prototype modification to fvlogger

logger Prototype modification to fvloggerfvlogger.js is a fine logging system for Javascript, but when you are already using Prototype.js, it unnecessarily duplicates a lot of functionality. I’ve forked the original code to “fvlogger 1.0.proto”, removing this duplication. In addition, I’ve added a sweet “add the logger to the page” function to the script. The end result is much smaller and cleaner looking than the original, I think.

This script is based on fvlogger 1.0, available from Five Volt Logic. It requires prototype, and if you want to use its auto-insertion features, it requires Behaviour.js as well. If you aren’t already using the Behaviour library, you should. It will revolutionize your use of Javascript, fully separating user interaction from markup. Most times I use it, I never have to use a single line of inline javascript at all. That is incredibly liberating!

If you want to use Prototype 1.3.x, you will also need to load a few functions borrowed from “the future”, which I’ve helpfully included as “prototype_future.js”. Just look at the test page in the zip, and all should be clear.

Download protologger-1.0.zip and let me know what you think.

[tags]javascript,libraries,prototype,logging,fvlogger,behaviour[/tags]

WordPress 2 multi-blogging made easy

I upgraded the site to WordPress 2 this morning. This wouldn’t be a bit deal, since the dev team has made it so easy to upgrade. What makes it interesting is that I read a tip on the WordPress forums and came up with a simple method to enable multiple domains using one blog installation on Linux/BSD systems.

1) Get WordPress 2.0 and unpack it to a master directory you’ll be symlinking later.

2) Copy wp-config.php to wp-config-orig.php.
3) edit wp-config.php, replacing the whole thing with:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/config.php'); ?>
4) make the directory for your domain, for example:
mkdir coderseye.com
5) cd into the directory and symlink the contents of your master directory.
cd coderseye.com
ln -s /home/example/wordpress-master/* .

6) copy the original wordpress config file, naming it “config.php” and edit like you usually would for wp-config.
cp /home/example/wordpress-master/wp-config-orig.php config.php
7) Done! You’ve successfully linked another directory as a separate blog with the same base files.

Making it automatic

I’ve made a script which automates all of this, at least on Linux boxes. You just call it like so:
setup_multiblog.sh master slave
If “slave” directory exists, it will be backed up, and upgraded to work with the master as a slave-multi-blog.
If it doesn’t exist, it will be upgraded.
If the master doesn’t have the modifications I describe in step #3, the script will back up wp-config and make the modifications.

setup_multiblog.zip

Enjoy, let me know if it needs tweaks, it has a lot of self-checks built in, so hopefully it won’t trash anything. I’d backup first, just to be double-sure.

Technorati Tags: , , ,