Skip to content

Instantly share code, notes, and snippets.

@brylie
Created January 6, 2024 11:34
Show Gist options
  • Save brylie/94c55d3d034916b34025e321a4bcd5ac to your computer and use it in GitHub Desktop.
Save brylie/94c55d3d034916b34025e321a4bcd5ac to your computer and use it in GitHub Desktop.
Code with Brylie - e44
(...) Hello and welcome to another Python, our open source live code hangout.(...) I'm working on some changes to the community stream here.
(...)
All right,(...) let's see, it should show up below the stream chat. So we're gonna continue working on the pull request in progress.
(...)
Where we are adding user assignments to homes.
(...)
It's a fairly large pull request,(...) 400 lines.
(...)
We've completed two parts of it, I should actually convert this to a checklist.
(...)
So we can get my square brackets. (keyboard clicking) All right,(...) and.
(...)
So we allow users to be assigned to one or more homes.
(...)
The homes page will list only the homes which a regular user has been assigned.
(...)
The super user can see all homes. So we had to write some unit tests for both of those cases.(...) Users attempting to access a home profile without proper assignment will encounter a 403 error not authorized.
(...)
So this is where we left off.
(...)
So I think we're gonna have to look at the home view.
(...)
Let's take a look at how this is defined. The home detail view.
(...)
Yes, and essentially it's a model view and it'll return an instance of a home.
(...)
However,(...) we're enriching the
(...)
(keyboard clicking) just trying to see what's going on here in the get object. This is where we would fetch the context object.(...) I'm not sure we need to use (keyboard clicking) a model detail view if we're just going to, I mean we could be using just a bespoke class based view here.
(...)
(keyboard clicking) (keyboard clicking)
(...)
I think that's actually
(...)
what I'll do. This code I wrote I think a long time ago.
(...)
I don't have a get blame to see when I wrote this.
(...)
(keyboard clicking) (soft music)
(...)
(keyboard clicking)
(...)
It's a fairly complicated view, but let's look at it. (keyboard clicking)
(...)
(soft music) (keyboard clicking) So if we go to the homes list, we'll see multiple homes. I'm a super user here. We've got a group with two homes in there and then some homes without a group.
(...)
I'll just go ahead and view this home. And what essentially we're doing here is preparing some chart data
(...)
relating to work and some activities, maybe a little both actually here. (keyboard clicking) (soft music)
(...)
Yeah, and we have the chart data wrapped in functions that are in our charts.
(...)
(soft music)
(...)
All right, so I'm just getting my bearings straight.
(...)
So one thing I would like to do (soft music)
(...)
is just check we have a, this view has a request attached to it. (soft music)
(...)
I think in the get context to data,
(...)
we can return 404 here.
(...)
Let me check with chat GPT.
(...)
(keyboard clicking)
(...)
(soft music) Yeah, I believe this query set is just going to be referring to home objects.
(...)
And then we're now objects all basically and then we're now filtering it by the actual
(...)
keyword argument, this UUID field basically.
(...)
Because when I view a home,
(...)
we're not using the internal primary key. We've got this short UUID.
(...)
(keyboard clicking) (soft music) So where would be the most idiomatic?
(...)
(keyboard clicking) (soft music)
(...)
(keyboard clicking)
(...)
So we're going to jingle model view,(...) model detail view.
(...)
Now I want to know where the most idiomatic place would be to perform a user authorization check.
(...)
This should be authenticated.
(...)
So that's an easy one, I believe to add.
(...)
And perform a 403, not authorized. The most idiomatic place to perform a user authorization check in a detail view is to override the git query set up. Okay, here you can apply the authorization logic and raise a permission denied exception if the check fails.
(...)
This exception automatically raises a 403 forbidden response.
(...)
Now we're also overriding the git object, which might be a little bit earlier in the call path, call chain, but we do have...
(...)
(soft music)
(...)
(keyboard clicking) (soft music)
(...)
So these are bespoke methods, so to speak.(...) I'm kind of tempted to move them out of the class
(...)
just to keep it more clear what's jangle and what's not. (keyboard clicking)
(...)
And since I'm already overriding the git object and git context data,
(...)
maybe we can do it there.
(...)
So the git object methods use retrieve the object that the view will display, just as in the git query set method.
(...)
This method is more suitable if your authorization logic is specifically tied to the object being retrieved, which it is.
(...)
Yeah.
(...)
And I can add a method on the home.
(...)
(soft music) So here we have the object, the home object here.
(...)
(soft music) And...
(...)
(soft music)
(...)
I just wanna kind of be explicit about that. (soft music) So if we come over here to the home model.
(...)
(soft music)
(...)
So now, line... (soft music)
(...)
(soft music)
(...)
(soft music) I can use this members. (soft music) And I'll put that kind of close.
(...)
(soft music) Oh,(...) yeah, that was good.
(...)
(soft music) Wow, it's really on top of it. So it returns true if the user has access to this home.
(...)
And I will just document the criteria.
(...)
Super users have access to all homes, members of the home have access to the home.
(...)
Yeah, so return user super user or user in self members all.
(...)
(soft music)
(...)
Really cool.
(...)
All right, and...
(...)
(soft music) So here's what we need to do to test this, and I'll write a unit test.
(...)
(soft music) First manually.
(...)
(soft music) So we're at home zero if I go to admin. (soft music)
(...)
And I go to home user relations. I have a test user and they're a member of home zero and one.(...) So if I open an incognito window here and log in as the test user.
(...)
I'll never try to test the user.
(...)
There we go. And so I go to my homes page and it shows the correct homes here. So I can access these.
(...)
But if I want to try, so somehow I get an email or I was maybe transferred to a different care home or department or something like that.
(...)
So I'll go back just to double check. I don't have access to home two, but if I do that, then we get permission error.
(...)
Which is what we expect.
(...)
And if debug is false, that should.
(...)
(clears throat) (soft music)
(...)
Raise. Now one problem,(...) 404, we're presenting a 403 page, which we'll have to check if that exists. I need to take this out of debug mode. And another thing is I need to make sure the user is logged in. Otherwise, you might have some troubles trying to access the property. (soft music)
(...)
And how do we decorate the view with login required? (keyboard clicking)
(...)
I don't remember the syntax.(...) A couple of options. You said login required mixing. That's probably about right.
(...)
So I would prefer that.
(...)
Approach.
(...)
And then we will use it.
(...)
And we might as well.
(...)
Required here as well.
(...)
If we logged in in order to view the homes list.
(...)
A specific home.
(...)
But we allow anonymous access to the resident page.
(...)
For now, the reason being is so that family members can check on their loved one without having to have an account, which we would need to manage their login and that kind of stuff. It's sort of a,
(...)
there's not a lot of personally identifiable information on the page and sort of security through obscurity, but we might have to reassess that at a later point.
(...)
I think this is a good improvement.
(...)
So how can I, let me double check my environment.
(...)
Just debug his faults and see what happens.(...) So if I go to the settings,
(...)
core settings, whoops,(...) debug.
(...)
And just set this to false.
(...)
We've got hard coded to true. That is not a good idea.
(...)
And bring up this one. Now it's interesting, this debug page, I should see like,
(...)
make sure the server is running.
(...)
Ah, must set the settings allowed host of debug as well. All right, that makes sense. Default is my local computer.
(...)
I don't know if that'll work, but
(...)
oh yeah, default would be allowed hosts.
(...)
Interesting.
(...)
All right,(...) run the server.
(...)
As you're doing before the values in CSR trusted origins,
(...)
let's start with the scheme.(...) Scheme, scheme, scheme.(...) Oh man.
(...)
So that won't work.(...) Right now we're not really dealing with CSRF, so I'll just leave this one alone.
(...)
Otherwise I would have to do something funky. I don't really want to dance around that issue. Okay, so server error 500.
(...)
That's not exactly what I was hoping for.
(...)
Permission error.
(...)
(keyboard typing)
(...)
I'm gonna need to give them a little more information there.
(...)
403 forbidden.
(...)
Response, instead of causing a 500 internal server error when a permission check fails in Django, you should raise a permission denied exception. Yeah, and not a permission error.
(...)
That's a good point. Good, small distinction.
(...)
Oh, and that's essentially what it told me to do. I don't know how I got confused there. Perhaps I was getting the code from GPT. I'm not sure what happened.
(...)
(keyboard typing)
(...)
Yeah, GPT did generate this code. That is correct.
(...)
And that's a pretty explicit distinction there.
(...)
(keyboard typing)
(...)
(keyboard typing)
(...)
Permission denied.
(...)
Yeah, we'll try it again.(...) 403 forbidden, very good. Now it's created a nice 403 forbidden page.
(...)
(keyboard typing)
(...)
Just double checking.(...) Yeah, custom template for that will be the 403 HTML. So I'll put this in our base templates directory here.
(...)
403,(...) it'll extend base HTML.
(...)
And then we'll put the block.
(...)
Content.
(...)
Oops.(...) (keyboard typing) It will be this.
(...)
See how this looks.
(...)
And a little bit of space.
(...)
We need to translate everything.
(...)
And they don't need the error number. Probably don't need the error number. It's, most people don't.
(...)
Even know what that means, I'm sure.
(...)
(keyboard typing)
(...)
Now if we refresh.(...) Ah!
(...)
Server error this time.
(...)
Once this template is in place, Jangle will automatically use it for 403 responses triggered by permission denied exceptions.
(...)
Okay. Usually it involves setting up the dir's in your templates. You're setting this up high.
(...)
Let me just do this. One thing is I just created it. So if I stop server and I restart it. It's return 500.
(...)
Let me just do this and rename this and see if that was the change that broke it.
(...)
(keyboard typing)
(...)
So now I get a 403 forbidden.
(...)
(keyboard typing)
(...)
Hmm.
(...)
(keyboard typing)
(...)
Let me just try this. But I would imagine I can use, and I'm pretty sure I can use, (keyboard typing)
(...)
Standard Jangle template syntax.
(...)
Huh.
(...)
I guess not. Okay.
(...)
Well I know I can. But there's some configuration going on. (soft piano music)
(...)
(keyboard typing)
(...)
So let's see how we can use the Jangle template syntax.
(...)
Such as extending base HTML
(...)
in our 403 template. Yeah, the extents should work.
(...)
And we need to find a block. So let me just start.
(...)
I mean that's it. That's right there.
(...)
Block title.
(...)
(soft piano music)
(...)
Yeah, and then at the top.
(...)
Maybe I had something wrong with my extension tag. There it is, yeah. Let me just see what I did wrong here.
(...)
Probably...
(...)
(soft piano music)
(...)
(keyboard typing)
(...)
I know what it was.
(...)
It's just this translate tag.
(...)
(soft piano music) It's doing too much at once.
(...)
Access denied.
(...)
(keyboard typing)
(...)
Forbidden.
(...)
(soft piano music)
(...)
(keyboard typing)
(...)
You do not have permission to access this page. There we are.
(...)
Now we're good. They can recover.
(...)
And basically since I had disabled debug mode, there was an error that was arising. It was telling me I hadn't imported the load I18intag.
(...)
But it was being swallowed and it was just returning a 500 error. So it was a bit of a tricky to debug situation.
(...)
Because enabling debug mode then wouldn't have rendered the template, I think.
(...)
Let's see.
(...)
Debug.
(...)
Equals.
(...)
Let's grab it from there with a default.
(...)
This is setting me up a little bit. So I've got the environment.
(...)
I'll make sure we have an env file here.
(...)
Which I don't have.
(...)
This is a good way to trip up contributors but...
(...)
There we are.
(...)
So no, I was wrong. It's still showing me the if debug is true.(...) Let me just double check this.
(...)
I think part of it is I need to reload. Then...
(...)
For example, if I remove this...
(...)
I get a 500 error.
(...)
Alright, so there we go. So it's not picking up the env file.
(...)
I think it needs to be Django debug.
(...)
Let me see what that...
(...)
Yeah, alright.
(...)
Now we're good to go. We should still have this...
(...)
Maybe I gotta...
(...)
I don't know, man. I don't know.
(...)
[typing]
(...)
Not sure why that's not working exactly.
(...)
We'll leave the default at true.
(...)
We're not anywhere close to production right now.
(...)
But I will need to change that and figure out why my env file isn't working. It's in the same...
(...)
Level as manage.py.
(...)
But it's not the main problem right now. So let's commit what we've got.
(...)
Pretty much a lot of hosts.
(...)
We had a model method.
(...)
And a view.
(...)
[typing]
(...)
And with those few changes...
(...)
And unit tests, unit tests...
(...)
We're really getting in the habit of this.
(...)
So now...
(...)
The home detail view... [typing]
(...)
Should have some tests available already.
(...)
Hey, ZJ, welcome. How are you doing? Hydrate! Okay, let's do that.(...) Let me top up though real quick.
(...)
Nice. I'll be right back when I top up.
(...)
[silence](...) Ah, okay, cool beans. Yeah, I don't want to over hydrate because I'm going to be having trouble sleeping.(...) Yeah, I took your advice and I've started setting up these little perks. I'm not really sure how the channel points work.
(...)
If you've got any names for the channel points, programmer points is kind of probably boring. I was wondering... I was thinking about calling them cookies.
(...)
Sort of a pun.
(...)
Because cookies are on web browsers. But it's probably not a very good one.
(...)
And then I don't know how fast they accumulate or what the value of them are. So I don't know how much I should...
(...)
[silence] What?(...) $2000? Oh my gosh.
(...)
[laughs](...) Okay, that's crazy.
(...)
[laughs] How do you even get...
(...)
Alright, nice.
(...)
That's already half of the cowboy mustache budget.
(...)
[laughs] I should have priced it higher I guess. Okay, nice.
(...)
How's your day going?
(...)
One per minute. Okay.
(...)
Dang. That's a lot of minutes. Wow, thanks. That's really cool.
(...)
Hmm, let's see what we've got. So yeah, I need a unit test. This one.(...) Do I have...
(...)
I've got the list view test, but I don't have any of the home view tests.
(...)
I suppose because we... Hmm.
(...)
I've been, I guess, lazy. I've been lazy about it.
(...)
So let's add one. One minute.
(...)
One point per minute. How's your day going?(...) You looking forward to the weekend? Did you get through the legal stuff? Did I get you back there behind you? [music]
(...)
Ah.
(...)
For an activity check.
(...)
That's cool.
(...)
Right. So the rate is determined by the subscriber.(...) Okay, yeah, and I haven't been watching how other channels use them.(...) But I'll, you know, get to know all this stuff. Trying it out. It's fun. It's really cool though.
(...)
Ah,(...) nice. 1.2 multiplier. Very cool. [music] Yeah, cool. Thanks.
(...)
I was like, what could I... What could I do? What's... I don't know. I was just thinking. And to some reason Burt Reynolds came to my mind.
(...)
He has a good mustache. Good 80s mustache. I don't know if I can get a Burt Reynolds mustache.
(...)
That's one. Let's see if I can grow one of those.(...) [laughs]
(...)
All right, so it looks like we just need to add tests for this view. It's just not been tested.
(...)
And where does it show up? I don't know if I can put the little cowboy mustache thing on my...
(...)
Like a chat overlay.
(...)
Or if it's like below the chat or something.
(...)
I haven't... This is just set it up like right before the stream. In fact, I was a little bit late hopping on the stream because I was getting the emoji set up.
(...)
Okay, cool. Yeah, I'll look for like some kind of browser overlay I can add to OBS.
(...)
I don't want to get too cluttered, but I think there's room for it.(...) But this animated background is making my...
(...)
VOD size really huge. Or when I export the movie to do a little bit of editing and then post to YouTube. It's like massive.
(...)
I did a... Well, I did a six hour stream yesterday and it was like 16 gigabytes. But for comparison, I guess it should have been about half of that.
(...)
I think it's just because this high definition animated background is causing a lot of information to be displayed. It's not able to kind of optimize for that. Whereas these areas with static colors,(...) the video compression algorithm can kind of optimize those big static areas.
(...)
Pretty good. All right, so I need to import this view.
(...)
You got anything you're looking forward to on the weekend? Just relaxing.
(...)
Models.
(...)
So essentially, local context... Local imports should go a little bit down here just to kind of get my imports sorted.
(...)
And then the views comes after models alphabetically.
(...)
Let's see if GPT thinks of something.
(...)
Views import.
(...)
Gaming, yeah.
(...)
That's cool. And I think we've talked about a couple of these games. I almost bought DayZ the other day. I learned that DayZ will run on Linux.
(...)
ProtonDB has a gold rating.
(...)
I've played a lot of these shooter games and I'm interested in survival and tactical shooter games.
(...)
I haven't really been wanting to play like Squad.(...) I think I mentioned that one or ARMA 3 or DayZ. But I made it mainly to kind of team up with people and hang out. And not so much of the adrenaline, twitch, fire shooting action.
(...)
It would need to run on Linux and not be a massive thing. So I don't know, there's many options. DayZ does at least a base game, maybe not the mods.(...) There was something about needing to flip some configuration thing.(...) And it was on offer, but anyway, I don't know.
(...)
Okay,(...) so given our home detail view now, checks for the permission denied.
(...)
Let's just ask GPT to help us with this test.
(...)
[typing]
(...)
HomeFactory.
(...)
Do we have an account factory? Do we need one? We don't need an account factory probably.
(...)
What was the name of, I think it was HomeUser.
(...)
Out in my factories. RelationFactory.
(...)
Mmm.
(...)
Let's just keep it the whole thing.
(...)
Squad, yep. Oh yeah, cool, no worries.
(...)
Life is busy.
(...)
I'll be in and out of chat as well. My focus is going to be kind of hopping back and forth between this issue.
(...)
[typing] [piano music]
(...)
This is looking good. Yeah, and I like these tests because they're really granular.(...) It's just testing the one thing, each one. I think the tests I was working on in this PR yesterday, with the help of GPT, they were like mega function tests, and I'd like to actually ask GPT to help me refactor those a little bit.
(...)
Just that they're easier to grok and maintain for the humans among us.
(...)
This is a good test, sweet. Yes.
(...)
We will try it out. [typing]
(...)
So far, human developers,(...) not obsolete.
(...)
We must assert our relevancy.
(...)
All right, then does this little pasting thing always, always?
(...)
It's kind of a long test suite. Let me make sure everybody's indented.(...) [typing] I guess so.
(...)
And we'll run the tests. I'm just going to run that test.
(...)
Oops, that was it. Darn it.
(...)
And,(...) doggone it. [typing]
(...)
There is something wrong.
(...)
Oh, yeah.(...) [typing] Indeed.
(...)
[typing] [typing] [typing] [typing] [typing]
(...)
[typing]
(...)
Somehow, I've already broken this.
(...)
There we go.
(...)
So, tests will still pass.(...) We'll run and pass.
(...)
[typing] And then,(...) import our view, import our mode.
(...)
[typing]
(...)
Bring this over.
(...)
[typing]
(...)
Oh, okay, cool. You guys are just chilling. It's kind of nice to have some kind of voice in the background sometimes. Somebody doing some work. I do that with podcasts as well.
(...)
But I guess it's better to have a voice that is interactive. All right, so now we can run this detail view test.
(...)
[typing]
(...)
Let's see what we get. Now, these ones are very straightforward to read and debug. I believe we should have a good time here, but they're erroring out. So, two of them failed. No reverse match for home detail.
(...)
All right.
(...)
So, that's just the thing that the model doesn't know the name of our view, so it made an attempt.
(...)
And I'm going to move this URL up.
(...)
[typing] [typing]
(...)
Equals reverse home detail quarks. So, they're both sort of guessing that it's a home detail view. [typing] And, ah, the problem.
(...)
[typing]
(...)
Because I can't define this until I've created the home.(...) [typing]
(...)
Now I can get the URL UID.
(...)
And I'll just double-check our URL patterns.
(...)
Home detail view.
(...)
So then,(...) ah...
(...)
[typing] [typing] We can just use...
(...)
It's a bit scrunched. It's a bit...
(...)
[typing] [typing]
(...)
Since the URL doesn't change to it. [typing]
(...)
Makes sense to reuse it. [typing] Good.
(...)
Status code. And then the other touch.
(...)
I like to use HTTP.
(...)
[typing]
(...)
.forbidden.
(...)
That way it's a little bit more explicit.
(...)
I don't have to do the mental mapping. What does 403 mean again? It's kind of, you know, reflexive by now, but...(...) you know, naming things.
(...)
[typing] I think it's accepted or okay, one of the two.
(...)
That varies depending on the library.
(...)
[typing]
(...)
Okay, one. Oh, it is there. There it is. Yeah, okay.
(...)
That's actually what we're looking for.
(...)
[typing] [typing] [typing]
(...)
Yeah, one time I bought Squad for like a brief moment and I just tried it on Linux and...
(...)
I sort of like walked 10 meters and then the whole thing bugged out on me.(...) [laughs] That was like a null space almost. It was real disappointing. So I just got a refund real quick on that one.
(...)
But, yeah, it looks cool. Squad, you have to be dedicated, it looks like, to play that game. You've got to kind of... it's not action-packed.
(...)
It looks great. Yeah, the graphics and the gameplay look really cool. I like the fact that, you know, you have roles and hierarchy and you're following more experienced players. Squad leaders have different levels of visibility and communication layers.(...) I like all the vehicles. That's one really cool aspect of it.
(...)
I'd probably be a medic.
(...)
Yeah, I wouldn't dare starting out, of course, be a squad leader. I wouldn't know what the heck is going on. But I think a medic I can kind of grasp and play my role there.
(...)
All right, so we've got some passing tests and I actually didn't need to import the view because we're using the reverse URL. So that makes sense. Let's go ahead and commit this and I'll see if I can get a little bit of help refactoring these sort of mega function tests.
(...)
Maybe that wasn't as bad as I was thinking, but I think it was.
(...)
Yeah, this where I'm doing a lot of iteration and validation is a lot of assertions.(...) If you've got like five, ten assertions in a test,(...) I don't know.
(...)
It seems like the test is probably doing too much, but... Maybe not. Maybe it's just the way it needs to be. As long as it's testing all the right things. But that's the problem is it's hard to tell if it's testing all the right things. It's too much to keep in memory in mind.
(...)
Hmm.
(...)
Properly assigned users will have full access to the home profile, including the ability to create activities for the residents of the home. This is a tricky one.
(...)
This implies quite a lot actually, surprisingly.
(...)
Because it implies the inverse in a way that you can't record activities for residents of homes you're not a member of.
(...)
Which would mean I would need to filter out the resident choice list.
(...)
I'll have to cross this bridge eventually.
(...)
And one possible approach is to add a modal dialogue here on the homepage, which I've been thinking about doing instead of this global one.
(...)
Which essentially this global one is just a page and it lists all the residents now grouped by home and sorted alphabetically. This list is going to grow potentially to thousands of people. So this is really just a temporary solution in any case. However,(...) there are certain people in the care network that have insight or oversight or influence in many of the residents. So they would actually potentially need to select from all the Josephs or Christophers,(...) which is Christianity and Christophers.(...) But what I can do is just step in the direction as part of this pull request.
(...)
I'm not getting it too big, though I'm the only contributor.
(...)
Is filter this modal filter this resident select list by fetching all of the homes that requesting user is a member of or if there are super users every resident.(...) But there are super users who fetch all the homes fetch all the home residents.
(...)
Residency is tricky group.
(...)
Yeah, I'll take a quick quick break. Think about this for a moment.
(...)
My hydration is the cycle is completing itself. So I'll be right back.
(...)
Yes, I need to add the music on the yeah, I got this. I had to go water the fishes. I need that the music on the loading page the pause menu.
(...)
All right, this one I can do. I'm gonna do this too. This is gonna be a tricky one.
(...)
But I think I have a helper function for it already.
(...)
I'm gonna group the residents by homes.(...) These are actually residencies.(...) And so it's a bit abstract in my mind right now. But let's make this happen.
(...)
Then we'll have one activity submit form, it can be a modal dialogue, it doesn't matter. The list is populated based on the homes users the member of or everybody for the user. So let's take a look at how this is generated.(...) Since its own view, so if I go to the activities views,(...) and it might just be a matter of passing two query sets,(...) or modifying the query set that gets passed to the form, which is the ideal solution ideal situation from my perspective, I don't have to think about it, we've already thought about it.
(...)
And that's where they should be.(...) Here we go, get resident choices.
(...)
Yeah, this will be good. Get ready for it. Now the problem though,(...) in the view,(...) and sorry in the form, I don't have access to the request user.
(...)
Maybe.(...) Yes, nothing comes in here.(...) I'm just getting the residency. So there's the first problem.
(...)
Dang it.
(...)
But...
(...)
So the first thing to do then.
(...)
So determine how to pass in these choices to the form.
(...)
The form doesn't to my knowledge have access to the request.
(...)
So let's give chat GPT some context here. It has surprisingly deep in nuance to knowledge of the Django web framework.
(...)
The Django form view, but at this point it's got the context.
(...)
That renders a model form.
(...)
Now this is just a...
(...)
Based on the request user.
(...)
So they can choose from only from choices.
(...)
They're allowed to view now. I could also just question whether or not this is an important thing to do.
(...)
From a privacy perspective with GDPR we have the few principles or guidelines and one of them is data minimization. What is GDPR guidelines?
(...)
I think that means collect only the data you need, but I think it also means to only share the data you need with the particular people who need it.
(...)
So if I can get a GDPR TLDR.
(...)
So the point is,(...) I'm a dummy.(...) I need that dummies version of it.
(...)
We need to put banners on everything. That's the main thing. That's what GDPRs did.(...) Granddaddy banner regulation.
(...)
Okay.
(...)
So my form choices.
(...)
Let me read this. Let me read this. To prepare the choices for the multiple choice field and Django form view based on the request user, he needs to override the gift form. Quarghs method.
(...)
Interesting.
(...)
What?(...) What?
(...)
Oh, yeah.
(...)
Nice. I knew there would be a way in Django.(...) It just is so well designed and evolved. Of course, it didn't all come at once.
(...)
I forgot to change my episode number.
(...)
I think so.
(...)
I don't know if we can have emojis in our episode titles on Twitch.
(...)
Form quarghs. There we go. Let's do this.
(...)
So after I init,(...) that's the form. I'm going to do the form view.
(...)
What the people are bobbly.
(...)
Super.
(...)
Get the quarghs.
(...)
Add a quargh.(...) Return the quarghs.
(...)
Also known as quargh.
(...)
Now I've got the user.
(...)
In my form, init, I can do the thing.
(...)
I have to pop it.
(...)
And it's actually the user object.(...) Wow.
(...)
You could technically just pass the whole request in there.
(...)
This means...
(...)
I can check up the user. Super user.
(...)
I should add that authenticated mix in here. You shouldn't be able to view this.
(...)
This form view without being signed in. I think that's a simple fix.
(...)
What was it again?
(...)
Login required mix in.
(...)
Oh my goodness.
(...)
What bandai pras.
(...)
And for some reason it doesn't get the imports right for some of these.
(...)
Django, conjrib.
(...)
It's not sorting my imports.
(...)
Maybe that was correct. No, I don't think it was.
(...)
Alright.
(...)
So I've passed it in.
(...)
I've passed in the data, the user, to the form.
(...)
And we should be guaranteed to have a user because I just required login.
(...)
Now what I'll do...
(...)
I'll abstract this into the getResidentChoices method.
(...)
Here's the tricky part.
(...)
We'll define this function here.
(...)
It'll do the thing that it was doing before.
(...)
Just slightly abstracted.
(...)
Oh, that was correct.
(...)
Django DB import queries.
(...)
Now transect.
(...)
Django DB or Django models?
(...)
Django DB models import queries.
(...)
Nice. Here we go. Now we're getting there. So it returns a tuple. A list of tuple integer string combinations.
(...)
And what I would like to do is not overthink this, but I don't like these primitive returns.
(...)
So I'm not sure how to really phrase this, but I'm going to see if I can do a small refactor without getting too far aside.
(...)
(keyboard clicking) (soft piano music)
(...)
Part of it is because this is kind of incomprehensible.
(...)
And essentially I would like to make it clear by having an explicit return.
(...)
What does this resident choices reflect, right?
(...)
They're grouped.
(...)
It's resident by home.
(...)
They're grouped by home, yeah.
(...)
(soft piano music) So part of this being explicit is to make it easier to understand. So we've got a dictionary, and we create a key for each home, each home name.
(...)
(soft piano music)
(...)
And we split it out. That's the tricky part.
(...)
(soft piano music)
(...)
(soft piano music)
(...)
So technically this should be resident by home, right? So let me just do this.
(...)
And...
(...)
(soft piano music)
(...)
(keyboard clicking)
(...)
It's grouped by...
(...)
(soft piano music)
(...)
Query set of residency.
(...)
And this will return a dictionary.
(...)
Where each...
(...)
(soft piano music) Yeah, this one I don't like this primitive. I want to say, what is this returning here?
(...)
(soft piano music)
(...)
But at least we're getting into more fathomable. Fathomable.
(...)
(soft piano music) Territory.
(...)
(soft piano music)
(...)
(soft piano music)
(...)
Okay.
(...)
We'll go with it.
(...)
(keyboard clicking)
(...)
(soft piano music) And so basically that should have just...
(...)
Once it stepped back. (keyboard clicking)
(...)
(soft piano music) Right.
(...)
So I'm getting ahead of myself a little bit with this refactor.(...) We're going to be good though.
(...)
(soft piano music)
(...)
(soft piano music)
(...)
It just seems like here.(...) However...
(...)
(soft piano music)
(...)
Oh, we're good. Alright.(...) (soft piano music)
(...)
Wait.
(...)
This is the one.
(...)
Base init. Got an unexpected queue.(...) Alright, so I just need to pay real close attention to the form initialization function.
(...)
(keyboard clicking)
(...)
(soft piano music) Well, it should know where that is. And I don't really understand why my language server doesn't know where these are. From Django Contraboth import, user model except...
(...)
I'll get user model.
(...)
So now we can refresh it.
(...)
We're good to go.
(...)
So it seems like the behavior hasn't changed yet. We're just kind of moving stuff around.
(...)
Maybe needlessly, but I believe it helps my brain to just parse smaller functions that kind of do us like a more or less single thing, what they say on the tin.
(...)
(soft piano music)
(...)
(soft piano music)
(...)
So part of the preparing resident, there's a sub-step to group the residents by home.(...) Yeah, so it's good abstraction there. I didn't have to see all this. But if I want to know, okay, how did I get that grouping? Okay, what's going on there? It's a bit more complicated.
(...)
But unto itself, you know, it's a little easier to grok this function.
(...)
Although not, you know, it's not super simple.
(...)
(soft piano music)
(...)
(soft piano music) And sort of the reason I wanted to refactor this is so that I can just make the modification at the one level of abstraction that's essentially going to change the query set. Somehow I'm going to have to figure that out still, but where the query set will differ.(...) All right.(...) But at least I don't have to read through every level there of that kind of complicated
(...)
data processing pipelines until you hear what it is.
(...)
All right, so.
(...)
(soft piano music)
(...)
(soft piano music)
(...)
It essentially comes down to here. We're going to get the resident choices. However,(...) I'll have two branching conditionals. What I need to do is prepare a list of residencies for the user. If the user is a super user,
(...)
then boom, they get everything.
(...)
That makes sense. Else.
(...)
Huh.
(...)
We get the residencies where the home is in the user homes list. We'll double check if this method exists. And if not, it's a helper I can define.
(...)
A query set.(...) And the move out is null.(...) Wow, this is what I was really hoping that it would just be a matter of changing the query.
(...)
Query set, the query or whatever. However, there was a lot in the way. And so sort of needed to think about it, reorganize it a little bit.
(...)
So let's double check that the user model has a home. And I'm pretty sure we added that previously. And GBT already recalls that. But if not,
(...)
it should be fairly easy to add.
(...)
Yep, right here. So home model import home, home objects filter, home user relations, user self. Wow, this is crazy.
(...)
And we're.
(...)
There's probably a little bit of redundancy. I can probably.
(...)
This should work.
(...)
Because these queries are lazily evaluated. So I think I can just lost my whole thing. Where was I even?
(...)
I don't go back there.
(...)
I think I can still.
(...)
Tag the query set.
(...)
And then here.
(...)
Let's see if this will work. Actually, I just want to keep it there. Residencies, residencies, residencies.
(...)
It's implicit. I think the data type, you know, we don't say this is a.
(...)
House integer and a cat string.
(...)
So I don't need to pass go or something. Okay.
(...)
So this was a bit afraid of user is super user user is none here.
(...)
So that.
(...)
There's probably some way I can have two views of the same file open.
(...)
Also, you're really closely reading.
(...)
There's a redirect there.
(...)
Might be trying to redirect to the login view. So yeah, we'll come back to that one and then.
(...)
This will have to fix the test later, but let me just see.(...) Okay, so back down here where we're passing in the user to the form.
(...)
You are all pattern.
(...)
So in the form of you are you are eligible work backwards a little bit in the form in the init quarks pop. Yes, it should be just a quark. Arcs and quarks there.
(...)
I don't need to add an explicit.
(...)
User argument.
(...)
So that's one thing I did wrong here. I don't need this. It's just a member of quarks, but when I do that.
(...)
I refreshed the page.
(...)
Get another thing.
(...)
Face for me and it got an unexpected keyword argument user.
(...)
I'll just have to paste this one in there.
(...)
But I probably am not reading this close enough super. Oh, you know why.
(...)
I did it after.
(...)
Instead of before.
(...)
Yeah, really subtle.
(...)
I don't understand why but wow. I'm surprised I noticed that.
(...)
Crazy.
(...)
Nevermind GPT. Thank you.
(...)
Yeah, that's the solution before calling super.
(...)
And since I'm a super user super duper.
(...)
It's showing me everybody.
(...)
Now let's go to our incognito window.
(...)
Nito. Nito.
(...)
See if it works. Attic to me.
(...)
I should only see home zero and one.
(...)
Yes, it worked. I'm just gonna fix those tests. I'll need a quick break. Come at these changes. Craziness craziness.
(...)
Craziness craziness.
(...)
And then the viewers I need to tell my why are we doing this.
(...)
We'll push this let the whole CI run.
(...)
I'll run the test locally and fix those and I think that'll kind of be it for this. This poor request has been in the coinable large pull request.
(...)
Pretty interesting feature. I'm gonna close this window out and we'll wait for CIT to run. I'll just take a brief break and be right back.
(...)
Okay. Very cool. Now, still failing the test. So that's all right. At least we'll know which tests are failing. We'll zero in on those. I'll need to write this is not always the most exciting thing. I'll need to write unit tests though. Okay. So let's go to the test. So I'm gonna run this. I'm gonna run this. I'm gonna run this. I'm gonna run this. I'm gonna run this. I'm gonna run this. I'm gonna run this. I'm gonna run this. So for this home,(...) the resident chooser field to make sure that the choices are correct because this is one of the more critical things in terms of privacy as mentioned earlier.
(...)
I didn't even spell that. The right to be forgotten is one.(...) Anonymization, I believe.
(...)
Pretty close. Pretty close.(...) Close number GPT.(...) The key takeaways from the general data protection regulation can be summarized in the following short, succinct phrases.
(...)
Dang. There's a lot of them. I only know two of them.
(...)
Data minimization.
(...)
Collect only what is necessary.
(...)
Right to be forgotten.
(...)
Erase personal data upon request.
(...)
Anonymization.
(...)
De-identify people.(...) Data to protect people.
(...)
Consent requirements. Explicit permissions for data processing.(...) Data portability. Allow data transfer between services.(...) Allow data transfer. Yes, yes. So our data should be, we can export that.
(...)
Transparency. Clear information about data use.(...) Accountability. Organizations must be responsible for data handling. Data protection by design. Integrate data protection into system design. Protection impact assessments. Breach notification, lawfulness of processing children's data protection.
(...)
Data subject rights.
(...)
Cross-border data transfer regulation.
(...)
Data protection officers. Regular audits. International cooperation and penalties for non-compliance.
(...)
So I guess the principles here is the minimization.(...) Collecting only what is necessary.
(...)
But also...
(...)
Data protection by design. Integrate data protection into the system design. So essentially, we want to make sure that we're only getting the information to the people who have permission, who are authorized to view that data.
(...)
This is really good TLDR. I'm not sure I've seen one. Like, this is synced. I should post this somewhere.
(...)
Maybe I can post it on a blog post.
(...)
But not right now. Not right now. Come back to it.(...) So we do have our failures.
(...)
Not too bad. Two of them.
(...)
And I think this is because I added a redirect.
(...)
302 happening there.
(...)
On our metrics test. So when we're trying to...
(...)
We need to log in the client, essentially.
(...)
So do we have a user?
(...)
Because you can see we just allowed anonymous people to post data directly to the database. This is a prototype. So I'm not even making any claims.
(...)
We're rewriting this from scratch.(...) And I'm working my way up from the basic principles to bedrock into the more real... The meat of the system. And so now I'm adding authorization. And it's starting to matter that I have created a user, for example.
(...)
I started to fix this with dang copilot or remember it to my dang brain.
(...)
From Django contrib auth import get user model.
(...)
Okay. Now we'll have the setup function. Dang, there's a lot going on here. Yeah, so it's right here.
(...)
Self create user. That's right. That's right, you copilot.
(...)
Oh, I don't know. Test.
(...)
Password. Log in the user. So in order to make any of these requests, we have to be an authenticated user. We can potentially also authorize to submit activities for the particular forms. Dang.
(...)
This is good stuff.
(...)
So we're going to create a home.
(...)
Then we're just a regular user.
(...)
I'm not even sure that these...
(...)
We'll work the way...
(...)
The way it's specifying.
(...)
But let's see. So let's just run these tests.
(...)
For the metrics. See if we can even...
(...)
If we can get an error. Yeah, so we just have failures, no errors. So this is working.
(...)
So now the thing is we got homes and residents.
(...)
Create residency for each resident. Just give myself some hints. Create two residents.
(...)
We do that. Now I need the home user relationship.
(...)
Yes.
(...)
That should be good.
(...)
We will also want to create a user who is not associated with any home.
(...)
Home user.
(...)
I forget what we called it before.
(...)
Homeless user. We don't need that. User with home, user without home.
(...)
Us.
(...)
Whatever.
(...)
It's a bit tricky, isn't it?
(...)
We're just a general user at this point.
(...)
General tzau.
(...)
Does that work? Does that explain that? I don't know.
(...)
So the general user,(...) no permissions.
(...)
Home user, good. Super user, good. We'll create use cases for those three.
(...)
And then we can log in here. Self-client force log in, self-super user.
(...)
Error, error, error. No.
(...)
User name.
(...)
Oh, yeah, of course.
(...)
Fail.
(...)
But only one fail this time.
(...)
So we're going to actually roll back with blue. We just need to do the same thing, log in to super user.
(...)
To fix these tests, but we're going to add a couple more tests.
(...)
Log in to super user.
(...)
Force log in.
(...)
Fix failing tests.
(...)
Yeah.
(...)
So that worked.
(...)
So we're going to add a couple of tests.
(...)
If I should create a new test suite.
(...)
Essentially, when I check the context, the form, this is a tricky one.
(...)
Let's see if we can just get a general high level response.
(...)
To test the resident activity form view to ensure users only see resident names they are authorized to view, you should create tests that simulate different user scenarios.(...) These scenarios typically include a user who has authorization to view certain residents, a user who doesn't have authorization, and possibly a super user who might have access to all the residents. Here's a general approach that's what I was hoping for, and it gave a little bit of code is working on that too.(...) We've got to set up the environment, so our setup function, create the test data in our setup function.
(...)
We can use a separate test suite for this perhaps, and group them together a little bit. Write the test case. Test for authorized user. Ensure that an authorized user can see the resident names they are supposed to, so the ones they're associated with via home user relationship, user home,(...) whichever it was.
(...)
Test for unauthorized user, so they shouldn't see, they should actually get a redirect,
(...)
or huh.
(...)
If they're not associated with any homes, but they managed to get a user account,(...) it
(...)
And then I can do for that is add another method on the user model.
(...)
I need to get my test coverage plugin set up so it shows me what's not covered because I'm losing track of the things I'm adding. But on the user, I can say we have this helper homes.
(...)
I'll add a property.
(...)
Whoops, darn it.
(...)
Can add activities is essentially what I'm after.
(...)
Is home users getting close there?
(...)
Cool.
(...)
So that's a good helper.
(...)
Then I can use that in the template.
(...)
This is why I like having a lot of logic in the models. It makes sense. And you can access the related data and stuff like that really easily.
(...)
And then you can split things out into refactoring into module level helper methods.
(...)
Probably I should have specified that those are internal, but nonetheless,(...) I'll just show you the idea here. So now, for example, in our base template,(...) we have a navigation menu actually.
(...)
And this needs to be translated.
(...)
Shoot, it won't let me do that. It's a label needs to be translated. I think it's because the double quotes.
(...)
So I need to use single quotes.
(...)
There's that.
(...)
And yes, I add unrelated commits. I try to clean things up as I go, even changing formatting and stuff. It's been a bit contentious at work sometimes.
(...)
There's a threshold at which a certain amount of formatting can go into a pull request and be reasonable from the reviewer standpoint. And at some point, you just have to separate the formatting from the work.(...) But what I'm trying to do here is get these buttons. So we've got login, logouts.
(...)
And then we've got the button. So we've got this button here for adding work. It triggers the modal dialog and the modal body is displayed here.
(...)
That is the modal.
(...)
Where was my button? I scanned past it.
(...)
Work report add activity here. So essentially, this nav item should only display if user can.
(...)
User.(...) I think it's a request user.
(...)
Can add activity right? Is that the one?
(...)
Tag nav it. Where did I put it?
(...)
Yeah.
(...)
If they can add an activity,(...) I think it roughly speaking should be the same for work. But we don't have the same permission system set up for the work. We're sort of developing two apps in parallel, converging them.
(...)
Where the work app was a hypothesis, every app is a hypothesis we wanted to test.
(...)
So we've had much more concrete results in testing this caregiving app.
(...)
Feedback and we've co-developed it with institutional care providers and things. We have a pretty good idea. This is a useful tool and I'm just in the process of putting it over to Python.
(...)
Okay, a new incognito window apparently.
(...)
So somehow somebody gets an account.
(...)
So firstly, they don't see anything.(...) Then I can log in.
(...)
But I don't see that button. So that was essentially it. I only see the add work button. This is a thing I'll have to do later. And on the homes page, it's empty, right? And if I wanted to add an activity as the user who can't. There it is. I can do it, but I can't see anybody. So that's the other thing now I can do is actually return 403 on this page fairly easily.
(...)
I can hide it when I can't do it. And somehow if they get to the add activity page, they bookmarked it or something like that. This is these are rare contingencies if at all. Something I need to worry about.
(...)
That's interesting. Never heard of that. But okay. Wow. That was elaborate.
(...)
This is my incognito window.
(...)
And it did what it said on the tin.(...) Man, that is really impressive.
(...)
It used my bespoke property on the user model and it used some internal Django logic. And then the form should render for users who can do it. So it's just decent.
(...)
And this is all just baked into the Django framework. It's well documented. It's been built into a lot of open source projects. And then hence the large language models have trained on it. And this is why the developer experience, even without the large language model, is fairly impressive. But with large language model, it's just kind of mind blowing at times.
(...)
Because this isn't shifting sands all the time. This stuff is kind of stable.
(...)
Pretty stable. You know, relatively speaking. Okay.
(...)
This pull request is sort of running away with me, though.
(...)
Getting close to 700 lines.
(...)
Another couple of hours into the session today.
(...)
But these tests are really important.
(...)
And in particular, I want to make sure we've baked in the GDPR principles.
(...)
I'm wondering if I should just put those in our read me or something.
(...)
Heck, where did they go?
(...)
There we are.
(...)
Just so I can remember them and come back later and figure out what to do with them.
(...)
It doesn't quite belong in the read me or the contributing guide. I don't know what to do with this. But what I can do, some of these do.
(...)
So I just want some guidelines in our contributing guide.
(...)
Cross border data transfer regulation. We're not really able to control that as an open source project. We don't know where and how this will be deployed.(...) We've got an organization who's deploying it. Then we could,(...) it would make sense to look at that. Hey,(...) buenos noches.(...) Welcome. Pretty good. How are you doing today?
(...)
Help in getting some help from a chat, GPT relating to data, anonymization and privacy concerns.
(...)
But it didn't quite.
(...)
Okay.
(...)
So let's see.
(...)
Well, maybe this is actually pretty good.
(...)
How are my prompting skills? Yeah, they're improving. Do you have any recipes or formulas or what are your kind of techniques you use?
(...)
A lot of times I'm doing like iterative prompts where I'll sort of work at a high level of detail, like get the big picture and then kind of zero in on this individual steps in a sequence. Like when I'm writing unit tests, for example, I'll be like, what are the test cases we should write? Okay, let's write test case A or B.
(...)
Now we'll get a better result from the unit tests perspective. Well, let's go ahead and add this GPR thing to our read me or contributing, I suppose.
(...)
And it's just a reminder to myself, but anybody else, what we're aspiring towards.
(...)
And what to consider when adding new features.
(...)
I suppose it can just go with sort of the end. I don't mean to just shove it down there, but
(...)
I just want to put it somewhere. This is really interesting.
(...)
And then we'll need to update the table of contents. So it's there. It'll be here and we can jump to it.
(...)
Do you use mainly like chat GPT or what kind of what kind of generative AI have you tried out? I've done mid journey chat GPT. I tried I've tried barred a couple of times decent. I haven't tried the new one from Google was the one that they released recently.(...) But I've also tried anthropic and basically this search engine CAGI. I don't know how you say it.(...) They have a chat agent that's built into their service and you can select between multiple language model back ends. See if I can log in there real quick. One second. Let me just do that off screen and I'll show you what I'm talking about there. Maybe you've seen it, but it's really good search engine.
(...)
One moment.
(...)
There we go.
(...)
So you have this CAGI search CAGI search. I don't know. I figure I'll say that but it's almost as good if not getting better than Google. Somehow the Google search results have been getting like deteriorating for me, especially with sponsored results taking up the everything above the fold even to scroll down. This one doesn't have a sponsor results. You pay a subscription fee, but it's got the CAGI assistant and you can upload documents and images and it's got several variants.(...) But for example, if I open the chat Jango Python just to get there, you get to select from multiple back ends.
(...)
And this is the first place I was able to try out the anthropic Claude.
(...)
I've been wanting to do that, but it was somehow not available in European Union, probably due to privacy regulations. It was available in UK though.
(...)
And then Google.
(...)
Yeah, it's paid.
(...)
But we pay regardless if we have the capability, if it's budgetable to pay for some services. I think it's worth it to not pay for those services with our like privacy and personal data type of stuff.
(...)
It's a bit tricky though. Yeah, because like Facebook is free, but then well, then you become a big advertising data point and they track and stock you.
(...)
I think that's not as concrete as paying.
(...)
I think they're asking for now 20 a month Facebook to not be stalked on the internet by Facebook. But yeah, I get what you're saying is all these subscriptions, they add up for sure.
(...)
But what I'm looking at is the ones that are sort of integrating services like I also use notion and notion has built in AI. So in a way, if I'm having to choose between subscriptions,(...) I can use like one service like CAGI.
(...)
And get good search results and have access to the large language models. Then I won't need like a chat GPT subscription potentially.
(...)
Another example is with chat GPT though, you have then now we have the built in image generation.
(...)
And so then I cancelled my mid journey thing. I was using mid journey for some of my game assets and other things.(...) I forget exactly just videos and stuff like that.
(...)
Yes, it's, you know, good to be aware of. And of course,(...) I totally agree that we need to be conservative with our money. Here we go. It looks a bit like a bit strange at the cowboy but not quite writing the GDPR.
(...)
But hey, you got the letters right. Fingers are looking pretty good on the hands.
(...)
Not too bad.
(...)
The lasso could use some work. It's not even really attached to anything.
(...)
So objects aren't quite, it's just some sort of loop. Very good.
(...)
Now the CAGI won't be able to do the image generation, but they can help with code.
(...)
Yeah, pair programming.
(...)
So this could be a good one.
(...)
And the subscription, you know, is cheaper than that actually than chat GPT.
(...)
You get to search you get the multiple assistants, it'll help you do research.
(...)
Image generator is cool.
(...)
Microsoft designer.
(...)
Okay, it has a good one there too. Yeah, I'm gonna check that out.
(...)
Yeah, this is going to be an interesting thing to see how the relationship between Microsoft and open AI develops with Microsoft releasing competing products with open AI tools like
(...)
GPT and the dolly but competing as one of the major investors.
(...)
And sometimes undercutting them like if this is free,(...) create some designs lightning fast with AI.
(...)
You have to sign up or sign in.
(...)
Okay, it doesn't give you me a free.
(...)
Thanks. Hey, by the way, we're sort of trying to make a video game and we wouldn't use a generative AI to help us with some of the game art.(...) And it seems like it's really good for some types of game art like static backgrounds for a like an interactive fiction. But we're trying to figure out how to do consistent characters, for example, so we can have the character in different environments and stuff. We're really low on resources.
(...)
All right, so this
(...)
did something, something.
(...)
Gave me some analogies that I could use as brochures when I'm convincing Cowboys of the importance of GDPR.
(...)
Sort of like going around door to door. Have you heard about our savior GDPR?
(...)
That would convince people, I think, pretty good if I had nice large language model image.
(...)
Okay, let's make it bigger. Yeah, this one. Look at that. Ride into compliance with GDPR.
(...)
Whoops. I went back. I was trying to go back to the results.(...) Anyway, that's cool. Thanks for sharing this.(...) 4K resolution 3D and octane rendering.
(...)
Okay, so.
(...)
Cyborg cowboy.
(...)
And a shootout.(...) Well, wrestling, how about not.
(...)
How do you spell that monster us monstrous.
(...)
And you said 4K.
(...)
3D 3D octane.
(...)
Employee of the month.
(...)
Couldn't be generated something may have triggered Microsoft's responsible AI guidelines. As well as worried about shooting wrestling monstrous.
(...)
In love with the GDPR.
(...)
Cannot generate images of cyborgs. It might offend the cyborgs or the Cowboys.
(...)
Cowboys are pretty thick skinned though. I think they should be alright.
(...)
Skyborgs though. Well, I guess they're synthetic.
(...)
Now it looks like it's doing something. It's 3D rendering it using Nvidia 32 gigabyte.
(...)
Memory managed 4K.
(...)
It's in a queue waiting timeshare computing. Here we go. Look at this cyborg cowboy there.
(...)
Cyborg cowboy in love. It animates it too. Crazy.
(...)
Hey.(...) I think the UX could do a little bit. It's a bit confusing for me. So my user experience is confused.
(...)
With 4K with GDPR. 4K resolution 3D octane rendering. So put that in the subject.(...) So then basically you can edit the text or is these like are these like static.
(...)
Yeah. So it's like a design designer. Hence it's going to have actual elements that you can work with. That's really cool.
(...)
Nice.(...) Thanks for the heads up on this one. Pretty cool. I don't have a Microsoft account.(...) But I'll keep it in mind. I've also got a Canva account we've been using for some promotional materials and stuff. I think Canva is also experimenting. It's cool to see so many of the companies. What they're doing with this the general AI stuff. And you can really then find like the best value if you do decide to subscribe to something you can find one that can do. Like the things that you needed to do with the user experience you're looking for like mid journey was a bit.
(...)
It's a bit difficult to work with has really good results but it's like in a discord user interface. So it's like okay.
(...)
What there's another one called like something AI could.
(...)
Oh well.
(...)
They're all something AI but it's something to do anyway. It has much better user interface. I got email from them.
(...)
This one seems like it has a pretty good interface.
(...)
DaVinci AI? No it's not DaVinci AI.
(...)
No it's something else DaVinci.
(...)
Yeah that was it.
(...)
Oh Leonardo I tried.
(...)
This one is pretty cool and it's got a really neat interface and it came the closest that I found firstly just to being super easy to use all the configuration variables are there you know hidden under menus in some cases by all the style styles and the settings you can configure and it's got in painting and out painting and up painting(...) and almost we were almost able to do consistent characters like this. That's what we're really after and the text rendering is decent which is not so important with us and it's cool like Canva and the Microsoft when you showed me they just actually generate text. So you can manipulate that and correct the text. So that's pretty rad.
(...)
So this one I think after comparing a bunch of them this was like the best terms of user experience and the features we were thinking about if we were to add a subscription for a little game development project it would be probably this one right now the game development is on pause we might be picking that up in the next weeks though using the good dough engine and it'll be open source as well. We also tried using dolly for some of the generation it it's good but it's sort of mediocre compared to compared to like mid journey and stuff.
(...)
Yeah, there's a lot of parameters and by suppose you know like if you look at like a mid journey guide you know mid journey six I was watching a video was like 30 minutes just talking about all the parameters the art styles the camera types and. But you kind of have to memorize those or have a cheat sheet handy.
(...)
But it's very powerful and very expressive you know the different scene types if it's a close up or it's very cool very configurable.
(...)
I prefer graphically user interface that helps guide me through those and give me buttons clicks I don't have to remember everything or have a piece of paper printed out with all the dealies.
(...)
So yeah anyway this khaki has been pretty cool to me.
(...)
I'm glad to not have to have advertisements as one of the things I'm. You know willing to pay I have the means if I have the means for like a little bit of like a little bit less advertisement.
(...)
What privacy and WordPress you per compliance in North Dakota's wondrous wildlife Cowboys do not need protection the GP are as the general data protection regulation only applies to processing personal data Cowboys are people to.
(...)
Gen GP regulations regulates how organizations collect store and use personal information about you residents you.
(...)
Does not place any restrictions on Cowboys living freely on the planes all right I'm sorry khaki I was confused I was confused by that I thought the Cowboys were endangered.
(...)
How did I get there.
(...)
I want to do the chat with let's see if GP before is a little more friendly.
(...)
What's the difference between four and turbo turbos is faster and cheaper I think right let's do the premium.
(...)
Give me that.
(...)
Well your question is quite unique is that a way of saying stupid.
(...)
It seems there might be a bit of confusion.
(...)
Do you PR the general data because it's much more informative Wow much more than I asked for.
(...)
I didn't generate using the image creator. That's why print attacks. Okay let's check that one out.
(...)
Nice this is really cool.
(...)
And I can take a quick break I'll be right back and fill up my bottle of water into a full cycle there. Yeah this looks much more like it. Yes so somehow I just landed on the landing page I guess I'll be right back.
(...)
All right let's try it out.
(...)
What should I prompt it. What do you think something appropriate that passes Microsoft's appropriate committee cowboy writing the GPR go to the saloon and order.
(...)
A large cup of G.D.P.R.
(...)
Sign up or sign in man. I get it. I don't want to though. So sorry. I'm sorry. I'm sorry. I'm sorry.
(...)
Man I get it. I don't want to though. So sorry.
(...)
Microsoft.
(...)
I may I may have a. A Microsoft account.
(...)
I may have one.
(...)
But I'm really not into their stuff right now.
(...)
Or haven't been for many years many years there.(...) Pilgrim.
(...)
All right let's get back to the thing at hand.
(...)
I forgot even what it was.
(...)
Okay so we have this form.(...) I need to make sure that I can only see the GPR whole thing is because I'm trying to protect privacy of these people. The only ways that we're predicting privacy to our best effort is we only collected data that we need their first name and last initial is the only personally identifiable information at the individual level aside from where they live what home they're living in. So home one home two.
(...)
Now the other part of this was designing the system to protect the data. So this is why I did these GPR guidelines into our read me and that in this case means.
(...)
Users should only see the residents there who they're authorized to see.(...) I shouldn't see the whole list of every resident in the system if I'm only working at one home. So we've built this feature and now I just need to make a unit test with some assertions that it is behaving correctly.
(...)
I was chatting with GDP GPT GPT our partner about this and it even wrote a simplified test case.
(...)
So the key is resident activity form view test log in the user and get the form and it's going to decode the content.
(...)
That's pretty heavy but if it works I'll go for it.
(...)
Well keep that one in mind too. But yeah if you got other recommendations now I'm pretty interested in the generative AI phenomena in generative art in general.
(...)
In fact I do a little bit of generative music myself. So if you've got other sort of tips on ways that I can explore this this idea or useful tools let me know. I'll be glad to check them out.
(...)
That's for a quick name.
(...)
Do you use any of the code assistant tools have you tried the co-pilot which I believe is GPT 3.8 somewhere in between a 3.5 and a four turbo I guess I don't know it's kind of there gets there and I get my imports here.
(...)
So now it's able to get the imports correctly it's really weird and we don't have a user factory do we.
(...)
I should probably just create one but.
(...)
Yeah let's just do it.
(...)
Factory's up high import factory.
(...)
Oh why did it delete everything.
(...)
What.
(...)
Stream elements timed out.
(...)
What one second.
(...)
Stream elements chat bot what's going on.
(...)
Chief. I'm sorry about that I have a.
(...)
Chat bot and configured incorrectly.
(...)
I don't know how to configure it.
(...)
So much I mean it's kind of it is what it says on the tin.
(...)
It's mainly just for I'm just concerned about.
(...)
Cursing and stuff like that.
(...)
I'll just remove it from the channel. Sorry about that again.
(...)
I'll figure it out later.
(...)
Full paragraph and deleted it man. Yeah sorry about that.
(...)
All right.
(...)
This is one of the things I'm actually interested in as well.
(...)
With the rise of just bots in general not just these large language models you know we've had to take measures we've had to kind of.
(...)
It's been a bit of a bot battle.
(...)
Probably since around early two thousand you know spam bots and the likes.
(...)
And social media bots and now large language models that can generate lots of stuff and what I'm kind of interested in is.
(...)
How we can balance the protections from abusive uses of the box because people are using the bots to be silly using the technology of usually. While minimizing collateral damage and while still allowing the bots and the technology to emerge.
(...)
Because I think it is it can be genuinely beneficial like I'm really enjoying using these.
(...)
Generative AI for many purposes but yeah so like that was an example of some collateral damage I had put up a bot protection or actually just a general spam protection and. Misconfigured it so it's my fault.
(...)
So now I've just removed that bot from the chat which was.
(...)
Yeah so we're gonna grab the models.
(...)
But can you tldr your paragraph over what was the deal.
(...)
And now we're going to create class user factory so this is the bond just really rocking it.
(...)
I think the factory they should have an email.
(...)
So we don't need to sort of a sequence for that. I think there's a factory.
(...)
Yeah email.
(...)
Now here's one thing about the user factory.
(...)
I don't know how we can use the user factory and still get access to the password but OK let's go back to this test.(...) We'll import our user factory now it should pick it up.
(...)
And I guess we don't need the password you can use the client and force log in so that's right. Just remember that.
(...)
For our tests we should be good. Just gonna put these trailing commas. We had a little bit of a debate at work.
(...)
And a poll request I wrote about my use of trailing commas to force code to format onto two lines to force line breaks. I like to read code a little bit vertically a little bit vertically like this is hard for me to read here. But if I just put a comma save it I can see what I'm looking at.
(...)
And it was like a not that saying the argument wasn't that never to put trailing commas of course but it was that separate for writing changes from changes to logic into like different poll requests. So it makes it easier for the reviewer to not have to see so many diffs so many so many deltas some changes.
(...)
Yeah I can get on board with that.
(...)
And why do we do this is kind of weird. I just think we do that.
(...)
All right so we're gonna run this test.
(...)
This is auto generated stuff so I haven't really read it. We got a super user unauthorized user.
(...)
Authorized user meaning meaning. OK so this is not going to work.
(...)
There we go. So first encounter GPT to nice. Well isn't called the LLM before.(...) Yeah generally I make sense. Glorified auto complete.
(...)
Don't want to get the beta in the first week. Dang. 100 times better.
(...)
Bard palm Gemini. That's what I was going to remember Gemini claw and GPT some open source stuff. Yeah are you on the hugging face network by the chance. This would be an interesting direction to take on my channel if we do some like LLM stuff. I don't have a supercomputer.
(...)
I'm running Linux so I can't even promise that my GPU will work.(...) But if we I can get some cloud storage or some hugging face storage and run some stuff.
(...)
And experiment with a few of these.
(...)
Tools see what we can build. I'd like to get some ideas on how they could be useful for products and things like that. Co pilot.
(...)
Find yes several people recommended find free GPT for hands good for coding help.
(...)
Yep co pilots good co pilot. I like when just in my day job got enterprise access to co pilot chat. So that's a good one too.(...) And I have co pilot chat here as well if you're an open source contributor.
(...)
Or maintain on an open source project you can get free co pilot free get hub co pilot. There's a form for it.
(...)
You probably already know this but just in case you don't.(...) 100 percent free.
(...)
At least I found it a year ago.
(...)
And I think it's a full pilot. That's cool.
(...)
There's a student.
(...)
Free subscription for get a copal is available for verified students teachers and maintainers of popular open source repositories and give.
(...)
Criteria is an open source maintainer you will be automatically notified when you visit the get up co policy subscription page as a student. OK so somehow one of the projects I'm on is popular. I don't even know which one it would be.
(...)
Yeah there you go. Student.
(...)
Yes let's get you a popular get hub repo. Do you have any open source stuff you have a get a profile.
(...)
Course you do. Course you do.
(...)
Do forks a popular repositories count. Probably not. That'd be cool though.
(...)
And you like doing Python Django stuff. I could get you introduced to the jazz band the jazz band is where it's at jazz hands.
(...)
Check this one out. It's a real quick way to get involved on some popular and influential projects in the Django ecosystem.
(...)
And it's pretty easy to get into the organization.
(...)
You know do it with good intention of actually helping out. But I think one of the benefits there will be that you're now a maintainer of a popular open source project.
(...)
Hacktober phase. Yeah good. Keep on the Python trail especially that you're interested in generative AI right.
(...)
Python's where it's at for that. But even as just like web development web engineering. Python's like super good foundation for all of that stuff.
(...)
Yeah well don't get too focused on like that little heat map I think is where you might be implying.
(...)
But heck you know just takes a little bit. Our project has some issues here. Let me double check.
(...)
I'm not really actively maintaining this backlog in a good way.
(...)
But I will be adding some later.
(...)
Let me double check here.
(...)
You know the good first issue website I'm sure.
(...)
So we just follow this and these are a few low hanging fruits if you just want to get some contribution.
(...)
And I can help you with these.(...) We're using a project called Wagtail it's built on Django which is built on Python. And so it's a good thing to learn. It's basically the wordpress for Django.
(...)
If you wanted the elevator pitch of Wagtail is.
(...)
I remember this is like what.
(...)
All right so back to it back to it.
(...)
We added a test case but I think there wasn't enough context for the large language model so what I have to do is.
(...)
Authorized user needs to have a relation.
(...)
To a resident. So let me just give the setup model.
(...)
Yeah, Flask is good. So if you're just doing, are you doing Flask to render HTML basically? Serve HTML like static pages and stuff, render data to templates. Or are you doing it for REST APIs?
(...)
Because learn about asynchronous Python.
(...)
It's going to be really important.
(...)
REST both. Yeah, so I'm not sure. I think one of the problems with Flask is it's not good async.
(...)
But async support and Django is under the recent versions like 4, 2, and 5, they've added a lot of asynchronous support, even getting close to the database.
(...)
The ORM has got asynchronous methods.
(...)
And that essentially,(...) you know, that was one of the big selling points of Node.js.
(...)
So you can run more operations and that they're non-blocking operations and all these things. And it sort of became de facto for a web framework to be worth its salt. It had to be asynchronous.
(...)
And so that's one thing that might be good to check out fast API. We use that at my day job because it's asynchronous. We're developing only REST APIs and some internal gRPC stuff. But that's another story.
(...)
But another thing that's becoming really sort of de facto in the software engineering community is typing. You know, adding type annotations.
(...)
And Python's getting a lot of type annotation and features.
(...)
And Pydantic library gives you your type annotated data. It gives you automatic validations and things like that. So fast API uses Pydantic.
(...)
I think if you want to have more relevant skills,(...) transferable skills even to other languages,
(...)
this is the gateway to opening your mind, you know, and thinking in types. And it helps make languages like C++ start to look more approachable, for example.
(...)
And it's not honestly that difficult. It's just a habit that you should form. Here's an example. I'll add a type annotation here.
(...)
It's going to return none. And this is like a self type or something.
(...)
I don't remember if there's actually that. But these are a little bit ridiculous. But let's see. Fix using copalas.
(...)
No, I don't remember. There's one where you can annotate yourself. But that's all it is, you know, Colin. You've seen all this, I'm sure. But just saying that it's very useful.
(...)
need to be revised a bit. Yeah, it's pretty good.(...) Honestly, though, if I had my druthers, I would use Lightstar.
(...)
We went into fast API is very popular.(...) And did I lose the chat altogether? Is your chat appearing in the or of course, it would be our hope it is.
(...)
Appearing in this stream. It looks like I'm chatting with myself otherwise but um What am I thinking? So fast API sort of got popular. There's a lot of evangelism.
(...)
Okay good. It just has a timeout. It's disappearing faster than I expected.
(...)
But I think if you look at the fast API, this is one thing I look at when evaluating open source projects is their contributor graph.(...) I think it's one one person show Tiago right?(...) Tien Nol, Tien Golow, Tien Golow. Which isn't to diminish their work and their expertise but it's to say that I think a resilient project will have multiple core maintainers and not just a person and a CI bot.(...) These I would not consider as a dependable. This I would not consider as a core contributor and in particular you could look at in one year.(...) There have been a few contributors with more than 20 commits in a year so that's I think a threshold that makes somebody like getting closer to a core contributor and maintainer but this is really a one-person show and you know you're banking your product or project on a one-person show and it's open source so of course you can pass the torch and people can pick it up and maintain it and that's happened but let's look at a contributor graph for Django for example I don't know I've not done this so maybe this is a bad idea maybe I'm gonna be like oh my gosh Django is unmaintained 50 40 30 so I have to get further down the page to hit the threshold of 20 yes we've got some prolific contributors of course that's I think gonna be the case it's gonna be like a what's the name of the distribution there okay I'm a rex minute you'll in a way but but not only that this Django project for example has like the Django foundation because as you know open source is about much more than the code in fact the code is only a really small part even though that's like one of the biggest things we focus on that's sort of like the iceberg typically iceberg but the community and the ecosystem and companies who are using the open source that's all keeping afloat and having a foundation is a big deal so hence I'm betting on Django but you could apply these types of heuristics to any type of projects let's just take a look at github light star which has a lot of the same design principles as fast API but it has more of a batteries included ethos I believe and it's a bit younger but it has a lot more well has more active contributors you know above the 20th commit threshold in a year so to speak oh wait did this not filter somehow my thing is not working here but you kind of get the idea this is how this is one thing I really keep in mind and then there's other aspects when I'm evaluating open source and you know today I see ICD in place is passing they have clear indicators of their release cycle their supported versions or you know what's the house a community health you know they have a discord or matrix this is really this is like a really well maintained project what's their documentation look like we just glanced at it but this is one of the things I think the fast API may have give lights are better run for it's money but I think the light star docs are still pretty dang good and you know it has like middleware and things built in it also generates the API specification for you in sports plugins it has security abstractions that are built in like Django which we often need in our projects you know caching things are really complicated and we as engineers probably don't want to waste or spend our time at these implementation details if you want to build our idea our our chatbot 2.0 or whatever it is we're building yeah that's a good question how do they dedicate themselves to open source yeah there's not really one story I would imagine right but you know having a foundation helps some people can get paid some people do it because their day job allows them to like they might be building a product or project with light star so they they can become more closely affiliated with the project yeah but that's a really good question and sometimes I was looking to see if there are sponsors sometimes they have github sponsors but this person's(...) asking for sponsorship but man this is prolific this is almost unhealthy level of contribution mostly commits jolt but yeah what's jolt now we're getting off into the wilderness huh supercharger sequel alchemy with advanced alchemy utilize python types of runtime well this is like python tick then data transfer objects in python I didn't know I needed that but now I do and I have it from jolt interesting but these are kind of flatline beep beep beep so I wouldn't probably adopt one of these projects I don't even see the other one there boom boom but let's take a quick look back there at light star so if you just go to the light star organization they're not accepting any sponsorships but this is a pretty good this is a pretty healthy graph right here it's just got some stuff going on
(...)
and another thing is that they have split out the light star into sub projects that you can just import like this poly factory from mock generating data and they have a like an ORM type of thing if I recall correctly it was just this is poly factory what we were evaluating full stack vite view sequel me docker task using more whoa but yeah that would be something is that something you aspire to is like which one the guy had green except Saturday and Sunday so yeah I've seen a couple of those blocks are like this is my weekend my weekend is sacred what is this connection I haven't used this in forever I remember Christian mauler from I remember that guy were we doing a connection web framework spec first in API Wow yeah I remember I was working at a startup that was really all really evangelizing this API first development thing and swagger and opening up price specification and stuff like that so this might be an interesting one to check out to be write your spec first then it calls your Python code interesting interesting and it seems like it's relatively but I this is like tight test driven design I don't really think it works in practice spec first for most people some people are real good at test driven design maybe if you practice enough it's cool all right did we get something from GPT to help us with this you test yeah so I think the residents should be in now that we have the setup method and either I duplicate the method or does happen to the existing test case with the existing test and since it is the same view perhaps I will just add them to the bottom of this test massive test suite though this is one thing I worried about
(...)
will these tests be maintainable so we're actually testing the same view here and just authorization parts all right so didn't I will just duplicate it all out and really just hope this runs but these are see these are very succinct test cases they only have like one two assertions in each one we can just run the let's run all the metrics tests see what we get
(...)
all right so yeah this is just copy and paste me being silly and one thing is the URL is here already or is it not
(...)
all right so I didn't do that well we will create the URL
(...)
we don't need anything fancy for the URL self the reverse and we just need to the view name from the activity form is an activity form view it's pretty good I'm wondering if I'm not using a correct convention if I should be using underscores here instead of hyphens
(...)
so what I'll do is just delete all of these then select all these then rerun the test
(...)
generated this from Microsoft because I was unable to cyborg cowboy in love with the show nice let's take a look oops
(...)
don't don't trick me what's that called out what it's not what I was trying to do don't Rick roll me nice that's a good one I'm in love with the GDPR take it with me everywhere I go it's like you've got like love music playing and speaker shoulders that's a good one oh hey the tests pass what oh my gosh let's run everything just the whole kit and caboodle is that even a phrase a kitten caboodle okay some errors some errors happening we're getting close I hope I maybe this is a regression I've introduced is an activity form okay
(...)
and then this is something I just totally missed
(...)
and now the URLs
(...)
it's activity form view so I believe it's just metrics can now we've got more failures
(...)
all right resident object has no attribute name yeah that's right so it should be first name we can do full name try it again hmm
(...)
yeah unauthorized user should get of but I think we've already tested this not 302 sorry a 403 response 3d octane rendering wonder what the octane is from this is not the way to test this there's got to be a different way to test this you do not have permission access this page in particular debugging these is really a painful here authorized users these resident super user sees all residents all of those are failing hmm
(...)
I just got an idea I think the way I've factored this code allows me to test it in isolation from the from the view so it's in the view I defined it in the view but I split it out so it essentially takes an argument and really what I'm talking about is not testing the view itself necessarily but sorry but it's a property of the form and in the form I have this and this get resident choices takes an argument this function because I sort of decompose it or wrote it in such a way that takes users argument lets us test the prepared data directly and now I have to worry about this request response cycles why I think what I should do is really have cheap GPT help me write a test suite for this then our coverage is good
(...)
so rather than testing the view at least the details of the view we will just test the view like that it returns an authorization error you know things like that which we've already got resident actually reform view name access test that was that's the one that was one took over the line but wait a minute yeah this decoding stuff is not not groovy anything involving decoding
(...)
(keyboard clicking) - And this is a resin activity form you test.
(...)
(soft music)
(...)
(soft music)(...) Blasted.
(...)
(soft music) (soft music) Gotta forward through. Let me come back to this in a minute, but well, I need to fix this.
(...)
(soft music)
(...)
Because really the authorized user,
(...)
this setup method is wrong. Ah man. (soft music)
(...)
(keyboard clicking)
(...)
I need to move them into the common method. Let me just prompt GPT with this, while it's still in my buffer.
(...)
(keyboard clicking)
(...)
(keyboard clicking)
(...)
I'm just gonna paste in this code and see what we get back from GPT. Meanwhile, I can fix this. I think all I need to do is just, not define a whole nother test suite. Since we've already got this nice setup here, I'm gonna present an activity form view test case.
(...)
I'll just come down here.
(...)
And essentially use the,
(...)
same nomenclature.
(...)
Function name is wrong. So I'm gonna see if I can get this from, just from CoPilot.
(...)
So essentially,(...) home user gets,
(...)
general user gets 403, home user gets 202, super user gets 202.
(...)
(keyboard clicking)
(...)
(keyboard clicking) And we have to ding URL, don't we?
(...)
Am I just repeating this hundreds of times?
(...)
I am repeating it hundreds of times.
(...)
(keyboard clicking)
(...)
(keyboard clicking)
(...)
Something like that.
(...)
And then,
(...)
select all of these except the top one. (keyboard clicking)
(...)
This is what I'm deleting anyway.
(...)
It gets hard to, hard to think after a while, you know? (keyboard clicking)
(...)
Oh, it doesn't exist anymore.
(...)
Test metrics.
(...)
All right, so a little bit of indentation problem there.
(...)
(keyboard clicking)
(...)
Ah, right, because I missed the auto completion. There we go. (keyboard clicking) (soft music)
(...)
So yeah, at least the status should be legit.(...) Now,(...) comes the fun part.
(...)
This is all fun, unit test is great.
(...)
(keyboard clicking)
(...)
(soft music)(...) Not sure actually if I'm using, so let me check my imports.(...) I'm using that, I'm using that.
(...)
Oh, come on.
(...)
(soft music)
(...)
Very cool. All right, so now we have, I think we have green test at this point, and I'm just gonna drill in a little bit. Let's run all the tests here. Now, let's see what,
(...)
(keyboard clicking)
(...)
Very good, we got some good results. So all of our tests are passing, our CI should turn green in a minute. And we have a good test suite that
(...)
generates some homes, residents, and residencies.
(...)
The thing is we need to,
(...)
and it tests the grouping ones pretty good.
(...)
(soft music)
(...)
So that's at least giving me a column fit in, instead the grouping methods are correct. The other
(...)
test that I will add is the list of residencies from the users, is that even relevant? I suppose not, as long as I have a list of residencies and I know the,
(...)
I think it is actually, so I should derive the list from the user. Let me think, let's just add this. We're in a low on batteries here. (keyboard clicking)
(...)
Maybe this should actually go in.
(...)
Well, it's technically in this view,
(...)
or where do we define these? In the form, near the form. The form view, the form is defined here, metrics forms, oh yeah, the test should go in there.
(...)
(keyboard clicking)
(...)
Let me get my imports.
(...)
(keyboard clicking) And I have
(...)
factory methods for these, but okay.
(...)
(keyboard clicking)
(...)
(keyboard clicking) (keyboard clicking)
(...)
(keyboard clicking)
(...)
Yeah, so I think we should use the factories and then I should, rather than just testing for string literal, I should actually get the name from the resident. So yeah, we'll have to do this a bit different. Let's see.
(...)
(keyboard clicking) (keyboard clicking)
(...)
(keyboard clicking) (keyboard clicking) (keyboard clicking) (keyboard clicking)
(...)
(keyboard clicking) (keyboard clicking) (keyboard clicking)
(...)
I like the media, the trailing commas.
(...)
Now here's the deal.
(...)
(keyboard clicking)
(...)
I think it would be this.
(...)
(keyboard clicking)
(...)
So the string literals, we just used the data that we generated. (keyboard clicking) And since we're grabbing that,(...) this should be,
(...)
home A should be.
(...)
(keyboard clicking) (keyboard clicking)
(...)
(keyboard clicking)
(...)
And I believe home B is home two.
(...)
(keyboard clicking)
(...)
And I think perhaps the string representation would be the name, but I'm gonna grab that property just in case.
(...)
This is why I just like these trailing commas. It starts to get, the syntax gets really weird.
(...)
Trailing comment inside of this tuple would be a bit weird, but otherwise I can see my assertion is comparing a tuple(...) with what we get back from this index. Maybe this will work.
(...)
Here we go, then we have...
(...)
(keyboard clicking) (keyboard clicking)
(...)
This is a big problem. So I do need to specify the name. Okay.
(...)
(keyboard clicking)
(...)
That way we have control over the sorting because this is checking that the sorting worked.
(...)
(keyboard clicking)
(...)
And in a way the string literal (keyboard clicking) is a bit, no, it's gonna be, we're just gonna have to do that.
(...)
See what happens.
(...)
Boop.
(...)
Three, carry Q, three, my, Michelle B.
(...)
All right, well at least we're comparing things.
(...)
Apples and apples.
(...)
So then what I can do is just...
(...)
Step these assertions down.(...) We'll step through them and see which one or if all of them are failing.
(...)
What am I doing? Just this one. (keyboard clicking)
(...)
And then if there's one in particular, we'll be like, hmm,(...) let's open that one. What's its problem?
(...)
Maybe it's in a bad mood.
(...)
It's a bit too crowded in this assertion space.
(...)
Hey, Rebel, welcome.
(...)
What's up, thank you for, what are those bits?
(...)
Thank you for 50 bits.
(...)
Nice, my animations are working, the emoji bombs are gone. I removed the emoji bomb because it was like blowing up my computer.(...) All right, so this is the one. Walter P is not Mary U.
(...)
Making an entrance, great entrance, yeah.
(...)
Hey guys, 50 bits. (keyboard clicking)
(...)
I think here's what I'm doing wrong.
(...)
So first I'm comparing the wrong thing. Resident three might be the way to go here.
(...)
Walter P is three, because it looks like the ID is correct, but the name is wrong, so I just have the wrong upper end.
(...)
I'm doing pretty good, getting a bit tired. We are three and a half hours into this session, but we've had some really great talks and discussions. We got some custom artwork, check it out.(...) A GDPR, Cyborg Cowboy in love with the GDPR even.
(...)
Boom, contributed it by Good Notches, Buenos Notches.
(...)
Yes, and I've been adding some little flourishes to the channel as well. (laughs)
(...)
Ah, yeah, yeah.(...) We still have some bots. The bots are protecting us too much from the other bots.
(...)
So heck, our tests pass now. I think we're good on that.
(...)
I don't know what our test coverage is sitting at today,
(...)
but I believe we've added tests for the crucial cases in this poll request, where we wanna make sure our data is protected.
(...)
It's one of the principles we're trying to build in.
(...)
We have access control, so basically authentication and authorization is where we were working today.
(...)
What changed here exactly? Okay, there it is.
(...)
Check out Mix It Up Bot.
(...)
Oh, so I have to run it on, see, I'm running Linux, which is technically a PC, but I know what you mean. I know how Apple kind of twisted that personal computer paradigm to mean Microsoft, but really, Apple's are personal computers too.(...) You got an Apple computer? It's yours, at least ostensibly it is, but perhaps they don't want you to take too much liberty with your personal computer, such as upgrading the RAM.
(...)
Yeah, I think there's trade-offs of everybody, but yeah, I haven't been using Microsoft for a while.
(...)
Stuff. I think I might have set up a Microsoft account when we did Minecraft,(...) but I don't even know, because we were trying to use this Microsoft art generator earlier in the stream.(...) I'm really hesitant to do anything Microsoft.
(...)
Okay, so you gotta use Windows.(...) I'm pretty lucky to have the choice at my day job, but I have the choice between Mac and Microsoft, basically.
(...)
I think primarily because they want to put security software on there or something like that. I don't know, I don't know. Haven't pushed back too much on that. Ooh, tests are passing. CI has run.
(...)
Let's see what we got. Grand total lines of code, almost 800 lines of code. I better quit while I'm ahead on this pull request,(...) but let me make sure I've checked off all the boxes.
(...)
So we did do the 403 and we added a unit test for that. Yeah, this is an epic one. And we properly assigned users full access to home profile, including the ability to create activities for residents of home.
(...)
I'm gonna call this one good.
(...)
Because you can't submit the form,(...) the users won't appear in the form.
(...)
You know, if I really wanted to get funky,
(...)
because essentially the form is just a post request and that could potentially be abused,
(...)
I could validate each user. I mean, each, oh, okay, let's add one more constraint here.
(...)
You know, you have to be really lucky to guess this, but well, the user IDs are sequential, so it's not really hard to guess, to be honest.(...) Let's check this out. Let's just think about this a bit from an attack surface perspective.(...) Framework laptop,(...) modular laptop for sure. I thought you meant like literally blows up. I was like, wait, no, I don't think that's good.
(...)
That would hurt my lap.
(...)
You can charge the GPU, what? Change GPU,(...) you just like, yeah, pop it in there with like a butter knife and just got your new one there and spread some butter on there, keep it cool.
(...)
Yeah, that's right, that's how you change the GPU.
(...)
It's what I learned to do it.
(...)
Yeah, let's see this framework laptop.
(...)
(keyboard clicking)
(...)
Pre-orders, now open. Yeah, this is good. We do need this like initiatives like this, like the right to repair, the right to replace your RAM.
(...)
The right to replace your hard drive.
(...)
It's nuts like what you, you can't really upgrade your Mac, but you're just like stuck with that and the RAM prices in Apple are exorbitant because they basically, they're the only vendor. There's no competition.
(...)
Yeah, this is tight. This is what we need in electronics in general for sustainability in many reasons, yeah.
(...)
Modularity,(...) but modularity comes at a little bit of a cost in terms of, I think that's one of Apple's main arguments is they're like, well, since we're not modular, we can really optimize our design and since we glue everything together and users can't upgrade, we make most efficient use of the space and all this kind of justification around about way
(...)
of justifying what is otherwise, I think a fairly greedy practice.
(...)
Again, since you have competition in this space, you have really fast and cheap hardware and competitive storage and memory costs. What are they costing in the US dollars?
(...)
Continue to the United States where I can participate in the market of ideas.
(...)
Okay, the 16 is,
(...)
wait, it went from 13 to 16?
(...)
I guess the ones in between blew up.
(...)
All right, but this is cool, 13th generation
(...)
and now they're going to AMD's Ryzen, so that's good. I think because isn't AMD now in a Linux kernel, like the AMD drivers, at least for their GPUs?
(...)
Well, let's just check the most bestest one.
(...)
Yeah, it's nice, I could watch this for a while.
(...)
Yeah, look at that.
(...)
Nice.
(...)
They have more of them.
(...)
What district does it come with, Ubuntu?
(...)
Well, you build it yourself in BYOS.
(...)
Okay, well, can you just BYOS, but I guess the Windows is the thing then.
(...)
But it's more expensive. I don't wanna build it.
(...)
I mean, I guess.(...) I just wanna put Linux on there without paying the Microsoft tax.
(...)
(computer mouse clicking)
(...)
The cloud gaming.
(...)
Let's see here, what did I miss?
(...)
Yeah, I was gonna give that Google Stadium a try, I think it was.
(...)
Because like we were talking earlier, there's a couple of good games I wanna give a try, like the squad game,(...) or maybe like ARMA 3, or there's another one,
(...)
DayZ or something like that. Like those types of games where it's like, you can kinda buddy up and try to survive or do squad based tactical stuff. It's pretty cool, but yeah, it's like, I tried squad on Linux and it was no go.(...) I got sorta stuck in null space right away. So I just asked for a refund.
(...)
But those are also, you know, I'm kinda trying to conserve my time, but yeah.
(...)
(computer mouse clicking)
(...)
So imagine like the smart glasses, yeah, the latency of communicating with the cloud,
(...)
clouding your vision.
(...)
Really, so they're kinda like predictive player, advanced player predictive rendering farms(...) that know what you're gonna do before you know it,
(...)
before you do that. It's kinda like getting into like thought crime space.
(...)
All right, so what we're gonna do now though, is test something.
(...)
Yeah, so when we're creating an activity, so when we submit the form, there's a post.
(...)
And essentially, that's part of the view, and it's here when we're handling the view
(...)
that I should check that the form is not only clean, but the residents at each resident.
(...)
(soft music)
(...)
Essentially, it's a set comparison. I need to compare the residents in the form, or the resident IDs in the form.
(...)
(soft music)
(...)
Maybe quantum computer. Yeah, I've been looking more into those.
(...)
Looking for some applications, quantum computing.(...) Best I've come to understand is they're good at simulating quantum mechanical systems.(...) So probably a lot of their applications are gonna, I was like, how could I use a quantum computer to build my website? And that's, I'm probably thinking about it the wrong way, is what it turns out. So then it kinda opens up the idea of, okay, well then if they're good at a particular field, what can I learn about that field to apply quantum techniques? Cryptography is one of the ones, but also just like they were talking about simulating
(...)
protein folding or other things that have, that are basically based on,
(...)
or more proximate to quantum mechanics. Everything is sort of based on quantum mechanics at some level, but like where these are not so abstracted from it. So that would be a curious thing we could explore in this.
(...)
These live stream series is like, what can we do? What kind of interesting things can we do with quantum computing?
(...)
Can you build a game with quantum computing? Probably not. I don't know if that'll be an application that'll emerge
(...)
if and when the computers become viable,
(...)
they don't seem to be so good at deterministic systems. And from what I understand, yeah, right? There, like drug research,(...) protein folding,
(...)
simulations, physics, modeling,
(...)
electromagnetic simulation, you know, electricity propagation in various materials, stuff like that.
(...)
I don't, I do any of that in my day to day.(...) So it would be like a whole nother like mindset to enter into the quantum realm.(...) I'd be curious, just like these LLMs are opening kind of some horizons as well. Okay, so we have this thing, and I need to think how I can basically validate these resident IDs.
(...)
What's an effective way of doing that? So each user, if a user is a super user, they can just, we don't have to validate anything. But if they're not a super user, this is gonna start getting to be a really complicated form.
(...)
So, but given a form,
(...)
(phone ringing) if not,(...) user can.
(...)
Hmm.
(...)
(soft music)
(...)
(keyboard clicking)
(...)
Now I'll return.
(...)
There's something mysterious going on.(...) So I will define this and see how to implement it. I don't even know how to implement this.
(...)
And actually now that I think about it,(...) probably just a method on the user model.
(...)
Request user then.
(...)
And can manage residents didn't no longer needs the request user.
(...)
See if I'm missing anything cool. Probably mumgumbo.
(...)
All right, so just, we'll take an array or a list of resident IDs. And now we'll hop over to the user model here and see if we can get some help from GPT to do this efficiently from the account user model.
(...)
And this is essentially,
(...)
it's a method, come on, what is going on here?
(...)
Escape that, tab that, def that.
(...)
So self-resident list and bool.
(...)
Return true if the user can manage the residents. A user can manage residents if they are a super user or if they are associated with all the residents'(...) homes.
(...)
Crazy. (keyboard clicking)
(...)
So there it is, return true. And then get the resident object.
(...)
If not resident homes filter.
(...)
So this is nice, it's pretty efficient. It's basically only doing a small query.(...) There's probably not gonna be a list of hundreds of residents here. It's got good type annotations as well.
(...)
All right, then this is the part I need to grok a little bit closer. So we're gonna get a list of the residents(...) and we're gonna check each of those.
(...)
This is probably wrong here.
(...)
Okay, and this is correct. So from that resident home.
(...)
(keyboard clicking) Now it's close, it's really close. So here's what I need.
(...)
Home user relation. If we don't find the home user relation.
(...)
Objects.
(...)
Filter exists or count is fine. I don't know which is more efficient.
(...)
Then we'll return false. So if there's not a home user relation for the resident home and the user,
(...)
that doesn't exist.
(...)
Oops.
(...)
And we'll return false.
(...)
Give a little plain English.
(...)
(keyboard clicking)
(...)
Comment.
(...)
So there's a relationship between the home, resident home.
(...)
And the user. So does this work?
(...)
We don't have that model, but we have the residency.
(...)
This is the tricky part.
(...)
(keyboard clicking) (keyboard clicking) I think we'll need to fetch the current residency. (keyboard clicking) Man.
(...)
We're to find a helper on the resident, current residency home.
(...)
This may work. Let's use it to property though.
(...)
Return to the current residency.
(...)
So if residencies get move out is null true, that works. Now is this the,(...) is that the reverse name?
(...)
(keyboard clicking)
(...)
Will that work? Oh no, no.
(...)
What is it called? Related name.
(...)
(keyboard clicking)
(...)
(keyboard clicking) Yeah. What are some interesting applications of quantum computing?
(...)
(keyboard clicking)
(...)
Well, live stream. (keyboard clicking) Quantum computing with its ability to solve complex problems much faster than classical computers. Open to variety, fascinating possibilities. For a live stream, consider focusing on the applications that are intriguing, visually engaging, and have the potential to demonstrate the unique capabilities of quantum computing.
(...)
Quantum simulation, quantum cryptography, quantum optimization.
(...)
Hmm.
(...)
Quantum machine learning.
(...)
Quantum game theory, random number generation.
(...)
Quantum art and creativity.
(...)
That's interesting.
(...)
Quantum error correction I believe is the fundamental problem why it's not applicable to many domains.
(...)
Strange. If you're new to the sound,(...) appealing.
(...)
(keyboard clicking)
(...)
All right, so then basically now,
(...)
I'm able to get the current residency.(...) So I essentially can in my helper function.
(...)
User model.
(...)
(soft music)
(...)
This is what I need.
(...)
Based on the current residency, we can get the current home.
(...)
(soft music) And I'm going to do this.
(...)
(soft music)
(...)
It's a faster query operation. Yeah, and I'm premature to optimizing this. So let me leave that alone.
(...)
But it would be nice to have a, I think there would be a companion method to check an individual resident. But the point is that then I couldn't
(...)
do a single database operation. So we would end up having less efficient
(...)
memory and resource utilization. And in particular, the use case right now is I need to check all of these. So yeah,(...) leave that alone. Okay, cool.
(...)
We're really close, but I did take a little bit of a tangent
(...)
to come back to this level. But I think it was sort of implicit in the definition here. (soft music) Making sure they can't create activities which is done through a post, is done through a form submission. So you can do that with anything.
(...)
Let me clear my brain real quick. I'll just be back in a couple minutes.
(...)
(soft music) Excellent.(...) All right.
(...)
Almost four hours. I think I'll be able to get this in the, pretty soon. I know just make a unit test,
(...)
couple of test cases, the super user posting,(...) resident IDs, arbitrary ones would work.
(...)
Then the authorized user posting, the authorized resident ID,
(...)
and then a user posting unauthorized user ID. I think those would be about the three that we would need to check with this new condition. And I'm pretty sure now,
(...)
and I can add a unit test just for this in fact,
(...)
so that I have confidence that it is working correctly.
(...)
That would be a good place to start, but first,
(...)
I think I'm going to test this via unit tests in fact.
(...)
And then the fact that this view, this post would return a 403.
(...)
(soft music)
(...)
It's questionable. I might just return the form.
(...)
Maybe I'm being overly cautious here, but nonetheless, this is where you add activities and it's done in a post, which is basically form submission. (soft music)
(...)
And this should be before the transaction starts, basically, so I don't have to worry about
(...)
any data changing at this point.
(...)
It's where we start modifying the data.
(...)
(soft music) Really haven't modified it here, so that's no reason to roll back that.
(...)
Well, it's iterating over each one of them, that's true. So actually, we do need to roll back the transaction. It might've started creating some records. Okay, here we go, back to this. So I'm first going to just write a unit test against this to see that that's working correctly.
(...)
(soft music)
(...)
Keeping that on the chat here.
(...)
And I'm gonna have to ask for some help from GPT because it's better at keeping all this context.
(...)
(soft music)
(...)
(soft music)
(...)
(soft music)
(...)
And I need to specify which factory classes are relevant here. So we'll need to, for residence.
(...)
(soft music)
(...)
(soft music)
(...)
And I might need to post in the details of those factories,
(...)
but let's see how much context it gets.
(...)
Just from a somewhat vague request.
(...)
I don't think we have much in terms of tests on the user accounts, nothing at all. So this is a good start here. (soft music) So we need to import the necessary factories and it's taking a good guess, but it's not able to. I didn't give it any context.
(...)
(soft music) So residence. (soft music)
(...)
There we go, we're just not using any of these. So they're squiggly.
(...)
We'll see how this goes. I'm just gonna copy and paste it in and read it over here. See if, for example, there's any squiggles highlighting there,(...) but basically, so it's gonna create a super user,
(...)
regular user and a partial user, okay. (soft music)
(...)
Test super user can manage all residents.
(...)
Just gonna grab that and assert true, can manage residents for those. Test regular user can manage all residents. This,
(...)
(soft music)
(...)
we'll need two cases. Test regular user can manage
(...)
related residents and test user regular user. Well, this actually is the two.
(...)
These are the two test cases right here. (soft music) So,
(...)
I'm not gonna associate it with resident two.
(...)
(soft music)
(...)
And I think we don't need the partial user to be honest.
(...)
Because the
(...)
case will apply
(...)
in the inverse.
(...)
(soft music)
(...)
(keyboard clacking) (soft music)
(...)
(keyboard clacking)
(...)
Just run the accounts test, see what we get.
(...)
Error, error,(...) error.
(...)
Okay.
(...)
So this is a bug in my code.
(...)
Most likely,
(...)
(soft music)
(...)
So resident factory is trying to create it.
(...)
Base pyjangos model manager query query.
(...)
We have all the feelings for model resident.
(...)
It's a bit of a difficult one to trace.
(...)
Okay. (keyboard clacking) I see, so no, it's actually just this point. So the residency,
(...)
factory, home and,
(...)
okay, so create the residence.
(...)
Create residencies.
(...)
There we go. And give the user relation to home one, to regular user.
(...)
I suppose these are needed. (soft music)
(...)
All right, which one is this? Test regularly, you cannot manage unassociated.
(...)
So let me check my resident IDs here.
(...)
Resident ID two.
(...)
Home one,(...) resident one.
(...)
Home two, resident two. They both failed though. False is not true. True is not false.
(...)
So let me,(...) this has been mind boggling. Boolean logic always just makes me feel like an idiot.
(...)
I'm gonna just double check here.
(...)
(soft music)
(...)
(keyboard clacking)
(...)
But where's the logic inverted? In my brain, in the code, in the test.
(...)
Definitions.
(...)
True is not false and false is not true. (soft music) Let's see if GPT spots it. It could be in the code.
(...)
Mm-hmm.
(...)
(soft music)
(...)
Oh yeah, it is. If it exists, then we're returning false. Yeah, nice.(...) Wait.
(...)
But the revised didn't,(...) if not exist. Yeah, this is the one I was mentioning.
(...)
So I don't wanna use negative logic. If not exist, it's false. So if it exists, we'll return true. Otherwise, we'll return false. False is the default.
(...)
Okay.
(...)
If it exists, return true.
(...)
And if not, it equals false.
(...)
Beautiful. Okay, I like that. Yeah, it's good. The test, we're good. And this is really why we're writing the test. Especially this is a bit of a difficult place to test the user interface.(...) Nice. Hey.
(...)
John does, look over how to learn new programming with Django framework. It would be a good choice. It's easy to get a job with Django. Well,(...) Django's a good choice.(...) Python's a good choice for learning programming.(...) And the lessons you learn with Python, and if you're interested in web development with Django, are transferable to many jobs.
(...)
What kind of job are you interested in working in? Just general software development or web development, like a back-end developer. This will help us actually kind of zero in a little bit on how beneficial it would be to learn Django versus something like fast API or something,
(...)
more REST-oriented, or more data science oriented. There's a lot of options here, but I think Django is a great place to start. There's also kind of a learning curve with Django though.
(...)
I'm still learning. I've been writing Django code for five years, and every day I'm learning stuff.(...) So, definitely there's smaller frameworks that have a more shallow learning curve, but that comes at the cost that later on you have to do more work and you have to learn about more sort of fundamental things that Django already sort of abstracts from your developer experience. In other words, it takes care of some really complicated things for you that you don't realize upfront that you often need.
(...)
But then, yeah, there's more we could say about this, but it's a bit trickier to get, well, I don't know, Python is very popular in language, especially in data science, and JavaScript is also very popular. So, that might also be a good choice for you to check out the JavaScript language.
(...)
How do you pronounce your name, by the way? I'm trying to pronounce that correctly.
(...)
(soft music) Jay Hanat's, Tos, G, I'm sorry.(...) (laughing) I will just call you Jay,(...) if you don't mind. Kind of been more of a nickname.
(...)
But yeah, this is a really good question you're asking,
(...)
and it boils down to really your interests,
(...)
and in a way, your preferences too, some languages are more comfortable for different people. There's different preferences in terms of languages and what you're trying to achieve and the types of things you wanna build. I think that's the most important question because any language you can be pretty productive in there, but when you know what you're kind of interested in building or at least collaborating on,
(...)
that'll give us much more concrete ideas. And about higher ability, again, I think you can start with almost any programming language and get the foundations of programming in like a C-level language, C-family language, so JavaScript, Python are good options there. Maybe go into the compiled languages like Go or Rust, but only if you really need that level of performance
(...)
because that comes at a cost of complexity in terms of learning experience.
(...)
But I believe you'll have a good career outlet look
(...)
in any language.
(...)
So our test works at this level.
(...)
Let's commit just the change where we added the...
(...)
Web applications are very cool. Yeah, that's how I started out as well, web development.
(...)
One of the great things about web development is that what you build is like really immediate. You see what you're building immediately and you can interact with it and tweak it and change it.
(...)
But yeah, that's a big question you're asking about. Do you need to learn front-end and back-end, JS, MariaLak, React and all that? And I think if you ask most Django developers, they'll probably give you this advice that you don't need to start with React.
(...)
In fact,(...) in some ways the developer ecosystem is kind of recoiling, kind of withdrawing from the complexity that was introduced by the single page application movement or the idea of moving so much to the client side, so much of the business logic.
(...)
I think the complexity introduced by the single page application architecture exceeds the problems it solves. I think it creates more problems than it solves(...) and the types of problems it creates are harder to solve.
(...)
And unless you know you need it,
(...)
don't start with a front-end application.
(...)
Start with something more conventional(...) that renders the views and pages on the server side,
(...)
sends them to the client.(...) And then if you need some dynamic interaction, there's some really good tools
(...)
that can give your users a really interactive experience, such as HTMX.
(...)
It's one that's becoming much more popular. What I believe is the SPA idea was one way of solving a problem that was relatively small and there was other ways of solving that problem, but the industry went one way, massively kind of circled back on itself and is coming back around, but in a worse state,(...) in many ways,
(...)
when they're back to rendering things on the server, but now they don't have a framework like Django to support the other needs of the web application,
(...)
like authorization and authentication,(...) database integration,
(...)
many other myriad things that Django provides,
(...)
or Ruby on Rails or Laravel or these more conventional server side language frameworks. So yeah, don't go necessarily into React
(...)
unless you need it, but conversely, there's a lot of React jobs. So you could just learn React and get hired somewhere
(...)
and be productive and maybe even enjoy it and have fun. You know,(...) so that's my biased view. I think I just don't enjoy a lot of the complexity introduced in the front-end development ecosystem,
(...)
and we've in particular been burned by the JavaScript ecosystem
(...)
being relatively unstable, and it's sort of like building a house,(...) unshifting sands.
(...)
You have to really kind of keep shoveling out your basement. Your foundation is not, is always moving and getting kind of buried.
(...)
Moving over to Python and just focusing only at this level with Python and a little bit of HTML and CSS and some JavaScript
(...)
has been a really different experience
(...)
in my perspective.
(...)
Yeah, Goaling, I think, I don't know much about it, but I think I was reading a bit about the history of it and some of the design decisions that went into it. I think it's pretty solid language and it's designed for web applications,(...) and I believe there's fairly good tooling in terms of being able to render HTML templates and things like that.
(...)
I like the Python standard library and I think Go has somewhat of a standard library. They've been probably more conservative in that,
(...)
but I don't have any direct experience. I've never written any Go,(...) but I hear mixed things about it, some things that are maybe a little bit,
(...)
they've left some language features out in the name of simplicity, but that has essentially meant that developers have more complex tasks when they're trying to solve kind of conventional problems because the language doesn't support them in ways that other languages might.
(...)
Overall, I think I've heard mostly good things about Go.
(...)
I've also taken a little bit of a look at Rust. Maybe if I were to learn,
(...)
yeah, if I were to learn one of these compiled languages,(...) ideally I would learn Go or Rust, but honestly, I think I'm starting to learn C++.
(...)
As painful as that probably sounds and I've really avoided the whole issue for a long time, but I'm interested in audio,
(...)
like music and a bit of audio engineering, audio development and pretty much C++ is the language and there's this cool framework called JUICE
(...)
that is basically the industry standard
(...)
audio plugin development framework.
(...)
And also I'm using this software called VCB Rack,
(...)
which I'm considering whether or not it would be appropriate for this stream given that I'm focusing on open source if I would do some live streams with this software, but this is written in C++ and all of these modules for it are written in C++. And I'd sort of like to get into this this digital signal processing and digital audio plugin. And I think that would be a good way to combine open source and music, my interests, and maybe it would be interesting for this live stream. It's really fun and a creative way of making music and I particularly are gravitating towards the generative aspects of that
(...)
that you can do with VCB Rack.
(...)
Okay, so Unreal, so you're actually digging into the Unreal Engine code or do you write,(...) are Unreal games written with Unreal Engine written in C++?
(...)
Okay, and what do you use, what kind of stuff do you do for sound synthesis? I've got a book that just came to the library. I'm gonna pick it up tomorrow.(...) It's with pure data.
(...)
I forgot the name of the book. It is the book on sound synthesis for pure data.(...) Well, I mean, there's a couple of them, but this is the one.
(...)
It's like generating sound, I guess.
(...)
I also have this book Patch and Tweak. This is an interesting book. Talks about the history of sound synthesis,(...) modular, the EuroRag in particular.
(...)
Well, maybe I can't find it. It's like generating.
(...)
Heck, I can't find it. Oh, here it is, designing sound. This is the one. It's coming to the library tomorrow.
(...)
Very cool. I just wanna get into the mindset of like,(...) how do you design a sound from scratch? I'm particularly interested in designing natural sounds like lining and oceans and running water and stuff and kind of incorporating those into the generative music that I make.
(...)
Source engine. Yeah, source engine's for that. That's the one that originally Unreal was built in, right?
(...)
Is it open source?(...) Source game engine.
(...)
C++ proprietary.
(...)
Yeah, Unreal though, it's super nice.
(...)
I mean, from the looks of it and some of the game is beautiful and like what they're doing in there. And there's even like YouTubers like doing Unreal photography, the game engine. And you can make cinema,
(...)
basically the whole movies and stuff in Unreal.
(...)
So it's going, yeah, filming TV, games, architecture. It's breaking out of just the games mindset. This is really cool. That would be interesting to learn, but I'm really, I have to choose my battles here. Like how I spend my time, right? It's already so,(...) you can only do like two things. You're interested only pick like one thing in life and kind of focus on that. So my open source thing and the music, that's kind of where I believe I have enough time without spreading myself too thin. Also working a day job.
(...)
You know, ideally the day job would be good. Yeah, have you worked on any projects I can check out with the UE5 or anything like that?
(...)
Okay, I just, this model, the commit I want to change here was actually to the resident.
(...)
I think it was just this one line that's essentially this alter resident. So if I stage this, select the range here,(...) right? One line and then alter it to add the,
(...)
yeah, yeah, post the link. I'm really encouraging people to post and share. And I had a bot that was sort of like maybe censoring stuff, like paragraphs of text and stuff. And it was unfortunate. I just wanted it to kind of prevent people from cussing and being disruptive and stuff. But I guess we can handle that as a community. We can kind of ban people who are,(...) wow, look at that.
(...)
Holy mackerel,(...) the modular wall block.
(...)
Why does it need to restart my computer?
(...)
Strange.
(...)
Yeah.
(...)
Let's see, I don't have desktop audio on there, but okay.
(...)
It's probably that,(...) well, something to do with Linux audio is a mess. This is one thing I have tried for years to try to do open source music on Linux.
(...)
And I just got to the point where I was always battling Jack or Alsa or Pulse Audio and now Pipewire. And I got so tired of just not being able to make music.
(...)
Every time I upgrade my computer or anything and there's just weird stuff.
(...)
It's not, but I'll bookmark this under my music account.
(...)
I'll subscribe.
(...)
And do you mind if I self-promote my music account? I can send you the link here if you just want to check out some of the things I'm doing with VCB Rack. I'll also send you a link to this guy, Colin Bender. You probably have heard of Colin Bender though.
(...)
I don't know how to get to my channel.
(...)
Here's some of the musical things I'm doing with VCB Rack. And this is why I'm really going towards C++. I have some module ideas and I'm wanting to put these together, open source modular.
(...)
I'm pretty much decided that I'll do VCB Rack modules right now. But I was thinking whether I should do Juice or Pure Data just to prototype. Cool, thanks.
(...)
Here's Colin Bender.
(...)
Benders.
(...)
This guy's really good.
(...)
And if you just look at like Reunion,(...) this one thing, this one video, I mean, you'll get it. How talented this was seven years ago. Man, mind blowing.
(...)
Very cool.
(...)
Just hear it.
(...)
Reunion.
(...)
I think it's a Flash Bowl remix because this song is originally Flash Bowl but in Colin Bender's
(...)
might have
(...)
taken it or somehow, I think there's some kind of a little bit of interplay there between Colin Bender's.
(...)
Maybe not.
(...)
Flash Bowl is also really good.
(...)
He has a channel as well.
(...)
How do you just get to the Flash Bowl?
(...)
Right here.
(...)
Craziness, really great music.
(...)
Inspiring stuff.
(...)
Not as much modular but a lot of synthesis and really intricate drum programming and jazz influences. And yeah, it's really good stuff. Live instrumentation, multi-instrumental musician, very talented person.
(...)
So this is just all to residencies.
(...)
Getting fairly fatigued but I think my test coverage is good enough that I can assert that only the right user can manage residents. I could write a test now at the view level(...) that when you're making a post with invalid resident IDs,
(...)
you'll get an not authorized error, 403.
(...)
So let's just commit this.
(...)
And I did write the corresponding test with that.
(...)
(keyboard clicking)(...) With this.
(...)
That's what I should really do is just write the test right when I write the function and that way don't forget. Have I tested that already?
(...)
What did we do here?
(...)
This one, so to that point, I should write the test before committing this, right? Now that the view in processing the post from the form (keyboard clicking)
(...)
and perhaps even if it's valid, but this introduces a new path, the view can return no permission.(...) Let's double check what this is. Okay, and then this is a couple of helper functions.(...) I should write unit tests for these as well.
(...)
(keyboard clicking) For these helpers.
(...)
(soft music)
(...)
So let's do that. Now let's write one more unit test. I'll just grab something to drink and
(...)
I think we'll be able to call it a night.
(...)
I haven't seen the change. We're still at 800.
(...)
Wow, what's going on? What's going on?(...) There it goes. Almost 800 lines. This is a pretty massive pull request. I don't think I would ask somebody to review this. Yeah, thanks for stopping by Rebel. Get some good sleep. I hope you're well rested in the morning or whenever you wake up. Not everybody's a morning person, of course.(...) Yeah, glad to hang out and hopefully see you around. I'll try to be on same time tomorrow, a little bit earlier.
(...)
Yep, hopefully see you.
(...)
Have a good, good rest.
(...)
Okay, so we're at 900 lines, but I think this other unit tests will be good.
(...)
To write.
(...)
So we need a view, a test for the view.
(...)
And I'm going to somehow get probably
(...)
a better code coverage tool that'll kind of tell me in the pull request the untested lines. Maybe there's a configuration for a code climate. It'll say, "Hey, these lines are untested." But on my other project I'm using,
(...)
well, I don't remember what it's called. Maybe not coveralls. There's another one for code coverage.
(...)
That scans it. CodeCov, that's the one basically. So I like the CodeCov experience. It'll tell you right there in the pull request exactly what's covered.(...) Advocating that we use is my day job. I thought, you know, less is more. I thought maybe I'll just use one tool, CodeCov, since it's doing both. But okay, now we've got tests that are failing. Dang it.(...) Now is it just a CI?
(...)
Wow, a lot of tests are breaking now.
(...)
(soft music)
(...)
I think this is why I didn't add the reverse name earlier.
(...)
Is it testy?(...) I'm getting testier. I'm getting kind of testy and tired.
(...)
Shoot.
(...)
(soft music) This is really...
(...)
(soft music) Man, dang it.
(...)
(soft music) (soft music) Yeah, it gets right into the core Django, mild SQL query,(...) names to path and...
(...)
(soft music)
(...)
(soft music)
(...)
Yeah, I think it's that
(...)
when I created the reverse relationship residencies,
(...)
because it is a mini... (soft music) One resident can have many residencies.(...) There now is no longer a residency
(...)
helper on the resident model. So it really does boil down
(...)
to how I'm fetching the current residents.
(...)
So let's find this definition. (soft music)
(...)
(soft music)
(...)
Okay.
(...)
(soft music)
(...)
That was it, wow.
(...)
Glad that was not so bad. So we're gonna write a unit test for this and then call it night. It's almost midnight here.
(...)
Fix tests.
(...)
It's essentially fix
(...)
home.currentresidents.
(...)
(soft music)
(...)
There we are.
(...)
All right, so then Lissio work.
(...)
(soft music) Now with this view, I'm gonna just write a test for it.
(...)
(soft music) Resident activity form view. (soft music)
(...)
Which is under metrics.
(...)
And let me just check our outline here. So the resident...
(...)
If I get to the right module,(...) metrics tests.
(...)
All right, so collapses. So we've got resident, it's essentially a massive one. Resident activity form view test case is it's got everybody in there. So we've already got good setup data. The main thing now
(...)
is there's a new sort of failure case, so to speak. I don't know if this is the correct way from a behavioral standpoint, if I should return a 403.(...) But if somebody is putting in the wrong
(...)
resident ID into this form, it's suspect because there's a graphical interface that shows you the resident name. You don't have to think about the ID. So there's some kind of potentially malicious behavior going on, potentially possibly bypassing the form or something like that. So I think a 403 is warranted in this case. So that's what we need to test against. Now to do that, I believe just make it post to the form. So let's see if there's a test where we're making up. We have several tests where we're making post requests.
(...)
So if I have a test case where we're setting up some form data, I think that's the ideal one.
(...)
And maybe if I just describe this well enough,
(...)
co-pilot it and do it for me.
(...)
2.0) And this can be the home user or the general user.
(...)
2.0) But I think I should do it with the home user because I think the general user will get, there's another.
(...)
2.0) Maybe not, there's not another access control mechanism there for the general user. So let's just try a general user making a post request.
(...)
2.0) And I think we have one. So here's an example.
(...)
And it... not sure where it got the data from, but that was not quite correct.
(...)
Or is it?
(...)
Oh, this is weird.
(...)
Set up. Do we define the data in the set up? No. So we don't need to define self data here.
(...)
We just need to define data.
(...)
Otherwise the data might pollute other tests. I'm not sure exactly how it works.
(...)
If it would remain in the class.
(...)
Across the test functions.
(...)
Alright, and then here's where we use it. So let's try this again.
(...)
I think we're pretty good.
(...)
I believe I've covered the definition of the task that I set out for myself.
(...)
I didn't handle the UI UX part.
(...)
I think I need to reconsider the UI UX part.
(...)
So...
(...)
I'll just say it relates to...
(...)
And we'll leave it open. We'll think about the UI UX a bit. I have an idea for a management section of the site. Where administrative users will log in and actually manage all the homes. Invite users, probably assign the users to homes.(...) So that it might not be directly integrated on this.
(...)
Necessarily on the home page itself. Because I believe that would be a bit tedious.
(...)
Tap to go to each home and assign a user there. Then go to the next home and assign a user there. Particularly... So I go to home one.
(...)
I click home one. Then I click a button add user. And then I'm like, well, I also need to add them to home zero. Or if I wanted to add them to the group, that's another thing.
(...)
So I believe a management interface is what we're going to need for that.
(...)
Which we have in the previous prototype.
(...)
And I think I've already researched and I've found...
(...)
...Norn Health Design...
(...)
...Component Library...
(...)
...which has many user interface components. And I hope we can use this. I don't know yet. So I'm going to experiment with this.(...) And then that lets us set up pretty advanced layouts.
(...)
Which would be pretty ideal not only for a management... ...sort of back end, so to speak. Management dashboard or interface. But even perhaps our whole app. So we wouldn't quite be so looking like bootstrap anymore.
(...)
And we would have a lot of primitives.
(...)
And it seems that's what we're targeting. It's like more advanced user data management dashboarding... ...with reports,(...) navigation menus and stuff like that. So I think this would give us a very professional aesthetic.(...) As well as a lot to work with to improve what we offer in this project. So yeah, I think I'll go that direction. So hence I'm going to leave the UX considerations for a future task.
(...)
I might split this out and close this issue. But I think I've done most of the significant work here in this pull request. Now that tests are passing, I can commit the code.
(...)
[typing]
(...)
They were related residents, so to speak. [typing]
(...)
So I'll push this up to GitHub.
(...)
If you're interested, just for reference, the pull request number 86 is where all these changes are.
(...)
And it's almost midnight, so I'm going to go ahead and get ready for bed.
(...)
But I will hop on tomorrow.
(...)
Continue the work,(...) probably in the afternoon.
(...)
[typing] So about another five hours. Now granted it wasn't constantly programming the source code, but you know I have a few digressions. But yeah, this stuff it adds up. It takes a while. There's a lot to it.
(...)
It's nice to have those little digressions and distractions and conversations. So that's why I really enjoy the live stream. So yes, I know most of the viewers have hopped off, but I appreciate Rebel for stopping in and chatting. As usual, it's interesting conversations we're having.
(...)
Let's see.(...) Welcome to the channel.
(...)
I hope you have a good success on your programming learning journey. And anytime you need some more advice or peer review or collaboration, stop on by. I'm really interested in doing that, working with other people and seeing what they're building.
(...)
Good note, Chase. Thanks for stopping in. Really fun chatting. Thanks for the generative artwork.
(...)
Sharing that. [Music] And I think way earlier in the stream, scrolling back here. ZJ, yes, thanks for stopping in, hanging out, putting me in the background while you do your stuff. I hope you're doing well and have a good weekend. Get some good rest and get anything off your mind. If you've got something on your mind, let go of stuff for the weekend. It's always nice.
(...)
All right, looks like our CI has passed, so I'll probably merge this off stream.(...) But anyway, this has been another live code hangout.
(...)
Appreciate everybody who stopped by. I hope you're doing well if you're watching this on YouTube or wherever. And have a great day.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment