HOWTO: Install a networked printer without all that crappy software.

Here’s a step-by-step guide to installing a network printer in Windows XP without having to install all the additional crappy software that vendors force onto your system. Often times installing all this additional software will compromise the stability of your system, slow it down, or both. These steps will bypass the vendor’s install disk and install only the drivers.

  1. Click: Start > Printers & Faxes
  2. Click: Add Printer
  3. The Wizard will start, click Next
  4. Select “Local printer attached to this computer” and uncheck “Automatically detect and install my Plug and Play printer” then click Next
  5. Select “Create a new port:” and choose “Standard TCP/IP Port”
  6. This will start another Wizard, click Next
  7. Type in your printer’s IP address, eg: 192.168.1.104
  8. Check “Always print to this device, even if its IP address changes” then click Next
  9. A summary of your settings will show, click Finish
  10. You’ll be back at the “Select a Printer Port” window. Select your newly created port from the “Use the following port” dropdown, then click Next
  11. Now you need to select your printer Manufacturer and Printer Model. If your model does not show, put your printer driver disk in your CD-ROM and click the “Have Disk” button. Browse to your CD drive and select your printer’s model. Once your Manufacturer and Model are selected, click Next
  12. Now name your printer, it’s probably best to accept the default. Choose whether or not you want to use the printer as the default.
  13. Chose whether or not to share you printer. Since this is a network printer, don’t share it. You’ll want to set it up to print directly from each of your machines.
  14. Print a test page and you should be good to go!

—————-
Now playing: My Bloody Valentine – What You Want
via FoxyTunes

Immigration & The Bible – Leviticus comes back to haunt Conservatives

These days, religion and politics seem to be one in the same. The line has been blurred so much that I sure as hell don’t see a line any more. Most issues are constantly debated in terms of the Bible, whether its abortion (“life is sacred and granted by God”) or even the war in Iraq (“end of days” anyone?). As evangelicals have hijacked the GOP, they’ve installed a religious litmus test for candidacy: only the most pious may win. And the Democrats? Don’t vote for them, they’re a bunch of godless, druggie, homosexual, Mexican lovers. The GOP evangelicals often quote Bible passages to argue their points, the most obvious which is their stance on homosexuality. “Leviticus! Leviticus!” is the only evidence they use to argue that homosexuality is sin. Well, if we’re working under the assumption that the Bible is the law of the land, what about the part regarding immigrants, another hot-ticket wedge issue pimped by the GOP? Let us consult our trusty virtual Bible to find out…

Leviticus 19.33-34: When an alien resides with you in your land, you shall not oppress the alien. The alien who resides with you shall be to you as the citizen among you; you shall love the alien as yourself, for you were aliens in the land of Egypt: I am the Lord your God.

Or, the modern translation:

Leviticus 19.33-34: When the Mexicans are living in the USA, treat them with respect. Treat them as if they are an US citizen. You used to be an illegal alien too, you know. I’m the man!

Seems pretty obvious to me. If evangelicals followed the Bible as well as they claim, they’d be all about amnesty and helping out immigrants. Instead, we see the opposite: xenophobia, hatred, and racism. And yet the pundits still wonder why the GOP is bankrupt in more ways than one.

mod_rewrite & PHP: How to match urlencoded plus sign (+ = %2B)

I ran into trouble when trying to pass a urlencode()‘ed plus sign into a web address being processed by mod_rewrite.

$url = 'http://www.server.com/browsealpha/name+has+plus+in+it/';
$url = urlencode($url); // http://www.server.com/browsealpha/name%2Bhas%2Bplus%2Bin%2Bit/

This $url variable gets echo()‘d as a link in a page, so once it’s clicked and loaded in the browser, I then needed mod_rewrite to translate that to the actual URL, which is:

http://www.server.com/browsealpha.php?name=name%2Bhas%2Bplus%2Bin%2Bit

Here is the RewriteRule I was using to match:

# match any name containing any combination of letters, numbers, and the % sign (to match urlencoded URLs)
RewriteRule ^browsealpha/([%\w]*)/?$ /browsealpha.php?name=$1 [QSA,L]

This rule should match http://www.server.com/browsealpha/name%2Bhas%2Bplus%2Bin%2Bit/ but for some reason it wouldn’t work. After hours of frustration, I found a few threads mentioning the need to urlencode() the string twice, like so:

urlencode(urlencode($variable));

IT WORKS!!! Apparently this is because mod_rewrite automatically decodes the urlencoded URL, so if you pass in %2B, PHP sees it as %2B0. If you double encode, mod_rewrite decodes the first one, and PHP receives the second one (which is now %2B, which is what we want).

—————-
Now playing: Autechre – 444
via FoxyTunes

jQuery: How to set one <select> element to the value of another (using onchange equivalent)

Say you have an HTML <select> form element and you want to set another <select> element equal to the first one when it changes. Here’s an easy way to do so with jQuery:

$('#id_of_select1').change(function() {
    var select1_value = $(this).val();
    $('#id_of_select2').val(select1_value);
});

—————-
Now playing: Drexciya – Astronomical Guidepost
via FoxyTunes

jQuery: How to get the ID of an element.

Say you want to know the ID of an element using jQuery. You can achieve this easily using jQuery’s attr() method:

var currentId = $('#element').attr('id');

But this is fairly useless, because it requires you to already know the ID of the element that you want. Usually you’ll want to find out the ID if you don’t already know it — given a jQuery ‘this‘ object:

var currentId = $(this).attr('id');

This will only work provided that you have a valid jQuery object $(this) that you are working with, eg:

$(document).ready(function() {
  $('input.text').focus(function() {
    $('input.text').removeClass('onFocus'); /* remove focus state from all input elements */
    $(this).addClass('onFocus'); /* add focus state to currently clicked element */
    var currentId = $(this).attr('id');
  });
};

Using the code above, you will now know the ID of the currently focused input element. This can come in handy later on if you want to perform further actions on the element.

—————-
Now playing: Amon Tobin – Precursor (feat. Quadraceptor)
via FoxyTunes