stop trying to make fetch happen

it is not going to happen

Don't call ToList()

February 26, 2020 — ~level3

Lets say we are doing something with Entity Framework Core. Maybe pulling some data and "hydrating" some objects. Think twice before calling ToList() in the middle of the action. We are likely doing it wrong. Maybe we need to tweak the data model or maybe we need to adjust the query but we probably need to do something.

STOP.

Take a look at what we could do differently. Even if the query is fast, what if the number of results is 1000x?

tags: dot-net-core, entity-framework-core, programming, note-to-self

What would you do to me?

February 25, 2020 — ~level3

I wrote this horrible code today:

if (data.status = HTTP_STATUS_CODE.NO_CONTENT) {

I meant to write

if (data.status === HTTP_STATUS_CODE.NO_CONTENT) {

Clearly, this is a major bug. I did catch it but not before deploying it to development environment. What would you do if you were my supervisor?

I didn't rewrite history as I had already pushed my changes before I deployed to development.

tags: shitpost, programming

Powershell fun

February 21, 2020 — ~level3

Turns out powershell has different streams for different things. Capture them all with this one trick

https://stackoverflow.com/a/44808718

archiving at https://archive.md/7eNnv https://outline.com/rms4SH

While ($True) { 
    date | Out-File -Append "output.txt";
    $output = try
    {
            Invoke-WebRequest 
                -Uri "https://www.google.com" 
            -UseDefaultCredentials 
            -AllowUnencryptedAuthentication 
            *>&1
    }
    catch
    {
        $_
    };
    $output | Out-File -Append "output.txt";
    Start-Sleep 30; 
}

tags: windows, powershell, programming, shitpost

Thankful for git commit --amend

February 21, 2020 — ~level3

As a mediocre programmer, I make a lot of mistakes. As such, I am very grateful that git commit --amend exists.

I always advise people to commit their changes early and commit changes often. Just don't push them out to public if you are not comfortable.

Feel free to rewrite history until you push.

My sister who is not a programmer, gives very sage programming advice. She once told me, If you can smell yourself a little bit, others can smell you A LOT. She was talking about my lack of personal hygiene but this also applies to code.

If your code smells "a little" to you, it probably smells like a fresh pile to other programmers or even to you six months from now.

I try not to anger future me too much.

tags: programming, shitpost, clickbait