tim laqua dot com Thoughts and Code from Tim Laqua

28Nov/0819

BlackBerry Storm (9530) Error: SIM Card Rejected

This error pops up when you lose CDMA (1XEV) connectivity in the US and the phone attempts to connect to a GSM network (you can duplicate if you force your Storm to GSM network technology) and you have a Global SIM card installed (and most of us do). The kicker is that the message "SIM Card Rejected" doesn't go away until your hard reboot - even after you've reconnected to the CDMA network.

So, if you're not using your Global SIM (if you are, call VZW and ask for Global Support - they can activate your SIM), you can just force CDMA only on the phone, do a battery pull, and you'll never see this again. I assume some future firmware update will handle this error better by making it go away once you're back on CDMA, but for now - this is what I had to do:

26Nov/0811

Monitoring, Starting, and Stopping Perfmon Performance Counter Logs using VBScript

Performance counters are great - unless they're not running. 😉 So this script illustrates one approach to monitoring the Performance Counter Logs on a given machine, starting them when they stop (for whatever reason) and letting someone know about it.

UPDATE For 2008+ Data Collector Sets: Monitoring and Starting Data Collector Sets with Powershell

I check the registry to determine the current state of a counter log, and use the logman command line utility to start the log when needed. Logman can also tell you the state of the counters, but it's crazy slow. I've been unable to locate a way to do all of this using WMI and the interweb has been less helpful than usual on this issue. So here's my solution:

16Nov/081

Installing ASTrace.exe in a 64-bit environment

ASTrace.exe is part of the SQL Server Analysis Services Community Samples on CodePlex. This utility works just fine in a 32-bit environment, however some of the assemblies needed to interact with Analysis Services do not have 64-bit counterparts - thus, you have to use WOW64 to get the service to work properly on a x64 machine.

ASTrace can be downloaded here:
http://www.codeplex.com/SQLSrvAnalysisSrvcs/Release/ProjectReleases.aspx?ReleaseId=13572

32-bit Installation Instructions can be found here:

http://msdn.microsoft.com/en-us/library/bb283156(SQL.90).aspx

And to get it to work on x64, you need to do two things differently:

  • Target x86 processors when you build the application - this way, your 64-bit OS will use WOW64 when the service runs (Project > ASTrace Properties... > Build Tab).

  • Create the following registry key and string value pointing to where you copied the ASTrace files:
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ASTrace]
    "path"="C:\\ASTrace"
5Nov/080

How to add a calculated measure (calculated field) to an Excel 2007 PivotTable with a SSAS data source

As it turns out, you can do it programatically as explained by Allan Folting here:
Microsoft Excel: Common Questions Around Excel 2007 OLAP PivotTables:
http://blogs.msdn.com/excel/archive/2008/02/05/common-questions-around-excel-2007-OLAP-PivotTables.aspx

And the parts that I have to keep looking up (I use my blog as a notebook for things I don't want to forget ;-):

Sub AddCalculatedMeasure() 
	Dim pvt As PivotTable
	Dim strName As String
	Dim strFormula As String 
 
	Set pvt = Sheet1.PivotTables("PivotTable1")
	strName = "[Measures].[Internet Sales Amount 25 %]"
	strFormula = "[Measures].[Internet Sales Amount]*1.25"
	pvt.CalculatedMembers.Add Name:=strName, Formula:=strFormula, Type:=xlCalculatedMember 
End Sub 
 
Sub AddCalculatedMember() 
	Dim pvt As PivotTable
	Dim strName As String
	Dim strFormula As String 
 
	Set pvt = Sheet1.PivotTables("PivotTable1")
	strName = "[Product].[Product Categories].[Bikes].[Mountain Bikes].[Mountain-100 Silver, 38 25 %]"
	strFormula = "[Product].[Product Categories].[Bikes].[Mountain Bikes].[Mountain-100 Silver, 38]*1.25"
	pvt.CalculatedMembers.Add Name:=strName, Formula:=strFormula, Type:=xlCalculatedMember
	pvt.ViewCalculatedMembers = True 
End Sub 
 
Sub AddNamedSet() 
	Dim pvt As PivotTable
	Dim strName As String
	Dim strFormula As String
	Dim cbf As CubeField 
 
	Set pvt = Sheet1.PivotTables("PivotTable1")
	strName = "[My Mountain Bikes]"
	strFormula = "[Product].[Product Categories].[Bikes].[Mountain Bikes].children"
	pvt.CalculatedMembers.Add Name:=strName, Formula:=strFormula, Type:=xlCalculatedSet
	Set cbf = pvt.CubeFields.AddSet(Name:="[My Mountain Bikes]", Caption:="Mountain Bikes") 
End Sub

He also mentions that you can expose these members to Excel Services 2007 by creating the new objects and then removing the VBA code - very useful article.