devnotes | Vince Buffalo 's devnotes — ½ TIL , ½ notebook | Learning library

 by   vsbuffalo HTML Version: Current License: GPL-2.0

kandi X-RAY | devnotes Summary

kandi X-RAY | devnotes Summary

devnotes is a HTML library typically used in Tutorial, Learning applications. devnotes has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has low support. You can download it from GitHub.

Devnotes are notes I take during development, about development. The [wiki] contains random notes, tips, and tricks I’ve learned.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              devnotes has a low active ecosystem.
              It has 114 star(s) with 13 fork(s). There are 12 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              devnotes has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of devnotes is current.

            kandi-Quality Quality

              devnotes has 0 bugs and 0 code smells.

            kandi-Security Security

              devnotes has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              devnotes code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              devnotes is licensed under the GPL-2.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              devnotes releases are not available. You will need to build from source code and install.
              It has 157 lines of code, 0 functions and 1 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of devnotes
            Get all kandi verified functions for this library.

            devnotes Key Features

            No Key Features are available at this moment for devnotes.

            devnotes Examples and Code Snippets

            No Code Snippets are available at this moment for devnotes.

            Community Discussions

            QUESTION

            Easy Problem: Android Kotlin LiveData observe function causes null pointer exception after I delete the item its trying to observe
            Asked 2022-Apr-12 at 00:28

            I'm using room to manage my local database for a dictionary. I select a word then delete it and it should navigate back to the homepage. Sometimes, however, after deleting the word it causes a null pointer exception trying to access the word I've deleted. I can simply try to catch the exception when it does happen, but I think I'm missing a fundamental understanding of how these lifecycles work and would like a better way to implement this if possible. I appreciate any help here.

            this is the code for the delete function in my fragment:

            ...

            ANSWER

            Answered 2022-Apr-12 at 00:28

            You are observing the result of the query to the database where you get the value of the item with the ID with which you start the fragment. I guess you use that "word" to display the data. But when deleting the object from the DB, the observer remains and then the query to the DB with that ID returns null because that object no longer exists. So "word" is getting that null. And "word" is not declared nullable. When you use navigateUp the fragment is not deleted instantly but goes to the backstack and the crash occurs there. I can think of two ways to fix this:

            1- You declare word as nullable

            Source https://stackoverflow.com/questions/71835294

            QUESTION

            How do you detect the unloading of a dynamic library in the current process?
            Asked 2021-Aug-01 at 02:49

            On Windows, we can register a callback function through LdrDllNotification, so that when any DLL is about to be unloaded, we can get a chance to collect some useful information about that DLL, including its address, size, etc.

            I don’t know enough about UNIX-like platforms (including Linux, macOS, iOS, Android, etc.). How can I do the same on these platforms?

            ...

            ANSWER

            Answered 2021-Aug-01 at 02:49

            On Linux, libraries are loaded and unloaded by the dynamic loader. The loading is usually done automatically when needed by the loader itself, but can also be done manually using the library function dlopen(). The unloading is done manually through dlclose() or automatically at program exit. This is not universally applicable to every Unix system, but only to POSIX compliant ones.

            Unfortunately, since (unlike in Windows) the job of loading and unloading libraries is carried out by the dynamic loader (which is just an userspace library), the kernel does not know what is going on and does not provide any mechanism of detecting loading or unloading of dynamic libraries. Even more unfortunately, the loader itself does not provide any such mechanism either. Indeed, there would probably be little-to-no-use for such functionality, apart from usage metrics or similar stuff.

            You normally don't even unload libraries at runtime in Linux, unless we are talking about a very complex piece of software that needs to limit its memory footprint when running. The loader loads the libraries when needed at startup (or when the first needed library function is called) and then they are left like any other piece of memory for the kernel to clean up when the program dies.

            To my knowlegte, the "best" you could do on Linux to detect unloading of dynamic libraries is:

            1. Create your own shared library implementing dlclose() and preload it when running executables. This is explained here and here.

            2. Continuously watch /proc/self/maps parsing the list of loaded libraries.

            3. Run the program under a debugger like gdb, which can be scripted/automated using Python.

            As per other OSes... Android is Linux based, though it has additional security features and apps are sandboxed, unless you root the device or you use a debug shell you can't just "run" other apps hooking them with a custom dlclose() or even a debugger. I can't say much about iOS, but I suspect that implementing such a functionality is not even remotely an option given the very limited abilities of apps (that are also sandboxed). AFAIK macOS also supports dlopen()/dlclose() for manually loading/unloading libraries, however the linker is not the same as the one commonly used on Linux (linked above) so I can't say much about the automatic loading/unloading behavior.

            Source https://stackoverflow.com/questions/68602876

            QUESTION

            Django / Heroku ModuleNotFoundError: No module named 'MyProject.apps'
            Asked 2021-Mar-09 at 20:37

            I've got a django app that works fine when I run it locally with "python manage.py runserver". However, Heroku is struggling to get the site up and running.

            I commit changes to git, which triggers an automatic build on Heroku. The build succeeds, but then fails when trying to start the process with the gunicorn command. I've pasted the full Heroku log below, but the relevant bit seems to be "ModuleNotFoundError: No module named 'FromThePath.apps'", which seems to be referring to the INSTALLED_APPS in settings.py.

            I've tried changing the INSTALLED_APPS to be prefixed with an extra "FromThePath." (which is what resolved an error in wsgi.py), but that causes a failure during build at the collectstatic command with "ModuleNotFoundError: No module named 'FromThePath.FromThePath'"

            Not sure where to go from here. My Google-fu is clearly inadequate. Thanks in advance for your help!

            Full heroku log:

            ...

            ANSWER

            Answered 2021-Mar-09 at 20:37

            Got it working by changing the Procfile so that it was running in the same directory as manage.py. You can do this using gunicorn's chrdir or pythonpath options

            Source https://stackoverflow.com/questions/66551666

            QUESTION

            Linux process stack overrun by local variables (stack guarding)
            Asked 2020-Mar-31 at 04:06

            From What is the purpose of the _chkstk() function?:

            At the end of the stack, there is one guard page mapped as inaccessible memory -- if the program accesses it (because it is trying to use more stack than is currently mapped), there's an access violation.

            _chkstk() is a special compiler-helper function which

            ensures that there is enough space for the local variables

            i.e. it's doing some stack probing (here is an LLVM example).
            This case is Windows-specific. So Windows has some solution to the problem.

            Let's consider the similar conditions under Linux (or some other Unix-like): we have a lot of function's local variables. The first stack variable access is behind the stack segment (e.g. mov eax, [esp-LARGE_NUMBER], here esp-LARGE_NUMBER is something behind the stack segment). Is there any features to prevent possible page fault or whatever in Linux (perhaps other Unix-like) or development tools like gcc, clang, etc? Does -fstack-check (GCC stack checking) somehow solve this problem? This answer states that it is something very similar to _chkstk().

            P.S. These posts 1, 2 didn't help a lot.

            P.P.S. In general, the question is about implementation differences between OSs (foremost Linux vs Windows) approaches of struggling with huge amount of stack variables, that climb behind the stack segment. Both C++ and C tags are added because it's about Linux native binary producing, but the assembly code is compiler-related.

            ...

            ANSWER

            Answered 2020-Mar-31 at 04:06

            _chkstk does stack probes to make sure each page is touched in order after a (potentially) large allocation, e.g. an alloca. Because Windows will only grow the stack one page at a time up to the stack size limit.

            Touching that "guard page" triggers stack growth. It doesn't guard against stack overflow; I think you're misinterpreting the meaning of "guard page" in this usage.

            The function name is also potentially misleading. _chkstk docs simply say: Called by the compiler when you have more than one page of local variables in your function. It doesn't truly check anything, it just makes sure that intervening pages have been touched before memory around esp/rsp gets used. i.e. the only possible effects are: nothing (possibly including a valid soft page fault) or an invalid page-fault on stack overflow (trying to touch a page that Windows refused to grow the stack to include.) It ensures that the stack pages are allocated by unconditionally writing them.

            I guess you could look at this as checking for a stack clash by making sure you touch an unmappable page before continuing in the case of stack overflow.

            Linux will grow the main-thread stack1 by any number of pages (up to the stack size limit set by ulimit -s; default 8MiB) when you touch memory below old stack pages if it's above the current stack pointer.

            If you touch memory outside the growth limit, or don't move the stack pointer first, it will just segfault. Thus Linux doesn't need stack probes, merely to move the stack pointer by as many bytes as you want to reserve. Compilers know this and emit code accordingly.

            See also How is Stack memory allocated when using 'push' or 'sub' x86 instructions? for more low-level details on what the Linux kernel does, and what glibc pthreads on Linux does.

            A sufficiently large alloca on Linux can move the stack all the way past the bottom of the stack growth region, beyond the guard pages below that, and into another mapping; this is a Stack Clash. https://blog.qualys.com/securitylabs/2017/06/19/the-stack-clash It of course requires that the program uses a potentially-huge size for alloca, dependent on user input. The mitigation for CVE-2017-1000364 is to leave a 1MiB guard region, requiring a much larger alloca than normal to get past the guard pages.

            This 1MiB guard region is below the ulimit -s (8MiB) growth limit, not below the current stack pointer. It's separate from Linux's normal stack growth mechanism.

            gcc -fstack-check

            The effect of gcc -fstack-check is essentially the same as what's always needed on Windows (which MSVC does by calling _chkstk): touch stack pages in between previous and new stack pointer when moving it by a large or runtime-variable amount.

            But the purpose / benefit of these probes is different on Linux; it's never needed for correctness in a bug-free program on GNU/Linux. It "only" defends against stack-clash bugs/exploits.

            On x86-64 GNU/Linux, gcc -fstack-check will (for functions with a VLA or large fixe-size array) add a loop that does stack probes with or qword ptr [rsp], 0 along with sub rsp,4096. For known fixed array sizes, it can be just a single probe. The code-gen doesn't look very efficient; it's normally never used on this target. (Godbolt compiler explorer example that passes a stack array to a non-inline function.)

            https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html describes some GCC internal parameters that control what -fstack-check does.

            If you want absolute safety against stack-clash attacks, this should do it. It's not needed for normal operation, though, and a 1MiB guard page is enough for most people.

            Note that -fstack-protector-strong is completely different, and guards against overwrite of the return address by buffer overruns on local arrays. Nothing to do with stack clashes, and the attack is against stuff already on the stack above a small local array, not against other regions of memory by moving the stack a lot.

            Footnote 1: Thread stacks on Linux (for threads other than the initial one) have to be fully allocated up front because the magic growth feature doesn't work. Only the initial aka main thread of a process can have that.

            (There's an mmap(MAP_GROWSDOWN) feature but it's not safe because there's no limit, and because nothing stops other dynamic allocations from randomly picking a page close below the current stack, limiting future growth to a tiny size before a stack clash. Also because it only grows if you touch the guard page, so it would need stack probes. For these showstopper reasons, MAP_GROWSDOWN is not used for thread stacks. The internal mechanism for the main stack relies on different magic in the kernel which does prevent other allocations from stealing space.)

            Source https://stackoverflow.com/questions/60058873

            QUESTION

            Replicating `std::thread::spawn` results in stack overflow
            Asked 2020-Jan-16 at 15:48
            Description

            I am trying to spawn threads on my Windows machine in a #[no_std] crate, but I am running into problems in the __chkstk function. To start off I created a crate with std and tried to find the places that are responsible for spawning threads in libstd.

            Libstd code (shortened to only show the relevant parts) ...

            ANSWER

            Answered 2020-Jan-16 at 15:48

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install devnotes

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/vsbuffalo/devnotes.git

          • CLI

            gh repo clone vsbuffalo/devnotes

          • sshUrl

            git@github.com:vsbuffalo/devnotes.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link