__s | __s , or dunders , is a simple Jekyll Starter Theme | Theme library
kandi X-RAY | __s Summary
kandi X-RAY | __s Summary
__s, or dunders, is a clean Jekyll Starter Theme.
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 __s
__s Key Features
__s Examples and Code Snippets
Community Discussions
Trending Discussions on __s
QUESTION
For my research study, I need to fit some Supernovae Light Curves (LC). For this purpose, there are some templates available to fit the SNe lightcurves. One such LC template fitter is the snfit-2.4.2 . While building 1it from the source I'm getting some errors, which is described below:
...ANSWER
Answered 2022-Mar-24 at 05:54The simple fix is change the code to:
QUESTION
.pyi file in visual studio code (python extension) in my case _csv.pyi file has more details on type hints compared to the .pyi file generated by mypy stubgen
for example, in the code below you can see both .pyi file
visual studio code _csv.pyi:
...ANSWER
Answered 2022-Mar-12 at 09:58_cvs.pyi
is part of typeshed
installed with mypy
. You can see it here: https://github.com/python/typeshed/blob/master/stdlib/_csv.pyi
QUESTION
In clang's standard library, what do the _ and __ on variables mean? Here is a part of string_view.
...ANSWER
Answered 2022-Mar-05 at 08:36_
and __
are just part of the identifier. They don't have any other special meaning.
However, identifiers containing a double underscore or starting with an underscore followed by an upper-case letter are reserved for the standard library. The user code is not allowed to declare them or define them as macro.
The standard library uses only such reserved identifiers for internal use to make sure that it doesn't interfere with any user code that is supposed to be valid.
For example this is a valid program:
QUESTION
#include
#include
#include
#include
#include
using namespace std;
int main()
{
vector ints = {1,2,3,4,5};
auto v = ints | views::take_while([](int i){return i<3;}) ;
for (int i : v) std::cout << i << ' ';
std::cout << '\n';
int size = v.size();
std::cout << size << std::endl;
}
...ANSWER
Answered 2022-Feb-12 at 14:39Since take_while
and its ilk shorten the size of the list in unpredictable ways, those range adaptors cannot return a sized_range
, even if the input itself is sized. sized_range
requires that the range can compute the size in O(1) time, and take_while
's view cannot do that.
So if you want the size (and you shouldn't), you will have to compute it yourself. You could also use std::ranges::distance
on the range.
QUESTION
So I am working on a challenge problem to find a vulnerability in a C program binary that allows a command to be executed by the program (using the effective UID in Linux).
I am really struggling to find how to do this with this particular program.
The disassembly of the function in question (main function):
...ANSWER
Answered 2022-Feb-02 at 10:16In regular C code, execlp("tidy","tidy","-asxml",0);
is incorrect as execlp()
expects a null pointer argument to mark the end of the argument list.
0
is a null pointer when used in a pointer context, which this is not. Yet on architectures where pointers have the same size and passing convention as int
, such as 32-bit linux, passing 0
or passing NULL
generate the same code, so sloppiness does not get punished.
In 64-bit mode, it would be incorrect to do so but you might get lucky with the x86_64 ABI and a 64-bit 0 value will be passed in this case.
In your own code, avoid such pitfalls and use NULL
or (char *)0
as the last argument for execlp()
. But on this listing, Ghidra produces code that generates the same assembly code, and in 32-bit mode, passing 0
or (char *)0
produce the same code, so no problem here.
In your context, execlp("tidy","tidy","-asxml",0);
shows another problem: it will look for an executable program with the name tidy
in the current PATH
and run this program as tidy
with a command line argument -asxml
. Since it changed the effective uid and gid, this is a problem if the program is setuid root because you can create a program named tidy
in a directory appearing in the PATH
variable before the system directories and this program will be run with the modified rights.
Another potential problem is the program does not check for failure of the system calls setreuid()
and setregid()
. Although these calls are unlikely to fail for the arguments passed, as documented in the manual pages, it is a grave security error to omit checking for a failure return from setreuid()
. In case of failure, the real and effective uid (or gid) is not changed and the process may fork and exec with root privileges.
QUESTION
I've always thought that using std::cout << something
was thread safe.
For this little example
...ANSWER
Answered 2021-Nov-28 at 10:28libstdc++
does not produce the error while libc++
does.
iostream.objects.overview Concurrent access to a synchronized ([ios.members.static]) standard iostream object's formatted and unformatted input ([istream]) and output ([ostream]) functions or a standard C stream by multiple threads does not result in a data race ([intro.multithread]).
So this looks like a libc++ bug to me.
QUESTION
I am working with a TAPI DLL in Python trying to keep track of all the events that happen.
Faced a problem handling ITAddressDeviceSpecificEvent event
...ANSWER
Answered 2021-Oct-07 at 18:13There is no solution. pywin32 is not able to parse dll correctly, from which further work with such events is not possible
QUESTION
In the C++ code below, a segmentation fault occurs before the first line of main()
is executed.
This happens even though there are no objects to be constructed before entering main()
and it does not happen if I remove a (large) variable definition at the second line of main()
.
I assume the segmentation fault occurs because of the size of the variable being defined. My question is why does this occur before the prior line is executed?
It would seem this shouldn't be occurring due to instruction reordering by the optimizer. I say this based on the compilation options selected and based on debug output.
Is the size of the (array) variable being defined blowing the stack / causing the segfault?
It would seem so since using a smaller array (e.g. 15 elements) does not result in a segmentation fault and since the expected output to stdout is seen.
ANSWER
Answered 2021-Oct-03 at 22:03This is definitely a stack overflow. sizeof(dynamic_loop_functor_t)
is nearly 64 MiB, and the default stack size limit on most Linux distributions is only 8 MiB. So the crash is not surprising.
The remaining question is, why does the debugger identify the crash as coming from inside std::operator<<
? The actual segfault results from the CPU exception raised by the first instruction to access to an address beyond the stack limit. The debugger only gets the address of the faulting instruction, and has to use the debug information provided by the compiler to associate this with a particular line of source code.
The results of this process are not always intuitive. There is not always a clear correspondence between instructions and source lines, especially when the optimizer may reorder instructions or combine code coming from different lines. Also, there are many cases where a bug or problem with one source line can cause a fault in another section of code that is otherwise innocent. So the source line shown by the debugger should always be taken with a grain of salt.
In this case, what happened is as follows.
The compiler determines the total amount of stack space to be needed by all local variables, and allocates it by subtracting this number from the stack pointer at the very beginning of the function, in the prologue. This is more efficient than doing a separate allocation for each local variable at the point of its declaration. (Note that constructors, if any, are not called until the point in the code where the variable's declaration actually appears.)
The prologue code is typically not associated with any particular line of source code, or maybe with the line containing the function's opening
{
. But in any case, subtracting from the stack pointer is a pure register operation; it does not access memory and therefore cannot cause a segfault by itself. Nonetheless, the stack pointer is now pointing outside the area mapped for the stack, so the next attempt to access memory near the stack pointer will segfault.The next few instructions of
main
execute thecout << "Starting main"
. This is conceptually a call to the overloadedoperator<<
from the standard library; but in GCC's libstdc++, theoperator<<
is a very short function that simply calls an internal helper function named__ostream_insert
. Since it is so short, the compiler decides to inlineoperator<<
intomain
, and somain
actually contains a call to__ostream_insert
. This is the instruction that faults: the x86call
instruction pushes a return address to the stack, and the stack pointer, as noted, is out of bounds.Now the instructions that set up arguments and call
__ostream_insert
are marked by the debug info as corresponding to the source ofoperator<<
, in theheader file - even though those instructions have been inlined into
main
. Hence your debugger shows the crash as having occurred "inside"operator<<
.Had the compiler not inlined
operator<<
(e.g. if you compile without optimization), thenmain
would have contained an actual call tooperator<<
, and this call is what would have crashed. In that case the traceback would have pointed to thecout << "Starting main"
line inmain
itself - misleading in a different way.
Note that you can have GCC warn you about functions that use a large amount of stack with the options -Wstack-usage=NNN
or -Wframe-larger-than=NNN
. These are not enabled by -Wall
, but could be useful to add to your build, especially if you expect to use large local objects. Specifying either of them, with a reasonable number for NNN
(say 4000000), I get a warning on your main
function.
QUESTION
I am a beginner in SYCL/DPC++. I have created an array and by using buffers I am updating the values in the device code but when I try to print the updated values in the kernel/device code I am getting error. I am able to print the updated values through accessors and arrays. Can someone help me out how can I print/get the values from kernel code?
Here is my code.
...ANSWER
Answered 2021-Sep-15 at 19:51You can't use standard print methods inside a SYCL kernel. You need to use the stream class. For example
QUESTION
EDIT: This has been solved and I have posted my learning and the code used at the bottom of the question
I would like to plot to datasets across the same x-axis with the second dataset being mirrored below the x-axis. I have attached the data set below.
So far I have tried:
...ANSWER
Answered 2021-Aug-10 at 10:47What about something like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install __s
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