mercredi 30 septembre 2020

Is that even feasable?: user click on a button on my website -> get data from another website -> display this data on my website

I tried to be the most explicit possible and I know I can do it in python but i'm trying to do it in javascript.

the data is in sms/tweet style and length so not very huge and I know where it's located on the other webiste




css class makes html element disappear

I have an html element which is an image . There is no problem seeing the image in mobile, but when you look at the page in computer, the image disappears. I found out the reason this element disappears is when I give it a class="ad_img". there is no style for appearing and disappearing this element inside that class. When I remove class="ad_img" the image shows up.

.ad_img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad_main_div {
  width: 100%;
  max-width: 800px;
}

.ad_main_panel {
  background-color: rgba(0, 0, 0, 0.00);
  border-radius: 3px;
  overflow: hidden;
  border: 3px solid rgba(0, 0, 0, 0.00);
  display: inline-block !important;
  position: relative;
  object-fit: cover;
  margin-top: 5px;
  margin-bottom: 5px;
  margin-right: auto;
  margin-left: auto;
  left: 0px;
  right: 0px;
  min-width: 100%;
  max-width: 800px;
  padding-bottom: 12.5%;
}
<center>
  <div class="ad_main_div">
    <p> With class </p>
    <button id="ad_main_button" class="ad_main_panel">
          <img src="https://pearlcapital.com/wp-content/uploads/2018/04/FB-Phone-GIF.gif"   id="ad_main_img" alt="No Image" class="ad_img"/>                 
    </button>
    
    <p> Without class </p> 
     <button id="ad_main_button" class="ad_main_panel">
          <img src="https://pearlcapital.com/wp-content/uploads/2018/04/FB-Phone-GIF.gif" id="ad_main_img" alt="No Image" />                 
     </button>
  </div>
</center>



Is it possible to retrieve the results of a console command for a remote website?

For example:

If I go to https://www.yahoo.com, enter the following console command within any browser console:

localStorage.length

I would get: 2

Is it possible to accomplish above with any scripting languages?

Pseudocode: (I am using curl here, but I did not see any options to execute console command in any curl documentation, so this is probably incorrect)

    curl ("https://wwww.yahoo.com");  // establish connection to a remote site
    curl (execute console command: "localStorage.length" );  // execute console command like you would on the yahoo site
    echo (display results);  // which should be "2" in this example
    curl close; 



How to autostart jwplayer when stream start

Hi i would like to know if there is a way to autoload the page, i have a jwplayer that when its off stream have a thumbnail thats ok but i want when the stream starts automatically autoload the page so the player auto starts, instead of the user having the obligation of refresh the site.

rtmp: { bufferlength: 3, }, 'autostart': 'true', 'width': '100%', 'aspectratio': '16:9', 'height': '550', 'fallback': false, 'androidhls': true, 'primary': 'ht/bg.png', 'image' : 'img', 'kind': 'thumbnails' });




UNITY MVC CONTAINER CATCH NULL EXCEPTION IN ACCOUNT CONTROLLER WITH AUTHORIZE ATTRIBUTE

I have a question. I'm new to UnityContainer. I use Unity for DI.

My ASP.NET MVC web app has an AccountController (which was auto-generated by ASP.NET Identity) with the [Authorize] attribute.

[Authorize]
public class AccountController : Controller
{
    private ApplicationSignInManager _signInManager;
    private ApplicationUserManager _userManager;

    [InjectionConstructor]
    public AccountController() { }

    public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager)
    {
        UserManager = userManager;
        SignInManager = signInManager;
    }

    public ApplicationSignInManager SignInManager
    {
        get
        {
            return _signInManager ?? HttpContext.GetOwinContext().Get<ApplicationSignInManager>();
        }
        private set
        {
            _signInManager = value;
        }
    }

    public ApplicationUserManager UserManager
    {
        get { return _userManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>(); }
        private set { _userManager = value; }
    }

    [AllowAnonymous]
    public ActionResult Login(string returnUrl) { ViewBag.returnUrl = returnUrl; return View(); }

    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public ActionResult Login(LoginViewModel model) 
    {
       //My code
       return RedictToAction("Index","Home");
    }
   
    //Some Methods
    
}

View my complete code: My simple AccountController was auto-generated by VS - Identity

I try to inject constructor for AccountController.

My code is in App_Start > UnityConfig.cs:

public static class UnityConfig
{
    public static IUnityContainer Container;

    public static void RegisterComponents()
    {
        var container = new UnityContainer();

        //register all my components with the container here            

        container.RegisterType<IUserStore<ApplicationUser>, UserStore<ApplicationUser>>();
        container.RegisterType<DbContext, ApplicationDbContext>(new PerRequestLifetimeManager());
        container.RegisterType<UserManager<ApplicationUser>>();
        container.RegisterType<ApplicationUserManager>();
        container.RegisterType<AccountController>(new InjectionConstructor());            
        
        DependencyResolver.SetResolver(new Unity.AspNet.Mvc.UnityDependencyResolver(container));
    }
}

My UnityConfig

When I start to run the app, and call a method on the AccountController, I ge tthis error message:

Value cannot be null. Parameter name: container

Please click below link to view the error message:

The Exception was thrown. Url's localhost:xxxxx/Account/Login

I found that when I removed [Authorize] and [ValidateAntiForgeryToken] attributes, everything worked well.

But when I added [Authorize] or [ValidateAntiForgeryToken] attributes, the exception was thrown.

Please help me to fix it.

I really appreciate it!




How to send Id and retrieve data related to that ID from database using Web API in .Net

I want to send CatID as user from client side and in server side I need to accept that and send back response to the client catName,catDes,catPic relevant to entered ID.

Below code is used to send Data to client. I want to receive req. from client and send back relevant response to client, this needs to done via Web API.

public class AddcatController : ApiController {

    [HttpPost]

    public HttpResponseMessage PostCat(Catergory category)
    {
        using (var db = new NorthwindEntities())
        {
            db.Categories.Add(new Category()
            {
                CategoryID = category.catId,
                CategoryName = category.catName,
                Description = category.catDes,
                Picture = category.catPic


            });

            db.SaveChanges();

        }
        //return OK;
        return Request.CreateResponse(HttpStatusCode.OK);
    }  }



Why doesn't this window open after closing it (chrome extension)?

So I'm building a simple chrome extension and I deal with popup windows. When the user installes or activates the extension, a popup should appear with instructions, then a user can click one of three buttons: "Done", "Skip", "Finish".

I have a problem with the "Skip" button: when a user clicks on it, it should "tell" the background script that Skip was clicked, then close itself (the window where the buttons are), then the background script will open a NEW window which is the same as the before one but with different data/information on it. Now the user can again choose between the three buttons and the cycle begins. The problem: if I click on the Skip button a few (2-3-4x) times, the new window will not open, sometimes even if I click only once, the window closes and doesn't open a new one.

The relevant code: background.js (this initializes the popup window and recieves datas from it):

window.open("notification.html", currentEx, 
"width=300,height=400,status=no,scrollbars=yes,resizable=no");

chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
    console.log("received " + msg.button);

    if(msg.button == "done"){
        console.log("done");
    }else if(msg.button == "skip"){
        randEx = Math.floor((Math.random() * 5));
        currentEx = something[randEx];
        console.log(currentEx);
        // currentEx is the data I want to access from the popup window that's why it is the name of the window

        var newWindow = window.open("notification.html", currentEx, 
        "width=300,height=400,status=no,scrollbars=yes,resizable=no");
    }else if(msg.button == "finish"){
        console.log("finish");
    }
});

notification.js (the popup window which is opened when the extension is activated or the user clicks on the skip):

var btnSkip = document.createElement("button");   
btnSkip.innerHTML = "Skip";  
btnSkip.onclick = function(){
    chrome.runtime.sendMessage({
        button: 'skip'
    }, function(){
        window.close();
    });
};                  
document.body.appendChild(btnSkip);  

I just can't see why the popup window won't open after 2 "Skip" or sometimes more click. It should close and open no matter how many times I do it, right? I can't figure out where is the problem, maybe the listener is wrong?




How to hide the top Navigation bar inside PWA (Progressive Web App) which is running based on Web Application

I'm developing PWA based on Web application so I added serviceworker.js and manifest.

I want to hide the top navigation bar inside PWA only as I showed in the below image.

Image of PWA




how I can scroll in page with JavaScript?

I am writing a program whit python , I am using selenium lib, in one of part of my program I want scrolling down in a page within another page with JavaScript code actually I want scrolling on followers page but I can not enter image description here and this is my code: enter image description here




Is there any Better way to reflect the changed CSS code on user end rather than telling them please clear your cache to see the update?

I have a website. When I Change something to the style sheet the effect does't fall into user's browser.Then when they clear their cache that new style sheet reflects to then.So my is there any better way to reflect that change whenever I update my code ??




What languages & technologies are best for a community website development? [closed]

I'm seeking for some guidance for a solid start in a website project :)

I'm a fresh CS graduate and currently want to try and build a community website that will include a few 'bulletin board' based pages, such as:

  • Apartment rents
  • Second handed furniture sales
  • Classes, courses & private teachers
  • Activities

and so on...

*The website will require a registration to use it. And all users can post their announcements.

My questions are:

  • What technologies should I use? maybe Django?
  • What database would be considered best for this use? lets say for a few thousand users.
  • Is there a designated design pattern for it?

Do you have an idea what would be the best combination for this use?

Thank You!




If div in iframe has child with specific class do

I want to add a class to the parent if the child has a specific class. The problem: It's in an iFrame and I'm not very good with jQuery.
It don't really has to be jQuery, any other way would be also great. Just notice: The iFrame is on my domain, but I can't access it, because it's generated by a plugin.

If you have any ideas how to fix it, I would appreciate it

My HTML looks somewhat like this in devtools:

<iframe src="#" id="iFrameResizer0">
<div class="book-day">
    <button class="disabled">Button Text</button>
</div>
<div class="book-day">
    <button class="active">Button Text</button>
</div>

</iframe>

and my jQuery:

$(document).ready(function () {

$("#iFrameResizer0").contents().find(".book-day button")
    if ($('.book-day button').hasClass('disabled')) {
     $(".book-day button").parent().addClass('disabled');
}

});

if everything works correct I want my html looks like this afterwards:

<iframe src="#" id="iFrameResizer0">
    <div class="book-day disabled">
        <button class="disabled">Button Text</button>
    </div>
    <div class="book-day">
        <button class="active">Button Text</button>
    </div>
    
</iframe>

Devtools:




X-Frame-Options being cached causing problems

I am trying to get an html page allowed on multiple domains and on IE11 at least. When I put X-Frame-Options: ALLOW-FROM <incoming_origin> (if the incoming origin is in the allowed list) The page get cached with this header and if you open it from another allowed origin it gets blocked.

When I put X-Frame-Options: ALLOWALL and from my backend return 403 if the origin is not on the allowed list. The page get cached with this header and if you open it from origin not on the allowed list.

I am using Cache-Control: private, no-cache, max-age=86400; which instructs the browser to revalidate the page before but it checks the e-tag sees its the same and just uses the cached page with the cached x-frame-options header

Now I can just use Cache-Control: no-store and force the browser never to cache which I am tempted to do.

Note: Currently what I am doing is force the page that is embedding to put the origin in the query string too, and if the request is cross domain and i detect no origin in query string I redirect to page?o=<the_origin_i_detect> Then I validate that the origin in query string is same as origin/referer in headers(which the browsers sets) and if its not I send 403 response. What this does is for each origin a different page is served (different querystring origin) with correct x-frame-options: allow-from <that_domain>. and if any one from a different origin tries to embed an already cached page (with an origin in qs) the browser will block him as allow-from is different or revalidate (since no-cache) and get 403 and block him (hopefully)

My question is though whats the common practice for such senario. and why didnt anyone mention this topic before.




Medical researcher trying to make a website to show interactive figures

I am an Australian researcher that is investigating how long patients survive after being admitted to Intensive Care.

I have made some interactive figures that are saved as html objects on my desktop.

I've purchased a domain name and hosting for it and can upload individual figures through cPanel.

However, I would like to upload the 6 figures and have a title page users open when typing my website name in. On that title page would be 6 links to each of the figures.

Appreciate any guidance on where I should look to learn how to do this!




How do you choose a boundary for multipart/x-mixed-replace when serving MJPEG over HTTP?

When sending M-JPEG over HTTP, you first send a header with Content-Type: multipart/x-mixed-replace;boundary=<your boundary>, then each time the sequence \r\n--<your boundary>\r\n occurs, the browser treats it as the end of one part and the start of the next part.

The problem is that a JPEG can contain that sequence, either in a comment or just because that byte sequence happens to occur in the payload.

I get that if you know all your jpeg images when you send the initial HTTP response header, you can construct a boundary which doesn't occur in any of your jpegs. But most of the time when you use M-JPEG, the jpegs are generated on the fly. How can I choose a boundary which is guaranteed to not occur in the jpegs? Are there byte sequences which never occur in a valid jpeg? Or is the best strategy just to choose a long enough random boundary that the probability of collision is small and hope for the best..?




Python Request entire HTML page, instead of initially loaded content

I am trying to get some data of reviews publicly available on the PlayStore, and as the API provided only allows to get reviews for one own's apps, I am trying to scrape it from the web.

I am using requests package to get the HTML page of a given app on the PlayStore and will use BeautifulSoup to parse it and save it to file, to then extract the relevant content (rating and comment of each user).

My issue is that not the entire content of the page is retrieved with request.get(URL). Navigating to the "Read All Reviews" on an app on the PlayStore, one gets to a page with all reviews for that app. Unfortunately, though, only a limited set of reviews loads when first loading the page, while the rest of the reviews only loads upon scrolling down to the bottom. By calling request.get(URL) only that limited set of reviews is retrieved, instead of all reviews.

Try navigating to https://play.google.com/store/apps/details?id=com.bendingspoons.thirtydayfitness&hl=en&showAllReviews=true and see older reviews load only when scrolling to the bottom of the page.

Is there a way to access the entire page/trigger the loading of more reviews/simulating the scrolling?

Below is my code:

# get reviews for Thirty Days of Fitness app
URL = "https://play.google.com/store/apps/details?id=com.bendingspoons.thirtydayfitness&hl=en&showAllReviews=true"

# make request
request = requests.get(URL)
# extract HTML text
raw_text = request.text

# parse HTML and prettify
soup = BeautifulSoup(raw_text, 'html.parser')
text = soup.prettify()

# write to file
save_path = './thirtydayfitness_html.txt'
with open(save_path, 'w+', encoding=request.encoding) as f:
    f.write(text)



Ask how to increase the speed of LIke %%

I am using mysql in flask. Fulltextsearch does not produce the same results as like%%. Ask if there is any way to improve the speed of like %%.

not good at English. Nevertheless, thank you for watching.




Accessing a Website on a remote PC over ssh tunnels from multiple devices

I have a Website backend and frontend both running on two ports of one PC. I can access these ports/the website from other devices in the same network without problem.

What I wanted to do now is to make this Website accessible for devices from another network. Point is the PC the project is running on is behind a Proxy so there is no public IP I could use for this (if I understood that correctly). That is why I was doing tests with having two ssh-tunnels to the ports for the frontend and backend from a remote PC over the proxy to the PC where the project is running. With these two ssh tunnels the project works.

My problem now is, that because that through the ssh tunneling, these ports can only be tunneled to one remote machine. If I try to open the same tunnels from yet another remote machine at the same time, I will get the message, that the ports are already in use.

Is there a possibility to make this work for multiple remote machines? I thought maybe it would be possible to kind of "redirect ports". So that it maybe is possible to reserve a range (there are only a limited amount of users for this system and it is only privately used btw) of ports and when a remote client opens an ssh tunnel to one of those, it will always be mapped to the ports where the website is running. For instance it doesn't matter if I connect to port 5000 or 5001 (given that the website is running on port 5000) and it will still work?

Sorry for the bad description, I don't really have any background knowledge on how this could be working? Maybe there is also a better solution than the ssh tunnels in general? Thanks in advance for any help!




How to mark gradient effect on background as important?

 background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 20%, #000000 80%), url("../assets/img/bg.jpg");

I want to mark gradient effect on background image as !important. is there any way to do this?




Why does Google's Rich Results test find structured data that I don't see in the browser?

Using https://search.google.com/test/rich-results I ran a test on this web page: https://www.cwcycles.co.za/product/sram-pc-gx-eagle-chain

It returns a found product, and on inspecting where that structured data is located it shows that there is a JSON-LD block in the head element: snip of the price present in the JSON-LD block

However, when I view the source for this page in Chrome there is no such block. Additionally I have inspected the page in the dev tools to see if JS is building it, and I have also changed the UserAgent to be GoogleBot, but still no luck in producing this JSON-LD block.

Why is it that Google's tool is seeing it but I am not?

Note: Originally I discovered this issue in a Python tool I have built, but have replicated it in the browser for ease of asking the question.




How can i make my website to base its time in online? I dont want it to read my computer's time. I'm currently working on voting system [closed]

date_default_timezone_set('Asia/Manila');
echo date('F j, Y g:i:a  ');

this is my code in time zone. I want to learn how to read time via online not reading my computer's time. A lot of computer is not set in correct time.




Is it the best way to use Angular 8 and JSP for developing Social Network web application

I am developing a social network web application. I already built the login and registration pages with all validation using Angular 8 as front end and Java, Spring framework as back end. Next step when a user login I want user goes to his profile where can add his photo, upload photos, and can look to others profile and comment and like to others photos. have a few questions:

  1. Is it the best way to use JSP or not?
  2. What technologies I should use when I want to redirect from one page to another page? For example I want a user be able to go to others profile and like and comment?



mardi 29 septembre 2020

Is it a good idea to keep CSS and JS files in CDN even if there are frequent updates?

I have an application where we are free to push to production at our convenience.
We are planning to keep our CSS and JS files in CDN but it says it takes around 48hrs for changes to get reflected worldwide.
Is it a good idea to keep such files in CDN or move back to our nginx server for them?




should I put JWT in Authorization Header?

normally people put JWT in Authorization header

but is there a problem when put JWT in not Authorization header I made up like Jwt, JWtInfo or etc

anyways the bottom line is should I put JWT in Authorization Header?




Flask web-app input for selenium browser automation

I have a simple Flask web app for logging into my electric company dashboard. I have a page called essentials. The essentials page has a form set up, for user input.

from flask import Flask, render_template, request from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time

> > app = Flask(__name__)
> > 
> > 
> > 
> > @app.route('/') 
    def home():
> >     return render_template('home.html')
> > 
> > @app.route('/essentials') 
    def essentials():
> >     return render_template('essentials.html')
> > 
> > @app.route('/form', methods=['POST']) 
    def form():
> >     username = request.form.get("user_name")
> >     password = request.form.get("password") 
> > 
> > 
> > 
> > if __name__ == '__main__':
> >     app.run(debug=True)
> > 
  • Then i have a selenium, web automation python script:
driver = webdriver.Safari()
driver.set_window_size(1100, 800)
driver.get('https://www.firstenergycorp.com/content/customer/jersey_central_power_light.html')

username = 
password = 


driver.find_element_by_id('loginUsername').send_keys(username)
driver.find_element_by_id('loginPwd').send_keys(password)
driver.find_element_by_id('loginPwd').send_keys(Keys.RETURN)
time.sleep(7)

Question: How do i pass the flask form web user inputs(username, password), into the selenium variables in this case "username" and "password" that it will then use for the automation part?




Scrape text from selected option from dropdown

How to get the text of selected option from HTML structure using python?

<select class="required" id="PPT" name="PPT">
<option value="">Paying Term</option>
<option selected="selected" value="0-10">0-10 Years</option>
<option value="10-20">10-20 Years</option>
<option value="20-30">20-30 Years</option>
<option value="30-40">30-40 Years</option>
</select>



How to involve a Explorer into the Website [closed]

I have a website where you can upload specific file, the file will get safed on a server Folder.

People on my website should be able to access the files from the website, how would this be possible?

Greetings Michael




Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:8080/favicon.ico (“default-src”)

Why I am getting this error when I run my Spring Boot App Result

I am running my app on firefox, I tried it on brave and chrome it is same there too.




Windows redirect url and path to another url

As per my other question (that unfortunately is unanswered as of writing this) I am trying to find a way that I can set up a local redirect on my machine so when a website is hit either via browser or console it is redirect to another of my choice.

I've tried doing this from the hosts file but for some reason it wont work but I assume the hosts file cannot accept paths

Example:

https://github.com/airbrake/airbrake-js    https://stackoverflow.com/questions/ask

So the stackoverflow link would redirect to the github link if accessed via the webbrowser or a local application.

Is there anyway this is possible?

Thanks




How to scrape Kickstarter in R?

I have used rvest but simply using that does not give me 42,922 projects as listed on the page. There are multiple pages but I can't seem to scrape those. I have to perform regression on this data.




Download older version of browsers as a developer [migrated]

The answer for this question seems so simple before 6 hours. But for the past 6 hours I'm trying to download Google Chrome version 38. I searched what ever I can in the google for hours and hours. Still I'm unable to get anything.

Here is the situation, I need to test a feature on Chromium 38 engine. Where can i get the specific version of any browser that use this specific engine.

Now I wonder, how developers handle this kind of scenario. If the approach is something different, please let know that too.




Open a word document file in web based ms office using Angular application

I want to open a word document file in web based ms office ( office 365 ) from the Angular application. So, for example

  1. I have running angular application
  2. A word document is received from backend (node js ) by calling a get url.
  3. Once the document file is received, I want to make the Angular application open it on the browser in ms office ( web view ).

Is it possible first of all? And yes then is there any API or how will the things to be carried after 3rd Step above.

Note: The user using Angular application is already logged in office 365 on the browser.




Why we have used except('logout')?

In one of the training tutorials , I saw this code in LoginController but I don't understand why except('logout') is used.

1

Could you please explain it to a beginner? What does except('logout') mean? I understand that something is excluded from the selection but I can't for some reasonю




"Save" a static image of an asp form for the user to refer back to

I have an asp application in which I present a series of questionnaires in a form panel - when the user pushes a submit button, I save their entries, clear the panel, and load the next questions into the panel. There are times when they need to look back at the initial form to check how they answered something on that form (they can't change the submitted answers). So what I think I need is a way to save a static view of the initial form in a separate web page/browser tab that they can select and then go back to where they were. I have found partial hints related to this (like saving a screen capture or converting the form to a pdf) but nothing seems to be the answer. Maybe I've been asking the question wrong or maybe there is a better way to do the whole thing? Thanks for any suggestions.




Mysql Update does Insert and not Updating Database

i've tried to update an Entry from my MySql Database with this code:

 $pdo->exec("UPDATE todo 
                SET title='$todotitle', 
                    description='$tododescription', 
                    endDate='$todoEndDate', 
                    endDateTime='$todoEndDateTime', 
                    forUser='$checkBox' 
              WHERE id='" . $gettodoId . "'");

After Submit the Entry i've selected with "WHERE" got not Updated but a New Entry in my DB was created.

What did i wrong and how can i update my Entry with my code. Thank you!




Allocation of large (~4G) ArrayBuffer failed on 64bit Chrome and Firefox in 2020

Operating System: MacOS 10.14.6

Browsers:

  • Chrome 85.0.4183.121 (Official Build) (64-bit)
  • Firefox 81.0 (64-bit)

Reproduce Steps:

  • Open a new tab
  • Open Console (F12 or CMD+ALT+I)
  • Create new ArrayBuffer new ArrayBuffer(Math.pow(2,32)-1)
  • Get error: Uncaught RangeError: Array buffer allocation failed

According to page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length The above ArrayBuffer allocation should be a valid case for 64 bit browsers.

Creating of Array of same size works. It seems ArrayBuffer length is using signed int32 while creating Array is using uint32.

Anyone has any idea?




How to connect Laravel 8 to oracle 11g database?

I'm trying to connect Laravel 8 with Xampp to the Oracle 11g database, I tried all possible solutions but it didn't work. Here are my system properties:

  1. Windows 8.1 64 bits.
  2. Laravel 8.
  3. Oracle 11g.
  4. Xampp 64 bits.
  5. php PHP 7.4.10

This is the error message: C:\xampp\htdocs>composer require yajra/laravel-oci8 PHP Warning: PHP Startup: Unable to load dynamic library 'php_oci8_11g' (tried: C:\xampp\php\ext\php_oci8_11g (%1 is not a valid Win32 application.), C:\xampp
php\ext\php_php_oci8_11g.dll (The specified module could not be found.)) in Unkn own on line 0 . . . The following image clarifies the problem: enter image description here




Web developing using imac pro 5k screen

I set a media query to fire between 992px and 1200 px.

I monitor the screen width using Chrome developer tools.

But the query fires between 793px and 959px.

I have experimented with media queries "min resolution" etc.

But cannot work out how ensure that H1 changes to red when the screen width is precisely between 992px and 1200px.




How to authenticate a custom Web application using Tacacs+

I'm currently looking for information on how to integrate authentication for a custom web application using TACACS+ We are currently running Nginx on the front and Ruby on the backend.

Also is there any specific gems available for interacting with TACACS+ server.

Thank you for your valuable help.




Read QRCode from multiple uploaded Image files using JavaScript

I am working on a project where I want to read QR Codes in all uploaded image files and retrieve all resulting QR Codes that are detected in JS console as a output

For uploading Image I used <input type="file" multiple /> and after uploading all images, we should get detected QR Code ( that will present anywhere in image ) in every image as a output in JS console.

So how can I do this?




\Firebase\JWT\JWT::decode() in php is confusing me

I came across this bit of code:

class JWT {
    private $secret = "secret-string";
    private $algos = ['HS256'];
    private $domain;

    function __construct() {
        $this->domain = $_SERVER['HTTP_HOST'];
    }

    function get() {
        if ( isset($_COOKIE['jwt']) ) {
            $ticket = $_COOKIE['jwt'];
            try {
                $data = \Firebase\JWT\JWT::decode($ticket, $this->secret, $this->algos);
                return $data->data;
            } catch (Exception $e) {
                return null;
            }
        } else {
            return null;
        }
    }

    function set($data) {
        $time = time();
        $expire = $time+60*60*24;
        $data = [
            "iat" => $time,
            "nbf" => $time,
            "exp" => $expire,
            "data" => $data,
        ];
        $jwt = \Firebase\JWT\JWT::encode($data, $this->secret, $this->algos[0]);
        setcookie('jwt', $jwt, $expire, '/', $domain, true, true);
    }
}

I am not familiar with php, But because of certain conditions, I have to slam my head against it currently. After slamming my head repetitively against this, I came to the conclusion that I am having a problem in the following bit of code:

$jwt = \Firebase\JWT\JWT::encode($data, $this->secret, $this->algos[0]);
setcookie('jwt', $jwt, $expire, '/', $domain, true, true);

I am not able to understand the format the JWT tokens will be encoded in. I have tried some trial and error but I failed and I feel like I am missing somewhere. My last resort was to move to stackoverflow to ask the wonderful programmers here about this.

For context: I would have posted this on security overflow, But I posted it here as the last time I did that my question got migrated.

Hopefully I can be shown the right direction!




lundi 28 septembre 2020

Material-UI Autocomplete endAdornment Issue

I'm trying to use Material-UI's Autocomplete component in my project.

I haven't applied any styling to it and it's rendering a bit off.

I have two issues:

  1. The highlight over the down around and clearable buttons is not a small circle as shown here.
  2. The dropdown only opens when I click close to the letters E, M and P. I'm assuming this is because of the above.

I'm not sure why that's happening because I just copied the code from Material-UI's documentation and I'm not sure which of my styles, if any, is causing the issue. I also checked on Chrome Devtools and none of my styles are being applied.

Code Snippet:

const employees = [
      { name: 'John Oliver' },
      { name: 'Karen Green' },
      { name: 'Alastair Brown' },
    ];

    const employeeNames = {
      options: employees,
      getOptionLabel: (option) => option.name,
    }; 

<div className="col-lg-5">
       <FormControl className="drop-down" required>
          <Autocomplete
            {...employeeNames}
            name="employee"
            autoHighlight
            renderInput={(params) => <TextField {...params} label="Employee" />}
          />
          <FormHelperText>Required</FormHelperText>
        </FormControl>
    </div>

Could someone please tell me what the problem is?

Another Screenshot

here




eosearch-ui process going down often

We have been experiencing a issue with eosearch where eosearch-ui process is getting down often. Memory in Java.nin was 4GB previously and we increased to 32GB recently and we still see the issue . Is there any tuning for these kind of issues ?

Thanks Barath




NoSuchMethodError: invalid member on null: 'toList' (Flutter Web) An exception was throw by _MapStream

The error: NoSuchMethodError: invalid member on null: 'toList comes, but code works when I use the commented provider i.e. final userdetails = Provider.of<List>(context).toList() ?? [];

However, if I use final userdetails = Provider.of<List>(context).toList() ?? []; I get this two errors, and app displays red screen. 1- NoSuchMethodError: invalid member on null: 'toList 2- An exception was throw by _MapStream<QuerySnapshot, List> listened by

import 'package:traveltogether_admin/Admin_Screens/Admin_ManageUsers_Tile.dart';
import 'package:traveltogether_admin/Models/user.dart';

class ManageUsers extends StatelessWidget {
  static const id = 'Admin_manage_users';
  @override
  Widget build(BuildContext context) {
    final userdetails = Provider.of<List<MyUserData>>(context).toList() ?? [];
    // final userdetails = Provider.of<List<RequestToJoinData>>(context).toList() ?? [];
    final user= userdetails;
    return ListView.builder(
        // shrinkWrap: true,
        // physics: NeverScrollableScrollPhysics(),
        // primary: false,
        itemCount: userdetails.length,
        itemBuilder: (context,index)
    {
      print(userdetails);
          return ManageUserTile(user[index]);
    });
  }
}




frontend or backend to compress images?

I am facing a long delay problem in my website, and one of the reasons is large images.

I know that I should minimize images size, and there are many packages I could use but I'm a little bit confused, should I use frontend compression packages (npm packages) or backend packages (Laraver packages) ? what is the deference?

To let you know, images is not static in the website it is uploaded from users, so I should compress any new image that send to server




Web alerts pop up clicking through web console or snippet

I am running some code snippets through chrome's source tab and most of the time the website pop ups an alert saying if I want to extend the session, how can I automate the clicking of Ok on the sessions extension alert. I don't want to use slenium as I have the snippets running.




Why can´t I see my Heroku app from two computers at the same time?

Well i have developed an app that graphs some data.However I can only visualize it with one computer at a time. I use Mozzila in computer A then go to the web page and it works, then I try to go to computer B but the web page doesn´t work.. However if i try first computer B then A, the computer B works but not A.




Does the complexity of a closure affect the performance cost of creating it?

Suppose I have the following React hook:

export const useSomeState = (someProps: {}) => {
  return React.useState(() => {
    // Some really complex function with lots of code
  })
}

Because we are using the function handler to React.useState, the state should only be initted once.. thats fine...

If this hook is used as part of a larger component that is re-rendered frequently does this hurt performance? Or do I need to use React.useCallback or something?

What is the performance cost of JS creating and re-creating a closure (on each re-render) that it will never run?

And does the complexity of the closure (number of variables captured and put on the heap) affect the performance cost?




Can't see new version of site on network

I recently changed my domain name from example.com to example2.com, and I can see the website using the new domain on every ISP network but my own. My own ISP, I cannot access the new version of the site, I am still seeing the old version, but on every other computer I can see the new version, what is going on here?

I am using Cricket Wireless on the ATT&T network, like I said, I can see my website on every other computer and phone, just not on my own. What is going on. I keep seeing the old version.

I've cleared out cache, downloaded and used multiple browsers, I've evn reset my phone back to factory condition, but still seeing the old version.




error in redirecting onmouseover to other elements

I want that the moment I move my mouse over the svg, the text will shift to the right, making it visible; however it is not working. What would be the problem?

HTML:

<div class="exitBox">               
            <span class="exitButton"><?php include "SVGs/sair.svg"; ?></span>
            <span class="exit"><a href="#" id="exitA">SAIR</a></span>               
        </div>

CSS:

.exitBox{
            display: inline;
            position: fixed;
            top: 20px;
            left: 40px;
            overflow: hidden;
        }

        .exitButton svg{
            width: 20px;
            color: black;
        }

        #exitA{
            display: inline-block;
            text-decoration: none;
            color: black;
            font-size: 30px;
            letter-spacing: 2px;
            font-family: Teko;
            transform: translateX(-100px);
        }

SCRIPT JS:

var exit = document.getElementById("exitA");
        var exitB = document.getElementsByClassName("exitButton");
        
        exitB.onmouseover = function exit(){
            exit.style.transform = "translateX(100px)";  
        }



How can i get my webscraper to skip over information I cant parse so it doesn't break.?

I've created this webscraper and when it runs it will break because I do not have a rule to keep running if it can't parse certian information. I am taking names and numbers of real estate agents however not everyone has their number on the website, when i run into a realtor without a number the script will stop working and return an error. I am a beginner at this and cant find the proper way to get it to keep looping between pages if the required information isnt found. it just stops when it can't find anymore information. I am aware this is a noob question but for the life of me I cannot get it to keep running over the missed information.

import requests
from requests import get
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup 
import numpy as np
from numpy import arange

from time import sleep
from random import randint

headers = {"Accept-Language": "en-US,en;q=0.5"}

my_url = 'https://www.realtor.com/realestateagents/phoenix_az/pg-2'

#opening up connection, grabbing the page
uClient = uReq(my_url)
#read page 
page_html = uClient.read()
#close page
uClient.close()

pages = np.arange(1, 30, 1)

for page in pages:

    page = requests.get("https://www.realtor.com/realestateagents/phoenix_az/pg-2" + str(page) + "&ref_=adv_nxt", headers=headers)


#html parsing
page_soup = soup(page_html, "html.parser")

sleep(randint(2,10))

#finds all realtors on page 
containers = page_soup.findAll("div",{"class":"agent-list-card clearfix"})

for container in containers:
    name = container.find('div', class_='agent-name text-bold')
    agent_name = name.text.strip()

    number = container.find('div', class_='agent-phone hidden-xs hidden-xxs')
    agent_number = number.text.strip()


print("name: " + agent_name)
print("number: " + agent_number)

below is the rule i wrote to try and solve this issue however i am not great at this and not entirely sure where i am going wrong yet.

nv = container.find_all('div', attrs={'number': 'nv'})
number = nv[1].text if len(nv) > 1 else '-'



How to navigate properly in Flutter Web with Back/Next browser buttons?

I'm currently working with Flutter Web using flutter_modular for the routing which works properly when you navigate straight to a page throught the browser, but I'm encountering a problem when trying to go back and then next again.

Let me explain myself, imagine you are at the home page and you navigate to the register page, then you press the back button from the browser and then you want to press the Next button from the browser, you can't because Flutter disposed the last page and it is not int the browser history anymore.

Is there anyway to achieve a clean and smooth navigation in Flutter Web?




Download latest file using wget

I'm trying to figure out how to download the most recent file from a server using wget on my Linux system. The files are ssl certs in zip archives for some services i.e. prometheus.my.domain-09.28.2020, alertmanager.my.domain-09.28.2020, my.domain-07.28.2020, etc. The date of its addition to the server is nailed to the name of the file.Currently, i have python script that helps me to cope with the task, but due to the presence of crutches, I want to switch to bash. I achieved stdout and sed and saving to a txt file without html tags.

wget -qO- https://myserver@my.domain/ssl/ | sed -e 's/<[^>]*>//g' > downloaded_file.txt

The result of the command can be seen in the file:

prom.my.domain-2020-09-18.zip                   18-Sep-2020 18:14                7217
prom.my.domain-2020-09-21.zip                   21-Sep-2020 17:20                7217
grafana.my.domain-2020-09-18.zip                18-Sep-2020 18:14                7222
grafana.my.domain-2020-09-21.zip                21-Sep-2020 17:20                7222
my.domain-2020-09-18.zip                       18-Sep-2020 18:14                7269
my.domain-2020-09-21.zip                       21-Sep-2020 17:20                7269

How to download the latest grafana.zip now?




Should I use authentication between frontend and backend

I have a website, frontend with react and backend with nodejs. both are deployed in a private network. Im exposing API REST in the backend and my frontend is consuming that services, however, Im exposing it without autentication right now. I think this is not issue because are in private network, however, I would like to understand if this is good approach, if you see some security issue.

Thank you




Getting Historical news data from Finwiz

Is there a way to get news headlines of more than the most recent from Finwiz Currently it shows only the current 50 or so

https://finviz.com/quote.ashx?t=tsla




How to Capture an HTML Element and save as image?

I want to capture and save it as an image of a specific HTML element by the press of a button.




Vue conditional rendering behaves differently for array data when updating

I have some elements on html and they are each rendered based on their own condition. I also needed to update vue data periodically so page will render accordingly. But I noticed that conditions related to array data disappears and appears again in a moment. Here is mycode :

     <button type="button" class="btn btn-success" v-bind:disabled="not == 'Yazıcılar bekleniyor..'" v-if="siparisler.length > 0" v-on:click="sendSiparis('YENI SIPARIS')" id="btn-send-all">SİPARİŞİ KAYDET VE GÖNDER</button>
     <button type="button" class="btn btn-secondary" v-if="masa_musait" v-on:click="guncelle">GÜNCELLE</button>

Here, siparisler is an array and masa_musait is boolean. When vue data updated, second button always stay on page but first button disappears for a moment from page. And this is not a wanted situation. To prevent that, I tried v-show instead of v-if. I also tried to create a boolean type value from siparisler.length > 0 but none of it worked. So I need help about that.




run python script on seperate server using flask api

I am making a website with python flask. I'm trying to run a script when a specific action is made on the site. My script is pretty cpu intensive so I was thinking it was best to run it on another server. I was wondering how I can do this. Anyone that could help? Would appreciate it a lot!




Download Most Recent Fil Via wget

I'm trying to figure out how to download the most recent file from a server using wget on my Linux system. The files are ssl certs in zip archives for some services i.e. prometheus.my.domain-09.28.2020, alertmanager.my.domain-09.28.2020, my.domain-07.28.2020, etc. The date of its addition to the server is nailed to the name of the file. Currently, i have python script that helps me to cope with the task, but due to the presence of crutches, I want to switch to bash.

import os
import zipfile
from datetime import datetime
import dateutil.parser as dparser
import requests
from bs4 import BeautifulSoup
​
url = 'https://myserver@domain/ssl/'
​
download_dir = '/home/my/Downloads'  # Specify download folder!
​
###################################################################################
​
cert = {}
soup = BeautifulSoup(requests.get(url).content, 'html.parser')
​
for tag in soup.find_all('a'):
    t = tag.get('href')
    if t != '../':
        date = int(dparser.parse(t, fuzzy=True).timestamp())
        domain = t.split('-')[0]
​
        if domain not in cert:
            cert[domain] = [date, t]
​
        if cert[domain][0] < date:
            cert[domain][0] = date
            cert[domain][1] = t
​
for key, value in cert.items():
    address = url + value[1]
    downloaded_obj = requests.get(address)
​
    dir = os.path.join(download_dir, f'{key}')
    if not os.path.exists(dir):
        os.mkdir(dir)
​
    temp_path = os.path.join(dir, value[1])
    with open(f"{temp_path}", "wb") as file:
        file.write(downloaded_obj.content)
​
        time = str(datetime.fromtimestamp(value[0]).date())
        unzip_path = os.path.join(dir, key + '-' + time)
        zipfile.ZipFile(temp_path).extractall(unzip_path)
​
        print(f"{value[1]} downloaded and extracted to {unzip_path} folder")



User closes browser - how to kill expensive processing on server

Say user actions triggers an expensive operation on the server.

Then they decide to leave the page.

How can i kill the expensive operation on the server to save resources when user leaves my webapplication / web page?




Higher Order Component showing no result in REact

import React, { Component } from 'react';
import click from './componet/click'
import mouse from './componet/mouse'
class App extends Component {
    render() {
        return ( < div > < p > check it < /p> < click / > < mouse / > < /div>)
        }
    }
    export default App;
    
    
    //click.js given below
    
    import React, { Component } from 'react'
import handlerHoc from '../hoc/withHoc'
class Clicker extends Component {
    constructor(props) {
        super(props)
    }

    render() {
        return ( < button onClick = { this.props.increamentCount } > Count is { this.props.count } < /button>)
        }
    }
    export default handlerHoc(Clicker)
    
    //mouse.js given below
    import React, { Component } from 'react'
import handlerHoc from '../hoc/withHoc'
class Mouser extends Component {
    constructor(props) {
        super(props)
    }
    render() {
        return ( < p onMouseOver = { this.props.increamentCount } > Count is { this.props.count } < /p>);
        }
    }
    export default handlerHoc(Mouser)
    //withHoc given below
    
    import React, { Component } from 'react'
const withHoc = (Wraper) => {
    class Handler extends Component {
        state = { count: 0 }
        countIncreaser = () => {
            this.setState(prevStae => {
                return { count: prevStae + 1 }
            })
        }
        render() {
            return ( < div > < Wraper count = { this.state.count }
                increamentCount = { this.countIncreaser }
                /></div > )
        }
    }
    return Handler
}
export default withHoc

I can not see any error message but still there is no output.I am sure that both terminal and browser not showing any error................... i tried many ways but still getting this. .....................................................................................................................................................................................................................................................................................................................




Why is there an extra space at the bottom for mobile?

I have a website that is responsive for mobile. On most devices it works fine but on the iPhone 11/11 pro the background is visible at the bottom of the page. After doing some research, it seems the CSS height property may be an issue. Suggested to use VH rather than % but after changing the HTML BODY to 100vh, it pushes all the content down (but no longer have the background visible at the bottom). See below - the red is the background color, the brown is the image.

All my content fits within the screen. Also - if I rotate the device in landscape then rotate back, then its perfect!

I think it is related to this 'notch' idea - https://css-tricks.com/the-notch-and-css/

enter image description here

HTML

<body class="bkground">
<div class="main">
    <div class="wrapper">
        <div class="content" role="main">
            <div class="main-form-container">
                <form id="auth-form" method="post" class="centered">
                   <!-- Content here -->
                </form>
            </div>
            <div class="accept-connect-container">
                <form method="post" class="accept-form">
                   <!-- Content here -->
                </form>
            </div>
        </div>
    </div>
</div>

CSS

@media (min-height: 640px) and (max-height:699px) {
html body {
    height: 100%;
}
.wrapper {
    background-image: url('../img/desktop-background.jpg');
    background-repeat: no-repeat;
    -webkit-background-size: fill;
    -moz-background-size: fill;
    -o-background-size: fill;
    background-size: fill;
    background-position: center;
    background-color: #fff;
    margin: 0;
    padding: 0;
}
.main {
    height: 100%;
}
.content {
    width: 350px;
   }
}



How to store objects of custom class as session variables in django?

In my case i wants to store object of my USER class to be stored as session variable To be more precise my class contains several methods for USER structure of my USER class

class USER:
    def __init__(self , phone_number_of_user = None , user_name  = None):
        self.phone_number = phone_number_of_user
        self.user_name    = user_name
    def login(self):
        login_code_will_be_here
    def get_user_name(self):
        return self.user_name
    def set_data_of_user_in_firebase(self , data = None):
        code to set data of user will be here

firstly i create a USER object

user = USER(phone_number = 9******** , user_name = John)

But when i tries to store my objects in session of django like this

request.session['user'] = user

django shows me following error

Object of type USER is not JSON serializable



Prop passed in to component is undefined

I am building an ecommerce website which includes a cart for each user. I want to pass the state of cart to a component using props

In App.js -

<Header cart={cart} />

In Header.js -

function Header({ cart }) {
  console.log(cart);
}

I have checked console.log(cart) in App.js and it gives me the desired and correct array of objects.

I pass in this state as a prop to Header Component and then I want to display the number of items in the cart.

But, the console.log(cart) in Header.js gives me undefined.

What am I doing wrong here? Thanks in advance.

App.js -->

function App() {
  const [{ bag }, dispatch] = useStateValue();
  const [cart, setCart] = useState([]);
  console.log("CART -", cart);

  useEffect(() => {
    //will only load when app component loads
    auth.onAuthStateChanged((authUser) => {
      console.log("USER ->", authUser);

      if (authUser) {
        dispatch({
          type: "SET_USER",
          user: authUser,
        });

        db.collection("users")
          .doc(authUser.uid)
          .collection("cart")
          .onSnapshot((snapshot) =>
            setCart(
              snapshot.docs.map((doc) => ({
                id: doc.data().id,
                image: doc.data().image,
                productName: doc.data().productName,
                productPrice: doc.data().productPrice,
              }))
            )
          );
      } else {
        dispatch({
          type: "SET_USER",
          user: null,
        });
      }
    });
  }, []);

  return (
    <Router>
      <div className="App">
        <Switch>
          <Route exact path="/payment">
            <Header cart={cart} />
            <Elements stripe={promise}>
              <Payment />
            </Elements>
          </Route>
          <Route exact path="/login">
            <Login />
          </Route>

          <Route exact path="/checkout">
            <Header />
            {/* <CategoriesHeader /> */}
            <Checkout />
          </Route>

          <Route exact path="/">
            <Header />
            <CategoriesHeader />
            <Home />
          </Route>
        </Switch>
      </div>
    </Router>
  );
}

export default App;



Flutter: How to return app with a clicked button on the Web

in our application We send an e-mail to the user to reset the password. After the mail process is over, we want to create a button(in web) and return to the application when the user clicks it.

What do I need to do with my Flutter app for this? How do I connect my application with a button on the web?




JavaScript class is not called and nothing happened

I'm very new to JavaScript. I tried to use reactJS to learn a JavaScript. Here, I'm trying to develop a weather application using API. But that didn't work. Can I know what is wrong with that code.

class retrieveApi extends React.Component {
  constructor() {
    super();
    window.alert("here");
    this.state = {
      temp: "",
      ret: "",
    };
    var Http = new XMLHttpRequest();
    const url =
      "http://api.openweathermap.org/data/2.5/forecast?appid=API_KEY&q=california";
    Http.open("GET", url);
    Http.send();
    window.alert("here");
    Http.onreadystatechange = (e) => {
      if (Http.readyState == 4) {
        this.setState({
          ret: Http.responseText,
        });
        var obj = JSON.parse(this.state.ret);
        window.alert(obj.cod);
      }
    };
  }
  render() {
    return <p className="main-temp text-shadow">{this.state.temp}</p>;
  }
}

in my App() function I called that class like this.

return <div>
<retrieveApi></retrieveApi>
</div>

I called that class like tags. Is that right? Before I tried to create clock so I used the same so I used like this. If something is wrong please rectify it.

And When I used this things nothing shows up or changes. Please help me with it!




dimanche 27 septembre 2020

Why Javascript doesn't have any browser/window close detection? [closed]

We can only detect when the page is loaded and unloaded but not when the browser or tab is closed. My question here is why? Why do browser doesn't have a pure Javascript close detection? Is it for security purposes? Thanks!




What am I doing wrong with using the this keyword and loops with vanilla javascript? [duplicate]

I think that only my html and my javascript should be necessary for this example. Basically, I am trying to make the elements have something happen to them in CSS in JS with a delay. However, I am unable to seem to get the setTimeout feature to get it to work. I am well aware of the Jquery delay function, but, I want to be able to do it in JavaScript. This is my HTML and this is my JS.

let div1 = document.querySelectorAll('div');
for (i = 0; i < div1.length; i++) {
  div1[i].addEventListener('click',
    function() {
      setTimeout(function() {
        this.style.display = "none";
      }, 200)
    },
    false);
}
<!Doctype html>
<html>

<head>
  <link rel="stylesheet" href="../CSS/csstest.css">
</head>

<body>
  <section class="grid">
    <div class="img1">aaaa</div>
    <div class="img2">bbbb</div>
    <div class="img3">cccc</div>
    <div class="img4">dddd</div>
    <div class="img5">eeee</div>
    <div class="img6">ffff</div>
    <div class="img7">gggg</div>
    <div class="img8">hhhh</div>
  </section>

  <script src="../JS/testjs.js"></script>
</body>

</html>



Wordpress Category to Menu

I have created several categories with sub-categories, I want to display the category in a menu so I created the menu inside appearance-->Menus, now what I want to be displaying is the created categories(with the respective sub-categories) in the menu. I went to the categoryName, when I selected the Category1 with the hope of getting all the sub-categories automatically, I only get the Category1 back, when I clicked view all-->select all-->add to menu unfortunately it shows all the categories with the sub-category at the same level. Please how can WordPress newbie, that have close to zero knowledge of php programming achieve this task? Or is there any plugin for that?




How to use IPython module in web IDEs

Hello I'm working on a resume website and wanted to embed an IDE that would run my python code in the site. The problem is it won't run in the IDEs because one of the modules isn't there. I'm really new with this stuff so I would love some help.

I get the following: ImportError: No module named IPython on line 6

Is there way to get it to work so I can embed it to my website? If it is not possible I'll just include the code itself. If there is a way to embed my program without using a web IDE I would like to know.




How to make Facebook Embedded Posts update to the last post on the page?

I am not sure how to explain it. I hope you can get me.

Okay here we go:

I would like to include a Facebook post from a Facebook page on my website. I have read The documentation of Facebook for developers.

My code:

<div class="col-xs-12 col-lg-4">
        <div class="card">
          
          <div class="card-block">
            <div class="fb-post" data-href="https://www.facebook.com/Belhaj.global.ads/posts/166214251671796"
            data-show-text="true" data-width="" >
            <blockquote cite="https://www.facebook.com/Belhaj.global.ads/posts/166214251671796" class="fb-xfbml-parse-ignore">
              Posted by
              <a href="https://www.facebook.com/Belhaj.global.ads/">BELHAJ GLOBAL</a>
              on&nbsp;<a href="https://www.facebook.com/Belhaj.global.ads/posts/166214251671796"> August 25, 2020</a>
            </blockquote>
          </div>
          </div>
        </div>
      </div>

Output: enter image description here

I want it to be auto-update to the latest post when I post a new post on my Facebook page.

is there any way to make it auto-update?




Under what conditions would window.location.search be undefined?

We inconsistently see this error in our logs: Cannot read property 'substring' of undefined

It occurs on this line of code: var sPageURL = window.location.search.substring(1)

Unfortunately, the error is not consistently reproduced, but the flow is:

  1. Open new window via JavaScript.

  2. In new window, invoke this line of code.

Based on Googling, internal testing, and answers like this, it seems like window.location.search should at worse but the empty string, but never undefined. If window or location were undefined, then it would be expected for the error to appear differently.

Under what conditions could window.location.search be undefined?




How to deploy nuxt proj with circleci once have new commit to github

Recently I made a dev branch for myrepo in GitHub, I deploy the Nuxt app by running sh deploy-dev.sh in my ubuntu server. I found that manually redeploying my project to the server every time after pushing commits is quite time-consuming; therefore, I tried to find ways to automatically deploy the app once I make a new commit on dev branch. I have read some documentation about CircleCI, but I'm still so confused. I've added the ssh key in the CircleCI project for myrepo, added it as steps: - add-fingerprints -"FI:GE:RP:RI:T" to the config.yml then I'm stuck with the connection problem and how should I actually run the deploy-dev.sh. How should I do the config if i want to:

  1. run the test only when dev has new commit
  2. try if the project can actually build
  3. deploy the project to the server by running the sh script

Here is the config.yml

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:10.19.0
    working_directory: ~/dev
    steps:
      - checkout
      - run: npm install
      - run: npm run build

  deploy:
    machine:
      enabled: true
    steps:
      - add_ssh_keys:
          fingerprints:
            - "FI:GE:RP:RI:T"
      - run:
          name: Deploy Over SSH
          command: |
             ssh USER@ADDRESS "sh dev/reploy-dev.sh"
workflows:
  version: 2
  workflow:
    jobs:
      - build
      - deploy

Here is the deploy-dev.sh

#!/bin/bash
pm2 stop dev
cd ~/dev/Myrepo
git checkout dev
git fetch
git pull
npm install
cp ../.env .env
npm run build
pm2 restart dev



Script that scrapes website infinitely without scraping duplicates doesn't work

I wrote a simple script, and while it works when scraping the website, when trying to make it not scrape duplicates, it doesn't work. I think the logic to make it not scrape duplicates would be:

  1. adding all the links to a list
  2. getting new links and comparing to the 1st list
  3. if new links in second list aren't in 1st list then amend to the 1st list?
import requests
import time
from bs4 import BeautifulSoup
import sys

f = open("links.txt", "a")
list_=[]

while True:
    try:
        URL = f'WEBSITEURL.COM'
        page = requests.get(URL)
        time.sleep(1)

        soup = BeautifulSoup(page.text, 'html.parser')

        data = soup.findAll('div',attrs={'class':'card-content'})
        for div in data:
            links = div.findAll('a')
            for a in links:
                if a not in list_:
                    f.write(a['href'])
                    f.write('\n')
                    print (a['href'])
                elif:
                    continue
    except Exception as e:
        print('something went wrong')
        #continue



type '_InternalLinkedHashMap

I have a Problem with my json.decode. I want to get some data from my website but when my website says {"Number":5} i only get this error (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'FutureOr<List>').

However if my website says string{"Number":5} i get the correct output and this error FormatException: Unexpected character (at character 1).

Here is my Flutter code:

@override
void initState() {


Future<List> senddata() async {
  final response = await http.post("http://www.quyre.de/2/Home.N.php", body: {
    "status": "0",
    "nam_ersteller": "Quyre",
  });

  var datauser = json.decode(response.body);
  return datauser;
}

senddata();
}

Thanks for any answer




How to find the total price from a list of items in React?

I am working on an ecommerce website in React. When a user adds a product in his cart, the state of cart get's updated. It looks like this -

const[cart, setCart] = useState([]);

everything works fine, the cart is updated with the help of Firestore. Each item in the cart has properties - id, image, productName and productPrice

I want to display the total price (sum of prices of all the items in the cart). What I try to do is this -

const getCartTotal = () => {
    let total = 0;
    {
      cart?.map((item) => total + item.productPrice);
    }
  };

But this give me an error in the browser -

Line 37:7:  Expected an assignment or function call and instead saw an expression  no-unused-expressions

What should the correct approach be? Thanks in advance!




How can I get the position of a Button on a website

I'm looking for a solution to find the position of a specific button on a website.

What I want to do is to get the position, write them into a text file and use those coordinates to run another program to click on this specific position.

If you guys have a better idea to realize this please let me know

I'm also wondering if it is possible to use a neural network to train it to find the position and then execute a click on this button.

The problem with automation is, that sometimes ad appears on this site and so the position of this button changes




How can I practice Web development as a beginner? [closed]

I'm new to Stack Overflow and programming in general (3 months.) I'm learning Html,css and some javascript. And I have done online courses, but I don't know how or what to practice effectively what I've learnt.

  1. What are the particular projects I should work on?
  2. Is it advisable to go into bootstrap when I haven't even built with traditional html and css?



How to scrap seloger.com with python

I need to get real apartment data for machine learning homework.

In order to do it, I need to scrap the website www.seloger.com to get apartment prices, surface, city, district ...

I have tried lots of open source code but none of them works (I use python). Here is one code that I have tried: https://medium.com/france-school-of-ai/web-scraping-avec-python-apprenez-%C3%A0-utiliser-beautifulsoup-proxies-et-un-faux-user-agent-d7bfb66b6556

Also, is it legal to scrap a website if it's just in an educational way?

Thanks a lot to anyone who can help me!




Can I make a website that changes every refresh like thispersondoesnotexist.com?

My friend and I are making this website and we don't like how its coded at the moment. I thought of making the website kind of a generator that changes every refresh like thispersondoesnotexist.com, but we don't know how to code it in. Can somebody please help?




Needed to solve a problem with Page-Break

When the 'Add Stuff' button is clicked new paragraph with random length is added to the DIV element that is A4 sized. When the new content doesn't fit within the page, then a new page(A4 sized div) should be created and new content should be added to the new page. Page-break property should be added when the content is added.

<page size="A4">
<div id="add_to_me"> 
    <p>This is the text which has already been typed into the div</p> 
</div> 
Add Stuff
function addCode() { 
        document.getElementById("add_to_me").innerHTML += 
        "<h1>What is Lorem Ipsum?</h1>" + generate();

}

function generate() {
var output = "<p>";
for (var i = 0; i < (50 + Math.random() * 1000); i++) {
    for (var j = 0; j < Math.floor(1 + Math.random() * 13); j++) {
        var char = 65 + (Math.random() * 26);
        output += String.fromCharCode(char);
    }
    switch (Math.floor(Math.random() * 8)) {
        case 0:
            output += ". ";
            break;
        case 1:
            output += ", ";
            break;
        default:
            output += " ";
            break;
    }
}
if (output.substring(output.length - 1, output.length) == " ") {
    output = output.slice(0, -1);
    var l = output.substring(output.length - 1, output.length);
    if(l == ","){
        output = output.slice(0, -1);
    }else if(l == "."){
        output += "";
    }else{
        output += "."
    }
};
output += "</p>";

return output; }




How to select date from bootstrap datepicker with python selenium webdriver?

I'm creating a python automation script to make the online class from a website, as my parents are the teacher so it will help them. I have created the code to login with credentials and go to the right menu, selecting the class, chapter and subject. I'm stuck in selecting the date. When I click in the date option a calendar pops out that's it. I have no idea how to select a date.

There is just this element in HTML for the date menu:

<input name="ctl00$mainContent$txtClassDate" type="date" id="txtClassDate" class="input-group-field TopFont" min="2020-09-27">

Here's my whole code:

from selenium import webdriver
from time import sleep

Input_user = input('User Mobile Number: ')
Input_passwd = input('User Password: ')
Input_class = int(input('Class (Write in digit): '))
while Input_class not in (3, 4, 5):
    print('You only teach classes from 3 to 5, so write 3,4 or 5.')
    Input_class = int(input('Class (Write in digit): '))
Input_chapter = int(input('Chapter Number: '))
while Input_chapter not in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16):
    print('Please select chapter number from 1 to 16')
    Input_chapter = int(input('Chapter Number: '))
Input_time = input('Time hhmmPM/AM: ')

browser = webdriver.Firefox()
browser.get('https://cgschool.in')
browser.maximize_window()

# User field
user = browser.find_element_by_xpath('//*[@id="txtuserid"]').send_keys(Input_user)
sleep(3)

# Password field
passwd = browser.find_element_by_xpath('//*[@id="txtpassword"]').send_keys(Input_passwd)
sleep(3)

try:
    # Login
    login = browser.find_element_by_xpath('//*[@id="btnlogin"]').click()

    # Menu bar
    menu = browser.find_element_by_xpath('/html/body/form/div[3]/div/div[3]/div[1]/div/input').click()
    sleep(3)

    # Teacher's work option under menu
    teacherswork = browser.find_element_by_xpath('/html/body/form/div[3]/div/div[1]/div/ul/li[2]/a').click()
    sleep(3)

    # Online class option under teacher's work 
    onlineclass = browser.find_element_by_xpath('/html/body/form/div[3]/div/div[1]/div/ul/li[2]/ul/li[10]/a').click()
    sleep(3)

    # Selecting class
    kaksha = browser.find_element_by_xpath('//*[@id="ddlClass"]').click()

    if Input_class == int('3'):
        class_3 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[1]/option[4]').click()
        sleep(3)

    elif Input_class == int('4'):
        class_4 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[1]/option[5]').click()
        sleep(3)

    elif Input_class == int('5'):
        class_5 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[1]/option[6]').click()
        sleep(3)


    # Subject field
    subject = browser.find_element_by_xpath('//*[@id="ddlSubject"]').click()
    sleep(3)

    # Selecting english subject
    english = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[2]/option[3]').click()
    sleep(2)
    
    # Chapter field
    chapter = browser.find_element_by_xpath('//*[@id="ddlChapter"]').click()
    sleep(2)

    if Input_chapter == int('1'):
        chap_1 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[2]').click()

    elif Input_chapter == int('2'):
        chap_2 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[3]').click()

    elif Input_chapter == int('3'):
        chap_3 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[4]').click()

    elif Input_chapter == int('4'):
        chap_4 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[5]').click()

    elif Input_chapter == int('5'):
        chap_5 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[6]').click()

    elif Input_chapter == int('6'):
        chap_6 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[7]').click()

    elif Input_chapter == int('7'):
        chap_7 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[8]').click()

    elif Input_chapter == int('8'):
        chap_8 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[9]').click()

    elif Input_chapter == int('9'):
        chap_9 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[10]').click()

    elif Input_chapter == int('10'):
        chap_10 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[11]').click()

    elif Input_chapter == int('11'):
        chap_11 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[12]').click()

    elif Input_chapter == int('12'):
        chap_12 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[13]').click()

    elif Input_chapter == int('13'):
        chap_5 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[14]').click()

    elif Input_chapter == int('14'):
        chap_13 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[15]').click()

    elif Input_chapter == int('15'):
        chap_14 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[16]').click()

    elif Input_chapter == int('16'):
        chap_15 = browser.find_element_by_xpath('/html/body/form/div[4]/div[1]/div[3]/select[3]/option[17]').click()

except:
    print('Something went wrong, please rerun or check your credentials')



How to test and exploit LFI vulnerabilities

I am looking for removing false positives while testing LFI vulnerabilities using automatic scanners like LFISuite.Any tools and tips that we can use to test for LFI vulnerabilities in endpoints like:

https://example.com/profile?p=FUZZ

https://example.com/index.html?file=FUZZ

Methodology i uses

  1. First try to find endpoints that can have potential LFI vulnerabiliites using tools like assetfinder and gf-patterns
  2. Second then using LFI Scanners like LFISuite or Burp Intruder to checki for http response code 200 when file is replaced with /etc/passwd or similar payloads 3.But even if the http response is 200 the result is often some code getting exposed rather than the contents of root directory that can be exploited to get shell or reverse shell.

Looking for some method or tool different from above to try to find LFI vulnerabilities.Any pointers in terms of pdfs, urls, youtube videos will be of great help.

Thanks




Download latest file by name and date with wget&curl? [closed]

Is it possible to download the last file by the upload date and its name using wget or curl?




Downloading a file with html anchor tag fails for "Failed - No file"

When trying to add <a href="/someUrl" download="amr.amr">Download</a>, I get "Failed - No file": enter image description here

But when I just get the file content with axios library and the exactly same url(axios.get('/someUrl')), I get a valid file stream with response headers:

HTTP/1.1 200 OK
X-Powered-By: Express
content-type: application/octet-stream
content-length: 317094
vary: Cookie
server: Werkzeug/1.0.1 Python/3.7.5
date: Sun, 27 Sep 2020 12:17:53 GMT
connection: keep-alive

What can be the source of the problem? And how can I debug the anchor tag download part?




how to link pages to a menu navigation in Wordpress

I'm building a WordPress website and I would like to know how I can link the menu with pages. in the beginning, I built the menu but after clicking on the contents of the menu my pages don't redirect to the destination page. how I can fix it?




How to create users and works URIs in FIREBASE WEB?

I have a huge problem, I have this application developed with firebase in javascript, HTML, CSS, it works kinda like LinkedIn (it's kind of a social network) and its purpose is to collect users information and jobs.

My problem now is to create a specific URI for each user and each job in order to make every element unique and reachable from a specific link. I'd like to have a pattern like:

https://myproj.com/users/john-doe for users https://myproj.com/jobs/developer for jobs

So if anyone wants to share his profile or his work, he is able to do it by that link.

The project is not a single page application, I would like to have different pages to handle both works and users info. I'm currently using firebase hosting and there is something but nothing fits my case, don't know about dynamic links but they don't look helpful. I'm really getting kind of desperate, I couldn't find ANYTHING in the web




How to inspect elements on an android device

Is there any way to inspect a website on android device. I'm not asking about Ctrl+U or view-source:https://blabla.com/, I'm asking about Ctrl+Shift+I.




Public Apache Web Server on Raspberry PI

I would like to host a PUBLIC apache web server on my Raspberry Pi running Apache2 installed. I would like to point my current domain at it, but the "public ip" of the server doesn't load the apache server? I have done all the port forwarding?

Can anyone take me through in steps explaining how I can do the sentence in bold.

Thank you - I do need to know very soon however, sorry for the rush.




Best way to make Website Work with android app?

So, I am finishing my Workout Website, and I would like to make it work on Android,and IOS, as an app. What is the best way to make it work? What programming app, and language should I learn?




Docusaurus - Input text and using it

I'm totally new to docusaurus and reactjs, to put this in context, I am building a website using docusaurus, it's about Spanish language learning so I would like people to input an entry and depending on the answer the text field gets green or red, I used <input type="text"> for the button but couldn't anything using js script inside the markdown file. I just want to learn




samedi 26 septembre 2020

Angular application not showing data

I am fetching data from my backend Spring Boot API using Angular, but it is not displaying data in the web page, there is no error in the console and nor in the Spring Boot App, Spring Boot works fine separately. I don't see any error here and I don't know what's causing this, anyone help me out here.

this is my app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { ProductService } from './services/product.service';

import { AppComponent } from './app.component';
import { ProductListComponent } from './componentes/product-list/product-list.component';

@NgModule({
  declarations: [
    AppComponent,
    ProductListComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule
  ],
  providers: [ProductService],
  bootstrap: [AppComponent]
})
export class AppModule { }

this is my product.service.ts

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Product } from '../common/product';
import { map } from 'rxjs/operators';

@Injectable({
  providedIn: 'root',
})
export class ProductService {
  private baseUrl = 'http://localhost:8080/api/products';

  constructor(private httpClient: HttpClient) {}

  getProductList(): Observable<Product[]> {
    return this.httpClient
      .get<GetResponse>(this.baseUrl)
      .pipe(map((response) => response._embedded.products));
  }
}

interface GetResponse {
  _embedded: {
    products: Product[];
  };
}

and this is my product-list.component.ts

import { Component, OnInit } from '@angular/core';
import { Product } from 'src/app/common/product';
import { ProductService } from 'src/app/services/product.service';

@Component({
  selector: 'app-product-list',
  templateUrl: './product-list.component.html',
  styleUrls: ['./product-list.component.css'],
})
export class ProductListComponent implements OnInit {
  products: Product[];
  constructor(private productListService: ProductService) {}

  ngOnInit(): void {
    this.listProducts();
  }

  listProducts() {
    this.productListService.getProductList().subscribe((data) => {
      this.products = data;
    });
  }
}

and it is above component's html file

<p *ngFor="let tempProduct of products">
  : 
</p>



It's 2020, any good ways to produce a pdf from a webpage? [closed]

The question is in the title, I have a page that is stylized with CSS and I want to produce a PDF from it. Ideally via client-side javascript, but I'm open to backend solutions as well.




Oracle Apex 20.1: responsive web application - device independent

can we build a responsive web application which can be device independent? means same web application run on computer, tablet, mobile. please help to guide or some link(s) for the same on step-by-step how to, and/or refer a book available in pdf.




How do file storage websites know if 30 seconds etc have passed between downloading 2 files?

How do file storage websites know if 30 seconds or 1 min etc have passed when someone wants to download a file? Often you get a message that you should wait for 30 sec etc. Do they store it on our website or is it on done on their server-side?

Thank you!




Chrome Extensions "chrome.storage.local" data updating trouble

I am working on one chrome extension and i need to use local storage to send data from options page to background scritps.

Options page script:

function addToStorage(key, val){
    let obj = {};
    obj[key] = val;

    chrome.storage.local.set( obj, function() {
      if(chrome.runtime.lastError) {
        console.error(
          "Error setting " + key + " to " + JSON.stringify(val) +
          ": " + chrome.runtime.lastError.message
        );
      }
    });
}

Background:

chrome.storage.local.get('code', function(code) {
    ... with code.code ...
});

For example: Now chrome.storage.local code value is abcd
I'm performing addToStorage('code', '1234') from options page script
After that in background script value code only will change when i manually click "update" at chrome extesions page

How can i automatically get actual data at background script?




Azure CDN not updating?

I am new to Azure and I have hosted my personal static website in BLOB storage and served through Azure CDN to my domain. I have my CNAME pointing to my Azure CDN endpoint. However, when I access the endpoint which the CNAME is pointing to, my website is updated, but if I went to the domain, it is now. Any ideas? This did not use to happen.

What other information should I add to help with answering this question?




How to Host MVC .net app with a database? [closed]

I would like to know how I could publish a .net mvc project using localDb and Entityframework in my web host.




How to create a sticky left card in react?

I'm new to react. I need to create a sticky card on left of the browser. I need the card as in designed below. enter image description here

That white is the sticky left card. Please help me with this. I don't know how to start. Else suggest me some docs. I searched all over but I can't find what I'm looking for.




How to find a specific file's code in a website with a broken git commit?

For a challenge I found that I was able to download files off of /.git/ After using the tools from GitTools I soon realised that my goal was to get to read config.inc.php file. But the problem is, I got index.php extracted but not config.inc.php after extracting using GitTools. Am I missing something? Kindly please guide me in the right direction.




About DNS resolve domain

Recently,I got a VPS from Vultr, try to building a blog websites for myself,that blog base wordpress,but i'm a rookie haha,never did this before so, This is probably the case:I followed the online tutorial,buy a vps from vultr,and buy a domian from dynadot,and follow the instruction complete setup. But i still can't connect my blog website. enter image description here

i wish someone can help this




Query params changing the history and bugging the back behavior

My applicant persists a lot of filters on the URL query params. The problem that I'm struggling with is that every query param added to the URL creates a new history.

So if I try to go back from that URL with history.goBack:

http://localhost:4001/applicants?jobId=1&orderBy=applied_at&page=1&status=%5B%22AWAITING_REVIEW%22%2C%22CLAIMED%22%2C%22CONTACTED_LEFT_MESSAGE%22%2C%22INTERVIEW_SCHEDULED%22%2C%22OFFER_MADE%22%5D

Instead of going to the previous page, I'll go to:

http://localhost:4001/applicants?jobId=1&orderBy=applied_at&page=1

Gif showing the behavior:

enter image description here

I know that there must be a lot of applications that persist values via query params and I would like to understand how to deal with the history.goBack when having query params on the URL.




Is it possible to define which device is "simulated" in a Windows forms app using code in visual studio?

i am currently working on a project and i have hit a wall, hoping someone else may know what steps to take. I am building an application and i want to load up a web browser from the toolbox in visual studio, and then add code so that the web page loads up a mobile version of a website, effectively enumerating the page served to something like an iphone.

T.I.A




Rename files while being uploaded in Flask?

I have a form on which people can upload multiple files:

class MyForm(FlaskForm):
    pictures=MultipleFileField('Upload', validators=[FileAllowed(['jpg','jpeg']), DataRequired()])
    submit=SubmitField("Submit")

But the order of files is important for my program. I want Python to rename them while they're being uploaded one by one.

I thought of renaming them according to the exact time they're uploaded. So I created this function in my views.py:

def saverename(picture):
    dateTimeObj = datetime.now()
    order = os.path.join(str(dateTimeObj.month) + 
                            str(dateTimeObj.hour) +
                            str(dateTimeObj.microsecond))
    path = os.path.join(app.root_path, 'inferfiles', current_user.username.replace(" ", "_"))
    picture_name, _ext = os.path.splitext(picture.filename)
    picture_name = order
    picture_path = os.path.join(path, picture_name)
    picture_full = picture_path + _ext
    picture = Image.open(picture)
    picture = picture.resize([900, 1300])
    picture.save(picture_full, quality=80)

But the problem is, microseconds sometimes writes 5 digits instead of 6 digits and this destroyes the whole process of ordering the files by their date.

I could use something like this:

Picture-001
Picture-002
Picture-003
Picture-004
Picture-005

But I have no idea how to create this in views.py. Because I fear that when lots of people use the program, maybe the counter wouldn't reset since the counter is in views.py (sorry if it's a silly thing to worry, I'm new). I hope I've explained it clearly.

Therefore I'm open to any recommendations, I would be much grateful for anybody who could help me on this.

Thank you very much in advance.




Which is the easiest Programming Language to create a website?

PHP, ASP.NET, Python, Flutter or anything else? And what is the differences between website and portal? This year, I try to create a portal using PHP. But what is your answer? Any good reesources about portal? Thank you.




Converting RTMP stream to Mp4 for showing in the web browser

I need to convert an RTMP Stream to an Mp4 file, i've tried using VLC Transcoding but it's not working!




How to create a document with user 'uid' in Firebase firestore

I am trying to create a document with an id that of the user as he signs up

this is the function which runs when user signs up ->

const register = (e) => {
    e.preventDefault();

    auth
      .createUserWithEmailAndPassword(email, password)
      .then((auth) => {
        if (auth) {
          db.collection("users").add({
            email: email,
            password: password,
          });

          history.push("/");
        }
      })
      .catch((error) => alert(error.message));
  };

Can anyone help me with how do I pass the .doc reference to accomplish this?




vendredi 25 septembre 2020

How can I get geeksforgeeks python pdf?

I am looking for geeksforgeeks python pdf which covers all the articles of python. If PDF is not available, how can I scrap it using beautiful soup ?




Odoo SEO search result

How to make SEO for Odoo website?

Hi guys, it is my first making SEO as well as Odoo website. I have already followed all instruction from Odoo website documentations for SEO yet still it doesn't appear on google. Any tips please? I have also connected with google webmaster, I can track everything for website.

Thanks.




Can someone please explain this interview question. I am new to MySQL and Apache

"Can you provide an example of when you would need to configure a component of a web-application stack like MySQL or Apache?" (Interview Question). I am not understanding this question fully. I am new to MySQL and Apache.




catch all URLs in [...slug] and only create static props for valid addresses in Next.js

I'm using dynamic routes and using fallback:true option to be able to accept newly created pages

first i check if parameters is true then i create related props and show the component with that props. In console i can also see that next.js create new json file for that related page to not go to server again for the next requests to the same page.

But even I type wrong address next create new json file for that path. It means that next.js create json file for every wrong path request.

How can avoid that vulnerable approach?

export const getStaticProps: GetStaticProps = async ({ params }) => {
  if (params.slug[0] === "validurl") {
    const { products } = await fetcher(xx);
    const { categories } = await fetcher(xx);
    return { props: { categories, products } };
  } else {
    return { props: {} };
  }
};

const Home = (props: any) => {
  if (!props) {
    return <div>404</div>;
  }
  return (
    <MainLayout {...props}>
      <FlowItems items={props.products} />
    </MainLayout>
  );
};



How do you make a drop list in HTML?

enter image description here

I have searched for how to do this everywhere but all I am getting is how to make lists that are open and cannot be closed and dropped down, rather always there. Please help :) thank you in advance




How to make Shopify webshop multilingual?

We googled this problem to find out most new and trendy, relaible and feisible solution but became more comfused so came here with big hope.

We have a webshop based on Shopify and want to make it multilingual. We tried some apps but they didn't give us the result as we want. So, we think, we need to make it manually. We have this criteria:

  1. Most of our pages are static. We are using Shopify for every thing but are ready to change and use API only for the ecommerce services, if needed.
  2. Our non-technical marketing personnel has to add his contents for all language without much hassle. Possibly, adding content in one place and it goes to relavent language pages.
  3. Our Spanish domain is es.example.com, German is de.example.com ..... When our visiter type www.example.com in his browser, we want to redirect our visitors to local domain based on their IP location using Java Script. But also give option to choose the language.

We know for some members, this may not be problem asked in this platform, but we believe other members will definately understand our dilemma.




Does BOM (Browser object model) in JavaScript has pre-defined class for it? Because every object is an instance of a class right

My question is does BOM (Browser object model) has per-defined classes, I am asking this because every object is an instance of a class right.




How to download latest file from ftp?

In ftp (example ftp://domain/files/) there are files with the name, by the date of creation, of the form "music-2020-09-21.zip", "films-2020-04-15.zip". How to download the last added "music.zip" file?




How can I make my header pic on my website responsive?

My header pic looks blurry when I resize the screen so how can I make it responsive?

.headerpic {
  width: 100%;
  max-width: 100%;
  height: auto;
  opacity: 0.8;
  webkit-transform: scaleX(-1);
  transform: scaleX(-1);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center;
  -moz-background-size: cover;
  -webkit-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  margin: 0 auto;
  max-height: 300px;
}
<div class="header">
  <img class="headerpic" src="images/header.jpg" alt="English header" sizes="(max-width: 480px) 100vw">
  <div class="title">
    <h1>English</h1>
  </div>
</div>



hosting websites on your site

I have website and domain on GoDaddy I want to make my website a hosting server, how? I want to provide 3 plans one of them free for students with a free subdomain from my domain, how?




How to statically serve a single page web app?

What is the correct logic for statically serving a single page web app? It seems to me that any path with no extension should go to index.html and any path with an extension should be served up as-is (assumed to be a file in the directory)?

I was surprised that I couldn't find clear best-practice for this online. Perhaps I'm missing something obvious.

Note - my implicit assumption here is that the majority of singe page app framework implementations behave similarly enough that the server's static rules can be agnostic (angular, yew, etc). If this assumption is totally wrong that would be interesting to know as well.