Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Thursday, July 3, 2008

Killing programs on Windows shutdown

My Windows computer at the office takes quite some time to restart... so, whenever there's an update or such that requires a restart, I wait for a moment that I'm away from the computer to do so. Turns out that it's not that unusual to return to a dialog box stating that some program has failed to exit with a button to "click to end".

Fortunately there's a workaround for this not so smart behavior. Start regedit (*sigh*), go to HKEY_CURRENT_USER\Control Panel\Desktop and alter the key AutoEndTasks to the value 1.

PS: I'm not really sure if this works, because I'm always away when my computer reboots... but I haven't seen that message again!

Tuesday, April 1, 2008

Registry entry for Java Preferences

Java Preferences in Windows are stored in the registry entry:

HKLM\Software\Javasoft\Prefs\

and

HKCU\Software\Javasoft\Prefs\

There, now I don't have to dig this information on the net again!

Thursday, June 7, 2007

Printing to PDF

If you need to print something to PDF in windows, you can do it with doPDF. I know there's a lot of other software that does exactly the same thing, but this one got my attention because:
  1. It is small (about 1Mb)
  2. It is free (as in beer)
  3. It is easy to use...
  4. ...but has advanced features for when you need them
In about 5 minutes (including download and installation) I had just what I wanted: a Word document printed in PDF, page size A4, 150 dpi's. Cool!

Sunday, May 27, 2007

VPN in Ubuntu

After my previous attempt at creating a VPN in Ubuntu I reverted all my work because I was rather unhappy with the results. After digging a bit more I found out I could actually use pptpconfig, as long as I didn't actually clicked the "Start" button. Here's the trick:

Start by installing pptpconfig. Add the following to your /etc/apt/sources.list file:

# James Cameron's PPTP GUI packaging
deb http://quozl.netrek.org/pptp/pptpconfig ./

Then install the app:

sudo apt-get update
sudo apt-get install pptpconfig

Now run it (sudo pptpconfig) and configure your VPN. In the "Routing" options, select "Client to LAN". Lets assume you called your new configuration MyVPN.

You can close pptpconfig. Go over to /etc/ppp/ip-up.d/ and create a new file called vpnroute (sudo gedit vpnroute). Assuming that the network you want to connect to uses IPs like 192.168.0.*, add this to the file:
#!/bin/sh
if [ "${PPP_IPPARAM}" = "MyVPN" ]; then
route add -net 192.168.0.0 netmask 255.255.255.0 dev ppp0
fi
Don't forget to make it executable, or it won't work:

chmod a+x vpnroute

And that's it. To start your VPN run:

sudo pon MyVPN

To stop it run:

sudo poff MyVPN

VPN in Ubuntu using Network Manager

UPDATE: I found a better way to connect to a VPN. Check this post.

Imagine you have a Windows Network at work and you're stuck at home waiting for the plummer to fix the sink. No problem, just connect via VPN to your workplace, launch a Remote Desktop and in no time you're working in that piece of code you must deliver yesterday. Being this such a useful and common scenario, how come it is so hard to set up in Ubuntu?

Here's how I managed to connect to my workplace via VPN using Ubuntu. Let me say upfront that I'm not particularly happy with the result, and I'll try to do it some other way in the near future. But if you're desperate this will do. This is not an How To, but rather a step by step description of the tries and failures. Maybe it can help someone that finds the same error messages I've encountered. Well, here goes:

First I tried pptpconfig. Everything seemed to be properly configured, but all I got was the error message:

Cannot determine ethernet address for proxy ARP (Update: Actually this is not a problem. Just add noproxyarp to the pppd parameters.)

So I decided to install the Network Manager PPTP package:

sudo apt-get install network-manager-pptp

And restarted everything that depended on the package:

sudo /etc/dbus-1/event.d/25NetworkManager restart
sudo /etc/dbus-1/event.d/26NetworkManagerDispatcher restart
killall gnome-panel
nm-applet &

The killall and nm-applet commands are there to restart the Network Manager icon on your gnome panel. If for some reason the Network Manager icon does not appear (happened to me) just execute:

sudo /etc/dbus-1/event.d/25NetworkManager start
killall gnome-panel
nm-applet &

If you click the Network Manager icon now, you should have a "VPN Connections" entry. Just configure your own VPN connection and it should appear in the list of VPNs. Click it. If it works, you're in luck. If it doesn't, keep reading.

To keep an eye on what's going on with the VPN connection, just tail syslog:

sudo tail -f /var/log/syslog

That's how I found this error message:

(...) no currently active network device, won't activate VPN.

I googled for a while and found that if you want to use Network Manager to take care of your VPN, you cannot have a Wireless Connection manually configured. Oh boy... So I opened the manual configuration, saved my current configuration and in the properties of the Wireless connection ticked the box "Enable roaming mode". Because I have a somewhat odd configuration of routers at home, I also had to reconfigure all the routers, but I won't bother you with that.

My main problem with the roaming mode is that it stores the WEP password in the keyring. That's all fine and safe, but it means that when I login, besides having to enter my username and password I also have to put my keyring password! Very annoying!

On with the show. Connect VPN. More mysterious errors in syslog:

LCP terminated by peer (+ bunch of characters blogger won't let my type)

This is a funny one! First because it was a bit lost in the middle of a bunch of error messages. Second because, at least to me, it means absolutely nothing! Using a bit of intuition I thought it might be an authentication problem, so I just ticked all the boxes in the "Authentication" tab in the VPN configuration dialog and... it worked! I have a VPN connection to my workplace!

Just for wrap up, here's what I didn't like about all this:
  1. It's a lot of work for something so common.
  2. Because the WEP is in the keyring I must enter the keyring password each time I login.
  3. I must use roaming for my wireless connection. This means the router must do the configuration, and my routers suck at that.
  4. PPTP logs are there for the people who know the code or the protocol by heart.
  5. I'll probably just revert to my old configuration and try a new way of connecting via VPN.I got back to my old configuration and managed to configure the VPN in a different way.

Saturday, May 12, 2007

Sandboxie

Are you looking for the best free text editor? Looking for the best wma to mp3 converter? It is quite easy to find free software to do these tasks, the problem is that after you install and test them all, your Windows installation is suddenly filled with registry entries and software you really don't want!

A while a go while browsing LifeHacker I read an article about a software that promised to end these troubles: Sandboxie. So I gave it a try.

I had some wma files to convert to MP3 files and found this free converter, so I installed Sandboxie and run the installer of the software. Everything went OK and the software was installed. I then run the free converter inside the Sandboxie and converted the files. Sure enough the converted files only appeared in the special folder selected by Sandboxie to be the sandbox.

I copied the MP3 files to a real folder on disk, turned off and cleared the contentes of the sandbox. And my Windows installation was exactly what it was before I installed the converter!

I only wished I knew about this software before testing 14 different text editors and totally trashing my Windows installation.

Tuesday, February 6, 2007

Registry Tips

Here's some tricks you can use to make the Windows Registry work for you:

Add a command to the context menu

Add a key to the HKEY_CLASSES_ROOT\[EXTENSION]\shell with the name of the application you'll be using (e.g. SourceEdit). In the default value, insert the name you want to appear in the context menu (e.g. "SourceEdit").

Inside the currently created key, add another key called "command". In the default value of the command key, add the command that will be invoked (e.g. "c:\Program Files\Source Edit\SrcEdit.exe" %1).

Note: [EXTENSION]can be "*" for all files.

Setting command completion in cmd

In the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor set the value of CompletionChar to 9.

Setting an application path to launch from the "run" window

In the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths create a new key with the name of the application you want to launch (e.g. ue.exe). Set the default entry to the application you REALLY want to launch (e.g. c:\Program Files\UltraEdit\uedit32.exe).

.reg Files

Adding an entry:

REGEDIT4

[HKEY_CURRENT_USER\DummyTree]
"ValueToBeRemoved"="Value"


Removing a tree:

REGEDIT4

[-HKEY_CURRENT_USER\DummyTree]


Remove an entry:

REGEDIT4

[HKEY_CURRENT_USER\DummyTree]
"ValueToBeRemoved"=-