vendredi 31 juillet 2020

Auth0 doesn't work on mobile for regular web application (Flask app)

I have a Flask app that uses Auth0 (Regular Web Application type). It works perfectly on localhost and on Prod using a laptop. But it doesn't work on an iPhone or iPad.

When using an iPhone or iPad, it will show the Auth0 Login Page (just exactly like what it would show when using a laptop). However, when I try to log in either with Google or email/password, it would keep redirecting me back to the Auth0 Login Page (it doesn't behave like that when I use my laptop -- it would take me to my app). It does return an error Wrong Email Or Password when I typed in wrong credentials using either device.

Is there anything I'm missing for using Auth0 on a mobile device? I've tried both Chrome app and Safari, both behave the same.




website to general-purpose programming language tasks

Im wondering if this is even possible or maybe its a lack of understandng. I want to know if you can have a website that has the ability to run tasks from a general-purpose programming language such as python, or even powershell and bash?

An example would be something like a website containg an input box and submit button, when submitted, the website would take that input and run some python or powershell commands using that input, then return the results. Is this even doable? I know there are cgi-bin scripts but thoes seem to be old news and not the proper way of doing things.

I've been googleing this for awhile and having a hard time figureing this out. What im looking to do is build basic web based apps for normal everyday functions that i use in these environments, i just dont understand how to bridg the gap.




How do I optimise an AEM page with multiple custom components?

So I'm currently using AEM 6.5 for a demo website I'm trying to build. The use-case is, I need to pull content from a content management system(CMS) using restful API's to build this site. For this purpose, I've created a custom component that has a dropdown in its configuration for the different content categories available in the CMS. Now based on this content category and a unique id from the request parameters, I make a rest API call to my CMS to get data. 

I place this custom component at multiple places in my page for different content as needed. I use the Java backend (WCMUsePOJO) to make the API calls to my CMS. The issue I ran into is that, when I place multiple of these components on my page, the page slows down significantly. Is there any optimisation approach that you can suggest?

I'm also using the tab component on my page, so if there is any optimisation around that, it'll work too.




JFrog Artifactory as data source in web application

I've my artifacts(logs and images) stored in Jfrog Artifactory. I need to use these as source of data in a web application I'm going to develop. I'm aware that Jfrog Artifactory has a REST API. However I did not find any documentation around if we can view the content of a file over a HTTPS call.Can I use Artifactory as source of data for a web application ( say using Blazor) ?. Appreciate your insights on this.




Send properties in child lit-element

I'm trying to build a web application using lit-element. I have main class named App and secondary class - popup which has properties such as time and text.

In App I have:

class App extends LitElement {
    ...
    render() {
        return html`
            <myapp-popup .time="5000" .text="this is a test"></myapp-popup>
            ...
        `;
    }
    ...
}
customElement.define('my-app', App);

In Popup:

class Popup extends LitElement {
    ...
    constructor() {
        super();
        this.display = 'show';
        setTimeout(() => this.display = 'hide', this.time);
    }
    render() {
        return html`
            <span class="pop-up ${this.display}>${this.text}</span>
        `;
    }
}
customElement.define('myapp-popup', Popup);

The problem is that in the constructor of Popup variable time is still undefined even though I passed it as a property in App.render().

How to correctly pass something into child lit-element so it will be available in child's constructor?




Angular cross origin build option

I would like to build my angular application with the cross origin build option. I am currently using a couple of build options and it works fine (prod and output-hashing). When I attempt to add cross-origin build option in the command line I get the following error: Unknown option --cross-origin (or --crossOrigin depending on how I write it so it is not a case convention issue). If add the the crossOrigin option to the angular.json file under the projects architect build options section then I get the following error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(crossOrigin). I would like to know what is causing this error and how to overcome it.




HTTPS icon red and crossed out using Apache2

I am trying to use the index.html default website of Apache2 but using secure connection with https.

I am using a self signed certificate but when I get into the website, the "https" is crossed out in red. I would like to fix it without using a paid certificate, since this is only for testing and learning more about Apache2

Thanks




How to access gmail without providing all credentials

I am trying to log into my gmail by only providing my email and leaving the password box empty. Each time I try, it stops me and says I need a password. Is there a way I could disable their requirement for me to log in with a password?




How do I implement a subscription model for user sign in event

I want to implement a event listener that I can subscribe to in my appA when user signin in my appB. Similar to how firebase implemented onAuthStateChanged(link). What's the most common ways to achieve that? Note that I don't have a web url for appA so I cannot use webhook to send message from appB to appA.




couldn't load TLS file database

I have a customed device with iMx.6 microcontroller and embedded Linux. Also I have costumed Linux kernel according in hardware and rootFS built by buildroot. The device has a LVDS and touchscreen. I would like to have Midori browser in the device to browse various websites. the problem is when I run Midori with $midori -a www.google.com I got this error :

GLib-Net-WARNING **: couldn't load TLS file database: Failed to open file '/etc/pki/tls/certs/ca-bundle.crt': No such file or directory

Do you have any idea how can I solve the problem?




TypeError: -not all arguments converted during string formatting

from tkinter import *
import tkinter as tk
import psycopg2



root = Tk()

def get_data(name,age,address):
    conn = psycopg2.connect(dbname="postgres", user="postgres", password="postgres", host="127.0.0.1", port="8080")
    cur = conn.cursor()
    query = '''INSERT INTO student (NAME,AGE,ADDRESS) VALUES (%s,%s,%s);'''
    cur.execute(query, ["name, age, address"])
    print("DATA INSERTED")
    conn.commit()
    conn.close()


error:

TypeError: not all arguments converted during string formatting

where is the problem and in addition id is registerd as serial in database




HTML Change the Background-Color of a Checked Checkbox

I have a really simple question but I could'nt find one simple answers for this.

I have a checkbox like below:

<input type="checkbox">

And I want to change just the background color when this checkbox is checked.

Is there a simple way to do this in CSS or JS ?




Getting span id innertext

Friends, I am trying to get the value of innerText but not able to do it. Please suggest, thanks.

Set dados = oHtml.getElementsByClassName("Label1")(0).getElementsByTagName("span")

i = 0
For Each oElement In dados
    Sheets("Data").Range("A" & i + 1) = dados(i).innerText
    i = i + 1
Next oElement
aaa:
Resume Next
On Error GoTo bbb
Set dados = oHtml.getElementsByClassName("detail-val")(0).getElementsByTagName("td")
i = 0
For Each oElement In dados
    Sheets("Data").Range("A" & i + 1) = dados(i).innerText
    i = i + 1
Next oElement
bbb:
Resume Next

HTML Code:

<table id="TdPrice" width="350px" cellpadding="0" cellspacing="0" border="0" style="text-align: left; font-size: 12px; line-height: 15px; float: right">
<tr><td colspan="2" class="detail-mtit"></td></tr>
<tr><td class="detail-tit" style="width:150px;">Price USD:</td>
<td width="160px" class="detail-val">4.00</td>
</tr>
<tr><td class="detail-tit">QTY In Stock:</td>
<td class="detail-val"><span id="Label1">5</span></td>
</tr>



After speeding up the internet the Next hyperlink button not working at times

The web site had a Next button on a page called 'Page A' (Name chnged) The page had a button with a link to take it to a next page or a pop up option

after speeding it up it does not work at times - but aftera while it worked

If the reason is mystery or spiritual then please ignore - if it is a material reason, then, please explain




Why my JS function automatically fires without click?

Basically i would like to toggle class of 'active'. and I want all JS related codes in my main.js file. I mean I dont want my #readmore button to has onClick=toggle() inside its attribute. onClick method works fine, toggles my 'active' class. But the problem is without doing it. When I use code below, it automatically adds 'active' class to .container and doesnt removes when I click on #readmore. By the way, i dont want to use jQuery.
Thats is my CSS

<div class="container">
        <div class="content">
            <h2>
                Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nesciunt, modi! Ipsum ab non voluptas facilis maxime architecto nulla consectetur recusandae.
            </h2>
            <img src="img/img4.jpg" alt="" width="600px">
            <a href="#" id="readmore">Read More</a>
        </div>

and my JS file

var myBtn = document.querySelector("#readmore");

myBtn.addEventListener("click",toggle());

function toggle(){
    document.querySelector(".container").classList.toggle('active');
};



How to add a spherical 360 render in my webpage and interact with hotspots

I want to integrate a 360 render in my webpage where the user can rotate the image and click on hotspots in the image. 1.How can I integrate this into my webpage? 2.How can I create the hotspots in the image? 3.And how can get the interaction of 360 rotation of the image?

I am trying to achive something similar to this https://www.target.com/c/360-degree-shoppable-rooms/-/N-mng3h




jeudi 30 juillet 2020

Get dynamic data of a stock

we need to get live data of a stock from its webpage (http://tsetmc.com/Loader.aspx?ParTree=151311&i=46348559193224090) as you see on link above there are lots of data and numbers and we need all of them for a bot.for example each second "حجم معاملات" is changing , and we need to get that number every time that user request our bot.

how can we get those date,live, in java ? thanks for your helps.




Firebase login for specific users

I'm trying to create a firebase web login system for only specific users(already added to firebase), I added my account to firebase authentication, and kept only kept:


  var token = result.credential.accessToken;
  var user = result.user;

}).catch(function(error) {

  var errorCode = error.code;
  var errorMessage = error.message;

  var email = error.email;
  var credential = error.credential;
});

But, it allows any user to login, is there any way to allow login for specific user? Sorry, this is my first working with firebase, and thank you and advance.




How to find hidden / not rendered html in a web page?

For example : In the following web page : https://geizhals.de/?cat=umtsover. doing inspect elements i find that some portion of code is not rendered by the browser, but present in html. Is there any way to detect this ?

html source of some part

I know there can be few heuristics that could be derived for some specific web pages. But is there any generic way to do this ? Assuming I have CSS ( where i could use visibility attributes ) and also if i dont have css info ?

Any help would be appreciated.




Carga de archivos de productos virtuales de PrestaShop usando el servicio web

Estoy agregando producto virtual en PrestaShop usando API y estoy usando PrestaShopWebservice 1.7

Agregué con éxito el producto y sus imágenes, pero cuando intento agregar un archivo para descargar este producto, no encontré ningún método en la biblioteca y API anteriores.

Por lo tanto, necesito algún método para agregar archivos descargables para productos virtuales en PrestaShop usando API.




How can I integrate a simple python chatbot into one single html page?

I’ve currently made a hard coded python bot, which also uses some modules that read json files.

All I really need to do is put this python based bot into a website, where the user can input and so on.

I haven’t got a lot of knowledge with HTML, so I just want a simple explanation, or a point in the right direction.




¿Por qué no aparecen mis proyectos de aplicación web en Apache Netbeans 12?

Acabo de descargar Apache Netbeans 12, al querer crear un nuevo proyecto de aplicación web, no me deja visualizarlo en la pestaña de "Proyectos" lo único que hace es abrir el index.html del proyecto. Estoy utilizando "Java with Ant", si creo un proyecto "Java Application" sí se puede visualizar sin problemas, pero al hacer un "Web Application" no me deja.enter image description here

Ayuda.




trying to delete post on a webpage using REQUEST.delete method in spring mvc but code not working ,go through following snapshots and resolve my query

this the corresponding html code.....

<form th:action="@{/delete/(postId=${message.title})}" th:method="delete">
    <input type="submit" value="Delete" />

this is corresponding controller code........

@RequestMapping(value="/delete",method=RequestMethod.DELETE)
public String deletepost(@RequestParam(value="postId") String title){
    ps.deletepost(title);
    return "redirect:/";
}

this is deletepost method in service class

`public void deletepost(String title){ EntityManager em = emf.createEntityManager(); EntityTransaction transaction = em.getTransaction();

    try {
        transaction.begin();
        Post p=em.find(Post.class,title);
        System.out.println(p.getTitle());
        em.remove(p);
        transaction.commit();
    }catch(Exception e) {
        transaction.rollback();
    }
}`



Why does setTimeout put callback into message queue when the timeout is set to 0?

I know the fact that on invoking setTimeout, the callback will be immediately put into the message queue waiting to be executed. I wonder why they designed it like this in the first place?

Is it not possible to put the callback function into the call stack directly when the browser figures the timeout is set to 0? Or is it because there are some certain important scenarios where you want your callback to wait in the message queue but you don't want any timeout in the meantime?

If this is the case, could someone point out what these certain situations are? I'm a noob in web dev so I'm confused about this design... Thank you!

Edit: Also, what baffles me even more, is that, say there is one callback function, which is going to take like 10 seconds to complete, and it gets put into the message queue and wait there, now the js engine starts to take care of other stuff, when everything in this program is done, the callback is executed now, but my problem is it still will take 10 seconds to complete, so why not just put this function to the end of the program?




How I use NFC tags as a ticket on a Website [closed]

I wanted to use an NFC tag as a ticket and I wanted to store the tag ID in a SQL database so that when scanning the tag, it will check if it is already saved and if it returns a message, otherwise it will return another message.

My question is that I don't know if I can do this through a website ... For example I wanted to read the tag on the computer with an NFC reader and then the site would look for her ID ...

Do you happen to know if this is possible and if not, do you know of any alternative that I should use?




How to add hash keys to Wordpress tags

I'm building a website about music chords. Sharp chords look like this example: F#m7b5. That chord (F#m7b5) can be called in many other way like:

F# half-diminished, F# minor seventh flat fifth, F# minor seventh flat five, F#m7b5, F#∅, F#m7(b5), F#º7, F#1/2dim, F#1/2dim7, F#m7(-5), Fa# ∅, Fa# m7b5, Fa# m7(b5)

I would like that my users will find my F#m7b5 post searching for any of the alternative nomenclature so I've added those as tags but Wordpress doesn't accept the hash keys into tags and after a post update all hash keys disappear.

There's a proper way to add hash keys into tags?




touch: cannot touch 'Dockerfile': Permission denied

I am using the latest version of docker toolbox on windows 10 home and I am getting this problem everytime I run this command I get this error

$ touch Dockerfile touch: cannot touch 'Dockerfile': Permission denied




Diagnosing why all calls to *.dev resolve to localhost on a particular machine

MacBook Pro (Catalina, 10.15.6) ...

When I browse to any website with the TLD of .dev (e.g. https://lando.dev) on this machine (and only this machine) I get ERR_CONNECTION_REFUSED. Pinging that URL shows me that *.dev URLs are trying to hit 127.0.0.1 but I cannot figure out why:

ping lando.dev                                                                                                                                                                                                                            2729ms  Thu Jul 30 10:27:25 2020
PING lando.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.040 ms

ping foobar.dev                                                                                                                                                                                                                            2729ms  Thu Jul 30 10:27:25 2020
PING foobar.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.052 ms

Things that might be relevant:

  • /etc/hosts does not appear to be the culprit; the string ".dev" does not even appear
  • I do have docker for mac installed, but I have this issue wether or not docker is running
  • Its certainly possible that i set SOMETHING up SOMEWHERE in the past (before .dev was a TLD) but I haven't the slightest idea where
  • I have a nearly identical machine with the same corporate proxy nonsense setup without this issue (on the same network). Additionally, this machine has the same issue on all networks.

Anyone have an idea how to diagnose where my issue is?




Use Entity Framework Core 3.0 in .Net 4.7.2 Web Forms application

I was hoping to be able to create a EF core 3.0 DAL project and use this for my database operation in a .Net 4.7.2 Web forms application. But it looks like the latest EF core 3.0 targets .Net Standard 2.1 and .Net 4.7.2 is not compatible with that? Is there any way to make use of EF Core 3.0 and DI with a Web forms app or do I just need to use EF6?




How do I create a router configuration app? [duplicate]

I have basic knowledge of creating django based apps. Using this knowledge, I am planning to create a web-based router configuration app.

This is what the app should do -

  1. At the click of button which basically triggers a command, the app should be able to login to the router via SSH
  2. Commit the command eg. "set interfaces ge-0/1 address 10.10.35.1/30"
  3. If the command succeeds, return a success message to the user. If not, return the error message to the user

Can SOAP with SSH help me in achieving this ? Is there an existing python library that already does the above ?

All I need is a little nudge in the right direction.

Thanks in advance.




Navbar disappears under content only in mobile browsers

So I've been developing my site for a while now. I've just deployed it on production and noticed that my navbar is disappearing under the page content while scrolling down.

The funny thing is that it does not disappear in mobile view of firefox/chrome. It only happens in mobile browsers (iPhone, chrome/safari/firefox). It works perfectly fine in mobile view inside of firefox/chrome/safari.

I'm even willing to donate to somebody for fixing this. Send me a message or contact me at dondor@protonmail.com

Live site: https://upcodia.cz

The navbar CSS:

.header-area .main-header-area.sticky {
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
position: fixed;
width: 100%;
top: -70px;
left: 0;
right: 0;
z-index: 9999 !important;
transform: translateY(70px);
transition: transform 500ms ease, background 500ms ease;
-webkit-transition: transform 500ms ease, background 500ms ease;
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.1);
background: rgba(255, 255, 255, 0.96);
background: #2C2C2C;
padding-bottom: 0;

}

The content it disappears under does not have a fixed position, nor does it have a z-index set. I really have no idea. I can't even reproduce the bug locally on my machine, as it only appears in mobile browsers.

The mobile view in chrome:

https://i.imgur.com/WeEm0kO.png

The view in chrome on iPhone 8:

https://i.imgur.com/7qhZkdU.jpg

Can somebody help me or point me in the right direction please ? Thank you!




Sending data from WinForms to Website database

I'm creating win forms application which has a database with some data. In application I'm generating new information which also goes to database.
I have an idea to put that data into website.

My question: Is it possible to send new generated data to the website database by click one button from winforms application ? Can't find any info about it. Any suggestions ?

Regards.




How to display search results in same page wordpress/php

I need to display search result in the same page. This is a page template where display some custom post type (Blog). I have added a search feild to this page and I need to display it search result in same page when some one search. Can anyone please help me with this.

<form id="searchform" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    <input type="text" class="search-field" name="s" placeholder="Search" value="<?php echo get_search_query(); ?>">
    <input type="submit" value="Search">
</form>

<?php 
    $args = array(
        'post_type' => 'blog_post',
        'orderby' => 'date',
        'order' => 'DESC',
        'posts_per_page' => 6
    );
    $service_slides = new WP_Query( $args );
    if( $service_slides->have_posts()) { ?>
    <div class="col-lg-12">
        <div class="row">
            <?php while ( $service_slides->have_posts() ) : $service_slides->the_post(); ?>
            <div class="blog-post-col col-lg-4 col-md-6 col-sm-6 col-xs-12">
                <div class="blog-img-wrapper">
                    <?php MultiPostThumbnails::the_post_thumbnail( 'blog_post','recent-image' ); ?>
                    <a class="blog-post-title"><?php the_title(); ?></a>
                </div>
                <span class="b-post-date"><?php echo get_the_date('M j Y'); ?></span>
                <p><?php echo wp_trim_words( get_the_content(), 40, '</p><a class="link-btn" href="'.get_permalink() . '"> Rear More </a>'); ?>
            </div>
            <?php endwhile; ?>
        </div>
    </div>
<?php } ?>



jQuery or javascript to determine if a list contains more than four elements

I want to use jQuery to determine if a list contains more than four elements. If there are more than four i want to add a "show-more" button. A click on said button should present the additional elements to the user.

Can anyone give me an idea how to solve this?

enter image description here

HTML structure:

<ul class="icons">
    <li class="icon"><a href="link01"><img src="img01" /></a></li>
    <li class="icon"><a href="link02"><img src="img02" /></a></li>
    <li class="icon"><a href="link03"><img src="img03" /></a></li>
    <li class="icon"><a href="link04"><img src="img04" /></a></li>
    <li class="icon"><a href="link05"><img src="img05" /></a></li>
    <li class="icon"><a href="link06"><img src="img06" /></a></li>
    <li class="icon"><a href="link07"><img src="img07" /></a></li>
    <li class="icon"><a href="link08"><img src="img08" /></a></li>
</ul>

tried jq:

$(".icons li").each( function (index) {
  index += 1;
  if(index > 3 ) {
    $(this).addClass("hide");
    $(this).append($('div',{
      class: 'blue',
      html: 'test'
    }))
  }
 });



HTTP code for timeout when server continues processing in the background

I stumbled upon a case where a request to an endpoint might take more than 60 seconds (let's say that's the timeout value), in which case the server sends a response and continues processing the request in the background. There are also cases where the same request would be processed before it times out and a successful response would be sent from the server to the client.

What would be the best HTTP code to use in those first case? I read HTTP server timeout. When should it be sent, which suggests 503 or 504, and HTTP status code for 'Loading', which mentions that the request can be deemed successful and return 200. But I'm not convinced by any of those suggestions more than the others yet.




How to bind a checkbox in Echo framework?

I have a simple form which I want to bind on the post request.

Here is the form:

<form method="post" action="/post">
    <input type="text" name="name" placeholder="name"><br>
    <input type="checkbox" name="agree"><br>
    <button type="submit">submit</button>
</form>

I'm trying to bind it in such a stuct:

type PostForm struct {
    Name  string
    Agree bool
}

Here is the whole code:

package main

import (
    "github.com/labstack/echo/v4"
    "html/template"
    "io"
    "log"
    "net/http"
)

type Template struct {
    templates *template.Template
}

func (t *Template) Render(w io.Writer, name string, data interface{}, _ echo.Context) error {
    return t.templates.ExecuteTemplate(w, name, data)
}

type PostForm struct {
    Name  string
    Agree bool
}

func main() {
    e := echo.New()
    e.Debug = true
    e.Renderer = &Template{
        templates: template.Must(template.ParseGlob("./templates/*.gohtml")),
    }
    e.GET("/", func(c echo.Context) error {
        return c.Render(http.StatusOK, "index.gohtml", nil)
    })
    e.POST("/post", func(c echo.Context) error {
        var form PostForm
        err := c.Bind(&form)
        if err != nil {
            return c.String(http.StatusInternalServerError, err.Error())
        }
        return c.JSON(http.StatusOK, form)

    })

    log.Fatalln(e.Start(":3000"))
}

When I do post request with unchecked Agree field, it works fine:

{
  "Name": "sdfgsdfg",
  "Agree": false
}

But when I send the post with checked checkbox, there is an error:

code=400, message=strconv.ParseBool: parsing "on": invalid syntax, internal=strconv.ParseBool: parsing "on": invalid syntax

What I'm doing wrong?

Here is the repo on github with all code: https://github.com/max-block/q__echo_bind_checkbox




Recaptcha v3 is backend implementation necessery?

I am building a site using django and I have a form where I want to use reCAPTCHA v3.

Google's documentation states that there are two options. Either automatically bind the challenge to a button or to programmatically invoke the challenge.

My question is whether I need to implement any backend changes while using the first option (automatic binding), cause by reading the documentation I can't figure it out.

Thanks for your time!




Jquery / javascript show more button if have more than 4 items [closed]

Jquery show more button if have more than 4 items.

how to make it? enter image description here

HTML structure:

<ul class="icons">
    <li class="icon"><a href="link01"><img src="img01" /></a></li>
    <li class="icon"><a href="link02"><img src="img02" /></a></li>
    <li class="icon"><a href="link03"><img src="img03" /></a></li>
    <li class="icon"><a href="link04"><img src="img04" /></a></li>
    <li class="icon"><a href="link05"><img src="img05" /></a></li>
    <li class="icon"><a href="link06"><img src="img06" /></a></li>
    <li class="icon"><a href="link07"><img src="img07" /></a></li>
    <li class="icon"><a href="link08"><img src="img08" /></a></li>
</ul>



how can i enable on my website to show popup of email id logged in user browser?

I am trying to create a signin button on top bar where when someone reaches on our website it shows a popup where email id is listed on that.i have seen this in https://timesofindia.indiatimes.com/ and on medium also i have seen that. can anyone suggest how can we do that?




Sending request to api using react

Hello I am New to React,and I don't know to to send request to an api using react and how to feed the response data to my component

shop.jsx

import React from 'react';
import './shop.css';

class Shop extends React.Component{
    render(){
        return(
            <div class="blog-post">
                <div class="blog-post_img">
                    <img src="shop.jpg" alt=""></img>
                </div>
                <div class="blog-post_info">
                    <h1 class="blog-post_title">{this.props.name}</h1>
                    <p class="blog-post_text">
                        {this.props.address}
                    </p>
                    <p class="blog-post_text">
                        {this.props.mobile}
                    </p>
                    <a href="#" class="blog-post_cta">Visit Shop</a>
    
                </div>
            </div>
        );
    }
}
export default Shop;

shops.jsx

import React from 'react';
import './shops.css';
import Shop from './shop'

class Shops extends React.Component{
    constructor() {
        super()
      }
      componentWillMount() {
        this.getData()
      }
      getData() {
        // create a new XMLHttpRequest
        var xhr = new XMLHttpRequest()
    
        // get a callback when the server responds
        xhr.addEventListener('load', () => {
          // update the state of the component with the result here
          console.log(xhr.responseText)
        })
        // open the request with the verb and the url
        xhr.open('GET','http://localhost:5000/api/shops/allShops')
        // send the request
        xhr.send()
      }
    render(){
        const shopjsx = this.state.shops.map((item, i) =>(<Shop name={item.shopname} address={item.address} mobile={item.phoneNumber}/>));
        return(
            <div id="container">
                {shopjsx}
            </div>
        );
    }
}
export default Shops;

I know that my code for shops.jsx is wrong, what I want is that, I want to make request to my api, and want that when I get the data from api, I need to put that data in shop.jsx components

Request to the api should be sent like this: GET http://localhost:5000/api/shops/allShops Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1ZWViZGZiNTYwMjEwYTVmNTg4ZGJjZWQiLCJlbWFpbCI6ImRldmFubm5ubjtAdHlwLmluIiwiaWF0IjoxNTk2MDkzNDg1LCJleHAiOjE1OTYwOTcwODV9.7aTRvpyajCzbahrvq_nSIyppQpr2tWLAN_oKP2G0NeI

From response I need only: shopname,phoneNumber,address




Send HTTP Response in Python with socket Library on Heroku?

I'm trying to get a Heroku web app to send a proper HTTP response to a browser. I'm also trying to do this using only the socket library. Right now, I've been able to read HTTP requests, but every attempt to respond to them has ended in something like

sock=backend at=error code=H18 desc="Server Request Interrupted"
method=GET path="/favicon.ico" host=appame.herokuapp.com
request_id=a6640486-2c72-429d-a2a0-e79784bbc4d3 fwd="99.39.166.192"
dyno=web.1 connect=0ms service=0ms status=503 bytes=128 protocol=http

I've checked all over and believe the closest question to the one I have is this one, but the solution didn't work for me. Every request immediately returns with the above status code 503.

Here's the code I'm currently using to receive and then respond to incoming requests:

# imagine I've received the data already and am trying to respond.
resp_body = '<html><body>This is a test response.</body></html>'
resp_body_bytes = resp_body.encode('utf-8')
data_back = 'HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: {0}\nConnection: close\n\n{1}\n'.format(len(resp_body_bytes),resp_body)
cli_sock.sendall(data_back.encode('utf-8'))
print('Sent data back:\n{0}'.format(data_back))
cli_sock.close()

That final print statement always executes without problems, but I'm still unable to field HTTP requests properly. Am I missing something obvious? I'm new to Heroku, so that might be the case.




mercredi 29 juillet 2020

Java wrong value when reading from website

I'm trying to make a programm, wich gets a word from a website, wich always gives you a random (german) word and count how frequently a character is in the word. When I try my programm with a stream from a list it works fine. If I read from the website, the word is displayed fine with System.out, but counting the letters does not work as intended. Here is my code:

public class WordCount {

  public static String charStat(String urlString) throws IOException {

/*    List<String> list = new ArrayList<>();
    list.add("word");
    Stream<String> characterStream = list.stream();*/ //works totaly fine every time

    URL url = new URL(urlString);
    Stream<String> characterStream = new BufferedReader(new InputStreamReader(url.openStream())).lines();

    BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
    System.out.println(br.readLine());//BufferedReader only used to print the word so I can controll
                                      //if everything is working

    int[] charNumber = new int[26];//size is 26 cause the alphabet has 26 characters

    Runnable func = () -> {
      characterStream
          .map(String::toLowerCase)
          .flatMapToInt(CharSequence::chars)
          .filter(c -> c != ' ')
          .map(c -> c - (int) 'a')//subtracting 'a'(95 in ascii) so a is in position 0 of the array
          .forEach(i -> {charNumber[i]++;});
    };

    func.run();
    characterStream.close();
    return "a: " + charNumber[0];//returning how many times the letter a is present, could be any letter
  }

  public static void main(String[] args) throws IOException {//Ik that main shouldn't throw an exception
    System.out.println(charStat("https://randomeword.azurewebsites.net/api/word"));//the website im
                                                                                   //getting the word from
  }
}

Example from a fail:

word:

Klavierkonzert

the array:

[1, 0, 0, 0, 3, 0, 2, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1]

the should be:

[1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 1]

I don't know why this is happening as the word gets shown correctly with System.out.println();. So if I've done anything wrong let me know.




Is it safe to store asset files under sub root folder?

My app will store an uploaded image file under https:\\domain.com\asset\userid\ directory according to this code:

$folder = $object->upload_dir.$user_id.DS;
if (!file_exists($folder)) {
    mkdir($folder, 0770, true);
}
move_uploaded_file($_FILES['image']['tmp_name'], $folder.$filename);
chmod($folder.$filename, 0660);

Is it safe to do that considering hacker can write a script, let's under https:\\domain.com\asset\ directory and delete all the image files altogether?




How to solve "Apply undefined" problem in React-Redux

I was working on this react web app with redux. (following a tutorial). I did everything right. But when I saved the changes this was displayed in the browser. It was something wrong with the redux Module files which I didn't even touch. Do you know how to get past this? ThanksError:




Javascript countdown table not displaying

I am making a website for a school project. My idea is to have a table with multiple countdowns counting down (yes) to different cricket tournaments. I got the multiple countdowns in table code from another thread but it won't display for me when I load my site.

Here is my HTML:

<!DOCTYPE html>
<Html>
    <head>
        <title>CCC</title>
        
        <link rel="stylesheet" href="cccstyle.css">
        <link href="https://fonts.googleapis.com/css2?family=Mr+De+Haviland&display=swap" rel="stylesheet">
    </head>
    <body>
        <!--top of the page title--> 
        <div id="title">
            <h1>The CTC</h1>
            <h3>Cricket Tournament Countdown</h3>
        </div id="title">
        <noscript id="countdown">Sorry, you need JavaScript enabled to view the count
            downs</noscript>

             
        
        <script src="table.js"></script>
    
      
    
    </body>
</html>

Javascript:

// data is an array of objects, each representing one of your categories.
// Each category has a .title to store its title and a .counters that
// stores an object for each counter in that category.
var data = [
    {
  title: 'LEAGUES',
  counters: [
    // Each counter has a .title and a .date that is parsed by new Date()
    {
      title: 'IPL',
      date: 'September 19, 2020'
    },
    {
      title: 'BBL',
      date: 'December 3, 2020'
    }
    {
      title: 'CPL',
      date: 'December 3, 2020'
    }
  ]
    },
    {
  title: 'ICC TOURNAMENTS',
    counters: [
      {
        title: "Women's Cricket World Cup",
        date: 'February 6, 2021'
      }
    ]
    },
    {

  ];
  // this reduce generates the table
  let table = data.reduce((acc, category, categoryIndex) => {
  return acc + `<tr><td colspan="6" class="category">${category.title}</td></tr>` +
  category.counters.reduce((acc, counter, index) => {
    return acc + `<tr id="counter-${categoryIndex}-${index}">
    <td>${counter.title}</td>
    <td>${counter.date}</td>
    <td class="days"></td>
    <td class="hours"></td>
    <td class="minutes"></td>
    <td class="seconds"></td>
    </tr>`;
    }, '');
  }, '<table class="countdown"><tr><th>Event</th><th>Date</th><th>Days</th><th>Hours</th><th>Minutes</th><th>Seconds</th></tr>');
  table += '</table>';
  
  // insert the table after the noscript tag
  document.getElementById('countdown').insertAdjacentHTML('afterend', table);
  
  // generate a flat list of counters
  let counters = data.reduce((acc, category, categoryIndex) => {
  return acc.concat(category.counters.reduce((counterAcc, counter, index) => {
      return counterAcc.concat([{
        // counters will be an array of the objects we generate here.
        // node contains a reference to the tr element for this counter
        node: document.getElementById(`counter-${categoryIndex}-${index}`),
        // date is the date for this counter parsed by Date and then converted
        // into a timestamp
        date: (new Date(counter.date)).getTime()
        }]);
      }, []));
  }, []);
  
  const msSecond = 1000,
    msMinute = msSecond * 60,
    msHour = msMinute * 60,
    msDay = msHour * 24;
  let intervalId;
  
  function updateCounters () {
    counters.forEach((counter, counterIndex) => {
    let remaining = counter.date - Date.now(),
      node = counter.node;
    let setText = (selector, text) => node.querySelector(selector).textContent = text;
  
    if (remaining > 0) {
      setText('.days', Math.floor(remaining / msDay));
      remaining %= msDay;
      setText('.hours', Math.floor(remaining / msHour));
      remaining %= msHour;
      setText('.minutes', Math.floor(remaining / msMinute));
      remaining %= msMinute;
      setText('.seconds', Math.floor(remaining / msSecond));
    } else {
      // make sure we don't accidentally display negative numbers if a timer
      // firing late returns a past timestamp (or the data contains a past date)
      setText('.days', 0);
      setText('.hours', 0);
      setText('.minutes', 0);
      setText('.seconds', 0);
  
      // This countdown has reached 0 seconds, stop updating it.
      counters.splice(counterIndex, 1);
      // no more counters? Stop the timer
      if (counters.length === 0) {
        clearInterval(intervalId);
      }
    }
    });
  }
  // display counters right away without waiting a second
  updateCounters();
  intervalId = setInterval(updateCounters, 1000);

CSS:

body
{
    background-color: #00002e;
}

        div.title
{
    text-align: center;
}

script {
    display: inline;
}

table {
    border-collapse: collapse;
    }
    tr:nth-child(even) {
    background-color: #edf;
    }
    .category {
    font-weight: bold;
    }
    td, th {
    padding: .5em;
    }
    .days, .hours, .minutes, .seconds {
    text-align: right;
    }

Help is very much appreciated.




Dynamic List with jquery json data

How to append below condition to id = #sellerMetal <ul> container,
it is a dynamic loop list
if dataJS
productList > medals > goldmedal = true,
append <li class="icon"><img src="/img/goldmetal.png"></li>

if dataJS
productList.medals.silvermedal = true,
append <li class="icon"><img src="/img/silvermedal.png"></li>

if dataJS
productList > medals > newshop= true,
append <li class="icon"><img src="/img/newshop.png"></li>
...
...
...
...
...

enter image description here



Hope someone can help me, this is a list of product Thank you very much


Below is the Render List of Product List Append

expected result:

<div id="List">
<div class="feature_ico">
    <ul id="#sellerMetal" class="icons">
        (Apend to here)
    </ul>
</div>
<div class="feature_ico">
    <ul id="#sellerMetal" class="icons">
        (Apend to here)
    </ul>
</div>
<div class="feature_ico">
    <ul id="#sellerMetal" class="icons">
        (Apend to here)
    </ul>
</div>
<div class="feature_ico">
    <ul id="#sellerMetal" class="icons">
        (Apend to here)
    </ul>
</div>

Below is example snippet......
below is the code that i have tried:
comment //Condition is here i have tried is the condition i put it, it doesn't work like expected.

//Below is the Data JS
var data = { productList: [
    {
        id: "e0c18c12-0b51-41ad-9f2c-aefc20cafcdb",
        link: "1",
        imgurl: "img001",
        text: 'Product 001',
        seo: '',
        medals: [{
            goldmedal: true,
            sellermedal: false,
            newshop: true
            }]
    },
    {
        id: "f3bee385-76d7-4a87-8bba-a51d33238858",
        link: "2",
        imgurl: "img002",
        text: 'Product 002',
        seo: '',
        medals: [{
            goldmedal: true,
            sellermedal: true,
            newshop: true
            }]
    },
    {
        id: "fc3dd6a9-5d8c-4262-aa65-a680e0f0cafe",
        link: "3",
        imgurl: "img003",
        text: 'Product 003',
        seo: '',
        medals: [{
            goldmedal: false,
            sellermedal: false,
            newshop: true
            }]
    },
    {
        id: "8615711e-8544-4484-933f-b14a93941b86",
        link: "4",
        imgurl: "img004",
        text: 'Product 004',
        seo: '',
        medals: [{
            goldmedal: false,
            sellermedal: false,
            newshop: true
            }]
    }]
};

$(function () {
    const getProductList = function (productItem) {
        const productListRender = $('<div>', { class: 'feature_ico'}).append($('<ul>', {
            id: plSettings.sellerMetal,
            class: 'icons'
        }));

        //Condition is here i have tried
        if (productItem.medals) {
            $.each(productItem.medals, function (index, data) {
                if (this.goldmedal === true) {
                    const medalRender = $(plSettings.sellerMetal);
                    const metalItem = $('<li>', {
                        class: 'icon gold'
                    }).append($('img'), {
                        src: ''
                    });
                    medalRender.append(metalItem);
                } else if (this.silvermedal === true) {
                    const medalRender = $(plSettings.sellerMetal);
                    const metalItem = $('<li>', {
                        class: 'icon gold'
                    }).append($('img'), {
                        src: ''
                    });
                    medalRender.append(metalItem);
                    }
                });
            }
            return productListRender;
        };

    const $product = $('#List')
    $.each(data.productList, function (index, data) {
        $product.append(getProductList(data));
    });
});

//Below is the Setting JS
var plSettings = $.extend({
    sellerMetal: '#' + 'sellerMetal',
    goldMetalSrc: '/img/tps/gold.png'
});
.feature_ico {
    border: 1px solid #e0e0e0
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="List"></div>



How to correctly utilize webpack for both node.js and browser applications

So I have been developing a web application that does some data processing. However with the limited supports for loading file from local, testing my code was brutal on browser.

Therefore, I wanted to set my project up in a way that I can write single js file for core functions and compile it for both browser and node.js so that I can test things using node.js and power up my web applications using the same code.

I found that webpack would be a good solution but how to correctly setup what I want was unclear. All the tutorial had pieces of what I wanted that when I put things together it falls apart.

In the ideal scenario, I would like to have the following set of files to run without error with correct output

  • ./src/common/utils.js
var square = function(x) {
    return x * x;
}

module.exports = square;
  • ./src/index.js
import {square} from "./common/utils";
  • ./src/index.html
<tags ... >
  <script type="text/javascript">
    console.log(square(3))
  </script>
<tags ... >
  • ./app.js
const square = require('./src/common/utils.js');
console.log(square(3))

I have separate webpack config

  • webpack-front.config.js : compile things to ./browser_dist/* with HtmlWebPackPlugin of template ./src/index.html
  • webpack-back.config.js : compile things to ./node_dist/* with entry of app.js

I have noticed that node.js version works as expected when I run following commands

webpack --config webpack-back.config.js
node node_dist/app.js

However, ween I run webpack --config webpack-front.config.js and open index.html on browser, I was seeing Uncaught ReferenceError: square is not defined

I know that webpack compiles everything into single main.js file and load it automatically for index.html. However, eventually I have multiple html pages and would like to have each one load different js (controller files) that exposes a set of functions upon include () as in the case of typical web application.

Can anyone guide me on how to set this up right? If I need to provide more information, I will do so.




Share my website on different devices within my network range

I have my own website, it contains html, css and javascript files, and I would like to display the site on different devices other than those methods that use localhost and IP, I mean display my website on my own network as if the real site starts from www to the domain name , Can you do that, please answer and thanks




What is the feature used in this website? [closed]

https://www.nurturedigital.com/

This website has a front-page sliding different images and texts. What is the feature called and how do I develop such websites.




how to make public_html can't access via php shell? [closed]

how can I make the public_html directory inaccessible via php shell ?

so when an attacker accesses the public_html directory via php shell it can't, access denied, forbidden or something like that ?




Boostrap 5 [The alpha version]

Ok, has anyone checked up the new boostrap5 alpha version, what are the new features available, how is it different from boostrap4, and what advice can you render to someone willing to adapt with the new boostrap version.




Disable document downloading user can only print a document search for solution/idea

I need idea/solution for business such that my operation team can only view and print document which is stored on web server. User cannot download any document.




What happens to the Web page after form submission

I have created a simple Web Page having a form for the user's name and age details lets say this is my page 1. I had page 1 linked with an asp file that displayed the user's name and age, consider this as page 2. Now What happens to page 1 after the submit button is clicked and Why are we directed to page 2?




Changing object property through $set gives:" TypeError: Cannot read property 'call' of undefined "

First of all, hello.

I'm relatively new to web development and Vue.js or Javascript. I'm trying to implement a system that enables users to upload and vote for pictures and videos. In general the whole system worked. But because i got all of my information from the server, the objects used to show the files + their stats wasn't reactive. I tried to change the way i change the properties of an object from "file['votes'] ) await data.data().votes" to "file.$set('votes', await data.data().votes)". However now i'm getting the TypeError: Cannot read property 'call' of undefined Error. I have no idea why this happens or what this error even means. After searching a lot on the internet i couldn't find anybody with the same problem. Something must be inheritly wrong with my approach.

If anybody can give me an explanation for what is happening or can give me a better way to handle my problem, I'd be very grateful.

Thanks in advance for anybody willing to try. Here is the Code section i changed:

async viewVideo() {
  this.videoURLS = []
  this.videoFiles = []
  this.videoTitels = []
  var storageRef = firebase.storage().ref();
  var videourl = []
  console.log("try")
  var listRef = storageRef.child('User-Videos/');
  var firstPage = await listRef.list({
    maxResults: 100
  });
  videourl = firstPage
  console.log(videourl)
  if (firstPage.nextPageToken) {
    var secondPage = await listRef.list({
      maxResults: 100,
      pageToken: firstPage.nextPageToken,
    });
    videourl = firstPage + secondPage

  }
  console.log(this.videoURLS)
  if (this.videoURLS.length == 0) {
    await videourl.items.map(async refImage => {

      var ii = refImage.getDownloadURL()
      this.videoURLS.push(ii)
    })

    try {
      await this.videoURLS.forEach(async file => {

        var fale2 = undefined
        await file.then(url => {
          fale2 = url.substring(url.indexOf("%") + 3)
          fale2 = fale2.substring(0, fale2.indexOf("?"))
        })
        await db.collection("Files").doc(fale2).get().then(async data => {
          file.$set('titel', await data.data().titel)
          file.$set('date', await data.data().date)
          if (file.$set('voted', await data.data().voted)) {
            file.$set('voted', [])
          }
          file.$set('votes', await data.data().votes)
          if (file.$set('votes', await data.data().votes)) {
            file.$set('votes', 0)
          }
          await this.videoFiles.push(file)
          this.uploadDate = data.data().date
          console.log(this.videoFiles)
          this.videoFiles.sort(function(a, b) {
            return a.date - b.date;
          })
        })
      })
    } catch (error) {
      console.log(error)
    }
  }
},
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>



General web scraper for multiple use cases

For a project, I'm currently trying to scrape Staff data (name, position, email, and such) from US public school websites simply by accessing the school district (SD) website. That is, I land on an SD webpage, find subsidiary schools, and then scrape staff details from the school page.

Unfortunately, most school pages have varied navigation to their staff page, but it would be nice to have 1-2 versions of web scrapers that could work for the majority of schools. Here are some school districts that have been challenging to scrape.

  1. Beaverton School District - https://www.beaverton.k12.or.us/
  2. Camas School District - http://www.camas.wednet.edu/
  3. Shoreline School District - https://www.shorelineschools.org/
  4. Everett School District - https://www.everettsd.org/
  5. Hesperia School District - https://www.hesperiausd.org/

Any/all guidance on how to approach this problem will be much appreciated! Thank you immensely




How to show nearby BLE devices via web withour prompting the user for coupling?

I'm currently trying to implement a way of discovering nearby ble-devices and reading their signal strength via web. I already found bluetooth-request-device-functionality. Unfortunately, this prompts the user to connect to a nearby bluetooth device.

I want to present nearby ble devices in a custom style css, without actually pairing to a device. Is there any way of just reading the advertisments without needing to pair to a device?

I hope, you can help me.




createImageBitmap can not turn off premultiply alpha when imageOrientation is flipY

I use createImageBitmap to load png images in the latest version of chrome browser. imageOrientation is flipY, premultiplyAlpha no effect. (always premultiply) imageOrientation is none, it works.

createImageBitmap(image, { imageOrientation: flipY ? 'flipY' : 'none', premultiplyAlpha: 'none', });

I don't know what went wrong about this code on chrome.




Trailing Slash on URLs rather than file name

I am trying to make a site, such as example.com/about , where the page is after the slash without the .php or .html, like example.com/about.php

I have looked online for what this is called but I couldn't find any information as I am not entirely sure what to search.

Can I do this by having folders rather than individual files, and within those files do I need an index.html?

Thank you




Create markdown files locally on netlify

I need to create md files locally on netlify. I using md files to store posts on my blog. Before I used Node Js server to create new md files, but now I want to deploy my page on Netlify, without external API.




mardi 28 juillet 2020

How to create a "complex" header in HTML?

I wanted to create an header in HTML but I made some mistakes and can't figure out how i do it the right way.

This is how I have tried to do it:

    .xyz-logo {
    float:left;
    width:472px;
    
    }

    .headerlayout h1{
    position:center;
    font-family: Arial, Helvetica, sans-serif ;
    font-size: x-large;
    width:1920px;
    height:200px;
    background:lightgrey;
    }
      <div class="headerlayout"> 
         <img class="xyz-logo" src="C:\Users\..."  alt="Logo">   
         <h1 >This is the title</h1>               
      </div>

This is a picture of how it should look:

enter image description here




Does one need to define meta tags for each URL in google analytics?

For google analytics to pick up a user page flow (for example, this user went from the landing page to /about to /inquire), does each page need to have its own meta tag defining its link?

I am implementing a website in Django with 3 urls, just /, /about, and /inquire but GA is showing that only the / is accessed even after a button click or link click. I felt that the reason could be because that each of the page templates extends a base.html which has the meta tags defined there...and those meta tags are stuff like

<meta name="google-site-verification" content="*****">
<title>mysite | サービス</title>
<meta name="description" content="cool stuff">
<meta name="keywords" content="key1, key2, key3">
<meta name="robots" content="index,follow">
<meta itemprop="name" content="mysite">
<meta itemprop="description" content="itemprop desc">
<meta itemprop="image" content="whatevs.jpg">

<!-- Opengraph tags-->
<meta property='og:type' content='website' />
        ...

Which means that since each url extends base.html, does that mean GA cannot pick up the page changes?




How to make a drawer type thing in a webpage

Hello everyone my name is BrownCoat, I am a newbie in this platform and I am asking my first question...

Here is the image I can't describe it so take a look at the image...

So in the image you can see that this site has a drawer-ish thing and contains a lot of links to other pages of the same site so can you all tell me how am I supposed to do this in code?? And how can I modify its properties like the placement in top, bottom, left or right??




When two visitors click a web form submit button at the same time which data go to the server at first?

In different websites, there are a lot of forms. Each form contains a submit button. By placing information in the fields we click the submit button. If more than one persons click a submit button at the same time from different computers, then which person's data go to the server at first? And on the internet/network which mechanism is following to store the data?? In my website, I am using core java language and MySQL database.




ASP.NET CORE WEB - How To extract the Id from a Razor View ("Id is in IEnumerable")

Probably my approach to this is bad, but at least I wanna find out, if there is a Solution to my problem. I want to extract the Id from the Razor View, so I can use it in the Controller/Action.

@model HomeViewModels
@inject SignInManager<ApplicationUser> signInManager;
<body>
    <div class="container">
        <div class="comedy">
            <h3>Comedy</h3>
            @foreach(var books in Model.BooksDisplayedInStore)
            {
                @if (books.BookGenre == "Comedy")
                {
                        <div>
                            <p>@books.BooksInStore</p>

                            @if (signInManager.IsSignedIn(User))
                            {
                                <form method="post" asp-controller="Home" asp-action="DisplayBooks">

                                    **<input asp-for="@books.Id" type="hidden" />
                                    <input asp-for="@books.BooksInStore" type="hidden" />**

                                    <label asp-for="BooksOrdered">Nr Books:</label>
                                    <input asp-for="BooksOrdered" />
                                    <span asp-validation-for="BooksOrdered"></span>
                                    <input type="submit" value="Buy" />
                                    <br />
                                    <div asp-validation-summary="All"></div>
                                </form>
                            }   
                        </div>
                }
            }
        </div>

So as you can see I'm using an IEnumerable in my ViewModel, to access the objects from the database. But I don't know how to access the Id from that specific object that I select on the Razor View. The Id that I need to use in the Controller/Action. I did try something like this: I created an Id inside my ViewModel and tried to use it like this:

@{
Model.BookId = books.Id
}

which of course failed. Probably should change this approach. Anyone knows more ? Thank you.




Drag & Drop Website Builder Tool that gives you the code?

We are building a simple web application (school assignment). We have basic programming skills and are wanting to code the back end ourselves.

We are wanting to know if there is a drag and drop tool available for our front end i.e., a tool that allows us to click and drag the html elements to create the interface.

We need the drag and drop tool to provide us with the code (so we can copy the code into our IDE and commit our work through git.)

Does anyone know of any tool we could use to achieve this?

We ideally need a tool that is free / open source if possible?

Thanks in advance :)




A weird encode character returned from Page.ClientQueryString()

Here is the input query string that I enter on the Address Bar:

https://myapp.com/myproject/exagoviewer.aspx?act_code=R&rep_own=AAAAAAAAA&report_name=3.52%20SR%20-%20Request%20Time%20Analysis&report_code=3.52%20SR

Then, in my code, when I get its query string by calling Page.ClientQueryString(), it returns this string

act_code=R&rep_own=AAAAAAAAA&report_name=3.52+SR+-+Request+Time+Analysis&report_code=3.52%2520SR

You can see there is a weir encode string in the parameter report_code=3.52%2520SR, it should be report_code=3.52%20SR

Then I tried calling another method HttpContext.Current.Request.Url.Query to get the query string, but I got the same issue:

?act_code=R&rep_own=AAAAAAAAA&report_name=3.52+SR+-+Request+Time+Analysis&report_code=3.52%2520SR

I have no idea what the problem I am facing now. Any advice, please?




Nginx : redirect httpS://....com:8080/ simply to httpS://....com

I am trying to redirect http traffic to https (classic case, I know).

But, my issue is that before we moved on to serving over https, we had the site serving on http://poubelle.net:8080/. The problem is that even though we are now asking all users to use https://poubelle.net/, every now and then a user will type httpS://poubelle.net:8080 and that fails.

I have tried many combinations and solutions, including erro_page 497 type solutions, but I need help to solve this.

Below is my current simplified config... what do I need to add to make it so that:

  1. http://poubelle.net/
  2. http://poubelle.net:8080/
  3. httpS://poubelle.net:8080/
  4. and of course https://poubelle.net/

all redirect to https://poubelle.net/ ? (config below works for cases 1, 2 and 4 but not 3)


server {
    listen 8080;
    server_name ${SERVER_NAME};
    return 301 https://$host$request_uri;
}

server {
    listen 80 default_server;
    server_name ${SERVER_NAME};
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name ${SERVER_NAME};
    ssl_certificate .../fullchain.pem;
    ssl_certificate_key .../privkey.pem;
    ssl_trusted_certificate .../cert.pem;
    ...


    location / {
        proxy_pass http://127.0.0.1:8081;
        ...
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /data/nginx/html/poubelle.net;
        ...
    }


}



Do Redirect Clients in RESTful App Paradigms Have to Be Web Apps?

I need to retrieve information from a web app that uses RESTful API and OAuth 2.0 for authorization. As part of the OAuth 2.0 process (in this instance) I need to supply a redirect URL for the server to respond to once access is authorized.

My question, does the application at the redirect URL need to be a web app? Do only web apps listen to web traffic?

My confusion / the reason I ask is that I know I can create a Windows Service app and using HTTPClient or similar class in this app I can make a web request to the web app that uses RESTful API.

This leads me to wonder if I NEED a web app to listen to the redirect URL or can I use the same Windows Service app and have IIS or whatever the webserver is, direct traffic from that redirect URL to my Windows Service app?

I am totally green when it comes to web technologies.




Angular: .then() block is being executed before my async function

I'm trying to populate my recipeList in my RecipesComponent constuctor but my then() block is being executed before my async GetRecipesService.getRecipes() has finished.

export class RecipesComponent{
    constructor(getRecipesService: GetRecipesService){
        getRecipesService.getRecipes().then(promise=>{
            this.recipeList = getRecipesService.recipes;
            console.log("RecipesComponent recipeList: "+this.recipeList);
        });
        
    }
    recipeList = [];

}

@NgModule()
export class GetRecipesService{
    recipes: any[];
    constructor(private http:HttpClient){
       this.http = http;
    }
    async getRecipes(){
        this.http.get<any[]>('http://localhost:4200/recipes').subscribe(response=>{
            this.recipes = response;
            console.log("getRecipes this.recipes: "+this.recipes);
           
        })
    }
}

In my web browser my console output is:

  1. RecipesComponent recipeList: undefined

  2. getRecipes this.recipes: [object Object],....[object Object]

How do I get my RecipesComponent to wait for getRecipes to finish?




Ember project to Github Pages

I just finished making an ember project (super simple nothing huge) You can check it out <here>

but I am trying to deploy it to make it into a website on github pages and there is hardly any documentation out there and was wondering if I could get some help. Thank you




Why does it shows error in the log in form in Django?

I'm trying to create a website with a log in and registration form in django, the registration works well, it saves the accounts in the database, but when I try to log in, it doesn't work at all, here's the code:

views.py

from django.shortcuts import render
from .forms import UserForm
from django.contrib.auth import authenticate, login, logout
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponse


# Create your views here.
def index(request):
    return render(request, 'app1/index.html')

@login_required
def user_logout(request):
    logout(request)
    return HttpResponseRedirect(reverse('index'))

def register(request):

    registered = False

    if request.method == "POST":
        user_form = UserForm(data=request.POST)
        if user_form.is_valid():
            user = user_form.save()
            user.set_password(user.password)
            user.save()

            registered = True
        else:
            print(user_form.errors)
    else:
        user_form = UserForm()

    return render(request, 'app1/register.html',{'user_form':user_form, 'registered':registered})

def user_login(request):
    if request.method == 'POST':
        username = request.POST.get('username')
        password = request.POST.get('password')

        user = authenticate(username=username, password = password)

        if user:
            if user.is_active:
                login(request, username)
                return HttpResponseRedirect(reverse('index'))
            else:
                return HttpResponse("Account Not Active")
        else:
            print("Someone tried to login and failed")
            print(f"Username: {username} and password {password}")
            return HttpResponse ("Invalid Login details supplied")
    else:
        return render(request, 'app1/login.html')

models.py

from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class UserProfileInfo(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)

forms.py

from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm

class UserForm(UserCreationForm):
    email = forms.EmailField(max_length=40, help_text='Required')
    

    class Meta:
        model = User
        fields = ('username', 'email', 'password1', 'password2')

I hope that someone could help me because I believe that the error is in the views.py, but I'm not sure where.




alert() is not working in js. Need help fast. Updated [closed]

no alert is coming.
I have updated the code
so you can debug it

Part of html:-

<form method="POST" name="main_form" onsubmit="return login()">
<input type="email" name="email">
<input type="password" name="pwd">
<input type="submit">
</form>

JS function:-

function login() {
    var email = document.main_form.email.value;
    var pwd = document.main_form.pwd.value;
    if (email == 'example@example.com' && pwd == 'example123') {
        sessionStorage.setItem("email", email);
        window.location.href = './index.html';
    } else {
        alert('Wrong');
    }
    return false;
}



Cookie not sent in API calls

We have a web application web.companyname.com which makes API calls to a bunch of microservices service1.companyname.com, service2.companyname.com etc.

The application is in our corporate network behind a proxy and the proxy authenticates the users and assigns the cookie

Set-Cookie: NSC_TMAS=547857834758478454545;Secure;Path=/;Domain=companyname.com

The problem : The application cannot send cookie in API calls to endpoints service1.companyname.com, service2.companyname.com etc. , alought it can read it - console.log(document.cookie) shows the required cookie.

When the same application is opened with chrome withour security , the cookie is sent without any problem.

What could be the reason?




window.location.href not working in form-html

window.location.href is not redirecting the user.
I have tried with return true also

Form Code:-

<form method="POST" name="main_form" onsubmit="login()">
<input type="email" name="email">
<input type="password" name="pwd">
<input type="submit">
</form>

Login():-

function login() {
    var email = document.main_form.email.value;
    var pwd = document.main_form.pwd.value;
    if (email == 'example@example.com' && pwd == 'example123') {
        sessionStorage.setItem("email", email);
        window.location.href = './index.html';
        return false;



Package needed for Heroku web application?

I need some guidance on what package to buy for Heroku, my current needs are:

1/2 web workers. 1 app worker.

I need to be able to host the site online using the web workers.




Odoo 13 Download link in website to ir.attachment calls multi-company issue

I need to generate download link to ir.attachment file. I have 2 models as storage.directory and storage.file, in storage.file i have field

attachment_ids = fields.Many2many(
        comodel_name='ir.attachment',
        relation='storage_ir_attachment_rel',
        string="Версии фалов",
        ondelete='cascade',
        required=True,
    )

this need to be able to save file versions. I want to render this structure on website

<t t-foreach="dir.files" t-as="file">
  <t t-foreach="file.attachment_ids" t-as="ir_file">
    <div>New row:
      <a t-attf-href="/web/content/#{ir_file.id}?download=true" target="_blank"> 
        <span t-esc="ir_file.name"/> 
      </a>
    </div>
  </t>
</t>

when test it on localhost it's perfect but when i push it in server get error

Error to render compiling AST
AccessError: ('The requested operation ("read" on "Project" (project.project)) was rejected because of the following rules:\n- Project: multi-company\n\nNote: this might be a multi-company issue.\n\n(Records: тест (id=15), User: user_name (id=22))', None)
Template: website_commissioning_works.inner_directory
Path: /t/div/t/div/div/div/t[1]/ul/t/li/t/div/span
Node: <span t-esc="ir_file.name"/>

Looks like i need access_token like this

<a t-attf-href="/web/content/#{attachment.id}?download=true&amp;access_token=#{attachment.access_token}" target="_blank">

but i don't understand where and how to define it




How can I create a search engine in a blog which glean informations from a database?

I code in the free-time as an hobby and I would really like to create a website with a specific content. Since I work in the museums and art-galleries, I have noticed that many people in my field have problems to understand some topics related to documentation-ontologies (classes, subclasses, properties related to the art-objects). I would like to open a blog with a search engine inside. The search engine should give results back (as texts and images of diagrams, which I would prepare), in order to make the concepts textually and graphically more clear: to make it simple, a kind of dictionary which gleans informations from a database where texts,jpgs and pdfs would be stored. I would know without many problem how to create the blog or a not too pretentious (to use an euphemism...) website with HTML, CSS and JS but I don´t really know how to connect the database to the search engine. Could you please give me some suggestion about it? I have read much about SQLite, PHP but the mass of informations is overwhelming, above all for a not-IT specialist like me. I can use T-SQL and MySQL but I have no idea which programming language would be better in this case and how to connect the tables to the website.

Thank you very much in advance




Does javascript developer have to make the layout/template of the site or do i start from a made site? Adding functionality, all the js magic? [closed]

What exactly does a dev job look like? Do i as a js developer add loops, functions, objects, control DOM or do i have to trouble myself with all those grids, floats, flexboxes? Do designers make the code for it? For me layouts seem troubling for now, especially since just making sites doesn't give you that much money. It's hard selling templates with wordpress around. Maintaining sites seems more profitable to me. I love javascript, i loved C++ just overall adding loops to a site seems easy to me, making objects which are extended variables, controlling DOM.




How to update npm in windows?

I am looking for a way to upgrade my npm, I follow the option 3 for windows in here npm docs. but when I install it it said npm.exe already in nodejs folder. I try to overwrite it with --force but it still not overwritten. How to do it correctly? also how to update node?




Is there any free website available which convert call recording to text?

enter image description hereIs there any free website available which convert call recording to text?i want the result which is showing in the image.




How can I save to string the latest record's value? -Firebase DB, JS

I have a database, like the screenshoot attached:

enter image description here

Under the Input there are many childs with 1,2,3,4... names. In my program I want to get the latest child, with the input1,2 and 3 values. Here is the code I have:

const databaseRef = firebase.database().ref();
const inputRef = databaseRef.child("Input");

inputRef.orderByChild("dataAdded").limitToLast(1).once('value', snap => {
    console.log(snap.val());
  });

And the output is:

{116: {…}}

  116:

    input1: 5

    input2: 1

    input3: 1

How can I put the input1,2 and 3 values into strings?




Recaptcha - is it safe/good practice using same site key in different apps

I have an API that has many different clients. In login process I mandate a captcha test on back end, so I require a captcha response from the client.

Is it OK to share the same site key for all my clients? Or should I provide a different site key and secret key tuple per client type, and maintain a dictionary of app id to secret on my back end in order to decipher the response per site?




API to automatically calculate the calories of a recipe

I am currently doing a cooking blog and wondering if anyone knows of an API to automatically calculate calories for a recipe? :)

Thank you for your answers




What I need to learn to make a Java GUI mixed with website? [closed]

So I am currently studying Java in Udemy from Tim Buchalka. Yesterday, I downloaded the Pomodoro desktop application from focusBooster. Now I wonder, If I am to make an app like this where I have the JavaFx GUI of Java that needs to be online to sign in. Then the information should be updated in your website account as if they're synchronized (app and website). What are the things that I need to learn if I will be using Java? I've heard of JSP but confused how can I combine JavaFX to JSP? Or is JavaSE alone enough to make this kind of application? Please please somebody help me!




How can I scrap all the news using the view more button. Can anyone write the code for me? I tried alot but no results [closed]

I want to scrap the news using the view more button I tried a lot but could not found any result. If anyone can write a python code for me I would be thankful




Which would be best web based PDF editor using dot net core and javascript

I am working with a requirement for one of module in project(.Net Core) which comprises of multiple pdf operations, like converting from pdf to html, then editing the html in a web view editor, finally converting it into a pdf.

I had worked out with some of pdf editors available which are as follows:

  1. Spire pdf

    Observation:

    I used existing code samples provided for spire pdf to convert from pdf to html and vice-versa. What i find missing in this editing the html editor in a web view, which allow me to add text, signature etc in the editor.
  2. Sejda Online PDf editor tool (Javascript)

    Observation:

    Developers link: Sejda.com/developers Online tool seems pretty cool but not able to integrate the editor in web view as trying to create token but website says a user can be only registered with official email ids.
    Pricing for this library is also a factor.

Please find screenshot below :

enter image description here

  1. PDF Tron(Javascript)

    Observation:

    I used javascript code provided to use web based pdf editor. I am able to perform required editing operationswith sample file provided like adding text, adding signature, highlighting text. But when i am trying to use a local based pdf on my machine its stuck with some cors issue. Pricing for this library is also a factor. Below mention code:
    const viewerElement = document.getElementById('viewer');
    WebViewer({
    path: 'https://pdftron.s3.amazonaws.com/webviewer/5.1.0/lib',
    initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',// replace with your own PDF file }, viewerElement).then((instance) => { // call apis here });



Thank you for going through the article, feel free for any more suggestions, i would be happy to try out some more ways to achieve my requirement.




Button change value of input, but input shows old value

I'm working on an e-commerce website, I want to have a button to add items to cart. When I add a button, value in nbrSeats (my list of values) change (in data), but the input field shows another value.

I put a part of the code here: https://codepen.io/martinrougeron2/pen/MWKdJBb

<!-- Use preprocessors via the lang attribute! e.g. <template lang="pug"> -->
<template>
  <div id="app">
    <button @click="create_list()">Create list</button>
    <div v-for="(i, index) in nbrSeats" :key="index">
      <input
             type="number"
             max="10"
             min="1"
             v-model="nbrSeats[index]"
             style="width: 60px"
             label="Nb. places"
             >
        
      </input>
    <button @click="nbrSeats[index]++">Add</button>
    </div>
<button @click="show()">Show me values</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      nbrSeats: [],
      message: 'Welcome to Vue!'
    };
  },
  methods: {
    doSomething() {
      alert('Hello!');
    },
    create_list() {
      for (var i = 0; i < 10; i++) {
        this.nbrSeats.push(1)
      }
    },
    show() {
      console.log(this.nbrSeats)
    },
  }
};
</script>



Save dom that has manipulated, and then load it after [closed]

I'm creating user interface that build a quotation for his customer. I want the my customer to be able to save the quotation .. and then be able to edit it whenever he wants and save changes, and can edit it again ..

It means all the DOM manipulation made to html should be saved anywhere (mysql?) and then when the customer want to edit it , he will load it from sql ?

Thank you in advance.




I can't practice data scraping using javascript

I was trying to practice data scraping for our project and I can successfully see the data if I enter node scrapers.js. However, when I load it into a livecount.html file, there's an error showing and I can't display the data collected from data scraping.

The error is: "was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)"

Here's the code from the html file

<html lang="en">
<head>
</head>
<body>
    Total cases: 
    <span id="totalCases"></span> <br>
    Recovered cases:
    <span id="recovered"></span> <br>
    <script src="scrapers.js" type="text/html">
    </script>
</body> </html>

and here's the code from scrapers.js

const puppeteer = require('puppeteer');

    async function scrapeProduct(url){
        const browser = await puppeteer.launch();
        const page = await browser.newPage();
        await page.goto(url);
    
        const [el] = await page.$x('//*[@id="yDmH0d"]/c-wiz/div/div[2]/div[2]/div[4]/div/div/div[2]/div/div[1]/table/tbody/tr[2]/td[1]');
        const txt = await el.getProperty('textContent');
        const rawTxt = await txt.jsonValue();
    
        console.log(rawTxt);
        
        const [el2] = await page.$x('//*[@id="yDmH0d"]/c-wiz/div/div[2]/div[2]/div[4]/div/div/div[1]/div[1]/div/div/div[2]/div[2]');
        const txt2 = await el2.getProperty('textContent');
        const recovered = await txt2.jsonValue(); 
        
        console.log(recovered);
        browser.close();
        document.write("total cases: " + rawTxt + "\n" + "recovered: " + recovered);
    }
    
    scrapeProduct('https://news.google.com/covid19/map?hl=en-PH&gl=PH&ceid=PH%3Aen&mid=%2Fm%2F05v8c');

I'm just new to these things so I don't really know how things works, just practicing stuff for our website project, and I wanted to display data to our website from another website. Any opinions will help! Thank you




Dynamic Menu with jquery json data

i have try but doesn't work, i'm trying to make Dynamic Menu from Jquery json data. I hope someone can help me, i have insert preview below....................... Thank you. I'm working on fully custom ui, so i plan not to use Jquery.UI, hope someone else have a solution to solve this issue for me and thank again.

var data = {
        menu: [{
            name: 'Women Cloth',
            link: '0',
            sub: null
        },{
            name: 'Men Cloth',
            link: '1',
            sub: [{
                name: 'Arsenal',
                link: '0-0',
                sub: null
            }, {
                name: 'Liverpool',
                link: '0-1',
                sub: null
            }, {
                name: 'Manchester United',
                link: '0-2',
                sub: null
            }]
        }]};

    var getMenuItem = function (itemData) {
        var item = $("<li>", {
            class: 'has-children',
            id: itemData.id
        }).append(
        $("<a>", {
            href: itemData.link,
            html: itemData.name,
            id: itemData.id + '-links',
        }));
        if (itemData.sub) {
            var subMenuItem = $("<li>", {
            class: 'has-icon'
            }).append(
            $("<a>", {
                href: itemData.link,
                class: 'submenu-title',
            }));
            var subList = $("<ul>", {
                class: 'secondary-dropdown',
            });
            $.each(itemData.sub, function () {
                subList.append(subMenuItem(this));
            });
            item.append(subList);
        }
        return item;
    };
    var $menu = $("#Menu");
    $.each(data.menu, function () {
        $menu.append(
            getMenuItem(this)
        );
    });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul id="Menu"></ul>

Below is the output i needed.

<li class="has-children" id="ID">
    <a id="ID-links" href="links">Women Clothing</a>
    <ul class="cd-secondary-dropdown is-hidden">
        <li class="go-back"><a>Back</a></li>
        <li class="has-icon"><a class="submenu">submenu 1</a></li>
        <li class="has-icon"><a class="submenu">submenu 2</a></li>
        <li class="has-icon"><a class="submenu">submenu 3</a></li>
        <li class="has-icon"><a class="submenu">submenu 4</a></li>
        <li class="has-icon"><a class="submenu">submenu 5</a></li>
    </ul>
</li>

<li class="has-children" id="ID">
    <a id="ID-links" href="links">Men Clothing</a>
    <ul class="cd-secondary-dropdown is-hidden">
        <li class="go-back"><a>Back</a></li>
        <li class="has-icon"><a class="submenu">submenu 1</a></li>
        <li class="has-icon"><a class="submenu">submenu 2</a></li>
        <li class="has-icon"><a class="submenu">submenu 3</a></li>
        <li class="has-icon"><a class="submenu">submenu 4</a></li>
        <li class="has-icon"><a class="submenu">submenu 5</a></li>
    </ul>
</li>



lundi 27 juillet 2020

Binding HTML links to cells in AG-Grid

I am developing a website containing a table in the format of the image below. I would like to make it so that when a user clicks any cell within the row of a given child, they are routed to a new page containing a more detailed profile of that child. I already have programmed a system of creating unique HTML links for each child page using their ID. How do I go about binding these links to each row within the AG Grid so that when a cell within the row for a given child is clicked a user will be led to that child's page?

table




How to upload file to the root of the site not via admin panel

So, yesterday I've got an e-mail from Google, which told me, that someone appears to registered as second owner of my website. How - I don't know. And in the list of owners there was only me! Strange.

When I've checked root folder of my website I've found, that there're 2 new files: google-site-verification.html file and instock.aspx, which presents an element of some T-shirts online-store.

Website, by the way, is on ASP.NET MVC 3 and works fine starting from 2012.

So, my question: how is it possible to upload a file to the root folder of the website? I know two ways:

  1. Via FTP.
  2. Via control panel.

So, is hacker just got access to my account (which is strange, why didn't he changed password and stole website at all?) or it's something else?

Any thoughts?

PS. I've managed to find that some turkish guy encountered the same problem with the same "new owner of the website". Here's branch of the forum with his complaints (google translator forever!):

https://www.r10.net/webmaster-genel-konular-sorunlar/2444605-web-sitem-hacklendi-bir-sorum-var-lutfen-yardim.html




How to identify which URLs point to duplicate content?

I have a list of around 20,000 URLs, but I know that some of them point to duplicate content. In my data, this happens most often because multiple URLs resolve to the same location without redirecting to a canonical URL. It also happens at different locations (i.e., staging servers).

I am looking for a "good enough" way of creating a list of URLs that point to unique content from my original list. My list is small enough that sending GET requests (following redirects) and fetching the page content is feasible. What would be a good approach for this?

This seems to be a common problem from those doing web crawlers. Are there any tools that already exist out there to do the heavy lifting?

I found this relevant question that points to a lot of general approaches for solving this, but I am hoping someone can point me to a more specific solution.

Python preferred, but not required.




font not displaying correctly

I imported Montserrat font from google font to my html code but when I try to display the webpage, this font doesn't seem working.

enter image description here

enter image description here

enter image description here




How to setup mixed authentication for Web API application (.net framework 4.7)?

I need to add additional authentication method to the existing Web API application that already has the Windows authentication. I have added a Startup file with the code:

using System.Configuration;
using Microsoft.IdentityModel.Tokens;
using Microsoft.Owin;
using Microsoft.Owin.Security.ActiveDirectory;
using Owin;

[assembly: OwinStartup(typeof(TodoList_Web.Startup))]
namespace TodoList_Web
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.UseWindowsAzureActiveDirectoryBearerAuthentication(
                new WindowsAzureActiveDirectoryBearerAuthenticationOptions
                {
                    Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
                    TokenValidationParameters = new TokenValidationParameters
                    {
                        ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
                    },
                });
        }
    }
}

Windows authentication is turned on IIS level and it seems that I should turn of it in IIS and add on the application level - add the configuration to the web.config file:

<system.webServer>
  <security>
    <authentication>     
       <windowsAuthentication enabled="true" />
    </authentication>
  </security>

Will it work at all? Can I somehow use an Authorize attribute to specify what authentication should be applied to particular method/controller? Something like this:

[Authorize(AuthenticationType=Windows)] 
or 
[Authorize(AuthenticationType=WindowsAzureActiveDirectoryBearer)]



Database systems installed on local computer can reflect Database systems in organizations? [closed]

For my research, I have designed a web application to connect different DBMS(Oracle, MySQL, SqlServer and PostgreSQL) on my desktop computer. Web application can acces tables of these dbms and query a sql command on them. Such as count number of rows with where statement. The question is about real life use. Will the application act in the same way in real life usage?




Bootstrap navbar hamburger menu not responding after click

When I view my website on mobile, though the hamburger menu appears, it doesn't respond after clicking. I am not sure what's wrong with my code.

<nav class="navbar navbar-expand-lg navbar-light bg-light">
        <a class="navbar-brand wc" href="">our association</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="list" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link wc navb-it" href="">About</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link wc dropbtn navb-it" href="#">stuff1</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link wc navb-it" href="#">stuff2</a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle wc navb-it" href="#" id="navbarDropdown">Event</a>
                    <div class="dropdown-menu mt-0" aria-labelledby="navbarDropdown">
                        <a class="dropdown-item" href="#">2020 Hackathon</a>
                        <a class="dropdown-item" href="#">Coding Challenges</a>
                </li>
            </ul>
            <ul class="navbar-nav ml-auto">
                
                <li class="nav-item">
                    <a class="nav-link wc navb-it" href="">Log in</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link wc navb-it" href="">Register</a>
                </li>
                
            </ul>
        </div>
    </nav>

At the beginning it didn't appear at all, that was because I didn't add a bootstrap color scheme to the navbar. Now, even though it shows, the menu bar in the mobile view doesn't work when clicking. Thank you.