I have this code for list all member roles but it’s not in list from top to bot

member.roles.cache.map((r) => r).slice(0,-1)
I want something like this

Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
I have this code for list all member roles but it’s not in list from top to bot

member.roles.cache.map((r) => r).slice(0,-1)
I want something like this

i setuped mui rtl configuration step by step in v5mui. using emotion as styled-engine
stylis v4
stylis-plugin-rtl v2
every thing is ok but when using some complicated component my app apearance crash.
there are a warning in terminal that i think it will be the answere…
but i dont understand it.
enter code here
WARNING in ./node_modules/stylis-plugin-rtl/dist/stylis-rtl.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/home/hamid/Desktop/zahra/node_modules/stylis-plugin-rtl/src/stylis-rtl.ts' file: Error: ENOENT: no such file or directory, open '/home/hamid/Desktop/zahra/node_modules/stylis-plugin-rtl/src/stylis-rtl.ts' @ ./src/index.js 8:0-42 15:18-27
I’m trying to move my blinking element directly to end of the result in the same line.
But my blinking cursor still shows under my javascript result and I can’t put it on the end of the result.
I tried: flex, float left, display: inbolcks and even margin div into div, but id didn’t help.
How can I do it?
I will be really glad for help!
function myFunction()
{
result.innerHTML += "I will not make any more boring art ";
}
body
{
background-color:white;
font-family: Lucida Console Regular;
font-size:15px;
color:black;
border-width:0px;
border: 0;
}
input {
font-size:15px;
border-top-style: hidden;
border-right-style: hidden;
border-left-style: hidden;
border-bottom-style: hidden;
background-color: white;
font-family: Lucida Console Regular;
color: transparent;
display: inline-block;
}
result{
display: flex;
}
.no-outline:focus {
outline: none;
}
textarea:focus, input:focus{
outline: none;
}
.cursor {
position: relative;
float:left;
flex:1;
}
.cursor i {
flex:1;
position: absolute;
width: 1px;
height: 100%;
background-color: black;
animation-name: blink;
animation-duration: 800ms;
animation-iteration-count: infinite;
opacity: 1;
}
@keyframes blink {
from { opacity: 1; }
to { opacity: 0; }
}
<input class="class" type="text" onkeydown="myFunction()" placeholder="type something" autofocus spellcheck="false" >
<div id="result"></div>
<div class="cursor">
<input type="text" class="rq-form-element" /><i></i></div>
I am making a text editor using basic html, css and javascript, I want to add a functionality for the user to resize the image after uploading it, like we do in MS Word.
I searched this several times but I didn’t get the result.
I tried to tackle this problem by making a resizable div and putting the image in this div, by setting the height and width of image 100% according to the div. Now, I can resize the image by resizing the div. But, the problem here is, user can write in this div also and i don’t want that, if i set contenteditable = “false” for this div then user can’t delete this image.
So, is there a way to dynamically resize the image in html using basic css and js.
I have a Jest unit test that is testing an error from a mocked API call to ensure that the error message is displayed on the page. In my actual file, I’m using notistack to display the error messages. I’ve not displayed the full API request because I don’t think it’s relevant so in short, it is the following:
myComponent.js:
import { useSnackbar } from 'notistack';
const myComponent = props => {
const { enqueueSnackbar } = useSnackbar()
//make an API call to an endpoint
...
if (response.ok) enqueueSnackbar("API Success", { variant: "success" });
else enqueueSnackbar("API Failed", { variant: "error" });
}
As a result of this, I am testing the above on my unit test. Again, I won’t paste the whole unit test because I don’t think it’s relevant, but something similar to:
myComponent.test.js
import { render, screen } from "@testing-library/react"
test('testing error message on API call", async () => {
// mock the API call to return a 500 <- this works fine
// ensure that the error message is displayed in the screen
expect(screen.queryByText(/API Failed/)).toBeInTheDocument();
});
Doing the above, I get an error:
TypeError: Cannot destructure property ‘enqueueSnackbar’ of ‘(0 ,
_notistack.useSnackbar)(…)’ as it is undefined
If I simply include something like the following, enqueueSnackbar() will be defined but the test still fails because the message is null.
const mockEnqueue = jest.fn();
jest.mock('notistack', () => ({
...jest.requireActual('notistack'),
useSnackbar: () => {
return {
enqueueSnackbar: mockEnqueue
};
}
}));
However, I don’t even want to mock the snackbar because I want to test the actual display message for each specific scenario (there are multiple).
I want to achieve something like this in React Native:
I have a TextInput component and I want to put an icon to the right side. The user can click it, then I can display some text in a modal or in a another component.
Is this possible in react native?
return(
<View style={styles.container}>
<TextInput
placeholder="Állat neve"
value={AllatNev}
style={styles.textBox}
onChangeText={(text) => setAllatNev(text)}
/>
</View>
);
}
)
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: color_theme_light.bodyBackground
justifyContent: 'center',
alignItems:'center'
},
textBox:{
borderWidth:2,
borderColor: color_theme_light.textBoxBorder,
margin:15,
borderRadius:10,
padding: 10,
fontFamily:'Quicksand-Medium'
},
});
Any way I can pass a user object in the res.redirect?
res.redirect("/");
I added authentication later in my code and after successful signin, I am now redirecting to the home route.
What do I do?
My code is :
let obj1 = [
{ city: 'Tokyo', country: 'Japan' },
{ city: 'Bangkok', country: 'Thailand'}
];
function myFunc(arr, key, value){
let newArr = arr.map((e)=>{
let obj = e;
obj[key] = value;
return obj;
})
return newArr
}
console.log(myFunc(obj1, 'continent', 'Asia'));
console.log(obj1);
I don’t want to mutate the “obj1” array. That’s why I’m using Array.map method. But it still changing the original Array. Does anyone know why this happening? Where I made the mistake?
I am trying to design a hangman game in lucidchart. Just start to thinking about the data. If I decide to store them in database, what kinds of columns do I need?
I can think of columns:
(1) word: To store the actual word; (2) numberOfWrongGuesses: To store the wrong guess number (3) currentWord: The word currently has guessed etc.
One problem is once the user done the game or prepare to start a new game, the database needs to be cleaned up right?
I’m trying to add a little tracking component that brings in a tracking number and carrier from an array. From there, it should add a url to the carrier website. I need to add an if statement or something so when it sees a specific carrier, it adds the url but I’m struggling.
renderTrackingNumbers() {
const { order: { tracking_info } } = this.props;
const trackingNumbers = tracking_info.map((tracking_info) => (
<div key={ tracking_info.id }>
<a href="{ tracking_url_should_be_added_here }">{ tracking_info.tracking_number }</a>
{ ' ' }
-
{ ' ' }
{ tracking_info.carrier_code }
</div>
));
return (
<div>
<h4>{ __('Tracking Numbers') }</h4>
<div>
{ trackingNumbers }
</div>
</div>
);
}
Here is the data I’m receiving from GraphQL:
[
{
"tracking_number": "231300687629630",
"carrier_code": "fedex"
},
{
"tracking_number": "1234567890",
"carrier_code": "dhl"
},
{
"tracking_number": "1Z12345E0305271640",
"carrier_code": "ups"
},
{
"tracking_number": "123465789123456",
"carrier_code": "usps"
}
]
Any help would be awesome.
I have a form where the user enters the parcel dimensions into 3 input fields (length,width,height) and then selects the parcel name from the dropdown selection.
The function I am trying to implement is when the user enters his values into the inputs the function automatically selects the parcel name from the dropdown based on his values when the user clicks the calculate button.
I would like the script to work out the result based on the option datasets not by manually setting the results/values in the javascript as I have more datasets which get changed regularly.
The code I have added always only selects the last option, I tried using a for loop but I could not get that to change the end result.
function calculate(clicked_id) {
Array.from(document.querySelector("#dropdown").options).forEach(function(option_element) {
var option_text = option_element.text;
var option_value = option_element.value;
var option_dataset_length = option_element.dataset.length;
var option_dataset_width = option_element.dataset.width;
var option_dataset_height = option_element.dataset.height;
var is_option_selected = option_element.selected;
var length = document.getElementById("length").value;
var width = document.getElementById("width").value;
var height = document.getElementById("height").value;
if (length <= option_dataset_length && width <= option_dataset_width && height <= option_dataset_height) {
document.getElementById("dropdown").value = option_value;
}
}
)
}
<!-- inputs -->
<div class="row">
<input type="text" id="length" placeholder="length">
<input type="text" id="width" placeholder="width">
<input type="text" id="height" placeholder="height">
</div>
<br>
<!-- dropdown -->
<div class="row">
<select id="dropdown">
<option value="1" data-length="10" data-width="15" data-height="20">Small Parcel</option>
<option value="2" data-length="20" data-width="25" data-height="30">Medium Parcel</option>
<option value="3" data-length="30" data-width="35" data-height="40">Large Parcel</option>
</select>
</div>
<br>
<!-- button -->
<div class="row">
<button type="button" onClick="calculate(this.id)">Calculate</button>
</div>
I’m making a website that can record audio for 5 seconds, it works, but when the 5 seconds finish I want the audio to download or to be save in a folder of my project, is it posible? here is my code:
navigator.mediaDevices.getUserMedia({ audio: true })
.then(stream => {
const mediaRecorder = new MediaRecorder(stream);
mediaRecorder.start();
const audioChunks = [];
mediaRecorder.addEventListener("dataavailable", event => {
audioChunks.push(event.data);
});
mediaRecorder.addEventListener("stop", () => {
const audioBlob = new Blob(audioChunks)
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
});
And I want to make something like this
mediaRecorder.addEventListener("stop", () => {
const audioBlob = new Blob(audioChunks)
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();
audio.save("direction-of-the-folder/") // MAKE this
});
Thank you in advance:)
I tried to enable the geolocation service for the webview, but it never asks for it. I then enabled the service via settings, and it times out every time I try to use it. Is there any problem?
Here’s my code in MainActivity.java:
package com.example.quickweather;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.*;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView daApp = (WebView)findViewById(R.id.DaApp);
WebSettings props = daApp.getSettings();
props.setJavaScriptCanOpenWindowsAutomatically(true);
props.setJavaScriptEnabled(true);
props.setGeolocationEnabled(true);
props.setAllowFileAccessFromFileURLs(true);
props.setAllowFileAccess(true);
props.setAppCacheEnabled(true);
props.setDatabaseEnabled(true);
props.setDomStorageEnabled(true);
props.setAllowContentAccess(true);
daApp.setWebChromeClient(new WebChromeClient(){
@Override
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback){
callback.invoke(origin,true,false);
}
});
daApp.loadUrl("file:///android_asset/webinterface/index.html");
}
}
I’ve been trying to implement a javascript/html/css app into my website builder. It works in the site builder preview, but not on the live version of the site. When I go to the live site, it shows the camera webcam feed, but the ASCII text is just one line. I’ve literally just copy and pasted this code from this git project.
For context, I’m using cargo.site builder and it’s
been kind of challenging to use JS files. My hunch is that my site styles are interfering with the project files. The url for this project is https://grantekilgard.com/ASCII-Webcam-Feed-Generator-copy. Any help is so appreciated, thank you all in advance. 
I’m trying to generate a barcode on the web from the png image. I’m using “jsqr” library. My code looks like this:
loadBarcodeImage() async {
Uint8List? image = await fileUtils.getFileFromLocal(['jpg', 'jpeg', 'png']);
chosenBarcodeImage = image;
Uint8ClampedList clampedList = image!.buffer.asUint8ClampedList();
js.JsArray js_array = js.JsArray.from(clampedList);
callUIBarcodeScanner(js_array);
}
callUIBarcodeScanner(dynamic barcodeImage) {
var barcode = jsqr.jsQR(barcodeImage, 100, 100);
print(barcode);
}
I had been tried a couple of other list types but still getting:
Malformed data passed to binarizer.
at Object.e.binarize (https://cdn.jsdelivr.net/npm/[email protected]/dist/jsQR.min.js:7:6194)
at l (https://cdn.jsdelivr.net/npm/[email protected]/dist/jsQR.min.js:7:5602)
```...
Please, help