55 karma · joined July 20, 2020
A beaver might instinctively know how to build a dam because it's built into its DNA, but a human can read the writings of past dam builders, learn the abstract theory of dam building, come up with their own improvements, debate those changes with other people interested in dam building, communicate their design to dam builders, and publish their work to become a permanent part of dam building literature. For a beaver to change how it builds dams, it would require a change in their DNA to pass on to future generations.
I'm almost expecting a few years down the road, Microsoft will go back on 4.8 being end-of-the-line for .NET 4 and start releasing new minor versions of it because of all the customer code that can't be ported to .NET 5. Or maybe it will just end up like VB6. Stuff written in it still works, and will continue to work, but it's considered a dead language.
The worst thing I've experienced with Dvorak is typing "ls<enter>" repeatedly. It's really painful on the pinky. Putting L on the right pinky stretch was a really bad decision.
One advantage Dvorak has over Colemak is that it's included with every OS and easy to switch to, whereas Colemak often requires a download and an install to use. And some games include Dvorak keybindings, but I haven't seen one with Colemak keybindings yet.
I learned Dvorak back in college, and got fast by playing muds. Type fast, or you're dead. Took a few months to get up to speed.
"Access Denied You don't have permission to access "http://www.costco.com/" on this server."
Is this from running NoScript? Or does it affect all Firefox users? (Also the URL is https://, not http://, so the error message doesn't match the URL).
So we have a hydro-carbon, we mix it with oxygen, and the oxygen combines with the hydrogen and the carbon, and releases heat as a byproduct. The heat energy increases the pressure of the newly created CO2. This higher pressure is placed on one side of a turbine or a piston, and we extract useful work by moving it from a high density state to a low density state, causing it to cool in the process.
Now it seems like if you want to re-concentrate that CO2, it should take at least as much work to compress it back to its original size as it released when you burned it in the first place, and probably a lot more, because the CO2 has been diffused into the general atmosphere.
To state it more succinctly, we extract work through a pressure differential, and by reversing that pressure differential, won't that require more work than we got out in the first place by the second law of thermodynamics?
I ignored the part where part of the energy is coming from the hydrogen. Is the hydrogen -> water where most of the energy is coming from, and the carbon part relatively insignificant?
WinForms designer is actual C# code, you can copy and execute that code outside of the designer. It's possible to search for references to a control in the designer, just the same as any other code. Often in Delphi, trying to accomplish the same thing in code as in the designer had a very obscure relationship. WPF feels much closer to the way Delphi did things, where your GUI is defined in different format than your code.
In WinForms, creating a new control requires, well, just write a class that descends from Control, compile, and then you can start using it. In Delphi, creating a new control means you need an independent project, compile it into a package, and figuring out how to install it. I remember fighting Delphi trying to understand the package management system, and it was way more complicated.
In WinForms, when you design a new control, it actually executes your code, so design time behaviors actually reflect what will happen at runtime. I remember having stuff in Delphi where a large control would be collapsed into a single line, and you couldn't actually tell what you were working with until you run it.
Can you explain this a bit more? I've always heard that there are supposed benefits to writing business logic in SQL, and I've made efforts to put it into practice, but the more I deal it, the more I dislike it.
I just finished rewriting a complex calculation that was being done in SQL into C#, and the C# runs about 10 times faster, is easier to understand, easier to debug, easier to change, and easier to test. The SQL was written as a series of views each building on top of another, some doing grouping, some doing calculations, etc. until it gets the final result which is copied into a table.
Let's say I need to calculate intermediate result A (like maybe a giant case statement) as input to calculate B, C, and D, which will then go on to be combined in various ways. In order to avoid inlining complex calculation A in 3 different places, I can either write a sub-select, a CTE, put it in a view, or copy it to a new table variable. But no matter how I handle it, I end up with layers and layers of nested select statements, each performing one more step of the calculation. Doing the same thing in an imperative language usually ends up seeming trivial compared to doing the same thing in SQL. In C#, I'd just add a function or read-only property to calculate A, and then use that wherever it's needed, but in SQL, adding such a requirement can mean restructuring the entire query.
In another case, I've taken a stored procedure that selected data into a table variable and manipulated that, and rewrote the whole thing in C#, getting a 15x performance gain (from almost a minute down to 3-4 seconds, and pretty much all that time is retrieving relevant rows from various tables). It does the exact same work, but working with classes instead of a table variable. When I originally started working on the stored procedure, it used cursors, and took 15 minutes to run.
In another case I was recently working on, what should be an efficient calculation joining 5 tables together into a view ended up taking several seconds to select one record and is called quite frequently (i.e. like 50 times in a second during application startup). I added an index to speed it up, but instead that index made other queries unbearably slow because the optimizer for those queries completely changed how they were executed based on the new index. So I put triggers to copy the view to a cache table every time something changes that the view depends on. But now it takes several seconds for each update of a row, which is still a win, because writes are maybe a few times a day, but reads are continuous. But it means that updating multiple rows at once will now be really, really slow, because the cache table has to always be up to date, and the trigger has to update it preemptively rather than lazily, because querying from the cache table can't cause it to update itself. I might end up having to rewrite the trigger to do the joining in C# if it causes too many performance problems.
On another database, I have to manually call update statistics pretty frequently, or the query optimizer breaks (i.e. extreme slowness), because frequently appending hundreds of records to a table that holds over a hundred thousand rows with an auto-increment primary key should obviously invalidate the entire query plan. I'm not blaming this on a poor job by the query optimizer. Rather, on the fact that SQL depends too much on letting a generic query optimizer decide on the fly what it thinks is the best way to accomplish a complex query, instead of writing code that will always have deterministic performance characteristics no matter what the statistics say. It's a blessing and a curse that the query optimizer can change based on actual data. But that seems much more important for writing ad hoc queries, and when writing an application, I think it's more important to have more direct control over the performance characteristics.
SQL definitely has its strengths, and I have no desire to stop using it, but I don't understand the claim that it's good for writing general business logic. Maybe I just haven't seen the places where it really shines in this regard, so I would like to hear about ways it's better, because maybe I'm doing it wrong.
For example, to use record syntax, you need to define this attribute:
namespace System.Runtime.CompilerServices { public class IsExternalInit : Attribute { } }
And supporting the new indexing syntax requires you to define System.Index and System.Range types, which are a bit more involved, but still pretty trivial:https://docs.microsoft.com/en-us/dotnet/api/system.index?vie... https://docs.microsoft.com/en-us/dotnet/api/system.range?vie...
But pretty much all the other new C# language features I've tried have just worked straight out of the box with .NET 4.7.2.
https://stackoverflow.com/questions/861384/is-it-possible-to...
Imagine trying to learn to read English, and instead of seeing words, you see a bunch of letters and have to decipher each letter. I'd almost describe it as dyslexia for musical notation or something (which isn't a problem for me when reading text). I can recognize C,D,E,F,G pretty instantly because of their position relative to the bottom bar of the treble clef, but as soon as you start getting above that, I start having to count spaces relative to a known position, because everything internal looks like a big jumble. So G-B-E (on the treble clef) is easy because I see G as the base, and then the other two notes are space by two, but if it's just B-E without the context of the G, I have to stop and figure out exactly where those notes fall. And as soon as I get below C (on the treble clef), I start having to stop to count the separator lines.
But if I can hear what I'm trying to play, I can usually just jump to the correct note/chord. Maybe I'll have to stop and experiment to get the right chord periodically, but I don't have to stop and analyze the position of each dot on the score. To me, the greatest value of sheet music for me has always been in keeping place, so I associate the location of specific patterns on a specific page, and based on all the context, and know that I'm supposed to be at this point in the song that I've already taken the time to memorize beforehand. But I'm pretty much never paying attention to the actual notes on the notation at that point.
int BinarySearch<t>(t[] array, t find, int min, int max, Comparer<t> comparer)
{
int mid = 0;
while (min <= max)
{
mid = (int)(((long)min + (long)max) / 2);
int compared = comparer.Compare(find, array[mid]);
if (compared > 0)
min = mid + 1;
else if (compared < 0)
max = mid - 1;
else
return mid;
}
return ~mid;
}Even though I'm a lot better than when I was a kid, I've only made it up to level 14 so far.