Override types for all module’s exports

I’m building a UI library and now I have this:

export * from 'npm-module'

npm-module has the following declaration

export declare const constA: string;
export declare const constB: string;
export declare const constC: string;
// ...

I would like to override the type for all the imports from npm-module, something like this:

type MyType = string

export * as MyType from 'npm-module'  // not real code, just an idea

My aim is to ensure that users will use only imported const from this module for a specific component.

Is there a way to achieve it? I guess it is something I can do with a declaration file.

Error in VSCode launch.json: “Inputs Property Not Allowed”

I’m encountering an issue with my launch.json configuration in Visual Studio Code. When I include the inputs property, VSCode displays the following error:

[{    "resource": "/home/robot/vision_servo/.vscode/launch.json",    "owner": "_generated_diagnostic_collection_name_#1",    "severity": 4,    "message": "Inputs Property Not Allowed",    "startLineNumber": 23,    "startColumn": 7,    "endLineNumber": 23,    "endColumn": 15}]

Here is the relevant section of my launch.json:

{
  // ... other configuration settings ...
  "inputs": [
    {
      "id": "package",
      "type": "pickString",
      "description": "Package name",
      "options": ["camera_deal", "vision_control", "egm_control"],
      "default": "camera_deal"
    },
    {
      "id": "program",
      "type": "pickString",
      "options": ["camera_deal", "vision_control", "egm_control"],
      "default": "camera_deal"
    }
  ]
  // ... other configuration settings ...
}

I’ve checked the VSCode documentation and it seems inputs is a valid property. I’m using VSCode version 1.84.2. Any idea why this error is occurring or how to fix it?

I attempted to use the inputs property in my VSCode launch.json configuration file, hoping to dynamically gather package and program names from the user at the start of a debug session. According to the VSCode official documentation I consulted, this seemed like a valid configuration approach. I expected that when I started a debug session, VSCode would prompt me to enter this information.

However, in reality, after I added the inputs property, VSCode displayed an error message stating “Inputs Property Not Allowed”. This left me puzzled, as to my knowledge, this should be a legitimate configuration. I checked for any JSON formatting errors and confirmed that I am using the latest version of VSCode, but the issue still persists. I haven’t tried other methods yet, as I’m unsure where to start in addressing this problem.

Display Django Form Fields depending on option selected using Javascript

I am working on a Django Project and I have the following html page which renders a form.
I do not know much of Javascript, and I think I am going wrong somewhere in the Javascript Function or something else entirely.
What I need to do is render the “id_mapnubparam01” field only when value of “id_mapnubfunction” is ‘GETDATA’. I’ve split the if condition into 2 just to be clear, the first if condition for the “p” tag works perfectly fine. However using the same if then else logic the “id_mapnubparam01” does not do anything. Any help is appreciated. Thanks.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Data</title>
</head>
<body>
    <form method="POST" enctype="multipart/form-data">
            {% csrf_token %}
            {% for field in form %}
                <div class="fieldWrapper">
                    <label>{{ field.label_tag }}</label>
                    {{ field }}
                </div>
            {% endfor %}
        <input type="submit" value="Submit">
    </form>
<p id="demo"></p>

    <script>

    function myFunction() {
      var x = document.getElementById("id_mapnubfunction").value;
      if (x != 'GETDATA') {document.getElementById("demo").innerHTML = "";
                          } else
                          {document.getElementById("demo").innerHTML = "You selected: " + x;
                          }
      if (x != 'GETDATA') {document.getElementById('id_mapnubparam01').hide();
                          } else
                          {document.getElementById('id_mapnubparam01').show();
                          }
    }
    </script>

</body>
</html>

how to fix the digital envelope routines unsupported in angular

I’m facing an issue while building my Angular application, and I’m seeking assistance to resolve it. During the build process, I’m encountering the following error.

Generating browser application bundles (phase: building)...node:internal/crypto/hash:68
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (/Users/Desktop/Apps/project/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/Desktop/Apps/project/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/Desktop/Apps/project/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/Desktop/Apps/project/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/Desktop/Apps/project/node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/Desktop/Apps/project/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/Desktop/Apps/project/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/Desktop/Apps/project/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /Users/Desktop/Apps/project/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/Users/Desktop/Apps/project/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /Users/Desktop/Apps/project/node_modules/babel-loader/lib/index.js:59:71
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}





"dependencies": {
  "@angular/animations": "^11.2.14",
  "@angular/common": "^11.2.14",
  "@angular/compiler": "^11.2.14",
  "@angular/core": "^11.2.14",
  "@angular/forms": "^11.2.14",
  "@angular/localize": "^11.2.14",
  "@angular/platform-browser": "^11.2.14",
  "@angular/platform-browser-dynamic": "^11.2.14",
  "@angular/platform-server": "^11.2.14",
  "@angular/router": "^11.2.14",
  "@angular/service-worker": "^11.2.14",
  "@capacitor/android": "^2.5.0",
  "@capacitor/cli": "^2.5.0",
  "@capacitor/core": "^2.5.0",
  "@fortawesome/angular-fontawesome": "^0.8.2",
  "@fortawesome/fontawesome-svg-core": "^1.2.27",
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
  "@nguniversal/common": "^11.2.1",
  "@nguniversal/express-engine": "^11.2.1",
  "@ngx-translate/core": "^10.0.2",
  "@ngxs/store": "^3.8.0",
  "@sweetalert2/ngx-sweetalert2": "~9.0.0",
  "ag-grid-angular": "^21.2.2",
  "ag-grid-community": "^21.2.2",
  "ag-grid-enterprise": "^21.2.2",
  "bootstrap": "4.1.1",
  "bootstrap-utilities": "^4.1.3",
  "classlist.js": "^1.1.20150312",
  "core-js": "^3.23.3",
  "crypto-js": "^4.1.1",
  "d3": "^4.13.0",
  "date-fns": "^2.17.0",
  "domino": "^2.1.3",
  "echarts": "^5.4.3",
  "exceljs": "^4.2.0",
  "express": "^4.15.2",
  "file-saver": "^2.0.5",
  "hammerjs": "^2.0.8",
  "js-cookie": "^3.0.5",
  "lodash": "^4.17.21",
  "lodash-es": "^4.17.21",
  "lzwcompress": "^1.1.0",
  "net": "^1.0.2",
  "ng-zorro-antd": "^11.4.2",
  "ngx-echarts": "^7.1.0",
  "ngx-infinite-scroll": "^9.1.0",
  "places.js": "^1.19.0",
  "postcode-validator": "^3.5.3",
  "rxjs": "^6.5.4",
  "sockjs-client": "^1.3.0",
  "stompjs": "^2.3.3",
  "sweetalert2": "^10.16.11",
  "tslib": "^2.0.0",
  "web-animations-js": "^2.3.2",
  "xml2js": "^0.5.0",
  "zone.js": "~0.10.2"
},
"devDependencies": {
  "@angular-devkit/build-angular": "~0.1102.19",
  "@angular/cli": "^11.2.19",
  "@angular/compiler-cli": "^11.2.14",
  "@angular/language-service": "^11.2.14",
  "@angularclass/hmr": "^2.1.3",
  "@biesbjerg/ngx-translate-extract": "^4.2.0",
  "@ngx-rocket/scripts": "^5.2.3",
  "@ngxs/devtools-plugin": "^3.8.0",
  "@types/jasmine": "^3.10.18",
  "@types/jasminewd2": "^2.0.13",
  "@types/lodash": "^4.14.202",
  "@types/node": "^14.18.63",
  "codelyzer": "^6.0.2",
  "hads": "^1.7.0",
  "htmlhint": "^0.11.0",
  "https-proxy-agent": "^2.0.0",
  "jasmine-core": "~3.5.0",
  "jasmine-spec-reporter": "~5.0.0",
  "karma": "~6.4.2",
  "karma-chrome-launcher": "~3.1.0",
  "karma-cli": "~2.0.0",
  "karma-coverage-istanbul-reporter": "~3.0.2",
  "karma-jasmine": "~1.1.2",
  "karma-jasmine-html-reporter": "^0.2.2",
  "karma-junit-reporter": "^1.2.0",
  "patch-package": "^6.5.1",
  "protractor": "~7.0.0",
  "stylelint": "~10.1.0",
  "stylelint-config-recommended-scss": "~3.3.0",
  "stylelint-config-standard": "~18.3.0",
  "stylelint-scss": "~3.9.0",
  "ts-loader": "^5.4.5",
  "ts-node": "^8.3.0",
  "tslint": "~6.1.0",
  "typescript": "~4.0.8",
  "webpack-cli": "^3.3.12"
}

The error is related to digital envelope routines and seems to be unsupported.
The build is using Webpack and Angular CLI.
The project is configured with Node.js v18.13.0.
I have already tried updating Node.js, reinstalling packages.

What is the correct way to transform a model variable to use NgRx state?

I’m trying to convert my Ionic app to NgRx.

In one of my components I have a model variable that connects to a textarea like this:

component:

myTextVar: string = '';

template:

<ion-textarea ... [(ngModel)]="myTextVar" ...></ion-textarea>

So, trying to convert this to NgRx I created a field in the module reducer:

const textsFeatureKey = 'texts';

export interface TextsState {
    ...
    myTextVar: string;
}

export const initialState: TextsState = {
    ...
    myTextVar: '',
};

export const textsReducer = createReducer(
    initialState,
    ...
    on(TextsActions.setMyTextVar, (state, { myTextVar }) => ({ ...state, myTextVar })),
);

an action:

export const setMyTextVar = createAction('[Texts Page] Set myTextVar', props<{ myTextVar: string }>());

and a selector:

export const selectMyTextVar = (state: AppState) => state.texts.myTextVar;

Then in the component I changed this:

myTextVar$: Observable<string>;

constructor(
    private store: Store<{ texts: any; }>
) {
    ...
    this.myTextVar$ = this.store.select(selectMyTextVar)
}

ngOnInit() {
    this.myTextVar$.subscribe(text => {
        console.log('mtv debug', text);
    })
    this.store.dispatch(setMyTextVar({ myTextVar: 'some initial text'}));
    ...
}

So far so good… it loaded myTextVar in the textarea when I do it like this:

<ion-textarea [ngModel]="myTextVar$ | async" ></ion-textarea>               

but now… How do I update the state ? I have done it like this:

<ion-textarea (ionInput)="onIonInputMyTextVar($event)" [ngModel]="myTextVar$ | async" ></ion-textarea>              

and then in the component:

onIonInputMyTextVar(event: any) {
    this.store.dispatch(setMyTextVar({ myTextVar: event.detail.value }));
}

This works. But isn’t this too far fetched to just update a model var ? I have substituted 2 lines of code by a much larger and harder to maintain code having to handle ionInput event, reducer, selector, initialization, several selects along the code…

Makes me think I’m doing something wrong. Maybe there is a simpler way to convert ngModel vars or simply I shouldn’t be using NgRx to handle simple variables cases in the component.

So my questions are:

  1. Am I doing this right ? Is there a simpler way to convert ngModel vars ?
  2. Should I really be doing this ? Isn’t traditional [(ngModel)]='myTextVar' much cleaner for simple cases like this ?
  3. Where should NgRx really be used ? Should I use it only for multi-component data ?

issue with apex-charts placing divs

I’m doing frontend project, and should correct appearance of apex-chart. I think I did nothing incorrect code. Applied:
display: flex justify-content-center,
align-items: center,
align-content: center,
align-self: center,
margin: 0 auto,
left: 0 to its parent div but nothing changed.

it’s a current appearance of my chart

I tried:

const SecondSection = () => {
const totalRevenueChartOptions = {
series: [
{
name: '2021',
data: [18, 7, 15, 23, 18, 12, 9]
},
{
name: '2020',
data: [-10, -18, -9, -14, -5, -17, -15]
}
],
chart: {
height: 300,
stacked: false,
type: 'bar',
toolbar: { show: false },
},
plotOptions: {
bar: {
horizontal: false,
columnWidth: '33%',
borderRadius: 12,
startingShape: 'rounded',
endingShape: 'rounded'
},
},
colors: ['red', 'blue'],
fill: {
colors: ['#1A73E8', '#B32824']
},
dataLabels: {
enabled: false,
},
stroke: {
curve: 'smooth',
width: 6,
lineCap: 'round',
colors: ['rgb(255, 255, 255)']
},
legend: {
show: true,
horizontalAlign: 'left',
position: 'top',
markers: {
height: 8,
width: 8,
radius: 12,
offsetX: -3
},
labels: {
colors: ['black']
},
itemMargin: {
horizontal: 10
}
},
grid: {
borderColor: ['silver'],
padding: {
top: 0,
bottom: -8,
left: 20,
right: 20
}
},
xaxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
labels: {
style: {
fontSize: '13px',
colors: ['black']
}
},
axisTicks: {
show: false
},
axisBorder: {
show: false
}
},
yaxis: {
labels: {
style: {
fontSize: '13px',
colors: ['black']
}
},
},
states: {
hover: {
filter: {
type: 'none'
}
},
active: {
filter: {
type: 'none'
}
}
}
};
return (

      <Chart 
       series={totalRevenueChartOptions.series}
       options={totalRevenueChartOptions}
       type='bar'
      />
);
}

expecting this:

How to import html to a docx template file?

I am writing a node.js program to bind data to a docx template.
I am using the Docxtemplater library to do the job.
The Docxtemplater library is working properly.
Unfortunately, some data is an HTML string, by default, the library does not parse the HTML, and it requires an extra module to parse the HTML string, however, I need to pay for this module.

So, I want to know if another library can perform the above functions.

Specific Regex character

I try to make highlight text function use replace and regex in react javascript

export const highlightKeyword = (
  text: string,
  searchFor: string | undefined
) => {
  if (!searchFor) return text;

  const result = text.replace(
    new RegExp(`(${searchFor})`, 'gi'),
    (_, match) => {
      // preserve capital on this match
      return `<b>${match}</b>`;
    }
  );

  return result;
};

but getting error when searchFor param is ‘(‘, any solution for this ?

Why does the Navigator.getBattery () method get the device power?

Can someone tell me? I believe it should be included in the V8 engine, but I can’t find the source code. I hope to find the code in the V8 engine to implement this function.

e.g

let batteryIsCharging = false;

navigator.getBattery().then((battery) => {
    batteryIsCharging = battery.charging;

    battery.addEventListener('chargingchange', () => {
        batteryIsCharging = battery.charging;
    });
});

How to show 6 labels in Y-axis in Line-chart (react-native-chart-kit)

i am using react-native-chart-kit this library, it is working fine. But I need to show 6 labels in y-axis. Right now it was showing 5 labels even if i declared 6 labels. I want to show 100 label in y-axis. I need to show 0,20,40,60,80,100 labels in y-axis. I’ve changed the height also but it doesn’t work. Please help me out this!
Thank in advance.

Github link :- https://github.com/indiespirit/react-native-chart-kit/issues/716

Code:-
`function* yLabel() {
yield* [“0”, “20”, “40”, “60”, “80”, “100”];
}

const yLabelIterator = yLabel();

<LineChart
bezier
// withHorizontalLabels={false}
// withVerticalLabels={false}
yAxisInterval={2}
data={{
labels: [‘Week 1’, ‘Week 2’, ‘Week 3’, ‘Week 4’],
datasets: [
{
data: [10, 70, 60, 40, 20, 50],
strokeWidth: 2,
color: (opacity = 1) => rgba(255,0,0,${opacity}), // optional
},
{
data: [20, 40, 60, 80, 80, 90],
strokeWidth: 2,
color: (opacity = 1) => rgba(0,0,102, ${opacity}), // optional
}
],
legend: [‘Organic’, ‘Paid’],
}}
formatYLabel={() => yLabelIterator.next().value}
width={Dimensions.get(‘window’).width – 16}
height={200}
chartConfig={{
backgroundColor: ‘#1cc910’,
backgroundGradientFrom: ‘#eff3ff’,
backgroundGradientTo: ‘#efefef’,
decimalPlaces: 2,
color: (opacity = 1) => rgba(0, 0, 0, ${opacity}),
style: {
borderRadius: 16,
},
}}
style={{
marginVertical: 8,
borderRadius: 16,
}}
/>`

Screenshot:-

enter image description here

Problem with Cognito: Logins don’t match. Please include at least one valid login for this identity or identity pool

I have the following problem with AWS Cognito:
Objective: To register a user, confirm registration with email code, authenticate upon user confirmation successful, and run a dynamodb query.

Observed issue: The registration is successful, the email code is received, and when it is entered immediately after receiving it on email, the subsequent user authentication is successful, the credentials refresh is successful, and the dynamodb query works normally. On the other hand, when I wait at least one minute since receiving the code on email, the registration confirmation is successful, the subsequent user authentication is successful, but the credentials refresh prior to running the dynamodb query fail with the following error:

NotAuthorizedException: Logins don’t match. Please include at least one valid login for this identity or identity pool.

I’ve been banging my head against this for two days and haven’t got the slightest idea of what I’m doing wrong… please help?

This is my code:

cognitoUser.confirmRegistration(confirmationCode, true, function(err, result) {
                if (err) {
                    alert(err.message || JSON.stringify(err));
                    confirmUserRegistration();
                } else {
                    console.log('Confirmation successful');
                    
    
                    var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
                    
                
                    cognitoUser.authenticateUser(authenticationDetails, {
                        onSuccess: function(session) {
                            console.log('authentication successful', session);
                    
                            var idToken = session.getIdToken().getJwtToken();
                            
                            AWS.config.credentials = new AWS.CognitoIdentityCredentials({
                                IdentityPoolId: "pool correctly configured",
                                Logins: {
                                    ['cognito-idp.us-east-2.amazonaws.com/user pool correctly configured']: idToken
                                }
                            });
                            
                              // Refresh credentials
                            AWS.config.credentials.refresh((error) => {
                                if (error) {
                                    console.error(error);
                                } else {
                                    // Credentials refreshed successfully
                                    console.log('Credentials refreshed');


                                    
                                     AWS.config.update({
                                        region: 'us-east-2' 
                                    });
                                    
                                    
                                    const dynamodb = new AWS.DynamoDB.DocumentClient();
                                    

                                    queryCLIENTSDB(dynamodb).then(highestID => {
                                        console.log("Highest ID from DynamoDB:", highestID);
                                        
                                        highestID++;
                                        console.log("New ID", highestID);
                                        addUserToDynamoDB(highestID, username);
                                        
                                    }).catch(err => {
                                        console.error("Error querying DynamoDB:", err);
                                    });
    
                                }
                            });

cringiest moments of her lifestyles, eurich has collected a following of over 1 million on tiktok

through disclosing some of the maximum intimate and admittedly cringiest moments of her lifestyles, eurich has collected a

https://www.topbestbloggeronline.com/

through disclosing some of the maximum intimate and admittedly cringiest moments of her lifestyles, eurich has collected a following of over 1 million on tiktok
through disclosing some of the maximum intimate and admittedly cringiest moments of her lifestyles, eurich has collected a following of over 1 million on tiktok

Could not make legend work for my graphicsLayer()

I have successfully added a graphicsLayer. when i want to view legend for the added layer i couldnt add it, i get “No legend”.

here my function adding the graphics layer, please help me or explain whats the issue when i try to add legend to the div id =”legendDivD”

async function conversionFunction() {
    try {
        for (i = 0; i < obj.length; i++) {
            var lati = obj[i].Latitude;
            var longi = obj[i].Longitude;
            var schoolCode = obj[i].Departmentcode;
            var pointxy = await xyConversion(longi, lati);
            var newData = {
                Latitude: pointxy.pnt_lat,
                Longitude: pointxy.pnt_lon,
                schoolCode: schoolCode
            }
            dataArr.push(newData)
        }
        console.log(dataArr)
        schLayer = new GraphicsLayer({ id: 'SchoolsLayer' });  // Create a single GraphicsLayer

        for (var i = 0; i < dataArr.length; i++) {
            var tmplteJson = { title: "Details", content: `Department code : ${dataArr[i].schoolCode} ` };
            var attributes = {}
            var poly_point1 = new esri.geometry.Point([dataArr[i].Longitude, dataArr[i].Latitude], new esri.SpatialReference({ wkid: 4326 }));
            var pointgraphic = new Graphic(poly_point1, dataArr[i].schoolCode.length == 11 ? markerPresSymbol : markerPropSymbol);
            pointgraphic.setInfoTemplate(new InfoTemplate(tmplteJson));
            schLayer.add(pointgraphic);
        }
        var legend = new Legend({
            map: map,
            //autoUpdate: true,
            layerInfos: [{ layer: schLayer, title: "" }]
        }, "legendDivD");
            map.addLayer(schLayer);
            legend.startup();
        
        $("#loading1").css('display', 'none');
    } catch (error) {
        console.error(error);
    }
}