|
A profiler is a tool like anything else. It can sometimes expose inefficiencies that you never would have thought of, or other times be useless (e.g. you can't fix what is using most of the CPU time/memory without a significant redesign). A person's assumptions of what is and isn't efficient can also be flawed.. Even with an experienced developer, when it is based on past observations, which could dramatically change with a single new release of your runtime/external libraries/compiler.
The same could be said about using a debugger vs. just adding debug logging. With a debugger you may be wasting a lot of time tediously stepping through the code execution, instead of letting it run and simply browsing the debug log to narrow down the problem. But sometimes simple debug output isn't enough, and a debugger is required.
|
|
|
|
|
As of last night, for some reason, I could not view some PNG files on a website that I manage. Weird as hell! Changing them to JPGs and they were fine. Anyone had something similar recently?
|
|
|
|
|
Maybe you're hiding the PNG files in the web.config or the images with such extension are denied access to in your settings. Possible errors are like this.
Favourite line: Throw me to them wolves and close the gate up. I am afraid of what will happen to them wolves - Eminem
~! Firewall !~
|
|
|
|
|
Possibly. Will have to check the GoDaddy settings. I know I haven't touched it and there's no on else working on this.
|
|
|
|
|
Bassam Abdul-Baki wrote: GoDaddy
I think I have isolated your issue.
What do you get when you cross a joke with a rhetorical question?
---
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
|
|
|
|
|
It might be mime type mapping. It used to be browsers would ignore that for images, but now they will error out.
|
|
|
|
|
Not this or that problem after all. For some reason, having spaces in long filenames (%20) appears to be a problem. Short names are fine. Underscores are fine. Renamed all files to use underscores instead of spaces. Inherited poblem.
|
|
|
|
|
Just curious, did you try using + 's instead of %20 's in the URLs? While they *should* be decoded to the same thing, maybe the server was treating them different.
|
|
|
|
|
No. I haven't had time to test it to see if it's just that website even. Thanks!
|
|
|
|
|
I was reading about the improvements in C# 6, and I can't wait to try this one out, even though the syntax is ugly as sin.
Quote: Null Propagation Operator
The null propagation operator is a concise syntax that enables chaining ‘.’ operations without checking each receiver against null. We can write expressions such as:
var zip = customers?.FirstOrDefault()?.Orders?.FirstOrDefault()?.Address?.Zip;
The value of zip is either the zip code of the first order from the first customer, or null if any of the expresssions return null (customers, FirstOrDefault(), Orders, FirstOrDefault(), or Address). If the Zip property of Address is a value type, zip is the the corresponding nullable value type.
This can simplify that “arrow” style of coding where we have multiple nested if statements where each if clause checks a variable against null.
from: http://thebillwagner.com/blog/overview-of-c-6-language-enhancements[^]
|
|
|
|
|
Agreed, this is a really nice syntax extension (yes its ugly), and may even help reduce the number of null references exceptions.
More stuff like this, and less of the async/await type stuff please.
Regards,
Rob Philpott.
|
|
|
|
|
I like both. I've worked on many projects that used IAsyncResult and the async/await syntax would have really really helped me out.
|
|
|
|
|
..yes, you're right, but, I'm going to miss the NullReferenceException. I liked that annoying little fella!
But I am obviously going to try this out. It is a short form of the try catch block for the NullReferenceException.
Favourite line: Throw me to them wolves and close the gate up. I am afraid of what will happen to them wolves - Eminem
~! Firewall !~
|
|
|
|
|
Nice, indeed.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
|
It can be useful, but also very bad. Think about such code in your sample, with NullReferenceException you had a way to know where the chain broken...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Not without putting it on separate lines. I've found myself doing hacks with either the ternary operator, or
var a = (obj ?? new Obj()).Value
or other ugly hacks just to make things a little more succinct than nesting a bunch of if statements to get the same effect.
|
|
|
|
|
When you had the punishment of NullReferenceException hang over your neck you would not dare to write all that in a single line anyway, but checking each and every part for existence an validity...IMHO it's a much better way - 'fail with grace' I think...
The new syntax is ugly and can get you into serious problems when need to be debugging...
The only sure thing - it will increase Q&A income
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I can see that you don't like this at all, and it doesn't fit the style of code that you write. I'm sharing something that works for me.
However, there is plenty of code I write where this is exactly the behavior I need. There are many forms that I deal with where null signifies something that isn't filled out, and I currently have to write extra code that is harder to read.
|
|
|
|
|
Hi KEP,
I would assume that a statement like the one shown by the OP would be followed by a test for a 'null result, possibly deliberately throwing an error if the result was 'null ... at least in the development stage. Once a 'null result is detected, one could set a break-point, and easily determine which operation returned null ?
This is, of course, speculation
cheers, Bill
“I have diligently numbered the days of pure and genuine happiness which have fallen to my lot: They amount to 14.” Abd-Ar Rahman III, Caliph of Cordoba, circa 950CE.
|
|
|
|
|
You assume to much - we have developers do not check for null even today. Imagine one learned to develop with the new syntax...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
A definite keystroke saver!
/ravi
|
|
|
|
|
That's exactly what I thought when I came across that too. At some point, I was actually considering implementing this, even though performance wouldn't be great:
var zip = StopAtNull<string>(() => customers.FirstOrDefault().Orders.FirstOrDefault().Address.Zip);
In fact, I think I saw a tip/trick along those lines. I'm glad to see this made it into the language itself.
|
|
|
|
|
So that would just wrap it in a try/catch(NullReferenceException) { return null; }?
Yeah, I assume the built in version would check at each operator which would probably be faster in most cases. Your method would also swallow null reference exceptions thrown from with functions which might or might not be what you want.
|
|
|
|
|
The idea was that it would use expression trees to break apart each call and check for nulls at each step.
|
|
|
|