MaxListenersExceededWarning: Possible EventEmitter memory leak detected.

I am developing a telegram bot following the tutorial and the code is working as I want. But there is a warning.

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit

I found a solution via stackoverflow.

require('events').EventEmitter.defaultMaxListeners = 15;

I understand that removing the restriction will remove the warning, but not the cause, and you will not receive any alerts about the cause of the resource leak. But I can’t know the reason in my code.
This is my code:

const { Bot, InlineKeyboard } = require("grammy");

// Create a bot using the Telegram token
const bot = new Bot(process.env.HTTP_API_TOKEN || "");

const introductionMessage = `Hello! Welcome to Bot`;

const aboutUrlKeyboard = new InlineKeyboard();
aboutUrlKeyboard.row().webApp(
"Play",
"https://www.google.com/"
);

const replyWithIntro = (ctx) =>
ctx.reply(introductionMessage, {
reply_markup: aboutUrlKeyboard,
parse_mode: "HTML",
});

// Keep this at the bottom of the file
bot.command("start", replyWithIntro);
bot.command("help", replyWithIntro);
bot.on("message", replyWithIntro);

bot.start();

Page Break issue in laravel

I’m encountering a problem with page breaks while printing an HTML document using a printDiv() function triggered by a button. The content overlaps or doesn’t break correctly between sections, causing formatting issues.

I’ve tried adjusting margins and page size using CSS @page rules, but the issue persists. Here’s the snippet I used for adjusting margins:

i am facing the issue. where i am not able to use page break in this code i am using laravel. can any one help me in this issue i am trying it for 3 to 5 days. Thanks.

What adjustments should I make to ensure that each section () in printableArea starts on a new page when printing? Are there specific CSS properties or print-specific adjustments I should consider to resolve this issue?

Print

               {{-- Header Section --}}
                <div class="row">
                 </div>
                
                {{-- Logo Section --}}
                @if ($layoutSetting->logo != 'off')
                    <div class="col-md-12">
                    
                    </div>
                @endif

                <div class="row printBody">

                
                    {{-- Document Id and Date/Time --}}
                    <div class="col-md-4 mt-5">
                                                </div>

                    {{-- Subject , To and info section --}}
                    <div class="col-md-12">
                       
                    </div>

                    {{-- Document Content section --}}
                    <div class="col-md-12" ><br><br>

                    </div>

                    {{-- Reference File Links section --}}
                    <div class="col-md-12"><br><br>

                    </div>

                    {{-- E Sign and QR code section --}}
                    <div class="col-md-12">

                    </div>
                   
                </div>
            </div>

Extjs TagField dropdown items persistent after selection

I’m currenly trying edit TagField behaviour so that the dropdown items stay in dropdown even after you select one or multiple. Use case is something like revenue calculator (every user can determinate own math formula given some constants and math operators), so user can select f.e. symbol “+” multiple times to get formula they want. Is there a easier way then f.e. after selection add the record back to store? Is there better component for something like this?

As I described earlier I only tried TagField and not that pretty code after every selection. I bet there is better way to do it, I’m kidna new to Extjs. Thanks for every suggestion 🙂

Calculate the XYZ tile grid given an extent and resolution for a MapGuide server using OpenLayers

I’m trying to add a tiled map from MapGuide to my OL map. However, with my current code, the X and Y values in the request call are incorrect. I have tried specifying the tile grid with resolutions and extents, but it seems to have no effect. I have also considered using WMTS with a WMTS grid, but given the structure of the call I need to make, it doesn’t seem to be supported. How can I transform the tileCoord that Open Layers is generating to the ones I need to request?

This is my current code:

import Map from 'ol/Map.js';
import TileLayer from 'ol/layer/Tile.js';
import View from 'ol/View.js';
import {getTopLeft} from 'ol/extent.js';
import proj4 from 'proj4';
import { register } from 'ol/proj/proj4';
import OSM from 'ol/source/OSM';
import TileGrid from 'ol/tilegrid/TileGrid.js';
import XYZ from 'ol/source/XYZ.js'; 
proj4.defs('EPSG:25831', '+proj=utm +zone=31 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs');
register(proj4);


// Define projection extent
var projectionExtent = [494035.69730822, 4676149.38116713, 502474.0732031, 4682213.46977595]; 
var resolutions = [
  50000, 40000, 30000, 25000, 20000, 17500, 15000, 12000, 10000, 9000, 8000,
  7000, 6000, 5000, 4500, 4000, 3500, 3000, 2500, 2000, 1500, 1000, 900, 800,
  700, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100
];

// Function to build custom tile URL
function buildTileURL() {
  let url
  url='https://wgis.test123.org/mapguide/mapagent/mapagent.fcgi?mapdefinition= ...  other parameters .... &version=1.2.0&tilecol={x}&tilerow={y}&scaleindex={z}';  // Assuming scaleindex corresponds to the zoom level
  console.log(url)
  return url
}

// XYZ source with custom URL function
var mapGuideSource = new XYZ({
  tileUrlFunction: function(tileCoord) {
    if (tileCoord) {
      console.log(tileCoord)
      return buildTileURL()
        .replace('{x}', tileCoord[1].toString())
        .replace('{y}', tileCoord[2].toString())
        .replace('{z}', tileCoord[0].toString());
    }
    return undefined;
  },
  projection: 'EPSG:25831',
});

const tileGrid = new TileGrid({
  extent: projectionExtent,
  resolutions: resolutions,
  tileSize: [300, 300],
  origin: getTopLeft(projectionExtent)
});


// Create the map layer
var mapGuideLayer = new TileLayer({
  source: mapGuideSource,
  tileGrid: tileGrid,
  extent: projectionExtent,
});

export const osmLayer = new TileLayer({
  source: new OSM(),
});

// Create the map
var map = new Map({
  target: 'map',
  layers: [mapGuideLayer,osmLayer],
  view: new View({
    projection: 'EPSG:25831',
    center: [498254.88525566, 4679681.39547154], 
    zoom: 12
  })
});

Accessing a dynamic Google Earth URL via JavaScript with some certain coordinates, but it actually sends me to the previous saved location

I’m trying to access a dynamic Google Earth URL via JavaScript which works great, but I have only one problem. By doing so, after a while, because of the cookies that are saved on that page it seems that it won’t get me to where it is supposed to get me, and it sends me to the previous saved location from cookies, because after I clear the cookies from Google Earth manually, it works. I don’t want to clear them manually every time, because this is for an app with users. I want to solve this problem from JavaScript code.

Code snippet:

window.open(`https://earth.google.com/web/search/${coords[0]},+${coords[1]}/@${coords[0]},${coords[1]},196.55454222a,112.74878798d,35y,0h,0t,0r`, '_blank');

How to Smoothly Animate a Conic Gradient Background in CSS?

I’m trying to create a smooth animation effect for a conic gradient background in CSS. My goal is to have the gradient appear to shift smoothly without rotating the entire element.

Here’s the CSS I’m currently using:

body {
    width: 100%;
    height: 100vh;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin: 0;
    position: relative;
    background: conic-gradient(from 0deg, #d5d06a, #be6d11);
    animation: animateGradient 10s linear infinite;
}

@keyframes animateGradient {
    0% {
        background: conic-gradient(from 0deg, #d5d06a, #be6d11);
    }
    25% {
        background: conic-gradient(from 90deg, #d5d06a, #be6d11);
    }
    50% {
        background: conic-gradient(from 180deg, #d5d06a, #be6d11);
    }
    75% {
        background: conic-gradient(from 270deg, #d5d06a, #be6d11);
    }
    100% {
        background: conic-gradient(from 360deg, #d5d06a, #be6d11);
    }
}

However, the animation doesn’t look smooth—it appears to be jerky and not continuous. I’m aiming for a seamless and fluid transition.

My questions are:

  1. How can I achieve a smooth, continuous shifting animation for a conic gradient background?
  2. Are there better techniques or optimizations to animate conic gradients in CSS for a more fluid result?

I initially tried animating the background property with keyframes to create a shifting effect in the conic gradient. My expectation was a smooth, seamless animation where the gradient would appear to flow continuously. However, the result was a jerky and non-fluid transition. I also experimented with using CSS variables to adjust the starting angle dynamically and tried rotating a pseudo-element, but neither approach yielded the desired smoothness. I’m looking for a method to make this animation as smooth and continuous as possible.

How to ensure that some code or module runs before any other module?

In a React app, I’m defining an extension on the Object class itself:

declare global
{
    interface Object
    {
        asEnum<TEnum>(this: TEnum): EnumWrapper<TEnum, any>;
    }
}

export function extendObjectType()
{
    Object.prototype.asEnum = function()
    {
        return new EnumWrapper(this as any)
    }
}

(I am aware that extending Object in this way is controversial, but I understand the issues, I’m comfortable with this, and as far as I can tell it’s unrelated to my problem.)

EnumWrappper is a custom class (not shown) that does useful things with the object that represents the enum that it’s wrapping.

Then I can do this:

enum YesNoMaybe
{
    Yes,
    No,
    Maybe
}

console.log(YesNoMaybe.asEnum().keys.join(","))  //prints out "Yes,No,Maybe"

This actually works and does print out the desired value, but obviously only if it runs after the code that extends the Object class. This is true in my React components, but not in a module in general, because the module code seems to run before the extension is made.

I have tried many things to arrange it so that the extension runs first, such as:

  • putting it in the main.tsx component
  • adding a custom script in the React loader html
  • making it the first module alphabetically

None of this helps. So the general question is: how can I arrange things so that a given block of code (or module) runs before any other module?

how can i solve to handle the multiple html pages for e-learning website

i am making a e-learning website and its based on few coding langauges and im using pure HTML,CSS,JS no any other framework and all , due to newbie so i ahve a question regarding that lets say there an C langauge Page and if we take another example c has 20 concepts(ex) so will i have to make 20html pages and its css for all 20 concepts ? even if i input all the content of C in one page it will be chances of more loading of the page for user so please help anyone

im trying to make all the content in one html page so i can just manage 1html and css file and i was trying to do make 20 html page as i can make which is required for the content and lanaguages but it will take more time and i have to manage multiple of html and css file

How to hide link to a different file in bottom left corner?

So i am making a proxy site, and i have a fontawesome button that links to a different file, but it shows in the bottom left corner of my screen when i hover over the button. Most of the current topics civer normal buttons, but they dont work for me since mine is fontawesome or smth…
Gif Demo
<a href="games.html" target="_blank"class="icon fa-solid fa-gamepad fa-hover"></a>

I looked through some of the problems related to this on the site, but none worked. Also I though that since it was a .html file it automatically wasnt going to show up.

How to split bigint into 32 bit chunks and recombine them?

How do I split a large bigint into a 32 bit number array? I also need to recombine them to the bigint again.

I have an api that takes an array of max 32 bit integers and returns an array of max 32 bit integers. But I have a large bigint number that I need to pass into and receive back from this api.

How do I do the splitting and recombining?

Don’t report a fetch timeout as an uncaught exception

I use:

fetch("/test", { signal: AbortSignal.timeout(2000) })
    .then(r => r.json())
    .then(r => { console.log(r["data"]) });

with the method from Fetch API request timeout? to abort the request after 2 seconds if no response.

In the case of a timeout, I have a JS error in the console:

Uncaught (in promise) DOMException: The operation timed out.

What’s the simplest way to avoid having this reported as an error?

I would like the timeouts to be silently ignored.

Reuse Postman Request

I want to reuse a entire postman request in one folder to another folder without pm.sendRequest/pm.execution.setNextRequest() which is like keeping repeated script in a common method and will be called where required in JAVA.

Want to resuse a request via javascript.pm.sendRequest is increasing complex in maintaining scripts.
don’t want to use in our projects

Thanks in advance

Could not add custom image to my Pin when using googles maps API?

i need to add a custom image to my pin, but Pin element does not except images.
i also need to be able to switch between images based on some criteria, so ill have mixed images of pin.

tried this:

`
<Pin background={‘#FBBC04’} glyphColor={‘#575’} borderColor={‘#000’} >

        <Image src="/pin-icon.png" alt="Pin Icon" layout="fill" objectFit="contain"/>        
    
</Pin>

`

but got nothing.
if any one can help me find a solution.

How to write some texts with different color in image using Jimp

I want to write one text with red color, one text with green color and one text with blue color in exist image. How to do it ?

type here
const font32White = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE)
image.print(font64White, 30, 10, '123')
image.print(font64White, 30, 20, '456')
image.print(font64White, 30, 30, '789')

I am trying to do it but only use black and white text. Can someone help me pls?

Trouble Interacting with Dropdown FormField in PHPWord

I’m using PHPWord to create a Word document with an interactive dropdown form field. Below is a snippet of my code:

$cell = $table->addCell();
$textRun = $cell->addTextRun();
$textRun->addFormField('dropdown')->setEntries(['Choice 1', 'Choice 2', 'Choice 3'])->setValue(1);

However, when the Word document is opened, the dropdown displays the selected value (“Choice 2”) but does not allow me to change the selected option interactively.

I want to create a dropdown like this:
enter image description here

But the result not my expected. I Can’t change the option and there isn’t any dropdown arrow. I can see the other options when I double click on the field and they appear to be editable (Can add, remove and change sequence). And when I click “OK” to close the popup, the selected option always changes to the first of option (“Choice 1” in this case).
enter image description here

Has anyone else encountered this issue or have any suggestions on what may be causing this and how to fix it? Any help or pointers would be greatly appreciated!

Thanks in advance!