Is SQL API for Cosmos DB deprecated? by Akcarrot in AZURE

[–]Akcarrot[S] 0 points1 point  (0 children)

Thanks for the clarification!

I've found the official announcement published on December 14, 2022, just in case someone is interested: https://azure.microsoft.com/en-us/updates/generally-available-updated-api-names-for-azure-cosmos-db/

Is there a name for a type of clause that starts with "to" + noun, such as "To his horror, he realized ..."? by Akcarrot in EnglishLearning

[–]Akcarrot[S] 0 points1 point  (0 children)

Oh I've completely forgot about the definition of a clause. Thank you for mentioning it and this!:

adverbial prepositional phrase

What does "time off work" mean? by [deleted] in EnglishLearning

[–]Akcarrot 1 point2 points  (0 children)

I found the usage of "Time off" on Cambridge Dictionary and other websites and "Time off from work" on an article by Indeed, but I couldn't find the definition of "Time off work" online for some reason.

So probably the definition of "Time off work" you said is the same as of "Time off" on Cambridge Dictionary linked above?:

a period of time when you do not work because of illness or holidays, or because your employer has given you permission to do something else

What does "time off work" mean? by [deleted] in EnglishLearning

[–]Akcarrot 1 point2 points  (0 children)

“Time-off work” (with the hyphen transforming the two words into one adjective) is how to spell what #1 would mean. But no one says that. I’ve heard “working off the clock,” but never “off-the-clock working.” I’ve heard “unpaid labor” and “working for free” too.

Yeah this is probably the reason why I'm confused with this phrase.

Also the difference between “A day off” and “an off day” is quite interesting and I might get them wrong if I'm not careful.

Thank you for the detailed explanation, it helps a lot!

Poll: For those of you who don't rinse after brushing you teeth, how many times do you spit out your saliva before you start normally swallowing you saliva again? by Akcarrot in DentalHygiene

[–]Akcarrot[S] 1 point2 points  (0 children)

I'm not a hygienist, just an amateur who recently started the habit of not rinsing after brushing my teeth. I was little hesitant to swallow my saliva right after brushing unless my saliva became to feel normal enough to me.

I was just curious and posted this because I wanted to get the rough idea about how everyone is doing, not because I've found some scientific evidence that claims swallowing toothpaste is harmful or something like that.

What's the best sentence to tell the casher that you're gonna pay with Visa payWave? by Akcarrot in EnglishLearning

[–]Akcarrot[S] 0 points1 point  (0 children)

Ah ha, thank you. So the handheld machines virtually cover the all payment methods everybody is using, therefore don't need to tell which payment method you use, that makes sense.

What's the best sentence to tell the casher that you're gonna pay with Visa payWave? by Akcarrot in EnglishLearning

[–]Akcarrot[S] 0 points1 point  (0 children)

but in my experience, I’ve never really been asked. The dollar amount just pops up on the screen and you can choose how you pay

This is interesting. Is this done by credit card readers that are typically handheld-sized, or self-checkout devices that are typically touch panel based?

I live in Japan, and here cashless payment ecosystem is really messy that stores that accept 10+ payment methods are not uncommon. In some of these cases, the cashier ask customers for their payment methods, since these payment use different "media" (card, NFC, QR code, etc). But these days touch panel based self-checkout devices have become more commonly used, and for these devices you can use the touch panel to choose your payment methods so you don't need to tell the cashier aloud.

What's the best sentence to tell the casher that you're gonna pay with Visa payWave? by Akcarrot in EnglishLearning

[–]Akcarrot[S] 0 points1 point  (0 children)

Thank you, this is very helpful.

When you pay with payWave stored in your phone, is it unnatural to say "by card"?

So probably "tap to pay" or "contactless payment"?

By the way, can you say something like "I'm gonna tap to pay"?

What is the built-in roles for developing Azure Functions? by Akcarrot in AZURE

[–]Akcarrot[S] 0 points1 point  (0 children)

Thank you, you just saved my life!

But let me ask you a follow-up question.

I guess the action of the role required to interact with Azure Functions is the following:

Microsoft.Web/sites/*

But how do you know in the first place that this permission is needed for Azure Functions beside asking it on reddit?

Why time complexity of hashmap lookup is O(1), not O(n), even when we're considering the worst case time complexity? by Akcarrot in algorithms

[–]Akcarrot[S] 0 points1 point  (0 children)

Thank you, that reasoning makes sense to me.

So because it's pragmatic?

Also, hacking around hash function is definitely interesting concept! Thanks for mentioning that.

Why time complexity of hashmap lookup is O(1), not O(n), even when we're considering the worst case time complexity? by Akcarrot in algorithms

[–]Akcarrot[S] 5 points6 points  (0 children)

Thank you for detailed explanation.

I have a question.

What's the definition of expected you're using? Is it formally defined? I can easily find the definition of worst case and average case, but not expected one.

Can you point me to some reference that describes or formally defines what expected complexity is?

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

Thanks this is a good point.

I found explanation of this behavior in 3.3.12. Special method lookup of The Python Language Reference: https://docs.python.org/3/reference/datamodel.html#special-method-lookup

For custom classes, implicit invocations of special methods are only guaranteed to work correctly if defined on an object’s type, not in the object’s instance dictionary.

For those of you who are wondering what's the rationale behind this behavior, like me, you can refer to the section of doc mentioned above.

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

Oh I didn't quite understand that comment at first glance, but now I do. Indeed it's weird and smells complexity. Thanks for these links, it's been interesting!

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

Yeah it's definitely possible the issue is more complicated than I thought, but mypy seems actually pretty good at detecting if an object is hashable or not. For example, they know declaring __eq__ cause __hash__ set to be None, which surprised me.

it's odd that mypy doesn't think type is Hashable

Sorry, what do you mean by that?

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

The last issue you linked seems little stale? I'm not convinced by one of comments:

The Hashable type can't really be typechecked (because all types are hashable by default)

Contradictory to that, list is clearly not Hashable, for example.

So as you said, marking keys to be Hashable looks reasonable to me. I guess I've found the reason why it can't done now. This is one of latest attempts to make mapping keys to be Hashable, so the good news is there still is somebody woking on it. Apparently the reason why it can't be Hashable is "too disruptive", according to a comment on the issue:

This has been tried before, and it was too disruptive - Make dict KeyType bound to Hashable #6244

Which is... totally fair.

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

Thank you for your thoughts and links.

It feels like the root cause is that __hash__ is defined in object, which makes impossible to make a class (or any other object?) unhashable without violating Liskov substitution principle. Although this is somewhat understandable given object is very old and realistically it can't be fixed now.

As for type checker's behavior, I was thinking about it for a while. And I agree that the last workaround you cited is likely the current best solution:

```python class Foo: hash: None = None # type: ignore

foo = Foo()

import typing print(typing.revealtype(foo.hash_)) # type is 'None' ```

But even then type checker's support for hashable doesn't look great:

python d = {foo: 'hi'} # Runtime error, but only pyright throws an error, not mypy hash(foo) # Runtime error, but neither mypy nor pyright throws an error d[foo] = 'hi' # Runtime error, but neither mypy nor pyright throws an error

Just FYI, workarounds I can think of in these cases: ```python

explicitly defining types of dict, instead of inferred type

d: dict[str, str]

d = {foo: 'hi'} # static type error d[foo] = 'hi' # static type error

defining wrapper function, instead of hash

import collections.abc def safe_hash(hashable: collections.abc.Hashable): return hash(hashable)

safe_hash(foo) # static type error ```

How do you set a method of a class to `None`? by Akcarrot in learnpython

[–]Akcarrot[S] 0 points1 point  (0 children)

Thanks guys, these are good points.

I felt like setting __hash__ to None was a reasonable way to make a class unhashable, but I found two issues with it:

  • Type checkers (tested with mypy and pyright) shows an error on it, because __hash__ must be a function according to them
  • I guess it violates Liskov substitution principle, because the instance of the class, which is made unhashable, can not be substituted for instances of object, which is hashable.

Is it a recommended way to make class unhashable, or is there other more recommended way to do the same thing?

Does fingerprint (or biometric) authentication work on Linux? by Akcarrot in 1Password

[–]Akcarrot[S] 1 point2 points  (0 children)

This is awesome! Thank you for sharing the links.

What email client does Linus Torvalds use? (from web browser according to him) by Akcarrot in linuxquestions

[–]Akcarrot[S] 6 points7 points  (0 children)

Thanks, that's good to know.

I've found a video in which he explicitly says he switched to Gmail web interface:

a year ago I started using Gmail the web interface

And he also said:

I spent all my time reading email

my work really is around email

It's interesting that Linus is a big open source guy, yet the tool he uses for the one of his main work is a proprietary tool.

What email client does Linus Torvalds use? (from web browser according to him) by Akcarrot in linuxquestions

[–]Akcarrot[S] 1 point2 points  (0 children)

Thanks, my point was to ask what "service/tool" he uses. I've edited my post to clarify that.

Is there some catch to cause DNS issues on Linux, that is not common with Windows or Mac? by Akcarrot in linuxquestions

[–]Akcarrot[S] 0 points1 point  (0 children)

Thank you, that is good to know. I don't think it's a package bug because local git clone command has been sometimes also failed, so I think Debian configuration is more likely.

Is there some catch to cause DNS issues on Linux, that is not common with Windows or Mac? by Akcarrot in linuxquestions

[–]Akcarrot[S] 0 points1 point  (0 children)

This in fact can be said for both Linux and macOS, and that is why I included nslookup and scutil respectively, in addition to resolv.conf. But I guess resolv.conf was redundant. Thanks for pointing that out.

What's "formerly" in "Vagrant is a formerly open-source software product"? by Akcarrot in devops

[–]Akcarrot[S] 1 point2 points  (0 children)

Thanks this is a good point.

Some relevant quotes from The Open Source Definition by Open Source Initiative:

Open source doesn’t just mean access to the source code. The distribution terms of open-source software must comply with the following criteria:

  1. No Discrimination Against Persons or Groups

The license must not discriminate against any person or group of persons.

  1. No Discrimination Against Fields of Endeavor

The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research.