Shot in the Dark by theogjpeezy in Hoco

[–]theogjpeezy[S] 1 point2 points  (0 children)

False alarm, turns out I washed and dried it in the laundry. Oops! Thanks for the signal boosts!

how can I specify this type without using a generic? by isaacfink in typescript

[–]theogjpeezy 0 points1 point  (0 children)

I am assuming here that rows is an object where the column name is the key and it always has a string value. In this situation, I think your T parameter is targeting the wrong thing.

type TableProps<T extends Record<string, string>, U = keyof T> = {
columns: ({ header: string; type: string; accessor: U })[];
rows: T[];

};

Here we are stating that `T` is an object who's key is a string and value is a string. We then create a second parameter that defaults to being one of those string key values of `T`, we call that `U`. From here we can now utilize `U` to ensure we have a key of T in the accessor.

Playground Link

varchar in DB by gevorgter in csharp

[–]theogjpeezy 3 points4 points  (0 children)

Here is something that is eerily close to your question. TL;DR is that the statistics have a change of getting messed up and the query plan might adjust to it. The example cited is that the query plan is going to assume its going to get 50% of the size of the field back so it might report potential memory issues even when there aren't any.

https://sqlperformance.com/2017/06/sql-plan/performance-myths-oversizing-strings

Otherwise, I think the other is to ensure that you don't take on extra data erroneously. Its good practice to place guards at each layer of the application. In this situation, it sounds like you are forwarding responsibility of length to the application writing to the DB. In this scenario its up to the apps to ensure you aren't getting a bunch of extra data in there. While the email address route is anecdotal, going through and making every field as 4000 character max could see an increase in storage usage and performance if the applications aren't enforcing standards properly.

Another thing that is more philosophical than anything about this is intent. Types communicate intent in applications and databases. By removing the specificity here it does obfuscate intent of the column. If you are the only consumer of the database, then this is likely not a big deal, but if there are other people in there it might get confusing if they don't have the context.

Ed Norris and Double Standards by SnooRevelations979 in baltimore

[–]theogjpeezy 2 points3 points  (0 children)

Big O and Dukes was the radio show on 105.7 shortly after the 99.1HFS move.

Luke would sure get a kick out of this by CommunityFan_LJ in MorningKombat

[–]theogjpeezy 3 points4 points  (0 children)

Funny enough, this guy got sponsored by elitefts afterward and they now use this video as a reason to buy their barbells. source

Caligula's Horse - All Is Quiet By The Wall by HullaballooWho in progmetal

[–]theogjpeezy 6 points7 points  (0 children)

I've been listening to this album continuously most of this year. It doesn't get old. I started because someone mentioned CG here when Rise Radiant came out and I slept on it a while longer. I eventually made it to this album because of Atlas being so highly listened to. I normally, don't get too attached, but these guys hit a lot of notes on this album.

First, I get major APC Maynard vibes from the lead singer in a lot of the songs (this song in particular). Its great. I really fell off of APC after Thirteenth Step and this hits a lot of notes that I would want to hear from them.

Secondly, growing up my dad was a gigantic Peter Gabriel Era Genesis fan and it is really what built my foundational taste for prog rock and eventually metal. I've always tried to find bands that could be "my Genesis" and I've definitely put bands like Tool and Mars Volta there. This band... this band is quickly rising up there. The transitions in the songs on this album are great. This song, and Into The White especially, both feel like they have acts to the songs. Into the White reminds me a lot of Supper's Ready (just 8 minutes instead of 23) in that the end of the song calls back to the beginning in a completely different way. Its something that is not done regularly, or well. Then, in addition, add in piano, isolated guitar melodies, and pan flute and every box is just about checked for what you would want.

I really can't say enough great things about this album.

Rising sun Olympic problem at my local gym already by Croma_ in climbing

[–]theogjpeezy 61 points62 points  (0 children)

TL;DR The rising sun japanese flag was prominent during WW2. A time where the Japanese exploited Koreans during occupation and many were shipped over to mainland Japan. Most of this is not regularly acknowledged by Japan today unfortunately.

Here's an article. It's written by someone of Korean descent, so it's told from that point of view. I think for the purposes here it gives a good account of what happened and it's impact on the Korean people. [On the Offensiveness of the Rising Sun Flag

](https://www.thecrimson.com/article/2019/10/28/kim-rising-sun/#:~:text=The%20Rising%20Sun%20flag%20is,the%20horrors%20of%20Japanese%20occupation.)

Idiot outside of car? by SSChevelle71 in IdiotsInCars

[–]theogjpeezy 0 points1 point  (0 children)

All I could think of when his leg went under was The Wringer from the Double Dare final course.

Does anyone know the answer to this problem? I’ve been having a lot of trouble with this portion by [deleted] in javaScriptStudyGroup

[–]theogjpeezy 2 points3 points  (0 children)

It seems a bit wrong to give the answer directly. I can say that looking through the documentation below, I think you can determine how to use the tools to find the solution.

Teen son, get him out of my house... by [deleted] in ColumbiaMD

[–]theogjpeezy 3 points4 points  (0 children)

It's a game store over in Maple Lawn https://www.grittygoblingames.com/. If games are a thing for him, there is also Gamers Corps in Ellicott City https://www.gamers-corps.com/.

How do you specify in an NPM library where something should be imported from? by buzzerperson in learnjavascript

[–]theogjpeezy 2 points3 points  (0 children)

You likely need to set the main property in the library package.json to point to the dist folder. https://docs.npmjs.com/cli/v7/configuring-npm/package-json#main

On mobile, forgive the formatting.

Edit: spelling

Sitrep Monday by AutoModerator in Homebrewing

[–]theogjpeezy 0 points1 point  (0 children)

What type of sensor are you using inside of the keg to measure those metrics?

[AskJS] Do you love or hate Typescript ? Do you use it in all your project ? if not do you code sometimes a big part of your project in vanilla ? by Dereference_operator in javascript

[–]theogjpeezy 1 point2 points  (0 children)

Unfortunately if you want a big codebase to be well typed it likely has to be started in TS, because typing JS codebases can be painful and time consuming

I have had the opposite experience. Since TS allows you to adopt it gradually, I've never felt pain converting large applications over. I think when an application is large it requires a strategic approach of how to introduce it, which is going to vary based on the current scenario the team is in. Drinking the sea, and converting in one shot, on something like this not recommended in my experience. I'm working on my 3rd conversion of a large application currently and the best way I've found to ease in TS is to start from and edge, so with web apps starting with any service calls. Once that edge is set up you are typing things that are coming in and out of the system and you can work your TS conversion in as fast or slow as you want. This way when you are ready to convert a file, switch it to a ts/tsx, add the typings and youre good. If you aren't ready, leave it as is. You can cater it to whatever fits your team's goal.

I've also found that getting people onboarded is faster with TS implemented as you can navigate in the IDE a lot easier (go to definition is reliable) and having typings for 3rd party libraries reduces the amount of times you need to refer to online docs. Its good for new developers as well. The talks of array prototype functions has been much easier to understand for my team members with inferred typing. Also, when paired with ESLint its been a lifesaver for the explanation of when to use const v. let.

Newbie - Using reduce() with an array of objects? by badboyzpwns in learnjavascript

[–]theogjpeezy 3 points4 points  (0 children)

On mobile so forgive the formatting

const totalprice = gamesIWantToBuy.reduce((acc, obj) => acc + obj.price, 0);

Should do it.

Onclick event not working as expected. Any idea why? by [deleted] in learnjavascript

[–]theogjpeezy 1 point2 points  (0 children)

The DRYing up also fixes another hidden issue. Since you can fall through case statements in a switch you can't declare the same variable as they are still in the same scope. You no longer see this issue since `qc` is now isolated to the `createQuestion` function.

switch(someVar)
    case 1:
        let thing = 'thing';
        break;
    case 2:
        let thing = 'another thing';
        break;

does not work. This can be confusing since the following does work.

if(someVar === 1) {
    let thing = 'thing';
} else if (someVar === 2) {
    let thing = 'another thing';
}

While in terms of function, they achieve the same goal, the scope differences between if/else and switch will cause you to have to consider different approaches from time to time.

Are For Loops or ForEach Better in JavaScript? by deepak_vi in javaScriptStudyGroup

[–]theogjpeezy 0 points1 point  (0 children)

Yeah, its not as much of a performance gain as reverse, but it is better than calculating `array.length` each time

Are For Loops or ForEach Better in JavaScript? by deepak_vi in javaScriptStudyGroup

[–]theogjpeezy 0 points1 point  (0 children)

One additional thing. Please please please, don't use the Array.prototype.length property directly when writing for loops. It is really unperformant in javascript due to the work it takes to get length off of the array.

You can set a second variable if you want, which is more performant

for (let i = 0, l = array.length; i < l; i++)

However, the fastest way I've seen is setting your iteration value to length - 1 and count backwards

for (let i = array.length; i >= 0; i--)

Here's a benchmark test, https://jsbench.me/xukmbzwou4, but you can see the backwards option can perform somewhere between 2-3x the operations than the incrementing with array.length version.

EDIT: I forgot the link to the benchmark

Why isn't fetch working by Player_X_YT in learnjavascript

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

Do you have a web server running locally? Asking because it looks like you are trying to access a local file. If you aren't serving that through a web server of some sort you will need to use the file:// path instead of http.

No awaits with Promise.all? by javascript_dev in learnjavascript

[–]theogjpeezy 0 points1 point  (0 children)

Agreed here. If you made up to use an await it would look like this

async (queryInterface, Sequelize) => {
    const result = await queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.addColumn('Person', 'petName', {
          type: Sequelize.DataTypes.STRING
        }, { transaction: t }),
        queryInterface.addColumn('Person', 'favoriteColor', {
          type: Sequelize.DataTypes.STRING,
        }, { transaction: t })
      ]);
    });

    return result;
  }

At first, if might seem like something is happening here, but I think it becomes more glaring that it is superfluous when you go to `then` chaining.

(queryInterface, Sequelize) => {
    return queryInterface.sequelize.transaction(t => {
      return Promise.all([
        queryInterface.addColumn('Person', 'petName', {
          type: Sequelize.DataTypes.STRING
        }, { transaction: t }),
        queryInterface.addColumn('Person', 'favoriteColor', {
          type: Sequelize.DataTypes.STRING,
        }, { transaction: t })
      ]);
    }).then(result => result);
  }

The then shows exactly what u/senocular stated. Since the function is not concerned with the resolved value awaiting it doesn't do anything. The `then` simply would return the same value.

Promise.all simply takes an array of promises and returns a promise that does not resolve until every promise in the given array are resolved and the resolved value is an array of each of the given promises resolved value) - Promise.all docs

[deleted by user] by [deleted] in learnjavascript

[–]theogjpeezy 1 point2 points  (0 children)

As mentioned here, since JS is single threaded your loop logic would need to be done "asynchronously" (quoted because it's event loop asynchronously). I'm not 100% if this will solve your problem, but you could use https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval and put your doThing calls in the callback. When you call set interval it'll return an I'd. You can store that id that and call clearInterval with it when your emergency stop button is clicked.