Categories
Development

Compare 2 big string lists

I have two lists of strings – this is not mandatory, i can convert them to any collection (list, dictionary, etc). First is “text”: Birds sings Dogs barks Frogs jumps Second is “words”: sing dog cat I need to iterate through “text” and if line contains any of “words” – do one thing and if […]

Categories
Development

delete database entries if expired (based on date) using query builder

I would like to delete all my invalidated json web tokens from the database that have expired already. I’m using TypeORM and I think I have to use the query builder for that. My token entity has a column representing the time the token expires @Column() public expiresOn: Date; I want to setup a cronjob […]

Categories
Development

In VSCode, right click and select “Run Jest” returns error “The system cannot find the path specified.”

this has been doing my head in most of the evening. In VSCode, inside a .test.tsx file, I right click and select “Run Jest” and I get returned the error “The system cannot find the path specified.” This does not happen when running all tests from npm scripts within package.json file. Using Windows 10, VSCode […]

Categories
Development

Android Dynamic View Positioning

I need view2 to be next to view1 IF view1 is not filling the whole width. If the width of view1 is match_parent (or match_constraint) then view2 should be under it. For example if my TextView text is short a timestamp be next to it If TextView text is multiline the time stamp be under […]

Categories
Development

How to mock a shadow element in jest testing

I have a react component ReactComponentContainer, which gets config and shadowRoot. import React from ‘react’; import App from ‘./App’; import ReactComponent from ‘./ReactComponent’; const ReactComponentContainer = function({config, shadowRoot}) { configme(shadowRoot.host || shadowRoot); return ( <App renderRoot={shadowRoot}> <ReactComponent/> </App> ); }; export default ReactComponentContainer; In my jest test file, I need to mock a shadow dom, […]

Categories
Development

DELPHI 10.3 – loop while until key pressed little problem

Goodmorning everyone, I wrote a very simple application in which I have to wait for the user to press a key (for example F2) to continue processing. The waiting cycle for pressing the button works perfectly, but the problem I need help with is this: if, during the waiting cycle of pressing a button, I […]

Categories
Development

Convert / cast string to numeric with Dutch locale

I have a string like 12,3 in my PostgreSQL database, which I want to cast / convert to a numeric or double type. If I would have the English decimal point, I could simply do ‘12.3’::numeric(10,2). I can of course replace the comma with REPLACE but that feels ‘hacky’, as this is a locale problem, […]

Categories
Development

VSCode geddski’s Macro Extension: How to write a snippet by simply writting the 3 first letters, and then choose the snippet in the suggestions?

I use https://marketplace.visualstudio.com/items?itemName=geddski.macros to create my macros in Visual Studio Code. My aim is to simply write “pre”, then Visual would show me some autocompletion suggestions. Among them, my macro. If I choose the latter, Visual will write my snippet <pre> var_dump($x); </pre>. However I don’t know how to do that. The documentation seems to […]

Categories
Development System & Network

VPS PHP-FPM max requests – httpd down error

My server down after every 2,3 hours and return error on email “The service “httpd” appears to be down.” My Hosting provider give me solution to increase PHP-FPM “max-request” and “child-request” size. Kindly suggest me accurate request size that is best for me. Below are my reports. => Google Analytics Data, Active users: 200 to […]

Categories
Development

How can I access to the reference in an internal table (ABAP)?

How can I access to the reference in an internal table? class class1 DEFINITION. public SECTION. data: data type string. data: children type standard table of REF TO class1 with empty key. methods constructor importing data type string. CLASS class1 IMPLEMENTATION. METHOD constructor. me->data = data. ENDMETHOD. endclass. START-OF-SELECTION. data children type standard table of […]