Why does header shrink after getting vue js build?

It was a very silly thing. In localhost, my header component looks quite normal, but after rendering everything on the page stays in the same design, the header gets smaller.

I’m working on netflix clone project, why is my header design getting smaller while everything is building properly on the page?

I did not interfere with the header in any way as javascript. Why did such an event happen to me when I was only standing as a component?

How can I allow users on my site to list their NFTs for sale?

I have an existing e-commerce website and we are implementing Web3 capabilities to the site. Our users are given exclusive NFTs built on Solana and we want to allow them to list them for sale in our own Digital Asset marketplace. When a user goes into their profile they’re able to see all the NFTs they have acquired. When they want to list one of them for sale, they click on the item and click a “Add To Marketplace” button. If their wallet isn’t already connected it will ask them to connect their wallet. Once the wallet is connected… I don’t know what to do.
How do I create this transaction that allows the owner of the NFT to list it in our marketplace?

Sort DataTable – show selected rows first

I am using the table-plugin for jQuery DataTables to display a HTML-Table. In addition I am using the Select-Plugin which allows to (multi)select table rows. As a user select a row, the class “selected” is added to the <tr> element:

<tr id="tr_1" class="odd selected">

How can I sort the rows, that the selected rows are shown first? This would improve clarity, especially with many rows or pages provided by DataTable.

import web3 into react js getting BREAKING CHANGE: webpack < 5 used to incl

I am having problems with importing web3 into reactjs. To replicate my problem, initiallize a new react app as so

npx create-react-app my-app
cd my-app

then open terminal in this location. Write:

npm install web3
npm install

in the App,js file add the following line

import Web3 from "web3"; 

I got the error after I do npm start then I got the unsolved error which is

Module not found: Error: Can't resolve 'stream'

Module not found: Error: Can't resolve 'crypto'

I tried finding a solution online, in particular I tried each of

  1. How to Polyfill node core modules in webpack 5
  2. https://www.youtube.com/watch?v=u1PPNIBvQjk
  3. Importing web3 causing a problem in react js
  4. https://github.com/facebook/create-react-app/issues/11756#issuecomment-1001162736
  5. https://namespaceit.com/blog/how-fix-breaking-change-webpack-5-used-to-include-polyfills-for-nodejs-core-modules-by-default-error
  6. How to create React App including Web3 using create-react-app? I am getting Module not found Error. BREAKING CHANGE: webpack < 5 used

None seem to work with me. Is there any advice on how to solve this problem?
Thank you!

Is it possible to change the message within a repeating IOS notification in react native?

I’m currently working in react native for the first time, trying to create an iPhone app. it’s been going well so far, but I’ve come across a slight limitation that I’m not sure I can workaround.

I want to be able to randomly send the user a notification a couple of times throughout the day, I’ve learned that I could use “repeatType” within my “localNotificationSchedule” function to set up a recurring notification message, but the problem with this is the notification repeats the same message over and over, and I want these messages to be random. is there a way about doing this?

I’m using local push notifications, and these two packages:

https://github.com/zo0r/react-native-push-notification

https://github.com/react-native-push-notification/ios

How do you add an annotation to a website without altering the layout?

I’m working on a hobby project similar to markup.io where you can load in any website and annotate it. I can’t figure out how to add an annotation that behaves like it does in markup.io:

  • Doesn’t interrupt the styling or layout of the website you are annotating
  • The annotation keeps the correct position when scrolling and resizing the window

From what I can see they place an absolute positioned div inside the element that you clicked on. From my understanding by reading the docs that div would position itself based on the closest positioned ancestor. How would you calculate the correct top and left values to position the annotation to where the user clicked? Is there a better way to do this?

I’m using React if that matters.

Things that I have tried:

  1. Append the following bit of html to the element that was clicked:
<div style="width:0px; height:0px; position:relative;">
<div style="width:50px;height:50px;position:absolute; ">this is the annotation </div> 
</div>

Problem: This would mess with the page layout because of the relative positioned div that is not ignored by the document flow.

  1. Create fixed overlay over the entire page. Get the css selector of the clicked element. Draw annotation on the fixed overlay at the x,y position of the element.

Problem: Whenever the user would scroll or resize the window the annotation would need to be redrawn at the new position of the element. I used getBoundintClientRect to get the new position and this would cause a reflow and caused the whole website to have severe perfomance issues when dealing with 100+ annotations.

Hopefully someone can point me in the right direction!

try catch or async awaiit in useeffect for jest

I am running my first unit tests in JEST. I installed Jest Fetch Mock but I still receive an error, “The promise rejected with reason FetchError“.

I did some reading, and I guess that I need to add an async await or a try catch. Can someone help me with this?

This is the fetch I am making in useEffect.

const [data, setData] = useState(null);
  const [isLoading, setLoading] = useState(false);

  useEffect(() => {
    setLoading(true)
    
    fetch("https://api.github.com/search/repositories?q=created:%3E2017-01-10&sort=stars&order=desc")
    .then((res) => res.json())
      .then((data) => {
        setData(data)
        setLoading(false)
      })
  }, [500]);

Why value of c cos and javascript Math.cos is different?

I was just porting a c code to JavaScript and got stumbled on a weird issue, the value from c cos function is different from the value of Math.cos value which results in wrong output.

First
c cos:

cos(-1.570796) is 0.000000

while

First
JavaScript cos:

Math.cos(-1.570796) is 3.2679489653813835e-7

Second
c cos:

cos(-1.570796) is -1.000000

while

Second
JavaScript cos:

Math.cos(-1.570796) is -0.99999999999994

I can see that JavaScript Second one is close enough to -1.000000 but the first one is way off.

Can anyone please let me know how can i fix this?

Attach An Event Handler To Add To Cart Button on a Shopify page

Our Shopify store doesn’t have a way to restrict the text characters that are entered in the gift message field so customers do not include emojis. We checked with the Bold App support team and they don’t have a way to prohibit emojis in the message box. So we decided to develop a custom solution to do it. Here is the product page.

I am thinking of attaching an event handler that gets called when Add to Cart button is clicked that strips the emojis if any in the gift message before the form is submitted. I’ve not been able to find any post here in the community that already discussed something similar so I request someone to share some ideas for me to start with after having a look at the product page. I’m trying to implement the solution found on Stackoverflow in my product page.

How to detect emoji using javascript

How do I add CSS or JS to JSON that I’m retrieving from an API in Rails?

After several days of reading and learning, I’ve finally figured out how to call an API on a Rails app and display it on a page.

Obviously, the API is returning the request in a JSON format, which is what’s being displayed on the webpage. This is exactly what’s being displayed..

{"data"=>{"id"=>501, "active"=>true, "type"=>"domestic", "legacy_id"=>66, "country_id"=>1161, "logo_path"=>"https://cdn.sportmonks.com/images/soccer/leagues/501.png", "name"=>"Premiership", "is_cup"=>false, "is_friendly"=>false, "current_season_id"=>18369, "current_round_id"=>247456, "current_stage_id"=>77453684, "live_standings"=>true, "coverage"=>{"predictions"=>true, "topscorer_goals"=>true, "topscorer_assists"=>true, "topscorer_cards"=>true}, "season"=>{"data"=>{"id"=>18369, "name"=>"2021/2022", "league_id"=>501, "is_current_season"=>true, "current_round_id"=>247456, "current_stage_id"=>77453684}}}, "meta"=>{"plans"=>[{"name"=>"Football Free Plan", "features"=>"Standard", "request_limit"=>"180,60", "sport"=>"Soccer"}], "sports"=>[{"id"=>1, "name"=>"Soccer", "current"=>true}]}}

I’ve been working with Rails for 2 weeks, so just finally getting that up is a big win for me. Now, I need to find my next step.

My question is, where do I look now to customize that data that’s on the page? Even if all you provide is a link or maybe help me to make sure I’m asking the right questions, that’d be helpful.

axios token based authentication handle 401 – try get access token by using refresh token

How to handle by using axios with token based authentication 401 unauthenticated request? And here, I used axios interceptors request & response. But is the interceptors response I don’t know what can I do?

// import
import axios from "axios";

axios interceptors request

axios.interceptors.request.use(
  config => {
    const accessToken = localStorage.getItem("ACCESS-TOKEN");
    if (accessToken) {
      config.headers['Authorization'] = 'Bearer ' + accessToken;
    }
    config.headers['Content-Type'] = 'application/json';
    
    return config;
  },

  error => {
    return Promise.reject(error);
  }
);

axios interceptors response

axios.interceptors.response.use(
  response => {
    return response.data;
  },

  error => {
    const originalRequest = error.config;
    
    if (error.response.status === 401 && !originalRequest._retry) {
      originalRequest._retry = true;

      const refreshToken = localStorage.getItem("REFRESH-TOKEN");
      localStorage.removeItem("ACCESS-TOKEN");
      
      // ?????
      // how to handle
      // ?????
    }
    
    return Promise.reject(error);
  }
);

How do I display a modal only once per hour for each user?

I have a website that displays a model on index load. Currently it loads every single time you go to the index page. It gets very annoying to the users of the website. I was wondering if I can only display it once per hour per user? The website is located at wikiraces.com

<!-- MODAL FOR NEWS-->
<div id="div1" class="modal">

  <!-- Modal content -->
  <div class="modal-content">
    <span class="close">&times;</span>
    </div>
    <!-- Modal content -->
<div class="modal-content">
  <div class="modal-header">
    <span class="close">&times;</span>
    <h2>New Features/Updates</h2>
  </div>
  <div class="modal-body">
   <h4> <p>The Fewest Clicks Game is Back!</p> </h4> 
    <p>
    It was down for maintanece for 14 hours but finally it is back
    </p> 
  
    <h4> The Multiplayer host random page is here! </h4> 
    <p>
     You can now play multiplayer without the hassle of chosing your own start!
      <br> 
      <br>
      <a href="/html/about.html"> <b> Report bugs </b></a>

    </p>
  </div>
  <div class="modal-footer">
   <h5> Enjoy, and remember to share this website with your friends! </h5>
  </div>
</div>
  </div>

</div> 

<script>
  // Get the modal
var modal = document.getElementById("div1");

// Get the <span> element that closes the modal
var spanTimed = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
window.onload = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
spanTimed.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none"; 
  }
}

</script>

Null check operator used on a null value in WebView flutter

please a error when I try to reload my webview from a button : E/flutter (18150): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Null check operator used on a null value

RaisedButton(
                        padding: const EdgeInsets.symmetric(vertical: 10,horizontal: 30),
                        onPressed: () async {
                          controller.reload();
                        },

this is my WebView

 WebView(
                  initialUrl: "https://wikoget.com",
                  javascriptMode: JavascriptMode.unrestricted,
                  onWebViewCreated: (controller){
                   this.controller=controller;
                  },
                  onPageFinished: (String url) {
                    controller
                        .evaluateJavascript("javascript:(function() { " +
                        "var head = document.getElementsByClassName('main-header-bar-wrap')[0];" +
                        "head.parentNode.style.cssText = ' position: sticky;position: -webkit-sticky; top : 0 ';" +
                        "var footer = document.getElementsByTagName('footer')[0];" +
                        "footer.parentNode.removeChild(footer);" +
                        "})()")
                        .then((value) => debugPrint('Page finished loading Javascript'));
                    },
                  onWebResourceError: (error) => setState(() {
                    controller.loadUrl("about:blank");
                    isError = true;
                  }),
                  gestureNavigationEnabled: true,
                ),