How can I find a reliable debt collection lawyer near me?

To find a reliable debt collection lawyer near you, start by searching online for local attorneys who specialize in debt recovery. Look for firms with strong reviews, proven success in handling similar cases, and experience with both creditors and debtors. Many lawyers offer free consultations, which can help you understand your legal options and fees before committing. You can also check local bar association directories or ask for referrals from business associates or friends.

Inspect shows Charset Encoding of ISO even when i have mentioned UTF-8 in all files

When i open the menu of my web application, i use inspect > network tab and see that pdamnu.do file has charset encoding of ISO.
Now in my pdamnu.jsp i have mentioned the encoding of utf-8

<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file = "/common/Include.jsp" %>
<%@ page import="bancmate.common.web.SessionHandler"%>
<%@ page import="java.util.*"%>
<%StringBuilder cssMenu = null ;%>
<%
String broadCast = null ; 
     if(session.getAttribute("BroadCast")!=null){
      broadCast = (String)session.getAttribute("BroadCast") ;
      broadCast = broadCast + "n";
      System.out.println("------------>>>>>>>>>>>>>>>>>>  "+broadCast);
     }
%>
    
<script>
    var cssMenujs="";
       var menu=sessionStorage.getItem('cssMenuLocal') || false;
       console.log("session storage get n"+menu);
       if(menu){
           <%
           cssMenu=new StringBuilder("<script>document.writeln(menu);</script>");
         System.out.print("if ok n"+cssMenu);
         %>
         console.log("session storage get menu set");
       }else{
           
        var url="<%=request.getContextPath()%>/menu/Pdamnu.do";
        var xhttp = new XMLHttpRequest();
            
        xhttp.onreadystatechange = function() {
                if (this.readyState == 4 && this.status == 200) {
                            console.log("In response");
                            cssMenujs = xhttp.responseText;
                            console.log("1");
                            cssMenujs = eval("cssMenujs");
                            console.log("2");
                                if(cssMenujs!=null)
                                {
                                    sessionStorage.setItem('cssMenuLocal',cssMenujs);
                                    console.log("session storage set n"+cssMenujs);
                                    <%
                                        cssMenu=new StringBuilder("<script>document.writeln(cssMenujs);</script>");
                                        System.out.print("n else ok n"+cssMenu);
                                    %>
                                }
                        }
                
        };
        xhttp.open("POST",url,false);
            xhttp.send();
    }
    if(cssMenujs=="" || !cssMenujs)
    {
        cssMenujs=eval("menu");
    }
</script>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        
         <!-- All CSS links -->

            <link rel = "stylesheet" href="<%=request.getContextPath()%>/jsp/css/style.css"  type = "text/css">
            <link rel="stylesheet" href="<%=request.getContextPath()%>/jsp/css/style-2.css" type="text/css"/>

            <!-- SmartMenus core CSS (required) -->
            <link href="<%=request.getContextPath()%>/jsp/css/sm-core-css.css" rel="stylesheet" type="text/css" />

            <!-- "sm-blue" menu theme -->
            <link href="<%=request.getContextPath()%>/jsp/css/sm-blue.css" rel="stylesheet" type="text/css" />

            <!--Css for slider-->
            <link href="<%=request.getContextPath()%>/jsp/css/js-image-slider.css" rel="stylesheet" type="text/css" />

        <!-- End of CSS links -->


        <!-- All jQueries links -->

            <!-- <script language=JavaScript src = "<%=request.getContextPath()%>/jsp/js/jquery-1.3.1.min.js" ></script>
            <script language=JavaScript src = "<%=request.getContextPath()%>/jsp/js/jquery1.js"></script>
            <script language=JavaScript src="<%=request.getContextPath()%>/jsp/js/jquery.dropdownPlain.js"></script> -->

            <script language=JavaScript src = "<%=request.getContextPath()%>/jsp/js/hammer.js"></script>
        
            <!-- jQuery -->
            <script type="text/javascript" src="<%=request.getContextPath()%>/jsp/js/jquery.js"></script>

            <!-- SmartMenus jQuery plugin -->
            <script type="text/javascript" src="<%=request.getContextPath()%>/jsp/js/jquery.smartmenus.js"></script>

            <!-- SmartMenus jQuery Keyboard Addon -->
            <script type="text/javascript" src="<%=request.getContextPath()%>/jsp/js/jquery.smartmenus.keyboard.js"></script>

            <!--JS for slider-->
            <script src="<%=request.getContextPath()%>/jsp/js/js-image-slider.js" type="text/javascript"></script>
 
        <!-- End of JQueries links -->
        <style>
        #main-menu>li>ul{display:block!important;
        width:100%;}
        </style>

<script>
    var outIn = 'in';
    
    $(document).ready(function(e) {
    
    var startX, curX, startY, curY; // Variables
    var newXScroll, newYScroll, genXScroll; // More Variables!
    
    // Change the height of the sidebar, as well as a few things to do with the main content area, so the user
    // can actually scroll in the content area.
    function sideBarHeight() { 
    
        var docHeight = $(document).height();
        var winHeight = $(window).height();
        
        $('.slide-in').height(winHeight);
        $('#main-container').height(winHeight);
        $('#sub-container').height($('#sub-container').height());
    } 
    
    sideBarHeight();
    
    var outIn = 'in';
    
    Hammer(document.getElementById('main-container')).on('swiperight', function(e) {
            //$('.slide-in').toggleClass('on');     
            //$('#main-container').toggleClass('on');
            //outIn = 'out';
            
    });
    
    Hammer(document.getElementById('main-container')).on('swipeleft', function(e) {
            $('.slide-in').toggleClass('on');   
            $('#main-container').toggleClass('on');
            outIn = 'in';
    });
    
    
    function runAnimation() {
        if(outIn == 'out') {
            document.getElementById("main-menu").style.display="block";
            $('.slide-in').toggleClass('on');
            $('#main-container').toggleClass('on'); 
            outIn = 'in';
            
        } else if(outIn == 'in') {
        
            $('.slide-in').toggleClass('on');   
            $('#main-container').toggleClass('on'); 
            outIn = 'out';
            
        }
    
    }
    
    $('.menu-icon')[0].addEventListener('touchend', function(e) {

        $('.slide-in').toggleClass('on');       
        $('#main-container').toggleClass('on');
    });
    
    $('.menu-icon').click(function() {      
        //$('.slide-in').toggleClass('on');     
        //$('#main-container').toggleClass('on');
    });
    
    

    });



</script>

        <!-- SmartMenus jQuery init -->
            <script type="text/javascript">
                $(function() {
                $('#main-menu').smartmenus({
                subMenusSubOffsetX: 1,
                subMenusSubOffsetY: -8
            });
                
                        
            $('#main-menu').smartmenus('keyboardSetHotkey', '123', 'shiftKey');
            });
            </script>


        

    
        <!-- #main-menu config - instance specific stuff not covered in the theme -->
        <style type="text/css">
        /*@media screen and (min-width: 768px) {
        #main-menu {
            position:relative;
            z-index:9999;
            width:230px;
            margin-top:0px;
            display:block;
            
        }*/
        /*#main-menu ul {
            width:12em; /* fixed width only please - you can use the "subMenusMinWidth"/"subMenusMaxWidth" script options to override this if you like */
        }
    }
</style>
        <script type="text/javascript">
        function formopen(menunext) {
                var url = "/BancMate/servlet/bancmate.common.menu.servlet.PdaMenuServlet?mnunext="+ menunext+"&Opentype=F&index=0&connectFrm=M&newMenu=Y" ;
                document.forms[0].action=""+url;
                document.forms[0].method="post";
                document.forms[0].submit();
                return ;
            }

    function callmenu() {
 $('.slide-in').toggleClass("on");
     $('#main-container').toggleClass("on");
     count = 1;
    }
    var count;
function check(){
//  debugger;
    if(count==1){
//  $('.slide-in').toggleClass("on");
    }
    if(document.getElementById("main-menu").style.display=="block" )
    {
    //  document.getElementById("main-menu").style.display="none";
//  if(document.getElementById("sm-15865158296919065-1")==true){
//      document.getElementById("main-menu").style.display="none";
//      document.getElementById("menuDiv").style.display="none";
//  }
        document.getElementById("right").src="<%=request.getContextPath()%>/jsp/images/right.jpg";
    //  document.getElementById("menuDiv").style.display="none";    
        count =2;
    }
    else 
    {
        document.getElementById("main-menu").style.display="block";
        document.getElementById("right").src="<%=request.getContextPath()%>/jsp/images/left1.jpg";
        document.getElementById("menuDiv").style.display="block";
        count =2;
    }

}
</script>

</head>
    <body style="width:1200px;height:200px;overflow-y:hidden;" onload="callmenu()">
        <form>
        
            <div>
                        
              <div id="main-container" class="tk-chaparral-pro">

             
              </div>
            
              <div class="menu-icon" onclick="check()" title="Main-Menu">
               <a href="#" tabindex="1" id="imglnk"><img
                 src="<%=request.getContextPath()%>/jsp/images/right.jpg" id="right"
                 style="width: 10%; height: 10%;" role="button"></a>        
               </div> 
               
              <div id="menuDiv" class="slide-in" style="display:block;height:100%;" onclick="check()" title="Main-Menu" >
            <div id="menuHtmlContent"></div>

<script>
  var menu = sessionStorage.getItem('cssMenuLocal');
  if (menu) {
    document.getElementById("menuHtmlContent").innerHTML = menu;
  } else {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
      if (this.readyState == 4 && this.status == 200) {
        var menuHTML = this.responseText;
        sessionStorage.setItem('cssMenuLocal', menuHTML);
        document.getElementById("menuHtmlContent").innerHTML = menuHTML;
      }
    };
    xhttp.open("POST", "<%=request.getContextPath()%>/menu/Pdamnu.do", true);
    xhttp.send();
  }
</script>

              </div>
            
             <div style=" border: 5px solid #495566; width: 35%; height: 200px; margin-top: 10%; margin-left: 40%;border-radius:10px;">
               <center>
               <B><h2 style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;color:blue;">Message</h2></B>
               <!--<input type="button" value="check" name="check" onclick="pdamenu()"/>-->
               <MARQUEE  behavior="alternate" style="margin-top:18%;" SCROLLDELAY=150>
               <%if(broadCast!=null){%>
               <B><%= broadCast %></B>
               <%}%>
               </MARQUEE>
               </center>
               </div>
               
               
               
              </div>
             
        </form>
</body>
</html>

and then in include.jsp as well it has utf-8 encoding.
In the doFilter also i have added the utf-8 encoding:

public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/html; charset=UTF-8");
        BMLogger logger = new BMLogger(BMIbFilter.class);
        HttpServletRequest httpRequest = (HttpServletRequest)request;
        logger.info("Filter Called for : " + httpRequest.getRequestURI());
        logger.info("Session Value is : " + httpRequest.getSession(false));

I have two folders, one is war which has frontend files and jar which has backend files and backend is in eclipse which also has default encoding of utf-8 and front end which is in vscode also have default utf-8.
i was trying to display hindi language but it shows question marks instead of hindi. and that is when i inspected and saw the encoding of iso in network tab.
some of the other pages show hindi perfectly and they also have utf-8 encoding in the network tab. except the menu (pdamnu.do) which shows the iso encoding in inspect network tab.

I have tried the page encoding in the jsp file. and i also added the response.setContent in filter to utf-8
In another file in MenuPdaAction i have added response.setContent like this:

if((mySession.getAttribute("cssMenu")==null)||(mySession.getAttribute("cssMenu").equals("")))
                {
                    System.out.println("New Menu Creating");
                    cssMenu = menuRemote.getCSSMenuTree(suserid, sustid, "  ", lang.intValue(), loginParameter);
                    response.setContentType("text/html; charset=UTF-8");
                    response.setCharacterEncoding("UTF-8");
                    mySession.setAttribute("cssMenu",cssMenu);
                    mySession.setAttribute("nextlvl",null);
                }
                else
                {
                        System.out.println("Existing menu get");
                        cssMenu=(StringBuilder)mySession.getAttribute("cssMenu");
                }
                 target = "success";
                 PrintWriter out = response.getWriter();
                 sCssMenu = cssMenu.toString().replace("'","&quot;");
            //      out.write(sCssMenu);  
                    out.print(sCssMenu);
                    out.flush();
                    return null;
                //  out.close();
             }

i tried removing replace() if it was messing with encoding but no results. Also my database written content of hindi seems to be in utf-16. i tried changing jsp and java files to utf-16 but no results. i cant change database content to utf-8.

IllegalViewOperationException – Trying to update non-existent view with tag during rapid D-pad input

I’m encountering a fatal crash on Android TV in a React Native app when rapidly navigating using the D-pad (Up, Down, Left, Right, OK, Back). The app occasionally throws the following exception:

Fatal Exception: com.facebook.react.uimanager.IllegalViewOperationException: Trying to update non-existent view with tag 6445
at com.facebook.react.uimanager.UIImplementation.updateView(UIImplementation.java:287)
at com.facebook.react.uimanager.UIManagerModule.updateView(UIManagerModule.java:505)
at com.facebook.react.uimanager.ReanimatedUIManager.updateView(ReanimatedUIManager.java:77)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)

Environment
[email protected]
[email protected]
Device: Android TV (Android 11)

What I’ve Observed:

  1. Crash only occurs under specific, high-stress input conditions.
  2. Triggered by very fast D-pad input causing rapid focus changes across a complex UI.
  3. Low reproduction rate, but occurs consistently when stress tested.
  4. No crash during normal app usage (30+ mins) or idle playback (6–7 hrs).

Has anyone encountered this issue with react-native-tvos and react-native-reanimated on Android TV?

Are there any known workarounds or suggestions to avoid this crash?

Any help would be greatly appreciated!

Trying to create a new user in google firestore with react and I get a 400 error

I am creating for the first time a new user registration and using firestore auth

this is the signup part of the code

const signup = async (
  email,
  password,
  firstName,
  lastName,
  groupName = 'default',
  userProfile = {},
) => {
  try {
    console.log('Attempting signup for:', email);
    setAuthError(null);

    const result = await createUserWithEmailAndPassword(auth, email, password);
    const user = result.user;
    console.log('User created successfully:', user.uid);

    const userData = {
      uid: user.uid,
      email: user.email,
      firstName: String(firstName || ''),
      lastName: String(lastName || ''),
      groups: [groupName],
      createdAt: serverTimestamp(),
      profileComplete: !!(firstName && lastName),
    };

    console.log('About to write to Firestore...');
    console.log('User data:', JSON.stringify(userData, null, 2));
    console.log('Database instance:', db);
    console.log('Document path:', `users/${user.uid}`);

    try {
      await setDoc(doc(db, 'users', user.uid), userData);
      console.log('Firestore write successful!');
    } catch (firestoreError) {
      console.error('Firestore write failed:');
      console.error('Error code:', firestoreError.code);
      console.error('Error message:', firestoreError.message);
      console.error('Full error:', firestoreError);

      // Check if it's a permissions issue
      if (firestoreError.code === 'permission-denied') {
        console.error(
          'This is a permissions issue - check your Firestore rules',
        );
      }

      throw firestoreError;
    }

    setUserGroups([groupName]);
    console.log('Signup completed successfully');
    return result;
  } catch (error) {
    console.error('Signup error:');
    console.error('Error type:', error.constructor.name);
    console.error('Error code:', error.code);
    console.error('Error message:', error.message);
    console.error('Full error object:', error);

    setAuthError(error.message);
    throw error;
  }
};

The call to createUserWithEmailAndPassword works and I have a valid user

createUserWithEmailAndPassword(auth, email, password);
    const user = result.user;

This is from the dev console

AuthContext.jsx:147 User created successfully: newUID
AuthContext.jsx:159 About to write to Firestore...
AuthContext.jsx:160 User data: {
   "uid": "newUID",
   "email": "[email protected]",
   "firstName": "Randy",
   "lastName": "Paries",
   "groups": [
       "default"
    ],
   "createdAt": {
       "_methodName": "serverTimestamp"
   },
"profileComplete": true
}
AuthContext.jsx:161 Database instance: Firestore {_authCredentials: 
  __PRIVATE_FirebaseAuthCredentialsProvider, _appCheckCredentials: 
  __PRIVATE_FirebaseAppCheckTokenProvider, _databaseId: _DatabaseId, _app: 
   FirebaseAppImpl, type: 'firestore', …}
AuthContext.jsx:162 Document path: users/newUID
AuthContext.jsx:165

GET https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel? 
net::ERR_ABORTED 400 (Bad Request)

In my database rules I have

rules_version = '2';
service cloud.firestore {
   match /databases/{database}/documents {
      match /{document=**} {
         allow read, write: if true; // ONLY FOR TESTING!
      }
   }
}

I do not know what to look at next… Nothing seems to work or change the error . I always get a 400.

Thanks for anyhelp

my web app shows this error: meta tag you specified is not allowed

I am following a web app series on Youtube and faced the following issue. Actually it was working well a few days ago but now the page shows the following error. I am using google app script and google sheet. I need load data from sheet to the website and if any changes happened about the data on the website it needs to update that in the database(google sheet).

Error: Exception: The meta tag you specified is not allowed in this context. (line 2, file "Code")

Here is my code which the error comes from:

function doGet() {
  const htmlService = HtmlService.createTemplateFromFile("main").evaluate().addMetaTag("viewport", "width=device-width, initial-scale=1.0")
  return htmlService
}

Is there anyone who can help me?

I am trying to load/open the web page but it shows error.

Tracking Website Visits Through Social Media Native Browsers

I am working on an application that allows other businesses to track which social media sites are driving traffic to their website. I was originally planning on doing this by having the user setup a script in the header of their website that sends the following information [social media source url, bubble user id]. Then this information would be captured by an api and each visit would be stored in a database that can then be used to create dashboards.

The problem that I am having is that this works completely fine on the desktop version of social media sites however it doesn’t seem to be sending information to my api when the link is opened from native social media apps (which would defeat the purpose of this entire project tbh).

Im not sure if this is because when social media sites like Twitter or Instagram open up a website in their native browsers it blocks some functionality. But I am really stumped on this one and pretty disappointed considering I felt I had a solid idea in place finally.

Please let me know if you can think of any work arounds or ways in which this could work here is the script that I am currently using that works anywhere but in a social media native browser:

<script>
(function() {
  function getUTMParam(name) {
    var url = new URL(window.location.href);
    return url.searchParams.get(name);
  }

  var utm_source = getUTMParam('utm_source');
  var referrer = document.referrer;
  var hostname = window.location.hostname;

  function isExternalReferrer(referrer, hostname) {
    try {
      var refHost = new URL(referrer).hostname;
      return refHost && refHost !== hostname;
    } catch (e) {
      return false;
    }
  }

  if (utm_source || isExternalReferrer(referrer, hostname)) {
    var payload = {
      organization_id: 'INSERTORGID',
      source: utm_source || referrer,
      url: window.location.href
    };

  fetch('https://INSERTAPIURL', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(payload)
    });
  }
})();
</script>

CORS 404 error on localhost:4400 storybook

I have a call to https://wwwstage.companyx.com/graphql/one , which is resulting into 500 CORS Error. I enabled cors plugin , but did not help.

Later I added below to vite.config.ts to have proxy set up.

server: { proxy: { '/graphql': { target: 'https://wwwstage.companyx.com', changeOrigin: true, secure: false, rewrite: (path) => path.replace(/^/graphql/, '/graphql'), }, }, }

Then I am getting 404 errors. requesting end point api call at localhost:4400.
Could any front end gurus provide insights on how to get around this.

Thanks,
Sri

JS STOMP client wont connect

I am trying to connect to a STOMP “server” and have initialised a connection, however my code gets stuck at STOMP: Opening Web Socket for about 5 minutes, then finally says the connection failed. I have successfully attempted a connection with python (my main language) however my friend wanted a connection added to his website so I thought with my very small amount of experience I would give it a try. I believe the brokerURL is correct, as earlier it was instantly failing the connection whereas now it fails after 5 mins.

I feel like this is just my lack of JS experience as like I said, I have successfully connected with a python client before now so.

As im not exactly sure whats going wrong here, any ideas as to whats going wrong will be greatly appreciated

Here is my code to connect:

let stompClient;

    const stompConfig = {
      brokerURL: "ws://xxx.xx.xx.xxx:port",
      
      // Keep it off for production, it can be quit verbose
      // Skip this key to disable
      debug: function (str) {
        console.log('STOMP: ' + str);
      },

      // If disconnected, it will retry after 200ms
      reconnectDelay: 200,

      // Subscriptions should be done inside onConnect as those need to reinstated when the broker reconnects
      onConnect: function (frame) {
        // The return object has a method called `unsubscribe`
        const subscription = stompClient.subscribe('/topic/TD_ALL_SIG_AREA', function (message) {
          const payload = JSON.parse(message.body);
          console.log(payload)
        })
        
        console.log("Connected to Simsig!")
        stompClient.publish({destination: '/topic/TD_ALL_SIG_AREA', body: "{snapshot:{}}"});
      }
    }
    
    // Create an instance
    stompClient = new StompJs.Client(stompConfig);

    // You can set additional configuration options here

    // Attempt to connect
    stompClient.activate();

Javascript – Some conditions not working on mobile

I’m looping through some data that I’m getting from an API call. Everything works as expected on desktop, but it seems the if conditions are being ignored on mobile (Safari and Chrome). At first I thought it was just the Unix calculation, but a string comparison also isn’t working and I’m not sure why. The only one that works consistently across devices is the year < currentYear comparison.

I tried changing all the lets to vars, but it didn’t make any difference, and to make it more confusing, there’s a Swedish localization that displays 1 less “event”. The only thing different between them is the event.title value.

Here’s the loop:

const currentYear = new Date().getFullYear();
const currentMonth = new Date().getMonth() + 1;
const currentDay = new Date().getDate();
const currentUnix = Math.floor(new Date(currentYear + '-' + currentMonth + '-' + currentDay).getTime() / 1000);

for(let event of allEvents){
    let dateArray = event.startDateString.split('-');
    let year = dateArray[0];
    let month = dateArray[1];
    let day = dateArray[2];

    let eventUnix = Math.floor(new Date(event.startDateString).getTime() / 1000);

    if(year < currentYear || currentUnix > eventUnix || event.title == 'Closed Period'){
        // don't display any from the previous year, any past events, or closed period
        continue;
    }

    $('#data').append('some HTML');
}

Thanks for any help!

Zod inferred types look like they’re not inferring the inheritance (extends)

I have created this file to test the behaviour i need:

import { z } from "zod";

// SCHEMAS
export const dataIdSchema = z.number().int().positive().finite();

export const baseDataSchema = z.object({
    id: dataIdSchema,
})

export const userSchema = baseDataSchema.extend({
    name: z.string(),
})

export type BaseData = z.infer<typeof baseDataSchema>;
export type User = z.infer<typeof userSchema>;

// CODE

//looking for optional attribs while 'id' still required
export type PaginationCursor<T extends BaseData> = Partial<T> & Pick<T, "id">;

export const createCursor = <T extends BaseData>(record: T): PaginationCursor<T>[] => {
  /**
   * Type '{ id: number; }' is not assignable to type 'PaginationCursor<T>'.
   *  Type '{ id: number; }' is not assignable to type 'Partial<T>'.ts(2322)
   */
  const cursor: PaginationCursor<T> = { id: record.id };

  /**
   * Type '{ id: 123; }' is not assignable to type 'PaginationCursor<T>'.
   *   Type '{ id: 123; }' is not assignable to type 'Partial<T>'.ts(2322)
   */
  const cursor2: PaginationCursor<T> = { id: 123 };

  // just fine on declaration
  const cursor3: PaginationCursor<User> = { id: 123 };
  const cursor4: PaginationCursor<BaseData> = { id: 123 };

  /** cursor3:
   * Type 'PaginationCursor<{ id: number; name: string; }>' is not assignable to type 'PaginationCursor<T>'.
   *   Type 'PaginationCursor<{ id: number; name: string; }>' is not assignable to type 'Partial<T>'.ts(2322)
   */
  /** cursor4:
   * Type 'PaginationCursor<{ id: number; }>' is not assignable to type 'PaginationCursor<T>'.
   *   Type 'PaginationCursor<{ id: number; }>' is not assignable to type 'Partial<T>'.ts(2322)
   */
  
  return [cursor, cursor2, cursor3, cursor4];
}

The project is a Vite+React+Ts
Dependencies:

  • “@emotion/react”: “^11.13.3”,
  • “@emotion/styled”: “^11.13.0”,
  • “@fontsource/roboto”: “^5.1.0”,
  • “@hookform/resolvers”: “^3.9.0”,
  • “@mui/icons-material”: “^6.4.8”,
  • “@mui/material”: “^6.1.6”,
  • “@mui/x-date-pickers”: “^7.29.2”,
  • “@supabase/supabase-js”: “^2.49.4”,
  • “date-fns”: “^4.1.0”,
  • “i18next”: “^25.1.3”,
  • “i18next-browser-languagedetector”: “^8.1.0”,
  • “leaflet”: “^1.9.4”,
  • “lodash”: “^4.17.21”,
  • “react”: “^18.3.1”,
  • “react-dom”: “^18.3.1”,
  • “react-hook-form”: “^7.53.1”,
  • “react-i18next”: “^15.5.1”,
  • “react-leaflet”: “^4.2.1”,
  • “socket.io-client”: “^4.8.1”,
  • “zod”: “^3.23.8”,
  • “zustand”: “^5.0.0”

Field in Modal dialog become non-interactive after delete records

I have a desktop web application that I’m building with Electron and React.js.

The problem is as follows:

  • When creating and updating records, everything works fine; this is achieved through a modal dialog.

  • When deleting a record and immediately creating a new one, the fields become non-interactive. This means I can’t focus them and I can’t type in the text fields.

I have to wait a few seconds for these fields to become interactive.

I honestly don’t know what in the code is causing this unwanted effect (If you require more information, feel free to ask):

import React, { useState } from 'react';
import { 
  Box, Typography, Paper, Button, TextField, IconButton,
  Table, TableBody, TableCell, TableContainer, TableHead, TableRow,
  Dialog, DialogActions, DialogContent, DialogTitle,
  Snackbar, Alert
} from '@mui/material';
import DeleteIcon from '@mui/icons-material/Delete';
import EditIcon from '@mui/icons-material/Edit';
import { useData } from '../context/DataContext';

const DepartmentsAreas = () => {
  const { departments, areas, addDepartment, addArea, updateDepartment, updateArea, deleteDepartment, deleteArea } = useData();
  
  // Estado para el diálogo de departamentos
  const [openDeptDialog, setOpenDeptDialog] = useState(false);
  const [deptName, setDeptName] = useState('');
  const [deptDescription, setDeptDescription] = useState('');
  const [editingDeptId, setEditingDeptId] = useState(null);
  
  // Estado para el diálogo de áreas
  const [openAreaDialog, setOpenAreaDialog] = useState(false);
  const [areaName, setAreaName] = useState('');
  const [areaDescription, setAreaDescription] = useState('');
  const [areaDepartmentId, setAreaDepartmentId] = useState('');
  const [editingAreaId, setEditingAreaId] = useState(null);
  
  // Estado para notificaciones
  const [notification, setNotification] = useState({
    open: false,
    message: '',
    severity: 'info'
  });
  
  // Funciones para mostrar/ocultar notificaciones
  const showNotification = (message, severity = 'info') => {
    setNotification({
      open: true,
      message,
      severity
    });
  };
  
  const handleCloseNotification = () => {
    setNotification({
      ...notification,
      open: false
    });
  };
  
  // Manejadores para departamentos
  const handleOpenNewDeptDialog = () => {
    setDeptName('');
    setDeptDescription('');
    setEditingDeptId(null);
    setOpenDeptDialog(true);
  };
  
  const handleOpenEditDeptDialog = (dept) => {
    setDeptName(dept.name);
    setDeptDescription(dept.description);
    setEditingDeptId(dept.id);
    setOpenDeptDialog(true);
  };
  
  const handleCloseDeptDialog = () => {
    setOpenDeptDialog(false);
  };
  
  const handleSaveDepartment = async () => {
    if (!deptName.trim()) {
      showNotification('Por favor ingrese un nombre para el departamento', 'error');
      return;
    }
    
    // Cerrar el diálogo primero
    setOpenDeptDialog(false);
    
    try {
      if (editingDeptId) {
        // Editar departamento existente
        await updateDepartment({
          id: editingDeptId,
          name: deptName,
          description: deptDescription
        });
        showNotification('Departamento actualizado correctamente', 'success');
      } else {
        // Crear nuevo departamento
        await addDepartment({
          name: deptName,
          description: deptDescription
        });
        showNotification('Departamento creado correctamente', 'success');
      }
    } catch (error) {
      console.error('Error al guardar departamento:', error);
      showNotification('Error al guardar el departamento', 'error');
    }
  };
  
  const handleDeleteDepartment = async (id) => {
    if (window.confirm('¿Está seguro de eliminar este departamento? También se eliminarán todas las áreas asociadas.')) {
      try {
        // Eliminamos el departamento
        await deleteDepartment(id);
        // Luego mostramos la notificación
        showNotification('Departamento eliminado correctamente', 'success');
      } catch (error) {
        console.error('Error al eliminar departamento:', error);
        showNotification('Error al eliminar el departamento', 'error');
      }
    }
  };
  
  // Manejadores para áreas
  const handleOpenNewAreaDialog = () => {
    setAreaName('');
    setAreaDescription('');
    setAreaDepartmentId('');
    setEditingAreaId(null);
    setOpenAreaDialog(true);
  };
  
  const handleOpenEditAreaDialog = (area) => {
    setAreaName(area.name);
    setAreaDescription(area.description);
    setAreaDepartmentId(area.departmentId);
    setEditingAreaId(area.id);
    setOpenAreaDialog(true);
  };
  
  const handleCloseAreaDialog = () => {
    setOpenAreaDialog(false);
  };
  
  const handleSaveArea = async () => {
    if (!areaName.trim()) {
      showNotification('Por favor ingrese un nombre para el área', 'error');
      return;
    }
    
    if (!areaDepartmentId) {
      showNotification('Por favor seleccione un departamento', 'error');
      return;
    }
    
    // Cerrar el diálogo primero
    setOpenAreaDialog(false);
    
    try {
      if (editingAreaId) {
        // Editar área existente
        await updateArea({
          id: editingAreaId,
          name: areaName,
          description: areaDescription,
          departmentId: areaDepartmentId
        });
        showNotification('Área actualizada correctamente', 'success');
      } else {
        // Crear nueva área
        await addArea({
          name: areaName,
          description: areaDescription,
          departmentId: areaDepartmentId
        });
        showNotification('Área creada correctamente', 'success');
      }
    } catch (error) {
      console.error('Error al guardar área:', error);
      showNotification('Error al guardar el área', 'error');
    }
  };
  
  const handleDeleteArea = async (id) => {
    if (window.confirm('¿Está seguro de eliminar esta área?')) {
      try {
        // Eliminamos el área
        await deleteArea(id);
        // Luego mostramos la notificación
        showNotification('Área eliminada correctamente', 'success');
      } catch (error) {
        console.error('Error al eliminar área:', error);
        showNotification('Error al eliminar el área', 'error');
      }
    }
  };

  return (
    <Box sx={{ p: 3 }}>
      <Typography variant="h4" gutterBottom>
        Gestión de Departamentos y Áreas
      </Typography>
      
      {/* Sección de Departamentos */}
      <Box sx={{ mb: 4 }}>
        <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
          <Typography variant="h5">Departamentos</Typography>
          <Button 
            variant="contained" 
            color="primary" 
            onClick={handleOpenNewDeptDialog}
          >
            Nuevo Departamento
          </Button>
        </Box>
        
        <TableContainer component={Paper}>
          <Table sx={{ minWidth: 650 }}>
            <TableHead>
              <TableRow>
                <TableCell>Nombre</TableCell>
                <TableCell>Descripción</TableCell>
                <TableCell align="right">Acciones</TableCell>
              </TableRow>
            </TableHead>
            <TableBody>
              {departments.map((dept) => (
                <TableRow key={dept.id}>
                  <TableCell>{dept.name}</TableCell>
                  <TableCell>{dept.description}</TableCell>
                  <TableCell align="right">
                    <IconButton onClick={() => handleOpenEditDeptDialog(dept)}>
                      <EditIcon />
                    </IconButton>
                    <IconButton onClick={() => handleDeleteDepartment(dept.id)}>
                      <DeleteIcon />
                    </IconButton>
                  </TableCell>
                </TableRow>
              ))}
              {departments.length === 0 && (
                <TableRow>
                  <TableCell colSpan={3} align="center">
                    No hay departamentos registrados
                  </TableCell>
                </TableRow>
              )}
            </TableBody>
          </Table>
        </TableContainer>
      </Box>
      
      {/* Sección de Áreas */}
      <Box>
        <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
          <Typography variant="h5">Áreas</Typography>
          <Button 
            variant="contained" 
            color="primary" 
            onClick={handleOpenNewAreaDialog}
            disabled={departments.length === 0}
          >
            Nueva Área
          </Button>
        </Box>
        
        <TableContainer component={Paper}>
          <Table sx={{ minWidth: 650 }}>
            <TableHead>
              <TableRow>
                <TableCell>Nombre</TableCell>
                <TableCell>Descripción</TableCell>
                <TableCell>Departamento</TableCell>
                <TableCell align="right">Acciones</TableCell>
              </TableRow>
            </TableHead>
            <TableBody>
              {areas.map((area) => {
                const department = departments.find(d => d.id === area.departmentId);
                return (
                  <TableRow key={area.id}>
                    <TableCell>{area.name}</TableCell>
                    <TableCell>{area.description}</TableCell>
                    <TableCell>{department ? department.name : 'N/A'}</TableCell>
                    <TableCell align="right">
                      <IconButton onClick={() => handleOpenEditAreaDialog(area)}>
                        <EditIcon />
                      </IconButton>
                      <IconButton onClick={() => handleDeleteArea(area.id)}>
                        <DeleteIcon />
                      </IconButton>
                    </TableCell>
                  </TableRow>
                );
              })}
              {areas.length === 0 && (
                <TableRow>
                  <TableCell colSpan={4} align="center">
                    No hay áreas registradas
                  </TableCell>
                </TableRow>
              )}
            </TableBody>
          </Table>
        </TableContainer>
      </Box>
      
      {/* Diálogo para Departamentos */}
      {openDeptDialog && (
        <Dialog 
          open={true} 
          onClose={handleCloseDeptDialog}
          maxWidth="sm"
          fullWidth
        >
          <DialogTitle>{editingDeptId ? 'Editar Departamento' : 'Nuevo Departamento'}</DialogTitle>
          <DialogContent>
            <Box sx={{ mt: 2 }}>
              <TextField
                margin="dense"
                label="Nombre del Departamento"
                type="text"
                fullWidth
                variant="outlined"
                value={deptName}
                onChange={(e) => setDeptName(e.target.value)}
                required
                error={!deptName}
                helperText={!deptName ? 'Este campo es requerido' : ''}
                sx={{ mb: 2 }}
                autoFocus={false}
                InputProps={{
                  readOnly: false,
                }}
              />
              <TextField
                margin="dense"
                label="Descripción"
                type="text"
                fullWidth
                variant="outlined"
                value={deptDescription}
                onChange={(e) => setDeptDescription(e.target.value)}
                multiline
                rows={3}
                InputProps={{
                  readOnly: false,
                }}
              />
            </Box>
          </DialogContent>
          <DialogActions>
            <Button onClick={handleCloseDeptDialog}>Cancelar</Button>
            <Button onClick={handleSaveDepartment} variant="contained" color="primary">
              Guardar
            </Button>
          </DialogActions>
        </Dialog>
      )}
      
      {/* Diálogo para Áreas */}
      {openAreaDialog && (
        <Dialog 
          open={true} 
          onClose={handleCloseAreaDialog}
          maxWidth="sm"
          fullWidth
        >
          <DialogTitle>{editingAreaId ? 'Editar Área' : 'Nueva Área'}</DialogTitle>
          <DialogContent>
            <Box sx={{ mt: 2 }}>
              <TextField
                margin="dense"
                label="Nombre del Área"
                type="text"
                fullWidth
                variant="outlined"
                value={areaName}
                onChange={(e) => setAreaName(e.target.value)}
                required
                error={!areaName}
                helperText={!areaName ? 'Este campo es requerido' : ''}
                sx={{ mb: 2 }}
                autoFocus={false}
                InputProps={{
                  readOnly: false,
                }}
              />
              <TextField
                margin="dense"
                label="Descripción"
                type="text"
                fullWidth
                variant="outlined"
                value={areaDescription}
                onChange={(e) => setAreaDescription(e.target.value)}
                multiline
                rows={3}
                sx={{ mb: 2 }}
                InputProps={{
                  readOnly: false,
                }}
              />
              <TextField
                select
                margin="dense"
                label="Departamento"
                fullWidth
                variant="outlined"
                value={areaDepartmentId}
                onChange={(e) => setAreaDepartmentId(e.target.value)}
                required
                error={!areaDepartmentId}
                helperText={!areaDepartmentId ? 'Este campo es requerido' : ''}
                SelectProps={{
                  native: true,
                }}
                InputProps={{
                  readOnly: false,
                }}
              >
                <option value="">Seleccione un departamento</option>
                {departments.map((dept) => (
                  <option key={dept.id} value={dept.id}>
                    {dept.name}
                  </option>
                ))}
              </TextField>
            </Box>
          </DialogContent>
          <DialogActions>
            <Button onClick={handleCloseAreaDialog}>Cancelar</Button>
            <Button onClick={handleSaveArea} variant="contained" color="primary">
              Guardar
            </Button>
          </DialogActions>
        </Dialog>
      )}
      
      {/* Notificaciones */}
      <Snackbar
        open={notification.open}
        autoHideDuration={6000}
        onClose={handleCloseNotification}
        anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
      >
        <Alert 
          onClose={handleCloseNotification} 
          severity={notification.severity} 
          sx={{ width: '100%' }}
        >
          {notification.message}
        </Alert>
      </Snackbar>
    </Box>
  );
};

export default DepartmentsAreas;

Simplest way to consume third party API in the backend just to authenticate and overcome cors

I am building a simple web APP using only front-end interface and JS for logic and consume data from third party API however I hit CORS issue! So I thought a simplest way to consume the API in backend and return results to my front JS.

so instead of :

front-end JS fetch ---> third party API

I need:

front-end JS fetch ---> back-end python request ---> third party API 

Is there a way to avoid frameworks and just use pure python the APP is not designed for production now but just a show case on github the people can run locally so I do not mind about security I would rather simplify code and avoid requiring any re knowledge of frameworks and dependency (only python and requests package enough)

I want to see examples and how other people design simliar apps

Want to know how to create Models for toggle time Tracker

I’m new to backend development, and I’m currently trying to build a time tracker app similar to Toggl. However, I’m struggling with creating models and controllers properly.

Every time I try to create models on my own, I get stuck, same with controllers. I’ve mostly relied on AI tools in the past, so I never really learned how to structure these things manually. Now, I’m pushing myself to learn and build it without shortcuts.

I’m also unsure how to create mock data for the app. I know it’s not that complex, but I just can’t figure it out on my own.

I would appreciate it if someone could point me to solid resources (not YouTube tutorials) that explain how to create models and controllers effectively, ideally with practical examples. Any advice, examples, or learning paths would be a huge help.

D3 Stacked Bar Chart Example Mechanism Specifics

I’m currently trying to make a stacked bar chart in D3. I’ve found the following links with examples: https://d3js.org/d3-shape/stack#_stack , https://observablehq.com/@d3/stacked-bar-chart/2 , https://d3-graph-gallery.com/graph/barplot_stacked_basicWide.html .

While I think I can just copy paste my data into this format and have it work, I’m not sure on the specifics of several things & would love to know the actual inner mechanisms, and Google isn’t able to understand my question.

  1. The simple example creates the stack with the following code:
var stackedData = d3.stack()
        .keys(subgroups)
        (data)

I’m trying to figure out what that (data) is doing at the end: as in, it’s not parameters being passed into any method’s parentheses, because all the methods’ parentheses have already been opened and closed, so where is it getting passed to if its parentheses are not attached to a method? If there’s just a link to the documentation on this or something that would be great.

  1. The example of the rectangle generation the official doc gives is:
svg.append("g")
  .selectAll("g")
  .data(series)
  .join("g")
    .attr("fill", d => color(d.key))
  .selectAll("rect")
  .data(D => D)
  .join("rect")
    .attr("x", d => x(d.data[0]))
    .attr("y", d => y(d[1]))
    .attr("height", d => y(d[0]) - y(d[1]))
    .attr("width", x.bandwidth());

2a) This isn’t that consequential but I’m just curious – why is it convention to use capital D in .data(D => D) instead of the usual lowercase d?

2b) In x(d.data[0]), what is “data”? I’ve used Inspect Element on the Observable example and found that it does contain a data array inside its __data__, but I’m not sure how it got there. Is it because of how the index() function used before it works? As in, usually, there is no array called “data” inside d, right?

2c) Why is height calculated by y(d[0]) - y(d[1]), not the other way around? d[1] is bigger than d[0] for each item, so that makes it negative. Is it something to do with the y axis increasing as it goes down on a webpage? But how can height be negative, regardless?

Thank you!!