Cayla  Erdman

Cayla Erdman

1596501540

Many (to many) relations among the stars.

In the mystical moist night-air, and from time to time, Look’d up in perfect silence at the stars.” — Walt Whitman


Recently, I came across a personal journal where I noted the objects I observed in the night sky with my telescope. Most of the entries are from high school and college summer breaks when I could stay up later at night and (somewhat) sleep in the next day. I’d start every summer by observing the late Spring constellations like Hercules with his Great Globular Cluster. Sometime around the middle of July, I would see a beautiful crescent Moon setting over Lake Michigan. This was also my favorite time to see The Summer Triangle with Lyra and it’s Ring Nebula. Finally, I’d end the summer by looking for the Andromeda Galaxy.

These deep-sky objects (objects like globular clusters and galaxies) occur relative to the same constellations. However, there are some objects (those inside the solar system) like the Moon, planets, and comets that change positions and move relative to the constellations throughout the year. In other words, I can observe the Moon or Jupiter in different constellations such as Taurus in the winter and Leo in the spring.

These observations are a great example of a database with a many-to-many relationship. Again, let me use astronomy for a SQL example. Let’s begin.

Many-to-many relationships

What is a many-to-many relationship in a SQL database? It’s an instance where multiple records in one table are related to multiple records in another table. After a bit of searching, a common example is a database made for a school. The school has many students that can take many classes at a time. At the same time, there isn’t one student per class — but many students per class. (For more on this example, I recommend reading this DZone tutorial.)

I want to use a different example to showcase this concept. Consider a list of constellations you can see in the summer (in the below picture on the left) and a list of objects that can be seen in the summer night sky (on the right). The list of objects are in some constellation from the left list. For example, the Ring Nebula can be observed in the constellation Lyra but the Moon can be observed next to many constellations in the Summer (here, Scorpius and Pisces). You can also see M-80 in Scorpius but M-82 is seen in Ursa Major.

Image for post

The relationship between items in two lists.

The Problem

How do you store this information in a database? Well, let’s try using one table. Coded up in a table called wrong_table, this looks like the following.

Image for post

One table to store the information.

But, how can we query this table? Specifically, look at the record for Scorpius and the record for Pisces.

Image for post

Querying wrong_table.

For Scorpius, M-80 and The Moon occur together as a text field. The Moon also occurs in the Pisces record. Say I want to count how many times The Moon occurs. Let’s try.

SELECT *
FROM wrong_table
WHERE name_obs = 'The Moon';

Result:

Image for post

Querying wrong_table.

Alright, that’s odd — the result is just the Pisces record. Why? The Moon’s instance in the record for Scorpius is tied to M-80 in that M-80, The Moon are in the same field and not distinct from each other. How can I count occurrences of The Moon if one record is not distinct from M-80?

Ok, let’s try another approach. Say we put each occurrence in its own column, like in wrong_table_2.

Image for post

A view of wrong_table_2.

There are a few issues with this. Let’s try finding the instances of The Moon.

SELECT *
FROM wrong_table_2
WHERE name_obs_1 = 'The Moon' OR name_obs_2 = 'The Moon';

Result:

Image for post

Querying wrong_table_2.

Ok, now let’s try to count the instances… but when we do, the columns used in the WHERE line can theoretically grow (countably) infinitely long. Meaning, I can add more observations to this table for the Scorpius record.

What a mess!

#sql-joins #sql #many-to-many

What is GEEK

Buddha Community

Many (to many) relations among the stars.

How to Create Emoji Star Rating Widget using only HTML & CSS

In this blog you’ll learn how to create Emoji Star Rating Widget using only HTML & CSS.

To create emoji star rating widget using only HTML & CSS. First, you need to create two files one HTML File and another one is CSS File.

1: First, create an HTML file with the name of index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Emoji Stars Rating | Codequs</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
</head>
<body>
  <div class="wrapper">
    <input type="radio" name="rate" id="star-1">
    <input type="radio" name="rate" id="star-2">
    <input type="radio" name="rate" id="star-3">
    <input type="radio" name="rate" id="star-4">
    <input type="radio" name="rate" id="star-5">
    <div class="content">
      <div class="outer">
        <div class="emojis">
          <li class="slideImg"><img src="emojis/emoji-1.png" alt=""></li>
          <li><img src="emojis/emoji-2.png" alt=""></li>
          <li><img src="emojis/emoji-3.png" alt=""></li>
          <li><img src="emojis/emoji-4.png" alt=""></li>
          li><img src="emojis/emoji-5.png" alt=""></li>
        </div>
      </div>
      <div class="stars">
        <label for="star-1" class="star-1 fas fa-star"></label>
        <label for="star-2" class="star-2 fas fa-star"></label>
        <label for="star-3" class="star-3 fas fa-star"></label>
        <label for="star-4" class="star-4 fas fa-star"></label>
        <label for="star-5" class="star-5 fas fa-star"></label>
      </div>
    </div>
    <div class="footer">
      <span class="text"></span>
      <span class="numb"></span>
    </div>
  </div>
</body>
</html>

2: Second, create a CSS file with the name of style.css

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
body{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(#FED151, #DE981F);
}
.wrapper{
  background: #f6f6f6;
  max-width: 360px;
  width: 100%;
  border-radius: 10px;
  box-shadow: 0px 10px 15px rgba(0,0,0,0.1);
}
.wrapper .content{
  padding: 30px;
  display: flex;
  align-items: center;
  flex-direction: column;
}
.wrapper .outer{
  height: 135px;
  width: 135px;
  overflow: hidden;
}
.outer .emojis{
  height: 500%;
  display: flex;
  flex-direction: column;
}
.outer .emojis li{
  height: 20%;
  width: 100%;
  list-style: none;
  transition: all 0.3s ease;
}
.outer li img{
  height: 100%;
  width: 100%;
}
#star-2:checked ~ .content .emojis .slideImg{
  margin-top: -135px;
}
#star-3:checked ~ .content .emojis .slideImg{
  margin-top: -270px;
}
#star-4:checked ~ .content .emojis .slideImg{
  margin-top: -405px;
}
#star-5:checked ~ .content .emojis .slideImg{
  margin-top: -540px;
}
.wrapper .stars{
  margin-top: 30px;
}
.stars label{
  font-size: 30px;
  margin: 0 3px;
  color: #ccc;
}
#star-1:hover ~ .content .stars .star-1,
#star-1:checked ~ .content .stars .star-1,
#star-2:hover ~ .content .stars .star-1,
#star-2:hover ~ .content .stars .star-2,
#star-2:checked ~ .content .stars .star-1,
#star-2:checked ~ .content .stars .star-2,
#star-3:hover ~ .content .stars .star-1,
#star-3:hover ~ .content .stars .star-2,
#star-3:hover ~ .content .stars .star-3,
#star-3:checked ~ .content .stars .star-1,
#star-3:checked ~ .content .stars .star-2,
#star-3:checked ~ .content .stars .star-3,
#star-4:hover ~ .content .stars .star-1,
#star-4:hover ~ .content .stars .star-2,
#star-4:hover ~ .content .stars .star-3,
#star-4:hover ~ .content .stars .star-4,
#star-4:checked ~ .content .stars .star-1,
#star-4:checked ~ .content .stars .star-2,
#star-4:checked ~ .content .stars .star-3,
#star-4:checked ~ .content .stars .star-4,
#star-5:hover ~ .content .stars .star-1,
#star-5:hover ~ .content .stars .star-2,
#star-5:hover ~ .content .stars .star-3,
#star-5:hover ~ .content .stars .star-4,
#star-5:hover ~ .content .stars .star-5,
#star-5:checked ~ .content .stars .star-1,
#star-5:checked ~ .content .stars .star-2,
#star-5:checked ~ .content .stars .star-3,
#star-5:checked ~ .content .stars .star-4,
#star-5:checked ~ .content .stars .star-5{
  color: #fd4;
}
.wrapper .footer{
  border-top: 1px solid #ccc;
  background: #f2f2f2;
  width: 100%;
  height: 55px;
  padding: 0 20px;
  border-radius: 0 0 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer span{
  font-size: 17px;
  font-weight: 400;
}
.footer .text::before{
  content: "Rate your experience";
}
.footer .numb::before{
  content: "0 out of 5";
}
#star-1:checked ~ .footer .text::before{
  content: "I just hate it";
}
#star-1:checked ~ .footer .numb::before{
  content: "1 out of 5";
}
#star-2:checked ~ .footer .text::before{
  content: "I don't like it";
}
#star-2:checked ~ .footer .numb::before{
  content: "2 out of 5";
}
#star-3:checked ~ .footer .text::before{
  content: "This is awesome";
}
#star-3:checked ~ .footer .numb::before{
  content: "3 out of 5";
}
#star-4:checked ~ .footer .text::before{
  content: "I just like it";
}
#star-4:checked ~ .footer .numb::before{
  content: "4 out of 5";
}
#star-5:checked ~ .footer .text::before{
  content: "I just love it";
}
#star-5:checked ~ .footer .numb::before{
  content: "5 out of 5";
}
input[type="radio"]{
  display: none;
}

Now you’ve successfully created a Pure CSS Emoji Star Rating Widget.

Cayla  Erdman

Cayla Erdman

1596501540

Many (to many) relations among the stars.

In the mystical moist night-air, and from time to time, Look’d up in perfect silence at the stars.” — Walt Whitman


Recently, I came across a personal journal where I noted the objects I observed in the night sky with my telescope. Most of the entries are from high school and college summer breaks when I could stay up later at night and (somewhat) sleep in the next day. I’d start every summer by observing the late Spring constellations like Hercules with his Great Globular Cluster. Sometime around the middle of July, I would see a beautiful crescent Moon setting over Lake Michigan. This was also my favorite time to see The Summer Triangle with Lyra and it’s Ring Nebula. Finally, I’d end the summer by looking for the Andromeda Galaxy.

These deep-sky objects (objects like globular clusters and galaxies) occur relative to the same constellations. However, there are some objects (those inside the solar system) like the Moon, planets, and comets that change positions and move relative to the constellations throughout the year. In other words, I can observe the Moon or Jupiter in different constellations such as Taurus in the winter and Leo in the spring.

These observations are a great example of a database with a many-to-many relationship. Again, let me use astronomy for a SQL example. Let’s begin.

Many-to-many relationships

What is a many-to-many relationship in a SQL database? It’s an instance where multiple records in one table are related to multiple records in another table. After a bit of searching, a common example is a database made for a school. The school has many students that can take many classes at a time. At the same time, there isn’t one student per class — but many students per class. (For more on this example, I recommend reading this DZone tutorial.)

I want to use a different example to showcase this concept. Consider a list of constellations you can see in the summer (in the below picture on the left) and a list of objects that can be seen in the summer night sky (on the right). The list of objects are in some constellation from the left list. For example, the Ring Nebula can be observed in the constellation Lyra but the Moon can be observed next to many constellations in the Summer (here, Scorpius and Pisces). You can also see M-80 in Scorpius but M-82 is seen in Ursa Major.

Image for post

The relationship between items in two lists.

The Problem

How do you store this information in a database? Well, let’s try using one table. Coded up in a table called wrong_table, this looks like the following.

Image for post

One table to store the information.

But, how can we query this table? Specifically, look at the record for Scorpius and the record for Pisces.

Image for post

Querying wrong_table.

For Scorpius, M-80 and The Moon occur together as a text field. The Moon also occurs in the Pisces record. Say I want to count how many times The Moon occurs. Let’s try.

SELECT *
FROM wrong_table
WHERE name_obs = 'The Moon';

Result:

Image for post

Querying wrong_table.

Alright, that’s odd — the result is just the Pisces record. Why? The Moon’s instance in the record for Scorpius is tied to M-80 in that M-80, The Moon are in the same field and not distinct from each other. How can I count occurrences of The Moon if one record is not distinct from M-80?

Ok, let’s try another approach. Say we put each occurrence in its own column, like in wrong_table_2.

Image for post

A view of wrong_table_2.

There are a few issues with this. Let’s try finding the instances of The Moon.

SELECT *
FROM wrong_table_2
WHERE name_obs_1 = 'The Moon' OR name_obs_2 = 'The Moon';

Result:

Image for post

Querying wrong_table_2.

Ok, now let’s try to count the instances… but when we do, the columns used in the WHERE line can theoretically grow (countably) infinitely long. Meaning, I can add more observations to this table for the Scorpius record.

What a mess!

#sql-joins #sql #many-to-many

Spring Data Rest – How to create a RestAPIs with JPA Many-to-Many relational entities

https://grokonez.com/spring-framework/spring-data-rest/spring-data-rest-create-restapis-jpa-many-to-many-relational-entities-springboot-mysql-hal-browser

Spring Data Rest – How to create a RestAPIs with JPA Many-to-Many relational entities | SpringBoot + MySql + HAL Browser

In the tutorial, JavaSampleApproach will guide how to build a Spring Data Rest application for Jpa Many-To-Many relational entities with SpringBoot.

Related posts:
Spring Data Rest – How to create a RestAPIs with JPA One-to-Many relational entities | SpringBoot + MySql + HAL Browser
How to access MySQL database with Spring Data Rest application
Spring JPA – Many to Many relationship

I. Technologies

– Java 8 – Maven 3.6.1 – Spring Tool Suite: Version 3.8.4.RELEASE – Spring Boot: 1.5.4.RELEASE – MySQL – Hal Browser

II. Practice

The tutorial creates a SpringBoot project with 2 JPA entities {Student, Subject} which have Many-to-Many relationship. We use Spring Data Rest to build restfulAPIs for accessing MySQL data which are created by 2 entities. Then using HalBrowser to consume the rests.

Step to do:
– Create SpringBoot project
– Create Jpa entities
– Create Rest repositories
– Implement CommandLineRunner client
– Run and check results

spring data rest hal many to many - project structure

1. Create SpringBoot project

Using SpringToolSuite to create a SpringBoot project. Then add dependencies:

More at:

https://grokonez.com/spring-framework/spring-data-rest/spring-data-rest-create-restapis-jpa-many-to-many-relational-entities-springboot-mysql-hal-browser

Spring Data Rest – How to create a RestAPIs with JPA Many-to-Many relational entities | SpringBoot + MySql + HAL Browser

#springdata #restapi #springjpa #many-to-many

To Relational or Not to Relational?

Working on your next project but not sure which back-end technology to use? For starters, databases come in two flavors: relational and non-relational. Both have their own set of rules, pros and cons which help in determining which type of application they should be used in. Let us delve into these differences so that we would be able to decide which one is better suited for us.

Relational Databases:

Relational databases store data in the form of tables containing rows (representing entries) and columns (containing a set of information) having a unique key for each row. These keys can either be primary or foreign. It is based on a form of algebraic set theory known as relational algebra, which is used in the relational modeling of data. They are better suited for applications where many transactions are involved, also known as transactions-oriented applications (OLTP).

They use SQL (Structured Query Language) as a language for the maintenance and querying of databases. We can use MySQL, SQL Server, SQLite, MS Access, Oracle, Sybase, PostGreSQL, or Informix.

They are normalized databases i.e they are in accordance with a series of so-called “normal forms” in order to reduce data redundancy and improve data integrity.

Advantages:

  1. They are useful for applications requiring a lot of transactions, complex queries and routine analysis of data

  2. They are robust, simple, structured and flexible.

  3. They ensure reliable data transactions through ACID (Atomity, Consistency, Isolation, Durability).

  4. Easier to use because of GUI (Graphical User Interface)

Disadvantages:

  1. Their main disadvantage is that it is impossible to horizontally scale them. If our business requirements increase, then we need to move on to bigger systems, making them more costly in the long run.

  2. Images and other multimedia files cannot be stored.

  3. We cannot use them for geospatial data

  4. They can cause ORM Impedance Mismatch

Here_ is a basic CRUD demo of __MySQL _using Node.js. You need to install the relevant software before running the examples in the repository.

#non-relational-database #mysql #relational-databases #nodejs #mongodb

Hollie  Ratke

Hollie Ratke

1604228400

‘Among Us’ Mobile Game Under Siege by Attackers

The meteoric rise of the game Among Us appears to be outpacing its developer’s ability to keep up with malicious actors. On Sunday night, a specific ongoing attack forced InnerSloth, the company behind the game, to hastily roll out an update designed to kick bad actors off the game’s servers — likely along with some innocent players as well.

Among Us takes place in a space setting, where some platers are “crewmates,” and others are “imposters” that live among us. As crewmates prepare their ship for departure, they must locate and eliminate the imposters before they’re taken out themselves. It so far has 5.3 million downloads on Google Play alone.

InnerSloth is asking for patience while the company addresses this and other ongoing security concerns. InnerSloth is run by a three-person team consisting of one developer, one animator and game designer, and one artist. The game was released almost two years ago, but thanks to a long summer spent largely under quarantine its audience has exploded over the past few months.

Eris Loris Takes Over Among Us

This most recent round of attacks spammed players with ads from a player named Eris Loris, rendering the game useless. Players flooded the Among Us subreddit to report the activity.

“So far every single server I’ve joined is hacked by Eris Loris today,” one user with a NSFW handle name wrote two days ago. “I have tried maybe 40-plus games. Not a single one wasn’t hacked within 10-30 seconds.”

The breach uses bots to overwhelm the game with messages promoting a YouTube channel and Discord operated under the name Eris Loris, threatening to “blow up your phone,” and concluding with a “Trump 2020” endorsement.

Among Us Server Update

Forest Willard, InnerSloth’s resident programmer, announced a server update Sunday night that tries to identify bad actors on the game and kick them out before they cause trouble. But the move comes with a downside, some players might get kicked off inadvertently, which Willard added in a tweet is for the “greater good,” that players should view as “emergency maintenance.”

“The reason I didn’t roll this update out sooner is that I was afraid of false positives: You totally might see the game think you’re hacking when you’re not,” Willard said in a subsequent tweet. “I’ve done my best to find this kind of bug, but my hand is forced this time.”

Threatpost wasn’t able to contact the person behind the Eris Loris breach by the time of publication, but he told Kokatu he attacked Among Us because he thinks it’s funny to rile people up. He added that the blame for the damage to the game falls on InnerSloth and the team’s inability to scale up quickly enough.

“Among Us may be a small developer team, but that’s not my fault,” he added. “The game is at a scale bigger than most games. There is nothing stopping them from getting more developers, so the ‘it’s three people’ reasoning means nothing to me.”

Can Among Us Scale?

InnerSloth’s recent record might back up Eris Loris’ point about scale. A scroll through the Among Us subreddit shows breaches on the game are frequent, in addition to rampant cheating.

In early October, a massive spike in traffic kept shutting down the Among Us servers, according to Screen Rant.

But that hasn’t stunted the game’s growth yet. Among Us was the most downloaded mobile game in the world during September, with 83.8 million installs, according to SensorTower, which added that’s 40 times more than the same month last year.

And just last week New York Representative Alexandria Ocasio-Cortez went live on Twitch to play Among Us and promote voting, an event that drew in 435,000 viewers just to her stream alone, TechCrunch reported.

#hacks #web security #alexandria ocasio-cortez #among us #among us 2 #among us subreddit #aoc #bots #breach #cybersecurity #eric loris #game servers #gaming #hack #hackers #innersloth #kicked off #mobile game #security breach #server update