Tuesday, December 31, 2019

Macbook Pro GPU Problem Fix

This can't be good!
If your Macbook is giving you a white screen of death during boot up, you might want to try this procedure.  My 2012 Macbook was getting about 1/3 of the way through the boot process, blinks the screen, coughs, then starts over.

It turns out a major problem with older macs is the AMD GPU eats itself and prevents bootup.  You have two options: go to the Apple Store and pay big dollars for a new graphics card, or disable the GPU.

If you decide to disable the GPU, just know that 3D applications that normally use the GPU will be slow.  But for normal operations, your Mac will work fine.

Here is the procedure I successfully used:

Reset the SMC

Shutdown, unplug everything except power and hold
leftShift + Ctrl + Option + Power 
Hold this for 5 seconds

Reset NVRAM: Power up and hold

Command + Option + p + r
Until you hear the startup chime two times.

Shutdown computer

Power up and boot into Single User Recovery by holding

if you are on high sierra 10.13.6+ you might need to use Command + r instead
Command + r + s

On the screen that loads choose a language. Next, on the screen which appears next choose the following options in the menu Utilities -> Terminal (see below.)

In the terminal that comes up, type the following commands:

Disable SIP (This is slow)

csrutil disable

Disable Discrete GPU on boot by running

nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01



Boot into Single User-mode by holding

Command + s
It might look as if it hanged, but press enter and you should see the shell (root#)

Mount root partition writeable

/sbin/mount -uw /

Make a kext-backup directory

mkdir -p /System/Library/Extensions-off

Move ONLY ONE offending kext out of the way

mv /System/Library/Extensions/AMDRadeonX3000.kext  /System/Library/Extensions-off/

Inform the system to update its kextcache:

touch /System/Library/Extensions/


I hope this helps you get more life out of your Macbook.  Let me know if this worked.

Monday, November 4, 2019

Creating JSON in C# With Dynamic

I'm excited to share a new (to me) way of creating JSON on-the-fly.  It uses the dynamic type in C#, which I knew about, but hadn't used too much.  Now I see how powerful it really is.

I ran across a problem where I had to build a JSON string to send to a web service as a parameter.  It was short but nested several layers deep.  I also needed it to be highly configurable.  I could build it with a string, or better yet, a StringBuffer.  Or I could build an object, then serialize it to JSON.  The former seems fragile, the later feels like overkill (And, there is nothing worse than trying to decode what another programmer has done with a thousand little classes you have to hunt down.)

Enter the dynamic type.  I knew it was very late-binding, thus avoiding compile-time type checking.  It gets its type at run-time.  So, it infers the type when the program runs and is able to do this:

dynamic nVal = 23.4;
dynamic sVal = "Hello";
Console.WriteLine(nVal.GetType().ToString());   // System.Double
Console.WriteLine(sVal.GetType().ToString());   // System.String

However, a little talked about feature is that it is an object that can be a container too.  And it can contain different types including arrays and objects.  This sets us up to be able to nest JSON very nicely.  Check out this example:

dynamic message = new JObject();
product.to = "UserToken";
product.priority = 5;
product.notification = new JObject();
product.notification.message = "You have a new order.";
product.notification.sound = "default";


// Output JSON
    "to": "UserToken",
    "priority": 5,
    "notification": {
        "message": "You have a new order.",
        "sound": "default"

Hopefully, this will help you create simpler JSON data too.

Friday, September 20, 2019

Web Load Testing with Fiddler

If you have been in the web business long, you've got to love Fiddler.  There is so much packed into a little package.  It can save you hours of debugging -- if you know how to use it.

Here's a new load test feature (at least it's new to me.)  Basically, in the Results window, select any request or set of requests, then press CTRL-R.  This will bring up a dialog box asking for how many times you want to run the command.  Enter your test count, press OK and let the barrage begin!

While there isn't too much instrumentation, there is a fair amount.  If you select the Timeline tab you can get an idea of concurrent transfers.  And the Statistics tab gives you performance information.

I was recently performance testing a web server application.  I used this technique in conjunction with Perfmon and was able to get some deep statistics.

Try it out and let me know how it works!

Sunday, August 25, 2019

Setting the Default Terminal to zsh In VS Code

If you are like me, you've fallen in love with both VS Code and zsh.  VS Code has made my Angular and Ionic development much easier.  And if you are here, you know zsh is the most beautiful shell out there.  So, how do you mash them together?

It turns out it's pretty easy... much easier than it used to be.

Just fire-up any project in VS Code.  Then bring up the terminal window (Control ~).  Next, look for a dropdown that is on the right top of the terminal window.  If you click on that dropdown, you can select zsh and make it your default.

Happy coding.

Wednesday, January 16, 2019

Mac OS Mojave Dark Mode - Set Mail Background to White

This is an example bad-looking email.
I don't entirely hate the Mac OS Mojave Dark Mode.  It's kind of a cool, different view of our real estate.  I don't know that it was entirely worth the download, but at least my Mac isn't bothering me every day to upgrade.

Anyway, one problem I had was that email backgrounds were all dark.  This made reading emails super-tough when I got replies in dark text.  Emails never quite look right.  Well, there is a fix for it!

To return your Mac Mail emails to defaulting to white, follow these steps:
  1. First be in Dark Mode (Apple -> System Preferences -> General.  Set Appearance: Dark)
  2. Next, open Mac Mail and go to Mail preferences.  Mail -> Preferences
  3. Select the Viewing icon
  4. Un-check the Use dark backgrounds for messages

Have an awesome, productive day!

Friday, June 22, 2018

Regenerating XSD Dataset After Change

I find myself constantly having to maintain projects built with XSD datasets.  The thing I always *strongly disliked* about XSD's is their tendency to be fragile.  Whenever I make a change everything breaks and I'd end up fooling around for a 1/2 day getting it to work again.

Well, I think I've finally figured out how to make changes to an XSD, then regenerate the schema correctly.  Here are the steps that are working well for me now:

Open the XSD and make whatever changes you need.  In this sample, I'm just adding a new column to a SQL Server stored procedure.  Once I've made the change in the stored procedure, it's time to synchronize the XSD.

Go to the XSD view in Visual Studio, right-click on the object you need to change and click "Configure."

Go through all the steps of configuring that item...

You will notice that there is a file called "...Designer.cs".  This is the file auto-generated by the DataSetGenerator tool (or at least it's supposed to be auto-generated).

If this file isn't being changed, you can force it to make a new one.  First, delete the Designer.cs file (Right click => Delete).

Then right-click on the .XSD file and select "Run Custom Tool".  This will regenerate the Designer.cs file and you should be off and running.

What?  You don't have a menu item that says "Run Custom Tool"?  Then you need to add it to the XSD file type.  You do that by left-clicking on the XSD file, then go to the properties.

Under custom tool, make sure it says MSDataSetGenerator.  If it doesn't, add it.

Happy coding!

Tuesday, January 16, 2018

SSRS Report Rendering GIF and PNG Format

This is a historical post so I don't forget how to turn this on in MS Reporting Services.  Hopefully, it helps others too as it isn't immediately obvious (like everything Microsoft makes, I suppose).

Anyway, to turn GIF and PNG rendering on in SSRS:
  1. Edit the file:

    {Reporting Path}/rsreportserver.config
  2. Which happens to be this on the server I'm working on:

    C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServ\rsreportserver.config
  3. Now, search for the tag <render> within this XML file.
  4. Add the following rendering options within this <render> element:
<Extension Name="PNG" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering">
<Extension Name="GIF" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering">

You should be all set. SSRS will pick up the change immediately, and it will be an available output rendering format.

As a bonus, you can add this to your automatic Reporting Services web service, by sending in this device info string:


Maybe I'll do another blog on how to use Reporting Service's Web Service to render reports in code.  When I do, I'll link to it here.