mardi 30 juin 2020

How to optimize/structure a website with 100+ static pages?

I wanted to design a content based website where each content has its own UI uniquely designed. For normal content based sites, the image location and text is stored in the CMS and loaded into a generic layout. But in this case, we are going with individual layouts and UX for each content. Every content is a uniquely designed static page. In such a case after a point once the content crosses 100+ pages, the website will become too heavy. Sticking to dynamic pages isnt a solution because they concept revolves around: Content Uniquely Crafted. How to approach such a problem?

Most websites with unique UI that I've seen as of now are product based websites like Apple where they uniquely design the webpage for each of their products. That is at max 6-7 pages and wont cause the website to become very heavy. But in this case, I am looking for an option to scale this because with more content there will be webpages added to the site and it will cause the site to be very heavy and slow.




The type Part is ambiguous

I'm working on small project where I'm trying to dd profile so the user can upload his profile pic so while I was searching for references I found some Youtube videos and I started coding and I want to link the image which user uploaded as his profile image. There I'm getting the error "The type Part is ambiguous"(in jsp)

<%@page 
 import="java.sql.*,java.text.*,javax.servlet.*,java.security.MessageDigest,
   java.security.NoSuchAlgorithmException 
      ,javax.mail.*,javax.mail.internet.*,
       java.io.File,java.io.PrintWriter,java.awt.List"%> 

     <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
    <%!
    %>
    <%
    String username=(String) session.getAttribute("nkey");
    String f_name =request.getParameter("f_name");
    String l_name =request.getParameter("l_name");

    Part part =request.getPart("profile_link");(here I'm getting the issue)
    String id_link =request.getParameter("id_link");
    String age =request.getParameter("age");
    String gender =request.getParameter("gender");
    String address =request.getParameter("address");
    String pincode =request.getParameter("pincode");
    String qualification =request.getParameter("qualification");
    String year =request.getParameter("year");
    String college_name =request.getParameter("college_name");
    String state =request.getParameter("state");
    String country =request.getParameter("country");
    %>
    <%!
    private static final String SAVE_DIR="Pictures";
    %>
    <%response.setContentType("text/html;charset=UTF-8");%>
    <% 
    PrintWriter outt=response.getWriter();
    String savePath="C:/Users/thots/Desktop/My World/internsip/Student_Portal 2.0/WebContent"+File.separator+SAVE_DIR;
    File fileSaveDir=new File(savePath);

    String fileName=extractFileName(part);
    
    part.write(savePath + File.separator + fileName);
    
    String filePath=savePath+File.separator + fileName;     
    %>
    <%
    try 
    {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Student_Portal 2.0","root","");
        Statement st=con.createStatement();
        int i=st.executeUpdate("insert into student_details values('"+username+"','"+f_name+"','"+l_name+"','"+filePath+"','"+id_link+"','"+age+"','"+gender+"','"+address+"','"+pincode+"','"+qualification+"','"+year+"','"+college_name+"','"+state+"','"+country+"')");
        if(i>0)
        {
            response.sendRedirect("index.jsp");
            Statement stt=con.createStatement();
            String sql="update user_login set P_Status='1' where username='"+username+"'";
            stt.executeUpdate(sql);
        }
        else
        {
            System.out.println("Failed");
        }

    } 
    catch (Exception e) 
    {
        e.printStackTrace();
    }
    %>

Html code

<form action="add_student_details.jsp" enctype="multipart/form-data" method="post">
                        <div class="container-fluid">
                            <div>
                                    <label for="img">Upload Profile Picture</label>
                                     <input name="profile_link" type="file" class="form-control" required>
                            </div>
                            <br>
                            <div>
                                    <label for="img">Upload Your ID card</label>
                                    <input name="id_link" type="file" class="form-control" required>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-6">
                                     <input name="f_name" type="text" class="form-control" placeholder="First name" required>
                                </div>
                                <div class="col-6">
                                    <input name="l_name" type="text" class="form-control" placeholder="Last name" required>
                                </div>
                            </div>
                            <br>
                            <div class="row">
                                <div class="col-6">
                                     <input name="age" type="number" class="form-control" placeholder="Age" required>
                                </div>
                                <div class="col-6">
                                      <select name="gender" class="form-control" required>
                                        <option>Male</option>
                                        <option >Female</option>
                                      </select>
                                </div>
                            </div>
                            <br>
                            <div>
                                <textarea name="address" rows="4" cols="55" placeholder="Your Address" id="w3review" required></textarea>
                            </div>
                            <br>
                            <div>
                                <input name="pincode" type="number" class="form-control" placeholder="Pincode" required>
                            </div>
                        </div>  
                        <br>
                        <hr>
                        <div class="modal-body">
                         <h4>Educational Info</h4>
                        </div>
                        <div class="container-fluid">
                            <div class="row">
                                    <div class="col-6">
                                          <select name="qualification" class="form-control" required>
                                          <option selected disabled>Select Your Qualification</option>
                                            <option>B.Tech</option>
                                            <option >B.E</option>
                                          </select>
                                    </div>
                                    <div class="col-6">
                                          <select name="year" class="form-control" required>
                                          <option selected disabled>Select Your Year</option>
                                            <option>I</option>
                                            <option >II</option>
                                            <option>III</option>
                                            <option >IV</option>
                                          </select>
                                    </div>
                                </div>
                                <br>
                                <div >
                                          <select name="college_name" class="form-control" required>
                                          <option selected disabled>Select Your College</option>
                                            <option>ABCD College Of Engineering And Technology</option>
                                            <option >XYZ College Of Engineering And Technology</option>
                                          </select>
                                </div>
                                <br>
                                <div class="row">
                                    <div class="col-6">
                                          <select name="state" class="form-control" required>
                                          <option selected disabled>Select Your State</option>
                                            <option>Telangana</option>
                                            <option >Kerala</option>
                                          </select>
                                    </div>
                                    <div class="col-6">
                                          <select name="country" class="form-control" required>
                                          <option selected disabled>Select Your Country</option>
                                            <option>India</option>
                                            <option>United States</option>
                                          </select>
                                    </div>
                                </div>
                                <br>
                                <hr>
                                <center>
                                <button type="submit" class="submit-btn">Submit</button>
                                </center>
                            </div>
                            <br>
                       </form>

Sorry for sharing the whole code. i tried multiple ways but none worked for me someone please help me Thank you.




What is the proper way to thread tornado+flask app?

I made a web app with flask and ran it with flask's own web server with parameter 'threaded=True'. It worked perfectly.

app.run(host='0.0.0.0', port=5000, threaded=True)

But sooner I've found that it's only suitable for dev environment, so I decided to use 'tornado'. But it doesn't work concurrently.

http_server = HTTPServer(WSGIContainer(app))
http_server.listen(5000)
IOLoop.instance().start()

Is there any parameter like 'threaded=True' of flask to thread? Or should I do it manually? If so, what is the proper way to do it?




How to get rid of error in Xampp while opening phpmyadmin

I am using Xampp that has phpmyadmin. When I try to open phpmyadmin I get this error:

mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)

In my config file the password is "" so nothing basically.

I have added the screenshot as well for the error. How can I fix it? I tried all the other answer of SO but nothing worked for me. enter image description here




Ant Design Collapse - close on button

I'm a beginner user of Ant Design and I've encountered this problem while using Collapse and Form from Ant Design library.

I've set up my page where the form to add new items is in the collapse and there is a list of items below the Collapse.

<Collapse>
  <Panel header="Add New"> 
     <Form />
  </Panel>
<Collapse>
<List/>

The item is successfully added to the list outside of the collapse, but the user has to close the collapse by pressing on the panel header. I want the collapse to close automatically when they press the submit button on the form inside Collapse.

Is there any way to make this happen?

Thank you in advance.




I will be able to recover data from the operating system from the website? [closed]

// Create the file.
    using (FileStream fs = File.Create(filePath))
    {
        Byte[] info = new UTF8Encoding(true).GetBytes("This is some text in the file.");
        // Add some information to the file.
        fs.Write(info, 0, info.Length);
    }

Eeu gostaria de saber como pegar algo do sistema apartir de um website




I must install django for every single project i make?

i am new to Python programming language and Django. I am learning about web development with Django, however, each time I create a new project in PyCharm, it doesn´t recognize django module, so i have to install it again. Is this normal? Because i´ve installed django like 5 times. It doesn´t seem correct to me, there must be a way to install Django once and for all and not have the necessity of using 'pip install django' for each new project I create, I am sure there must be a way but I totally ignore it, I think I have to add django to path but I really don´t know how (just guessing). I will be thankful if anyone can help me :)




Why is font-size different on iOS Chrome v. iOS Safari?

I'm working on a responsive website and when checking it on my iPhone (iOS 13, June 2020) I found that the font size was different between Safari and Chrome.

I tried several things to account for it, but had trouble finding the cause.

I suspected it was related to some CSS I had from long ago: -webkit-text-size-adjust: 100%; Removing and changing this value had no effect on the difference though, so it was a red herring.

What would cause a discrepancy between the rendering of the same site and CSS on these two apps?




How to add call schedule functionality iin django python?

I am new to python. I am developing a website in django framework. I have to add a "scheduling a call" functionality in my website in which the user can book a call (name, email, date and time) and also can see the booked slots in calender. I do not know how to do this nor i am able to find anything like this on the internet. Can anyone here help me for it?




Q: How te get your session cookie from Discord (.exe) using JS or a Tool/Software

My question is asked above ↑. Feel free to answer me, thx in advance.




Modbus Web Server

I need to create an alarm manager that exchanges data with a PLC using Modbus TCP protocol. the PLC should only pass the values off some variables. I have already the html,css and javascript component but don't know how to connect the plc to show the web page. Do you have some advice or some tool to help me ?




The speed of Tezgah arası cam website is high, but the ranking has dropped

Tezgah arası cam, I have applied all the seo methods, but the pagespeed values ​​are very good but the ranking has shifted 2-3 pages back. why could it be?




Controlling volume of active tab in chrome

Working on a chrome extension and I want to control to audio of the active tab.

Currently this is what I have

let audioStates = {};
window.audioStates = audioStates;
const connectStream = (tabId, stream) => {
  const audioContext = new window.AudioContext();
  const source = audioContext.createMediaStreamSource(stream);
  const gainNode = audioContext.createGain();
  source.connect(gainNode),
    gainNode.connect(audioContext.destination),
    (audioStates[tabId] = {
      audioContext: audioContext,
      gainNode: gainNode,
    });
};
const setGain = (tabId, level, state) => {
  if (state === 'down') {
    audioStates[tabId].gainNode.gain.value =
      audioStates[tabId].gainNode.gain.value * level;
  } else if (state === 'up') {
    audioStates[tabId].gainNode.gain.value =
      audioStates[tabId].gainNode.gain.value / level;
  }
};

chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        const tab = tabs[0];

        const url = new URL(tab.url);
        activeTab = url.hostname;
        activeTabId = tab.id;
      });

      chrome.tabCapture.capture(
        {
          audio: true,
          video: false,
        },
        (stream) => {
          if (chrome.runtime.lastError) {
            return;
          } else {
            console.log(audioStates);
            connectStream(activeTabId, stream);
            setGain(activeTabId, 0.1, 'down');
          }
        }
      );

I store every tab where the volume is called to be raised and lowered. And use setGain to lower and raise the gain depending on the state, .i.e. up and down.

Is there a simpler way to do this? Storing the tabs feels unnecessary.




Why my background-image isn't showing in the browser? please help me [duplicate]

enter image description here

My image isn't showing in the browser please help me. My html document is preety stright forward but the image is not showing. I have placed the image inside a folder named image. I have tried same code in another folder it worked but in this particular folder it isn't showing anything. what should i do.

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-decoration: none;
}

body {
  background-image: url("https://via.placeholder.com/150");
  background-position: center;
  background-size: auto;
  background-repeat: no-repeat;
}

.logopic {
  width: 4em;
}

#container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 80%;
  margin: 15px auto;
}

.list-item-ul {
  list-style: none;
  margin: 0em 2em 0em 0em;
}

.list-item-li {
  text-decoration: none;
  display: inline-block;
  background: rgb(186, 178, 117);
  padding: 0.20em 0.50em 0.20em 0.50em;
  margin: 0em 1em 0em 1em;
}

li a {
  color: white;
}
<!DOCTYPE html>
<html>

<head>
  <title>
    Responsive Web Three
  </title>
  <link rel="icon" type="image/png" href="image/logo.png">
  <link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body>
  <header id = "container" id="topheader">
    <img src="https://via.placeholder.com/150" alt="logo" class="logopic">
    <nav class="list-item-nav">
      <ul class="list-item-ul">
        <li class="list-item-li"><a href="">home</a></li>
        <li class="list-item-li"><a href="">About us</a></li>
        <li class="list-item-li"><a href="">Services</a></li>
        <li class="list-item-li"><a href="">Portofolio</a></li>
      </ul>
    </nav>
  </header>

</body>

</html>



Tools to check for web session is valid

Are there any tools to test if the web session is still valid after logout?

Are there tools where maybe I could take the cookies (JSESSIONID) then use the tool to execute the Java code to see if I can still get any response.




Setting browser/os restrictions on Django

I’m new to django programming, not python, and could do with a hand.

I am attempting to make a website exclusive to a certain device. I have created a disallow page accessible by ‘/disallow/’. How do I go about running os/browser checks that then redirect in the event the os/browser is not on the verified list.

I know the information I am wanting to check will be in the request and I can use

request.META['HTTP_USER_AGENT']

However where do I write any logic required and how could I apply this to any page the user tries to access.

Any help would really be appreciated Ed




Spring Session expired - Get / Post behaves differently

I have a Spring boot 2.1.x web application with session configured to be expired after X minutes. I have an expired session page which I want to take users to when session expires. To do that, I use the following codes.

Spring security config:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
  // some other code
 
  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
        .anyRequest()
        .permitAll()
        .and()
        .sessionManagement()
        .invalidSessionStrategy(new MyInvalidSessionStrategy());
  }
  
  private static class MyInvalidSessionStrategy implements InvalidSessionStrategy {
    @Override
    public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException {
      if (request.getSession(false) == null) { // IMPORTANT: retrieve session
        request.getSession(true);
        response.sendRedirect("/"); // home page
      } else {
        response.sendRedirect(Mappings.URL_EXPIRED_SESSION); // expired session page
      }
    }
  }
}

When a session expires, a user can have 2 possible actions: (i) Refresh current page (or Back button) and ii) Submit a form on current page

For the i) situation, user's action causes a GET request and the session is returned as null and user is taken to home page.

For the ii) situation, user's action causes a POST request and the session is found (although expired) and user is taken to the expired page.

My question is why it is behaving this way. i.e. why session is null when GET.




Browser Not setting the cookies for fetch api deployed on aws cloudfront

So I am making a request from https://demos.thedomain.com to https://api.thedomain.com with fetch options as:

fetch('https://api.thedomain.com', {
  "body": {"username":"me@asdf.in","password":"qwerty"}",
  "credentials": "same-origin",
  "method": "POST",
  "headers": {
    "Accept": "application/json",
    "Content-Type": "application/json"
  }
})

and the response is:

enter image description here

And the browser doesn't set the cookies. Does anyone knows why this is happening ? The reason I put cloudfront's name in the question is because if I deploy the (exactly same)build to firebase and point route 53 to it, it works perfectly but when I deploy it to S3 for cloudfront and repoint using cloudfront CNAME it fails to set the cookies. I have tried setting secure: true,false both. If any more details is required, just ask.




What kind of element in a web page can be set focus?

Maybe the following question is stupid:-), it will bring me negateive votes.

I want to set focus for element specified in a web page. But I found that it seems that not all element in the page can be set successly(It make sense compare with desktop application's element).

so, What kind of element in a web page can be set focus?




How can I block trackers from my website?

The Situation

I am making a website that will go public. I have to integrate ads if I want to make a revenue.

I am against tracking. I am aware there are tracker blocking tools for browsers, but not everyone has one.

The Question

Is there anyway I can show ads, make a revenue, while blocking all trackers?

The Holy Grail

If there are trackers coming from other websites, I'd like to block them as well.




List is accepting only one comment

I was passing customizable comments for Instagram. I was writing the following Code:

def comment(username,comment) :
    driver.get(f"https://www.instagram.com/{username}/")
    time.sleep(5)

    for i in range(7):
        driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")

    href_found = driver.find_elements_by_tag_name("a")
    pic_href = [ele.get_attribute('href') for ele in href_found if '.com/p' in ele.get_attribute('href')]

    #comment = ["Nice Work"]

    for ele in pic_href:
        driver.get(ele)
        time.sleep(3)


        driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")

        commentbox = lambda: driver.find_element_by_xpath("/html/body/div[1]/section/main/div/div[1]/article/div[2]/section[3]/div/form/textarea")
        commentbox().click()
        commentbox().clear()


        for i in comment:
            commentbox().send_keys(i)
            time.sleep(random.randint(1,7)/30)

        commentbox().send_keys(Keys.ENTER)


if __name__ == "__main__":
    login("<id>","<password>")
    desire_user = input("Enter Instagram Username to Comment: ")
    comm = [x for x in input("Enter comments").split(",")]
    for i in comm:
        comment(desire_user,i)

The idea is to create a list of comments and enter one comment per post. For example: passing the first comment for the first post and then next comment for the next post and so on.

Can anyone please help me with the following script.




What language is on this picture?

And a little insight in code would be very appreciated. What language is this?




lundi 29 juin 2020

Can unilateral attribute be set InputDecoration in the flutter

Can the InputDecoration attribute flutter set the style of the input field with one side instead of four sides? I just want the bottom to workenter image description here




how to remove .php extension from the website url using .htaccess or another way

Hello developers i need to remove .php extension from my website url. I tried lots of codes but cant do it. Can you please help me to solve it out. I used .htaccess in following way -

#remove php file extension-e.g. https://example.com/file.php will become https://example.com/file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
enter code hereRewriteRule ^(.*)$ $1.php [NC,L]



How to display playstore reviews on a website?

I would like to display reviews of an app on a website. Is it possible? I tried to search it but couldn't find any proper resource to do it.




Serve Flask application with GUnicorn on Localhost

I am a noob in this area so please bear with my dumb questions.

I have a Flask application and I want to run that with GUnicorn on my localhost. I looked on Google but almost every tutorial requires a domain name and there isn't much documentation for running it on a mac.

  1. Please tell how can I run the app with GUnicorn on my mac?
  2. I want to use https for the secure communication so how can I change the configuration of Gunicorn to do so?

Any help will be great.

Cheers




Is there a solution for my website using asp.net?

Sorry guys! I have no expertise in websites so i have a simple question like this:"Can i change the look of this website below?". The only answer i receive from who wrote this website is "CANNOT"! And my website using these things: Microsoft ASP.NET, SweetAlert, jQuery 3.4.1, Bootstrap 4.3.1, IIS 10.0.

https://estore.viettien.com.vn/

i have searched everything on GG but i still have no answer for this.

Could you help me in this case please?




Flutter web sockets

Please does anyone know how to unicast or multicast data using flutter web sockets? I was able to broadcast data using flutter web sockets. What I need is to send some particular data to someone or some group.




What exactly is Function.prototype()? Is it a suitable default value?

In NodeJS and the browser, if you call Function.prototype(), it returns undefined.

Calling Function.prototype.toString() returns "function () { [native code] }".

Is this an empty function? Is it suitable to use in place of () => {} for defaults (e.g. default prop for React component)?




How to add images to flask website? With database or file name? Python

I'm working on this project of movie database, I made database of the movie details(Name, Rating... etc) But now I need to save the Image in somewhere I saved it in a folder but if the user is not a developer how can he access the folder? Or is there any way for me to save the Images on a database? Flask uses SQLAlchemy and you can't save images in it and if you can it's not that good. If my question is not clear please let me know.




implementing controlValueAccessor in multiple levels - Angular

i have a custom input that have more than 1 parent like:

mySimpleInputComponent -> mySpecialInputComponent

mySpecialInputComponent uses mySimpleInputComponent with some extra functionality.

since i want to use mySpecialInputComponent with a "formControlName" i implemented controlValueAccessor in both mySimpleInputComponent and mySpecialInputComponent and added in both of the components:

{
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(() => CurrentComponent),
      multi: true
}

but after adding the formControlName to mySpecialInputComponent like:

 <mySpecialInputComponent formControlName="controlName"/>

i get an error:

vendor.js:37090 ERROR NullInjectorError: R3InjectorError(theModule)
[mySimpleInputComponent -> mySimpleInputComponent -> mySimpleInputComponent -> 
mySimpleInputComponent]: 
NullInjectorError: No provider for mySimpleInputComponent!

if i remove the formControlName from the template the error disappears are the providers sure be the way i put them?




My other folders and images won't work and link with the website

This problem is really starting to bug me. So I have a folder with more folders and files in it. It looks like this, :

Game Name

-Elements

--Website

---Images

---Fonts

---Scripts

---Documents

--Game

The index.html and webstyle.css files are in the websites folder and the image I'm using is in the images folder, of course. This is what the code for it looks like, it's in the CSS file:

body {

background-image: url("/images/bg.jpg");

}

The thing is I tried checking the website to see if it worked but it didn't, I even checked to see if the image was there at all, it wasn't, and neither were any of the folders or files except for the HTML and CSS documents. This is really getting on my nerves ugh I don't know what to do. And plus I can't figure out how to make this dumb thing show the code right, so please help before I smash this laptop




what tool should I use for services section in my wordpress website page?

I have three different pages with three different our services sections so it is not good to use custom widgets for example if I have three pages each of them with three different services in service section, so what should I do? thanks




Data update time after site update

How often does Google update site data on the service https://developers.google.com/speed/pagespeed/insights/ today we optimized the site, after how long does the service display this in its report?




Different Result Mac problem or hard to reset cache

Maybe this is hard to explain but I'll give it a try.

I'm a Software Developer student who is the only one of them using a MacBook out of a project.

We are working on a web-application but there is one thing that is stopping me with working and that is that I get a different result on a page than all others of my project.

But a bug that is fixed and changed but it's like my mac still does remember the old results. I did try:

  • deleted the project and re-install it.
  • delete Eclipse and reset cache
  • using different browsers

To make it more clear: We work on a slideshow. When I open the page the topbalk is black for me (and the timer does not work) for everyone else it is blue (and it does work) but when I reset my cache I do see it will get blue. If I refresh and login on the page again, it get's black again. Like it goes back to the way my mac wants it to be.

If someone can help me with this I would be very thankful since my school won't help students using a Macbook..




Bootstrap Collapse Navbar disappearing

I've looked around but can't find a solution to this issue.

When I change the window size to it's small enough for my navbar links to be replaced by the collapse icon and when I click on the icon that brings up the links, they really quickly show up like they're meant to and then disappear...

So I click the icon, the links show up like they're meant to and then they go half a second later

Here's my navbar code

  <nav class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
  <ul class="navbar-nav">
    <li class="nav-item"><a class="nav-link" id="links" href="distance.html">Distance</a></li>
    <li class="nav-item"><a class="nav-link" id="links" href="#">Test</a></li>
    <li class="nav-item"><a class="nav-link" id="links" href="#">Test</a></li>
    <li class="nav-item"><a class="nav-link" id="links" href="#">Test</a></li>
  </ul>
</div>

I also have the following links for popper, jquery and bootstrap included at the bottom of my body tag, as well as the bootstrap css link in my head tag

  <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>

  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>

  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>

If anyone could help that'd be great!




How to convert static to dynamic website? [closed]

i am trying to develop a dynamic website where a user can control adding pages to their website and add posts to their website , is it possible and if so where can i learn to develop a website from static one to dynamic .




how to view where Google Custom Search get's it's autocomplete data from, and can you add this data automatically?

I have implemented the Google Custom Search Engine on my site and it works, however the results that it is returning within the autocomplete are very limited and not very useful. Does anyone know how to find where it is getting the data for the autocomplete functionality, and if there is a way to add to this list automatically, and not via the 'add custom autocompletions' or upload XML within the autocomplete tab on the custom search engine config dashboard. Thanks.




Conditional rendering with typescript -

When trying to conditionally render something from a datastructure, I want the element to appear if there exists a record of it in the dataset, but not if it doesnt. My attempt for this was this:

// other code...

{patient.address[0]
    ? patient.address[0].line[0]
    : null}

// other code...

This works for instances where the field is present, but when it isnt - i get a " TypeError: Cannot read property '0' of undefined".

I think the problem is that when trying to access .address[0], the error gets thrown due to the array not existing on the dataset, before it can enter the conditional. How can I ammend my approach to fix this?




How to make a progressive web app on a LAN without https

I would like to make a progressive web app but for private use. What I mean is, I would like to serve the app from a LAN and have the app on the phone communicate with it on that same LAN. As far as I know, https is a requirement in order for the app to successfully be "installed" and for it to communicate with the server. Is there some method of allowing for this outside of generating a self-signed certificate? In other words, is there some exception allowing for the app to not have to use https if it is on the same network as the server?




Badly uploaded images to browser

we have problems with badly uploaded images to our web application. It cannot be reproduced on local, but the problem is reported by clients. Images are cutted in some part and filled with random color(mostly grey) I attched exapmle images. Problem is on web part because our checksums are correct on server. This is not language problem it's occur on javascript and flex app. Files are also correct. In first attempt image was badly uploaded but when you try to upload it again it will be ok. We are not sure but maybe it's problem with memory or cpu is too burdened client's reported us the browser was acting weird. Is anyone had this problem or know source of it. Any hints will be welcome

Example image A Example image B




Owin authetication in a pop out

Is it possible to initiate

HttpContext.Current.GetOwinContext().Authentication.Challenge(

Owin challenge in a pop out window? And when the user has authenticated, close the pop out window and redirect the original website?




click event is not working. For few elements it is for few its not

In my code for cmd and normal its working, but for #aboutme its not. Don't know why such event is getting ignored while its working for the above snippet.

var normal = $(".normal");
var cmd = $(".cmd");
normal.on("click", function(){
  $(".UI").show();

  $(".console").hide();
});
cmd.on("click", function(){
  $(".console").show();
  
  $(".UI").hide();
});


$("#aboutme").on("click",function(){
console.log("okay");
});

My Html Code: class dashboard acts as a wrapper.

<div class="dashboard ">
            <div class="option">
                <div class="normal">Normal</div>
                <div class="cmd">Terminal</div>
            </div>   
            <hr style="background-color: white;">
            
                <div class="console">
                    </div>
                        
                <div class="UI ">
                    <div class="showcase">
                            <div id="aboutme">
                            <h2><span>&raquo;About</span></h2>
                            <p>Self-motivated fresher seeking a career in recognized organization to prove my skills and utilize my knowledge and intelligence in the growth of organization.</p>
                            </div>
                            <div id="Skills">
                            <h2><span>Skills</span></h2>
                            <p> <kbd>Programming Languages</kbd>         :    Python, Node.js, C++</p>
                               <p> <kbd>Platform & Development Tools</kbd>   :    VS Code , Spyder and Jupiter Notebook</p> 
                           
                           
                          
                    </div>
                </div>
            </div>



Error in adding my website to my facebook page [closed]

I am facing issue in adding my new website to my new facebook page, it's showing following error

The website URL that you provided is not valid. Please enter a correct URL and try again.

Please help me and let me know how this issue can be resolved.




dimanche 28 juin 2020

How can I center the navigation bar, but have more navigation on the top right in fixed positions

So I have some code here and I wanted to have my main navigation in the middle and then the account and cart tabs on the top right. I want it in a way where the tabs that say "buy,sell,trade... etc" are directly in the middle and not in the middle of the left side of the page and the account and cart containers.

CSS

header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30p 10%;
text-align: center;
transition: all 0.4s ease 0s;}

.navigation {
list-style: none;
width: 10000px;
margin: 1%;}

.navigation li {
display: inline-block;
padding: 10px 20px;
float: center;}

.navigation li a {
transition: all 0.4s ease 0s}

.navigation li a:hover{
color:#75593e }

.home {
width: 65px;
height: 55px;
background: url("/images/ClosedBoxLogo.png");}

.home:hover {
background: url("/images/OpenBox.png") no-repeat;}

/* Cart and Account */

.rightside {
display: flex;
list-style: none;
align-items: center;
justify-content: space-between;}

.rightside li {
padding: 10px 20px;}

And this is my HTML

<body>
    <header>
            <ul class="navigation">
                <li><a href="#">Buy</a></li>
                <li><a href="#">Sell</a></li>
                <li><a href="index.html"><img class="home" src="images/CloseBox.png" alt="Close Box" onmouseover="this.src='images/OpenBox.png';" onmouseout="this.src='images/CloseBox.png';"/></a></li>
                <li><a href="#">Trade</a></li>
                <li><a href="#">Middle Man</a></li>
            </ul>
            <ul>
                <div class="rightside">
                    <li><a href="#"> Account </a></li>
                    <li><a href="#"> Cart </a></li>
                </div>
            </ul>
    </header>
   
</body>



Django: Calling images in gallery using database?

I am calling images from a model in database in django like this:

And then I want to call any one of the images that will be clicked into a modal(which I outside the for loop) which the js file with collect the image URL and pass it to the main class:

Hello!

But when the code runs, the image class "fs-gal-main" comes up with an unknown source. What do I do?




Exactly How and Where Does The Trending Posts System Work Inside A Server?

I know this question is fairly simple for you and there are many related answers but none of them explain all what I need.

So you all must have been to YouTube, there you must have seen the Trending Posts Section, where all the videos which have the most views/likes/dislikes (I don't know exactly) w.r.t the time are listed. Now, all those videos are from different different channels.

I want to know:

  1. There must be an algorithm or function inside the server to do that? If there is one, then when do it runs, i.e, are the results kept ready inside the server the same a google search engine --- which keeps the pages stored according to their ranking and whenever someone searches it delivers the result.

  2. The above algorithm goes through every posts, right? But when? How does it knows that this post from this youtuber is getting this amount of views or a lot of views.

  3. Now, after it knows which posts are trending --- where are they stored. Like, if we take mongodb database. Is it kept in a different collection like trending posts or their id's

I know the above questions must be confusing because of my half(or no) knowledge. But, please let's help me know it all. I am trying to get this answer for a very long time. Any guides or tutorials appreciated. Thanks!




how to create web push notification in Vue.js?

enter image description here

how to create web push notification in Vue.js??




how to read multi part data response from java web service using c#

I have one web service which is developed in java language.The WSDL file provided by Client. I have created Proxy and calling that method by passing username, password and couple of more parameter. But in repose, I am getting below error message.

The content type multipart/related; type="text/xml"; start="54-1320753400.1593357648052.IBM.WEBSERVICES@apsrt3985.uhc.com"; boundary="----=Part_0-1397619294.1593357648053" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 653 bytes of the response were: '

------=Part_0-1397619294.1593357648053

Content-Type: text/xml; charset=UTF-8

Content-Transfer-Encoding: binary

Content-Id: 54-1320753400.1593357648052.IBM.WEBSERVICES@apsrt3985.uhc.com

I have done lot of research but I could not able to get any answer on this. Can you please help me out?

Sorry for bad english.




Set PropTypes of many props with same type

I want to set Set PropTypes of many props with same type

Button.propTypes = {
  flexStart: PropTypes.bool,
  flexEnd: PropTypes.bool,
  center: PropTypes.bool,
  spaceAround: PropTypes.bool,
  spaceBetween: PropTypes.bool
}

But i need to simplify it, because all props has same type




web parse resurns JSON unterminated string error exception

All hands, I am doing a JSON parse as a part of web scraping and pretty regularly I get this error UnterminateUnterminated string starting at: line 1 column 'some column' (char ' some char') The page can be reparsed later after I catch this exception and it can return OK or again give this error, at random. I use simple JSON loads() approach.

So, the question is: are there any ways to avoid this specific exception? Right now my timeouts are around 30-40 seconds, I am not sure that increasing them leads to any effect as the error appears at random.




URL API for generating QR codes [closed]

Does anyone know a good website to generate a QR code directly from a URL?

For example: QRcode.com/ThisIsMyInformation

The output in the URL would be the raw QR image as a PNG.

Thank you!




How to open full version of the site that was built on Django?

I have my first website that is based on Django 3. It’s good when I open it using my PC, but when I use mobile phone, it opens as a mobile version and compresses all the visual content so it looks awful. How can I make it open as a full version?




Architecture : MERN / Full stack framework for simple projects

I've seen that during the past few years, tech stacks such as MERN, MEAN, ... are getting more and more popularity.

I am pretty sure there are many reasons for this (such as raw performance or the possibility to make dynamic progressive web apps, and things like that).

However, currently working as a full stack developer in Ruby on Rails, I am wondering:

Is there any way splitted frontend/backend stacks (such as MERN, ...) can compete in any way in terms of development time with full stack frameworks (such as Laravel, Rails, Django, ...), especially to make small apps?

I find that tools such as Express.js, React,.. often don't come "battery included", meaning that you often have to reinvent the wheel, or install a lot of packages and extensions to get even a simple work done.

Is my vision true? If yes, I dont really understand why frameworks such as Rails are becoming less and less popular over time (and no other frameworks seem to have a huge popularity boost). Are everyone accepting the boilerplate coming with MERN, MEAN,... stacks, or is there anything I get wrong?

Best




Error on cakephp's Auth->identify() when trying to login

I'm using cakephp 4 and when I'm trying to login a User it says me there was no table called Users. But I used "Users" nowhere in my code, only "User" without the "s". CakePHP error screen

I don't find the bug and how to resolve it.




Cross Border in Css

How to create this type of border ?(menu Left side Border ) enter image description here




putting text a little bit lower on my website

I would like to get this text a little bit lower.

<div style="text-align:center"><h1><b>Welcome</b></h1></div>

Any help will be appreciated. I am a beginner.




Disabling developer tools in all browsers [duplicate]

I know this question is old. There are many threads which clearly state we cannot disable developer tools. However, there must be some other way. I have a inventory software which is hosted online and front end is in HTML, css and JS. It was working fine. There is a sale invoice page, where lots of calculations happen when users enter quantity. The product cost etc is readonly(the user is not expected to change).Some mischievous users are able to use dev tools to remove the readonly attrib and make changes and save the erroneous calculations. Can someone suggest how I can handle this case?




onload animation delay of child elements of a div with js?

i have div, inside which i have made 3 card inside it and animated it as slide in. I can delay animation using nth child, but i want to do it with java script .children property and apply animation delay as --> index + 's' [my code] (https://codepen.io/beastop/pen/mdVMNgY)

<div class="container">
  <div class="card"></div>
  <div class="card"></div>
      <div class="card"></div>
</div>



How to render python on browser

I'm new to python. Im trying to get Python called from my Javasctipt so it can appear on my HTML. I created a small file to act as my webserver, however the response I'm getting from my Javascript is the content of python file itself as opposed to the output of the script. How I can I tell my server to run my python script as opposed to giving back the file?

Note: I'll make my life easier using Flask and I'll be using it for real development, but I just want to get a sense of what is happening in the background.

Thanks!

Myserver.py

from http.server import HTTPServer, BaseHTTPRequestHandler

class Serv(BaseHTTPRequestHandler):

    def do_GET(self):
        if self.path == '/':
            self.path = '/index.html'
        try:
            file_to_open = open(self.path[1:]).read()
            self.send_response(200)
        except:
            file_to_open = "File not found"
            self.send_response(404)
        self.end_headers()
        self.wfile.write(bytes(file_to_open, 'utf-8'))

httpd = HTTPServer(('localhost', 8080), Serv)
httpd.serve_forever()

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tittle</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="test.js"></script>
</head>
<body>
<h1>Hello world</h1>
</body>
</html>

Test.js

$.ajax({
                    url: '/test2.py',
                    success: function(data) {
                    alert(data);
                    }
})

test2.py

print("Hello there")
print("Hello one, ")
print("Hello two2, ")



How to set scale?

Hello,

I created new React App a few days ago and I have a problem.

All elements are bigger, than on the design although it is the same size (1920x1080). And that's because my default system scale is 125%. When I have changed it into 100%, it worked fine. But I want my app to be well displayed on all my users devices (even if they have scale 125% as system default).

In my index.html I have this line:

<meta name="viewport" content="width=device-width, initial-scale=1" />

Do you know what's the problem with it?




Get forbidden web-data with C++

I want to save JSON-config files with user information with my website and prohibit access to them using htaccess. But I'm creating a client app that must receive data from these files going around the prohibition. How can I do this?




how to show a excel data to a asp.net web form

i have a excel sheet contains contacts details of all employee of my region. I want to show it to a website using asp.net and sql server db please guide how will i do it.




VideoTexture Chromakey - WebXR AR & Three.js

Using WebXR and Three.js for Augmented Reality, I'm trying to display a videotexture (with chromakey) on a box which is display where the user has touch the ground surface.

I arrive to place the model on the ground and it seems the videotexture is attached to the box. But it never play and update (Keep black screen).

I use this three.js extension for video Chromakey. https://github.com/hawksley/Threex.chromakey

In my code structure, I don't know where to put video.startVideo() and video.update(). I tried to place the video.update() in onXRFrame(time, frame) but it didn't worked.

Have you a solution for this, where material.update() should be place? Here is my code :

   async onSessionStarted(session) {
  ...

 this.renderer = new THREE.WebGLRenderer({
  alpha: true,
  preserveDrawingBuffer: true,
});
this.renderer.autoClear = false;

this.gl = this.renderer.getContext();
this.scene = new THREE.Scene();

var canPlayMp4  = document.createElement('video').canPlayType('video/mp4') !== '' ?   true : false
  if( canPlayMp4 ){
    var url = 'imaes/video.mp4'
}else{  alert('cant play mp4 or ogv')}

var material = new THREEx.ChromaKeyMaterial(url, 0xd432); 
var geometry = new THREE.PlaneBufferGeometry( 3, 2);
this.model = new THREE.Mesh( geometry, material );
...

this.reticle = new Reticle(this.session, this.camera);
this.scene.add(this.reticle);
this.frameOfRef = await this.session.requestFrameOfReference('eye-level');
this.session.requestAnimationFrame(this.onXRFrame);
window.addEventListener('click', this.onClick);
}

async onClick(e) {
...
this.scene.add(this.model);
this.material.startVideo();
}

onXRFrame(time, frame) {
let session = frame.session;
let pose = frame.getDevicePose(this.frameOfRef);

this.reticle.update(this.frameOfRef);

if (this.reticle.visible && !this.stabilized) {
  this.stabilized = true;
  document.body.classList.add('stabilized');
}

session.requestAnimationFrame(this.onXRFrame);
this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this.session.baseLayer.framebuffer);

if (pose) {

  for (let view of frame.views) {
    const viewport = session.baseLayer.getViewport(view);
    this.renderer.setSize(viewport.width, viewport.height);

    this.camera.projectionMatrix.fromArray(view.projectionMatrix);
    const viewMatrix = new THREE.Matrix4().fromArray(pose.getViewMatrix(view));
    this.camera.matrix.getInverse(viewMatrix);
    this.camera.updateMatrixWorld(true);

    // Render our scene with our THREE.WebGLRenderer
    this.renderer.render(this.scene, this.camera);

  }
  }
  }



How to create a nuxt.js app without create-nuxt-app

Please I wish to know how I can create a nuxt app without the create-nuxt-app template. I am pretty new to it and I don't want to download the template but start a new project (say with Vue.js) and incrementaly add nuxt functionality to my app. I Googled but can't find a relevant post.




How to check changes in the URL page?

I joined a new internet project. Everything is clear. I downloaded Github repositories and already checked all files and code. This page is created on react, gatsbyjs and already have URL. So my question is how to check changes on a page without breaking the actual page? What command I have to use or what file I have to open?




Is it possible to host a website on a computer but use the static IP from a vpn-server on a google cloud vm?

I have my website up and running on a google cloud vm. But it runs slow because i only use the cheapest one. Before upgrading the vm to a more powerful one, is it possible to host a website on my own computer using the IP from google cloud vm? I successfully set up a vpn server on it using softether (checking whatsmyip on my computer shows the public IP from google cloud vm). Any tips and help would be appreciated.




C# - How can i perform a click or write in a textbox programmatically on web page?

I would like write data in a web page and after submit the information programmatically in C#.. How can i do that?

code




Why my firebase site is working on Desktop but is blank on mobile

This is screenshot of the desktop version of my site

This is screenshot of the mobile version of my site




Web Installer Issue -DB Issue -The server principal "DOMAIN\MACHINENAME$" is not able to access the database

I am getting below error while generating the SQL scripts using a web installer with Integrated security as true /Windows authentication mode on.

It works perfectly fine with SQL authentication mode.

The server principal "DOMAIN\MACHINENAME$" is not able to access the database "" under the current security context.

Regards




How to implement server-to-server callbacks?

I have a mobile app using Flutter, and I have integrated an external SDK called Pollfish. How do I implement Server to Server callbacks exactly? Is there a guide that I can follow and it's not very easy to understand as I am not a web developer? This is the url for what I am trying to implement.




React : Print multiple Instance of one class using another class

I'm a React beginner. I'm trying to make a board game(Ludo) that will need 13*13 boxes. I have one box class that print out one square button and rendering it works fine. Code below:

class Box extends React.Component{
  render(){
    return(
      <button className="square">
        
      </button>
    );
    
  }
}

Problem is when I try to print multiple Box with the Board class. Apparently this code does not work. I can't figure out why. Any insight will be helpful.

class Board extends React.Component{
  render(){
    return(
      {this.renderRow}
    );
  }
  renderRow(){
    for(let i= 0; i < 13; i++){
      return(
        <Box />
      );
    }
  }
}

Thanks in advance

Upadate : it seems like even the box is not working. Only when I comment out Board class the Box class works.

Update 2 : changing from {this.renderRow} to (this.renderRow) inside Board:render solved the issue where even Box class won't render(as mentioned in update 1). new code is :

class Board extends React.Component{
  render(){
    return(
      (this.renderRow)
    );
  }
  renderRow(){
    return(
        <Box />
    );
  }
}




Why am I getting this error when I try to start react?

I installed node JS in my device only last week and its version is 12.18.1 and npm version is 6.14.5 . npx create-react-app is working and I get all the node modules and other files but when I try to start it gives be following error. PS: I changed the folder and then started as npm start.

    npm start
Starting the development server...

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projectreact@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projectreact@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-06-28T06_35_26_852Z-debug.log

Please help developers!!




samedi 27 juin 2020

can we make html/css/js preprocessor with javascript(nodeJS)?

there are many pre-processors for html css and js made with Ruby,dart etc. but can we make the pre-processors like pub,sass,postCSS,typescript with Javascript(nodeJS).

if yes ,then how to make pre-processors?




unable to pass value in jsp file

I'm new to using JSP so I just wrote a simple email verification code where I'm getting an error for passing value. See the code for more info

<%
    String data="";
    String code="";
    String name =request.getParameter("username");
    String email =request.getParameter("email");
    String password =request.getParameter("password");
    String profession =request.getParameter("profession");
    data=password;
    String algorithm="MD5";
    data=generateHash(data,algorithm);
    code=getRandomNumberString();
    sendMAil(email);
    %>
    <%! 
    //password hashing....
    static String uname=name;//(getting error here)name cannot be resolved to a variable
    static String key=code;//(getting error here code) code cannot be resolved to a variable

my requirement is to pass Code value into key and similarly name to uname for use in functions hope u got some idea on my issue if any idea please help me Thank you.




Books on colors in web design/web development? From simple thin to advanced thick feel?

All of my colors look pale compared to modern websites, even older websites? Which color combinations are used to create that blockbuster feeling, like it's all a thick window? My sites look thin compared to modern/once modern sites? In source code it says that it's white for background yet it looks so bright and thick? Is it some combination of letters and background that gives the illusion of other colors?




when i am trying to install radium package to Reactjs this Error occur what should i do for this?

i am new developer and these error very torture to me... please help me!!!

npm install --save radium

  • radium@0.26.0 updated 1 package and audited 1374 packages in 11.052s

23 packages are looking for funding run npm fund for details

found 34 vulnerabilities (31 low, 1 moderate, 2 high) run npm audit fix to fix them, or npm audit for details PS D:\education\my-new-app>

enter image description here




Variable not assigning from the first try

I am having issue with assigning value to global variable. When I click button to console my varible it is empty and when I click button second time, I can see my variable value. I do not know why it is empty at first click and not empty at second click. Look at my code below. Thanks!

export class DriversService {
  mc = '';
  dil = '';
  constructor(private db: AngularFirestore, private auth: AuthService, private afAuth: AngularFireAuth) { }

 getUsers() {
  return this.auth.user.pipe(
    take(1),
    map(user => {
      this.mc = user['company'];
      return user['company'];
    })
  )
 }

 getMc(){
   return this.getUsers().subscribe(user => {
     this.mc = user;
     console.log('Hello', this.mc)
     return this.mc;
    });
  }
  
  getComp(){
    this.mc = this.dil;
    if(this.dil.length <= 0){
      return this.getUsers().subscribe(user => {
        this.mc = user;
        console.log('Bye', this.mc)
        return this.mc;
       });
    }
    else{
      console.log('Bye1', this.dil)
    }
  }
  oneMore(){
    console.log(this.mc) // Here it is empty
  }



Web Designing software vs from scratch

So when it comes to making a website should I use a type of web designing software or should I make it completely from scratch so that i can impress universities when they check it out? I'm mainly trying to add a few good looking and useful websites to my portfolio.




What tools should I look into to approach taking ownership of website?

I'm part of an organization that has a website, and I'm taking over that website to manage it for them. I have lots of experience with HTML, CSS, and JS, but no experience doing website admin. The only information I have right now is that the previous admin used Dreamweaver.

What information should I seek out in order to approach administrating a site in a scenario like this? The previous admin said that you can download software and use it to just take over administration of the existing site. How should I approach this?




I want to improve my programming skills but I dont want to waste money on google cloud [closed]

This year, I have finished multi-platform application development and I want to do research on web development with google cloud applications (mongo, nodejs, angular, etc), but I don't want to waste money.

Are there solutions to develop and deploy free or cheap applications? Like XAMPP, docker or others.

I would also like to know what books you recommend for web development, servers, microservices... I'm very lost ><




Any APIs for number of people in a particular radius

I have searched online and think google heatmap could be of use but not sure about it.




Rearranging UI elements according to screen size in Flutter

I checked flutter interact 19 keynote video where it was mentioned an upcoming feature to resize and rearrange the ui according to screen size. It is in this video, minute 17:30.

https://youtu.be/NfNdXgJZfFo

6 months ago it was in "very early stage" does anybody know if it is out yet? I believe is something else than LayoutBuilder or MediaQuery.of(), since those were available before the keynote on the video.

I know there are other packages as well from other developers but I am interested in the one from Google.




How to extract data from any file type and use it in html format? [closed]

I am planning to make a website for conducting online mock test but I have no idea how to extract questions(in form of mcq) provided by my content creators in a text file type and show those questions on the site where people can choose the correct option. I will be working in NodeJS.




How to copy text written with @ in excel

I have a formula for this -

  =CONCATENATE(IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",1)),LEN(B4))," ",REPT(" ",100),1),100)),""),",",IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",2)),LEN(B4))," ",REPT(" ",100),1),100)),""),",",IFERROR(TRIM(LEFT(SUBSTITUTE(MID(B4,FIND("~~",SUBSTITUTE(B4,"@","~~",3)),LEN(B4))," ",REPT(" ",100),1),100)),""))

But problem with this is that it only give results up to 3 words from a line with @ . For example if i have line - The @Sun is @beautiful and @only @star in the @solar system . This will give result - @sun @beautiful @only . But i want a formula so that i can extract all words with "@" from that line or paragraph . Please tell me if this is possible in excel or anyhow it is possible with another tool or any website




vendredi 26 juin 2020

How to add multiple types of objects in a class

Here, is the problem when I try to add multiple objects to context through get function it is not showing pagination and when views.py is like below code then I am unable to add multiple objects of different models. Ex: I want to add two models like Items and Ads to my Homepage class then how can I do this. Views.py

class HomeView(ListView):
    model = Item
    paginate_by = 12
    template_name = "home.html"

home.html

<div class="card-body text-center">
                <a href="" class="grey-text">
                  <h5></h5>
                </a>
                <h5>
                  <strong>
                    <a href="" class="dark-grey-text">
                      <span class="badge badge-pill -color"></span>
                    </a>
                  </strong>
                </h5>

                <h4 class="font-weight-bold black-text">
                  <strong>
                  
                  
                  
                  </strong>
                </h4>

              </div>



Buliding a real time "API Builder"

For a project I was thinking of making a real time api builder. The application should be easy to deploy and would allow users to easily create API endpoints and specify what data needs to transmitted via these endpoints. The API builder would also allows users use whatever application to consume the API, whether it be web, desktop or mobile. In order to make the API easily consumable, I was thinking about using a preexisting messaging protocol such as XMPP or MQTT. The problem is that these messaging protocols require a broker or server to sit between clients. I have not decided whether the API builder should be a web application (I'm more leaning towards this) or a desktop application. I know that there libraries and frameworks for web such as SocketIO and Redis that I can use to implement such a task but then I would have to develop my own messaging protocol instead of using a standard one. What would be the best option for developing such an application? Should I try build my own messaging server/broker for XMPP or MQTT? Should I make my own messaging protocol?




my code only ever out puts "You win, rock beats scissors."

This is the code, now matter what I input as the input parameter in the play function, it alwats returns "You win, rock beats scissors."

    function computerPlay() {
        switch(Math.floor(Math.random() * 3) + 1) {
            case 1:
                return "rock";
                break;
            case 2:
                return "paper";
                break;
            case 3:
                return "scissors";
                break;
            default:
                return "error1";
                break;
        }
        
    }
    let playerInput;
    function startPlay() {
        playerInput = prompt("Rock, paper, or scissors?");
        play(playerInput, computerPlay());
    }
    function play(a,b) {
        if(((a = "rock") && (b = "scissors")) || ((a = "paper") && (b = "rock")) || ((a = "scissors") && (b = "paper"))) {
            alert(`You win, ${a} beats ${b}!`);
        }else if(((a = "rock") && (b = "paper")) || ((a = "paper") && (b = "scissors")) || ((a = "scissors") && (b = "rock"))) {
            alert(`You lose, ${b} beats ${a}`);
        }else if(a == b) {
            alert("It's a tie.");
        }
    }



Getting the "Cannot access 'firebase' before initialization" error when using Firebase with JavaScript

This is the HTML Code. I get the "Cannot access 'firebase' before initialization" error when using Firebase with JavaScript. I have tried to move the tags around but does not seem to be working.

<!DOCTYPE html>
<html lang="en" dir="ltr">
    <head>
        <title>Login</title>
        <meta charset="utf-8">
    </head>
    <body>
        <script src="https://www.gstatic.com/firebasejs/7.15.1/firebase-app.js"></script>
        <script src="https://www.gstatic.com/firebasejs/7.15.4/firebase-auth.js"></script>
        <script src="https://www.gstatic.com/firebasejs/7.15.4/firebase-firestore.js"></script>
        <script src="form.js"></script>
        <section>
            <input id="email" name="email" placeholder="email">
            <input id="password" name="password" placeholder="password">

            <button onclick=signUp() id="signUp" type="button">Sign Up</button>
        </section>
    </body>
</html>

This is the JS code without the parameters.

var firebaseConfig = {
apiKey: 
authDomain: 
databaseURL:
projectId: 
storageBucket: 
messagingSenderId: 
appId: 
measurementId:
};
  // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
    firebase.analytics();

const firebase = firebase.auth();

function singUp() {
    var email = document.getElementById("email");
    var password = document.getElementById("password");

    const promise = auth.createUserWithEmailAndPassword(email.value, password.value);
    promise.catch(e => alert(e.message));

    alert("Signed Up");
}

I can't seem to be initializing firebase. Do you know what is wrong?




My images disappeared after using clearfix code

Before adding this clearfix code all my images were displaying properly after I added them all of my images disappeared blank space replacing all of them.

.clearfix {zoom:1}
.clearfix {

    content: attr('.');
    clear: both;
    display: block;
    height: 0;
    visibility: hidden;

}

enter image description here




How to read Firestore data from my website without authentication? (Security required, Http Request takes too long)

I am building a website where some information from my Firestore database needs to be displayed. Currently I am using Cloud Functions with HTTP requests to load my data but because my function is not called very frequently the user experiences a "cold start" (up to 5 seconds) very often and even without a cold start the speed is not really satisfying (about 2 seconds). The data is only max. 200 Bytes so this should not be the problem.

Is there a better way or a common mistake which I might be doing? Are there any security concerns if my security rules would allow read-access without authentication for this collection?

Security is very important for this site and a certain document should be accessible depending on the URL. (https:URL/docID)




Openlayers and Angular : How to use Web Worker to add vectoreLayers

I rarely post my problems since generally I find everything here but not this time unfortunately. here's my problem: i'm currently working on a navigable map that will display shapes. I recover the data via json from my database. my problem is that the result contains more than 200,000 figures. when I launch my function the app crash. I thought of web workers unfortunately I cannot import modules like (vectorlayers, WKT ... etc). if you know how to do it or if there is another alternative to offer me please. I already tried streaming with oboe the page does not crash completely but it remains unusable. here are the codes:

function to receive data :

public async list() {
// const url = `${this.baseUrl}/`;
return this.httpClient.get(this.baseUrl).toPromise().then(data => {
  return data;

});

function to add the vectorlayers :

export function DisplayPopup(map: Map, geom) {
const format = new WKT();
let features;

features = format.readFeature(converter.convert(geom), {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
this.vectorLayer = new VectorLayer({
source: new VectorSource({
  features: [features]
}),
style: styleFunction
});
map.addLayer(this.vectorLayer);
}

And finally the function with the loop :

async OnGetgeomlist() {
const allbuilding = await this.buildService.list() as Buildings[] ;
allbuilding.forEach(build => {
  const house = new Buildings(build);
  new DisplayPopup(this.map, house.geom);
});
}



Laravel is returning view with 404

web.php

Route::get('/jobs/{id}/edit', 'JobController@edit')->name('job.edit');

then html page:

                         <td>
                            <a href=""><button class="btn btn-dark">Edit</button></a>

                            <a href=""><button class="btn btn-success btn-sm">Apply</button></a>
                        </td>

The jobs.show is working, so that's fine

If I click on the edit button the url is:

http://127.0.0.1:8000/jobs/41/edit

controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Job;
use App\Company;
use App\Http\Requests\JobPostRequest;

class JobController extends Controller
{
    public function index()
    {
        $jobs = Job::all()->take(10);
        return view('welcome', compact('jobs'));
    }

    public function edit($id) {
        $job = Job::findOrFail($id);
        return view('jobs.edit', compact('job'));
    }
    
    public function show($id, Job $job) {
        return view('jobs.show', compact('job'));
    }

folder where the edit view is located:

resources - views - jobs - edit.blade.php

Does anyone has an idea why I get page 404?




how to fix the rendering bug on ios with the scroll?

user: testtest
password : Test123456789!
https://app.alfredetnestor.com/business/8/settings

anyone know how to fix this concern?
because I have no idea where it comes from and how to fix it




Border animation in CSS and HTML

I am trying to build a modern-looking website, and one of the things I want to add to my site is some kind of animation when opening the site for the first time. Mainly I want to animate borders of my "div" elements, same, or similar to this website tron. How do I do that in CSS and HTML, do you have any idea?




which web crawler can I use for text mining?

Which web crawler you used for getting text content (customer reviews, etc.) from the web pages in order to use in text mining process ?

Thanks for your reply.




Make migrations Command

I just started teh django with python.while ı tried the run code that is "python manage.py make migrations" , ı see error "module 'django.db.models' has no attribute 'models'". how can ı fix it?(I left the code and error down. )

from django.db import models

class Article(models.Model):
author = models.ForeignKey("auth.User",on_delete = models.CASCADE)
title = models.models.CharField(max_length=50)
content = models.models.TextField()
created_date = models.models.DateTimeField(auto_now_add = True)

Error




How to fetch data from firestore database using Javascript/Web?

 db.collection("schools")
   .doc("St. Francis Xavier's")
   .collection("students")
   .add({
          Name:"Manoj Shetty",
          Age:"21",
          Address:"Sakaleshpur"
       )}

In this type of firestore collection, 1.How to fetch the names of students who belong to "St. Francis Xavier's"? 2. How to fetch the details of particular student who belong to "St. Francis Xaviers"? 3. How to fetch details of all students from all schools?




How a dns server is queried

I am aware that a DNS server is used to query the IP address of some domain. Let's say a user is navigating to example.com for the first time from his machine/browser. I want to know how the user's browser/machine is able to query the DNS server that is configured in the machine. The DNS server can be default as assigned by the ISP or a custom one (similar to google public DNS such as 8.8.8.8).

  1. What type to Query/API call is getting initiated from the browser/machine to the DNS server 8.8.8.8 to resolve example.com? Kindly provide the details of the request signature, protocol, response format, and other details.
  2. Can we try this request programmatically using NodeJs or other languages without using any third party library/service provided we have the IP address of the DNS server and the domain name whose IP has to be resolved?



Query to iterate over array of maps in Firestore (web)

I'm using Firestore in my React Native project, and I want to get X document in real time by using .where(), the think is that the field that I'm looking for is inside an array of maps, how can I perform a query to get the document based on the field "r_user_uid"

something like:

const db = firebase.firestore();
db.collection("f_invitations").where("invitations.r_user_uid", "==", 12) 
                              .onSnapshot((querySnapshot) => {...}

enter image description here




Firefox or google chrome incoming text to java string

A web page constantly serves data(mainly text). This data is automatically displayed on the browser. The browser is chrome, Firefox, MS edge or explorer. Is there a way to read those text into java string?




How to create a firestore database?

// Add a new document in collection "schools"
db.collection("schools").doc("St. Francis Xavier's").set({
    Student1:
    {
        name: "Manoj",
        age: "21",
        address: "Tulunad"
    }
})
.then(function() {
    console.log("Document successfully written!");
})
.catch(function(error) {
    console.error("Error writing document: ", error);
});
  1. I want to create database of schools.
  2. For that I'll make a collection in Firestore database "schools" Inside that I need schoolname as doc
  3. And inside that I should be able to store different different students belonging to particular school But we can't do add operation on doc, we can only perform set operation.
  4. And while reading the data, I need basic data(for example name,class and address is enough) of all students belonging to all school ( not any particular) but all students and how to fetch that. And if I click on any particular student's name, then I should get entire data of that student.
  5. And one more is, I need to fetch names(schoolname doc) of all schools, and if I click on a single school name, then I need all data of students (for example name,class and address is enough) belonging to particular school. And if I click on any particular student's name, then I should get entire data of that student. And also how to update the data of a particular student who belongs to particular school. For example i want to update age of a particular student who belongs to a particular school. (Please give me the syntax for these..., Thank You)



Variable value from local .txt file html [closed]

We're making a website on a local web server using html, and we need to read a value from a local .txt file into a variable so we can use them to change elements on our website. The value in the file is going to change from something like a 0 to a 1, and we want that to change something on our website.

What is a good way to do this?




How to display messages in a chat application in Django

I am building a chat application in Django. But I am confused about how to show messages as soon as the person on the other side sends a message. At present, I have to reload the page to view the messages. I thought of refreshing the page automatically for 3-5 seconds. Is there any way to display messages as soon as the other person sends a message




jeudi 25 juin 2020

To suppress zeros in a Kwizcom chart

I have a Kwizcom chart that gets values from SharePoint list and stacks it along the Y-axis. I am unable to suppress the zeros in the chart as some values in the list do not exist and I don't want my users to see a '0' in the charts.

Can you help me achieve it?

I used the web part settings for min value but it doesn't save it.

Kwizcom Web Part

Please do tell me what am I doing wrong. Thanks




How to extract HPKP (HTTP Public Key Pinning) backup pin?

I am doing HPKP when communicating on my asp.net server However, there is the inconvenience of changing the ssl pin key set in the server whenever the certificate is changed. When using hpkp, if you set the backup pin, it seems that there is no need to change the pinkey even if the certificate is changed. I don't understand how to extract backup pins. need help




Issue with can not press the like button when viewing in fullscreen mode

I have issue with an not press the like button when viewing in fullscreen mode

https://playcode.io/614075/ <-- example here, thanks for read




How to anonymously access a firestore document using a password [duplicate]

I'm building a web app with firebase that can't have an authentication system but still needs to access sensitive data in a firestore document after being given a password. I was thinking about making the password the name of the document, but then I realized this is not secure because someone could query all the documents in the database.

Is there a way to use firebase rules or some other workaround such that the only way to read a document is to have a certain code?




How to detect browsers notification

How to detect Chrome browser notification?

I don't mean my own application's notification, but any notification

Is there a way to just tell that the browser got a notification (without its details)




Get excel table from web site using httr GET

How could i extract excel table from web site, using username and password which i have using httr? I tried this, but it doesn't work:

url <- "https://ss0.corp.com/auth"
login <- "john.johnson" (fake)
password <- "67HJL54GR" (fake)

res <- GET(url, authenticate(login, password))
content <- content(res, "text")

But it doesn't give me the excel table. Content doesn't give me excel. After i log in there there appears a button which allows to download excel table. But i get a list of numbers, like 5,8,3,6,7,8b,9a,2,5t,..... Even when i paste wrong password the output is the same. What do i do wrong and how it must look like?




Url rewriting redirect 301 old to new website

a small problem with redirections from my old site to the new one. I was helped for rewriting, I try to make it out that if the user arrives on example.ch/ or example.ch/fr he is redirected to my new site. But if it reaches example.ch/fr/b2b that the user must be directed to the old site. Here are my rules:

RewriteRule fr/produits-fr/equilibre-et-vitalite-fr/ortie-fr https://exemple.swiss/products/ortie [R=301,L]
RewriteRule fr/produits-fr https://sekoya.swiss/collections/all [R=301,L]
RewriteRule en/ https://exemple.swiss/a/l/en [R=301,L]
RewriteRule de/ https://exemple.swiss/a/l/de [R=301,L]
RewriteRule fr/ https://exemple.swiss/a/l/de [R=301,L]
RewriteCond %{REQUEST_URI} !^fr/b2b
RewriteRule (.*) https://www.exemple.swiss/ [R=301,L]

But currently if I go to ex.com/fr/b2b I come across the new site on the home page. Do you see a problem in my rule or condition?

Tanks a lot




Get excel table from web site using httr GET

How could i extract excel table from web site, using username and password which i have using httr? I tried this, but it doesn't work:

url <- "https://ss0.corp.com/auth"
login <- "john.johnson" (fake)
password <- "67HJL54GR" (fake)

res <- GET(url, body = list(username = login, password = password))
content <- content(res, "text")

But it doesn't give me the excel table. What do i do wrong and how it must look like?




Populating a Bootstrap dropdown from an MS SQL Database

I've been racking my brains all morning, and I have searched on loads of pages via Google.

I can't find a way to populate a bootstrap button dropdown box with data from a MS SQL server.

Plenty of ways to do a plain HTML dropdown from MySQL.

This is the code of the button:

<div class="btn-group">
    <button type="button" class="btn btn-info btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Family</button>
    <div class="dropdown-menu">
        <a class="dropdown-item" href="#">Option 1</a>
        <a class="dropdown-item" href="#">Option 2</a>
        <a class="dropdown-item" href="#">Option 3</a>
     </div>
 </div>

Help is kindly appreciated.




How to show image which was detected by YOLO on website by using Flask

I am trying to show on my website the detected image that was uploaded by the user and the YOLO algorithm detects objects. I want to show the image with the bounding box on a website. the following code is after detection now I want to pass it to a web server with confidence and Label. how can I do that? I followed this link https://www.youtube.com/watch?v=MAjbzx2zq-c
img, detections = draw_bounding_box(img, FONT, boxes, classes, class_ids, confidences, colors) frame = cv2.imencode('.jpg', img)[1].tobytes() yield(b'--frame\r\n'b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')




How to cloak & redirect my website download link through another website?

I want to cloak redirect my download links through another website like a site called a2zapk.

They are using a special technic to redirect their Download links through another blog.

Example-

If you Download telegram app from a2zapk website

The Download link will be cloaked & Download will start through another website called A2zupload

But if you open a2zupload website in a incognito tab you'll just see a news blog.

How can I cloak Download links of my site through another blog like them?




Whack-A-Mole Web Game with Javascript

I'm trying to develop some Whack-a-mole web game, with html, css and javascript, but i'm new to this, so i would really appreciate some help. This is my code so far and what i'm trying to do now is to:

  1. make the start button only work once, cause now i can click it for how long i want and the moles are starting to appear from all holes
  2. make the mole be clicked only once, now i can click it as it fades out so the score increments without sense
  3. check if the mole is clicked or not, cause when it s not clicked, i wanna display a message that says u missed and maybe add some lives to the game
const holes = document.querySelectorAll('.hole');
const scoreBoard = document.querySelector('.score');
const moles = document.querySelectorAll('.mole');

let lastHole;
let timeUp = false;
let score = 0;

function randomTime(min, max) {
  return Math.round(Math.random() * (max - min) + min);
}

function randomHole(holes) {
  const index = Math.floor(Math.random() * holes.length);
  const hole = holes[index];


  if (hole === lastHole) {
    return randomHole(holes);
  }
  lastHole = hole;
  return hole;
}

function peep() {
  const time = randomTime(500, 1000);
  const hole = randomHole(holes);
  hole.classList.add('up');
  setTimeout(() => {
    hole.classList.remove('up');
    if (!timeUp) {
      peep();
    }
  }, time);
}

function startGame() {

  scoreBoard.textContent = 0;
  timeUp = false;
  score = 0;

  peep();
  setTimeout(() => timeUp = true, 90000)
}

function wack(e) {
  if (!e.isTrusted) return;
  score = score + 100;
  this.parentNode.classList.remove('up');
  scoreBoard.textContent = score;

}


moles.forEach(mole => mole.addEventListener('click', wack))
<button onClick="startGame()">Start</button>
<span class="score">0</span>

<div class="game">
  <div class="hole hole1">
    <div class="mole"></div>
  </div>

  <div class="hole hole2">
    <div class="mole"></div>
  </div>

  <div class="hole hole3">
    <div class="mole"></div>
  </div>

  <div class="hole hole4">
    <div class="mole"></div>
  </div>

  <div class="hole hole5">
    <div class="mole"></div>
  </div>

  <div class="hole hole6">
    <div class="mole"></div>
  </div>

  <div class="hole hole7">
    <div class="mole"></div>
  </div>

  <div class="hole hole8">
    <div class="mole"></div>
  </div>

  <div class="hole hole9">
    <div class="mole"></div>
  </div>

</div>



Object destructuring in JavaScript [duplicate]

>{a} = {a: true} // Statement
<{a: true}

The above statement is assigning the value true to a

Why is the above statement not giving error in the chrome console? While the below statement gives an error.

>{a} = {a: true}; // Statement
<Uncaught SyntaxError: Unexpected token '='

How does the semicolon at the end matter?




History API | How to listen to forward() events

TL;DR - Is there a way to listen to forward() events of the history API?

I'm trying to handle navigation events in my application (to attach data for each route and support back & forward navigation).

I achieve this by saving the data in a stack object that aims to replicate the browser's history.

Currently, I use the history API to listen to onpopstate events, and for any new browsing events.

Now I need to be able to differentiate between events fired due to forward vs. event that were just routed. Is that even possible? Do the browser export such an API?

Thanks!




How do I add url to a lightbox in Webflow?

I'm working on a Webflow site. On the home page we have a lightbox with a video. The user must click a button to view the lightbox. We would like the URL to change when the lightbox is visible to make the video in the lightbox more shareable.

How can I make a URL for a lightbox?




How do I add a remove function based on my code? (PHP and HTML)

Im trying out some exercise Ive found online, and I reach dead end. I know to use unset() to remove a specific array, however I dont understand how it actually works. Here is my code:

<?php session_start();
if (empty($_SESSION['cart'])) {  //check if array is empty
    $_SESSION['cart']= array(); 
    }

    array_push($_SESSION['cart'],$_POST['apples']);  //store array 
    array_push($_SESSION['cart'],$_POST['banana']); ?>

And the rest of the code is in html. Thanks in advance.




Do I need a cookie notice for login cookies?

In compliance with all cookie laws, if my website only stores one cookie to check if a user is logged in, and no third party ones, do I still need a cookie notice and cookie policy?

I know there are exceptions for "essential" cookies (in GDPR at least), would my use be classed as "essential", and if so, what exactly am I exempt from?




How to modify this PHP code to send data to json file on server as shown below json format

 <?php  
 $message = '';  
 $error = '';  
 if(isset($_POST["submit"]))  
 {  
      if(empty($_POST["title"]))  
      {  
           $error = "<label class='text-danger'>Enter  details</label>";  
      }  
      else if(empty($_POST["image"]))  
      {  
           $error = "<label class='text-danger'>Enter Written By</label>";  
      }  
      else  
      {  
           if(file_exists('myfile.json'))  
           {  
                $current_data = file_get_contents('myfile.json');  
                $array_data = json_decode($current_data, true);  
                $extra = array(  
                     'title'  =>     $_POST['title'],  
                     'image'  =>     $_POST["image"],  
                     'link'   =>     $_POST['link'],  
                     'info'   =>     $_POST['info'],  
                );  
                $array_data[] = $extra;  
                $final_data = json_encode($array_data);  
                if(file_put_contents('myfile.json', $final_data))  
                {  
                     $message = "<label class='text-success'>Added Successfully</p>";  
                }  
           }  
           else  
           {  
                $error = 'JSON File not exits';  
           }  
      }  
 }  
 ?>

Above is my PHP code that i have for sending data to json present on server.

{
"Apple": [
  {
    "title": "iphone5",
    "image": "lllllll",
    "link": "llllll",
    "info":"llllll"
  },
  
  {
    "title": "iphone6",
    "image": "lllllll",
    "link": "llllll",
    "info":"llllll"
  }
]
}

Above is my json file format that i want to have after submitting data using PHP, it should not override myfile or something like that, i want it to be add more childs in array using PHP

[
  {
    "title": "Aiphone5",
    "image": "lllllll",
    "link": "llllll",
    "info":"llllll"
  },
  
  {
    "title": "Aiphone6",
    "image": "lllllll",
    "link": "llllll",
    "info":"llllll"
  }
]

If i run as shown above php code the o/p of json is as above




I can't position the image outside the div

``I have set a division position to absolute and its parent to relative. When I type top:-2px, then instead of going up outside the div, the 2px of the image is cut and the image remains inside the div. I can't figure out why the image is not going outside the div. The image is not going outside the division even after writing top:-2px

This is sass:

.composition{

position: relative;

&__photo{
    width: 55%;
    box-shadow: 0 1.5rem 4rem rgba($color-black,.4);
    border-radius: 2px;
    position: absolute;

    &--1{
        left: 0;
        top: -2rem;

    }

    &--2{
        top: 2rem; 
        right: 0;
    }

    &--3{
        top: 10rem;
        left: 20%;
    }
}

}

.row{
width: $grid-width;
margin: 0 auto;
overflow: auto;


&:not(:last-child){
    margin-bottom: $gutter-vertical;}


[class^="col-"]{
    float: left;

    &:not(:last-child){
        margin-right: $gutter-horizontal;
    }
}

.col-1-of-2{
    width: calc((100% - #{$gutter-horizontal}) / 2);

}

.col-1-of-3{
    width: calc((100% - 2* #{$gutter-horizontal})/3);
}

}

This is html:

<div class="row">
                <div class="col-1-of-2">
                    <h3 class="heading-tertiary u-margin-botton-small">You're Going To Fall In Love With Yoga</h3>
                    <p class="paragraph"></p>
                
                    <h3 class="heading-tertiary u-margin-botton-small">practice yoga like never before</h3>
                    <p class="paragraph">..</p>
                    <a href="" class="btn-txt">Learn More &rarr;</a>
                </div>
                
                <div class="col-1-of-2">
                    <div class="composition">  
                        <img src="img/nat-1-large.jpg" alt="photo 1" class="composition__photo composition__photo--1">
                        <img src="img/nat-2-large.jpg" alt="photo 2" class="composition__photo composition__photo--2">
                        <img src="img/nat-3-large.jpg" alt="photo 3" class="composition__photo composition__photo--3">
                    </div>
                </div>
           </div>



mercredi 24 juin 2020

Flutter - Filter out the display items according to Firebase keys, and in descending order

I am trying to create a Flutter portfolio sorted by "categories" with flat buttons. When one click on the categories, the related projects will be filtered and displayed accordingly, in descending order based on the timestamp.

I have succeeded in displaying the projects in descending order, however have been unable to display my projects by the key value.

Code for the "categories" flat buttons:

class PortfolioCategories extends StatefulWidget {
  @override
  _PortfolioCategoriesState createState() => new _PortfolioCategoriesState();
}

class _PortfolioCategoriesState extends State<PortfolioCategories> {
  void _select(CategoryChoice category) {
    setState(() {
    PortfolioRow.itemBuilder(context, category.categoryIndex);
    });
  }

class CategoryChoice {
  const CategoryChoice({this.category, this.categoryIndex});

  final String category;
  final String categoryIndex; //value of 'category' key in Firebase
}

const List<CategoryChoice> categories = const <CategoryChoice>[
  const CategoryChoice(category: 'ALL', categoryIndex: 'Category_ALL'),
  const CategoryChoice(
      category: 'MULTIMEDIA DESIGN', categoryIndex: 'Category_1'),
  const CategoryChoice(category: 'CURATORIAL', categoryIndex: 'Category_2'),
  const CategoryChoice(category: 'ART', categoryIndex: 'Category_3'),
];

Code for my portfolio:

class PortfolioRow extends StatelessWidget {
  const PortfolioRow({Key key, this.category}) : super(key: key);

  final CategoryChoice category;
  @override
  Widget build(BuildContext context) {
    return StreamBuilder(
      stream: Firestore.instance
          .collection('portfolio')
          .orderBy('createdAt', descending: true)
          .snapshots(),
      builder: (context, snapshot) {
        if (!snapshot.hasData) return Text("Loading...");
        return GridView.builder(
            physics: ScrollPhysics(),
            shrinkWrap: true,
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 3,
            ),
            itemCount: snapshot.data.documents.length,
            itemBuilder: (context, index) =>
            portfolioContainer(context, snapshot.data.documents[index])); //portfolioContainer is the portfolio projects that will be displayed
      },
    );
  }
}