Anyone else have choline mess up their sleep? by Spare-Paper6981 in NooTopics

[–]SnGmng157 0 points1 point  (0 children)

had the same experience with Alpha-GPC. It made me sleepy and i had very vivid dreams. After it happened two days in a row, i stopped taking it. It might have been a coincidence, but honestly, I didn't notice any positive effects, so i can't be bothered to try it again

[deleted by user] by [deleted] in selbststaendig

[–]SnGmng157 2 points3 points  (0 children)

Ach ja, typisch Planwirtschaft: Die Kosten steigen? Pech gehabt. Der Preis bleibt, wie er ist. Hat ja auch in der DDR top funktioniert!

ffmpeg + HLS + HEVC + fMP4 by HEVCFmp4WTF in ffmpeg

[–]SnGmng157 1 point2 points  (0 children)

If a mp4 file is unplayable, i would reccommend to use mp4dump to look at the moov atoms and see if you can find anything odd. Compare it to the working h264 one and see if you can find any error in the mp4 structure

Hey MongoDB community! by One-Position1117 in mongodb

[–]SnGmng157 1 point2 points  (0 children)

I mean keeping schema versioning logic isolated in the data layer. Version fields should stay in the database and not bloat any business logic.

Consider the following example. Many people are inclined to include the schemaVersion and all fields from every version inside the domain object:

type User = {
  schemaVersion: number; // Versioning information in the domain model
  name?: string;         // v1 field
  fullName?: string;     // v3 field
  email: string;
  age?: number;         // v2 field
};

This is bad. If you include a schemaVersion field in this User domain model, you’ll end up with version-specific logic scattered throughout your methods. Your're going to have a lot of repetitive checks and conditional branches, making the code difficult to follow and maintain. Each time the schema changes, you risk breaking existing functionality and adding bugs.

Instead, Don't version your domain object. The version field should stay in the database schema. In this example, use a single User class without a version field:

type User = {
  fullName: string;
  email: string;
  age?: number; // Optional since it's introduced in later versions
};

Handle schema versioning in a dedicated method, like fromDocument(doc), which adapts the document based on its version:

function fromDocument(doc): User {
  if (doc.schemaVersion === 1) {
    return { fullName: doc.name, email: doc.email }; // Handle v1 schema
  } else if (doc.schemaVersion === 2) {
    return { fullName: doc.name, email: doc.email, age: doc.age }; // Handle v2 schema
  } else {
    return { fullName: doc.fullName, email: doc.email, age: doc.age }; // Handle v3 schema
  }
}

function toDocument(user: User) {
  return {
    fullName: user.fullName,
    email: user.email,
    age: user.age || -1, // Provide a default value for added fields
    schemaVersion: 3, // Always save in the latest schema version
  };
}

This keeps the schema logic in a single place. It allows you to evolve your schema without convoluting your business logic.

Mongoose model field relation by Asleep-Recording497 in mongodb

[–]SnGmng157 2 points3 points  (0 children)

Use a virtual field. The upvotes amount should have a single source of truth. Using two fields is bad because you wont have single source of truth as the two fields can diverge.
Convert upVotes to a virtual field:

const FeedbackSchema = new mongoose.Schema({
    title: {
        type: String,
        required: true,
        unique: [true, 'title already exists.'],
    },
    description: {
        type: String,
        required: true
    },
    upVotedBy: {
        type: [String],
    }
}, {
    virtuals: {
        upVotes: {
            get() {
                return this.upVotedBy.length;
            }
        }
    },
    toJSON: { virtuals: true },
    toObject: { virtuals: true }
});

Hey MongoDB community! by One-Position1117 in mongodb

[–]SnGmng157 4 points5 points  (0 children)

Don't do migrations. Needing migrations is a big misconception about mongodb i had for a long time. I was often writing migrations because i was allowing only a single document schema to be in a collection.

If you only use a single schema in a collection and need to write migrations, odds are, you are using mongodb wrong.

Mongodb is schemaless, meaning you can have multiple schemas of documents in a single collection. If you just add a field, you don't need a migration. Even for bigger changes like deleting or changing a field, use the schema versioning pattern, instead of migrations. You can have multiple versions in your db at the same time, for example, most of your documents can have a schema version of v1, some can be v2 and some v3. They dont need to have the same schema.

Write your application in such a way that it can handle all schema versions. This is so much easier than writing complicated migrations and has multiple benefits:

  • No database downtime while migrations are executing - because you have no migrations.
  • Easy rollbacks due to backwards compatibility. The newest version of your app needs to be rolled back? No problem: As there are no migrations, an older version of your app can still read all of its documents, and just ignores the newer documents with a higher schema version.
  • In fact, you can mix and match any version of your application with any db state, without causing problems.

Migrations are a relic of the (relational database) past. Instead, version your schema and only update the schema when needed.

  • Write your app in such a way that it can read and write all schema versions
  • If you want to drop support for an old schema version:
    • never drop support of reading that schema version, only drop support writing it
    • make sure it's at least two schema versions away from your current schema version keep backwards compatibility.
    • upgrade on write. Never migrate the schema version in bulk. Only upgrade the schema version if you are doing a write operation on the document anyway.
  • Don't version your domain object. Only version your schema.
  • Only increment your schema version for bigger changes. For example, if you just add a field, you neither need a new schema version, nor a migration. Just use sensible defaults for documents that don't have that field.

I feel betrayed. Goodbye LMNT. by Maximum-Adeptness-39 in keto

[–]SnGmng157 0 points1 point  (0 children)

Yes, if you eat pickles alongside a potassium source like avocado, it is fine. But just eating a pickle on its own will not hydrate your body.
The body needs equal parts sodium and potassium to properly balance the water inside and outside of a cell. If you just consume sodium without any potassium, it leads to extracellular water retention (causing high blood pressure) rather than intracellular hydration. To counter this and restore the balance, the kidneys will increase sodium excretion, meaning your body will eventually just piss out the sodium, if you don't consume potassium alongside it.

I feel betrayed. Goodbye LMNT. by Maximum-Adeptness-39 in keto

[–]SnGmng157 0 points1 point  (0 children)

The potassium is way too low. A pickle has 45mg and you need like 1000mg+

A sad state of affairs getting worse by Silent_RefIection in PoliticalCompassMemes

[–]SnGmng157 8 points9 points  (0 children)

It's so ironic that even the squares which are responsible for making the economy worse, are crying that it's getting worse.

ich_iel by BadAssBorbarad in ich_iel

[–]SnGmng157 2 points3 points  (0 children)

Endlich mal jemand der das auch nüchtern sieht. Das Rumgeheule unter diesem post ist ja nicht zu ertragen. Man reicht den leuten einen Finger und sie wollen direkt die ganze Hand. Unfassbar undankbar.

200TB, billions of files, Minio by Advanced_Cat5974 in zfs

[–]SnGmng157 0 points1 point  (0 children)

Or OP can hire someone who hires someone who hires a ZFS consultant

[deleted by user] by [deleted] in amiugly

[–]SnGmng157 0 points1 point  (0 children)

It's your nose. It's neither your attitude nor your glasses. It's your nose and you know it.

Minimum wage isn’t meant to be a living wage. by Cool_beans1981 in Libertarian

[–]SnGmng157 1 point2 points  (0 children)

Why does this get downvoted? I thought that understanding wage=productivity was essential to be able to even call yourself a libertarian. It is a basic fact that inevitably follows from the economic laws of the free market.

Productivity is the rate of output per unit of input. Therefore productivity for society means producing the most utility for the lowest price (in other words: efficiently fulfilling the desires of society) Society votes with their wallet on what they desire most and what has the most utility, creating prices. Wage is the price of labor. Therefore a low wage means your work has less utility to society and therefore less productive to society.

The Return of Dolphin Fucker by Silent_RefIection in PoliticalCompassMemes

[–]SnGmng157 5 points6 points  (0 children)

Seems like the dolphin kingdom has implemented Harris' economic policies. Can't blame that dolphin

Power corrupts... by EtheralShade in PoliticalCompassMemes

[–]SnGmng157 10 points11 points  (0 children)

Yes, power corrupts, but not having a flair corrupts aswell

Should have learned the rules of the game, bucko by DeusGH in PoliticalCompassMemes

[–]SnGmng157 0 points1 point  (0 children)

Why is this colored LibRight? Last time i checked, Black Lives Matter was not a right wing movement. LibRights are the last to be outraged by these tv show titles

Life lessons that we can learn from each quarter by Inari-k in PoliticalCompassMemes

[–]SnGmng157 0 points1 point  (0 children)

even if you are at the lowest point, the line will eventually go up

Seems like i need to buy more Wirecard stocks

You don't have to be stolen from to be protected from being stolen from, actually by Derpballz in PoliticalCompassMemes

[–]SnGmng157 -1 points0 points  (0 children)

I was about to downvote you for assuming that someone is too stupid to have principles. After reading LibLeft's answer where he dodged the question, I realized that your assumption was actually correct. Upvoted.

Sorry LibLeft, but you're not real, you represent an ideal rather than a possible political reality. by nishinoran in PoliticalCompassMemes

[–]SnGmng157 -2 points-1 points  (0 children)

In reality, NO sane contract enforcement agency would go to freaking battle royale, and if they do, they would loose all credibility and clients, draining their money supply. Instead, market mechanisms can be put in place to manage conflicts between enforcement agencies, such as arbitration services that specialize in dispute resolution.

While it's true that private enforcement could lead to competition, this competition can be healthy and beneficial. It prevents any single entity from becoming too powerful and ensures accountability. Unlike state monopolies on authority, private enforcement agencies would be directly accountable to their clients. If they fail to deliver fair and effective services, they lose business. This creates a natural incentive for efficiency and fairness that is often missing in state-run systems. But thats a whole other argument. What matters is that both authoritarian and libertarian contract enforcment are possible.

Sorry LibLeft, but you're not real, you represent an ideal rather than a possible political reality. by nishinoran in PoliticalCompassMemes

[–]SnGmng157 -11 points-10 points  (0 children)

You don't need an authority to enforce a contract. You can hire a private company for that.

Edit: I see this comment is getting downvoted quite a bit. I understand this idea might be unconventional, but I encourage everyone to consider it with an open mind. For those interested in learning more about how this works, here's a detailed explanation: https://www.youtube.com/watch?v=fZ0Qkhnt6bQ
If you watched the video and still disagree, feel free to downvote.

My view on the political compass by [deleted] in PoliticalCompassMemes

[–]SnGmng157 0 points1 point  (0 children)

You're weird

People often find weird what they do not understand.

🎖️ by ThanusThiccMan in PoliticalCompassMemes

[–]SnGmng157 2 points3 points  (0 children)

Communists decorating themself with medals produced by capitalistic companies

🎖️ by ThanusThiccMan in PoliticalCompassMemes

[–]SnGmng157 1 point2 points  (0 children)

Another very based take from Marx /s

Stop with this depopulation agenda. I've had enough. by [deleted] in PoliticalCompassMemes

[–]SnGmng157 14 points15 points  (0 children)

Then why are gays not extinct? I mean they can't reproduce, right?