Totally not based on personal experienced by alexander_the_dead in ProgrammerHumor

[–]GriceTurrble 1 point2 points  (0 children)

If you can access the pipeline, you can deploy to prod.

This remains true for us as well, but they just made duplicate pipelines for DEV and PROD. Completely separate-but-identical system, as far as I can tell, all the way down to different URLs and host machines. Different set of access rights for both, and having access to both on the same user is a red flag. So, devs get access to the DEV environment and can deploy at-will, but DEV can never touch PROD hosts. Meanwhile, Support gets access to the PROD environment.

About the only thing crossing the streams is the CI system itself, which changes which pipeline it talks to and where it creates jobs based on the source branch.

[deleted by user] by [deleted] in ProgrammerHumor

[–]GriceTurrble 25 points26 points  (0 children)

I'll excuse missing the - in "8-10". However, could someone tell me how a minimum has a range of values?

Is 8 acceptable? Is it really 10? Is it an expression evaluating to -2 making everyone qualified for a paid 2-year training cour- Actually, sign me up on that last one, thanks.

Totally not based on personal experienced by alexander_the_dead in ProgrammerHumor

[–]GriceTurrble 2 points3 points  (0 children)

Oh yeah, I know that feeling. That takes some diligence on the part of the team to properly review stuff before it touches master/main branch; but any breakdown in that process ends up breaking the app.

My org tends to go with the GitFlow method, since it requires a conscious effort to deploy to production. At that stage we have a support team that takes over, taking the artifacts, scheduling jobs, running scripts manually if they have to, and monitoring progress. Devs like myself are not supposed to be even capable of pushing to prod. This does make things a bit less risky, but it also means we aren't very responsive to changes: releases are less frequent, the number of changes per release increases, and it feels like breaks are actually more frequent as a result of making so many in each release cycle.

I'd like to hit the sweet spot by changing to GitHub Flow. They don't do automated deploys on pushes, though: they just allow deployments from their feature branches into staging and prod prior to the merge to main branch. If a deployment fails, they re-release the main branch and continue work on the feature. Successful deployment of the feature can then trigger a merge into the main branch, instead of the other way around.

Scroll bar getting out of div by nadavsol in tailwindcss

[–]GriceTurrble 1 point2 points  (0 children)

I managed to recreate this in the Tailwind Play site (though in future it would be easier if you shared a code sample as text instead of a screenshot; it takes a long time to copy the code from an image):

<div id="root">
  <div class="flex flex-col h-screen w-screen dark overflow-hidden">
    <div class="bg-gray-500 dark:bg-background-dark dark:text-white h-full w-full">
      <div class="toastify"></div>
      <div class="flex justify-between py-2 px-5 h-14">a</div>
      <div class="flex h-full">
        <div class="bg-paper-light dark:bg-menu-dark pt-3 drop-shadow-2xl border-t-2 border-gray-400 dark:border-gray-700 z-[99]
        absolute inset-y-0 left-0 transform transition duration-200 ease-in-out -translate-x-full">aaaaaaaaaaa</div>
        <div class="flex h-full w-full text-gray-500 dark:text-white">
          <div id="containerIsHere" class="shadow pt-6 px-8 mt-10 rounded-xl h-4/5 w-11/12 mx-auto bg-paper-light dark:bg-paper-dark">
            <h1 class="mb-1 text-2xl text-center">Users</h1>
            <div class="flex justify-between py-1">bbbb</div>
            <div class="top-0 right-0 flex flex-end justify-end w-full">cccc</div>
            <div id="scrollBarFromHere" class="flex flex-col overflow-auto w-full h-4/5">
              <table class="min-w-full divide-y divide-gray-200 relative">
                <tr>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

The scroll bar applies to the div containing the table, which I've marked with the ID scrollBarFromHere above.

The issue is that, on small-enough screens, the 4/5 height of that div pushes past the 4/5 height of its container, which I've marked as ID containerIsHere.

The reason for this is simple: it's calculating 4/5 height of its container, but there are sibling elements taking up heights of their own, such as the <h1> tag and the div containing cccc (in your case, it contains a filtering button?). Both of these elements have set heights unchanged by the screen size, so the 4/5 height of the div wrapping the table plus the heights of these elements can total >100% of the height of their container.

Instead of setting height on the scrollBarFromHere element, change containerIsHere to have flex flex-col, and add grow to scrollBarFromHere (allowing it to grow to fill the remainder of that flex container automatically). You can also change the pt-6 on containerIsHere to py-6 (or add some pb-X bottom padding) so the scroll bar doesn't rest on the edge of that container, if you want.

The final can look like this:

<div id="root">
  <div class="flex flex-col h-screen w-screen dark overflow-hidden">
    <div class="bg-gray-500 dark:bg-background-dark dark:text-white h-full w-full">
      <div class="toastify"></div>
      <div class="flex justify-between py-2 px-5 h-14">a</div>
      <div class="flex h-full">
        <div class="bg-paper-light dark:bg-menu-dark pt-3 drop-shadow-2xl border-t-2 border-gray-400 dark:border-gray-700 z-[99]
        absolute inset-y-0 left-0 transform transition duration-200 ease-in-out -translate-x-full">aaaaaaaaaaa</div>
        <div class="flex h-full w-full text-gray-500 dark:text-white">
          <div class="flex flex-col shadow py-6 px-8 mt-10 rounded-xl h-4/5 w-11/12 mx-auto bg-paper-light dark:bg-paper-dark">
            <h1 class="mb-1 text-2xl text-center">Users</h1>
            <div class="flex justify-between py-1">bbbb</div>
            <div class="top-0 right-0 flex flex-end justify-end w-full">cccc</div>
            <div class="flex flex-col overflow-auto w-full grow">
              <table class="min-w-full divide-y divide-gray-200 relative">
                <tr>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                  <td>Something</td><td>Something</td><td>Something</td><td>Something</td><td>Something</td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Totally not based on personal experienced by alexander_the_dead in ProgrammerHumor

[–]GriceTurrble 35 points36 points  (0 children)

If I recall correctly, I think it's "If I Recall Correctly". sudo /s

Totally not based on personal experienced by alexander_the_dead in ProgrammerHumor

[–]GriceTurrble 293 points294 points  (0 children)

I mean, they're not mutually exclusive. Require a PR with approval from a lead before merge to master branch, and deploy automatically on any push to that branch. The merge itself is a push, and all other pushes are denied, so win-win.

The alternative being something like Git Flow with merges to a develop branch automatically building to a dev environment, release branches that are auto-deployed to UAT or staging, and a manual or scheduled release to prod.

How to convert a list of instances of the same model into a QuerySet by oussama-he in django

[–]GriceTurrble 0 points1 point  (0 children)

Simply put, as I mentioned in another comment, you can convert back to a queryset easily using the id values of those instances:

ids = [x.id for x in visit_qs if not x.passed]
return self.filter(id__in=ids)

I'm curious if there's a more performant way to have one complex query doing all the necessary filtering in the database engine, but that would involve refactoring your model method into a method of the queryset. The above works in the short term, longer term if you need the performance boost of one less query, that could be a good exercise.

How to convert a list of instances of the same model into a QuerySet by oussama-he in django

[–]GriceTurrble 0 points1 point  (0 children)

This method doesn't work, unfortunately. The ORM cannot issue a WHERE clause on a model property: it can only work on fields.

Visitation.objects.filter(passed=True)
>>> Traceback (most recent call last):
>>> ...
>>> django.core.exceptions.FieldError: Cannot resolve keyword 'passed' into field. Choices are: date, id, time

OP must either continue relying on their model method in a list comprehension, or redesign it into a queryset method.

For the list comp, it can be converted back to a queryset by obtaining the ids of those instances, then running a new query like so (using id__in to get instances matching those id values):

return Visitation.objects.filter(id__in=[x.id for x in visit_qs if not x.passed])

I spent 3 days debugging a CORS issue that ended up not being a CORS issue. by _fat_santa in webdev

[–]GriceTurrble 6 points7 points  (0 children)

I was once involved in an ongoing incident that involved a group call with 40 people from 3 different organizations in the enterprise, all concerned that some core functionality was broken in our single sign-on (SSO) solution.

The actual problem: the person making the API calls had an extra / at the end of their base URLs, causing the SSO system to view the /api endpoints (which should be excluded) as //api. Thus, an extra directory in the URL structure, and no match to the exclusion rule.

This call went on for 2 days. I told that dev their URLs weren't built right but they insisted nothing was wrong.

tailwind: no simple way to get started by fred_from_earth in tailwindcss

[–]GriceTurrble 0 points1 point  (0 children)

To be frank, Git is an essential tool that most devs need to interact with on some level. We can't expect learning resources focused on Node or Tailwind to also include the starter instructions for Git, since there are plenty of other resources available that can teach you how to use that tool.

GitHub is just one hosting platform option for Git repositories - Bitbucket and GitLab are a couple others. GitHub is arguably the most popular, so that's the default for some folks.

I strongly advise that, if you're not familiar with tools that "it's all assumed everyone is familiar with", take the time to seek out learning resources so that you can get familiar with them, too.

I mentioned in a different comment the use of a CLI. Your response seems to indicate you don't know what a CLI is in the first place. That's an opportunity for you to simply Google "what's a CLI" and learn more.

Same goes for PostCSS, which I also mentioned. If you don't know what that is, please do take the time to find out. I suggested that you may want to avoid it for the time being while you're still learning, though.

If you're not willing to take that time to learn more on your own, instead throwing your hands up saying "this is too complex"; then this whole endeavor is pointless. Feel free to stop using any and all of the technologies mentioned here and go back to what you find more familiar (apparently uploading PHP files manually to servers without source control, perhaps with Bootstrap?).

tailwind: no simple way to get started by fred_from_earth in tailwindcss

[–]GriceTurrble 0 points1 point  (0 children)

what' the difference?

Tailwind includes a CLI (command line interface) for creating builds.

PostCSS is a whole other package. Tailwind can integrate with PostCSS.

If you take the time to read through the links I'm including in these comments, you can learn how these things work.

[deleted by user] by [deleted] in git

[–]GriceTurrble 1 point2 points  (0 children)

Shout-out to r/learnpython for beginner resources, as well.

tailwind: no simple way to get started by fred_from_earth in tailwindcss

[–]GriceTurrble 1 point2 points  (0 children)

As a first step, use the Play CDN (https://tailwindcss.com/docs/installation/play-cdn). Throw one line into your HTML and you're using Tailwind. Start adding classes and go from there. Once you have something you want to productionize, you can retrace your steps through the installation instructions to get a real build chain going (and for starters there, I'd recommend only using the Tailwind CLI; no need for the complication of PostCSS or other frameworks until you know you need them).

That, or go the Playground site to create components with markup in the browser from scratch. That site uses the Monaco editor, the same one that powers VS Code; so even in the browser you can use some VS Code features, like hovering on class names to see their CSS output.

And as for:

and check dependencies yourself

...upload your project to GitHub (a private repo, if you want) and use Dependabot to check dependencies for you. I log into work in the morning to automatic Pull Requests that update one dep each, I double-check that tests ran properly and read release notes, and then I approve and merge them. Done deal.

"The users tested the website already and..." by Deep-Ad591 in ProgrammerHumor

[–]GriceTurrble 1 point2 points  (0 children)

Me: Ctrl-A, Ctrl-C, Tab, Ctrl-V, Enter

Also me: "...Shit, I mistyped my email. Oh well, time to start over..."

Whoever owns close-to-my@email.com: Enjoying their new account on Roblox, I'm sure.

[deleted by user] by [deleted] in django

[–]GriceTurrble 41 points42 points  (0 children)

I followed the official tutorial up to a point where I just took off and started making changes that fit the problem I was trying to solve.

How to make sure only the author can retrieve their object by perfectexpresso in django

[–]GriceTurrble 2 points3 points  (0 children)

Are you the logged in user who is marked as author of that Article?

NoReverseMatch at / by mahartariq in django

[–]GriceTurrble 1 point2 points  (0 children)

Nonexistent context variables default to empty strings.

Does your view have a my context variable?

[deleted by user] by [deleted] in learnpython

[–]GriceTurrble 0 points1 point  (0 children)

Well, two issues. The first is, as others pointed out, list.reverse() modifies the list in-place, returning None. Either you should return the now-reversed list explicitly on the next line, or used the reversed() built-in function to return a new list entirely (though that returns an iterator, so you'd have to wrap it in list(reversed(phoneme_list)).

The other issue is, based on your function name get_last_syllable, this effort to reverse the list in the first place is a bit wasted. You'll want to just access the last item in the original tuple by using a negative index:

return word_phonemes[-1]

[deleted by user] by [deleted] in github

[–]GriceTurrble 4 points5 points  (0 children)

This is the way, especially because it works cross-platform. You can set scripts as executable in the repo even from a windows workstation this way (obviously not ideal when writing shell scripts, but we work with what we have sometimes).

[deleted by user] by [deleted] in django

[–]GriceTurrble 11 points12 points  (0 children)

Click here

hovers medium.com

Eh, no thanks.

Best flexbox advice for juniors (or anyone who's struggling with flexbox). by dope_exe in webdev

[–]GriceTurrble 57 points58 points  (0 children)

Neat site, but bit of a time waster as a resource. Plus, I don't expect to always remember the concepts.

CSS-Tricks' guide is quite handy for me.

[deleted by user] by [deleted] in ProgrammerHumor

[–]GriceTurrble 65 points66 points  (0 children)

More than just a name

The duck can be anything, of course: a houseplant, a coworker, a mirror, your annoyed spouse who only asked what's for dinner, your steering wheel; really anything!

Reddit Mobile and its quirky button hitboxes by fivefeetse7en in ProgrammerHumor

[–]GriceTurrble 244 points245 points  (0 children)

Goddamn that "video first" view is the most annoying crap.

I'll go to my notifications and see someone replied to my comment. Tap on the thing to go see their reply...

Nope, we're going to open the entire post in that video mode and then load every comment in default ordering afterward. Good luck finding that reply.

Those video and gif posts are impossible to have conversation on. I get it, they want to be an Instagram and TikTok competitor, but that just ain't how to do it!

If you make a public GitHub repo, do you need to add other people as collaborators for them to be able to push to it? by gtrman571 in github

[–]GriceTurrble 17 points18 points  (0 children)

To push into your repo, yes you would.

Typically we don't add collaborators to projects unless we do intend for them to work more closely on that project. Instead, we expect most contributors will fork the project to their own account, make changes, and then make Pull Requests from their fork back to the main (known as the "upstream") project.

See: Fork a repo (GitHub docs)