Saturday, June 29, 2019

Fix: The Diagnostic Service Host service failed to start due to the following error. [ solved, no kidding ]

Lots of these Messages about the Diagnostic Service Host in the System Log

On Windows 7/10 Machines Attached to A Domain

The Diagnostic Service Host service failed to start due to the following error:
A privilege that the service requires to function properly does not exist in the service account configuration. You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration.  The good news is that you can fix it using active directory group policy or the Local Security Policy and just adding a few things to the Local Policies.  Same fix applies to both Windows 7 and Windows 10.  To Fix this using any Policy, you must be running a Professional or Enterprise version of Windows. If you have Home Edition, sorry.

Here's How to Fix It

You see this in your system logs repeatedly, and its dragging down your computer and making it run slow.  Startup is slow, and there are no real diagnostics. Plus it's difficult to search your event logs. This is one of the items to fix in our blog entry on making your computer run faster. There are lots of blog entries about how to fix this, plus many paid fix-it services such as experts-exchange say they have the fix, and even put [SOLVED] in the title.
Lot of messages about the Diagnostic Service Host repeatedly

How to Fix It with Group Policy

The first thing to do is to open a group policy object that applies to your desktop and server computers.  Hopefully you can edit your Domain group policy.  You have to adjust the following items:  Bypass Traverse Checking, Impersonate a Client After Authentication, and Profile System Performance by granting certain users permission.  

In the registry, you will see this:
Required privileges of the Diagnostic Service Host 
The registry shows what privileges are needed. You need to grant them to the service users.

SeChangeNotifyPrivilege  -- Bypass Traverse Checking
SeImpersonatePrivilege -- Impersonate a Client After Authentication
SeSystemProfilePrivilege  -- Profile System Performance

All in Computer Configuration -> Windows Settings -> Security Settings -> Local Policies

Edit the User Rights Assignment Policy Object, when done it will look like this.

by granting each one:

All need to have:
NT SERVICE\WdiServiceHost
Plus on Windows 10, you need "Local Service"

Just like this for each one
When fixed, you will see this in services.msc
Finally, go to each machine and reboot it.

If you like what you just read, and it helped fix your problem, please leave a comment below.  We would love to hear back from you.  If you are tired of googling around for solutions to windows problems, visit my website for details on great MSP and break fix services in Southern California and beyond.  Bare Wire Networks


Thursday, June 27, 2019

How to setup Rabbit SVN client in Ubuntu 14.04 LTS

RabbitVCS is a graphical front-end for version control systems available on Linux. It integrates into file managers to provide file context menu access to version control repositories. The project was originally called NautilusSvn, but due to the desire to support file managers in addition to Nautilus and more version control systems, it was renamed to RabbitVCS.

Step 1: Open your Terminal press Ctrl+Alt+T.
Step 2: Run the following commands one by one

RabbitVCS team also maintaining PPA for Ubuntu and Debian systems. Use the followings commands to add RabbitVCS ppa in your system install required packages.
$ sudo add-apt-repository ppa:rabbitvcs/ppa
$ sudo apt-get update
$ sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus3

Step 3: Restart your ubuntu desktop.

You have successfully installed Rabbit SVN Enjoy.

To remove Rabbit SVN client

Step 1: Open your Terminal
Step 2: Run the following command.

sudo apt-get remove rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus3 nemo-rabbitvcs

Step 3: Restart your desktop.


Wednesday, June 26, 2019

Useful Web Development Hacks and Useful Tips

Javascript, HTML and PHP Tips and Shortcuts

Change the URL in the browser address bar.  A useful hack to so that when you have an <A HREF="#" > and an OnClick handler, your browser addressbar will get cleaned up.

Changing only what's after hash - old browsers
document.location.hash = 'lookAtMeNow';
Changing full URL. Chrome, Firefox, IE10+
history.pushState('data to be passed', 'Title of the page', '/test');
The above will add a new entry to the history so you can press Back button to go to the previous state. To change the URL in place without adding a new entry to history use
history.replaceState('data to be passed', 'Title of the page', '/test');

Sunday, June 23, 2019

How to Make A Keymaker in C-Sharp

You can reverse engineer .Net programs to find out how other software developers protect their applications.  It is a good exercise that will teach you how to make a better software protection scheme.  The first thing to do is get a good set of reverse engineering programs. I recommend dotPeek32. DotPeek32 can open up a .Net program and show you the source code. programs are merely interpreted and not true machine code. They are Microsoft's famous JustInTime compiled with CLR run time code. Using DotPeek or RedGate .Net Reflector, you can easily reverse engineer any application.  My simple keymaker serves as an example of how you can make keymakers using one that I found inside an obscure industrial service application.  You could use the same things in your own application, although I would recommend extending it to 32 characters.

The Simple keymaker UI
the code shown below is the called Sample_Keygen.Form1. It is the event handler for the "Get Key" button.  It works by taking a four digit customer number and 2 digit major version number as inputs, then applying an offset to the customer number strings and version number strings and spreading them over nine (9) characters of an char array.  The second and fourth characters are just random characters that are not used.   In actual operation, the output is stored in TextBox3 and is then given to the customer to use in his own application.  This same function is used in the protected application, and the second and fourth characters are not compared against the inputted key value.  It is a simple and effective way to protect an application against software piracy.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;

// using this dll
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
namespace Sample_Keygen
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            int num1;
            object obj1;
            int num2;
            int CustNum = 0;
            int VersionAPP = 1;
            string Num, Ver;
            char[] chArray = new char[9];
            Num = textBox1.Text.ToString();
            Ver = textBox2.Text.ToString();
            if (!Int32.TryParse(Num, out NumNaja))
                NumNaja = 0;
            if (!Int32.TryParse(Ver, out VersionAPP))
                VersionAPP = 1;

            string str1 = Microsoft.VisualBasic.Strings.Format((object)(double)CustNum, "0000");
            string str2 = Microsoft.VisualBasic.Strings.Format((object)(double)VersionAPP, "00");
            chArray[0] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str1, 1, 1)) * 2.0 + 65.0))));
            chArray[1] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked((double)VBMath.Rnd() * 26.0 + 65.0))));
            chArray[2] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str1, 3, 1)) * 2.0 + 65.0))));
            chArray[3] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked((double)VBMath.Rnd() * 26.0 + 65.0))));
            chArray[4] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str1, 2, 1)) * 2.0 + 65.0))));
            chArray[5] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str1, 4, 1)) * 2.0 + 65.0))));
            chArray[6] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str2, 1, 1)) * 2.0 + 65.0))));
            chArray[7] = Microsoft.VisualBasic.Strings.Chr(checked((int)Math.Round(unchecked(Conversions.ToDouble(Microsoft.VisualBasic.Strings.Mid(str2, 2, 1)) * 4.0 + 65.0))));
            chArray[8] = Microsoft.VisualBasic.Strings.Chr(checked(unchecked(checked(Microsoft.VisualBasic.Strings.Asc(chArray[0]) - 65 + Microsoft.VisualBasic.Strings.Asc(chArray[1]) - 65 + Microsoft.VisualBasic.Strings.Asc(chArray[2]) - 65 + Microsoft.VisualBasic.Strings.Asc(chArray[3]) - 65 + Microsoft.VisualBasic.Strings.Asc(chArray[4]) - 65 + Microsoft.VisualBasic.Strings.Asc(chArray[5]) - 65) % 26) + 65));
            obj1 = (object)(Conversions.ToString(chArray[0]) + Conversions.ToString(chArray[1]) + Conversions.ToString(chArray[2]) + Conversions.ToString(chArray[3]) + Conversions.ToString(chArray[4]) + Conversions.ToString(chArray[5]) + Conversions.ToString(chArray[6]) + Conversions.ToString(chArray[7]) + Conversions.ToString(chArray[8]));

            textBox3.Text = obj1.ToString();

Wednesday, June 19, 2019

Shoretel Read-Only VB.Net Database Connect Strings for custom CDR Applications

Shoretel read-only Database Passwords

Shoretel Logo
Have you ever wanted to write your own custom Shoretel/Mitel CDR database reporting application?  If you need root access to the database for read-write operations see this blog entry.   In visual basic dot net, the connect string would look like this:

Dim conn1Str As String = "server=shoretel64;user=st_cdrreport;database=shorewarecdr;port=4309;password=passwordcdrreport;"
Dim conn2Str As String = "server=shoretel64;user=st_configread;database=shoreware;port=4308;password=passwordconfigread;"

Pretty Formatted:

Dim conn1Str As String = "server=shoretel64;user=st_cdrreport;database=shorewarecdr;port=4309;password=passwordcdrreport;"
Dim conn2Str As String = "server=shoretel64;user=st_configread;database=shoreware;port=4308;password=passwordconfigread;"

Assuming your server is just called shoretel64

Tuesday, June 18, 2019

Sudden Magento Failure - The session id is too long or contains illegal characters + Can't retrieve entity config

Magento Failure

You'll be cooking soon.
Suddenly, your magento starts showing error reports instead of shopping carts. Your product pages just show an error exception. And you cannot logon. One of the basic skills that a good Magento cart builder needs to know is how to recover their server from near death.  We are quite skilled at all things Magento. Here's how to fix it by deleting the cache and session pool, once you do this, you will be cooking with gas again.

So, you look in var/report and find the report file, and the first things it says is:

a:5:{i:0;s:46:"Can't retrieve entity config: sales/quote_item";i:1;s:4545:"#0 /home/needfulthings/public_html/app/code/core/Mage/Core/Model/Resource.php(282): Mage::throwException('Can't retrieve ...')
#1 /home/needfulthings/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(276): Mage_Core_Model_Resource->getTableName('sales/quote_ite...')

Plus in ./var/log/system.log, you see this:

2019-06-17T02:49:35+00:00 ERR (3): Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'  in /home/needfulthings/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 134
2019-06-17T02:49:35+00:00 ERR (3): Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,'  in /home/needfulthings/public_html/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 134

It happens because there is junk in the magento cache.
clean out your cache and delete your sessions from:

Delete the contents of the following directories, assuming your magento is installed in ~/


Tuesday, June 4, 2019

Using The Shoretel 90V Serial Console to Factory Reset

How to Connect to the Shoretel 90V Serial Console Like a Boss

You just bought a pre-owned Shoretel 90V from a grey market source, and now you find that you cannot logon anymore as anonymous.  The Shoregear90V is quite different from the Shoregear 90.  For one, it runs WindRiver Linux on top of VXWorks,  Whereas the Shoregear 90 just runs WindRiver VXWorks.  As a result Shoregear90V boots into Linux, while Shoregear 90 just has the old familiar VXWorks configuration pages. Both of them have a RS232 serial port that you can use to configure them.   Shoretel is full of hidden and secret passwords, including a secret CDR database with its own passwords. The Shoretel switch is no exception.  You may need to factory reset it, or you just need to set the root password.  Well, here are some ways to get in.  First step is to get a RS232 serial port added to your computer. You can always use a USB to Serial adapter (such as the venerable Tripp-Lite Keyspan USA-19HS) or you can just use the built in RS232 port. On most computers, it looks like a DB9 connector. Here are some pictures that will help you get in.  I buy and sell these grey market Shoretel switches all the time and this is often the first thing you need to do to clear them out and get them ready for the next user.  There is no user called anonymous, that was a feature from the previous generation of switches. On the 90V, the Linux root user is called "root" and his password is "ShoreTel"  The previous generation 90 used Wind River VXWorks, The 90V runs Linux.  Curiously enough, there is removable compact flash drive inside the 90V that contains the ext4 file system. You can always remove it and mount it in ubuntu and them edit the /etc/shadow file . On the 90V there is a message that will tell you to press a key to stop booting so you can edit the environment variables. You will be hitting that.   If you like what you see here, please leave comment and thank us for our work!  If you are getting in over your head and need to hire a Shoretel/Mitel Pro, see our website for contact details.

Shoretel Switch Connectors

Your Shoretel switch has a pair of female DB9 connectors.  The bottom connector is labeled "maint" you will use that one.  The top one is just marked "10101" that is reserved for things such as CDR etc...  The reset button is located in the left of the little blue light.

root@Default:/root# fdisk -l /dev/kcfa

Disk /dev/kcfa: 2096 MB, 2096898048 bytes

16 heads, 63 sectors/track, 4063 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0xdbe3ac07

    Device Boot      Start         End      Blocks   Id  System

/dev/kcfa1               1        4063     2047720+  83  Linux

how to factory reset:  reboot, then use the option to stop auto boot, (press a key as soon as you see the "al tests passed message) and then type:
> bootc static flash vxworks
> saveenv
> reset

or just change the IP address and set to DHCP
All tests passed
Hit any key to stop autoboot:  0
=> printenv

Environment size: 267/492 bytes
=> setenv flags 0x40
=> setenv host
=> setenv serverip
=> saveenv
Saving Environment to EEPROM...

The Meaning of Flags

Setting the flags to 0x40 will enable DHCP, while setting it to 0x0 will enable the use of the static IP address in the ipaddr field of env vars.
Shoretel Boot Flags

Use a Cisco DB9 to RJ45 Cable with a Null Modem

Connect it to the bottom port /maint port using a gender changer

Set your RS232 port to 19200 Baud,8 bits, 1 stop bit, no parity

Use Putty with the serial port option

Power up your 90V, press a key when prompted to stop in env console

Logon as root, with password ShoreTel

As you can see, it just runs Wind River Linux
Thats all you need to do. I recommend pressing the reset button and holding it for 10 seconds to reset the root password back to ShoreTel.  If you found this bit of advice useful or if you know of more ways to get in, please leave us a comment.

Set the IP Address and Server Address of SG-T1K

Connect a serial cable to the console port and wait for your switch to fully startup. then logon as anonymous with password=ShoreTel Once Connected, use option (3) to set the network parameters. Save them and then (4) reboot!

Other Curious Tidbits

After you boot up into Wind River Linux, you will see the flag value in /proc/ubootenv/flags and there is a networks script in /nand/etc/sysconfig/network-scripts/ifcfg-eth0 that you can play with.

Saturday, June 1, 2019

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Suddenly it happens, your PHP page shows this message in red: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" and you don't know why.

Somewhere in your code, you were using curl and were playing with the headers. You must have inserted this command:

header('Content-Type: application/json'); 

To Fix this error: you need to insert this statement right after you are done with JSON.

header('Content-Type: text/html; charset=utf-8');

Install a SSL Certificate into Remote Desktop / Terminal Server using MMC

How to Install a SSL Certificate into Remote Desktop / Terminal Server

This little tech tidbit is for those who like to use terminal servers or remote desktop to logon to their servers.  I will explain how to install a trusted certificate into terminal services. The first thing you need to do is the get a SSL certificate as a Standard PEM. You can get free SSL from, you should download the certificate and then use SSL Shopper's conversion tool to convert it to PFX/PKCS#12 form.  

Step 1 convert it from PEM to PKFS/12, using the sslshopper website converter
Step 2 Open MMC, add the Certificates plugin, as Computer Account, or just run certlm.msc
Step 3 Import the new certificate into your Personal Store
Step 4 Copy the new certificate into the Remote Desktop Branch
Step 5 Use this magic command to assign this certificate to terminal services.
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="PUT-the-THUMB-print-HERE"

Open your new certificate, and then Get the thumbprint from the certificate. It will look like this:
‎3b a2 15 ac 85 a3 ee 56 9b 2e 55 73 de 22 55 29 cb d4 8a 05

Put the thumbprint without spaces in the following command below. Be sure to use PowerShell. you can also use cmd.exe as Administrator to run this command. wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TSGeneralSetting Set SSLCertificateSHA1Hash="PUT-the-THUMB-print-HERE"  copy this command to a administrative command prompt or powershell and hit enter. It should say successful and will now use the certificate you choose.

Screenshots from the import a SSL certificate process
Here's a great video that shows the process.

Get A Free SSL Certificate and Use Free Conversion Tools

How to Get A Free SSL Certificate

A Free SSL? Really?

SSL is so expensive, but now there is a free option. It's called You can get 90 day certificates and a handy reminder to help you remember to renew it.  This is one of the first things you need to do while building your business website.

SSL For Free
SSL For Free? Finally.

Discounted SSL

There are some websites that sell discounted SSLs from Comodo.


SSL Decoder

SSL Converter
To convert your certificate from a Standard PEM to a PFX/PKCS#12.  You will need your private key and certificate file from