542 lines
48 KiB
Plaintext
542 lines
48 KiB
Plaintext
Episode: 4649
|
|||
|
|
Title: What did I do at work today? Part 3 Section 2
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr4649/hpr4649.mp3
|
||
|
|
Transcribed: 2026-07-31 16:15:59 (official HPR transcript)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
This is Hacker Public Radio Episode 4649, for 2026-05-28
|
||
|
|
Today's show is entitled, "What did I do at work today? Part 3 Section 2"
|
||
|
|
The host is Lee and the duration is 01:03:49
|
||
|
|
The flag is Explicit, and the license is CC-BY-SA
|
||
|
|
The summary is "Lee narrates a portion of his working day, this episode is section 2 of 2"
|
||
|
|
You are listening to a show from the Reserve Queue.
|
||
|
|
This show was submitted in July 2025 to cover occasions like this
|
||
|
|
where there are gaps in the schedule.
|
||
|
|
Hi, I'm Lee, today I'll be continuing to narrate some of my working day.
|
||
|
|
In the last episode I was testing a PHP API class and finally that it was failing
|
||
|
|
and the certain conditions which might indicate regression, I'll be continuing to debug
|
||
|
|
the issues today.
|
||
|
|
So anyway, back to my cake class, my cake test class, so if it doesn't exist, I'm saying
|
||
|
|
great with ID, great with ID and then I'm tracing it.
|
||
|
|
And then in my remove function, can I delete an object, it's my DB object class, I delete
|
||
|
|
an object, delete an object has been deprecated, so I don't worry about things, so in the
|
||
|
|
systems architecture, it was decided more recently that if an object is not linked to anything
|
||
|
|
then effectively it's dead anyway, and we don't care about unlimited orphaned objects,
|
||
|
|
just floating around in the ether, if they're not linked to something, they're actually
|
||
|
|
not there.
|
||
|
|
Right, so in the cake class, right, so I've done that, I've created that type in the constructor.
|
||
|
|
I know, well, so now I have to relate it to the to make it a type object, an object
|
||
|
|
of type system object, I've written a helper, I'm just gone back to my turn, I'm looking
|
||
|
|
for a system object, it's going to be far too many results, I'm just head piping that
|
||
|
|
to head, so that's 2059, and how do I want to relate that, I think the first relationships
|
||
|
|
available, and I think 1309 is the 101, is the type of so system, I want system object
|
||
|
|
to be the type of this thing, so first I'll create a system object, type, equals a
|
||
|
|
this data object, self system object type system object, actually I'll commit, keep things
|
||
|
|
in the same sort of idiom, and I'll just define that constant object type system object
|
||
|
|
type system object to notes, sound like it's going in circles, and that's two of defining
|
||
|
|
that's two of five nine, so I've created my object type system object, and then I'm then
|
||
|
|
saying system object type, link that with what relationship is, it's best if I want
|
||
|
|
for you, which is the role type, so just define that as well, it's a relationship that
|
||
|
|
defines a type and 309, so I'll link a cell role type, that's the constant, I'll link
|
||
|
|
it to my type, so there I've created this as a type, and now I'm going to do an export
|
||
|
|
definition where I'm just adding a cake, a JSON, so right, so fix a system object, adding
|
||
|
|
it to the system organization, because obviously every system organization needs cakes,
|
||
|
|
so we're adding a cake directly to the system organization, so the heading will be finding
|
||
|
|
a map thing, and then that I've got listed columns, so actually the last export definition
|
||
|
|
I copied from was quite over-complicated, so I used a, maybe the first one I set up, which
|
||
|
|
is a lot simpler, so I'm just adding a cake, it's the same relationship as it, and
|
||
|
|
there's one, five, one, oh, so it ends in 33, so just look that up in my test class, see what
|
||
|
|
that relates to, so dummy cake, so that is the correct relationship, the other one will
|
||
|
|
have been the wrong relationship, so I've got my cake definition, I'm defining a relationship
|
||
|
|
and defining type, heading, my thing is my label, so I'm leaving this cake and then what
|
||
|
|
I'm also going to do is do an action, so now I'm looking back on my documentation, which
|
||
|
|
is where it's all started, where I've been type 4 up, I've been the most recent thing,
|
||
|
|
and see what was actually saying this documentation is supposed to do, so it's a trigger,
|
||
|
|
trigger, and I'll define that to be an update, action, add relationship, it's going to be
|
||
|
|
7024, which is the type relationship, it's just the inverse type, so rather than is the type
|
||
|
|
of it has the type relationship, and then child, and then I'm going to specify this specific
|
||
|
|
type that I created for cakes, and at this point I am rather wishing that we were using
|
||
|
|
near 4 j, because then I wouldn't be hacking away in this language that means nothing
|
||
|
|
to anyone, I'd actually be hacking away in that we've defined ourselves, I'd be hacking
|
||
|
|
away, doing exactly the same thing, but I'd be using syntax and terminology that actually
|
||
|
|
other people would understand what we were doing, but I mean I can explain it at a higher level,
|
||
|
|
but I'm not the specific way, I'm implementing stuff, it's using our in-built graph database
|
||
|
|
functions and methods and way of doing things, rather than using cipher, that's it, so
|
||
|
|
you'll be using cipher if you're using a graph database like Neo4j, and then what we
|
||
|
|
termed the child is going to be the constant that I derived to find for the type of cakes,
|
||
|
|
so I'm looking, he's just looking at my test class for that, I define that constant, did I define
|
||
|
|
that constant yet, I've put it in my object range, file work, maybe I didn't actually put it
|
||
|
|
in my take test class, well here's a good way to find out just search for it, I did, all right,
|
||
|
|
I started putting it inside the cakes definition rather than wherever else, put it inside the cakes
|
||
|
|
definition class, and you know what, I've just, I've got a feeling that I've just put all this
|
||
|
|
stuff in the wrong place, I put it in the cakes definition, I should put it in the cakes database class,
|
||
|
|
so quickly doing an about, about turn, I'm grabbing those constants out cakes definition class
|
||
|
|
and putting them in the cakes database class, making sure I haven't doubly defined any of them
|
||
|
|
I don't think so, it does help that you have to find the stuff on the top and you actually,
|
||
|
|
you know, if you've doubly defined something, of course you do, but to put it all at the top,
|
||
|
|
you can just look through and you know what you've defined and what you haven't, and you know,
|
||
|
|
basically the most important thing is you know what you're using, what constants you're actually
|
||
|
|
using, whereas if it was in some other file, like header file, you'd have no, you know, you'd
|
||
|
|
have to dig a long way to know, actually what is this particular thing doing in the database,
|
||
|
|
what, what relationship is it using, what objects is it using, but because I'm only using things
|
||
|
|
I've defined in constants, I'm fairly confident about what the scope is of what this code does,
|
||
|
|
so I'll just go to my constructor and grab that nonsense that I put in the constructor
|
||
|
|
for the, it was the cake definition class and I'll put it in the constructor with the cake
|
||
|
|
database class, we have so much put it in the API user class, put it in the, it's hard when you
|
||
|
|
define lots of classes in one place, then in one file, this is always going to be the hazard,
|
||
|
|
sometimes it's more convenient to do so, to define more define some related classes in the same
|
||
|
|
because I, of course, the file cake test class is.php, now I haven't called it this class,
|
||
|
|
and often if I'm creating a file that's just one class, I'll call it something.class.php,
|
||
|
|
because then it's clear what you're doing, but then just as an aside, sometimes I'll create
|
||
|
|
a helper class inside other than the main class, you know, I'll create a secondary class,
|
||
|
|
and not showing PHP if you can or in the version that when I started coding this stuff,
|
||
|
|
whether you could nest classes inside each other in PHP, so only I know with the other,
|
||
|
|
worker doing visual basic, seems like you can do that, and though, therefore, you can
|
||
|
|
do that in C sharp, and I imagine that in a more, in a more up-state version of PHP, they
|
||
|
|
try to accommodate all the modern stuff, the modern languages do, so, but anyway, I'm not assuming
|
||
|
|
anything about that, and it doesn't, it's irrelevant to this particular instance, so anyway,
|
||
|
|
I know that that type exists, and I saw I was setting my export definition to, this was where
|
||
|
|
I jumped here, was object-type dummy cake, and it has this number here, which ends in 471,
|
||
|
|
I'm going to this, and I'm setting the child to 471, which will just make this thing that we're
|
||
|
|
adding to be a cake of the type cake, and when it's updated, it will set its type to cake,
|
||
|
|
so now I've actually got to write some code that will do that in the test classes,
|
||
|
|
so, it's will be in the cake, I've got a cake, a test data class, I've got rest API class,
|
||
|
|
I've got a database class, so actually it's going to be in the rest, the cake's rest API, so
|
||
|
|
add delete update, so I actually update delete update, that's all just to do with doing
|
||
|
|
cried operations, create, read update delete, that's what cried stands for, it's basically the
|
||
|
|
most basic thing stuff, so that you would be doing with data and any circumstance, so in the cake's
|
||
|
|
test class, I've got cakes, test data, so I guess we can just call the end, we can just
|
||
|
|
do play another, I probably don't need to add anything else in the cake test classes, I've
|
||
|
|
probably just going to the run tests script, and I'll go to one of my earlier tests, where I'll
|
||
|
|
just add it to the cake for the rest API, or update it, but I mean adding should be the same,
|
||
|
|
same as updating, so I'm just copying a load of code, and I've said, so I've got the section I
|
||
|
|
added earlier, link a type from object using actions, so I'm saying my nice cake equals test
|
||
|
|
data dummy cake, and result equals cake API add nice cake, so dummy cake will be my rot will be
|
||
|
|
the wrong definition, and then dummy cake will be a nice cake, all right, I'm slightly confused,
|
||
|
|
at what point is it deciding which JSON definition to use, so cake API add nice cake, so I look
|
||
|
|
in my test class, it's what does add do, it's an institution, so it's just posting it to the API,
|
||
|
|
but how does it know what definition to use, so I guess you need to use a different definition
|
||
|
|
for each one, so I saw there was all that stuff about setting up the definitions, so I've got
|
||
|
|
add cake for add cake 3, add cake 2, so actually maybe I should just have add cake 6, so
|
||
|
|
don't have a complete about turn here, add cake, I know this is to the database, it's not using
|
||
|
|
the rest API, okay in those what JSON definition to use, according to the entity that we're specifying,
|
||
|
|
so I'm looking up to see what the entity, where these entities have been defined, set entity,
|
||
|
|
entity equals cakes, right, so we can do in the set entity function, oh okay, so I think we've got an entity
|
||
|
|
one and an entity set, so see where else I'm in my run tests, I must be calling set entity,
|
||
|
|
yes set entity cakes 2, cakes 3, cakes 4, so this one will be cake 6, so I can just, this is
|
||
|
|
answering my question basically, so cake API set entity, cake API set entity cakes 6,
|
||
|
|
so it should use my definition which includes the thing that makes it add the type,
|
||
|
|
I just want to check with what my nice cake looks like in the test class, so this will be in the
|
||
|
|
date, test data, got dummy cake, it has a label, bake, description, icing, contains sizes,
|
||
|
|
recipe, so it's just a dummy cake, it doesn't have anything clever in it and it's only going to
|
||
|
|
look at the label, it's not going to look at anything other than the label, it's going to ignore
|
||
|
|
the description, it's going to ignore the date, it was baked, it's going to ignore what color the icing
|
||
|
|
was, so my whole test is, I've set the section link a type to an object using actions, nice cake,
|
||
|
|
equals test data dummy cake, cake API set, cake 6, post result is cake API, add nice cake,
|
||
|
|
and code is the status code, so first I'm checking that it's said to 01,
|
||
|
|
create the right state, why don't I am I over testing, I think I might be over testing,
|
||
|
|
I've actually all we all I care about is that firstly I get a newly created cake back, so cake
|
||
|
|
ID equals post result, forward arrow ID, so I've got my ID and then I want to just find out what
|
||
|
|
the type is for that ID, so let's implement in my test date, is it test data, and my cake API,
|
||
|
|
so where should I put this, I want to put, I want to put in my tests that I want to
|
||
|
|
check what the type is of something, but I don't want a hard code, I don't want a hard code here,
|
||
|
|
in my things, so API use a cake's definition, I could correct standalone function, I mean
|
||
|
|
there won't be the end of the world, I mean it would be, I mean it's like, it should be a date,
|
||
|
|
it's a date based function, sorry I'm in stupid, it's going to be a date based function,
|
||
|
|
so get type, so I'm in my database class, so get type function, get type object ID is in
|
||
|
|
put parameter, I say cake equals this data object, object, so idea is just wrapping it in my
|
||
|
|
wrapping the object ID, which is the number wrapping it into an object, which I can then do
|
||
|
|
in the things too, find out stuff about it, so I'd say my type equals a cake, a child, and then
|
||
|
|
real type, or self-wrote type, I think type, so it will be has the type that we're checking
|
||
|
|
this, so 7024, it has the type, yeah has the type, so 7024 have I defined this constant here,
|
||
|
|
pretty sure I wouldn't have, and I haven't, so let's just define it constant real type inverse,
|
||
|
|
because in this database system we have the concept of a relationship, every relationship has
|
||
|
|
an inverse relationship, so if the sky is blue then blue is the color of the sky, that is the color
|
||
|
|
of, it has the cut, it's the opposite of it, it has the color in real type inverse, it's
|
||
|
|
in 1994, and of course the fact the ironic thing is I'm going to need to test this text,
|
||
|
|
I'm not going to write a test, class to test the test, so I'm going to have to test the test
|
||
|
|
for a hand, and as well as I'm going to debug the test as well as using the test to test the
|
||
|
|
thing that I'm actually testing, and that's the irony when the testing tests get complex,
|
||
|
|
right, so I've got the type, and I just return the idea of the type,
|
||
|
|
and I should return the type ID, yeah and I listen, let's not call it, okay, get type say,
|
||
|
|
all call it is a cake, and then I can just test, so if type ID return, so just return a billion expression,
|
||
|
|
type ID calls it calls, and then this type that I defined earlier, object type dummy k,
|
||
|
|
it's just a long number, and it's full set for one, so it is a cake, we'll just compare the type with
|
||
|
|
that constant object type dummy k, but self before it, because it's a constant of the class,
|
||
|
|
right, that should be it is a k, we're just going to assert in our tests that it will
|
||
|
|
retake on us, so rather than assert true, what assert is a k, and pass it, the idea, in fact,
|
||
|
|
we can just pass it, post result ID, rather than put an idea in a separate variable, because it's
|
||
|
|
too much code, and actually what object is actually running this is the, from the cupboard of the class,
|
||
|
|
it's the k-state-based class, and what's my instance of the k-state-based class, such
|
||
|
|
look for the word k-state-based, so D-B, I'm just calling it D-B, by the way, every variable in
|
||
|
|
page P we prefix it with a dollar sign, and I haven't been saying dollar sign, but it's just because
|
||
|
|
my brain filters that out now, but I know it's just something that tells my brain, it's a variable,
|
||
|
|
or not, I mean I remember in basic, in the original basic, you would have the dollar sign
|
||
|
|
after the variable, so if it was a string, not if it was an inch, so test, I really like PHP,
|
||
|
|
I mean if you say it's an old fashioned language, but things that you can do like, you can just
|
||
|
|
put a variable inside a double-quited string, and nine times out of ten, it will just replace
|
||
|
|
that, it will just happily put the value of that thing into that string, and even if it's a complex
|
||
|
|
object, and it gets cast to a string, then, which, and I use that a lot, actually, because even
|
||
|
|
in my database object, the class I was mentioning earlier, I have it so you can cast it to a string,
|
||
|
|
and it intelligently finds out the name of the object, because objects can, the name of an object,
|
||
|
|
can be defined by the object itself, or it can be defined by a sort of label attached to that
|
||
|
|
object, which we call a display name, so it's very neat that you can just cast stuff to a string like
|
||
|
|
that, it's basically changing the type of an inch to draw us any other of which was string,
|
||
|
|
this by putting it in double quotes, and you can even do have like put an array, or a property
|
||
|
|
of an object using the arrows syntax, or an array using the square brackets syntax, inside a string,
|
||
|
|
and you just get a nice string out of the thing convert to a string with the variables inside it
|
||
|
|
converted, and it's just like, especially when you, in the old days, when you would be hacking
|
||
|
|
with HTML and PHP, it just seemed to do all the things in the most efficient way, but I
|
||
|
|
said, you can say that about any language, say that about par, or we can say about lots of languages,
|
||
|
|
and the truth is some of it is kind of unnecessary now, because the move has been away from
|
||
|
|
in the industry and practice away from rendering stuff in HTML, rendering the HTML with PHP
|
||
|
|
in and amongst the HTML, because a lot of stuff has a back end, which is purely PHP and a
|
||
|
|
front end, which is purely HTML and JavaScript, I guess if it's reacting might be type script,
|
||
|
|
but you won't be intermingling PHP and HTML quite as much as you might have been in the past,
|
||
|
|
when PHP was invented, so some of that cleverness is kind of lost, and actually it may
|
||
|
|
become some incumbents, anyway, I've asserted that, and I've saved it, and nicely sublime text has
|
||
|
|
actually got PHP parser, that it runs what it has an add on that does PHP parsing when I save the
|
||
|
|
file, so it's nicely telling me that there's a syntax error, tells me on what line it's on,
|
||
|
|
so yeah, I've just put a neat, a spurious equal sign there, so that's, that should be okay,
|
||
|
|
let's run it, let's run these tests, I was actually going to do that before, but I just got completely
|
||
|
|
sidetracked, at least I'm in the right folder here, I got up to the stage, I was going to run it just
|
||
|
|
to make sure that I actually ran before I actually made any changes, I hope PHP run, I'm in the
|
||
|
|
terminal here in console, logged into my dev server, she's running a bunching, so run, my piece is running
|
||
|
|
a coupon to the server, it's self, doesn't have graphical windowing system running on it, it's
|
||
|
|
purely the log-in, and I actually sit for the terminal or it exposes ports, which network services
|
||
|
|
accessing, most importantly, it's got the HTTP port 80, whatever, open, fact, just don't end that
|
||
|
|
local host, so as it's still in map on any box I've got, if I can, even a container I might try to,
|
||
|
|
as you shouldn't really, yeah, it's got port 80, it's got port 443, it's got the SMTP port open
|
||
|
|
for whatever reason, it's got the SSH port open, of course, I was all in the OK, it's got the
|
||
|
|
MySQL port open, got a feeling a firewall, another level wouldn't allow public access to,
|
||
|
|
mySQL port and palace, let's just test that in that media, and a certain number, and three, three,
|
||
|
|
six, so I should say, Python P3, and it's just filters, so that's probably the MySQL is not available
|
||
|
|
to the public, but where is port 22, 18, 4, 4, 3, so that's the SSH and the HTTP ports,
|
||
|
|
or open to the public, all the other ports I can see, like RPC buying is 1, 1, 1,
|
||
|
|
and the SMTP, they're not open to the public, and the MySQL is an open to public,
|
||
|
|
all right, back to what I was doing, I was just typing PHP run test, stop PHP, well it hasn't crashed,
|
||
|
|
it hasn't out of, out of hand crashed, now it's running all the tests, what's running,
|
||
|
|
what here we go, it has crashed now, create with ID, it's past too many arguments, so why,
|
||
|
|
what have I done wrong, let's look in my DB objects, in my database, object plus,
|
||
|
|
the right DB objects, such with great, with ID, I see it not, and I did, honey, I'm asking
|
||
|
|
it an ID in the name, you need two parameters, and what have I not passed it an ID in the name,
|
||
|
|
take test classes, I go to the Cape Test classes, create with ID, I passed it, and I did,
|
||
|
|
I haven't passed it a name, okay, what should I call it, Cape Type, some pass it a name now,
|
||
|
|
so it won't name that thing, it's run the test again, I do need the toilet break at this point,
|
||
|
|
some hit, like my head flans off, say that, actually I'm, that's been abandoned because
|
||
|
|
it's tried to insert something that was empty, because I've called the thing the wrong name,
|
||
|
|
yeah, I've just called, I've not called the SQL variable that's kind of the SQL string,
|
||
|
|
I haven't called it SQL, I couldn't read SQL, because I copied it from somewhere else,
|
||
|
|
now the time lucky made me, running those running off to the toilet, okay, I'm back and it's crashed,
|
||
|
|
again, it's telling me the SQL statement that crashed, I didn't wrap it in double quotes,
|
||
|
|
that was all, I, I don't need double quotes a single quote, so I tried to insert a string,
|
||
|
|
so my, my Cape Type was a string and I put it in a rescue or statement without the quotes,
|
||
|
|
so I'll run that again, see if it runs, and all these tests are starting to run,
|
||
|
|
well at least it's saying setting up the Cape definition, it's crashed again,
|
||
|
|
so this isn't, I'm going to one must be of type, Cape Type, so if some reason I'm passing
|
||
|
|
a Cape State base, when it should be an SQL database, which is fair enough, as a valid concern,
|
||
|
|
so I'm looking at this protected date, Cape State, my coffee is stained cold,
|
||
|
|
I still good, I, it's Italian, my skill, right, my skill must be of type, my skill, I in Cape State
|
||
|
|
base given, so I look at the cool stack, this was in Cape's test class, the line 213,
|
||
|
|
and that was in, yeah, 213, so I just scroll down to line 213, so what it was doing,
|
||
|
|
this, or Cape, the lead, or Cakes, I don't see the problem, I think this might be a regression,
|
||
|
|
I don't think this necessarily relate to what I've been doing, and as I've caught in,
|
||
|
|
introduced to a regression, so basically I've got unpassiated, I should be passing it a database,
|
||
|
|
so object and unpassiated, a Cape State database object, so it's easily that I got confused
|
||
|
|
between the two, I just don't, I'm trying to locate where exactly I did, make that mistake,
|
||
|
|
so runs test, the lead is in the delete all Cakes function, and then it was in the children function,
|
||
|
|
so it's getting the children of the Cakes, which was, yeah, 213, as I said,
|
||
|
|
so this all, this all is the wrong type, so this all is system object, child,
|
||
|
|
real system organization, how could it be a Cakes database, am I setting this data equals something
|
||
|
|
I'm setting these data data source, I'm setting DB to be the wrong, all right, I tell you what,
|
||
|
|
I am using DB, the word DB more than once, and that could be confusing the hell out of that,
|
||
|
|
yeah, it could be confusing the hell out of it, so I have in the run test script,
|
||
|
|
I'm calling this thing DB, and maybe that wasn't a problem before, but the moment it is,
|
||
|
|
so it just search for all instances of DB, and doing regular expression, backward slash,
|
||
|
|
dollar DB, see how many times I see it, so actually I find greater than sign, which stands for an arrow,
|
||
|
|
it seems to be in lots of places, so let's just call it something else, I mean,
|
||
|
|
one of the hell, just search for a place, just type it, just have to be careful that search is
|
||
|
|
for a place, it's not going to replace all that, I'm not overseeing that in that replacing,
|
||
|
|
all sorts of shared in mind too, DB, our place it with, and the worst thing with a search
|
||
|
|
in a place if it's part of another word, and then you end up, so I think I'll just, I'll
|
||
|
|
do separately the arrow, the DB arrow, I'll replace with Cape Database, Cape DB, Cape and the
|
||
|
|
Scored DB, so dollar sign, Cape and the Scored DB, in our place all, I forgot to put the arrow
|
||
|
|
and replace all, and then this one other place, we're gonna replace it, where I didn't use an arrow,
|
||
|
|
whereas when I was assigning it in the first place, so now as if there is any DB, so DB is nowhere to be found,
|
||
|
|
so that might fix it, it's just, you know, case in point, never use global variables,
|
||
|
|
ever, ever, ever, ever, you know, this, for system-wide stuff, there is this, and it's, well,
|
||
|
|
basically if you're using global variable, be damn sure it's part of the architecture,
|
||
|
|
and whatever you do, don't call anything else that global variable, especially if you're using
|
||
|
|
explicitly bringing that thing in, that using its name, okay, right, the first test is found,
|
||
|
|
price response with crated status code is not true, and I've got 500, so this is not good,
|
||
|
|
because the 500 means that the thing is crashed, luckily, we actually have a function for just,
|
||
|
|
a little script for just this circumstance, and it's called WTF, it's not, I know there is another
|
||
|
|
WTF on where it in repositories, but this script is not that, my own version of WTF,
|
||
|
|
and it tells me, if I, it looks at the look files, tell me what the fact where it was,
|
||
|
|
kind of access, offset of type string on string, and it's to point me to particular line of my
|
||
|
|
API, this is not what we call a graceful failure of this, in my API query, 9364, I'm quite glad
|
||
|
|
I'm running these tests, if nothing else, it's just going to help me fix the tests,
|
||
|
|
all right, look at the cool stack, this was add set column values, add values,
|
||
|
|
cannot access offset type string, on 9671 actually, I'm looking at the exactly where it went wrong,
|
||
|
|
all right, I'm completely confused, have I not got this feeling, I'm not updated, just thought
|
||
|
|
how I did it, right, I need to download, I've updated it in the repository from someone else's
|
||
|
|
changes, I should need to download these files again, to my local machine, so download file,
|
||
|
|
if some machines just download file, if you're a coder, download file, there's three classes
|
||
|
|
I've downloaded, I try to download everything else I see lying around, because if someone else has
|
||
|
|
changed their other than me, then it will have changed, it's just, I was the only person working on
|
||
|
|
this, then I know my supervisor has gone in updated it, to get something I've been working,
|
||
|
|
and then I've gone in trying to use it, if I'm working from the wrong version, then it's going to
|
||
|
|
be telling me, and my local cook is not going to match, so 671, that's better, I'm looking at
|
||
|
|
something entirely different, so cannot access offset of type string, so basically I've got a string,
|
||
|
|
I think something like it thinks is an array, except it's a string, how did that thing become a string?
|
||
|
|
So I'm calling the add function with a string, and it should always be an array,
|
||
|
|
so this is where I should do type checking, but because this type checking is recently introduced in
|
||
|
|
PHP, when I say recently, not that recently, but within the however many years since I've been working
|
||
|
|
PHP on PHP, so in the days when I learned PHP, I was not doing type checking, and I've just
|
||
|
|
managed to cope without doing type checking, in a lot of the code I do, but if you look at any
|
||
|
|
modern PHP, you'll see that they are specifying what type each of the variables is, suddenly in the
|
||
|
|
parameters of a function, and especially what type of variable their function returns, and see if this
|
||
|
|
was checking that an array was being passed, it would crash at that point, it would not come down to
|
||
|
|
the middle of the function, and then trying to do something funny with an array that wasn't an array.
|
||
|
|
I'm not going to update this to type check, because then it's a wink with the rest of the code,
|
||
|
|
you know, I can just make a new year's resolution wherever that, and the new code I write, I'll
|
||
|
|
use type checking. I mean, if in some of the code in the past I've just had manual type checking
|
||
|
|
where I've said, is this an array or not, and I break out if it's an array, because I was worried
|
||
|
|
about that, where it was a reasonable risk, I might pass it in the wrong thing,
|
||
|
|
but she was some sort of recursive function where it could be of different types that I'm passing
|
||
|
|
in depending on what level the recursion is at. Anyway, let's see, where am I calling this add function
|
||
|
|
called it in set cold values? So now I'm going to look for that one, some searching for Ion set
|
||
|
|
cold values, and I'm calling add this add, so actually this is quite a substantial thing,
|
||
|
|
I'm calling it in all different places, but luckily this tells me what line I called it on,
|
||
|
|
then 1, 5, 5, 2, so if it was a some definition, you know what, I think I've opened the
|
||
|
|
can of worms, because it looks like this could be all kind of stuff to debug now, and my
|
||
|
|
miss a good thing I've opened it, but basically I need to start a fresh and start working for
|
||
|
|
exactly what is going on here, because what I can do now what I can just do for the moment,
|
||
|
|
I'll just exit, if value is not an edge, I'll put a comment, say hack,
|
||
|
|
because then if I search later for the word hack, I'll know I've put this hack in there,
|
||
|
|
if value, if not is a ray value, then I'll exit with the value,
|
||
|
|
accept, and say what the value is, and I'll make print, whatever it was that I'm looking at,
|
||
|
|
I'm looking at a column at the moment, or something it calls itself a column, a call,
|
||
|
|
I'll just use the print off function just to output that to this, that object is screen,
|
||
|
|
as well, and exit, and I'll run my stuff again, that was in my other terminal window,
|
||
|
|
I'll run the tests again, oh this is a problem actually, because it's gone and
|
||
|
|
it's actually not going to output this directly to the screen, because it's an API,
|
||
|
|
in it I need to log this stuff, I can't just print it to the screen, so
|
||
|
|
wonder what I'm using in this, so yes I'm using my login class, so I can just call self-log,
|
||
|
|
set of classes at a trade, and login.trate.pshp second, I can log, in fact I can log error even,
|
||
|
|
so all right, this often happens, I jump around and I lose where I'm coding, I have to search
|
||
|
|
for encoding, so I mean you know note to someone who ever creates text editors, it'll be nice to have
|
||
|
|
a way of scrolling back, just irrespective of what you've been doing, just scrolling back to what
|
||
|
|
you're without undoing anything, just scrolling back, as she is, that is the way of doing it,
|
||
|
|
I just undo and it's scrolling back, but just without being able to undo, they could find what
|
||
|
|
go to the line I was last editing, or that I was last looking at, and maybe they're probably
|
||
|
|
a bit even sublime text has a way of doing that, so I don't know, so anyway I'm going to self-
|
||
|
|
log the value, I actually log the message, because I think that's a better function that
|
||
|
|
can actually I can pass it unlimited number of objects, and it will just nicely output that is,
|
||
|
|
I just don't want to see what the name of the log file is, so I know what to look at,
|
||
|
|
so it should be defined as a constant log file, so it's temporary API.log, which is not that,
|
||
|
|
name for it, so I'll go to my temporary directory, and I'll tell iPhone F, it's just a follow
|
||
|
|
the API.log, and run the tests again, so if anything comes out before it crashes, you know what's
|
||
|
|
interesting is that it's not given a 500 this time, it hasn't crashed this time, but that's probably
|
||
|
|
because I've extended before it actually got to the point of crashing, or I just realized something
|
||
|
|
I should, if I'm looking this, I should actually output strings, I can identify this part of it,
|
||
|
|
so I've put sub definition, now what should I call this? Yes, sub F, not a right, you know,
|
||
|
|
run that again, so then I can look in the log, that it will say sub F, not a right hopefully,
|
||
|
|
before it outputs the stuff that it does, here we go subnet is not a right, and then it's
|
||
|
|
saying that there's an array, so which is my columns, and then the value is it's saying,
|
||
|
|
it's what nothing is not happening any value, so it's got, what is my sub definition here?
|
||
|
|
Yeah, it lost, so where's it getting value from? Value, there's values, and it's
|
||
|
|
iterating through the values, isn't it? You know what, let's just hack in a fix, you know,
|
||
|
|
much as much as I like to really understand what's going on, let's just tell it if it's not
|
||
|
|
an array, just don't do it, this is how lazy we are, if not, it's array then continue,
|
||
|
|
well let's say let's say let's say let's say let's say log the fact we expect is an array,
|
||
|
|
and then we just say continue and continue the self-log error, I would actually like to know
|
||
|
|
where this value has come from, type equals value, oh look up, no, oh look it, not entirely sure
|
||
|
|
where it's getting that from, I just log error, it's expected in the array, sub definition,
|
||
|
|
so at least I can trace this back, it's expected, and I just run the tests again,
|
||
|
|
so if the test fails from something other than an array then I'll know that it's a problem,
|
||
|
|
but the test is all passing, all right now we've had a crash, try to add value, I do not
|
||
|
|
indefinition, let's come out in my log, so let's say sub definition expects it in the array,
|
||
|
|
and it said try to add value not indefinition, don't know if that was immediately
|
||
|
|
what happened before the crash, I can see they looks like it was because it's out putting the
|
||
|
|
it was just trying to add exactly the same thing where it was get updated cake,
|
||
|
|
it was a cherry alarm and cake, it was trying to get it, and then it's trying to add value
|
||
|
|
by d not indefinition, so let's say try to add value, try to add value key not indefinition,
|
||
|
|
set values, set values, set values being called, it shouldn't be called at this point,
|
||
|
|
because we're not, we're getting an updated cake, we're not adding it, so actually it was
|
||
|
|
may have been the previous thing that was looking at, so then it's crashed in a totally different
|
||
|
|
point, so I should do this, give this up, and do my dot ETF again, see where it crashed,
|
||
|
|
uncalled value error, and it's given me a line number 571, and sometimes you just find out where
|
||
|
|
it died and then just stick a bit of sick Apache metal over it, just gaff a taper,
|
||
|
|
it doesn't make tile off since, saying happened on 571, cannot be empty,
|
||
|
|
mySQL I query, cannot be empty, so I'm giving it some SQL, the Generate SQL is failing,
|
||
|
|
so this is no good at all, the Generate SQL is failing is something really up,
|
||
|
|
so where else is this using this, check up, they check unique, but actually my wish you
|
||
|
|
thought, do this at the end of this, if not SQL, then we, if logon error, not SQL,
|
||
|
|
look, stuff to look, found to generate SQL, this will be calling a log error function,
|
||
|
|
cannot give the error function like a parameter, some parameter, wow, it's difficult,
|
||
|
|
it seems to be taking all sorts of stuff in, at least it'll be nice if it logs that,
|
||
|
|
I think I've missed a semicolon or something, some color name, and then just run the test again,
|
||
|
|
my recognition has stopped churning away, it's now a new on fan mode, it's obviously cool down in here,
|
||
|
|
it's efficiently, I guess you could look at the log and it's, come up with that,
|
||
|
|
think about the SQL, don't tell it, it's helped put the hold down log,
|
||
|
|
correct for the word files, see what the error was again, argument query,
|
||
|
|
mySQL I query, I'm query, cannot be empty, I was wrong about exactly what was going on there,
|
||
|
|
at least I've proved myself wrong, it's two, nine, five, seven, one,
|
||
|
|
pointing me towards, okay, this is interesting, why am I calling query on mySQL I object,
|
||
|
|
I'm not calling DB run SQL which is normally cool, well at least some reason,
|
||
|
|
argument one cannot be empty so the SQL is empty, it's log the SQL,
|
||
|
|
I mean what the hell self, log, let's go, look message yourself,
|
||
|
|
let's go, generate it, let's go for query, and then the SQL itself,
|
||
|
|
oh cost it to a string, and then what it is we get something out, not in fact I'm going to put
|
||
|
|
some sort of delimter around it so that if it's empty string then at least we get that as well,
|
||
|
|
I'll just put double quote, some escaping that with a backslash, double quote and a double quote,
|
||
|
|
and that's just capital, that's let's be polite here, my log message,
|
||
|
|
tail it, and run the things again and look at the log and see what comes out,
|
||
|
|
right here we go, wow, it's a massive chunk of SQL that's generated, but I mean it proves that SQL
|
||
|
|
is that the SQL is an actual lump of stuff, it's not nothing but that, and then it says generated
|
||
|
|
SQL for query, nothing, so what's going on, what's that about, generated SQL query, all right,
|
||
|
|
so that was the previous one that was that, and then this one it's done, it's done nothing,
|
||
|
|
but why don't get, as I've called generate, I've logged something else in generated SQL for query
|
||
|
|
in the function of it, so when it returns SQL, there are some conditions in which it doesn't
|
||
|
|
return of value, what's my set error day, and it's my set error function, also logged the error,
|
||
|
|
it's maybe the problem that I'm using two different mechanisms for a point, there are one of them,
|
||
|
|
one of them is really for development, the other one is for like actual usage, and this is where
|
||
|
|
there's disparities coming up, I guess, so let's log error, let's actually log this error,
|
||
|
|
using into the log file, as well as adding it to the list of errors, which might actually get
|
||
|
|
reports to the user, we don't want it to report, don't want this to report to the user,
|
||
|
|
certainly some of these, you'll be logging more stuff than you'll be reporting,
|
||
|
|
and when I say the user, and what I've been using might just be, just get stored somewhere in the
|
||
|
|
system and someone uses the user interface to investigate what happened, so all right here again,
|
||
|
|
no such nested definition on 1905, in API.php, right, so this is on the no such nested definition,
|
||
|
|
there's no such nested relationship, so okay this is what it's failing, all right so we
|
||
|
|
without me going to the deals of why, even with myself, why it's happening,
|
||
|
|
just look at where that's happening, so no such nested relationship, I mean this does point to
|
||
|
|
like add data or something, so let me look at this, I can see what the object idea is,
|
||
|
|
I've got a Python program around myself, let's me explore an object in the database and it's
|
||
|
|
not linked to anything, should it be linked to something, so it's got, on which JSON definition
|
||
|
|
isn't using for this test, so get updated cake via API, that's the name, that's the section,
|
||
|
|
so look at the run tests, search for that, get up, don't catch my API, K-K-P-I get,
|
||
|
|
so she can get, so we haven't set the entity at all yet, before like 195,
|
||
|
|
search for the word entity, it first turns up when I'm trying to update things that I haven't,
|
||
|
|
so we're just using the first definition, so I can look right there at that, at the export definition,
|
||
|
|
we have got what's called a multi definition, we have got what's called a sub definition,
|
||
|
|
so this could very well be the sub definition that it's having a problem with, and it's actually
|
||
|
|
could be because because I've found to define this sub definition, because this is where it was
|
||
|
|
failing before expected and now I set call values, although did that happen immediately before that
|
||
|
|
and that that's 449-58 seconds and this last error was 450 and 4 seconds and no,
|
||
|
|
it was not immediately proceeding yet that happened, so or how can I, I don't know how contest this,
|
||
|
|
that's my hypothesis, what is it, notice the recipe that is getting, I could tell you the recipe
|
||
|
|
out of definition, I might break the other tests and you can't easily comment stuff out, Jason,
|
||
|
|
you know, it looks like a definite regression, because this did use to work, some reason it's not,
|
||
|
|
so I mean, the biggest thing for me to do is find out why it's not, I think it's to do
|
||
|
|
the sub definition expecting an array, that's 1, 5, 6, D, why actually I don't need to know what
|
||
|
|
line it's out, can you search for it, you feel like so sub definite or expected an array,
|
||
|
|
you know, here we go, so the question is, why is Bush, so I just want to be lazy by just patching it
|
||
|
|
and, you know, it's not going to, let me patch that fix it by patching it, I've got actually figure out
|
||
|
|
what what's happening, you're still going to look at this, export rates, things sub diff,
|
||
|
|
shun spelling is right, so vowel call is, I think, called vowel call value of column
|
||
|
|
or something for whatever reason, it's what it's called, it's sub definition, so let's look,
|
||
|
|
look for all instances of the word sub definition, let's hear it, we're right there,
|
||
|
|
fetch sub definitions, so I've got a feeling, we're using fetch sub definitions to
|
||
|
|
deal with this situation we've got sub definition and then we're passing it, we're passing it
|
||
|
|
an array and then what we do with that array we're getting a map of things and then we're just
|
||
|
|
processing it as if it was, as if it wasn't a sub definition as if it was a normal top-level definition
|
||
|
|
because this is all about having a nested object that we're an entity that has a nested part to it,
|
||
|
|
so I don't know, for example, a customer has an address and then the address itself might be an
|
||
|
|
object which has a top line and a second line in the postcode, but you might want those to be
|
||
|
|
returning like as a nested object, you know, a nested in the JSON under an address key,
|
||
|
|
all right, and in number two I look right, so that shortly, right, I have to decide now
|
||
|
|
whether I take a break and document just where I'm at, so I think this is possibly a good idea,
|
||
|
|
so I don't think I'm going to flower into this and get in the major answer, so I'm bringing
|
||
|
|
up Joplin and you don't, you know, it's fixed everything, all in one go, you know, that's
|
||
|
|
success is never guaranteed, then you think you do sometimes you just document the problem and come
|
||
|
|
back to it, what folder are we looking in the API folder, so I knew you know, I call it Deepug API,
|
||
|
|
I've already got one called API Deepug, and what was this? This was something else entirely,
|
||
|
|
and that wasn't something else entirely, something related but not this, so I'll call this something
|
||
|
|
more meaningful, so cake test by hell with sub-death, and that's, I try to make the name
|
||
|
|
for note not too long, because then it doesn't fit in the column of notes in Joplin, unless you
|
||
|
|
really stretch that out, but then it's taken up too much room, you know, got room to write the note,
|
||
|
|
after them turn off the preview, because that takes a half the screen, don't type it in mark
|
||
|
|
down, so I just note down the name of function fetch sub-death missions, put that in that text,
|
||
|
|
I'll just look down the errors that I'm game and what log far I'm looking in, so putting those
|
||
|
|
in triple that text, and I know it's sometimes it helps if you just put tell it it's plain text,
|
||
|
|
and the mark down there's a bit of cumbersome to do that, but otherwise it's syntax highlights it
|
||
|
|
when you preview it, it doesn't matter that I don't care, I don't care, it's honest, I'm
|
||
|
|
looking at it, I should let it, if it wants to syntax guests or what it thinks it is and syntax
|
||
|
|
highlighted in whatever way it thinks it wants to, go ahead, just be honest, I don't know,
|
||
|
|
half a half, do we really want, I think, guests, at anything, do we want Joplin to be guessing?
|
||
|
|
What, or have a standard way of syntax highlighting, or do we want that when we create
|
||
|
|
block quite a block of unformatted text that we just wanted to be playing without syntax highlighting,
|
||
|
|
suppose it's convenient, if it guesses what it is and it syntax highlights it or it has some
|
||
|
|
sense of default syntax highlighting, and at the same time it's a bit annoying if it is just standard
|
||
|
|
text, you would kind of want it to default, standard text, and let's we specifically say
|
||
|
|
backtick, backtick, backtick, SQL or backtick, backtick, PHP, because otherwise I've got a
|
||
|
|
type backtick, backtick, backtick, text, and only at that point it's not syntax highlighting,
|
||
|
|
and because it's a log file, it's going to have the mixture of all these stuff, so it's best
|
||
|
|
to treat it as text, anyway I've just persuaded myself to put the word text there, so it's pasted
|
||
|
|
in what was happening in the log file, let me describe it before my brain completely melts,
|
||
|
|
so I'll document what part of the test was failing, so test failure, is double hash symbol, what
|
||
|
|
pounds symbol, just to make that heading to, so a reason, and basically the reason is because
|
||
|
|
sub-definition is getting past nothing or string string when it should get an array, so
|
||
|
|
it is going wrong, go wrong and focus, find that bit where expected, and the array, so I'll tell
|
||
|
|
it what a line, which is include that bit of code, about sub-definition, where kind of sub-definition,
|
||
|
|
so I've included that, is put loads of tabs in there, at the beginning I can thankfully select
|
||
|
|
and shift tab to bring it, get rid of all that unwanted indentation, so we're not Python-I,
|
||
|
|
right, the reason sub-definition is getting past nothing or string when it should get an array,
|
||
|
|
so it's going wrong, it's maybe not the root cause, and we do the WTF, so I can just get a copy of the
|
||
|
|
crash, there was given a sum that's the recent crash and not some other crash, because yeah that's
|
||
|
|
I think that's the reason one batch run the test again, let it crash, and then I'll do WTF again,
|
||
|
|
and it should be five past six, so it's waiting for that, so the first test is passing,
|
||
|
|
it's not completely screwed, and then that was a five past five because that's UTC,
|
||
|
|
and it's currently British summertime, where I am, so fatal error, that's my heading,
|
||
|
|
and then I'm pasting in what the fatal error was, so right at the top, I'll say I think we should
|
||
|
|
look here, because this is where I can maybe have narrowed it down to, so I might be
|
||
|
|
look here as I'm heading, maybe look here, I'll just say maybe look at the putt the name of the
|
||
|
|
function in Bactics, in and the name of the file is API query.php, and I'll just say log, and that's API.log,
|
||
|
|
it's my heading, it's just tells you what's where that is, it tells you the test failure,
|
||
|
|
it tells you the reason it tells you the fate to error, okay I mean I've documented that now,
|
||
|
|
exactly where, where I'm right, because I'm hungry and it's so kills I need to take,
|
||
|
|
and it's not past my bedtime, let's past the time, I should be working really,
|
||
|
|
it's start late today, obviously I had the meeting in this morning, so they're trying to
|
||
|
|
remember how much time I've actually spent in this, it's exit out of this dev server and back
|
||
|
|
my local machine could code, it could work at the log, press end, so we're using some of that
|
||
|
|
cat or something that nicely could nicely output stuff when you cat it, and it gives you keys
|
||
|
|
that sort of less or keys and it's time and ending line numbers, the thing that you're looking
|
||
|
|
at is highlights it nicely in different colors, quite sensibly, I'm looking at
|
||
|
|
fourth of July, so I'm not including what did this morning, so I'm going up to three,
|
||
|
|
30 are stied, the 1, 2, 3, 4, 5, 6, 7, 8, 19, so it's about two and a half hours,
|
||
|
|
and it wasn't like checking my name out, but not that long, so I think I just
|
||
|
|
looked down, turned, I did two and a half hours on that look, I try to look it in as much
|
||
|
|
there as I can, and I've already got one for today, so I had to put a meeting that already
|
||
|
|
locked, just try to add the same day again, so it's like hours
|
||
|
|
right in the try at the test, I saw first what I did was I documented the action
|
||
|
|
facility of the API, try adding tests and noticed failure in API tests started investigating
|
||
|
|
problem detected fatal error when processing sub definition, and actually I've got
|
||
|
|
feeling this and may have come across this error, but just not noticed it hadn't been
|
||
|
|
and explicitly noticed it was a problem, but certain thing the stuff I was working on with
|
||
|
|
creating a swagger definition, and I've denied the API definition programmatically,
|
||
|
|
and some of the entities were failing and it might well be not failing to produce
|
||
|
|
documentation but failing when I was actually testing them, against that definition using a
|
||
|
|
utility, called postman, and it was not retrieving anything, but I do think it was giving
|
||
|
|
a 500 error, so maybe it wasn't the same error as this, but it's not bad thing that I'm now
|
||
|
|
getting into the detail that I'm getting into the weeds with it, and really because I haven't
|
||
|
|
been doing, I'm working on this for well over a year, maybe two years, even since I was
|
||
|
|
what since I was doing, since I implemented this the first time, so it's good that I'm really
|
||
|
|
seriously getting back into and seeing what's going on and updating the tests and stuff,
|
||
|
|
seeing where it's falling down, especially as I've had some edits from other people
|
||
|
|
to my code, so they could introduce regressions that other people were not even
|
||
|
|
that the people who did it were not aware of, so there we are, so an overall
|
||
|
|
today I've done four hours for this company, for this particular company that's
|
||
|
|
having done anything for the other company, anyway so I don't even leave it there,
|
||
|
|
I know where I need to get started next time, next time I do this, so I'm closing that down,
|
||
|
|
shutting that down, can take my pill, going to have something to eat, because there's
|
||
|
|
past six o'clock, going to check messages and discord and stuff, but I can do that in my iPad,
|
||
|
|
so I shut my PC down now, so I stop recording now.
|
||
|
|
You have been listening to the Hacker Public Radio podcast, at hackerpublicradio.org.
|
||
|
|
Today's show was contributed by a HPR listener like yourself.
|
||
|
|
If you ever thought of recording a podcast, then visit the HPR site to find out how easy it really is.
|
||
|
|
Hosting for HPR has been kindly provided by anhonesthost.com, the Internet Archive, rsync.net, and the HPR Community Content Delivery Network.
|
||
|
|
Unless otherwise stated, today's show is released under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
|