Windows 11, .Net 3.5 install, error 0x800F0954

Posted on Wednesday, September 7, 2022 by Nicki

 If you are trying to install .Net 3.5 via the Add Programs/Features on Windows 11 and get the above error, follow these simple steps:

  • Download the Windows 11 ISO here
  • Mount it (should be drive D, but confirm
  • Run this command in an command window with administrator privileges, changing D for the drive letter where the ISO was mounted:
Dism /online /enable-feature /featurename:NetFX3 /All /Source:%setupdrv%:\sources\sxs /LimitAccess


Credit

MariaDB Sequence Storage Engine

Posted on Tuesday, April 14, 2020 by Nicki

Learnt today that MariaDB has this great feature called a Sequence Storage Engine.

Ever needed to repeat something couple of times but don't want to write a loop? Just write a query that joins to a sequence table, for example:

set @date = date(now());
select 
date(date_add(@date, interval seq day)) as date, 
dayname(date_add(@date, interval seq day)) as dayname, 
week(date_add(@date, interval seq day)) as weeknum, 
mod(dayofweek(date_add(@date, interval seq day))+5, 7) dayofweek, 
case when mod(dayofweek(date_add(@date, interval seq day))+5, 7) < 5 then 1 else 0 end workday
from seq_0_to_21

It produces the following listing(forgive the formatting):

+------------+-----------+---------+-----------+---------+
| date | dayname | weeknum | dayofweek | workday |
+------------+-----------+---------+-----------+---------+
| 2020-04-14 | Tuesday | 15 | 1 | 1 |
| 2020-04-15 | Wednesday | 15 | 2 | 1 |
| 2020-04-16 | Thursday | 15 | 3 | 1 |
| 2020-04-17 | Friday | 15 | 4 | 1 |
| 2020-04-18 | Saturday | 15 | 5 | 0 |
| 2020-04-19 | Sunday | 16 | 6 | 0 |
| 2020-04-20 | Monday | 16 | 0 | 1 |
| 2020-04-21 | Tuesday | 16 | 1 | 1 |
| 2020-04-22 | Wednesday | 16 | 2 | 1 |
| 2020-04-23 | Thursday | 16 | 3 | 1 |
| 2020-04-24 | Friday | 16 | 4 | 1 |
| 2020-04-25 | Saturday | 16 | 5 | 0 |
| 2020-04-26 | Sunday | 17 | 6 | 0 |
| 2020-04-27 | Monday | 17 | 0 | 1 |
| 2020-04-28 | Tuesday | 17 | 1 | 1 |
| 2020-04-29 | Wednesday | 17 | 2 | 1 |
| 2020-04-30 | Thursday | 17 | 3 | 1 |
| 2020-05-01 | Friday | 17 | 4 | 1 |
| 2020-05-02 | Saturday | 17 | 5 | 0 |
| 2020-05-03 | Sunday | 18 | 6 | 0 |
| 2020-05-04 | Monday | 18 | 0 | 1 |
| 2020-05-05 | Tuesday | 18 | 1 | 1 |
+------------+-----------+---------+-----------+---------+
22 rows in set (0.01 sec)

The sequence table name is dynamic, so to get a sequence from 1 to 5 use the table name seq_1_to_5. It has a column called seq that contains the sequence number

Link:  https://mariadb.com/kb/en/sequence-storage-engine/



Help, my QuickAccess in Windows 10 is broken

Posted on Friday, November 15, 2019 by Nicki

QuickAccess in Windows10 Explorer is quite handy for pinning often-used folders. Recently mine stopped working for some reason. It would not show the items previously pinned, nor would it accept new pins.

After a bit of searching, the fix is:

Integrating to legacy temperature monitoring device

Posted on Thursday, October 26, 2017 by Nicki

Below is sample code of a proxy ASP.Net page that queries a TempageR 4E realtime temperature monitor and exposes the temperature to PRTG in order to report and escalate out of range values.

public partial class FetchTemp : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient(System.Configuration.ConfigurationManager.AppSettings["ip"], 80);
            NetworkStream ns = client.GetStream();
            byte[] request = System.Text.Encoding.ASCII.GetBytes("GET /getData.htm HTTP/1.1\r\n\r\n");

            ns.Write(request, 0, request.Length);

            byte[] resp = new byte[2048];
            int bytes = -1;

            StringBuilder sb = new StringBuilder(); 

            while (bytes != 0)
            {
                bytes = ns.Read(resp, 0, resp.Length);
                sb.Append(System.Text.Encoding.ASCII.GetString(resp, 0, bytes));
            }

            dynamic obj = JsonConvert.DeserializeObject(sb.ToString());
            Response.Write("[" + obj.sensor[0].tempc + "]");
        }
    }

It calls the getData.htm page, which exposes the device info, sensors and their values as a JSON object. This gets parsed, and the value of the first sensor is written to the Response in blockquotes. The PRTG HTTP Content sensor is configured with the URL of the page (FetchTemp.aspx).

The code uses a TcpClient instance to retrieve the data. The getData.htm page does not return HTTP response headers, which causes HttpWebRequest as well as the built-in PRTG HTTP XML/REST sensor to fail with "The underlying connection was closed unexpectedly", using TcpClient solves this issue.

Using TLS 1.1, 1.2 in .Net 4.0 Application

Posted on Thursday, August 3, 2017 by Nicki

One of our partners stopped support for SSL3.0 and TLS1.0 on a service that we connect to with a .Net 4.0 application.

Using WireShark we determined that the application was attempting connections using SSL3.0 and TLS1.0 only. Digging into this we found a link mentioning that a registry value needs to be configured for .Net4.0 to be able to use TLS1.0 and above.

Once we configured the registry value and restarted the application, it was able to connect to the remote service.


How to generate a GUID in XSLT transformations

Posted on Wednesday, May 10, 2017 by Nicki

A recent task involved migrating tens of jobs from Control M to VisualCron. I 'm never in the mood for manual repetitive tasks, so the approach was taken to do it with XSLT, since both Control M and VisualCron support XML config schemas.

VisualCron expects various Ids to be GUIDs, and XSL has no built-in functionality to generate GUIDs, so a plan had to be made. I queried Google and found that one can write extension objects in C# and use them during the translation.

The code for to generate a GUID is very simple:

    public class TransformUtils
    {
        public string GenerateGuid()
        {
            return Guid.NewGuid().ToString();
        }
    }

This is then plugged into the transformation code like this:
            string xmlPath = txtXMLSource.Text;
            string xslPath = txtXSLSource.Text;
            StringBuilder output = new StringBuilder();

            
            XsltArgumentList arguments = new XsltArgumentList();
            arguments.AddExtensionObject("EPS:TransformUtils", new TransformUtils());
            
            using (StringWriter writer = new StringWriter(output))
            {
                XslCompiledTransform transform = new XslCompiledTransform();
                transform.Load(xslPath);
                transform.Transform(xmlPath, arguments, writer);
            }
Inside the xslt stylesheet the extension function can now be called:
<xsl:value-of select="TransformUtils:GenerateGuid()" />

I found a good sample and guide here

DNS Unlocker ads #2

Posted on Thursday, September 17, 2015 by Nicki

In my quest to find the cause(s) for these DNS Unlocker ads, I found Steve Gibson's DNS Nameserver Spoofability Test to test my DNS.

This can identify any DNS issues that could cause these DNS Unlocker ads to be injected into sites you visit.