I Need to deploy node js application on intranet service does anyone has an idea how to deploy?
Thanks in Advance.
i have create node js application and need to deploy in my local setup and i’m trying to deploy it through godaddy.
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
I Need to deploy node js application on intranet service does anyone has an idea how to deploy?
Thanks in Advance.
i have create node js application and need to deploy in my local setup and i’m trying to deploy it through godaddy.
I’m trying to use the slider to make the square big as I move up the slider and smaller as I move it back. I have a clearRect to help with that but it isn’t operating as it should…I looked over the code and I’m not noticing any errors – its creating the square fine but it isn’t making it smaller as I move the slider back
I’m still learning basics so I apologize if this is too trivial. Would appreciate the help!
I went through different solutions from here but all of them dealt with draw or stroke which isn’t the case for mine
Im currently using code pen so linking my code here –
https://codepen.io/thedailyrush/pen/gOEogQE
there are 3 inputs for the canvas – the functions below are pretty much all they do – the doRange() function is where I’m having the issue
function doRed(){
var canvas = document.getElementById("c1");
canvas.style.backgroundColor = "#E26D5A";
}
function doColor(){
var canvas = document.getElementById("c1");
var input = document.getElementById("col");
var finalColor = input.value;
canvas.style.backgroundColor = finalColor;
}
function doRange(){
var canvas = document.getElementById("c1");
var sizeInput = document.getElementById("ranger");
var howBig =sizeInput.value;
var ctx = canvas.getContext("2d");
ctx.clearRect(0,0,howBig.width,howBig.length);
ctx.fillStyle="#F5BB00";
ctx.fillRect(10,10,howBig,howBig);
}
i am having problem with extracting Timestamp from XML report, generated by JMeter using JS and i am using its values in XLS report.
i have tried multiple ways to extract Timestamp values in seconds only but it shows values as be year–month==day–hh–min–sec (epoch system) i just need to extract total time taken by the sampler to execute in seconds here is my sampler
<sample t="7" it="0" lt="0" ct="0" ts="1706503149549" s="true" lb=" Enterprise Dashboard - https://dr-wv.wmi360.com/Login/ACO/Dashboard" rc="200" rm="OK" tn="Smoke Thread Group 1-1" dt="text" by="1396210" sby="0" ng="1" na="1">
<java.net.URL>https://dr-wv.wmi360.com/Login/ACO/Dashboard</java.net.URL>
</sample>
I’ve attempted to create a demo account on Fub, but I’m encountering issues logging in after registration. Could someone walk me through the process of creating a demo account step-by-step to ensure I’m not missing any crucial details?
I have tried multiple times to register in Follow up Boss (Fub) with different email accounts
but could not log in every time I tried.
Below given is the button, addItem is the function which will add the code
<button onclick="addItem()" class="list-group-item list-group-item-action py-2 ripple btn btn-primary">
<i class="fas fa-chart-area fa-fw me-3"></i><span>➕ Add Product</span>
</button>
Below is the code i want to add:
<a href="#" class="list-group-item list-group-item-action flex-column align-items-start">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">Item 1</h5>
</div>
<p class="mb-1">Edible/Drinkable</small>`
</a><br>
Im trying to add the tag at a certain place in the html file onclick of a button
I need the page to run like this: The HTML loads, and the first prompt asks user for input. Prompt is submitted, and the running total is changed and the page displays it. Second prompt is asked, submitted, and then running total is changed and displayed again. Same thing for the final prompt. I believe everything is working completely fine except I can’t find a way to make the prompts show up after all of the HTML is loaded, and for the total to update and be displayed after each prompt. I’ve tried window.onload, setTimeout, DOMContentLoader, etc. but none of them seem to work.
HTML:
<!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>Reno Calculator</title>
<script src="homerenovation.js" defer></script>
</head>
<body>
<h1>Reno calculator <img src="2chicks.jpg"></h1>
<p class="paint" style="background-color:grey;"></p>
<p class="furniture" style="background-color:pink;"></p>
<p class="floorCoverings"></p>
<h3 class="totalCost"></h3>
</body>
</html>
Javascript:
function addPaintAndSupplies(totalCost, callback) {
let cost = prompt("Enter the cost for the paint and supplies :");
cost = parseFloat(cost);
if (cost > 100){
cost *= 1.1;
}
// Get a handle for the paint paragraph
let paintArea = document.querySelector(".paint");
paintArea.innerHTML = `Paint $ ${cost.toFixed(2)}`;
callback(totalCost + cost);
return (totalCost + cost);
}
const addFloorCoverings = function(totalCost, callback) {
let cost = prompt("Enter the cost for the floor coverings :");
cost = parseFloat(cost);
if (cost < 500){
cost *= .85;
}
// Get a handle for the floor coverings paragraph
let floorCoveringsArea = document.querySelector(".floorCoverings");
floorCoveringsArea.innerHTML = `Floor Coverings $ ${cost.toFixed(2)}`;
callback(totalCost + cost);
return (totalCost + cost);
}
const addFurniture = (totalCost, callback) => {
let cost = prompt("Enter the cost for the furniture :");
cost = parseFloat(cost);
if (cost < 500){
cost *= .90;
}
// Get a handle for the furniture paragraph
let furnitureArea = document.querySelector(".furniture");
furnitureArea.innerHTML = `Furniture $ ${cost.toFixed(2)}`;
callback(totalCost + cost);
return (totalCost + cost);
}
const updateTotals = (cost) => {
// Get a handle for the total cost header
let totalsArea = document.querySelector(".totalCost");
totalsArea.innerHTML = `Total $ ${cost.toFixed(2)}`;
}
let totalCost = 0;
totalCost = addPaintAndSupplies(totalCost, updateTotals);
totalCost = addFloorCoverings(totalCost, updateTotals);
totalCost = addFurniture(totalCost, updateTotals);
I have got a big application where I got the upmost layout that does a lot of checks and fetches for some user data and verifies it’s valid, all server rendered.
The app/(dashboard)/layout.tsx file looks like this:
export default async function DefaultLayout({
children,
}: {
children: React.ReactNode;
}) {
// Fetch user data
var userState = await fetchUserData();
return (
other components...
);
}
export const dynamic = 'force-dynamic'
Then I have got another server component as child of this which does another await fetchUserData() to get the userState.
The fetchUserData function is a fetch to my db with { cache: “no-store” }
, so it shouldn’t cache any data
The interesting bit is that even if I call this function 2 times, on my database it only does 1 request, so this means that Next.js will call fetch once then even if it has “no-store” during this render it won’t do the fetch again?
Next.js docs say “This request should be refetched on every request.” for the no-store property on a fetch call, but even if that function with the fetch is called 2 times (I have tested it with a console.log before the fetch), on my database it only logs 1 call.
Does this work on a render to render basis? If I do 1 fetch then during the current render that fetch will never be called again but instead the initial fetch data will be used? What if I wanted to fetch 2 times and get data each time?
<div
ref={tableContainerRef}
style={{
overflow: 'auto', //our scrollable table container
position: 'relative', //needed for sticky header
height: '100%', //should be a fixed height
}}
>
{/* Even though we're still using sematic table tags, we must use CSS grid and flexbox for dynamic row heights */}
<table className='dark:text-slate-300 w-full'>
<thead className='sticky top-0 z-[1] text-slate-500 dark:text-slate-400 bg-slate-50 dark:bg-slate-900/20 text-xs font-semibold uppercase '>
{table.getHeaderGroups().map((headerGroup) => (
<tr
key={headerGroup.id}
style={{ display: 'flex', width: '100%' }}
className='border-slate-200 dark:border-slate-700 border-t border-b'
>
{headerGroup.headers.map((header: any) => {
return (
<th
key={header.id}
className=' flex items-center p-3'
style={{
display: 'flex',
width: header.getSize(),
}}
>
<div
{...{
className: header.column.getCanSort()
? 'cursor-pointer select-none flex flex-row gap-2 items-center'
: '',
onClick: header.column.getToggleSortingHandler(),
}}
>
{flexRender(
header.column.columnDef.header,
header.getContext(),
)}
{{
asc: (
<KeyboardArrowUpIcon
style={{ fill: '#4a586b', width: '18px' }}
/>
),
desc: (
<KeyboardArrowDownIcon
style={{ fill: '#4a586b', width: '18px' }}
/>
),
}[header.column.getIsSorted() as string] ?? null}
</div>
</th>
);
})}
</tr>
))}
</thead>
<tbody
style={{
display: 'grid',
height: `${rowVirtualizer.getTotalSize()}px`, //tells scrollbar how big the table is
position: 'relative', //needed for absolute positioning of rows
}}
>
{rowVirtualizer.getVirtualItems().map((virtualRow: any) => {
const row = rows[virtualRow.index] as Row<T>;
return (
<tr
data-index={virtualRow.index} //needed for dynamic row height measurement
ref={(node) => rowVirtualizer.measureElement(node)} //measure dynamic row height
key={row.id}
className='p-1'
style={{
position: 'absolute',
transform: `translateY(${virtualRow.start}px)`, //this should always be a `style` as it changes on scroll
width: '100%',
}}
>
{row.getVisibleCells().map((cell) => {
return (
<td
key={cell.id}
className='text-[#333] py-1 px-3'
style={{
width: cell.column.getSize(),
}}
>
{flexRender(
cell.column.columnDef.cell,
cell.getContext(),
)}
</td>
);
})}
</tr>
);
})}
</tbody>
</table>
</div>
https://codesandbox.io/p/sandbox/festive-wind-8dj7ch?file=%2Fsrc%2FApp.js%3A2%2C39
If done as in the above codesandbox, it becomes fixed at 150px and does not become full width
If you know how to solve it, I’d appreciate it if you could let me know I applied it to the code sand box just like my situation.
We are building a sign up form for a React application which embeds a HTML legal agreement as iframe. The document is available in multiple languages , one of which can be selected by a dropdown menu, this option is independent from the application’s global i18n preference.
Our legal department doesn’t really like us touching their docs so converting it to JSX isn’t an option, they also want us to make sure the user has “read” the agreement by requiring the document to be scrolled to the bottom before the checkbox agreeing to it is enabled.
We attempted to implement this by registering a load listener on the iframe’s contentWindow inside a useEffect hook that registers a scroll listener on contentDocument when the iframe has finished loading. The scroll listener then enables the “I agree” checkbox when the user has finished reading the iframe document.
import { useEffect, useRef, useState } from "react";
import "./styles.css";
export default function App() {
const [language, setLanguage] = useState("en");
const [tncRead, setTncRead] = useState(false);
const iframeRef = useRef();
useEffect(() => {
if (iframeRef) {
const currentRef = iframeRef.current;
// Wait for the iframe document to finish loading
iframeRef.current.contentWindow.addEventListener("load", () => {
console.log("onLoad fired");
// Register the scroll listener
iframeRef.current.contentDocument.addEventListener(
"scroll",
handleOnScroll
);
});
return () => {
if (currentRef) {
console.log("unregistered listener");
currentRef.contentDocument.removeEventListener(
"scroll",
handleOnScroll
);
}
};
}
}, [language]);
function handleLanguageChange(e) {
setLanguage(e.target.value);
}
function handleOnScroll(e) {
const scrollingElement = e.target.scrollingElement;
const hasReachedBottom =
scrollingElement.scrollHeight - scrollingElement.clientHeight <=
scrollingElement.scrollTop + 50;
if (!tncRead && hasReachedBottom) {
setTncRead(true);
}
}
return (
<div className="App">
<div>
<label>Language :</label>
<select onChange={handleLanguageChange}>
<option value="en">English</option>
<option value="zh">中文</option>
</select>
</div>
<iframe ref={iframeRef} id="tnc-frame" src={`tnc_${language}.html`} />
<div>
<input type="checkbox" disabled={!tncRead} />
<label>I agree to the Terms & Conditions</label>
</div>
</div>
);
}
https://codesandbox.io/s/react-iframe-onload-test-forked-q76qzs?file=/src/App.js
However this only works on the initial render of the component. If the user changes the state controlling the iframe’s src attribute by selecting a different language, the load listener registering the scroll listener doesn’t fire which causes the checkbox to never enable.
I tried the same in vanilla JavaScript and it worked there.
I am currently making a word-guessing minigame. In this, I have one Array called PlayingArrays and a bunch of other arrays that contain names. I am using Math.random() to get the indices.
Question: How can I get the name of the array?
Note: The alert on line 19 in inside of playGame() is alert(`${category}`). When this runs, I get every word inside of the array.
const difficultyArticle = document.querySelector('#difficulty-article');
const difficultyOptions = document.querySelector('#difficulty-options');
const startGameButton = document.querySelector('#start-game');
const playArticle = document.querySelector('#play-article');
const resultArticle = document.querySelector('#result-article');
let maxTime = 0;
let currentTime = 0;
let currentSeconds = 0;
let currentMinutes = 0;
let lives = 0;
let difficulty;
function playGame() {
let wordInfo = determineWord();
let randomWord = wordInfo.word;
let category = wordInfo.category;
alert(`${randomWord}, ${category}`);
}
function determineWord() {
let categoryIndex = Math.round(Math.random() * (PlayingArrays.length - 1));
let category = PlayingArrays[categoryIndex];
let wordIndex = Math.round(Math.random() * (category.length - 1));
let randomWord = category[wordIndex];
return {
word: randomWord,
category: category
}
}
playArticle.classList.add("hidden");
resultArticle.classList.add("hidden");
startGameButton.addEventListener('click', (event) => {
playGame();
})
body {
font-family: 'Times New Roman', Times, serif;
}
#difficulty-article.hidden, #play-article.hidden, #result-article.hidden {
display: none;
}
#title-display {
width: 100vw;
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: center;
font-size: 18pt;
}
#title-display h1 {
font-weight: 300;
}
#title-display h2 {
font-weight: 800;
color: red;
}
#difficulty-display {
position: relative;
left: 42.5vw;
}
#difficulty-display select, #difficulty-display button {
text-align: center;
font-size: 12pt;
width: 15vw;
height: 5vh;
}
<!DOCTYPE html>
<html lang="en">
<html>
<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">
<meta name="author" content="Christian Davis">
<link rel="stylesheet" href="styles.css">
<title>Guess That Word</title>
</head>
<body>
<article id="difficulty-article">
<div id="title-display">
<h1>Guess That</h1>
<h2>WORD!</h2>
</div>
<div id="difficulty-display">
<select required id="difficulty-options">
<option value="">---Select Your Difficulty---</option>
<option value="Easy">Easy</option>
<option value="Medium">Medium</option>
<option value="Hard">Hard</option>
<option value="Impossible">Impossible</option>
</select> <br>
<button id="start-game">Start Game</button>
</div>
<img src="./Images/Question Mark Man.jpeg">
</article>
<article id="play-article">
</article>
<article id="result-article">
</article>
<script src="game.js"></script>
<script src="Arrays.js"></script>
<!--Normally, we want to use type="module" in the game.js file,
but that doesn't work on my chromebook-->
</body>
</html>
Arrays:
const Animals = [
"Aardvark",
"Albatross",
"Alligator",
"Ant",
"Armadillo",
"Axolotl",
"Aye-Aye",
"Badger",
"Banded Palm Civet",
"Bandicoot",
"Barnacle",
"Barracuda",
"Basilisk Lizard",
"Basking Shark",
"Bear",
"Beaver",
"Bedbug",
"Bee",
"Beetle",
"Binturong",
"Bird",
"Birds Of Paradise",
"Bison",
"Blobfish",
"Booby",
"Bongo",
"Bonito Fish",
"Bonobo",
"Booby",
"Bovid",
"Buffalo",
"Bug",
"Butterfly",
"Buzzard",
"Carp",
"Cat",
"Cheetah",
"Chameleon",
"Cockroach",
"Cod",
"Coelacanth",
"Cheetah",
"Chameleon",
"Dolphin",
"Duck",
"Elephant",
"Eagle",
"Fox",
"Frog",
"Giraffe",
"Gorilla",
"Hawk",
"Hippopotamus",
"Iguana",
"Ibis",
"Jaguar",
"Jellyfish",
"Kangaroo",
"Koala",
"Lemur",
"Lion",
"Meerkat",
"Monkey",
"Narwhal",
"Newt",
"Orangutan",
"Ostrich",
"Penguin",
"Peacock",
"Quetzal",
"Quokka",
"Raccoon",
"Rhinoceros",
"Shark",
"Sloth",
"Tiger",
"Toucan",
"Uakari",
"Umbrellabird",
"Viper",
"Vulture",
"Wallaby",
"Wombat",
"X-ray Tetra",
"Xenops",
"Yabby",
"Yak",
"Zebra",
"Zorse",
"Albatross",
"Aye-Aye",
"Badger",
"Banded Palm Civet",
"Bandicoot",
"Barnacle",
"Barracuda",
"Basilisk Lizard",
"Basking Shark",
"Bison",
"Blobfish",
"Booby",
"Bongo",
"Bonito Fish",
"Bonobo",
"Bovid",
"Buffalo",
"Bug",
"Butterfly",
"Buzzard",
"Carp",
"Cat",
"Cockroach",
"Cod",
"Coelacanth",
"Cuttlefish",
"Dung Beetle",
"Earwig",
"Echidna",
"Falcon",
"Fiddler Crab",
"Firefly",
"Flatworm",
"Flying Squirrel",
"Gazelle",
"Gecko",
"Gibbon",
"Glass Lizard",
"Glow Worm",
"Gnu",
"Goblin Shark",
"Goldfish",
"Goose",
"Gopher",
"Gudgeon",
"Guinea Pig",
"Guppy",
"Hamster",
"Harpy Eagle",
"Hercules Beetle",
"Hermit Crab",
"Herring",
"Hornet",
"Hummingbird",
"Hyena",
"Ibex",
"Impala",
"Indigo Bunting",
"Insect",
"Jackal",
"Jerboa",
"Junglefowl",
"Kinkajou",
"Kiwi",
"Kookaburra",
"Kowari",
"Lamprey",
"Leaf-Tailed Gecko",
"Leech",
"Lemming",
"Limpet",
"Lobster",
"Locust",
"Mantis Shrimp",
"Mantis",
"Marmoset",
"Marsupial",
"Mastodon",
"Mayfly",
"Midge",
"Millipede",
"Mole",
"Mollusk",
"Mongoose",
"Monitor Lizard",
"Moth",
"Mouse",
"Mule",
"Nightingale",
"Nudibranch",
"Numbat",
"Nurse Shark",
"Okapi",
"Olm",
"Opossum",
"Owl",
"Panda",
"Parrot",
"Peafowl",
"Pelican",
"Penguin",
"Pheasant",
"Pig",
"Pika",
"Piranha",
"Planarian",
"Platypus",
"Poodle",
"Porcupine",
"Quail",
"Quokka",
"Quoll",
"Rabbit",
"Rat",
"Reindeer",
"Reticulated Python",
"Rhinoceros",
"Sable",
"Salamander",
"Sardine",
"Scorpion",
"Sea Dragon",
"Sea Slug",
"Sea Squirt",
"Sea Urchin",
"Seahorse",
"Seal",
"Shrimp",
"Skunk",
"Sloth",
"Slug",
"Snail",
"Snake",
"Snipe",
"Snow Leopard",
"Sparrow",
"Spider",
"Sponge",
"Squid",
"Squirrel",
"Star-Nosed Mole",
"Starfish",
"Stonefish",
"Sturgeon",
"Sun Bear",
"Swordfish",
"Tapeworm",
"Tarantula",
"Tarsier",
"Termite",
"Thorny Devil",
"Tiger Beetle",
"Tiger Shark",
"Tiger Snake",
"Tiglon",
"Tortoise",
"Toucan",
"Tree Frog",
"Tsetse Fly",
"Uakari",
"Uguisu",
"Umbrellabird",
"Unicorn",
"Urial",
"Vampire Bat",
"Vampire Squid",
"Vicuna",
"Vulture",
"Wallaby",
"Walrus",
"Warthog",
"Wasp",
"Water Buffalo",
"Weasel",
"Weevil",
"Whale",
"Whippet",
"Whitefish",
"Wild Boar",
"Wildebeest",
"Wolf",
"Wolverine",
"Wombat",
"Woodpecker",
"Wrasse",
"Wrench",
"Wryneck",
"X-Ray Tetra",
"X-Ray Fish",
"Xantus's Hummingbird",
"Xeme",
"Xenarthra",
"Xenomorph",
"Xenophyophore",
"Xenops",
"Xenopus",
"Xerus",
"Xiaosaurus",
"Xoloitzcuintli",
"X-Ray Crab",
"X-Ray Shrimp",
"Yaffle",
"Yak",
"Yapok",
"Yardang",
"Yellow-Eyed Penguin",
"Yellowjacket",
"Yelling Cat",
"Yerevan",
"Yeti Crab",
"Yew",
"Ylva",
"Yo-Yo",
"Yodeler",
"Yoshi",
"Yowie",
"Yoyo",
"Yurt",
"Zander",
"Zebra",
"Zebu",
"Zedonk",
"Zebra Shark",
"Zebra Turkeyfish",
"Zorse"
]
const People = [
{ firstName: "Christian", lastName: "Davis" },
{ firstName: "Ada", lastName: "Lovelace" },
{ firstName: "Abraham", lastName: "Lincoln" },
{ firstName: "Albert", lastName: "Einstein" },
{ firstName: "Alice", lastName: "Johnson" },
{ firstName: "Barack", lastName: "Obama" },
{ firstName: "Bob", lastName: "Smith" },
{ firstName: "Cleopatra", lastName: "Jones" },
{ firstName: "Charles", lastName: "Darwin" },
{ firstName: "Charlie", lastName: "Davis" },
{ firstName: "Coco", lastName: "Chanel" },
{ firstName: "David", lastName: "Bowie" },
{ firstName: "Emily", lastName: "Brown" },
{ firstName: "Emmeline", lastName: "Pankhurst" },
{ firstName: "Frank", lastName: "Johnson" },
{ firstName: "Frida", lastName: "Kahlo" },
{ firstName: "Galileo", lastName: "Galilei" },
{ firstName: "Grace", lastName: "Taylor" },
{ firstName: "Grace", lastName: "Hopper" },
{ firstName: "Henry", lastName: "Clark" },
{ firstName: "Helen", lastName: "Keller" },
{ firstName: "Ivy", lastName: "Robinson" },
{ firstName: "Isaac", lastName: "Newton" },
{ firstName: "Jack", lastName: "Anderson" },
{ firstName: "Jane", lastName: "Austen" },
{ firstName: "John", lastName: "Doe" },
{ firstName: "John", lastName: "Kennedy" },
{ firstName: "Katherine", lastName: "Miller" },
{ firstName: "Kylie", lastName: "Johnson" },
{ firstName: "Leonardo", lastName: "da Vinci" },
{ firstName: "Louis", lastName: "Turner" },
{ firstName: "Mia", lastName: "Hill" },
{ firstName: "Marie", lastName: "Curie" },
{ firstName: "Martin", lastName: "King Jr." },
{ firstName: "Nelson", lastName: "Mandela" },
{ firstName: "Noah", lastName: "Parker" },
{ firstName: "Olivia", lastName: "Rossi" },
{ firstName: "Pablo", lastName: "Picasso" },
{ firstName: "Paul", lastName: "White" },
{ firstName: "Quinn", lastName: "Miller" },
{ firstName: "Queen", lastName: "Elizabeth II" },
{ firstName: "Robert", lastName: "Davis" },
{ firstName: "Rosa", lastName: "Parks" },
{ firstName: "Sophia", lastName: "Walker" },
{ firstName: "Steve", lastName: "Jobs" },
{ firstName: "Thomas", lastName: "Edison" },
{ firstName: "Tom", lastName: "Thompson" },
{ firstName: "Ursula", lastName: "Smith" },
{ firstName: "Victor", lastName: "Garcia" },
{ firstName: "Vincent", lastName: "van Gogh" },
{ firstName: "Wendy", lastName: "Jones" },
{ firstName: "William", lastName: "Shakespeare" },
{ firstName: "Winston", lastName: "Churchill" },
{ firstName: "Xander", lastName: "Johnson" },
{ firstName: "Yvonne", lastName: "Miller" },
{ firstName: "Zachary", lastName: "Wilson" },
{ firstName: "Zhang", lastName: "Heng" }
]
const Buildings = [
"Angkor Wat",
"Big Ben",
"Brandenburg Gate",
"Burj Khalifa",
"Christ the Redeemer",
"Colosseum",
"Eiffel Tower",
"Forbidden City",
"Great Wall of China",
"Hagia Sophia",
"Louvre Museum",
"Machu Picchu",
"Neuschwanstein Castle",
"Petra",
"Pyramids of Giza",
"Sagrada Familia",
"Sydney Opera House",
"Taj Mahal",
"The White House",
"Tokyo Tower",
"Alhambra",
"Amsterdam Centraal",
"Atomium",
"Basilica of the Sagrada Familia",
"Blue Mosque",
"Buckingham Palace",
"Casa Milà",
"Casa Batlló",
"Château de Versailles",
"Cologne Cathedral",
"Dresden Frauenkirche",
"Dome of the Rock",
"Edinburgh Castle",
"Empire State Building",
"Fallingwater",
"Florence Cathedral",
"Gherkin",
"Golden Gate Bridge",
"Great Mosque of Djenne",
"Himeji Castle",
"Hofburg",
"Hollywood Sign",
"Jin Mao Tower",
"Leaning Tower of Pisa",
"Mont Saint-Michel",
"Moscow Kremlin",
"Palace of Westminster",
"Pantheon",
"Potala Palace",
"Reichstag Building",
"Rockefeller Center",
"St. Basil's Cathedral",
"St. Peter's Basilica",
"Statue of Liberty",
"Stonehenge",
"Taipei 101",
"The Shard",
"Tower Bridge",
"Uffizi Gallery",
"Willis Tower",
"Windsor Castle",
"Yellow Crane Tower"
]
const Climates = [
"Alpine",
"Arid",
"Boreal Forest",
"Chaparral",
"Coastal",
"Cold Alpine",
"Cold Arid",
"Cold Continental",
"Cold Desert",
"Cold Highland",
"Cold Monsoon",
"Cold Oceanic",
"Cold Prairie",
"Cold Rainforest",
"Cold Savannah",
"Cold Steppe",
"Cold Swamp",
"Cold Temperate",
"Cold Tundra",
"Cold Wetland",
"Cold Oceanic",
"Cold Ice Cap",
"Desert",
"Dry Continental",
"Dry Desert",
"Dry Highland",
"Dry Ice Cap",
"Dry Oceanic",
"Dry Prairie",
"Dry Rainforest",
"Dry Savannah",
"Dry Steppe",
"Dry Swamp",
"Dry Tundra",
"Dry Wetland",
"Equatorial",
"Equatorial Guinea Climate",
"Equatorial Monsoon",
"Equatorial Rainforest",
"Hot Alpine",
"Hot Arid",
"Hot Continental",
"Hot Desert",
"Hot Highland",
"Hot Ice Cap",
"Hot Oceanic",
"Hot Prairie",
"Hot Rainforest",
"Hot Savannah",
"Hot Steppe",
"Hot Swamp",
"Hot Tundra",
"Hot Wetland",
"Hot Oceanic",
"Hot Steppe",
"Hot Savannah",
"Hot Prairie",
"Hot Swamp",
"Hot Alpine",
"Hot Rainforest",
"Hot Monsoon",
"Hot Desert",
"Hot Highland",
"Hot Tundra",
"Hot Ice Cap",
"Humid Continental",
"Humid Subtropical",
"Ice Cap",
"Mangrove",
"Mediterranean",
"Mediterranean Forest",
"Monsoon",
"Mountain",
"Polar",
"Polar Alpine",
"Polar Desert",
"Polar Ice Cap",
"Polar Maritime",
"Polar Tundra",
"Polar Wetland",
"Polar Oceanic",
"Prairie",
"Savanna",
"Semi-Arid",
"Steppe",
"Subarctic",
"Subtropical Desert",
"Subtropical Highland",
"Subtropical Oceanic",
"Subtropical Steppe",
"Subtropical Wetland",
"Swamp",
"Taiga",
"Temperate Oceanic",
"Temperate Rainforest",
"Thundra",
"Tropical Arid",
"Tropical Continental",
"Tropical Desert",
"Tropical Highland",
"Tropical Monsoon",
"Tropical Oceanic",
"Tropical Rainforest",
"Tropical Savannah",
"Tropical Wetland",
"Tundra",
"Warm Arid",
"Warm Oceanic",
"Warm Steppe",
"Wetland",
"Xanthus's Hummingbird",
"Xeme",
"Xenomorph",
"Xenophyophore",
"Xenops",
"Xenopus",
"Xerus",
"Xiaosaurus",
"Xoloitzcuintli",
"X-Ray Crab",
"X-Ray Fish",
"X-Ray Shrimp",
"Yellow-Eyed Penguin",
"Yellowjacket",
"Yelling Cat",
"Yerevan",
"Yeti Crab",
"Yew",
"Ylva",
"Yo-Yo",
"Yodeler",
"Yoshi",
"Yowie",
"Yoyo",
"Yurt",
"Zander",
"Zebra",
"Zebra Shark",
"Zebra Turkeyfish",
"Zedonk"
]
const Countries = [
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Aruba",
"Australia",
"Austria",
"Azerbaijan",
"Bahamas",
"Bahrain",
"Bangladesh",
"Barbados",
"Belarus",
"Belgium",
"Belize",
"Benin",
"Bermuda",
"Bhutan",
"Bolivia",
"Bonaire",
"Sint Eustatius",
"Saba",
"Bosnia and Herzegovina",
"Botswana",
"Bouvet Island",
"Brazil",
"British Indian Ocean Territory",
"Brunei Darussalam",
"Bulgaria",
"Burkina Faso",
"Burundi",
"Cabo Verde",
"Cambodia",
"Cameroon",
"Canada",
"Cayman Islands",
"Central African Republic",
"Chad",
"Chile",
"China",
"Christmas Island",
"Cocos Islands",
"Colombia",
"Comoros",
"Democratic Republic of the Congo",
"The Congo",
"Cook Islands",
"Costa Rica",
"Croatia",
"Cuba",
"Curaçao",
"Cyprus",
"Czechia",
"Côte d'Ivoire",
"Denmark",
"Djibouti",
"Dominica",
"Dominican Republic",
"Ecuador",
"Egypt",
"El Salvador",
"Equatorial Guinea",
"Eritrea",
"Estonia",
"Eswatini",
"Ethiopia",
"Falkland Islands",
"Faroe Islands",
"Fiji",
"Finland",
"France",
"French Guiana",
"French Polynesia",
"Gabon",
"Gambia",
"Georgia",
"Germany",
"Ghana",
"Gibraltar",
"Greece",
"Greenland",
"Grenada",
"Guadeloupe",
"Guam",
"Guatemala",
"Guernsey",
"Guinea",
"Guinea-Bissau",
"Guyana",
"Haiti",
"Heard Island",
"Holy See",
"Honduras",
"Hong Kong",
"Hungary",
"Iceland",
"India",
"Indonesia",
"Islamic Republic of Iran",
"Iraq",
"Ireland",
"Isle of Man",
"Israel",
"Italy",
"Jamaica",
"Japan",
"Jersey",
"Jordan",
"Kazakhstan",
"Kenya",
"Kiribati",
"Democratic People's Republic of Korea",
"Republic of Korea",
"Kuwait",
"Kyrgyzstan",
"Lao People's Democratic Republic",
"Latvia",
"Lebanon",
"Lesotho",
"Liberia",
"Libya",
"Liechtenstein",
"Lithuania",
"Luxembourg",
"Macao",
"Madagascar",
"Malawi",
"Malaysia",
"Maldives",
"Mali",
"Malta",
"Marshall Islands",
"Martinique",
"Mauritania",
"Mauritius",
"Mayotte",
"Mexico",
"Micronesia",
"Moldova",
"Monaco",
"Mongolia",
"Montenegro",
"Montserrat",
"Morocco",
"Mozambique",
"Myanmar",
"Namibia",
"Nauru",
"Nepal",
"Netherlands",
"New Caledonia",
"New Zealand",
"Nicaragua",
"Niger",
"Nigeria",
"Niue",
"Norfolk Island",
"Mariana Islands",
"Norway",
"Oman",
"Pakistan",
"Palau",
"Palestine",
"Panama",
"Papua New Guinea",
"Paraguay",
"Peru",
"Philippines",
"Pitcairn",
"Poland",
"Portugal",
"Puerto Rico",
"Qatar",
"Macedonia",
"Romania",
"Russia",
"Rwanda",
"Réunion",
"Saint Barthélemy",
"Saint Helena",
"Saint Kitts",
"Saint Lucia",
"Saint Martin",
"Saint Pierre",
"Saint Vincent",
"Samoa",
"San Marino",
"Sao Tome and Principe",
"Saudi Arabia",
"Senegal",
"Serbia",
"Seychelles",
"Sierra Leone",
"Singapore",
"Sint Maarten",
"Slovakia",
"Slovenia",
"Solomon Islands",
"Somalia",
"South Africa",
"South Georgia",
"South Sudan",
"Spain",
"Sri Lanka",
"Sudan",
"Suriname",
"Svalbard and Jan Mayen",
"Sweden",
"Switzerland",
"Syrian Arab Republic",
"Taiwan",
"Tajikistan",
"Tanzania",
"Thailand",
"Timor-Leste",
"Togo",
"Tokelau",
"Tonga",
"Trinidad and Tobago",
"Tunisia",
"Turkey",
"Turkmenistan",
"Turks and Caicos",
"Tuvalu",
"Uganda",
"Ukraine",
"United Arab Emirates",
"United Kingdom",
"United States",
"Uruguay",
"Uzbekistan",
"Vanuatu",
"Venezuela",
"Vietnam",
"Virgin Islands",
"Virgin Islands",
"Wallis and Futuna",
"Western Sahara",
"Yemen",
"Zambia",
"Zimbabwe",
"Åland Islands"
]
const States = [
"Alabama",
"Alaska",
"Arizona",
"Arkansas",
"California",
"Colorado",
"Connecticut",
"Delaware",
"Florida",
"Georgia",
"Hawaii",
"Idaho",
"Illinois",
"Indiana",
"Iowa",
"Kansas",
"Kentucky",
"Louisiana",
"Maine",
"Maryland",
"Massachusetts",
"Michigan",
"Minnesota",
"Mississippi",
"Missouri",
"Montana",
"Nebraska",
"Nevada",
"New Hampshire",
"New Jersey",
"New Mexico",
"New York",
"North Carolina",
"North Dakota",
"Ohio",
"Oklahoma",
"Oregon",
"Pennsylvania",
"Rhode Island",
"South Carolina",
"South Dakota",
"Tennessee",
"Texas",
"Utah",
"Vermont",
"Virginia",
"Washington",
"West Virginia",
"Wisconsin",
"Wyoming"
]
const Capitals = [
"Montgomery",
"Juneau",
"Phoenix",
"Little Rock",
"Sacramento",
"Denver",
"Hartford",
"Dover",
"Tallahassee",
"Atlanta",
"Honolulu",
"Boise",
"Springfield",
"Indianapolis",
"Des Moines",
"Topeka",
"Frankfort",
"Baton Rouge",
"Augusta",
"Annapolis",
"Boston",
"Lansing",
"St. Paul",
"Jackson",
"Jefferson City",
"Helena",
"Lincoln",
"Carson City",
"Concord",
"Trenton",
"Santa Fe",
"Albany",
"Raleigh",
"Bismarck",
"Columbus",
"Oklahoma City",
"Salem",
"Harrisburg",
"Providence",
"Columbia",
"Pierre",
"Nashville",
"Austin",
"Salt Lake City",
"Montpelier",
"Richmond",
"Olympia",
"Charleston",
"Madison",
"Cheyenne",
"Tokyo", // Japan
"Paris", // France
"Berlin", // Germany
"Cairo", // Egypt
"Moscow", // Russia
"Seoul", // South Korea
"Oslo", // Norway
"Wellington", // New Zealand
"Beijing", // China
"Rome", // Italy
"Dublin", // Ireland
"Canberra", // Australia
"Nairobi", // Kenya
"Bangkok", // Thailand
"Stockholm", // Sweden
"Amsterdam", // Netherlands
"Brasília", // Brazil
"Lisbon", // Portugal
"Ottawa" // Canada
]
const Foods = [
"Almond",
"Apple",
"Apple Pie",
"Asparagus",
"Banana",
"Barley",
"Beef",
"Broccoli",
"Brownie",
"Butter",
"Candy",
"Carrot",
"Cheese",
"Cherry",
"Chicken",
"Couscous",
"Daikon",
"Date",
"Doughnut",
"Duck",
"Durian",
"Eclair",
"Egg",
"Eggplant",
"Elderberry",
"Einkorn",
"Evaporated Milk",
"Fennel",
"Feta",
"Fig",
"Fish",
"Fudge",
"Gelato",
"Garlic",
"Grapes",
"Grits",
"Grouper",
"Habanero",
"Halibut",
"Havarti",
"Hempseed",
"Honeydew",
"Hot Fudge Sundae",
"Ice Cream",
"Ice Cream Sandwich",
"Iceberg Lettuce",
"Israeli Couscous",
"Jalapeño Jack",
"Jelly Beans",
"Jellyfish",
"Kiwi",
"Kale",
"Kamut",
"Kettle Corn",
"Lamb",
"Lemon",
"Lemon Bars",
"Lettuce",
"Macarons",
"Mango",
"Milk",
"Mousse",
"Mushroom",
"Mussels",
"Napa Cabbage",
"Natto",
"Nondairy Yogurt",
"Nougat",
"Oatmeal Raisin Cookies",
"Olive Oil",
"Orange",
"Ostrich",
"Papaya",
"Parmesan",
"Peach",
"Pear",
"Pecan",
"Pepper",
"Pesto",
"Pineapple",
"Pork",
"Potato",
"Pudding",
"Pumpkin",
"Quark",
"Quiche",
"Quinoa",
"Raspberry",
"Rice",
"Sausage",
"Shrimp",
"Sorghum",
"Soy Milk",
"Spinach",
"Strawberry",
"Sushi",
"Taco",
"Tapioca",
"Tea",
"Teff",
"Toffee",
"Udon",
"Vanilla",
"Walnut",
"Watermelon",
"Wonton",
"Yogurt"
]
const PlayingArrays = [
Animals,
People,
Buildings,
Climates,
Countries,
States,
Capitals,
Foods
]
how do i get my code to end up saying Your trip of 1,567.2 miles will take approximately 18.42 hours to complete. You will need to purchase about 125.38 gallons of fuel which will cost about $374.87. ive done this much so far please help thank you.
import java.util.Scanner;
public class TravlerPlanner {
public static void main (String args[])
{
Scanner scan = new Scanner(System.in);
System.out.printf("How many miles do you plan to travel?tt");
// int miles = scan.nextInt();
double miles = scan.nextDouble();
System.out.printf("So you will drive " + miles +" miles.");
System.out.printf("enter the average speed you plan to travel;");
double speed = scan.nextDouble();
System.out.printf("What is the price of gas?");
double gas = scan.nextDouble();
System.out.printf("Ok, so gas costs $" + gas +" per gallon.");
System.out.printf("What is the average MPG of your car? ");
// int mpg = scan.nextInt();
double mpg = scan.nextInt();
System.out.printf("So, you get " + mpg +" miles per gallon.");
System.out.printf("travel planner");
System.out.print(miles*speed);
double cost = (miles / mpg * gas);
double time = (miles / speed);}
}
}
So i have passed all previous tests of the exercise but i cant seem to pass the last one. Am i missing something?
the test is as follows:
You can add from, to and limit parameters to a GET /api/users/:_id/logs request to retrieve part of the log of any user. from and to are dates in yyyy-mm-dd format. limit is an integer of how many logs to send back.
This was my code implementation to do the exercise tracker test.
const express = require('express')
const app = express()
const cors = require('cors')
const mongoose = require('mongoose')
const bodyParser = require('body-parser')
require('dotenv').config()
app.use(cors())
app.use(express.static('public'))
app.use(bodyParser.urlencoded({extended:false}))
app.get('/', (req, res) => {
res.sendFile(__dirname + '/views/index.html')
});
mongoose.connect(process.env.MONGO_URI)
//models
const User = mongoose.model('User', new mongoose.Schema({
username: String,
}));
const Exercise = mongoose.model('Exercise', new mongoose.Schema({
user_id:{type: mongoose.Schema.Types.ObjectId, ref: 'User'},
description: String,
duration: Number,
date: String,
}));
//API endpoints
app.route('/api/users')
.post(async function(req,res) {
try{
const username = req.body.username
const newUser = new User({username:username})
const userAdded= await newUser.save()
res.json({username:userAdded.username,_id:userAdded._id})
console.log(userAdded)
}
catch(err){
res.json({error:err})
}
})
.get(async function(req,res){
const allUsers = await User.find({})
const eachUser = allUsers.map(user=>({
username:user.username,
_id:user._id,
}))
res.json(eachUser)
})
app.post('/api/users/:_id/exercises',async function(req,res){
try {
const id = req.params._id;
const user = await User.findById(id);
if (!req.body.date) {
req.body.date = new Date().toDateString();
}
const addExercise = {
user_id: id.toString(),
description: req.body.description,
duration: req.body.duration,
date: new Date(req.body.date).toDateString(),
};
const newExercise = new Exercise(addExercise);
const exerciseAdded = await newExercise.save();
res.json({
username: user.username,
description: exerciseAdded.description,
duration: exerciseAdded.duration,
date: exerciseAdded.date,
_id: user._id.toString(),
});
console.log({
username: user.username,
description: exerciseAdded.description,
duration: exerciseAdded.duration,
date: exerciseAdded.date,
_id: user._id.toString(),
})
} catch (error) {
res.status(500).json({ error: error.message });
}
})
app.get('/api/users/:id/logs',async function (req,res){
try {
const id = req.params.id;
const user = await User.findById(id);
let exercises = await Exercise.find({user_id:id})
if (req.query.from && req.query.to) {
const fromDate = new Date(req.query.from);
const toDate = new Date(req.query.to);
// console.log(exercises)
exercises = exercises.filter((exercise) => {
// console.log(exercises)
const exerciseDate = new Date(exercise.date);
return exerciseDate >= fromDate && exerciseDate <= toDate;
})
if (req.query.limit) {
// console.log(req.query.limit)
exercises = exercises.slice(0,parseInt(req.query.limit));
}
}
res.json({
username: user.username,
count: exercises.length,
_id: user._id.toString(),
log:exercises,
})
} catch (error) {
res.status(500).json({ error: error.message });
}
})
const listener = app.listen(process.env.PORT || 3000, () => {
console.log('Your app is listening on port ' + listener.address().port)
})
I have made a test of my own and i am getting results after the ‘from’ and ‘to’ queries. However, this implementation still fails the last test. Any help or guidance would be much appreciated. Thanks!
How are you? I’m trying to use the Spotify API for a project but I want to know how to use the full songs instead of just the preview.
I already have an example of the api but I haven’t found how to implement the complete songs
I made a code to get Steam data, specifically the game title and price. Here is the code:
async function getDataFromGame() {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto(
"https://store.steampowered.com/app/221100/"
);
await handleAgeRestriction(page);
const result = await page.evaluate(() => {
const title = document.querySelector(".apphub_AppName").innerText;
const price = document.querySelector('.game_purchase_price').innerText;
const bundle_title = document.querySelector('div.game_area_purchase_game > h1').innerText;
const bundle_price = document.querySelector('.discount_final_price').innerText;
const game = {
title,
price,
bundle_title,
bundle_price
}
return game;
});
console.log(result);
await browser.close();
}
When I run it, I get this error:
*node:internal/process/promises:279
triggerUncaughtException(err, true / fromPromise */);
^
Error [TypeError]: Cannot read properties of null (reading ‘innerText’)
at evaluate**
This is what I tried and it worked
async function getDataFromGame() {
const browser = await puppeteer.launch({ headless: false, slowMo: 1000 });
The issue is that it takes a long time to retrieve the data and I wouldn’t want someone who wants to use my code to have to see the entire functionality.
My usecase is simple: I want to fetch products that are listed in other peoples stores.
I got the following API working, it returns a list of products that I have added to my own store:
https://{{my_store_name}}.myshopify.com/admin/api/2024-01/products.json
I have contacted a bunch of store owners and they’re said they’re ok with me wanting to fetch their product details via an API. I want something like:
https://{{xyz_person's_store_name}}.myshopify.com/admin/api/2024-01/products.json
Can somebody please tell me if this is possible? I am open to any kind of approach.
Thank you.