ThreeJS – How to play animation between specific keyframes – forward and backward

  • Looking to get GLB(s) to advance to a specific KeyFrame via
    hovering over 1 of 3 buttons.
  • ‘Advance’ means move from current KF to desired (1, 21, 41)… could be forward or backward.
  • Mock-up of intended behavior: (https://imgur.com/N25k2gM).
  • Best I’ve been able to do thus far (.gif): https://imgur.com/N64oKj6
  • Been at the problem a couple hours. Put some effort in before I asked.

.

Help on this would be greatly appreciated.

You can tell this is for a web designer-type portfolio (which I’m excited to finish 🙂 )

Cheers

Adding autocomplete email address list in google script

I am try to add autocomplete list email in my function. Right now, i key in the email address manually, so i have to write or copy all. it should be more efficient if the there autocomplete feature. Here is my code sample:

function getemail(){

var ui_user = SpreadsheetApp.getUi();

var result = ui_user.prompt(“Enter Receiver Email:”);
return result.getResponseText();

}
is GAS can search our contacts email address then query it all?

Bypass HTML encode on specific URL while using loadData() WebView

So I was going to loadData() into my WebView with my HTML in the type of String that contains a direct download URL, shown below:

loadData(url, "text/html", "utf-8")

Where the download URL on the HTML like this:

src="https://firebasestorage.googleapis.com/v0/b/valostats-657c2.appspot.com/o/agents%2Fa3bfb853-43b2-7238-a4f1-ad90e9e46bcc%2Fa3bfb853-43b2-7238-a4f1-ad90e9e46bcc.glb?"

Apparently, when it’s being loaded the download URL is encoded where the %2F into / symbol. So it will be like this:

src="https://firebasestorage.googleapis.com/v0/b/valostats-657c2.appspot.com/o/agents/a3bfb853-43b2-7238-a4f1-ad90e9e46bcc/a3bfb853-43b2-7238-a4f1-ad90e9e46bcc.glb"

Which is produce error like this
Error code 400: Invalid HTTP method/URL pair

So, is there any way to load my HTML into webview without encode the download url?

Bootstrap Select send additional parameter to ajax

Does anyone know how to get the value of a data attribute “date” from a bootstrap-select? I want to send additional parameter as a filter because in one page i have several selectpicker for each date

<select class="selectpicker" data-date="2022-04-21"></select>
<select class="selectpicker" data-date="2022-04-22"></select>
<select class="selectpicker" data-date="2022-04-23"></select>

my current script is like this

$(".selectpicker").selectpicker().ajaxSelectPicker(
        {
            ajax: {
                url: "ajax/search_by_date.php",
                type: "POST",
                dataType: "json",
                data: {
                    q: "{{{q}}}",
                    date: $(this).data("date"),
                }
            },
            locale: {
                emptyTitle: "Please type room name"
            },
            preprocessData: function(data) {
                var i,
                l = data.length,
                array = [];
                if (l) {
                    for (i = 0; i < l; i++) {
                        array.push(
                            $.extend(true, data[i], {
                                text: data[i].name,
                                value: data[i].id,
                            })
                        );
                    }
                }
                return array;
            },
            preserveSelected: false
        });
    $("select").trigger("change");

with this i get null on $_POST[“date”]

thank you for your help

How to go back to previous page from Servlet?

I have just started learning JSP and Servlet. I am finding issues in page redirections. I want page to be redirected to the previous screen where previous page should be at the same state of filled data in the form.

I have tried using getHeader(“referer”) but its not working.
Any help would be really appreciated.
Thanks in advance.

AWS API Call from GAS Signature Mismatch

I have been trying to get an api call to Amazon SES to work for sending bulk emails. After figuring out issues with dates I’m now getting an error about the signatures mismatching. My code is below

function sendEmails() {

  var template = HtmlService.createHtmlOutputFromFile('EmailTemplate.html');
  var output = template.getContent();
  var subject = 'Message from Mr. Bunz';
  var data = JSON.stringify(

    {
      "Content": { 
          "Simple": { 
            "Body": { 
                "Html": { 
                  "Data": output
                },
            },
            "Subject": { 
                "Data": subject
            }
          },
      },
      "Destination": { 
          "ToAddresses": [ "[email protected]" ]
      },
      "FromEmailAddress": "[email protected]",
      "ReplyToAddresses": [ "[email protected]" ]
    }

  );
  var url = 'https://email.us-west-1.amazonaws.com/v2/email/outbound-emails';
  var aws_key_id = 'AKIAWLG4NO6GFEXAMPLE';
  var aws_key = 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY';
  var today = new Date();
  var amz_date_iso = Utilities.formatDate(today,"UTC","YYYYMMd'T'HHmmss'Z'");
  var amz_date = Utilities.formatDate(today,"UTC",'YYYYMMd');
  console.log(amz_date)
  var signature = awsSignature(aws_key,amz_date_iso);

  var headers = {
    "contentType": "application/json",
    'X-Amz-Date': amz_date_iso,
    "Authorization": "AWS4-HMAC-SHA256 Credential="+aws_key_id+"/"+amz_date+"/us-west-1/ses/aws4_request, SignedHeaders=content-type;host;x-amz-date;, Signature="+signature
  };
  console.log(headers);
  var options = {
    
    "method": "POST",
    "headers": headers,
    "payload": data, 
    "muteHttpExceptions" : true,
  };
  apiresponse = UrlFetchApp.fetch(url,options);
  console.log(apiresponse.getContentText());    
}

function awsSignature(key,dateStamp) {
  var regionName = 'us-west-1';
  var serviceName = 'iam';

  var kDate = Utilities.computeHmacSha256Signature(dateStamp, "AWS4" + key);
  var kRegion = Utilities.computeHmacSha256Signature(
    Utilities.newBlob(regionName).getBytes(),
    kDate
  );
  var kService = Utilities.computeHmacSha256Signature(
    Utilities.newBlob(serviceName).getBytes(),
    kRegion
  );
  var kSigning = Utilities.computeHmacSha256Signature(
    Utilities.newBlob("aws4_request").getBytes(),
    kService
  );
  kSigning = kSigning
    .map(function(e) {
      return ("0" + (e < 0 ? e + 256 : e).toString(16)).slice(-2);
    })
    .join("");
  Logger.log(kSigning);
  return kSigning;
}

The exact error message is below

{“message”:”The request signature we calculated does not match the
signature you provided. Check your AWS Secret Access Key and signing
method. Consult the service documentation for details.”}

I’ve tried generating a new key/id pair with no luck. The two answers on this issue on stackoverflow I have found are here and here.

I was getting a byte array back and couldn’t figure out how to convert it into the needed signature so my implementation of creating the signature is based on this post.

Would greatly appreciate any and all help.

How to make a range update a label with the value and move another range on Safari?

I have two range sliders that display the value in the label when they slide. They also adjust each other to prevent a backwards range. It works in FireFox {99.0.1 (64-bit)} (Mac OS) but not in Safari{15.4.1} (iPhone)

           <h6>Age range you prefer</h6>
            <label for="Youngest" id="youngestlabel" class="form-label">Youngest Age: (<?php if(!empty($UserLookingForYoungest)){echo $UserLookingForYoungest;}else{echo "18";}?>)</label>
            <input type="range" class="form-range" id="Youngest" name="Youngest" min="18" max="80" step="1"
                   value="<?php if(!empty($UserLookingForYoungest)){echo $UserLookingForYoungest;}else{echo "18";}?>"
                   onchange="UpdateOldest(this.value)"
                   onmousemove="document.getElementById('youngestlabel').innerHTML='Youngest Age: (' + this.value + ')';">

              <br />
              <label for="Oldest" id="oldestlabel" class="form-label">Oldest Age: (<?php if(!empty($UserLookingForOldest)){echo $UserLookingForOldest;}else{echo "80";}?>)</label>
            <input type="range" class="form-range" id="Oldest" name="Oldest" min="18" max="80"  step="1"
                   value="<?php if(!empty($UserLookingForOldest)){echo $UserLookingForOldest;}else{echo "80";}?>"
                   onchange="UpdateYoungest(this.value)"
                   onmousemove="document.getElementById('oldestlabel').innerHTML= 'Oldest Age: (' + this.value + ')';">

and the javascript:

<script>
function UpdateOldest(newvalue){
 var OldestAge = document.getElementById('Oldest').value;

if(newvalue >= OldestAge){
    updateValue = parseInt(newvalue) + 1;
    document.getElementById("Oldest").value = updateValue;
    document.getElementById('oldestlabel').innerHTML= "Oldest Age: (" + updateValue + ")";
   }};


function UpdateYoungest(newvalue){
var YoungestAge = document.getElementById('Youngest').value;
    if(newvalue <= YoungestAge){
    updateValue = parseInt(newvalue) - 1;
    document.getElementById("Youngest").value = updateValue;
    document.getElementById('youngestlabel').innerHTML= "Youngest Age: (" + updateValue + ")";
   }};
</script>

So, whats the deal with Safari and range sliders?

Thanks!

Angular 1.8.2 Tree on DataTable

I’ve trying to implement an tree using angular 1.8.2

<div ng-controller="DataTableTreeController">
 <table>
    <thead>
        <tr>
            <th ng-repeat="data in treeColumns">{{data}}</th>
        </tr>
    </thead>
    <tbody>
        <div ng-repeat="data in tree" ng-include="'tree_item_renderer.html'"></div>
    </tbody>
 </table>
</div>

<script type="text/ng-template"  id="tree_item_renderer.html">
 <tr>
    <td>
        <button ng-click="expand(data)">+</button>
    </td>
    <td>{{data.descricao}}</td>
 </tr>
 <div ng-repeat="data in data.filhos" ng-include="'tree_item_renderer.html'"></div>
</script>

and the result is:

Image showing the result

Problems:
1 – The “+” button to expand a line with its children works fine, but the html doesn’t show the child lines
2 – The table header must be above

what’s wrong with that? any help will be appreciated!

Why do I keep on getting this RangeError when doing this simple math calculation in node?

All my program is really doing is taking two inputs on the HTML form and having it parsed into text in node and then doing a math operation on the two. The strange thing is that it only happens with printing numbers. Not with strings.

The interesting thing is that it still prints the right number, but it’s labeled with the invalid status code. It can be seen at the top of the error.

Here is the HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BMI Calculator</title>
</head>
<body>
    <h1>BMI Calculator</h1>
    <form action="/bmicalculator" method="post">
        <input type="number" name="height" placeholder="Height">
        <input type="number" name="weight" placeholder="Weight">
        <button type="submit" name="submit">Submit</button>
    </form>
</body>
</html>

Here is the js code:

const express = require('express');
const bodyParser = require('body-parser');

const res = require('express/lib/response');

const app = express();
app.use(bodyParser.urlencoded({extended: true}));

app.get('/', function(req, res) {
    res.sendFile(__dirname + '/index.html');
});

app.get('/bmicalculator', function(req, res) {
    res.sendFile(__dirname + '/bmiCalculator.html');
});

app.post('/', function(req, res) {
    let num1 = Number(req.body.num1);
    let num2 = Number(req.body.num2);
    let r = num1 + num2;
    res.send(r);
})

app.post('/bmicalculator', function(req, res) {
    let weight = Number(req.body.weight);
    let height = Number(req.body.height);
    let r = weight * height;
    res.send(weight);
})

app.listen(3000, function() {
    console.log('server started');
});

And here is the error:

RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 12
    at new NodeError (node:internal/errors:371:5)
    at ServerResponse.writeHead (node:_http_server:274:11)
    at ServerResponse._implicitHeader (node:_http_server:265:8)
    at ServerResponse.end (node:_http_outgoing:871:10)
    at ServerResponse.send (/Users/user/Desktop/Calculator/node_modules/express/lib/response.js:221:10)
    at /Users/user/Desktop/Calculator/calculator.js:28:9
    at Layer.handle [as handle_request] (/Users/user/Desktop/Calculator/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/user/Desktop/Calculator/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/user/Desktop/Calculator/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/user/Desktop/Calculator/node_modules/express/lib/router/layer.js:95:5)

why this javascript function wont get result [duplicate]

why this function not working? error message is not working too.

function Login(){
const loginForm = document.getElementById("login-form");
const loginButton = document.getElementById("login-form-submit");
const loginErrorMsg = document.getElementById("login-error-msg");

loginButton.addEventListener("click", (e) => {
    e.preventDefault();
    const username = loginForm.username.value;
    const password = loginForm.password.value;

    if (username === "user" && password === "webdev") {
        alert("You have successfully logged in.");
        location.href="index.html";
        return;
    } else {
        loginErrorMsg.style.opacity = 1;
        return;
    }
}
)
<form id="login-form">
      <input type="text" name="username" id="username-field" class="login-form-field" placeholder="Username">
      <input type="password" name="password" id="password-field" class="login-form-field" placeholder="Password">
      <input type="submit" value="Login" onclick="Login()" id="login-form-submit">
    </form>

i already have onclick event but the function still wont work.

How to use OnClick and Draw WKT automatically on Openlayers + React + MySQL?

(1)Copy WKT strings in Blue => (2)Paste in Text Area => (3)Click Draw => (4)WKT Draw on Map

WKT drawn on Map

Objective: (1)Click on WKT strings in Blue => (2)WKT Draw on Map

import './App.css';
import React, { useState, useEffect} from 'react';
import OlMap from 'ol/Map';
import LayerGroup from 'ol/layer/Group';
import OlView from 'ol/View';
import OlLayerTile from 'ol/layer/Tile';
import { Form, Input, Button, Tag } from "antd";
import GeoJSON from 'ol/format/GeoJSON';
import { fromLonLat, toLonLat, transform} from "ol/proj";
import OlFeature from "ol/Feature";
import WKT from "ol/format/WKT";
import OlSourceOsm from 'ol/source/OSM';
import { useTabs, TabPanel  } from "react-headless-tabs";
import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer";
import { Drawer } from 'antd';
import { SimpleButton,MapComponent,NominatimSearch,LayerTree} from '@terrestris/react-geo';
import '@terrestris/react-geo/dist/Field/NominatimSearch/NominatimSearch.less';
import { Style, Circle as CircleStyle, Fill, Stroke } from "ol/style";
import 'ol/ol.css';
import 'antd/dist/antd.min.css';
import axios from 'axios';
import  {BiMenu} from 'react-icons/bi';
import './react-geo.css';
import Dropdown from 'react-bootstrap/Dropdown';
import 'bootstrap/dist/css/bootstrap.min.css';
import { Vector as VectorSource} from "ol/source";
import Circle from 'ol/geom/Circle';
import Feature from 'ol/Feature';
import Data from './Wkt';
import "./WktToMap/WktToMap.scss";
import $ from 'jquery';
const { TextArea } = Input;

export const drawWktFeature = (map, wktFeature) => {
  removeLayer(map, "wktLayer");
  const wktFormat = new WKT();
  const geometry = wktFormat.readGeometry(wktFeature, {
    dataProjection: "EPSG:4326",
    featureProjection: "EPSG:3857",
  });

  if (map) {
    const poly = new OlFeature({
      geometry: geometry,
    });

 

Thank you very much.

NextJS: Footer not render on vercel deploy

so I want to make template for the navbar and footer and decide using a layout like on here

it’s working fine on the localhost but when deploy on the vercel some reason not rendered but just a footer that is not rendered

Preview

  • on local host
    enter image description here

  • on vercel
    enter image description here

Script

Layoout.js

import Footer from "./Footer";
import Navbar from "./Navbar";

const Layout = ({ children }) => {
  return (
    <>
      <Navbar />
      {children}
      <Footer />
    </>
  );
};

export default Layout;

_app.js

import Layout from "../component/Layout";

import "../styles/globals.css";

function MyApp({ Component, pageProps }) {
  return (
    <>
      <Layout>
        <Component {...pageProps} />
      </Layout>
    </>
  );
}

export default MyApp;

index.js

import Head from "next/head";
import Featured from "../component/Featured";
import ProductList from "../component/ProductList";

export default function Home() {
  return (
    <div>
      <Head>
        <title>MarssId</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.ico" />
      </Head>
      <Featured />
      <ProductList />
    </div>
  );
}

Footer.jsx

import Image from "next/image";
import React from "react";
import styled from "styled-components";
import { Instagram } from "@material-ui/icons";

const Container = styled.div`
  height: calc(100vh-100px);
  @import url("https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap");
  font-family: "Roboto", sans-serif;
  background-color: #93221e;
  display: flex;
`;

const Item = styled.div`
  flex: 1;
  position: relative;
  display: flex;

  &:last-child {
    flex: 3;
    padding: 50px;
    justify-content: space-between;
  }
`;

const Card = styled.div`
  flex: 1;
  padding: 0 20px;
`;
const Title = styled.h1`
  font-size: 18px;
  color: white;
`;

const Text = styled.p`
  color: white;
  margin-top: 10px;
`;

const Motto = styled.h2`
  color: whitesmoke;
`;

const SocialContainer = styled.div`
  color: white;
  margin-top: 10px;
  display: flex;
`;

const SocialIcon = styled.div`
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
`;

const Footer = () => {
  return (
    <Container>
      <Item>
        <Image src={"/img/1.JPG"} layout={"fill"} objectFit="cover" />
      </Item>
      <Item>
        <Card>
          <Motto>MARRS, CANDUNYA CEMILAN!</Motto>
          <Text>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
            eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </Text>
        </Card>
        <Card>
          <Title>Contact</Title>
          <Text>Shopee</Text>
          <SocialContainer>
            <SocialIcon>
              <Instagram />
            </SocialIcon>
          </SocialContainer>
        </Card>
      </Item>
    </Container>
  );
};

export default Footer;

am I missing something here? I don’t have any idea what is wrong here