dimanche 31 mai 2020

What does the localhost: 3000 server created by express mean?

What is it that you access when you type in "localhost: 3000" onto your browser? What does that represent?




How to show storage usage to each user

We have a web platform that allows users to upload and download their data stored in a storage connected to Linux via NFS. currently about 350GB data is stored.

I want to show each user their current storage usage on the web in real time like Google drive or Dropbox when you update a file, the remaining disk space is shown right away.

My idea was to run du command on Linux and send an update query to DB but du takes so long.

Is there any better idea that I can do this on real time?

Thanks




Which Path should I use in my website? Related path absolute path?

I am building website for my client. I was wondering which path should I use for my website? which path is more secure? also correct me if I am totally wrong or if you have other reason for safety concerns for website! Thanks in advance.

For example...

<script src="https://example.com/admin/js/myjavascript.js"></script>
or
<script src="/js/myjavascript.js"></script>

<img src="https://swadtiffin.ca/wp-content/uploads/myimg.jpg" alt="Loading...!">
or
<img src="/wp-content/uploads/myimg.jpg" alt="Loading...!">

$http({
  method: 'POST',
  url: '/wp-content/themes/astra-child/php/get_all_food_combos.php',
  data: $.param({ 'data': "test" }),
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  }).then(function (resp) {
  console.log(resp.data); //all items
  });
  }, function (error) {
     console.log(error);
  });

or

$http({
  method: 'POST',
  url: 'https://example.com/wp-content/themes/astra-child/php/get_combos.php',
  data: $.param({ 'data': "test" }),
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  }).then(function (resp) {
  console.log(resp.data); //all items
  });
  }, function (error) {
     console.log(error);
  });



How do I apply a background to the whole website?

I have a background design that I would like to cover the whole background of my website with an opacity of 0.03 . Is this possible? If so, would someone be willing to provide me with some code on how to do this, please?




Is node/backend required to save input on a site? [duplicate]

CONTEXT (OPTIONAL)

I know its a duplicate but the other posts didn't answer my problem.

I have a site running on github.io, which I would share but it is currently running a "prank" site and it's really dumb. I did it to test my knowledge and train web development.

I have yet to learn Node and Backend, I don't know much about it so I'm sorry if this seems like a bad question!

QUESTION BEGINS HERE

I have an array at my js file and I want the user to be able to submit strings to it, it does work but only until I refresh the page, only javascript, CSS and HTML are running, no Node, no Backend, is there a way to submit those changes permanently without backend?

edit: And, if I were to use backend, which tools should I be familiar with? I don't know much about server-side programming and client-side, only recently I discovered that there is a difference and I know that node is relevant to the server-side.

EDIT

I'm referring to this post that is about cookies and local storage, but from my understanding, cookies only save data on the client's machine, as do local storage, right?




Redirect non-allowed IPs to a certain page

I downloaded a .htaccess file from www.ip2location.com containing white-listed IP addresses, it essentially blocks all non-white list IP addresses, but I also want to also redirect non-white listed IPs to a certain page like "COMING SOON". How can I do this?

Here is the .htaccess file

```# -------------------------------------------------------
   # Free IP2Location Firewall List by Country
    # Source: https://www.ip2location.com/free/visitor-blocker
     # Last Generated: 25 Aug 2019 23:38:41 GMT
     # [Important] Please update this list every month
   # -------------------------------------------------------
  <Limit GET HEAD POST>
 order deny,allow
 allow from 23.248.181.0/24
 allow from 23.248.183.0/24
  allow from 23.248.185.0/24
 allow from 31.13.155.234/32
 allow from 31.13.156.64/29
 allow from 31.13.158.236/30
  allow from 31.13.159.16/28
 allow from 34.99.130.0/23
  allow from 34.103.146.0/23
 allow from 41.57.120.0/22
 deny from all
</Limit>```

note: my white-listed IP/range is more than this, just for simplicity purpose it gave a sample of white list IPs




How to publish correctly on github?

I'm having problem publishing my web project on github even after I have set to master branch in settings that allows to be published, got a green tick, yet its shows 404. Image of my github repository or go to https://github.com/harnystiles/Website

The asset folder takes in all my css, js, font etc




Heorku Application Open Failure

I am trying to deploy me react app on heroku. Everything says deployed on heroku but when I type heroku open, it says application error and the windwo suggests me to do heroku --tail. When I do heroku --tail on command line, I receive the following error. Please help.

Thank you.
State changed from starting to crashed 2020-05-31T21:02:37.775855+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ancient-gorge-48530.herokuapp.com request_id=d9a3fe26-753e-417d-b296-b77f9ea48280 fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https 2020-05-31T21:02:39.965317+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ancient-gorge-48530.herokuapp.com request_id=b767e1b3-d89d-4cf1-b762-aa7ca6b06496 fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https 2020-05-31T21:02:47.963754+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ancient-gorge-48530.herokuapp.com request_id=252ba8b0-1413-4762-8f9e-866f4ce263dc fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https 2020-05-31T21:02:48.946628+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ancient-gorge-48530.herokuapp.com request_id=ec439c87-bbdd-4880-a3e9-f93911527f1f fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https 2020-05-31T21:03:34.544211+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=ancient-gorge-48530.herokuapp.com request_id=0d845c3c-198e-48a0-b8ed-225a89af5af0 fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https 2020-05-31T21:03:36.818111+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ancient-gorge-48530.herokuapp.com request_id=d179d8d0-da44-4353-99d3-776cb60fa7a4 fwd="24.105.211.206" dyno= connect= service= status=503 bytes= protocol=https




Restrict access on webpage using .htaccess

Hey I am currently running into the problem, that I want to restrict access on some websites in my html root folder, so I can access them only from my local Network.

The Problem is, that neither the site.conf file works nor the .htaccess file in the root folder of the specific website.

My 000-default.conf looks like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/username/htmlfolder
        <Directory />
                Options FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
        DocumentRoot /home/username/htmlfolder
        ServerName myurl.com
        <Directory />
                Options FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

        SSLEngine on
        SSLCertificateFile /linktomy.crt
        SSLCertificateKeyFile /linktomy.key
</VirtualHost>

and my .htaccess file looks like this:

Require ip 192.168.0.0/255.255.255.0
ErrorDocument 403 "Access Restricted!"

The Problem is, that a syntax error in the .htaccess file is making no error when restarting the apache2 server using sudo service apache2 restart and I can still access those websites from a different IP. Using the 2 parameters from the .htaccess file in the 000-default.conf file instead of Require all granted is also not doing anything.

How can I resolve this?




Deploying to Heroku: ImportError:Couldn't import Django

my StackOverflow friends,

When I want to deploy my code to Heroku using git push heroku master I have ImportError:Couldn't import Django. So I try python manage.py runserver to see what is going on and it shows this in the terminal. Full description of ImportError:Couldn't import Django. Before I tab all the process for deploying my code to Heroku,python manage.py runserver works well (the system gives me a link to open my Web page).

I am very new in PyCharm and Heroku and I do not know what is going on. I read a little bit about virtualenv, but I still do not know what is that. If you can help me, please tell me in details what should I do in basic programming language.

Thank you so much :)




how to enable accept cookies in android webview. How to set cookies in android web view

how to enable accept cookies in android webview.i just started android. If anyone know the solution please help me as soon as possible. Thank you




HTML: Automatically Display Given Input on the Same Page

my StackOverflow friends,

I would like to ask how should we write in HTML to display automatically an input given by the web user on the same page without a button or click.

Here is an example that I copy from elsewhere

> <!DOCTYPE HTML>
> <HTML>
> <head>
> </head> 
> <body>
> <script type="text/javascript">
>
> function changeThis(){      
>   var formInput = document.getElementById('theInput').value;   
>   document.getElementById('newText').innerHTML = formInput;   }  
> </script>
> 
> <p>You wrote: <span id='newText'></span> </p> 
> <input type='text' id='theInput'>   
> <input type='button' onclick='changeThis()' value='See what you wrote'/>   
> </body>  
> </html> 

I want to obtain the same effect without using any button, click or Enter tab.

In other words, the input given is display next to "You wrote" second after the user puts something on the line box.




What port is the best to use when making a website

I have no idea what port to use when it comes to making a website, there is a lot of people that use 80 but that might just be for Capturing Flags in Cybersecurity with sites likes TryHackMe and more but what is the most common port to use?




How can I use the user agent string for browser detection if the strings include information about more than one browser?

I want to use the user agent string to determine what browser the user is coming from (specifically interested in whether the user is using Chrome). There is a section of the MDN web doc on user agents that says "...to detect Safari you have to check for the Safari string and the absence of the Chrome string". But a Safari user agent string looks something like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36. It seems like Chrome user agent strings look similar and also include information about the Safari version. How can I distinguish between the two?

I know using the UA string for browser detection is not recommended but unfortunately I need to do it this way for a project I am working on.




Search data table values in website - Python Selenium

I am doing a project where I need to search data table values in a webpage. My data table iS:['FT 202003/69362', 'FT 202003/62581', 'FT 202003/4664', 'FT 201903/215090', 'FT 201903/197043'], so, for each value, I need to search same value in website and click in a button that belong to that value (button is "Obter documentos"). Any ideas?

Website page:

enter image description here




Echoing Different File Contents for Mobile Users vs Laptop

I am setting up a news website for a project and use PHPs Echo file_get_contents feature for a universal navigation bar, the issue is I want different file contents to echo for a mobile user as a post to a laptop/desktop user (my nav bar isn't mobile friendly). How could I do this -current php is below :)

<?php echo file_get_contents('./page/nav.php'); ?>

-Jake




How can I make www.javahippo.com website better?

My website is about providing low cost services for Java software development, etc.

I have listed everything in the first page itself because there is not much to write currently.

Is it attractive enough?

Also, does someone know how can I know/contact potential customers.

Is there a website where I can list my website so that potential customers can find my website.




Getting error while redirecting on specific url

On redirecting website through "www " gives WordPress database error: [Lock wait timeout exceeded; try restarting transaction] UPDATE scsr_options SET option_value = '1' WHERE option_name = 'rs_tables_created'

while redirecting website through "https:// works fine. can anyone help. website is created through wordpress.




Django get URL from address bar

I am a begginer with django and I am stuck in getting this to work, practically what I want is that the user types in the address bar http://website.com/example and then in Django I want to make a dynamic view where it checks the address and then redirects user to the correct page otherwise gives an error.

this is what I was trying but it might not be working..

urlpatterns = [
path("", views.index, name="index"),
path("<str:name>", views.example, name="example") ]

and then in the views.py I want the following:

def example(request, name):
    return render(request, "website/<name> here i want for it to insert what the user typed in the address bar", {
        "name": util.get_entry(name)  <-- this is a function which checks if there is that name in the database otherwise will return an error.
    })

Hope I was clear with the question and thank you for the help :)




A button is empty or has no value text: Accessibility Error

Someone please help me in troubleshooting this problem. It's very urgent.Screenshot




Displaying a piece of HTML code in a web page

I am preparing a web page for teaching basic HTML. I need to add some HTML codes into that web page. Is there any way to do that? I am coding on Net-beans. I need to add codes with the colors that appear on that IDE. Thank you.




Which technology to implement the same web application?

I have checked the website and have researched some technologies this website is using. The website is here: https://www.wayfair.com/RoomPlanner3D/ After opening, there is a option create new room, I'm interested to know about that particular section. This allow us to design a new room. Can anybody tell me which technology the website using for that particular section to create room. And also can you suggest me which technology should I use to implement the same web application.

For your convenience, the list if technologies I have researched for that website are:

  • Nginx (web server)
  • PHP
  • Bootstrap
  • YUI Doc
  • Backbone Js
  • React
  • Underscore Js
  • jQuery

If anyone can suggest new best technologies to implement with little reasoning, that would be great. Looking forward to hearing from you.




Static website I am hosting cannot be reached and the server IP cannot be found

I recently used Google Domains to register a domain and have connected it to Google Cloud Console to manage a static website. I followed the Google Codelabs guide to set it up and faced no issues. However, when refreshing my website, it still doesn't load and my browser (Chrome) gives me the following error message:

This site can’t be reached

[url]’s server IP address could not be found."

As well, going to www.[domain name].dev gives me another error message:

Your connection is not private

Attackers might be trying to steal your information from www.carbonfootprint.dev (for example, passwords, messages, or credit cards).

NET::ERR_CERT_COMMON_NAME_INVALID

...Which is confusing, because I was under the impression that a .dev domain suffix gives SSL certification by default.

However, in my Google Domains settings, the website content appears as it should in the minimized preview that exists in both the Domain Overview panel and Website panel. It has been over 48 hours, so it should have updated by now if it were just a delay issue.




samedi 30 mai 2020

How do I use the user agent string for browser detection when all strings seem to include more than one browser?

I am so confused. I want to use the user agent string to determine what browser the user is coming from (specifically interested in whether the user is using Chrome). There is a section of the MDN web doc on user agents that says "...to detect Safari you have to check for the Safari string and the absence of the Chrome string". But a Safari user agent string looks something like this: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36. It seems like Chrome user agent strings look similar and also include information about the Safari version. How can I distinguish between the two?

I know using the UA string for browser detection is not recommended but unfortunately I need to do it this way for a project I am working on.




About to deploy my first app. Quick question

Got everything working so far, and I have it launched on a Heroku test domain. I checked the website URL that I want and noticed there's nothing parked on there already. How do I go about getting that connected with Heroku? I looked around the Heroku website and dashboard to see what my options were and didn't see anything about purchasing a domain or registering a web address, I'm lost here. Do I need to buy from GoDaddy or another hosting service and set the address/routing DNS from there?




How to get rid of overlaying

The main problem is that the header is fixed and thus overlaying the main part of the web page. So what I did is just margin-top to the main part, which appears to be not working. Moreover, if you will deleted header, it can be seen that the main section just goes too up.

Overview: image|| without header

HTML:

    <header class="header">
    <nav class="navbar">
        <ul class="navbar-nav">
            <li class="nav-item"><a class="nav-link" href="index.html">Visualizer</a></li>
            <li class="nav-item"><a class="nav-link" href="instruction.html">Instructions</a></li>
            <li class="nav-item active"><a class="nav-link" href="credits.html">Credits</a></li>
        </ul>

    </nav>
</header>

<main class="credits">
    <div class="">

        <div class="cr-card">
            <div class="cr-img">
                <img src="img/p1.png">
            </div>

            <div class="cr-info">

                <h1 class="cr-name">
                    Lorem
                </h1>
                <p class="cr-about">
                    lorem ipsum
                </p>
                <ul class="cr-links">
                    <li>
                        <a href="https://github.com/lorem"><i class="fab fa-github"></i></a>
                    </li>
                    <li>
                        <a href="https://t.me/lorem"><i class="fab fa-telegram"></i></a>
                    </li>
                    <li>
                        <a href="https://www.instagram.com/lorem/"><i class="fab fa-instagram"></i></a>
                    </li>
                </ul>

            </div>
        </div>
        <div class="cr-card">
            <div class="cr-img">
                <img src="img/p1.png">
            </div>

            <div class="cr-info">

                <h1 class="cr-name">
                    Lorem
                </h1>
                <p class="cr-about">
                    lorem ipsum
                </p>
                <ul class="cr-links">
                    <li>
                        <a href="https://github.com/lorem"><i class="fab fa-github"></i></a>
                    </li>
                    <li>
                        <a href="https://t.me/lorem"><i class="fab fa-telegram"></i></a>
                    </li>
                    <li>
                        <a href="https://www.instagram.com/lorem/"><i class="fab fa-instagram"></i></a>
                    </li>
                </ul>

            </div>
        </div>
        <div class="cr-card">
            <div class="cr-img">
                <img src="img/p1.png">
            </div>

            <div class="cr-info">

                <h1 class="cr-name">
                    Lorem
                </h1>
                <p class="cr-about">
                    lorem ipsum
                </p>
                <ul class="cr-links">
                    <li>
                        <a href="https://github.com/lorem"><i class="fab fa-github"></i></a>
                    </li>
                    <li>
                        <a href="https://t.me/lorem"><i class="fab fa-telegram"></i></a>
                    </li>
                    <li>
                        <a href="https://www.instagram.com/lorem/"><i class="fab fa-instagram"></i></a>
                    </li>
                </ul>

            </div>
        </div>
    </div>
</main>

SCSS:

.header {
margin-top: 0px;
top: 0;
width: 100%;
height: $header-height;
z-index: 5;
background: radial-gradient(at center top, rgb(46, 51, 58) 0, rgba(27, 30, 34, 0) 80%);
border: 1px;

.navbar {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: center;



    .navbar-nav {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
        justify-content: center;

        .nav-item {
            display: flex;
            align-items: center;
            justify-content: center;
            color: #ffffff;
            cursor: pointer;

            .nav-link {
                font-family: "Raleway", "Hack", Arial, sans-serif;
                font-size: 1.1em;
                color: white;
                height: 68px;
                line-height: 68px;
                padding: 0 15px;
                border-bottom: 0px #3d5cff solid;

                &:hover {
                    border-bottom: 5px #3d5cff solid;
                }
            }

            &.active {
                .nav-link {
                    border-bottom: 5px #fff solid;
                }
            }
        }
    }




}

}




Checking GET method value

I want to check if the value of $_GET["d"] are equal with "n" using this code

<?php if (isset($_GET["d"] == "n" or "h")): ?>

but i receiving the error

Cannot use isset() on the result of an expression (you can use "null !== expression" instead)

What should i do?




How do I make an owner manage e-commerce site?

new here. Just sant to ask some questions regarding site developments. I am planning to create an ecommerce site for someone. How do I make it so that the owner can add, edit and monitor products? Do i have to make login and authentication as admin? How does a normal process work? Sorry Im new in the development world. Thank you




How do i ask for personal data consent for GDPR?

I am building a site for a wedding decoration company, and we have a form that the user fills out to get a price offer. In this form we ask for name, email, telephone, address, etc, so I think this has to be disclosed to the user with some kind of GDPR related message. Is it enough if i write a line before the submit button that states something like "By clicking 'submit' i consent to my personal data being sent to the company"?




Can good SEO performance be obtained by using create-react-app ? If yes, how? Any suitable reference or guide

Please don't mention gatsby.js or next.js as an alternative for now. I am looking for SEO results only by using create-react-app.




validate form then open mail program

Is there away to validate a form in js and if its valid execute a js function?

basiclly it should check if the form is valid then open the default email program with some entries

like so ->

like so




What program can simplify creating websites?

I know HTML,CSS and a little bit of javascript the thing is im creating a little website for fun but i think i'm doing it the wrong and hard way Is there maybe a program to simplify the CSS coding or something? like some program that Web developper uses?I remember seeing that a year ago but i don't remember the name Thank you!




My website doesn't load on Chrome normal but loads in Incognito - but same issue for other users

I've been pulling my hair out for a week trying to get this fixed. Its very hard to reliably replicate the issue, but here goes!

My website won't load on 'normal' chrome, but will load sometimes in Incognito. Ok, fine - disable all extensions and clear cache (similar issue to this Webpage displayed in Incognito, not in regular Chrome)

I have done all of that - but it still doesn't load AND other users from around the world are having the same issue trying to load my site: https://nightrideband.com

People seem to be able to access it once, but then it won't load a second time for them. Almost like there is something seriously wrong with how my WP site is telling browsers to Cache? I host with TrulyWP (a fairly new hosting provider) and use their platform caching thing - I have also tried to disable that. I also tried using their CDN service but that hasn't worked either.

Its so random! I even tried doing some GTMetrix reports, https://gtmetrix.com/?job_error=yJET1gcI (https://nightrideband.com/ fail) https://gtmetrix.com/reports/www.nightrideband.co.uk/6pT83dLQ - adding www. seems to work sometimes.

I think my DNS settings are ok enter image description here enter image description here

Can anyone help me please?

thank you so much!




Wordpress Plugin for Hiking Trails like Komoot

in order to promote our rural hiking trails I want to give a detailed information page about hiking trails in our region. Therefore I am looking for a Wordpress Plugin that is able to gibe a distance "timeline" like Komoot displays their routes: https://www.komoot.de/tour/110865348.

Komoot Hiking Trail

What I have found so far:

  • Cool Timeline Pro
  • WP Timeline
  • TimelineExpress

Does someone have experiences using those plugins? According to their documentations they are all using dates in order to build the timeline. I need something to have the distance for example 0 to 10 (km).




Accessing Website With Authentication And Gathering Data From It

I want to create some java program that accesses some specific URL, enter username and password to specific fields and get some data from it. Getting data part is not that important, but I want to help for accessing the website with username and password. I did some research, I found Selenium and tried some stuff with it, however it did not help me that much. If you have any suggestions, let me know. I am not experienced in website access through java at all. Thank you.




how to compare checkbox checked string value with li element to edit last one

how to compare checkbox checked string value with li element to edit last one. For example.

 jQuery(function($){

// start ajax 
    $('#filter input[type="checkbox"]').on('change', function(){
        var filter = $('#filter');

                        /* Stuff to do every *odd* time the element is clicked */
        $.ajax({
            url:filter.attr('action'),
            data:filter.serialize(), // form data
            type:filter.attr('method'), // POST
            beforeSend:function(xhr){
                filter.find('button').css('opacity', '1').text('Загрузка...'); 
                // changing the button label
            },
            success:function(data){
                filter.find('button').css('opacity', '0');; // changing the button label back
                if($(".checkbox:checked").length == 0) {
                                $('#response').empty(); 
                          } else {
                                $('#response').html(data); 

                                 };

                                 $(".usage-product-list li").each(function () {
                                        if ($(this).text() == 'Усиление иммунитета') {
                                            $(this).css('color', 'red');
                                        }
                                    });


                                }
                    });
        return false;
                    });
//end jquery ajax

    // load more toggle start
    $('.load-more').toggle(function() {
    $(this).html('Меньше параметров <i class="fas fa-angle-up"></i>');
    $('.row-wrap').slideDown('slow');
}, function() {
    $(this).html('Больше параметров <i class="fas fa-angle-down"></i>');
    $('.row-wrap').slideUp('slow');
});
    // load more toggle end


    $('#filter input[type="checkbox"]').click(function () {
            $(this).siblings('span').toggleClass('active');
        });
    // end of stack
    });
// end of stack

In my code i have to change color of li if it contain a text wich i put into the string, but how to change every li color wich text string equal to each checked checkbox parent LABEL string value?

 $(".usage-product-list li").each(function () {
                                            if ($(this).text() == 'Усиление иммунитета') {
                                                $(this).css('color', 'red');
                                            }
                                        });

  <label><span></span><input class="checkbox" type="checkbox" name="usage_uluchpoedaemost"/>Улучшение поедаемости</label>
                    <label><span></span><input class="checkbox" type="checkbox" name="usage_usilimmun"/>Усиление иммунитета</label>



my homepage menu does not work, but works when hovering below the menu

the homepage of my website emceegladys.com has a header at the top of the page. when I hover over my menu items, I can't click to the next pages. however, when I hover below the words, I can click to the next pages. the menu for the other pages are working though.

it is a weird bug and I can't seem to fix it. would like some help thank you very much.




Bootstrap select element showing black border on options

How can I fix this issue? Or is this bootstrap's issue? Click this to view my screenshot




How to fix PHP 7.2 Warning: count(): Parameter must be an array or an object that implements Countable in errors.php?

My script is-

<?php  if (count($errors) > 0) : ?>
  <div class="error">
        <?php foreach ($errors as $error) : ?>
          <p><?php echo $error ?></p>
        <?php endforeach ?>
  </div>
<?php  endif ?>

The error I get is Warning: count(): Parameter must be an array or an object that implements Countable.

I'm using PHP 7.2 on Apache2.




vendredi 29 mai 2020

How to access Flask web server from mobile device?

Guys I have FLask web development server running on my Mac @ 127.0.0.1:5000/. Both my mac and my android device are connected to the same WLAN. I am unable to access my flask website by entering the IP addr of my mac(192.168.8.103:5000) into the browser of my android device. But I can access the webpage from my apache server running on my Mac by entering 192.168.8.103 into the browser of my android device. Can I access the flask webserver from my mobile ?




How to make responsive datatable by adding panels to your left or right?

In the following example in the JS I create a basic datatable table, I easily create the functions to open and close the panels and define the data with which the table will be filled by means of a javascript variable.

In the CSS I define the styles for the left and right panels (sidebarLeft, sidebarRight), so that they occupy their position in their respective place, I add color and I add style for the position and color of their close button (closebtnLeft, closebtnRight) .

and finally in the HTML section I only add the left panel, the main container that contains the table that will be seen at all times and the right panel.

As you can see by having a sufficient screen size for the table to be displayed complete, and pressing either the button left or right panel, the table does not become responsive keeping its size before adding the panel

show size error in the table here

$(document).ready(function() {
    $('#example').DataTable( {
        data: dataSet,
        columns: [
            { title: "Name" },
            { title: "Position" },
            { title: "Office" },
            { title: "Extn." },
            { title: "Start date" },
            { title: "Salary" }
        ],
      "searching": false,
      "lengthChange": false,
      responsive:true
    } );
} );

function openNavLeft() {
  document.getElementById("mySidebarLeft").style.width = "250px";
  document.getElementById("main").style.marginLeft = "250px";
}

function openNavRight() {
  document.getElementById("mySidebarRight").style.width = "250px";
  document.getElementById("main").style.marginRight = "250px";
}

function closeNavLeft() {
  document.getElementById("mySidebarLeft").style.width = "0";
  document.getElementById("main").style.marginLeft= "0";
}
function closeNavRight() {
  document.getElementById("mySidebarRight").style.width = "0";
  document.getElementById("main").style.marginRight= "0";
}



var dataSet = [
    [ "Tiger Nixon", "System Architect", "Edinburgh", "5421", "2011/04/25", "$320,800" ],
    [ "Garrett Winters", "Accountant", "Tokyo", "8422", "2011/07/25", "$170,750" ],
    [ "Ashton Cox", "Junior Technical Author", "San Francisco", "1562", "2009/01/12", "$86,000" ],
    [ "Cedric Kelly", "Senior Javascript Developer", "Edinburgh", "6224", "2012/03/29", "$433,060" ],
    [ "Airi Satou", "Accountant", "Tokyo", "5407", "2008/11/28", "$162,700" ],
    [ "Brielle Williamson", "Integration Specialist", "New York", "4804", "2012/12/02", "$372,000" ],
    [ "Herrod Chandler", "Sales Assistant", "San Francisco", "9608", "2012/08/06", "$137,500" ],
    [ "Rhona Davidson", "Integration Specialist", "Tokyo", "6200", "2010/10/14", "$327,900" ],
    [ "Colleen Hurst", "Javascript Developer", "San Francisco", "2360", "2009/09/15", "$205,500" ],
    
];
.sidebarLeft {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #111;
  overflow-x: hidden;
  transition: 0.5s;
  padding-top: 60px;
}

.sidebarRight {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  right: 0;
  background-color: #111;
  overflow-x: hidden;
  transition: 0.5s;
  padding-top: 60px;
}


.sidebarRight .closebtnRight {
  position: absolute;
  top: 0;
  left: 25px;
  font-size: 36px;
  margin-right: 50px;
}

.sidebarLeft .closebtnLeft {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  margin-left: 50px;
}

.sidebarLeft a,.sidebarRight a {
  text-decoration: none;
  font-size: 25px;
  color: #818181;
  display: block;
  transition: 0.3s;
}

.sidebarLeft a:hover,.sidebarRight a:hover {
  color: #f1f1f1;
}

body {
  font-family: "Lato", sans-serif;
}
<!--sidebar left-->
<div id="mySidebarLeft" class="sidebarLeft">
  <a href="javascript:void(0)" class="closebtnLeft" onclick="closeNavLeft()">×</a>
</div>

<!--main card-->
<div id="main" class = "card bg-light">
                    <div class="pt-3">
                        <div class = "row pull-right">
                            <div class = "col-12 ">
                                <ul class = "flex-lg-row d-flex flex-column mb-0 p-0">
                                    <li class = "d-inline px-lg-1">
                                      <button class="btn fas fa-arrow-left openbtn" onclick="openNavLeft()">
                                        </button>
                                      <button class="btn fas fa-arrow-right openbtn" onclick="openNavRight()"> 
                                        </button> 
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class = "clearfix"></div>
                    </div>
                    <div class = "card-block px-3 pb-0">
                        <table id="example" class="table table-hover display responsive no-wrap" width="100%"></table>                    
                        </div>
                </div>
                
<!--sidebar right-->
<div id="mySidebarRight" class="sidebarRight">
  <a href="javascript:void(0)" class="closebtnRight" onclick="closeNavRight()">×</a>
</div>



<!-------------------------------- CDN's css-------------------------------------->

<!-- Bootstrap & fontawesome css -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<link rel = "stylesheet" href = "https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css" />
<!-- Datatable css -->
<link rel = "stylesheet" href = "https://cdn.datatables.net/1.10.18/css/jquery.dataTables.min.css" />
<link rel = "stylesheet" href = "https://cdn.datatables.net/autofill/2.3.0/css/autoFill.dataTables.min.css" />
<link rel = "stylesheet" href = "https://cdn.datatables.net/fixedcolumns/3.2.5/css/fixedColumns.dataTables.min.css" />
<link rel = "stylesheet" href = "https://cdn.datatables.net/responsive/2.2.2/css/responsive.dataTables.min.css" />
<!-------------------------------- CDN's js-------------------------------------->
<!-- Boostrap & fontawesome js-->       
<script
  src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
  integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="
  crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- Datatable js -->
<script type = "text/javascript" src = "https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
<script type = "text/javascript" src = "https://cdn.datatables.net/autofill/2.3.0/js/dataTables.autoFill.min.js"></script>
<script type = "text/javascript" src = "https://cdn.datatables.net/fixedcolumns/3.2.5/js/dataTables.fixedColumns.min.js"></script>
<script type = "text/javascript" src = "https://cdn.datatables.net/scroller/2.0.0/js/dataTables.scroller.js"></script>
<script type = "text/javascript" src = "https://cdn.datatables.net/responsive/2.2.2/js/dataTables.responsive.min.js"></script>



wordpress website Menu not working on my mobile and im technically layman in coding can anyone support to rectify

I'm not sure what happened or how it happened but one of our client websites mobile menu all of a sudden (at least I think it was all of a sudden) stopped working. I try to click on it and nothing happens (it's supposed to open a drop down) and I'm not sure how to fix.and im technically layman in coding can anyone support to rectify




Firebase Firestore works with real database but not emulator

I'm using Firebase and have started trying to run a local development instance using the Firebase Emulators. I'm running v8.4.1 of Firebase Tools. When I'm running with the real Firestore database everything works fine. However there is something wrong when I'm using the emulators.

I can set a document and then get it through Javascript but nothing shows in the Firebase Emulators UI and the same in reverse, when I add data through the Firebase Emulators UI it isn't available using get in Javascript. Also, when I use the import and export function of the Firebase Tools CLI none of the data I've added through Javascript is exported and imported. I'm not getting any errors in the browser console.

I'm not sure if there is something wrong I'm doing in initializing Firebase or some other config I'm missing?

I'm running: firebase emulators:start --only functions,firestore

Firebase setup code

import * as firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import 'firebase/functions';

const db = firebase.initializeApp({
  apiKey: 'my_api_key',
  appId: 'my_app_id',
  authDomain: 'my_auth_domain',
  databaseURL: 'my_database_url',
  messagingSenderId: 'my_messaging_sender_id',
  projectId: 'my_project_id',
  storageBucket: 'my_storage_bucket',
}).firestore();

if (process.env.NODE_ENV === 'development') {
  firebase.setLogLevel('debug');

  db.settings({
    host: 'localhost:8080',
    ssl: false,
  });

  firebase.functions().useFunctionsEmulator('http://localhost:5001');
}

export { db };

Browser console

index.esm.js?abfd:106 [2020-05-30T03:18:23.148Z]  @firebase/firestore: Firestore (7.14.5): FirestoreClient Initializing. user= Jgjhmnb23JHFDTRGEYK5Jppwed
index.esm.js?abfd:106 [2020-05-30T03:18:23.162Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Get last stream token
index.esm.js?abfd:106 [2020-05-30T03:18:23.164Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Get next mutation batch
index.esm.js?abfd:106 [2020-05-30T03:18:23.166Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Allocate target
index.esm.js?abfd:106 [2020-05-30T03:18:23.167Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Execute query
index.esm.js?abfd:106 [2020-05-30T03:18:23.168Z]  @firebase/firestore: Firestore (7.14.5): IndexFreeQueryEngine Using full collection scan to execute query: Query(target=Target(categories, orderBy: [name (asc), __name__ (asc)]); limitType=F)
index.esm.js?abfd:106 [2020-05-30T03:18:23.173Z]  @firebase/firestore: Firestore (7.14.5): Connection Creating WebChannel: http://localhost:8000/google.firestore.v1.Firestore/Listen/channel [object Object]
index.esm.js?abfd:106 [2020-05-30T03:18:23.178Z]  @firebase/firestore: Firestore (7.14.5): Connection Opening WebChannel transport.
index.esm.js?abfd:106 [2020-05-30T03:18:23.180Z]  @firebase/firestore: Firestore (7.14.5): Connection WebChannel sending: {"database":"projects/vendida-a17e6/databases/(default)","addTarget":{"query":{"structuredQuery":{"from":[{"collectionId":"categories"}],"orderBy":[{"field":{"fieldPath":"name"},"direction":"ASCENDING"},{"field":{"fieldPath":"__name__"},"direction":"ASCENDING"}]},"parent":"projects/my-project-ha47s/databases/(default)/documents"},"targetId":2}}
index.esm.js?abfd:106 [2020-05-30T03:18:23.217Z]  @firebase/firestore: Firestore (7.14.5): Connection WebChannel transport opened.
index.esm.js?abfd:106 [2020-05-30T03:18:23.241Z]  @firebase/firestore: Firestore (7.14.5): Connection WebChannel received: {"targetChange":{"targetChangeType":"ADD","targetIds":[2]}}
index.esm.js?abfd:106 [2020-05-30T03:18:23.242Z]  @firebase/firestore: Firestore (7.14.5): Connection WebChannel received: {"targetChange":{"targetChangeType":"CURRENT","targetIds":[2],"resumeToken":"HGfhjBG7dfU56Gn=","readTime":"2020-05-30T03:18:23.208926Z"}}
index.esm.js?abfd:106 [2020-05-30T03:18:23.242Z]  @firebase/firestore: Firestore (7.14.5): Connection WebChannel received: {"targetChange":{"resumeToken":"YFgT/hjfF76fWj1=","readTime":"2020-05-30T03:18:23.209597Z"}}
index.esm.js?abfd:106 [2020-05-30T03:18:23.244Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Get last remote snapshot version
index.esm.js?abfd:106 [2020-05-30T03:18:23.246Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: Apply remote event
index.esm.js?abfd:106 [2020-05-30T03:18:23.248Z]  @firebase/firestore: Firestore (7.14.5): MemoryPersistence Starting transaction: notifyLocalViewChanges

firestore-debug.log

May 30, 2020 1:08:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
May 30, 2020 1:09:06 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
May 30, 2020 1:09:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.

firebase-debug.log

[debug] [2020-05-30T03:10:25.924Z] May 30, 2020 1:10:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"May 30, 2020 1:10:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}
[debug] [2020-05-30T03:11:06.713Z] May 30, 2020 1:11:06 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"May 30, 2020 1:11:06 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}
[debug] [2020-05-30T03:11:25.949Z] May 30, 2020 1:11:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"May 30, 2020 1:11:25 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}



webview android studio html5 video not working

my problem is when iam using webview to show my website thet have a video player , the player not working i started to change to javascript plyr.js and not worked neather , the website is fine and work well on other browsers , and also when playing a video that src is from the same as my host is the video work and play in the webview ........ so i thing the problem is when i change the src of video to sorce that hosted in other storage the webview cannot handle that , please help me to solve my problem.




Deleted Mobile Web Page Still Shows

I have a very difficult to solve cache problem. I have made a webpage https://tucarreradespega.com The mobile version was broken, so I decided to delete it from my host. However, the page still shows. Only after being refreshed you realise the page is deleted. But when you try to enter again, I have the same problem.

It happens in every mobile device. It's like a phantom Give it a try.




Rendering a horizontal timeline (zoomable, scrubbable) that also displays calculated value on mouseover?

I would like to create an online interactive horizontal timeline, that also shows a calculated value on mouseover, or in a separate box on the page.

  • I have a 6 month timeframe with roughly 20-30 events.

  • I would like a way to zoom in/out and drag through these events

  • In parallel, there is a numerical value that increases over time at a linear rate - which we should display at the current mouse position.

Does anybody know of any good timeline libraries that could render such a thing, or even any cool examples online you might seen that show something similar? Or how would you approach this problem?




Can't store data to mysql db through nodejs

Hello community! I've written these functions to get information comming trough an html form and store it in the database, but when I try to do this, the data aren't stored successfully. I was trying to implement different methods to do this but didn't work.

My controller:

const mysqlConnection = require('../database');
getIndex = (req, res) => {
    console.log('POST /');
    console.log(req.body);
    const {
        id, solicitante, telefono, mensaje, caracteristicas, 
        tipoMasa, saborMasa, cobertura, tamano, abono, precio,
        horaPedido
    } = req.body;
    console.log(req.body);
    const query =  `
        SET @id = ?;
        SET @solicitante = ?;
        SET @telefono = ?;
        SET @mensaje = ?;
        SET @caracteristicas = ?;
        SET @tipoMasa = ?;
        SET @saborMasa = ?;
        SET @cobertura = ?;
        SET @tamano = ?;
        SET @abono = ?;
        SET @precio = ?;
        SET @horaPedido = ?;
        CALL addOrEditPedido(@id, @solicitante, @telefono, @mensaje, @caracteristicas, @tipoMasa, @saborMasa,
            @cobertura, @tamano, @abono, @precio, @horaPedido);
    `
    mysqlConnection.query(query, [id, solicitante, telefono, mensaje, caracteristicas, tipoMasa, saborMasa, cobertura, tamano, abono, precio, horaPedido], (err, rows, fields) => {
        if(!err){
        console.log('done');
            res.json({status: 'Order saved!'});
        }else{
            console.log(err);
        }
    });
}
module.exports = {getIndex};

procedure:

USE `jean001`;
DROP procedure IF EXISTS `addOrEditPedido`;

DELIMITER $$
USE `jean001`$$
CREATE PROCEDURE `addOrEditPedido` (
    IN _id INT,
    IN _solicitante VARCHAR(30),
    IN _telefono VARCHAR(20),
    IN _mensaje VARCHAR(200),
    IN _caracteristicas VARCHAR(200),
    IN _tipoMasa VARCHAR(30),
    IN _saborMasa VARCHAR(30),
    IN _cobertura VARCHAR(30),
    IN _tamano VARCHAR(20),
    IN _abono INT, 
    IN _precio INT,
    IN _horaPedido VARCHAR(5)
)

BEGIN
    IF _id = 0 THEN
        INSERT INTO pedidos (solicitante, telefono, tipoMasa, saborMasa, cobertura,
                            tamano, caracteristicas, mensaje, abono, precio, horaPedido, estado)
        VALUES (_solicitante, _telefono, _tipoMasa, _saborMasa, _cobertura,
                _tamano, _caracteristicas, _mensaje, _abono, _precio, _horaPedido, _estado);
        SET _id = LAST_INSERT_ID();
    ELSE
        UPDATE pedidos
        SET 
        solicitante = _solicitante,
        telefono = _telefono,
        tipoMasa = _tipoMasa,
        saborMasa = _saborMasa,
        cobertura = _cobertura,
        tamano = _tamano,
        caracteristicas = _caracteristicas,
        mensaje = _mensaje,
        abono = _abono,
        precio = _precio,
        horaPedido = _horaPedido,
        estado = 1
        WHERE _id = id;
    END IF;
    SELECT _id AS id;
END;$$
DELIMITER;


I hope u can help me Thanks in advance!




VERY simple HTTP Server on Pi

I'm still new to Pi And Python - so forgive what might be a silly question. I need to set up a very simple HTTP Server - that can be accessed from the internet. I don't need the complexity of Apache or anything like that.

After much reading - so far I can use python -m http.server --cgiwhich will let me run a python program from the web. Great.

The problem is this is slow as the program has to load, do what it does, and then send it. I have found other examples that wrap http.server within the python program - but they all say localhost only.

What do I need to do to manage a simple 'GET' request from within python - that can can be accessed from the Pis IP address?

Thanks - fortunately I have plenty of hair to pull out at the moment. :-)




call() is not working with getter and setter in javascript

let Name = {
   get fullname() {
        return this.fname + this.last
    }
}

function pension() {
    return this.age > 60
}
let firstclass_employee = [{
    fname: "sangeth",
    last: "AV",
    age: 21,
    address: {
        housename: "good house",
        place: "goodplace",
        city: "goodtwon",
        postcode: 121212
    },
    hobbies: ["driving", "travelling", "sports"]
}, {
    fname: "ramu",
    last: "kv",
    age: 29,
    address: {
        housename: "etho veedu",
        place: "vayadi",
        city: "kalur",
        postcode: 11111
    },
    hobbies: ["travelling", "sports"]
}]
console.log(" objects::\t", Name, "\n", firstclass_employee)
    //calling a out side function for an object(out side function may be inside an object oe not)
console.log("Fullname of first employee::", Name.fullname.call(firstclass_employee[0]))
console.log("Pension status of of first emlpoyee::", pension.call(firstclass_employee[0]))
console.log("Fullname of 2nd employee::", Name.fullname.call(firstclass_employee[1]))
console.log("Pension status of of 2nd emlpoyee::", pension.call(firstclass_employee[1]))
AND getting error---> console.log("Fullname of first employee::", Name.fullname.call(firstclass_employee[0])) ^

TypeError: Name.fullname.call is not a function




How much do I need to know about Python and Django to get become a freelancer? Should I learn anything else instead of them to get a job? [closed]

I know a few things in Python, like functions, loops and arguments but it's not much. I only know the very simple stuff. I also know that Python and Javascript are the easiest languages and so I have heard that with a little knowledge about them I can work a web developer or web scraper. But I am not sure about that, I just need a job. Thanks in advance.




Woocommerce swatch variations: filter gallery on select

I am using Variation Swatches For WooCommerce plugin to add variation images to product colors.

It's working fine for now, but the problem is that I am also showing all the product's gallery beside it. When I select a specific color, the corresponding image is showing but the gallery is not filtered to the image(s) of this specific color only.

I want to show the user only the images of the color they choose.

Is there an easy way to filter the gallery by choice of variation or should I do it programmatically?




Tracking location of link click

I wanted to create a link on my social media that when clicked will tell me where the user that clicked it is? Like city/town level? Is this possible? Any help?

Is there any service that does this? It sounds pretty simple but not sure how to go about it.




NGINX proxy_pass http://localhost:9999/ Not Found

I run my webapp on NGINX with the following configuration:

# Based on https://www.nginx.com/resources/wiki/start/topics/examples/full/#nginx-conf
# user              www www;  ## Default: nobody

worker_processes  auto;
error_log         "/opt/bitnami/nginx/logs/error.log";
pid               "/opt/bitnami/nginx/tmp/nginx.pid";

events {
  worker_connections  1024;
}

http {
  include       mime.types;
  default_type  application/octet-stream;
  log_format    main '$remote_addr - $remote_user [$time_local] '
  '"$request" $status  $body_bytes_sent "$http_referer" '
  '"$http_user_agent" "$http_x_forwarded_for"';
  access_log    "/opt/bitnami/nginx/logs/access.log";
  add_header    X-Frame-Options SAMEORIGIN;

  client_body_temp_path  "/opt/bitnami/nginx/tmp/client_body" 1 2;
  proxy_temp_path        "/opt/bitnami/nginx/tmp/proxy" 1 2;
  fastcgi_temp_path      "/opt/bitnami/nginx/tmp/fastcgi" 1 2;
  scgi_temp_path         "/opt/bitnami/nginx/tmp/scgi" 1 2;
  uwsgi_temp_path        "/opt/bitnami/nginx/tmp/uwsgi" 1 2;

  sendfile           on;
  tcp_nopush         on;
  tcp_nodelay        off;
  gzip               on;
  gzip_http_version  1.0;
  gzip_comp_level    2;
  gzip_proxied       any;
  gzip_types         text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  keepalive_timeout  65;
  ssl_protocols      TLSv1 TLSv1.1 TLSv1.2;
  client_max_body_size 80M;
  server_tokens off;
  include  "/opt/bitnami/nginx/conf/server_blocks/*.conf";

  # HTTP Server
  server {
    # port to listen on. Can also be set to an IP:PORT
    listen  8080;

    location /api/* {
      proxy_set_header X-Forwarded-Host $host:$server_port;
      proxy_set_header X-Forwarded-Server $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://localhost:9999;

    }

    location /status {
      stub_status on;
      access_log   off;
      allow 127.0.0.1;
      deny all;
    }
  }
}

and the way that I do the call:

methods: {
  load_user(event) {

    console.log(this.$kc)

    const config = {
      headers: {Authorization: `Bearer ${this.$kc.token}`}
    };

    this.$axios.get('/api/hello/sali', config)
      .then((response) => {
        console.log(response)
      })
      .catch(() => {
        console.log("errro")
      })
  },

Then it shows the following message:

enter image description here

However, it should return:

enter image description here

What am I doing wrong?




Refresh datalist in view after user finishes typing in textbox Angular 7

I am trying to refresh a datalist in the view after waiting for user to finish typing in the textbox and updating results. Tried with angular directives, tried with Observable and various timeouts and debounces and no luck. I ran out of options.

In the html file:

            <input type="text" class="form-control" id="Other"  
            (keyup)="onKeySearch($event)" list="dynamicList" formControlName="Other"/>

            <datalist id="dynamicList">
                <option *ngFor="let employee of employeesList" [value]="employee.Name">
                    </option>
            </datalist>

in the .ts file:

  public employeesList: EmployeeData[] = [];

  timeout: any = null;

  getEmployeesList(name : string) {
      let empList: EmployeeData[] = [];

      // get employees list from service 
      this.employeeService.getEmployeesList(name).subscribe((data: any) => {
        empList = data;
        console.log(empList)
      })
      return empList;
    }

  public onKeySearch(event: any) {
    let empListt: EmployeeData[] = [];

    clearTimeout(this.timeout);
    var $this = this;
    this.timeout = setTimeout(() => {
        empListt = $this.getEmployeesList(event.target.value);
        console.log(empListt)
    }, 1000);
    this.employeesList = empListt;
  }

The problem is that the datalist is not updates after retrieving the data an populating the list. After it exists the method the list is again empty, thus no data to display.




How to prompt the certificate used by site in command line

i'm facing an issue, i can't figure out the path of certificate used by site , how can i prompt the certificate used by site in command line in linux distribution.

is there any command openssl when we can mention the site and can prompt the certificate used ?

thank you for your help.




How to check if a file on a users computer matches the contents of a file on a webpage

I want to have a python script that will check and try and match the contents of a file on a users computer e.g /user/desktop/key/passkey.key with a link e.g. https://key.website.com and will continue on with the script If the files match, but stop if they don't.




Is there way to convert web application in python flask to mobile?

I know that there are ways to convert web site to mobile application using directories and platforms, but it seems like all the examples were on JavaScript. Does it also work with python flask web application?




Python Selenium - Search data table values in website

I am doing a project where I need to search data table values in a webpage. My data table iS: ['FT 202003/69362', 'FT 202003/62581', 'FT 202003/4664', 'FT 201903/215090', 'FT 201903/197043'], so, for each value, I need to search same value in website and click in a button that belong to that value. Any ideas?




Blazor Server-side not loading event listeners

Im building a Blazor Server-side website and im using a template for the design. This includes css and js files.

For some reason the event listeners are not working! I have a button that uses css and js to do some stuff. If I start the website then nothing happens when I press the button. But if I then refresh the page with CTRL+F5 then it works!

Im using .Net Core 3.1.

Normal F5 refresh of the website (don't work):

enter image description here

CTRL+F5 refresh of the website (now it works):

enter image description here

_Host.cshtml

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title</title>

<link rel="stylesheet" media="screen" href="css/vendor.css">
<link rel="stylesheet" media="screen" href="css/theme.css">
<script src="js/modernizr.min.js"></script>
<script src="_framework/blazor.server.js"></script>
<script type="text/javascript" src="js/vendor.min.js"></script>
<script type="text/javascript" src="js/theme.min.js"></script>



Question not fetching from db and not displaying result

i was trying to develop web application of MCQ test using jsp and servlet. question id is fetching on test screen for students but question not showing. instead it shows test name. also after submit test it not generate results. I checked database but it is fine. below is code!

testscreen.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="java.util.ArrayList, com.bmpl.examviral.quiz.*"%>
<%@page import="java.util.HashMap, com.bmpl.examviral.quiz.*"%>
<%@page import="java.util.Map, com.bmpl.examviral.quiz.*"%>
<%@page import="com.bmpl.examviral.quiz.model.dto.QuestionDTO"%>
<%@page import="com.bmpl.examviral.quiz.model.dto.TestDTO"%>
<%@page import="com.bmpl.examviral.quiz.model.dto.UserDTO"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%          
        ArrayList<QuestionDTO> questionlist = (ArrayList<QuestionDTO>)request.getAttribute("questionList");
        TestDTO testdto = (TestDTO)request.getAttribute("testDetails");
        UserDTO userdto = (UserDTO)request.getAttribute("userdetails");
        session.setAttribute("testDetails", testdto);
        session.setAttribute("userdetails", userdto);
        String testName = (String)request.getAttribute("testName");
        int testDuration = (Integer)request.getAttribute("testDuration");
        int dataSize = questionlist.size();
        HashMap<Integer, String[]> map = new HashMap<Integer, String[]>();
        HashMap<Integer, String[]> quesmap = new HashMap<Integer, String[]>();
        int quesNum[] = new int[dataSize];
        String quesArr[] = new String[dataSize];
        String optionAArray[] = new String[dataSize];
        String optionBArray[] = new String[dataSize];
        String optionCArray[] = new String[dataSize];
        String optionDArray[] = new String[dataSize];       
        String option1[] = new String[dataSize];
        String option2[] = new String[dataSize];
        String option3[] = new String[dataSize];
        String option4[] = new String[dataSize];
        String ques1[] = new String[dataSize];
        String ques2[] = new String[dataSize];
        String ques3[] = new String[dataSize];
        String ques4[] = new String[dataSize];
        String ques5[] = new String[dataSize];
        int keys[] = new int[dataSize];
        int quesKeys[] = new int[dataSize];     
        for(int i=0,j=i+1,k=j+1,l=k+1; i<dataSize;i++){
            QuestionDTO quesSet = questionlist.get(i);
            quesNum[i] = quesSet.getQuesNo();
            quesArr[i] =quesSet.getQuestion();
            for(String s: quesArr){
                System.out.println("New Array "+s);

            }
            optionAArray[i]= quesSet.getOptionA();
            optionBArray[i]= quesSet.getOptionB();
            optionCArray[i]= quesSet.getOptionC();
            optionDArray[i]= quesSet.getOptionD();          
            System.out.println("Question No is "+quesNum[i]);
            System.out.println("Question "+(i+1)+" is "+quesArr[i]);
            System.out.println("Option A Array is "+optionAArray[i]);
            System.out.println("Option B Array is "+optionBArray[i]);
            System.out.println("Option C Array is "+optionCArray[i]);
            System.out.println("Option D Array is "+optionDArray[i]);
            map.put(keys[i], optionAArray);
            option1 = map.get(keys[i]);
            System.out.println("Keys of I "+option1[i]);
            map.put(keys[j], optionBArray);
            option2 = map.get(keys[j]);
            System.out.println("Keys of J "+option2[j]);
            map.put(keys[k], optionCArray);
            option3 = map.get(keys[k]);
            System.out.println("Keys of K "+option3[k]);
            map.put(keys[l], optionDArray);
            option4 = map.get(keys[l]);
            System.out.println("Keys of L "+option4[l]); 
        }

%>    
<!DOCTYPE html5>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome to <%= testName %> test</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Allerta+Stencil">
<link rel="icon" href="../../favicon.ico">
<link href="css/fontawesome.min.css" rel="stylesheet">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Custom css -->
<link rel="stylesheet" href="css/testscreen.css">
<script src="js/timer.js"></script>
</head>

<body>
    <div class="row header">
        <div class="col-lg-12">
            <div class="logo">
                <img src="images/logo.jpg" alt="">
            </div>
           <h1>Welcome to exam viral<br><span data-shadow-text="Text-Shadow">Java Programming</span><br> test</h1>
       </div>           
    </div>
    <div class="row quespage" ng-show="questionPage" id="quesdiv">
        <div class="col-lg-4 sidepanel">
            <div class="timestatus w3-container w3-allerta">
                <p>Total Time:<span id="totaltime"><c:out value="${testDuration}"></c:out></span></p>
                <p id="showtime" class="w3-xlarge">Time Left: <span id="time"></span> Minutes</p>
            </div>
            <div class="card">
                  <img src="images/newdp.png" alt="John" style="width:100%">
                  <h2>Samarth Parashar</h2>
                  <p class="title">Student</p>
                  <p class="iname">MERI College</p> 
                  <p><button>Contact</button></p>
            </div>

        </div>
        <div class="col-lg-8 quesdiv">
            <form action="Test?noofquestions=<%= dataSize%>&testName=<%= testName%>" method="post">
                        <%
                            for(int i=0;i<keys.length;i++){

                        %>  
                        <div class="panel panel-primary">
                        <div class="panel-heading">
                            <input type="hidden" name="que<%=i%>" value="<%= quesArr[i]%>"/>
                            <h3 class="panel-title"><%= quesNum[i] %>&nbsp &nbsp <%= quesArr[i]%><br></h3>
                        </div>
                        <div class="panel-body">
                            <table>
                                <tbody>

                                    <tr>
                                        <td>A</td>
                                        <td><input type="radio" name="options<%= i %>" value="optionA" required>&nbsp <%= option1[i] %></td>
                                    </tr>
                                    <tr>
                                        <td>B</td>
                                        <td><input type="radio" name="options<%= i %>" value="optionB" required>&nbsp <%= option2[i] %></td>
                                    </tr>
                                    <tr>
                                        <td>C</td>
                                        <td><input type="radio" name="options<%= i %>" value="optionC" required>&nbsp <%= option3[i] %></td>
                                    </tr>
                                    <tr>
                                        <td>D</td>
                                        <td><input type="radio" name="options<%= i %>" value="optionD" required>&nbsp <%= option4[i] %></td>
                                    </tr>                               
                                </tbody>
                            </table>

                        </div>
                    </div>

                <%  
                    }
                %>
            <input class="btn btn-primary submitBtn" id="submitButton" type="submit" value="Submit">
            <input type="reset" class="btn btn-success" value="Reset">
            </form>
            <a class="btn btn-primary" href="logout.jsp">Logout</a>
      </div>
    </div>
</body>
</html>

testcontroller.java test servlet page

package com.bmpl.examviral.quiz.controller.testcontrollers;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.bmpl.examviral.quiz.commonutils.Result;
import com.bmpl.examviral.quiz.model.dao.QuestionDAO;
import com.bmpl.examviral.quiz.model.dao.ResultDAO;
import com.bmpl.examviral.quiz.model.dto.QuestionDTO;
import com.bmpl.examviral.quiz.model.dto.ResultDTO;
import com.bmpl.examviral.quiz.model.dto.TestDTO;
import com.bmpl.examviral.quiz.model.dto.UserDTO;

/**
 * Servlet implementation class TestController
 */
@WebServlet("/Test")
public class TestController extends HttpServlet {
    private static final long serialVersionUID = 1L;
    int rows=0;
    /*String optionArray[] = new String[4];
    String quearr[] = new String[6];*/
    QuestionDAO quesdao = new QuestionDAO();
    QuestionDTO quesdto = new QuestionDTO();
    ResultDTO resultdto = new ResultDTO();
    ResultDAO resultdao = new ResultDAO();
    int dbresult=0;

    /*int correctAnsCounter=0;
    int incorrectAnsCounter=0;*/

    /**
     * @see HttpServlet#HttpServlet()
     */
    public TestController() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        int correctAnsCounter=0;
        int incorrectAnsCounter=0;
        HttpSession session = request.getSession();
        TestDTO testdto = (TestDTO)session.getAttribute("testDetails");
        UserDTO userdto = (UserDTO)session.getAttribute("userdetails");
        int totalMarks = testdto.getTotalMarks();
        System.out.println("Total Marks "+totalMarks);
        String testName = request.getParameter("testName");
        String arr = (String)request.getAttribute("arr");
        System.out.println("String in controller"+arr);
        System.out.println("Test name is "+testName);
        rows = Integer.parseInt(request.getParameter("noofquestions"));
        Result result = new Result(rows, totalMarks);
        String optionArray[] = new String[rows];
        String quearr[] = new String[rows];
        System.out.println("No of questions are "+rows);
        for(int i=0;i<rows;i++){

            quearr= request.getParameterValues("que"+i);
            optionArray[i] = (String)request.getParameter("options"+i);
            String userSelectedOption = optionArray[i];
            if(userSelectedOption==null){
                System.out.println("Getting Null Value");               
            }else{  
                System.out.println("Option selected by user of Question "+(i+1)+" is "+userSelectedOption);
                for(String s: quearr){
                    System.out.println("question "+ s);
                    QuestionDTO quesdto = quesdao.getDataComp(s, testName);
                    String correctAns = quesdto.getCorrectAnswer();
                    System.out.println("Correct Ans is "+correctAns);
                    int cmp = correctAns.compareTo(userSelectedOption);
                    if(cmp == 0){
                        correctAnsCounter++;
                        System.out.println("Answer is correct");
                    }else{
                        incorrectAnsCounter++;
                        System.out.println("Answer is not correct");
                    }
                }
            }
        }
        result.countCorrectAns(correctAnsCounter);
        float percentage = result.calculatePercentage();
        System.out.println("User Get "+percentage+" percentage");
        System.out.println("No of correct answer is "+correctAnsCounter);
        System.out.println("No of incorrect answer is "+incorrectAnsCounter);
        resultdto.setUsername(userdto.getUsername());
        resultdto.setMarks(percentage);
        resultdto.setEmail(userdto.getEmail());
        resultdto.setTestName(testName);
         try {
            dbresult = resultdao.insertResultData(resultdto);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        request.setAttribute("percentage", percentage);
        request.setAttribute("correctAnswers", correctAnsCounter);
        request.setAttribute("incorrectAnswers", incorrectAnsCounter);
        request.setAttribute("testName", testName);
        request.setAttribute("userdetails", userdto);
        request.setAttribute("noofques", rows);
        RequestDispatcher rd = request.getRequestDispatcher("result.jsp");
        rd.forward(request, response);
    }

}


result.jsp

 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="com.bmpl.examviral.quiz.model.dto.UserDTO"%>    
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    UserDTO userdto = (UserDTO)request.getAttribute("userdetails");
    int noofques = (Integer)(request.getAttribute("noofques"));
    int correctAnswers = (Integer)(request.getAttribute("correctAnswers"));
    int incorrectAnswers = (Integer)request.getAttribute("incorrectAnswers");
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Student Result</title>
    <!-- Bootstrap library--->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!---- Custom css file ---->
    <link rel="stylesheet" href="css/result.css">
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

      // Load the Visualization API and the corechart package.
      google.charts.load('current', {'packages':['corechart']});

      // Set a callback to run when the Google Visualization API is loaded.
      google.charts.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

        // Create the data table.
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Answers');
        data.addColumn('number', 'answers');
        data.addRows([
            ['Correct Answers', <%= correctAnswers %>],
            ['Incorrect Answers', <%= incorrectAnswers %>]
          ]);


        // Set chart options
        var options = {'title':'How many answers you give right or wrong',
                       'width':400,
                       'height':300};

        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
    <!-- Disable Back button -->
    <script type="text/javaScript">
            function disableBackButton()
            {
            window.history.forward();
            }
            setTimeout("disableBackButton()", 0);
    </script>
</head>
<body onload="disableBackButton()">
    <div class="row header">
        <div class="col-lg-12">
          <img src="images/logo.jpg" alt="sitelogo">
             <h2 class="sitename">Exam Viral</h2>
            <h1 class="mainheading">View Student Result</h1>    
            <p class="welcome">Welcome <%= userdto.getUsername() %></p>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-2 col-md-2 col-sm-4 leftsidebar">
            <div class="card">
                  <img src="images/newdp.png" alt="John" style="width:100%">
                  <h2><%= userdto.getUsername() %></h2>
                  <p class="title">Student</p>
                  <p><%= userdto.getInstitutename() %></p>
                  <a href="#"><i class="fa fa-dribbble"></i></a> 
                  <a href="#"><i class="fa fa-twitter"></i></a> 
                  <a href="#"><i class="fa fa-linkedin"></i></a> 
                  <a href="#"><i class="fa fa-facebook"></i></a> 
                  <p><button>Contact</button></p>
            </div>
        </div>
        <div class="col-lg-6 col-md-6 col-sm-4 centerside">
            <div class="panel panel-success">
              <div class="panel-heading">
                    <h3 class="panel-title">Test Submitted Successfully</h3>
              </div>
              <div class="panel-body">
                <p>You Got <c:out value="${requestScope.percentage}"> Percentage</c:out></p>
                <p>Total questions are <%= noofques %></p>
                <p>You gave <c:out value="${requestScope.correctAnswers}"></c:out> correct Answers</p>
                <p>You gave <c:out value="${requestScope.incorrectAnswers}"></c:out> incorrect Answers</p>
              </div>
            </div>
            <a class="btn btn-primary" href="index.jsp">Home</a>
            <a class="btn btn-primary" href="login.jsp">Logout</a>
        </div>
        <div class="col-lg-4 col-md-4 col-sm-4 rightsidebar">
            <div id="chart_div"></div>
        </div>
    </div>
</body>
</html>

I think problem is in testscreen.jsp page line which is below

quesArr[i] =quesSet.getQuestion();
            for(String s: quesArr){
                System.out.println("New Array "+s);

            }

in above list questions are not getting in quesArr[i] help me




How to verify hCaptcha response and ensure it is filled?

I have followed the tutorial here.

hCaptcha appears on my site, but the form can be submitted without attempting it. How can I make it a required field?

I have tried the following to make it required.

<?php
$data = array(
            'secret' => "my-secret (should start with 0x..)",
            'response' => $_POST['h-captcha-response']
        );
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
var_dump($response);
?>

And also

<?php

  if(isset($_POST['h-captcha-response']) && !empty($_POST['h-captcha-response']))
  {
        $secret = 'your_secret_key';
        $verifyResponse = file_get_contents('https://hcaptcha.com/siteverify?secret='.$secret.'&response='.$_POST['h-captcha-response'].'&remoteip='.$_SERVER['REMOTE_ADDR']);
        $responseData = json_decode($verifyResponse);
        if($responseData->success)
        {
            $succMsg = 'Your request have submitted successfully.';
        }
        else
        {
            $errMsg = 'Robot verification failed, please try again.';
        }
   }
?>

But I get a Notice: Undefined Index: error. I tried to hide the error by editing php.ini and also by adding
<?php error_reporting (E_ALL ^ E_NOTICE); ?> at the top of my file, but it doesn't work.

When I try to make it required, I get an unexpected end to file error-

$("form").submit(function(event) {

   var hcaptchaVal = $('[name=h-captcha-response]').value;
   if (hcaptchaVal === "") {
      event.preventDefault();
      alert("Please complete the hCaptcha");
   }
});



How to add read more toggle , when amount of text is unknown using HTML, CSS and Javascript only [closed]

I was making a feed similar to Quora, using HTML, CSS, and Javascript. I wanted to add a read more toggle. There are some jquery codes available, but I had just started web dev so it would be great if I can get something in vanilla Javascript.




casts datetime format in Laravel

As the Laravel document, we can cast the value to DateTime.

https://laravel.com/docs/5.8/eloquent-serialization#date-serialization

protected $casts = [
    'birthday' => 'date:Y-m-d',
    'joined_at' => 'datetime:Y-m-d H:00',
];

There result is :

"2020-05-29 00:00:00" but i want to result like that:

"2020-10-29T00:00"

I can use Carbon with format "Y-m-d\TH:i");

if possible to format like "2020-10-29T00:00" if I don't use the Carbon?

any ideas will be appreciated.




jeudi 28 mai 2020

I want to change price depending on checkboxes ticked. How to remove if statement from onSubmit()

I want the users to select items form checkbox and submit a numerical price according to the items selected. I have tried it here using if statement. How to do this efficiently?? i had tried to map the states using this.state.map() but its not working also.

  constructor(props) {
    super();
    this.state = {
      check1: false,
      check2: false,
      check3: false,
      check4: false,
    };
    this.onCheckChange = this.onCheckChange.bind(this);
    this.onSubmit = this.onSubmit.bind(this);
  }

  onCheckChange(e) {
    this.setState({
      [e.target.name]: e.target.checked,
    });
  }

//**************i want to change this ****************

  onSubmit(e) {
    e.preventDefault();
    var price = 0;
    if (this.state.check1 === true) {
      price = price + 10;
    }
    if (this.state.check2 === true) {
      price = price + 20;
    }
    if (this.state.check3 === true) {
      price = price + 30;
    }
    if (this.state.check4 === true) {
      price = price + 40;
    }
    console.log(price);
  }

  render() {
    return (
      <div>
        <Form onSubmit={onSubmit}>
          checkboxes are placed
        </form>
      </div>
    );
  }
}

export default SellComponent;



Prevent Bootstrap Menu going Behind Footer

I've designed a Page who has Top Navigation, Slider and Footer. it looks fine on Desktop but when we open/Expand the Menu on Mobile Device, the Menu is going behind the Footer.

Please note that we cannot add extra White Space between Slider and Footer to prevent this as described in this

Following is the Screenshot from Mobile Device:

enter image description here

How can we resolve this? please help

Thanks




flutter program work okay on chrome, but cannot work correctly on web server

I'm pretty new to flutter, and wrote the following flutter program to get the client IP address and location. I'm calling "http://ip-api.com/json" for IP address and location information. The program works okay by using device "chrome", I can print client's IP address on the title bar.
. When I switch to device "web server", and the program print nothing on the title bar, and it just show a blank page. I have been struggle on this for a week now. Is this because that flutter is still in beta version for web support? Your help is highly appreciated.

import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

class IP_info{
  final String IP;
  final String city;
  final String ZIP;
  final String st_code;
  final String state_name;
  final String country_code;
  final String country_name;

IP_info({this.IP,this.city,this.st_code,this.ZIP,
this.state_name,this.country_code,this.country_name});



factory IP_info.fromJson(Map<String, dynamic> json){
    return IP_info(
      IP:json['query'],
      ZIP:json['zip'],
      city:json['city'],
      country_code:json['countryCode'],
      st_code:json['region'],
      country_name:json['country_name'],
      state_name:json['regionName'],
    );
  }
  }
}

void main() {
  runApp(MaterialApp(
      title: 'This is a test',
      home: MyApp()
  ),
  );
}

class MyApp extends StatefulWidget{
  @override
  State<StatefulWidget> createState()  => MyAppState();
}

class MyAppState extends State<MyApp> {

  bool _isLoading = false;
  IP_info ip_info;

  @override
  void initState() {
     _isLoading=true;
    _getPublicIP();
  }

_getPublicIP() async {
    try {

      const url = 'http://ip-api.com/json';

      final response = await http.get(url);
      if (response.statusCode == 200) {
        ip_info = IP_info.fromJson(json.decode(response.body));

        setState(() {
          _isLoading = false;
        });
        }
      else {
        // The request failed with a non-200 code
        print(response.statusCode);
        print(response.body);
      }
    } catch (e) {
      print(e);
    }

  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Testing your IP Address ${ip_info.IP}'),),
    );
  }
 }



Add users` extra data to firestore when they sign in first time with web Firebase firestore

unsubscribeFromAuth = null; //memory leak

  componentDidMount() {
    this.unsubscribeFromAuth = auth.onAuthStateChanged(user => {
      this.setState({ currentUser: user });
      if (user === null)
        return;

      // user data
      const uid = user.uid;
      const photoURL = user.photoURL;
      const name = user.displayName;      

      const userRef = firestore.collection('Users');
      userRef.where('uid','==',uid).get().then((querySnapshot) => {
        console.log("uid size : ",querySnapshot.size);
        // add user extra data when first sign in.
        if (querySnapshot.size === 0) {
          firestore.collection('Users').add({
            uid: uid,
            photoURL: photoURL,
            name: name,
          })
          .then((docRef) => {
            console.log("Document written with ID: ", docRef.id);
          })
          .catch((error) => {
            console.error("Error adding document: ", error);
          });
        }
      });
    });
  }

My code is like this. But when I sign in, querySnapshot.size is 0 and it add user`s data again and again even though there are already user data.

enter image description here enter image description here

Like these, they have same uids but signing in made again and again. Is there any problem when I program like this?




I hate php help plz

I'm making a chat feature for site and php is shit code:

<?php
if (isset($_POST['send'])) {

    require 'database.php';

    $input = $_POST['input'];

 }  else {

          $sql = "INSERT INTO chatsys (chat) VALUES (?)";
          $stmt = mysqli_stmt_init($conn);
          if (!mysqli_stmt_prepare($stmt, $sql)) {
            header("index.html?error=sqlerror");
            exit();
          }
          else {

            mysqli_stmt_bind_param($stmt, "sss", $input);
            mysqli_stmt_execute($stmt);
            header("index.html?request=success");
            exit();
          }
    }
  {
    mysqli_stmt_close($stmt);
    mysqli_close($conn);

}

And database code:

<?php

$servername = "localhost";
$dBUsername = "root";
$dBPassword = "";
$dBName = "chatsys";

$conn = mysqli_connect($servername, $dBUsername, $dBPassword, $dBName);

if (!$conn) {
    die("Connection failed: ".mysqli_connect_error());
}
?>

What have I done wrong, plz I need some help. Also for context this is made to browser chat application for well sending messages between people. I am mostly writing this part because i won't let me post it if I do not write more text but like please help though.




How to sell a course part by part in wordpress?

I am going to create a learning website by wordpress.

1.I want to sell a course's seasons seperately. For example course x has 7 season and i want to sell each season seperately. Is there any plugin ?

2.i want to sell seasons in order. For example student must buy season 1 befor season 2 and season 2 befor season 3. Is there any plugin ?

3.i want to students pay after watcing the seasons. For example student watch season 1 and if he was satisfied he pay for season 1 and season 2 will be accessable and free to watch and if he was satisfies from season 2 he will pay for it. Is there any plugin ?

Thanks. Have a good day.




How can I make a simpler players list [closed]

Ok so I have a Minecraft smp server and I want on my site to have a section with every player s base location

I came up with a working prototype but I am no master at html CSS etc so I need help

When there are few players it is easy to hardcode them in but when you have 40 50 players it becomes a pain in the backside and I want to know how to make this process automated

Here is what it looks like1

The list is 150 players long but here is a player model

<li>
    <div class="entry">
      <h1 class="namePlayer">x247Shufflingx</h1>
      <span class="avatarmc">
          <img src="https://minotar.net/avatar/x247Shufflingx/64">
      </span>
      <span class="coords">
          <h1 class="detailsBase">
              <details>
                  <summary>Coordinates</summary>
                      <p class="coords1">
                          Overworld Base : Not Available Yet | Nether Portal : Not Available Yet
                      </p>
              </details>
          </h1>
      </span>
    </div>
   </li>

And css

<style>
.avatarmc, .coords {
    vertical-align:middle;
    display:table-cell;
}
.coords1{
    margin: 0;
    font-size: 19px;
}
.detailsBase {
    margin-left: 15px;
    font-size: 19px;

}
.namePlayer {
    text-align: left;
    margin:0;
    font-size: 25px;
}
ol {
    font-size:25px;
    margin-left: 15px;
}
.numbers {
 margin-top:75px;
}
</style>





How should I transfer data from a website?

Currently, I am working in a company where I have to copy sentences, audio files, pictures to a different page. There are many things to copy so it will take a very long time to do it manually. I heard about Selenium. I have some experience with coding languages such as java and c#. What would be the most efficient way to do this?




div: to fill all available space with increasing parent

  1. There are "view" and "main" with a height of 100%. "main" will scroll.
  2. There are "header" and "footer" of fixed height (but unknown in advance).
  3. "content" will scroll and take up all the free space (for example, when increasing the "header", it decreases).
  4. However, it can decrease only to a specified height (min-height), after which the "view" block begins to expand.

Drawing layout.

How can this be achieved? Tried through flex. The fact is that at a height of 100% of the view block, when expanding, it begins to climb onto another block because of the hard-set height (i.e., overflow occurs). And you cannot remove the specified height from view, because impossible to implement paragraph 3.

<div class="main">
    <div class="view">
        <div class="header"></div>
         <div class="content"></div>
          <div class="footer"></div>
    </div>
    <div class="view">
        <div class="header"></div>
         <div class="content"></div>
          <div class="footer"></div>
    </div>
</div>
.main {
    height: 100%;
    overflow: auto;
}

.view {
    height: 100%;
}

.header, .footer {
    height: 30px;
}

.content {
    overflow: auto;
//    height: all remaining space until min-height
    min-height: 50%;
}



mercredi 27 mai 2020

How to position a Text/TextSpan inside a class

How can I position my Text like this? I check the docs and I only see texts that are on each of the other side of the row but not someone like this which is the other way around.

I just wanted to have my first column takes about 30% of the row inside a card with text alignment of right and my second column takes about 70% of the row inside a card with text alignment of left. I also wanted to have it like a sort of table where in everything is in proper alignment with regards to column. Thank you

         Date:   Today       
      Address:   Sample       
       Gender:   Male
       Status:   Active



Possible ways to embed a flutter web app?

we want to embed a flutter WEB app on multiple web sites.

For now we can think of two approaches that could be followed

  1. Embed using iFrame
  2. Make the whole app using a script tag (not sure if it is possible with flutter yet)

Please let me know if there are other ways which I am missing out on.

Also, it would be great to know if there are any cons of using an iframe to embed a flutter web app.




How to use webdriver to open a function in the settings?

I need to open favorites, history or settings, or an option.

E.g: enter image description here

I am using edge,c#