Setting command prompt start directory for administrator in windows (7)

I bought a new computer, pretty cheap, pretty good. So I’m pretty happy with it. Its one weak point is that its 3D graphics card (which I do need) has no decent driver support under linux yet. So a good reason to leave windows 7 on it for a while, and find out how it works. I do miss linux, but I have no major complaints so far.
Something I brought over from linux, is wanting to use the command line, and I really needed it for playing around with Django. I guess the command line in windows is not really the same as in linux, and it doesn’t work as smoothly, but there is one. What I do hate, however, is typing in directory paths using the – for my finger less conveniently placed – “\”. So I wanted to start the command prompt in my Django directory. If you create a shortcut to the command prompt, you can set a directory where it has to start. If you run it as administrator, however, it still starts up in the system folder. Windows wouldn’t be Windows however, if there wasn’t a registry setting for this:
(start the registry editor with regedit in the start menu)
add to HKEY_CURRENT_USER\Software\Microsoft\Command Processor a new string value “Autorun” (if it’s not there yet) and set its value to “CD /d ” (E.g. CD /d C:\Users\User\Desktop)
And that works when you open cmd as administrator too…
(BEWARE, messing with windows registry can cripple your windows installation, so be careful and backup)

Drupal 6: adding and modifying html using javascript

A while ago, I had a simple website, with a simple js script for calculating a price based on some user input. The script uses an updater function that, after all required choices have been made (radio buttons), calculates the final price and shows the price. It does this by adding html to a predefined ‘price div’ (price.innerHTML = “…”) and setting it’s height from 0 to ‘auto’. Nothing fancy, but worked quite nice.
Upon changing the website for a Drupal site, I was confronted with implementing the js within Drupal. And even though it wasn’t really hard, it took me a while to figure it out, so I thought I’d share my findings, hoping they would be useful to somebody.

First of all, I created a normal page within Drupal. The downside of the method (to some people) is that I had to enable PHP for the page input. But as I am the only person ever seeing an input form on this particular site, I didn’t care too much. For adding the required js (and some extra css for that page), I used:

drupal_add_js(’sites/all/js/prices.js’); drupal_add_js(’sites/all/js/updater.js’);
drupal_set_html_head(‘<script type=”text/javascript”>
window.onload = function() {
includePrices();
};
');
drupal_add_css(path_to_theme().'/prices.css', 'theme', 'all', TRUE);
$styles = drupal_get_css();

And then I added an html form which calls the updater function on each click. This makes it possible to have the second choice customers have to make depend on the first choice they make.

<div onclick="update();" id="priceform">
<div onclick="update();" id="house_type">
<form id="typeform">
Type house:
<input type="radio" value="1" ...
</form>
...

Works like a charm for me...

Vpnc under Ubuntu: Connection established, but not being used

Working from home, the need for a proper vpn connection with my university got quite important to me. I had installed and configured vpnc earlier, but I couldn’t get any further then establishing a connection. Once the connection was made, I still couldn’t get on university-only sites or make use of certain services. So I thought I’d try to find out what was wrong. Turns out that there’s a standard setting that makes the VPN not being used for all network traffic. You can turn it of by going to the VPN settings (“configure VPN” and select the VPN connection, click “edit”), go the “IPv4 settings” tab, click on “Routes…” and uncheck “Use this connection only for resources on its network”. That trick did it for me.

Don’t really know whether it’s vpnc or network-manager-vpnc that is to be blamed for the standard settings.
My versions: Ununtu 9.10, vpnc 0.5.3-1 and network- manager-vpnc 0.8~a~git.20091008(…)-0ubuntu1