samedi 31 juillet 2021

what is difference between gatsby and strapi?

**Please don't downvote this question **

I have a little bit confusion about difference between strapi and gatsby .

Is it good to use both of them together or to choose one of them ? If they are used together how they work together (the mechannisim behind) ? When and in which case to use them together ?




How can I change many processes of action in jsp and outputting in servlet with one click?

<c:forEach items="${datelist}" var="list" varStatus="status">
    <div id="schedulelist" class="list-group">
        <form id="my_form" method="POST" action="/SIST2_Travel/plan/planscd.do">
            <input type="submit" value="${"Day"} ${status.count} ${list}" class="btn btn-primary">

            <div class="d-flex w-100 align-items-center justify-content-between">
                <strong class="mb-1">${"Day"} ${status.count}</strong>
                <small>${list}</small>
            </div>
            <div class="col-10 mb-1 small">${city.name}</div>
            <!-- </a> -->
            <input type="hidden" name="city" value="${city}">

            <input type="hidden" name="cityname" value="${city.name}">
            <input id="currX" type="hidden" name="cityX" value="${city.cityX}">
            <input id="currY" type="hidden" name="cityY" value="${city.cityY}">
            <input type="hidden" name="Explain" value="${city.explain}">
            <input type="hidden" name="Cityseq" value="${city.cityseq}">


            <input type="hidden" name="planname" value="${citydto.name}">
            <input type="hidden" name="dayendtravel" value="${citydto.dayendtravel}">
            <input type="hidden" name="daystarttravel" value="${citydto.daystarttravel}">
            <input type="hidden" name="willshare" value="${citydto.willshare}">

                <%-- <input type="text" name="rdate" value="">--%>
            <input type="hidden" name="rdate" id="rdate" value="${list}">
            <c:forEach items="${datelist}" var="list" varStatus="status">
                <input type="hidden" name="datelist" value="${list}">
            </c:forEach>
        </form>
        </c:forEach>
    </div>

When I click the button in this code The following getlist form shows the schdule.

<form id="getlist" method="POST" action="/SIST2_Travel/plan/plandone.do">
    <div class="plan sortable" id="planlist">

        <c:forEach items="${list}" var="dto" varStatus="status">

            <div class="list-group">
                <div class="list-group-item list-group-item-action">
                    <div id="seqname"></div>
                    <div class="d-flex w-100 justify-content-between" data-seq="${status.index}">
                        <h5 class="mb-1">${dto.place_name} ${status.index}</h5>
                        <small class="text-muted">${dto.category_group_name}</small>
                    </div>
                    <p class="mb-1">${dto.address_name}</p>

                    <button type="button" class="close" aria-label="Close"
                            onclick="location.href='/SIST2_Travel/plan/plandel.do?plan2seq=${dto.plan2seq}';">
                        <span aria-hidden="true">&times;</span>
                    </button>

                    <form method="POST" action="/SIST2_Travel/plan/plandel.do">
                        <input type="hidden" name="plan2seq" value="${dto.plan2seq}">

                        <input type="hidden" name="cityname" value="${city.name}">
                        <input type="hidden" name="cityX" value="${city.cityX}">
                        <input type="hidden" name="cityY" value="${city.cityY}">
                        <input type="hidden" name="Explain" value="${city.explain}">
                        <input type="hidden" name="Cityseq" value="${city.cityseq}">


                        <input type="hidden" name="planname" value="${citydto.name}">
                        <input type="hidden" name="dayendtravel" value="${citydto.dayendtravel}">
                        <input type="hidden" name="daystarttravel" value="${citydto.daystarttravel}">
                        <input type="hidden" name="willshare" value="${citydto.willshare}">


                        <c:forEach items="${datelist}" var="list">
                            <input type="hidden" name="datelist" value="${list}">
                        </c:forEach>
                    </form>
                </div>
                <input type="hidden" name="planseq" value="${dto.plan2seq}">
                <input type="hidden" name="seq" value="${status.count}">
            </div>
        </c:forEach>
        <input type="submit" value="Schedule registration completed">
    </div>
</form>

And if click submit, which is registration completed, the plandone servelet registers the schedule in the db and the job ends.

The problem here is that we have to click on several buttons that exist in the schedulelist, and the whole schedule should be registered.

The biggest difficulty is sending data from jsp to servlet, and in the process of sending data from servlet to jsp, the schedultlist changes and it is difficult to store all the changing information.

I wonder how to register all schedules (all contents of schedulelist) with one click of the submit button.




Browser rejects cookie if it is in a cross-site context and has strict same-site attribute

My server set same-site cookie on my client. every thing works fine if both server and client are on the same domain but when they are not on the same domain the browser rejects the cookie and i get the console warning shown in the attached image. i'm confused with the term "same-site" does it mean server and client should be hosted on the same domain or the browser sends the cookie only for same-site requests (that is, requests originating from the same site that set the cookie). If the request originated from a different URL than the current one, no cookies with the SameSite=Strict attribute are sent. browser console




Deploy a web app contains selenium webdriver

I have deployed a flask web app to pythonanywhere.com . I pip installed all the modules needed with bash console but the part of my web app using selenium and firefox as webdriver is not working.Is there any problem with using web scraper bots like selenium at backend?




Netlify Deployment Time Exceeded

5:35:33 PM: ──────────────────────────────────────────────────────────────── 5:35:33 PM: 1. Build command from Netlify app
5:35:33 PM: ──────────────────────────────────────────────────────────────── 5:35:33 PM: ​ 5:35:33 PM: $ npm start

5:35:34 PM: > simple-light-react@0.1.0 start /opt/build/repo

5:35:34 PM: > craco start

5:35:38 PM: Browserslist: caniuse-lite is outdated. Please run the following

command: npx browserslist --update-db

5:35:39 PM: ℹ 「wds」: Project is running at http://10.7.61.53/

5:35:39 PM: ℹ 「wds」: webpack output is served from

5:35:39 PM: ℹ 「wds」: Content not from webpack is served from /opt/build/repo/public

5:35:39 PM: ℹ 「wds」: 404s will fallback to /

5:35:39 PM: Starting the development server...

5:35:39 PM:

5:35:55 PM: Browserslist: caniuse-lite is outdated. Please run:

5:35:55 PM: npx browserslist@latest --update-db

5:36:08 PM: Compiled with warnings.

5:36:08 PM:

5:36:08 PM: src/partials/Testimonials.js

5:36:08 PM: Line 1:16: 'useState' is defined but never used no-unused-vars

5:36:08 PM: Line 2:9: 'Document' is defined but never used no-unused-vars

5:36:08 PM: Line 2:19: 'Page' is defined but never used no-unused-vars

5:36:08 PM: Search for the keywords to learn more about each warning.

5:36:08 PM: To ignore, add // eslint-disable-next-line to the line before.

6:04:03 PM: Build exceeded maximum allowed runtime

6:04:08 PM: Failed to compile.

6:04:08 PM:

6:04:08 PM: ./src/index.js

6:04:08 PM: Error: ENOENT: no such file or directory, open '/opt/build/repo/src/index.js'

Here, Netlify is stating that my deployment time exceeds even though I can deploy the app locally on my computer yet have never really coded in Java and React so I'm having trouble understanding threads and why my app deployment is taking a while when I'm utilizing a one page website. For refernece, my github repository here at https://github.com/tagalon/dropnutailwind. I'm using a free template made just for the heads up. Thanks again!




How to disable horizontal scrolling in an image?

I'm doing an animation-on-scroll page. At the moment, I'm optimizing it for mobile devices.

In case an element is bigger than the actual screen (e.g. bigger than a mobile screen), you're able to scroll in that element (e.g. you're able to scroll horizontally in an image). How can I block that? I've already found out that the e.g. actual x-scroll-position doesn't change when scrolling through an image horizontally.

Because of the animation, I'm not able to set any elements position to relative. Overflow-x: hidden doesn't work in my case.




Why does CSS follow US English?

It's been over a month since I started learning Web Development. When I started with styles, I realised that CSS follows US English. I personally do not have any major problem with it, but does anyone know an answer to this.




Creating a web hosting platform using Firebase? [closed]

I am creating a prototype for a web hosting platform and I am looking at firebase to help quickly bring it to life. Not sure if its a smart idea or not. Any one can point me in the right direction? I am still trying to figure out the best way to build this platform!




Is there a way that I can make css take into account how much space a svg takes up

I have a svg and two divs and I am trying to make it so it the 2 divs and the svg take up the whole screen when you enter the site but with the svg is makes it bigger because the css is not accounting for the svg is there a way I can make css account for the space the svg takes up

I have tried to set the max height for the header-container

I have also tried to adjust the vh for the 2 divs but on a smaller or bigger screen they become different sizes and it does not work

* {
  margin: 0%;
  padding: 0%;
}
body {
  height: 100000px;
}
.header-container {
  width: 100%;
  background-color: #3C8DAD;
  max-height: 100vh;

}

.header-top {
  width: 100%;
  height: 50vh;
}
svg {
  vertical-align: top;
}
.header-bottom {
  width: 100%;
  height: 50vh;
  background-color: #F5A962;
}
.header-content {
  align-items: center;
  width: 45%;
  height: 300px;
  border: 2px red solid;
  position: absolute;
  left: 25%;
  top: 50%; 
}
.name {
  font-family: 'Titillium Web', sans-serif;
  font-size: 40px;
  color: white;
}
.job {
  font-family: 'Noto Serif', serif;
  font-size: 66px;
  font-weight: 800;
  color: white;
  margin-top: 3%;
  margin-left: 4%;
}
<div class="header-container">
  <div class="header-top">
      <div class="header-content">
          <div class="name">Andrew Saenger</div>
          <div class="job">Front-End Web Developer</div>
      </div>
  </div>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320">
    <path fill="#F5A962" fill-opacity="1" d="M0,160L48,160C96,160,192,160,288,138.7C384,117,480,75,576,85.3C672,96,768,160,864,160C960,160,1056,96,1152,80C1248,64,1344,96,1392,112L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path>
  </svg>
  <div class="header-bottom"></div>
</div>


    



HTML Scaling issue to fit content

I'm fairly new to web-development, and at the moment I'm learning responsive design. I'm have some difficulty with making my websites content fix properly on small screens like smart phones. Tried using media queries but am fairly new on the subject so any help would be apricated.

GitHub: https://github.com/JackDef10/Web-portfolio.git Website: https://jackdef10.github.io/Web-portfolio/




How do I make my home page go to a .com/example

I am making a informational site about stocks, cryptos etc. I have made multiple sites but never really got them up and running.

I have a home page that should refer to (for example) Bitcoin. (I am not sure if this is a dumb question) i am looking for the web adress of it being http://example.com/bitcoin.

how do i do this?




Mrwhosetheboss how to mimic that instagram hack? [closed]

How to do this? Watch this video at 10:41, how do I reply a message by reacting to it with a text in instagram ?. I know Javascript React Node so please feel free to give a detailed answer

watch at 10:41




CSS HTML "color: gold;" not working on mobile

Im building a website and I cant get this text color to change.

enter image description here

(link to full size image of text im trying to change) https://i.stack.imgur.com/e5FQ1.png

Ive tried using

color: gold;

and ive also tried using the !important tag as well.

Ive spend hours just sitting and staring but no ideas have come to me.

The link to the webiste is https://luxtent.by/ and when you are inspecting element make sure to set the view type to iPhone 6/7/8.

Also another issue that I cant figure out is that the icons are white on screen but, when if you look in inspect element, they are gold. enter image description here

If you have any ideas feel free to try them out in inspect element and let me know if you have any questions.




My CS50 Lab 8 Trivia Website's buttons aren't working

<!DOCTYPE html>
Trivia!
    <script>

        // TODO: Add code to check answers to questions
        //run the script once the DOM is loaded
        document.addEventListener('DOMContentloaded', function(){

            //when correct answer is clicked change button colour to green
            let correct = document.querySelector('.correct');
            correct.addEventListner('click', function(){
                correct.style.backgroundColor = 'green';
                document.querySelector('#feedback1').innerHTML = 'Correct!';
            });

            //When any incorrect answer is clicked, change color to red.
            let incorrects = document.querySelectorAll('.incorrect');
            for (let i=0; i < incorrects.length; i++){
                incorrects[i].addEventListener('click', function() {
                    incorrects[i].style.backgroundColor = 'red';
                    document.querySelector('#feedback1').innerHTML = 'Incorrect';
                });
            }

            //check free response submission
            document.querySelector('#check').addEventListner('click', function(){
                let input = document.querySelector('input');
                if (input.value === 'Switzerland'){
                    input.style.backgroundColor = 'green';
                    document.querySelector('#feedback2').innerHTML = 'Correct!';
                }else{
                    input.style.backgroundColor = 'red';
                    document.querySelector('#feedback2').innerHTML = 'Incorrect';
                }
            });

        });

    </script>

</head>
<body>

    <div class="jumbotron">
        <h1>Trivia!</h1>
    </div>

    <div class="container">

        <div class="section">
            <h2>Part 1: Multiple Choice </h2>
            <hr>

            <!-- TODO: Add multiple choice question here -->
            <h3>What is the approximate ratio of people to sheep in New zealand?</h3>
            <button class="incorrect">6 people per 1 sheep</button>
            <button class="incorrect">3 people per 1 sheep</button>
            <button class="incorrect">1 person per 1 sheep</button>
            <button class="incorrect">1 person per 3 sheep</button>
            <button class="correct">1 person per 6 sheep</button>

            <p id="feedback1"></p>

        </div>

        <div class="section">
            <h2>Part 2: Free Response</h2>
            <hr>

            <!-- TODO: Add free response question here -->
            <h3>In which country is it illegal to own one guinea pig, as a lone guinea pig might be lonely?</h3>
            <input type="text"></input>
            <button id="check">Check Answer</button>

            <p id="feedback2"></p>

        </div>

    </div>
</body>

This is the html and javascript code for my Trivia website which has 2 questions. The first question has 4 buttons containing 4 options out of which there is only 1 correct answer. And the second question is text based free response answer. When I click on the buttons for the question 1 or the "Check answer" button for question 2 nothing happens. Any help would be appreciated. Also I am new to stack overflow and this is my first question so if it's formatted incorrectly kindly excuse.




How do I turn my website into an app when adding to homescreen on an ios device?

I have a website and I would like for it to be an app, take as an example the samsung itest which prompts you to add to the home screen on an ios device, how would I implement such a thing and then make it work as a fullscreen app?

My current problem is that when I add it to the home screen it just opens safari with the website.

The device I am trying this on is a test iPhone 11 Pro Max with iOS 15.

Do I need some special tools or xCode for this? Can I do it without a MacOS device or do I need one?

Thanks in advance.




How can I go through the servlet and apply css to the selected button?

<div id="schedulelist" class="list-group">
        <form id="my_form" method="POST" action="/SIST2_Travel/plan/planscd.do">
            <input type="submit" value="${"Day"} ${status.count} ${list}" class="btn btn-primary">
 
            <div class="d-flex w-100 align-items-center justify-content-between">
                <strong class="mb-1">${"Day"} ${status.count}</strong>
                <small>${list}</small>
            </div>

The code above is list.jsp. In this code, the tag takes you to planscd.do. And back to list.jsp again.

At this time, I want to change the class of the button of the clicked tag to btn-info.

How can I go through the servlet and apply css to the selected button?




vendredi 30 juillet 2021

Are Web APIs a javascript feature or a browser feature?

MDN provides a list of Web APIs available.

Are these Javascript feature or just limited to browsers?




Internationalization in Ktor based website

I'm new to Ktor and Kotlin in general, so please be patient.

I am currently trying to create a little website (mostly for learning) that uses key-value files for internationalization.

I already did something similar in PHP where I just decoded a JSON file and got the value related to the key I passed. This way, I could do something as <p><?php echo $langJson["presentation"][0];?></p> (with $langJson being my json key-value file) so that I would get the proper translation.

I'm trying to do an equivalent in Kotlin using Ktor, but I don't know how to do it. I found the aymanizz ktor-i18n plugin on GitHub that allows to use i18n for internationalization but I don't know if it is really adapted to what I want to do since it detects the language in the header instead of it being chose by the user (with _GET for instance).

Does anyone have any clue on how I could do that?

Briefly, what I want to do is having a single coded page where the content is dynamicly chosen from the accurate language file.

Thank you all! :)




Redirect link to run a python script

on every outboud links on post, when click on links, i want to get final url from a cloak links, then replace some element on final url , then go to final links. for ex: original link on post: https://example.com/go/771/ when click on above link, i will redirect to : https://www.exampledomain.com/?aid=318dd9f8&data1=9gxijwksq68v36sv__53:VT13100210635792 i want: anytime click on original link, you will redirect to run a python script to replace character: 318dd9f8 by 234324 ( for example), so final link i want is : https://www.exapledomain.com/?id=234324&data1=9gxijwksq68v36sv__53:VT13100210635792

How i can do this by python? i am beginer, thank you very much for helps. jim




Best way to add mobile CSS on an existing webpage designed with react?

I want to add a responsive design to my already built web application. Is it my best approach to detect dimension at top level component and conditionally render different component base on users on desktop or mobile ?

I've design responsive website by only css, or with a framework like tailwind in the past, but refactoring an existing application that has elements style tied to logic impose a challenge to do with css alone.




How to filter list data by id and show the single object in HTML template by django?

This is the Json List Below:

"chartOfAccounts": [
            {
                "id": 147,
                "name": "Sales Product - Wholesale test",
                "description": "Sales - Wholesale",
                "balance": "0.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 5,
                    "name": "Accounts Receivable (A/R)",
                    "account_type": {
                        "id": 2,
                        "name": "Accounts Receivable (A/R)",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 146,
                "name": "Sales Product - Wholesale test",
                "description": "Sales - Wholesale",
                "balance": "0.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 5,
                    "name": "Accounts Receivable (A/R)",
                    "account_type": {
                        "id": 2,
                        "name": "Accounts Receivable (A/R)",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 145,
                "name": "Cash in hand rony",
                "description": "Cash in hand rony",
                "balance": "-45980.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 1,
                    "name": "Cash and cash equivalents",
                    "account_type": {
                        "id": 1,
                        "name": "Cash and cash equivalents",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 144,
                "name": "6yt4",
                "description": "gyyy",
                "balance": "5203.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 1,
                    "name": "Cash and cash equivalents",
                    "account_type": {
                        "id": 1,
                        "name": "Cash and cash equivalents",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 99,
                "name": "Cash in hand Monim",
                "description": "monim cash",
                "balance": "-1759.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 1,
                    "name": "Cash and cash equivalents",
                    "account_type": {
                        "id": 1,
                        "name": "Cash and cash equivalents",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 98,
                "name": "Monim Capital",
                "description": "Monim Capital",
                "balance": "50000.00",
                "is_active": true,
                "is_editable": true,
                "account_detail_type": {
                    "id": 10,
                    "name": "Owen's Capital",
                    "account_type": {
                        "id": 6,
                        "name": "Owen's Capital",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "cr"
                }
            },
            {
                "id": 93,
                "name": "Payroll - m@m.bn",
                "description": "Payroll - m@m.bn",
                "balance": "0.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 12,
                    "name": "Expenses",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 12,
                "name": "Profit",
                "description": "Profit",
                "balance": "437690.75",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 11,
                    "name": "Income",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "cr"
                }
            },
            {
                "id": 10,
                "name": "Rajib",
                "description": "Test",
                "balance": "50000.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 11,
                    "name": "Income",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "cr"
                }
            },
            {
                "id": 9,
                "name": "Sales - Product",
                "description": "Sales - Product",
                "balance": "0.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 11,
                    "name": "Income",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "cr"
                }
            },
            {
                "id": 8,
                "name": "Purchases - Product",
                "description": "Purchases - Product",
                "balance": "47388.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 12,
                    "name": "Expenses",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 7,
                "name": "Payroll Expenses",
                "description": "Payroll Expenses",
                "balance": "0.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 12,
                    "name": "Expenses",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 6,
                "name": "Office expenses",
                "description": "Office expenses",
                "balance": "28899.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 12,
                    "name": "Expenses",
                    "account_type": {
                        "id": 7,
                        "name": "Revenue",
                        "principle": {
                            "id": 3,
                            "name": "Owen's Equity",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 5,
                "name": "Accounts Payable (A/P)",
                "description": "Accounts Payable (A/P)",
                "balance": "18491.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 9,
                    "name": "Accounts Payable (A/P)",
                    "account_type": {
                        "id": 5,
                        "name": "Current liabilities",
                        "principle": {
                            "id": 2,
                            "name": "Liability",
                            "calculation_type": "cr"
                        }
                    },
                    "calculation_type": "cr"
                }
            },
            {
                "id": 4,
                "name": "Inventory",
                "description": "Inventory",
                "balance": "88682.75",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 7,
                    "name": "Inventory",
                    "account_type": {
                        "id": 3,
                        "name": "Current assets",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 3,
                "name": "Accounts Receivable (A/R)",
                "description": "Accounts Receivable (A/R)",
                "balance": "2500.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 5,
                    "name": "Accounts Receivable (A/R)",
                    "account_type": {
                        "id": 2,
                        "name": "Accounts Receivable (A/R)",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            },
            {
                "id": 1,
                "name": "Rajib",
                "description": "Test",
                "balance": "431248.00",
                "is_active": true,
                "is_editable": false,
                "account_detail_type": {
                    "id": 1,
                    "name": "Cash and cash equivalents",
                    "account_type": {
                        "id": 1,
                        "name": "Cash and cash equivalents",
                        "principle": {
                            "id": 1,
                            "name": "Asset",
                            "calculation_type": "dr"
                        }
                    },
                    "calculation_type": "dr"
                }
            }
        ],

From this JSON list data I want to filter it by id and show it on an html template! Basically this needs for a edit tasks. when someone click on edit button particular id is passed. like.. when id is 147 I want to print 147's other data like name, description, balance, account details type! And this will be like a single object.

See the belows HTML Format: Here I want to show the data like name, description, balance etc in the value template:

                                 <div class="form-group row">
                                    <label class="col-form-label col-md-2">Name</label>
                                    <div class="col-md-10">
                                        <input type="text" class="form-control" name="name"
                                               value="">
                                    </div>
                                </div>
                               <div class="form-group row">
                                    <label class="col-form-label col-md-2">Description</label>
                                    <div class="col-md-10">
                                        <input type="text" class="form-control" name="desc"
                                               value="">
                                    </div>
                                </div>
                              <div class="form-group row">
                                    <label class="col-form-label col-md-2">Balance</label>
                                    <div class="col-md-10">
                                        <input type="text" class="form-control" name="bal"
                                               value="">
                                    </div>
                                </div>



How to get element height and width from ReactNode?

I have a dynamic component in which I pass in children as prop. So the props look something like:

interface Props {
   ...some props
   children: React.ReactNode
}

export default Layout({...some props, children}: Props) {...}

I need to access the size of the children elements (height and width), in the Layout component. Note that the children are from completely different components and are non-related.

I can use the Layout component as follow:

<Layout ...some props>
  <Child1 /> // I need to know the height and width of this child
  <Child2 /> // as well as this child
  <Child3 /> // and this child.
</Layout>

How can I do so dynamically? Do I somehow have to convert ReactNode to HTMLDivElement? Note that there is no way I can pass in an array of refs as a prop into Layout. Because that the pages which use Layout are dynamically generated.




How to fetch all the webpages using Javascript from the Internet based on the search query?

I just wanna know how to fetch all the webpages from the internet using Javascript and show them up in an HTML page. This is the same like other search engines do, say Google, they fetch the webpages from the internet and show the best webpages using the pagerank algorithm...

I just wanna know how to do the same???




How can I solve mysqli_fetch_assoc(false)? [duplicate]

I have tried and error for several hours, but still can't find how to get the right way, it keeps showing

[::1]:56462 [200]: POST /school.php - Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\Users\ying qi\Desktop\Rate This Uni\school.php:17 Stack trace: #0 C:\Users\ying qi\Desktop\Rate This Uni\school.php(17): mysqli_fetch_assoc(false) #1 {main} thrown in C:\Users\ying qi\Desktop\Rate This Uni\school.php on line 17

Here is the code around line 17

<?php
            $result = mysqli_query($con,"SELECT school_title FROM schools WHERE school_id=$sid"); 
            while($row = mysqli_fetch_assoc($result)) { 
                echo $row['school_title'];}
            ?>

How can I solve it?




Blazor routing and navigation issue, how to add navigation to components, but not not load all new page

I'm trying to add navigation to my components, but not navigating away from the current overall page that I'm on. I'll use Azure Dev Ops web app as an example of this. When in a repo and searching through files, there is a tree view on the left showing the files/folders in that repo. The user can navigate this tree view and click on a file, and on the right it then shows the file. When the user clicks on the file in the tree view and loads the file preview on the right, the url changes each time, but there is no new page. It's not navigating away to a new page, just changing the url, so that there is navigation history and user can use back/forward buttons. Actually, every click and action the user does, changes the URL, like clicking on different tabs on the file preview.

I can mimic the same behavior with having a tree view and the user can navigate it and load a preview on the right of the window, but these are not page components. These are just regular components that get loaded with different data as the user clicks on different files on the tree view. But there is no new changing urls/navigation history. I'm mainly a winforms guy, so learning web dev. So I guess my question is, how do I have child components, that are page components as well? Or is there a way to just add navigation to a component without making it a page component? I've searched everywhere for an answer to this, but not found it. Thank's much in advance!

Image of dev ops page for a better visual




Is using flutter for both mobile and web for a social media platform feasible?

I'm new to flutter and I'm planning to create a social media platform something like Twitter, Instagram, or TikTok. I plan to use flutter for its web and mobile. But from what I can see since Flutter web is still in its early stages is it really achievable/feasible/practical(I don't what term to use) for the platform to only use flutter? Or is it much better to separate the web and mobile like using react/angular for the web and flutter for mobile? Also, Can you also provide what are the pros and cons for both scenarios?




Why doesn't my console show a result with blank window?

The question is simple: why doesn't my console show a result based on the code below? There is no message 'Loaded' in the console after this code has been executed... Seems like 'onload' has interaction problems with 'about:blank' window. Maybe 'about:blank' has permanent 'readyState' property which always describes 'complete'?

P.S. Tested it only in Google Chrome.

<!DOCTYPE html>
<head></head>
<body>
    <script>
        let newWindow = window.open('about:blank')

        newWindow.onload = function() {
            console.log('Loaded')
        }
    </script>
</body>
</html>



models.ForeignKey() in django

Here is my code

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User

class Post(models.Model):
    title = models.CharField(max_length=100)
    content = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)

So I'm kinda confused with what models.DateTimeField(default=timezone.now) do, what does "default" mean here?

And I'm also confused what models.ForeignKey(User, on_delete=models.CASCADE) do, what is "on_delete=models.CASCADE" do and mean?

And is this code ( from django.contrib.auth.models ) a database for users?




Change content after data has been entered into the database

I have a page where the user enters his email address to subscribe to a newsletter. This is then forwarded to a PHP file via an action tag in the form, which then saves it in a database. The page will then be updated.

Now I would like to give the user some feedback that everything went well.

Above the button there is a text with an id = notify- It says something like: Subscribe to our newsletter. Now I want this text to be replaced with something new, but with the same CSS formatting. How do I do that ?




How to increment slot field when booking an appointment

Doctor model

class Doctor(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    qualifications = models.CharField(max_length=100)
    expertise = models.CharField(max_length=100, default='Cardiac')
    fee = models.IntegerField(default=500)
    slots = models.IntegerField(default=0)

    def incSlots(self):
        self.slots = self.slots + 1

Appointment model

class Appointment(models.Model):
    appointment_id = models.AutoField(primary_key=True)
    patient = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    blood_pressure = models.CharField(max_length=10)
    BMI = models.CharField(max_length=10)
    blood_sugar = models.CharField(max_length=10)
    HB = models.CharField(max_length=10)
    platelets = models.CharField(max_length=10)
    date = models.CharField(max_length=30)
    time = models.CharField(max_length=30)
    detail = models.TextField()
    doc = models.OneToOneField(Doctor, on_delete=models.CASCADE)

Appointment view

def appointment(request):
    docname = request.POST.get('doc_name')
    if request.method == 'POST':
        form = AppointmentForm(request.POST)
        if form.is_valid():
            form.doc.incSlots()
            form.save()
            return redirect('success')
        else:
            print(form.errors)
    form = AppointmentForm(initial={"patient":request.user, "doc_name": docname})
    return render(request, 'appointment.html', {'form': form})

I want to increment "slot" field when booking an appointment, I have no idea how to do it, i am new to django, i'll appreciate any help Thank you.




An alternative to store dark-mode information in cookies or local-storage for faster reload

I'm creating a static website to host my notes on the web. On that site, I have implemented a dark-mode feature based on a flag (e.g flag=0 means dark and flag=1 means light). Now, to save the previous browsing theme of the user, I'm saving the flag value in two ways...

  1. Using Cookies
  2. Using LocalStorage

For Cookies, I'm using the following function to extract the flag value...

function getCookie(cname) {
        let name = cname + "=";
        let decodedCookie = decodeURIComponent(document.cookie);
        let ca = decodedCookie.split(';');
        for (let i = 0; i < ca.length; i++) {
            let c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1);
            }
            if (c.indexOf(name) == 0) {
                return c.substring(name.length, c.length);
                document.cookie = "darkflag = 1";
            }
        }
        return "1";
    }

and for localStorage,

function getLS(cname) {
        let val = localStorage.getItem(cname);
        if (val !== null && val !== ''){
            return val;
         }
        else {
                return "1";
                localStorage.setItem("darkflag", "1");
            }
        }

Testing both these ways using local-host works perfectly, but when I've hosted them using netlify ( Site that uses Cookie and Site that uses localStorage ), I'm facing a performance issue in refreshing the webpage after setting the dark mode. It reloads into the light mode, takes a little time (~1.2-1.5 sec) to read the flag data, and displays the correct theme.

How can I remove this issue? Is there any alternative way to store the dark flag data?

Any help/ suggestion is highly appreciable.

Thank you.


P.S. My dark mode function looks something like this...

function darkmode() {
    var darkflag = (getLS('darkflag'));
    var r = document.querySelector(':root');
    if (darkflag == 0) {
        r.style.setProperty('--bg', '#040407');
        r.style.setProperty('--font', '#eee');
        r.style.setProperty('--sidebarbg', '#111');

 and so on...
}



Will Domain Age re-count if I assign it to new instnace/IP?

I'm curios about the domain age.

If I shut down my original server(EC2) and use another instance(maybe GCP or Azure), and assign the same original domain with new IP, will the domain age reset to 0? or it won't be affected?

Thanks!




is auto complete attribute for input tag works without name attribute?

when i use auto complete attribute for input tag , it doesn't work by itself and i should use name attribute . The question is must we use auto complete attribute with name attribute and it doesn't work by itself ? Thank you .




Unable to insert data into database in dyanamic page

I'm creating a website which is for students in university to review their school. Since there are a lot of schools, I need to build a page that can take data from the database to show on the page, at the same time, I also put a form inside it, so they could comment and rate it. I identify each school by its school_id. This is what I'm trying:
This is the code the page before entering the dynamic page:

 <?php 
                $sql = "SELECT * FROM schools WHERE state_id=10001";
                $result = mysqli_query($con, $sql);
                if (mysqli_num_rows($result) > 0) {
                while ($row = mysqli_fetch_assoc($result)) {
                    echo"<form action='../school.php' method='post'><div class='states&school'>
                    <h3><button class='searchedschool' value=".$row['school_id']." name='id'>"
                    .$row['school_name']."</button>
                    </h3>
                    </div>
                    </form>";
                        }
                    }
                    ?>

And this is the code on the second page

 <?php             $sid=$_POST['id'];
                    if (isset($_POST['submit'])) {
                    $nickname=$_POST['user_nickname'];
                    $email=$_POST['user_email'];
                    $comment=$_POST['cmt_text'];
                    $course=$_POST['user_course'];
                    $rating=$_POST['user_rating'];
                    $school_id=$sid;
                    $db="INSERT INTO 
comments(user_nickname,user_email,cmt_text,user_course,user_rating,school_id) VALUES(?,?,?,?,?,?)";
                    $stmt=mysqli_stmt_init($con);
                    if(!mysqli_stmt_prepare($stmt,$db)){
                        echo "Data Error";
                    }else{
                        mysqli_stmt_bind_param($stmt,"ssssii", $nickname,$email,$comment,$course,$rating,$school_id);
                        mysqli_stmt_execute($stmt);
                    }
                    header("location:School.php");
                    exit;
                    }?>

This is the form

<form action="school.php" method="POST" id="myForm" class="form">
                <div class="row">
                    <div class="input-group">
                        <label for="name">Name</label>
                        <input class="typingbox"  minlength="5" type="text" name="user_nickname" id="name" placeholder="Enter your Name" required>
                    </div>
                    <div class="input-group">
                        <label for="email">Email</label>
                        <input class="typingbox" type="email" name="user_email" id="email" placeholder="Enter your Email" required>
                        </div>
                    <div class="input-group">
                        <label for="Course">Course</label>
                        <input class="typingbox" type="text"  minlength="6" name="user_course" id="course" placeholder="Enter your Course" required>
                    </div>
                    <div class="input-group">
                        <label for="rating">Rating (1-5) </label>
                        <input class="typingbox" type="number" min="0" max="5" name="user_rating" id="rating" required>
                        </div></div>
                    <div class="input-group textarea">
                        <label for="comment">Comment</label>
                        <textarea id="comment" minlength="50" class="typingbox" name="cmt_text" placeholder="Enter your Comment" required></textarea>
                    </div>
                    <div class="input-group">
                        <button name="submit" class="btn-btm">Submit</button>
                        <button type="button" class="btn-btm" onclick="closeForm()">Close</button>
                    </div></form>

This is one of the examples of how I present data from database

<h1 class="schoolheading"><?php
                    $result = mysqli_query($con,"SELECT school_name FROM schools WHERE school_id=$sid"); 
                    while($row = mysqli_fetch_array($result)) { 
                        echo $row['school_name'];}
                    ?></h1>

I didn't show the rest of the code because there's too many.

So basically every time I clicked the submit button, the data are not inserted into the database. Then I will be redirected to the same file but not showing any content and says that 'Undefined array key "id". How can I correct it? Or I should make my page the other way, as I'm not sure this is the correct way to make a dynamic page. I'm sure that my files are connected to the database.




Content.js not working in extension but working in chrome console

I am building an extension that gets the total time for a youtube playlist. It can get the video element of the playlist but cannot query each video element to get the time as it returns a null element but the same code works fine in chrome console.

The function in question is the getTime() and the line is timeStringElement = video.querySelector('span#text');

function getTime(){
    let videos = document.querySelectorAll('#playlist-items');
    videos[videos.length-1].scrollIntoView(true);
    let timeHours = 0;
    let timeStringElement;
    let containerElement;
    for (let video of videos){
        timeStringElement = video.querySelector('span#text');
        if (timeStringElement !== null){
            console.log(timeStringElement.innerText);
            timeHours += getHours(timeStringElement.innerText);
        }
    }
    return timeHours;
}
function getHours(time){
    let timeList = time.split(':').reverse();
    let timeHours = 0.0;
    let multiplier = 1/3600;
    for (let timeValue of timeList){
        timeHours += timeValue*multiplier;
        multiplier *= 60;
    }
    return timeHours;
}

window.onload = function(){
    let url = window.location.href;
    if (url.indexOf('list=') !== -1){
        let hours = getTime();
        console.log(hours);
    }
}



How to apply css only to clicked menu wehn menu click?

<div id="schedulelist" class="list-group">
         <label class="sclist" for="sclist">List</label>
         <input id="sclist" type="checkbox">
         <c:forEach items="${datelist}" var="list" varStatus="status" >
             <a href="#" class="list-group-item list-group-item-action active py-3 lh-tight"
                aria-current="true">
                 <div class="d-flex w-100 align-items-center justify-content-between">
                     <strong class="mb-1">${"Day"} ${status.count}</strong>
                     <small>${list}</small>
                 </div>
                 <div class="col-10 mb-1 small">${city.name}</div>
             </a>
         </c:forEach>
     </div>

Above is my code. When 1day is clicked, I want to change the background color corresponding to 1day's div to red.

And when 2day is clicked, I want to return the color of 1day back to blue and change the background color to red only for 2day.

How can I do this?




Getting Flask Error GET html 404 constantly

All of my .html files are present in templates folder.

I'm getting a 404 error on one particular file called tour.html

I have defined its route as:

@app.route('/tour1.html')
def tour1():
    return render_template('tour1.html')

Full Error is

"GET tour1.html HTTP/1.1" 404

Additionally, the linking works fine when I run on VS Code Live Server, so no issue in html files.




What is HTTP status response for checking regex match false

Assume I have this line:

match, _ := regexp.MatchString(template.Validation, userConfig.Value)

match = false

What should I return HTTP status response?




jeudi 29 juillet 2021

How to access the variables inside a function imported from another page in React?

My goal is to send a large string or an obj to another page on clicking a card. I tried sending the string through Link. But it can't be done since it has more than 4000 characters. So I decided to store the string to a variable inside a function on clicking the card and export the function to the other page. I successfully did it. My question is that: How can I access the variable inside the imported function on the other page?

I tried const {variable} = importedFunction(). But when i console logged the variable, it says undefined.

Page-1

export const handleClick =(obj)=> {
  const objVar= obj  
} 


Page-2

import handleClick from '../../NewsWithSidebar/NewsWithSideBar'

function Single() { 

 const {objVar}= handleClick()
 console.log(objVar) /*(but the console is showing undefined)*/

);




Is there a way for a browser / web-application to access and read files in a given folder on local file system (vs requiring user to upload folder)

I would like our web-application to read images from our user's selected folder. The current UX is that the user must upload the folder of images, which takes an unacceptable amount of time, so we'd like to not require uploads. We're currently using the FileSystem API.

My hunch is that this is not doable with a web-app. If that's true, my next question is... can it be doable if it was a progressive web-app? What about an electron desktop app?

Thanks in advance




How to create simple document library website with search?

I have over 10,000 PDF files (all useful articles Ive compiled under various topics). I want to have them all on a website so that anyone can simply search for the file name and get it.

Is there any easy way to build it fast as it's not practical to link over 10,000 files individually.

One option I'm exploring is simply uploading all docs to Google Drive and embedding that to the website. However, that wouldn't allow for search within the drive. Alternatively I found Steagle - but it is too expensive and I am looking for a free or cheap/affordable solution.

Thanks in advance.

Please note: My knowledge on web development is very minimal, I only know basic HTML and have built websites using mobirise, wix, Google Sites etc.




In Angular, makeDecorator use noSideEffects. What will be the impact if this noSideEffects is not used?

Here is the code.

export function noSideEffects<T>(fn: () => T): T {
  return {toString: fn}.toString() as unknown as T;
}



How to bold day for multiple hour tables?

I currently have this code which highlights the day for an hours table that I have. It does this job properly for the one table, but not for the others. I have 4 tables in total on this page and need it to bold the day for each of them.

<script>
        var days = 'sunday,monday,tuesday,wednesday,thursday,friday,saturday'.split(',');
        document.getElementById( days[(new Date()).getDay()] ).className = 'pw-bold';
</script>
<table style="width: 100%; margin-bottom: 50px;">
    <tbody>
        <tr>
            <th class="pw-table-header">Hours</th>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="sunday">Sunday</div>
            </td>
            <td class="pw-table">Closed</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="monday">Monday</div>
            </td>
            <td class="pw-table">7:00am - 4:00pm</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="tuesday">Tuesday</div>
            </td>
            <td class="pw-table">7:00am - 4:00pm</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="wednesday">Wednesday</div>
            </td>
            <td class="pw-table">7:00am - 4:00pm</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="thursday">Thursday</div>
            </td>
            <td class="pw-table">7:00am - 4:00pm</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="friday">Friday</div>
            </td>
            <td class="pw-table">7:00am - 4:00pm</td>
        </tr>
        <tr>
            <td class="pw-table">
                <div id="saturday">Saturday</div>
            </td>
            <td class="pw-table">Closed</td>
        </tr>
    </tbody>
</table>
.pw-bold{font-weight: bold;}



How can you iterate through the list of websites in the search engine in Python?

When you search something on your browser it will give you by default a list of websites related to the search that you have done, but I was wondering if there was a way to store/print/iterate the list of urls shown in that main page.

I haven't tried anything because I don't even know which python library should I use.

Which library should I use for this puprose?

I hope that it is a valid question.




Why CSS is not working on my GitHub pages

https://github.com/Leevance-singh/tech

CSS is not working on my GitHub pages and I've searched more than 40 forums and solutions but still can't get it working.my href is correctly pointed towards CSS file but still can't see changes live on website




A request not appearing on Firefox dev tools Whatsapp web

I was using Whatsapp web and wanted to know how messages are sent. I opened the network tab in Firefox dev tools, then sent a message to my friend. The message was sent, but nothing appeared on the network tab.

Why couldn't I see that a request has been sent?




Easiest way to serve out an HTML5 canvas?

this is a beginner question for web folks. I've never served out a web page, but I've prepared a data presentation using an HTML5 canvas (I wanted it to be interactive and viewable anywhere; the canvas works great), within an HTML file. It's in an HTML file that I can double click on, and it opens in a browser and does what I want it to do.

What's the easiest/best way for me to put this on the web so that I can send out a URL to anybody and they can view it? Please keep it simple, because while I'm competent at software development I haven't the foggiest about web stuff. :) Thanks!




How to write web scraping for below scenario? [closed]

Suppose we have to scrape bookmyshow.com then we have to perform 3 tasks given as below:

1)When click on any navbar items we haveto console log name of that item

2)When click on movies then console log name of that movie

3)console.log item that is searched in search bar

How can we do web scraping for above scenario in javascript/nodejs?




Move mapped object from one array to another in React

Hello I have mapped array like this and I need to move objects based on ean which user input to another array

      const transformedData = data.order_items.map((invoiceData) => {
        return {
          ean: invoiceData.ean,
          name: invoiceData.name,
          count: invoiceData.count,
        };
      });

I have tried something like this, but every time I try to add another object it always overwrite the existing one. And I am also not able to remove it from transformedData array

const filteredExpeditionProducts = expeditionProducts.filter(
      (order_item) => order_item.ean.toString() === enteredEan
    );
      filteredExpeditionProducts.map((invoiceData) => {
        return {
          ean: invoiceData.ean,
          name: invoiceData.name,
          count: invoiceData.count,
        };
      });

I would appreciate any help




How to get my colleagues' birthday from company’s website?

I'm very shy type and afraid of asking her when's her birthday. Like you know, A bit eagerness blossomed in me and luckily on our company's website there's a column named "daily announcements".

Some important announcements, staffs' birthdays and wedding anniversaries of that day would be mentioned there. Now the problem is should I wait for one long year (maximum) to find her birthday or is there any other way to retrieve the data from company's website?




Failed web deployment

I have already uploaded war file in the tomcat, in the running section, it said running (false) and trying to start running, I got this error message FAIL - Application at context path /example could not be started please anyone to help me on this

Am using tomcat version 7 and jdk version 8




Angular 11: can't use query parameters

When I try to go 'localhost:4200/reset-password?token=asdsadas' Angular changes url to just 'localhost:4200/reset-password', so, I am not able to get query parameters from code.

Here is my routing settings:

const routes: Routes = [
  { path: '', redirectTo: '/register', pathMatch: 'full' },
  {
    path: 'login',
    component: LoginComponent,
    canActivate: [AnonymousGuard],
  },
  {
    path: 'register',
    component: RegisterComponent,
    canActivate: [AnonymousGuard],
  },
  {
    path: 'application',
    component: ApplicationFlowComponent,
    children: applicationFlowRoutes,
    canActivate: [AuthGuard],
  },
  {
    path: 'qflow',
    loadChildren: () => import('./questioneer-flow/questioneer-module.module').then((x) => x.QuestioneerModuleModule),
  },
  {
    path: 'reset-password-mail',
    component: ResetPasswordMailComponent,
  },
  {
    path: 'reset-password',
    component: ResetPasswordComponent,
    canActivate: [RequiredQueryParamsGuard],
    data: {
      requiredQueryParams: ['token']
    },
  },
  {
    path: 'oflow',
    component: OverviewAppFlowComponent,
  },
  {
    path: 'decline',
    component: DeclineComponent,
  }
];



setTimeout doesn't work on first time in dropdown menu

i wanted to add a hover delay on dropdown menu link, that after a 1sec it opens another dropdown with another links, it adds a class with display:block on hover. My js code works fine, except! it won't display another submenu on the first time.

Scenario:

  1. Entering the page
  2. Hover on menu to see submenu
  3. Hover on submenu link to see another submenu, it should show after a 1 second
  4. It doesn't show
  5. Repeat point 3. and it actually works.
 const flyoutSubEl = this.el.querySelector(`[${this.options.megaMenuSubId}='${flyoutSubId}']`);
        const flyoutSubTriggerEl = this.el.querySelector(`[${this.options.megaMenuSubTrigger}='${flyoutSubId}']`);

        if (flyoutSubEl.classList.contains(this.options.menuActive)) {
            if (this.eventTrigger == 'click') {
                this._closeAllFlyoutsSub();
            }
        } else {
            let timer;
            flyoutSubTriggerEl.addEventListener("mouseenter",()=>{
                timer = setTimeout(()=>{
                    this._closeAllFlyoutsSub(this.options.menuActive);
                    flyoutSubEl.classList.add(this.options.menuActive);
                }, 500);
            })
            flyoutSubTriggerEl.addEventListener("mouseleave",()=>{
                clearTimeout(timer);
            })
            
        }

Does anyone have a clue about why is this code not working on the first time? Console isn't showing anything usefull, if the dropdown should be on display:block from the beggining, then why is this working on second time?

Thanks for help!




Does anyone know how to read a file From Line X to Line Y in nodejs? [duplicate]

Lets say i have a file like

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Of course this is not the real file, If it was i would have just made an array, the file is a space separated file that is very large about 2,000-10,000 lines, and i want to get chunks of it, starting from line x to line y.

Here each number representing a new line, can you in nodejs(in backend) read a file starting from line lets say 15 and ending at 19. There seems to be no native way to do this, nor any questions asked previously on the subject on stack overflow or github.




I listed my wordpress website in hostinger but its look is different from original website when it is opening

enter image description here

It's a original look for current look you can visit skyhometutor.com and one more thing parents enquiry form on parent page is not opening




sticky position not working for viewport height less than 500px

I am having a strange problem with the sticky position in CSS. I want an element to stick to the bottom of the page and it is working perfectly if the viewport height is greater than or equal to 500px but if it is reduced any further then the element no longer sticks to the bottom of the page

This is how the sticky element looks like

 .sticky{
    position: sticky;
    bottom: 0;
    top: 90%;
    display: flex;
    height: 50px;
    width: 100%;
    justify-content: center;
    align-items: center;
    background: var(--tl-dark-theme);
}

This is the container of the sticky element

section {
    height: 100%;
}



mercredi 28 juillet 2021

I Got This Error While Uploading Image to a Local Folder (index):7146 crbug/1173575, non-JS module files deprecated

I am Trying to Fetch an Image File from Local Computer and upload to another Folder Local to the Source Code So I can use that Image File in my Project While I got This Error or Can you Suggest Another Method for the Same

Here is the HTML File

    <form action="upload.php" method="post" enctype="multipart/form-data">
        <input type="file" name="file" id="file" multiple="multiple" />
        <input type="submit" value="Upload" />

    </form>

This is the PHP File

<?php
$filename= $_FILES['file']['name'];
$location= "upload/".$filename;
if(move_uploaded_file($_FILES['file']['tmp_name'],$location)){

    echo '<p>File Uploaded Successfully</p>';

}
else{

    echo '<b>Error</b>';
}

?>



How to configure dynamic environment variables for JS that will run in browser?

I have a requirement where system environment variables that we can get at server side (using process.env.BLABLA in Node.js) need also be injected in the pre-built JS file that will be served to the browser. The UI is made using Angular.

I have thought of three ways as of now in my mind :-

  1. an API call to /api/config to get these environment variables and using them.

  2. Let's say we have certain placeholder variable names in our JS files which will finally get bundled and served to browser. Before serving the bundled js file say , bundle.js, we replace those placeholders with the environment variables. The only thing is that bundle.js is quite huge (can't split it yet) and reading and writing might delay server start. Also don't know if this should be advocated.

  3. We can dynamically generate another file, say, config.js (at server startup) with the dynamic environment variables and a logic to store them in sessionStorage when loaded in browser. This file will be loaded via separate script tag in the index.html before bundle.js and then in bundle.js there would be logic to derive the environment variables using sessionStorage. The only thing here is that a person can see these variables using the dev tools. As of now, I don't think that's a concern. Also if the user resets sessionStorage to any other values, it shouldn't matter as the values would already be set and used at load time and cleared at the unload event.

What are some good ways to go about this ? The first one is quite simple but I want to prevent a request after bundle.js execution.




what is the differences between react, open graph and bootstrap

I'm kinda new, so I really need some help to get started. I don't even know the differences between all of those mentioned above. Which one is better and when do I need to use them.




OkHttp not sending tokens

I have OkHttp & Cookiejar handling all cookies. The instance of my client loads a login page, then responds with credentials and I get a 200 response with 4 cookies:

CONTOSO_USER
CONTOSO_INSTANCE
CONTOSO_ANALYTICS
JSESSIONID

The issue is that when I make subsequent requests to the server it appears its only sending JSESSIONID and CONTOSO_USER.

I am my client setup is:

   // COOKIE STORE
    CookieStore cookieStore = cookieManager.getCookieStore();

    // COOKIE JAR
    CookieJar cookieJar = new CookieJar() {
        private final HashMap<String, List<Cookie>> cookieStore = new HashMap<>();

        @Override
        public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
            cookieStore.put(url.host(), cookies);
        }

        @Override
        public List<Cookie> loadForRequest(HttpUrl url) {
            List<Cookie> cookies = cookieStore.get(url.host());
            return cookies != null ? cookies : new ArrayList<Cookie>();
        }
    };

    // NEW CLIENT
    OkHttpClient client = new OkHttpClient.Builder()
        .addNetworkInterceptor(new LoggingInterceptor())
        .cookieJar(cookieJar)
        .build();
        
        // REQUEST TO LOGIN TO WEBSITE AND RECEIVE COOKIES

And then I can print the 4 cookies describe above with:

    for (Cookie cookie : cookieJar.loadForRequest(loginUrl)) {
        System.out.println("\n Cookie:" + cookie.name());
        System.out.println("\t Domain:" + cookie.domain());
        System.out.println("\t Value:" + cookie.value());
    }

Yet when I create a new request with:

    Request quickFind = new Request.Builder()
            .url(quickFIndUrl)
            .post(RequestBody.create(MediaType.parse("text/x-markdown"), postBody))
            .build();
     System.out.println(" Headers : " + quickFind.headers() +"\n") ;

It only sends JSESSIONID and CONTOSO_USER.

Why?




hey guys can you help me whit my react project (lay n3atabon mkom) [closed]

enter image description here

enter image description here




How do I export these function stored in const

import React from 'react';

const stories = [ { title: 'React', url: 'https://react.js.org/', author: 'Jordan Walke', num_comments: 3, points: 4, objectId: 0, }, { title: 'Redux', url: 'https://redux.js.org/', author: 'Dan Abramov, Andrew Clark', num_comments: 2, points: 5, objectId: 1, }, ];

const App = () => { return (

My React

    <label htmlFor="search">Search: </label>
    <input id="search" type="text" />

  <hr />
  <list />
</div>

); };

const List = () => { return stories.map(item => { return ( {item.title} {item.author} {item.num_comments} {item.points} ); }); };

export default App; // export default App;




How can I make this text and image not overlap

I know this looks very simple, but I have been trying to figure out a solution for an hour now. I have an "a" element with text and an image inside. The problem is that the image goes below the text, and I want them lined up.

HTML code:

 <!-- Header right part --> 
            <div class="dropdown">
                <a>
                    User123
                    <img src="Images/Icons/user.svg" id="nav-user-logo" alt='User123'>
                </a>
                <div class="dropdown-content user-dropdown-content" >
                    <a>AW Admin</a>
                    <a>Account Settings</a>
                    <a>Change Password</a>
                    <a>Logout</a>
                </div>
            </div>

Relevant CSS:

a {
    text-decoration: none;
    color: #fff;
}

a:hover {
    color: #ff5c33;
    text-decoration: none;
    cursor: pointer;
}

#nav-user-logo{
    max-height: 16px;
}



Lighthouse Mobile scores does not cross 90 (currently ~85). https://ift.tt/3zFHke6. Struggling from the past few days how to get this right

Mobile scores does not cross 90. The reason given: the main-thread work. But, I've even reduced the components being displayed by using "display: none" for certain section on mobile. Despite that doesn't alter at all. What should I be doing? The following link will yield the scores:

https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fwww.skylarkinfo.com%2F




Can you use array in javascript without initializing it? [closed]

Ok so I have a code like this, you can skip most of it, I will mark the important part.

const Author = require('./../models/author.model');
const Book = require('./../models/book.model');
class BookRepository {
  constructor() {
    this.seedRepo();
  }
  addBook(title, author, language, publisher, ISBN) {
    this.books.push(
      new Book(title, author, language, publisher, ISBN)
    );
  }
  addAuthor(firstName, lastName, DOB, gender) {
    let newId = this.authors[this.authors.length - 1].id + 1;
    let newAuthor = new Author(newId, firstName, lastName, DOB, gender);
    this.authors.push(newAuthor);
    return newAuthor;
  }
  getLanguage(lang) {
    let language = this.languages.find(l => l.abbrev === lang);
    return language && language.langName || 'unknown?';
  }
  getAuthor(id) {
    for (let a of this.authors) {
      if (a.id === id) return a;
    }
    return null;
  }
  /************ Seeding repo below: ****************/
  seedRepo() {
    this.seedAuthors();
    this.seedBooks();
    this.seedLanguages();
  }
  seedAuthors() {
    this.authors = [];
    this.authors.push(new Author(100, 'Steve', 'McConnel', new Date('1965-07-10'), 'm'));
    this.authors.push(new Author(101, 'Douglas', 'Crockford', new Date('1955-01-01'), 'm'));
    this.authors.push(new Author(201, 'Douglas', 'Adams', new Date('1952-03-11'), 'm'));
    this.authors.push(new Author(202, 'Sylvia', 'Plath', new Date('1932-10-27'), 'f'));
  }
  seedBooks() {
    this.books = [];
    this.addBook('Code Complete', this.getAuthor(100), 'en',
      'Microsoft Press; 2nd edition',
      '0735619670'
    );
    this.addBook('JavaScript: The Good Parts', this.getAuthor(101), 'en',
      `O'Reilly Media`,
      '9780596517748'
    );
    this.addBook(`The Hitchhiker's Guide to the Galaxy`, this.getAuthor(201), 'en',
      'Del Rey; Reissue edition',
      '1535185554'
    );
    this.addBook(`The Bell Jar`, this.getAuthor(202), 'en',
      'Harper Perennial Modern Classics;',
      '0060837020'
    );
  }
  seedLanguages() {
    this.languages = [{
      abbrev: "en",
      langName: "English"
    }, {
      abbrev: "hr",
      langName: "Croatian"
    }];
  }

}



const repoInstance = new BookRepository();

module.exports = repoInstance;

https://www.codepile.net/pile/k8RkQvWN

how can we use array authors and books without initializing it?

Thank you!




Make multiple pages in ReactJS without using react-dom-router

I am a begginer in ReactJS web development and I wanted to ask, how can I make multiple pages in ReactJS (for example if I click on a button called "About me" that it will redirect to a different part of the whole site, for exaple example.com/aboutme) without using react-dom-router?

I don't want to change much in the codes because I already use my App.js as the main page.




Can someone explain me this codes logic?

i have this piece of code and i cant figure out what it's trying to accomplish with its logic. It's just the cases "-1" and "1".

Some Context:

  • This is part of a function, which resizes images for a webpage.
  • We have the dimensions of the original image and desired sizes, which are given as arguments.
  • It is possible that the desired size is just a width or just a height, in either way the empty value will be replaced with the original width/height.

I am trying to rewrite the code..

If it does matter, this is coldfusion and "arguments", "local" and "variables" are scopes, kind of namespaces, where variables can be stored.


arguments.width = isNumeric(arguments.width) ? arguments.width : variables.getOrgWidth();
arguments.height = isNumeric(arguments.height) ? arguments.height : variables.getOrgHeight();


switch (arguments.ratio) {
 case "-1":
      // What does this do?
      if ((variables.getOrgWidth() / arguments.width) LT (variables.getOrgHeight() / arguments.height)) {
           local.targetSize = "#arguments.width#"
      } else {
           local.targetSize = "x#arguments.height#"
      }
      break;

 case "0":
      // Force desired width and heigth, even if its distorts
      local.targetSize = "#arguments.width#x#arguments.height#!"
      break;

 case "1":
      // What does this do??
      if ((variables.getOrgWidth() / arguments.width) GT (variables.getOrgHeight() / arguments.height)) {
           local.targetSize = "#arguments.width#"
      } else {
           local.targetSize = "x#arguments.height#"
      }
      break;

 case "2":
      // transform dimensions based on desired width, the height will be calculated
      local.targetSize = "#arguments.width#"
      break;

 case "3":
      // transform dimensions based on desired height, the width will be calculated
      local.targetSize = "x#arguments.height#"
      break;
}
   



can't login on page using Jsoup

I wanna login on Website and take some information from it. I use library of Jsoup. And it doesn't work. I tried to get some cookies, but they are null, because of it happens problems. [error][1] [1]: https://ift.tt/2UVjg8g

I tried to try different code.

        org.jsoup.Connection.Response test = Jsoup.connect("https://school4yalta.eljur.ru/authorize")
            .data("username", "username")
            .data("password", "password")
            .data("return_uri", "/journal-user-preferences-action/")
            .method(Method.POST)
            .execute();

    System.out.print(test);

and: [response][2] [2]: https://ift.tt/3lbyTU5

I looked all thing what I can, but anything don't work. Please, help me. Sorry, if I made mistakes' sentence




URL Parse NodeJS Deprecated. How to parse relative url?

I know that the same question already exists, but I don't have enough reputation to leave there a comment, so my only option is to ask again.

I am only a beginner in Node.js(bought Udemy course yesterday), so my routing is literally a bunch of if's.

Problem: url.parse is deprecated.

The problem I bumped into with answer on that question, is that to use new URL() it is important to know the exact website absolute path, which means I have to hardcode it and it is impossible to use just relative URL. (lol)?

Inside http.createServer function I have const { query, pathname } = url.parse(req.url, true);, which is supposed to give me exact path, on which I base my routing (e.g. for the website http://127.0.0.1:8000/product?id=0 I get returned query = {id: 0} and pathname = /product).

I thought to use querystring.parse, but it is also deprecated.

My code in case:

const http = require("http");
const url = require("url");

const server = http.createServer((req, res) => {
  const { query, pathname } = url.parse(req.url, true);
  console.log(req.url); // http://127.0.0.1:8000/product?id=0 => /product?id=0

  // Overview page
  if (pathname === "/" || pathname === "/overview") {
    res.writeHead(200, { "Content-Type": "text/html" });

    res.end('<h1>Overview page!!!</h1>');

    // Product page
  } else if (pathname === "/product") {
    res.writeHead(200, { "Content-Type": "text/html" });
    res.end('<h1>Product page!!!</h1>');

    // Api page
  } else if (pathname === "/api") {
    res.writeHead(200, { "Content-Type": "text/html" });
    res.end('<h1>Api page!!!</h1>');

    // Not found page
  } else {
    res.writeHead(404, { "Content-Type": "text/html" });
    res.end('<h1>Page not found!</h1>');
  }
});

server.listen(8000, "127.0.0.1", () => {
  console.log("Server started on 127.0.0.1:8000");
});



How to preview AVI/MKV video file on my web

I am creating my home web server movie database. On the site, you can click on certain movies to play them. I know that <video> tag can play MP4/OGG/WebM but most of my movies are .avi or .mkv which <video> tag does not support.

My question is how to implement these avi/mkv files on my web?

Can I convert them somehow in my HTML/JavaScript code into MP4?

Thank you.




How to get Bitcoin investment website script

I'm trying to develop a bitcoin investment website and I need help with script to enable me complete the work. Can anyone assist me?




Java web application deployment on AWS

We are starting a Java restful web application. My responsibility in a team is to deploy the app on AWS server. What services do I need ? I suppose that there must be a storage for images, a DB (PostgreSQL), an HTTPS certificate from AWS. Can you provide step by step information source ?




Unable to find the issue in Angular 6 version application [closed]

enter image description here

"@angular/cli": "~6.0.8",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"

Unable to find this issue, not getting every time, randomly getting this error. Please can anyone help me out to resolve this one.

This is the error text and here I changed actual domain name with dummy name like Domain-Name.

ERROR https://Domain-Name/main.9b653922ba691a181429.js:1:502993/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:502210/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:499407/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:490423/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:489739

ERROR https://Domain-Name/main.9b653922ba691a181429.js:1:502993/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:502210/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:499407/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:490423/nhttps://Domain-Name/main.9b653922ba691a181429.js:1:489739



create a cart that saves data with localstorage

hi i can't archive data with localstorage. I am making a shopping cart and I would like that when I change the page or reload the page I do not reset the cart, but the products inside it are kept. how can I do ? I tried to use the localstorage function but I can't figure out where to put it

my vuejs code, thanks

 data() {
  return {
    products: [
      {
        id: 1,
        name: 'Product 1',
        description: 'This is an incredibly awesome product',
        quantity: 0,
      },
      {
        id: 2,
        name: 'Product 2',
        description: 'This is an incredibly awesome product',
        quantity: 0,
      },
      {
        id: 3,
        name: 'Product 3',
        description: 'This is an incredibly awesome product',
        quantity: 0,
      }
    ],
    showCart: false
  };
},

computed: {
  cart() {
    cart = JSON.parse(localStorage.setItem('cart')); 
    return this.products.filter(product => product.quantity > 0);
  },
  totalQuantity() {
    return this.products.reduce(
      (total, product) => total + product.quantity,
      0
    );
  }
},

methods: {
  updateCart(product, updateType) {      
    for (let i = 0; i < this.products.length; i++) {
      if (this.products[i].id === product.id) {
        if (updateType === 'subtract') {
          if (this.products[i].quantity !== 0) {
            this.products[i].quantity--;
            saveCart();
          }
        } else {
          this.products[i].quantity++;
          saveCart();
        }
        break;
      }
    }
  },

  saveCart() {

    localStorage.products = JSON.stringify(products);
  }

}



Angular equivalent of JQuery selectors

I want to invoke a method on click of any div with a given class. In JQuery it was a trivial one liner. Do we have something similar in Angular?




How To set X Frame Options in Python Falcon Application?

I have to set in my app X - Frame Options to prevent clickjacking, how to do this in Python Falcon framework? As far as I know it must be done on backend side, probably in falconapp.py




How do I make my website acceptable for SEO

So I have a custom website and I've been getting SEO done for the past 6 months and there is no progress on My website and I don't even know how to get it solved now I am getting services done from Web design company in Alexandria VA for my website and I am seeing the improvement in my website. Hope it will get better because i have invested my all savings on this.




My web application show null reference in cookie value in one page in case of IE Browser but not Crome or firefox .Give any solution

From login page it goes another page after that it goes home page where it shows null reference error in IE browser.




Javascript scrolling effect

So recently I've been struggling to obtain a scrolling effect similar to the one on this website: https://studiothomas.co.uk/

I've tried using wheel event listener, but a huge problem comes when the scrolling is made with a laptop touchpad. It works good and fine with mouse wheel though.

So my question is, do you have any advice to solve this problem?

Thanks




How do i assign a class to a html image with css?

This is the html part:

.bild{
  height:100px;
  width: 100px;
}
<div class = "wrapper">
    <img class = "bild" src="https://placeholder.com/wp-content/uploads/2018/10/placeholder.com-logo1.png" alt="the google logo" > 
</div>

They do not seem to "understand" each other, as the image does not change.




Flutter Web - How to get network time?

I'm working on an app that is highly dependent on the date. Since user can change DateTime.now(), I'd like to access time from a server.

Unfortunately, the package https://pub.dev/packages/ntp is not available for web. What are the alternatives for web?




mardi 27 juillet 2021

Dailymotion Data API for Searching

How can I use the Dailymotion data API to develop a Web application that retrieves Dailymotion videos based on tags? Please provide a roadmap and guide me.

PS: A beginner to the platform




Can I use Google's Public Time Server for getting time stamps at a very high rate?

I actually needed to get timestamps for very fast-changing values in a firebase database. I need the timestamp each time I change. like a live data feed. If I use Google's time server, will it cause any problem? I mean is there any usage limit for using their time server?




firebase hosted react app returns "you need to enable JavaScript to run this app"

I have a web app made with react which is hosted via firebase hosting, and a backend server using express hosted on cloud functions.

Website: https://studyi.co/

The landing, login and signup pages work as expected, but on any route with /app/{route} (e.g /app/dashboard), a blank page is returned and the request returns "you need to enable javascript to run this app"

Everything here works on dev server, where the react website was started with npm start, and communicating to cloud functions by firebase.

Any idea why?

I am new to web development, let me know if I can provide anything else.

enter image description here

Blank Page Returned from /app/about (This should just render 2 lines of text)




The Server encountered an internal error and was unable to to complete your request. Either the server is overloaded or there is an error in the app

I have Python flask web application and we have an admin and normal view. Normal view is still working and admin view it was working up to last week, but this week all of sudden its stopped working. We have not modified any of the code and we have not changed/modified configurations:

Configurations:

  1. we are using apache http server and redirecting to the wsgi scripts.
  2. Python version: 2.7.5 and 3.6.8
  3. Flask version '0.10.1'
  4. Linux CentOS 7

Tried below Workaround to bring back the application, but still we are getting the same error as "The Server encountered an internal error and was unable to to complete your request. Either the server is overloaded or there is an error in the application". So, Please help/suggest me on this issue.

  1. Restarted Linux server.
  2. Restarted Web Server.
  3. Re-deployed the application.



How to paste text in a DIV text area using SELENIUM and Python

I am trying to send some text to the text box. The problem is that when the text is short(small) it works, but when the text is long(big) it doesn't work. Please, I have pasted my code below. Let me know what I am doing wrong

from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()
driver.get("https://editor.swagger.io/")


# when we read swagger file from excel will put it here

swagger = '{"swagger":"2.0","info":{"title":"test api *************************************}'

#fetch the box for the swagger input
editor = driver.find_element_by_class_name("ace_text-input")
#
# #clear it
editor.clear()
# #send the swagger we want to convert
editor.send_keys(swagger)```



MongoDB :Auth mechanism not specified Error for specific Project

We running 2 web .net project on same Pc and connecting to same Mongod server . first and second project connect to same database.

First project with authorization connection string working fine without connection issue but Second project with same authorization string giving Auth mechanism not specified error if I specified any auth mechanism then it giving Unsupported MongoAuthenticationMechanism SCRAM-SHA-1 error

This is happen only for second project , not issue with first project I am sure that

  1. both mongod server and shell version match
  2. same connection string for both

but why it giving issue for second project only. what would be possible project level issue? any idea.

Please help for this




JSOUP: Not catching the tag

Not catching the tag img inside four div tags. This is issue in details here at github




Spring - alternative way to have request context in child thread

In java application using spring I'm facing situation when I need to create asynchronous REST endpoint for some small data processing.

I.e. current idea is:

  • we got request for processing
  • as soon as we verify it could be processed we return 200 OK
  • at the same time we create child thread in which processing will run

Child process is used because we need to have Request / Session in that processing thread (because current user should be checked and recorded during processing - due to legacy code it's hard to do before).

I use solution found on StackOverflow and it works like a charm.

However some of colleagues on review regard it "insecure" to enable inherited request context on all thread. Thus I'm looking for other possible approach.

What I tried is to share request attributes to child thread manually:

    var attrs = RequestContextHolder.getRequestAttributes();
    new Thread(() -> {
        RequestContextHolder.setRequestAttributes(attrs);
        // ...
    });

This partly works, but only till response is sent in parent thread. After this I get exception with explanation Cannot ask for request attribute - request is not active anymore!

I tried to specify that parent's attributes are inheritable - but this doesn't help:

    var attrs = RequestContextHolder.getRequestAttributes();
    RequestContextHolder.setRequestAttributes(attrs, true);  // inheritable
    new Thread(() -> {
        RequestContextHolder.setRequestAttributes(attrs);
        // ...
    });

(I got error saying that I have no active request, If I'm not wrong - tried few more similar variations)

So any further hints are welcome (or explanations of my mistakes). Thanks in advance!




Convert a JSON file to an array in javascript to visualize the data in ChartsJS

I have a JSON file with a lot of temperatur data meassured every quarter hour and saved into a object in the file.

{"Temp_12:0": "26",
"Temp_12:15": "20",
"Temp_12:30": "25",
"Temp_12:45": "25",
"Temp_13:0": "26",
"Temp_13:15": "25",
"Temp_13:30": "26",
"Temp_13:45": "26"}

This is how the data is structurised in the file. I want to display the display the data on a webserver in my local network with ChartsJS. The Problem is that I don't have an idea of how to parse the data so that I can display it.

I want to parse the JSON Objects into an 1D array so it would be easy for me to visualise them.

I would be hapy if anyone here can help me with my problem because I'am relatively new to JavaScript.




send message from website to messaging platform like telegram,gmail,or whatsapp

I want to send messages to messaging apps from my website. For example when user x clicked the place order button then my website needed to send some text message to the given deliverer’s number or id. I can use messenger telegram gmail viber whatsapp as my messaging platform. And i like to use MEVN stack or LAMP stack for this website.is that possible and how can i do it.