« first day (2699 days earlier)      last day (2234 days later) » 

mr5
3:03 AM
TIL, polygons need a physical therapy
 
user5500750
3:31 AM
What options do I have to build network shared by software installations on different computers?
 
user5500750
Or is the only option that I have is building an API.
 
user5500750
The apps will share an online database where they can synchronize data they have collected.
 
6:46 AM
hi
am using this to get all files in a directory
string[] fileEntries = Directory.GetFiles(sSearchlogPath, "*xml", SearchOption.TopDirectoryOnly);
i want to get all files starting with a particular string only
say "SA_*******.xml
 
6:58 AM
posted on March 07, 2018 by Scott Hanselman

Head over to the main .NET Core download page and pick up .NET Core 2.1 - Preview 1. The SDK contains the tools you need to build and run apps with .NET Core and supports Mac, Windows, Ubuntu, Debian, Fedora, CentOS/Oracle, openSUSE, and we even have Docker images for Stretch, Alpine, and more. It's not your grandmother's Microsoft. ;) Once you've installed it, from a prompt type "dotnet" an

 
7:09 AM
Goood morning sharperinos!
@NoMan How about chaning the search pattern from "*xml" to "SA_*.xml" ?
 
7:40 AM
good morning
 
8:37 AM
o hai.
 
ahoihoi
 
Helloww
 
8:52 AM
Morning
My ReSharper has stopped working ...
I tried clearing the cache, I tried turning it on and off
 
There's an overload version of GetMethod that take only the method name, why then I have to pass an empty Type[] when getting parameter-less method like ToLower?
 
mr5
but have you tried selling it and buy another one?
 
Good idea mr5
I'll do that right away!
 
@MohamedElshawaf What do you mean? typeof(string).GetMethod("ToLower") won't work?
 
yes
this work
MethodInfo method = typeof(string).GetMethod("ToLower", Type.EmptyTypes);
 
9:02 AM
Ah, because there's more than one that matches. You have to pass a Type[] to specify the overload you want.
 
right, thanks
 
It's to disambiguate between ToLower() and ToLower(CultureInfo ci).
 
@AvnerShahar-Kashtan I see
 
@Squirrelkiller ya . thanks i got it
 
... even a reinstall of ReSharper didn't fix it.
That's so annoying
 
mr5
9:06 AM
@WilliamMariager inside ReSharper HQ "M: this guy seems enjoying our product, and we're not getting any profit. Broke his product, quick!"
 
@WilliamMariager What stopped working? Everything? Does the REsharper menu show up?
 
Can't even suggest a basic foreach ...
@mr5 And I'm even a paying customer ...
@AvnerShahar-Kashtan, Intellisense is broken. If I switch to VSs own, it works, if I switch to ReSharpers it stops working.
...
I found the problem
#if TRUE
/* no ReSharper in here, no analysis, no intellisense, nothing */
#endif
/* complete ReSharper here */
I was using the preprocessor directive to turn parts on and off while testing.
Oh well
 
why would you have an #if TRUE?
- Resharper
 
At least my ReSharper is fully updated now
 
it prolly thinks that the code is invalid or written in a different encoding
 
9:14 AM
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos squirrelerinos pleberinos!
 
Calm down
We don't want none of your shenanigans today
 
Fight me if you dare
tail puffs up
 
9:34 AM
feathers fly everywhere
 
random Danish racial slurs
 
good morning
@Squirrelintraining this made my day
 
I don't know if it's the act of a squirrel tail puffing up in slow motion in my head, or the way "tail puffs up" sounds
but it made me giggle
it compensates for the retarded asshole that skipped a STOP and almost hit me in a crossroad 15 minutes ago
@WilliamMariager that's better than #pragma disable all!
 
@HéctorÁlvarez bloddy humans
 
mr5
9:52 AM
@Squirrelintraining noooo. you eat nerd?
 
@mr5 For breakfast
 
mr5
@Squirrelintraining izz you the new nerd now?
 
New?
I am el maestro n3rd
 
mr5
coz u 8 him m8
no more negroterrorinos, only squirellterrorinos
 
10:05 AM
o_o
 
10:19 AM
^-^
 
mr5
x_x
 
d-.-b
 
What is the proper way with Entity Framework to add child/parent objects/rows to the database within 1 single SaveChanges() call?
 
Just add them to the context.
 
mr5
Context.Add(database)
 
10:27 AM
I have an MSSQL database with SQL authenticated new user. Which permissions does it need?
 
owner
 
someone told me some "trace" permission and another is required
 
mr5
Permissions.Add("trace").Add("another")
 
it's role membership, not permission. It have db_owner already
 
you didnt specify what you want to achieve
having it given random roles and permissions makes no sense
 
10:30 AM
didn't work. Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll

Additional information: Login failed for user 'alma'.
 
it all works
but not what you want
 
@RoelvanUden I keep getting "{"Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints, model requirements, or store-generated values."}";
 
        using ( SqlConnection con = GetDBConnection(ConnectionName) )
        using ( SqlDataAdapter da = new SqlDataAdapter(SQL, con) )
        {
            da.Fill(ret);
        }
simple as that.
SQL is "select 1"
or anything
and it needs permission
 
login failed sounds like your user does not exist as a user
or the password is incorrect
 
mr5
@ntohl sorry. I don't even have any idea what I am typing xD
 
10:32 AM
or I overestimate Microsofts power
 
it's correct. Just needs some authentication permission or something
 
@RoelvanUden gist.github.com/anonymous/ceb3247cdd6483afecc6b3dfbc09865c That's the code I'm using (stripped some logic)
 
like You also need SQL Server Browser service to make this work
 
@ErwinOkken Don't add tournamentRounds into the db context. They're children of the object's you're adding so they'll be saved.
That's likely the cause of your cyclic dependency issue.
 
@RoelvanUden That's what I had earlier, which isn't working. Will revert it and try it again
 
10:42 AM
What's 'this' then?
 
But all my entities have a link with the tournament somehow
 
Yeah that's fine, but show me the class that runs this code. I suspect you just misdefined the Rounds property
 
Tournament (in it) => List<TournamentRound> => List<TournamentMatch> => Match which should all be created in 1 SaveChanges
one sec
 
Also, I assume that all the tables have an identity PK
 
CTRL+F for Roel, that's the line that's crashing
SKOTournament : KnockoutTournament : Tournament

And Tournament has:

public virtual List<TournamentRound> Rounds { get; set; }
 
10:59 AM
Why virtual though?
 
For fun
Everyone knows virtual reality is better than real reality
 
Fair enough
 
11:25 AM
@Squirrelkiller Lazy loading, right? All my lists are.
 
Tip of the day: Always ensure you're optimising your use of BigInteger
 
Tip of the day: Always optimize, preferably prematurely.
 
@RudiVisser By using dynamic, right?
 
Don't be so crude Avner
 
Tip of the day: nano-optimizations are inherently better than micro-optimizations. Smaller is better, right?
 
11:34 AM
dynamic a = new BigInteger(10);
dynamic b = new Int32(10);
dynamic c = a + b;
Console.WriteLine(c.ToString());
 
Output: 30
 
why 30?
@AvnerShahar-Kashtan i think you use microservices too much
 
BigIntegers are too cool to represent such small numbers
 
@Wietlol Picoservices are where it's all at these days.
 
nah, people wouldnt understand such a name
needs enterprisify
 
11:38 AM
Encapsulating every single method call with a service infrastructure, including smart contracts, automatic cloud provisioning and redundancy.
 
Also Blockchain
 
ow, and rabbit mq
 
"myString".ToLower() should automatically be subjected to regulatory governance and pass the method call through established service channels. Does it meet GDPR requirements? Would it be better served by passing each character in the string separately to a Hadoop grid which will apply the transformation and reassemble it later? Test and see!
By the way, I'm laughing now, but this is pretty much what native coders thought of COM when it came out, and what COM people thought of .NET managed method dispatch.
 
you cant go small enough with microservices
COM?
 
COM adds a huge amount of abstraction to every method call compared to native method dispatch.
To C coders in the late 80's, it seemed like a laughably clunky convention.
(Probably still does to C coders in the late 2010's)
 
11:43 AM
I realize that COM is something I might never need, but where'd I start when I wanted to learn about it?
 
@AvnerShahar-Kashtan There was no New Hector() until the 90s, so as a so-called millenial I have to ask, how was it like to code in the 80s?
 
@HéctorÁlvarez Dunno. I was in elementary school in the 80's.
I started in the late 90's.
 
Damn old people
I wasn't born in the 80s
 
oohh nice, the times of Fedora and Suse
 
11:49 AM
I learned C/C++, but I started coding properly in VB, then moved on to C# in 2001 and never looked back.
I looked forward at a lot of other languages. But not back. No, never back.
 
Dude you had VB, good thing you didn't carve your eyes out with a spoon to avoid looking in any direction at all.
why did you scrap C/C++, those 2 languages look like the best on average for good optimizations
 
VB was a fantastic language. Especially compared to what C++ had to offer at that time.
 
Well I guess it makes sense if you take the technological level of that decade into account, luckily technology evolves exponentially faster.
 
VB (.NET) is still a good language. But VB6 at the time was remarkably low-hassle.
It Just Worked, most of the time. You didn't get into pointer hell like in C++ with keeping track of resources. It paired great with middleware like COM+ or IIS to run back-end services, and was the inspiration behind WinForms - simple drag-and-drop UI development that was miles ahead of competitors like PowerBuilder or Oracle ugh Forms.
 
even if that would lead to bad practises, like leading the flow using GoTo?
 
11:56 AM
@HéctorÁlvarez There's nothing in the language that encourages bad practices.
Well, except for the popularily of On Error Resume Next, but that's basically making it aligned with standard C practices for error flow management.
I've seen more goto used in C than in VB.
 
Exceptions are the standard error handling paradigm for .NET and Java, but not in C.
 
The worst thing about VB was the Microsoft examples that rarely taught good practice.
 
the worst thing about VB was the B
 
I've seen things you people wouldn't believe.
 
11:59 AM
the V is actually nice and is coming back in a while
 
@Squiggle Wait, is the MSDN showing good practices now? Why are you talking in past tense.
 
Once had to maintain a switch statement so long that it spanned files
 
> So in C it's guaranteed there won't be exceptions,how? at 12:55

> @httpinterpret: in C it's "guaranteed" that there are no exceptions in the same way that it's "guaranteed" that there are no templates, or no reflection, or no unicorns.
Found on an SO question about exception in C.
I can't remember the last time I saw a good practice in MSDN documentation. Or any documentation. They tend to take the "show the minimum amount of code needed to demonstrate the specific method" approach.
 
@Wietlol, Mister Regex, I need you!
 
@WilliamMariager wrong ping
 
12:02 PM
@Squiggle B*tch please, I have this from in front of me with 17 (yes, 17) floating datagrids, and took 3 days researching why. Turns out there's one that you can NOT move because the rest use it as a reference, but you can't stack them either or else you lose track of the real one, so they have to be in a relatively safe distance
, and you can move them around if you want to check a button underneath, but you have to put it relatively back to where it was. Also every control is loaded from code and datagrid cloumns are also handled from code.
 
@WilliamMariager you summoned me?
 
I remember early .NET docs and tutorials that basically encouraged you to drag an SQL DataAdapter directly onto your WinForms page.
 
@WilliamMariager Kendall is kinda right, you pinged wrongly
 
it should have been "@MisterRegex"
 
12:03 PM
Can I make it not match coconutmilk easily?
 
why?
on which rules?
 
@HéctorÁlvarez I've seen someone write a DAL function that returned hierarchical data. He couldn't figure out how to represent the hierarchy in code (List<T>? Array? Ummm) so he created a TreeView control (in the DAL, yes, yes) filled it up with data and returned THAT to the form.
 
@HéctorÁlvarez ...ew.
 
When the word contains coconut, it's not real milk.
 
in any case, im back in 30 mins
 
12:04 PM
You're back now!
 
those rules should not be done in regex
 
Yeah, I thought so
 
@AvnerShahar-Kashtan that's probably even worse than writing HTML in your SQL Stored Procs
 
I'll do the check inside my replace function.
 
but you could add negative looks
 
12:04 PM
@WilliamMariager based on what rule?
 
but it is notorious
 
@WilliamMariager Yeah, this isn't a textual rule. It's a business logic rule.
 
@AvnerShahar-Kashtan I remember this, you probably explained it on Monday. Then again, it's better than my DAL that has no "Save" feature for the User type
 
1 min ago, by William Mariager
When the word contains coconut, it's not real milk.
 
How would you differentiate between "coconut milk" and "warm milk"?
 
12:05 PM
You're serious?
 
I'm serious :P
 
what about almond milk?
 
I'd have to consider that as well.
I'm dealing with fixing some old product information data.
 
I don't think you have a well-defined problem
 
Fixing allergens.
It's about 1k products, so doing it by hand would be a pain. Trying to fix it with mostly code.
 
12:06 PM
I think you have to do it by hand
 
1k? do it by hand. Unless you'll need to do it again later.
 
search for all instances of milk, then choose what to do with them by hand
 
Doing it by hand would take weeks. I'll just note down the few that contain milk, and mark them for manual check.
 
thumbsup.png
 
How would 1000 items take weeks?
 
12:07 PM
@KendallFrey @WilliamMariager Yeah. Use tools to narrow things down from 1k to a manageable amount, but then do a manual scan to make sure you're getting it right.
@WilliamMariager Yeah, that. :)
 
do they all contain "milk"?
 
Nope. But the milk check is just one of the things I'm fixing.
Also handling celery, soy, shellfish, gluten, etc.
Soy might prove a bit annoying too, since refined soy isn't an allergen.
 
GIGO
you've got some sorting to do
sounds like you need an intern
 
was just about to say the same thing
 
Or a mechanical turk
 
12:11 PM
...damnit I was about to say that, too
 
It's actually the sort of work that can be mechanicalturked rather easily.
 
!!urban mechanicalturk
 
@Squirrelintraining No definition found for mechanicalturked
 
did you just verb "mechanical turk"?
 
12:11 PM
@Squirrelintraining mechanical turk humans used as pieces of machinery, that is, as a mesurable part of an industrial procces, disregarding their humanity in favour of the greater goal. Mechanical turks are usually inserted as procedures in computer programming just like you would commonly say "save file; clear screen; mech-turk-do-something"
 
@Squiggle There's a line in The West Wing where Leo, the chief of staff, missed a memo or something and only caught up later. So the president tells him "For the rest of this day, I'm going to be 30 minutes smarter than you all the time". You're Leo today. Just a few seconds behind.
@Squiggle I believe I did.
@CapricaSix Wow, that's a very bleak way of looking at it.
 
For all the VS gurus, is the a way to get the IL code while debugging without using an IL disassembler?
or more particularly, without using ILDASM.exe on a binary
 
Doesn't using a mechanical turk come with other limitations? Like languages? No clue how it's normally done.
 
@HéctorÁlvarez There's a Disassembly window under Debug -> Windows, isn't there?
Or is that real asm?
 
@WilliamMariager I wouldn't bother investigating that. It would probably only make sense for data sets in the hundreds-of-thousands.
 
12:13 PM
@ErwinOkken It looks like you've got SingleKnockoutTournament instances referencing SingleKnockoutTournament instances? What is the code for KnockoutTournament?
 
Yeah, I wasn't going to. Just curious about the concept.
 
@WilliamMariager I don't know the actual procedure, but the idea is to break down your dataset, give a corresponding question ("Does this entry contain soy/shellfish/etc"), and spread it out to multiple participants per entry, then correlate.
 
@AvnerShahar-Kashtan I don't see any on VS2015, might be a feature of VS2017? Or maybe an add-on?
 
Google uses a similar concept in their image identification captchas
 
@HéctorÁlvarez What version of VS are you using? Could be an enterprise feature.
 
12:15 PM
@AvnerShahar-Kashtan What do you mean with real asm?
 
@HéctorÁlvarez as opposed to MSIL.
 
@WilliamMariager VS2015 Professional
 
As in, the assembler output MSIL gets turned into.
 
@HéctorÁlvarez I'm pretty sure it was there as well.
I'm on VS2017 Professional.
 
@AvnerShahar-Kashtan I'm a noob when it comes to disassembling stuff, I recently started researching on it and spent a couple of days understanding stuff. Eventually found this ILdasm thing that comes with the Microsoft SDK for windows v7.0A --> NETFX 4.0 tools
 
12:18 PM
@HéctorÁlvarez There really are better tools for this. ILSpy, for instance.
 
that's all I can make out of it, until I dwelve deeper
 
@WilliamMariager you invented regex, you should know.. ^^
 
Probably dotPeek as well.
ILDASM will simply give you an MSIL dump, right?
 
I'll check those out, hopefully they are free
 
dotPeek used to be free, not sure if it still is.
 
12:18 PM
ILSpy is.
You can use LinqPad as well if you want a simple interactive shell to write a bit of C# and immediately see the IL it compiles to.
 
+1 for ILSpy
 
RoslynPad = LinqPad but free and with annoying editor
 
@RudiVisser But without IL output, AFAIR.
Oh, he did add it.
 
Yes
It's your friend isn't it?
 
And the annoying auto-complete-brackets thing is annoying. I'll talk to him about it (the guy who write it sits across the room from me)
 
12:21 PM
It's just Avalon isn't it
Tries to be smart but it's just REALLY annoying. If anything have an option to turn it all off
 
That's the basis, but it only started a couple of versions ago.
 
LinqPad's IL output is better, though, because it only shows you the IL for your code, not for everything.
 
@AvnerShahar-Kashtan Tell him about that too :)
 
12:24 PM
I will. :)
 
Does this below code violates SRP :
static readonly ColumnInfoMap columnInfoMap = new ColumnInfoMap
        {
            new Int32ColumnInfo()
        };

 abstract class ColumnInfo
    {
        public abstract Type Type { get; }
        public abstract void Write(DbDataReader dr, int i, BinaryWriter w);
        public abstract int GetHashCode(DbDataReader dr, int i);
        public abstract int GetHashCode(BinaryReader r);
        public abstract bool Equals(DbDataReader dr, int i, BinaryReader r);
    }
    abstract class ColumnInfo<T> : ColumnInfo where T : IEquatable<T>
 
Could you be more specific? What about it makes you ask the question? Don't just dump code.
 
Yezushchristallahmohammedwhy
 
barty barty
 
As you can see that 1 class is handling more than 1 responsibility like Write,Comparision etc
 
12:25 PM
@RoelvanUden you forgot buddha and genesha
 
Didn't you just answer your own question
 
So i want to ask that shall i divide this in to more class ?
 
Will it benefit you in any way?
 
We have told to follow SRP
 
Or are you perhaps overthinking whilst learning?
 
12:26 PM
@RudiVisser He's aware of the problem and it will be fixed soon.
 
Oh is it for an assignment
 
perhaps he should become a squrrel
 
@AvnerShahar-Kashtan 👍 Tell him I love him
 
so i am trying to identify that will it be good to divide that in to sub classess or the way it is right now is fine
 
@Learning-Overthinker-Confused Who the fuck keeps telling you all this crap
 
12:28 PM
@RoelvanUden But isnt it is good to follow SRP?
 
The whole fucking point of all these principles is to produce sane and logical code that's easy to follow. When you start splitting up every goddamn thing into even more shitty things, it's not going to produce sane, logical and easy to follow code, will it? God damnit, just apply common sense while programming and move the fuck on
2
/rant
 
But as i am learning this SRP,so i was not sure about this.probably confused
So asked you guys
 
Same with design patterns. They started out as descriptive patterns, they describe the sort of thing people already do, and give them an accepted name so people will be able to talk about their design in fewer words. But when you start wondering if your code is a "proper" Template Method, for instance, you're using it wrong.
 
Stop overthinking. SRP just means that one class does one thing. Whatever 'thing' is, is not defined. If your class happens to produce items and store them, and you call it a ProduceAndStoreManager, it still makes fucking sense so you could argue that its SRP is valid.
Also, ^^ that so much
 
12:33 PM
Yeah but if you see my ColumnInfo class,it is handling 3 responsibilites:Read,Compare,Write
So as per SRP it should either handle:Read or write or compare
This is what i have learned uptill now about SRP
 
It should handle none of those, I think.
If it's a ColumnInfo class, it should simply hold column info.
Have the DataReader read data.
 
Well, a compare (e.g. overrides equals) makes sense to compare one instance of ColumnInfo to another.
 
Actually the above code is reading typed data(int,string) from data reader independent of database column
 
Weird, ILSpy doesn't appear in the contextual options... I've restarted VS2015 a couple of times and it shows as enabled in the Extensions view.
 
So it's not a ColumnInfo class. It doesn't do Info. It's... well, basically, I don't know what it does.
 
12:38 PM
This column info class is handling data reading from data reader independent of database column.As you can see right now its handling int type of data
So the magic is that TYPE property
 
The point of the class is that it abstracts the type-specific DataReader call, and the type-sepcific BinaryWriter call?
 
Yes exactly
So does it make sense to divide this classes or the way it is,its fine?
 
It's a class that has a dependency both on DataReader and on BinaryWriter, two completely separate classes, while seeming to be a neutral utility class. What happens if you want to use it somewhere else just for handling DataWriter writes?
How are you instantiating these classes?
 
void BindColumns(DbDataReader dr, string[] columnNames, ref ColumnInfo[] columnInfo, ref int[] columnIndices)
    {
        columnInfo = new ColumnInfo[columnNames.Length];
        columnIndices = new int[columnNames.Length];
        for (int i = 0; i < columnNames.Length; i++)
        {
            var ci = dr.GetOrdinal(columnNames[i]);
            var di = columnInfoMap[dr.GetFieldType(ci)];
            columnInfo[i] = di;
            columnIndices[i] = ci;
        }
    }
 for (int i = 0; i < columnInfo1.Length; i++)
                        columnInfo1[i].Write(dr, columnInfoIndices1[i], dataWriter);
This write operation based on reading data from data reader and then passing that data to data writer for writing
 
So it's not a write operation. It's a Read and Write operation. It's a Copy operation.
 
12:50 PM
Yeah first reading from data reader and then writing to file
 
Because your input isn't trivial.
 
Whatever column names i pass to this BindColumn name method,It populates ColumnInfo class based on that
 
This is what strikes me as non-SRPish. The fact that your Write operation, which leads you to believe is a method focused on writing, actually has non-trivial Read logic.
 
So this is not Following SRP right?
 
Again, SRP is not something to "follow". It's a general guideline to keep operations focused on one thing.
You can make it more SRPish by simply naming it Copy instead of Write.
 
12:52 PM
So what do you suggest ?
Splitting it to seperate classes to handle only Read,Write and equality compare?
 
Isn't there a way to make extension methods for .NET classes, like String ..?
 
there is
 
there is?
up to C#6, there isnt
 
@MohamedElshawaf Extension "Static" methods? Not really. But why? What's the difference between String.IsNumeric() and StringExtensions.IsNumeric()?
 
on the class level: string.ExtMethod() ?
 
12:57 PM
 public static partial class Extensions

    public static String Replace(this String S, Char[] OldChars, Char[] NewChars)
we have this for example
 
that is a normal extension method
 
Ho ho ho, merry... everyone. Tortoise merge lets me choose between these 2 options

1.
`public void Foo(int whatever)` (latest version)

2.
`public void Foo(string old_whatever)` (old version)
`public int...`

i.e. the old version plus the new features, or the new version without the new features.
 
not a static extension method
 
@ntohl No, he meant adding more things like String.Join(), static methods.
 
@ntohl imagine "String.IsNullOrEmpty()"
and "String.IsEmpty()"
(not that IsEmpty should by any means be static, but wth)
 
12:59 PM
@AvnerShahar-Kashtan I want to make extension method that return Empty array of any type, like string.EmptyArray() , int.EmptyArray().. etc
 

« first day (2699 days earlier)      last day (2234 days later) »