|
In general terms, I know that. I've used Windows since almost day 1, and I don't recall ever seeing a drag work when the mouse pointer moves outside the boundaries of the windows that has the focus. That's good to know, so long is it doesn't make the thing 3 parsecs wide.
David A. Gray
Delivering Solutions for the Ages, One Problem at a Time
Interpreting the Fundamental Principle of Tabular Reporting
|
|
|
|
|
foo.TryGetValue("bar", out object value);
var somestr = value.ToString();
Sort of defeats the purpose of the try when foo doesn't have the key "bar" or even if it does, the value might be null.
If I show this to the person who wrote it, do you think they'll suggest a try-catch block to not break the rest of the code?
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Brilliant! Promote this programmer to management so they don't write code that breaks the system with random null reference exceptions.
|
|
|
|
|
At least he tried
|
|
|
|
|
A classic case of "when a little knowledge is a dangerous thing". They understood that they needed to use TryGetValue() but not how to use it.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Prolog has the notion of "fail" and handles this gracefully (Visual Prolog in the example below):
facts % key_value lookup table
key_value : (string Key, integer Value).
predicates
tryGetValue : (string Key) -> integer Value determ.
clauses
tryGetValue(K) = V :-
key_value(K, V), % FAILs here if undefined key_value/2
!.
|
|
|
|
|
Ah, but there is no fail without try.
Nobody special
|
|
|
|
|
They were probably so thrilled with using inline type declaration they thought their job that day was done
|
|
|
|
|
var somestr = foo.TryGetValue("bar", out var value) ? value?.ToString() : null;
Would that be better?!
|
|
|
|
|
Pulled the hard disk from a Ubuntu system, swapped it into a different laptop. Very different configuration; about the only thing they have in common is a manufacturer's badge and a QWERTY keyboard.
The first boot took a little longer than usual, but it came up seamlessly.
Try that with Windows!
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
A long time ago I did something similar on a Win 95 (or was it 98) machine. Whole new motherboard, processor, etc. When it booted up I saw some messages about updating various drivers, which it did fairly seamlessly. I don't remember for certain, but I think it did ask to be rebooted, but after that it came up just fine...
No idea what Windows does now though...
|
|
|
|
|
I did it recently: changed the MB, Processor, and RAM. Heck, I went from a E6700 to an i5 and a totally different MB and BIOS manufacturer.
Turned on the power and it booted fine - possibly a little slowly but not much off the original boot time.
Only hassle was the "Windows Activation Licence" which - rightly - decided it was different hardware and I needed to reactivate.
That would have gone smoothly if I had less than three monitors, or the remote desktop software MS technical use could see more than just the middle one. Or if the taskbar had been on that monitor, I guess that would have been handy. Of course, if the "activation failure" detector hadn't deliberately disabled any changes to the desktop at all that would have helped.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I did it with my kid's pc too. Whole new pc. Swapped old HDD out into new box. Win 8.1 Started up just fine!
|
|
|
|
|
|
See The Lounge[^] (Bug Of The Year, aka Booty! ) posted by Super Lloyd yesterday
|
|
|
|
|
I even quickly checked to see if no one already posted this. Guess I'm blind...
|
|
|
|
|
Indeed, yeah!
Though weird and wonderful is a better forum for it... For some reason I didn't get the link to it that day.. (sometimes the menu link to some other forum is not there, quite strangely )
|
|
|
|
|
And worse, it takes two clicks of the Cancel button to dismiss the print dialog!
/ravi
|
|
|
|
|
And.. you are totally right!
|
|
|
|
|
This is from an enumeration:
Completeed = 2,
I could understand Compleeted , but this just leaves me teed.
Now I'll have this shyte in my code.
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Looks like it's time to add some tech debt to the backlog. I just hope it isn't customer facing.
/ravi
modified 19-Jun-19 22:21pm.
|
|
|
|
|
Ravi Bhavnani wrote: I just hope it isn't customer facing.
No, but when I serialize the enum value to a string (I don't trust this company to not change the ordinal values), I don't want the client-side Javascript to continue this atrocity, so it looks like I'll have either a special handler case or map the enum with the typo to my own enum and deal with ordinal value changes if they happen. Or some other half-assed solution.
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Marc Clifton wrote: I don't trust this company to not change the ordinal values Say it ain't so!
/ravi
|
|
|
|
|
I have to put up with a production code path containing "Intergrated" instead of "Integrated". It's been there for years so no-one wants to touch it!
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Inter - place into a grave or crypt
Grated - like to grate cheese, etc.
to place shredded cheese into a grave or crypt. It could happen.
|
|
|
|