Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Jabor
Jul 16, 2010

#1 Loser at SpaceChem
So when you say "client", the part that's failing is when the customer connects to your service from their own machine?

The first step would be reproducing the failure, even if you have to do it live. Then instead of just "not trusted" (which could be anything) you can take a look at the failure and see the exact reason it's not trusting the certificate.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

epalm posted:

Yeah, I was thinking about timeline earlier. Could happen either way, right? On one hand it could be right after installing, on the other a bug could sit there for a week before crippling the software in a way that downgrading to the previous version is better/cheaper/faster than getting a fix out to the client. We write software for an industry that sees "new" things as bad and scary, so "put it back to the way it was" is a frequent sentiment (whether misguided or not).

I'm not sure how often this is the case. How much testing do you put into your downgrade scripts to ensure that they don't break things even worse in the hypothetical scenario you're considering?

One thing you can do is to have two phases of each release - one release with just the new database version, and then the real release with the actual logic and code changes that depend on those database changes. This gives you an intermediate point (the old version of the program, running against the new database) that you can safely roll back to. And if it turns out you do need to roll back the database migration, you can use that intermediate point to do so without causing any issues in code that relies on the upgraded database.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Suppose you have a ProtocolEntry x, which represents tcp ports 60-120. And you have another ProtocolEntry y, which represents tcp ports 80-100.

The issue is that your HashSet has no way of knowing that y represents a "subset" of x - all it knows is that the ProtocolEntrys are not equal, so neither HashSet is a subset of the other.

If you want a slightly-less-kludgy version of your current solution, you can do as Nihil Credo suggests - use a helper method that, instead of returning a port number (that's only meaningful if you already know the protocol), returns a tuple of <protocol, port number>. Then you can stick those in a set and subset it.

If you want a cleaner solution ... fundamentally, with your current api, the code doing the comparison has absolutely no way to tell that a particular protocol entry represents a range of ports with defined endpoints. The only way that it can look at a ProtocolEntry is to iterate over all the individual ports that the ProtocolEntry contains. So you're going to have to expand the api with this particular use case in mind.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
I mean, why not just use resources like the analyser suggests? It's easy enough to set up, and once you've done it the usage is basically identical to your constants class anyway.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
I mean, the baseline evidence in favour is that "Microsoft's code analyzer is recommending them", which certainly suggests that they're the generally recommended way to handle UI strings - or at least worthy enough to look into rather than uninstalling the analyzer in a huff.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
What is your goal here?

Are you trying to prevent yourself from accidentally breaking the singleton contract by using reflection or serialisation internally?

Are you trying to prevent malicious code from deliberately creating multiple singletons for some nefarious purpose?

Are you trying to make it easier for benign-yet-incompetent developers to use your singleton the "right way" as opposed to hacking up a seemingly-working-until-it-doesn't solution using reflection?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You can put your singleton in an assembly with the DisablePrivateReflection attribute.

Keep in mind that, like the Java solution, this doesn't stop anyone copying your code and changing it to allow what they want to do.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Uh, perhaps don't?

Users have expectations about how a text field works based on how literally every text field across the entire operating system works. If you do some fuckery that makes your text field work differently, everyone is going to hate it.

If the user wants to go back to typing at the end, they will click at the end where they want to type after they're done copying the stuff they want to copy.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It feels like the best way to do that would be to make the rich text read-only, and have your code track the text caret position within the control and handle text input. That is, assuming you can't find a more appropriate console input control to handle that for you.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Rocko Bonaparte posted:

There's a way to set the rich text box as read-only while still being able to type into it?

(I'll believe anything about that thing at this point; it's not been the most logical GUI widget that I've tried to use.)

You don't want users to be able to arbitrarily type into it - you only want their inputs to end up in the command line part.

So leave the richtext as read only, and only update it from your code. You could handle key events yourself and figure out what changes they mean, or pass them to an invisible textfield that only has the editable command line.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If you bisect those commits, you will only need about seven builds to figure out which commit actually introduces the problem.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Embedding a webview is bad because at that point the user is ultimately typing their third-party credentials into your application and just trusting you to not misuse them.

You shouldn't have any firewall issues if you make sure you're only listening on the loopback port.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Your other options are:

- Defensive copying, where your read-only accessors make a deep copy of anything mutable and return that
- Immutability, where the objects you're storing in your state cannot ever change, and anything that wants to change the state does so by creating new objects and replacing the existing ones
- Annotating the interface return values to suggest that they shouldn't be changed, and writing an annotation processor that fails your build if it detects someone breaking the annotation contract

They're all some combination of "a lot of work" and "not so hot for performance". I'm not sure if anyone has already built an annotation system you could use, which would make that a pretty palatable option, but I suspect not.

What you really want is something like c++'s const keyword, which unfortunately doesn't exist in c#. (C# const means something different).

Having read-only interfaces for everything is honestly not the worst option.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The key insight to coming up with a recursive solution is to look hard at your incremental step - suppose you have a solution for three different dictionaries. As in, you've run the code, and you've got your solution back out of it.

Now someone comes along with a fourth dictionary, and asks you what the solution would be if you had had that fourth dictionary in there from the start. Can you do that? And can you generalize that so you could do exactly the same steps if someone then came along with a fifth dictionary, and a sixth, and so on?

Once you know what your incremental step is, the base case is frequently pretty obvious. Then you can write your recursive solution:

code:

Solution solveRecursively(Problem p) {
  if (isBaseCase(p))
    return baseCaseSolution(p);
  Solution smallerSolution = solveRecursively(smallerProblem(p));
  return incrementalStep(p, smallerSolution);
}

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Are there individual test cases in those that take an hour to run, or does it just take a long time to run the tests in aggregate because there are so many and you don't have enough machines to run them all in parallel?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
I think the idea is that these comparators are being written in an embedded scripting language by someone using Rocko Bonaparte's software, and while it's okay for the sort to run dogshit slow if the user writes a bad comparator that blocks on something, it's not really okay for it to block a thread and stop other operations from proceeding.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

insta posted:

I mean, at some point, some business unit said "we need to let them draw Win32 controls onto a form so they can attach to the events..." in order for WYSIWYG editors like VB6.

Yeah, enormous teams have spent millions of dollars on these sort of things and still have not managed to accomplish the dream of "software being meaningfully createable by someone who is not a developer". You're unlikely to succeed where they have failed.

My recommendation would be to encourage your clients to accept that, and provide them with library components that a developer on their end can very easily assemble into a dashboard for their specific needs.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You're looking for the intersection of all the sets of tags.

You could do something like:
code:
var tags = new HashSet<Tag>(videos[0].tags);
foreach (Video v in videos.Skip(1)) {
  tags.IntersectWith(v.tags);
}

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The right answer is to use a log method that accepts a format string, so it doesn't even need to do the formatting if there's no log sink connected that would receive the message.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Can you wire up a second log sink that accepts logs at a more verbose level from the paths of interest?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Rocko Bonaparte posted:

Is there a priority queue available for .NET 4.x that has a decent iteration for deletion? I am using one for a scheduler in a Unity project and I just realized I should be canceling out scheduled items on stuff that gets deleted. I saw the implementation did iteration by creating a list of every element and returning it. It spares me invalidating the iterator, but that's still kind of gross.

I had this in this project a long time ago and I don't even think the .NET 6 one was even around. I can't use it anyways since Unity's stuck back in .NET 4.6. This one came from a NuGet: https://www.nuget.org/packages/OptimizedPriorityQueue/. I was also using it for an A* pathfinder before I decided to just buy an asset to do it better than I could be bothered to ever refine, so I don't have as much of a compelling reason to use this particular one other than Unity and it's .NET fickleness.

I can consider just using a completely different data structure for all it matters.

I just had a look at the code in that library and it looks like it's only the slow, safe implementation that makes a copy? If you're looking to optimize this for performance you can switch to the FastPriorityQueue implementation it provides in order to ... be faster, at the expense of not getting all those safety checks and needing to take more care around using it correctly.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Ugh, I always forget that c# iterators don't just let you remove the current element and keep iterating. That blows, because it's a really natural way to express exactly this sort of thing (and it would be easy to do for the heap - copy the last element over the current one, decrement the heap size, and re-heapify, just like with any other removal - the process of restoring the heap property will only touch either some of the elements that you've already iterated over, or some of the elements that you will iterate over in the future, never both, so you can just pick up the iteration where you left off).

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
That article is poorly written, the code it supplies is not how anyone would write it in a modern language, and I'm not sure anyone who learned programming this century would ever call it the "command pattern" anyway.

It's literally just like writing an event handler in javascript. When you create your event handler, nothing happens right away - you just get something you can invoke later that will do the thing you've specified. You pass that something to the system, and the system then invokes it at an appropriate time.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

worms butthole guy posted:

Yeah sorry I should've said that my interest comes from this book which discusses it:

https://gameprogrammingpatterns.com/command.html

but treating it like a event handler works. I think I have a better grasp of it now in literally treating it like MVC.

That page does a much better job of motivating it and talking about why you'd use it and why various aspects are there. I'd honestly suggest re-reading that page and mulling over it some more instead of looking for explanations on SEO content mill websites.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If you're just looking for a single mod, have you considered a binary search? Disable half the mods, launch the game, see if it's slow. If it is, then you know the problem mod is one of the still-enabled ones - if it's faster, the problem mod is one that you've just disabled. Rinse and repeat, looking at a smaller subset each time.

Should only take 7 or 8 launches to figure out which mod is responsible.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Kyte posted:

Why not await the background task?

Because then you can't do anything else on the awaiting thread until the background task finishes?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

TheBlackVegetable posted:

Is there maybe an open source licence that says "use this for free unless it's for development in an uber corp in which case cough the gently caress up"?

if you're using the stallman definition of "open source" then no, any open source license will allow commercial use as long as they abide by the terms of the license, the best you can do is picking something like agpl that's just insanely toxic and that commercial users want to stay away from.

if you don't care about stallman or fsf weenies, then creative commons cc-nc forbids commercial use (and you can sell commercial licenses separately under whatever terms you want). so as long as the license's definition of "commercial use" matches what you expect it to be then it'll do what you want.

Adbot
ADBOT LOVES YOU

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
yea fair, i'm probably getting them confused.

my big point was that if you want "open source but without this defining property of open source licences", there's a whole world of "not technically open source by some strict definition, but the source is available for people to look at and use if they want it" which may be a better fit

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply