Jump to content

Ingolme

Moderator
  • Posts

    14,894
  • Joined

  • Last visited

  • Days Won

    175

Posts posted by Ingolme

  1. Here are some tweaks I made to the CSS to get it to align to the right.

    You just need to replace the existing .topnav, .topnav a and .dropdown rules with these ones:

    .topnav {
      text-align: right;
      overflow: hidden;
      background-color: #333;
    }
    
    .topnav a {
      display: inline-block;
      vertical-align: middle;
      color: #f2f2f2;
      text-align: center;
      padding: 14px 16px;
      text-decoration: none;
      font-size: 17px;
    }
    
    .dropdown {
      display: inline-block;
      vertical-align: middle;
      overflow: hidden;
    }

     

    • Like 1
  2. If they're greyscale, all the images will have the same value for the red, green and blue channels. CSS doesn't let you tint the background images. If the source images are already visibly red, or cyan, it should work as it is.

    You can use <canvas> with Javascript to composite the images, but it's not exactly simple. You need to learn how to program on the canvas, then you can grab pixel data from each of the images and composite them manually.

  3. A simple solution would be to allow horizontal scrolling on the container and then make the image size larger on small screens.

    For this to work, each comic panel needs be within a third of the width of the image. Different spacing between the panels might cause them to not line up perfectly.

    HTML:

    <div class="strip">
      <img src="comic-strip.png" alt="Comic strip">
    </div>

    CSS:

    .strip { overflow: auto; }
    .strip img { display: block; width: 100%; }
    @media screen and (max-width:768px) {
      .strip-img { width: 300%; }
    }

     

  4. You can't. They are completely different objects with no connection to each other. If you put the string "Mike" into object A and then ask object B for the string you won't find it there.

    When you write setName("Mike") it's a shorthand for calling this.setName("Mike") and this is an object. Then you have a completely different object called getData. You haven't written getData.setName("Mike") so it won't give you anything.

    For your test to make sense you need to write this code:

    public class CreateAccount {
      @Test
      public void test1() {
        GetData getData = new GetData();
        getData.setName("Mike");
        String name = getData.GetMyData();
        System.out.println("get name: " + name);
      }
    }

     

    Why exactly do you want two different objects to point to the same data?

  5. You need a loop. You can use indexOf() and go changing the initial offset until you've found all the matches. When it returns -1 there are no more matches.

    String words = "I go to summer school. I also go to winter school";
    int counter = 0;
    int start = words.indexOf("e");
    while(start > -1) {
      counter++;
      start = words.indexOf("e", start + 1);
    }
    System.out.println("counter " + counter);

     

  6. I'm not subscribed to the New York Times, so I can't see the articles.

    You can start by testing different libraries to see which ones are best suited for your project. Most likely none of them will be perfect but they should be a good starting point. After you have a library you will most likely need to write some additional code yourself or hire someone to do it.

    There's a tradeoff between ease-of-use and specialization. If you're satisfied with how a library works out of the box you can just use it as it is. If you want code specialized for your exact use case then you'll need somebody with a minimum level of programming skills. New York Times is a very large company, I would imagine that they've paid developers to code things exactly to their specifications.

×
×
  • Create New...