« first day (3099 days earlier)      last day (1863 days later) » 

2:45 AM
So the black hole is real?
New religion birth yesterday: flat hole believers
It is an alien space teleporter
 
I think it will fall in the domain of Flat earthers as they already say all space imagery is faked
 
 
3 hours later…
6:59 AM
good morning
programmars
 
prograndma
 
7:19 AM
prograndfa
programing
programming
programmming
prograrnrning
 
H.N
:( GrammingPro
 
ohayou
 
good morning!
 
7:57 AM
morning.
 
H.N
o/ New day, new Posibilities!*

*Nvm, I got a task in VisualBasic solution from 2002. this code looks ancient >.<
 
Buenas dias desarrolladores
 
H.N
tres cervezas, por favor :>
I'll just leave work as soon as u get them :D
 
R K
8:21 AM
how to add comma where \r\n in a long string of characters in c#?
@H.N
 
"loooooooo,oooooooong"
 
R K
programming sux
@anand_v.singh
how to add comma where \r\n in a long string of characters in c#?
 
@RK What?
 
"looooo\r\noooooog".Replace("\r\n",",")
"looooo\r\noooooog".Replace("\r\n",",\r\n")
 
R K
dfsgdsfgsd\r\ndsfg\r\nsd\r\nfgds\r\nf\r\ndsfg\r\ndsf\r\ngs
i have this string
and i want to replace \r\n with comma
 
8:33 AM
public static void Main(string[] args)
{
    //Your code goes here
    var strong = "dfsgdsfgsd\r\ndsfg\r\nsd\r\nfgds\r\nf\r\ndsfg\r\ndsf\r\ngs";
    Console.WriteLine("Hello, world!");
    Console.WriteLine(strong.Replace("\r\n",","));
}
Hello, world!
dfsgdsfgsd,dsfg,sd,fgds,f,dsfg,dsf,gs
 
@nyconing Talk about overkill
 
vs readability
 
R K
done @nyconing tnx
 
 
1 hour later…
10:04 AM
!!xy
 
!!yx
 
@Default That didn't make much sense. Maybe you meant: y, ye, x
 
OMG, this is the perfect definition of an XY problem: stackoverflow.com/questions/55629391/…
blablabla "I have one for loop and it is running around" blablabla "now I want to use threading"
 
that's already explained when they read the links for the close reason
 
10:07 AM
1 hour doing validations -> Lets multithread it!
I wonder... WTF are you doing and how?
 
I helped a client refactor a JS app once. It was a single 5000 line JS app, written by someone entirely self-taught. It worked, but occasionally crashed and with slow-downs.
I found that in about a dozen places they had for-loops like this for (i = 0 ; i < document.getElementsOfType('blah').count; i++ ) { var element = document.getElementsOfType('blah')[i]; ... }.
Meaning they would re-query the entire DOM document for every iteration of the loop.
So yeah, that's how someone self-taught might find themselves with 1 hour validation loops.
 
My boss long time ago (not in that company anymore) had this code in vb.net (im translating it to c#):
switch(bolean_variable) {
case true:
--- no code----
default:
bunch_of_code
}
When I asked, they told me "it was easier to read"
Do note that proper vb.net code would have been:
If boolean_variable = False then
some_code
end if
Life is too long and world is too small... That dude became my client in my next company
 
If Not boolean_variable Then
you mean
If = True|False Then is never "proper" IMO
also, it was easier to read than what :) an if else?
 
10:24 AM
yup, they said a switch/case was easier to read than an simple if
 
I can understand the case for a switch/case (I don't agree, but I understand). What I don't understand is is a switch/case with one explicit, empty case, and an implicit case with the logic in it.
Prefering a switch/case over an if is treating a conditional like a pattern match, which makes sense - match the range of possible values and handle them all, and a boolean is no difference.
That isn't this case.
 
switch (!bolean_variable == false) {
    case true:
        break "yas!";
    case false:
        break "nope";
    default:
       break "maybe";
}
 
runs switch 100 times = smart
runs switch 1000 times = AI
runs switch 10000 times = ?
 
@nyconing My kind of user
They had also some funny try-catch-finally things
bool executed = false;
try
{
// some problematic code
executed = true;
}catch{
empty_block
}
finally {
if (executed) {
// Some code
} else {
// Log "something went wrong"
}
}
 
try {
    ...
    return "Hello";
}
catch (Exception ex) {
    return "Error";
}
return null;
> I dont trust the language runtime to actually return one of the values, so I also added the return null; part
 
10:41 AM
Kinda paranoid, yet they had their reasons
Do note that in my code fragment they lost all exception info so they couldnt log anything useful.
 
hmm...
 
10:54 AM
Having reasons != Having good reasons.
2
 
11:32 AM
Agree
 
helloworld
 
ohai
 
 
1 hour later…
12:40 PM
lol, theres somebody from north korea who answered the survey :D is this legit?
 
Possibly with a VPN.
Without a VPN is unlikely
 
G K
12:53 PM
Hi all,
I wanted to set the StringFormat for a TextBox from code-behind in WPF application and tried with the following code.

var binding = new Binding
{
Source = DataContext,
Path = new PropertyPath((DataContext as MainVM).SelectedIpAddress),
StringFormat = "###.###.###.###"
};

TextBox1.SetBinding(TextBlock.TextProperty, binding);

But the textbox does not restricting user with the format of what I have provided. The above code I am calling from Constructor. Basically I wanted to restrict user to type in IP address formation.
 
1:06 PM
Hello, having a little trouble with .net core's DI right now
from what I understand, I just include the stuff I want injected in the constructor and it gets injected, right?
public ServerWatcher(ILogger<ServerWatcher> logger)
It's an asp.net core api project made from the template, it should have logging added to the services by default yet my ide still tells me that I need to supply an argument to the constructor.
 
and you have to construct the ServerWatcher from a call tree which is resolved by DI
 
I'm using core's built in DI
hm, so I can't just create new objects and expect the DI to fill them in
 
@CaptainObvious Maybe north korea govern related, its likely military would not have that censorship firewall
 
@Lett1 no. Whenever there is a new keyword, you are out of resolution chain
 
so, how do I get that thing inside the chain then?
 
1:19 PM
make a control, with custom constructor
and don't call it. It will be called by the routing
 
yes
 
Is that ILogger<> a Microsoft.Extensions.Logging.ILogger btw?
never mind my Ninject link. I see if you call Startup.ConfigureServices, it will by default set some bindings up by default
 
1:42 PM
yes, its the ilogger from the extensions
the class I want to use it in is not really related to the frontend, it's a watcher that runs requests periodically and saves it into a dict
 
hi, anyone has an idea how to remove items which are in a list of a list? :/
 
so list>list>items?
 
Parent[]
- ParentName
- Childs[]

var withoutKate = parents.SelectMany(y=> y.Childs).RemoveAll(x=> x.Childname == "Kate");
something like this
 
@bradbury9 If that was the case I doub't they'd be allowed to be doing the Stack Overflow Developer Survey for 20 minutes or so on the clock
 
1:57 PM
well i'm doing it now like this and it works:

var activeTrades = new List<int>() { 13711183, 13711183};
foreach (var opSkinsApp in inventory)
    opSkinsApp.Items.RemoveAll(x => activeTrades.Contains(x.Id));

but it would be nice to know how to "LINQify" this foreach :D
 
is there a data structure that is like a two way dictionary so you can query with values and it'll return keys?
 
maybe Tuple :o
 
sounds like a list of tuples to me
 
no no.
tuple is just collection of objects. afaik
i want to be able to do: dict[key] == value && dict[value] == key
 
touple.Item1 == key && touple.Item2 == value <- hmm isn't it what you want?
 
2:09 PM
nope.
would i be able to access the items using the syntax above?
something to make this more maintainable
    enum MyEnum
    {
        Mon,
        Tue,
    }

    void Main()
    {
        var toStringDict = new Dictionary<MyEnum, string>
        {
            {MyEnum.Mon, "Monday"},
        };
        var fromStringDict = new Dictionary<string, MyEnum>
        {
            {"Monday", MyEnum.Mon},
            {"Tuesday", MyEnum.Tue)},
        };

        var key = MyEnum.Mon;
        var stringRepr = toStringDict[key];
        var fromString = fromStringDict["Tuesday"];


    }
someone has already thought of it and it wasn't a tuple.
85
A: Two-way / bidirectional Dictionary in C#?

EnigmativityI wrote a quick couple of classes that lets you do what you want. You'd probably need to extend it with more features, but it is a good starting point. The use of the code looks like this: var map = new Map<int, string>(); map.Add(42, "Hello"); Console.WriteLine(map.Forward[42]); // Outputs "...

can you create a custom object similar to enum?
ie a class or struct where you can add and remove fields in initialisation ?
so you could do class.myfield
 
2:25 PM
Google has deserted me. Is there a way to do this in one line?
	var myCollection = await myClass.GetCollectionAsync(1);
	var myObject = myCollection.Where(i => i.Id == 1).FirstOrDefault();
 
callbacks?
 
(await myClass.GetCollectionAsync(1)).Where(...
 
or that
 
@Default D'oh. Didn't think of that, how silly. Thank you
 
im curious - what did you google? :)
 
2:29 PM
@Default c# async collection where
 
ah.
 
Linq commands often don't get the best google results, being adverbs and all
 
so, is there any kind of hint I can give to the runtime that it should inject into that class?
 
you might have found it on await collection where one line - at least for me on duckduckgo it lead to this one stackoverflow.com/questions/35011656/async-await-in-linq-select
well - this worked too of course
@MattThrower I think google knows me too well - I usually find what I'm looking for in the top results.
 
@Default :)
 
2:35 PM
scary / handy.. meh..
 
@Default Does that mean it usually gives you the .... default result?
 
hurr hurr :D
 
I have a asp core project where I use autofac to inject dbcontext. I select Singleton option as EF Core is not thread safe. But when i run a code that suppose to run 30 threads I see only 2. Does singleton prevent construction of new class or simply makes it wait?
 
2:51 PM
I select Singleton option as EF Core is not thread safe - what?
 
If the injection is not singleton then I get thread issues
When multi threading. I ensure dbcontext is ServiceLifetime.Singleton
 
3:16 PM
@YousufHossain How many cores? You could setup lots of cores, but if there are not enough vcpu cores...
 
@bradbury9 you're not gonna call xy? I'd call this xy..
 
when you store type of a instance in var. how can i use the value of that var in a generic function?
eg: var CachedTye =....; GenericFunction<Cachedtype>();
 
3:39 PM
@bradbury9 it is matter of EF core thread handling. The problem is not that it is not doing 30 in parallel. The problem is that it is doing 2 then stopping. Not doing the rest
 
I'm out! \o see you tomorrow
 
4:27 PM
Visual Studio has been crashing and automatically restarting a lot today
I've gotten a couple error messages that say to check ActivityLog.xml but I'm not sure what to do with the information in it.
 
mr5
5:16 PM
I noticed, VS2019 would randomly crash on a large code base.
 
5:46 PM
@Hypersapien I have never, not once, ever gotten anything useful from VS crash files.
 
6:19 PM
The error messages in the file said something about Out of Memory
 
 
2 hours later…
user10864482
8:35 PM
hello
 
user10864482
9:26 PM
hello user
 
11:31 PM
Morning O/
 

« first day (3099 days earlier)      last day (1863 days later) »