[-] [email protected] 6 points 3 days ago

The question reads like an XY problem, they describe DB functions for data structures so unless there's some specific reason they can't use a DB that's the right answer. A "spreadsheet for data structures" describes a relational database.

But they need rectangular structure. How do they work on tree structures, like OP has asked?

Relationships. You don't dump all your data in a single table. Take for instance the following sample JSON:

JSON


  "users": [
    {
      "id": 1,
      "name": "Alice",
      "email": "[email protected]",
      "favorites": {
        "games": [
          {
            "title": "The Witcher 3",
            "platforms": [
              {
                "name": "PC",
                "release_year": 2015,
                "rating": 9.8
              },
              {
                "name": "PS4",
                "release_year": 2015,
                "rating": 9.5
              }
            ],
            "genres": ["RPG", "Action"]
          },
          {
            "title": "Minecraft",
            "platforms": [
              {
                "name": "PC",
                "release_year": 2011,
                "rating": 9.2
              },
              {
                "name": "Xbox One",
                "release_year": 2014,
                "rating": 9.0
              }
            ],
            "genres": ["Sandbox", "Survival"]
          }
        ]
      }
    },
    {
      "id": 2,
      "name": "Bob",
      "email": "[email protected]",
      "favorites": {
        "games": [
          {
            "title": "Fortnite",
            "platforms": [
              {
                "name": "PC",
                "release_year": 2017,
                "rating": 8.6
              },
              {
                "name": "PS5",
                "release_year": 2020,
                "rating": 8.5
              }
            ],
            "genres": ["Battle Royale", "Action"]
          },
          {
            "title": "Rocket League",
            "platforms": [
              {
                "name": "PC",
                "release_year": 2015,
                "rating": 8.8
              },
              {
                "name": "Switch",
                "release_year": 2017,
                "rating": 8.9
              }
            ],
            "genres": ["Sports", "Action"]
          }
        ]
      }
    }
  ]
}

You'd structure that in SQL tables something like this:

Tables


dbo.users

user_id name email
1 Alice [email protected]
2 Bob [email protected]

dbo.games

game_id title genre
1 The Witcher 3 RPG
2 Minecraft Sandbox
3 Fortnite Battle Royale
4 Rocket League Sports

dbo.favorites

user_id game_id
1 1
1 2
2 3
2 4

dbo.platforms

platform_id game_id name release_year rating
1 1 PC 2015 9.8
2 1 PS4 2015 9.5
3 2 PC 2011 9.2
4 2 Xbox One 2014 9.0
5 3 PC 2017 8.6
6 3 PS5 2020 8.5
7 4 PC 2015 8.8
8 4 Switch 2017 8.9

The dbo.favorites table handles the many-to-many relationship between users and games; users can have as many favourite games as they want, and multiple users can have the same favourite game. The dbo.platforms handles one-to-many relationships; each record in this table represents a single release, but each game can have multiple releases on different platforms.

[-] [email protected] 490 points 1 month ago

I disagree with that framing, someone not buying your shit is not the same as you losing money. Inkscape saved millions for graphic designers, which is very different. Adobe was not entitled to that money, you can't lose something that was never yours.

[-] [email protected] 79 points 3 months ago

Some local residents have not been onboard with the lack of car spaces at the new station.

If you need a car to reach the station it's questionable to claim you're local.

[-] [email protected] 304 points 5 months ago

What's the end game for cancer?

There isn't one, it doesn't matter that the host dies eventually as long as they get to keep growing for now.

1
submitted 7 months ago by [email protected] to c/[email protected]
1
submitted 7 months ago by [email protected] to c/[email protected]
1
submitted 8 months ago by [email protected] to c/[email protected]
1
submitted 8 months ago by [email protected] to c/[email protected]
5
I don't exist (programming.dev)
submitted 9 months ago by [email protected] to c/[email protected]

I signed in this morning and checked my profile to find I'm not actually here. Did anyone else accidentally stop existing overnight?

[-] [email protected] 223 points 9 months ago

I leave on time, how is that an insult? I'd be much more insulted if someone asked me to work for them for free. That's what unpaid overtime is.

7
submitted 10 months ago* (last edited 10 months ago) by [email protected] to c/[email protected]

Not sure exactly how long this has been happening, but it's been bugging me for the last week at least.

Running Firefox 129.0 (64-bit) on Linux Mint, it seems like the login session is just constantly expiring. Every time I boot up my machine the first time I open programming.dev I have to sign in again. Closing all programming.dev tabs and navigating back to programming.dev without closing Firefox seems to always preserve the session and not require a new sign-in.

~~Closing all Firefox windows then opening Firefox and navigationg to programming.dev is a semi-reliable way to reproduce, about 75% of the time it requires a new sign-in even when I'd signed in less then a minute ago before closing the window.~~ Further testing shortly before submitting this post and those steps no longer reproduce the issue, I'm signed in even after closing the window. Maybe it's a recurring transient issue with login service?

Potentially relevant add-ons are UBlock Origin (0 blocks, shouldn't be an issue) and Privacy Badger (also 0 trackers blocked). I'm connected through VPN, but the issue seems to appear regardless of whether I stay on the same VPN server or switch servers. Firefox reports Content-Security-Policy issues but these seem unrelated and also appear when the session is successfully preserved.

Possibly helpful, occasionally when I open programming.dev I'll see it's signed out then automatically signs in after a second or so; this might have been a known Lemmy issue at some point with delayed authentication as a (now insufficient) solution. A good chance that's a dead-end, might be worth checking anyway.

Edit: It's worth noting that I'm also signed in via the android Jerboa app on another device and don't get signed out there. This could definitely be relevant if it turns out the Jerboa session somehow interferes with the Firefox session.

1
submitted 1 year ago by [email protected] to c/[email protected]
[-] [email protected] 90 points 1 year ago

QR codes essentially just encode text, as long as you're using a sensible QR code reader and check any URLs before opening them there's minimal risk to scanning a QR code.

[-] [email protected] 98 points 1 year ago

with extras like [..] no lockscreen ads

What the fuck? Why is that an extra not just the default? It's great that this product isn't riddled with ads, but that's like saying it's great a burger is not made of human shit; it's crazy that anyone would tolerate a shit-burger in the first place.

Maybe ads are normal in the e-reader space for some reason, but that's just insane to me.

[-] [email protected] 103 points 1 year ago

You're not wrong, but the first words are literally "Just over a decade ago". It's not a news article, it's the story of the research in 2013 which revealed bitcoin isn't anonymous.

[-] [email protected] 186 points 2 years ago

In place of cookies, Google has introduced a new set of tools that makes the Chrome browser itself keep tabs on what you’re doing online.

So instead of cookies which can be blocked or deleted relatively simply there's spyware baked directly into the browser. How is this an improvement for the user?

[-] [email protected] 80 points 2 years ago

Public transport too. It really seems like every time a public service is privatised it goes to shit, almost as if for-profit motives aren't aligned to public interest.

[-] [email protected] 88 points 2 years ago

That's an odd complaint. If they didn't ask for donations, donations would be a lower % of their income. How many donations do you need before you can ask for donations?

view more: next ›

my_hat_stinks

0 post score
0 comment score
joined 2 years ago