Author Archive

Cornelius J. van Dyk

Born and raised in South Africa during the 70's I got my start in computers when a game on my Sinclair ZX Spectrum crashed, revealing it's BASIC source code. The ZX had a whopping 48K of memory which was considered to be a lot in the Commodore Vic20 era, but more importantly, it had BASIC built into the soft touch keyboard. Teaching myself to program, I coded my first commercial program at age 15.

After graduating high school at 17, I joined the South African Air Force, graduating the Academy and becoming a Pilot with the rank of First Lieutenant by age 20. After serving my country for six years, I made my way back into computer software.

Continuing my education, I graduated Suma Cum Laude from the Computer Training Institute before joining First National Bank where my work won the Smithsonian Award for Technological Innovation in the field of Banking and Insurance. Soon I met Will Coleman from Amdahl SA, who introduced me to a little known programming language named Huron/ObjectStar. As fate would have it, this unknown language and Y2K brought me to the USA in 1998.

I got involved with SharePoint after playing around with the Beta for SharePoint Portal Server 2003. Leaving my career at Rexnord to become a consultant in 2004, I was first awarded the Microsoft Most Valuable Professional Award for SharePoint in 2005, becoming only the 9th MVP for WSS at the time. I fulfilled a life long dream by pledging allegiance to the Flag as a US citizen in 2006. I met the love of my life and became a private consultant in 2008. I was honored to receive my ninth MVP award for SharePoint Server in 2013.

How do I – Activate my MSDN copy of Visio 2013 Professional?

Written by Cornelius J. van Dyk on . Posted in Blog, How Do I...

Situation:  You have a MSDN subscription and you have downloaded Office 2013 or one of the Office products, like Visio 2013 Professional, from Microsoft and have installed said product.  You have a license key provided by MSDN, but the installer never prompts you for the license key.  This is a departure from traditional installer behavior where you would enter the license key before the install can even be done.  Once you’ve completed the install, you open your product and are confronted by this little gem of a warning just below the Ribbon:

screenshot.492

Since you have a license key, you click the “Activate” button.  You are presented with this screen which is there for a while, so be patient:             

screenshot.493

Eventually, you’re presented with a Sign In screen like this:

screenshot.494

Having gotten your license key from MSDN, you promptly enter your MSDN UserID and password and click the “Sign in” button.  Unfortunately, you’re presented with an error thus:

screenshot.495

After trying the login a couple more times (just in case you fat fingered the password), you click the “Can’t access your account?” button.  Your browser opens and you’re taken to this page:

screenshot.496

Again, you enter your MSDN UserID as well as the CAPCHA code and click the “Next” button.  This time you’re presented with an error screen stating that your ID doesn’t exist thus:

screenshot.497

So now what?

This is the problem with the new installer.  In order to use our MSDN license key, we’re going to have to follow these steps:

  1. Click “Start”.
  2. On the popup menu, click “Control Panel”.
  3. In the Control Panel, double click the “Programs and Features” icon.
  4. Scroll down through the list of installed products and locate the product in question.  In this example it was “Microsoft Visio Professional 2013”.
  5. Select the target product.
  6. In the toolbar above the list, click the “Change” button.screenshot.498
  7. When the configuration window appears, select the “Enter a Product Key” radio button and click “Continue”.screenshot.499
  8. No enter your product key and click “Continue”.screenshot.500
  9. Unfortunately, you have to go through the configuration piece again.  For a simple license key addition, I don’t see the need in this, but that how it works for now.  You could just click “Continue” but in my case, I wanted to make sure nothing was getting reset so I clicked “Customize”.screenshot.501
  10. Ensure your configuration settings are as desired and click the “Continue” button.screenshot.502
  11. It sets in the Configuration Progress screen for quite a while.  Just be patient.screenshot.503
  12. Once the configuration completes, click the “Close” button.screenshot.504
  13. Finally re-launch the application and the red warning should now be gone.screenshot.505

 

This took me a while to figure out, so hopefully this saves someone some time.



Cheers
C




image

InfoPath

InfoPath is dead!

Written by Cornelius J. van Dyk on . Posted in Blog

InfoPath is dead!  We all knew it had to happen eventually.  The Office Team blogged on the Office Blog today noting the death of InfoPath.  From the third paragraph:

“This means that InfoPath 2013 is the last release of the desktop client, and InfoPath Forms Services in SharePoint Server 2013 is the last release of InfoPath Forms Services. The InfoPath Forms Services technology within Office 365 will be maintained and it will function until further notice.”

There will be no future version of InfoPath.  Not much beyond that is shared at this time, except the assurance that there’s another 9 years left of official support for On-Prem InfoPath deployments.  A sneak peak of what’s to come is supposed to be in the “Update on InfoPath and SharePoint Forms” session at the SharePoint Conference in March.  We all knew it was coming so it shouldn’t be a big surprise that it’s finally here.  I think more surprising is the fact that Microsoft waited this long to announce that the 2013 version was the last version.  That should make for some interesting developments as far as SharePoint forms go.



Cheers
C




image

How do I – Validate user input is numeric from Powershell?

Written by Cornelius J. van Dyk on . Posted in Blog

As the level of complexity and power of our Powershell scripts increase, it is inevitable that we reach a point where we need to interact with the user and prompt them for some information.  In this case we were building a script to automate the creation and scaling of Search so we needed to know how many servers would be configured as Crawl servers.  We all know the Read-Host cmdlet can provide us with the input, but how do we know that the user actually entered numeric only data?  The easiest way is to simply use a try/catch block and attempt to convert the input to an int value.  Here’s how we do that:

$numberOfCrawl = 0
$inputOK = $false
do
{
  try
  {
    [int]$numberOfCrawl = Read-Host -ForegroundColor red "Please enter the number of servers you wish to configure as Crawl servers."
    $inputOK = $true
  }
  catch
  {
    Write-Host -ForegroundColor red "INVALID INPUT!  Please enter a numeric value."
  } 
}
until ($inputOK)
Write-Host –ForegroundColor green "You chose to configure [$numberOfCrawl] Crawl servers."

We start by defining the $inputOK variable as false and then wrap the entire piece of code in a do/until loop that repeats until the user enters a valid numeric only value.  Inside of this loop, we have a try/catch block.  Inside the try, we attempt to assign the entered value from Read-Host to the $numberofCrawl variable which we cast as an int.  If the user enters a non-numeric value, the cast will fail and will be caught by the catch.  In the catch we output an error message in red text and simply allow the loop to restart from the top.  If however, the user entered a valid numeric value, the cast will succeed afterwich we set the $inputOK variable to true thus allowing the loop to end gracefully.  As a final step, we display the entered value to the user.



Cheers
C




image

How do I – Play the TNG Red Alert (or any audio file for that matter) in my WinForms C# app

Written by Cornelius J. van Dyk on . Posted in Blog, How Do I...

Out of the box, C# and .NET supports the playing of any .WAV file.  The code is pretty straight forward.  We simply need to reference the system media class to create a SoundPlayer{} object thus:

System.Media.SoundPlayer p = new System.Media.SoundPlayer(@"C:\Media\MySoundEffect.wav");
Once we have the object, we simply invoke the Play() method thus:
p.Play();

So in two simple lines of code, we are able to play any .wav file from our application.  There are some more embedded problems that may not immediately be obvious.  Allow me to explain.

Suppose I’m trying to add the Star Trek TNG Red Alert sound to my app for an emergency notification.  I begin by locating the sound in question.  A quick web search takes me to the http://www.trekcore.com/audio/ site where the Red Alert section has several samples to choose from.  Once I locate the sound sample that I wish to use, I click the link and download the file.

image

PROBLEM #1:  The file is in the .mp3 audio format.  Attempting to use it in the instantiation of the SoundPlayer() method fails with the message that only .wav files are supported.

RESOLUTION We could use a custom media player class, or we could just let the internet do some work for us.  A quick search pointed me to the http://media.io/ online audio conversion web site.  The simple interface couldn’t be cleaner or more straight forward:

image

Simply take the .mp3 file we previously downloaded and upload and convert it on this site.  Now we finally have a .wav file that we can use in our project.  Now we would like the alert sound to be played 3 times and a popup window present the error notification.  That’s easy, right?  We simply use a for() loop that looks like this:

for (int i = 0; i <= 2; i++)
{
    System.Media.SoundPlayer p = new System.Media.SoundPlayer(@"TNG-Red-Alert.wav");
    p.Play();
}
MessageBox.Show("There is an error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);

We compile and run the app and expect the alert sound to play 3 times… only… it doesn’t.  So why doesn’t it play our audio?  It seems the problem is related to the fact that the asynchronous .Play() method, being spun from the current executing thread, does not have enough time to execute before the modal .Show() method is executed.  As you know, the MessageBox.Show() method will block the existing thread from executing any further until user action is taken on the window.  As such, the Play() method is queued really quickly given present computer CPU speeds, and once the.Show() method is invoked, it aborts the asynchronous threads to the .Play() method.  To solve the problem we have to allow the .Play() method some time to begin execution.  The easiest way to do that is to simply .Sleep() the current thread.  By injecting this line of code:

System.Threading.Thread.Sleep(1500);

right after the .Play() call, the currently executing thread will pause for 1.5 seconds.  Depending on what audio you’re playing, you can tweak this value (in milliseconds) to match accordingly.

At this point, the alert message and audio work correctly… but the OCD in me still isn’t happy with the effect we get.  When the error condition is generated, the audio alert is played three times, per our code, and then the error alert is popped up.  The problem I have with that is that the audio warning gets my attention, but then I have to wait for it to finish playing three times before the error message with useful information pops up.  That should be easy to fix, right?  Why not just simply move the .Show() method call to before the for() loop containing the .Play() call?

Unfortunately, this doesn’t work as you’d expect.  Because of the fact that the .Show() call actually freezes the current thread, the message box is displayed and then awaits user interaction before it allows the audio code to execute.  What we need is for the .Show() code to be spun off in another thread so as to allow the audio alert to play while the message is displayed.  To do this, we create a new method thus:

public void ShowAlert()
{
    System.Threading.Thread t = new System.Threading.Thread(() =>
    {
        MessageBox.Show("There is an error!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
    });
    t.Start();
}

Once we have the message box contained in a separate thread, we simply make that call prior to playing our audio thus:

ShowAlert();
for (int i = 0; i <= 2; i++)
{
    System.Media.SoundPlayer p = new System.Media.SoundPlayer(@"TNG-Red-Alert.wav");
    p.Play();
    System.Threading.Thread.Sleep(1500);
}

Once the user interacts with the message box, the thread (t) will terminate gracefully.  In the mean time our main app is free to continue execution of our loop to play the alert sound.



Cheers
C




image