Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Posts posted by Funce

  1. Your example doesn't illustrate your issue.

    The data should generally only be received at stage 4.

    1: server connection established
    2: request received 
    3: processing request 
    4: request finished and response is ready

     

    Do you have some specific code that is causing this issue for you?

  2. You're missing a couple of things from the video I'll list them

    • Your Youtube link is an HTML comment inside a CSS block, you'll need to move that outside the <style> tags to make it work properly
    • You have an extra ':' after translate in your hamburger.
    • Your left is supposed to be 50% in your hamburger.
    • Your box shadow color in hamburger:before, hamburger:after is supposed to be rgba(0, 0, 0, 0.2)
    • You have a background style in your icon.
    • You need a transition of 0.5s in your hamburger:before, hamburger:after

    Hope this helps.

  3. 1 hour ago, kayut said:

    When I send a /search/photos request to Unsplash API, I get a response with only 10 images.

    Is it possible to get more than 10 images?

    https://unsplash.com/documentation#search-photos

    You'll need to send a per_page parameter stating how many results you want per request. (Defaults to 10, as observed)

    Alternatively, to get the next set of results(10), you'll need a 'page' parameter.

  4. As I'm not a member of the staff, I can only speculate.

    Graphic Design tutorials seem a little out of scope for a web development website. As does Photoshop and Illustrator.

    I'm led to believe w3schools is teaching more about capability, whether something is possible, over when you should use something, ie Designing a webpage.

    The most C# you'll get is on the Razor ASP.net tutorials. Maybe they could be expanded? I dunno. Haven't looked into ASP very much.

  5. Expanding on what merzgasalim said,

    You're using a lot of old tags, and misusing them too.

    You should never need more than one <main> tag. It usually signals that this is the main content. To read, or otherwise.
    You've created your own <header2> tag, which is... not quite to HTML standard. If you want custom tags, use CSS classes. Like <header class="myHeader">
    <center> is an old tag, and is not used except inside some antique processors like the Outlook email processor.

    I've had to change the img sources so I could get good testing going.

    Perhaps something like this would work better?

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="UTF-8" />
        <title>Portfolio</title>
        <style type="text/css">
          article {
            width: 600px;
            float: right;
            padding-right: 100px;
            font-size: 20px;
            line-height: 2;
            padding-top: 100px;
          }
          main {
            padding-left: 70px;
            padding-bottom: 50px;
            padding-top: 50px;
          }
          header {
            width: 100%;
            font-size: 60px;
            margin: 20px 0;
          }
          .center-header {
            margin: 0 auto;
            width: 350px;
          }
          .row {
            display: flex;
            width: 100%;
          }
    
          .column {
            flex: 33.33%;
            margin-left: 5px;
          }
          .column img {
            width: 100%;
          }
    
          div {
            font-family: Cambria, "Hoefler Text", "Liberation Serif", Times,
              "Times New Roman", serif;
            padding-top: 0px;
          }
          ul {
            list-style-type: none;
            margin-bottom: 5px;
            padding: 0;
            overflow: hidden;
            background-color: #333;
            display: flex;
            justify-content: center;
            width: 100%;
          }
    
          li {
            float: left;
          }
    
          li a {
            display: block;
            color: white;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
          }
    
          li a:hover {
            background-color: #111;
          }
          .active {
            background-color: #4caf50;
          }
        </style>
      </head>
    
      <body>
        <header><div class="center-header">Lauren Miller</div></header>
    
        <ul>
          <li><a href="graphic design.html">Graphic Design</a></li>
          <li><a class="active" href="index.html">About Me</a></li>
          <li><a href="art.html">Art</a></li>
        </ul>
    
        <div class="row">
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
              alt=""
            />
          </div>
    
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
              alt=""
            />
          </div>
    
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/1/14/Gatto_europeo4.jpg"
              alt=""
            />
          </div>
        </div>
    
        <div class="row">
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
              alt=""
            />
          </div>
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/1/14/Gatto_europeo4.jpg"
              alt=""
            />
          </div>
          <div class="column">
            <img
              src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
              alt=""
            />
          </div>
        </div>
      </body>
    </html>

     

  6. Is it necessary to have them in separate tables? This seems like the exact trouble you'd run if they're separate.

     

    You might want to look at `CASE` statements, and using `EXISTS`. If you really want to go down this route. I tried looking at these questions:

    https://stackoverflow.com/questions/4076098/how-to-select-rows-with-no-matching-entry-in-another-table/36694478#36694478

    https://stackoverflow.com/questions/63447/how-do-i-perform-an-if-then-in-an-sql-select

  7. Were you looking for something like this?

    <!DOCTYPE html>
    <html>
    <style>
    
    img {
      width: 500px;
    }
    
    .image-caption {
      display: none;
      width: 500px;
      background-color: cyan;
    }
    </style>
    <body>
      <div class="image-caption-container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"/>
        <div class="image-caption">
        This is a cat
        </div>
      </div>
      <div class="image-caption-container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"/>
        <div class="image-caption">
        This is a cat
        </div>
      </div>
    </body>
    
    <script>
    
    function handleClick() {
      console.log(this.children[1]);
      toggleDisplay.call(this.children[1])
    }
    
    function toggleDisplay() {
      var x = this;
      if (x.style.display === "block") {
        x.style.display = "none";
      } else {
        x.style.display = "block";
      }
    }
    
    window.onload = function() {
      var containers = document.querySelectorAll(".image-caption-container");
      containers.forEach(function (container) {
        container.onclick = handleClick;
      });
    };
    
    
    </script>
    </html>

     

  8. An SQL command given that you already have the unix time stored in another variable would be quite simple.

    DELETE FROM table WHERE time < ?

    As long as you've inserted these records with their related timestamp, this should remove everything that has a timestamp less than the value you set.

    The value can be calculated as

    <?php
    $criteria = time() - 3600; //3600 seconds is 1 hour
    ?>

     

  9. This one should be pretty simple, this should count up. Its just as simple as making sure that the 'countDownDate' is set to something in the past.

     

    All you need to do is replace two bits

    // Set the date we're counting down to
    var countDownDate = new Date("Jan 5, 2021 15:37:25").getTime();

    With

    // Set the date we're counting down to
    var countDownDate = new Date().getTime();

     

    And then this

    var distance = countDownDate - now;

    with

    var distance = now - countDownDate;

     

  10. Be aware, Our Services doesn't have a <a> inside it, so you'll need to correct that for this to work.

     

    Replacing 

    .navbar a:hover, .dropdown:hover .dropbtn {
      background-color: white;
      
    }

    With

    .navbar a:hover, .dropdown:hover .dropbtn, .dropdown:hover .dropbtn a {
      background-color: white;
      color: black;
    }

    Does what you want.

  11. I just fiddled with a couple of things in your code, it works fine, except for that fact that your search container is inside your blog container. It doesn't look like there's that much formatting in your code (unless your editor and the forum doesn't play nice).

    Here's a version that may work with some corrected styles too. (I just added display: none to the search container)

    CSS:

    #blogcontainer {
      width: 100%;
      height: 90%;
      float: left;
      overflow-y: hidden;
      padding: 0;
      position: static;
      float: left;
      margin-left: 0;
      margin-right: 0;
      margin-bottom: 0;
    }
    
    #searchcontainer {
      width: 100%;
      height: 90%;
      float: left;
      overflow-y: hidden;
      padding: 0;
      position: static;
      display: none;
      float: left;
      margin-left: 0;
      margin-right: 0;
      margin-bottom: 0;
    }
    
    #rightcontainer {
      height: 100vh;
      width: calc(100% - 20vh - (0.678 * (100%-20vh)));
      position: fixed;
      overflow: hidden;
      background-color: gray;
      margin-left: calc((0.678 * (100%-20vh)) + 20vh);
      float: left;
      margin-right: 0;
    }

    HTML:

    <div id="rightcontainer">
      <div id="searchbox">
        <form>
          <input type="text" placeholder="Search..." required />
          <input id="cardib" type="button" value="Search" onclick="getSearch()" />
        </form>
      </div>
    
      <button id="down" onclick="scrollDown()" onmouseenter="Highlight1()">
        &#9660;
      </button>
      <button id="up" onclick="scrollUp()" onmouseenter="Highlight2()">
        &#9650;
      </button>
    
      <div id="blogcontainer" onmouseover="RollOff1()" onmouseout="RollOff2()">
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">Valentines and Rats</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">Valentines and Rats</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
    
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">Valentines and Rats</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
    
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">Valentines and Rats</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
      </div>
      <div id="searchcontainer" onmouseover="RollOff1()" onmouseout="RollOff2()">
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">OMG</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">OMG</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
    
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">OMG</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
    
        <div class="postcontainer">
          <div class="thumb"></div>
          <div class="topblock">
            <div class="titleblock">OMG</div>
            <div class="moreblock">MORE ></div>
          </div>
          <div class="block">
            <div class="date"><p>February 14, 2016</p></div>
            We celebrate Valentine's Day while I battle rats in the coop.
          </div>
        </div>
      </div>
    </div>

     

  12. You might be able to query from what file the request is running on.

    You can always use $_SERVER['PHP_SELF'] to find out what file is running. Just go something like this for a quick and dirty solution.

    <li class="<?php echo ($_SERVER['PHP_SELF'] == "/index.php" ? "active" : "");?>">
    <a href="index.php">Start</a>
    </li>
    <li class="<?php echo ($_SERVER['PHP_SELF'] == "/about.php" ? "active" : "");?>">
    <a href="about.php">About</a>
    </li>
    <li class="<?php echo ($_SERVER['PHP_SELF'] == "/practices.php" ? "active" : "");?>">
    <a href="practices.php">Practices</a>
    </li>

    From what I've seen, it uses a relative-to-root path so if its under any directories you'll need to write it as "/sub-directory/about.php"

  13. Without a binding? You might be able to use a prepared query like this.

    <?php
    $stmt = $dbh->prepare("SELECT * FROM REGISTRY WHERE name = ? AND id = ?");
    if ($stmt->execute(array($name, $id))) {
      //Stuff
    }
    ?>

    If you want to see the other ways (mostly binding) you can check it out on the doc page:
    http://php.net/manual/en/pdo.prepared-statements.php

     

    Although I'm perplexed as to why it is imperative to not use a binding.

×
×
  • Create New...