Subtopic: Software development / 3

Company and industry news, featured projects, open source code, tech tips, and more.

Benford's Law

Michael Argentini Avatar
Michael ArgentiniFriday, March 15, 2024

The Benford project provides a framework for using Benford's Law to determine if a given random data set has been modified.

Benford’s Law, also known as the Law of First Digits, the Phenomenon of Significant Digits, or the Law of Anomalous Numbers is the finding that the first digits (or numerals to be exact) of the numbers found in series of records of the most varied sources do not display a uniform distribution, but rather are arranged in such a way that the digit “1” is the most frequent, followed by “2”, “3”, and so in a successively decreasing manner down to “9”. The expected distributions can be seen in the screenshots below.

Essentially, when looking at a significantly large set of numbers, this law can tell you if the distributions of first digits follows Benford's Law. Deviations of significance should indicate data tampering. This can be applied in all kinds of use cases, from social likes and follower counts, to regional vote counts, financial information, and more.

This project has some sample images and voting data that you can use to see how Benford's Law applies to them.

Screenshots

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

DataStore

Michael Argentini Avatar
Michael ArgentiniThursday, February 15, 2024

The DataStore project is a high performance JSON object store (ORM) for SQL Server.

DataStore uses and automatically creates and manages a pre-defined SQL Server data structure that can coexist with existing database objects. All database operations are performed with the DataStore helper class.

Your models are stored in the database as JSON text so you can have most any kind of object structure, provided your models inherit from DsObject.

Basic example

Instantiating DataStore with settings is non-destructive. Any existing DataStore tables are left untouched. Methods to delete all or unused schema objects are provided for those edge cases.

Models

Instantiate DataStore with a settings object and database schema will be created for all classes that inherit from DsObject. The following attributes can be used in your classes:

  • DsNoDatabaseTable prevents DataStore from creating a table for the class.
  • DsUseLineageFeatures enables lineage features for that table; add to the class itself.
  • DsSerializerContext(typeof(...)) to provide a de/serialization speed boost by using source generator JsonSerializationContext classes for each table; add to the class itself.
  • DsIndexedColumn generates a SQL computed column with index for faster queries on that data; add to properties and fields.
  • DsIndexedColumn("Food","Email") generates indexed SQL computed columns for faster queries on the dictionary key names specified; add to Dictionary properties and fields.
[DsUseLineageFeatures]
[DsSerializerContext(typeof(UserJsonSerializerContext))]
public class User: DsObject
{
    [DsIndexedColumn]
    public string Firstname { get; set; }
    
    [DsIndexedColumn]
    public int Age { get; set; }
    
    public List<Permissions> Permissions { get; set; }
    
    [DsIndexedColumn("Food", "Color")]
    public Dictionary<string, string> Favorites { get; set; } = new();
}

[JsonSerializable(typeof(User))]
[JsonSourceGenerationOptions(WriteIndented = false)]
internal partial class UserJsonSerializerContext : JsonSerializerContext
{ }

Construction

You can create a DataStore instance anywhere in your code:

var dataStore = new DataStore(new DataStoreSettings {
    SqlConnectionString = sqlConnectionString,
    UseIndexedColumns = true
});

You can also use DataStore as a singleton service:

services.AddSingleton<DataStore>((factory) => new DataStore(new DataStoreSettings {
    SqlConnectionString = sqlConnectionString,
    UseIndexedColumns = true
}));

Create and save objects

Creating and saving a DataStore object is simple:

var user = new User
{
    FirstName = "Michael",
    LastName = "Fynydd",
    Age = 50,
    Permissions = new List<Permission>
    {
        new() { Role = "user" },
        new() { Role = "admin" },
        // etc.
    }
};

await dataStore.SaveAsync(user);

The saved object is updated with any changes, like lineage and depth information, creation or last update date, etc. And you can provide a list of objects to save them all in one call.

Read objects

Querying the database for objects is simple too. In any read calls you can specify a DsQuery object with a fluent-style pattern for building your query. In the query you can specify property names as strings with dot notation:

var users = await dataStore.GetManyAsync<User>(
    page: 1,
    perPage: 50,
    new DsQuery()
        .StringProp("LastName").EqualTo("Fynydd")
        .AND()
        .StringProp("Permissions.Role").EqualTo("admin")
        .AND()
        .GroupBegin()
            .NumberProp<int>("Age").EqualTo(50)
            .OR()
            .NumberProp<int>("Age").EqualTo(51)
        .GroupEnd(),
    new DsOrderBy()
        .Prop<int>("Age").Ascending()
);

Or you can use the model structure to specify names, and make code refactoring easier:

var users = await dataStore.GetManyAsync<User>(
    page: 1,
    perPage: 50,
    new DsQuery()
        .StringProp<User>(u => u.LastName).EqualTo("Fynydd")
        .AND()
        .StringProp<User, Role>(u => u.Permissions, r => r.Role).EqualTo("admin")
        .AND()
        .GroupBegin()
            .NumberProp<User,int>(u => u.Age).EqualTo(50)
            .OR()
            .NumberProp<User,int>(u => u.Age).EqualTo(51)
        .GroupEnd(),
    new DsOrderBy()
        .Prop<User>(o => o.Age).Ascending()
);

Dynamic property access

If you need to access object properties without knowing the object type, DsObject exposes JSON features that allow you to access property values using standard JSON path syntax:

var users = await dataStore.GetManyAsync<User>(
    page: 1,
    perPage: 50
);

foreach (DsObject dso in users)
{
    dso.Serialize(dataStore);

    var lastName = dso.Value<string>("$.LastName");
    var roles = dso.Values(typeof(string), "$.Permissions.Role");

    // etc.
}

Remember: these JSON features are read-only. If you change a property value in the DsObject you will need to call Serialize() again to update the JSON representation.

Screenshots

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

Upgrade Windows 10 without a TPM chip

Michael Argentini Avatar
Michael ArgentiniSunday, November 12, 2023

Microsoft (in)famously requires that your PC have a special security chip (TPM) in order to install Windows 11. But the requirement is wholly unnecessary to maintain a secure installation. And it requires many people to buy new PCs, arguing that this is likely the primary reason Microsoft implemented the requirement.

Patching the Windows install to allow it to run on existing hardware without a TPM chip has been a game of cat and mouse. And until now it had again been thwarted by Microsoft.

Recently Microsoft has patched the Windows 11 ‘product server’ trick for TPM check bypass, but the bypass still works with setupprep.exe. This bypass will upgrade Windows 10 clients to Windows 11 without requiring a TPM.

setupprep.exe /product server

Prioritizing software features

Michael Argentini Avatar
Michael ArgentiniFriday, October 13, 2023

Being a pragmatist when it comes to software development, I generally prefer simple solutions whenever possible. So when clients are faced with the challenge of determining which features to add to their products, as a starting point I usually recommend looking at user value versus cost to implement.

Given a progressive value scale from a “cup of coffee” at the low end and a “house” at the high end, we can easily see where the best choices lie.

Looking at the first row in this example, if a user values a feature at “house” and your cost to implement is a “cup of coffee” this feature addition becomes a no-brainer.

Likewise if a user values a feature at a “cup of coffee” but it will cost a “house” to build, it's certainly a feature to avoid implementing.

There may be some diamonds in the center blue area, but more information is usually required before we make those decisions.

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

How to copy a Git repo to another location using rsync on macOS

Michael Argentini Avatar
Michael ArgentiniWednesday, June 14, 2023

Here's a Mac pro tip: When copying a git repository directory to your network file server using rsync, try this:

rsync -brtlvP --chmod=Fu+w --delete-before Code/MyProject/ /Volumes/MyServer/Code/MyProject/

This will copy the files with timestamps but no other attributes, and will also give the file owner (you) full access rights. This ensures that you (or even Windows users with access rights) can overwrite the directory contents later because local read-only files (e.g. in the .git directory) won't be read-only on the server. You can also change the chmod option to customize the rights, like ensuring everyone has full control.

Install SQL Server 2022 with full-text search on Apple Silicon Macs

Michael Argentini Avatar
Michael ArgentiniThursday, April 27, 2023

It looks like a recent change to Docker has allowed Macs with Apple Silicon to run a full installation of Microsoft SQL Server 2022 with full-text search in a Docker container.

How is this possible? Docker has a new feature that can use Rosetta 2 for x64 emulation. That means it supports creating an x64-based Linux image/container and installing the free but full version of SQL Server with FTS.

Step 0: Enable Rosetta in Docker

Enable this feature in the Docker settings as seen in the image below. Look in Settings => Features in development.

Step 1: Create the dockerfile

Take the content below and save it as a text file named Dockerfile. This configuration creates an Ubuntu 20.04 image, then installs the Microsoft package repositories, SQL Server 2022, FTS, and MS Tools.

# Docker image with msssql 2022 with full text search enabled;
# Based on work in: https://github.com/Microsoft/mssql-docker

# Base OS layer: Latest Ubuntu LTS
FROM --platform=linux/amd64 ubuntu:focal

# Install prerequistes since it is needed to get repo config for SQL server
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -yq curl apt-transport-https gnupg && \
    # Get official Microsoft repository configuration
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb --output packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update  && \
    # Install SQL Server from apt
    apt-get install -y mssql-server && \
    # Install optional packages
    apt-get install -y mssql-server-fts && \
    ACCEPT_EULA=Y apt-get install -y mssql-tools && \
    # Cleanup the Dockerfile
    apt-get clean && \
    rm -rf /var/lib/apt/lists

# Run SQL Server process
CMD /opt/mssql/bin/sqlservr

Step 2: Build the dockerfile

This will build the Dockerfile and create a Docker image named sqlserver.

docker build -t "sqlserver:latest" .

Step 3: Run the container

This will create a container from the new image and run it. The sa user will have a password of P@ssw0rdz!, the EULA will be accepted, and port 1433 will be opened.

docker run -d --platform linux/amd64 --name sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=P@ssw0rdz!' -p 1433:1433 sqlserver:latest

At this point you should have SQL Server running! You can also have it start up with Docker by executing the command below:

docker update --restart=always sqlserver

The iOS-ification of macOS

Michael Argentini Avatar
Michael ArgentiniTuesday, March 7, 2023

Apple's decision to make macOS look and feel more like iOS is aspirational, certainly. If users could seamlessly switch between operating systems and retain muscle memory it would be a big win. It's no wonder that Apple decided to do this with macOS 13 Ventura.

But in practice, Apple's zeal for consolidation has created some real problems for users. In many cases it feels like one step forward and two steps back. I can see how iOS power users may welcome most of the changes to macOS, but that position smacks of Stockholm Syndrome to me.

One of the best examples of this is the redesigned System Settings, which is a mess. I've given it months to “grow on me” and it has… like a fungal infection. The settings are (dis)organized into a single column of top-level categories in a seemingly random order. Devices running macOS have wide screens, so restricting the top-level categories to a single narrow column is an artificial limitation. And it can’t be remedied by resizing the System Settings window because only its height can be changed.

And the organization? macOS has a much deeper and more broad collection of settings than iOS. So as difficult as specific iOS settings can be to find on an iPhone, it’s near impossible on a Mac. And making it worse is the fact that some settings have been organized out of existence, spread out into disparate, counterintuitive categories. Want to tune all your power and sleep settings? You may have to explore a dozen settings categories to find them when they could have been put into an “Energy” category or something similar. Luckily there is a search feature. Without it I’m sure users would be surrounding the Apple Campus with pitchforks and torches.

Also part of this convergence initiative is the Apple decision to make physical keyboards work more like the iOS virtual keyboard, which changes contextually. The difference is that the iOS keyboard changes in appearance so you can infer what's expected. This means that, for example, sometimes you can use the delete key to remove characters to the right of your cursor, and sometimes you can't. It's like an infuriating game. And now when you press and hold an alphanumeric key it no longer repeats, in favor of a popup with extended characters (e.g. foreign characters with accents and ligatures). I suppose that’s handy for people who write in a foreign language. But you would assume that it would be an option, not a change to the original default key behavior. Your keyboard isn’t broken. Apple made it better YOU'RE WELCOME.

Use CSS to style elements adjacent to an input based on it being empty or filled

Michael Argentini Avatar
Michael ArgentiniWednesday, December 21, 2022

Here's an interesting method for styling an adjacent element based on whether an <input> is empty or not.

The traditional method for accomplishing this is to use JavaScript, which involves more complex code that is difficult to write and manage. It would require using a selector to find both elements, determining if the input is empty or not, and altering the styles or class names of the adjacent element.

The method below only requires CSS.

input[type="search"]:placeholder-shown + i {
    /* input is empty */
    display: none;
}

input[type="search"]:not(:placeholder-shown) + i {
    /* input is not empty */
    display: inline-block;
}

In this case I'm hiding and showing a clickable icon that clears the search text if there is any. No JavaScript needed other than the click event 😃.

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

Software development is not coding

Michael Argentini Avatar
Michael ArgentiniWednesday, June 22, 2022

When asked, most people think that software development is coding; the physical act of programming apps and platforms for servers, computers, and mobile devices. This is not the case.

Software development is the process of solving problems through software. It's a creative process that is centered on discovery and adaptation which uses tactics like programming (coding) to accomplish its ends. Likewise, software development is not the act of reusing existing software for a new purpose. That's just copying bits.

So it is important for those involved in the software development process to understand and acknowledge the following key aspects.

Discovery and adaptation is the focus.

Understanding the problem domain is the key to a successful software development process. And we know the least about a problem domain at the outset. So it doesn't make sense to plan everything out at the beginning. Software development is an exercise in learning. We learn more and more about the problem to be solved as we move through the process. And as the problem domain comes into focus we should be refining or redefining what we should be building as we learn.

Mistakes will be made.

Mistakes help us solve problems and are one way in which we learn. Embrace them. Plan for them.

We cannot predict the future.

Perfect plans are usually perfectly wrong. It is impossible to perfectly know the steps, mistakes, discoveries, interruptions, and goals for a project, nor the time impact of each, all in advance.

Estimates are guesses about the future.

Great software doesn't just manifest in one go. It springs forth in a deficient state and evolves over time. This makes guessing about its future state with any accuracy a fools errand. It also means that creating precise specifications for those guesses can be a waste of time.

Accuracy and precision are not the same. Something can be very precise but horribly wrong. This has been shown by various studies, including those in the Microsoft Press book Rapid Development by Steve McConnell. According to the book it doesn't matter how diligent or thorough an estimate may be. The data shows that when compared to a more broad, high-level, or piecemeal approach based on past experience, the error bounds are largely the same.

Right-fit planning works.

We must understand the level of precision that makes sense. For example, it doesn't make sense to plan an entire project with the same precision as planning next week's work. Likewise, planning specific deliverables for dates far out into the future is also problematic. Small time horizons increase the accuracy of our guesses.

Release often.

By deploying changes frequently, we allow the entire team to steer the direction of the project early and often. This agile approach will ensure that the final product performs as it should for its users.

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

Project: LVHN bedside kiosk

Michael Argentini Avatar
Michael ArgentiniTuesday, March 1, 2016
Lehigh Valley Hospital, Cedar Crest Lehigh Valley Hospital, Cedar Crest

Lehigh Valley Health Network (LVHN) is proudly part of Jefferson Health. LVHN's mission is to heal, comfort, and care for people and communities by providing advanced and compassionate health care of superior quality and value supported by education and clinical research.

Lehigh Valley Health Network (LVHN) partnered with Fynydd to build a curated, locked-down "kiosk" learning and entertainment experience for in-room patients. It would be deployed on Apple iPads and rolled out to a limited number of random patients. IT would gather analytics on usage through tracking of the patient's Internet access and in-person feedback. The goal was to try a new approach to educating patients about their care team, as well as what to expect when they go home, and a more enjoyable experience while in the hospital.

HIPAA requires that the device be completely cleared of all personal information between patients, and nurses needed a simple way to reset the devices, and keep patients from navigating into device settings, the App Store, and other areas that would create HIPAA and security concerns.

The first thing we had to do was ensure that HIPAA compliance was possible. After some research, we discovered that by using iOS "Guided Access Mode", we could keep patients in our app, even if the device was locked. We also discussed being able to write a system which would auto-wipe any browser or other history and input from the device whenever the user was taken to the "Acceptable Use Agreement" screen, asking for consent. We also created a shortcut for hospital staff to get there and a passcode so only hospital staff could initialize the app.

The app had lots of information about a patient's care team, what to expect during their stay, and what to do when they get home. They also had access to specific web resources, including a custom YouTube interface with curated LVHN videos.

During the testing phase, armatures which held the iPads were connected to the hospital beds, making it easier for patients in most any condition to use the device. There were no support calls, LVHN IT was able to get the analytics they needed, and some lucky patients got an even better experience.

Some of the key features include:

  • 4 months to MVP
  • API integrations
  • Github source code repository management
  • Native iPadOS app development
  • Server security audit
  • Technical research, consulting
  • Secured access to iPad
  • iPad data wiped and reset between patients
Screenshots

Key technologies

Front-end

Apple iOS

Github

Swift

Cloud back-end

Amazon Web Services

ASP.NET

C#

Github

Microsoft Windows

SQL Server

YouTube

Want to know more?

There's usually more to the story so if you have questions or comments about this post let us know!

Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!

© 2026, Fynydd LLC / King of Prussia, Pennsylvania; United States / +1 855-439-6933

By using this website you accept our privacy policy. Choose the browser data you consent to allow:

Only Required
Accept and Close