mine | Minimal and single-header cryptography library | Encryption library
kandi X-RAY | mine Summary
kandi X-RAY | mine Summary
It all started with ripe that depends on third-party library (initially OpenSSL then Crypto++) linked statically. However after deploying residue with ripe to older distributions of linux, we learnt that portability is an issue for ripe as minimal library (because of it's dependencies). So we started to implement standards forming Mine. We are very careful with our implementations and have over 50 test cases in-place.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mine
mine Key Features
mine Examples and Code Snippets
Community Discussions
Trending Discussions on mine
QUESTION
I'm facing a critical issue right now in Romania. So for almost 24 hours my mobile app which is using Firebase Realtime Database can't be used on some ISPs (like Vodafone, DIGI or Telekom) if you are using mobile data (4G or 5G) the app is working fine, but on Wi-fi (on these ISPs the app is getting timeout). I talked like several hours on the phone with multiple ISPs and the Firebase support (right now the app is working using DIGI, but nobody knows why). The ISPs are saying that problem is not on their end and Firebase is saying that the problem is on the ISP side. Firebase support answer:
As this has been caused by network issues, rather than Google's infrastructure, we can't do much about it from our end. I would recommend that you contact the ISP provider directly as they will be able to check deeper on their side.
As far as we can see, the multiple providers are affected by that issue. Our engineering team is already aware of that and looking for solutions. Like I said before, there is nothing we could do with the providers, but our engineers would find any suitable workaround.
So my question is: what can I do? (I saw that Firebase realtime database deployed in europe-west works) but mine is already on united states.
Is there someone having troubles like me? I tested multiple apps which I know are using Firebase and they are having the same issues, the app being unreachable over this type of network.
So the problem is regarding Ukraine and Russia :(. Many apps using Firebase Realtime Database are not working right now.
Below I posted a fix for this and how I handled in order to make my app functional again
...ANSWER
Answered 2022-Mar-29 at 13:21So for someone who is in Europe and has the same issue like me, this is what i did.
I made a new instance of a realtime database on europe-west (because this one works on every ISP). I migrated my old database to the new one. I pushed for release a new iOS and Android build using the new database. I disabled my old instance in order to not have any syncing problems. I made all of this at night hours like 24:00.
I the morning all users would have the new update. If someone is not going to have the update until 10 AM I have set a push notification to announce this changes.
QUESTION
ANSWER
Answered 2022-Jan-13 at 15:07QUESTION
I am trying to get this link to work, performing a DELETE
request:
ANSWER
Answered 2021-Dec-25 at 22:28As suggested here, the following will suffice:
QUESTION
I would like to be able to robustly stop a video when the video arrives on some specified frames in order to do oral presentations based on videos made with Blender, Manim...
I'm aware of this question, but the problem is that the video does not stops exactly at the good frame. Sometimes it continues forward for one frame and when I force it to come back to the initial frame we see the video going backward, which is weird. Even worse, if the next frame is completely different (different background...) this will be very visible.
To illustrate my issues, I created a demo project here (just click "next" and see that when the video stops, sometimes it goes backward). The full code is here.
The important part of the code I'm using is:
...ANSWER
Answered 2022-Jan-21 at 19:18The video has frame rate of 25fps, and not 24fps:
After putting the correct value it works ok: demo
The VideoFrame api heavily relies on FPS provided by you. You can find FPS of your videos offline and send as metadata along with stop frames from server.
The site videoplayer.handmadeproductions.de uses window.requestAnimationFrame() to get the callback.
There is a new better alternative to requestAnimationFrame. The requestVideoFrameCallback(), allows us to do per-video-frame operations on video.
The same functionality, you domed in OP, can be achieved like this:
QUESTION
Because of Google Play, I had to update an old project of mine to the latest expo versions (version 43.0.0 to be exact). The idea is for the app to scan a QRCode and process the data, simply. However, expo-barcode-scanner only works once and after that I need to close and open the app again to work. Has anyone encountered this problem and (or) knows how to solve it? Below is my code:
...ANSWER
Answered 2021-Nov-12 at 21:14Welcome @Backup Gov18,
This is a documented issue.
Note: Only one active BarCodeScanner preview is supported currently. When using navigation, the best practice is to unmount any previously rendered BarCodeScanner component so the following screens can use without issues.
There is a workaround.
Instead of conditionally rendering the component, you could render it inside another dedicated screen component.
This way, after this new screen reads the barcode, you could navigate back to your first screen. Navigating back may unmount this new screen. You can force unmount if you need to.
As you are using react-navigation
, you had better use .pop()
instead of goBack()
.
You can also use expo-camera
instead of expo-barcode-scanner
. expo-camera
does not have this issue. It also offers more options like flashlight/torch and switching cameras.
QUESTION
(Note! This question particularly covers the state of C++14, before the introduction of inline variables in C++17)
TLDR; Question- What constitutes odr-use of a constexpr variable used in the definition of an inline function, such that multiple definitions of the function violates [basic.def.odr]/6?
(... likely [basic.def.odr]/3; but could this silently introduce UB in a program as soon as, say, the address of such a constexpr variable is taken in the context of the inline function's definition?)
TLDR example: does a program where doMath()
defined as follows:
ANSWER
Answered 2021-Sep-08 at 16:34In the OP's example with std::max
, an ODR violation does indeed occur, and the program is ill-formed NDR. To avoid this issue, you might consider one of the following fixes:
- give the
doMath
function internal linkage, or - move the declaration of
kTwo
insidedoMath
A variable that is used by an expression is considered to be odr-used unless there is a certain kind of simple proof that the reference to the variable can be replaced by the compile-time constant value of the variable without changing the result of the expression. If such a simple proof exists, then the standard requires the compiler perform such a replacement; consequently the variable is not odr-used (in particular, it does not require a definition, and the issue described by the OP would be avoided because none of the translation units in which doMath
is defined would actually reference a definition of kTwo
). If the expression is too complicated, however, then all bets are off. The compiler might still replace the variable with its value, in which case the program may work as you expect; or the program may exhibit bugs or crash. That's the reality with IFNDR programs.
The case where the variable is immediately passed by reference to a function, with the reference binding directly, is one common case where the variable is used in a way that is too complicated and the compiler is not required to determine whether or not it may be replaced by its compile-time constant value. This is because doing so would necessarily require inspecting the definition of the function (such as std::max
in this example).
You can "help" the compiler by writing int(kTwo)
and using that as the argument to std::max
as opposed to kTwo
itself; this prevents an odr-use since the lvalue-to-rvalue conversion is now immediately applied prior to calling the function. I don't think this is a great solution (I recommend one of the two solutions that I previously mentioned) but it has its uses (GoogleTest uses this in order to avoid introducing odr-uses in statements like EXPECT_EQ(2, kTwo)
).
If you want to know more about how to understand the precise definition of odr-use, involving "potential results of an expression e...", that would be best addressed with a separate question.
QUESTION
Originally this is a problem coming up in mathematica.SE, but since multiple programming languages have involved in the discussion, I think it's better to rephrase it a bit and post it here.
In short, michalkvasnicka found that in the following MATLAB sample
...ANSWER
Answered 2021-Dec-30 at 12:23tic
/toc
should be fine, but it looks like the timing is being skewed by memory pre-allocation.
I can reproduce similar timings to your MATLAB example, however
On first run (
clear
workspace)- Loop approach takes 2.08 sec
- Vectorised approach takes 1.04 sec
- Vectorisation saves 50% execution time
On second run (workspace not cleared)
- Loop approach takes 2.55 sec
- Vectorised approach takes 0.065 sec
- Vectorisation "saves" 97.5% execution time
My guess would be that since the loop approach explicitly creates a new matrix via zeros
, the memory is reallocated from scratch on every run and you don't see the speed improvement on subsequent runs.
However, when HH
remains in memory and the HH=___
line outputs a matrix of the same size, I suspect MATLAB is doing some clever memory allocation to speed up the operation.
We can prove this theory with the following test:
QUESTION
The standard defines several 'happens before' relations that extend the good old 'sequenced before' over multiple threads:
[intro.races]
11 An evaluation A simply happens before an evaluation B if either
(11.1) — A is sequenced before B, or
(11.2) — A synchronizes with B, or
(11.3) — A simply happens before X and X simply happens before B.[Note 10: In the absence of consume operations, the happens before and simply happens before relations are identical. — end note]
12 An evaluation A strongly happens before an evaluation D if, either
(12.1) — A is sequenced before D, or
(12.2) — A synchronizes with D, and both A and D are sequentially consistent atomic operations ([atomics.order]), or
(12.3) — there are evaluations B and C such that A is sequenced before B, B simply happens before C, and C is sequenced before D, or
(12.4) — there is an evaluation B such that A strongly happens before B, and B strongly happens before D.[Note 11: Informally, if A strongly happens before B, then A appears to be evaluated before B in all contexts. Strongly happens before excludes consume operations. — end note]
(bold mine)
The difference between the two seems very subtle. 'Strongly happens before' is never true for matching pairs or release-acquire operations (unless both are seq-cst), but it still respects release-acquire syncronization in a way, since operations sequenced before a release 'strongly happen before' the operations sequenced after the matching acquire.
Why does this difference matter?
'Strongly happens before' was introduced in C++20, and pre-C++20, 'simply happens before' used to be called 'strongly happens before'. Why was it introduced?
[atomics.order]/4
says that the total order of all seq-cst operations is consistent with 'strongly happens before'.
Does it mean that it's not consistent with 'simply happens before'? If so, why not?
I'm ignoring the plain 'happens before', because it differs from 'simply happens before' only in its handling of memory_order_consume
, the use of which is temporarily discouraged, since apparently most (all?) major compilers treat it as memory_order_acquire
.
I've already seen this Q&A, but it doesn't explain why 'strongly happens before' exists, and doesn't fully address what it means (it just states that it doesn't respect release-acquire syncronization, which isn't completely the case).
Found the proposal that introduced 'simply happens before'.
I don't fully understand it, but it explains following:
- 'Strongly happens before' is a weakened version of 'simply happens before'.
- The difference is only observable when seq-cst is mixed with aqc-rel on the same variable (I think, it means when an acquire load reads a value from a seq-cst store, or when an seq-cst load reads a value from a release store). But the exact effects of mixing the two are still unclear to me.
ANSWER
Answered 2022-Jan-02 at 18:21Here's my current understanding, which could be incomplete or incorrect. A verification would be appreciated.
C++20 renamed strongly happens before
to simply happens before
, and introduced a new, more relaxed definition for strongly happens before
, which imposes less ordering.
Simply happens before
is used to reason about the presence of data races in your code. (Actually that would be the plain 'happens before', but the two are equivalent in absence of consume operations, the use of which is discouraged by the standard, since most (all?) major compilers treat them as acquires.)
The weaker strongly happens before
is used to reason about the global order of seq-cst operations.
This change was introduced in proposal P0668R5: Revising the C++ memory model, which is based on the paper Repairing Sequential Consistency in C/C++11 by Lahav et al (which I didn't fully read).
The proposal explains why the change was made. Long story short, the way most compilers implement atomics on Power and ARM architectures turned out to be non-conformant in rare edge cases, and fixing the compilers had a performance cost, so they fixed the standard instead.
The change only affects you if you mix seq-cst operations with acquire-release operations on the same atomic variable (i.e. if an acquire operation reads a value from a seq-cst store, or a seq-cst operation reads a value from a release store).
If you don't mix operations in this manner, then you're not affected (i.e. can treat simply happens before
and strongly happens before
as equivalent).
The gist of the change is that the synchronization between a seq-cst operation and the corresponding acquire/release operation no longer affects the position of this specific seq-cst operation in the global seq-cst order, but the synchronization itself is still there.
This makes the seq-cst order for such seq-cst operations very moot, see below.
The proposal presents following example, and I'll try to explain my understanding of it:
QUESTION
A new PendingIntent field in PendingIntent is FLAG_IMMUTABLE.
In 31, you must specify MUTABLE or IMMUTABLE, or you can't create the PendingIntent, (Of course we can't have defaults, that's for losers) as referenced here
According to the (hilarious) Google Javadoc for Pendingintent, you should basically always use IMMUTABLE (empasis mine):
It is strongly recommended to use FLAG_IMMUTABLE when creating a PendingIntent. FLAG_MUTABLE should only be used when some functionality relies on modifying the underlying intent, e.g. any PendingIntent that needs to be used with inline reply or bubbles (editor's comment: WHAT?).
Right, so i've always created PendingIntents for a Geofence like this:
...ANSWER
Answered 2021-Oct-27 at 21:22In this case, the pending intent for the geofence needs to use FLAG_MUTABLE
while the notification pending intent needs to use FLAG_IMMUTABLE
. Unfortunately, they have not updated the documentation or the codelabs example for targeting Android 12 yet. Here's how I modified the codelabs geofence example to work.
First, update gradle to target SDK31.
In HuntMainActivity
, change the geofencePendingIntent
to:
QUESTION
In an earlier question of mine I asked how to populate an existing object using System.Text.Json.
One of the great answers showed a solution parsing the json string with JsonDocument
and enumerate it with EnumerateObject
.
Over time my json string evolved and does now also contain an array of objects, and when parsing that with the code from the linked answer it throws the following exception:
...ANSWER
Answered 2021-Dec-12 at 17:26After further consideration, I think a simpler solution for replacement should be using C# Reflection instead of relying on JSON. Tell me if it does not satisfy your need:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mine
You can either download binary for your platform via releases page or using NPM.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page