am having this error ‘folly/dynamic.h’ file not found

I am encountering the following error when building my iOS app in Xcode:

arduino
Copy code
‘folly/dynamic.h’ file not found
The error points to a path in JSIDynamic.h, which I can locate, but the folly/dynamic.h file is missing.

I am using React Native 0.66 and the latest version of Xcode. So far, I have tried the following:

Using various tools in Xcode to troubleshoot the issue.
Conducting research online.
Reviewing related questions on Stack Overflow.
Despite these efforts, I have been unable to resolve the problem. Any guidance or solutions would be greatly appreciated.

Scroll main content when cursor is in side bar

I want to enable scrolling of the main content list even when the cursor is over the sidebar. For example, on X (formerly Twitter), the feed remains scrollable even when the cursor is positioned over the side menu or trend view on the Home page, while the menu buttons and trend elements remain clickable. How can I implement this behavior?

I attempted to use pointer-events, but I couldn’t achieve both making the sidebar clickable and allowing the main content to remain scrollable when the cursor is over the sidebar.

No need to follow the following code. It’s just for an example. but I expect to use Flex or Grid CSS to make the layout.

body {
  margin: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.container {
  display: flex;
  width: 100%;
}

.sidebar {
  width: 250px;
  background-color: #f4f4f4;
}

.main-content {
  flex: 1;
  padding: 20px;
  background-color: #fff;
  overflow-y: auto;
}
<div class="container">
  <div class="sidebar">
    side bar (main content is not scrollable when cursor is over here).
  <button>button should be clickable</button>
  </div>
  <div class="main-content">
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
    <div>text</div>
  </div>
</div>

Unity WebGL build not getting location services

I built a WebGL application from Unity and added Javascript and C # code to get location services from the browser. However, when I start the application, it asks for permission, but the application is not able to receive it. The location service script is LoactionProviderFactory from mapbox SDK.

Javascript code:

var EXPORTED_FUNCTIONS = ['_requestWebGLLocation'];
mergeInto(LibraryManager.library, {
    requestWebGLLocation: function() {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(
                function(position) {
                    unityInstance.SendMessage('LocationProviderFactory', 'OnLocationReceived',
                        position.coords.latitude + ',' + position.coords.longitude);
                },
                function(error) {
                    console.error('Error obtaining location: ', error);
                }
            );
        } else {
            console.error('Geolocation is not supported by this browser.');
        }
    }
});

Location code:

#if !UNITY_EDITOR
#define NOT_UNITY_EDITOR
#endif

namespace Mapbox.Unity.Location
{
    using UnityEngine;
    using Mapbox.Unity.Map;
    using System.Text.RegularExpressions;
    using System.Runtime.InteropServices;
    using System.Collections;


    /// <summary>
    /// Singleton factory to allow easy access to various LocationProviders.
    /// This is meant to be attached to a game object.
    /// </summary>
    public class LocationProviderFactory : MonoBehaviour
    {
        [SerializeField]
        public AbstractMap mapManager;

        [SerializeField]
        [Tooltip("Provider using Unity's builtin 'Input.Location' service")]
        AbstractLocationProvider _deviceLocationProviderUnity;

        [SerializeField]
        [Tooltip("Custom native Android location provider. If this is not set above provider is used")]
        DeviceLocationProviderAndroidNative _deviceLocationProviderAndroid;

        [SerializeField]
        AbstractLocationProvider _editorLocationProvider;

        [SerializeField]
        AbstractLocationProvider _transformLocationProvider;

        [SerializeField]
        bool _dontDestroyOnLoad;

        [DllImport("__Internal")]
        private static extern void requestWebGLLocation();



        /// <summary>
        /// The singleton instance of this factory.
        /// </summary>
        private static LocationProviderFactory _instance;
        public static LocationProviderFactory Instance
        {
            get
            {
                return _instance;
            }

            private set
            {
                _instance = value;
            }
        }

        ILocationProvider _defaultLocationProvider;

        /// <summary>
        /// The default location provider. 
        /// Outside of the editor, this will be a <see cref="T:Mapbox.Unity.Location.DeviceLocationProvider"/>.
        /// In the Unity editor, this will be an <see cref="T:Mapbox.Unity.Location.EditorLocationProvider"/>
        /// </summary>
        /// <example>
        /// Fetch location to set a transform's position:
        /// <code>
        /// void Update()
        /// {
        ///     var locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider;
        ///     transform.position = Conversions.GeoToWorldPosition(locationProvider.Location,
        ///                                                         MapController.ReferenceTileRect.Center,
        ///                                                         MapController.WorldScaleFactor).ToVector3xz();
        /// }
        /// </code>
        /// </example>
        public ILocationProvider DefaultLocationProvider
        {
            get
            {
                return _defaultLocationProvider;
            }
            set
            {
                _defaultLocationProvider = value;
            }
        }

        /// <summary>
        /// Returns the serialized <see cref="T:Mapbox.Unity.Location.TransformLocationProvider"/>.
        /// </summary>
        public ILocationProvider TransformLocationProvider
        {
            get
            {
                return _transformLocationProvider;
            }
        }

        /// <summary>
        /// Returns the serialized <see cref="T:Mapbox.Unity.Location.EditorLocationProvider"/>.
        /// </summary>
        public ILocationProvider EditorLocationProvider
        {
            get
            {
                return _editorLocationProvider;
            }
        }

        /// <summary>
        /// Returns the serialized <see cref="T:Mapbox.Unity.Location.DeviceLocationProvider"/>
        /// </summary>
        public ILocationProvider DeviceLocationProvider
        {
            get
            {
                return _deviceLocationProviderUnity;
            }
        }

        /// <summary>
        /// Create singleton instance and inject the DefaultLocationProvider upon initialization of this component. 
        /// </summary>
        protected virtual void Awake()
        {
            if (Instance != null)
            {
                DestroyImmediate(gameObject);
                return;
            }
            Instance = this;

            if (_dontDestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
            }

            InjectEditorLocationProvider();
            InjectDeviceLocationProvider();
        }

        private void Start()
        {
            StartCoroutine(StartLocationService());
        }

        /// <summary>
        /// Injects the editor location provider.
        /// Depending on the platform, this method and calls to it will be stripped during compile.
        /// </summary>
        [System.Diagnostics.Conditional("UNITY_EDITOR")]
        void InjectEditorLocationProvider()
        {
            Debug.LogFormat("LocationProviderFactory: Injected EDITOR Location Provider - {0}", _editorLocationProvider.GetType());
            DefaultLocationProvider = _editorLocationProvider;
        }

        /// <summary>
        /// Injects the device location provider.
        /// Depending on the platform, this method and calls to it will be stripped during compile.
        /// </summary>
        [System.Diagnostics.Conditional("NOT_UNITY_EDITOR")]
        void InjectDeviceLocationProvider()
        {
            if (Application.platform == RuntimePlatform.WebGLPlayer)
            {
                Debug.Log("Using WebGL Geolocation.");
                requestWebGLLocation();
            }
            else
            {
                int AndroidApiVersion = 0;
                var regex = new Regex(@"(?<=API-)-?d+");
                Match match = regex.Match(SystemInfo.operatingSystem);
                if (match.Success) { int.TryParse(match.Groups[0].Value, out AndroidApiVersion); }
                Debug.LogFormat("{0} => API version: {1}", SystemInfo.operatingSystem, AndroidApiVersion);

                if (Application.platform == RuntimePlatform.Android && AndroidApiVersion >= 24)
                {
                    DefaultLocationProvider = _deviceLocationProviderAndroid;
                }
                else
                {
                    DefaultLocationProvider = _deviceLocationProviderUnity;
                }
            }
        }

        public void OnLocationReceived(string locationData)
        {
            string[] coordinates = locationData.Split(',');
            if (coordinates.Length == 2)
            {
                float latitude = float.Parse(coordinates[0]);
                float longitude = float.Parse(coordinates[1]);
                Debug.Log($"WebGL Location Received: Latitude: {latitude}, Longitude: {longitude}");
                // You can further process this location data as required
            }
        }

        IEnumerator StartLocationService()
        {
            if (!Input.location.isEnabledByUser)
            {
                Debug.LogError("Location services are not enabled.");
                yield break;
            }

            Input.location.Start();

            int maxWait = 20;
            while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
            {
                yield return new WaitForSeconds(1);
                maxWait--;
            }

            if (maxWait <= 0)
            {
                Debug.LogError("Timed out while initializing location services.");
                yield break;
            }

            if (Input.location.status == LocationServiceStatus.Failed)
            {
                Debug.LogError("Unable to determine device location.");
                yield break;
            }

            Debug.Log($"Location: {Input.location.lastData.latitude}, {Input.location.lastData.longitude}");
        }


    }
}

Editor Errors:

Location services are not enabled.
UnityEngine.Debug:LogError (object)
Mapbox.Unity.Location.LocationProviderFactory/<StartLocationService>d__26:MoveNext () (at Assets/Mapbox/Unity/Location/LocationProviderFactory.cs:210)
UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
Mapbox.Unity.Location.LocationProviderFactory:Start () (at Assets/Mapbox/Unity/Location/LocationProviderFactory.cs:149)

.

GUI Error: Invalid GUILayout state in  view. Verify that all layout Begin/End calls match
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Console Errors:

Location service updates are not enabled. Check LocationService.status before querying last location. NewMap.framework.js:10

.

NewMap.framework.js:10 NullReferenceException: Object reference not set to an instance of an object.

js-cookie returns null but headers return the set cookies, Why?

import Cookies from 'js-cookie';
//this returns null 
const authTokenFromCookies = Cookies.get('authToken');
console.log("AuthToken from cookies:", authTokenFromCookies);


// This returns the token set from the backend
const authToken = response.headers['authToken'];
console.log("AuthToken after login:", authToken);

js-cookie returns null but headers return the set cookies, Why?
What could be the cause?

FastAPI can not catch and validate parameters from Javascript

I send file and json with this format,

var formData = new FormData();
export_param = {"data":"test} // json data
formData.append('metadata',JSON.stringify(export_param));
var dataurl = imagePreviewRef.current.makeImageDataUrl();
var blobData = createBlob(dataurl);
formData.append("file",blobData);
axios.post(qs_url,formData,{headers: {'Content-Type': 'application/form-data'}}).then(res=>{

This means send the file as blob named file and send json data as metadata,

then I want to receive this in FastAPI

@app.exception_handler(RequestValidationError)
async def validation_exception_handler(request: Request, exc: RequestValidationError):
    exc_str = f'{exc}'.replace('n', ' ').replace('   ', ' ')
    logging.error(request, exc_str)
    content = {'status_code': 10422, 'message': exc_str, 'data': None}
    return JSONResponse(content=content, status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)

@app.post('/plan/myslace')
async def getcreatePlan(file: Annotated[bytes, File(default=None)],metadata:Annotated[str,Form(default="test")]):
    print(test_param)
    return {"myslace":"OK"}

it returns shows the error in console.

fastapi.exceptions.RequestValidationError: 2 validation errors for Request
query -> file
  field required (type=value_error.missing)
query -> metadata
  field required (type=value_error.missing)

So i e means it can not catch the parameter either file nor metadata

Where should I fix?

having difficulty in configuring my backend in nextjs

@here
Im having difficulty configuring my backend in next framework . can some one help me with the project structure

this is my current project structure

.
├── favicon.ico
├── globals.css
├── layout.js
├── login
│   └── page.jsx
├── page.js
└── pages
    └── api
        ├── db.js
        └── examples
            ├── controller.js
            ├── model.js
            └── routes.js

5 directories, 9 files

Need a modular structure which will be easy to maintain and readable

How to play one of several HTML Audio elements when there is more than one on a page

I have a playlist which feeds (via sql) the HTML audio tag. If I use the controls in the audio tag I can play each song separately. However, if I remove controls and add my own volume, fade, play buttons etc each button reacts to the first song in the list. I don’t know how to identify each separate audio tag in my javascript.

I tried my own control buttons but each set only affects the first song in my list.

The list of songs can be different every time the page is loaded as the user selects them from a different page so I cannot hard wire a unique id.

How to preserve MediaStream loudness in JavaScript AudioRecorder?

I am using the MediaRecorder API to record two media streams:

  1. The microphone input of the user, obtained the following way:
const stream = await navigator.mediaDevices.getUserMedia({
   audio: true
});
  1. An echo of the input, created the following way:
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
source = audioContext.createMediaStreamSource(stream);
   
delay = audioContext.createDelay(2);
delay.delayTime.value =  ms / 1000;
   
gain = audioContext.createGain();
gain.gain.value = parseFloat(1)
   
source.connect(delay); // delay is set elsewhere by the user
delay.connect(gain); // gain is set elsewhere by the user
gain.connect(audioContext.destination);
   
const outputStream = audioContext.createMediaStreamDestination();
delay.connect(outputStream); 

// ECHO STREAM OBJECT FOR MEDIA RECORDER
echoStream = outputStream.stream;

The echo itself works fine, delay and gain are applied as expected (less gain → echo is more quiet, and vice versa).

But when I record the streams with MediaRecorder, they all have the same loudness. I need to preserve the loudness of the echo exactly as the user hears it from their speakers. How can this be achieved? Is it even possible with the MediaRecorder API?

multiselect_to returns null even if the options are selected

I have implemented multiselect and able to select options on left side and move them to right side.

When i am trying to get the selected options in the javascript using var multiselect_toval=$(‘#multiselect_to’).val();, it is returning null even though the options are selected. any help will be appreciated.

JSP Code

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="ISO-8859-1">
<title> Dashboard</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="javascriptf/jquery.js"></script>
<script src="multiselect/jquery-1.11.2.min.js"></script>
<script src="multiselect/multiselect.min.js"></script>
  
<script>

    function updateLabel() {
        var aap_dropDownval=$("#aap_dropDown").val();
        var flag_dropDown=$("#flag_dropDown").val();
        var run_dropDown=$("#run_dropDown").val();
        var optiondropDown=$("#optiondropDown").val();
        
                **var multiselect_toval=$('#multiselect_to').val();
        
        alert("multi: "+multiselect_toval);**
        
        $.ajax({
          url: "ReportGenerator",
          type: "POST",
          data:{aapnval:aap_dropDownval,flagval:flag_dropDown,runval:run_dropDown,optionval:optiondropDown,multiselectval:multiselect_toval},
          success: function(data) {
            // Update the label with the received data
            $("#errorlbl").text(data);
          }
        });
      }


    function getOption() {
        selectElement = 
              document.querySelector('#optiondropDown');
        output = selectElement.value;
        if(output=="Full List")
        {               
            document.getElementById('multiselectdiv').style.visibility = 'visible';
        }
        else{
            
            document.getElementById('multiselectdiv').style.visibility = 'hidden';
        }
    }
    
    jQuery(document).ready(function($) {
        $('#multiselect').multiselect();
        
    });
</script>
</head>
<body class="mb-2 bg-info-subtle text-info-emphasis d-grid gap-3">
            <nav class="navbar navbar-light bg-light">
                <a class="navbar-brand" href="#" >
                  <img src="images/NovartisLogo.jpg" alt="" width="100%" height="50" >
                </a>
                 <span class="display-6" style="width: 80%" >NRV Flagging Status Dashboard</span>
            </nav>
            
            <div class="container text-center">
              <div class="row mb-5">
                <div class="col">
                        <select class="btn btn-info dropdown-toggle" id="aap_dropDown">
                            <option class="btn btn-light">Application Name</option>
                            <option class="btn btn-light">App1</option>
                            <option class="btn btn-light">App2</option>
                        </select> 
                </div>
                <div class="col">
                       <select class="btn btn-info dropdown-toggle" id="flag_dropDown">
                            <option class="btn btn-light">Flag</option>
                            <option class="btn btn-light">M1</option>
                            <option class="btn btn-light">M2</option>
                            <option class="btn btn-light">M3</option>
                        </select> 
                </div>
                <div class="col">
                         <select class="btn btn-info dropdown-toggle" id="run_dropDown">
                            <option class="btn btn-light">Run</option>
                            <option class="btn btn-light">Run1</option>
                         </select>
                </div>
                <div class="col">
                       <select class="btn btn-info dropdown-toggle" name="optionName" id="optiondropDown" onchange="getOption()">
                            <option class="btn btn-light">Option</option>
                            <option class="btn btn-light">Summary</option>
                            <option class="btn btn-light">Full List</option>
                         </select>
                </div>
              </div>
            </div>
            <div class="row d-flex justify-content-center" id="multiselectdiv" onblur="updateUI()" style="visibility:hidden">
                
              <div class="col-md-auto" >
                <select name="from[]"  id="multiselect" class="form-control" size="5" multiple="multiple" style="border: 1px solid black">
                  <option>app_name</option>
                  <option>idname</option>
                  <option>business_name</option>
                  <option>current_flag</option>
                  <option>old_flag</option>
                  <option>run</option>
                  <option>path</option>
                </select>
              </div>
            
              <div class="col-md-auto d-grid gap-1">
                <button type="button" id="multiselect_rightAll" class="col-md-auto" style="border: 1px solid black;">>></button>
                <button type="button" id="multiselect_rightSelected" class="col-md-auto" style="border: 1px solid black;">></button>
                <button type="button" id="multiselect_leftSelected" class="col-md-auto" style="border: 1px solid black;"><</button>
                <button type="button" id="multiselect_leftAll" class="col-md-auto" style="border: 1px solid black;"><<</button>
              </div>
            
              <div class="col-md-auto">
                <select name="to[]" id="multiselect_to" class="form-control" size="5" multiple="multiple" style="border: 1px solid black"></select>
              </div>
            </div>
            
             <div class="d-flex justify-content-center">
                    <button type="submit" class="btn btn-success" onclick="updateLabel()">Submit</button>
             </div>
             
             <div class="d-flex justify-content-center" id="labelContainer">
                 <%-- <label id="errorlbl" class="text-danger" style="font-weight:bold;" ><%=errlbl%></label> --%>
                 <label id="errorlbl" class="text-danger" style="font-weight:bold;" ></label>
            </div>
</body>
</

html>

Is there a way I can connect whatsapp to Salesforce?

We use salesforce as a primary CRM tool in our company in which all the people across the globe need to enter data regularly.
But they don’t.

I was thinking of a solution that could be as easy as messaging a friend.

So is there a way a WhatsApp chatbot can be created in such a way that it fetches information from salesforce?

How it would work is-
One would simply be able to open whatsapp, go into the chatbot’s window, enter a template sentence (For eg. “Fetch accounts of xyz”) and the chatbot would return the results. Then the person would be able to add update to a particular account (For eg. “Update account abc ‘Met with client.'”) and it automatically updates in SF.

So I was thinking of the following-

  1. A web app can be created that is hosted on the local server of my company
  2. The web app fetches and updates SF using an API.
  3. ⁠The Whatsapp bot is basically for CRUD into the web app.
    (The web app is the medium between the salesforce API and the WhatsApp bot)

Is what I am imagining above plausible?

Cypress config option “testIsolation: false” is not working on Describe level saying argument type is not assignable to parameter type

I am trying to add config option “testIsolation: false” on describe level, but it is not recognized.

describe("Test 1",{ testIsolation: false}, () => { }

Reason:
Argument type { testIsolation: boolean } is not assignable to parameter type Cypress.SuiteConfigOverrides

The other available options are recognized as expected but baseUrl and testIsolation are not.

  interface SuiteConfigOverrides extends Partial<
    Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations'>
  >, Partial<Pick<ResolvedConfigOptions, 'baseUrl' | 'testIsolation'>> {
    browser?: IsBrowserMatcher | IsBrowserMatcher[]
    keystrokeDelay?: number
  }

enter image description here

I am using Cypress with JavaScript. Version 13.3.1, but I tried with the latest and it is not working as well.

Pinch and zoom combined with dragging with mouse and touch screen

I’m trying to create the ability, on a touchscreen monitor, to be able to zoom in to a part of an image and be able to drag it around and zoom out from the point the drag ended.

I’m using the GSAP library for the drag and zoom along with Hammer JS to aid in using touch screen.

From the basic codepen I created I have got it working. However if I zoom in then drag to the opposite end of the image, when I zoom out the image will not scale from where my mouse is. I think it has something to do with the transform-origin and translate3D() clashing as if I zoom in and out on the same spot it is perfect.

Am I being really dumb and missing something incredibly obvious or is it something else?

Appreciate any help and/or suggestions given.

https://codepen.io/wescritch98/pen/wBwmvmm

<img src="https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg?t=st=1736502806~exp=1736506406~hmac=55191bc567a6b56fa91081c238a86595d5a85ff785179070a8deb52b1ba05041&w=1380" class="zoom-item">
body {
  display: flex;
  justify-content: center;
  align-ites: center;
  overflow: hidden;
}

.box {
  width: 300px;
  height: 300px;
  background: red;
}
let image = document.querySelector(".zoom-item"),
  hammer = new Hammer(image),
  mousePosArr = [],
  pinchPosArr = [];

hammer.get("pinch").set({
  enable: true
});

hammer.on("pinchstart", (e) => {
  let pinchX = e.srcEvent.offsetX,
    pinchY = e.srcEvent.offsetY;

  pinchPosArr.push(pinchX, pinchY);

  zoomDrag[0].disable();
});

hammer.on("pinch", (e) => {
  console.log(pinchPosArr);

  let roundedX = Math.ceil(pinchPosArr[0]),
    roundedY = Math.ceil(pinchPosArr[1]);

  switch (e.additionalEvent) {
    case "pinchout":
      //round the numbers to nearest whole one
      zoom_control("+=0.03", roundedX, roundedY);
      break;
    case "pinchin":
      if (gsap.getProperty(e.target, "scale") >= 1.2) {
        zoom_control("-=0.03", roundedX, roundedY);
      }
      break;
  }
});

hammer.on("pinchend", () => {
  pinchPosArr = [];
  zoomDrag[0].enable();
});

let zoomObserver = Observer.create({
    target: ".zoom-item",
    type: "wheel", // Will only fire on the wheel scroll
    ease: "linear", // makes the animations more slower
    wheelSpeed: 0.1, // Changed how fast the zoom in happens
    onUp: (self) => {
      mousePosArr = [];
      let mouseX = self.event.offsetX,
        mouseY = self.event.offsetY;

      mousePosArr.push(mouseX, mouseY);
      // Creates an array and pushes each instance of mouseX and mouseY into the array

      const [posA, posB] = mousePosArr.slice(-2); // slice() helps me grab the last two added items into the array

      //using the posA and posB means that it zoom into wherever my mouse currently is
      console.log(image.style.scale);
      zoom_control("+=0.3", posA, posB);
    },
    onDown: (self) => {
      // Will only fire if the scale is above the 1.2
      if (gsap.getProperty(self.target, "scale") >= 1.2) {
        zoom_control("-=0.3", mousePosArr[0], mousePosArr[1]);
      }
    }
  }),
  zoomDrag = Draggable.create(".zoom-item", {
    zIndexBoost: false, // zIndexBoost set to false to stop it creasing on each click
    onDrag: () => {
      zoomObserver.disable();
    },
    onDragEnd: () => {
      zoomObserver.enable();
    }
  });

function zoom_control(scaleNum, transformX, transformY) {
  gsap.set(image, {
    transformOrigin: `${transformX}px ${transformY}px`
  });
  let scaleSetter = gsap.quickSetter(image, "css");
  scaleSetter({
    scale: scaleNum
  });
}

NestJS annotations not covered by unit tests?

I’m trying to increase the code coverage of my NestJS API, but I’m coming up against an issue where my coverage report is stating that my Nest annotations aren’t being covered at all.

enter image description here

I’ve covered what I believe to be all of the main parts of the model, but I’m not sure how (or even if) these annotations can be covered?

import { MyModel } from './my.model';

describe('my.model', () => {
  let myModel: MyModel;

  beforeEach(() => {
    myModel = new MyModel();
  });

  it('should be defined', () => {
    expect(myModel).toBeDefined();
    expect(myModel).toBeInstanceOf(myModel);
  });

  it('should have undefined values when not set', () => {
    expect(myModel.prop1).toBeUndefined();
    expect(myModel.prop2).toBeUndefined();
    expect(myModel.prop3).toBeUndefined();
  })

  it('should have a prop1 field', () => {
    myModel.prop1 = 'Y';
    expect(myModel.prop1).toBe('Y');
  });

  it('should have a prop2 field', () => {
    myModel.prop2 = '123';
    expect(myModel.prop2).toBe('123');
  });

  it('should have an optional prop3 field', () => {
    myModel.prop3 = '456';
    expect(myModel.prop3).toBe('456');
  });
});

Docker – How to Apply Custom Modifications to the codebase

I am using an open-source, self-hosted version of cal.com, deployed with Docker and docker-compose on a server.

Request:

How can I overcome the yarn build timeout issue or find an efficient way to build the application so that my code modifications are applied correctly? I would ideally like to not use yarn build at all.

I’ve created a custom Dockerfile to incorporate some additional changes to the codebase, such as modifying the welcome message. However, I’m encountering an issue during the build process:

  • When I include the yarn build command in the Dockerfile, the build process takes over 40 minutes and eventually times out during the @calcom/web#build step.
  • Without the yarn build command, the Docker image builds quickly, and I can see that the code changes exist inside the Docker container. However, the modifications are not reflected in the running application.

Problem:

I believe the yarn build step is necessary to compile the application with my code modifications, but it’s timing out and not completing successfully.

Question:

Is there an alternative way to apply these code changes without running into the yarn build timeout issue? How can I efficiently build the application with my modifications in a self-hosted production environment?

Any help or suggestions would be greatly appreciated.

Here is my Dockerfile:

ARG SOFTWARE_VERSION_TAG=latest
FROM calcom/cal.com:${SOFTWARE_VERSION_TAG}

RUN apt-get update && 
    apt-get install -y python3 python3-pip && 
    rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir --break-system-packages cyrtranslit

COPY ./patch.sh /calcom/
COPY ./convert.py /calcom/
COPY ./icons /calcom/app/web/public

# Applying custom changes to the code, like a different welcome message
RUN chmod +x /calcom/patch.sh
RUN chmod +x /calcom/convert.py

RUN /calcom/patch.sh

WORKDIR /calcom

ARG NEXT_PUBLIC_LICENSE_CONSENT
ARG CALCOM_TELEMETRY_DISABLED
ARG DATABASE_URL
ARG NEXTAUTH_SECRET=secret
ARG CALENDSO_ENCRYPTION_KEY=secret
ARG MAX_OLD_SPACE_SIZE=4096
ARG NEXT_PUBLIC_API_V2_URL

ENV NEXT_PUBLIC_WEBAPP_URL=http://NEXT_PUBLIC_WEBAPP_URL_PLACEHOLDER 
    NEXT_PUBLIC_API_V2_URL=$NEXT_PUBLIC_API_V2_URL 
    NEXT_PUBLIC_LICENSE_CONSENT=$NEXT_PUBLIC_LICENSE_CONSENT 
    CALCOM_TELEMETRY_DISABLED=$CALCOM_TELEMETRY_DISABLED 
    DATABASE_URL=$DATABASE_URL 
    DATABASE_DIRECT_URL=$DATABASE_URL 
    NEXTAUTH_SECRET=${NEXTAUTH_SECRET} 
    CALENDSO_ENCRYPTION_KEY=${CALENDSO_ENCRYPTION_KEY} 
    NODE_OPTIONS=--max-old-space-size=${MAX_OLD_SPACE_SIZE} 
    BUILD_STANDALONE=true

RUN yarn config set httpTimeout 120000000

# This step times out after 40 minutes during the @calcom/web#build
RUN yarn build

And here is my docker-compose.yml:

services:
  database:
    container_name: database
    image: elestio/postgres:16
    restart: always
    volumes:
      - ./pgdata:/var/lib/postgresql/data/
    env_file: .env
    ports:
      - 172.17.0.1:5432:5432

  calcom:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        SOFTWARE_VERSION_TAG: ${SOFTWARE_VERSION_TAG}
    restart: always
    ports:
      - 172.17.0.1:6424:3000
    env_file: .env
    environment:
      - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
      - DATABASE_DIRECT_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DATABASE_HOST}/${POSTGRES_DB}
    depends_on:
      - database

  pgadmin4:
    image: elestio/pgadmin:latest
    restart: always
    environment:
      PGADMIN_DEFAULT_EMAIL: ${ADMIN_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${ADMIN_PASSWORD}
      PGADMIN_LISTEN_PORT: 8080
    ports:
      - "172.17.0.1:8080:8080"
    volumes:
      - ./servers.json:/pgadmin4/servers.json

Additional Information:

  • Without the yarn build step, the build completes immediately, but the modifications are not effective in the running application.
  • Including yarn build causes the build to take too long and ultimately times out.

References: