问:
Why was my scroll bar enabled on my HTML site?
I am new in this field and now I am trying to improve myself by testing. I kept trying to figure out why I scroll bar vertically and horizontally, from what I noticed I think it's because of the tables. How can I solve this?
I know I didn't organize it very well, but I really want to solve that scroll bar, I also tried to hide it from the body, but if someone has a lower resolution, the total site will not be displayed. What do you think I could do to them?

body
{
 margin: 0;
 padding: 0;
 min-height: 100vh;
 background: #b3ccff;
 font-family: arcon;
  display: inline-block;
}
/* ------ [profesoreconomist.ro] ------ */
.link{
  left: 100px;
  top: 50px;
  position: absolute;
}
/* ------ [Imagine Banner] ------ */
.banner{
position: relative;
top: 0;
margin-top: 4.3%;
right: -80px;
max-width: 1750px;
}
/* ------ [Continut butoane] ------ */
.spoiler {
  display: none;
  bottom: 50%;
}
.show {
  display: none;
}
.hide:target + .show {
  display: inline;
}
.hide:target {
  display: none;
}
.hide:target ~ .spoiler {
  display: inline;
}
/* ------ [Buton Pagina Principala] ------ */
.btn {
  padding: 10px 30px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post1 {
  position: relative;
  padding: 20px;
  right: -58px;
}
/* ------ [Buton Curriculum] ------ */
.btn2 {
  position: relative;
  right: 0;
  top: 29%;
  padding: 10px 50px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post2 {
  position: relative;
  top: -42px;
  left: 270px;
}
/* ------ [Buton Standarde de pregatire...] ------ */
.btn3 {
  padding: 10px 12px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post3 {
  position: relative;
  padding: 20px;
  right: -435px;
  top: -84px;
}
/* ------ [Buton Prolectare didactica] ------ */
.btn4 {
  padding: 10px 30px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post4 {
  position: relative;
  padding: 20px;
  right: -723px;
  top: -146px;
}
/* ------ [Buton Evaluare] ------ */
.btn5 {
  padding: 10px 27px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post5 {
  position: relative;
  right: -963px;
  top: -188px;
}
/* ------ [Buton Resurse internationale] ------ */
.btn6 {
  padding: 10px 12px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post6 {
  position: relative;
  right: -1085px;
  top: -210px;
}
/* ------ [Buton Proiecte scolare] ------ */
.btn7 {
  padding: 10px 8px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post7 {
  position: relative;
  right: -1273px;
  top: -232px;
}
/* ------ [Buton Concursuri si olimpiade scolare] ------ */
.btn8 {
  padding: 10px 14px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post8 {
  position: relative;
  right: -1410px;
  top: -254px;
}
.spoiler-content {
 position: fixed;
 bottom: 40%;
 right: 45%;
}
/* ------ [Meniu Pagina autentificare] ------ */
input[type=text], input[type=password] {
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}
@-webkit-keyframes animatezoom {
  from {-webkit-transform: scale(0)}
  to {-webkit-transform: scale(1)}
}

@keyframes animatezoom {
  from {transform: scale(0)}
  to {transform: scale(1)}
}
@media screen and (max-width: 300px) {
  span.psw {
    display: block;
    float: none;
  }
  /* ------ [Pozitie buton cancel din meniul de autentificare] ------ */
  .cancelbtn {
    position: fixed;
    width: 100%;
    bottom: 100%;
  }
}
/* ------ [Buton Autentificare] ------ */
.login {
  padding: 13px 43px;
  margin-bottom: 0;
  *margin-left: .3em;
  cursor: pointer;
  background-color: #4d94ff;
  border: none;
   width: 200px;
 }
 /* ------ [Pozitie buton autentificare] ------ */
 .plogin {
  position: relative;
  top: -284px;
  right: -1669px;
 }
 /* ------ [Buton Login din meniul de autentificare] ------ */
 .login2 {
    padding: 12.5px 43px;
  margin-bottom: 0;
  *margin-left: .3em;
  cursor: pointer;
  background-color: #4d94ff;
  border: none;
   width: 100%;
 }
button:hover {
  opacity: 0.8;
}

/* ------ [Buton cancel din meniul de autentificare] ------ */
.cancelbtn {
 left: 0%;
  width: auto;
  padding: 10px 18px;
  background-color: #f44336;
  border: none;
}
/* ------ [Pozitie imagine din meniul de autentificare] ------ */
.imgcontainer {
  text-align: center;
  margin: 24px 0 12px 0;
  position: relative;
}

img.avatar {
  width: 20%;
  border-radius: 50%;
}

.container {
  padding: 16px;
}

span.psw {
  float: right;
  padding-top: 16px;
}

/* ------ [Background meniu de autentificare] ------ */
.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
  padding-top: 60px;
}

/* ------ [Continut meniu login] ------ */
.modal-content {
  background-color: #fefefe;
  margin: 5% auto 15% auto;
  border: 1px solid #888;
  width: 80%;
}

/* ------ [Buton X pentru inchidere meniu login] ------ */
.close {
  position: absolute;
  right: 25px;
  top: 0;
  color: #000;
  font-size: 35px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: red;
  cursor: pointer;
}

.animate {
  -webkit-animation: animatezoom 0.6s;
  animation: animatezoom 0.6s
}
/* ------ [Tabel Noutati] ------ */
.tabel-noutati {
  position: relative;
  left: 80px;
  top: -270px;
  border-collapse: collapse;
  width: 350px;
  background-color: #ffffff;
}
/* ------ [Background alb tabele] ------ */
td, th {
  border: 1px solid #dddddd;
  text-align: left;
  height: 550px;
  right: 10px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
/* ------ [Text noutati] ------ */
.news {
  position: absolute;
 top: -2.5%;
 left: 15px;
}
/* ------ [Text link-uri utile] ------ */
.links {
 position: absolute;
 top: -2.5%;
 left: 15px;
}
/* ------ [Tabel link-uri urile] ------ */
.tabel-links{
 position: relative;
  left: 1399px;
  bottom: 0;
  border-collapse: collapse;
  width: 350px;
  background-color: #ffffff;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
<title>xxxxxxx</title>
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<div id="container">
<div id="header">

</div>
<body>
  <!------ Buton Pagina Principala ------>
<div class="forum-post1">
    Pagina principala
    Pagina principala
    <div class="spoiler">
      <p class="spoiler-content">Bine ai venit pe site-ul nostru!</p>
    </div>
</div>
  <!------ Buton Curriculum ------>
<div class="forum-post2">
    Curriculum
    Curriculum
    <div class="spoiler">
      <p class="spoiler-content">Continutul din Curriculum</p>
    </div>
</div>
  <!------ Buton Standarde de pregatire profesionala ------>
<div class="forum-post3">
    Standarde de pregatire profesionala
    Standarde de pregatire profesionala
    <div class="spoiler">
      <p class="spoiler-content">Standarde de pregatire profesionala</p>
    </div>
</div>
  <!------ Buton Prolectarea didactică ------>
<div class="forum-post4">
    Prolectarea didactică
    Prolectarea didactică
    <div class="spoiler">
      <p class="spoiler-content">Prolectarea didactică</p>
    </div>
</div>
  <!------ Buton Evaluare ------>
<div class="forum-post5">
    Evaluare
    Evaluare
    <div class="spoiler">
      <p class="spoiler-content">Continutul din Evaluare</p>
    </div>
</div>
  <!------ Buton Resurse internaționale ------>
<div class="forum-post6">
    Resurse internaționale
    Resurse internaționale
    <div class="spoiler">
      <p class="spoiler-content">Resurse internaționale</p>
    </div>
</div>
  <!------ Buton Proiecte școlare ------>
<div class="forum-post7">
    Proiecte școlare
    Proiecte școlare
    <div class="spoiler">
      <p class="spoiler-content">Continutul din Proiecte școlare</p>
    </div>
</div>
  <!------ Buton Concursuri si olimpiade scolare------>
<div class="forum-post8">
    Concursuri și olimpiade școlare
    Concursuri și olimpiade școlare
    <div class="spoiler">
      <p class="spoiler-content">Concursuri și olimpiade școlare</p>
    </div>
</div>
  <!------ Buton catre link-ul profesoreconomit.ro------>
profesoreconomist.ro
  <!------ Buton de Autentificare / Meniul de autentificare ------>
<div class="plogin">
<button class="login" onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Autentificare</button>
</div>
<div id="id01" class="modal">
  <form class="modal-content animate" action="#" method="post">
    <div class="imgcontainer">
      <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
      <img src="img\avatar.png" alt="Avatar" class="avatar">
    </div>
    <div class="container">
      <label for="uname"><b>Numele utilizatorului</b></label>
      <input type="text" placeholder="Introdu numele de utilizator" name="uname" required>

      <label for="psw"><b>Parola</b></label>
      <input type="password" placeholder="Introdu parola" name="psw" required>

      <button class="login2" type="submit">Login</button>
      <label>
        <input type="checkbox" checked="checked" name="remember"> Ține-mă minte
      </label>
    </div>

    <div class="container" style="background-color:#f1f1f1">
      <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
      <span class="psw">Ai uitat parola?</span>
    </div>
  </form>
</div>

<script>
var modal = document.getElementById('id01');
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
</script>
  <!------ Tabelurile de noutati si link-uri utile ------>
<table class="tabel-noutati">
  <tr>
  <th>
  <h2 class="news">Noutăți</h2>

<table class="tabel-links">
  <tr>
  <th class="thh">
  <h2 class="links">Link-uri utile</h2>

  </body>
</html></code>```

答:
You can implement a vertically stacked overflow menu like this. However, you would need to use JavaScript to "listen" for the menu overflow button on-click event.

Perhaps look into grouping your menu items too, this can also save space. example

Body:
I am new in this field and now I am trying to improve myself by testing. I kept trying to figure out why I scroll bar vertically and horizontally, from what I noticed I think it's because of the tables. How can I solve this?
I know I didn't organize it very well, but I really want to solve that scroll bar, I also tried to hide it from the body, but if someone has a lower resolution, the total site will not be displayed. What do you think I could do to them?

body
{
 margin: 0;
 padding: 0;
 min-height: 100vh;
 background: #b3ccff;
 font-family: arcon;
  display: inline-block;
}
/* ------ [profesoreconomist.ro] ------ */
.link{
  left: 100px;
  top: 50px;
  position: absolute;
}
/* ------ [Imagine Banner] ------ */
.banner{
position: relative;
top: 0;
margin-top: 4.3%;
right: -80px;
max-width: 1750px;
}
/* ------ [Continut butoane] ------ */
.spoiler {
  display: none;
  bottom: 50%;
}
.show {
  display: none;
}
.hide:target + .show {
  display: inline;
}
.hide:target {
  display: none;
}
.hide:target ~ .spoiler {
  display: inline;
}
/* ------ [Buton Pagina Principala] ------ */
.btn {
  padding: 10px 30px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post1 {
  position: relative;
  padding: 20px;
  right: -58px;
}
/* ------ [Buton Curriculum] ------ */
.btn2 {
  position: relative;
  right: 0;
  top: 29%;
  padding: 10px 50px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post2 {
  position: relative;
  top: -42px;
  left: 270px;
}
/* ------ [Buton Standarde de pregatire...] ------ */
.btn3 {
  padding: 10px 12px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post3 {
  position: relative;
  padding: 20px;
  right: -435px;
  top: -84px;
}
/* ------ [Buton Prolectare didactica] ------ */
.btn4 {
  padding: 10px 30px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post4 {
  position: relative;
  padding: 20px;
  right: -723px;
  top: -146px;
}
/* ------ [Buton Evaluare] ------ */
.btn5 {
  padding: 10px 27px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post5 {
  position: relative;
  right: -963px;
  top: -188px;
}
/* ------ [Buton Resurse internationale] ------ */
.btn6 {
  padding: 10px 12px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post6 {
  position: relative;
  right: -1085px;
  top: -210px;
}
/* ------ [Buton Proiecte scolare] ------ */
.btn7 {
  padding: 10px 8px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post7 {
  position: relative;
  right: -1273px;
  top: -232px;
}
/* ------ [Buton Concursuri si olimpiade scolare] ------ */
.btn8 {
  padding: 10px 14px;
  margin-bottom: 0;
  *margin-left: .3em;
  font-size: 16px;
  font-weight: bold;
  color: #333333;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  vertical-align: middle;
  cursor: pointer;
  background-color: #f5f5f5;
  *background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  *border: 0;
  border-color: #e6e6e6 #e6e6e6 #bfbfbf;
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
  border-bottom-color: #a2a2a2;
  text-decoration: none;
}
.forum-post8 {
  position: relative;
  right: -1410px;
  top: -254px;
}
.spoiler-content {
 position: fixed;
 bottom: 40%;
 right: 45%;
}
/* ------ [Meniu Pagina autentificare] ------ */
input[type=text], input[type=password] {
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}
@-webkit-keyframes animatezoom {
  from {-webkit-transform: scale(0)}
  to {-webkit-transform: scale(1)}
}

@keyframes animatezoom {
  from {transform: scale(0)}
  to {transform: scale(1)}
}
@media screen and (max-width: 300px) {
  span.psw {
    display: block;
    float: none;
  }
  /* ------ [Pozitie buton cancel din meniul de autentificare] ------ */
  .cancelbtn {
    position: fixed;
    width: 100%;
    bottom: 100%;
  }
}
/* ------ [Buton Autentificare] ------ */
.login {
  padding: 13px 43px;
  margin-bottom: 0;
  *margin-left: .3em;
  cursor: pointer;
  background-color: #4d94ff;
  border: none;
   width: 200px;
 }
 /* ------ [Pozitie buton autentificare] ------ */
 .plogin {
  position: relative;
  top: -284px;
  right: -1669px;
 }
 /* ------ [Buton Login din meniul de autentificare] ------ */
 .login2 {
    padding: 12.5px 43px;
  margin-bottom: 0;
  *margin-left: .3em;
  cursor: pointer;
  background-color: #4d94ff;
  border: none;
   width: 100%;
 }
button:hover {
  opacity: 0.8;
}

/* ------ [Buton cancel din meniul de autentificare] ------ */
.cancelbtn {
 left: 0%;
  width: auto;
  padding: 10px 18px;
  background-color: #f44336;
  border: none;
}
/* ------ [Pozitie imagine din meniul de autentificare] ------ */
.imgcontainer {
  text-align: center;
  margin: 24px 0 12px 0;
  position: relative;
}

img.avatar {
  width: 20%;
  border-radius: 50%;
}

.container {
  padding: 16px;
}

span.psw {
  float: right;
  padding-top: 16px;
}

/* ------ [Background meniu de autentificare] ------ */
.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
  padding-top: 60px;
}

/* ------ [Continut meniu login] ------ */
.modal-content {
  background-color: #fefefe;
  margin: 5% auto 15% auto;
  border: 1px solid #888;
  width: 80%;
}

/* ------ [Buton X pentru inchidere meniu login] ------ */
.close {
  position: absolute;
  right: 25px;
  top: 0;
  color: #000;
  font-size: 35px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: red;
  cursor: pointer;
}

.animate {
  -webkit-animation: animatezoom 0.6s;
  animation: animatezoom 0.6s
}
/* ------ [Tabel Noutati] ------ */
.tabel-noutati {
  position: relative;
  left: 80px;
  top: -270px;
  border-collapse: collapse;
  width: 350px;
  background-color: #ffffff;
}
/* ------ [Background alb tabele] ------ */
td, th {
  border: 1px solid #dddddd;
  text-align: left;
  height: 550px;
  right: 10px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
/* ------ [Text noutati] ------ */
.news {
  position: absolute;
 top: -2.5%;
 left: 15px;
}
/* ------ [Text link-uri utile] ------ */
.links {
 position: absolute;
 top: -2.5%;
 left: 15px;
}
/* ------ [Tabel link-uri urile] ------ */
.tabel-links{
 position: relative;
  left: 1399px;
  bottom: 0;
  border-collapse: collapse;
  width: 350px;
  background-color: #ffffff;
}

<!DOCTYPE html>

<title>xxxxxxx</title>
  <link rel="stylesheet" type="text/css" href="style.css">

    Pagina principala
    Pagina principala

Bine ai venit pe site-ul nostru!

    Curriculum
    Curriculum

Continutul din Curriculum

    Standarde de pregatire profesionala
    Standarde de pregatire profesionala

Standarde de pregatire profesionala

    Prolectarea didactică
    Prolectarea didactică

Prolectarea didactică

    Evaluare
    Evaluare

Continutul din Evaluare

    Resurse internaționale
    Resurse internaționale

Resurse internaționale

    Proiecte școlare
    Proiecte școlare

Continutul din Proiecte școlare

    Concursuri și olimpiade școlare
    Concursuri și olimpiade școlare

Concursuri și olimpiade școlare

profesoreconomist.ro

<button class="login" onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Autentificare</button>

  <form class="modal-content animate" action="#" method="post">

      ×

      Numele utilizatorului
      <input type="text" placeholder="Introdu numele de utilizator" name="uname" required>

      Parola
      <input type="password" placeholder="Introdu parola" name="psw" required>

      <button class="login2" type="submit">Login</button>

        <input type="checkbox" checked="checked" name="remember"> Ține-mă minte

      <button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
      Ai uitat parola?

  </form>

Noutăți

Link-uri utile


来源: stackexchange

问:
LinkedIn Share URL is not populating the message / title
This is similar to this question

I am trying to build a url that populates a post for someone to share on LinkedIn. Following their guide I am using the url

```<code>https://www.linkedin.com/shareArticle
?url=<uriecodedurl>
&mini=true
&title=<uriencodedtitle>
&summary=<uriencodedwords>
&source=<uriencodedwords>
</code>```

and also &text=hello from another SO Q.

This creates the post alright, but gets redirected and all the queries are removed except url. The share/post then contains the website with the title & summary from the meta tags, but I cannot work out how to pre-populate the text in the post.

So my question is, is it possible to pre-populate a post, and if so, how?

For example, with the twitter sharing url, I can use the &text=words to populate a tweet that the user can edit before posting.

答:
Your URL format for sharing is deprecated and no longer supported by LinkedIn.  For now, in 2020, url is the only acceptable GET argument and the following is the accepted share URL format...

```<code>https://www.linkedin.com/sharing/share-offsite/?url={url}
</code>```

Source: Official LinkedIn Sharing Documentation.

Question 1: Can you pre-populate the message?

No, there is no way to do that with the share-offsite URL above.

BUT -- if you register an application id with LinkedIn, and configure the LinkedIn Share Plugin (not to be confused with the LinkedIn Share URL), then yes, you will be able to configure texts.  But that's an entirely different API and maybe a bit much.  If you go that route, it's possible, otherwise, it's not.

The reasoning here should be obvious.  Without a registered App_id, LinkedIn is worried about prepopulating harmful messages, whereas once you have an App_id, and you use their API package, then you are a trusted entity using a trusted auth platform, etc..

Question 2: Can you prepopulate the title?

Yes, set the og: tag in the  block of your HTML, like so...

<meta property='og:title' content='Title of the article"/>

Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.

ContentLicense: CC BY-SA 4.0

Body:
This is similar to this question

I am trying to build a url that populates a post for someone to share on LinkedIn. Following their guide I am using the url

https://www.linkedin.com/shareArticle
?url=<uriecodedurl>
&mini=true
&title=<uriencodedtitle>
&summary=<uriencodedwords>
&source=<uriencodedwords>

and also &text=hello from another SO Q.

This creates the post alright, but gets redirected and all the queries are removed except url. The share/post then contains the website with the title & summary from the meta tags, but I cannot work out how to pre-populate the text in the post.

So my question is, is it possible to pre-populate a post, and if so, how?

For example, with the twitter sharing url, I can use the &text=words to populate a tweet that the user can edit before posting.

Body:
Your URL format for sharing is deprecated and no longer supported by LinkedIn.  For now, in 2020, url is the only acceptable GET argument and the following is the accepted share URL format...

https://www.linkedin.com/sharing/share-offsite/?url={url}

Source: Official LinkedIn Sharing Documentation.

Question 1: Can you pre-populate the message?

No, there is no way to do that with the share-offsite URL above.

BUT -- if you register an application id with LinkedIn, and configure the LinkedIn Share Plugin (not to be confused with the LinkedIn Share URL), then yes, you will be able to configure texts.  But that's an entirely different API and maybe a bit much.  If you go that route, it's possible, otherwise, it's not.

The reasoning here should be obvious.  Without a registered App_id, LinkedIn is worried about prepopulating harmful messages, whereas once you have an App_id, and you use their API package, then you are a trusted entity using a trusted auth platform, etc..

Question 2: Can you prepopulate the title?

Yes, set the og: tag in the <head> block of your HTML, like so...

<meta property='og:title' content='Title of the article"/>

Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.


问:
C/C++: Easily unzip to memory
I need to find a library that allows me to easily get a directory listing of all the files inside a ZIP archive and allows me to extract any given file inside the archive to memory (a buffer). Preferably, it should be a high-level library since my requirements aren't very complex (what I mentioned above is pretty much all I need).

Previously I tried PhysFS which has the behavior I need (easily access files inside an archive), but it's unsuitable because of other reasons (there are many archives and PhysFS would require me to mount all of them individually, which is not an option). Another library that kinda has the functionality I need is Chilkat, but it's shareware so I can't use it either.

Any other suggestions?

答:
While .zip uses zlib http://zlib.net compression, it alone is not sufficient to get a directory listing from a .zip file.

You also need code that can read the .zip dictionary format.  Check out Minizip http://www.winimage.com/zLibDll/minizip.html.  It provides a code and simple zip/unzip command line executables.

edit 2 The code is entirely C (so is Zlib) -- the page has links to two c++ wrapper libs that both seem to be dead links.

ContentLicense: CC BY-SA 3.0

Title: C/C++: Easily unzip to memory


问:
How to divide total days output by individual year in python so that total days doesn't effect one particular year
Iam currently working on analyzing the delay in the response to a request made to each department. Format of data is as below:

```<code>Department     RequestDate     ResponseDate
Electronics    2019-05-01      2019-09-19
Babyshop       2018-08-02      2019-09-30
Grocery        2016-01-01      2018-01-01
Pharmacy       2015-03-01      2018-03-01
</code>```

What iam trying to accomplish is divide total days into respective years. The expected output is as below:

```<code>Department     RequestDate     ResponseDate   2015  2016  2017  2018  2019    TotalDays
Electronics    2019-05-01      2019-09-19      0      0    0     0     149     149
Babyshop       2018-08-02      2019-09-30      0      0    0     152   272     424
Grocery        2016-01-01      2018-01-01      0      365  365   1     0       731
Pharmacy       2015-03-01      2018-03-01      306    365  365   60    0       1096
</code>```

currently my workflow is in excel and it is tidious. Is there any way to make use of python functions.

答:
I have tried my best to include every boundary condition in the solution. As far as index are concerned I think you can take care of that.

```<code>import calendar as cd
df = pd.DataFrame(columns=['RequestDate','ResponseDate'])
df.RequestDate = [pd.Timestamp('2019-05-01'), pd.Timestamp('2018-08-02'), pd.Timestamp('2016-01-01'),pd.Timestamp('2015-03-01')]
df.ResponseDate = [pd.Timestamp('2019-09-19'), pd.Timestamp('2019-09-30'), pd.Timestamp('2018-01-01'),pd.Timestamp('2018-03-01')]

df['TotalDays']=(df.ResponseDate-df.RequestDate).dt.days+1  #This is done coz it
#  seems in sample data, that the day corresponding to **ResponseDate**
# has also been counted when it comes to number of days for each years
year_min = df['RequestDate'].min().year
year_max = df['ResponseDate'].max().year
years = [i for i in range(year_min,year_max+1)]

for i in years:
    df[i]=0
df.columns=['RequestDate','ResponseDate', 'TotalDays', *years]
l=[]

for i in range(len(years)-1):
    z=[]
    for item, row in df.iterrows():
        row[years[i]] = (min(row['ResponseDate'], pd.Timestamp(f'{years[i]+1}-01-01'))-max(row['RequestDate'], pd.Timestamp(f'{years[i]-1}-12-31'))).days
        if cd.isleap(years[i])==True:
            if row[years[i]]<=0:
                row[years[i]]=0
            elif row[years[i]]>366:
                row[years[i]]=366
        else:
            if row[years[i]]<=0:
                row[years[i]]=0
            elif row[years[i]]>365:
                row[years[i]]=365

        z.append(row[years[i]])
    l.append(z)

for i in range(len(years)-1):
    df[years[i]]=l[i]
df[years[-1]]=df['TotalDays']-df.iloc[:, 3:-1].sum(axis=1)
df=df[['RequestDate','ResponseDate',*years,'TotalDays']]
df
</code>```

there could be better answers, but I can't think of them. Does this work in your all cases?

Body:
Iam currently working on analyzing the delay in the response to a request made to each department. Format of data is as below:

Department     RequestDate     ResponseDate
Electronics    2019-05-01      2019-09-19
Babyshop       2018-08-02      2019-09-30
Grocery        2016-01-01      2018-01-01
Pharmacy       2015-03-01      2018-03-01

What iam trying to accomplish is divide total days into respective years. The expected output is as below:

Department     RequestDate     ResponseDate   2015  2016  2017  2018  2019    TotalDays
Electronics    2019-05-01      2019-09-19      0      0    0     0     149     149
Babyshop       2018-08-02      2019-09-30      0      0    0     152   272     424
Grocery        2016-01-01      2018-01-01      0      365  365   1     0       731
Pharmacy       2015-03-01      2018-03-01      306    365  365   60    0       1096

currently my workflow is in excel and it is tidious. Is there any way to make use of python functions.

Body:
I have tried my best to include every boundary condition in the solution. As far as index are concerned I think you can take care of that.

import calendar as cd
df = pd.DataFrame(columns=['RequestDate','ResponseDate'])
df.RequestDate = [pd.Timestamp('2019-05-01'), pd.Timestamp('2018-08-02'), pd.Timestamp('2016-01-01'),pd.Timestamp('2015-03-01')]
df.ResponseDate = [pd.Timestamp('2019-09-19'), pd.Timestamp('2019-09-30'), pd.Timestamp('2018-01-01'),pd.Timestamp('2018-03-01')]

df['TotalDays']=(df.ResponseDate-df.RequestDate).dt.days+1  #This is done coz it
#  seems in sample data, that the day corresponding to **ResponseDate**
# has also been counted when it comes to number of days for each years
year_min = df['RequestDate'].min().year
year_max = df['ResponseDate'].max().year
years = [i for i in range(year_min,year_max+1)]

for i in years:
    df[i]=0
df.columns=['RequestDate','ResponseDate', 'TotalDays', *years]
l=[]

for i in range(len(years)-1):
    z=[]
    for item, row in df.iterrows():
        row[years[i]] = (min(row['ResponseDate'], pd.Timestamp(f'{years[i]+1}-01-01'))-max(row['RequestDate'], pd.Timestamp(f'{years[i]-1}-12-31'))).days
        if cd.isleap(years[i])==True:
            if row[years[i]]<=0:
                row[years[i]]=0
            elif row[years[i]]>366:
                row[years[i]]=366
        else:
            if row[years[i]]<=0:
                row[years[i]]=0
            elif row[years[i]]>365:
                row[years[i]]=365

        z.append(row[years[i]])
    l.append(z)

for i in range(len(years)-1):
    df[years[i]]=l[i]
df[years[-1]]=df['TotalDays']-df.iloc[:, 3:-1].sum(axis=1)
df=df[['RequestDate','ResponseDate',*years,'TotalDays']]
df

there could be better answers, but I can't think of them. Does this work in your all cases?


问:
how to create a DF from a DF based on a condition
My current DF looks like this

```<code>Combinations               Count
1   ('IDLY', 'VADA')       3734
6   ('DOSA', 'IDLY')        2020
9   ('CHAPPATHI', 'DOSA')   1297
10  ('IDLY', 'POORI')       1297
11  ('COFFEE', 'TEA')       1179
13  ('DOSA', 'VADA')        1141
15  ('CHAPPATHI', 'IDLY')   1070
16  ('COFFEE', 'SAMOSA')    1061
17  ('COFFEE', 'IDLY')      1016
18  ('POORI', 'VADA')       1008
</code>```

Lets say I filter by the keyword 'DOSA' from above data frame I get the below OP

```<code>    Combinations           Count
6   ('DOSA', 'IDLY')        2020
9   ('CHAPPATHI', 'DOSA')   1297
13  ('DOSA', 'VADA')        1141
</code>```

But I would like the output to be like the df below(which has ignored the filter key word as its common,

```<code>    Combinations    Count
6   IDLY            2020
9   CHAPPATHI       1297
13  VADA            1141
</code>```

What concept of pandas needs to be used here? How can this be achieved?

答:
In general, it's not ideal to have list, tuples, sets, etc inside a dataframe. It's better to have multiple records for each instance when needed.

You can use explode turn Combinations into this form and filter on that

```<code>keyword = 'DOSA'

s = df.explode('Combinations')

s.loc[s.Combinations.eq('keyword').groupby(level=0).transform('any') & s.Combinations.ne('keyword')]
</code>```

Or chain the two commands with .loc[lambda ]:

```<code>(df.explode('Combinations')
   .loc[lambda x: x.Combinations.ne(keyword) &
            x.Combinations.eq(keyword).groupby(level=0).transform('any')]
)
</code>```

Output:

```<code>   Combinations  Count
6          IDLY   2020
9     CHAPPATHI   1297
13         VADA   1141
</code>```

Body:
My current DF looks like this

Combinations               Count
1   ('IDLY', 'VADA')       3734
6   ('DOSA', 'IDLY')        2020
9   ('CHAPPATHI', 'DOSA')   1297
10  ('IDLY', 'POORI')       1297
11  ('COFFEE', 'TEA')       1179
13  ('DOSA', 'VADA')        1141
15  ('CHAPPATHI', 'IDLY')   1070
16  ('COFFEE', 'SAMOSA')    1061
17  ('COFFEE', 'IDLY')      1016
18  ('POORI', 'VADA')       1008

Lets say I filter by the keyword 'DOSA' from above data frame I get the below OP

    Combinations           Count
6   ('DOSA', 'IDLY')        2020
9   ('CHAPPATHI', 'DOSA')   1297
13  ('DOSA', 'VADA')        1141

But I would like the output to be like the df below(which has ignored the filter key word as its common,

    Combinations    Count
6   IDLY            2020
9   CHAPPATHI       1297
13  VADA            1141

What concept of pandas needs to be used here? How can this be achieved?

Body:
In general, it's not ideal to have list, tuples, sets, etc inside a dataframe. It's better to have multiple records for each instance when needed.

You can use explode turn Combinations into this form and filter on that

keyword = 'DOSA'

s = df.explode('Combinations')

s.loc[s.Combinations.eq('keyword').groupby(level=0).transform('any') & s.Combinations.ne('keyword')]

Or chain the two commands with .loc[lambda ]:

(df.explode('Combinations')
   .loc[lambda x: x.Combinations.ne(keyword) &
            x.Combinations.eq(keyword).groupby(level=0).transform('any')]
)

Output:

   Combinations  Count
6          IDLY   2020
9     CHAPPATHI   1297
13         VADA   1141


问:
Apache Rewrite Dynamic Subfolder
Can i rewrite the urls in .htaccess like below example and remove a dynamic part from url ?

https://example.com/abc/123/efg
 =>
https://example.com/abc/efg

while 123 is dynamic.

答:
I just use RedirectMatch directive like this:

RedirectMatch 301 /abc/([0-9]+)/(.*) /abc/$2

Title: Apache Rewrite Dynamic Subfolder


问:
Displaying the user's computer name
I want to display the user's computer name in Fourhundredone() but the error keeps telling me I need an integer? (TypeError: an integer is required (got type str)) is there any way to display it more correctly?

```<code>import socket
computer_name = socket.gethostname()
    def draw_text2(text, computer_name, text2, font, color, surface, x, y):
        font = pygame.font.Font("PixelDigivolve-mOm9.ttf",100)
        text = font.render(text + str(computer_name), text2, 1, color)
        text2= font.render(text2, 1, color)
        textRect = text.get_rect()
        textrect = textobj.get_rect()
        textrect.topleft = (x, y)
        surface.blit(textobj, textrect)

    def Fourhundredone():
        running = True
        while running:
             display_background(screen, clubroom)
             display_mai(screen,character_Mai)
             display_textbox()
             draw_text("Mai", font2, blood_red, screen, 2, 522)
             draw_text2("\"We can't be like you", computer_name, "!\"", font3, color, screen, 15, 580)

             for event in pygame.event.get():
                if event.type == QUIT:
                    running = False
                    pygame.quit()
                    sys.exit()
                if event.type == KEYDOWN:
                    if event.key == K_ESCAPE:
                        running = False
                    if event.key == K_SPACE:
                        Fourhundredtwo()

             pygame.display.update()
             mainClock.tick(10)
</code>```

答:
Your problem isn't with the computer name, it would seem.

```<code>text = font.render(text + str(computer_name), text2, 1, color)
</code>```

Looks wrong. You want to do (+ instead of ,):

```<code>text = font.render(text + str(computer_name) + text2, 1, color)
</code>```

Outside the scope of the question, I'd recommend passing a single string that has been pre-formatted, instead of tailoring your function to the string you're trying to print.

Something like

```<code>def draw_text2(text, font, color, surface, x, y):
</code>```

and called:

```<code>draw_text2(f"\"We can't be like you {computer_name}!\"", font3, color, screen, 15, 580)
</code>```

or even

```<code>draw_text2("\"We can't be like you" + computer_name + "!\"", font3, color, screen, 15, 580)
</code>```

if you don't want to bother with string formatting (although you should, it's much cleaner).

Any way you want to compose your string, passing it as a single parameter pre-formatted will make your function more re-usable.

Title: Displaying the user's computer name

Body:
I want to display the user's computer name in Fourhundredone() but the error keeps telling me I need an integer? (TypeError: an integer is required (got type str)) is there any way to display it more correctly?

import socket
computer_name = socket.gethostname()
    def draw_text2(text, computer_name, text2, font, color, surface, x, y):
        font = pygame.font.Font("PixelDigivolve-mOm9.ttf",100)
        text = font.render(text + str(computer_name), text2, 1, color)
        text2= font.render(text2, 1, color)
        textRect = text.get_rect()
        textrect = textobj.get_rect()
        textrect.topleft = (x, y)
        surface.blit(textobj, textrect)

    def Fourhundredone():
        running = True
        while running:
             display_background(screen, clubroom)
             display_mai(screen,character_Mai)
             display_textbox()
             draw_text("Mai", font2, blood_red, screen, 2, 522)
             draw_text2("\"We can't be like you", computer_name, "!\"", font3, color, screen, 15, 580)

             for event in pygame.event.get():
                if event.type == QUIT:
                    running = False
                    pygame.quit()
                    sys.exit()
                if event.type == KEYDOWN:
                    if event.key == K_ESCAPE:
                        running = False
                    if event.key == K_SPACE:
                        Fourhundredtwo()

             pygame.display.update()
             mainClock.tick(10)

Body:
Your problem isn't with the computer name, it would seem.

text = font.render(text + str(computer_name), text2, 1, color)

Looks wrong. You want to do (+ instead of ,):

text = font.render(text + str(computer_name) + text2, 1, color)

Outside the scope of the question, I'd recommend passing a single string that has been pre-formatted, instead of tailoring your function to the string you're trying to print.

Something like

def draw_text2(text, font, color, surface, x, y):

and called:

draw_text2(f"\"We can't be like you {computer_name}!\"", font3, color, screen, 15, 580)

or even

draw_text2("\"We can't be like you" + computer_name + "!\"", font3, color, screen, 15, 580)

if you don't want to bother with string formatting (although you should, it's much cleaner).

Any way you want to compose your string, passing it as a single parameter pre-formatted will make your function more re-usable.


问:
How to make a list of numbers from a txt file in python?
I have text file containing the numbers 52, 2,103,592,2090,34452,0,1, but arranged as one column (under each other). I want to import the numbers into python and create a list

```<code>L=[52,2,103,592,2090,34452,0,1]
</code>```

The best I have managed to do so far is:

```<code>txtfile=open('file.txt')

L=[]
for line in txtfile:
    L.append(line.rstrip())

print(L)
</code>```

which returns:

```<code>L=['52','2','103','592','2090','34452','0','1']

</code>```

but the ' around the numbers bother me.

Any help is appreciated.

答:
Similar to Asocia's answer, but I would define the length of the list first (this may slightly increase speed, and is arguably a better practice):

```<code>txtfile=open('file.txt')

L = [0] * len(list(txtfile))

for lineIdx, line in enumerate(txtfile):
    L[lineIdx] = line.rstrip()

print(L)
</code>```

I hope this helps.

Body:
I have text file containing the numbers 52, 2,103,592,2090,34452,0,1, but arranged as one column (under each other). I want to import the numbers into python and create a list

L=[52,2,103,592,2090,34452,0,1]

The best I have managed to do so far is:

txtfile=open('file.txt')

L=[]
for line in txtfile:
    L.append(line.rstrip())

print(L)

which returns:

L=['52','2','103','592','2090','34452','0','1']

but the ' around the numbers bother me.

Any help is appreciated.

Body:
Similar to Asocia's answer, but I would define the length of the list first (this may slightly increase speed, and is arguably a better practice):

txtfile=open('file.txt')

L = [0] * len(list(txtfile))

for lineIdx, line in enumerate(txtfile):
    L[lineIdx] = line.rstrip()

print(L)

I hope this helps.


问:
How to upload the public url for an image uploaded to the Firebase Cloud Storage to the Realtime Database
After uploading an image to the Firebase Cloud Storage, I want to add its public download URL to a child node in my realtime database.

My File Upload Code

```<code>    private void uploadFile() {

        if (imageUri != null) {

            StorageReference fileRef = storageReference.child(UID + "/pic" + ".png");

            UploadTask uploadTask =  fileRef.putFile(imageUri);
            uploadTask.addOnSuccessListener(OrderPickupActivity.this, new OnSuccessListener<UploadTask.TaskSnapshot>() {
                @Override
                public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                    fileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                        @Override
                        public void onSuccess(Uri uri) {
                            imageURL = uri.toString();
                        }
                    });
                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Toast.makeText(OrderPickupActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                }
            });

        } else {
            Toast.makeText(this, "Choose an image!", Toast.LENGTH_SHORT).show();
        }

    }
</code>```

Uploading to the realtime database

```<code>uploadFile();

                    PickupDetails newPickup = new PickupDetails(
                            date,
                            time,
                            name,
                            email,
                            address,
                            pinCode,
                            UID,
                            phoneNumber,
                            imageURL
                    );

                    FirebaseDatabase.getInstance().getReference("Pending-Requests")
                            .child(FirebaseAuth.getInstance().getCurrentUser().getUid())
                            .setValue(newPickup)
                            .addOnCompleteListener(new OnCompleteListener<Void>() {
                                @Override
                                public void onComplete(@NonNull Task<Void> task) {
                                    //Toast.makeText(OrderPickupActivity.this, "Success!", Toast.LENGTH_LONG).show();
                                    progressBar.setVisibility(View.GONE);
                                    startActivity(new Intent(OrderPickupActivity.this, MainActivity.class));
                                }
                            })
                            .addOnFailureListener(new OnFailureListener() {
                                @Override
                                public void onFailure(@NonNull Exception e) {
                                    Toast.makeText(OrderPickupActivity.this, "Error, " + e, Toast.LENGTH_LONG).show();
                                    progressBar.setVisibility(View.GONE);
                                }
                            });
</code>```

Pickup Details class

```<code>public class PickupDetails {

    public String date, time, userName, userEmail, userAddress, pinCode, userUID, phoneNumber, image;

    public PickupDetails(String date, String time, String userName, String userEmail, String userAddress, String pinCode, String userUID, String phoneNumber, String image) {
        this.date = date;
        this.time = time;
        this.userName = userName;
        this.userEmail = userEmail;
        this.userAddress = userAddress;
        this.pinCode = pinCode;
        this.userUID = userUID;
        this.phoneNumber = phoneNumber;
        this.image = image;
    }
}
</code>```

I have used the answers from similar questions on StackOverflow, but none of them seems to help me. When I log the result, I am able to get the value, but it does not reach the database.

答:
In onSuccess method of your getDownloadUrl listener:</p>

```<code>databaseRef.child("images").push().setValue(uri.toString())
    .addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            Toast.makeText(MainActivity.this, "Image uri saved.", Toast.LENGTH_SHORT).show();
        }
    })
    .addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Toast.makeText(MainActivity.this, "Error occured.", Toast.LENGTH_SHORT).show();

        }
    });
</code>```

Body:
After uploading an image to the Firebase Cloud Storage, I want to add its public download URL to a child node in my realtime database.

My File Upload Code

    private void uploadFile() {

        if (imageUri != null) {

            StorageReference fileRef = storageReference.child(UID + "/pic" + ".png");

            UploadTask uploadTask =  fileRef.putFile(imageUri);
            uploadTask.addOnSuccessListener(OrderPickupActivity.this, new OnSuccessListener<UploadTask.TaskSnapshot>() {
                @Override
                public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                    fileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                        @Override
                        public void onSuccess(Uri uri) {
                            imageURL = uri.toString();
                        }
                    });
                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Toast.makeText(OrderPickupActivity.this, e.toString(), Toast.LENGTH_LONG).show();
                }
            });

        } else {
            Toast.makeText(this, "Choose an image!", Toast.LENGTH_SHORT).show();
        }

    }

Uploading to the realtime database

uploadFile();

                    PickupDetails newPickup = new PickupDetails(
                            date,
                            time,
                            name,
                            email,
                            address,
                            pinCode,
                            UID,
                            phoneNumber,
                            imageURL
                    );

                    FirebaseDatabase.getInstance().getReference("Pending-Requests")
                            .child(FirebaseAuth.getInstance().getCurrentUser().getUid())
                            .setValue(newPickup)
                            .addOnCompleteListener(new OnCompleteListener<Void>() {
                                @Override
                                public void onComplete(@NonNull Task<Void> task) {
                                    //Toast.makeText(OrderPickupActivity.this, "Success!", Toast.LENGTH_LONG).show();
                                    progressBar.setVisibility(View.GONE);
                                    startActivity(new Intent(OrderPickupActivity.this, MainActivity.class));
                                }
                            })
                            .addOnFailureListener(new OnFailureListener() {
                                @Override
                                public void onFailure(@NonNull Exception e) {
                                    Toast.makeText(OrderPickupActivity.this, "Error, " + e, Toast.LENGTH_LONG).show();
                                    progressBar.setVisibility(View.GONE);
                                }
                            });

Pickup Details class

public class PickupDetails {

    public String date, time, userName, userEmail, userAddress, pinCode, userUID, phoneNumber, image;

    public PickupDetails(String date, String time, String userName, String userEmail, String userAddress, String pinCode, String userUID, String phoneNumber, String image) {
        this.date = date;
        this.time = time;
        this.userName = userName;
        this.userEmail = userEmail;
        this.userAddress = userAddress;
        this.pinCode = pinCode;
        this.userUID = userUID;
        this.phoneNumber = phoneNumber;
        this.image = image;
    }
}

I have used the answers from similar questions on StackOverflow, but none of them seems to help me. When I log the result, I am able to get the value, but it does not reach the database.

Body:
In onSuccess method of your getDownloadUrl listener:

databaseRef.child("images").push().setValue(uri.toString())
    .addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            Toast.makeText(MainActivity.this, "Image uri saved.", Toast.LENGTH_SHORT).show();
        }
    })
    .addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            Toast.makeText(MainActivity.this, "Error occured.", Toast.LENGTH_SHORT).show();

        }
    });


问:
Redirecting output of boost::timer::auto_cpu_timer
I'm widely using boost::timer::auto_cpu_timer to measure the execution time of different functions and code blocks. I'm using a macro to simplify its use at the time I can easily disable it in production:

```<code>#include <boost/timer/timer.hpp>
#include <string>

#ifdef LOG_MEASURE_TIME
#  define CPU_TIMER() boost::timer::auto_cpu_timer t_##__LINE__(cpuTimerFormat(__FUNCTION__, __LINE__))
#endif
</code>```

where

```<code>std::string cpuTimerFormat(const std::string &name, int line)
{
  const std::string time = " %ws wall, %us user + %ss system = %ts CPU (%p%)\n";

  return name + '@' + std::to_string(line) + time;
}
</code>```

For tracing purposes, I'd like to redirect the output of boost::timer::auto_cpu_timer from std::cout to std::clog, which is also linked to an optional log file.

```<code>// log_path is a std::filesystem::path from application options or command-line arguments
std::ofstream log_file;
if (!log_path.empty()) {
  log_file.open(log_path);
  if (log_file.is_open()) { std::clog.rdbuf(log_file.rdbuf()); }
}
</code>```

I've being looking around and couldn't find a solution for it other than implementing my own auto_cpu_timer based on boost::timer::cpu_timer. Is it possible to do directly on boost::timer::auto_cpu_timer?

答:
I'm documenting it here because after googling and stackoverflowing for it I couldn't find the answer.

I don't know why I didn't pay attention to it first, but there is a constructor for boost::timer::auto_cpu_timer that receives a std::ostream&, so the solution is quite straight forward:

```<code>#include <iostream>

#ifdef LOG_MEASURE_TIME
#  define CPU_TIMER() boost::timer::auto_cpu_timer t_##__LINE__(std::clog, cpuTimerFormat(__FUNCTION__, __LINE__))
#endif
</code>```

For completeness, remember that std::clog is initially associated to std::cerr, which is usually also linked to the stdout. If the log file is optional, then std::clog may be streaming to the incorrect destination. If tracing should remain hidden except if the log file is specified, you can initially link std::clog to a null buffer:

```<code>std::clog.rdbuf(nullptr);
</code>```

Body:
I'm widely using boost::timer::auto_cpu_timer to measure the execution time of different functions and code blocks. I'm using a macro to simplify its use at the time I can easily disable it in production:

#include <boost/timer/timer.hpp>
#include <string>

#ifdef LOG_MEASURE_TIME
#  define CPU_TIMER() boost::timer::auto_cpu_timer t_##__LINE__(cpuTimerFormat(__FUNCTION__, __LINE__))
#endif

where

std::string cpuTimerFormat(const std::string &name, int line)
{
  const std::string time = " %ws wall, %us user + %ss system = %ts CPU (%p%)\n";

  return name + '@' + std::to_string(line) + time;
}

For tracing purposes, I'd like to redirect the output of boost::timer::auto_cpu_timer from std::cout to std::clog, which is also linked to an optional log file.

// log_path is a std::filesystem::path from application options or command-line arguments
std::ofstream log_file;
if (!log_path.empty()) {
  log_file.open(log_path);
  if (log_file.is_open()) { std::clog.rdbuf(log_file.rdbuf()); }
}

I've being looking around and couldn't find a solution for it other than implementing my own auto_cpu_timer based on boost::timer::cpu_timer. Is it possible to do directly on boost::timer::auto_cpu_timer?

Body:
I'm documenting it here because after googling and stackoverflowing for it I couldn't find the answer.

I don't know why I didn't pay attention to it first, but there is a constructor for boost::timer::auto_cpu_timer that receives a std::ostream&, so the solution is quite straight forward:

#include <iostream>

#ifdef LOG_MEASURE_TIME
#  define CPU_TIMER() boost::timer::auto_cpu_timer t_##__LINE__(std::clog, cpuTimerFormat(__FUNCTION__, __LINE__))
#endif

For completeness, remember that std::clog is initially associated to std::cerr, which is usually also linked to the stdout. If the log file is optional, then std::clog may be streaming to the incorrect destination. If tracing should remain hidden except if the log file is specified, you can initially link std::clog to a null buffer:

std::clog.rdbuf(nullptr);


问:
Error in table(data, reference, dnn = dnn, ...) : all arguments must have the same length when run confusionMatrix with caret, in R
I have an issue running a confusionMatrix.

here is what I do:

```<code>rf <- caret::train(tested ~.,
                               data = training_data,
                               method = "rf",
                               trControl = ctrlInside,
                               metric = "ROC",
                               na.action = na.exclude)

rf
</code>```

After I get my model this is the next step I take:

```<code>evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))
</code>```

And then I am running my confusion matrix.

```<code>cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")
</code>```

And the error comes after I apply the confusionMatrix:

```<code>Error in table(data, reference, dnn = dnn, ...) :
  all arguments must have the same length
</code>```

Nevertheless, I give you bits of my data.

train data:

```<code>structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(2L,
2L, 1L, 1L, 2L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"),
    Age = c(63, 23, 28, 40, 31, 60), number_days_symptoms = c(1,
    1, 16, 1, 14, 1), care_home_worker = structure(c(1L, 2L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), how_unwell = c(1, 1, 6, 4, 2,
    1), self_diagnosis = structure(c(1L, 1L, 2L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), chills = structure(c(1L, 1L, 2L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    cough = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diarrhoea = structure(c(1L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    fatigue = structure(c(1L, 2L, 2L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), headache = structure(c(2L, 2L,
    3L, 2L, 2L, 2L), .Label = c("Headcahe", "No", "Yes"), class = "factor"),
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), muscle_ache = structure(c(1L,
    1L, 2L, 2L, 2L, 2L), .Label = c("No", "Yes"), class = "factor"),
    nasal_congestion = structure(c(1L, 1L, 1L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    shortness_breath = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), sore_throat = structure(c(1L,
    1L, 1L, 2L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    sputum = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), temperature = structure(c(4L,
    4L, 4L, 4L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41",
    "No"), class = "factor"), asthma = structure(c(2L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diabetes_type_two = structure(c(2L,
    1L, 1L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    obesity = structure(c(1L, 2L, 2L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), hypertension = structure(c(1L,
    1L, 2L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 2L), .Label = c("No",
    "Yes"), class = "factor"), lung_condition = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), kidney_disease = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(1L,
3L, 4L, 5L, 6L, 7L), class = "data.frame")
</code>```

and here is my test_data:

```<code>structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(1L,
2L, 1L, 1L, 1L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"),
    Age = c(19, 26, 30, 45, 40, 43), number_days_symptoms = c(20,
    1, 1, 20, 14, 1), care_home_worker = structure(c(1L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), how_unwell = c(7, 6, 6, 6, 6,
    2), self_diagnosis = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), chills = structure(c(2L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    cough = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diarrhoea = structure(c(2L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    fatigue = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), headache = structure(c(2L, 2L,
    2L, 3L, 2L, 3L), .Label = c("Headcahe", "No", "Yes"), class = "factor"),
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), muscle_ache = structure(c(2L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    nasal_congestion = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    shortness_breath = structure(c(2L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), sore_throat = structure(c(1L,
    1L, 1L, 2L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    sputum = structure(c(2L, 1L, 1L, 2L, 1L, 2L), .Label = c("No",
    "Yes"), class = "factor"), temperature = structure(c(4L,
    4L, 4L, 1L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41",
    "No"), class = "factor"), asthma = structure(c(1L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diabetes_type_two = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    obesity = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), hypertension = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), lung_condition = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), kidney_disease = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(2L,
8L, 11L, 14L, 20L, 27L), class = "data.frame")
</code>```

Additionally, I perform a smote balancing class, on a subsample in ctrInside.

This is my smote function:

```<code>smotest <- list(name = "SMOTE with more neighbors!",
                func = function (x, y) {
                  115
                  library(DMwR)
                  dat <- if (is.data.frame(x)) x else as.data.frame(x)
                  dat$.y <- y
                  dat <- SMOTE(.y ~ ., data = dat, k = 3, perc.over = 100, perc.under =
                                 200)
                  list(x = dat[, !grepl(".y", colnames(dat), fixed = TRUE)],
                       y = dat$.y) },
                first = TRUE)
</code>```

And ctrlInside is this:

```<code>ctrlInside <- trainControl(method = "repeatedcv",
                           number = 10,
                           repeats = 5,
                           summaryFunction = twoClassSummary,
                           classProbs = TRUE,
                           savePredictions = TRUE,
                           search = "grid",
                           sampling = smotest)
</code>```

Those function are given just so that you have an idea of what I am doing per whole. Is there a reason why this is happening?

答:
You can use complete.cases to predict only those that have no nas, also you must operate on the matrix, I will show below. Using an example dataset, I make 10 of the variable in a column NAs, and train:

```<code>idx = sample(nrow(iris),100)
data = iris
data$Petal.Length[sample(nrow(data),10)] = NA
data$tested = factor(ifelse(data$Species=="versicolor","positive","negative"))
data = data[,-5]
training_data = data[idx,]
testing_data= data[-idx,]

rf <- caret::train(tested ~., data = training_data,
                              method = "rf",
                              trControl = ctrlInside,
                              metric = "ROC",
                              na.action = na.exclude)
</code>```

Do the evaluation result and you can see i get the same error:

```<code>evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

Error in table(data, reference, dnn = dnn, ...) :
  all arguments must have the same length
</code>```

So there's two sources of error, 1.. you have NAs and they cannot predict that, and second, evalResult.rf returns a matrix of probabilities, first column is probability being negative class, 2nd being postive:

```<code>head(evalResult.rf)
   negative positive
3     1.000    0.000
6     1.000    0.000
9     0.948    0.052
12    1.000    0.000
13    0.976    0.024
19    0.998    0.002
</code>```

To get the classes, you do, get the column with max value for each row, and return the corresponding column name, which is the class:

```<code>colnames(evalResult.rf)[max.col(evalResult.rf)]
</code>```

We do now:

```<code>testing_data = testing_data[complete.cases(testing_data),]
evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- factor(colnames(evalResult.rf)[max.col(evalResult.rf)])
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

Confusion Matrix and Statistics

          Reference
Prediction negative positive
  negative       33        1
  positive        0       11

               Accuracy : 0.9778
                 95% CI : (0.8823, 0.9994)
    No Information Rate : 0.7333
    P-Value [Acc > NIR] : 1.507e-05

                  Kappa : 0.9416
</code>```

Body:
I have an issue running a confusionMatrix.

here is what I do:

rf <- caret::train(tested ~.,
                               data = training_data,
                               method = "rf",
                               trControl = ctrlInside,
                               metric = "ROC",
                               na.action = na.exclude)

rf

After I get my model this is the next step I take:

evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))

And then I am running my confusion matrix.

cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

And the error comes after I apply the confusionMatrix:

Error in table(data, reference, dnn = dnn, ...) :
  all arguments must have the same length

Nevertheless, I give you bits of my data.

train data:

structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(2L,
2L, 1L, 1L, 2L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"),
    Age = c(63, 23, 28, 40, 31, 60), number_days_symptoms = c(1,
    1, 16, 1, 14, 1), care_home_worker = structure(c(1L, 2L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), how_unwell = c(1, 1, 6, 4, 2,
    1), self_diagnosis = structure(c(1L, 1L, 2L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), chills = structure(c(1L, 1L, 2L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    cough = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diarrhoea = structure(c(1L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    fatigue = structure(c(1L, 2L, 2L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), headache = structure(c(2L, 2L,
    3L, 2L, 2L, 2L), .Label = c("Headcahe", "No", "Yes"), class = "factor"),
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), muscle_ache = structure(c(1L,
    1L, 2L, 2L, 2L, 2L), .Label = c("No", "Yes"), class = "factor"),
    nasal_congestion = structure(c(1L, 1L, 1L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    shortness_breath = structure(c(1L, 1L, 1L, 1L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), sore_throat = structure(c(1L,
    1L, 1L, 2L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    sputum = structure(c(1L, 1L, 2L, 2L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), temperature = structure(c(4L,
    4L, 4L, 4L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41",
    "No"), class = "factor"), asthma = structure(c(2L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diabetes_type_two = structure(c(2L,
    1L, 1L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    obesity = structure(c(1L, 2L, 2L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), hypertension = structure(c(1L,
    1L, 2L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 2L), .Label = c("No",
    "Yes"), class = "factor"), lung_condition = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), kidney_disease = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(1L,
3L, 4L, 5L, 6L, 7L), class = "data.frame")

and here is my test_data:

structure(list(tested = structure(c(1L, 1L, 1L, 1L, 1L,
1L), .Label = c("negative", "positive"), class = "factor"), Gender = structure(c(1L,
2L, 1L, 1L, 1L, 2L), .Label = c("Female", "Male", "Other"), class = "factor"),
    Age = c(19, 26, 30, 45, 40, 43), number_days_symptoms = c(20,
    1, 1, 20, 14, 1), care_home_worker = structure(c(1L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    health_care_worker = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), how_unwell = c(7, 6, 6, 6, 6,
    2), self_diagnosis = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), chills = structure(c(2L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    cough = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diarrhoea = structure(c(2L, 1L,
    1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    fatigue = structure(c(2L, 1L, 1L, 2L, 2L, 1L), .Label = c("No",
    "Yes"), class = "factor"), headache = structure(c(2L, 2L,
    2L, 3L, 2L, 3L), .Label = c("Headcahe", "No", "Yes"), class = "factor"),
    loss_smell_taste = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), muscle_ache = structure(c(2L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    nasal_congestion = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), nausea_vomiting = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    shortness_breath = structure(c(2L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), sore_throat = structure(c(1L,
    1L, 1L, 2L, 1L, 2L), .Label = c("No", "Yes"), class = "factor"),
    sputum = structure(c(2L, 1L, 1L, 2L, 1L, 2L), .Label = c("No",
    "Yes"), class = "factor"), temperature = structure(c(4L,
    4L, 4L, 1L, 1L, 4L), .Label = c("37.5-38", "38.1-39", "39.1-41",
    "No"), class = "factor"), asthma = structure(c(1L, 1L, 1L,
    1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    diabetes_type_one = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), diabetes_type_two = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    obesity = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), hypertension = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    heart_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), lung_condition = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor"),
    liver_disease = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No",
    "Yes"), class = "factor"), kidney_disease = structure(c(1L,
    1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"), class = "factor")), row.names = c(2L,
8L, 11L, 14L, 20L, 27L), class = "data.frame")

Additionally, I perform a smote balancing class, on a subsample in ctrInside.

This is my smote function:

smotest <- list(name = "SMOTE with more neighbors!",
                func = function (x, y) {
                  115
                  library(DMwR)
                  dat <- if (is.data.frame(x)) x else as.data.frame(x)
                  dat$.y <- y
                  dat <- SMOTE(.y ~ ., data = dat, k = 3, perc.over = 100, perc.under =
                                 200)
                  list(x = dat[, !grepl(".y", colnames(dat), fixed = TRUE)],
                       y = dat$.y) },
                first = TRUE)

And ctrlInside is this:

ctrlInside <- trainControl(method = "repeatedcv",
                           number = 10,
                           repeats = 5,
                           summaryFunction = twoClassSummary,
                           classProbs = TRUE,
                           savePredictions = TRUE,
                           search = "grid",
                           sampling = smotest)

Those function are given just so that you have an idea of what I am doing per whole. Is there a reason why this is happening?

Body:
You can use complete.cases to predict only those that have no nas, also you must operate on the matrix, I will show below. Using an example dataset, I make 10 of the variable in a column NAs, and train:

idx = sample(nrow(iris),100)
data = iris
data$Petal.Length[sample(nrow(data),10)] = NA
data$tested = factor(ifelse(data$Species=="versicolor","positive","negative"))
data = data[,-5]
training_data = data[idx,]
testing_data= data[-idx,]

rf <- caret::train(tested ~., data = training_data,
                              method = "rf",
                              trControl = ctrlInside,
                              metric = "ROC",
                              na.action = na.exclude)

Do the evaluation result and you can see i get the same error:

evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- as.factor(ifelse(evalResult.rf <0.5, "positive", "negative"))
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

Error in table(data, reference, dnn = dnn, ...) :
  all arguments must have the same length

So there's two sources of error, 1.. you have NAs and they cannot predict that, and second, evalResult.rf returns a matrix of probabilities, first column is probability being negative class, 2nd being postive:

head(evalResult.rf)
   negative positive
3     1.000    0.000
6     1.000    0.000
9     0.948    0.052
12    1.000    0.000
13    0.976    0.024
19    0.998    0.002

To get the classes, you do, get the column with max value for each row, and return the corresponding column name, which is the class:

colnames(evalResult.rf)[max.col(evalResult.rf)]

We do now:

testing_data = testing_data[complete.cases(testing_data),]
evalResult.rf <- predict(rf, testing_data, type = "prob")
predict_rf <- factor(colnames(evalResult.rf)[max.col(evalResult.rf)])
cm_rf_forest <- confusionMatrix(predict_rf, testing_data$tested, "positive")

Confusion Matrix and Statistics

          Reference
Prediction negative positive
  negative       33        1
  positive        0       11

               Accuracy : 0.9778
                 95% CI : (0.8823, 0.9994)
    No Information Rate : 0.7333
    P-Value [Acc > NIR] : 1.507e-05

                  Kappa : 0.9416


问:
Getting practice with pandas & numpy
I just finished reading some books about pandas, numpy & matplotlib and thought about getting some practice.
Unfortunately, I am a bit lost on how to start.
Can anyone recommend a site, which provides csv-files to practice on?
I have found some sites like kaggle or data.gov, but they just have files, which are already cleaned etc.
I'm also open to other ways on how to practice those libraries.
Grateful for every answer.
Best regards  </p>

答:
You could try finding some interesting datasets on: icpsr.umich.edu

In my experience, these sets often contain missing values and values that need formatting, which could be good for practice.

Some datasets are public, but many require will require special credentials. If you are a university student, this often qualifies.

Title: Getting practice with pandas & numpy


问:
getting the address of the function?
I'm writing this code and printing this line below shows me the address, how is that possible?</p>

```<code>struct back
{
    static const int y = 7;
    static int f(int i = 0)
    {
        return i / 2;
    }
};
</code>```

```<code>std::cout << back::f;      // 003A143D
</code>```

答:
From eerorika's response, the printing of the class static function's address appears to be happenstance rather than by the standard.

You can override the behavior if you wish.  For example,

```<code>#include <iostream>

namespace {

struct back {
    static const int y = 7;
    static int f(int i = 0) {
        return i / 2;
    }
};

std::ostream& operator<<(std::ostream& out, decltype(back::f)) {
    out << "baby ducks";
    return out;
}

} // anon

int main() {
    std::cout << back::f << "\n"; // Output: baby ducks
}
</code>```

WARNING (from comment section): not a good idea to overload << for int(int) since there is no user defined type involved.

Title: getting the address of the function?

Body:
I'm writing this code and printing this line below shows me the address, how is that possible?

struct back
{
    static const int y = 7;
    static int f(int i = 0)
    {
        return i / 2;
    }
};

std::cout << back::f;      // 003A143D

Body:
From eerorika's response, the printing of the class static function's address appears to be happenstance rather than by the standard.

You can override the behavior if you wish.  For example,

#include <iostream>

namespace {

struct back {
    static const int y = 7;
    static int f(int i = 0) {
        return i / 2;
    }
};

std::ostream& operator<<(std::ostream& out, decltype(back::f)) {
    out << "baby ducks";
    return out;
}

} // anon

int main() {
    std::cout << back::f << "\n"; // Output: baby ducks
}

WARNING (from comment section): not a good idea to overload << for int(int) since there is no user defined type involved.


问:
Why are the GEF children not drawn when removing absolute size of container?
I try to get a simple working GEF editor. I have a GraphicalEditorWithPalette that creates my example model. I have a RootEditPart that overrides createFigure and  getModelChildren like this:

```<code>public class RootEditPart extends AbstractGraphicalEditPart {
    @Override
    protected IFigure createFigure() {
        Figure figure = new Figure();
        figure.setOpaque(true);
        figure.setLayoutManager(new XYLayout());
        figure.setSize(1000, 1000);
        return figure;
    }
    @Override
    protected List<Positionable> getModelChildren() {
        return getModel().getChildren();
    }
    // More methods ...
}
</code>```

I have a ChildEditPart that creates a label and override refreshVisuals like this:

```<code>public class ChildEditPart extends AbstractGraphicalEditPart {
    @Override
    protected void refreshVisuals() {
        RDC rdc = getModel();
        Label nameLabel = (Label) getFigure();
        nameLabel.setText(rdc.getName());
        Point position = rdc.getPosition();

        Rectangle r = new Rectangle(position.x, position.y, -1,-1);
        ((GraphicalEditPart) getParent()).setLayoutConstraint(this, nameLabel, r);
    }
    // More methods ...
}
</code>```

This works as expected. But I don't want to have a fixed size for the container. Instead I try to achieve that the containers size adapts to the children. If I remove the figure.setSize(1000, 1000); the children are not drawn any more. What is my mistake?

Edit:
Maybe it is important to know that my editor configures the root edit part like this: viewer.setRootEditPart(new ScalableFreeformRootEditPart());

Edit2:
Seems like in fact the call viewer.setRootEditPart(new ScalableFreeformRootEditPart()); is the problem. If I remove this it works as expected. Currently I don't fully understand why ... would be great if someone could explain.

答:
You have to set size of parent's figure manually when it needed.

```<code>figure.setSize(figure.getPreferredSize());
</code>```

figure delegates computing it's prefer size to it's layout(if exist).
XYLayout will compute minimal size to represent contents.

I think best place to insert this code is setLayoutConstraint of parent EditPart.

Body:
I try to get a simple working GEF editor. I have a GraphicalEditorWithPalette that creates my example model. I have a RootEditPart that overrides createFigure and  getModelChildren like this:

public class RootEditPart extends AbstractGraphicalEditPart {
    @Override
    protected IFigure createFigure() {
        Figure figure = new Figure();
        figure.setOpaque(true);
        figure.setLayoutManager(new XYLayout());
        figure.setSize(1000, 1000);
        return figure;
    }
    @Override
    protected List<Positionable> getModelChildren() {
        return getModel().getChildren();
    }
    // More methods ...
}

I have a ChildEditPart that creates a label and override refreshVisuals like this:

public class ChildEditPart extends AbstractGraphicalEditPart {
    @Override
    protected void refreshVisuals() {
        RDC rdc = getModel();
        Label nameLabel = (Label) getFigure();
        nameLabel.setText(rdc.getName());
        Point position = rdc.getPosition();

        Rectangle r = new Rectangle(position.x, position.y, -1,-1);
        ((GraphicalEditPart) getParent()).setLayoutConstraint(this, nameLabel, r);
    }
    // More methods ...
}

This works as expected. But I don't want to have a fixed size for the container. Instead I try to achieve that the containers size adapts to the children. If I remove the figure.setSize(1000, 1000); the children are not drawn any more. What is my mistake?

Edit:
Maybe it is important to know that my editor configures the root edit part like this: viewer.setRootEditPart(new ScalableFreeformRootEditPart());

Edit2:
Seems like in fact the call viewer.setRootEditPart(new ScalableFreeformRootEditPart()); is the problem. If I remove this it works as expected. Currently I don't fully understand why ... would be great if someone could explain.

Body:
You have to set size of parent's figure manually when it needed.

figure.setSize(figure.getPreferredSize());

figure delegates computing it's prefer size to it's layout(if exist).
XYLayout will compute minimal size to represent contents.

I think best place to insert this code is setLayoutConstraint of parent EditPart.


问:
Unable to connect to bitbake server
Im trying to setup bitbake tool and trying to follow the tutorial

https://www.yoctoproject.org/docs/1.8/bitbake-user-manual/bitbake-user-manual.html#bitbake-examples

Now when I run the bitbake command I get the following error,

```<code>p@p-ubuntu:~/ba/bitbake$ bitbake
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/p/ba/bitbake/lib/bb/main.py", line 428, in setup_bitbake
    topdir, lock = lockBitbake()
  File "/home/p/ba/bitbake/lib/bb/main.py", line 480, in lockBitbake
    lockfile = topdir + "/bitbake.lock"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
)
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/p/ba/bitbake/lib/bb/main.py", line 428, in setup_bitbake
    topdir, lock = lockBitbake()
  File "/home/p/ba/bitbake/lib/bb/main.py", line 480, in lockBitbake
    lockfile = topdir + "/bitbake.lock"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
</code>```

How do I start the bitbake server?

答:
I had the same problem after I canceled a bitbake-process harshly (ctrl-c).

After removing the file bitbake.lock in the build-folder, bitbake worked again as intended.

```<code>rm bitbake.lock
</code>```

Title: Unable to connect to bitbake server

Body:
Im trying to setup bitbake tool and trying to follow the tutorial

https://www.yoctoproject.org/docs/1.8/bitbake-user-manual/bitbake-user-manual.html#bitbake-examples

Now when I run the bitbake command I get the following error,

p@p-ubuntu:~/ba/bitbake$ bitbake
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/p/ba/bitbake/lib/bb/main.py", line 428, in setup_bitbake
    topdir, lock = lockBitbake()
  File "/home/p/ba/bitbake/lib/bb/main.py", line 480, in lockBitbake
    lockfile = topdir + "/bitbake.lock"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
)
NOTE: Retrying server connection... (Traceback (most recent call last):
  File "/home/p/ba/bitbake/lib/bb/main.py", line 428, in setup_bitbake
    topdir, lock = lockBitbake()
  File "/home/p/ba/bitbake/lib/bb/main.py", line 480, in lockBitbake
    lockfile = topdir + "/bitbake.lock"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

How do I start the bitbake server?

Body:
I had the same problem after I canceled a bitbake-process harshly (ctrl-c).

After removing the file bitbake.lock in the build-folder, bitbake worked again as intended.

rm bitbake.lock


问:
How to change the text of a label with Stringproperty() in kivy
I’m just trying to change the text of a label by changing the variable to which the text is defined, but it doesn’t work. Yet I used the Stringproperty().I would like, if possible, that as soon as we press the button the text changes directly, passing through the variable theText

How to solve this problem plz?

Here is my code that serves as an example:

```<code>from kivy.app import App
from kivy.properties import StringProperty
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen

class MenuScreen(Screen):
    pass

class SettingsScreen(Screen):

    def change_text(self):
        self.root.theText = '1'

class MyScreenManager(ScreenManager):
    # This is the text that both Labels may display
    theText = StringProperty('0')

kv = """
MyScreenManager:
    MenuScreen:
        name: 'menu'
    SettingsScreen:
        name: 'settings'

<MenuScreen>:
    label_wid : ratio
    FloatLayout:
        Button:
            text: "options"
            pos: 270, 240
            size_hint: .30, .10
            background_color: 0,1,0,0.75
            on_press: root.manager.current = 'settings'
        Label:
            id:ratio
            # Use theText Property from MyScreenManager
            text: root.manager.theText
            pos: 0,90
            font_size:30
            color:1,0,0,1

<SettingsScreen>:
    FloatLayout:
        Label:
            id:ratio
            # Use theText Property from MyScreenManager
            text: root.manager.theText
            pos: 0,90
            font_size:30
            color:1,0,0,1
        Button:
            text: "options"
            pos: 270, 240
            size_hint: .30, .10
            background_color: 0,1,0,0.75
            on_press: root.change_text

"""

class Quizz(App):
    def build(self):
        self.title = 'Quizz'
        Window.clearcolor = (0, 1, 1, 0.25)
        return Builder.load_string(kv)

if __name__ == '__main__':
    Quizz().run()

</code>```

答:
Two problems. First, when you assign a method call to a Button in kv, you must include (). Yes, just the opposite of everywhere else in python. So the on_press should be:

```<code>on_press: root.change_text()
</code>```

Second, the change_text() method needs to reference the MyScreenManager instance, which is simply self.manager in the SettingsScreen. So the change_text() should be:

```<code>def change_text(self):
    self.manager.theText = '1'
</code>```

Body:
I’m just trying to change the text of a label by changing the variable to which the text is defined, but it doesn’t work. Yet I used the Stringproperty().I would like, if possible, that as soon as we press the button the text changes directly, passing through the variable theText

How to solve this problem plz?

Here is my code that serves as an example:

from kivy.app import App
from kivy.properties import StringProperty
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen

class MenuScreen(Screen):
    pass

class SettingsScreen(Screen):

    def change_text(self):
        self.root.theText = '1'

class MyScreenManager(ScreenManager):
    # This is the text that both Labels may display
    theText = StringProperty('0')

kv = """
MyScreenManager:
    MenuScreen:
        name: 'menu'
    SettingsScreen:
        name: 'settings'

<MenuScreen>:
    label_wid : ratio
    FloatLayout:
        Button:
            text: "options"
            pos: 270, 240
            size_hint: .30, .10
            background_color: 0,1,0,0.75
            on_press: root.manager.current = 'settings'
        Label:
            id:ratio
            # Use theText Property from MyScreenManager
            text: root.manager.theText
            pos: 0,90
            font_size:30
            color:1,0,0,1

<SettingsScreen>:
    FloatLayout:
        Label:
            id:ratio
            # Use theText Property from MyScreenManager
            text: root.manager.theText
            pos: 0,90
            font_size:30
            color:1,0,0,1
        Button:
            text: "options"
            pos: 270, 240
            size_hint: .30, .10
            background_color: 0,1,0,0.75
            on_press: root.change_text

"""

class Quizz(App):
    def build(self):
        self.title = 'Quizz'
        Window.clearcolor = (0, 1, 1, 0.25)
        return Builder.load_string(kv)

if __name__ == '__main__':
    Quizz().run()

Body:
Two problems. First, when you assign a method call to a Button in kv, you must include (). Yes, just the opposite of everywhere else in python. So the on_press should be:

on_press: root.change_text()

Second, the change_text() method needs to reference the MyScreenManager instance, which is simply self.manager in the SettingsScreen. So the change_text() should be:

def change_text(self):
    self.manager.theText = '1'


问:
Display the value of the id of the event with eventclick
I am trying to get the id of the event in order to remove the event from the database. I am trying to get the id with eventClick, when user clicks an event, pops up a dialog and asks user to remove the event. To do that, I need the id of the event.

But when I get it with "info.event.id", it returns [object Object] and cannot get it properly.

```<code>eventClick = (info) => {
    this.setState({
      eventId: info.event.id, // returns [object Object]
      title: info.event.title,
      start: info.event.start.toString(),
      end: info.event.end.toString(),
    });
</code>```

This is the console.log(info.event) output:

```<code>EventApi {_calendar: Calendar, _def: {…}, _instance: {…}}
allDay: (...)
allow: (...)
backgroundColor: (...)
borderColor: (...)
classNames: (...)
constraint: (...)
durationEditable: (...)
end: Fri Jun 12 2020 17:01:00 GMT+0300 (GMT+03:00)
extendedProps: (...)
groupId: (...)
id: "[object Object]"
overlap: (...)
rendering: (...)
source: EventSourceApi
start: Thu Jun 11 2020 17:01:00 GMT+0300 (GMT+03:00)
</code>```

Every object except id display well. How do I get it real value of the id?

Btw, I already tried the JSON.stringify(), it could not work. Also, the object is not a JSON object. It is a random integer like "3525".

答:
This is happening because you have object type [object object] in that 'id' key, maybe try using

JSON.stringify(info.event.id) and then find the exact id value you're looking for.

Body:
I am trying to get the id of the event in order to remove the event from the database. I am trying to get the id with eventClick, when user clicks an event, pops up a dialog and asks user to remove the event. To do that, I need the id of the event.

But when I get it with "info.event.id", it returns [object Object] and cannot get it properly.

eventClick = (info) => {
    this.setState({
      eventId: info.event.id, // returns [object Object]
      title: info.event.title,
      start: info.event.start.toString(),
      end: info.event.end.toString(),
    });

This is the console.log(info.event) output:

EventApi {_calendar: Calendar, _def: {…}, _instance: {…}}
allDay: (...)
allow: (...)
backgroundColor: (...)
borderColor: (...)
classNames: (...)
constraint: (...)
durationEditable: (...)
end: Fri Jun 12 2020 17:01:00 GMT+0300 (GMT+03:00)
extendedProps: (...)
groupId: (...)
id: "[object Object]"
overlap: (...)
rendering: (...)
source: EventSourceApi
start: Thu Jun 11 2020 17:01:00 GMT+0300 (GMT+03:00)

Every object except id display well. How do I get it real value of the id?

Btw, I already tried the JSON.stringify(), it could not work. Also, the object is not a JSON object. It is a random integer like "3525".