Почему hamburger не работает на в media запросах?

var button = document.querySelector('.hamburger'); var headerList =  document.querySelector('.header-list');  button.onclick = function(){     headerList.classList.toggle('openMneu'); };
.header {   background-color: #13334c; }  .hamburger {   display: inline-block;   position: absolute;   right: 30%;   top: 8px;   visibility: hidden; }   .hamburger .fa-bars {     color: #fff; }  .logo {   padding: 20px 0; }  .logo__link {   color: #ffffff;   font-family: Philosopher;   font-size: 18px;   font-weight: 400; }  .header-list {   list-style-type: none;   display: -webkit-flex;   display: -moz-flex;   display: -ms-flex;   display: -o-flex;   display: -webkit-box;   display: -ms-flexbox;   display: flex;   -webkit-box-pack: end;   -webkit-justify-content: flex-end;       -ms-flex-pack: end;           justify-content: flex-end;   -webkit-box-align: center;   -webkit-align-items: center;       -ms-flex-align: center;           align-items: center;   margin-bottom: 0;   white-space: nowrap; }   .header-list__item {     color: #ffffff;     font-family: Philosopher;     font-size: 18px;     font-weight: 400;     margin-left: 26px;     padding: 20px 0;     position: relative;     border-bottom: 5px solid transparent; }     .header-list__item:hover {       border-bottom: 5px solid #fff; }     .header-list__item:first-child {       margin-left: 0; }  a {   color: #fff;   text-decoration: none; }   a:hover {     color: #fff;     text-decoration: none; }  .openMneu {   display: block; }      @media only screen and (max-width: 578px) 	.header-list 		display: none 	.hamburger 		z-index: 100 		top: -70px 		visibility: visible
<nav class='nav'> 					<ul class="header-list"> 						<li class="header-list__item"><a href="#">Главная</a></li> 						<li class="header-list__item"><a href="#"></a>Услуги</li> 						<li class="header-list__item"><a href="#"></a>Примеры</li> 						<li class="header-list__item"><a href="#"></a>О нас</li> 						<li class="header-list__item"><a href="#"></a>Контакты</li> 					</ul> 					<button class='hamburger'> 							<i class="fas fa-bars"></i> 					</button> 				</nav>

Java Many Readers One Writer with semaphores and multithreading

I’ve been looking for a solution to the may readers one writer in Java. I was intrigued by this question posted here and I read the wikipedia entry about it.

So far, I’ve reached a fine solution, or at least thats what I think. I’ve setup a new github repo to put the code to be used in another proyects if people want

But I’m open to improvements and critics if you see fit

The pseudocode of the main class is here

abstract class AbsrtactReadersWriter<T> {  Semaphore readCountSempaphote = new Semaphore(1); Semaphore resourceSemaphore = new Semaphore(1, true); Semaphore serviceQueueSemaphore = new Semaphore(1,true); AtomicInteger readCount = new AtomicInteger(0);   public final T read() {     T data = null;     try {         // Entry to read         serviceQueueSemaphore.acquire();         readCountSempaphote.acquire();         if (readCount.incrementAndGet() == 1){             resourceSemaphore.acquire();         }         serviceQueueSemaphore.release();         readCountSempaphote.release();         // CRITICAL SECTION Do read         data = executeReading();         // Exit to read         readCountSempaphote.acquire();         if (readCount.decrementAndGet() == 0){             resourceSemaphore.release();         }         readCountSempaphote.release();     } catch (InterruptedException e) {         System.out.println(e.getMessage());     }     return data;   }  // Protected critical section that read the resource abstract protected T executeReading();   public final void write(T data) {     try {         // Entry write         serviceQueueSemaphore.acquire();         resourceSemaphore.acquire();         serviceQueueSemaphore.release();         // CRITICAL SECTION  Do Write         executeWriting(data);         // Exit write         resourceSemaphore.release();     } catch (InterruptedException e) {         System.out.println(e.getMessage());     }   }  // Protected critical section that writes to the resource abstract protected void executeWriting(T data);  } 

This pseucode lacks some elements (privates, comments) form the class on the github repo, but hits the point.

In the repo, you can also see examples and tests.

The starvation problem on readers/writer is solved by Java itself, as the semaphores are created with the fair parameter, that forces the fairness of the blocking and a fifo queue on the waiting threads. I use an AtomicInteger to store the readcount, even it’s protected; the equality operation maybe not and doesn’t impose a great penalty

So, guys, what do you think ?

Impressão de uma matriz no console e no JTextArea

Estou fazendo um projeto de um disciplina da faculdade em java e estou com o seguinte problema:

Eu estava imprimindo a matriz que se refere ao mapa de um labirinto no console, ai está tudo certo ela imprime certo. Impressão no console

Ai para deixar um pouco mais bonito fiz uma class chamada UIBuilder que monta uma interface gráfica com um JTextArea que o texto é uma String formatada dessa mesma matriz. Ai que está o problema a matriz está diferente da impressão no console utilizando o mesmo método. Impressão no JTextArea

Método que imprime a matriz:

/**  * Formata o mapa da matriz em uma String  * @return String Mapa formatado  */ public String printMapa() {     String mapa = "";     for (int i = 0; i < this.altura; i++) {         for (int j = 0; j < this.largura; j++) {             Coordenada current = Coordenada.valueOf(i, j);             if (getPlayer().getPosicao().equals(current))                  mapa += "*";             else                 mapa += this.labirinto[i][j];         }         mapa += "\n";     }     return mapa; } 

Classe UIBuilder.java

package app.ui;  import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea;  import app.core.Mapa;  public class UIBuilder {      private JFrame frame;     private JTextArea label;     private Mapa mapa;      public UIBuilder(Mapa mapa) {         this.mapa = mapa;         build();     }      public void build() {         this.frame = new JFrame("Labirinto - Projeto C");         this.frame.setSize(800, 600);         this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         this.frame.setVisible(true);         this.label = new JTextArea("");         this.label.setEditable(false);         this.label.setSize(500, 500);         this.frame.add(this.label);     }      /**      * Precisa ser chamado em cada update do while      * em startMoving()...      */     public void update() {         this.label.setText(this.mapa.printMapa());     }  } 

O que pode estar causando essa diferença?

Packagist vs. repo.magento.com

For installation of the community edition is there any benefit to installing from repo.magento.com instead of Packagist?

I see that there are over 20k downloads of the community edition from packagist so I know it must be a pretty common practice, but the installation instructions recommend to install it from repo.magento.com.

I’ve searched through their documentation and couldn’t find any reason why they want you to use their repo instead of Packagist.

Is there something obvious I’m missing?

Creating AD module for application

I have application A, where i would like to add functionality for advertisement/collaboration.

The module should have its own database, application A should communicate with its API to retrieve info from the database of this module.

The database should contain information about companies and offers etc. However, i could do this without this module and put it all inside application A.

I am new to microservices, so i am asking the most important question, wouldn’t communication be slow? Is it worth doing like this?

How should i decide if creating microservice is worth?

Also, if i decide for doing it this way, what are the fastest way for communication? I would preferably go against communicating via HTTP (e.g rest api), but i am not sure what messaging service i should use.

Thanks for help.

Airplay 2: Connecting a HomePod, Sonos One and a Yamaha WXA-50 synced at the same time

I am unfamiliar with the AirPlay 2 Protocol. I am wondering if this setup is possible; I want to buy a

  • HomePod
  • Sonos One (is AirPlay 2 enabled)
  • Yamaha WXA-50 (is AirPlay 2 enabled)

Can I stream audio to each of these devices at the same time and have them all play in sync, like proper multi-room audio?

Player’s Circumventing the limitations of Wish

So I know that Wish is meant to be a really powerful spell, but some of my players from my group (I am the DM) seem to have spent some time into getting around the limitations of Wish. Now, I know that in order for no adverse (other than a mishap) you must replicate a spell of 8th level or lower, with anything else becoming a probability for you to never cast a wish spell again. You could wish for a magical weapon but that would be likely to transport you someplace where the weapon currently resides. I know that the Wish, if making something, must remain within three hundred cubic feet, or you could completely heal 20 creatures, or any number of weird stuff. Some of my players spent a large amount of time trying to create some wishes so that I cannot twist nor corrupt their wish. Now, I also know that they cannot just wish for something like 45 points of Dexterity, but they are legitimate wishes. One of them ran along the lines of “I wish for the immediate and complete obliteration of all (insert monster here, in this case it was the Tarrasque) in this plane of existence with absolutely no adverse side effects whatsoever.

How would a DM handle such a wish? Furthermore, if players are putting that much time into such a wish, would that even be considered abusing that power? I realize that they might never cast that spell again due to the 33% chance of never being able to cast it again, but I honestly believe telling them that their spell fails is an absolute last resort. I would prefer if the answers came from experience and not conjuncture.

Transportation card in Taiwan

Is there a universal transportation card that is valid for MTR and buses all over the Taiwan? Or do I have to buy a new card each time I visit a new city in Taiwan?

If there is no universal card, I see that there is an Easy card in Taipei. What are its analogues in Taichung and Kaohsiung, and can I buy them at THSR stations in each of the cities on arrival?

Duda sobre cómo funcionan las funciones en un bucle infinito

Valga la redundancia en el título jaja. Bueno, estoy haciendo un juego con pygame para clase de informática en bachillerato. Tengo montado un while True y ahí dentro metí lo siguiente:

if victoria == 30:     pygame.mixer.music.stop()     pygame.mixer.music.load("victory.wav")     pygame.mixer.music.play(-1)     surface.blit(victoria, (0,0))     vbx = 0     vby = 0 

Cuando se cumplían los requisitos para la victoria la canción que tenía que sonar, al estar metida dentro del bucle, empezaba a sonar 30 veces por segundo.

Luego me dí cuenta que si todo lo que he puesto en ese if lo defino previamente como una función y dentro del while lo dejo así

if victoria == 30:     win() 

la canción empezaba a sonar una sola vez, como debe ser.

Mi pregunta es la siguiente, por qué el while True sólo lee una vez la función en vez de leerlo 30 veces por segundo como lo puse anteriormente?