Software: BPSNMPMon updated

An update to BPSNMPMon, a SNMP (Simple Network Management Protocol) utility that will monitor host processor, storage and interface values, is now available. The latest version includes several enhancements:

  • Added AutoHeight option to scale the interface graph based on visible values
  • The charts now resize with the form
  • SNMP counters can be saved to a delimited log file 

 

BPSNMPMon performs various SNMP queries at a user-defined time interval and graphically represents the information in a simple user friendly interface.

 

Add BPSNMPMon to your network management "toolkit".



   

SQL: SQLServerAgent Error: Job xxx does not exist in the job cache

 

I recently encountered the error SQLServerAgent Error: Job xxx does not exist in the job cache (where xxx is the internal id number). This error was a bit misleading at first as I confirmed the job entry did exist. The cause of the error was that the SQLAgent service account didn’t have the necessary permissions to read the job data. Once the permissions were properly setup the job executed. 



   

C#: Decode Base64 Encoded String

C# code to dencode a Base64 encoded string to its equivalent string representation.

private string DecodeBase64(string s)
        {
            try
            {
                byte[] ascBytes = System.Convert.FromBase64String(s);
                return System.Text.ASCIIEncoding.ASCII.GetString(ascBytes);
            }
            catch (Exception e) { throw new Exception(e.Message); }
        }



   

C#: Base64 Encode a String

C# code to encode a string to its equivalent string representation that is encoded with base-64 digits.
private string EncodeBase64(string s)
        {
            try
            {
                byte[] ascBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(s);
                return System.Convert.ToBase64String(ascBytes);
            }
            catch (Exception e) { throw new Exception(e.Message); }
        }



   

C#: Save a Form’s Size and Location

In an attempt to enhance user experience it may be desirable to save the size and location of a Form. When dealing with customizable user settings, it is important to determine where to persist the user’s applications settings. The Application class has a UserAppDataRegistry property that references the HKEY_CURRENT_USER\Software\[Control.CompanyName]\[Control.ProductName]\[Control.ProductVersion]. registry key in the user’s profile (If this key does not exist it is created). Here is a basic example of storing a form's state in the user's registry profile:
	private void Form_Load(object sender, EventArgs e)
        {
            this.WindowState = (FormWindowState)FormWindowState.Parse(WindowState.GetType(), Application.UserAppDataRegistry.GetValue("WindowState", FormWindowState.Normal).ToString());
            if (this.WindowState == FormWindowState.Normal)
            {
                int x = (int)Application.UserAppDataRegistry.GetValue("LocationX");
                int y = (int)Application.UserAppDataRegistry.GetValue("LocationY");
                this.DesktopLocation = new Point(x, y);
                int w = (int)Application.UserAppDataRegistry.GetValue("WindowSizeW");
                int h = (int)Application.UserAppDataRegistry.GetValue("WindowSizeH");
                this.Size = new Size(w, h);
            }
        }

        private void Form_FormClosing(object sender, FormClosingEventArgs e)
        {
            Application.UserAppDataRegistry.SetValue("WindowState", this.WindowState);
            Application.UserAppDataRegistry.SetValue("WindowSizeH", this.Size.Height);
            Application.UserAppDataRegistry.SetValue("WindowSizeW", this.Size.Width);
            Application.UserAppDataRegistry.SetValue("LocationX", this.DesktopLocation.X);
            Application.UserAppDataRegistry.SetValue("LocationY", this.DesktopLocation.Y);
        }