how to use setTimeout on a react component

This question might be simple to most web developers but I am pretty new and cannot figure out the way to put a settimeout function on what I would like to show on a page. below is the example of the code I would like to add a timeout for. import React from "react"; function… Read More how to use setTimeout on a react component

How can I remove a specific role from everyone that has it in Discord.js v13

I want my bot to remove a specific role from everyone that has it when a message is sent in a channel client.on(‘messageCreate’, async message => { if(message.channel.id === ‘954375143965216869’){ //counting message.guild.roles.get(‘944674567811645472′).members.map(m=>m.member.id).delete(); } }) I’m using discord.js v13 and node.js v16.4.2 >Solution : This should work, it’ll fetch all the members in the guild and… Read More How can I remove a specific role from everyone that has it in Discord.js v13

BottomSheetScaffold is overriding the background color of its parent

I’m trying out BottomSheetScaffold and I just found a strange behavior (maybe a bug) when using it. I put it inside a Box { } that has a cyan background color: composable(route = "my_route") { Box( modifier = Modifier .fillMaxSize() .background(color = Color.Cyan), ) { val coroutineScope = rememberCoroutineScope() val bottomSheetScaffoldState = rememberBottomSheetScaffoldState() BottomSheetScaffold( scaffoldState… Read More BottomSheetScaffold is overriding the background color of its parent

Why is my text going vertical at a certain width?

So I have an issue with my code where when my JavaScript types of a word (eg. Gamer) it limits to a certain width and ends up going vertical instead of horizontal. Here are all the classes and code for the text: // TYPEWRITER // const typedTextSpan = document.querySelector(“.typed-text”); const cursorSpan = document.querySelector(“.cursor”); const textArray… Read More Why is my text going vertical at a certain width?

Why the TaskCompleted is executed before the end of the operation

I created a task like the following code Task task = new(async () => { // without await Task Delay dont work await Task.Delay(TimeSpan.FromSeconds(5)); Console.WriteLine("Task is down"); }); task.Start(); var awaiter = task.GetAwaiter(); awaiter.OnCompleted(() => { Console.WriteLine("Task is Completed"); }); Why the task completed first is printed and then the task is down The task… Read More Why the TaskCompleted is executed before the end of the operation

GetX Throwing TypeError when try to build with Obx

I have controller call MenuController class MenuController extends GetxController { var currentCategory = Rx<int>(0); @override void onReady() async { await Future.delayed(const Duration(milliseconds: 2000)); } void setMenuByIndex(int index) { currentCategory.value = index; } } And I’m trying to check selected index from simple Widget like this Obx(() => Text(controller.currentCategory.value.toString())) Getting controller like here final controller =… Read More GetX Throwing TypeError when try to build with Obx

MongoDB – Group and Find Top N with condition

Consider this test collection, in which an airport is identified by AirportID: { AirportID:"1001", delayMinutes :"15.0" }, { AirportID:"1004", delayMinutes :"3.0" }, { AirportID:"1001", delayMinutes :"20.0" }, { AirportID:"1002", delayMinutes :"6.0" }, { AirportID:"1002", delayMinutes :"25.0" }, { AirportID:"1004", delayMinutes :"55.0" }, I want to group it together and list the top 2 from that… Read More MongoDB – Group and Find Top N with condition