Is it possible to upload a file to IPFS without first storing it locally using AJAX

I have JS and PHP scripts that uploads a file to Pinata (IPFS) and it all works fine but I first need to upload the file to my web server then it can be uploaded to IPFS. This is not a good solution for large files because I need to wait for 2 uploads to happen before I get the returned CID.

Is it possible to upload directly to Pinata without first uploading to my server? Ultimately im going to setup my own Arweave node in the future but am currently using a paid account on Pinata.

i am trying to get the style of an element from html and trying to print on console

i am trying to get the style of an element from html and trying to print on console. I cant see style option while typing the style property in visual code. its keep showing the error
Uncaught TypeError: Cannot read properties of null (reading ‘style’)
in javascript var element; element = document.querySelector(“#header”).style.backgroudColor; console.log(element);

<!DOCTYPE html>
<html>

  <head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='all.css'>
    <script src="javascript_code.js"></script>
  </head>

  <body>
    <div id="header" class="heading" style="background-color: red;">
      <h1>this is header</h1>
      <h1>this is header2</h1>
    </div>
    <script src="javascript_code.js"></script>
  </body>

  </html>

How to render a string which has both HTML and Latex in it in React Js?

This is the string “<table border=”1″ cellpadding=”1″ cellspacing=”1″ style=”width:400px;”>rntrnttrnttt<td rowspan=”3″>An algebraic expression with rntttonly one termrntttMonomialrnttrnttrnttttwo unlike termsrntttBinomialrnttrnttrntttthree unlike termsrntttTrinomialrnttrntrnrnrn

An expression <span class=”mathImg mathquill-rendered-math”>4x^2+4 has  <select name=”first” required=”required”><option value=””>Select<option value=”3″>1<option selected=”selected” value=”2″>2<option value=”4″>3 terms.  So, it is a  <select name=”second” required=”required”><option value=””>Select<option value=”1″>Monomial<option selected=”selected” value=”Binomial”>Binomial<option value=”2″>Trinomial expression.

rnrn

An expression <span class=”mathImg mathquill-rendered-math”>-frac{7}{9}a^2-4b+3 has <select name=”fourth” required=”required”><option value=””>Select<option value=”1″>1<option value=”2″>2<option selected=”selected” value=”3″>3 terms.  So it is a  <select name=”third” required=”required”><option value=””>Select<option value=”1″>Monomial<option value=”2″>Binomial<option selected=”selected” value=”Trinomial”>Trinomial expression.

rn” which I need to render in ReactJs.The expression frac{7}{9}a^2-4b+3 in the above string needs to be rendered as Latex.

Converting json response to Array Variable [duplicate]

i am trying to show data from events.json file to my website. my code is showing data in console.log but how can i store it in variable to resue it, on the website.

events.json file data:

[
{
      "id": "d8jai72s",
      "name": "Vacations",
      "description": "TEST",
       "date": "March/16/2022",
      "type": "vacation"
     
    }
]

Code to show response in console:

$(document).ready(function() {
fetch("events.json")
.then(response => {
   return response.json();
})
.then(jsondata => console.log(jsondata));

enter image description here

i want to use this response here in same .js file:

    $("#demoEvoCalendar").evoCalendar({
        format: "MM dd, yyyy",
        titleFormat: "MM",

        calendarEvents: [{
          

> // i want place response data in calendarEvents here with other events.

      id: "d8jai72s",
      name: "Vacations",
      description: "Winter Vacation Starts (All Classes)",
       date: ["January/01/2022", "January/13/2022"],
      type: "vacation",
      everyYear: 0
    }
]
});

Create a php/JS script that hides referrers URL on separate Domain with Countdown

I’ve seen a few great Q&A’s on a summary of the JavaScript I think I would need, but I am wanting a php/JS s ript that will run on its own domain/url so any link I click on any of my websites goes to this domain eg.
www.url.us/?r4nd0m and can also put in the actual domain www.url.us/?google.com as this will act as a buffer between the TARGET URL so the target domain doesn’t know the a href link that’s being clicked.
I’ve seen something like this and it has a countdown that can be changed in the code eg. 10sec or 60sec etc

I know a short url service could accommodate this in a sense, but I don’t want the target to know it came from a short url service either, I want it to specifically show this domain (if any = if possible)

I know good way to get a random or alias after the www.url.us/?chosenAlias or www.url.us/?r4nd0m is to have a text area on the url.us/index.php where you can enter the target domain, and have a drop down to select random or alias from similar shorten url services that have this (won’t put any urls as when I replied to a Q&A that was to do with this subject, being new, and niave my Question got removed right away, and it was a great thread, as alot of the JavaScript and php/mysqli was being worked on, though was for putting into the originating domain), I think it’s easy just having a domain name dedicated to this function IMHO

THANKS GUYS, I WAS A MEMBER ON HERE SINCE ABOUT 2017 I JUST LOST MY INTERNET PROVIDER EMAIL AND FORGET MY PASSWORD TO OLD ACCOUNT….

IF YOU NEED ANYTHING FROM ME, PLS LET ME KNOW, HAPPY TO CONTRIBUTE, I AM MORE OF A FRONT END CODER AND ILLUSTRATOR

Output showing Undefined using find array helper in javaScript

So, here is the code which is using find helper in javaScript and supposed to return a value but instead of that it is showing undefined.

function Car(model) {
this.model = model;
}
var cars = {
 new Car('Buick'),
 new Car('Camaro'),
 new Car('Focus')
};
cars.find(function(car){
 return car.model === 'Focus';
});

I am running this code in VB and the output supposed to be Focus but it is showing undefined.

Change the texture of an existing model in google model-viewer using an image file

I am a student with an upcoming project using Google’s model-viewer to render a poster using AR on a user’s wall. I have a simple, textureless, one-sided plane that I made using the three.js online editor, which lives in my project’s directory. I am trying to implement a system where the texture of that plane can be set to an image to simulate a poster/painting/etc.

Google’s model-viewer documentation has an example (the one with the rubber duck) in which a model has a texture created and set from a referenced image file, and I have attempted to implement it on my end using the plane and some various images of different types in place of their examples, but I cannot get it to work.

I have been looking for possible solutions online for a long time with no real progress so I figured it was time to ask the question for myself. The documentation makes this look simple enough so clearly, I’m misunderstanding something.

Here is the modified code from the model-viewer documentation:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Model-Viewer Test</title>
  <script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
  <style>
    model-viewer {
      width: 400px;
      height: 600px;
    }
  </style>
</head>

<body>
  <model-viewer id="plane" camera-controls src="assets/blank.glb" ar ar-modes="webxr">
    <div class="controls">
      <p>Textures</p>
      <select id="normals2">
        <option>None</option>
        <option value="assets/planet.jpeg">Forbidden Planet</option>
        <option value="assets/retro.jpg">Retro Camera</option>
        <option value="assets/movie.png">Movie Poster</option>
      </select>
    </div>
  </model-viewer>
  <script type="module">
    const modelViewerTexture = document.querySelector("model-viewer#plane");

    modelViewerTexture.addEventListener("load", () => {

      const material = modelViewerTexture.model.materials[0];

      const createAndApplyTexture = async (channel, event) => {

        if (event.target.value == "None") {
          // Clears the texture.
          material[channel].setTexture(null);
        } else if (event.target.value) {
          // Creates a new texture.
          const texture = await modelViewerTexture.createTexture(event.target.value);
          // Set the texture name
          texture.name = event.target.options[event.target.selectedIndex].text.replace(/ /g, "_").toLowerCase();
          // Applies the new texture to the specified channel.
          material[channel].setTexture(texture);
        }
      }

      document.querySelector('#normals2').addEventListener('input', (event) => {
        createAndApplyTexture('normalTexture', event);
      });
    });
  </script>
</body>

</html>

The only response I get when picking an option in the selector is the error message:

Uncaught (in promise) TypeError: Cannot set property name of #<xy> which has only a getter
    at createAndApplyTexture

which refers to line 46:

texture.name = event.target.options[event.target.selectedIndex].text.replace(/ /g, "_").toLowerCase();

and otherwise, nothing happens. The plane itself is rendering with no problems. I have tried using both a .gltf and a .glb model.

I do not intend to plagiarize from Google’s documentation on the actual project as I have done here, I just wanted to see if I could get the dynamic textures working beforehand and immediately hit a wall.

Thank you to anyone who sees or responds to this.

Creating sequential numbers in the auto table jspdf column VusJs

enter image description here

    columns: [
      {
        header: 'No',
        dataKey: 'Index',
      },
      { header: 'No Registrasi', dataKey: 'no_register' },
      { header: 'Kode Partai', dataKey: 'kode_partai' },
      { header: 'Sumber', dataKey: 'kode_partai' },
      { header: 'Tanggal Panen', dataKey: 'tanggal_panen' },
      { header: 'Tanggal Terima', dataKey: 'tanggal_penerima' },
    
    ],
    

I’ve tried to use index + 1, but it doesn’t work. I want my dataKey to be filled with sequential numbers according to the number of Arrays I get from the api service’s response. in what other way so that I can enter the serial number in the ‘NO’ column.I use Vuejs

Add/Set product Images and gallery images programmatically

I’m getting data from jSON file and trying to setup the images for a product, My goal is –
need to develop a way to extract/download images from JSON responses and set images to related product
//$product_data is getting the response from Json

$product_data = $_REQUEST['data'];
$product = new WC_Product_Simple();
$product->set_name( $product_data['Title'] ); // it's working
$product->set_status( 'publish' );
$product->save();

If it has multiple images that need to be assigned to a product, the first image need to assign as the featured image/thumbnail, and then assign the rest of the images as the product gallery thumbnails.

jSON response of one product

{
        "SKU": "0000000",
        "Title": "Malt Scotch Whisky",
        "Image1": "https://images.skulibrary.com/media/sys_master/hfa/he9/9712207298590.jpg?response-content-disposition=inline;filename=DIAG-5000281045160-1.jpg",
        "Image7": "https://images.skulibrary.com/media/sys_master/hbf/hd5/9712208150558.jpg?response-content-disposition=inline;filename=DIAG-5000281045160-7.jpg"
    }

How to correctly check if a toggleButton is currently selected on Chrome console using jQuery commands?

There’s this page that displays the economic calendar for Today by default:

enter image description here

I’m trying to find a jQuery method that returns true or false depending on weather the toggleButton called Today is currently selected.

I tried the following method on Chrome Console:

$('#timeFrame_today').is(':selected') 

And it returned:

false

Which should not be the case since as I mentioned, the #timeFrame_today button (a.k.a. Today) is selected by default, so I’m lost here.

What is the Correct Way to Use Secret Manager in Firebase Cloud Function?

I started to add Secret Manager with a SECRET_NAME contains a certain password inside Cloud Function using Node.js. I tried both ways. First, adding Secret Manager using Console and another, adding Secret Manager directly through Firebase CLI. Unfortunately, both ways give an empty Secret value in Cloud Function variable of Secret as shown in picture below.

Link to picture

I used parameter runWith({secret: [“SECRET_NAME”]}) as shown in code below.

exports.Auth = functions.runWith(secret).https.onCall(async (data, context) => {
  const response = 129132;
  return Promise.resolve(response);
});

const secret = {
  timeoutSeconds: 120,
  memory: "1GB",
  secret: ["SECRET_NAME"],
  minInstances: 0,
};

I followed the documentation written in Firebase Cloud Function (https://firebase.google.com/docs/functions/config-env).

I had wasted almost a week to figure out where I got wrong and found nothing. I also added a role “Secret Manager Secret Accessor” to current SECRET_NAME in Google Cloud Console, and it gave result to nothing at all. As written in this stackoverflow post reference

My question is should I add SECRET_NAME manually in Cloud Function Console in Google Cloud Platform? If so, then what is the use of documentation written above? Is Firebase trying to lead us to nowhere?

How to add text sequentialy to a file with javascript

I have this code:

const fs = require("fs");

const saveFile = (fileName, data) => {
  return new Promise((resolve) => {
    fs.writeFile(fileName, data, (err) => {
      resolve(true);
    });
  });
};

const readFile = (fileName) => {
  return new Promise((resolve) => {
    fs.readFile(fileName, "utf8", (err, data) => {
      resolve(data);
    });
  });
};

const filename = "test.txt";

saveFile(filename, "first");

readFile(filename).then((contents) => {
  saveFile(filename, contents + " second");
});

readFile(filename).then((contents) => {
  saveFile(filename, contents + " third");
});

I’m hoping to obtain in ‘test.txt’

first second third

but instead, I get

first thirdd

The idea is that every time I receive a certain post request. I have to add more text to the file

Does someone have any solution for this?

Thank you so much!

Is there anyway to extend more pug files into one pug file?

Sorry if this has been answered before, haven’t been able to find it anywhere but I know in pug it allows you to insert the contents of one Pug file into another. I was wondering if it is possible to insert multiple contents from multiple files into directly one file? I’m having trouble doing so whenever I try to add another line of to my question-display.pug.

./questions/question-display.pug
extends ../layout.pug
include ../utils.pug
block content
/.answers/answer-form
h2 Your Answer
        +errorBlock(errors)
        form(method="post" action="/answers/new")
            input(type="hidden" name="_csrf" value=csrfToken)
            label(for="title") Title

I have currently have a pug file to display a question and I want to implement an answer form directly into my question display pug.

How to convert RxJS triple ‘of(…).pipe.map(…)’ expression to the Observable of three dimensional array

I have this expression:

var s2 = of(6, 16, 26).pipe(
    map(v1=>of(5, 15, 25).pipe(
      map(v2=>[v1,v2])
      )), 
    combineLatestAll());
  s2.subscribe(console.log)

… and s2 is an of type Observable<number[][]>as I want it.

Can I convert the following expression in a similar way to Observable<number[][][]> (instead of it being an Observable<Observable<number[]>[]>):

var r2 = of(5, 15, 25).pipe(
    map(v1=>of(6, 16, 26).pipe(
      map(v2=>of(7, 17, 27).pipe(
        map(v3 => [v1,v2,v3])
        )))),
    combineLatestAll());

I can’t get my head around it. Any help appreciated.