Their doc suggests two types,
$guid A uuid-v4 style guid
$randomUUID A random 36-character UUID
Is there a difference?
Yes they are different in terms of generation. For purpose they are same.
Here you may check:
https://www.google.com/search?q=uuid+vs+guid
Also this answer may help:
Is there any difference between a GUID and a UUID?
Related
Specifically in regards to conditional formatting, but also applicable in the broader scope of IF() tests within Google Sheets...
Can I compare using =IF(A1=OR("Yes","Y","YES")) and achieve the same result as =IF(OR(A1="Yes"),(A1="Y"),(A1="YES"))? I know that both expressions could be simplified by removing the leading IF(), but since I'm desiring to use this information in the context of conditional formatting.
I know that the above two statements do not evaluate identically. Is there different (and simpler) syntax that the verbose OR(<full-expression>,<full-expression>,etc...), or am I stuck with that?
Well, a little more searching under a different question yielded the answer to this one: REGEXMATCH().
=REGEXMATCH(A1,"Yes|Y|YES") evaluates the same as =IF(OR(A1="Yes"),(A1="Y"),(A1="YES")). Note: Per the above-linked page, Google products use RE2 for regular expressions.
First of all, I use C# 4.0 to parse the code of a VB6 application.
I have some old VB6 code and about 500+ copies of it. And I use a regular expression to grab all kinds of global variables from the code. The code is described as "Yuck" and some poor victim still has to support this. So I'm hoping to help this poor sucker a bit by generating overviews of specific constants. (And yes, it should be rewritten but it ain't broke, so...)
This is a sample of a code line I need to match, in this case all boolean constants:
Public Const gDemo = False 'Is this a demo version
And this is the regular expression I use at this moment:
Public\s+Const\s+g(?'Name'[a-zA-Z][a-zA-Z0-9]*)\s+=\s+(?'Value'[0-9]*)
And I think it too is yuckie, since the * at the end of the boolean group. But if I don't use it, it will only return 'T' or 'F'. I want the whole word.
Is this the proper RegEx to use as solution or is there an even nicer-looking option?
FYI, I use similar regexs to find all string constants and all numeric constants. Those work just fine. And basically the same .BAS file is used for all 50 copies but with different values for all these variables. By parsing all files, we have a good overview of how every version is configured.
And again, yes, we need to rebuild the whole project from scratch since it becomes harder to maintain these days. But it works and we need the manpower for other tasks. It just needs the occasional tweaks...
You can use: Public\s+Const\s+g(?<Name>[a-zA-Z][a-zA-Z0-9]*)\s+=\s+(?<Value>False|True)
demo
Just a non-critical question that has bothered me after trying to find answers in the doc to no avail.
class Book(models.Model)
authors = ManyToManyField(Author)
homer = Author.objects.get(pk=1)
iliad = Book.objects.get(pk=2)
iliad.authors.filter(pk=homer.pk).exists()
Book.objects.filter(name='Iliad', authors__in=homer).exists()
I believe the last two asserts will test if Homer is the author of Iliad. But I kind of dislike the (pk=homer.pk) portion and am wondering if there's any construct that will allow me to test if an object (assuming we already have it from a "get") exists in a queryset?
(homer in iliad.authors)
While the above expression may also work, and is arguably more pythonic, it may retrieve unnecessarily too many authors back from DB.
In this particular case homer in iliad.authors would be only slightly slower than exists version. Most of the books have one or two authors so getting all from DB should not be a problem.
I think there is no way to do this in Django faster without using filter in way you used, sorry.
Django's queryset code implements some optimization when using the in operator.
To get better insight, I'd try timing the use of in on the queryset vs. your other examples, for big and small datasets.
I couldn't find a 'path length' method in the boost::filesystem::path, is there one?
If there is no such method (why?) - should I use .native().length() or .string().length() ?
I take it .string().length() should be faster, right?
.native() directly returns the internal representation of the path, while string() might perform some conversions. All in all, it won't make much difference though whether you use native().length() or string().length().
How about string() method? (returns std::string)
fs::path path;
...
path.string().size();
There is no length on path and it doesn't really follow why you would want it.
.string() is the generally recommended thing to use for externally visible representations. Check out the path decomposition table in their docs to get that warm fuzzy reassurance on what to expect.
I have no reason to believe performance would differ with either. You probably shouldn't worry about it until your profiler tells you to. :)
tribool strikes me as one of the oddest corners of Boost. I see how it has some conveniences compared to using an enum but an enum can also be easily expanded represent more than 3 states.
In what real world ways have you put tribool to use?
While I haven't used C++, and hence boost, I have used three-state variables quite extensively in a network application where I need to store state as true/false/pending.
An extra state in any value type can be extremely valuable. It avoids the use of "magic numbers" or extra flags to determine if the value of a variable is "maybe" or "unknown".
Instead of true or false, the state of a tribool is true, false, or indeterminate.
Let's say you have a database that contains a list of customers and their dateOfBirth. So you write a function along the lines of :
tribool IsCustomerAdult(customerName);
The function returns:
`true` if the customer is 18 or older;
`false` if the customer is less than 18;
`indeterminate` if the customer is not in the database
(or the dateOfBirth value is not present).
Very useful.
I think the extra benefit is not only the 3rd value, but also that you can easily use the 3-valued logic!
For example:
(true && indeterminate) == indeterminate
(true || indeterminate) == true
SQL implements such logic.
I've seen numerous examples of two booleans being used to represent three possible states, explicitly or otherwise, with the fourth state being silently assumed to be impossible. In at least two cases, I've changed such constructions to use tribool since we started using boost.
I am a big fan of the Boost library and started using it at company who I have since left. After getting exposure to and using the boost library extensively throughout our project I stumbled on tribool and was considering using for some "Fuzzy Logic" algorithms needing improvements.
I left before I had a chance to get into it, but beyond the "Fuzzy Logic" example, other modules in the system had components with this sort of between state that considering now, I would probably end up using tribool in a decent amount of code if I was still with the company.
-bn
I think it is very useful for Language moulding such as OCR applications and Speech synthesis because as you know human languages are ambiguous and they have a lot of Intermediate statuses
looking foreword to improve the current technologies using the tribool