How can I determine the duration of valid time remaining on a TOTP token countdown?

I’m studying concepts of OTP with a small application to generate and validate HOTP and TOTP tokens. I’m stuck on the formula used to determine the expiration in seconds of a TOTP token at any given time; the countdown value displayed in MFA mobile apps.

The formula described in Section 4 of RFC6238 suggests simply that TOTP = HOTP(K, T). I’ve not been able to observe this in practice.

Wiki’s for TOTP Algorithm and HOTP Algorithm.

I started by testing the constituent components of the formula with static values in this Vanilla JavaScript example (42 lines, heavily commented). Each section describes the TOTP Algorithm accompanied by an associated variable or formula.

I’m expecting the final output to be a realistic integer representing the duration of time remaining before a token expires.

Provided static values T=now(), T0*=0 and X=30, the formula const Ct = Math.floor((T-T0) / X) produces 57075351, obviously not accurate.

I’ve also created this basic Angular implementation to incorporate scripted OTPAuth functionality.

OTPAuth GitHub, NPM Package, OTPAuth documentation.

Responsive Timeline in Oracle APEX

I am designing an app in Oracle Apex and I need help implementing a concept. Basically, I want to open a timeline with the important dates I have marked for a specific object when it is selected.

Example: If I am talking about real estate construction X, I want the timeline to be able to show the start date, foundation date, construction survey, and completion date. If it is construction Y, I want it to do the same, but with its own dates.

Here are some additional details about the concept:

The timeline should be interactive, allowing users to navigate between different dates and view additional information for each date.
The timeline should be customizable, so that I can add and remove certain filters

I have a few ideas about how to implement this concept, such as adding CSS or HTML to my page, but I would appreciate any feedback or suggestions you may have.

Thank you for your time!

How to have two window.onscroll functions on the same page

I have two window.onscroll functions, each one works, however when they are both added only the one listed first will work?

<script>
window.onscroll = function() {scrollFunction()};

function scrollFunction() {
  if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) {
    document.getElementById("navbar").style.padding = "30px 10px";
    document.getElementById("logo").style.fontSize = "25px";
  } else {
    document.getElementById("navbar").style.padding = "80px 10px";
    document.getElementById("logo").style.fontSize = "35px";
  }
}
</script>


<script>
window.onscroll = function() {topofpage()};

function topofpage() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("topofpagescroll").style.width = scrolled + "%";
}
</script>

Is there a way to convert a raw TXT file to a JSON format please?

Here an example

Question n ° 465

In normal operation:

a) I have to drive in the middle of the road

b) I have to drive to the left of the roadway

In normal operation:

a) I have to drive in the middle of the road

b) I have to drive to the left of the roadway

c) I have to drive near the right edge of the road as much as the permetenen

What I want to have:

{

  "id": 453,

  "question": "Quelles sont les précautions à prendre pour aborder un virage ?",

  "reponses": [

    {

      "texte": "Garder la même vitesse pour vite aborder le virage",

      "correcte": false

    },

    {

      "texte": "Ralentir avant d'aborder le virage",

      "correcte": true

    },

    {

      "texte": "Rouler au milieu de la chaussée avant d'atteindre le virage",

      "correcte": false

    },

    {

      "texte": "Bien serrer la droite avant d'aborder le virage",

      "correcte": true

    }

  ]

},

{

  "id": 454,

  "question": "Que signifie le panneau B2c ?",

  "reponses": [

    {

      "texte": "Interdit de tourner à gauche",

      "correcte": false

    },

    {

      "texte": "Interdit de faire marche arrière",

      "correcte": false

    },

    {

      "texte": "Interdit de faire demi-tour jusqu'à la prochaine intersection incluse",

      "correcte": true

    },

    {

      "texte": "Interdit de faire marche arrière jusqu'à la prochaine intersection incluse",

      "correcte": false

    }

  ]

},

Use chart.js version 4.4.2 in Vue3 project get error

use import { Chart } from "chart.js/auto"; in JavaScript file then console report a error:

GET http://localhost:5173/node_modules/.vite/deps/chart__js_auto.js?v=2ebd765d net::ERR_ABORTED 504 (Outdated Optimize Dep)

trying to use .js file but it work different from npm install version.

Knock notification service not working calling from a cron job in NextJS

I am deveolping a web app in React, NextJS and I’m using Knock as notification system for sending in-app notifications when some event happens. In this case i want to send a notification to all users when a report get created.
Reports are created automatically and the function is triggered by a cron job which starts when the app is launched and then executes every week (currently, for testing purposes, every minute).

My problem is, I have created a function which starts the cron and every time it extecutes it creates a fake CSV report (that is saved in the public folder) and then it launches the notification.

Everything works fine, async-await instructions work perfectly but Knock doesn’t receive anything, problem is the executions ends correctly, I can’t understand why, does anyone have any idea?

Here’s the code of the cron:

export const GET = async () => {
    const host = process.env.NEXT_PUBLIC_HOSTNAME;
        
        cron.schedule("* * * * *", async () => {
            const date = new Date();            
            const knock = new Knock(process.env.KNOCK_API_KEY);

            try {
                const csvWriter = createObjectCsvWriter({
                    path: "./public/test.csv",
                    header: [
                        { id: "name", title: "NAME" },
                        { id: "lang", title: "LANGUAGE" },
                        { id: "country", title: "COUNTRY" },
                        { id: "countrys", title: "COUNTRYs" },
                        { id: "langs", title: "LANGUAGEs" },
                        { id: "names", title: "NAMEs" },
                        { id: "countrya", title: "COUNTRYa" },
                        { id: "langa", title: "LANGUAGEa" },
                        { id: "namea", title: "NAMEa" },
                        { id: "paesea", title: "NAMEa" },
                    ],
                });

                const numeroRecord = 1000;

                const records = [];

                // Ciclo for per generare i record
                for (let i = 0; i < numeroRecord; i++) {
                    const record = generaRecordCasuale();
                    records.push(record);
                }

                await csvWriter.writeRecords(records).then(() => {
                    console.log("CSV creato");
                });

                console.log(
                    "CRON JOB: Generazione report - Cron job eseguito " +
                        date +
                        " su istanza: " +
                        process.pid
                );

                await knock.workflows.trigger("reportlink-test", {
                    data: {
                        machinery: "Escavatore EJ-93Y",
                        date: "22/01/2024",
                        url:
                            "http://" +
                            process.env.NEXT_PUBLIC_HOSTNAME +
                            "/macchinari",
                    },
                    recipients: [
                        {
                            id: "1",
                            name: "John Hammond",
                            email: "[email protected]",
                        },
                    ],
                });

            } catch (error) {
                console.log(
                    "CRON JOB: Generazione report - Errore nella generazione del record. " +
                        error
                );
            }
        });
return new Response(
            "CRON JOB: Generazione report - Cron job eseguito con successo.",
            { status: 200 }
        );
    } catch (error) {
        console.log(error);
        return new Response(
            "CRON JOB: Generazione report - Errore nello starting del cron",
            { status: 400 }
        );
    }
};

triggering the function manually (creating a button in front end and calling the same function) in another file route.js works, the notification pops up so is not a code problem (the code is the same), it’s not even an API key problem. The server (vs studio since i’m executing in local) console doesn’t show any error or warning.

Can I Filter an Array of Objects Inside an Array of Objects in JS using .filter()? [closed]

I want to go through an array of objects inside an array of objects, and save only certain items using Array.prototype.filter().

I tried to map the outer array and inside it go through each array with filter to extract each object.
In the code below I have cut it down a bit so it’s simpler to read.

const newerGroups = newGroups.map((group) => {group.hashtags.filter((hash) => hash.selected)});

Example for an instance of newGroups:

{
 0:{
  hashtags: {
    0: {
      phrase: "React",
      selected: true
    }
    1: {
      phrase: "JavaScript",
      selected: true
    }
    2: {
      phrase: "Java",
      selected: false
    }
  }
  title: "OOP"
 }
 1:{
  hashtags: {
    0: {
      phrase: "Express",
      selected: true
    }
    1: {
      phrase: "Node",
      selected: true
    }
    2: {
      phrase: "Spring",
      selected: false
    }
  }
  title: "Libs"
 }
}

With the current code snippet, I get returned an Array of undefined ([undefined, undefined, undefined])

Netilfy 404 contentScript.js i18next

It’s been about 4 years since I touched this app but since then there’s been settings that I had to change and this 404 pops up. I don’t see this js file anywhere in my build so I’m wondering why there’s a loading error. enter image description here

jQuery toggle effect not working for non-logged-in users in WordPress

I wrote this jquery code to make a toggle effect

and the toggle effect is work but for this i have to loged in dashboard but when I log out or other profile or other browser then this toggle effect is not working

can you tell me how to do that without any error

!important this code writen on function.php

Well If needed then please modified the code or give me some suggestion to do that

Gamil Account Recover [closed]

[verification code is to time but gamil no login my mobile]https://stackoverflow.com/feeds recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover my gamil account
recover myrecover my gamil account
gamil account

https://i.stack.imgur.com/ZwjQj.jpg)

How to i recover my gamil accout

Twilio Studio – How I make a http resquest using the widget http request – authorization

friends. I’m developing an IVR using Twilio Studio. Currently, I need to make an HTTP request. Since the APIs are for private use, I first need to go through authorization using my username and password, which generates an access token. How do I authorize myself and then make another request (already having a token)?

What I’ve done so far: I’ve created a function that will query the Asset that contains the user and password parameters (json), and then it will make the HTTP request to the endpoint URL in question. However, the error below is presented.

My function

const axios = require('axios');

exports.handler = function(context, event, callback) {
    // URL of your asset
    const assetUrl = 'https://authorizationtoken-2014.twil.io/token.json';

    // Make an HTTP request to obtain asset data
    axios.get(assetUrl)
        .then(response => {
            // Check if the response was successful
            if (response.status === 200) {
                // Process the asset data
                const assetData = response.data;
                console.log('Asset data:', assetData);

                // Now you can access the asset information, such as user and password
                const user= assetData.user;
                const password = assetData.password;

                // Check if user credentials are provided
                if (!user|| !password) {
                    return callback("User credentials not provided.");
                }

                // Create the authentication endpoint URL using the asset credentials
                const endpointUrl = `https://xxxxxxxxxxxxx/apigateway/token?user=${encodeURIComponent(user)}&password=${encodeURIComponent(password)}`;

                // Make an HTTP request to obtain the access token
                axios.get(endpointUrl)
                    .then(response => {
                        // Check if the response contains the access token
                        const token = response.data.access_token;
                        if (token) {
                            // Access token obtained successfully
                            callback(null, { success: true, token: token });
                        } else {
                            // Access token not found in the API response
                            callback("Access token not found in the API response.");
                        }
                    })
                    .catch(error => {
                        // Error while making HTTP request
                        callback(`Error obtaining access token: ${error}`);
                    });

            } else {
                // Response was not successful
                throw new Error(`Request error: ${response.statusText}`);
            }
        })
        .catch(error => {
            // Handle errors while obtaining asset data
            console.error('Error obtaining asset data:', error);
            callback(error);
        });
};

Log Detail

Request URL: https://authorizationtoken-2014.twil.io/authorization
Request Method: POST
Response Status Code: 500
Response Content Type: text/plain

Error

  "function_1": {
      "status_code": 500,
      "content_type": "text/plain",
      "body": "Error: Request failed with status code 403"
    }

how to use useSelector and its mapdispatch equivalent

I am figuring out how to convert connect code to useSelector in redux.
What is the equivalent of mapDispatchProps in useSelector api?
How would you convert the two following codes to useSelector api?

const mapStateToProps = (state) => ({ currentUser: state.user, });

const mapDispatchProps = (dispatch) => bindActionCreators({ fetchUser, fetchUserPosts }, dispatch);

export default connect(mapStateToProps, mapDispatchProps)(main);
import React from 'react'
import { View, Text, Image, FlatList } from 'react-native'
import { auth } from '../../firebaseConfig'

import { fetchUserPosts } from '../../redux/actions/index.js'

import { connect } from 'react-redux'

function Profile(props) {
  const { currentUser, posts } = props;
  console.log({ currentUser, posts });
  return (
    <View>
      <Text>Profile</Text>
    </View>
  )
}

const mapStateToProps = (store) => ({
  currentUser: store.userState.currentUser,
  posts: store.userState.posts,
})

export default connect(mapStateToProps, null)(Profile);

Network Request Failed Android – React Native / Capacitor

I’m having an issue while making a POST request using React Native on an Android 6 simulated device.
It works on recent Android versions though.
The url is a https
usesCleartextTraffic did not work.
This is my fetch:

    fetch(url, {
      method: 'POST',
      credentials: 'include',
      headers: new Headers({
        Accept: 'application/json',
        'Content-type': 'application/json',
        Authorization: 'Bearer',
      }),
      body: JSON.stringify(request),
    })
      .then(response => {
        if (!response.ok) {
          throw new Error('Network response was not ok');
        }
        return response.json();
      })
      .then(response => {
        Alert.alert('test', JSON.stringify(response));
      })
      .catch(error => {
        console.error('There was a problem with your fetch operation:', error);
      });

…………………………………………………………………………………

Oauth2.0 by okta while integraing nodejs with ifttt service

I am trying to integrate ifttt with nodejs and while creating ifttt service I need oauth for authentication. I have created a application in oauth in okya then I got the credentials like client id and authorization url and all… Now I have cdeated a api in okta which is useful for token authentication but i am confused how this api is gonna verify the token

I would be good if you explain about application, api, scope, audience of oauth and how to verify the token

How to fade in elements to a specified opacity percentage?

CSS that applies the opacity for the element

#urlTextOne {
    opacity: 80%; 
}

I have JS that applies the ‘fadeIn’ class to the element after page load

.fadeIn {
    animation: fadeIn 5s;
}
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 80%;}
    
}

Here’s the JS that removes the display none and then add’s the class to fade in

urls[i].classList.remove('d-none'); 
urls[i].classList.add('fadeIn');

I tried using the CSS animation above but it fades from fully opacity into no opacity and then flashed to the 80% opacity. I’m confused why the animation goes to no opacity and then jumps to the 80%. Additionally, I never remove the class that applies the 80% opacity.