|
I'm gonna guess a spoonful of #3 with a drizzle of #2 to really bring out the flavor.
|
|
|
|
|
I understood what you are saying.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
A situation where I was dead certain it cannot happen but ...
Rings a bell?
|
|
|
|
|
I always place assert(false) or its equivalent in places where I am sure that it "can't happen". I've caught many nasty bugs this way.
A usage example would be the 'default' clause in a switch statement (when there is no reasonable default).
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
I throw an exception:
switch (unit)
{
default: throw new ArgumentException($"Unknown Unit type: {unit.ToString()}");
case Unit.Mm: mult = 1.0f; break;
case Unit.Cm: mult = 10.0f; break;
case Unit.Imperial: mult = 25.4f; break;
}
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
In C++, C#, or Java, I agree that's what you should do. In C, the best you can do is something like I outlined.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Interesting, I always thought you needed to have the default clause last.
Well that adds readability.
I think.
Wrong is evil and must be defeated. - Jeff Ello
Never stop dreaming - Freddie Kruger
|
|
|
|
|
I like all my validations at the top of a method, so it's just an extension of that: since cases can get quite long when there a few of them it's just more obvious to me that there is a "default fail".
If it's off the bottom of the screen it's harder to see and associate with the switch.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I made the experience that logging "this shouldnt not happen" is more cool, because in such situation I am to angry and nervous to mess with an exception stack.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I see two problems with this approach:
- You may not notice the entry in the log (is happens even to the best of us, sometimes )
- Executing the "can't happen" code may cause the output to be corrupted. In many cases, it is better to get truncated output than wrong output.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
But an assert means the program is crashing and this is extrem bad when I want to debug that issue.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Put a breakpoint on the assert() statement.
The debugger is your friend.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
and so it explodes one step later.
Maybe I should tell you that I work with XCode in which moving the next call with the mouse doesnt work
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Despite having \\SGNAS in my Hosts file, my desktop is fine, but my Surface keeps losing SMB1 devices completely, via IP or domain name.
This was getting frustrating ...
Then I found this - ProviderFlags ([Samba] Re: msdfs root problems even after a reboot?[^]) and it seems to be working so far:
1) Open Regedit and accept UAC.
2) Navigate to HKEY_CURRENT_USER\Network
You should see a list of mapped drives as individual keys:
A
B
M
P
S
V
W
X
3) Open each drive twig and add a new DWORD32 Key named "ProviderFlags".
3) Set the value to 1 (you can just press ENTER to open the edit box once it's highlighted)
4) Reboot.
With the domain / IP mapped in Hosts*, all seems fine and indeed considerably faster than it was before the 2004 upgrade!
* Easy to do:
1) WINKEY, then type "notepad" - right click and select "Run as Administrator"
2) Accept UAC
3) Open the file "%systemRoot%\System32\Drivers\etc\hosts"
4) Add your mapping: "192.168.0.11 \\SGNAS #Seagate BlackArmour 16TB" is mine
IP first, then at least one space
Domain next, I use the \\ prefix but I'm not sure it's needed. (If it ain't broke ...)
Anything after "#" is a comment.
[edit]
I've written this up as a tip: Finding my network shares on SMB1 drives after the Windows 10 2004 update.[^] so it survives a little longer than this thread will!
[/edit]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
modified 23-Aug-20 8:12am.
|
|
|
|
|
Given that SMB2 has been around since 2006, there is no excuse for NAS providers not to support it. Given the known security flaws, supporting only SMB1 is IMO criminally irresponsible.
For that matter, even SMB3 has been out for over 8 years.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
While it is true for new devices - let say after 2008-2010, MS has no excuse to drop them just like that...
(We gave 20 years of support, so we still have some Novel-area servers from the 2nd century... In case...)
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Unfortunately, that doesn't mean NAS manufacturers will update older devices, even f it is probably just a case of loading new drivers into the kernel.
Too many companies assume that nothing needs maintenance or updates once they have your money ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Checked on my VM and the connection is stable, however do not know about speed (maybe these devices are too old for that)...
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
When I opened a file from the NAS, there was always a couple of seconds delay before Excel, Word, or VLC opened and began loading it - I always assumed it was the NAS spinning up disks from the "power saving" state.
But now it's pretty much instantaneous. Noticeable difference!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I had never such delay... I do not think that theses old disk can go to sleep (or they sleep always anyway)
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
Until just now I believed negative integers were just a flip of the first bit. Wow, how wrong I was, for MANY years! Are there some architectures where that is the case, to make myself feel a little better?
|
|
|
|
|
There are two ways to represent negative numbers: "sign & magnitude" and "two's-complement" - the "flip the top bit" approach is the former, and was used extensively by IBM until around the 70's bby which time it was clear that two's complement was a "better" solution (i.e. easier to implement in hardware, and didn't have a "negative zero" which is a odd concept all on it's own).
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OTOH, two's complement has an oddity that -MINVALUE == MINVALUE, which for some use cases is even worse than "negative zero".
(e.g. in a 16-bit system, MINVALUE = -32768 == 0x8000, and -MINVALUE == (~MINVALUE + 1) == 0x8000)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
That depends, some systems have a "negative space" that is one larger than the positive space (or consider 0 to be a positive number, which is also an odd idea)
We'd need to move away from binary computers to sort all this crap out!
Can I suggest trinary? "True", "False", and "Dunno"?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you have a "negative space" that is one larger than the "positive space", then you must either have the anomaly that I discussed, or raise a flag/generate an exception when calculating -MINVALUE. Both are bad solutions, but the latter is safer, in the sense that you won't get bad results without knowing about them.
We could avoid the anomalies and use any base we wished, if we didn't insist on encoding the sign as part of the number. For example, we could use a trinary value (positive, zero, negative) to represent the sign, and whatever base was convenient to represent the magnitude. If the sign is zero, the magnitude would be ignored. The problem, as you stated in your original answer, is that this is much more difficult to implement in hardware.
EDIT: IIRC, the Zuse Z3 (?) actually had a trinary sign bit.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|