Dogpile on RIM

RIM caved to pressure from Saudi Arabia and will be installing servers there that can be monitored by Saudi authorities. Now, India has given RIM until August 31 to make a similar concession or have service suspended. I’m sure RIM will capitulate in order to stay in business. This is an unhappy precedent.

India is apparently also threatening to shut down Google and Skype messaging services unless the Indian government has the ability to intercept and monitor traffic.

Clearly, we need ubiquitous, secure and easy-to-use peer-to-peer cryptography so that governments have no central actors to put pressure on. Maybe the solution is OpenPGP but it needs to be much easier for people to use.

Advertisements

Death of Google Wave is a Wakeup Call About Cloud Service Risk

Google recently announced that it is shutting down its Wave service.

…Wave has not seen the user adoption we would have liked. We don’t plan to continue developing Wave as a standalone product, but we will maintain the site at least through the end of the year…

This is interesting because it is the latest in a series of dying Web 2.0 services. Some of these, like lala, were shut down as a part of an acquisition. But Wave is different. It was backed by the Great Google and it had more than a million users who are unhappy to have this collaboration service yanked out from under them.

In the past, if a company stopped publishing a software title it didn’t immediately disappear from your computer. Cloud service are different. The death of Wave is a wakeup call that cloud services are fundamentally different than installed software because the cloud can go away.

Google has decided that Wave isn’t the future, so it’s going to go away. If you like Wave and think it’s great, you’re out of luck. You can’t keep running it, Google says it goes, so it’s gone. This is sort of scary. Welcome to vendor lock in 2.0.

This is probably going to happen to other things. I’m not sure which ones, but if you think things like Twitter, Facebook, and Gmail are never going to change, you are sadly mistaken.

How much should anyone depend on a cloud service? What’s the backup plan if your service gets shut down?

Why is Skype Using the Wrong Audio Device?

I’ve been trying to figure out what is causing my audio to whack out and go crackly intermittently. Now I’m hyper-sensitized to anything making pops and crackles on my late 2009 MacBook Pro 15” running Windows 7 x64 with Boot Camp 3.1.

One thing I noticed is that the pops seem to always start with the incoming IM noise emitted by Skype. Another thing I noticed was that the pop seemed to be first coming from my 24” Cinematic Display. To simplify the number of things going on, I disabled the Cinematic Display (aka "Apple USB audio device”) and “Digital Audio (S/PDIF)” playback audio devices in mmsys.cpl because I’m not using them. (I’ve gone many hours without any pops and crackles after disabling these two devices but I’m not ready to say the problem is solved.)

What I just noticed is that the incoming IM ping sound was coming very much from my right speaker and it was really loud. Then I realized it wasn’t coming from the right desktop speaker at all. It was coming from my laptop. All of my other sound is coming out of my Klipsch speakers via the “headphones” minijack. Nothing should be coming out of the laptop speakers which aren’t the current default playback device. It shouldn’t be doing that.

The Volume Mixer shows that Skype is the only thing using the built-in speakers. These screenshots were taken nearly simultaneously without making any system changes. I just changed the selected device in the Volume Mixer.

skype-using-interanleverything-else-using-default

All of the Skype incidental notifications are coming out of my laptop but voice calls are playing out of the configured default playback device, which is my desktop speakers. Very weird. This reminds me that when we first got the MacBooks it was just as Snow Leopard was released and we had the drivers in Boot Camp 3.0. Skype could not hear anything with the built-in microphone even though the built-in microphone was working as demonstrated by Sound Recorder.

I have a suspicion that Skype is doing something low-level and inadvisable with the audio devices.

For the record, according to Skype’s own settings dialogs, it should not be using the laptop built-in speakers.

skype-audio-config

Mystery Solved!

The notifications show up on whatever speaker is defined in Options | Audio Settings | Ringing. By default that is set to “Ring on all devices”. Changing it to Use selected speaker removes the weirdness of ringing coming out of the laptop speakers while using headphones.

Command Prompt and PowerShell Here with Console.exe

command-hereIn antediluvian turn of the century days, there was an Open Command Window Here PowerToy. When Vista was released, this functionality was baked in to the default Explorer shell. Hold {SHIFT} and right-click on a drive, directory or the background of a directory and you will have an “Open command window here” option in the resulting context menu. Although PowerShell is installed by default on Windows 7, there is no parallel “Open PowerShell window here” option, but it can be easily added.

“Open PowerShell window here”

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

[HKEY_CLASSES_ROOT\Drive\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Drive\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

Use Console.exe Windows

If you use command-line a lot in Windows, you will appreciate the advantages of using console.sf.net as the terminal window. The “Open … window here” context menus can be tweaked to open the new command prompts in Console rather than vanilla Windows CSRSS console windows.

"Open command window here” with Console

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\""

[HKEY_CLASSES_ROOT\Drive\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\""

“Open PowerShell window here” with Console

 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\""

[HKEY_CLASSES_ROOT\Drive\shell\powershell]
@="Open PowerShell window here"
"Extended"=""
[HKEY_CLASSES_ROOT\Drive\shell\powershell\command]
@="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\""

 

 

Restore Defaults

For PowerShell, remove the powershell keys from beneath HKCR\Directory\shell, HKCR\Directory\Background\shell and HKCR\Drive\shell.

“Open command window here” restore default

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Drive\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

The Stack is an Implementation Detail

c-sharpI have a confession. When .NET and C# beta came out in 1999, I was confused by the definition of struct as a “value type” allocated on the stack and class as a “reference type” allocated on the heap. We were told structs are lean and fast while classes are heavy and slow. I distinctly recall searching for every imaginable opportunity to use the struct keyword. I further recall being confused by the statement that everything in C# is passed by value and by the ref and out keywords. I used ref whenever I wanted to modify values in a formal parameter regardless of whether they were structs or classes. What I didn’t realize at the time was that ref and out are really just an explicit use of a pointer. Ref and provide a mechanism to manipulate a value type by pointer instead of manipulating a local copy. For reference types, though, using ref and out is the moral equivalent of using a pointer-to-pointer in C and it is rarely necessary or correct.

Eric Lippert has a could of blog posts about how the stack is an implementation detail and not really the point of value types at all. He flat-out stays that the guidance about stacks and heaps is useless and confusing. The point of value types is that they are always copied by value rather than just having another variable point (refer) to the same memory as with a reference type. They just happen to be placed on the stack because they can.

Along the way he explains why you can’t capture a ref value type in a closure.

Something like su(1) for PowerShell and Console

If you have your day-to-day account configured as a limited user and not a member of the Administrators group, you have to elevate to switch users or use the runas service to do some system configuration tasks. If you already have a shell open anyway, the runas comand-line is probably what you want, but the syntax of the command is a little verbose. I have a basic su-like su for PowerShell that opens a new PowerShell session in a new Console window running with the credentials you gave to su. By default it tries to log you in as the built-in administrator account (which is disabled by default on Windows Vista/7).

su.ps1

#emulate UNIX su behavior
#start a new powershell instance with a different user account context

param( [string] $username )

function Substitute-User( [String] $username )
{
	if( !$username )
	{
		#look up the built-in Administrator account using WMI. 
		#the built-in administrator has a SID that starts with S-1-5 and ends with -500.
		$accts = get-wmiobject win32_useraccount
		foreach( $acct in $accts )
		{	
			if( $acct.SID -match '^S-1-5-.+-500$' )
			{ 
				$username = $acct.Caption
				if( $username -match "[^\\]+$" )
				{	
					$username = $matches[0] 
				}
				break
			} 
		}
	}
	$credential = Get-ConsoleCredential( $username )
	$startinfo = new-object Diagnostics.ProcessStartInfo
	$startinfo.UseShellExecute = $false
	$startinfo.FileName = "$env:programfiles\Console2\Console.exe"
	$startinfo.UserName = $credential.UserName
	$startinfo.Password = $credential.Password
	$startinfo.Arguments = "-r $pshome\powershell.exe -d `"$pwd`""
	$startinfo.WorkingDirectory = $pwd

	trap [ComponentModel.Win32Exception]
	{
		if( $_.Exception.NativeErrorCode -eq 267 )
		{
			write-host "$pwd is an invalid directory for $username."
			write-host "Starting PowerShell in ${env:SystemRoot}\system32."
			$startinfo.Arguments = "-r $pshome\powershell.exe -d ${env:SystemRoot}\system32"
			$startinfo.WorkingDirectory = "${env:SystemRoot}\system32"
			$null = [Diagnostics.Process]::Start( $startinfo )
		}
		else 
		{	
			$_.Exception.Message
		}
		continue
	}
	$null = [Diagnostics.Process]::Start( $startinfo )
}

#Generate a PSCredential object without creating a pop-up security dialog like 
#the built-in get-credential cmdlet.
function Get-ConsoleCredential( [String] $username=$( read-host 'Username' ) )
{
	while( !($username) )	
	{
		$username = read-host 'Username'
	}
	$passwd = read-host -asSecureString 'Password'
	new-object Management.Automation.PSCredential $username, $passwd
}

Substitute-User $username

Boot Camp: Dated Broadcom Driver Causes Audio Pops and Crackles

broadcom-disable-802-11aI have had a problem with my MacBook Pro having intermittent crackles and pops in the audio in my late 2009 Macbook Pro Unibody. I previously suspected the Cirrus Audio driver.  Restarting “Windows Audio” (aka audiosrv) fixes the problem. The pattern is that everything is fine on boot. The crackles and pops start after resuming from sleep.

I just came across this post which indicates the problem is actually caused somehow by the the 802.11a feature of the Broadcom wireless network adapter. Somewhat incredulously, I gave this a try and it works so far.

It also seems that although, Apple has not seen fit to send out an update, Broadcom has published several newer versions of their 943XX driver. These are available from other OEMs using Broadcom chips (Acer, Dell and HP) that actually provide updates for Windows drivers on a regular basis. HP helpfully offers a version of the Broadcom Wireless driver that is almost a year newer than the one in Boot Camp 3.1. The revision history of here shows notes a series of performance enhancements over the Apple-distributed version 5.60.18.8.

Update

Some good folks have taken it upon themselves to scrape together Broadcom wireless driver downloads posted by various OEMs. Note that sometimes the stuff in the forums is newer than what is listed in the pinned initial post. At the time of this writing, the latest available is 5.100.249.2 from Acer.

Update 2

I’m still getting the intermittent pops and crackles. Perhaps I have unfairly maligned the Broadcom driver based on random info from the interwebs. I just realized that the speakers on my Cinematic Display are running at the same time as my nice speakers on the mini-jack. Maybe that has something to do with it. Still futzing.

%d bloggers like this: