« first day (2970 days earlier)      last day (2204 days later) » 
01:00 - 15:0015:00 - 23:00

15:00
also, the architecture is not really "wrong"
Rant away. Keeps me from doing the actual work :D
it takes years of experience to make a "wrong" architecture
maybe more like it takes years to know that that architecture you used was wrong
problems arising from bad architecture don't really show its ugly head until it's bombarded with lots of new feature requests
I'm sure this one is wrong. It's just dawned on me that it's violating SRP for starters - having a class that both builds an object and does the post to and endpoint is two responsibilities
@Neil not really wrong... ofcourse you could have done better
but making something wrong is really difficult
15:03
well it's hard to anticipate future development.. heck near impossible really
I have a lot of respect for MS for having a very consistently wrong architecture
:D
best you can hope for is to expect change whenever you write code
I guess I split this into two. A set of classes that talk to the API, each one of which has a dedicated helper class.
im not sure what the helper class is for... you should be able to make static methods out of it
if not, then probably one helper class used for multiple services
@Neil a good design is one that can change
so to test it, you change it
but then you have a new design, that could be really bad
Well, imagine that all these Api's are for auction sites like Ebay and Gumtree or whatever. In our database we have all sorts of "widgets" with fields like cost, rrp, description, dimensions and so on
15:07
yay, loophole
@MattThrower i'd give each of those services their own client library
then make adapter service objects according to a common interface that you want to use
But Ebay wants you to post XML and it wants all the price fields as decimals, with currenect listed separately. Whereas Gumtree wants JSON and wants prices as a single string ( e.g. "$400.50"). So each helper class takes our "widget" object and builds the approrpiate output for the api
@Wietlol Yes, I think we're thinking along the same lines. You're just calling it a client lib rather than a helper class
i actually mean make models for all input and output data
for each external service
which dont share a common api
then make adapters for them
@Wietlol Really? Seems a lot of work for limited gain
the lot of work is often simply asking a client library generator to "do its work"
do you have a swagger doc for example?
there are quite some client library generators for that
@Wietlol Nope. These Api's are .... not great
15:13
then... yea... do the thing manually
That said I know there are services where you can past in xml/json and it'll build a DTO for you
it might be a lot of work, but when you have done it, that gives you good separation of concerns
which helps a lot in applications with a lot of services and stuff
the DTO builders are often quite bad though
mostly because the JSON or XML data examples you have wont be sufficient to understand the api
@Wietlol true with one small caveat
A good design is one that can change where needed
if you dedicate time towards making it dynamic and then it isn't used, you've wasted time and you've made it complicated for no reason
> complicated
that is a very vague term
it's almost as bad to make a sophisticated design that isn't used as it is to make an inflexible design that can't adapt
15:22
I have seen people writing stuff and what they wrote was extremely complicated
but when other people tried to show a more simple solution, that person said "why do you overcomplicate it so much?"
well someone's definition is jumbled or it wasn't really simpler :P
there is also the tradeoff between YAGNIY and... basically anything
finding a good balance between them is quite important
if you were an engineer, and you had to build a road which takes you to a place which is on the other side of a river and a mountain, you have to build a bridge but you don't have to go over the mountain
or through it
In other words, some things you must do to get you to your destination, while others are needlessly complicated
the trick is knowing when it's necessary and when it's not
im not sure what you want to compare it with though
designing a program
15:26
for example, would you make interfaces for everything?
we've had this conversation before, so I trust you know the answer to this question :P
for me, making interfaces for everything is like building a bridge, even where none is needed
of course it's a hyperbole, but you're still doing more work than is required
maybe the road would be bumpy otherwise, so building a bridge over everything has a certain logic
but that may not be as efficient as say, simply smoothing out the pavement or taking some other tactic that is less costly
but you are not making the bridge
you are just writing down the laws of physics which the bridge has to abide to
I was making an analogy mostly
I'm sure you can find exceptions to this analogy
i was trying to make sense
but it wasnt needed (yet)
so we skipped sense
well we're always talking about abstract things in our field
15:32
until we need to get things done
might as well be a little creative and use analogies as well
we use abstractions to get things done, though don't we?
that's just another tool in the toolbox
im not sure
this conversation is too abstract to allow me to understand anything at the moment
admittedly, just using the last few minutes of the day towards something non-productive
if you're looking for something non-productive, can you see if you can download and run gitlab.com/kush/dotnetfun on your computer?
15:57
why would we do that?
considering Main is "Hello World!", I think I'd be able to run it
I mean run the tests
because it is unproductive
does it work on your machine?
yes, it works on gitlab ci :D
16:26
three millenials whose hips lied...
 
1 hour later…
17:27
hello guys, can anyone help me to find a powershell script tp install a c# windows service ?
am not good at powershell
posted on December 03, 2018 by ericlippert

For the last two decades or so I’ve admired the simplicity and power of the Python language without ever actually doing any work in it or learning about the details. Having recently dug into those details, I think it is … Continue reading →

posted on December 03, 2018 by haacked

Sit back and relax as I regale you with a harrowing account of trying to do something straightforward with CSS. Ha! Straightforward. How silly was I to think that. As they say,

 
2 hours later…
19:38
Does anyone if there's a quick way to have an OdbcDataAdapter auto trim the ending blank spaces that come from a CHAR column?
Blank spaces? like end space?
.Trim() on the ToString()?
I was hoping there's a way to auto do that when querying as this entire database uses CHAR for any string types.
I have a function that loops through all tables and all rows and for every string type column does .ToString().Trim(), but was wondering if there was a way for the DataAdapter to do it at the time of the filling
Does the [NotMapped] attribute for EF
prevent database column from mapping back to field in the code?
Is it one way or two way?
20:00
iirc, NotMapped means that it wont be included in the (de)serialization process
so its not in the database
but when i retrieve the entity
from the database, the "NotMapped" value does populate right?
then it would also be ignored
Is there a way to only ignore one way?
the NotMapped property would remain its default
why do you want to ignore it one way?
i'd make it readonly
or get only
because I don't want to insert the id
since its populated in the database
but on the get I want to know what the id is
20:02
the id should be the id
not NotMapped
how you mean?
the Id will automatically be supplied by the database on insertion
the client should never have to write the Id property
so I don't want to populate it during the mapping from my domain model
depends
is it a database id or a public id?
it's a column id
like a primary key
foreign keys in other tables refer back to it
20:05
we distinguish the database id and the public id
the database id (primary key, auto-incrementing number) is something only the database is supposed to know
when I retrieve the entity
i want the value
the public id (often a guid), is used as unique identifier to locate records
if you insert something into the database, let the database decide what id value it should have
if you read from the database, you should have the id
so on insertion, dont populate it from the domain model
how do i deal with the foreign key issues?
20:07
and on reading... you dont want to create the model object yourself
what foreign key issue?
ok so when i insert into my model
currently
i get an error saying that because of referential constraints between that parent id table
and another one
(When I insert an entity)
like on the .saveChanges()
So on insert, I shouldn't set the ids right?
But then any foreign key relationships on that entity from other entities are handled by themselves?
the foreign keys should be handled by collections
i have a case where after I create the entity
I need to go back through the whole thing afterwards
and add the foreign keys
sorry the foreign entities
but each of those foreign entities
have id columns to the base object
if I don't map the Id somehow, what do I put for those foreign key entities?
or how do i know where to map the foreign objects and where not to?
if I map the id
and then get rid of the value before i add and savechanges()
would that work?
is this sort of how your model looks like?
20:24
can i do a thing
where I set the stuff
the ids
and then before i add and save
I set them all to default?
or null
You should be able to in the SQL Statement depending on how you have it setup. or there is this example.
https://stackoverflow.com/questions/17675253/trim-whitespace-from-all-dataset-fields
@pingOfDoom i think you have to look at your model
using collections should be sufficient to handle the foreign keys
I'm so confused :(
One sec ill mockup what my model looks like
class Parent{

  int parentId;
  //Other stuff
  ICollections<Child> childrenRef1;
  ICollections<Child> childrenRef2;
}

class Child{

  int childId;
  int parentIdRef1; //Fk to parent.parentId
  string relevantString;
  int parentIdRef2;
  virtual Parent p1;
  virtual Parent p2;

}
this is the entity model
and Whenever i insert into it
I get errors
but the db model underlying it
is fine
It's a db first thing
@juanvan Yeah, Im using that linked solution as a way to clean up the data after. The problem trying to do it in the SQL statement is I have a lot of tables to select and it's a pain to write SELECT RTIM(Vendorname) AS Vendorname, RTIM(Vendoraddress1) AS Vendoraddress1, RTRIM(Vendoraddress2) AS Vendoraddress2 .... etc. I was wanting to just do SELECT * FROM VendorTable
Ya Data integrity is a pita
20:44
you shouldnt need the parent id
just the parent should be sufficient
20:58
But I want it
to store
it would be stored
it just wont be visible in your models
No but like in the object model
in the domain model
I need those references
I have the entity model and then a dataobject model
in that data object model, I need those two ids
you can get the id by child.p1.parentId
and if in the entity I get rid of the corresponding properties, there's no easy method to set the ids
setting is by child.p1 = otherParent
inside the code, you should prefer models over raw data
its an entirely different mindset than databases
21:14
so ur saying
that i shouldn't include those foreign key properties
in the entity framework entity?
Btw this is dbfirst
so the entity models were generated by themsleves
I tried that
Tried deleting the 2 ids
and then deleting any references
But still get an error on the .add()
then im not sure about it, maybe make a post on SO?
or try to recreate the issue with examples of EF usage
21:31
is "PackageCertificateThumbprint" sensitive information?
I only see answers for not to include certificate itself
 
1 hour later…
22:37
!!tumbleweed
01:00 - 15:0015:00 - 23:00

« first day (2970 days earlier)      last day (2204 days later) »