The current documentation of both functions reads very similar to each another:
System.IOUtils.TPath.IsUNCRooted
System.IOUtils.TPath.IsUNCPath
Both are static members of the same class, with one of them decorated inline, so I wouldn't think they are separate implementations with equivalent functionality you often find across various Delphi classes (although examples within a common class do exist in Embarcadero's standard library).
Specifically, I can't come up with a case where a path is a valid UNC path but not a rooted UNC path. So what does IsUNCRooted even mean?
IsUNCRooted only checks if the parameter starts with an UNC sequence, while IsUNCPath also checks the rest for valid path names. So a valid UNCPath is indeed also UNC rooted, but not always the other way round.
Related
We have a query regarding referencing resources contaiend in another. Assume the scenario,
ResourceA
|- contains
|- ResourceB
|- ResourceC
And ResourceB has a reference to ResourceC.
In above case, is it mandatory for ResourceA to contain direct reference to both Resource B and C? Or is it suifficient for A to refer to B, as there is a tarnsitive reference to C already (A->B->C)?
Our intepretation of the FHIR spec is latter (i.e. transitive reference is sufficient), reading below statement from https://www.hl7.org/fhir/references.html#contained
A contained resource SHALL only be included in a resource if something
in that resource (potentially another contained resource) has a
reference to it.
However there is also another note under same documentation which is causing us a confusion, mainly as the example only demonstrates reference from current().
Implementation Note: Contained resources are still a reference rather
than being inlined directly into the element that is the reference
(e.g. "custodian" above) to ensure that a single approach to resolving
resource references can be used. Though direct containment would seem
simpler, it would still be necessary to support internal references
where the same contained resource is referenced more than once. In the
end, all that it would achieve is creating additional options in the
syntax. For users using XPath to process the resource, the following
XPath fragment resolves the internal reference:
ancestor::f:[not(parent::f:)]/f:contained/*[#id=substring-after(current()/f:reference/#value,
'#')]
Could you please help clarify this. Thanks.
The intention is that what you're doing should be allowed. However, the way the invariant is currently defined, it doesn't work - in either XPath or FHIRPath (the latter being more important). To be honest, we haven't figured out how to fully express it properly because what we're looking for is that there is a reference chain from the containing resource to all contained resources or a reference chain from the contained resources to the containing resource. There's no simple FHIRPath or XPath expression that allows for a recursive checking of this. (XPath's 'ancestor' only works on the instance, not the logical reference hierarchy.) So - what you're doing is technically non-conformant with R4. It (hopefully) won't be non-conformant in R5. And it's certainly in the spirit of what we'd intended to allow in R4...
Your interpretation is definitely correct.
I believe the xpath expression is fine, substring-after(current()/f:reference/#value, '#') extracts the Reference.reference.value field from the current node and strips the leading #. This is relative to the reference field, not the contained resource or container. The path ancestor::f:*[not(parent::f:*)] can traverse multiple steps up the ancestors to find the contained resources so it is indifferent to whether they're in the same resource or a container. It uses the constraint that contained resources can't contain more contained resources, otherwise it could be ambiguous.
The Effective go has following advice on naming of getters:
Go doesn't provide automatic support for getters and setters. There's
nothing wrong with providing getters and setters yourself, and it's
often appropriate to do so, but it's neither idiomatic nor necessary
to put Get into the getter's name. If you have a field called owner
(lower case, unexported), the getter method should be called Owner
(upper case, exported), not GetOwner. The use of upper-case names for
export provides the hook to discriminate the field from the method. A
setter function, if needed, will likely be called SetOwner. Both names
read well in practice:
Source: https://golang.org/doc/effective_go.html#Getters
Now, this advice doesn't seem to consistent as the stdlib itself violates this multiple times.
As you can see in above screenshot, there are multiple methods which use GetX naming convention which is advised against in the effective go guide.
So the question is is the advice given in guide wrong or these methods are named wrongly & would be fixed in future versions?
These names are not consistent with Go naming by design. Rob Pike, one of the Go creators, says this about the names in the OS package:
There are inconsistencies but this is the key point. It should be Stdout not StdOut, because that name is coming from the underlying system. Similarly it's Fprintf not FPrintf or FPrintF because that is a very familiar name. These names are coming into Go, not being created there, and the initial cap is the admission fee.
The names will not be changed in a future version of Go.
[go-nuts] FunctionName caseinconsistencies
A lot of the all lowercase names were chosen before we had really
figured out what the naming conventions should be. The rule we
adopted, which might be worth revisiting later, was that entry points
in package os or syscall, which are named after equivalents in C, just
had a single capital at the beginning, to avoid needing to decide
where the internal capitalizations are in abbreviations like geteuid
or getwd or chdir. Names like Readdirnames, which are actual words,
might be worth revisiting at some point.
Russ
os: inconsistent casing in names #1187
Is there any sort of rule about the casing of functions used in the
"os" package? Looking through, it doesn't sound like it's very easy
to recall whether a given function should be called LikeThat or
Likethat.
For instance:
Mkdir
MkdirAll
TempDir
Getenv
ForkExec
Readlink
ReadAt
Readdir
It feels very ad-hoc, and hard to recall.
It's a known issue. It's unplanned.
The term "getters" refers to methods on structs that allow you to read values of (often unexported) fields on that struct. The functions you're pointing to are top-level functions which allow you to read values from the OS. That idiomatic rule is not relevant to this case.
I've had a look into CSS setups for a couple of projects that other people developed and I can understand most of what's going on.
The programmers have, however, created some files whose names start with the underscore (for example: _variables.scss). I have seen files named like this in both of the projects.
I can't figure out what this convention represents. Is there a special reason why the people are naming the files this way?
The only reason I can find to use underscore before the name of the partial is what's described in the Sass docs here:
The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file.
Any SASS files not beginning with an underscore will be rendered on their own, which will fail if they are using variables or mixins defined elsewhere.
In the end I have concluded that the underscore is just used to clarify that it is a partial file. We can also use a partial file without using an underscore as prefix.
Sometimes that naming convention is used for templates or template part files, you could find this being used in MVC frameworks.
In other places this might mean that this variable or file is private and can only be accessed by the server or the running program. It all depends on the language you're programming really, but this is simply a naming convention.
It's just a naming convention. When you want to define a name for an interface you define it with (_interface). This is just for compatibility issues, In some cases a program may include classes and interfaces And in order to distinguish between the two, you use _ for interfaces.
This is just one example as you can use it in the BLL layer when working with databases and so on.
It is an emphasis for other developer to notice the variables and objects.
While looking over documentation of projects, tools etc. I have noticed individuals prepending a period to a file path:
I have tried with and without and it still works, but why do people use the convention?
It depends on the specific environment whether a . has a specific meaning. In general . stands for the current directory (and .. being the parent directory). If the environment uses a PATH-like lookup system, there may well be a difference between ./foo and foo.
The PATH is an environment variable in many systems which defines several paths in which files are looked up. E.g. PATH=/bar:/baz:.. This mean, when you try to refer to file foo, this will be looked up as /bar/foo, /baz/foo and ./foo, the first one to match wins.
As such, the difference can be important if the system uses such a relative lookup. I'm not clear on whether gulp does specifically. If it doesn't, it's relatively redundant to use ..
I'm considering how to do automatic bug tracking and as part of that I'm wondering what is available to match source code line numbers (or more accurate numbers mapped from instruction pointers via something like addr2line) in one version of a program to the same line in another. (Assume everything is in some kind of source control and is available to my code)
The simplest approach would be to use a diff tool/lib on the files and do some math on the line number spans, however this has some limitations:
It doesn't handle cross file motion.
It might not play well with lines that get changed
It doesn't look at the information available in the intermediate versions.
It provides no way to manually patch up lines when the diff tool gets things wrong.
It's kinda clunky
Before I start diving into developing something better:
What already exists to do this?
What features do similar system have that I've not thought of?
Why do you need to do this? If you use decent source version control, you should have access to old versions of the code, you can simply provide a link to that so people can see the bug in its original place. In fact the main problem I see with this system is that the bug may have already been fixed, but your automatic line tracking code will point to a line and say there's a bug there. Seems this system would be a pain to build, and not provide a whole lot of help in practice.
My suggestion is: instead of trying to track line numbers, which as you observed can quickly get out of sync as software changes, you should decorate each assertion (or other line of interest) with a unique identifier.
Assuming you're using C, in the case of assertions, this could be as simple as changing something like assert(x == 42); to assert(("check_x", x == 42)); -- this is functionally identical, due to the semantics of the comma operator in C and the fact that a string literal will always evaluate to true.
Of course this means that you need to identify a priori those items that you wish to track. But given that there's no generally reliable way to match up source line numbers across versions (by which I mean that for any mechanism you could propose, I believe I could propose a situation in which that mechanism does the wrong thing) I would argue that this is the best you can do.
Another idea: If you're using C++, you can make use of RAII to track dynamic scopes very elegantly. Basically, you have a Track class whose constructor takes a string describing the scope and adds this to a global stack of currently active scopes. The Track destructor pops the top element off the stack. The final ingredient is a static function Track::getState(), which simply returns a list of all currently active scopes -- this can be called from an exception handler or other error-handling mechanism.