Friday, April 23, 2010

Opening Visio 2007 docs in Individual Windows

I repeatedly disagree with Microsoft UI designers. Ok, they think it's nice that Visio treats many diagrams with a single instance. That I can live with. But shouldn't they enable the user to quick swap between them, maybe by using tabs, etc.?

Anyway, Visio is actually a great tool, so I'm not ready to ditch it just yet. Not surprisingly, there's a way to make sure Visio opens a new instance every time you open a new file, which results in a taskbar item for each document, which essentially mimics the effect that I desire, because it enables the user to quickly see whichs  files are open. Not surprisingly as well, the method it's obscure, requiring some tweaking with Windows registry:
  1. Open Visio and go to Tools->Options, select the Advanced tab and check "Put all settings in the Windows Registry".
  2. Open regedit by typing regedit in the Windows->Run interface.
  3. Make a registry backup by selecting the upper node in the tree on the left panel, and selecting File->Export. Make sure to add a date to the file, so that you now how long it was since the backup was made.
  4. Navigate the left tree to HKEY_CURRENT_USER/Software/Microsoft/Office/12.0/Visio/Application.¹
  5. On the right panel, find the "SingleInstanceFileOpen" value. Double click it, and change it's data from "1" to "0".
Just one thing. This will increase memory usage by Visio, since each document now has to run a full application.

¹ - This applies to the 2007 version of Visio. Other versions might store the value somewhere else, so if you are running something different, try Edit->Search and look for SingleInstanceFileOpen, but make sure this is a Visio value.

Monday, April 19, 2010

What Every Computer Scientist Should Know About Floating-Point Arithmetic

Nice article about float points. Too bad the reading is complex and slow, but I recommend it to every programmer out there.

Friday, March 26, 2010

Enabling ICS

I'm on fire this week. Another small help for our everyday use that I decided to post here since it took me quite a while to find it on the net.

I was trying to enable ICS (Internet Connection Sharing) on Windows Vista and always got this error message:

"An error occurred while Internet Connection Sharing was being enabled.
(null)"

Well, I Googled it and found this post which gave the solution, which is to enable the following services:

  • Application Layer Gateway Service
  • Network Connections
  • Network Location Awareness (NLA)
  • Plug And Play
  • Remote Access Auto Connection Manager
  • Remote Access Connection Manager
  • Remote Procedure Call (RPC)
  • Telephony
  • Windows Firewall

In my case, the Windows Firewall was the culprit. It's not ideal to have to have Windows Firewall running just to enable ICS, because I already have Symantec Firewall protecting me, so I hope Microsoft correct this sometime in the future.

Tuesday, March 23, 2010

Google in China

All this stuff about Google standing up to China's government, Chinese hackers et cetera has left only one question in my mind: why Google's front page is different in China?

What happened to File Assossiaction under Vista, Seven?

Back to my help-you-do-it articles...

One thing bothered me for a while: our dear Microsoft removed the file associations item that was under the Tools Menu.What the hell? I never quite understood why MS does that sometimes. Information Architecture is very important, and regrouping items might make things better for the user. However, those grouping and organizations should reflect what the user (us!) believes to be the right way to sort the information.

I mean, when asked the question, "where is the right place to put <something>?", the answer is usually "where most users think it will be!". So Microsoft, where do *you* think your users look for file associations? Where it has been for more than a decade, under the Tools menu!

When I was looking for it, to fix an association that another badly planned application decided to break, I immediately went to the Folder Options, under the Tools Menu and looked for the association, which was no longer there.

Before I panicked I decided to Google it, and found out that the associations are now under a specific application called Default Programs, under the Control Panel.

The Default Programs application is a more user-friendly version of the old File Associations tab. It lets the user change the default program that will open an file (based on the extension, as it's the custom in Windows), change the association between file extensions and programs, set the autoplay defaults, and even use a profile-like thing to rapid switch configurations for associations (which is done in order to enable the user to quick return to a Microsoft setting, of course).


So far, so good. If you need to reconfigure your file associations, you should look at this wizard.

HOWEVER, where is the "advanced" button? None. Microsoft thinks all of us, users (even those with a Enterprise Version of Windows Vista) are dumb. So there's no way to change how the application is executed, like, for example, which parameters would be provided when calling a program to open a certain file. in my case, I was simply trying to tell windows that Java jar files are opened by calling java -jar JARFILE.

Well, enough complaining. How do we do it? There are two shell utilities, ASSOC and FTYPE, that enables us to do it. If changing the place of the interfaces was a bit unfortunate, I must say that the new solution is way better. ASSOC and FTYPE lets us create a N to N association between file types and extensions, and it's much more clean than the way it worked with the old interface.

You must take two steps in any order when defining the associations:

Define the File Type
A file type is a kind of "profile" for your file (I think file class would be an even better name). You name it anything you'd like and informs how it's opened. On my Java JAR example:

FTYPE jarfile="C:\aplic\Java\jre6\bin\javaw.exe" -jar "%1" %*

where %1 is the filename that Windows will gladly pass to your application and %* tells windows to "pass everything else to the program the way you received it". The last one doesn't make much sense in Windows, but the truth is that the shell will also use this list to open files, so if you simply type the filename on the prompt, you end up opening the file.

Create the Association
Now, for the association itself,

ASSOC .jar=jarfile

which is quite intuitive: you tell Windows to threat files with .jar extension as jarfiles.