samedi 29 février 2020

Reviews button not working in my jquery functions

I am developing a website where I am displaying all my products based on an ajax call taking the default values of my dropdown list. I have 2 pages order.php and action.php. Order.php is where the results will be displayed and action.php is where I will send the ajax call to display the products and pass the response back to a div in my order.php. Now, in my results i have a button having a class .reviews and if i want to add an action with it, i shall put it within the jquery script tag. I did that in order.php with a simple alert (clicked) and nothing happens.

Link: Reviews button not working in the jquery function




Server Error in '/' Application.Could not load file or assembly 'zzz or one of its dependencies. Not enough space on the disk.(HRESULT: 0x80070070)

if somebody can assist me, wll be great! So, i`m start to recieve that message from my web application(without any changes in code). I checked disk quotas in hosting, and in have 60 Mb unused space.

Server Erorr /




Reviews button not working in the jquery function

I am developing a shopping website for food items. I have my products displayed on my order.php page based on an ajax call which will take the default category on my dropdown list. The items are displayed in cards each with a review button having class 'reviews'. However, when i am making a test with the button using jquery, the page is simply reloading with no action. Please help me

//order.php

<div id="message">
 </div>

 <div class="container" style="position:relative; top:200px; float:center">

 <div class="collapse" id="filterdiv">

 <form class="d-inline">
    <select id="Category">
        <option value='' selected>All</option>
        <?php 
        $fCategory="SELECT DISTINCT Food_Type from food";
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $res=$conn->query($fCategory);

        if($res->rowCount()>0)
        {
            while($row=$res->fetch(PDO::FETCH_ASSOC))
            {
                echo "<option value=".$conn->quote($row['Food_Type']).">".$row['Food_Type']." 
       </option>";
            }
        }

        ?>


    </select>

    <select id="price">
    <option value="">Price</option>
    <option value="lowtohigh">Low to High</option>
    <option value="hightolow">High to Low</option>
    <
    </select>
  </form> 
  </div>



  <div class="row" id="result">

   </div>
   </div>




<script type="text/javascript" src="Bootstrap4/js/jquery-3.4.1.min.js"></script>

<script type="text/javascript" src="Bootstrap4/js/bootstrap.min.js"></script>

<!--Ajax code to get food info-->
<script type="text/javascript">
    $(document).ready(function()
    {

    $("#filterdiv").ready(function(){

        let foodType=$("#Category").val();
        let price=$("#price").val();

        $.ajax({
            url:'action.php',
            method:'post',
            data:{foodType:foodType,price:price},
            success:function(response)
            {
                $("#result").html(response);
            }
        });     
    });


    });

</script>   


   Now for action.php
   if (isset($_POST['foodType']) || isset($_POST['price']))
   {
    $foodType=$price=$priceSort=$foodSort="";

    if (isset($_POST['foodType']))
    {
        $foodType=$_POST['foodType'];
        if ($foodType=='')
        {
            $foodSort='';
        }
        else
        {
            $foodSort="WHERE Food_Type=".$conn->quote($foodType);
        }

    }

    if (isset($_POST['price']))
    {
        $price=$_POST['price'];

        if ($price=="lowtohigh")
        {
            $priceSort="ORDER BY `Food_Price(Rs)` ASC";
        }

        else if ($price=='hightolow')
        {
            $priceSort="ORDER BY `Food_Price(Rs)` DESC";
        }
        else
        {
            $priceSort="";
        }
      }

    $foodDisp="SELECT * FROM food ".$foodSort." ".$priceSort;
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $res=$conn->query($foodDisp);

    while($row=$res->fetch(PDO::FETCH_ASSOC))
    {

        ?>

    <div class="col-lg-3 mx-0">
        <div class="card-deck" style="display:flex; flex:flex-wrap; padding:2px;">
            <div class="card bg-transparent p-2 h-100 border-secondary mx-0 mb-2" style="min- 
         height:35rem;max-height:35rem;">
            <img src="<?= 'foodImages/'.$row['Food_Url'] ?>" class="card-img-top img-fluid img- 
            responsive img-thumbnail" height="100" width="100%">
            <div class="card-body p-1 text-center">

                <h4 class="card-title text-center text-info"><?php echo $row['Food_Name']; ?>
                </h4>
                <h5 class="card-text text-center text-white"><?php echo $row['Food_Description']; 
            ?>
                </h5>
                <h5 class="card-text text-center text-danger"><?php echo "Rs 
               ".$row['Food_Price(Rs)']; ?>
                </h5>
                <button class="btn btn-success reviews">Reviews</button>
            </div>

                <div class="footer p-1">
                    <form action="" class="form-submit">
                    <input type="hidden" class="fid" value="<?php echo $row['Food_Id'] ;?>
                    ">

                    <input type="hidden" class="fname" value="<?php echo $row['Food_Name'] ;?>
                    ">

                    <input type="hidden" class="fprice" value="<?php echo $row['Food_Price(Rs)'] 
           ;?>
                    ">

                    <input type="hidden" class="fimage" value="<?php echo $row['Food_Url'] ;?>
                    ">

                    <input type="hidden" class="ftype" value="<?php echo $row['Food_Type'] ;?>
                    ">

                    <button class="btn btn-info btn-block addItemBtn">Add to cart</button>


                    </form>
                </div>
            </div>
        </div>
    </div>



 <?php }
  }
  ?>



How to implement Guest User in Flask?

I'm trying to create a guest user in my flask app, but have found it to be a pain. I need a different user experience when they choose to be a 'guest' - it'll be triggered by a 'continue with guest' button click. Here's what I've done so far:

class AnonymousUser(AnonymousUserMixin):
    def __init__(self):
        super()
        self.is_guest=False

class GuestUser(AnonymousUserMixin):
    def __init__(self):
        super()
        self.is_guest=True

So initially, I set

loginmanager.anonymous_user = AnonymousUser

and when the 'continue as guest' button is pressed, I set

loginmanager.anonymous_user = GuestUser

I've noticed that this successfully changed the anon user in the login manager, but it doesn't change the current_user provided by flask-login. Printing flask-login after setting the anon user in the login manager to GuestUser still gives

<app.models.AnonymousUser object at 0x111422222>

Can anyone highlight the flaw in this approach or suggest a different approach? Thanks!




What does [0] mean at the end of $variable? and what does "this" pointing at inside of bind() function? [duplicate]

  1. Why does it mean when you put [0] at the end of div class selector holder -> $chatHistory?

  2. what does this pointing inside of bind() function from this part this.addMessage.bind(this) in javascript?

This is HTML part.

It has chat-history div class

<div class="chat-history">
        <ul>
          <li class="clearfix">
            <div class="message-data align-right">
              <span class="message-data-time" >10:10 AM, Today</span> &nbsp; &nbsp;
              <span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>

            </div>
            <div class="message other-message float-right">
              Hi Vincent, how are you? How is the project coming along?
            </div>
          </li>

          <li>
            <div class="message-data">
              <span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
              <span class="message-data-time">10:12 AM, Today</span>
            </div>
            <div class="message my-message">
              Are we meeting today? Project has been already finished and I have results to show you.
            </div>
          </li>

          <li class="clearfix">
            <div class="message-data align-right">
              <span class="message-data-time" >10:14 AM, Today</span> &nbsp; &nbsp;
              <span class="message-data-name" >Olia</span> <i class="fa fa-circle me"></i>

            </div>
            <div class="message other-message float-right">
              Well I am not sure. The rest of the team is not here yet. Maybe in an hour or so? Have you faced any problems at the last phase of the project?
            </div>
          </li>

          <li>
            <div class="message-data">
              <span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
              <span class="message-data-time">10:20 AM, Today</span>
            </div>
            <div class="message my-message">
              Actually everything was fine. I'm very excited to show this to our team.
            </div>
          </li>

          <li>
            <div class="message-data">
              <span class="message-data-name"><i class="fa fa-circle online"></i> Vincent</span>
              <span class="message-data-time">10:31 AM, Today</span>
            </div>
            <i class="fa fa-circle online"></i>
            <i class="fa fa-circle online" style="color: #AED2A6"></i>
            <i class="fa fa-circle online" style="color:#DAE9DA"></i>
          </li>

        </ul>

      </div> <!-- end chat-history -->

This Javascript part.

and it has this part scrollTop(this.$chatHistory[0].scrollHeight);

(function(){

  var chat = {
    messageToSend: '',
    messageResponses: [
      'Why did the web developer leave the restaurant? Because of the table layout.',
      'How do you comfort a JavaScript bug? You console it.',
      'An SQL query enters a bar, approaches two tables and asks: "May I join you?"',
      'What is the most used language in programming? Profanity.',
      'What is the object-oriented way to become wealthy? Inheritance.',
      'An SEO expert walks into a bar, bars, pub, tavern, public house, Irish pub, drinks, beer, alcohol'
    ],
    init: function() {
      this.cacheDOM();
      this.bindEvents();
      this.render();
    },
    cacheDOM: function() {
      this.$chatHistory = $('.chat-history');
      this.$button = $('button');
      this.$textarea = $('#message-to-send');
      this.$chatHistoryList =  this.$chatHistory.find('ul');
    },
    bindEvents: function() {
      this.$button.on('click', this.addMessage.bind(this));
      this.$textarea.on('keyup', this.addMessageEnter.bind(this));
    },
    render: function() {
      this.scrollToBottom();
      if (this.messageToSend.trim() !== '') {
        var template = Handlebars.compile( $("#message-template").html());
        var context = { 
          messageOutput: this.messageToSend,
          time: this.getCurrentTime()
        };

        this.$chatHistoryList.append(template(context));
        this.scrollToBottom();
        this.$textarea.val('');

        // responses
        var templateResponse = Handlebars.compile( $("#message-response-template").html());
        var contextResponse = { 
          response: this.getRandomItem(this.messageResponses),
          time: this.getCurrentTime()
        };

        setTimeout(function() {
          this.$chatHistoryList.append(templateResponse(contextResponse));
          this.scrollToBottom();
        }.bind(this), 1500);

      }

    },

    addMessage: function() {
      this.messageToSend = this.$textarea.val()
      this.render();         
    },
    addMessageEnter: function(event) {
        // enter was pressed
        if (event.keyCode === 13) {
          this.addMessage();
        }
    },
    scrollToBottom: function() {
       this.$chatHistory.scrollTop(this.$chatHistory[0].scrollHeight);
    },
    getCurrentTime: function() {
      return new Date().toLocaleTimeString().
              replace(/([\d]+:[\d]{2})(:[\d]{2})(.*)/, "$1$3");
    },
    getRandomItem: function(arr) {
      return arr[Math.floor(Math.random()*arr.length)];
    }

  };

  chat.init();

  var searchFilter = {
    options: { valueNames: ['name'] },
    init: function() {
      var userList = new List('people-list', this.options);
      var noItems = $('<li id="no-items-found">No items found</li>');

      userList.on('updated', function(list) {
        if (list.matchingItems.length === 0) {
          $(list.list).append(noItems);
        } else {
          noItems.detach();
        }
      });
    }
  };

  searchFilter.init();

})();



When making a call using ajax, the page is simply reloading with no action

I am making a restaurant website and i have displayed my products using an ajax call based on filter. When i added jquery at start, everything was working fine. Now, as i continued adding actions with each button, as soon as i click one of them, the page simply reloads and nothing happens. I have no idea what the issue is. I will post a lengthy part of the code for you so that you can follow

P.S: The code for add to cart is correct. It is after adding the other jquery functions, that it stopped working

  <div id="message">
   </div>

     <div class="container" style="position:relative; top:200px; float:center">

    <div class="collapse" id="filterdiv">

    <form class="d-inline">
        <select id="Category">
            <option value='' selected>All</option>
            <?php 
            $fCategory="SELECT DISTINCT Food_Type from food";
            $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

            $res=$conn->query($fCategory);

            if($res->rowCount()>0)
            {
                while($row=$res->fetch(PDO::FETCH_ASSOC))
                {
                    echo "<option value=".$conn->quote($row['Food_Type']).">".$row['Food_Type']." 
           </option>";
                }
            }

            ?>


        </select>

        <select id="price">
        <option value="">Price</option>
        <option value="lowtohigh">Low to High</option>
        <option value="hightolow">High to Low</option>
        <
        </select>
    </form> 
   </div>



<div class="row" id="result">

</div>
</div>




    <script type="text/javascript" src="Bootstrap4/js/jquery-3.4.1.min.js"></script>

    <script type="text/javascript" src="Bootstrap4/js/bootstrap.min.js"></script>

    <!--Ajax code to get food info-->
    <script type="text/javascript">
        $(document).ready(function()
        {
            $(".addItemBtn").click(function(e)
            {
                e.preventDefault();
                var $form=$(this).closest(".form-submit");
                var fid=$form.find(".fid").val();
                var fname=$form.find(".fname").val();
                var fimage=$form.find(".fimage").val();
                var fprice=$form.find(".fprice").val();

                $.ajax({ 
                    url: 'action.php',
                    method:'post',
                    data: {fid:fid,fname:fname,fimage:fimage,
                        fprice:fprice},
                    success:function(response)
                    {
                        $("#message").html(response);
                        window.scroll(0,0);
                    }

                });
            });


            $("#search").keyup(function(){
            let searchText=$(this).val();
            if(searchText!=""){
                $.ajax({
                    url:'action.php',
                    method:'post',
                    data:{query:searchText},
                    success:function(response){
                       $("#show-list").html(response);
                    }
                });
            }

            else{

                $("#show-list").html('');
            }
        });


        $(document).on('click','#show-list a',function(){
            $("#search").val($(this).text());
            $("#show-list").html('');
        });


        $('body').click(function()
            {
                $('#show-list a').hide();
                $('#show-list p').hide();
            });


            $(".reviews").click(function(){
                alert("clicked");
            });




        $("#filterdiv").ready(function(){

            let foodType=$("#Category").val();
            let price=$("#price").val();

            $.ajax({
                url:'action.php',
                method:'post',
                data:{foodType:foodType,price:price},
                success:function(response)
                {
                    $("#result").html(response);
                }
            });     
        });


        $("#Category").change(function(){
            let foodType=$(this).val();
            let price=$('#price').val();

            $.ajax({
                url:'action.php',
                method:'post',
                data:{foodType:foodType,price:price},
                success:function(response)
                {
                    $("#result").html(response);
                }
            });     
        });


        $("#price").change(function(){
            let price=$(this).val();
            let foodType=$('#Category').val();

            $.ajax({
                url:'action.php',
                method:'post',
                data:{price:price,foodType:foodType},
                success:function(response)
                {
                    $("#result").html(response);
                }
            });     
        });

        $("#searchData").click(function()
            {

                let searchValue=$('#search').val();             

                $.ajax({
                    url:'action.php',
                    method:'post',
                    data:{searchValue:searchValue},
                    success:function(response)
                    {
                        $("#result").html(response);
                    }
                });



            });



        });



    </script>   


   Now for action.php
    if ((isset($_POST['fid'])) &&(!isset($_POST['qty'])))
{
    alert('hello');
    $fname=$_POST['fname'];

    $fimage=$_POST['fimage'];

    $fprice=$_POST['fprice'];

    $fqty=1;



    $cartQuery="SELECT * FROM cart WHERE Food_Name='$fname' AND cartNo='$cartNo'";
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $res=$conn->query($cartQuery);
    $numRes=$res->rowCount();
    if($numRes)
    {
        echo '<div class="alert alert-danger alert-dismissible ">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
          <strong><h3>Item already added to your cart</h3></strong>
          </div>';

    }

    else
    {

        $insertQuery="INSERT INTO cart (cartNo,Food_Name,Food_Price,Food_Url,qty,Total_Price) VALUES 
        ('$cartNo','$fname','$fprice','$fimage','$fqty','$fprice')";
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $conn->exec($insertQuery);

            echo '<div class="alert alert-success alert-dismissible mt-2">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
          <strong><h3>Item added to your cart</h3></strong>
          </div>';
    }


    }

    if (isset($_GET['remove']))
    {
        $deletedId=$_GET['remove'];

        $deleteQuery="DELETE FROM cart WHERE id='$deletedId' AND cartNo='$cartNo'";



        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $row=$conn->exec($deleteQuery);

        Header("Location:cart.php");            
    }

    if (isset($_GET['clear']))
    {
        $clear="DELETE FROM cart WHERE cartNo='$cartNo'";
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $conn->exec($clear);

        Header("Location:cart.php");

    }

    if(isset($_POST['qty']))
    {   
        $qty=$_POST['qty'];
        $fid=$_POST['fid'];
        $fprice=$_POST['fprice'];

        $tprice=$qty*$fprice;

        $updQty="UPDATE cart SET qty='$qty',TOTAL_PRICE='$tprice' WHERE id='$fid' AND 
        cartNo='$cartNo'";

        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $conn->exec($updQty);
        Header("Location:cart.php");




    }

    if (isset($_POST['query']))
    {
                function test_input($data) {
                $data = trim($data); //whitespacess
                $data = stripslashes($data); //removes backslashes n clean data from database or form
                $data = htmlspecialchars($data); //converts predefined characters to html entities, encoding user input so that they cannot manipulate html codes
                return $data;
                }



        $inpText=$_POST['query'];

        $searchData=test_input($inpText);
        $searchData=preg_replace("#[^0-9a-z]#i","",$searchData);

        $query= "SELECT Food_Name FROM food "
            . "WHERE ( LOWER(Food_Name) LIKE LOWER('%$searchData%') "
            . "OR LOWER(Food_Description) LIKE LOWER('%$searchData%') )";

        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $result=$conn->query($query);


        if($result->rowCount()>0)
        {
            while($row=$result->fetch(PDO::FETCH_ASSOC))
            {


                echo "<a href='#' class='list-group-item list-group-item-action border-1'>".$row['Food_Name']."</a>";

            }

        }

        else
        {
            echo "<p class='list-group-item border-1 text-danger'>No results found</p>";
        }



    }


    if (isset($_POST['foodType']) || isset($_POST['price']))
    {
        $foodType=$price=$priceSort=$foodSort="";

        if (isset($_POST['foodType']))
        {
            $foodType=$_POST['foodType'];
            if ($foodType=='')
            {
                $foodSort='';
            }
            else
            {
                $foodSort="WHERE Food_Type=".$conn->quote($foodType);
            }

        }

        if (isset($_POST['price']))
        {
            $price=$_POST['price'];

            if ($price=="lowtohigh")
            {
                $priceSort="ORDER BY `Food_Price(Rs)` ASC";
            }

            else if ($price=='hightolow')
            {
                $priceSort="ORDER BY `Food_Price(Rs)` DESC";
            }
            else
            {
                $priceSort="";
            }
        }

        $foodDisp="SELECT * FROM food ".$foodSort." ".$priceSort;
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $res=$conn->query($foodDisp);

        while($row=$res->fetch(PDO::FETCH_ASSOC))
        {

            ?>

        <div class="col-lg-3 mx-0">
            <div class="card-deck" style="display:flex; flex:flex-wrap; padding:2px;">
                <div class="card bg-transparent p-2 h-100 border-secondary mx-0 mb-2" style="min- 
             height:35rem;max-height:35rem;">
                <img src="<?= 'foodImages/'.$row['Food_Url'] ?>" class="card-img-top img-fluid img- 
                responsive img-thumbnail" height="100" width="100%">
                <div class="card-body p-1 text-center">

                    <h4 class="card-title text-center text-info"><?php echo $row['Food_Name']; ?>
                    </h4>
                    <h5 class="card-text text-center text-white"><?php echo $row['Food_Description']; 
                ?>
                    </h5>
                    <h5 class="card-text text-center text-danger"><?php echo "Rs 
                   ".$row['Food_Price(Rs)']; ?>
                    </h5>
                    <button class="btn btn-success reviews">Reviews</button>
                </div>

                    <div class="footer p-1">
                        <form action="" class="form-submit">
                        <input type="hidden" class="fid" value="<?php echo $row['Food_Id'] ;?>
                        ">

                        <input type="hidden" class="fname" value="<?php echo $row['Food_Name'] ;?>
                        ">

                        <input type="hidden" class="fprice" value="<?php echo $row['Food_Price(Rs)'] 
               ;?>
                        ">

                        <input type="hidden" class="fimage" value="<?php echo $row['Food_Url'] ;?>
                        ">

                        <input type="hidden" class="ftype" value="<?php echo $row['Food_Type'] ;?>
                        ">

                        <button class="btn btn-info btn-block addItemBtn">Add to cart</button>


                        </form>
                    </div>
                </div>
            </div>
        </div>



 <?php }
   }
  ?>

 <?php

  if (isset($_POST['searchValue']))
 {
function test_input($data) {
 $data = trim($data); //whitespacess
 $data = stripslashes($data); //removes backslashes n clean data from database or form
 $data = htmlspecialchars($data); //converts predefined characters to html entities, encoding user 
 input so that they cannot manipulate html codes
 return $data;
 }



    $inpText=$_POST['searchValue'];

    $searchData=test_input($inpText);

    $starString= strtolower($searchData);
    $searchData = $conn->quote($starString);
    $searchDataStartMatch = $conn->quote("%".$starString);
    $searchDataEndMatch = $conn->quote($starString."%");
    $searchDataBothMatch = $conn->quote("%".$starString."%");


    $sql="SELECT * FROM food WHERE LOWER(Food_Name) like {$searchDataBothMatch} OR 
          LOWER(Food_Description) LIKE {$searchDataBothMatch}
          ORDER BY CASE WHEN LOWER(Food_Name)={$searchData} or LOWER(Food_Description)={$searchData} 
                        THEN 0
                        WHEN LOWER(Food_Name) like {$searchDataEndMatch} or LOWER(Food_Description) 
                        LIKE {$searchDataEndMatch} THEN 1
                        WHEN LOWER(Food_Name) like {$searchDataBothMatch} or LOWER(Food_Description) 
                         LIKE {$searchDataBothMatch} THEN 2
                        WHEN LOWER(Food_Name) like {$searchDataStartMatch} or LOWER(Food_Description) 
                 LIKE {$searchDataStartMatch} THEN 3
                 ELSE 4
          END";

          echo $sql;

    $res=$conn->query($sql);




    if ($res->rowCount()>0)
    {
        while($row=$res->fetch(PDO::FETCH_ASSOC))
        {
            ?>



            <div class="col-lg-3 mx-0">
            <div class="card-deck" style="display:flex; flex:flex-wrap; padding:2px;">
                <div class="card bg-transparent p-2 h-100 border-secondary mx-0 mb-2" style="min- 
               height:35rem;max-height:35rem;">
                <img src="<?= 'foodImages/'.$row['Food_Url'] ?>" class="card-img-top img-fluid img- 
                 responsive img-thumbnail" height="100" width="100%">
                <div class="card-body p-1 text-center">

                    <h4 class="card-title text-center text-info"><?php echo $row['Food_Name']; ?>
                    </h4>
                    <h5 class="card-text text-center text-white"><?php echo $row['Food_Description']; 
                ?>
                    </h5>
                    <h5 class="card-text text-center text-danger"><?php echo "Rs 
                     ".$row['Food_Price(Rs)']; ?>
                    </h5>
                    <button class="btn btn-success reviews">Reviews</button>
                </div>

                    <div class="footer p-1">
                        <form action="" class="form-submit">
                        <input type="hidden" class="fid" value="<?php echo $row['Food_Id'] ;?>
                        ">

                        <input type="hidden" class="fname" value="<?php echo $row['Food_Name'] ;?>
                        ">

                        <input type="hidden" class="fprice" value="<?php echo $row['Food_Price(Rs)'] ;?>
                        ">

                        <input type="hidden" class="fimage" value="<?php echo $row['Food_Url'] ;?>
                        ">

                        <input type="hidden" class="ftype" value="<?php echo $row['Food_Type'] ;?>
                        ">

                        <button class="btn btn-info btn-block addItemBtn">Add to cart</button>


                        </form>
                    </div>
                </div>
            </div>
        </div>


<?php } 
    }

    else
    {
        echo "<p class='h4 text-white'>There are no matches! Search again </p>";
    }


}

?>



Why is some sql tables not updated by PUT api requests

I use this code to update table "BI_table", it works fine. If use the same code(but changed table "machines"), it will not update. The controller and class is also the same. My suspicion is, that BI_table has no relations to other tables in my database but machines has. How to update machines table?


[HttpPut]
         public HttpResponseMessage Put(int id,[FromBody]BI_table value) 
        {
            using (testdatabseEntities1 nd = new testdatabseEntities1())
            {
                 var entities = nd.BI_table.FirstOrDefault(e => e.id == id);

                if (entities == null)
                {
                    return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Id findes ikke..");
                }

                else
                {

                    entities.id = value.id;
                    entities.stopcause = value.stopcause;
                    nd.SaveChanges();
                    return Request.CreateResponse(HttpStatusCode.OK, entities);

                }
            }
        }




How to show network traffic in browser?

I have a project and I want to make a simple debug application in Istio. So I want to make a simple webpage which can display the network traffic in realtime.

For example I send traffic to my application and the webpage show network traffic like tcpdump.

So the question is what kind of language need me to perform this? And there is somewhere an example about if somebody display anything like that.

Thanks a lot!




Error running 'Tomcat': Address localhost:1099 is already in use

enter image description here

Error running 'Tomcat': Address localhost:1099 is already in use
The image above is the problem that I currently face.


I tried to solve it by looking at the postings people posted in the face of a problem similar to mine, but I think it's a different matter from mine.
Once in my situation, there is no 'process using 1099 port'.


enter image description here
There is no return value when I type netstat -aon | find "1099".
I've shut down the whole IntelliJ process and rebooted PC.
I don't seem to use port 1099 at all, but there's an error like that.




Keep bootstrap open after firing onclick event

I went through many posts and forums and couldn't find a solution for my problem;

I have a web app using asp.net, and I have a bootstrap modal inside one of my pages, the modal contains textboxes and a button which inserts a record into the DB. The issues is when I click the Save button, the modal disappears. I want to keep the modal open after I click the Save button to see if the event is successful or not or see which textboxes are not filled.

Here is my asp code:

 <div class="modal fade" data-backdrop="static" style="font-size: 30px; font-family: 'FavFont'" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-lg" role="document" style="width: 1250px; text-align: center">
            <div class="modal-content">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <div class="modal-header" style="margin: auto">
                    <h5 class="modal-title" style="margin: auto; font-size: 30px">
                        <label for="forCostumer" dir="rtl">Make payment</label>
                        <asp:TextBox runat="server" ID="forCostumer" class="browser-default custom-select form-control col-12" Style="font-size: 30px; font-family: 'FavFont'; text-align: right"></asp:TextBox>
                    </h5>
                    <br />


                </div>
                <div class="modal-body">
                    <br />
                    <div>
                        <div>

                            <hr style="width: 40%; text-align: center; margin: auto" class="border-0" />

                        </div>
                    </div>
                    <br />

                    <div class="container">

                        <div class="col-sm-12 text-right" style="float: right;">
                            <label for="txtItemName1" dir="rtl">Total</label>
                            <asp:TextBox runat="server" ID="txtNowTotal" class="browser-default custom-select form-control col-12" Style="font-size: 30px; font-family: 'FavFont'; text-align: right"></asp:TextBox>
                        </div>
                        <br />
                        <div class="col-sm-12 text-right" style="float: right;">
                            <label for="txtItemName1" dir="rtl">Paid amount</label>
                            <asp:TextBox runat="server" ID="txtNowPaid" class="browser-default custom-select form-control col-12" Style="font-size: 30px; font-family: 'FavFont'; text-align: right"></asp:TextBox>
                        </div>
                        <br />
                        <div class="col-sm-12 text-right" style="float: right;">
                            <label for="txtItemName1" dir="rtl">Amount to Pay</label>
                            <asp:TextBox runat="server" ID="txtNowToPay" class="browser-default custom-select form-control col-12" Style="font-size: 30px; font-family: 'FavFont'; text-align: right"></asp:TextBox>
                        </div>

                        <div class="col-sm-12 text-right" style="float: right;">
                            <br />
                            <br />

                            <asp:Button ID="btnPayNow" runat="server" UseSubmitBehavior="false" type="button" class="btn btn-success btn-lg" Style="width: 20%; font-size: 40px" OnClick="MakePayment" Text="Make payment" ></asp:Button>
                            <br />
                            <br />







                            <br />
                            <br />
                        </div>
                        <br />



                    </div>

And here is my codebehind:

 protected void MakePayment(object sender, EventArgs e)
    {
        if (string.IsNullOrWhiteSpace(txtNowToPay.Text))
        {
            txtNowToPay.BorderColor = System.Drawing.Color.Red;
        }
        else
        {
            txtNowToPay.BorderColor = System.Drawing.Color.Gray;

            using (SqlConnection ConnectToDB = new SqlConnection(CS))
            {
                ConnectToDB.Open();
                SqlCommand cmdpay1 = new SqlCommand("update TBL_installments set paid_amount = paid_amount + '" + txtNowToPay.Text + "', remain_amount = remain_amount - '" + txtNowToPay.Text + "' where costumer_id = '" + Session["CostIdToSelect"] + "'", ConnectToDB);
                cmdpay1.ExecuteNonQuery();
                SqlCommand cmdpay2 = new SqlCommand("update TBL_debts set paid_amount = paid_amount + '" + txtNowToPay.Text + "', remain_amount = remain_amount - '" + txtNowToPay.Text + "' where costumer_id = '" + Session["CostIdToSelect"] + "'", ConnectToDB);
                cmdpay2.ExecuteNonQuery();
                ConnectToDB.Close();



                GridView1.DataSourceID = "SqlDataSource1";
                GridView1.DataBind();



            }

        }
    }

I'd appreciate anyone who can help.

Thank you




What is the software allow to add auto play videos to a website chatbox area?

I saw a SaaS startup, who allow people to add autoplay marketing videos on websites whare normally chatboxes are. I'm unable to find it. Hope anyone of you might seen this website.




Why to use separate CSS files for components in React.js

I am new to Web Development and currently learning React.js. I learned about how to create Components in React and giving styles to them.

Is it like that if I create separate CSS files for React Components, the app will load faster because the browser has to load small sized CSS files instead of single big file?

I want to ask about how React loads the CSS files in the browser and whether I should use separate CSS files for React Components.




Vue-apollo-graphql. Web testing with different users to test reactivity

I am developing a web service. Debugging the reactivity is proving a pain in the neck.

Is there a library to test a web to see that reactivity works among different users?

Thanks.




how can I get a link (url) of the page that I visited on my site to share it

I showed my website in a application. it was successful I want to share a page from my site I have set up the sharing command, but how can I get the link (url) to the page that I visited on my site to share it




How to be background canvas

I have particles.js on my page but it is in front of the every element. I want to make it background. How can do this? I want to make something like there : https://vincentgarreau.com/particles.js/ My form is behind of the particles canvas. How can i set it in front of the canvas ?

my home page

My style.css and index.html:

/* Particles JS Style */

  
  /* ---- particles.js container ---- */
  
  #particles-js{
    width: 100%;
    height: 100%;
    
    background: linear-gradient(rgb(151, 206, 231) 0%, rgb(253, 253, 253) 100%);
    background-image: url('');
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    top: 0;
  }
 
  /* Particles JS Style  end */
html{
    height: 100%;
    width: 100%;
}

body{
    height: 100%;
    width: 100%;
    
}


canvas {
 position: fixed;
 top:0;bottom:0;right:0;left:0;
 margin:0;
 width: fit-content;
 height: fit-content;

 

}


form {
    display: block;
   
}

.mainContainer {
    min-height: 100vh;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-align: center;
    align-items: center;
    background: url("../img/2.jpg");
    background-size: cover;
    background-position: center center;
    
    font-family: 'Lato', sans-serif;
}


.mainContainer form {
    width: 100%;
    max-width: 940px;
    margin: 0;
    
    background: linear-gradient(rgb(78, 111, 126) 50%, rgb(164, 198, 214) 100%);
    padding: 50px 70px 80px 70px;
    
}

.mainContainer form fieldset {
    margin-bottom: 40px;
    border: 0px;
}

.mainContainer form fieldset legend {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    font-family: 'Poppins', sans-serif;
}

.mainContainer form .inner-form header {
    margin-bottom: 28px;
}

.mainContainer form .inner-form header .icon-line {
    display: -ms-flexbox;
    display: flex;
}

.mainContainer form .inner-form header .icon-line .item {
    color: #555;
    border-radius: 3px;
    background: #fff;
    margin-right: 5px;
    padding: 18px 20px;
    transition: all .3s;
    cursor: pointer;
    position: relative;
    text-align: center;
    
}

.mainContainer form .inner-form header .icon-line .item:after {
    content: '';
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #002c71;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all .3s;
}


.mainContainer form .inner-form header .icon-line .item .group-icon {
    display: -ms-flexbox;
    display: flex;
    width: 100%;
    -ms-flex-pack: center;
    justify-content: center;
    margin-bottom: 10px;
}

.mainContainer form .inner-form header .icon-line .item .group-icon svg {
    width: 20px;
    height: 20px;
    fill: #555;
    margin: 0 4px;
}

.mainContainer form .inner-form header .icon-line .item span {
    font-size: 12px;
    font-weight: bold;
}

.mainContainer form .inner-form header .icon-line .item.active {
    color: #fff;
    background: #002c71;
}

.mainContainer form .inner-form header .icon-line .item.active:after {
    opacity: 1;
}

.mainContainer form .inner-form header .icon-line .item.active svg {
    fill: #fff;
}

.mainContainer form .inner-form header .icon-line .item:hover,
.s012 form .inner-form header .icon-line .item:focus {
    background: #002c71;
    color: #fff;
}

.mainContainer form .inner-form header .icon-line .item:hover .group-icon svg,
.s012 form .inner-form header .icon-line .item:focus .group-icon svg {
    fill: #fff;
}

.mainContainer form .inner-form .main-form {
    position: relative;
}

.mainContainer form .inner-form .main-form .row {
    margin-bottom: 15px;
    
}

.mainContainer form .inner-form .main-form .row .input-line{
    background: #fff;
    border-radius: 3px;
    height: 50px;
    width: 70%;
    position: relative;
    padding: 10px 15px 10px 48px;
}

.mainContainer form .inner-form .main-form .row .input-line .icon-input {
    width: 48px;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: center;
    justify-content: center;
}

.mainContainer form .inner-form .main-form .row .input-line .icon-input svg {
    fill: #ccc;
    width: 20px;
    height: 20px;
    -ms-flex-item-align: end;
    align-self: flex-end;
    margin-bottom: 10px;
}

.mainContainer form .inner-form .main-form .row .input-line .input-field label {
    font-size: 11px;
    font-weight: 900;
    display: block;
    color: #555;
}

.mainContainer form .inner-form .main-form .row .input-line .input-field input {
    font-size: 16px;
    color: #333;
    background: transparent;
    width: 100%;
    border: 0;
    padding: 2px 0;
    font-family: 'Lato', sans-serif;
    margin-top: 5px;
}

.mainContainer form .inner-form .main-form .row .input-line .input-field input.placeholder {
    color: #808080;
}

.mainContainer form .inner-form .main-form .row .input-line .input-field input:-moz-placeholder {
    color: #808080;
}

.mainContainer form .inner-form .main-form .row .input-line .input-field input::-webkit-input-placeholder {
    color: #808080;
}

.mainContainer form .inner-form .main-form .row .input-line.input-field input.hover,
.mainContainer form .inner-form .main-form .row .input-line .input-field input:focus {
    box-shadow: none;
    outline: 0;
}

.mainContainer form .btn-search {
    right: 0px;
    min-width: 100px;
    height: 50px;
    padding: 0 15px;
    background: #ff8300;
    white-space: nowrap;
    border-radius: 3px;
    font-size: 16px;
    color: #fff;
    transition: all .2s ease-out, color .2s ease-out;
    border: 0;
    cursor: pointer;
    font-weight: 900;
    

}

.mainContainer form .btn-search:hover {
    background: #e67600;
}

@media screen and (max-width: 767px) {
    .mainContainer form {
        padding: 30px 15px;
    }

    .mainContainer form fieldset legend {
        text-align: center;
        
    }

    .mainContainer form .inner-form header {
        overflow: hidden;
    }

    .mainContainer form .inner-form header .icon-line {
        overflow-x: auto;
    }

    .mainContainer form .inner-form header .icon-line .item {
        width: 100%;
        min-width: 170px;
    }
}

#motherboard {
    margin-top: 20px;
    font-size: 28px;
}
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    
   </head>
 
  <body id="particles-js" >
    <div class="mainContainer"  >
      <!-- scripts -->
  <script src="public/particles.js"></script>
  <script src="public/js/app.js"></script>
      <form>
        <fieldset>
          <legend>Donanım Motoru</legend>
        </fieldset>
        <div class="inner-form">
          <header>
            <div class="icon-line" id="iconContainer">
              <div class="item active" id="">
                <div class="group-icon">
                 <i class="fas fa-hdd"></i>
                </div>
                <span>SSD</span>
                </div>
              <div class="item" id="">
                  <div class="group-icon">
                   <i class="fas fa-server"></i>
                  </div>
                  <span>EKRAN KARTI</span>
                </div>
              <div class="item" id="">
                <div class="group-icon">
                <i class="fas fa-microchip"></i>
                </div>
                <span>İŞLEMCİ</span>
              </div>
              
              <div class="item"  id="">
                <div class="group-icon">
                  <i class="fas fa-memory"></i>
                 </div>
                <span>RAM</span>
              </div>
            </div>
            
          </header>
          <div class="main-form" id="main-form">
            <div class="row">
              <div class="input-line">
                <div class="icon-input">
                    <i class="fas fa-border-none motherboard" id="motherboard"></i> 
                </div>
                <div class="input-field">
                  <label>ANAKARTINIZ</label>
                  <input type="text" placeholder="Bilgisayar modeliniz" />
                </div>
              </div>
            </div>
       
           
           
           <style>
              .searchButtontoRight {
                    position: absolute;
                    right: 0 px;
               }
              </style>
           
            <div class="row last">
               <button class="searchButtontoRight btn-search " type="submit" id="btnSearch">Ara</button> 
              
            </div>
            <script src="public/js/selection.js"></script>
            
          </div>
        </div>
      </form>
    </div>
  </body>


    
    
    <link href="https://fonts.googleapis.com/css?family=Lato:400,700,900|Poppins:700" rel="stylesheet" />
    <link href="public/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="public/fontawesome-free-5.12.0-web/css/all.css" rel="stylesheet" type="text/css" />
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

   

</html>

I am new for web development. Plase help me...




Website work only for my pc - Based iframes / object tag

I will try to make it simple. I build a tool that helps people to make their own dashboard. http://webager.net/

In the first version, the client gave a full URL and I turned it into a screen (Based on iframe tag + "x-frame-bypass" script from Github).

After I uploaded the website (AWS, S3, Route53) it worked only for my pc and another pc at my home.

Then I changed the <iframe> tag to <object> tag and it worked for me well without the external script. Still, the same result. It worked also with big websites like twitter and youtube, but people see an only blank screen.

X-frame-options - just wasn't relevant.

It should be looking like this: https://i.imagesup.co/images2/da718cf6a68f2dadc93eed4bbe21a25627939bad.png

** I uploaded the website yesterday.

Thank you very much! Thank you very much !




I am getting this since 2 days. routes error in php please

Uncaught Exception: No routes found for this Uri in C:\xampp\htdocs\PDO\core\router.php:23 Stack trace: #0 C:\xampp\htdocs\PDO\index.php(14): Router->direct('PDO') #1 {main} thrown in C:\xampp\htdocs\PDO\core\router.php on line 23.

I am not getting this since two days. help with this please.




vendredi 28 février 2020

Flip Card doesn't focus and scroll with mouse wheel on both sides

I have a flip card with two long texts and when I am on the front sides it doesn't focus on scroll and doesn't scroll with mouse wheel or by finger when I am on cellphone.

I searched and used similar codes and ideas but none of them helped me. I thank you in advance if you could help me fix it.

my html:

<div class="flipCard"> 
  <div class="card" onclick="this.classList.toggle('flipped');"> 

    <div class="side front"><table><td>This is the front side of my flip card. It's a long text and the scroll doesn't focus and work with mouse wheel automatically.</td></table></div> 

    <div class="side back"><table><td>This is the back side of my flip card. It's a long text and the scroll focuses and works fine with mouse wheel.</td></table></div>

  </div>
</div>

and this is my css sorry that I couldn't summarize it more:

.flipCard {
  -webkit-perspective: 800;
  -ms-perspective: 800;
  -moz-perspective: 800;
  -o-perspective: 800;
   width: 400px;
   height: 200px;
   position: relative;
   margin: 50px auto;
}

.flipCard .card.flipped {
  transform:rotatey(-180deg);

}

.flipCard .card {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: 0.5s;
}

.flipCard .card .side {
  width: 100%;
  height: 100%;
  padding: 10px;
  cursor: pointer;
  position: absolute;
  z-index: 2;
  backface-visibility: hidden;  /* W3C */
  overflow: auto;
}

.flipCard .card .back {
  background: white;
  color: black;
  transform:rotatey(-180deg);
}

.flipCard .card .front {
  font-family: Georgia;
  font-size: 3em;
  text-align: center;
  background-color: #7030a0;
}

.flipCard .card .back {
  background-color: #dbb2f9;
  padding: 0.6em;
  font-family: Georgia;
  font-size: 1.0em;
  text-align: center;
}

table{
    height: 100%;
    width: 100%;
}
td{
    vertical-align: middle;
    text-align: center;
}
.front td{
  color: white;
  font-family: Georgia;
  font-size: 1.0em;
}
.back td{
  font-family: Georgia;
  font-size: 2.5em;
}

I have my code here too: https://codepen.io/teslapixela/pen/xxGdvoG




how to fix image for all scree sizes in bootstrap or css?

Best Business Services Lets Grow Your Business Togather

Quick Call enter image description here


Insert values into MySQL database (JavaScript)

I’m working a sign up function but have no knowledge on PHP. Basically I want to insert all the info in the signup onto a database like all sign up forms do. Then the login function will be able to check if that information is already there. Anyway, I’m a noob at MySQL so how would I approach this? I want to use vanilla JS and not Node or other stuff. I’ve heard it’s possible to do this but I don’t know how I would go about doing this. Sorry if I didn’t explain this well; First post on Stack...




How to implement Websockets on Codeigniter?

I need to send progress notifications on a process' state during the process in my Codeigniter app. I asked my professors, and they said the best solution is Websockets. I found a great library for websockets in codeigniter here, and it does work, but I can't seem to figure out how to send messages from the model to a view.

I did the simple setup with the "php vendor/takielias/codeigniter-websocket/install.php --app_path=application" command, and I was able to have to 2 'clients' talk to one another in real time. I was even able to get one of them to talk to my view php file.

Now I just need to get the model to talk to the view. I tried adding this to the top of the model file:

defined('BASEPATH') OR exit('No direct script access allowed');
require('vendor/autoload.php');

use WebSocket\Client;

And then I try to log in in the modal's constructor with this:

            $this->client = new Client('ws://0.0.0.0:8282');

            $this->client->send(json_encode(array('user_id' => 1, 'message' => null)));
            $this->client->send(json_encode(array('user_id' => 1, 'message' => 'Super cool message to myself!')));

The readme states that the first message is necessary for validation of the connection.

Despite this, I never receive the message on the view file. The socket code in my view is:

var conn = new WebSocket('ws://localhost:8282');
var client = {
    user_id: 1,
    recipient_id: null,
    type: 'socket',
    token: null,
    message: null
};

conn.onopen = function (e) {
    conn.send(JSON.stringify(client));
    $('#messages').append('<font color="green">Successfully connected as user ' + client.user_id + '</font><br>');
};

conn.onmessage = function (e) {
    var data = JSON.parse(e.data);
    if (data.message) {
        $('#messages').append(data.user_id + ' : ' + data.message + '<br>');
    }
    if (data.type === 'token') {
        $('#token').html('JWT Token : ' + data.token);
    }
};

Let me guess, its the ports? I played around with them to no avail. Any ideas?




Flask can not serve file accesed in javascript

I have a flask app:

app-|
    app.py
    templates-|
              index.html
    static-|
           main.js
           audio.mp3 

This is how I get the audio in main.js: audio = new Audio('audio.mp3');
but i get this Error: "GET /audio. mp3 HTTP/1.1" 404 - I tried all paths i could think of. Nothing worked.

If i try to get the file directly through the URL like ip\static\audio.mp3 it works. Also if i have all files in a folder and open the html document. What can i do to fix it? I could not find anything related to this. But im new to webdev so maybe i search the wrong termes




How do I set an interval, clear it, the reset the interval with the same exact ID

So basically I would like something like this

Inter = setInterval(Function, 1000);
clearInerval(Inter);
Inter = setInterval(Function, 1000);

For some reason something similar won't work for me, I'd post it all but I have no comments and no sense of organization. Is this supposed to work, or is their something I am missing?

Edit : Okay so I'll try to better explain this. So basically, I have an interval set, and a function to clear said interval. I need these to reset after every input, so the clearInterval has to recognize an interval with the same ID as it began with, so I need to basically re-use the ID, but for some reason it doesn't work. Hopefully thast madness made semi sense




Is there a free cloud database I can use for my portfolio web app? [closed]

I created a little web app for my portfolio while I'm learning React/Node. I am using MySql workbench at the moment locally. I would like to be able to plug that in to something free in the cloud just to display my app. Doesn't have to be huge storage or anything, just something free.




SOAP WEB SERVICE - javax.xml.ws.WebServiceException: class com.developer.jaxws.Update do not have a property of the name devdesc

I am wondering why I am getting this error in my soap web server. where could I insert the property needed to properly deploy it. I have tried creating new web service and recreate the operations but the same error persist. I also tried removing and reinstalling glassfish server. where could I find it? I am using Netbeans 8.0.2 with glassfish 4.0. Thanks

javax.xml.ws.WebServiceException: class com.developer.jaxws.Update do not have a property of the name devdesc
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:610)
at com.sun.xml.ws.server.sei.TieHandler.createArgumentsBuilder(TieHandler.java:143)
at com.sun.xml.ws.server.sei.TieHandler.<init>(TieHandler.java:115)
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:110)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:127)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:487)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:283)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:158)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:639)
at org.glassfish.webservices.WSServletContextListener.registerEndpoint(WSServletContextListener.java:267)
at org.glassfish.webservices.WSServletContextListener.contextInitialized(WSServletContextListener.java:104)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)

source code

        /*
         * To change this license header, choose License Headers in Project Properties.
         * To change this template file, choose Tools | Templates
         * and open the template in the editor.
         */

        package com.developer;

        import java.sql.Connection;
        import java.sql.PreparedStatement;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import javax.jws.WebService;
        import javax.jws.WebMethod;
        import javax.jws.WebParam;

        /**
         *
         * @author PCTechRinz
         */
        @WebService(serviceName = "ProjectSoapService")
        public class ProjectSoapService {

            Connection con = DBConnect.serverConnect();
            private String uniquename;
            private String desc;
            private int id;

            public void setUniqueName(String value){ this.uniquename = value;}
            public void setDescription(String value){ this.desc = value;}
            public void setID(int value){ this.id = value;}

            public String getUniqueName(){ return this.uniquename;}
            public String getDescription() {return this.desc;}
            public int getID(){ return this.id; }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "insert")
            public String insert(@WebParam(name = "name") String name, @WebParam(name = "id") int id, @WebParam(name = "devdesc") String description) {

                String res = "";
                try {
                    String sq = "Insert into projects(uniquename,id,descrption) values ('"
                            + name + "','"
                            + id + "','"
                            + description + "');";
                    PreparedStatement st = con.prepareStatement(sq);
                    st.execute();
                    res = "Success";
                } catch (Exception e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "search")
            public String search(@WebParam(name = "name") String name) {
                String res = "";
                this.id = 0;
                this.uniquename = "";
                this.desc = "";

                try {
                    String query = "SELECT * FROM projects where uniquename='" + name + "';";

                    // create the java statement
                    Statement st = con.createStatement();

                    // execute the query, and get a java resultset
                    ResultSet rs = st.executeQuery(query);

                    // iterate through the java resultset
                    while (rs.next()) {
                        this.id = Integer.valueOf(rs.getString("id"));
                        this.uniquename = rs.getString("uniquename");
                        this.desc = rs.getString("description");

                    }
                    st.close();
                    res = "Found";
                } catch (SQLException e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "delete")
            public String delete(@WebParam(name = "name") String name) {
                String res = "";
                try {
                    String sq = "Delete from projects where uniquename ='" + name + "';";
                    PreparedStatement st = con.prepareStatement(sq);
                    st.execute();
                    res = "Success";
                } catch (Exception e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "update")
            public String update(@WebParam(name = "name") String name, @WebParam(name = "id") int id, @WebParam(name = "devdesc") String description) {
                String res = "";
                String found = this.search(uniquename);

                if (found.equals("Found")) {
                    try {
                        String query = "update projects set id = '"
                                + String.valueOf(id) + "', description = '"
                                + description + "' where uniquename = '"
                                + name + "'";
                        PreparedStatement preparedStmt = con.prepareStatement(query);
                        // execute the java preparedstatement
                        preparedStmt.executeUpdate();
                        res = "Success";
                    } catch (SQLException e) {
                        res = e.toString();
                    }
                } else {
                    res = "Not Exist";
                }
                return res;
            }





        }

changing property name does not work




Firebase Storage Downloading Image CORS error [JavaScript]

When I run the code below, I got CORS error and any help would be greatly appreciated. Thanks I tried a few answers in this topic here in StackOverflow but nothing helped me.

// Your web app's Firebase configuration
      var firebaseConfig = {
        apiKey: "**********",
        authDomain: "********",
        databaseURL: "********",
        projectId: "********",
        storageBucket: "********",
        messagingSenderId: "********",
        appId: "********",
        measurementId: "********"
      };

      // Initialize Firebase
      firebase.initializeApp(firebaseConfig);

      var storage = firebase.storage();
      var storageRef = storage.ref('image');
      var starRef = storageRef.child('image1.jpg');

      starRef.getDownloadURL().then(url => {
        console.log(url);
      })

enter image description here




How do I get a count of users and web pages by sub-domain using Dynatrace or Google Analytics?

I work at a company with a website which is translated to 3 languages. We are trying to price out some competitors language translation services and they asked for some page load metrics. Each language has its own subdomain for instance:

  • spanish: es.mydomain.com
  • french: fr-ca.mydomain.com
  • english: www.mydomain.com

I am trying to figure out how many total users hit the site (based on session) and also the total number of pages loaded on each domain/language over the last year (for instance 3000 sessions hit the french page and a total of 30000 pages were loaded).

We have dynatrace and google analytics but Im struggling to figure out where to find this information. Seems like it should be available somewhere. Google Analytics doesn't seem to report anything based on sub-domain. Dynatrace is probably my best bet but its so vast I cant seem to figure out the exact right place to look (seems like its used more for error monitoring than analytics tracking).




ASP.NET Core - Maintaining one instance of object for each user on webpage

I'm currently creating a demo webpage in ASP.NET Core for the company I work for. The server maintains a model of a bayesian network that calculates probabilities, given the users input on the client. It is important that the users on the client each have their own network with the probabilities based on their input.

To maintain the network throughout requests, I tried to add the network as a scoped service thinking it would create one instance for each client. I did so by adding services.addScoped<networkClass>(networkClass); in startup and injecting it into my controllers of which the user requests. It didn't work obviously. As I thought about it more, I also realized that I had to somehow know when the user leaves his session so that I can delete the network.

My question is: if I want each web user/client to have their own instance of a, say mathematical network, in ASP.NET Core using MVC and Angular, how would I go about that? And how would I make it last throughout the users session and then notify the server when the user exits the domain so I can delete the network?

Sorry if it is a stupid question, i am fairly new to web development so if you have some documentation on the matter as well that would be appreciated.

Thanks




Particles JS - How to make background?

i am new at particles.js. I am trying to make a background via using particles.js But it looks like below.

Picture

As you can see, canvas comes below of the my form. I want to make it behind of my form. How can do this? Please help me...




Crawling problem about the page_source in Python

I try to crawl the product title and other information in the website. There is a category and then a page. In the page, there is a product list. I click one of the products in the list and then I crawl the information(title, etc.). After crawling, I click to go back to the list. I click next one of the products in the list until specific page and category.

This is my logic.

There is a problem that under 'for i in range(0,20):' driver.get(url) html = driver.page_source soup = BeautifulSoup(html, 'html.parser') html and soup has the page_source(information) about the products list, not the information about the product. I tried to get the current URL and get the information but the source keep having the prior page information.

I need a help about it.

def get_search_page_url(category, page):
    return('https://www.missycoupons.com/zero/board.php#id=hotdeals&category={}&page={}'.format(category, page))

def get_prod_items(prod_items):
    prod_data = []

    for prod_item in prod_items:

        try:
            title = prod_item.select('div.rp-list-table-row.normal.post')[0].text.strip()
        except:
            title =''
        prod_data.append([title])

    return prod_data

#####
driver = webdriver.Chrome('C:/chromedriver.exe')

driver.implicitly_wait(10)

prod_data_total =[]
for category in range(1, 2):
    for page in range(1, 2): 

        url = get_search_page_url(category, page)
        driver.get(url)

        time.sleep(15)

        for i in range(0,20):
            driver.find_elements_by_css_selector("div.rp-list-table-cell.board-list.mc-l-subject>a")[i].click()
            url=driver.current_url
            driver.get(url)
            html = driver.page_source
            soup = BeautifulSoup(html, 'html.parser')

            prod_items = soup.select('div#mc_view_title')
            prod_item_list = get_prod_items(prod_items)

            prod_data_total = prod_data_total + prod_item_list

            driver.back()
            time.sleep(5)



Collecting subpages on using R

pagelinklists <- NULL
for(i in (2:144)){
page <-        qq("https://forum.federalsoup.com/default.aspx?g=topics&f=4&p=@{i}")
pagenumber <- LinkExtractor(page)
pagelinklists <- c(pagelinklists,     pagenumber$InternalLinks)
}
pagelinklists <- gsub("amp;", "",     pagelinklists)
pagelinklists <- pagelinklists [str_detect(pagelinklists, "g\\=posts\\&t\\=\\d+$")]
pagelinklists <- unique(c(URLlist, pagelinklists))

for(i in (pagelinklists)){
pages <- LinkExtractor(i)
subpages <- c(subpages, pages$InternalLinks)
subpages <- gsub("amp;", "", subpages)
subpages <- subpages [str_detect(subpages, "g=posts\\&t=\\d+\\&p=\\d+$")]
}

I entered the above lines, which should spit out a variable of lists of URLs I’m looking for. However, there’s an Error: : '' does not exist in current working directory I’m not sure what to do now




div is not getting aligned properly on project page

I want the whole .main class starting with "dashboard" to get aligned properly to the top of the page and want it adjacent to the sidebar but it's alignment is going below the sidebar.

This is how my page looks like: https://i.stack.imgur.com/Zp5Av.png Target page look: https://i.stack.imgur.com/bgcoy.png

body{
        font-family: 'Rosario' ;
 
}

.sidebar{
    margin:10px -8px 20px 20px; 
}

.sidebar>li>a{
    padding:  20px 20px;
}

.main{
    margin-top: 5px;
    
    padding: 20px;
    
}

.placeholders{
    margin-top: 10px;
    margin-bottom: 30px;
}

.placeholder{
    margin-bottom: 20px;
}

.placeholder img{
    display: inline;
    border-radius: 50%;
    
}

body, .sticky-footer-wrapper {
   min-height:100vh;
}

   

 
<!DOCTYPE html>
<html lang="en">

<head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
        <link rel="stylesheet" href="css/adminboard.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/js/all.min.js">
    <link href="https://fonts.googleapis.com/css?family=Rosario&display=swap" rel="stylesheet">

    </head>
<body>
        <title>Admin Dashboard</title>
                

<!--navbar starts here       -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar-fixed-top">
  <a class="navbar-brand" href="#">Admin Dashboard</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#"><i class="fas fa-tachometer-alt"></i> Dashboard<span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-cogs"></i> Settings</a></li>
      <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-user"></i> Profile</a></li>
      <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-question-circle"></i> Help</a></li>

      
    </ul>
    <ul class="navbar-nav ml-auto">
   
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
     <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-user-plus"></i> Add Users</a></li>
      <li class="nav-item"><a class="nav-link" href="#"><i class="far fa-copy"></i> Add Categories</a></li>
     
    
    </ul>
  </div>
</nav>

<!--navbar ends </here>-->

<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 ">
 <ul class="nav flex-column sidebar">
  <li class="nav-item"><a class="nav-link active" href="#"><i class="fas fa-chart-area"></i> Reports</a></li>
  <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-chart-pie"></i> Stats</a> </li>
  <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-chart-line"></i> Graphs</a></li>
  <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-users"></i> Users</a></li>
</ul>

<ul class="nav flex-column sidebar">
<li class="nav-item"><a class="nav-link active" href="#"><i class="fas fa-chart-area"></i> Old Reports</a></li>
  <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-dollar-sign"></i>  Revenues</a></li>
  <li class="nav-item"><a class="nav-link" href="#"><i class="fas fa-globe"></i> Countries</a></li>
  <li class="nav-item"><a class="nav-link" href="#">Spammers</a></li>
</ul>
</div>
      </div>
            <div class="col-sm-9 col-md-10 main">
               <h1 class="page-header"><i class="fa fa-tachometer" aria-hidden="true"></i>
                 Dashboard</h1>
          <div class="row placeholders">
              <div class="col-xs-6 col-sm-3 placeholder">
                  <img src="images/graph.png" class="img-responsive" width="200" height="200" alt="">
                  <h4>Label</h4>
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
              </div>
              <div class="col-xs-6 col-sm-3 placeholder">
                  <img src="images/graph.png" class="img-responsive" width="200" height="200" alt="">
                  <h4>Label</h4>
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
              </div>
              <div class="col-xs-6 col-sm-3 placeholder">
                  <img src="images/graph.png" class="img-responsive" width="200" height="200" alt="">
                  <h4>Label</h4>
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
              </div>
              <div class="col-xs-6 col-sm-3 placeholder">
                  <img src="images/graph.png" class="img-responsive" width="200" height="200" alt="">
                  <h4>Label</h4>
                  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
              </div>
          </div>
          <h2 class="sub-header">Detailed Result</h2>
          <hr>
          <div class="table-responsive">
              <table class="table table-striped">
                  <thead>
                      <tr>
                          <th>ID#</th>
                          <th>Detail 1#</th>
                          <th>Detail 2#</th>
                          <th>Detail 3#</th>
                          <th>Detail 4#</th>
                      </tr>
                  </thead>
                  <tbody>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                      <tr>
                          <td>234</td>
                          <td>John</td>
                          <td>Pentesting</td>
                          <td>China</td>
                          <td>90$</td>
                      </tr>
                  </tbody>
              </table>
          </div>
           </div>
           </div>
       
    

        <footer class="bg-dark text-white mt-4">
    <div class="container-fluid py-3">
        <div class="row">
            <div class="col-md-3">
                <h5>Footer</h5></div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
        </div>
        <div class="row">
            <div class="col-md-6">I stay at the bottom of the viewport! <span class="small"><br>Unless the page content pushes me further.</span></div>
            <div class="col-md-3"></div>
            <div class="col-md-3 text-right small align-self-end">©2020 Brand, Inc.</div>
        </div>
    </div>
</footer>




        

        <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>

        


</body>
</html>



Which hosting should I use for an Angular WebApp?

I have a web site made with Angular but I don't know which hosting service should I use? I deployed an Angular App with Cloud Foundry Hosting before, but now I want to try another service, maybe a better one. Thanks a lot!




CSS dinamically added with Javascript visual bug [closed]

I used this CSS template for my schedule web app, but it has a bug that it needs to be in the responsive form to look good, I just show you, I have no clue why this happens because I'm really new in CSS and I just use this CSS template from GitHub

You can try it yourself in: gilbertomarcano.github.io

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

I'm very sorry if I do not make myself clear but I'm new in this

My HTML li looks like

<div class="cd-schedule cd-schedule--loading margin-top-lg margin-bottom-lg js-cd-schedule">
    <div class="cd-schedule__timeline">
      <ul>
        <li><span>07:00</span></li>
        <li><span>07:30</span></li>
        <li><span>08:00</span></li>
        <li><span>08:30</span></li>
        <li><span>09:00</span></li>
        <li><span>09:30</span></li>
        <li><span>10:00</span></li>
        <li><span>10:30</span></li>
        <li><span>11:00</span></li>
        <li><span>11:30</span></li>
        <li><span>12:00</span></li>
        <li><span>12:30</span></li>
        <li><span>13:00</span></li>
        <li><span>13:30</span></li>
        <li><span>14:00</span></li>
        <li><span>14:30</span></li>
        <li><span>15:00</span></li>
        <li><span>15:30</span></li>
        <li><span>16:00</span></li>
        <li><span>16:30</span></li>
        <li><span>17:00</span></li>
        <li><span>17:30</span></li>
        <li><span>18:00</span></li>
      </ul>
    </div> <!-- .cd-schedule__timeline -->

    <div class="cd-schedule__events">
      <!-- -->
      <ul>
        <li class="cd-schedule__group">
          <div class="cd-schedule__top-info"><span>Monday</span></div>

          <ul id='monday-ul'>
          </ul>
        </li>

        <li class="cd-schedule__group">
          <div class="cd-schedule__top-info"><span>Tuesday</span></div>

          <ul id='tuesday-ul'> 
          </ul>
        </li>

And I append every event using this JS code

createDayEvent(subject, day, weekdayid) {
    // Creating the li element
    const li = document.createElement('li')
    li.classList.add('cd-schedule__event')

    // Creating the em element 
    const em = document.createElement('em')
    em.classList.add('cd-schedule__name')
    em.textContent = subject.name
    em.value = subject.name

    // Creating the a element and its attributes
    const a = this.createElement('a')
    const dataStart = this.createAttribute('data-start', this.intToDate(day.hours[0]))
    const dataEnd = this.createAttribute('data-end', this.intToDate(day.hours[day.hours.length - 1] + 1))
    const dataContent = this.createAttribute('data-content', 'event-abs-workout')
    const dataEvent = this.createAttribute('data-event', 'event-1')
    const href = this.createAttribute('href', '#0')

    // Set attributes
    a.setAttributeNode(dataStart)
    a.setAttributeNode(dataEnd)
    a.setAttributeNode(dataContent)
    a.setAttributeNode(dataEvent)
    a.setAttributeNode(href)

    // Append everything to the correspond element
    a.appendChild(em)

    li.appendChild(a)

    // Getting the correct ul element and append the li
    const weekday = document.getElementById(weekdayid)

    weekday.appendChild(li)
}



Generating images for web from .psd file

I am trying to make a website that has custom t-shirts.

I currently have a photoshop mockup with two smart objects that need to be edited in order to create the custom image of the t-shirt.

I am trying to understand the possibility of using the .psd file that I created to generate the image when the user inserts the images to place on the t-shirt (front and back).

Searching around the internet, I couldn't find anything to help me understand neither if it is possible nor a better way of doing so.

I found this example that could explain my intentions: https://printify.com/app/editor/6/29?g=v2




I want to make this type of CSS design and i don't know how to do it [closed]

I am designing a website where I'm stuck on this layout:

designe




Am working on nginx for web deployment.Am facing issue while converting the files with uppercase to lowercase

In apache we have mod spelling module to this .How can we achieve in nginx




Deploy django app as static pages on common static web-hosting provider? [closed]

I've worked a few times on django but I'm not an expert and I don't know all the low level functionalities of the framework.

With that in mind, I was wondering if there's is a way to deploy a django app as a static website or if there's something out there that generates html pages out of a django project (connecting routes to files, fixing links, etc.) and then store those generated files on static web-hosting provider (i.e. github-pages)

I've looked around but I couldn't find anything worth trying out.

What do you guys suggest?




How to control multiple request to wordpress site?

Website receiving multiple requests continuously from the same IP and CPU memory usage reached 98%. Is there any Wordpress plugging to block the IP automatically when we receive multiple requests from the same IP, instead of manually block the IP.

Please suggest a solution for this.




how to break a long words in new line when there is no space to fit

this must be a css problem but I am not entirely sure if you can achieve this using only css and have a perfect typography on my site!

My following code looks like:

overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;

but for some reason it does not seem to work, tested with Chrome and Edge! The words are breaking to a new line as whole word instead of showing part of it to the remaining space and the next characters to new line!

Any idea how to solve this?




Show a firebase-hosted webapp on different webpage

I created a chatbot-gui using firebase and now I want to put this bot on a different website. The bot is hosted on a own webpage provided by firebase. The background behind the bot is blank and I want to display the bot "on-top" of a different website. I just want to add a script to the side which loads the Firebase Website and displays it on top of the website.

Sorry for the bad explanation but maybe somebody has already dealt with that topic.




PCI Scan Failure : Web Server Stopped Responding [closed]

We have problems with pci scanning.

As a result of the scan;

  • 1 - Web Server Stopped Responding QID: 86476 Category: Web server

  • LEVEL 3

PORTS : 2082, 2086, 2095, 7781, 2077, 2079, 2080, 2078....

We don't know how we can fix it? We Use WHM / Cpanel..

Can you help me. Thanks..




Problem with puppeteer web scrape Problem

I have the need to scrape a list of URLs to collect the Title, ImageURL and Content form the URLs and put them into a JSON file to import.

But I can't seem to get it to work in a for loop, as it worked for one URL only but not since adding the FOR loop in.

Could I get some help on this?

const puppeteer = require('puppeteer');

async function scrapPamphlets()
{
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  const urls = ['https://www.bibleed.com/the-divine-origin-of-the-bible.html','https://www.bibleed.com/god-and-creation.html'];

for (let i = 0; i < urls.length; i++) {
const pamphletURL = urls[i];

await page.goto(`${pamphletURL}`, {waitUntil: 'networkidle2'});

let pamphletData = await page.evaluate(() => {
      let data = [];
      // get the page elements
      let pamphletElms = document.querySelectorAll('div[class="wsite-section-elements"]');
      // get the pamphlet data
      pamphletElms.forEach((pamphletelement) => {
          let pamphletJson = {};
          try {
              pamphletJson.title = pamphletelement.querySelector('h2').innerText;
              pamphletJson.imgURL = 'https://www.bibleed.com' + pamphletelement.querySelector('div div.wsite-image a img').getAttribute('src');
              pamphletJson.txtContent = pamphletelement.querySelector('.paragraph').innerText;
          }
          catch (exception){
          }
          data.push(pamphletJson);
      });
      return data;
})
}

 // save data to json file
 const fs = require('fs');
 fs.writeFile('pamphletData.json', JSON.stringify(pamphletData), err => err ? console.log(err): null);

await browser.close();
}

scrapPamphlets();



jeudi 27 février 2020

Error in exporting data table to excel in JavaScript

I am exporting my data table to Excel by JavaScript. And it's working properly. But when i export more than 70-80 rows its not working and page is being redirected to "#blocked" page.

enter image description here

How can i fix this? Please. This is js code which i am using:

<script type="text/javascript">
var tableToExcel = (function() {
  var uri = 'data:application/vnd.ms-excel;base64,'
    , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>'
    , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
    , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  return function(table, name) {
    if (!table.nodeType) table = document.getElementById(table)
    var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
    window.location.href = uri + base64(format(template, ctx))
  }
})()
</script>



Dynamic color change

OK so I'm designing a website for a client. He builds storage units. He wants customers to select a color option and it change the color of the cabin image. I have no idea how to do this. Any tips




Internet Explore 11 can't load all records

I have a website. When I load all records from my DB, with IE, it's can't load all records and cause lag to my computer. But with another browser like Google Chrome, I can load all records and don't have any problems. I had read some info about IE and i think it's because of disk space. Anyone help me pls?




Javascript console.log weird behavior on browser console

If i run the following code on chrome or firefox directly into the console, on the first log the value of value2 is 0 in the inlined representation, but if I expand the representation to check the whole object, it is showed as 17. Is this a multi browser bug or I am missing something with javascript here? The reason I am asking this question here is because this behaviour is happening across different browsers, which makes me think there is some kind of catch on the language or the function that I am not aware of.

Actual code:

action = new Object();
action.value1 = 17;
action.value2 = 0;

console.log(action);
action.value2 = action.value1;
console.log(action);

Tested on MacOS Catalina with the latest version of both browsers.

EDIT-----------------

The problem is the first console.log prints value2 being 0 but when I expand the object details it is showed as 17. I attached a print to clarify the question.

PRINT OF THE CONSOLE RESULTS

I would expect the result to be 0 on the value2 of the first output even with the expanded view.




Is there a way to run a python script from a website? [closed]

Some background that may help you answer this question: I'm an intermediate python programmer who has very little experience in HTML and web development. I'm looking to store a python script, I created, on a website for users to use. The script reads excels files and outputs data/info based on user input.

I've been trying to research a solution for this without much success. Ideally, I picture a website where a user can click on a button that automatically executes the script. There would also be some sort of interface that the user can interact with and enter inputs. Finally, the user should easily be able to download the files created by my script.

Does anyone know of a good web development platform to implement something like this or advice on how you would go about? I've never created a website before so sorry if this seems like a really basic or obvious question. Thank you and I appreciate any help.




Disable mobile browser swipe to go back behavior?

I'm building a feature that let's users drag different items around. However, when they drag an item that's near the edge of the screen of their phone, the browser goes back to the last page. Does anyone know if it's able to disable this in a single <div> or is it impossible?




SSL domain or ip public?

I have a question I need to install SSL HTTPS, I have an aplication on wampserver with public ip but whithout SSL I will buy a domain example.com and I need enable the SSL with public ip and the new domain




How to restrict the number of concurrent requests to a specific ASP.NET Core web method?

I'd like to know the best way to restrict the number of concurrent requests to a specific ASP.NET Core web method? The limit would apply to all users of the application, not just the requesting user.

Calls to my controller method can be memory intensive, so I'd like to restrict the number of requests to, say, 2. I'd like the maximum number of requests to be configurable via app settings.

If 2 requests are already being processed, I like the web method to return an error HTTP response - perhaps 503 for Service Unavailable (unless there is a more appropriate HTTP code?)

  • Is there anything built into .NET Core that I can use? (I'm using .NET Core 3.1)
  • Or should I use a semaphore on the web method?

Thanks

Should I just put a semaphore on the web method?