Sunday, November 20, 2011

Taking Advantage of the Microsoft XPS "Virtual Printer" Even on Macs and iPADs

Symptom:

I was using an application and the result of which is only output via a Print interface. To make the matter worse, this was on a remote site so I could not print to my printer either. To make it even worse, I don't feel like adding any PDF printing driver to this machine as it belonged to a customer.

Fix:

I have been aware that Microsoft XPS driver is installed on just about any modern Microsoft OS machines, and it is even often annoying that it comes up as a default driver to my mothers-in-law PC and she cannot print to actual paper.

As it turns out, you can consider this XPS as the pre-installed "PDF" driver that works on Windows. And since .NET Framework 3.0 a "free" viewer comes "pre-installed"; all you need to do is to activate it! Like just about anything Microsoft (Apple) does, XPS is designed to kill  other company's product, in this case the PDF.

Whether XPS is superior to PDF or not, I don't care, I am not in printing business, but, this means that we can print at most computers without any physical printer, and take or email the XPS file back home and print at your leisure (or just view them to save the tree) or re-print them in PDF once you get it back on a PDF enabled computer.

To "install" or actually "activate" the XPS viewer, see this MS article. What is XPS Viwer

Other platform users do not need to dismay. You can try uploading the XPS file to your Google Docs account and view it online!

Note that the article is a bit obsolete, in systems with .NET framework 3.5 (probably) or later the XPS viewer enable is not within the .NET Framework feature but are listed in the top level list.


SQL Server 2008: Cannot Detach The Database

Symptom:

You have a dead file for a database that was active. For example, you have lost a disk drive or if you have lost file MDF file. Now you try to detach it from the SQL Server Management Studio, it won't let you do it.

Fix:

Try manually firing the query then

use master
drop database

The key above is that you are going to the master and not any other databases.


Saturday, November 19, 2011

Tortoise Git Tips: How To Use It Behind an HTTP Proxy

Problem:

You want to connect to the Git Server via HTTPS (say GitHub.com), but you are behind a proxy. You know the proxy information.

Fix:

Issue the following Git command from the Git Bash. In this example my proxy is at DaProxy... port 8123

config --global http.proxy http://DaProxy.myhospital.edu:8123




Monday, November 14, 2011

Where is The DLL for System.Windows.Media.Imaging Namespace?

Symptom:

You wanted to use classes from System.Windows.Media.Imaging Namespace, but there is no such class when you try to Add Reference from your Visual Studio.

Fix:

Add PresentationCore, which you should find under the .NET tab of Add Reference dialog box.


Monday, November 07, 2011

Bluetooth and/or WiFi Abruptly and Intermittently Goes Offline on Windows 7 Laptops

Recently I had a symptom in which Bluetooth and WiFi stops working temporarily. This is a problem for me because I often use RDP to connect to my laptop and it drops connections. Interestingly in my case, each time this happens the CPU fans go faster for a bit, so I suspected that this has something to do with the power.

As it turns out, both Bluetooth and WiFi network devices can shut itself down by default due to automatic power management controls.

This behavior can be disabled from the Device Manager (just type these words in at the Start menu) and go to each Bluetooth Radio and WiFi device properties. You will find the Power Management tab where you can configure this.

I just did it so I will update this will or will not work in a longer run.


Saturday, November 05, 2011

Windows SC.EXE Command Gotcha

Symptom:

You wanted to create/install a service using the SC.EXE command on Windows 2008 (XP as well) but it does not seem to work. It come back with the help message suggesting that you have had some errors.

sc create MyService binpath="c:\MyService\MyService.exe" type="own" start="auto"


This WILL result in errors and it won't tell you how you have errored.

Fix:

Fix your brains that it is not Unix that you are dealing with, since we cannot fix someone who designed it at Microsoft.


sc create MyService binpath= "c:\MyService\MyService.exe" type= "own" start= "auto"

Do you see the difference between the two?

There is a blank after each= sign.  Not an example of world-class coding.










Tuesday, November 01, 2011

How To Escape Textile Formatting

Problem

You want to write express on the text things like %TEMP%\My Directory\ on a Textile format (such as on Basecamp Writeboard) but The % character goes away.

Solution

Use the ==

==%Temp%== and the % will now appear in the text.