instruction
stringlengths
0
30k
null
|php|visual-studio-code|syntax-highlighting|
|linux|
I have a view in my Django project: ```python @permission_required('storage.add_iteminrelease') @transaction.atomic def add_item_in_release(request, id): release = get_object_or_404(Release, pk=id) if (request.method == 'POST'): add_item_in_release_form = ItemInReleaseForm(request.POST) ...
In C++, I am receiving red squiggly lines under cout, endl, vectors, etc. even though I run the code there is no error=. I am using Studio Code and using C++ Extension Pack. This has only become an issue as of last week for some unknown reason, nothing has been changed within the settings. [Example][1] Now it's ...
I am trying to write a JUnit test, but receiving java.util.NoSuchElementException. With limited knowledge of Mockito and JUnit, I understand DriverManager.getConnection needs to be mocked/stubbed. How can I do that? The aim is to run the JUnit test without access to the actual database. ```lang-java public class...
You can put this code in a `ViewModifier`. You can put `presentProfilePage` as a `@State` in there. ``` struct ProfileNavigation: ViewModifier { @State var presentProfilePage = false let image: UIImage? func body(content: Content) -> some View { content .navigationDestinat...
gganimate is not keeping all the past marks when using shadow_mark option
|r|gganimate|
null
The issue is that `handleLogin` has a closure over the selected `isAuthenticated` value from the time it's called, it won't ever be a different or updated value in the callback. The `loginUser` action either is fulfilled or is rejected. The `handleLogin` callback can `await` this action being fulfilled. All Redux-To...
Unless you do want to control whether those get materialized, you're just typing more and nesting more. It technically makes little to no difference whether you keep your CTE's or switch to subqueries, or add those as regular `where` conditions at the end, or as additional `join` conditions: [demo][1]. I think the `...
|python|range|scipy-optimize|
I am writing the sql query to get the latest supervisor and their job but problem I am facing is that there are multiple supervisor are coming up in the query with multiple jobs for their for the employee. there should be only one supervisor with one job. I can get the correct supervisor_id and their job IN THE FIRS...
{"OriginalQuestionIds":[21247203],"Voters":[{"Id":18470692,"DisplayName":"ouroboros1"},{"Id":-1,"DisplayName":"Community","BindingReason":{"DuplicateApprovedByAsker":""}}]}
`-F` and `--onefile` are the same thing. Also, it should be `--hidden-import` not `--hiddenimport` Do like this: pyinstaller --hidden-import=numpy --hidden-import=os --hidden-import=matplotlib.pyplot --collect-submodules=numpy --collect-submodules=matplotlib.pyplot --onefile BOX_PLOT_interactive.py
Hi here are few observations, [enter image description here][1] [1]: https://i.stack.imgur.com/jYeT8.png I have a php program ` <?php $op=exec('node -v'); $op1=exec('which node'); echo "Node version : $op"; echo "\n Node path : $op1"; echo "\nUser : ". get_current_user(); ...
How can I use the verify_otp function on the python library for supabase / where can I find extended documentation on it?
Instead of using a `ZStack`, try showing the yellow cicle as an `.overlay` over the `Image`. You might need to change the `.scaleEffect` on the circle to be the same as the scaling of the `Image`. The blue background can be applied using another `.background` modifier to the `Image`. Something like: ```swift ...
I am creating a Spring boot application with Aspects, but it is not working. It is not getting picked up. I have defined EnableAspectJAutoProxy in a custom configuration class. @Configuration @EnableAspectJAutoProxy(proxyTargetClass = true) public class AppConfig { @Bean public ModelMa...
Aspects not working in spring boot application
|spring|spring-boot|aop|aspectj|spring-aop|
Thanks Krish, I modify the code a little bit, this code works : ```[![enter image description here][1]][1] shap_values = pd.DataFrame({ "A": [-0.065704, -0.096510, 0.062368, 0.062368, 0.063093], "B": [-0.168249, -0.173284, -0.168756, -0.168756, -0.169378] }) train = pd.DataFrame({ "A": [0, 1, 1, 0, 0], ...
I am working on an scanned image which is basically a handwritten letter. My target is to find the bounding boxes of every line on that image. But the bounding boxes **must not** overlap each other. **Input Image:** [![Input image][1]][1] **Expected Image after drawing bounding boxes:** [![Expected image][2]][...
changing the node version used by apache web server
|node.js|apache|ubuntu|webserver|node-modules|
You can navigate to **Settings | Editor | Inspection Settings | Inspection Severity | C#** and disable the `Namespace does not correspond to file location` inspection. Consider saving this setting only for the current project by opening the drop-down menu for the Save button and selecting **Solution personal** or **Sol...
A few days ago Webmin S3 site backups began to fail. Error notice was as follows: > Can't locate Time/Piece.pm in @INC (@INC contains: /vendor_perl /usr/libexec/webmin /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . .. .. /us...
Webmin CentOS7 AWS backup errors - perl(S3::AWSAuthConnection) can't be installed
|perl|amazon-s3|webmin|
Turns out that installing Net::Amazon::S3 worked for me. I don't know why it started failing, but installing this one will correct communications with S3. https://metacpan.org/pod/Net::Amazon::S3 Module name Net::Amazon::S3 0.89-2.el7 Description Use the Amazon S3 - Simple Storage Service ...
I have a data frame with 2 columns (ID and Year). I want to create a 3rd column called "FLAG" that has output based on the following conditions **(all grouped by the ID)**: - If data exists for 2020 or 2021 (but not both), then output "Gap" - If data exists for 2020 and 2021, then output "Ap21" - If data exists fo...
since the chatbots haven't figured this one out, here's how to get rid of the annoying Styles pane for chromium: - Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac) to open dev tools. - Click the settings icon - Under "Panel layout" select horizontal the extra pane will now be at the bottom, height-adjustable.
<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function calculateSum() { // Get the values from the input fields var num1 = parseFloat(document.getElementById("num1").value); var num2 = parseFloat(document.getElementById("num2").value); ...
I'm rendering a page which uses states to store data and it contains several event handlers that needs async/await because it contains fetch function. How would I go about this? I've read about using useEffect, but how would I integrate it inside a handler in this case? Is it possible? Here's a snippet of one of ...
I'm trying to implement a command in my VSCode extension that auto-trims the document, leaving nothing left but the found text from the find widget (joined by newlines). Example image: [![enter image description here][1]][1] Ideally when I run my command, the only text remaining in the document are the woff2 u...
Soft list based on another list
|python|python-3.x|list|dictionary|sorting|
My solution was to create a popup that takes up the entire size of the parent: ```java int width = ConstraintLayout.LayoutParams.MATCH_PARENT; int height = ConstraintLayout.LayoutParams.MATCH_PARENT; final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable); ``` Then, in the xml lay...
{"Voters":[{"Id":446594,"DisplayName":"DarkBee"},{"Id":3115822,"DisplayName":"Borja"},{"Id":13376511,"DisplayName":"Michael M."}],"SiteSpecificCloseReasonIds":[18]}
views: ``` @scheduled_task def daily(request): signals.task_daily.send_robust(sender=None) return HttpResponse('ok') ``` signals: ``` from django.dispatch import Signal task_daily = Signal() ``` commad: ``` from django.core import management from django.dispatch import receiver @re...
I am looking at transitioning docker image builds from using a bash wrapper script + Dockerfiles to using packer. The script does a git clone, then sets a variable in the script to a git commit (e.g. `gitCommit=$(git log -1 --pretty="format:%h %s")`). The variable is then passed to the docker build command as a build a...
|training-data|langchain|large-language-model|huggingface|seq2seq|
For OpenLayers 2: ``` Map.getExtent() ``` ...will return a Bounds, which you can then use to get the lat/long coordinates in any number of ways: http://dev.openlayers.org/apidocs/files/OpenLayers/BaseTypes/Bounds-js.html#OpenLayers.Bounds Ideally, you'd turn the vectors into Geometry objects and check them a...
I've been trying to get my head around this for a couple weekends now, I've been watching some tutorials and reading up, but I'm still missing key bits of what's actually doable with a dataset. I've struggled to find any resources on actual dataset creation. All the tutorials just seem to use plug and play datasets wit...
Trouble understanding how to use list of String data in a Machine Learning dataset - Features expanded before making prediction
|pandas|csv|tensorflow|machine-learning|dataset|
null
My core table data looks like this. It is keeping track of order statuses. | ID | PartNum | EnteredOn | PickedTime | DeliveredTime | | -------- | -------------- |-------------- |-------------- |-------------- | | 100 | 50A |2024-03-28 08:59:13.727 |2024-03-28 09:30:20.237 |2024-03-28 09:56:42.570 | | 125 | 6...
In a VSCode extension (Using Typescript) - How can I get the text content of all matches when the user executes a search in the Find Widget?
|typescript|vscode-extensions|
I'm trying to access my custom environment value without declaring `@Environment` property in `View`. So why I need that? Let's look at the example. I have my custom environment value: ``` enum Theme { case black case white func color() -> Color { // ... Get color functional } } struct Th...
Access to environment value without declare @Environment property in SwiftUI's View
|ios|swift|swiftui|
I have a `basePath` in nextjs config. When I setup the `basePath` it is working fine on local. But when I deploy the project in firebase I am getting 404 index.html not found. Below is my firebase.json config: ``` { "hosting": { "source": ".", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],...
How to host nextjs project with basePath in firebase? I am facing 404 index.html not found
|firebase|next.js|
In angular, we can encapsulate functionality in a component and define its interface via @Input and @Output <br> I imagine this to be the interface to a component. Interfaces in other systems typically include properties, methods and events. It is clear how to make a property part of your interface - decorate it ...
How to create a flag based on several conditions?
|r|dataframe|
Hi here are few observations, [Click Here][1] [1]: https://i.stack.imgur.com/jYeT8.png I have a php program ` <?php $op=exec('node -v'); $op1=exec('which node'); echo "Node version : $op"; echo "\n Node path : $op1"; echo "\nUser : ". get_current_user(); ?> ` when i ...
## Problem ## **[Count Subarrays Where Max Element Appears at Least K Times][1]** You are given an integer array `nums` and a positive integer `k`. Return the number of subarrays where the maximum element of `nums` appears at least `k` times in that subarray. A subarray is a contiguous sequence of elements within...
I am new to R and R/exames but it looks promising so I would like to try to use it. I am trying to import a question from R/exams into www.inspera.com by using QTI v2.1. The question I am using is “elasticity1.Rmd” (found on https://www.r-exams.org/assets/posts/2017-10-07-static_num_schoice/elasticity1.Rmd). I am...
Falling to import R/exams question to Inspera do to lack of expectedLength parameter
|r-exams|
null
Pandas API on Spark exposes the pandas functionality to spark which enables users to write pandas-style code on spark dataframes. #### [API Reference Doc](https://spark.apache.org/docs/latest/api/python/reference/pyspark.pandas/index.html)
null
You should not violate the rules stated by the React documentation, because React (when used as intended) makes certain guarantees on how it will behave. React doesn't make guarantees on how it would behave if used differently. The internal implementation of React may change fundamentally without notice. React w...
How to detect lines and draw bounding box of that line on handwritten letters Using CV2
|python|opencv|computer-vision|connected-components|mser|
EDIT: I will either delete this answer, or refactor it to be in Postgres syntax (I initially misread the question and thought this was for SQL Server). Depending on whether it answers the question or not. Currently the question is ambiguous. This answer takes advantage of the [OUTPUT][1] clause available in SQL Ser...
what I doing wrong? This is my top html: <RadSideDrawer> <Button ... ></Button> <StackLayout MainContent> <page-router-outlet></page-router-outlet> </StackLayout> </RadSideDrawer> I have add this module to app.module.ts ... import { NativeScriptUISideDrawerModul...
nativescript-ui-sidedrawer - Unable to start activity ComponentInfob Calling js method onCreate failed
|android|angular|nativescript-angular|nativescript-plugin|
Assuming that your initial table (your incremental table) is insert only and has an additional column to track the timestamp when a record was inserted. Also assuming that when you say the 'latest' record that you are referring to the IDs that have the greatest insert timestamp. The capturing of deletes can be inser...
|rsync|systemd|
VS Code is currently planning a way to allow users to unpublish specific versions of their extension. I don't think the exact details are fleshed out yet, though I assume that once this gets implemented, you'd be able to unpublish that version and still use that version number later when the time comes. See VS Marketpl...
null
|python|mysql|python-3.x|sqlalchemy|pipenv|
null
I am trying to fetch images from firebase storage and display it in my flutter app but i am getting the error "No object exists at the desired reference". All the images are stored in the root directory. I have also changed the firebase rules to allow read and write without authentication. This is my code. impo...
firebase_storage/object-not-found. No object exists at the desired reference
|flutter|firebase|
I need to exchange data between a Windows service and a "regular" application. To do that I use the shared memory (file mapping) and a couple of event. I create the event objects in the service using "CreateEvent()" function and in the application I use the "OpenEvent()" function. In the service: HANDLE hEv...
When creating a new User Story and we chose to close it, we get 3 options "Cancel", "Discard" or "Save changes". By choosing the option to "Save changes" one would expect a draft version of the ticket to be created and saved, but where is it? Steps to reproduce the case in question: 1. On the Backlog, choose an ...
I want to pursue a functional-style one-liner for this task with no filters, no new/temporary variables, and correctly return a string from an array of zero or more words/elements. I use the variables `$conjunction` to contain the single replacement word `and` (wrapped with spaces) and `$separator` to contain the de...
null
I'm trying to use locomotive-scroll in a Next.js component with TypeScript, but I've encountered a significant problem. While incorporating it into a React project posed no issues, and everything functioned as expected, ``` function App() { const scroll = new LocomotiveScroll({ el: document.querySelector("[da...
In this call to `df.sort_index()` on a MultiIndex dataframe, how to use `func_2` for level `two`? func_1 = lambda s: s.str.lower() func_2 = lambda x: np.abs(x) m_sorted = df_multi.sort_index(level=['one', 'two'], key=func_1) The [documentation][1] says "*For MultiIndex inputs, the key is applied per...
How to use two key functions when sorting a MultiIndex dataframe?
|python|pandas|sorting|multi-index|
In the following example I'm downloading MNIST myself and loading it through `reticulate` / `numpy`. Shouldn't make much difference. When you want to get a sample with `sample(), you usually take a sample of indices you'll use for submitting. To get a balanced sample, you might want to draw a specific number or proport...
# Absolutely perfect 2019 solution: [![enter image description here][1]][1] Without further ado, here's exactly how you do this. 1. Don't actually use, in any way, the "standard" layer `.layer` that comes with the view 2. Make a new layer *only for* the image. You can now mask this (circularly) without affect...
I have the following bash script (`test.sh`): #!/bin/bash printf '\e[36m%s\e[0m' "This is a test"; echo "" function yes_or_no { while true; do read -p "$* [y/n]: " yn case $yn in [Yy]*) return 0 ;; [Nn]*) echo "Aborted"...
Exchange data between a Windows service and an application
|windows|service|
I have finished Bro codes 4 hour course on C and now I am interested in GUI applications using C. GTK looks good to me, but I don't understand anything on the GTK web site. After a few tutorials, I can build GTK code in Code::Blocks. Now I want to deploy and distribute it on Windows. Can anybody give me a guide? I t...
Distributing a GTK4 Windows application
|c|user-interface|gtk|