« first day (3496 days earlier)      last day (1470 days later) » 
02:00 - 11:0011:00 - 23:00

mr5
2:03 AM
MS Teams
edit failed
fucking ugly chat system
 
2:19 AM
why do people us MS Teams?
is it good?
 
mr5
no
I have no idea why my employer chose it.
 
sad alpaca :/
 
 
2 hours later…
4:45 AM
Ben Popper on May 12, 2020
We dig deep into .Net and prepare a live episode to raise funds for those impacted by the COVID-19 crisis.
 
 
2 hours later…
6:35 AM
hi
 
6:51 AM
why it is showing error when I am trying to pass parameter to method along with casting
((child)parent) // still showing error
can not implicitly convert...
 
mr5
what were the types? is child : parent?
is the param type either parent or child?
 
yup
param type is child
 
good morning
@juanvan That answer is "something is wrong" without even the smallest visual edit
 
7:08 AM
ok found the issue @mr5. Thanks xD
good morning @ntohl :)
 
good morning
 
7:20 AM
@MarshallTigerus resharper have a stylecop plug-in. Resharper's option system to implement rules is very nice. Helps visually a lot. Tho I don't know if it's the same with the stylecop plug-in. I would just don't bother with stylecop, and stick with Resharper's rules
 
how was your weekend?
 
morning
 
morning ;)
 
7:42 AM
fine. Lot of CS:GO. Got my new controller, so we played a little Rocket League
went to our "croft" or how do you call it with kids
you?
 
nice! :D
me binge watched youtube as always
 
7:57 AM
Fucking JSON
Doesn't allow annotations, but a dot in a property name is perfectly valid
also good morning
 
mr5
JSON is not meant with that kind of purpose.
Maybe what you want is XML instead?
Adding annotations is kinda doable in JSON but you will need to put more structure in every property.
 
8:11 AM
Annotations in JSON? Why?
 
mr5
My daily dose of news taken from 9gag
 
xD
 
mr5
What could be more worse knowing that there's a near blackhole in our solar system
 
nothing, I guess!
the ultimate final boss
 
mr5
we need to propel our entire solar system away from it.
or create an artificial world.
Elon is our best bet.
 
8:15 AM
I don't think it's in out solar system
but a star system
haha
 
we need only propel Sun and Earth and Moon
we leave no man behind. But planets...
 
mr5
@Shad it's 1000ly away. In cosmic scale, it's like in our backyard.
 
hmm
 
“It is most likely that there are black holes much closer than this one,” said Avi Loeb, director of Harvard’s Black Hole Initiative, who wasn’t part of the study. “If you find an ant while scanning a tiny fraction of your kitchen, you know there must be many more out there.”
 
8:40 AM
@mr5 @Hozuki I don't want annotations, it was just for the sake of comparison. Why the fuck do I need symbols in property names?
 
Because it's valid to have property names with symbols..
 
It just makes adding properties to the JSON much more convoluted.
 
How so?
 
Yes but the decision is so arbitrary
 
It's really not. JSON comes from JavaScript Object Notation. The {} object in JSON is essentially a key/value dictionary. You can put in keys that have arbitrary symbols in them, because a dictionary supports that. That's why you can do this.
 
8:42 AM
Well, the logical way to handle a property, let's say if you have something like {foo:{bar:{gee}}}, would be something like foo.bar
 
You can do either way.
 
but it goes further, and you can add {"foo.bar.gee":"whatthefuck"} which is totally valid
 
Yes, it is.
How you access your data is key here.
 
right, if that was illegal and JSON had proper notation then it would be much easier to use
 
myObject.foo.bar.gee in JS uses the . for referencing so the first example will work
 
8:44 AM
You could do stuff like foo.bar="lol" and get the proper nested value
 
myObject['foo.bar.gee'] is just a key lookup
@HéctorÁlvarez But that's now how it works. You're confusing something your programming language does with something that belongs to the data.
If your programming language interpreted dots as keys of a dictionary it would work.
(No sane language does this)
 
It's not versatile
how am I supposed to add a new property nested down
it's impossible
 
I'd argue it's very versatile. You can write ANY data in JSON and not limited by arbitrary decisions to make life a little easier.
What do you want to do? It's definitely possible.
And in what language? C#?
 
Given this: `{"foo":{"bar":"gee"}}`
Achieve this: `{"foo":{"bar":"gee", "lol":"asd"}}`
Technically this is JS rhino
or Nashorn if I feel brave
BTW this is not valid: {"foo":{"bar":"gee"}, "foo.lol":"asd"}
 
var obj = {"foo":{"bar":"gee"}};
obj.foo["lol"] = 1;
 
8:51 AM
Sure it is.
var obj = JSON.parse('{"foo":{"bar":"gee"}, "foo.lol":"asd"}')
console.log(obj['foo.lol']);
 
@BlackSquirrel Black squirrel doing black magic again. Cheers
@Hozuki Again, that's not valid
 
var obj = JSON.parse('{"foo":{"bar":"gee"}, "foo.lol":"asd"}')
console.log(obj['foo.lol']); // -> asd
console.log(obj.foo.bar); // -> gee
Sure it is. Run it in your JS engine.
 
hugs
 
It's OK for your example
But it needs to be run on a loop without any direct access
(for my use case)
 
It's certainly possible. Tell me what you want to do, specifically.
 
8:54 AM
I send a JSON with installation steps, now they want me to perform an atomic operation that runs validations and adds the relevant info to the JSON with a simple structure, basically all the steps and messages in one single property, which someone else will read on a loop and will print everything on a document independently of how many fields are there
 
Sure, that can be achieved.
 
There are properties with names that include tildes and other special characters like this: �
 
nice logic <3
 
That's fine.
 
It's scary
 
8:56 AM
Hozuki is legend
 
Because, look:
var o = JSON.parse('{"�":{"bar":"gee", "lol":"asd"}}')
console.log(o['�'].bar);
console.log(o['�'].lol);
This is perfectly valid.
 
you can do it!
 
yes I know it's syntactically correct
that's far from "fine"
 
let aliens understand you
 
it's like bungee jumping. It's not fine.
Sure, nothing wrong will happen to you
 
8:57 AM
Well, I can't solve your feeling of dislike/contempt towards JSON... just the technical stuff, I can do.
 
but you are FUCKING JUMPING OFF A BRIDGE.
 
There are people that do that for fun, y'know.
 
like you! ^
xD
 
So what you're saying is... Fucking Javascript
 
There are also people who enjoy JS apparently
 
8:58 AM
@HéctorÁlvarez I don't believe you
 
Yes, I prefer JS over C# to be honest.
 
wow
 
REEEEEEEEEE
 
no typescript?
 
8:58 AM
||votekick Hozuki
 
<user> voted to kick @$0
2
 
fucking A*
 
mr5
don't you have any rights to restructure the annotations of the properties? This would be less awkward and more fit to JSON format if you remove the weird notations.
 
Yes, TypeScript is the best one for me.
 
mr5
Abide to KVP
 
8:58 AM
Thanks James for demonstrating the superiority of JS
3
 
But having to pick between C# and JS? Definitely JS.
 
I like having strong boundries in the language I use
 
Gimme strong typing any day
 
I prefer strong typing, too. That's why TypeScript is perfect for me. It combines all the pros of C# with all the pros of JS.
 
8:59 AM
that's why I asked :3
 
pros of JS: Unhandled System.NullReferenceException
 
Typescript is good, agreed
 
lol
not defined
eww
 
mr5
Is typescript just a transpiled language?
 
Yer
 
mr5
9:02 AM
I mean, is everything you would write to it would just be transpiled to JS?
 
Yep
 
mr5
that sucks.
 
Does it? It means it works with the entire JS ecosystem and every JS engine out there.
That's a huge, huge, huge plus.
 
I never understood one thing
if TS is like superset of JS
how TS code would be transpiled to JS?
didn't sound logical to me, when I first read
 
So it can run in browsers
 
9:04 AM
Basically just fuck the types off
And then it's done
 
hmm
 
That, in a nutshell.
 
Because javascript lets you tag arbitrary shit onto arbitrary shit
 
lol you so funny
 
So normal class types jsut become objects full of random other objects
 
9:05 AM
@BlackSquirrel That didn't work, it added foo[\"lol\"] at the root element
 
isn't this how programming was like earlier?
functional programming
Lisp etc
working with barebones
 
uh
I'm gonna say no because it still supoports objects
 
@Shad You instance a {{{{{{{{{{{{{{{{{{{{{{{{{{{horse}}}}}}}}}}}}}}}}}}}}}}}}}}}}
 
xD
 
@HéctorÁlvarez works in my browser console, what can I say ?
 
9:07 AM
That basically means, @HéctorÁlvarez, you did something wrong.
 
Maybe the issue is Rhino
 
No, no, it's not Rhino. It's you. :-D
 
mr5
remove the weird notations and abide to KVP and you're good to have annotations in JSON format.
 
@HéctorÁlvarez Looks like you did something stringy? in your loop.
Hence the escaped quotes
 
9:10 AM
@BlackSquirrel Even I can tell this is wrong
 
I don't loop, I added the string just like you did
 
var obj = {"foo":[{"bar":"gee"}]};
obj.foo["lol"] = 1;
Hector try that
Note the addition of the []
 
that's how it is right now
 
Actually
Looking at your requirement a bit more
Try obj.foo.lol="asd";
 
that added foo[0].lol:"asd"
that edit was done first of all, it adds the full string
I am starting to think the problem is with the operation
 
9:14 AM
Yeah
 
That works, but obj.foo["blah"] allows you to be dynamic with "blah"... var propname = "lol"; obj.foo[propname] = 1;
 
if you have an actual object parsed correctly, I'm fairly certain that should work
JS is basically typing everything dynamic and hoping for the best
 
agree
 
Somewhat handy if it works, but horrifically dumb and can go to shit extremely easily
 
And yet somehow it's everywhere ...
 
9:17 AM
because you are awesome :D
 
Bit like a virus...
David Icke probably thinks Brendan Eich is a lizard alien...
 
I would like to become one too then..
 
let me try an alternative
 
mr5
I hope your next alternative would not use weird symbols just because JSON was derived from JS
 
9:32 AM
@BlackSquirrel nope, that's too advanced for Rhino
your first example worked
with a different operation in the tool
 
Always willing to learn, what is the tool and what is the operation?
 
9:56 AM
Fucking royal mail
 
mr5
tomorrow, our employer will hand out our Mac to us.
goodbye day shift!
I'll be playing games allday knowing that I could procrastinate even more.
jk
hello my employer if you ever read this, izz just a joke.
 
I had 2 classes, one for create and one for update
in create method same lines of code were there as there were with Update (only slight difference of one line)
I decided to common them out to a single method
for this I created a base class
create : base , update : base
and my method

`X(Base b)`
now at run time I check which type is b and do the logic accordingly.
was my thinking okay?
 
mr5
in my experience, it always result to a bad inheritance. I tend to separate those two logic every time I encounter it.
 
:(
 
(:
\o
 
10:08 AM
I thought I had tried something based on my knowledge
hi hans
 
hey
 
@mr5 logic was 99 % same
 
mr5
the boilerplate is negligible since it's only present at exactly two files.
 
say something more?
I am stupid?
 
everyone is
 
10:10 AM
you are shad
 
mr5
the tradeoffs will boil down with semantic vs ...ughh
logic?
@Wietlol help me
 
the tradeoff is semi-duplicate code against separation of concerns
 
mr5
semi-duplicate can be worded as boilerplate, no?
 
is it okay to choose semi-duplicate code once in a while?
 
nope
boilerplate code is different
you can have boilerplate code without duplication
and you can have duplication without boilerplate code
 
mr5
10:12 AM
@Shad yes especially for DTOs
 
I did that only!
CreateRequestDto
and UpdateRequestDto
 
although, the reason why the boilerplate code exists, is often also a cause for duplication
 
both have same fields
 
mr5
noice
you're doing a good job
 
you serious?
:D
 
mr5
10:13 AM
yeah
 
@Wietlol once said I shouldn't do it
and keep Create and Update separate
 
@Shad what you want to distinguish between is duplication of code and duplication of effort
 
we have had this conversation before
but here I am again
 
why are you here again?
 
I sooo wanted to use run time polymorphism in my project
 
10:14 AM
you want to use language features, not to solve problems, but because you want to use those features?
 
no I want to solve problems with the use of language features (if there is a way to do it)
as I said
 
what problem are you trying to solve?
 
I create a sinle method for CreateOrUpdate(BaseClass b)
 
mr5
duplication
 
I needed to common out the code
yes duplication
 
10:15 AM
is it duplication tho?
 
X lines of code in my CreateEntityMethod(CreateRequestDto)
 
can you share that code?
 
X+1 lines of Code in my UpdateEntityMethod(UpdateRequestDto)
sorry, I feel shy
can we talk abstractly?
 
nope
 
....
X properties in CreateRequestDto field
X + 1 properties in my UpdateRequestDto field
so I hope my thinking/approach was okay
 
10:17 AM
without code, I cant tell
 
I use AddOrUpdate methods all the time. It adds a new entity if id doesnt exists, it updates if it does exists. It significantly reduces duplication of code
But totally depends what your doing
 
mr5
I tend to think ahead in time when I'm implementing CRUD at local storage. Suppose there's an additional field that would be added to Update or Create, now, if I made a common method for both operation, the adjustments would be ugly.
 
yes it is something similar
@Daniel but for Update I am checking out other dependent stuff
 
For me the difference is one line, the first where it either news the entity up or fetches it from the db
 
over all it is under one method
 
mr5
10:19 AM
yes that AddOrUpdate is a common thing in most of the libraries I am using.
 
so I just do now...
 
mr5
It's also common in Android
 
if(b is Create)
//Do my create logic
if(b is Update)
//Do other stuff
so I solved code duplication using inheritance and runtime polymorphism, yeah!?
 
ye... I would avoid that as much as possible
 
...
 
10:21 AM
you are not using polymorphism here
 
I am!
 
if you would, you would do b.Execute()
 
I don't get it
 
Create's execute method would then have the create logic
 
mr5
it's inheritance. you inherit a common method.
 
10:21 AM
and Update's execute method would then have the other stuff
 
What is the extra property in your updatedto?
 
mr5
polymorphism is about type morphing from base to derived.
 
what you are doing is basically a switch case on the type
 
Id
:P
 
Why not just have an AddOrUpdateDTO. If id == null then create else update
One dto, one method
 
10:22 AM
^ this is what my senior said
xD
 
but I used inheritance :(
 
Checking types is not a gd idea for this situation
 
the switch can also be done based on type
but that still has the switch (or if else chain)
which is really a bad habit
 
:(
 
10:24 AM
it violates Liskov
and open/close
 
@Daniel so I am stupid?
 
I suppose the latter is more important
@Shad everyone is
 
You're not stupid
 
"Checking types is not a gd idea for this situation"
when will I learn this?
@Wietlol okay
 
It'll come with experience
You're not stupid
 
10:25 AM
ok <3
 
after you did it that way and realized that it is bad
 
^^
 
I did it that way... and realized it was bad
 
really?! :O
 
We've all done stupid shit, im still doing some stupid stuff. We're all learning
 
10:26 AM
if you are not doing stupid shit, you are not learning :)
 
so should I revert that thing?
or keep it in my project?
 
mr5
if you are not learning, you are doing stupid shit.
 
well... I still want an example piece of code
 
@BlackSquirrel Microfocus Operations Orchestration. The tools that failed were all the default operations, the one that worked was the user scriptlet.
 
mr5
var stupid = new Shit()
 
10:27 AM
I can again given an abstract one...
giving
 
dont give abstract examples
 
mr5
shad wouldn't let the internal code to leak =P
 
give concrete examples, derive an abstract problem, produce a generic solution
 
Basically, this is an orchestration environments where you use encapsulated operations programmed in Java, and build upon them through flows.
the operations simply don't work
 
//Service

CreateServiceMethod(CreateRequestDto Child1)
{
  CommonMethod(child1)
...
}
UpdateServiceMethod(UpdateRequestDto child2)
{
CommonMethod(child2);
...
}
/////////////////////

CommonMethod(BaseRequestDto b)
{
if(b is CreateRequestDto)
//Call Create method in data access layer
else if(b is UpdateRequestDto)
//Call Update method in data access layer

...do common stuff...
}
^see
This is what I have done overall
is fine?
 
10:32 AM
so...
what is the common stuff?
 
validations
 
also...
CreateServiceMethod(CreateRequestDto Child1)
{
	//Call Create method in data access layer
	CommonMethod(child1)
	...
}
UpdateServiceMethod(UpdateRequestDto child2)
{
	//Call Update method in data access layer
	CommonMethod(child2);
	...
}
/////////////////////

CommonMethod(BaseRequestDto b)
{
	...do common stuff...
}
so, the validation stuff... should that be in a validator?
 
there is more to it then what I wrote
I have used Transaction
of entity framework
so I am even calling a different service (I have put that in common stuff as well)
I put most of the things inside CommonMethod
and it is now like
return CommonMethod(child1)
 
so, what is the content of CommonMethod?
 
Transaction!
in brief, I call a third service and create it
but in case of Update, I check if it has been created before or not (that entity)
if yes, I return at once...
 
10:38 AM
@Hozuki It actually was not Rhino, it was Java. I copied it over to the explicit scriptlet and it just worked. I asked a colleague about it and he said JSON operations never worked, and they usually hack it around with a merge, because that was the first bootstrap solution they found
 
@HéctorÁlvarez omg.
 
while with Create, I go on to Create the that third entity (Which I would need to in case of update as well, if it was not created)
so you understand my thinking?
@Wietlol
 
@ntohl On further investigation, one of the content packs broke during an update, and all XML operations stopped working until a hotfix was deployed
today I learned a valuable lesson
 
I understand your thinking, but not your situation
 
@HéctorÁlvarez House style? Everybody lies?
 
10:45 AM
AddOrUpdateMethod(AddOrUpdateDTO dto)
{
var id = dto.Id ?? Create(dto);

//Do you update stuff right here
}


Create()
{
//Do your creation stuff here
}
Would something like that work? Hard to tell without knowing the full situation though
 
@Daniel thanks for the idea
@Wietlol @Daniel thank you for your time again :)
 
No probs buddy
 
I think this is the most common UpdateOrCreate logic
 
hmm you are right
 
but it also depends on what api you are using
 
10:59 AM
@HéctorÁlvarez "JSON operations"?
 
02:00 - 11:0011:00 - 23:00

« first day (3496 days earlier)      last day (1470 days later) »