In my vs code my intelliSense is not functioning. It is neither showing any kind suggestion nor auto importing components.
Do I need to install some of the extensions or do I need to do some changes in my vs code settings.
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
In my vs code my intelliSense is not functioning. It is neither showing any kind suggestion nor auto importing components.
Do I need to install some of the extensions or do I need to do some changes in my vs code settings.
I want the cue box to be fixed to the bottom of the screen. I have subtitle files in .vtt form. I am using webvtt.
.ts file
@ViewChild('cVideo', { read: ElementRef })
readonly cVideo!: ElementRef<HTMLVideoElement>
ngAfterViewInit(): void {
const video = this.cVideo.nativeElement;
const cueTrack = video.textTracks[0];
if (cueTrack) {
cueTrack.addEventListener('cuechange', () => {
const activeCues = cueTrack.activeCues;
if (activeCues && activeCues.length) {
const cueBox = (cueTrack.activeCues[0] as any).getCueAsHTML();
const videoContainer = video.parentElement;
if (videoContainer) {
console.log('n-34');
cueBox.style.position = 'sticky';
cueBox.style.bottom = '0';
cueBox.style.width = '100%';
cueBox.style.left = '0';
cueBox.style.margin = '0';
cueBox.style.padding = '0';
cueBox.style.boxSizing = 'border-box';
cueBox.style.zIndex = '9999';
videoContainer.appendChild(cueBox);
console.log('n-45');
}
}
});
}
}
I cannot see the console.log('n-45');
on the console. I also logged cueBox it does show the subtitles text correctly.
I am planning to build an application using Electron. What I want to accomplish is to get the URL of the site the user has open in Chrome. For example, if the user has Twitter open in Chrome, I want to get the information to identify it as Twitter, like https://twitter.com. To add, the information to be retrieved does not have to be a URL; it only needs to identify the site.
White man needs help
ANUMIT JOOLOOR the real one
Jewish people of [redacted] causing problems
Tell as many white people you can.
Please.
Also please let professors at computer science department of Indiana University know about me.
They will help me.
tell police of Seville, Ohio about me.
They know me from year 2004, 2005.
They will help me.
I want when to click on the button the duplicate field to appear on the right half of the page next to the original field.
I created this code, but when I click on the button the duplicated fields appear to bellow the original, it should be the same as the original only to be on the right half of the page aligned with the original.
HTML
<div id="inputs" class="short">
<input id="input1" class="input" placeholder=" Add label..." type="text">
<hr class="hr1">
<input id="input2" class="placeholder" placeholder=" Add placeholder..." type="text">
<button class="btn btn-delete">
<i class="fas fa-trash-alt"></i>
</button>
<button onclick="duplicate()" class="button1">
<i class="fa fa-plus"></i>
</button>
</div>
<div id="duplicatedInputs"></div>
JavaScript
var counter = 1;
function duplicate() {
// Get the input fields container
var inputContainer = document.getElementById("inputs");
// Get the input fields to duplicate
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input2");
// Clone the input fields
var clonedInput1 = input1.cloneNode(true);
var clonedInput2 = input2.cloneNode(true);
// Generate unique IDs for the cloned input fields
clonedInput1.id = "input1-" + counter;
clonedInput2.id = "input2-" + counter;
counter++;
// Append the cloned input fields to the duplicated inputs container
var duplicatedInputsContainer = document.getElementById("duplicatedInputs");
duplicatedInputsContainer.appendChild(clonedInput1);
duplicatedInputsContainer.appendChild(clonedInput2);
}
My script is like this below,
After api fetch the items, I want to rerender component and make EnhancedTable
appered.
However this script, api fetch success, but EnhancedTable is not appeared.
response.data returns correct data but, re-render is not executed.
Where am I wrong?
const MetaPanel = (props) =>{
const [drawingItems,setDrawingItems] = React.useState([]);
useEffect(() => {
console.log("File List");
var formData = new FormData();
axios.defaults.xsrfHeaderName = "X-CSRFTOKEN";
axios.defaults.xsrfCookieName = "csrftoken";
axios.defaults.withCredentials = true;
axios.get(`/api/drawings/`)
.then(function (response) {
console.log(response.data);
setDrawingItems(response.data);
})
.catch(function (response) {
console.log(response);
});
},[]);
return (
<div>
<div>
<p>FileList</p>
{drawingItems.length != 0 &
<EnhancedTable data={drawingItems}></EnhancedTable>
}
</div>
</div>
);
}
I’m making a website with Express/React, and I’m not sure if I should use Express to use sendFile to send my website through there, or if I should not? I’m mostly asking about good practices.
Because I’m using Oauth that will log me in through Steam (video game launcher), and right now I’m not serving my page through Express, and since I’m new to Express and backend, and only like 3-5 months into learning React, backend is a lot to take in.
So my (probably not so great) solution is that I load my React page, click on login button, which redirects me to a page from express that is just empty and has no React or anything, which instantly redirects me to the Steam page where I can login. It then redirects me back to an express page. Which is where I’m stuck. I have my data, but I don’t know how I should be able to redirect the user to the React page again and keeping the data. And I imagine that would not be a problem if I just served my React page through express instead.
So this leads me to a few questions:
First, are both solutions (sending React page through Express, or just doint it “the normal” way) okay, just personal preference? If not, which way is the best when it comes to React?
Second, if I didn’t serve my React page through Express, how would I solve this? I’ve been trying for a while but I am really not able to figure it out. Because when I redirect them back to the React page, I need something to send with the user to verify it’s them when the client needs to fetch data from express.
This is my express file for login. All comments that don’t have code to the left of it are comments left by me to make the code more clear and explain what I tried.
const express = require("express");
const router = express.Router();
const SteamAuth = require("node-steam-openid");
const steam = new SteamAuth({
realm: "http://127.0.0.1:3001/auth/steam/", // Site name displayed to users
returnUrl: "http://127.0.0.1:3001/auth/steam/authenticate", // Your return route
apiKey: "I blurred out my key:)", // Steam API key
});
//When I press my login button on the page, I get sent here
//this redirects me to the login through Steam page.
router.get("/auth/steam", async (req, res) => {
const redirectUrl = await steam.getRedirectUrl();
return res.redirect(redirectUrl);
});
//This below is where the users gets redirected
//after I have logged in through Steam,
//as you can I'm trying to redirect the user back
//to the page with port 3000 which is my React page, the main page.
//And I have no clue how to send the data with the redirection.
router.get("/auth/steam/authenticate", async (req, res) => {
try {
const user = await steam.authenticate(req);
res.redirect("http://127.0.0.1:3000/");
//...do something with the data
} catch (error) {
console.error(error);
}
});
module.exports = router;
This is my react App.JS, the element is simply a button which sets my url so I get sent to the express URL that send me to Steam Oauth page.
window.location.href = "http://127.0.0.1:3001/auth/steam";
import "./App.css";
import "./styles.css";
import Login from "./modules/btn.js";
import { useEffect } from "react";
function App() {
//this useEffect is just me testing that it works
useEffect(() => {
fetch("http://127.0.0.1:3001/hej")
.then((res) => res.json())
.then((json) => {console.log(json)});
}, []);
return (
<div className="App">
<Login />
</div>
);
}
export default App;
The vertical input fields that exist on the left half of the page should duplicate on click and be placed on the right half of the page when clicking on the button ‘plus’. I tried different ways and the code works in the online compiler but in VS Code where is my project it doesn’t work!
HTML
<div id="inputs" class="short">
<input id="input1" class="input" placeholder=" Add label..." type="text">
<hr class="hr1">
<input id="input2" class="placeholder" placeholder=" Add placeholder..." type="text">
<button class="btn btn-delete">
<i class="fas fa-trash-alt"></i>
</button>
<button onclick="duplicate()" class="button1">
<i class="fa fa-plus"></i>
</button>
</div>
<div id="duplicatedInputs"></div>
JavaScript
var counter = 1;
function duplicate() {
// Get the input fields container
var inputContainer = document.getElementById("inputs");
// Get the input fields to duplicate
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input2");
// Clone the input fields
var clonedInput1 = input1.cloneNode(true);
var clonedInput2 = input2.cloneNode(true);
// Generate unique IDs for the cloned input fields
clonedInput1.id = "input1-" + counter;
clonedInput2.id = "input2-" + counter;
counter++;
// Append the cloned input fields to the duplicated inputs container
var duplicatedInputsContainer = document.getElementById("duplicatedInputs");
duplicatedInputsContainer.appendChild(clonedInput1);
duplicatedInputsContainer.appendChild(clonedInput2);
}
I’ve really been looking for a solution to this error for a while, I’ve looked everywhere, I’ve searched here, on YouTube, I even tried using chatgpt to see if he knew and nothing……some son of god can do it tell me what is going wrong in my code? I swear I don’t know and it’s probably something very ridiculous that I can’t see……
my entire register.jsx code looks like this:
import React, {useState} from 'react';
import { createUserWithEmailAndPassword, updateProfile } from "firebase/auth";
import {auth, db, storage} from "../firebase";
import { ref, uploadBytesResumable, getDownloadURL } from "firebase/storage";
import { doc, setDoc } from "firebase/firestore";
const Register = () => {
const [err, setErr] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
const displayName = e.target[0].value.trim(); // sanitize display name
const email = e.target[1].value;
const password = e.target[2].value;
const file = e.target[3].files[0];
try {
const res = await createUserWithEmailAndPassword(auth, email, password);
const storageRef = ref(storage, `${displayName}_${Date.now()}`); // use sanitized display name as storage ref
const uploadTask = uploadBytesResumable(storageRef, file);
uploadTask.on(
'state_changed',
(snapshot) => {
// handle progress or error events
},
async () => {
try {
const downloadURL = await getDownloadURL(uploadTask.snapshot.ref);
await updateProfile(res.user,{
displayName,
photoURL: downloadURL,
});
await setDoc(doc(db, "users", res.user.uid), {
uid: res.user.uid,
displayName,
email,
photoURL: downloadURL,
});
} catch (error) {
console.error(error);
setErr(true);
}
},
(error) => {
console.error(error);
setErr(true);
}
);
} catch (error) {
console.error(error);
setErr(true);
}
};
return (
<div className="formContainer">
<div className="formWrapper">
<span className='main_logo'></span>
<span className="logo">AMICA</span>
<span className="title">Register</span>
<form onSubmit={handleSubmit}>
<input type="text" placeholder="display name"/>
<input type="email" placeholder="email"/>
<input type="password" placeholder="password"/>
<input style={{display: 'none'}} type="file" id='file'/>
<label id='upload_img' htmlFor="file">
<span id='img_icon'><i className="fi fi-br-picture"></i></span>
</label>
<label htmlFor="file" id='img_name'>Select an image</label>
<button>Sign up</button>
{err && <span>Something went wrong</span>}
</form>
<p>You do have an account? Login</p>
</div>
</div>
)
}
export default Register;
I tried to fix it looking in many places and even in the doc to see if there was something wrong with the way I was writing and I didn’t find anything, I hoped that he could send the information like the displayname, email, password and photo in png/jpg format for firebase firestore
In class component
render(){
if (temp){ // preparation for making HTML
text = <div>OK</div>
}
else {
text = <div>NG</div>
}
return (<div>{text}</div>);
}
However in function component
return
returns html directly ,so where can I put the preparation?
There exists some hooks called just before the return
?
Is there any way to get data on Airbnb listings programmatically from a listing ID? Such as the square footage. They are not accepting new requests to their API.
Is there a third party API for Airbnb or an Airbnb web scraper?
I see Zapier has some sort of integration. Is it possible for me to use that with JavaScript, Python, or some other programming language?
My goal is to show different set of forms based on which radio button is clicked. No matter what I try I can’t seem to make it work. The forms are hidden, but when I click on the radio button, nothing happens. I believe the cause is the JS code is not linked to the radio button collection — something may be different from JS to simple HTML. I’d really appreciate help.
View
<%= form.collection_radio_buttons(:number, [["1", '1'] ,["2", '2'], ["3", '3'], ["4", "4"], ["5", "5"], ["6", "6"] ], :first, :last) do |b| %>
<%= b.label { b.radio_button + image_tag(b.text+'.png') } %>
<% end %>
JS code
<script type="text/javascript">
document.getElementById("one").style.display = "none";
document.getElementById("two").style.display = "none";
$(document).ready(function() {
$('input[type="radio"][name="number"]').change(function() {
if (this.value == '1') {
document.getElementById("one").style.display = "block";
document.getElementById("two").style.display = "none";
}
else if (this.value == '2') {
document.getElementById("two").style.display = "block";
document.getElementById("one").style.display = "none";
}
});
});
</script>
jQuery (footer)
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
The forms (on the same template as the radio buttons)
<p id="one" class="one" style="">
<%= form.text_area :body, class:'', style:"" %>
</p>
<p id="two" class="two" style="">
<%= form.text_area :body, class:'', style:"" %>
</p>
I have dygraph charts with multiple lines of timeseries data like shown below, I wanted to display a set of annotations on top of the different chart lines where the data has been flagged.
function createGraph(div_element,graph_data) {
const dygraph_div = document.getElementById(div_element);
gs.push(
(g = new Dygraph(dygraph_div, await fetchData(graph_data), {
animatedZooms: true,
annotations: true,
zoomCallback: function (minDate, maxDate) {
let start_date= new Date(minDate).toLocaleString("sv");
let end_date= new Date(maxDate).toLocaleString("sv");
console.log("Zoomed to [", start_date, ", ", end_date, "]");
zoom(begin_date, end_date);
},
legend: "always",
}))
);
};
The function below is used to convert an array containing information of the start and end timestamp where the data was flagged, can be up to 100 elements.
async function convertToAnnotations(flagged_data) {
flagged_data.forEach((flag) => {
const { start_timestamp, stop_timestamp, chart_lines} = flag;
chart_lines.forEach((line) => {
const graph = gs.find((g) => g && g.attributes_ && g.attributes_.series_ && g.attributes_.series_[line]);
if (graph) {
const annotations = graph.annotations() || [];
annotations.push({
series: line,
x: new Date(start_timestamp).toLocaleString("sv"),
height: 5,
width: 5,
tickHeight: 1,
shortText: "test",
text: "Flagged data",
});
graph.setAnnotations(annotations);
}
});
});
console.log(gs);
}
This is a sample result of one object inside the annotations array at the end:
height: 5
series: "A"
shortText: "test"
text: "Flagged data"
tickHeight: 1
width: 5
x: "2022-09-26 13:40:00"
My problem is, the annotations have been set in the function and I can see it when I console.log(gs) but nothing is displaying on any charts, the series does match.
I tried to use .getTime() instead of toLocaleString() but I was getting errors.
I tried to manually create html elements but it ended up not working or displaying little circles vertically or in random places, not on the proper chart lines.
I searched everywhere but I could not fix this issue so I came here.
I want to make users go to next page after 10 seconds not immediately
My code below
<div class="col-md-<?= $col_num ?>">
<?= $this->Flash->render() ?>
<?= $this->Form->create(null, ['id' => '']); ?>
<?= $this->Form->hidden('action', ['value' => 'continue']); ?>
<?= $this->Form->hidden('page', ['value' => $page + 1]); ?>
<?= $this->Form->button(__('Click here to continue - Step (1/2)'), ['class' => 'btn btn-primary',]); ?>
<?= $this->Form->end() ?>
</div>
Go to next page immediately ( code )
<script>
var buttonElement = document.querySelector('.btn.btn-primary');
if (buttonElement) {
buttonElement.click();
}
</script>