Skip to content

Instantly share code, notes, and snippets.

View bseddon's full-sized avatar
💭
Working hard on XBRL and XAdES signing

Bill Seddon bseddon

💭
Working hard on XBRL and XAdES signing
  • Lyquidity Solutions Limited
View GitHub Profile
@bseddon
bseddon / syncfusion-olap-engine.md
Created December 1, 2022 14:34
Syncfusion OLAP engine query

Syncfusion has a great JavaScript pivot table. Under the covers is support for OLAP (Analysis Services or Mondrian) not just relational or JSON or CSV. This support is implemented in a class called OlapEngine. This engine can be used separately to access data from an AS cube when there is a need to create some kind of custom report. The engine module can be imported:

import { OlapEngine } from '@syncfusion/ej2-pivotview';

Note this use of import assumes there is a script map from '@syncfusion/ej2-pivotview' to a web accessible place that implement OlapEngine.

The engine can then be used to access data:

@bseddon
bseddon / Mapping-using-D3.md
Last active January 26, 2023 00:43
D3 mapping example

This is not a review of all the ways D3 can be used to create maps and all the formats that can be used. It's a review of my use of D3 and how to use information within shape files published by, for example, US Census Bureau.

Let's suppose you want to create a map of all the zip codes in New Jersey and show something about each one. Here's a way to do it.

Create a folder. I'll call it 'mapping'.

Begin by downloading a source of zip codes for NJ. Copy the page of zip code and paste into Excel (drop the formatting). Delete all the columns except the one containing the zip code and so there are only zip codes then save as a CSV into the mapping folder.

Next download the Zip code tabulation areas (zctas) file and unzip again into the 'mapping' folder. The two key files are the shape file (.shp) and the database format (.dbf). T

In the previous gist it was shown how to retrieve geometries in order to create SVG maps using D3. A geometry is just a sequence of latitude and longitude values for a shape. The same geomtries can be used to create overlays for Google Maps. Creating an overlay using a single array of points is covered in the Google Maps API documentation. Instead this gist covers handing multiple geomtries where the aim is to merge them so they can be shown as one continuous area.

The scenario might that you have geometries for all the counties of a state an want to use them to show the whole state. In this example, the aimn is to show the area served by the NJ Cumberland, Salem and Cape May Workforce Board. Given the name, it will no surprise that the board covers these three counties. There is no single geometry for this area but geometries for the three counties are available from the US Census Burea

@bseddon
bseddon / why-not-react.md
Last active July 16, 2024 23:56
Why not React?

Everywhere you turn there's React. But why? Back in the day browsers were less functional and less compliant so it may have made sense for Facebook to create a tool in which their developers could work without needing to pay attention to browser differences.

I guess there are some companies for which this is still true but for many others its not. Most companies I work with use modern versions of Chrome, Edge, Safari or Fiefox. They run modern versions because the compliance functions of their organizations insist on it because they don't want an old bropwser version to be the reason they get sued for negligence after a hack.

All modern browsers are functionally complete and its hard to find a difference that has any relevance in the vast majority of cases. In my view, the case for React does not exist. It's a legacy tool that's outlived its usefulness but because Facebook uses it, it must be the right thing to use. No. React introduces a redundant run/build process so JSX can be turned into, you k

@bseddon
bseddon / wp-theme.md
Last active January 24, 2024 01:15
Different WordPress theme by users

When developing a large application in WordPress one option is to implement it as a theme rather than a series of plugins. When the project has multiple developers, a challenge then is how to provide each developer their own environment. If the site is standalone then each developer can have their own local WP instance. But what about the database? If different developers are adding records to different databases how are they merged.

Anyway, in my scenario there's a simpler approach. Let each developer have their own copy of the theme within the themes folder. The only requirement then is to be able to allow each user to choose or to be allocated a specific theme. This is really easy to do.

The main function is the one that reacts to the 'wp_loaded' action. The action function looks to see what theme template folder is defined in user meta for the user and returns it. Otherwise it returns a default theme folder.

The rest of the code adds a dropdown of the available themes to the user profile page

@bseddon
bseddon / moving-windows-user-profile-location.md
Created April 1, 2025 10:04
Moving windows profile storage location

By default Windows stores user profile data within the c:\Users<username> folder. Because this default location is on C: which is often the system drive, the drive can easily run out of space. Moving them to a different drive using a junction addresses this problem.

To do this, a user's files have to be moved to a different location and then delected from c:\Users so a junction to the new location can be created. But a user can't delete their own files because they are being... used.

If its possible to boot to safe mode then this is an option but on a live server this may not be an option. In such a case, another administrator can do it for you but can it be done without requiring a different admin? Yes but the account being used does need to be a member of the Administrators group.

First change the registry entry for your user so it points to a nonexistent location. The registry key for all user profiles is:

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\

@bseddon
bseddon / NullAudio.php
Created June 4, 2025 09:14
Splitting audio files in silent spaces using PHP
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/