How to remove padding/margin from labels in xAxis in rechart?

I have this graph and I want the first xAxis label to start at the beginning of the last horizontal line (Please see image). I want letter “N” from November to start at the beginning of the line. Can someone point me in the right direction, please? Thanks a lot in advance!

This is what my simple graph looks like:

 <div style={{ paddingTop: '16px', marginRight: '0px' }}>
      <ResponsiveContainer width="100%" height={400}>
      <LineChart
        margin={{
          top: 15,
          right: 45,
          left: 0,
          bottom: 24,
        }}
        data={points}
      >
        <CartesianGrid stroke={palette.border.primary} vertical={false} />
        <XAxis
          type="number"
          dataKey="date"
          tickLine={false}
          tickFormatter={unixDateFormatter}
          stroke={palette.border.primary}
          tickCount={6}
          ticks={generateTicks(points, 6)}
          domain={['dataMin', 'dataMax']}
          tick={{ fill: palette.text.primary }}
          fontSize={11}
          dy={5}
        />
        <YAxis
          dataKey="score"
          tickLine={false}
          axisLine={false}
          domain={[0, 1000]}
          tickCount={11}
          tick={<RiskScoreAxisTick />}
        />

and this my Graph:

enter image description here

NavBar not behaving properly in mobile screens react

I have an issue with my navbar,the weird thing is it works properly on desktop screen but start misbehaving on mobile,the nav bar moves a bit before getting fixed instead of being fixed immediately user starts scrolling,a screenshot of the behaviour below:

In the screenshot you can see the first content that seems to partly scroll with the whole content,that’s the navbar,after scrolling to that point it then assumes a fixed position making only half of the navbar visible.I use styled components for my styling below is the code for the navbar component:

export const  NavWrapper=styled.div`
color:#686869;
width:100%;
background:#ffffff;
top:0;
left:0;
position:sticky;
z-index: 100;
margin-bottom:10px;
box-shadow: -1px 5px 16px -10px rgba(0,0,0,0.63);
-webkit-box-shadow: -1px 5px 16px -10px rgba(0,0,0,0.63);
-moz-box-shadow: -1px 5px 16px -10px rgba(0,0,0,0.63);
@media only screen and (max-width: 480px) {
  box-sizing: border-box;
  position: -webkit-sticky;
  position: sticky;
  }
`;

export const Wrapper = styled.div`
width:93%;
padding-left:15px;
padding-right:15px;
display:flex;
justify-content:space-between;
align-items:center;
top:0;
left:0;

@media only screen and (max-width: 480px) {
  padding-top:8px;
  padding-bottom:8px;
  }

`;

I also tried to check if the contents where allowing an horizontal overflow,but i made sure i’m using border-boxing and the other components in the parent component had width less than 100%
this the styled component for the parent component :

export const Wrapper= styled.div`
position:relative;
width:100%;
background:#f2f2f2;
min-height:750px;




:after{
    
    opacity:0.5;
}

@media only screen and (max-width: 480px) {
  padding:0;
  box-sizing: border-box;
}
`;



export const  ContentWrapper=styled.div`
width:100%;
padding:0;
`;

export const HomeContent=styled.div`
display:flex;
width:100%;

`;

export const ContentOne=styled.div`
width:26%;
@media only screen and (max-width: 480px) {
  display:none;  
}
`;

export const GigContent=styled.div`
width:40%;
padding:2%;
@media only screen and (max-width: 480px) {
   width:98%;
   padding:1px;
   
}
`;

export const Loader=styled.div`
margin-left:230px;
@media only screen and (max-width: 480px) {
 margin-left:170px;   
}
`;

the jsx:

<Wrapper>
            <NavBar image={profileImage}/>
                {state.clientGig==0?<DialogBox display={"block"} message={NO_GIGS}/>:<></>}
                {error?<DialogBox display={"block"} message={error}/>:<></>}
        <ContentWrapper>
            <HomeContent>
                <ContentOne></ContentOne>
                <GigContent>
                    {
                     loading?
                     <Loader><ClipLoader color={'#36D7B7'} loading={loading}  size={25} /> </Loader>
                     :
                    <> {state.isClient==1?<FormGig profileId={profileId}/>:<></>}
                 {
                  state.Gigs.map((item)=>(
                     <Gig  title={item.title} senderImage={profileImage} 
                     isClient={state.isClient} id={item.id} profileId={profileId} 
                     userId={item.client} tags={item.tags} 
                     body={item.about} bids={item.bids} closed={item.closed}/> 
                  ))
                 }</>
                    }
                    
                 
                </GigContent>
                <ContentOne></ContentOne>
            </HomeContent>
            </ContentWrapper>
        </Wrapper>

styling and jsx for the gig component which is also a child component in the parent component:

export const Wrapper=styled.div`
display:${(props)=>props.display || "block"};
position:relative;
width:90%;
background:#ffffff;
min-height:200px;
padding:5%;
border:1px solid #c7c7c9;
@import url('https://fonts.googleapis.com/css?family=Ubuntu');
font-family:'Ubuntu',sans-serif;
box-shadow: -1px 3px 5px -2px rgba(0,0,0,0.63);
-webkit-box-shadow: -1px 3px 5px -2px rgba(0,0,0,0.63);
-moz-box-shadow: -1px 3px 5px -2px rgba(0,0,0,0.63);
:hover{
    background:#f7faf9;
}
`;

export const Header=styled.div`
width:100%;
display:flex;
justify-content:space-between;
margin-bottom:17px;
`;

export const Title=styled.div`
width:90%;
font-size:20px;
font-weight:bold;
`;

export const CancelIcon=styled.div`
width:10%;
font-size:20px;
font-weight:bold;
`;

export const Body=styled.div`
width:100%;
margin-bottom:10px;
`;

export const Bids=styled.div`
margin-bottom:7px;
font-size:12px;
color:#49494a;
`;

export const TagsSection=styled.div`
display:flex;
width:100%;
padding:5px;
margin-bottom:17px;
`;

export const Tag=styled.div`
font-size:13px;
border-radius:25px;
background:#9c9ca1;
color:#ffffff;
margin-right:6px;
padding-top:3px;
padding-bottom:3px;
padding-left:5px;
padding-right:5px;
`;

export const Message=styled.button`
margin-top:5px;
margin-bottom:7px;
font-size:12px;
padding:6px 10px 6px 10px;
background:#3251fc;
color:#ffffff;
border:none;
border-radius:8px;
`;

export const ClosedDiv=styled.div`
color:#e34b50;
font-size:11px;
margin-bottom:7px;
`;

export const BidButton=styled.button`
width:70%;
padding:15px;
border-radius:25px;
font-size:13px;
border:none;
background:#5c5cff;
color:#ffffff;
margin-left:70px;

:hover{
    background:#4373f7;
    
}
@media only screen and (max-width: 480px) {
  margin-left:40px;  
}

`;
<Wrapper display={removeGig}>
                <Header>
                <Title>{props.title}</Title> 
                {
                   props.profileId==props.userId && props.isClient?
                   <CancelIcon onClick={()=>deleteGig()}>
                       <i class="fa fa-times" aria-hidden="true"></i>
                   </CancelIcon> 
                   :
                   <>
                   </>
                }
                </Header>
                <Body>{props.body}</Body>
                {
                    props.profileId==props.userId && props.bids.length !=0 && props.isClient ?
                <Link to={"/bidders"}
                 state={{bids:props.bids,id:curUserId,username:curUserName,senderImage:props.senderImage}}>
                <Bids>{props.bids.length} bids already</Bids>
                </Link>
                :
                <Bids>{bids.length} bids already</Bids>
                }
                {
                    props.isClient && props.profileId==props.userId?
                    <Message onClick={closeGig}>{closed}</Message>
                    :
                    <>
                    {props.closed?
                       <ClosedDiv>closed</ClosedDiv>
                       :
                       <></>
                    }
                    </>
                }
                <TagsSection>
                  {
                      props.tags.map((item)=>(
                          <Tag>{item.name}</Tag>
                      ))
                  }  
                </TagsSection>
                <>{props.isClient==0 && !props.closed?<BidButton onClick={(e)=>bidGig(e,props.id,props.userId)}>{loading?<ClipLoader color={'#36D7B7'} loading={loading}  size={20} />
                
                :<>{bidVal}</>}</BidButton>:<></>}</>
            </Wrapper> 

Selenium-Webdriver: My USB ports have been non-functional for awhile and seems to be hindering the development process of this script

For the following code I receive the immediate following errors:

Code:

const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

(async function firstScript() {
    let driver, service;
    service = new chrome.ServiceBuilder('../config/chromedriver.exe');
    driver = await new Builder().forBrowser('chrome').setChromeService(service).build();
})();

Error

[28396:19016:0525/185240.960:ERROR:device_event_log_impl.cc(214)] [18:52:40.966] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[28396:19016:0525/185240.960:ERROR:device_event_log_impl.cc(214)] [18:52:40.966] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)

How do I get the DOM from a webpage with Chrome Extension Manifest v3?

I’m making a chrome extension to gather data from a webpage. When I try to use document.querySelectorAll() it gets the DOM from the popup, not the current webpage. I tried using chrome’s messaging system to request and send back the HTML but it doesn’t work and gives me errors.

Here’s the important files:

manifest.json

{
  "name": "Name",
  "description": "Description",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": ["storage", "activeTab", "scripting", "tabs"],
  "host_permissions": [
    "*://*.website.com/*"
  ],
  "content_scripts": [
    {
      "matches": ["*://*.website.com/*"],
      "js": ["content_script.js"]
    }
  ],
  "action": {
    "default_popup": "popup.html",
    "default_icon": {
      "32": "/images/icon.png"
    }
  },
  "icons": {
    "32": "/images/icon.png"
  }
}

popup.js (runs inside popup.html)

function fetchData() {
  chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
    chrome.tabs.sendMessage(tabs[0].id, {greeting: "fetchData"}, (response) => {
      console.log(response);
    });
  });
}

content_script.js

chrome.runtime.onMessage.addListener(
  function(request, sender, sendResponse) {
    if (request.greeting === "fetchData") {
      sendResponse(document.querySelectorAll(".class"));
    }
  }
);

The error I get from the message sending is “Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.”

When I turn the NodeList to an array, there are no console errors, but it returns a list of “[object Object]”.

Please let me know if there’s a way to do this. I’m just using vanilla js.

Bootstrap Table: how to ignore special characters when using filter control column option

I have a bootstrap table where I’ve set my columns to use data-filter-control="select". When I try to filter a column that contains a special character like < or >. It returns No matching records found. However for other characters like &, = or etc. It works fine without any issues. Is there a way to ignore those special characters when using the filter?

Example code is on https://live.bootstrap-table.com/code/rsquare31/11608

Browser Alert for Right-Click on Image

Does anyone know of a window alert script (browser message) that would make an alert appear when a user right-clicks on an image? The idea is to warn someone that the image is copyrighted, or that they need to cite the source if they want to use it, etc. If such a script exists, is it possible to do this for just a specific image or images on the page, rather than a right-click anywhere on the page? Thanks for any help.

If there is a matching value in the object, how do I rotate the object?

{
 "name": "Albania",
 "topLevelDomain": : [
                      ".al"
                     ],
 "callingCodes": [1 item],
 "capital": "Tirana",
 "altSpellings":  [
                    "AL",
                    "Shqipëri",
                    "Shqipëria",
                    "Shqipnia"
                   ],
 "region": "Europe",
 "population": 2837743,
 "latlng": [2 items],
 "demonym": "Albanian",
 "area": 28748,
 "gini": 33.2,
 "timezones": [1 item],
 "borders": [4 items],
 "nativeName": "Shqipëria",
 "numericCode": "008",
 "flags": {2 items},
 "currencies": [1 item],
 "languages": [
               {
                 "iso639_1": "sq",
                 "iso639_2": "sqi",
                 "name": "Albanian",
                 "nativeName": "Shqip"
                }
               ],
 "translations": {11 items},
},{},{}...

If there is a matching value in the object according to the input from the user, I want to return those objects. For example, I want to find the single object where the id is “Albani” and return that object or I want to find the only value where the id is “Shqip” and return that object.
Api:https://restcountries.com/v2/all

function(input){
 return obj
}

Alert before executing value on select [duplicate]

I have a Select input type with 3 options and want to prompt an Alert window when any option is selected.

This alert has to put the execution of the selected option on hold and give a warning like: “Unsaved changes will be lost. Are you sure you want to continue?”, then I want the option to ‘Cancel’ the execution or to press ‘OK’ and execute.

How can I add a Cancel option inside the alert so it doesn’t execute the selected option and stays on the previously selected option?

See my code below and in the JSFiddle

HTML:

<p> Choose your formation: </p>
<select id="formation" name="formation" onchange="myFunction(formation)">
  <option value="1"> 1-1-2 </option>
  <option value="2"> 1-2-1 </option>
  <option value="3"> 2-1-1 </option>
</select>

<p>
  You chose the following formation: <spam id="demo"> X</spam>.
</p>

Javascript:

function myFunction(formation) {
    alert("Unsaved changes will be lost. Are you sure you want to continue?")

    if(document.getElementById('formation').value == "1") {
    document.getElementById("demo").innerHTML = "1-1-2";
  }
  if(document.getElementById('formation').value == "2") {
    document.getElementById("demo").innerHTML = "1-2-1";
  }
  if(document.getElementById('formation').value == "3") {
    document.getElementById("demo").innerHTML = "2-1-1";
  }
}

React automatically importing all the CSS

So I’m doing a React App, Where the css files remains on src/dist/css, where src is located in the same local of App.js, the thing is I just want to import one single CSS file, but when I’m going to see every css file were automatically imported somehow.

I want to prevent this, because it’s conflicting with the normal css screen.

These are the only things I’m Importing. ( IMAGE )

But All of these are being imported, I don’t know if is something with React or the Server.. ( IMAGE )

How to pass a ion-select value into a pipe in Angular/Ionic?

I am using a ion-select to show currency options. This is my code:

 <ion-item>
        <ion-label>Currency</ion-label>
        <ion-select>
          <ion-select-option value="USD">Dollar</ion-select-option>
          <ion-select-option value="EURO">Euro</ion-select-option>          
        </ion-select>
  </ion-item>

When the user choose one of the currency the prices will shown in that chosen currency. I have read in the Angular documentation there is a currencypipe.

https://angular.io/api/common/CurrencyPipe

I use this pipe like this:

  <ion-col>               
       <ion-badge>Current price: {{item.price | currency}}</ion-badge>
  </ion-col>

You can specify this pipe like this to show the currency the user wants.

<ion-col>               
     <ion-badge>Current price: {{item.price | currency:'USD'}}</ion-badge>
</ion-col>

The requirement I try to achieve is, I want that the user can select te currency from the ion-select and pass this value in the CurrencyPipe. How can I achieve this?

Source I tried:

How can I pass dynamic value to pipe in Angular 8

if else condition inside for loop using angular

I am working on a task where I am looping an array inside a tag & using target=”_blank” attribute but one of the array element should not want this target=”_blank” attribute so what to do?

<ul *ngIf="item.menu">
            <li *ngFor="let subMenu of item.menu">
              <a href="{{subMenu.link}}" target="_blank">{{'landing.menu.' + subMenu.name | translate}}</a>
            </li>
          </ul>

Javascript – Regex match multiple instances [duplicate]

I am new to regex and I am trying to get multiple instances of sections that start and end with a % across a string.
For example, I have the following string:

This happened %Monday% following our forest %trip%. Tomorrow %we will% start packing our things and %return home%.

I am looking to get all the sections that start with % and end with % detected and I cannot seem to get my head around regex… 🙁
I did try a few ways but all it did it selected either everything inside the sentence between first % and last one or just the %.
Thank you.

How to programmatically push a docker image to a docker registry?

I’ve looked online for an answer, but all I could find were articles about dockerizing a node app and pushing it to docker hub or another registry. My question is different.

I programmatically generate some basic files in a folder. One of the root files is a Dockerfile, which I use to build a docker image with child-process. After I build this image, I’d like to push it to my docker registry (not docker hub).

What options am I left with here? Using child-process again after building the image?