Categories
Mastering Development

Autoit – “possibly used before declaration” and “undeclared global variable” Compile Error

This is my first aproach to AutoIt and my apologies for the basic questions I have an AutoIt program/code that is made of 2 .au3 files 1 – I would like to ask, how does that files work together (how they can be combined, if this is possbile) or are they supposed to be 2 […]

Categories
Mastering Development

window.crypto returns 352 bit key instead of 256?

I’m trying to encrypt some text using window.crypto: await crypto.subtle.encrypt(algorithm, key, dataArrayBuffer).catch(error => console.error(error)); However I get this error AES key data must be 128 or 256 bits. I’m using PBKDF2 to create a 256 bit key from a password and I specify a key length of 256: window.crypto.subtle.deriveKey( { "name": "PBKDF2", "salt": salt, "iterations": […]

Categories
Mastering Development

conversation reference (concurrent dictionary become blank) after IIS pool recycle

We have a bot design in Bot framework-4 using .Net c# sdk. This bot is hosted on IIS and available on different channel such as Directline, MS Teams etc. We want to send proactive messages to all the user in MS teams to notify them irrespective of if they communicated with bot or not. The […]

Categories
Mastering Development

I am having a very strange issue using styled-components. I have a style rule which should be applied to <tr> elements on focus: const TableStyles = styled.table` width: 100%; table-layout: auto; border-collapse: collapse; tr:focus { background-color: #e7f0ff; } `; This rule works for the table rows in the table body but does not work for […]

Categories
Mastering Development

Strictly typing result of Object.Entries

I have the following; export interface Tiles { rock: Tile, tree: Tile } export interface Tile { passable: boolean; positions: number[][]; } I have used the data like so; for (const [key, val] of Object.entries(tiles)) { draw(ctx2d, key, val); } Though Object.entries doesn’t preserve type. I’d like to ensure key only allows ‘rock’ or ‘tree’, […]

Categories
Mastering Development

How does this recursive Python code work?

I came across this recursive function that’s supposed flatten a dictionary: def flatten(data, prefix=”, separator=’.’): """Flattens a nested dict structure. """ if not isinstance(data, dict): return {prefix: data} if prefix else data result = {} for (key, value) in data.items(): result.update(flatten(value,_get_new_prefix(prefix, key, separator), separator=separator)) return result def _get_new_prefix(prefix, key, separator): return (separator.join((prefix, str(key))) if prefix […]

Categories
Linux Mastering Development Ubuntu

Installing RealVNC armhf version on Ubuntu Mate 20.04 (arm64) on Raspberry Pi 4

I’m trying to get VNC running on the above and I’ll try and quickly run down how I managed to get to the position where it’s almost working. So I installed the arm64 image from RealVNC download and then obviously got this error as I’m running the arm64 Ubuntu Mate and RealVNC only offer an […]

Categories
Linux Mastering Development Ubuntu

Installing RealVNC armhf version on Ubuntu Mate 20.04 (arm64) on Raspberry Pi 4

I’m trying to get VNC running on the above and I’ll try and quickly run down how I managed to get to the position where it’s almost working. So I installed the arm64 image from RealVNC download and then obviously got this error as I’m running the arm64 Ubuntu Mate and RealVNC only offer an […]

Categories
Mastering Development

Modify object property with a variable in typescript

In js I have a function which modify properties of an object contained in a list of object according to parameters: function edit(object, key, property, value){ object[key][property] = value; } How would I manage to do the same function in TypeScript ? From now I’ve made this: function edit(object: ObjectList, key: string, property: string, value: […]

Categories
Mastering Development Software

When designing an API in Javascript with closures, should I provide singletons or factories for directly creating objects to clients?

I’m designing an API in Javascript part of an Angular with typescript project. I have involved later in this project implemented. There is a DataStorageService which I checked from git logs that essentially like this in the beginning. @Injectable({ //Injected an instance of it to DI container in startup by angular. providedIn: ‘root’ }) export […]