Vista quirks

Sunday, February 24th, 2008

Since I bought a laptop with Vista Home Premium preinstalled, I’m now a happy owner of Microsoft’s newest and finest. I must say, over all I think they’ve done a great job with this OS, it feels solid and polished. While tweaking around, I find some of the things work differently (not necessarily worse), and some things have changed so that I need help to get them done for the first time. I thought I’d share with you the links that I have found most useful:

  • Howto enable ICMP pings? While using WLAN, most networks require you to respond to ping in certain intervals, otherwise they cut the connection and require you to re-authorize. Here’s how to enable ICMP echo requests (and almost anything else in Vista firewall).
  • Say you need to start a program everytime Windows starts. You can no longer just put in the Start-folder and be done, because UAC requires you to authorize the program if it needs administration privileges. Here’s how to run those programs properly at logon (and set up other scheduled tasks).
  • My new computer came with HD partitioned in two and Vista preinstalled. I wanted to merge those two partitions, but thought It would require me to reinstall the OS. Well, it doesn’t thanks to Vista Disk Management that let’s you delete, shrink and extend the partitions on the fly! This also means, that you can shrink your Windows partition to make room for, say, Linux, all without the use of third-party (sometimes unreliable) programs.

While reading the forums, some people seem to be doing stuff like disabling UAC while getting used to the new OS. “Why is this OS bugging me with these authorizations? Just do it!” I think it’s great Microsoft has decided to bring the security concepts found from other more technically oriented OS’s to end user OS like Windows Home, and kindly advice people how to get used to them and how to work with them. There’s a ton of great features out there in Vista, that I appreciate. Take a time to learn them and you’ll find you computing to get more safe and proficient.

Custom Wordpress rewrites

Sunday, December 23rd, 2007

Wordpress is a wonderful blogging/CMS software. One of the great things about it is, that it creates nice search engine friendly URLs for you automatically. This is accomplished by redirecting all the page requests to Wordpress, that does some rewrite magic on the PHP side.

Let’s say you have created a WP plugin, that extends WP functionality with some special page (which I won’t go into here now). You use WP hooks to integrate the pages into normal WP template construction routine, and monitor request URI for GET variables. Now, suppose you also want to have a nice clean search engine friendly URL for your special page.

So, you are monitoring for page requests like this coming in:

http://www.yourwpsite.com/?special=somevariable

And you would like your user to be able to access the same functionality like this:

http://www.yourwpsite.com/special/somevariable

Let’s set up a rewrite of our own. In your WP top level folder is a .htaccess file and there’s a rewrite rule created by WP:

RewriteRule . index.php [L]

Change that to this:

RewriteRule !^special /index.php [L]
RewriteRule ^special(\/?)([^/.]*)/?$ /?special=$2 [C]

Let’s go through what is going on here. The first rule is saying:

“If user is not (!) requesting our special page, rewrite the request to index.php as normal and don’t process any more rewriterules ([L]).”

Now, the request for the special page doesn’t pass the first test, and goes on to the second rule, which says:

“If the requested page starts (^) with “special”, is possibly followed by “/” ((\/?)) and some query string that doesn’t include “/” (([^/.]*)) and possibly ends with “/” (/?$), rewrite URL to “/?special=querystring” AND continue executing rewrite rules ([C]).”

Now, it loops back to beginning to search for more rewrites, and finds the first rule, which now matches, and the request URL is rewritten to /index.php with all the GET parameters still intact for your plugin hooks to process.

That’s all for now.

Howto copy Windows installation

Wednesday, April 11th, 2007

I recently was able to save my Windows installation from failing hard drive to a new one by copying it. This method is simple, and might save you a trouble from doing it yourself, in case you’re thinking about using for example Gnu’s dd program (some say it will not work). So:

  1. Install the new hard disk.
  2. Download your copy of Acronis Migrate Easy Trial edition.
  3. Answer a few questions, like source drive and destination drive (doh). If your new drive is larger than the old one, no problem; Migrate Easy is able to expand the old partition to fill the new drive.

MBR is also copied from old drive to new one. Set your new drive to be the first drive to boot from via BIOS, and you’re done!

Howto: Safe portable browsing

Thursday, January 18th, 2007

Two of the applications I use most are Portable Firefox and Nutty. Portable Firefox is a portable version of the popular web browser, and Nutty is an SSH client (modified Putty).

When I’m traveling, I am often using those apps from my memorystick that is plugged into a computer that I can’t trust, over a network I can’t trust. I cannot be sure whether someone is monitoring my browsing or not. With these steps, you can create an encrypted tunnel between the computer you’re using, and your home server. All the traffic goes through that tunnel, and you appear to be browsing from your home computer. Plus, you browse through proxy that does ad filtering (amongst other things).

You need to download Portable Firefox and Nutty into your memory stick. You also need a (Linux) server where you can install software and connect using SSH.

Step 1: Set up Privoxy

First, we are going to set up a proxy on the home server. On Ubuntu Linux, you can find it on repository and install it like this:

apt-get install privoxy

You can propably install it as easily on other Linux distributions as well using their package managers. Next, edit the configuration file /etc/privoxy/config with your editor of choice, and find part ‘4.1. listen address’. Set up listen address something like:

listen-address localhost:8118

Tip: If you want to play around with proxy settings later, find section ‘4.4 enable-edit-actions’, and uncomment line

enable-edit-actions 1

Step 2: Set up Nutty

Nutty SSH tunnel settingsFire up Nutty, and go into Connection -> SSH -> Tunnels. Add new forwarded port with these values: Source port: 12345, Destination: localhost: 8118 and press ‘Add’. Now go into the session screen, and open an SSH connection into your home server. You need to log in for the tunnel to be created.

Step 3: Set up Firefox

Firefox proxy settingsOk, so you’re ready to start Firefox. Go to Tools -> Options (this is for Windows version of the Firefox), select ‘Advanced’, and click on the ‘Network’ tab and push ‘Settings’. Now select ‘Manual proxy configuration’ and type these values: HTTP Proxy: localhost, Port: 12345.

Done! Now you’re surfing through SSH tunnel using proxy that protects your privacy, manages cookies, controls access, and removes ads, banners, pop-ups and other obnoxious Internet junk. You can be more safe that your browsing activities is not logged and your retain your privacy where ever you are.

If you want, you can also install Quickproxy Firefox Add-on for easy one click access to switch between tunneled connection, and direct connection if you should need one.