Tabs not aligned in Bootstrap Modal

I´m building a Bootstrap Modal and I want to put some tabs inside this Modal to be able to navigate inside him.

What is happenings is that the tabs displayed are not aligned the proper way like in the following image:

enter image description here

I am building this modal in the Javascript with this code:

BootstrapDialog.show({
          title: "Vouchers Details",
          closable: false,
          message: `
             <!-- Criação das tabs -->
    <ul class="nav nav-tabs" role="tablist">
      <li class="nav-item">
        <a class="nav-link active" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-toggle="tab" href="#menu1" role="tab" aria-controls="menu1" aria-selected="false">Menu 1</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" data-toggle="tab" href="#menu2" role="tab" aria-controls="menu2" aria-selected="false">Menu 2</a>
      </li>
    </ul>

    <!-- Conteúdo das tabs -->
    <div class="tab-content mt-3">
      <div id="home" class="tab-pane fade show active" role="tabpanel" aria-labelledby="home-tab">
        <h3>HOME</h3>
        <p>Some content.</p>
      </div>
      <div id="menu1" class="tab-pane fade" role="tabpanel" aria-labelledby="menu1-tab">
        <h3>Menu 1</h3>
        <p>Some content in menu 1.</p>
      </div>
      <div id="menu2" class="tab-pane fade" role="tabpanel" aria-labelledby="menu2-tab">
        <h3>Menu 2</h3>
        <p>Some content in menu 2.</p>
      </div>
    </div>
          `,
          buttons: [
            {
              label: "Dismiss",
              action: function (dialog) {
                dialog.close();
              },
            },
          ],
        });

I need some help to align this tabs.

I try to use some bootstrap classes and some css and html customization, but it did not solve this problem.

Is there a way to make a different function happen after every single click on the document in js?

Im trying to make a gaming website in which when the user first signs in, they are greeted by two show lights that shine down on words that say: “WELCOME TO COSMIC GAMES!” I want to make it interactive, so I’ve been trying to make it so that when the user clicks anywhere on the document, it displays one of the words. I already got the first word, the problem, though is trying to call the second function to light up the second word without calling the first function.

This is what I tried:

var clicks = 0;

function playLightSwitch1() {
  clicks = 1;
  audio  = new Audio("lightSwitch.mp3");
  audio.play();
  document.getElementById("welcomeText").setAttribute("class", "glowWelcome");
  document.getElementById("whiteTraingle1").setAttribute("class", "whiteTraingleVisible1");
  document.getElementById("whiteTraingle2").setAttribute("class", "whiteTraingleVisible2"); 
}

if (clicks == 0) {
  document.addEventListener("click", playLightSwitch1);
}
if (clicks = 1) {
  document.removeEventListener("click", playLightSwitch1);
}

the first function worked, but when I clicked again, the first function ran. I just want nothing to happen on the second click. PS: ignore the setAttribute stuff, that’s just changing the text so it glows.

highcharts tree graph panning and zoom in and out

I’m using a Highcharts tree graph chart. I managed to enable the scrollbar with some help. Another thing I’m trying to do but keep failing is to be able to move on the graph like on Google maps and zoom in and zoom out with scroll wheel.

I might have wrote the correct JS but then didn’t have right CSS or had a CSS that made the code no work.

Highcharts.chart('container', {
  chart: {
    spacingBottom: 150,
    marginRight: 120,
    // margin: [50, 50, 50, 50], // Top, right, bottom, left
    height: 3500,
    width: 2500
  },
  title: {
    text: 'Phylogenetic language tree'
  },
  series: [{
    type: 'treegraph',
    keys: ['parent', 'id', 'level'],
    clip: false,
    data: [
      [undefined, 'Proto Indo-European'],
      ['Proto Indo-European', 'Balto-Slavic'],
      ['Proto Indo-European', 'Germanic'],
      ['Proto Indo-European', 'Celtic'],
      ['Proto Indo-European', 'Italic'],
      ['Proto Indo-European', 'Hellenic'],
      ['Proto Indo-European', 'Anatolian'],
      ['Proto Indo-European', 'Indo-Iranian'],
      ['Proto Indo-European', 'Tocharian'],
      ['Indo-Iranian', 'Dardic'],
      ['Indo-Iranian', 'Indic'],
      ['Indo-Iranian', 'Iranian'],
      ['Iranian', 'Old Persian'],
      ['Old Persian', 'Middle Persian'],
      ['Indic', 'Sanskrit'],
      ['Italic', 'Osco-Umbrian'],
      ['Italic', 'Latino-Faliscan'],
      ['Latino-Faliscan', 'Latin'],
      ['Celtic', 'Brythonic'],
      ['Celtic', 'Goidelic'],
      ['Germanic', 'North Germanic'],
      ['Germanic', 'West Germanic'],
      ['Germanic', 'East Germanic'],
      ['North Germanic', 'Old Norse'],
      ['North Germanic', 'Old Swedish'],
      ['North Germanic', 'Old Danish'],
      ['West Germanic', 'Old English'],
      ['West Germanic', 'Old Frisian'],
      ['West Germanic', 'Old Dutch'],
      ['West Germanic', 'Old Low German'],
      ['West Germanic', 'Old High German'],
      ['Old Norse', 'Old Icelandic'],
      ['Old Norse', 'Old Norwegian'],
      ['Old Swedish', 'Middle Swedish'],
      ['Old Danish', 'Middle Danish'],
      ['Old English', 'Middle English'],
      ['Old Dutch', 'Middle Dutch'],
      ['Old Low German', 'Middle Low German'],
      ['Old High German', 'Middle High German'],
      ['Balto-Slavic', 'Baltic'],
      ['Balto-Slavic', 'Slavic'],
      ['Slavic', 'East Slavic'],
      ['Slavic', 'West Slavic'],
      ['Slavic', 'South Slavic'],
      ['Polish', 'POLISH2'],
      ['PPPPPPPPP1', 'QQQQQQQQQ'],
      // Leaves:
      ['Proto Indo-European', 'Phrygian', 6],
      ['Proto Indo-European', 'Armenian', 6],
      ['Proto Indo-European', 'Albanian', 6],
      ['Proto Indo-European', 'Thracian', 6],
      ['Tocharian', 'Tocharian A', 6],
      ['Tocharian', 'Tocharian B', 6],
      ['Anatolian', 'Hittite', 6],
      ['Anatolian', 'Palaic', 6],
      ['Anatolian', 'Luwic', 6],
      ['Anatolian', 'Lydian', 6],
      ['Iranian', 'Balochi', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Kurdish', 6],
      ['Iranian', 'Pashto', 6],
      ['Iranian', 'Sogdian', 6],
      ['Old Persian', 'Pahlavi', 6],
      ['Middle Persian', 'Persian', 6],
      ['Hellenic', 'Greek', 6],
      ['Dardic', 'Dard', 6],
      ['Sanskrit', 'Sindhi', 6],
      ['Sanskrit', 'Romani', 6],
      ['Sanskrit', 'Urdu', 6],
      ['Sanskrit', 'Hindi', 6],
      ['Sanskrit', 'Bihari', 6],
      ['Sanskrit', 'Assamese', 6],
      ['Sanskrit', 'Bengali', 6],
      ['Sanskrit', 'Marathi', 6],
      ['Sanskrit', 'Gujarati', 6],
      ['Sanskrit', 'Punjabi', 6],
      ['Sanskrit', 'Sinhalese', 6],
      ['Osco-Umbrian', 'Umbrian', 6],
      ['Osco-Umbrian', 'Oscan', 6],
      ['Latino-Faliscan', 'Faliscan', 6],
      ['Latin', 'Portugese', 6],
      ['Latin', 'Spanish', 6],
      ['Latin', 'French', 6],
      ['Latin', 'Romanian', 6],
      ['Latin', 'Italian', 6],
      ['Latin', 'Catalan', 6],
      ['Latin', 'Franco-Provençal', 6],
      ['Latin', 'Rhaeto-Romance', 6],
      ['Brythonic', 'Welsh', 6],
      ['Brythonic', 'Breton', 6],
      ['Brythonic', 'Cornish', 6],
      ['Brythonic', 'Cuymbric', 6],
      ['Goidelic', 'Modern Irish', 6],
      ['Goidelic', 'Scottish Gaelic', 6],
      ['Goidelic', 'Manx', 6],
      ['East Germanic', 'Gothic', 6],
      ['Middle Low German', 'Low German', 6],
      ['Middle High German', '(High) German', 6],
      ['Middle High German', 'Yiddish', 6],
      ['Middle English', 'English', 6],
      ['Middle Dutch', 'Hollandic', 6],
      ['Middle Dutch', 'Flemish', 6],
      ['Middle Dutch', 'Dutch', 6],
      ['Middle Dutch', 'Limburgish', 6],
      ['Middle Dutch', 'Brabantian', 6],
      ['Middle Dutch', 'Rhinelandic', 6],
      ['Old Frisian', 'Frisian', 6],
      ['Middle Danish', 'Danish', 6],
      ['Middle Swedish', 'Swedish', 6],
      ['Old Norwegian', 'Norwegian', 6],
      ['Old Norse', 'Faroese', 6],
      ['Old Icelandic', 'Icelandic', 6],
      ['Baltic', 'Old Prussian', 6],
      ['Baltic', 'Lithuanian', 6],
      ['Baltic', 'Latvian', 6],
      ['West Slavic', 'Polish', 6],
      ['POLISH2', 'PPPPPPPPP', 7],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['POLISH2', 'PPPPPPPPP1', 8],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['POLISH2', 'PPPPPPPPP', 8],
      ['QQQQQQQQQ', '_=========_', 10],
      ['West Slavic', 'Slovak', 6],
      ['West Slavic', 'Czech', 6],
      ['West Slavic', 'Wendish', 6],
      ['East Slavic', 'Bulgarian', 6],
      ['East Slavic', 'Old Church Slavonic', 6],
      ['East Slavic', 'Macedonian', 6],
      ['East Slavic', 'Serbo-Croatian', 6],
      ['East Slavic', 'Slovene', 6],
      ['South Slavic', 'Russian', 6],
      ['South Slavic', 'Ukrainian', 6],
      ['South Slavic', 'Belarusian', 6],
      ['South Slavic', 'Rusyn', 6]

    ],
    marker: {
      symbol: 'circle',
      radius: 6,
      fillColor: '#ffffff',
      lineWidth: 3
    },
    dataLabels: {
      align: 'left',
      pointFormat: '{point.id}',
      style: {
        color: '#000000',
        textOutline: '3px #ffffff',
        whiteSpace: 'nowrap'
      },
      x: 24,
      crop: false,
      overflow: 'none'
    },
    levels: [{
        level: 1,
        levelIsConstant: false
      },
      {
        level: 2,
        colorByPoint: true
      },
      {
        level: 3,
        colorVariation: {
          key: 'brightness',
          to: -0.5
        }
      },
      {
        level: 4,
        colorVariation: {
          key: 'brightness',
          to: 0.5
        }
      },
      {
        level: 6,
        dataLabels: {
          x: 10
        },
        marker: {
          radius: 4
        }
      }
    ]
  }]
});
html,
body {
  height: 100%;
  margin: 0;
}

.navbar {
  font-family: 'Consolas', monospace;
  font-size: 14px;
}

.sidebar {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  position: fixed;
  top: 0;
  right: 0;
  width: 350px;
  height: 100%;
  padding-top: 56px;
  display: flex;
  flex-direction: column;
}

.chart-container {
  margin-right: 350px;
  height: calc(100vh - 56px);
  padding-top: 56px;
}

table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  border: none;
  position: relative;
}

td {
  border: none;
  padding: 10px;
  position: relative;
}

.label {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: white;
  padding: 0 5px;
  font-weight: bold;
  z-index: 1;
}

tr:first-child td {
  height: 20%;
}

tr:last-child td {
  height: 80%;
}

.label {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: white;
  padding: 0 5px;
  font-weight: bold;
  z-index: 1;
}

textarea {
  position: absolute;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  top: 40px;
  left: 10px;
  right: 10px;
  bottom: 80px;
  padding: 10px;
  box-sizing: border-box;
  width: calc(100% - 20px);
  height: calc(100% - 80px);
  white-space: nowrap;
  overflow: auto;
  resize: none;
  border: 1px solid white;
}

.highcharts-figure {
  /* top: 80px;
            max-width: 1200px;
            min-width: 360px; */
  max-height: 1200px;
  height: 100%;
  width: 100%;
}

.btn {
  font-family: 'Consolas', monospace;
  font-size: 14px;
}

#container {
  width: 3000px;
  height: 3400px;
}

.footer {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  background-color: #212529;
  color: white;
  text-align: center;
  padding: 5px;
  text-shadow: 1px 1px 3px #44996e;
  user-select: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
}

.footer p {
  margin: 0;
}

.btn {
  border: 1px solid white;
  color: white;
  background-color: transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/treemap.js"></script>
<script src="https://code.highcharts.com/modules/treegraph.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<div id="navbar-placeholder"></div>

<figure class="highcharts-figure">
  <div id="container"></div>
  <p class="highcharts-description">
  </p>
</figure>



<!-- Chart Container -->
<div class="chart-container">
  <div id="highchart-container" style="width: 100%; height: 100%;"></div>
</div>

<div class="sidebar bg-dark text-white">
  <table>
    <tr>
      <td>
        <span class="label text-white bg-dark">toolbox</span>
        <div class="button-container d-flex flex-wrap justify-content-center">
          <button class="btn btn-secondary m-2">Button 1</button>
          <button class="btn btn-secondary m-2">Button 2</button>
          <button class="btn btn-secondary m-2">Button 3</button>
          <button class="btn btn-secondary m-2">Button 4</button>
          <button class="btn btn-secondary m-2">Button 5</button>
          <button class="btn btn-secondary m-2">Button 6</button>
          <button class="btn btn-secondary m-2">Button 7</button>
          <button class="btn btn-secondary m-2">Button 8</button>
          <button class="btn btn-secondary m-2">Button 9</button>
        </div>
      </td>
    </tr>
    <tr>
      <td>
        <span class="label text-white bg-dark">details</span>
        <!-- Label for the second row -->
        <div class="textarea-wrapper">
          <textarea class="text-white bg-dark" placeholder="..."></textarea>
        </div>
      </td>
    </tr>
  </table>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

Spotify Web API redirect user back to the app after log out [duplicate]

I have a nodejs app that utilizes Spotify Web API, where I am trying to implement a log out button for the user.

Currently I am redirecting the user to

https://accounts.spotify.com/logout

which then logs the user out and eventually yields in Spotify’s log out page. I wonder if it is possible to redirect user back to my app’s home page after logging the user out.

Unable to Track New Files and Folders in Git with VS Code

I cloned my Git repository in VS Code, and while I can commit and push changes to existing files, new files or folders I create aren’t recognized. When I run git status, it says my branch is up to date, and I don’t see any options in the Source Control panel for the new files.

What I’ve Tried:

  • Checked that new files are in the cloned repository directory.
  • Reviewed the .gitignore file for exclusions.
  • Reloaded VS Code.

Why isn’t Git recognizing my new files and folders?
How can I add them to my repository and push them to GitHub?

How to correctly handle issues with incorrect rotation axes after multiple CSS rotate transformations

I’m currently learning about CSS transforms, and I’ve created a demo that showcases 3D rotation of an object.

Here is a simplified version of my code:

export default function RotateDemo() {
    const [ rotateX, setRotateX ] = useState(0);
    const [ rotateY, setRotateY ] = useState(0);
    const [ rotateZ, setRotateZ ] = useState(0);

    return (
        <div className="flex flex-col w-screen h-screen items-center justify-center ">
            <div className="controls w-32 h-32 flex flex-col items-center justify-center mr-[500px]">
                <div>
                    <div>Rotate X: {rotateX}°</div>
                    <input type="range" min="-360" max="360" value={rotateX}
                           onChange={(e) => setRotateX(Number(e.target.value))}
                    />
                </div>
                <div>
                    <div>Rotate Y: {rotateY}°</div>
                    <input type="range" min="-360" max="360" value={rotateY}
                           onChange={(e) => setRotateY(Number(e.target.value))}
                    />
                </div>
                <div>
                    <div>Rotate Z: {rotateZ}°</div>
                    <input type="range" min="-360" max="360" value={rotateZ}
                           onChange={(e) => setRotateZ(Number(e.target.value))}
                    />
                </div>
            </div>

            <div
                className="flex items-center justify-center"
                style={{
                    position: 'absolute',
                    transformStyle: `preserve-3d`,
                    transform: `rotateX(-30deg) rotateY(-30deg)`,
                }}
            >
                <div style={{
                    transformStyle: `preserve-3d`,
                    transformOrigin: `-50px 150px -100px`,
                    transform: `translateX(100px) translateY(-100px) translateZ(100px) 
                                rotateX(${rotateX}deg) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg`
                }}>
                    <div className="cube-face front bg-[#ff0000]">Z</div>
                    <div className="cube-face back bg-[#ff6b00]">Z</div>
                    <div className="cube-face left bg-[#3DE30DFF]">X</div>
                    <div className="cube-face right bg-[#0037ADFF]">X</div>
                    <div className="cube-face top bg-white">Y</div>
                    <div className="cube-face bottom bg-[#f7ff00]">Y</div>
                </div>
                <div
                    style={{
                        transformStyle: `preserve-3d`,
                        transform: `translateY(0px)`,
                    }}
                >
                    <div className="cube-face front bg-white">Z</div>
                    <div className="cube-face back bg-white">Z</div>
                    <div className="cube-face left bg-white">X</div>
                    <div className="cube-face right bg-white">X</div>
                    <div className="cube-face top bg-white">Y</div>
                    <div className="cube-face bottom bg-white">Y</div>
                </div>
            </div>
        </div>
    );
}

The related CSS for the cube faces is as follows:

.cube-face {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 6rem;
    color: black;
}

.front { transform: translateZ(50px); }
.back { transform: translateZ(-50px); }
.left { transform: rotateY(90deg) translateZ(-50px); }
.right { transform: rotateY(90deg) translateZ(50px); }
.top { transform: rotateX(90deg) translateZ(50px); }
.bottom { transform: rotateX(-90deg) translateZ(50px); }

RotateDemo

I’ve encountered an issue where, when I set the rotateY to 90 degrees, modifying the rotateX and rotateZ values makes the object rotate around the same axis. I initially tried nesting divs to change the order of rotations, which worked temporarily, but I still face situations where two rotations appear to use the same axis, leading to unexpected behavior.

Unable to write to the file [closed]

I am reading individual lines from a file and replacing . in each line. In console.log() it is displaying the expected output but I am unable to write it back to the file.

r1.on('line', function(line) {
  line = line + line.replace(/./g,'_') + 'n';
  console.log(line);

  fs.writeFile("assertion", line, function(err) {
  if (err) {
    return console.log(err)
  }
})

Google OAuth 2.0 issues

I’m having issues with authenticating with Google. I am using react front-end with node as back-end, with an Express server.
Here is the Google API Client side information:
Google Auth

My server endpoint (server running on port 3000) (using the oauth2client from here https://github.com/googleapis/google-api-nodejs-client?tab=readme-ov-file#generating-an-authentication-url)
Server endpoint

Front-end function:
front-end function

Function in use in .jsx file:
function in use

And here is the error in the console:
Console error

And finally, here is the error found in Google’s OAuth side of things:
OAuth Error

Save Contact with vcf works on mac, but not on iPhone

I have some code to save contact info as a vcf. The code works fine, but when using on iOS the contact never saves. It only works on Mac. Not sure if there is something I am missing or what. I tried a couple libraries and got the same result.

Do not read. The warning said I do not have enough details and there is literally nothing else for me to add that is not a waste of time. Blah blah blah. Hello. Is this enough details?

Here is the code:

  const generateVCFHandler = async (
    name: string,
    avatar: string,
    links: Link[],
  ) => {
    let vCardString = "BEGIN:VCARDnVERSION:3.0n";

    // Name and formatted name
    const names = name.split(" ");
    const firstName = names[0];
    const lastName = names.length > 1 ? names[names.length - 1] : "";
    vCardString += `FN:${name}nN:${lastName};${firstName};;;n`;

    // Add avatar
    if (avatar) {
      try {
        const response = await fetch(
          `/api/fetchImage?url=${encodeURIComponent(avatar)}`,
        );
        const { base64, mimeType } = await response.json();
        if (base64 && mimeType) {
          vCardString += `PHOTO;ENCODING=b;TYPE=${mimeType.split("/")[1]}:${base64}n`;
        }
      } catch (error) {
        console.error("Failed to fetch image base64", error);
      }
    }

    // Iterate over links to add relevant contact information
    links.forEach((link) => {
      switch (link.icon) {
        case "CiPhone":
          vCardString += `TEL;TYPE=CELL:${link.url.replace("tel:", "")}n`;
          break;
        case "CiMail":
          vCardString += `EMAIL;TYPE=INTERNET:${link.url.replace("mailto:", "")}n`;
          break;
        case "CiFacebook":
          vCardString += `URL;TYPE=Facebook:${link.url}n`;
          break;
        case "CiInstagram":
          vCardString += `URL;TYPE=Instagram:${link.url}n`;
          break;
        case "CiLinkedin":
          vCardString += `URL;TYPE=LinkedIn:${link.url}n`;
          break;
        case "BsTwitterX":
          vCardString += `URL;TYPE=X:${link.url}n`;
          break;
      }
    });

    vCardString += "END:VCARD";

    // Download the vCard
    const blob = new Blob([vCardString], { type: "text/vcard;charset=utf-8;" });
    const url = URL.createObjectURL(blob);
    const a = document.createElement("a");
    a.href = url;
    a.download = "contact.vcf";
    document.body.appendChild(a);
    a.click();
    document.body.removeChild(a);
  };

Here is an example output:

BEGIN:VCARD
VERSION:3.0
FN:Bob User
N:User;Man;;;
TEL;TYPE=CELL:1 (123) 222-3333
URL;TYPE=Facebook:https://facebook.com/myprofile
URL;TYPE=Instagram:https://instagram.com/haha
END:VCARD

ERPNext Query & Script code Problem for Report

In this below code i need month names like setember, october, november instead of {current_month}, {next_month_name}, etc and the condition is this report works as interval of 3 months like if the september over then that month diappear and jan month should be appear.

Can you please correct the code.

def execute(filters=None):
    from datetime import datetime
    from frappe import _  

    current_date = datetime.now()

 
    month_names = [
        "January", "February", "March", "April", "May", "June",
        "July", "August", "September", "October", "November", "December"
    ]

    current_month_index = current_date.month - 1  # Adjust for 0-based index
    rolling_months = [
        month_names[(current_month_index + i) % 12] for i in range(4)
    ]

   
    print("Rolling months:", rolling_months)

 
    columns = [
        _("Enquiry Name") + "::150",
        _("Enquiry Owner") + "::150",
        _("Status") + "::150",
        _("Stage") + "::150",
        _("Probability") + "::150",
        _("Expected Closing Date") + "::150",
        _("Next Activity Date") + "::150",
        _("Closing Month") + "::150",
        _("Enquiry Amount") + "::150",
    ]

  
    for month in rolling_months:
        columns.append(f"{month} Amount::150")

  
    query = f"""
    SELECT
        o.customer_name AS `Enquiry Name`,
        u.full_name AS `Enquiry Owner`,
        o.status AS `Status`,
        o.custom_stage AS `Stage`,
        o.custom_probability__copy AS `Probability`,
        o.expected_closing AS `Expected Closing Date`,
        o.custom_next_activity_date AS `Next Activity Date`,
        CONCAT(
            CASE
                WHEN MONTH(o.expected_closing) = 1 THEN 'January'
                WHEN MONTH(o.expected_closing) = 2 THEN 'February'
                WHEN MONTH(o.expected_closing) = 3 THEN 'March'
                WHEN MONTH(o.expected_closing) = 4 THEN 'April'
                WHEN MONTH(o.expected_closing) = 5 THEN 'May'
                WHEN MONTH(o.expected_closing) = 6 THEN 'June'
                WHEN MONTH(o.expected_closing) = 7 THEN 'July'
                WHEN MONTH(o.expected_closing) = 8 THEN 'August'
                WHEN MONTH(o.expected_closing) = 9 THEN 'September'
                WHEN MONTH(o.expected_closing) = 10 THEN 'October'
                WHEN MONTH(o.expected_closing) = 11 THEN 'November'
                WHEN MONTH(o.expected_closing) = 12 THEN 'December'
            END,
            ' ',
            YEAR(o.expected_closing)
        ) AS `Closing Month`,
        FORMAT(o.opportunity_amount, 2) AS `Enquiry Amount`,
        CASE
            WHEN MONTH(o.expected_closing) = MONTH(CURDATE()) AND YEAR(o.expected_closing) = YEAR(CURDATE()) THEN FORMAT(o.opportunity_amount, 2)
            ELSE 0
        END AS `{rolling_months[0]} Amount`,
        CASE
            WHEN MONTH(o.expected_closing) = MONTH(DATE_ADD(CURDATE(), INTERVAL 1 MONTH)) AND YEAR(o.expected_closing) = YEAR(DATE_ADD(CURDATE(), INTERVAL 1 MONTH)) THEN FORMAT(o.opportunity_amount, 2)
            ELSE 0
        END AS `{rolling_months[1]} Amount`,
        CASE
            WHEN MONTH(o.expected_closing) = MONTH(DATE_ADD(CURDATE(), INTERVAL 2 MONTH)) AND YEAR(o.expected_closing) = YEAR(DATE_ADD(CURDATE(), INTERVAL 2 MONTH)) THEN FORMAT(o.opportunity_amount, 2)
            ELSE 0
        END AS `{rolling_months[2]} Amount`,
        CASE
            WHEN MONTH(o.expected_closing) = MONTH(DATE_ADD(CURDATE(), INTERVAL 3 MONTH)) AND YEAR(o.expected_closing) = YEAR(DATE_ADD(CURDATE(), INTERVAL 3 MONTH)) THEN FORMAT(o.opportunity_amount, 2)
            ELSE 0
        END AS `{rolling_months[3]} Amount`
    FROM
        tabOpportunity o
    LEFT JOIN
        tabUser u ON u.email = o.opportunity_owner
    WHERE
        o.expected_closing BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 3 MONTH)
        AND o.docstatus = 0
    ORDER BY
        o.expected_closing;
    """

  
    data = frappe.db.sql(query, as_dict=True)

  
    for row in data:
        row['Enquiry Amount'] = f"{float(row['Enquiry Amount'] or 0):,.2f}"
        for month in rolling_months:
            row[f"{month} Amount"] = f"{float(row[f'{month} Amount'] or 0):,.2f}"

    return columns, data
````Preformatted text`

I just need the column heading should show month names like setember, october, november instead of {current_month}, {next_month_name},etc.

there is interval function. so the logic is, when the current month “september” over then the column disappear and the current month should be OCT and new column created for Jan.

Heap out of memory Angular Ckeditor 5

All I did was npm install --save @ckeditor/ckeditor5-angular, imported it in shared.module.ts

import { CKEditorModule } from '@ckeditor/ckeditor5-angular';

And after typing ng serve i get this error message after it finishes sealing…

Also RAM usage spikes up to 4 gigs more than usual…

What could be the cause of this error message?
I have tried deleting node_modules folder and package-lock.json file, but nothing…


√ Compiled successfully.
⠦ Generating browser application bundles (phase: sealing)...
<--- Last few GCs --->

[4380:0000018D91386A30]   635576 ms: Scavenge (reduce) 3769.1 (4135.9) -> 3769.1 (4135.9) MB, 3.8 / 0.0 ms  (average mu = 0.069, current mu = 0.027) allocation failure;
[4380:0000018D91386A30]   635584 ms: Scavenge (reduce) 3771.8 (4138.6) -> 3771.8 (4138.6) MB, 3.8 / 0.0 ms  (average mu = 0.069, current mu = 0.027) allocation failure;
[4380:0000018D91386A30]   635589 ms: Scavenge (reduce) 3772.9 (4139.7) -> 3772.9 (4139.7) MB, 3.6 / 0.0 ms  (average mu = 0.069, current mu = 0.027) allocation failure;


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF61745D84F node_api_throw_syntax_error+174175
 2: 00007FF6173E0DA6 v8::internal::wasm::WasmCode::safepoint_table_offset+59926
 3: 00007FF6173E2A40 v8::internal::wasm::WasmCode::safepoint_table_offset+67248
 4: 00007FF617E8D604 v8::Isolate::ReportExternalAllocationLimitReached+116
 5: 00007FF617E78992 v8::Isolate::Exit+674
 6: 00007FF617CFA87C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
 7: 00007FF617D07B5D v8::internal::Heap::PublishPendingAllocations+1117
 8: 00007FF617D04BE7 v8::internal::Heap::PageFlagsAreConsistent+3367
 9: 00007FF617CF7317 v8::internal::Heap::CollectGarbage+2039
10: 00007FF617D0DCD3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
11: 00007FF617D0E57D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
12: 00007FF617D1DD40 v8::internal::Factory::NewFillerObject+816
13: 00007FF617A0EE85 v8::internal::DateCache::Weekday+1349
14: 00007FF617F2B501 v8::internal::SetupIsolateDelegate::SetupHeap+558257
15: 00007FF617EDCF35 v8::internal::SetupIsolateDelegate::SetupHeap+237285
16: 00007FF59B5FE6C6

This is angular version:

ng version

     _                      _                 ____ _     ___
    /    _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △  | '_  / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ | | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   __| |_|__, |__,_|_|__,_|_|       ____|_____|___|
                |___/


Angular CLI: 17.3.8
Node: 18.20.4
Package Manager: npm 10.7.0
OS: win32 x64

Angular: 17.3.12
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1703.8
@angular-devkit/build-angular      17.3.8
@angular-devkit/core               17.3.8
@angular-devkit/schematics         17.3.8
@angular/cdk                       17.3.10
@angular/cdk-experimental          16.2.6
@angular/cli                       17.3.8
@angular/material                  17.3.10
@angular/material-moment-adapter   17.3.10
@schematics/angular                17.3.8
ng-packagr                         17.3.0
rxjs                               7.8.1
typescript                         5.4.5
zone.js                            0.14.7

Redux mockStore – Data not passing in component

I am trying to do the unit testing for the calculation in my component. My issue is that I have created a mockStore but that value inside the mockStore is not passing the data to my component. Hence my test case is getting failed

// below is my mockStore code

    import { configureStore } from '@reduxjs/toolkit';
import { creditStatementData } from './__mock__Data/mockCreditStatement.json'; // Adjust the path as needed

const initialState = {
    creditStatementList: creditStatementData,
};

// Reducer function
const creditStatementListReducer = (state = initialState, action) => {
    switch (action.type) {
        // You can add cases for any actions you may want to test
        default:
            return state.creditStatementList || []; // Return the state as is for any other action
    }
};

// Configure the mock store
const mockStore = configureStore({
    reducer: {
        creditStatementList: creditStatementListReducer,
    },
    preloadedState: initialState,
});

export default mockStore;

============================================

// below is my test file

        import { render, screen } from "@testing-library/react";
    import { MemoryRouter } from "react-router-dom";
    import { Provider } from "react-redux";
    
    // functions import
    import { getFormattedCurrency } from "../../../utils/unitFunction";
    
    // components import
    import CreditSaleTableRow from "../../../components/creditSale/creditSaleTableRow";
    import CreditSaleStatementDataTable from "../../../components/creditSale/creditSaleStatement/creditSaleStatementDataTable";
    
    // mock store
    import mockStore from "../../__mockStore__";
    
    // mock data imports
    import testCases from '../../__mock__Data/creditSaleTestingData.json'
    import creditStatementData from '../../__mock__Data/mockCreditStatement.json'
    
    describe("CREDIT SALE calculation testing", () => {
        test('should calculate total credit and balance to pay', () => {
            const totalDebit = creditStatementData.filter(data => data.type === "debit")
                .reduce((total, item) => total + Number(item.amount), 0);
            const totalCredit = creditStatementData.filter(data => data.type === "credit")
                .reduce((total, item) => total + Number(item.amount), 0);
    
            render(
                <Provider store={mockStore}>
                    <CreditSaleStatementDataTable
                        customerId="testCustomerId"
                        isLoading={false}
                        setIsLoading={jest.fn()}
                        testingData={creditStatementData}
                    />
                </Provider>
            );
    
            const balanceToPay = totalCredit - totalDebit;
            const balanceToPayInScreen = screen.getByText(getFormattedCurrency(balanceToPay).toString());
    
            expect(getFormattedCurrency(balanceToPayInScreen)).toBeInTheDocument();
        });
});

I have consol.log my redux state in the component i can see it a empty array

Redux_creditStatementList for testing []

Compare string with day and month of date

I want javascript to add a class to a html element, depending of the current day and month. To do this, I would like to compare the class of the elements (“09-20”, “09-21”, …) with the day and month of the current date.
Unfortunately my script doesn’t work. I’m an absolute beginner in javascript, so sorry for my rookie mistakes.

<div class="grid-item" data-date="09-20"></div>
<div class="grid-item" data-date="09-21"></div>
<div class="grid-item" data-date="09-22"></div>
<div class="grid-item" data-date="09-23"></div>
<div class="grid-item" data-date="09-24"></div>
<div class="grid-item" data-date="09-25"></div>
<div class="grid-item" data-date="09-26"></div>

.grid-item {
  height: 130px;
  width: 130px;
  float: left;
  background: red;
  margin: 10px;
}
.today {
  background: yellow;
  border: red 1px solid;
}

$(function() {
   var a = new Date();     
    $(".grid-item").each(function() {
        var specifiedDate = $(this).data('date');       

        if (a.getMonth() + "-" + a.getDay() == specifiedDate) {
            $(this).addClass('today');
        }
    });
});

Show/hide some text in larger text

I’m trying to show/hide some text (a highlight) in the middle of a paragraph. These criteria are essential:

  1. I need the method to be flexible to work on a single line or multi-line.
  2. And I need it to not mess with the rest of the paragraph’s text line-height.

Below are what I have so far but neither is quite right. Version 1 has the transition I would prefer i.e. width of the <mark> tag reducing to zero and using an overflow: hidden to mask the text as it is reducing is size. The problem with this is it can’t be multi-line. Version 2 is a compromise that reduces font-size: 0px; but can be multi-line.

Is there any solution to getting this to work (looking like version 1 but functioning like version 2)? Or is there another solution to this? (I have also tried transform: scaleX(0); and this does not work).

body
{
    font-size: 15px;
    line-height: 21px;
    font-family: 'Open Sans';
}

.section
{
    position: relative;
    margin: 0px 0px 50px 0px;
    width: 500px;
    height: 210px;
    background: #eeeeee;
    border: 1px solid #666666;
}

.paragraph
{
    position: relative;
    width: 100%;
    height: 100%;
    display: inline;
    vertical-align: middle;
}

.paragraph1
{
    background: #00ffff;
}

.paragraph2
{
    background: #00ffff;
}


/* version 1 */
.mark1
{
    position: relative;
    top: 2px;
    width: 150px;
    height: 21px;
    transition: all 1.0s;
    vertical-align: bottom;
    display: inline-block;
    overflow: hidden;
    white-space: pre;
}

.mark1 span
{
    position: relative;
    top: -2px;
    height: 23px;
    display: inline-block;
    background: #cccccc;
}

.mark1.hidden
{
  width: 0px;
  transition: all 1.0s;
}


/* version 2 */
.mark2
{
    position: relative;
    transition: all 1.0s;
    vertical-align: bottom;
    background: #00ff00;
}

.mark2 span
{
    position: relative;
    padding: 0px 0px 0px 0px;
    background: #cccccc;
}

.mark2.hidden
{
  font-size: 0px;
  transition: all 1.0s;
}
<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>example</title>
  <link href='https://fonts.googleapis.com/css?family=Open Sans' rel='stylesheet'>
</head>

<body>


<button onclick="
const collection = document.getElementsByClassName('mark1');

for (let i = 0; i < collection.length; i++) {
collection[i].classList.toggle('hidden');
}
">toggle version 1</button>

<div class="section">
<div class="paragraph paragraph1">
Lorem Ipsum is<mark class="mark1"> <span>simply dummy text of</span></mark> the printing and typesetting industry. <mark class="mark1"><span>Lorem Ipsum</span> </mark>has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>



<button onclick="
const collection = document.getElementsByClassName('mark2');

for (let i = 0; i < collection.length; i++) {
collection[i].classList.toggle('hidden');
}

">toggle version 2</button>

<div class="section">
<div class="paragraph paragraph2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the<mark class="mark2"> <span>industry's standard dummy text ever since the 1500s</span></mark>, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>

</body>

</html>