Connecting to RDS (Oracle) from Github Actions

I have a nodejs script which connects to an Oracle DB which is in a private VPC. I can run this script without any issues on my machine, and in a lambda. I need to run this from Github Action. I have stored DB_USER, DB_PASSWORD AND DB_CONNECTION in SECRETS and passing them to the js script. I am reading them as process.env…. in my script. I have verified the values. But when I try to get the connection, it never
connects and times out after 60 seconds printing this error:

Request exceeded “transportConnectTimeout” of 60 seconds.

If I have the DB credentials, but if the DB is in an AWS account in its own private VPC, do I need to do anything else to access it in Github Actions?

Thank you for any help!!

My yaml script:

name: DB Connection
on:
  workflow_dispatch:
  
jobs:
  build:
    runs-on: ubuntu-latest
    environment: dev
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2  # Set up Node.js
        with:
          node-version: '20.9'

      - name: Install dependencies
        run: npm install  

      - name: Run JS
        env:
          DB_USER: ${{ secrets.DB_USER }}
          DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
          DB_CONNECTION: ${{ secrets.DB_CONNECTION }}
        
        run: node ./src/test-db-connection.js

My JS (test-db-connection.js):

import oracledb from 'oracledb';

async function testConnection() {
    let connection;

    try {
    
    connection = await oracledb.getConnection({
            user: process.env.DB_USER,
            password: process.env.DB_PASSWORD,
            connectString: process.env.DB_CONNECTION,
        });

        console.log("Database connection successful!", connection);

    } catch (err) {
        console.error("Database connection failed:", err.message);
    } finally {
        if (connection) {
            try {
                await connection.close();
            } catch (err) {
                console.error('Error closing the connection:', err);
            }
        }
    }
}

testConnection();  

Seeking Collaboration to Improve Stability, Interactivity, and Deployment of My React.js Game on GitHub Pages (Beginner)

I’m a beginner working on a game in React.js, and I need help from the community to make it more stable, interactive, and successfully deployable on GitHub Pages. I’ve encountered some issues with GitHub Pages during deployment, specifically related to Jekyll and Liquid syntax errors in my README.md file, and as a beginner, I’m not familiar with Jekyll or how to resolve these issues.

Details about the Game:

Concept: The game challenges players to memorize and repeat a color sequence, enhancing both memory and engagement. As the game progresses, sequences grow, making it more challenging and interactive.

Features:

Displays a sequence of colors that players must watch and repeat.
Players click buttons representing colors; the sequence grows longer with each round if guessed correctly.
Feedback, messages, and dynamic styles are provided based on the player’s actions and results.
Technologies Used: Built using React.js, leveraging Hooks (useState, useEffect) for managing game state, JavaScript for game logic, and Tailwind CSS for responsive, styled UI elements.

The Problem:

GitHub Pages Deployment Issue: Every time I try to deploy the game, the build fails due to errors pointing to Liquid syntax in the README.md file. Despite trying to correct the syntax as suggested by the error messages, the build continues to fail, and I don’t understand why Jekyll is causing these conflicts.

Jekyll Confusion: I’m not sure what Jekyll is or why it’s involved in the GitHub Pages build process. I would appreciate any advice on whether Jekyll is necessary for this project or if there’s a way to disable it to simplify deployment.

Game Stability and Interactivity: In addition to deployment issues, I’d like feedback on improving the game’s stability and user engagement to make it more polished and enjoyable.

What I’m Looking For:

Deployment Assistance: Any guidance on overcoming the Jekyll and Liquid syntax errors to deploy the game on GitHub Pages successfully.

Collaboration to Enhance Gameplay: I’m open to collaborating to make the game more interactive and enjoyable, as this is one of my first significant projects in React.js.

General Tips and Feedback: Suggestions for debugging, improving code quality, or using best practices as a beginner.

What did I try?

Fixing Jekyll Errors: I researched the Jekyll and Liquid syntax error and attempted to modify my README.md file based on suggestions, such as removing any {} brackets or renaming the file. I also tried disabling Jekyll by adding a .nojekyll file in the root of my repository, but the build still failed.

Experimenting with Deployment Settings: I explored various GitHub Pages settings, including adjusting the branch used for deployment, but it didn’t resolve the Jekyll-related errors.

React Code Debugging: I tried to debug parts of the game to ensure the code was functioning correctly and didn’t contain any major issues that might cause build errors, but the game worked fine in local development.

What was I expecting?

I expected my game to deploy successfully on GitHub Pages, displaying the interactive color sequence game that I can run locally without issues. My goal was to have a stable, accessible URL for sharing and collaborating on the game, where contributors could see the game in action directly. I was hoping to resolve any deployment issues smoothly without needing to handle Jekyll, which I’m unfamiliar with, and to focus on enhancing the game’s interactivity and stability with community input.

Removing inline module script *immediately* after execution?

Since inline module scripts don’t have document.currentScript, we can’t simply append document.currentScript.remove() at the end of the script.

Extra Notes/Context:

  • I’m talking about the synchronous phase of the module script’s execution. I.e. once the script has synchronously executed, it should immediately be deleted, without e.g. waiting for an event loop tick in which other code might run.
  • I’m adding the module script to the DOM programmatically, and I don’t control the code inside the script tag (i.e. it’s “userland” code), or whether or not it’s a module script, and so on. I can only do simple modifications to the script that don’t affect the code – e.g. appending document.currentScript.remove() would be fine, but e.g. wrapping the script in a function/block scope, or something like that would materially affect the code (e.g. variable scoping), so I can’t do stuff like that.
  • This is an unusual requirement, I must admit, but it’s an unusual use case – related to dev tooling / live debugging / etc.

Populated string parameter evaluating as false [closed]

I’m having a problem with checking an optional string parameter of an object returned from a fetch call:

const uploadResponse = await fetch(uploadUrl, {
    method: "POST",
    headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "video/mp4",
        "Content-Length": String(videoBuffer.length),
    },
    body: videoBuffer,
});
                                    
const jobStatus = (await uploadResponse.json()) as AppBskyVideoDefs.JobStatus;
console.log(JSON.stringify(jobStatus, null, 4));
console.log(" error:", jobStatus.error);
if (jobStatus.error) {
    console.warn(` Video job status: '${jobStatus.error}'. Video will be posted as a link`);
}

The above code, when run in a case where the error field is populated generates the following output:

{
    "jobStatus": {
        "did": "",
        "error": "daily_vid_limit_exceeded",
        "jobId": "",
        "state": ""
    }
}
 error: undefined

Somehow, despite the fact that the stringify of the object finds the error element populated with a string, the direct access log of jobStatus.error and the following test in the if statement think it’s undefined/false.

How is this possible and what can I do to properly check the error parameter here?

I’ve tried changing the if condition to explicitly check for undefined as well as other cases. Nothing I’ve tried has resulted in any different outcome.

Automating js files to encrypt a value with python and requests-html

Page B(2nd page) request depending on Page (1st page) click which trigger an event in another js files to encrypt a value. How to automate this with Python and requests/requests-html?

E.g. the content is not existed elsewhere or cookies and it was generated by a js when people click on a button. And it will pass as request when opening the next page visiting.

Request

I’m implementing an API call to a website and Selenium will not be an option.

“Node.js Error: Port 3000 Already in Use Despite Killing the Process”

those who know about node js . Can you help me . I have some error in my js code. By using postman made a code to give res, Req . I used port 3000 in my lap . But it always show me an error “3000 is already used .

i kill the port number on cmd , and i tried another port number . Bu same error

this is the error i am getting =

(node:events:496
throw er; // Unhandled ‘error’ event
^

Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (node:net:1907:16)
at listenInCluster (node:net:1964:12)
at Server.listen (node:net:2066:7)
at Function.listen (C:UsersErangaOneDriveDesktopfucking projectnode_modulesexpresslibapplication.js:635:24)
at file:///C:/Users/Eranga/OneDrive/Desktop/fucking%20project/index.js:56:5
at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:543:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
Emitted ‘error’ event on Server instance at:
at emitErrorNT (node:net:1943:8)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: ‘EADDRINUSE’,
errno: -4091,
syscall: ‘listen’,
address: ‘::’,
port: 5000
}

Node.js v22.11.0
[nodemon] app crashed – waiting for file changes before starting…)

issue with converting complex javascript object to string to write to file [duplicate]

I have this object in a .js file being run with nodejs on the command line. I am trying to save the “print-friendly” version of it to a variable, and then to write the variable to a file:

var obj = {}

obj['keys'] = ['a', 'b', 'c', 'd',]
obj['animals'] = [
    {name: 'giraffe'}, 
    {name: 'zebra'}, 
    {name: 'bird'}, 
    ]
    
obj['arrs'] = {
    'sky': {color: 'blue'},
    'grass': {color: 'green'},
    'brick': {color: 'brown'},
}

obj['arrs_2'] = []
obj['arrs_2']['sky'] = {color: 'blue'}
obj['arrs_2']['grass'] = {color: 'green'}
obj['arrs_2']['brick'] = {color: 'brown'}

When I console.log(obj), I get:

{
  keys: [ 'a', 'b', 'c', 'd' ],
  animals: [ { name: 'giraffe' }, { name: 'zebra' }, { name: 'bird' } ],
  arrs: {
    sky: { color: 'blue' },
    grass: { color: 'green' },
    brick: { color: 'brown' }
  },
  arrs_2: [
    sky: { color: 'blue' },
    grass: { color: 'green' },
    brick: { color: 'brown' }
  ]
}

Everything prints out correctly. But if I try to console.log(JSON.stringify(obj, null, 4)), I get:

{
    "keys": [
        "a",
        "b",
        "c",
        "d"
    ],
    "animals": [
        {
            "name": "giraffe"
        },
        {
            "name": "zebra"
        },
        {
            "name": "bird"
        }
    ],
    "arrs": {
        "sky": {
            "color": "blue"
        },
        "grass": {
            "color": "green"
        },
        "brick": {
            "color": "brown"
        }
    },
    "arrs_2": []
}

I was trying:

var out = JSON.stringify(obj, null, 4)
fs.writeFileSync('out.txt', out, (err) => {
    if (err) {
        throw err;
    }}
)

to write it, but the JSON.stringify is unable to print the contents of “arrs_2” (and displays no errors). Is there a way to capture the console.log output to a variable without actually printing it to the screen? Or maybe a different function than JSON.stringify() that can convert the full object into a string like console.log can?

Sync Historical Data and so on

I am trying to retrieve all historical transactions data of plaid account. I am using nodejs

I am using this api

https://sandbox.plaid.com/transactions/sync

And I am sending the cursor as “” for the first time does this guarantee me that it will start from the beginning and then i can move to the next request with the next_cursor?

Also I am getting the data in batches is it possible to have in delete array of response an transactionsID and later in other batches to have in added the same transactions id or this is not possible? Because that will complicate things.

Is the order guaranted of addded , updates and deletion in the same batch or updates can be in other batches

{
 cursor : "",
 count : 100
}

Dreamweaver RegEx Invalid Quantifier

I am using the following search string in Adobe Dreamweaver 19.2 Win 7.

=(?<!”)(d+)(?!”) The Equals sign is part of the search string.

Searching text “table cellspacing=0 border=0 cellpadding=2 width=312”

I do not recieve the error if I simply select replace. Adobe makes the appropriate changes with no error. The error only occurs if I click replace all.

enter image description here

The Dreamweaver error message box strips off the first 2 characters of the search string . Could this be some indication of the Quantifier error?
Ive ran the search string through the regex 101 website. The search string passes no errors.
I’ve been searching on google and stackoverflow,tried many different combinations of the search string.
Same error in Dreamweaver 21.4 on Win 10

My replace string is “$1”

Typescript ‘any’ type error with dynamic array key

I’m getting the following error when trying to use a dynamic value for an array key.

Element implicitly has an 'any' type because expression of type '`faults_${string}`' can't be used to index type 'HeatsTable'.
export interface HeatsTable {
    heat_id: UUID
    start: number
    faults_1: string[]
    faults_2: string[]
    faults_3: string[]
    faults_4: string[]
  }

const fault = heatData[`faults_${runningId}`]; // Throws the above TS error

Using keyof HeatsTable works but causes an error on another page because it thinks faults could be a number. Is there another solution for this that I’m missing?

ASP.Net web forms application’s page scroll behavior when bootstrap enabled

I’ve an issue with page scroll behavior in ASP.Net web forms application when bootstrap css enabled, below is the explanation.

  1. Created a new Web Forms project from Visual Studio 2022
  2. VS automatically created the project with required folders/files & packages (bootstrap 5.2 included)
  3. In default.aspx page, added a asp:Button inside an asp:UpdatePanel, bound with a JavaScript call on client click. the button’s objective is to scroll to a div placed at the bottom of the page.

button

scroll div

  1. Tried to test the functionality, found an issue that the page is scrolling to the bottom of the page (Div1) as expected and immediately scrolling back to the top of the page.

Kindly help me based on the below observations.

Observations

  1. If the below reference to bootstrap CSS is disabled, then working as expected, no issue.

bootstrap

  1. Access below link address to see videos of browser development tools

video ref

Best way to get random photo from camera roll without loading all of them?

I’ve been trying a long time to get this working, but no luck. I just want to pull 1 random image from my phone/emulator’s camera roll. The issue is that RN and all packages that I’ve found have to load every image in order, and then randomly choose. This takes forever if you have a large camera roll. Is there a way to just get a list of photo ids and choose from that?

Twilio Recording Fetch returns not found

I’m trying to fetch a recording resource in google apps script with UrlFetchApp to use as an attachment in an email but keep getting the following error The requested resource /2010-04-01/Accounts/ACxxxxxxxxx/Recordings/RExxxxxxxxx was not found.

Whats intresting is that when I hardcode the url into the function it works, but when the url is passed in as a parameter it gets this error. I logged the url to the spreadsheet before the error and the url comes through.

Any help is appreciated.

function doGet(e){

var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('vm');

try{
var p = e.parameter;
var from = p.from;
var received = p.received;
var u = p.recording;
var url = String(u);
var length = p.length;
var email = p.email;
var ext = p.ext;
var fromDashes = from.slice(-10,-7)+"-"+from.slice(-7,-4)+"-"+from.slice(-4);
var receivedDashes = received.slice(-10,-7)+"-"+received.slice(-7,-4)+"-"+received.slice(-4);

  //time script ran
const d = new Date();
const t = d.toLocaleString();
const split = t.split(',');
const time = split[1];

var curr_date = d.getDate();
var curr_month = d.getMonth() + 1; //Months are zero based
var curr_year = d.getFullYear();

var theDate = curr_month + "-" + curr_date + "-" + curr_year;

ss.appendRow([theDate,time,receivedDashes,fromDashes,length,ext,email,url]); // this logs the full url

var fileName = "VM_" + fromDashes + "_" + theDate

var blob = UrlFetchApp.fetch(url).getBlob().getBytes();

blob = Utilities.newBlob(blob, 'audio/x-wav', fileName);

var message = {
  to: email,
  subject: "[New] Voicemail for "+ext,
  htmlBody: "<h3>You received a new voicemail from: " + fromDashes + "</h3>For: "+ext+"<br><br>Recieved at: "+receivedDashes+"<br>Length: "+length+"<br><br><a href=" + url + ">Listen to Voicemail</a>", //<br><br><a href=" + callBackUrl + ">Call "+fromDashes+"</a>",
  attachments: [blob]
};

MailApp.sendEmail(message);

}
catch(e){
  ss.appendRow([e])
}
}

WordPress – Display page content and not custom post type with

I have created a custom post-type with a single page that serves as a template page, the CPT are listed as expected but when I include the to list display the page content, it displays for a post content instead

    <? while ( have_posts() ) : the_post();?>

      $args = array(
            'posts_per_page' => -1,
            'post_type' => 'rooms',
        );

        $the_query = new WP_Query($args);
        $categories_posts = array();

        if ($the_query->have_posts()) :
            while ($the_query->have_posts()) : $the_query->the_post();
          //code
          <? endwhile; endif; ?>

           <?php the_content();?>

I tried to move the <?php the_content();?> above the query and it displays the content i need but it doesn’t work below the query

How to detect ENTER key on Chrome on Android?

I have a problem with handling jQuery Terminal library on Android. Since like forever Android don’t trigger keypress or keydown event, and you need to generate it from input event.

And in the library I used this code to detect if user press ENTER:

function input_event() {
    debug('input ' + no_keydown + ' || ' + process + ' ((' + no_keypress +
          ' || ' + dead_key + ') && !' + skip_insert + ' && (' + single_key +
          ' || ' + no_key + ') && !' + backspace + ')');
    // correct for fake space used for select all context menu hack
    var val = clip.val();
    debug('command => ' + val + ' :: ' + command);
    if (!is_mobile) {
        val = val.replace(/^ /, '');
    }
    // Some Androids don't fire keypress - #39
    // if there is dead_key we also need to grab real character #158
    // Firefox/Android with google keyboard don't fire keydown and keyup #319
    if (no_keydown || process || ((no_keypress || dead_key) &&
                                  !skip_insert &&
                                  (single_key || no_key) && !backspace)) {
        if (val && val === command) {
            if (is_android) {
                // ignore autocomplete on GBoard keyboard #693
                if (no_keydown) {
                    event('keydown', 'Enter', 13);
                }
            }
            finalize_input_event();
            return;
        }

Editable element is called clip because I also use it for clipboard handling.

The problem is that this doesn’t work with dot after text. When you press dot, it triggers an input event for old text, which triggers ENTER. (I’m not sure if this always how it was working).

So the question is how to properly detect ENTER key when all you have is an Input event?

I use contenteditabe element, so I can’t use form submit.

This is my testing page: https://terminal.jcubic.pl/andorid.php (the contenteditable is visible to help debugging).