« first day (3271 days earlier)      last day (1680 days later) » 

2:01 AM
Any XML gurus here? I'm trying to read an XML file, I've checked my XPath is correct, but something on the C# side of things is not working. Can traverse the nodes, can't query.
 
2:35 AM
how tf do i set a const like this?
const int testCount = UBTDataList.Count();
 
since const must compile time constant, your UBTDataList must be compile time constant too
but while UBTDataList is a compile time constant, you can define the int without Count()
 
what?
this object list is going to be shredded down
will the value as 'int x = objectList' remain constant even at code that wil shred it?
 
int x = objectList <-invalid cast
 
.count*
 
?
if your testCount is a const, your expression must be compile-time-constant
const int testCount = UBTDataList.Count();
UBTDataList is a const?
 
2:51 AM
it's an object list
and i get an error trying 'const int testCount,...
 
yup, list aint constant
 
it is
and i dont need to specify, after i debugged
what i found out was that
var testCount = UBTDataList.Count();
this remains constant if the list get's affected on the following code
i found this out by step by step debugging
 
No, list cant be const, unless you define it as null
169
A: Inline instantiation of a constant List

Jon Skeetconst is for compile-time constants. You could just make it static readonly, but that would only apply to the METRICS variable itself (which should typically be Metrics instead, by .NET naming conventions). It wouldn't make the list immutable - so someone could call METRICS.Add("shouldn't be here...

1. by define `testCount` your expression must be compile-time constant.
2. but, `UBTDataList` aint constant because c# dont allow list to be constant
you may just define it as static readonly as on the link, there will explain
 
i think we're talking about different things
what describes an objectlist.Count where it's value does not change if the underlying asset is changed?
 
oh really, maybe Im misunderstood your question
 
3:04 AM
when i ran the code, the count was 2, following, the ubtdatalist.count was 1 after shredding
however, testCount was still 2
what is this called?
 
you stored the int at the time that list has 2 items inside it
the int wont changed whatever list items count have changed
var testCount = UBTDataList.Count(); <- at this time, testCount wont change by items count, because it have been stored as variable
you may Count() again while you want new items count value
 
yea now we're on the same page
i had the wrong idea where i needed to specify a const, for it to hold '2'
 
3:45 AM
 
 
1 hour later…
5:01 AM
171
Q: Firing mods and changing content license: is Stack Exchange still interested in cooperating with the community?

amonThe last weeks and days have seen some erratic behaviour by Stack Exchange Inc, such as likely illegal changes to the content license and the firing of a community moderator for no good reason. It would be nice if those just were examples of ill judgement, but the disturbing alternative is that S...

 
5:14 AM
Moderator resignations across the network to protesting against SE, so far 10
Im good to see SE actually given stress to mods, but also sad they revoked a mod for ridiculous reason
 
5:55 AM
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
6:15 AM
-145
A: Moderator Resignation Notice

Sara ChippsWe’re sorry to see you go. We understand there are some folks upset about the decision made this week. We aren’t going to share specifics out of respect for all individuals involved but this is a site reaching millions of people and we have to do what we believe fosters a spirit of inclusion an...

chaos
 
Morning o/
 
Rob
Howdy
 
6:45 AM
ohayou
 
7:06 AM
So I'm a bit afraid of what I just built, but also proud.
I gotta map an int to an Enum. The enum goes "Months12"/"Months24"/"Months36" and so forth.
Naturally, I ToString'd the Enum.Values, .Replace'd the "Months" with "", parsed the results to integers, OrderBy'd that, and rounded my input int to the next higher integer.
And it actually works for two different but basically equal Enums, so I made it generic. Supported Enums in the summary.
 
good morning
 
@Squirrelkiller Then some new programmer to your project adds Weeks52 and breaks everything
 
at least in Java you can associate data to enum values
they didn't get a lot right, but I love that feature at least
 
It's not a problem in C# either - mabye you remember my question from last week where an enum class has ints like 500/700/1000 assigned to it?
 
7:21 AM
no, but maybe I wasn't here
 
Sep 26 at 14:07, by Squirrelkiller
I have an Enum: https://paste.ofcode.org/uvemW7qCRrEVVuM3KBnAA7
 
So why wouldn't you just do Month12 = 12, Months24 = 24, etc?
 
1) It's not my enum, I jsut haev to parse an int to that
 
well if it's just three values, just do an if else chain and handle the three cases
seems very fragile as you did it
 
2) That's not so much better. Since we have an int, I have to account for possibly somebody throwing a 3 in there
 
7:28 AM
then I don't think I really understand the problem here
 
@Squirrelkiller look telegrampls
 
WTF with SO now? Killing all mods?
 
killing? glad I'm not a mod then
 
@Squirrelkiller what is the problem with it?
or is there no problem, just proud of what you made?
 
Jon Skeet still user?
 
7:37 AM
why not?
 
Jon Skeet is an excellent user, but that wouldn't necessarily make him a good mod
 
Is there a drama tag on Meta? If not, now would be an excellent time for it to be created
 
#SOProblemsByte
 
Im expect that question will get lock or delete soon
but it was still alive
 
7:54 AM
Not sure I really understand the heart of the issue
Moderators didn't like the recent policy changes?
 
I think it's that and being sacked for being jewish or something
 
SO isn't compromising and has resulted in the firing of several moderators from what I've gathered
 
I also love tacos
 
@nyconing just got closed
 
@CaptainObvious ouch, I can see why that would be a serious issue
 
7:57 AM
Meh a mod get revoked across networks, but her do not violating any rules or coc, and she get revoked silently without inform or confirmation
 
though it's kind of a hard thing to prove
 
No, its open
215
Q: Firing mods and forced slippery relicensing: is Stack Exchange still interested in cooperating with the community?

amonThe last weeks and days have seen some erratic behaviour by Stack Exchange Inc, such as likely illegal changes to the content license and the firing of a community moderator for no good reason. It would be nice if those just were examples of ill judgement, but the disturbing alternative is that S...

 
there was no obvious reason behind Monica getting fired, but that doesn't mean there wasn't one, nor that it was illegitimate
 
I mean the answer
 
SE should feedback asap with acceptable explains, or further damages may continues
 
8:03 AM
meh, I think it hurt a lot of feelings, because people wanted to be moderators of this site because it was almost a noble cause
and now it would seem people are being bluntly reminded of the fact that this is very much a corporate site
 
mr5
8:16 AM
How did the XF team manage to recreate iOS from C# while knowing the fact that iOS is closed-source?
Example is this class: UIImage
How did they know the internals of those?
 
8:35 AM
@Neil the corporation only ensnared the goal of community driven site... Without community they would not manage even their arses
 
objc has reflection that more powerful than java
 
@ntohl I think it's easy to forget that it's against their own best interest to go against the community
maybe they don't realize that now, but they will if they want to stay in business
 
Line 128 #if false LOL Dead codez
 
one way or another it'll work itself out
 
@mr5 They didn't. They "merely" translate C# to native obj-c calls, and translate the result back into C#.
It's an elaborate layer of glue between C# and the native env
This is, of course, very much simplified. They had to do a lot of work to make certain calls work, but that's essentially what it is.
 
8:39 AM
Hiiya
So I was creating a copy constructor... but I ran in to a little problem...
or it's not really a problem but
let's say the thing you copy from is a null object
then I would like to get a null object from the copy constructor... but that's not possible.
 
mr5
@RoelvanUden I know most of the codes are binded but for example, this code: UIApplication.EnsureUIThread(). How did they know that they should put it there? (Although one can confirm by calling it from another thread but still)
 
Should I check for null before I copy, or should I create a factory that returns null or a copy?
 
is this bad?
I have one transaction, where I have two separate calls to the database using EF-Core
each function moves a record from a temp table to another table
 
@Markus copy constructor would be wrong because once you're in the constructor, an instance is getting made
you could throw an exception, but that's generally discouraged
 
but I assume their "SaveChanges" will mess up the other calls
 
8:46 AM
better to check before the copy
 
Yes, I think I'll go with that. thanks
Factory seems a little overkill just for this
 
well it is a bit overkill
you can't just make a method?
 
just a static method?
MyStuff.Copy(myStuff)
 
yes that would be my factory
 
@Neil did you know you can overload a constructor in Kotlin?
 
8:48 AM
interface IFactory abstract Factory
 
I mean, you didn't need to create a class just for that
 
what is this jibberish @nyconing ?
 
you could add a static method in the class that you're copying
@Wietlol in what sense? how would that work?
 
abstract Factory interface IFactory<model class TMyModel>
 
class FactoriesFactory:Factory
 
8:51 AM
FactorioFactory:IFactory
 
obviously, this isnt restricted to making new instances
or... returning the actual type of the class
like this
 
oh, didn't know about the invoke operator
 
however, if the signature matches a constructor, the constructor will always be used... except... if the visibility is restricting it
 
I'd think that would get you into all sorts of trouble though, if you weren't careful
Gotta problem where you need to replace every instance of a class with another? Simply override the invoke method! It will solve all your problems! No hassle!
 
this is a nice thing
@Neil you could... yes
I am not sure that it would be preferred over a simple refactor... but it could work
 
8:55 AM
I think I would be very cautious about using that. it isn't a behavior I would expect
you wouldn't know it does that without seeing the actual source code for that class, which you may not always have
 
because you are unfamiliar with it
 
but yeah, certainly a powerful feature
 
I expect code to be written with the least surprise
I dont expect a language to provide keywords for every possible intent
 
@Wietlol as you should
 
@mr5 I presume through testing that it makes sense to help people out
 
8:57 AM
I expect that when I do Foo("Hello, World!", 1) I get a Foo object
I dont care if it got cached or whatever
I just want the object
when you get a String instead... that is surprising
 
if you don't care if it is cached, then this makes no difference
 
it could make a significant performance difference, but that is an implementation detail from the library you use
not something you want to handle yourself
 
But if you think it isn't cached, and insert it into a Map yourself to cache it, then you're doubling the work
and memory usage
 
it is a rare feature, and should be used carefully, but it can definitely be very useful
 
and if you're lucky, you won't have concurrency issues
 
8:59 AM
but... back to my EF question...
am I being paranoid or is what I wrote really bad?
 
I think it would be handy as a quick fix in a pinch, but it would have to be swapped for a more permanent solution later through refactoring
 
@Neil the copy constructor with a null object could be a nice example tho, probably better than the cache
 
again, I wouldn't expect that behavior
 
> I have one transaction, where I have two separate calls to the database using EF-Core
each function moves a record from a temp table to another table
but I assume their "SaveChanges" will mess up the other calls
 
so therefore it would be a bad thing to do
 
9:02 AM
@Neil you wouldnt expect me to write good code... is me writing good code now a bad thing?
 
@Wietlol if it is in a transaction, it shouldn't have conflicts with other transactions/operations
 
it's conflicting with itself
 
the tables being used dont mess with each other
 
I think DatabaseContext.SaveChangesAsync(); should be after awaiting the waitall
since you are using the same transaction
 
@Wietlol I fail to see how my expectations would change whether writing good code is a good thing
 
9:04 AM
@Neil the principle of least surprise states that less surprise is better, but something being surprising doesnt make it bad by definition
it could be that what you expect is... odd
 
@Wietlol if you decide that surprising behavior in a program is a good thing, then no, but I would say it is
When would behavior contradictory of your expectations ever be a "pleasant surprise"?
oh! It was supposed to throw an exception here, but instead it didn't! How lovely!
 
it would be a pleasant surprise if you understand that your code will be better
 
the other problem with that code is you don't handle rollback on exception
 
@Wietlol and how per se would it be better as a consequence? At best, you have to rewrite to compensate for the unexpected behavior and at worst, you receive some sort of runtime error in production
 
0/
 
9:08 AM
> transaction will auto-rollback when disposed if not committed
do I need special rollback code tho?
 
not if rolling back is the desired behavior
 
for example, lets assume that we get a new employee at work, and he used to be a C developer
he could suspect that when certain code fails, it returns a null object or some invalid number
instead, he realizes (against his expectations) that an exception is thrown
his expectation was definitely not met, and this was certainly surprising to him
but... I think we both agree that the exception version is much more pleasant
I would assume that this is a pleasant surprise
 
if he checks the return value for being null or invalid in order to deal with the error, and then an exception is thrown instead, crashing the program, I think we both agree that the crash is less than pleasant
 
I didn't know that it rolls back auto
 
realizing (maybe after a longer period) that the system you use is better designed than you expected
 
9:13 AM
i love red bull
red bull is my best programming companion
 
@Wietlol so in my scenario, you would pop the cork on the champagne to celebrate the fact that you've inserted a major blocking bug in your program in production, on account of the fact that you now know you can catch that exception
 
@Harry for me, it is my rubber duck
 
@Harry you should ween yourself off sooner rather than later
move to coffee and then to nothing
 
@Wietlol i have one too but its a reindeer plushie
 
9:15 AM
Morning
 
@Neil I assume that, before hitting production, the error handling has been tested
at least, that is our policy
 
@CaptainSquirrel i dont have it every day, just when im particularly struggling
 
@Harry Even so
I used to use monster for that
 
@Wietlol you can't test with every possible value
 
if you just throw code into production, I expect it to fail... and what a surprise, my expectations are met :D
 
9:15 AM
And a steak pie 👀
 
hmm... true
 
Also if we're working with the assumption that the person expects a certain behavior, then he's not going to think to test it
of course, that's a mistake, but still
 
I do however expect that a function has one version of passing errors
 
it he expected it, it wouldn't be unexpected, now would it? :P
 
either by value or by exception, not both depending on which error it is
 
9:16 AM
@Harry that word made me trembling.. it was hard to swallow, remember one time Im overnight but meeting is upcoming, I decide to drink it, I take 10mins for courage enough to drank it...... my tear dropped on every swallowing
 
Suppose in one case he's tested, it responded with a null or invalid number, and in another untested scenario, it throws an exception instead
 
in the case of it being exceptions, while checking for values, I assume that the null check has been tested before hitting production
 
So he assumes it always returns a null or invalid number. He's met with a not so pleasant surprise
 
Mmmm mcdonalds breakfast
 
are you sure that was redbull and not cocaine
 
9:18 AM
@Harry is there a difference?
 
@Harry greenhalghs have amazing steak pies
 
@Neil only the method of ingestion
 
when you actually get meat in them lmao
 
@Harry You're from coventry, that's even worse. You're a discount brummie
 
haarryy
all on board
we can leave now
lets sail
 
9:21 AM
I don't like that End of the heavy world 's taste
 
coventry = home of jag
coventry = home of industrial revolution
coventry = home of industrial revolution

brum= home of horrible accents and the country's least friendly train station
 
Wow I actually, again, found a feature from looser languages I miss in C#
 
you mean jS ?
 
At first it was "i want my int to be recognized as bool" because I started learning in C
 
looser languages?
 
9:23 AM
loose == "int might aswell be a bool"
 
you mean that stuff that breaks all the time?
oh that hell of loose languages
 
And just now I went "oh come on why cant the nullable bool be recognized as false when it's null?"
Because I just wrote "x ?? false" like 8 times
 
!!Is JS for losers ?
 
@Hans1984 Of course!
 
in the case of Boolean? always use ==
 
9:24 AM
says the JS bot..
 
I concur
 
maybeBool == true
 
@Harry Halewood is best factory
 
maybeBool == false
 
=== true
 
9:24 AM
!!Do you wish you were written in Java ?
 
@Hans1984 Indeed
 
B===== true
 
@rlemon you heard the lady
 
@Squirrelkiller That didn't make much sense. Maybe you meant: lemon
 
Wait no
 
9:25 AM
@CapricaSix You misspelled "In dead"
 
And the industrial revolution's real home was Runcorn
 
var D = true;
assertThat(B===D)
 
true == true === true
 
(Java == JavaScript) != (Java === JavaScript)
 
And the worst thing: I agree with the Lion here.
 
9:30 AM
@Harry Just Sayin' the jag land rover head office is in liverpool
So cov isn't exactly "Home"
 
if ([] == 0) return "js"
 
@CaptainSquirrel Incorrect, it is in coventry
But the coventry factory is a bit shit
 
morning
 
@bradbury9 it's 11:41, son.
Did you sleep in?
 
@CaptainObvious not according to google
 
9:46 AM
Jaguar Cars - Headquarters: Coventry
HEADQUARTERS
 
i used to live next to it
i lived on riverside close
30 second walk to the factory
 
This just in: Google tailors your search results to where you are
 
This just in, Northener is offensive
Which of you snowflakes is going trigger-happy on the flags?
 
Did you just call me a snowflake? I.. I don't know what to say.. *tears swelling up*
 
9:51 AM
People are flagging things?
Also, apparently spelling is hard
 
@BenFortune I'm offensive?
wat
That's offensive!
Swearing in checkin'
nice
 
I didn't mean to
 
how does one "accidentally" write the c word in a checkin
 
By missing the o
Y'all know how bad I am at typing
 
Swears in Yorkshire
 

« first day (3271 days earlier)      last day (1680 days later) »