vendredi 31 janvier 2020

Checkbox must be placed within the form tag with runat=server

I have the belowe code, when I load the page it says:

"Checkbox must be placed within the form tag with runat=server"

Why is it throwing this error while the checkbox is inside the form tag?!.

<form id="form1" runat="server">
  <asp:scriptmanager runat="server"></asp:scriptmanager>
       <asp:CheckBox ID="CheckBox1" runat="server" />
<div>

      <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="900" Height="600"></rsweb:ReportViewer>
</div>
</form>



Delete method is not working in web api core

Iam using web api core in my application get and post method is working fine

these are code

 public class DepartmentController : Controller
    {
        [HttpGet]
       [Route("api/Departments")]
        public List<Department> Get()
        {
            DepartmentDbContext Db = new DepartmentDbContext();
            List<Department> Departments = Db.departments.ToList();
            return Departments;

        }
        [HttpPost]
        [Route("api/Departments")]      
        public string Post([FromBody] Department department)
        {
            DepartmentDbContext Db = new DepartmentDbContext();      
                try
                {
                    Db.departments.Add(department);
                    Db.SaveChanges();
                    // return department;
                    return "Added Successfully";
                }
                catch (Exception)
                {
                    return "Record Not Added";
                }    
        }
}

the above code working fine and also worked fine in postman also

but delete method is not working

here is the code

[HttpDelete]
[Route("api/Departments")]
public int Delete(int id)
{
    DepartmentDbContext Db = new DepartmentDbContext();
    try
    {
        Department dept = Db.departments.Where(x => x.DepartmentID == id).FirstOrDefault();
        Db.departments.Remove(dept);
        Db.SaveChanges();
        return 1; 
    }
    catch(Exception)
    {

        return -1; 
    }
}

this code is not working in postman also

how to solve this

Regards

Baiju




Using Selenium to automate duo authentication, but the chrome webdriver gets CSP error

I'm trying to automate the process of logging into my university account using Selenium and Python. My university uses Duo Multi-Factor logon. When I get to the Duo authentication page, the Duo iframe should prompt for the u2f Security stored on my computer, but it is not doing that.

Opening up the chrome webdriver console, I could see the error thrown:

Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-aqNNdDLnnrDOnTNdkJpYlAxKVJtLt9CtFLklmInuUAE='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.

For the record, carrying out the same Duo authentications in the normal Chrome does not produce the problem. I have searched extensively for the remedy of this error. Most seem to suggest the bypassing of CSP, which I cannot do since I could not edit the contents of the university authentication page.

I have tested the ability of the Chrome driver (controlled by selenium) to invoke the u2f extension of chrome, since other websites seem to work well. From the second error thrown

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('chrome-extension://kmendfapggjehodndflmmgagdbamhnfd') does not match the recipient window's origin ('null'). (anonymous) @ prompt.js?v=16c0d:5 func._wrapped @ errors.js?v=65ffc:67

it seem to suggest that the iframe that Duo authentication is not properly loaded, which could result from the previous error.

My question is why does using selenium and Chrome webdriver cause this CSP error?

I'm still quite new to web development, so I might be missing some information. If someone experienced could offer their intuition on this problem, I would try it out!

Additional information:

The file that the CSP error is thrown from is the javascript file that is prompting Duo authentication. In particular, thrown at iframe.setAttribute method.

u2f.getIframePort_ = function (callback) { var iframeOrigin = "chrome-extension://" + u2f.EXTENSION_ID, iframe = document.createElement("iframe"); iframe.src = iframeOrigin + "/u2f-comms.html", iframe.setAttribute("style", "display:none"), document.body.appendChild(iframe); var channel = new MessageChannel; channel.port1.addEventListener("message", function ready(message) { "ready" == message.data ? (channel.port1.removeEventListener("message", ready), callback(channel.port1)) : console.error('First event on iframe port was not "ready"') }), channel.port1.start(), iframe.addEventListener("load", function () { iframe.contentWindow.postMessage("init", iframeOrigin, [channel.port2]) }) }




what is the best secured way to store authorization token?

I have an application where I get token through AAD authentication. Everytime I make an api call I have to pass that token as header. Where to store the token so that it's secured. is there any way appart from cookie / local storage / session storage ?




Any suggestions on error from curl_exec in php?

I get the following error when running getAnalysis() on my Ubuntu machine but I do not get it when I run this error on any macs(Tried several different versions of Mac OS including the newest version). I think curl is not understanding the reply back from the server but not sure how to trouble shoot it. I tried the curl_error function to see what the last error was but nothing printed out. Any help would be appreciated

I am using PHP 7.2.24-0ubuntu0.18.04.2 with curl 7.58.0 on my ubuntu machine.

It worked on PHP 7.3.9 with curl 7.64.1 on my mac

Error:

======================================
<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference&#32;&#35;179&#46;96cadf17&#46;1580524623&#46;c5f345a
</BODY></HTML>
======================================

Code:

function getAnalysis($text)
{
    $APIKey = "APIKey";
    $URL="https://www.APIURL.com/API/";
    $data = json_encode(array('text' => $text));
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$URL);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_USERPWD, "apikey:$APIKey");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

    $result=curl_exec($ch);

    print("======================================\n");
    print($result);
    print("======================================\n");

    curl_close ($ch);

    return $result;
}



How to update data back to sql server from internet though web service

I am going to build a resful or soap web service to allow client includes app and web base browser to connect to on premise sql server of my company. How to allow client update data from app and save back to my on premise sql server with security. Here is my topology: enter image description here




Is there any way to download a file from my website which is hosted on a vps?

I have recently bought a VPS and hosted a simple-looking website on it (without even a domain) and I want to download a file from it via direct link (let's say my website is hihi.com and I want to host a file on it, so i can get a link like hihi.com/2H3DX3D and it will start saving a file). Is there any way/app to do that?




Mobile application for managing multiple custom web email accounts

I have a domain which I created multiple webmail accounts with. I need a mobile app to manage all of these emails, an app I can use to view inbox and send emails with. Which can you recommend?




Chatbot program in jupyter notebook how to integrate it with my site and how to define gui?

I have written a code for my chatbot on jupyter notebook .Now i want this chatbot to be integrated with my website how can it be done ? I also want to know how to define Gui for the chatbot.Please help.




How to remove accents to webscrape name using python

i have a list of names, but some have accents. i want to be able to find the page of the person without having to manually get rid of the accent on the name, which prevents the search. is there a way to even do this?

import requests
from bs4 import BeautifulSoup
import pandas as pd
from pandas import DataFrame

base_url = 'https://basketball.realgm.com'

player_names=['Ante Žižić','Anžejs Pasečņiks', 'Dario Šarić', 'Dāvis Bertāns', 'Jakob Pöltl']

# Empty DataFrame
result = pd.DataFrame()

for name in player_names:
    url = f'{base_url}/search?q={name.replace(" ", "+")}' 
    response = requests.get(url)
    soup = BeautifulSoup(response.content, 'html.parser')

    if url == response.url:
        # Get all NBA players
        for player in soup.select('.tablesaw tr:has(a[href*="/nba/teams/"]) a[href*="/player/"]'): 
            response = requests.get(base_url + player['href'])
            player_soup = BeautifulSoup(response.content, 'lxml') 
            player_data = get_player_stats(search_name=player.text, real_name=name, player_soup=player_soup) 
            result = result.append(player_data, sort=False).reset_index(drop=True)
    else:
        player_data = get_player_stats(search_name=name, real_name=name, player_soup=soup) 
        result = result.append(player_data, sort=False).reset_index(drop=True) 



My website doens't recognize any db on localhost

I'm creating a website on localhost using Xampp and PhpMyAdmin to create a db. When I try to use my function to subscribe with username and password, it seems that the db doesn't work: my site displays me that accepted the input but in the user table on phpMyAdmin I can't find the new user just added. I don't know if the problem is the query or the connection to db itself. Is there away to debug it? Sorry for my bad English

I have this php function that is included in all my pages that requires db

<?php
    function db_connection() {
        $db = "mysql:dbname=movie;host=localhost";
        try {
            return new PDO($db, "root", "");
        } catch(PDOException $e) {
            print("Fail to access to db");
        }
    }

I have this php file for the login

<?php include ("database.php");?>
<?php
        function new_user($name, $password)
        {
            $psw = md5($password);
            $db = db_connection();
            $qname=$db->quote($name);
            $qpassword=$db->quote($psw);
            $db -> query(" INSERT INTO Users (id, name, password) VALUES (null, $qname, $qpassword)");
        }

        function check_existent_user($name)
        {
           $db = db_connection();
           $qname=$db->quote($name);
           $rows= $db -> query("SELECT name FROM Users WHERE name = $qname");
           foreach ($rows as $row) {
                return $name == $row["name"];
           }
        }

        function check_password($name, $password)
        {
            $psw = md5($password);
            $db = db_connection();
            $qname = $db->quote($name);
            $rows = $db->query("SELECT password FROM Users WHERE name = $qname");
            if($rows)
            {
                foreach ($rows as $row) {
                    $correct_pass = $row["password"];
                    return $psw === $correct_pass;
                }
            } else {
                return FALSE;
            }
        }



Failed to connect to Tomcat 9 on CentOS 8

Apache Tomcat 9 on CentOS 8 is running well, but I can not connect to it by curl.

Before I change the HTTP&HTTPS port of Tomcat, I can access it successfully.

The same is true on Ubuntu 18.04 LTS.

I uses OpenJDK 13.

$ sudo firewall --zone=public --add-port=80/tcp --permanent
success
$ sudo firewall --reload
success

Then

$ curl http://localhost:80
curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

Why? Need I use "semanage"?

server.xml (now)

<Connector port="80" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="443" />

server.xml (before the change)

<Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443" />



how to fix react app who not opening in browser

im using visual studio code.

node version v4.2.6

npm version 3.5.2

i connected to remote machine via remote-ssh , run npm start and get this:

react-crm@1.0.7 start /home/opc/maor/react-crm npm-run-all --parallel open:src

react-crm@1.0.7 open:src /home/opc/maor/react-crm babel-node tools/srcServer.js

[Browsersync] Access URLs:


   Local: http://localhost:4000
External: http://10.0.0.2:4000

      UI: http://localhost:4001

UI External: http://localhost:4001


[Browsersync] Serving files from: src

[Browsersync] Watching files...

[Browsersync] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)

webpack built 0c4de8889ae3a0e51298 in 11937ms

Child html-webpack-plugin for "index.html":

webpack: bundle is now VALID.

also even when i try to connect in the browser to http://localhost:4000 nothing showed.

what shoud i do?




Please check why the page opens in the middle (when you're using iPhone)

I have a problem. The landing page, we have just created opens in the middle of the website(when you're trying to open it by Safari/chrome) when using iphone?

The link for the landing page is : http://safebag.zarnica.biz.ua/

What do I see, when the page opens

What do I need to see




Upload image and text data to flask server through ajax

I want to upload image and text data to my flask server. How can we send it. My HTML Code

<form id="upload-file" method="post" enctype="multipart/form-data">
                            <button type="button" class="btn btn-success" >
                                <label for="imageUpload" style="font-size: 1rem; line-height: 1.5; font-weight: normal; margin-top: 9px;" >
                                    Choose Photo...
                                </label>
                            </button>
                            <input type="file" id="imageUpload" name="image" accept=".png, .jpg, .jpeg">
                            <input type="text" id="imageUpload" name="i1" >
                            <input type="text" id="imageUpload" name="i2" >
                        </form>

JavaScript and ajax Code

$('#btn-predict').click(function () {
        var form_data = new FormData(document.getElementById('upload-file'));
        $.ajax({
            type: 'POST',
            url: 'http://127.0.0.1:5000/predict',
            data: form_data,
            contentType: false,
            cache: false,
            processData: false,
            async: true,
            success: function (data) {
                console.log('Success1');
            },
        });
    });

My Flask Server Code

@app.route('/predict', methods=['GET', 'POST'])
def upload():
    if request.method == "POST":

        if request.files:
            output={}
            image = request.files["image"]
            print(request.files)
            basepath = os.path.dirname(__file__)
            file_path = os.path.join(
            basepath, 'uploads', secure_filename(image.filename))
            image.save(file_path)
            print(file_path)
            # Make prediction
            model = load_model(model_path)
            model.load_weights(model_weight)
            preds = model_predict(file_path, model)

            return str(preds)

    return render_template('AboutUs.html')

I know how, who to send image but in above case I want to send text data with image.




How to implement SSL On AWS public DNS?

The server will not issue certificates for the identifier :: Error creating new order :: Cannot issue for "ec2-xx-xxx-xxx-xxx.us-east-2.compute.amazonaws.com": The ACME server refuses to issue a certificate for this domain name, because it is forbidden by policy (and 1 more problems. Refer to sub-problems for more information.




web service to process data subject request

I am new to coding in c# and have a project to realise in VS 2019. like the new GDPR law say any person has the rights to know what personal data has been stored concerning him. I have to develop a restful service which would be called within an application. This service would have to search for all data regarding this person in other various applications.Which means any one using this service have to implement the interfaces of my webservice. I have the following questions.

How can i realise this since various applications have different ways of storing personal data. Meaning i cnt have a fixed model for the web service

How can i gather all information about this person i.e data stored in databases, pdfs, pics , videos of this person stored as well?

Thanks for your time in reading and any little input will be helpful for me to come through.




How to upload image and show it in other page in asp.net?

How I can upload a image "File Upload" and show in same page , and send this image to other page by button click as form profile in asp.net c# (Master Page). Also to save it to File. Type : png,jpg,gif




ookla Speedtest with i frame

Hi<iframe width="100%" height="650px" frameborder="0" src="https://yanivsu.speedtestcustom.com/"></iframe>

fro some reason only i see is white page and when i try to get it to the website I can see the Speedtest perfect https://yanivsu.speedtestcustom.com. In addition when i put in the src a regular website its work perfect on my website... please help me... SpeedTest Website custom My Website My website with regular website




How not to autoload registered identifiers in form

I want to make a form to create user on my website. But i got a problem, as my email + password have been saved by my brower to login in my website, my add user form get automatically loaded with my identifiers.

The form will have to be use by other people, to make it simple I'd like to block the autoload identifiers in this form. It migth exist but didn't found it anywhere...

    <form method="post">
      <div class="form-group">
        <label for="exampleFormControlInput1">User email adress</label>
        <input type="text" name="email" class="form-control"  placeholder="nom@exemple.com">
      </div>
      <div class="form-group">
        <label for="exampleFormControlInput1">Password</label>
        <input type="password" name="password" class="form-control"  placeholder="C94head">
        ...

Even if I switch my first input/name type from "email" to "text" my browser autoload my id. Ialso tried to remove the type, delete my cookies, doesn't work neither..

Anyone got an idea please?

Thanks for your help !




What is an optimal back-end infrastructure of web service fetching data from DB to visualize them on a map?

I am working on a web service which aims to show the user a map in a browser with trajectories of animals plotted and some control widgets (this is a web service for researchers doing wildlife tracking). Each user has MySQL DB with all locations of different animals as rows in a table (each row has tracker id, time stamp, latitude/longitude etc). The rest of web service is being under development with some pieces done and other not. I am not a web developer and struggling with conceptualizing the design of the service.

What is the most optimal design of this infrastructure to deliver the following functionality:

1) User registration, logging, storage of credentials, compliance with GDPR

I'd imagine that I have a php script accessible by e.g. https://my-service.com/registration.php An unregistered user starting with my service will type the url in a browser to register and create a user name and a password saved in the users' DB of credentials. At some point a mail service will send an automatic email to the user to verify his/her email address. If all went well the user will receive another email with a confirmation of successful registration, a login and a password saved on the server (could be changed later).

But how do I arrange this process on the back-end also making my life easier in the light of GDPR? I heard that the best way to outsource the storage of users' credentials to a third-party authentication service.

Is it a good idea to redirect the user going to https://my-service.com/registration.php to some common authentication services which will take care of email verification, registration confirmation and GDPR compliance and data protection. As far as I understand I will have a token for each user (if so how do I create this token automatically and how the authentication service knows what token this user needs). Upon successful registration and logging in the authentication service will send a request with a token to my website so that the user gets access to his/her DB with tracking data. Not sure how it works in detail and therefore would appreciate any feedback.

2) Upon registration and logging in the user will have a front-end GUI in a browser. My developer created this the front-end using Spring framework (not sure how it works though). Upon logging in each user will be redirected to url loading this GUI in a browser where the user has a Google map with trajectories of animals plotted and some control widgets (e.g., a calendar widget for choosing time range or drop down menus to choose devices plotted). If the authentication service sends the user back to my server with a token then GUI application loads the interface into the user's browser and this GUI application has permission to read-only access to a user-specific DB for filtering out which data from DB are visualized.

I wonder how the above functionality should be designed on the back-end? At the moment I have a very fuzzy idea how to deliver this service. Feel free to direct me to completely different routes from described above.




Web application has different values wether console is open or closed

My Web Application is acting out. With the (google chrome) debug console closed the application works as intended, it downloads an image and places it on the page. When I open the console for the same application and run it, it can't read the size values of the downloaded image. Is this chrome bug? Is there a way to fix this problem?

Resulting values with console closed:

Resulting size with console closed

Resulting size with console opened:

Resulting size with console opened

This problem does not appear to occur in Firefox browser




My website doesn't "recognize" my database on localhost

I'm creating a website on localhost using Xampp and PhpMyAdmin to create a db. When I try to use my function to subscribe with username and password, it seems that the db doesn't work: my site displays me that accepted the input but in the user table on phpMyAdmin I can't find the new user just added. I don't know if the problem is the query or the connection to db itself. Is there away to debug it? Sorry for my bad English




jeudi 30 janvier 2020

How to expand the width of images to the width of the window inside the carousel?

You can see my carousel on my Github page. https://ionianthales.github.io/playground.github.io/

I set .carousel to position: absolute; which is ul tag. and when I click the .right-btn, the slide effect works. But I use the dual monitor and when I expanded the web browser window horizontally over the full width of a monitor, I could see other images are shown in a slide too. ( To check this issue, I should decrease the size of web browser horizontally and then refresh the page and then expand the web browser horizontally )

I tried to fix it on my own. But It didn't work well.

also, I will include my codes here.

html code

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <link rel="stylesheet" href="index.css">
    <link href="https://fonts.googleapis.com/css?family=Anton|Bowlby+One+SC|PT+Sans+Narrow&display=swap" rel="stylesheet">
</head>
<body>
    <nav class="nav-container">
        <div class="logo">
            LogoShop
        </div>
        <ul class="menu-container">
            <li class="menu-item"><a href="">shirt</a></li>
            <li class="menu-item"><a href="">pants</a></li>
            <li class="menu-item"><a href="">uniform</a></li>
            <li class="menu-item"><a href="">contact</a></li>
        </ul>
    </nav>
    <div class="carousel-container">
        <div class="carousel-wrapper">
            <ul class="carousel">
                <li class="slide active"><img src="images/freestocks-org-_3Q3tsJ01nc-unsplash.jpg" alt=""></li>
                <li class="slide"><img src="images/jonathan-francisca-HY-Nr7GQs3k-unsplash.jpg" alt=""></li>
                <li class="slide"><img src="images/tamara-bellis-0C2qrwkR1dI-unsplash.jpg" alt=""></li>
            </ul>
        </div>
        <button class="btn left-btn"><img src="images/left-arrow.svg" alt=""></button>
        <button class="btn right-btn"><img src="images/right-arrow.svg" alt=""></button>
        <div class="carousel-nav">
            <div class="dot active"></div>
            <div class="dot"></div>
            <div class="dot"></div>
        </div>
    </div>
    <script src="index.js"></script>

</body>
</html>

css

html{
    /* border: 1px red solid; */
    height: 100%;
}
body{
    height: 100%;
    margin: 0;
}
nav{
    /* border: 1px red solid; */
    width: 70%;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    align-items: center;
}
ul{
    list-style: none;
}
.logo{
    /* border: 1px blue solid; */
    font-family: 'Anton', sans-serif;
    font-size: 30px;
}
.menu-container{
    /* border: 1px red solid; */
    display: flex;
    font-family: 'PT Sans Narrow', sans-serif;
    font-size: 25px;
    padding: 0;
}
.menu-item{
    /* border: 1px red solid; */
    margin: 0 15px;
}
li a{
    text-decoration: none;
    color: black;
}

/* carousel */
.carousel-container{
    position: relative;
    /* border: 1px red solid; */
    width: 100%;
    height: 500px;
}
.carousel-wrapper{
    /* border: 1px red solid; */
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.carousel{
    /* border: 1px red solid; */
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    transition: 300ms transform ease-in;
}
.slide{
    position: absolute;
    /* border: 1px red solid; */
    margin: 0;
    width: 100%;
    height: 100%;
}
.slide img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* opacity: 0; */
}
.btn{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 100px;
    width: 40px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}
.left-btn{
    left: 0;
}
.right-btn{
    right: 0;
}
.carousel-nav{
    position: absolute;
    /* background-color: dodgerblue; */
    width: 100%;
    height: 50px;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.dot{
    border-radius: 50%;
    width: 20px;
    height: 20px;
    background-color: grey;
    opacity: 0.5;
    margin: 0 20px;
    cursor: pointer;
}
.dot.active{
    background-color: grey;
    opacity: 1;
}

javascript

const carousel = document.querySelector('.carousel');
const slides = [...carousel.children];
const nextBtn = document.querySelector('.right-btn');
const previousBtn = document.querySelector('.left-btn');

const slideWidth = slides[0].getBoundingClientRect().width;

console.log(slideWidth);

function positionSlides(slides){
    for (let i=0; i<slides.length; i++){
        slides[i].style.left = slideWidth * i + 'px';
    };
};

nextBtn.addEventListener('click', function(){
    const currentSlide = carousel.querySelector('.active');
    const nextSlide = currentSlide.nextElementSibling;
    const position = nextSlide.style.left;

    carousel.style.transform = `translateX(-${position})`;
    currentSlide.classList.remove('active');
    nextSlide.classList.add('active');

});

previousBtn.addEventListener('click', function(){
    const currentSlide = carousel.querySelector('.active');
    const previousSlide = currentSlide.previousElementSibling;
    const position = previousSlide.style.left;

    carousel.style.transform = `translateX(-${position})`;
    currentSlide.classList.remove('active');
    previousSlide.classList.add('active');
});

positionSlides(slides);

Thanks for reading my question. : )




Checking if the website is reachable with or without www

How to check if the website is reachable with or without www. For example the following URL:

https://corteva.in/

is unreachable. But when entered like (with www):

https://www.corteva.in/

it correctly displays in the browser. Is there a way I could check this with python?

I tried the following:

import socket
socket.gethostbyname('www.corteva.in')
socket.gethostbyname('corteva.in')

both resolve to some IP address. But when loading in the browser like https://corteva.in the browser is never able to load the web service.




Chrome iphone not asking microphone permission

I have a web application that uses microphone input. It works fine for me in all browsers in laptops and other devices. A prompt for allowing microphone access is being poped out and can allow for the same.

But in iphones, the pop up is not being shown while taking the app in chrome. It works fine in safari. Please find a solution ASAP.




How do I use 'fs' in a JavaScript file on my website?

I am trying to create code that replaces links to files if the file was deleted, or was never created. It is for a school project. I tried using jQuery, and that broke the website. I tried other pure JavaScript methods, all crashed my site.

I have code that gets a file based on the date, and then use that as an href for a popup. I want to make the popup's href to change from a video file to an html document, 'noSchool.html', if there is no video file found in the directory for my site. I've also tried using fs, like other people have suggested on here, but the console keeps throwing errors saying 'require is not defined' or 'Cannot use import statement outside a module'.

What can I do to get this to work?




embed local Jupyter notebook cells in web browser

I am trying to create a deep learning education website. I want to embed notebook cells with contents on the page

jupyter notebook itself runs on personal pc and I want to run some simple deep learning code in the notebook cell portion of the web browser.

https://reactjs.org/ It's really just like the Live JSX EDITOR on the React page, and I want to run some simple deep learning code just like a local jupyter notebook coding

Isn't there a good way?

The methods I've searched so far are as follows and only Python code is executed.

  • cocalc
  • livebook
  • TRANSCRYPT
  • BRYTHON
  • SKULPT
  • PYPY.JS
  • BATAVIA
  • PYODIDE



Can we use Firebase as a common backend for an iOS app and Wordpress website both?

We are creating an employer/employee platform where employer would like to use a Wordpress website while the employees will use an iOS app.

Because of our newness to iOS development, we only are proficient in using Firebase as the backend for iOS apps.

Is it possible to use the same (Firebase) backend for the iOS app, and our Wordpress website as well ?

If not, what other technology stack can we use for backend that will serve both our iOS app and the Wordpress website ?

thank you in advance:)




How To Add Transition Duration To A Dropdown Css Menu?

I just wanted to know if it is possible to add a transition duration to a dropdown menu. I have been looking for an answer online for a while but all I could find is some bootstrap and javascript codes in order to execute this feature.

 <li class="dropdown"><a href="#" class="dropbtn">Dropdown</a>
                    <div class="dropdown-content">
                       <a href="#">Houses</a>
                       <a href="#">Catles</a>
                       <a href="#">Studios</a>
                    </div>
            </li>



Python Beautifulsoup decompose removing elemets out of element

i got a DB of files from theguardian.com. I need to reduce these files to only text and remove all Ads and other text. I am able to get main text but when i try to remove bottom element ("div", attrs={"class": "submeta"}) it delete whole text, but text is not part of this element.

Input file

    # Decomposing
    for remove1 in soup.select("figure", attrs={"class": "element-atom"}):
        remove1.decompose()
    for remove2 in soup.select("aside", attrs={"data-component": "rich-link"}):
        remove2.decompose()
    for remove3 in soup.select("div", attrs={"class": "submeta"}):
        remove3.decompose()

    # Extraction of text
    textHeadline = soup.find("h1", attrs={"class": "content__headline"})
    textUnderline = soup.find("div", attrs={"class": "tonal__standfirst"})
    textBody = soup.find("div", attrs={"class": "content__article-body from-content-api js-article__body"})


    # Final text
    reductionResult = str(textHeadline) + str(textUnderline) + str(textBody)

Thank you for any help




display message WHEN THERE IS NO Order. Woocommerce wordpress

I have a function code that i have placed in my theme function.php to display my orders on another page of my wordpress website. This function is placed in child theme.

function woocommerce_orders() {
    $user_id = get_current_user_id();

    if ($user_id == 0) {
        return do_shortcode('[woocommerce_my_account]'); 
    }else{
        ob_start();
        wc_get_template( 'myaccount/my-orders.php', array(
            'current_user' => get_user_by('id', $user_id),
            'order_count'  => $order_count 
        ));

        return ob_get_clean();
    }
}

add_shortcode('woocommerce_orders', 'woocommerce_orders');

This will only display when there is an order placed. Can you help me or guide me to add a message which says that no order has been placed when there is no order placed.




How to publish wordpress site ( made on localhost using xampp) without using paid hosting?

I have made some wordpress sites on localhost using xampp, but I want to showcase them on my portfolio site as my projects..but I am low on budget and unable to buy paid web hosting. Any other way than paying to buy hosting?




Apple Watch web API for HRV

I have read a lot, but I could not figure out it .Is there any web API to access data of Apple watch such as Heart Rate Variation(HRV) data and for my web application? Thank you so much :)




How exactly Netlify CMS works?

so I recently got interested into git-based CMS and serverless apps, but I have a confusion about the whole branch saving of the new data, for example how does it work with important data like in an E-commerce shopping which a user wants to buy an item, so the user must be authenticated first, my question is where does all the passwords of users will be saved (inside git I assume), and more important thing is that is it safe to do this, I personally don't think so, more over there is important data like the sale analytics and the yearly revenue that the site should keep in it and i don't think that these type of informations anybody would like to be seen by public or if the repository is private by the git owners Itself. What do you think? Am I right about the whole data security thing or wrong? Please correct me if so?




What hosting site to use for Django/Angular application?

I am all new to web development and I have a task to complete. I have to create a website for my university project course. I have to work on a website for a local business allowing them to upload posts with attachments (pictures and videos) and an admin page in which they'd add posts as many times as they want. Everything is simple regarding backend and frontend. I am just confused about the web hosting part because I need powerful servers with a big storage for the database since I'll be uploading videos. They will be providing a budget of 250$ for us to work with since later on, the project is to be passed to the local business. I have to use Angular and Django as my technologies. Any idea on the web hosting sites I can use?

Thanks a lot!




Running libreoffice as a service

I'm building a web application, that, among other things, performs conversion of files from doc to pdf format.

I've been using LibreOffice installed on the same server along with my web application. By shelling out and calling libreoffice binary from the code of my web app I am able to successfully convert documents.

The problem: when my web application receives several HTTP requests for doc->pdf conversion during a very short period of time (e.g. milliseconds), calling libreoffice fails to start multiple instances at once. This results in some files being converted successfully, while some are not.

The solution to this problem as I see it would be this:

  1. start libreoffice service once, make sure it accepts connections,
  2. when processing HTTP requests in my web application, talk to a running libreoffice service asking it to perform file format conversion,
  3. the "talking" part would be facilitated through shelling out to some CLI tool, or through some other means like sending libreoffice API requests to port or socket file).

After a bit of research, I found a CLI tool called jodconverter. From it, I can use jodconverter-cli to convert the files. The conversion works, but unfortunately jodconverter will stop the libreoffice server after conversion is performed (there's an open issue about that). I don't see a way to turn off this behavior.

Alternatively, I'm considering the following options:

  1. in my web app, make sure all conversion requests are queued; this obviously defeats concurrency, e.g. my users will have to wait for their files to be converted,

  2. research further and use something called UNO, however there's no binding for the language I am using (Elixir) and I cannot seem to see a way to construct a UNO payload manually.

How can I use libreoffice as a service using UNO?




How to retrieve authentication credentials from Basic HTTP? [closed]

I have a TCP Listener on the port that receives the message, and I want to decode the credentials. How do I do that?




Google chrome bar highlighting

Does anyone know how to achieve such effect of highlighting the Google chrome interface above the site? google chrome bar highlighted

As you can see the highlight only appears above the site area.

This is the information I gathered:

  • It works only in Chrome, highlighting depends on your actual Chrome theme (it changes its color).
  • It works on different machines / accounts.
  • It works only on that site (at least I haven't encountered such effect on other sites).
  • The site is a progressive web app, but its manifest is super simple, there is only gcm_sender_id in it.
  • The site has a service worker.



Check continuously if a file exists with PHP/HTML and AJAX

I want to create a website that waits for an image to be placed in a folder on the webserver. The website should check every few seconds (like 5 or 10 seconds) if there is an image in the folder and if there is one display it and stop refreshing. Has anybody tried this before? Could I do something like this with AJAX?




How can I stop, Someone hitting my website through looping in one day he send request like 10000 website url

I have develop a new website before 6 months ago, its a directory website. some one hitting my website through loop in one minute there are 10 request from same ip. I am getting this every day, I am unable to block him.

There are 60-70 IP he use in every week.

Please help me.




Are Progressive Web Apps allowed to send push notifications by default once installed?

Today i installed some PWAs from appsco.pe and each one that has been installed has the notifications set to "allowed" by default (this is visible by checking the app permissions / details from mobile).

The weird thing is that by going to settings > notifications on Chrome mobile browser, the PWAs are not even listed among the sites that have web push permissions (which is correct as i didn't give any permission).

So i'm a bit confused, is it my smartphone that has something wrong or is it effectively a new feature for PWAs?




web cgi in c, serve binary image file

i have a cgi program in c, which serves an jpeg file. it works, but i thought it needs fread and fwrite for binary files. can you tell me why it works here for binary file with getc and putc? these functions i thought are only for text files?

#include <stdio.h>
int main(){
printf("Content-type: image/jpeg\n\n");
FILE* fp=fopen("../protected/DSCN2099.JPG","rb");
int ch;
while(1){
  ch=getc(fp);
  if(ch==EOF){
    break;
  }
  putc(ch,stdout);
}
fclose(fp);
return 0;
}




React Bootstrap Responsive Mode is not working what i want

I am new developer for bootstrap. I made a product but if I collapse automatically from right side or left side of chrome it works responsive like I want. But when i choose from inspect and giving an absolute width it does not look like other one. I added two photo to describe clearly. Thank you for your effort everyone.

the wrong one


collapsed one




How to Query passing in a parameter to a crud repository?

I have a web application that connects to an SQL database and has several entities.

The main tables are;

  1. Employees
  2. EmployeesxSkills (mapping the id of a certain employee to the id of a certian skill)
  3. Skill
  4. SkillxRole (mapping id of skill to id of a role)
  5. Role

I am trying to create a method that queries the roles based on a name input by the user, gets the role id and then queries the SkillxRole table and returns a string array of all the skills associated with that role id.

How do I query in a crud repository using a parameter specified by the user. This will be input using html input box using ajax and then I assume a valid endpoint.

Any help would be much appreciated. Below is my searchController code that I wish to query my repositories within.

@Controller
public class SearchController {
      public EmployeeRepository employeeRepository;
      public RoleRepository roleRepository; 
      public SkillRepository skillRepository;   
      public roleSkillRatingsRepository roleSkillRatingsRepository;
      @Autowired
        public void  employeeRepository(EmployeeRepository employeeRepository){
            this.employeeRepository = employeeRepository;
        }
      @Autowired
        public void  roleRepository(RoleRepository roleRepository){
            this.roleRepository = roleRepository;
        }
      @Autowired
        public void  skillRepository(SkillRepository skillRepository){
            this.skillRepository = skillRepository;
        }
      @Autowired
        public void  roleSkillRatingsRepository(roleSkillRatingsRepository roleSkillRatingsRepository){
            this.roleSkillRatingsRepository = roleSkillRatingsRepository;
        }


      @ResponseBody
        public List<Employee> getAllemployees() {
            System.out.println(employeeRepository.findAll());
            return employeeRepository.findAll();
        }

      @ResponseBody
        public Map<String,Integer> getRoleSkills() {

            return null;
        }

Role Repository

@Repository
public interface RoleRepository extends CrudRepository<Role, Integer> {

    List<Role> findAll();

    //something I found online but unsure how to apply this to my situation 
    @Query("select p from Person AS p"
               + " ,Name AS n"  
               + " where p.forename = n.forename "
               + " and p.surname = n.surname"
               + " and n = :name")
               String [] findByName(@Param("name") Name name);

    }




Check Anonimizing IP fun in web source code

Is it possible to check from the browser anonimizing ip function in web source code? And if yes, can I also check if anonimizing function is before tracking website function. Need this to make sure if I can turn off internal website trafic from google analytic.




Script for opening website in default browser in fullscreen mode -

I would like to ask, if it is possible to make script for opening website in default browser in full screen mode. I have found some scripts but it was write for specific browser. So if I write it for chrome, and someone does not have this browser, script will not work. I tried something like this, but unfortunately it does not work. It opens the browser, but not in fullscreen mode.

 start "" www.google.com
 WScript.CreateObject("WScript.Shell").SendKeys("{F11}");



is Flutter Web reliable for production?

I've been search technology for build both mobile app and web just in one code and i found Flutter can do that. I know Flutter is new comers. But i want to know your thought about Flutter:

  • How Stable (web)
  • Documentation (web)
  • Community (web)
  • Performance (web)
  • How it compare to other web technology
  • Is there any other technology like flutter who can build mobile and web in one code?
  • Your future prediction about flutter web
  • how much would you give it a score (0/100)

I really appreciate all your thought. Thanks in advance...




FFMPEG PROJECT BATCH

I need to transform with FFmpeg every file from a folder to another.

The video bitrate must be the best for the web. Codec h264 or h265? Frame-rates and resolutions size must be no change from the source.

How can I do it?




in asp.net web api ,How to customize error message of owin OAuthAuthorizationServerProvider?

public static class ContextHelper { public static void SetCustomError(this OAuthGrantResourceOwnerCredentialsContext context, string errorMessage, bool status) { var json = new ErrorMessage(errorMessage, status).ToJsonString();

       //context.SetError(json);            
       context.Response.Write(json);
   }

   public static string ToJsonString(this object obj)
   {
       return JsonConvert.SerializeObject(obj);
   }

}

public class ErrorMessage { public ErrorMessage(string message, bool status) { Message = message; Status = status; } public string Message { get; private set; } public bool Status { get; private set; } }

if (user == null) { ContextHelper.SetCustomError(context, "Provided username and password is not matching, Please retry.", false); return; }

I get "syntax error". Because text response is:

{"access_token":null,"message":"The user name or password is incorrect"}{"error":" "}

I can't remove {"error":" "}

is there any way to remove {"error":" "}




create a route with list of coordinates on google map with JavaScript

Note: I have found many similar threads like this, but was unable get help from those.

I am storing coordinates of a device in database after every 20 KMs, Now I need to draw a route of line on the map to show history of movement of that device on map. I just need to draw a default line with no markers on it. and map should be disabled for other functionalities like zoom-in etc.

What I did: in my node js application controller, I have retrieved the list of coordinates as a array in variable. passed those array to view.

How do I append that coordinates in my existing map initialize() functions which is also used for Places api and real-time location of device.

can any one guide how to do this.

My Map Init()

function initMap() {
        var input = document.getElementById('searchTextField');
        var autocomplete = new google.maps.places.Autocomplete(input);
        google.maps.event.addListener(autocomplete, 'place_changed', function () {
            var place = autocomplete.getPlace();
            var lat = place.geometry.location.lat();
            var long = place.geometry.location.lng()


            document.getElementById('city2').value = place.name;
            document.getElementById('cityLat').value = place.geometry.location.lat();
            document.getElementById('cityLng').value = place.geometry.location.lng();

        });
            map = new google.maps.Map(document.getElementById('map'));
            navigator.geolocation.getCurrentPosition(function (position) {
                var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

                map.setCenter(initialLocation);
                map.setZoom(13);               
            }, function (positionError) {
                map.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
                map.setZoom(5);               

            });
            map.setMapTypeId('roadmap');
        }



mercredi 29 janvier 2020

#N/A in Importxml when apply some web address

I trying import title below website, but #N/A appeared for all xpath of case

Can I solve this problem?

Website : https://beta.sam.gov/search?keywords=w91qvn&sort=-relevance&index=&is_active=true&page=1

Spreadsheet : https://docs.google.com/spreadsheets/d/1MsPc0BnrN6QEHA_QEJ0WTCJ4xnlP5LiYffWN2ch_ikQ/edit?usp=sharing

Apply : Importxml("https://beta.sam.gov/search?keywords=w91qvn&sort=-relevance&index=&is_active=true&page=1","//*[@id=main-container']")

Try shot : https://docs.google.com/drawings/d/1hna4qC1Zh_dZQKA_3174PftyBqOC6v8ZH33GsiMrAEo/edit?usp=sharing

Thanks.




Wildcard subdomains + main domain ssl

I have a website where users get their own subdomain... and it works fine only the SSL doesn't really work... when I try after a restart to go to user1.example.com it loads the SSL certificate of example.com instead of *.example.com... so someone know how I could say to apache2 that it needs to load the first config first and then the second one?

at some point, it worked but I made an apache2 restart and after that, it stopped working... I am pretty sure that apache2 loads the exmaple.com first and that this is the mistake but Idk how to change it.

my confs

  1. 00-catchall.conf
  2. 01-exmaple.com.conf

00-catchall.conf

<VirtualHost *:80>

DocumentRoot /var/www/example.com/public/
ServerAlias *.example.com
</VirtualHost>

<VirtualHost *:443>
  Header set Access-Control-Allow-Origin "*"

ServerAlias *.example.com
DocumentRoot /var/www/example.com/public/
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/-0001/privkey.pem

</VirtualHost>

01-example.com.conf

    <VirtualHost example.com.com:80>
        ServerAdmin mail@example.com

        DocumentRoot /var/www/example.com/public/
        ServerName example.com
        CustomLog /var/www/log/example.com/access.log combined
        ErrorLog /var/www/log/example.com/error.log

<Directory /var/www/example.com/>
        AllowOverride All

</Directory>

</VirtualHost>

<VirtualHost example.com:443>
Header set Access-Control-Allow-Origin "*"



        ServerAdmin mail@example.com
        ServerName example.com

        DocumentRoot /var/www/example.com/public/
        CustomLog /var/www/log/example.com/sslaccess.log combined

        ErrorLog /var/www/log/example.com/error.log

<Directory /var/www/example.com/>
        AllowOverride All

</Directory>
    SSLEngine On
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>





Why does an empty service worker significantly slow down page load speed?

A very simple setup.

  1. Importing service worker file within <script> tag in index.html like so:
if ('serviceWorker' in navigator) {
    window.addEventListener('load', function() {
        navigator.serviceWorker.register('/app/static/js/service-worker.js', { scope: '/' });
    });
}
  1. Service worker itself is empty (1 line):
console.log('Successfully Installed Service Worker.');
  1. After running page load speed tests I get interesting results:
                        DOM Interactive    DOM Complete       Load Event End     Number of page loads
no-service-worker       0.232              2.443              2.464              30
with-service-worker     0.343              2.484              2.502              30

What gives? How does an empty service worker slow down page load by whopping 120+ milliseconds?




Using rvest, xml2 and selector gadget for webscrapping results in xml_missing

I'm trying to scrap information from the following URL:

https://www.google.com/search?q=812-800%20H%20St%20NW

I want to retrieve the highlighted "812 H St NW": target

The selector gadget (chrome extension) suggests to use the following node ".desktop-title-content"

However, I get an NA as a result and I don't get how to fix this problem.

Here is my code:

link <- "https://www.google.com/search?q=812-800%20H%20St%20NW"
xml2::read_html(link) %>% 
  rvest::html_node(".desktop-title-content") %>%  rvest::html_text()

[1] NA

Thank you




I am using sqlite database in javascript. I am unable to write relevant functions to edit and delete table items. plz help,I am a beginner

var db = openDatabase('kcK.sqlite', '1.0', 'Test DB', 2 * 1024 * 1024); var msg; function data(){ var name1=document.getElementById("name").value; var marks2=document.getElementById("marks").value; db.transaction(function (tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS database"+"(word VARCHAR(50),"+"definition VARCHAR(50) NOT NULL)"); tx.executeSql('INSERT INTO database(word,definition)VALUES(?,?)',[name1,marks2]); }); } function kamal(){ db.transaction(function (tx) { tx.executeSql('SELECT * FROM database', [], function (tx, results) { var len = results.rows.length, i; msg = " Found rows: " + len + "

"; document.querySelector('#status').innerHTML += msg; for (i = 0; i NAMEMARKS'+msg+''+marks+''; } }, null); }); } function update(){ //plz tell code } function delete(){ //plz tell code } Name:




How do I set up an admin route for a web administrator? [closed]

I have tried creating a route say '/admin' where an admin can login from but I believe that is a bad practice. Is there an existing way of handling such routes. If i inspect some popular websites i.e stack overflow.com and type https://stackoverflow.com/admin i cannot get an admin route and neither can it be listed in a web crawler tool.How do handle such admin routes ?




Exporting mysql datababse to Excel

now am trying to export mysql database to excel sheet and i am using php/mysql to preform that and everytime i get this error i've tried everything but i can't find a solutions for this case

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in staff/export.php on line 9

and here's the export.php

<?php  
//export.php  
$connect = mysqli_connect("localhost", "user", "password, "dbname");
$output = '';
if(isset($_POST["export"]))
{
 $query = "SELECT * FROM tbl_customer";
 $result = mysqli_query($connect, $query);
 if(mysqli_num_rows($result) > 0)
 {
  $output .= '
   <table class="table" bordered="1">  
<tr><th>Id</th><th>Customer name</th><th>Agent name</th><th>Phone Number</th><th>Email</th><th>Brand Name</th><th>Field</th><th>Website</th><th>comments</th></tr>
  ';
  while($row = mysqli_fetch_array($result))
  {
   $output .= '
    <tr>  
                         <td>'.$row["Id"].'</td>  
                         <td>'.$row["Customer name<"].'</td>  
                         <td>'.$row["Agent name"].'</td>  
       <td>'.$row["Phone Number"].'</td>  
       <td>'.$row["Email"].'</td>
              <td>'.$row["Brand Namel"].'</td>
        <td>'.$row["Field"].'</td>
        <td>'.$row["Website"].'</td>
         <td>'.$row["comments"].'</td>
                    </tr>
   ';
  }
  $output .= '</table>';
  header('Content-Type: application/xls');
  header('Content-Disposition: attachment; filename=download.xls');
  echo $output;
 }
}
?>



Visual Studio Code, find javascript definition in html script-tag

I'm working on a web project in VSC with html,js and css-files (nothing special). Some javascript file are defined in a tag in html-file:

<script type="text/javascript">
var myvar01 = true;
var myvar02 = false;
var myvar03 = "var99";
</script>

Variable myvar01 is used in a js-file. If I highlight this variable in the js-file and call function "Go to Definition" (context menu), the definition in the html-file is not found. Why? Both files are open in the editor.




How to insert sections and hyperlinks in google maps infobox

I need to insert a google map on my website, however I want to insert sections and hyperlinks to documents in the infobox, which i can't seem to do in google mymaps.

Using this website as reference: https://www.odense.dk/dagtilbud/dagplejen/dagpleje-syd?areaid=50&areaname=Syd

It has a map with a section. Within this there are markers. In the infobox of the markers there are hyperlinks to a document.

How and where do i get started with creating something similar?

Any help much appreciated.




Owin Client Authentication is not working with Web Hosting in IIS

I did implemented the Owin Authentication using the Web Hosting. The application is working fine and I am able to get the Token when I run the application locally. But when I am trying yo deploy the application in to the IIS it is not working and it is saying invalid client.

Could you please provide me a sample code for Owin web hosting.




How to use Angular components in paperbits

I am trying to include an Angular component as widget or as component within paperbits. In the documentation it seems that this should be possible https://paperbits.io/wiki/widget-anatomy. But I can not get it run and I also can't find any examples to this topic. Does anyone have experience with that and can show me a minimalistic example how to use angular components within paperbits?




Many buttons appear on my confirmation dialog

I want to make confirmation dialog before delete some data. But there are so many buttons appear like this:

Confirmation Dialog

This is my code:

<t:pagelink page="SUM01005e" context="[clientProduct.client.clientId, clientProduct.aggregator.aggregatorId, clientProduct.postpaidProduct.billerCode]" onclick="return deleteConfirmation(this, '${clientProduct.aggregator.name}','${clientProduct.postpaidProduct.billerCode}','${clientProduct.productName}');"><img src="/sbgss/images/delete.png"/></t:pagelink>

This is my jquery:

function deleteConfirmation(ele, agName, productCode, productNameBox){

            $j("#agName").html(agName);
            $j("#productCode").html(productCode);
            $j("#productNameBox").html(productNameBox);

            $j("#deleteConfirmation").dialog({
                buttons:[ 
                    {
                        text: "OK",
                        "class": "button button-pill button-flat-primary button-tiny ui-state-focus",
                        click: function() {
                             window.location = $j(ele).attr("href");
                        }
                    },
                    {
                        text: "Cancel",
                        style: "margin-left:10px",
                        "class": "button button-pill button-flat-primary button-tiny ui-state-focus",
                        click: function() {
                             $j(this).dialog("close");
                        }
                    }
                ]
            });

            return false;

with this:

<div id="deleteConfirmation" title="Delete Ag Mapping - Confirmation" style="display:none">
        <table>
            <tr><td colspan="3">${message:areyousuretoremovethisdata}</td></tr>
            <tr>
                <td>Aggregator</td>
                <td style="width:10px">:</td>
                <td><span id="agName"></span></td>
            </tr>
            <tr>
                <td>Product Code</td>
                <td>:</td>
                <td><span id="productCode"></span></td>
            </tr>
            <tr>
                <td>Product Name</td>
                <td>:</td>
                <td><span id="productNameBox"></span></td>
            </tr>
        </table>
    </div>

How to fix that? Everyone please help me, because this is urgent case.




How to get Sharepoint credentials to be used in an ASP Net Core app?

I have an ASP NET Core app that will be acessible through a Sharepoint page, once it's published to an IIS Server. I need to get the credentials used to access that page (Windows Authenticaton), because they will then be used to access a third link. I'm using the Razor Pages approach, so I have no controller.

Is there a way to do this?




Aframe Multiple Pattern Ratio

Hello I want To Use Multiple Patterns With Different Ratio . Can Any One Help Me to Sort Out This . I Can Use Use Multiple Markers With Different Ratio But I Am Not Able To Use Multiple Markers With Dirrerent Ration .

Like Pattern One (Hiro) - HIRO ( Which has ratio of 0.50 by default),

Pattern Two (Custom QR Code) With Ratio 0.75 - PATTERN,

Tag <a-scene arjs="patternRatio: 0.75">
<a-marker type="pattern" preset="hiro" vidhandler="target: #vid1">
--------
<a-marker
        type="pattern"
        url="https://cdn.glitch.com/e85b316e-eed9-4e96-814e-d12630bc00df%2Fpattern-qr-code.patt?v=1577440081157"
        vidhandler="target: #vid2"
      >

Glitch : Multi Pattern Code




I have to put more than 100 advertisements each and every day. The details in the advertisements are same. so how can I automate it? [closed]

I am advertising in a local website daily. I have to put more than 100 advertisements each and every day. The details in the advertisements are same. so how can I automate it?




Better way to get user progress?

Basically, Users do "tasks" which the website gives them, they perform them outside the computer on pen & paper. Once they're done or didn't succeed they can move to the next "task".

I want to have a page were a user can view own's progress/performance.

To do exactly that, the naive approach would be a Button. Users can click it once they finish a task. with that info I can update a graph, so for example - a graph of how many tasks they did each day, will be updated once they go to their progress page. Or average tasks/day graph... etc.

The thing is, I don't know if users will do the action of clicking the button. Users probably care less about some side feature like this "progress tracking" which is way secondary to the tasks.

In the end, I want to present some stats for the user. I want to do it even without the user interaction with some button. Any suggestions?




I called a web service asynchronously but I want to return data from _completed and not getting how to do it?

Here I want to return WebserviceResult which is a custom class but it's returning null because ShareManagementWebService_ResetPermissionInheritanceCompleted is taking some time. How to return data???

internal WebServiceResult ResetInheritance(string shareName, string subFolder) {
shareManagementWebService = new ShareManagementService();

        shareManagementWebService.ResetPermissionInheritanceCompleted += new ResetPermissionInheritanceCompletedEventHandler(
        ShareManagementWebService_ResetPermissionInheritanceCompleted);
        shareManagementWebService.ResetPermissionInheritanceAsync(shareName, subFolder, null);

        return resetPermissionInheritanceResult;
    }
    private void ShareManagementWebService_ResetPermissionInheritanceCompleted(object sender, ResetPermissionInheritanceCompletedEventArgs e)
    {
        resetPermissionInheritanceResult = e.Result;
        //return resetPermissionInheritanceResult;
    }



When I am trying to open a office.com in any browser of some systems it is showing blank white screen

When I am trying to open office.com in any browser of some systems it is showing blank white screen and but in some systems it is opening properly.

When I checked developer tools I found that serviceworker is not receiving for the office.com page in the systems where office.com page showing blank white screen.

For the systems in which it is opening properly serviceworker is working fine. All the systems gets internet through proxy.

Please help me in configuring serviceworker in the systems where it is not opening.

image where serverworker is not showing




Send Redirect is not working for external URL from linux app server but it is working from local system

I am trying to redirect to the external URL using HTTP response object from Filter

Example: httpResponse.sendRedirect("google.com")

The above redirection is working from the local tomcat run but when I run from client Linux server it is not.

is it related to a proxy setting?




Nginx configration (Modem or Router web interface )

I try to develop modem or router web interface.

  • I choose the web server nginx
  • I try to configure when type the browser 192.168.1.1 open that web interface

       server {
           listen 80 ;
    
           server_name _ 192.168.1.1;
    
           root /var/www/myModem;
           index index.html;
    
           location / {
               try_files $uri $uri/ =404;
       }}
    

That configration is not working.

How can I configure that ?




getting "Element should have been "select" but was "option" error while fetching data from the drop down

I am trying to select an item from the select dropdown but facing an error

Html :

<select _ngcontent-c8="" class="form-control">
  <option _ngcontent-c8="" value="" ng-reflect-value="">Select Priority</option>
  <option _ngcontent-c8="" value="HIGH" ng-reflect-value="HIGH">HIGH </option> 
  <option _ngcontent-c8="" value="MEDIUM" ng-reflect-value="MEDIUM">MEDIUM</option>
  <option _ngcontent-c8="" value="LOW" ng-reflect-value="LOW">LOW</option>
</select>



mardi 28 janvier 2020

Jaws is reading tab title multiple times. How to skip tab title while reading?

The jaws read the tab tile multiple times and the main content is being read after the repetitive reading of the title. How can it be solved using an aria component or some other fix? Thanks in advance.




Why doesn't my firewall accept CloudFlare IP addresses?

Recently I decided to open my website, and recently I have been facing DDOS attacks. To solve the problem I decided to register with Cloudflare so that the connections are not established directly with me.

I configured the server correctly the DNS servers. My domain name points to the Cloudflare server and the Cloudflare server is trying to connect to my original server. I don't really understand network, so that's why i ask your help.

My problem is about my Firewall. As stated in the documentation, you must whitelist with Cloudflare IP addresses. I did it: whitelist of cloudflare ips

But i still have this error : Error 522 Ray ID: 55c8e10c6ef8f959 • 2020-01-29 05:41:47 UTC Connection timed out

Official Documentation of this error :

Background

A 522 error happens when a TCP connection to the web server could not be established. This typically happens when Cloudflare requests to the origin (your webserver) get blocked. When this happens, you’ll see “ERR_CONNECTION_TIMED_OUT”.

Quick Fix Ideas

Make sure that you’re not blocking Cloudflare IPs in .htaccess, iptables, or your firewall.

Make sure your hosting provider isn’t rate limiting or blocking IP requests from the Cloudflare IPs and ask them to whitelist the IP addresses here: https://www.cloudflare.com/ips 535. If the IPs that fail are consistent each time, that indicates some of the IPs in Cloudflare’s IP ranges are either being rate-limited or blocked by a network device at your hosting provider. Because Cloudflare operates as a reverse proxy the IP address your server will see is one of a limited number of Cloudflare IPs. In that sense, many actual visitors may all come from the same IP address, which can cause firewalls or security software that is not appropriately whitelisting the Cloudflare IP ranges to block this traffic as it may see it as excessive or malicious

If you are seeing 522 errors in certain locations only, it means you likely forgot to whitelist one of our ranges that corresponds to these locations, so double check to ensure all our IPs are whitelisted appropriately.

Please reach out to your hosting provider or site administrator to confirm if there are any load problems on your infrastructure.

It may be there was a temporary problem on the path or at your origin preventing connections from completing. If they are no longer happening, here are two actions to take: a) Check with your hosting provider to see if they had any issues with packet loss or if your server was under load at the time the errors happened and b) Have your hosting provider or server administrator confirm that all Cloudflare IP ranges are fully whitelisted from any rate limits.

If your firewall is configured to DROP packets rather than refuse connections, it will cause a 521; meaning an incorrectly configured firewall can actually masquerade as a connection timeout 522 error.


I do not know if that can help, but when I completely disable the firewall, the error disappears to make way for an error 521.

Thank you in advance for your help.




How was treehouse website course boxes developed using images?

I am looking at the treehouse website I see that the course boxes were developed using images, if so, how was that done. If not, how was it done? look at references here:

https://d9hhrg4mnvzow.cloudfront.net/join.teamtreehouse.com/techdegree/21b4a261-fewd-v2.png https://join.teamtreehouse.com/techdegree/

If this is just the way it is disabled for users without a subscription than how does the actual website display these course boxes and inside the course page?




A working example of night.js on Codepen? [closed]

I had been trying hard to implement night.js on my website but could not succeed in it.

Maybe cause there is no good explaination of the code on github.

Can someone please give a working example of the same on Codepen or js fiddle?

Thanks




Avoid rebuilding with msbuild /t:Package?

I wish to create a zip web site package for later msdeploy. I used msbuild command line tool

msbuild xxxx.csproj /p:PackageLocation=outputDir\xxxx.zip /t:Package 

msbuild did pack the website, but it also rebuild the website before packing it. The problem is that the website was already built (it contains pages and all the dlls already) before I call msbuild /t:Package.

Is there a way to avoid rebuilding with msbuild /t:Package ?




Comparing XAMPP and php -S localhost:8000, they look very different

I've set up local testing using both XAMPP and php -S localhost:8000. When I compare the website that is produced from both, the website behaves and looks different from each other. However, the same codebase hosted on the web server looks completely fine and behaves alright.

How am I supposed to know if my changes will work properly on the actual web server if they don't show up properly during local testing?

I'm forced to test locally because my co-workers don't seem to know how to set up the dev environment for me to edit the files on a staging server accurately.... Please help!




Long running processes on Web service in IIS

I'm struggling to find a solution that best fit my problem.

I have a asp.net mvc web app where clients log on to. This app lets them validate large amounts of data that is stored on a SQL DB. The users start the validation process from the web app that starts processing the data using a web service running on a different server. The problem is that the IIS service times out and I recon that IIS is not well suited for the processing. Another problem comes to reporting progress back to the UI. I have looked into Hangfire to start the processing and using SignalR for progress and feedback. Is this the best way to go or is there better ways out there?

If someone can give me some direction as where to start, it will be appretiated.

Thanks




Web service JSON representation / editing

everyone!

I want to create a web-based service that will be able to craft a JSON file in a specific predefined format.

JSON will consist of a specific sections, and each section will contain a list of rules, which user should be able to add \ remove \ edit in a user-friendly manner (e.g. define a true \ false value for a rule with a checkbox, add a new rule with + button under the last rule, etc). In the end user should be able to download the final JSON file.

I have python development background, and just starting writing in JS, and my questions to you guys are:

  • How and where do I store the current state of JSON file between pages switches?
  • Any particular advice how to organize addition \ removal of elements and corresponding JSON changes?
  • General advice to a newbie JS developer for this task?

Thank you, boys and girls, this is my first question on SO, hope community can help me!




bootstrap-select.js - javascript appending select options from CRM Web API failing

I have the oddest problem with some CRM web resources and bootstrap-select.js and hoping somebody can point out how blind I am being.

My situation is that I have a html web resource being shown as a modal using alert.js, within the modal I have a web api call to retrieve a list of users and then populate the options of a bootstrap-select.js select drop down. Everything is working, modal loads, web api call gets all users, iterates through and creates the options.....and now the weirdness (",)

Using Chrome Dev Tools - if i step through the code and let it complete all the options are visible and selectable (Woohoo!) - however if I let it run without stepping through the code it creates the options but they are not visible ????

    <script src="ClientGlobalContext.js.aspx" type="text/javascript" ></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/js/bootstrap-select.min.js"></script>

    <script>
    $.fn.selectpicker.Constructor.BootstrapVersion = '4.1';
    </script>

    <div class="form-group">
    <select class="selectpicker" multiple data-live-search="true" data-actions-box="false" title="Choose CLI Users" id="deptUserList" data-width="100%"></select>

    </div>
    </form>
    <script>
    $('#deptUserList').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) {
    alert($('select').val());
    });
    </script>

    <script>

    $(document).ready(function () {
    debugger;
    var crmWindow = parent.Alert.getCrmWindow();

    getParentAccount();

    var submitButton = parent.Alert.$("#alertJs-tdDialogFooter button:first");
    submitButton.prop('disabled', false);

    function getParentAccount() {
    debugger;
    var crmWindow = parent.Alert.getCrmWindow();

    var parentAccountGUID = crmWindow.Xrm.Page.getAttribute("accountid").getValue()[0].id;
    var parentAccountGUID = parentAccountGUID.replace(/[{}]/g, "");
    var parentAccountName = crmWindow.Xrm.Page.getAttribute("accountid").getValue()[0].name;

    //document.getElementById('cliDept_Account').value = parentAccountName;

    var req = new XMLHttpRequest();
    req.open("GET", crmWindow.Xrm.Page.context.getClientUrl() + "/api/data/v8.1/cliusers?$select=accountid_value,cliuserid,departmentid_value,parentaccountid_value,username&$filter=parentaccountid_value eq " + parentAccountGUID + " and  departmentid_value eq null&$count=true", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
    req.onreadystatechange = function () {
    if (this.readyState === 4) {
    req.onreadystatechange = null;
    if (this.status === 200) {
    var results = JSON.parse(this.response);
    var recordCount = results["@odata.count"];
    for (var i = 0; i < results.value.length; i++) {
    debugger;
    var accountid_value = results.value[i]["accountid_value"];
    var accountid_value_formatted = results.value[i]["accountid_value@OData.Community.Display.V1.FormattedValue"];
    var _accountid_value_lookuplogicalname = results.value[i]["accountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
    var cliuserid = results.value[i]["cliuserid"];
    var departmentid_value = results.value[i]["_departmentid_value"];
    var _departmentid_value_formatted = results.value[i]["_departmentid_value@OData.Community.Display.V1.FormattedValue"];
    var _departmentid_value_lookuplogicalname = results.value[i]["_departmentid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
    var _parentaccountid_value = results.value[i]["_parentaccountid_value"];
    var _parentaccountid_value_formatted = results.value[i]["_parentaccountid_value@OData.Community.Display.V1.FormattedValue"];
    var _parentaccountid_value_lookuplogicalname = results.value[i]["_parentaccountid_value@Microsoft.Dynamics.CRM.lookuplogicalname"];
    var username = results.value[i]["username"];

    console.log("User " + i + " : " + username);

    var select = document.getElementById('deptUserList');
    var opt = username;
    //alert(opt);
    var el = document.createElement('option');

    el.textContent = opt;
    el.value = opt;
    select.appendChild(el);



    }
    } else {
    crmWindow.Xrm.Utility.alertDialog(this.statusText);
    }
    }
    };


    req.send();
    }
    });


    </script>

    ```

I am going round in circles trying to work this out, I am a far stretch away from an expert with JS I just cannot see what is going on with this.

[Proof its creating the options][1]
[Options visible after stepping through the code][2]
[Options not visible without stepping through code][3]


  [1]: https://i.stack.imgur.com/5VvJR.png
  [2]: https://i.stack.imgur.com/jU3kM.png
  [3]: https://i.stack.imgur.com/Plvkm.png

Thanks in advance,
David




How to round off up to 4 decimal places that will be input based?

I have a problem here to solve this problem. I have a feature where a user will input a given value for the cent (precision) and will be automatically round off the prices.

So for example, the given value for the price is 100.123456 and the user input 1 cent

So the expected output will be 100.1

because 1 cent is equal to 0.01

In that case, I have no problem, I can make a formula for that case. But for that case, the decimal places that will be rounding off is only 2 decimal places or up to hundredths only.

I am thinking if how can I solve if up to 4 decimal places and the user will be input 10.12 for example and will be converted as 0.1012 so that up to 4 decimal places.

Thank you so much!!!! I badly need your help! Thank you.




Mapping folders from different discs to the same endpoint NGINX

I have some discs, each one with multiple folders, inside each folder there are some images

disc 1 : folder1000, folder1001 ...
disc 2 : folder2000, folder2937 ...
disc N : folderN...

I need to point those discs to the same endpoint mydomain.com/images/

So the result should be this...

mydomain.com/images/folder1019/img34.jpg    this comes from disc1
mydomain.com/images/folder2073/img2346ab.jpg    this comes from disc2
mydomain.com/images/folder4083/imgabcdf.jpg   this comes from disc4
mydomain.com/images/folder5091/img8567.jpg    this comes from disc5
mydomain.com/images/folderN/img4565.jpg     this comes from discN

Using symlinks to the same folder is discarded, I just want to know if can I map the discs to the same url root.

I going to use NginX so I appreciate any expert who can help me to solve this




After deploying java web application giving 404– Internal Server Error

I am trying to deploy my java web application in Heroku from using eclipse IDE follow by this link: https://devcenter.heroku.com/articles/deploying-java-applications-to-heroku-from-eclipse-or-intellij-idea.

I have use WAR file to deploy this project.I have used mysql database locally.

This is github link of my project: https://github.com/sachin1830/SmOnlineExamProject.

This is my website link:

https://onlineexam1830.herokuapp.com/.

The index page working fine but when i am getting error when I am trying to login.

Error: HTTP Status 500 – Internal Server Error ,HTTP Status 404 – Not Found showing.

This is my first project and i am new in this please give me suggestions why this error coming and how i can resolve this error?
image

Steps to repro the issue:

  1. open website https://onlineexam1830.herokuapp.com/
  2. Click on login on top
  3. Enter username as nn
  4. Enter password as uu

Expected: User should be able to login

Actual: Got error as 404.

Locally everything is working fine.




How can I define which element jquery should use?

I'm trying to do a gallery so I got this while and every image has a different ID but when clicking the image I did a function to open it and add some css, like a popup with some css, the problem is that those jquery functions works with the ID of the image but every image has a differente ID. How can I do to make it work?

popup = {
  init: function() {
    $('figure').click(function() {
      popup.open($(this));
    });

    $(document).on('click', '.popup img', function() {
      return false;
    }).on('click', '.popup', function() {
      popup.close();
    })
  },
  open: function($figure) {
    $('#imagenabierta').css('clip-path', 'none');
    $('#imagenabierta').css('height', '500px');
    $('#imagenabierta').css('width', '800px');
    $('.gallery').addClass('pop');
    $popup = $('<div class="popup" />').appendTo($('body'));
    $fig = $figure.clone().appendTo($('.popup'));
    $bg = $('<div class="bg" />').appendTo($('.popup'));
    $close = $('<div class="close"><svg><use xlink:href="#close"></use></svg></div>').appendTo($fig);
    $shadow = $('<div class="shadow" />').appendTo($fig);
    src = $('img', $fig).attr('src');
    $shadow.css({
      backgroundImage: 'url(' + src + ')'
    });
    $bg.css({
      backgroundImage: 'url(' + src + ')'
    });
    setTimeout(function() {
      $('.popup').addClass('pop');
    }, 10);
  },
  close: function() {
    $('#imagenabierta').css('clip-path', 'polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%)');
    $('#imagenabierta').css('height', '305px');
    $('#imagenabierta').css('width', '382px');
    $('.gallery, .popup').removeClass('pop');
    setTimeout(function() {
      $('.popup').remove()
    }, 100);
  }
}

popup.init()
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="content-wrapper">
  <section class="content">
    <div class="row">
      <div class="gallery">
        <div class="grid--item">
          <figure>
            <img class="img" src="..." alt="Imagen" height="500px" width="800px" id="imagenabierta1">
            <figcaption>comentario 1<small>$fecha1</small></figcaption>
            <div class="container">
              <h2>$titulo1</h2>
              <div class="desc">$creador 1</div>
            </div>
          </figure>
        </div>
        <div class="grid--item">
          <figure>
            <img class="img" src="..." alt="Imagen" height="500px" width="800px" id="imagenabierta2">
            <figcaption>comentario 2<small>$fecha2</small></figcaption>
            <div class="container">
              <h2>$titulo2</h2>
              <div class="desc">$creador 2</div>
            </div>
          </figure>
        </div>
        <div class="grid--item">
          <figure>
            <img class="img" src="..." alt="Imagen" height="500px" width="800px" id="imagenabierta3">
            <figcaption>comentario 3<small>$fecha3</small></figcaption>
            <div class="container">
              <h2>$titulo3</h2>
              <div class="desc">$creador 3</div>
            </div>
          </figure>
        </div>
      </div>
    </div>
  </section>
</div>



How can you make call a page without showing parameters on the URL using C# MVC?

I am trying to modify a project so that the routes, and the parameters do not show in the URL, when you access them through an <a> element.

This is the code on the View:

@Html.ActionLink("Edit", "EditSchedule", new { id = item.OID, iorDapa = item.IOR_HORARIO }) |
@Html.ActionLink("Delete", "DeleteSchedule", new { id = item.OID, iorDapa = item.IOR_HORARIO })

I've tried to change the Action Link for a RouteLink, by calling this

 routes.MapRoute(
      name: "EditSchedule",
      url: "{controller}/{action}/{oid}_{iorDapa}",
      defaults: new { controller = "Users", action = "Index", oid = UrlParameter.Optional, iorDapa = UrlParameter.Optional }
 );

However, that didn't work, given that it keeps making a link element with an established URL, so I assume that something else is needed, perhaps some method I don't know to make a call to the api?

And... From here on I tried many things, but none seem to work.

From other projects I worked with (JS), I remember that the router called an API, which in turn called a controller file, and that controller did the logic to then call the view.

However, with this C# project I cannot get the program to call the WebApiConfig file, or the RouteConfig without actually showing the parameters on the URL.

I'm sorry If I have explained myself a tad bad, I'm a bit lost in this!




Minima jekyll theme social icons don't show up

I have taken the code as-is from here https://github.com/jekyll/minima and run it on github pages.

The social icons don't show up.

Could someone help me fix this? I'm at a complete loss as to how to debug this.




put cursor at end of text in prompt with default value

When calling window.prompt() with default value text current is selected, is there the way to unselect the text and put cursor at end.


prompt("Prompt with default value", "Default")

enter image description here

I also checked https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt but nothing useful came out.




I want to send an E-Mail inside JavaScript code using PHP [duplicate]

Is it possible that I can send an email by picking an item from the dropdown list. By picking the option BEHOBEN the mail should be sent.

My try:

function myFunction() {
        var selectNEW = document.getElementById('select'); //dropdownlist id
        var selectedText = selectNEW.options[selectNEW.selectedIndex].text; //get text from list
        if (selectedText == "BEHOBEN") {
            alert("Successfully");
            <?php

            $to = "/*to mail*/";
            $subject = "Success";
            $message = 'Everything successfully finished';
            $header = 'From: /*my mail*/';

            mail($to,$subject,$message,$header);

            ?>
        } else {
            alert("You have to pick an option from the DropDownList");
        }
    }

The button

<div class="sendButton">
        <input class="send" onclick="myFunction()" type="submit" name="send" value="Success"></input>
    </div> 

But in my case the email would not be sent.




Peerjs doesn't open connection with no errors (react)

I almost completely copied an example from https://peerjs.com/docs.html#start, but suddenly it fell down (yesterday it's was working, but not today)

here is my peerjs peace of code

componentDidMount = () => {
    this.peer = new Peer()
    if (this.state.join === "host") {
        this.peer = new Peer()
        this.peer.on("error", err => {
            console.log("error: ", err)
        })
        this.peer.on("open", id => {
            this.props.dispatch({type: "SetPeerId", value: id})
            console.log(id)
        })
        this.peer.on("connection", (con) => {
            console.log("connection opened")
            con.on("data", i => {
                console.log(i)
            })
        })
    } else {
        this.peer = new Peer()
        var con = this.peer.connect(this.state.join)
        con.on("open", () => {
            console.log("opened")
            setInterval(() => {
                con.send("HERE WE ARE")
            }, 100)
        })
        con.on("error", err => {
            console.log("error ", err)
        })
    }
}



lundi 27 janvier 2020

undefined when creating table on phpmyadmin

I have created about 50 fileds in this (keluarga) table in phpmyadmin. But when I submit to create this table, it's shown the warning "undefined". Anyone has the solution?

enter image description here




Need an advice for web screen templates for pc web design

I'm a junior designer for app and pc uxui, yoonjae

I just got a task for pc web design and I'm on a mission to choose an screen templates, I choose a 1366x768 with chrome before. It was based on stat counter and we pick an option as global, china, and north america's recent 1 year.

Here's the problem. we may can choose 1366. BUT, we hope to handling few more next year. I found 1366's change are came from 2012, it seems bit old to me and If mainstream screen size are change in next few month, it seems to be waste of time. because we don't want to spend many of times for PC.

If you have any advice for future web screen. please give me an advice.. 1920 is looking best. but I heard Chinese digital environment is little bit weird.

Thank you guys!! Yoonjae




Website reloads when I click in the search button with selenium

I'm doing an automated search in a website, but when I click in the button or submit the form the website reloads and delete my filter. I think that the problem is in one function of the website.

This is the website:

http://www.tjpe.jus.br/consultajurisprudenciaweb/xhtml/consulta/consulta.xhtml

Function

function dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++) {f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var i = 0;for (k in pvp) {var p = document.createElement("input");p.type = "hidden";p.name = k;p.value = pvp[k];f.appendChild(p);adp[i++] = p;}};function jsfcljs(f, pvp, t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target = ft;dpf(f);};

There is an "on-click" in the website like this:

onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.getElementById('formPesquisaJurisprudencia'),{'formPesquisaJurisprudencia:j_id112':'formPesquisaJurisprudencia:j_id112'},'');}return false"

My selenium and python code:

import time
import os
import seleniumrequests
from selenium import webdriver
from seleniumrequests import Chrome
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

chrome_options = Options()
chrome_options.add_experimental_option('prefs',  {
    "download.prompt_for_download": False,
    "download.directory_upgrade": True,
    "plugins.always_open_pdf_externally": True
    }
)

estado = str(input("Em qual estado você deseja fazer a busca?\n")) 

if (estado.upper() == 'PE'): #Mudar para "Case" quando houver outros estados
    med = str(input("Qual medicamento você deseja procurar?\n"))

    driver = webdriver.Chrome()

    driver.get('http://www.tjpe.jus.br/consultajurisprudenciaweb/xhtml/consulta/consulta.xhtml')

    driver.find_element_by_id('formPesquisaJurisprudencia:inputBuscaSimples').send_keys(med)

    driver.find_element_by_id('//*[@id="formPesquisaJurisprudencia"]/div[5]/div/a[1]').click()

    driver.find_element_by_xpath('//*[@id="resultadoForm:j_id20_body"]/div/table/tbody/tr[1]/td[2]/a').click()

    driver.find_element_by_name('j_id77:j_id80').click()



Conditional HTML statments and printing instructions

In HTML what I want to do is for example:

z = x + y;

If x < 0

Print: "x cannot be less than 0. Please try again"

And this would be in the script function part of the code of Course with the associated programming and all that. I just dont know the right way to print a string with conditional statements. Any help would be appreciated.




Can anybody suggest me good books to get a good idea of programming?

I'm new to the programming world and I'm not a CSE student, but I'm highly interested in learning programming and computer and web technologies. Have basic knowledge of general computing and using contemporary internet tools.

Drem to be a developer.

Thanks Priyashis.