@SebastianL The fuck should we know. What is all that shit? Why are you counting everything with an enumerable? Dafuq are you doing Contains on a list? dafuq does getreachable do
the efficiency is not why i asked this (i know that this is terrible), but i wondered why if (sw.Elapsed.Milliseconds >= 80) is not working, but i assume Contains is the bad guy here
Because you can easily have >20ms delay between the first and second time you check sw.Elapsed, which, I believe, isn't particularly reliable for <100ms resolutions anyway.
suuuure why not. It happen din the past, he woke up and came over just when i spawned in the airplaine. He was super excited to see the airplane and when i jumped out he said "airplane gone?.." sounded sad
You check sw.Elapsed. It's 70ms. All's good. Then you call Links.Count(), visited.Contains, Links[i].Content and visited.Add, any of which, and certainly all together, can push your running time over 100ms.
I'm not even sure what you're doing. For each link, you're going over all other links, looking for ones you haven't visited yet and are empty, and "visit" them?
But your recursive call both returns a list of cells and updates the parameter, which is confusing and probably problematic too.
I'm pretty sure you're duplicating Visited cells. You're passing it into getReachable which adds to it, and then returns the cells after adding, and adds again.
What what does Links contain? The set of possible links from your starting position? It doesn't look like you update it, so it will always go over hte Links from the starting cell, not from the cell it moved to.
1.) .Count() is pointless on a collection, use .Count instead 2.) Use something that has a faster .Contains than O(n), like HashSet (assuming your Cell hashes well and the hashing criterion doesn't change)
@RonaldMunodawafa Oh, yes, let's write a unit test for every goddamn thing the compiler should've seen in the first place. Because that's not a wasted effort at all!
I remember, when I had a parameter, which was handled as a list of strings. Then flattened it. It worked well in most of the circumstances. One time we called it with 1 item. Than it iterated through the string's chars, and flattened that... Can't reproduce
I'm trying to compare an edmx file to a database, and someone said there was an option to do that in VS2017. Is that true, and does the option exist in 2015?
You can always drop source code into folders that only source code goes into. Why you'd go out of your way to have no file extensions on your .cs files is beyond me, though. I can't see it being a recommendation, and I wouldn't be surprised if it messes up some 3rd-party IDE plugin somewhere.
How can I add icons to my VSTO buttons in the Ribbon Designer so that it shows me in VS and deployed on Outlook where it at the moment doesn't do that?
I never knew how many boxes of minerals I had until I began packing to move this week. It's enough to fill a closet, leaving only enough room to hang clothes on racks above.
No. Amorphous and non-solids don't qualify. It has to be a repeated and definite chemical structure. But that does make ice and salt minerals (house salt is officially called halite). I collect rocks like agate, etc. and minerals like quartz crystals. It's not uncommon for good specimens to be abundant when they show up, so I collected a lot...
In StreamReader, if you do while(!reader.EndOfStream) if I enqueue into a concurrent collection, do I need to store the index? Or will I be able to trust the ordering?
@KendallFrey I saw this example, I wondered why he couldn't use a ConcurrentQueue or another thread safe collection.
AllLines = new string[MAX]; //only allocate memory here
using (StreamReader sr = File.OpenText(fileName))
{
int x = 0;
while (!sr.EndOfStream)
{
AllLines[x] = sr.ReadLine();
x += 1;
}
} //CLOSE THE FILE because we are now DONE with it.
Parallel.For(0, AllLines.Length, x =>
{
TestReadingAndProcessingLinesFromFile_DoStuff(AllLines[x]);
});
So I was looking into Parallel processing, to read all the files.
// Todo: Wrap in Parallel
var contents = new ConcurrentQueue<string>();
using (var reader = File.OpenText(file.FullName))
while(!reader.EndOfStream)
contents.Enqueue(reader.ReadLine());
Parallel.ForEach(contents, index =>
{
// Do Stuff.
});
Something like that, where it does Parallel on the open / read, and then the action of parsing data to database. I know some constriction would occur on the IO.
is anyone good with EF and/or SQL Server? We have tables resources and work and a child table work_resources. We want to cascade delete work_resources rows when either a resource or work item is deleted. we can a circular cascade delete error when cascade on delete is on both foreign key relations.