question_id
int64
37.6M
73.2M
input_text
stringlengths
88
52.4k
output_text
stringlengths
37
35.6k
title
stringlengths
15
150
tags
stringlengths
1
107
q_score
int64
-19
397
view_count
int64
3
879k
answer_count
int64
1
21
accepted_answer_id
int64
37.6M
73.8M
answer_id
int64
37.6M
73.8M
a_score
int64
-5
1.29k
is_accepted
bool
1 class
creation_date
stringlengths
20
24
input_text_instruct
stringlengths
251
52.6k
72,858,612
How to use logging filter without passing resulting logger as an extra argument to every function?<p>I am using logging Filters to provide contextual information for logging statements.</p> <pre><code>import logging class ContextFilter(logging.Filter): def filter(self, record): record.client_id = 12345 ...
<p>When you use <code>logging.info()</code> you are using the root logger, which doesn't have your filter. If you added</p> <pre><code>logging.getLogger().addFilter(f) # logging.getLogger() gets root logger </code></pre> <p>then your <code>logging.info()</code> call won't raise the error.</p>
How to use logging filter without passing resulting logger as an extra argument to every function?
python|logging
1
61
1
72,866,396
72,866,396
1
true
2022-07-04T14:53:04.897Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to use logging filter without passing resulting logger as an extra argument to every function?<p>I am using logging Filters to provide contextual informa...
72,856,147
How to decrypt the verification code from cognito?<p>I got the code like this in request codeParameter:&quot;{####}&quot; and I want to store it in database decrypted.</p> <pre><code>const { plaintext, messageHeader } = await decrypt( keyring, b64.toByteArray(codeParameter), ); console.log(plaintext...
<p>The lambda trigger referred in the provided AWS Documentation <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-email-sender.html" rel="nofollow noreferrer">Custom email sender Lambda trigger</a> is not the same as the lambda you are implementing, which is the <a href="https:...
How to decrypt the verification code from cognito?
javascript|node.js|amazon-web-services|aws-lambda|amazon-cognito
0
61
1
72,875,920
72,875,920
1
true
2022-07-04T11:42:50.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to decrypt the verification code from cognito?<p>I got the code like this in request codeParameter:&quot;{####}&quot; and I want to store it in database ...
72,890,237
What signal is emitted when pressing CTRL+D in node:readline?<p>I've been trying to intercept <code>CTRL+D</code> so I can use it to represent 'document' for a CLI I am building. I have been unsuccessful identifying how to intercept it when using readline with keypress.</p> <p>Is there a specific signal event I can lis...
<p><kbd>Control</kbd> + <kbd>D</kbd> is not a regular operating system signal like SIGINT.</p> <p>It is used on stdin as &quot;end-of-transmission&quot; information by readline and many others to close stdin. Here is a snippet of the <a href="https://github.com/nodejs/node/blob/9512da07a4eb9a8c5fb1f232524c7df7627f676e/...
What signal is emitted when pressing CTRL+D in node:readline?
node.js|readline|ctrl
2
61
1
72,890,974
72,890,974
1
true
2022-07-06T21:50:51.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What signal is emitted when pressing CTRL+D in node:readline?<p>I've been trying to intercept <code>CTRL+D</code> so I can use it to represent 'document' for...
72,891,183
How can you pass a multi-line output from one command as n arguments to a single command, not n commands with a single argument?<h3>TL;DR</h3> <p>Given the input</p> <pre><code>a b c </code></pre> <p>I am trying to execute command <code>foo</code> with each input as a separate argument (e.g. 'n' inputs means a single c...
<p>You're trying too hard.</p> <pre><code>find * -type f -name &quot;*.swift&quot; -print0 | xargs -0 xcrun -sdk macosx swiftc -o &quot;$OUTPUT_FILE&quot; </code></pre>
How can you pass a multi-line output from one command as n arguments to a single command, not n commands with a single argument?
bash|shell|sh|zsh|xargs
0
61
2
72,891,255
72,891,255
1
true
2022-07-07T00:45:08.773Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can you pass a multi-line output from one command as n arguments to a single command, not n commands with a single argument?<h3>TL;DR</h3> <p>Given the i...
72,892,900
Can Dynamic and Constantly changing image URL work with Next/image<p><strong>Can Next/Image use empty string variables for the src that'd get set later via an API?</strong></p> <p>I have an image url that I'd retrieve from an API. so the image src gets set after runtime. By default it's an empty string <code>''</code> ...
<p>Try rendering the <code>Image</code> conditionally like so :</p> <pre><code>return ( &lt;&gt; {imageUrl &amp;&amp; &lt;Image src={imageURL} alt='Dynamic Image' layout='responsive'/&gt; } &lt;/&gt; ) </code></pre>
Can Dynamic and Constantly changing image URL work with Next/image
reactjs|next.js|nextjs-image
0
61
1
72,893,070
72,893,070
1
true
2022-07-07T05:57:58.153Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can Dynamic and Constantly changing image URL work with Next/image<p><strong>Can Next/Image use empty string variables for the src that'd get set later via a...
72,879,821
CUDA Unified Memory: Difference in behaviour on Windows and Linux<p>I am porting an application from Linux to Windows and discovered significant runtime differences of the same code on the same hardware between Windows and Linux.</p> <p>A minimal working example:</p> <pre class="lang-cpp prettyprint-override"><code>#in...
<p>According to the <a href="https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#um-requirements" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p>GPUs with SM architecture 6.x or higher (Pascal class or newer) provide additional Unified Memory features such as on-demand page migration and ...
CUDA Unified Memory: Difference in behaviour on Windows and Linux
c++|cuda
1
61
1
72,899,607
72,899,607
1
true
2022-07-06T07:59:32.570Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CUDA Unified Memory: Difference in behaviour on Windows and Linux<p>I am porting an application from Linux to Windows and discovered significant runtime diff...
72,899,811
How to extract elements from a list when the list is made of string and list of differents size?<p>I have a list made of lists and strings, and I want to extract each element from the list. And if the extracted element is a list, extract the elements from the list.</p> <p>This is just to manipulate the lists a bit so I...
<p>You can do something like this:</p> <pre class="lang-py prettyprint-override"><code>meal = ['salad', ['coquillette', 'ratatouille', 'steak'], 'cheese', ['ice cream', 'tart', 'fruit']] out = [] for m in meal: out += [m] if not isinstance(m, list) else m print(out) ['salad', 'coquillette', 'ratatouille', 'steak', '...
How to extract elements from a list when the list is made of string and list of differents size?
python|list
0
61
5
72,899,907
72,899,907
1
true
2022-07-07T14:41:41.800Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to extract elements from a list when the list is made of string and list of differents size?<p>I have a list made of lists and strings, and I want to ext...
72,904,063
How to copy specific files from directory into new directory zsh<p>I have a list of file names contained within a text file (a.txt). I want to extract from a directory (b) the files listed in <strong>a.txt</strong> to a new directory (c). The syntax of the filenames in <strong>a.txt</strong> and <strong>b</strong> matc...
<p>If you know the filenames don't contain whitespace or wildcard characters, you can do it as a simple one-liner:</p> <pre><code>cp $(&lt;a.txt) b/ </code></pre> <p>If they can contain special characters, you can read them into an array:</p> <pre><code>readarray files &lt;a.txt cp &quot;${files[@]}&quot; b/ </code></p...
How to copy specific files from directory into new directory zsh
linux|zsh|cp
0
61
2
72,904,108
72,904,108
1
true
2022-07-07T20:49:28.237Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to copy specific files from directory into new directory zsh<p>I have a list of file names contained within a text file (a.txt). I want to extract from a...
72,906,967
How to replace Open api spec in Azure Api Management service<p>I have a rest api with its specification written in OAS 3.x version. This api spec yaml file has been uploaded into <code>Azure Api Management service</code></p> <p>Now I have added additional endpoints to this OpenAPI spec and I need to upload it again int...
<p>If you are facing issues with update, there is an alternate way. Go to your API and select 'All Operations' there you have an Open API specification editor. You can just replace your code there (copy/paste).</p> <p><a href="https://i.stack.imgur.com/yqxj7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgu...
How to replace Open api spec in Azure Api Management service
azure|azure-api-management
0
61
1
72,907,241
72,907,241
1
true
2022-07-08T05:18:58.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to replace Open api spec in Azure Api Management service<p>I have a rest api with its specification written in OAS 3.x version. This api spec yaml file h...
72,914,671
Oracle: Dynamic SQL query error for subquery right parenthesis(ORA-00907: missing right parenthesis)<p>I have executed below block and I am getting the error message as ORA-00907: missing right parenthesis. I have closed right parenthesis but still it is giving error. I am not understating what is wrong in my query. Ca...
<p>Please print the query before execute, that will show you the issue. I believe you need to put spaces after opa.list_header_id and AND</p> <p>I fixed it here and see if that works</p> <pre><code> vv_xml_disc_query VARCHAR2(32767) := NULL; cust_lang varchar2(10):='F'; trx_id number:=2978023; line_so...
Oracle: Dynamic SQL query error for subquery right parenthesis(ORA-00907: missing right parenthesis)
sql|oracle|plsql|dynamic-sql
0
61
2
72,914,831
72,914,831
1
true
2022-07-08T16:58:15.337Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Oracle: Dynamic SQL query error for subquery right parenthesis(ORA-00907: missing right parenthesis)<p>I have executed below block and I am getting the error...
72,906,796
leveldb why do we need sequence number<p>the sequence number does give a versioning information, but why do we need that? The SST structure itself already tells you which one is newer and which one is older: when we do compaction, record from L level always overwrite the one in L + 1 level, if they have the same user k...
<p>For RocksDB, the sequence number is used for a few features, including Snapshot, Transactions, etc.</p> <ul> <li>Snapshot: <a href="https://github.com/facebook/rocksdb/wiki/Snapshot" rel="nofollow noreferrer">https://github.com/facebook/rocksdb/wiki/Snapshot</a></li> <li>Transactions: <a href="https://github.com/fac...
leveldb why do we need sequence number
database|key-value-store|leveldb|rocksdb
1
61
2
72,915,006
72,915,006
1
true
2022-07-08T04:55:24.520Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: leveldb why do we need sequence number<p>the sequence number does give a versioning information, but why do we need that? The SST structure itself already te...
72,917,063
Why does powershell throw a path does not exist error?<p>Why does powershell throw an error when trying to create or modify a registry key from the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-itemproperty?view=powershell-7.2" rel="nofollow noreferrer">docs</a> I used<...
<p>HKLM is the name of a 'drive'. Move there first</p> <p>Set-Location HKLM:</p> <p>Set-ItemProperty -Path &quot;HKLM:\Software\ContosoCompany&quot; -Name &quot;NoOfEmployees&quot; -Value 823</p>
Why does powershell throw a path does not exist error?
powershell|registry
0
61
1
72,917,138
72,917,138
1
true
2022-07-08T21:14:35.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does powershell throw a path does not exist error?<p>Why does powershell throw an error when trying to create or modify a registry key from the <a href="...
72,915,819
Pine Script: How to check if current time is 3:00 PM in GMT+5:30 timezone<p>In the PineScript v5, I am trying to develop a strategy where I don't intent to take any trade after 3:00 pm (in GMT+5:30 timezone). So if the current time is less than 3:00 pm, then only I will &quot;entry&quot;/&quot;exit&quot; the trades. Ot...
<p>We can calculate the hour in GMT+530 using below code</p> <pre><code>h=hour(time('1'),&quot;Asia/Kolkata&quot;) m=minute(time('1'),&quot;Asia/Kolkata&quot;) hour=h*100+m </code></pre> <p>Then you can use this hour in your if case instead of hour(timenow)</p> <p>In below chart I have plotted both (my calculated hour ...
Pine Script: How to check if current time is 3:00 PM in GMT+5:30 timezone
pine-script|tradingview-api|pinescript-v5
0
61
1
72,919,156
72,919,156
1
true
2022-07-08T18:50:59.670Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Pine Script: How to check if current time is 3:00 PM in GMT+5:30 timezone<p>In the PineScript v5, I am trying to develop a strategy where I don't intent to t...
72,910,367
Regex with positive lookbehind that will match multiple lines<p>I'm struggling with regex that will match multiple lines after some specific string.</p> <p>Let's say we have a sample data like:</p> <pre><code>Data1 some changing text 12406943 Old Company New Company reason Something 1/2/2005 10,00 14757152 Old Company ...
<p>In Java, you can make use of the <code>\G</code> anchor instead of using a lookbehind assertion.</p> <p><strong>Explanation</strong></p> <pre><code>(?:^Data2\Rsome changing text|\G(?!^))\R(?&lt;caseNumber&gt;\d+)\h+(?&lt;companyName&gt;\S.*?)\h+(?&lt;invoiceNumber&gt;\S+)\h+\d{2}\.\d{2}\.\d{4}\b.* </code></pre> <ul>...
Regex with positive lookbehind that will match multiple lines
java|regex|regex-lookarounds
0
61
1
72,923,261
72,923,261
1
true
2022-07-08T10:54:30.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Regex with positive lookbehind that will match multiple lines<p>I'm struggling with regex that will match multiple lines after some specific string.</p> <p>L...
72,923,295
Solana Metaplex Creator Split issue<p>I'm using the Metaplex Storefront for testing purposes. I've added 2 whitelisted wallets for my auction page via the admin page(one of the whitelisted wallet is that I used to initialize the page). I've made a test auction with this nft(<a href="https://explorer.solana.com/address/...
<p>Creators array works for secondary sales (marketplaces for example), splitting the royalties percentage obtained on secondary sales over the creator array addresses.</p> <p>For example, your NFT has a 4% on the seller fee, and ur creator array share is set to 50-50, then each creator will receive 2% of any secondary...
Solana Metaplex Creator Split issue
typescript|solana|metaplex
-1
61
1
72,923,641
72,923,641
1
true
2022-07-09T17:09:23.820Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Solana Metaplex Creator Split issue<p>I'm using the Metaplex Storefront for testing purposes. I've added 2 whitelisted wallets for my auction page via the ad...
72,937,537
Uncaught Error: Maximum update depth exceeded error with useState()<p>Why am I getting this error?</p> <pre><code>Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to preve...
<p>You need to provide a dependency array in <code>setEffect</code> or it will run on <a href="https://reactjs.org/docs/hooks-effect.html#detailed-explanation" rel="nofollow noreferrer">every state change</a>. Since it's changing state, that means it will run, which causes it to run again, which causes it to run again...
Uncaught Error: Maximum update depth exceeded error with useState()
javascript|reactjs|react-hooks
0
61
2
72,937,605
72,937,605
1
true
2022-07-11T11:05:32.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Uncaught Error: Maximum update depth exceeded error with useState()<p>Why am I getting this error?</p> <pre><code>Uncaught Error: Maximum update depth exceed...
72,943,396
How do I get all members with a role?<p>I'm trying to send a DM to all members with a specific role. I've tried that to get members with a role:</p> <pre><code>guild.roles.cache.get(ROLE_ID).members </code></pre> <p>and</p> <pre><code>guild.roles.fetch(ROLE_ID) </code></pre> <p>My problem is that the bot only returns m...
<p>I think the problem is that <a href="https://discord.js.org/#/docs/main/stable/class/Role?scrollTo=members" rel="nofollow noreferrer"><code>Role#members</code></a> returns a Collection of the <strong>cached</strong> guild members only that have this role. Try to fetch all members first and then try again:</p> <pre c...
How do I get all members with a role?
javascript|node.js|discord|discord.js|bots
1
61
1
72,944,037
72,944,037
1
true
2022-07-11T18:58:38.383Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I get all members with a role?<p>I'm trying to send a DM to all members with a specific role. I've tried that to get members with a role:</p> <pre><co...
72,941,565
Hosting and connecting to a google cloud sql databse<p>I'm currently building a website that I would like to privately host so it can only be used internally. My goal is to store file uploads into a google cloud bucket then document certain things into a cloud sql db for filtering later on.</p> <p>I've been able to sto...
<p>The general recommendation is to use the <a href="https://cloud.google.com/sql/docs/postgres/sql-proxy" rel="nofollow noreferrer">Cloud SQL Auth Proxy</a> to connect to your Cloud SQL instance.</p> <p>Basically you'd run the proxy wherever you're running your webapp and then have your webapp connect to the proxy as ...
Hosting and connecting to a google cloud sql databse
node.js|reactjs|google-cloud-sql|endpoint
1
61
1
72,945,489
72,945,489
1
true
2022-07-11T16:12:37.547Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hosting and connecting to a google cloud sql databse<p>I'm currently building a website that I would like to privately host so it can only be used internally...
72,945,065
offline debugging mdt powershell scripts<p>I’m trying to create a way to offline debug PowerShell scripts that are intended for workstation deployment Task Sequences in Microsoft Deployment Toolkit (MDT). The scripts use the task sequence environment variables that are retrieved using a ComObject, $tsenv. The ComObject...
<p>First, if you want to export objects to be imported later I highly recommend the <code>Export-CliXml</code> cmdlet. It will retain things like nested arrays and what not, so if &quot;APPLYGPOPACK&quot; returns an array of strings of what GPOs to apply, it will keep it as an array of strings when you import it later....
offline debugging mdt powershell scripts
powershell|mdt
0
61
1
72,945,521
72,945,521
1
true
2022-07-11T21:59:22.177Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: offline debugging mdt powershell scripts<p>I’m trying to create a way to offline debug PowerShell scripts that are intended for workstation deployment Task S...
72,949,888
Cannot Access Variable In While Loop Inside Function Python<p>I have a program that is involved with flask and python, It is actually part of a larger program that recognizes license plates and does other things at the same time, I want to access a variable that is inside a while loop and that loop is inside a function...
<p>I cannot find the <code>boxes</code> variable declared anywhere except inside the function.</p> <p>If you want to use the <code>global</code> keyword, you need to actually have a global variable with that name. Long story short, a global variable needs to be declared outside any function.</p> <p>You might want to do...
Cannot Access Variable In While Loop Inside Function Python
python|tensorflow|flask
-1
61
1
72,950,032
72,950,032
1
true
2022-07-12T09:17:18.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot Access Variable In While Loop Inside Function Python<p>I have a program that is involved with flask and python, It is actually part of a larger progra...
72,950,123
Issue with database connection string using Helm and kubernetes secrets<p>I'm trying to put a formatted Postgres connection string inside a Kubernetes secret. I'm using Helm to deploy the apps to the AKS cluster and after the deployment, looking at the values of the secrets in the Azure portal, I see something strange....
<p>In the format string, use <code>%d</code> for the (integer) port number.</p> <pre class="lang-yaml prettyprint-override"><code>{{ with .Values.database }} DatabaseConnectionString: &quot;{{ printf &quot;Server=%s;Port=%d;...&quot; .host .port | b64enc }}&quot; {{ end }} </code></pre> <p>This comes from the <a href="...
Issue with database connection string using Helm and kubernetes secrets
kubernetes|kubernetes-helm|go-templates
0
61
1
72,950,485
72,950,485
1
true
2022-07-12T09:34:54.023Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issue with database connection string using Helm and kubernetes secrets<p>I'm trying to put a formatted Postgres connection string inside a Kubernetes secret...
72,956,255
how to remove blue outline from bootstrap 5 range input<p>I tried removing the outline using shadow none, but its not working is there another solution</p> <p><a href="https://i.stack.imgur.com/9yQp2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9yQp2.png" alt="range input" /></a></p> <p>Html code<...
<p>I got the answer by looking at file <code>_custom-forms.scss</code> from bootstraps src.</p> <p>This is how you do a live snippet:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override...
how to remove blue outline from bootstrap 5 range input
css|twitter-bootstrap
0
61
1
72,956,649
72,956,649
1
true
2022-07-12T17:31:13.380Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to remove blue outline from bootstrap 5 range input<p>I tried removing the outline using shadow none, but its not working is there another solution</p> <...
72,935,628
FLTK - Why fl_width function returns -1 for the length of a char array on a Linux machine?<p>I am using the <code>fl_width</code> function to create widgets whose size depends on their label (<em>e.g.</em>, some Fl_Box). In the <a href="https://www.fltk.org/doc-1.3/group__fl__attributes.html#ga92c762ce2fc7fa891bac6b759...
<h3>One should invoke <code>fl_font(Fl_Font face, Fl_Fontsize fsize)</code> first.</h3> <p>As <a href="https://stackoverflow.com/users/7860670/user7860670">user7860670</a> suggested in the comments to the question, one have to invoke <code>fl_font(Fl_Font face, Fl_Fontsize fsize)</code> for having a proper behaviour fo...
FLTK - Why fl_width function returns -1 for the length of a char array on a Linux machine?
c++|linux|ubuntu|fltk
1
61
1
72,965,664
72,965,664
1
true
2022-07-11T08:24:23.793Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: FLTK - Why fl_width function returns -1 for the length of a char array on a Linux machine?<p>I am using the <code>fl_width</code> function to create widgets ...
72,961,157
Can't use TSConfig Paths in the Jest test files<p>Well, the title is pretty auto-explainable: I have set my tsconfig paths so that I can use <code>@configs/logger</code> instead of <code>../../configs/logger</code> everytime in my APP files. But if I try to use those path mappings in the jest test files, it doesn't wor...
<p>Apparently if I change in the <code>tsconfig.json</code> from</p> <pre class="lang-json prettyprint-override"><code>&quot;baseUrl&quot;: &quot;./src/&quot;, &quot;paths&quot;: { &quot;@configs/*&quot;: [&quot;configs/*&quot;], &quot;@controllers/*&quot;: [&quot;controllers/*&quot;], &quot;@middlewares/*&...
Can't use TSConfig Paths in the Jest test files
typescript|jestjs|ts-jest|tsconfig|tsconfig-paths
1
61
1
72,967,653
72,967,653
1
true
2022-07-13T05:01:12.633Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can't use TSConfig Paths in the Jest test files<p>Well, the title is pretty auto-explainable: I have set my tsconfig paths so that I can use <code>@configs/l...
72,971,755
Deciles in Python<p>I want to group a column into deciles and assign points out of 50.</p> <p>The lowest decile receives 5 points and points are increased in 5 point increments.</p> <p>With below I am able to group my column into deciles. How do I assign points so the lowest decile has 5 points, 2nd lowest has 10 point...
<p>Try this:</p> <pre><code>df['points'] = df['decile'].add(1).mul(5) </code></pre> <p>Output:</p> <pre><code> column decile points 0 1 0 5 1 2 0 5 2 2 0 5 3 3 1 10 4 4 1 10 5 4 1 10 6 5 2 ...
Deciles in Python
python|pandas|cut
0
61
3
72,971,820
72,971,820
1
true
2022-07-13T19:39:47.017Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Deciles in Python<p>I want to group a column into deciles and assign points out of 50.</p> <p>The lowest decile receives 5 points and points are increased in...
72,973,774
How can I choose a single dynamodb table as event type in Cloudtrail<p>I plan to create a trail in <code>Cloudtrail</code> to capture all data events for a dynamodb table. But it doesn't allow me to select a single dynamodb table. It is greyed out in below screenshot. Is there a way to only capture one single table rat...
<p>You have to switch to advanced mode. Then you can specify custom event pattern in json, e.g.:</p> <pre><code>[ { &quot;name&quot;: &quot;&quot;, &quot;fieldSelectors&quot;: [ { &quot;field&quot;: &quot;eventCategory&quot;, &quot;equals&quot;: [ &quot;Data&quot; ] ...
How can I choose a single dynamodb table as event type in Cloudtrail
amazon-web-services|amazon-dynamodb|amazon-cloudtrail
0
61
1
72,973,853
72,973,853
1
true
2022-07-13T23:45:51.917Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I choose a single dynamodb table as event type in Cloudtrail<p>I plan to create a trail in <code>Cloudtrail</code> to capture all data events for a d...
72,974,700
SQL how to remove the last character of a string if it is not numeric?<pre><code>PhoneNumber 1111111 1111111name 1111111ext2222name 1111111ex222name </code></pre> <p>I have a column of phone numbers that looks like this. The phone number could be followed by an extension then followed by a name. I'd like to remove the ...
<p>With just a bit of string manipulation</p> <pre><code>Declare @YourTable Table ([PhoneNumber] varchar(50)) Insert Into @YourTable Values ('1111111') ,('1111111name') ,('1111111ext2222name') ,('1111111ex222name') Select * ,NewValue = substring([PhoneNumber],1,len([PhoneNumber])-patindex('%[0-9]%',reverse([...
SQL how to remove the last character of a string if it is not numeric?
sql|sql-server|azure-synapse
0
61
1
72,974,741
72,974,741
1
true
2022-07-14T02:57:34.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: SQL how to remove the last character of a string if it is not numeric?<pre><code>PhoneNumber 1111111 1111111name 1111111ext2222name 1111111ex222name </code><...
72,951,623
"Not a valid framework" (MM0140) error when trying to build Xamarin native bindings library for framework targeting net6-macos<p>I have working native bindings library targeting old xamarin.mac (xamarin.full net framework 4.8) built with mono. It is binding <code>ScritptingBridge.framework</code>, not a static library....
<p>Finally, I posted the issue in the xamarin repo on github <a href="https://github.com/xamarin/xamarin-macios/issues/15485" rel="nofollow noreferrer">https://github.com/xamarin/xamarin-macios/issues/15485</a>.</p> <p>And ducting the discussion and experiments we concluded the following:</p> <ul> <li><p>MM0140 is beca...
"Not a valid framework" (MM0140) error when trying to build Xamarin native bindings library for framework targeting net6-macos
c#|xamarin|xamarin.mac
2
61
1
72,977,137
72,977,137
1
true
2022-07-12T11:32:24.230Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: "Not a valid framework" (MM0140) error when trying to build Xamarin native bindings library for framework targeting net6-macos<p>I have working native bindin...
72,814,509
Movesense can't generate ninja files according to documentation<p>C++ development and related evironments are not something I use so I might be missing som knowledge in this area.</p> <p>I want to do som sensor programming and want to deploy the example-project to get it working and then write my own code to extend it ...
<p>You are trying to build the project on the MinGW terminal in windows instead of the Docker container as described in the documentation:</p> <p><a href="https://movesense.com/docs/esw/getting_started/#build-commands-real-hw" rel="nofollow noreferrer">https://movesense.com/docs/esw/getting_started/#build-commands-real...
Movesense can't generate ninja files according to documentation
c++|cmake|ninja|movesense
1
61
1
72,977,557
72,977,557
1
true
2022-06-30T10:50:42.527Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Movesense can't generate ninja files according to documentation<p>C++ development and related evironments are not something I use so I might be missing som k...
72,975,909
Separate messages buffered together with Lighttpd’s mod_wstunnel and UNIX socket communication to the backend<p>I have a problem with lighttpd's <code>mod_wstunnel</code> where if I send from the backend (using a UNIX socket to communicate between lighttpd and the backend) two messages in a row (two consecutive <code>s...
<p>As linked in a comment above, the answer in <a href="https://stackoverflow.com/questions/61601487/lighttpd-mod-wstunnel-concatenates-json-messages">lighttpd/mod_wstunnel concatenates JSON messages</a> links to RFC 6455 which says that &quot;An intermediary might coalesce and/or split frames.&quot;</p> <p><a href="ht...
Separate messages buffered together with Lighttpd’s mod_wstunnel and UNIX socket communication to the backend
javascript|c++|json|websocket|lighttpd
0
61
1
72,985,906
72,985,906
1
true
2022-07-14T06:05:40.483Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Separate messages buffered together with Lighttpd’s mod_wstunnel and UNIX socket communication to the backend<p>I have a problem with lighttpd's <code>mod_ws...
72,978,800
Kafka: The connection was reset error in browser and INFO exited: sample-data (exit status 0; expected)<p>I have run the following command while making the kafka cluster up</p> <pre><code>sudo docker compose up kafka-cluster </code></pre> <p>i have successfully access the Landoop UI portal a day ago but when i shutdown...
<p>I figured out the solution as <code>fast-data-dev</code> is not maintained so we can make changing in the my configuration or <code>mydocker_compose.yml</code> I have replaced the <code>landoop/fast-data-dev:cp3.3.0</code> with <code>landoop/fast-data-dev:latest</code>My final <code>docker-compose.yml</code> is as f...
Kafka: The connection was reset error in browser and INFO exited: sample-data (exit status 0; expected)
docker|apache-kafka
0
61
1
72,990,764
72,990,764
1
true
2022-07-14T10:09:17.400Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Kafka: The connection was reset error in browser and INFO exited: sample-data (exit status 0; expected)<p>I have run the following command while making the k...
72,990,648
Cypress - How to use if statement with contains<p>so I have to use <code>cy.contains</code> to find the element I want, but all I can find online is how to use if() with <code>cy.find</code> or <code>cy.get</code> if there a way to do this with contains?</p> <p>Example code:</p> <pre class="lang-js prettyprint-overrid...
<p>You can also do like this:</p> <pre class="lang-js prettyprint-override"><code>cy.get('body').then(($body) =&gt; { if ($body.find('div.name:contains(&quot;Test 1&quot;)').length &gt; 0) { //Element Found } else { //Element not found } }) </code></pre>
Cypress - How to use if statement with contains
cypress
1
61
3
72,990,768
72,990,768
1
true
2022-07-15T07:45:07.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cypress - How to use if statement with contains<p>so I have to use <code>cy.contains</code> to find the element I want, but all I can find online is how to ...
72,994,482
Decode JSON response from API<p>I get some JSON objects from my api that look like this:</p> <pre><code>{ &quot;from&quot;: &quot;1970-01-01&quot;, &quot;until&quot;: null, &quot;employeeId&quot;: &quot;13&quot;, &quot;project&quot;: { &quot;id&quot;: &quot;05c6adce-20cd-4ca3-9eff-8fd430f63a20&q...
<p>There is a lot going on with the structs you try to decode to. You got several typos in here. E.g. <code>alternativeCode</code> instead of <code>alternativeCodes</code>...</p> <p>Next there are several type mismatches here. For example <code>employeeId</code> is a <code>String</code> and not an <code>Int</code>.</p>...
Decode JSON response from API
swift|jsondecoder
1
61
2
72,994,968
72,994,968
1
true
2022-07-15T13:06:45.493Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Decode JSON response from API<p>I get some JSON objects from my api that look like this:</p> <pre><code>{ &quot;from&quot;: &quot;1970-01-01&quot;, &...
72,995,101
How do I know what should be added as a provider or import in my Jasmine Unit Test<p>I'm new to unit tests and I haven't been able to find a clear and concise explanation of what gets added as a provider vs import in my spec.ts. I keep getting the same error no matter what I try.</p> <p>Here's my service class:</p> <p...
<p>What gets added to imports are <code>modules</code> and what gets added to <code>providers</code> are services. Some <code>modules</code> export a <code>provider/service</code> in their <code>exports</code> field and therefore you can add a module to the <code>imports</code> section and then be able to inject the ex...
How do I know what should be added as a provider or import in my Jasmine Unit Test
javascript|angular|unit-testing|jasmine
1
61
2
72,995,465
72,995,465
1
true
2022-07-15T13:53:16.600Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I know what should be added as a provider or import in my Jasmine Unit Test<p>I'm new to unit tests and I haven't been able to find a clear and concis...
72,992,778
Find exact match with regular expression without preleading string in python<p>I have a text file called my_file.txt that has the following content:</p> <pre><code> R.A.O.S-VARIATION WITH WAVE PERIOD/FREQUENCY VEL R.A.O.S-VARIATION WITH WAVE PERIOD/FREQUENC...
<p>For a fixed-string match like this, you don't need a regular expression.</p> <p>Use this instead:</p> <pre><code>if line.strip() == &quot;R.A.O.S-VARIATION WITH WAVE PERIOD/FREQUENCY&quot;: # do stuff </code></pre> <p>If you really want to use a regular expression, use <code>re.fullmatch()</code> to match the wh...
Find exact match with regular expression without preleading string in python
python|regex|match|python-re
-3
61
3
72,997,354
72,997,354
1
true
2022-07-15T10:43:57.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Find exact match with regular expression without preleading string in python<p>I have a text file called my_file.txt that has the following content:</p> <pre...
72,995,497
useffect inside <outlet> component does not trigger<p>Parent component:</p> <pre><code> &lt;Main props... &gt; &lt;LinksArray /&gt; &lt;Outlet context={investorId}/&gt; &lt;/Main&gt; </code></pre> <p>outlet component</p> <pre><code>const NewBoards: React.FC = () =&gt; { let { boardId } = useParams(); ...
<p>From what I see from your comments you've seriously misunderstood what is happening between the <code>Outlet</code> and the nested <code>Route</code> components that are rendering their content, i.e. <code>element</code> prop, into it.</p> <p>Assuming <code>authorized</code> is true then the following route config:<...
useffect inside <outlet> component does not trigger
reactjs|react-hooks|react-router|use-effect
0
61
1
72,998,139
72,998,139
1
true
2022-07-15T14:23:53.280Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: useffect inside <outlet> component does not trigger<p>Parent component:</p> <pre><code> &lt;Main props... &gt; &lt;LinksArray /&gt; &lt;Outlet contex...
72,994,460
Python Playwright Download only certain files from a page<p>I'm attempting to download files from a page that's constructed almost entirely in JS. Here's the setup of the situation and what I've managed to accomplish.</p> <p>The page itself takes upward of 5 minutes to load. Once loaded, there are 45,135 links (JS butt...
<ol> <li><strong>First</strong> of all, <code>download.save_as</code> returns a coroutine which you need to await. Since there is no such thing as an &quot;<code>aysnc lambda</code>&quot;, and that coroutines can only be awaited inside async functions, you cannot use <code>lambda</code> here. You need to create a separ...
Python Playwright Download only certain files from a page
python-3.x|playwright-python
0
61
1
73,000,085
73,000,085
1
true
2022-07-15T13:05:28.050Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python Playwright Download only certain files from a page<p>I'm attempting to download files from a page that's constructed almost entirely in JS. Here's the...
73,003,521
How to select first N elements Gin-Gorm<p>I have a function that displays <code>Categories</code>, I want to use the <code>Preload</code> method to also display <code>Products</code> related to this category, but I don’t need all the products, but only 5 pieces, how can I fix the request? Function:</p> <pre><code>func ...
<p>You can try c<a href="https://gorm.io/docs/preload.html#Custom-Preloading-SQL" rel="nofollow noreferrer">ustom preloading</a> to modify how the <code>Preload</code> function is going to load <code>Products</code>. The code should look something like this:</p> <pre><code>func GetAllCategories(c *gin.Context) { Ca...
How to select first N elements Gin-Gorm
go|go-gorm|go-gin
2
61
1
73,005,369
73,005,369
1
true
2022-07-16T10:44:08.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to select first N elements Gin-Gorm<p>I have a function that displays <code>Categories</code>, I want to use the <code>Preload</code> method to also disp...
73,007,993
How do I make another series of buttons appear in SwiftUI<p>My code currently asks the user to pick between Morning and Evening, and depending on their answer, it'll present two more options. However, the options presented after Morning/Evening question aren't functional. I would like my code to extend the quiz so that...
<p>Additional answer requested by the poster.</p> <pre><code>import SwiftUI struct Content: View { @State var result = &quot;Start&quot; var body: some View { VStack { ZStack { switch result { case &quot;Start&quot;: HStack { Button { ...
How do I make another series of buttons appear in SwiftUI
swift|button|swiftui|uibutton
1
61
2
73,013,782
73,013,782
1
true
2022-07-16T22:19:04.873Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I make another series of buttons appear in SwiftUI<p>My code currently asks the user to pick between Morning and Evening, and depending on their answe...
73,027,057
How to keep a 30 day schedule script running with schedule<p>How do I close the terminal but keep a scheduled script running? It works for seconds, minutes with the terminal opened but terminates when the terminal is closed. Is there a way of working around it?</p> <pre class="lang-py prettyprint-override"><code>from s...
<p>Assuming you are on Linux, do <code>nohup python myscript.py &amp;</code>. The purpose of the <code>nohup</code> command is to make the script a daemon so it detaches from the terminal.</p>
How to keep a 30 day schedule script running with schedule
python|scheduled-tasks
1
61
1
73,027,209
73,027,209
1
true
2022-07-18T18:35:36.630Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to keep a 30 day schedule script running with schedule<p>How do I close the terminal but keep a scheduled script running? It works for seconds, minutes w...
73,026,237
Decoupling Pattern<p>After looking at major pattern designs, I can't seem to make up my mind around the best to one to decouple classes in a big hierarchy system, specially were it concerns on avoiding injecting a Parent property in EVERY object along the way.</p> <p>Some of the premises are:</p> <ol> <li>A child might...
<p>All these requirements remind me <a href="https://en.wikipedia.org/wiki/Graph_(abstract_data_type)" rel="nofollow noreferrer">graph data structure</a>:</p> <ul> <li>A child might me removed from one parent and added to another.</li> <li>Somewhere down the hierarchy, I need to access Parent of type X.</li> <li>As men...
Decoupling Pattern
c#|design-patterns
2
61
1
73,031,721
73,031,721
1
true
2022-07-18T17:22:31.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Decoupling Pattern<p>After looking at major pattern designs, I can't seem to make up my mind around the best to one to decouple classes in a big hierarchy sy...
73,027,770
Google Sheets API : Formatting select ranges differently within the same batchUpdate request array<p>I am struggling to format multiple sections of the sheet on the same request array using the batch update in the google sheets API.</p> <p>I've been able to update the formatting successfully, <strong>but only the last ...
<p>I believe your goal is as follows.</p> <ul> <li>You want to achieve the output situations of your 2 images by one API call.</li> </ul> <p>In this case, how about the following modification?</p> <p>When I saw your showing request body, it is as follows.</p> <pre><code>{ &quot;requests&quot;:[ { &quo...
Google Sheets API : Formatting select ranges differently within the same batchUpdate request array
python|python-3.x|google-api|google-sheets-api
1
61
1
73,032,405
73,032,405
1
true
2022-07-18T19:41:25.480Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Google Sheets API : Formatting select ranges differently within the same batchUpdate request array<p>I am struggling to format multiple sections of the sheet...
73,016,871
Auto import components Nuxtjs not working<p>I'm confused why it didn't work on my vue file when Im trying to auto import components in my view, the documentation says <a href="https://nuxtjs.org/docs/directory-structure/components/" rel="nofollow noreferrer">link</a> you just need to set the components into <code>true<...
<p>OP's issue was fixed by importing <code>TimelineItem</code> inside of <code>components.js</code>!</p> <p>Everything is working fine, as expected.</p>
Auto import components Nuxtjs not working
laravel|vue.js|components|nuxt.js
1
61
1
73,034,655
73,034,655
1
true
2022-07-18T02:55:58.443Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Auto import components Nuxtjs not working<p>I'm confused why it didn't work on my vue file when Im trying to auto import components in my view, the documenta...
72,788,510
Adding a view modifier inside .onChange<p>Is it possible to add a view modifier inside <code>.onChange</code>?</p> <p>Simplified example:</p> <pre class="lang-swift prettyprint-override"><code>content .onChange(of: publishedValue) { content.foregroundColor(.red) } </code></pre> <p>I have a theme that when chang...
<p>First of all, thanks for the help. Neither of the answers helped in my situation, since I couldn't get the modifier to update with the variable change. But with some Googling and trying out different solutions I figured out a working solution for updating the status bar colors.</p> <p>I needed to update the style va...
Adding a view modifier inside .onChange
swift|swiftui
0
61
3
73,036,184
73,036,184
1
true
2022-06-28T14:39:31.697Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Adding a view modifier inside .onChange<p>Is it possible to add a view modifier inside <code>.onChange</code>?</p> <p>Simplified example:</p> <pre class="lan...
72,992,700
Comparing data of any type without overloading<p>let's start with an example:</p> <pre><code> type Collection_t is table of varchar2(3); Collection_v Collection_t := Collection_t('qwe', 'asd', 'yxc', 'rtz', 'fgh', 'vbn'); single_var varchar2(3) := 'yxc'; procedure get_position(Single_Value varchar2, ...
<p>From my limited understanding, you still have to encode/decode <code>anydata</code> into basic (or user-defined) PL/SQL types to do anything meaningful like comparing values, so you might not gain the benefits of dynamic languages like Python.</p> <p>Here is an example, passing <code>anydata</code> as a parameter. Y...
Comparing data of any type without overloading
oracle|plsql
0
61
1
73,056,293
73,056,293
1
true
2022-07-15T10:37:10.237Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Comparing data of any type without overloading<p>let's start with an example:</p> <pre><code> type Collection_t is table of varchar2(3); Collection_v ...
72,947,918
VSCode tmLanguage.json issue: how to prevent nested block comment?<p>I want to support a customized language which does not support nested block comment, i.e., the following code should be considered as comment:</p> <pre class="lang-c prettyprint-override"><code>/* /* */ </code></pre> <p>The tmLanguage.json for my VSC...
<p>After some researching in <a href="https://macromates.com/manual/en/language_grammars" rel="nofollow noreferrer">TextMate</a>, the tmLanguage.json defaultly does not support nested pattern. I incorrectly used:</p> <pre class="lang-json prettyprint-override"><code>&quot;block_comment&quot;: { &quot;comment&quot;:...
VSCode tmLanguage.json issue: how to prevent nested block comment?
regex|visual-studio-code|comments
1
61
1
72,948,040
72,948,040
1
true
2022-07-12T06:30:50.310Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VSCode tmLanguage.json issue: how to prevent nested block comment?<p>I want to support a customized language which does not support nested block comment, i.e...
72,924,360
Creating Coin Flip using Vanilla Javascript and decrement and this<p>I need to make a coin flip 20x and display the coin, and the results x times each. I am trying to use decrement to determine the coin flip. And then need to display the flip x number of times. I am running into an issue of how to write it using this....
<p>You can also approach it functionally. This will help you focus on one problem at a time:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>// Store the coin flip state as a b...
Creating Coin Flip using Vanilla Javascript and decrement and this
javascript|this|decrement
0
61
2
72,924,650
72,924,650
1
true
2022-07-09T20:18:42.613Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Creating Coin Flip using Vanilla Javascript and decrement and this<p>I need to make a coin flip 20x and display the coin, and the results x times each. I am ...
73,012,338
selectKBest with chi2 throws ValueError: could not convert string to float: 'Self_emp_not_inc' for categorical columns in classification problem<p>I am trying to select the best categorical features for a classification problem with <code>chi2</code> and <code>selectKBest</code>. Here, I've sorted out the categorical c...
<p>Encode features would do the job. For example</p> <pre class="lang-py prettyprint-override"><code>from sklearn.preprocessing import OneHotEncoder from sklearn.feature_selection import chi2, SelectKBest from sklearn.pipeline import make_pipeline X, y = df_cat_kbest.iloc[:, :-1], df_cat_kbest.iloc[:, -1] selector = ...
selectKBest with chi2 throws ValueError: could not convert string to float: 'Self_emp_not_inc' for categorical columns in classification problem
python|pandas|scikit-learn
0
61
1
73,012,574
73,012,574
1
true
2022-07-17T13:50:47.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: selectKBest with chi2 throws ValueError: could not convert string to float: 'Self_emp_not_inc' for categorical columns in classification problem<p>I am tryin...
72,801,906
Model training with tf.data.Dataset and NumPy arrays yields different results<p>I use the Keras model training API and observed differences when training the model with NumPy arrays (<code>x_train</code> and <code>y_train</code>) and with <code>tf.data.Dataset.from_tensor_slices((x_train, y_train))</code>. A minimal wo...
<p>The behavior is due to the default parameter <code>shuffle=True</code> in <code>model.fit(*)</code> and not a bug. According to the <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model#fit" rel="nofollow noreferrer">docs</a> regarding <code>shuffle</code>:</p> <blockquote> <p>Boolean (whether to shuffl...
Model training with tf.data.Dataset and NumPy arrays yields different results
python|tensorflow|machine-learning|keras
2
61
1
72,803,601
72,803,601
1
true
2022-06-29T13:04:38.157Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Model training with tf.data.Dataset and NumPy arrays yields different results<p>I use the Keras model training API and observed differences when training the...
72,877,834
Updating grouped data based on date<p>I have a dataframe that looks like the following:</p> <pre><code>df = pd.DataFrame({'ID': ['1', '1', '1', '2', '2', '2'], 'ID2': ['25', '29', '56', '562', '92', '170'], 'Origin': ['2005', '2010', '2020', '1995', '1999', '2007'], ...
<p>I think you can test if shifted values per groups by <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.groupby.DataFrameGroupBy.shift.html" rel="nofollow noreferrer"><code>DataFrameGroupBy.shift</code></a> are <code>Done</code> and also if same row has <code>Unfinished</code> - both cond...
Updating grouped data based on date
python|pandas|dataframe|numpy
2
61
4
72,878,350
72,878,350
1
true
2022-07-06T04:03:37.197Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Updating grouped data based on date<p>I have a dataframe that looks like the following:</p> <pre><code>df = pd.DataFrame({'ID': ['1', '1', '1', '2', '2', '2'...
72,867,388
How to select from a checkbox using selenium java<p>I have this website: <a href="https://magiceden.io/marketplace/primates" rel="nofollow noreferrer">https://magiceden.io/marketplace/primates</a>. On the website there's a default option of &quot;Recently listed&quot;. How can I use java selenium to change that from th...
<p><strong>This is quite simple and can be done simply using the native driver properties without over complicating it with using Javascript, Actions or Scroll.</strong></p> <p>You are facing a problem because the element you are trying to locate is called an &quot;<em>svg element</em>&quot; so it will not support stan...
How to select from a checkbox using selenium java
java|selenium|selenium-chromedriver
0
61
2
72,873,803
72,873,803
1
true
2022-07-05T09:53:27.913Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to select from a checkbox using selenium java<p>I have this website: <a href="https://magiceden.io/marketplace/primates" rel="nofollow noreferrer">https:...
72,902,926
How to adapt content to a fixed bottom container?<p>I have a container with position fixed at the bottom of the page, and I would like that the content above it (a long paragraph in this case) will be visible to its end when scrolling until the bottom.</p> <p>I created a working example of this on Codepen: <a href="htt...
<p>You can using <code>min-height: 100vh;</code> instead of <code>margin-bottom: 500px;</code> on your <strong>.content</strong> class. Then change <code>position:fixed</code> to <code>position:sticky</code> in <strong>.bottom-content</strong> and add a global CSS reset class.</p> <pre class="lang-css prettyprint-overr...
How to adapt content to a fixed bottom container?
html|css
2
61
2
72,904,548
72,904,548
1
true
2022-07-07T18:56:32.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to adapt content to a fixed bottom container?<p>I have a container with position fixed at the bottom of the page, and I would like that the content above...
72,819,131
Best way to clear a each list in a nested list in Python?<p>Let's say I have a nested list like this</p> <pre><code>list_1 = [1, 2, 3] list_2 = [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;] li = [list_1, list_2] </code></pre> <p>How do I clear each item in <code>li</code> so that <code>list_1</code> and <code>list_2</c...
<p>You can use the <code>list.clear</code> method to empty the lists in-place and have that effect the original variables. By only assigning empty lists in their place, the original variables are not modified since you are creating new lists:</p> <pre><code>for p in parameters: p.clear() </code></pre> <p>which is e...
Best way to clear a each list in a nested list in Python?
python|list
0
61
1
72,819,170
72,819,170
1
true
2022-06-30T16:27:44.433Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Best way to clear a each list in a nested list in Python?<p>Let's say I have a nested list like this</p> <pre><code>list_1 = [1, 2, 3] list_2 = [&quot;a&quot...
72,937,835
How to create a column that is dependent on the average of previous observed events?<p>In the data below we observe a virtual GDP growth of a certain country over time. My aim is to create a variable with three categories: 0= no crisis, 1= crisis, 2= severe crisis. That would be identify economic crises as years where ...
<p>You could use <code>lag</code>, <code>rowwise</code>*, and <code>mutate</code> within <code>dplyr</code>:</p> <pre class="lang-r prettyprint-override"><code>library(dplyr) df |&gt; mutate(gdp3_growth_lag1 = lag(gdp_growth, 1), gdp3_growth_lag2 = lag(gdp_growth, 2), gdp3_growth_lag3 = lag(gdp_gro...
How to create a column that is dependent on the average of previous observed events?
r|dplyr
2
61
3
72,938,160
72,938,160
1
true
2022-07-11T11:27:27.990Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create a column that is dependent on the average of previous observed events?<p>In the data below we observe a virtual GDP growth of a certain country...
72,863,588
Initialize method pointer inside struct<p>I am trying to write a NES emulator.</p> <p>I have created a lookup table that contains all the instructions for the 6502. Each Instruction contains the name of the instruction, a pointer to the method that is the instruction, a pointer to the address mode method, and how many ...
<p>I assume this is your 'minimal' example, as your code doesn't reproduce your issue directly:</p> <pre class="lang-rust prettyprint-override"><code>struct Bus { ram: [i32; 1024], } pub struct Nes6502 { bus: Bus, /// Accumulator Register a: u8, /// X Register x: u8, /// Y Register y: ...
Initialize method pointer inside struct
pointers|rust|emulation
0
61
1
72,866,177
72,866,177
1
true
2022-07-05T03:02:46.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Initialize method pointer inside struct<p>I am trying to write a NES emulator.</p> <p>I have created a lookup table that contains all the instructions for th...
72,938,610
PHP header downloading unreadable zip file in Android<p>My php script is converting a PDF file into a zip file containing images for each page of the PDF.</p> <p>After loading the zip with images I'm transferring the zip to the headers like below.</p> <pre><code>ob_start(); header('Content-Transfer-Encoding: binary');...
<p>The issue appears to be caused by order of operations processing and including the HTML in the response to the client.</p> <p>To circumvent the issues, I recommend using a separate script file for the <code>POST</code> request handler, as opposed to including it procedurally in the same view script. Otherwise, wrap ...
PHP header downloading unreadable zip file in Android
php|android|html|download
0
61
1
72,955,305
72,955,305
1
true
2022-07-11T12:29:03.070Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: PHP header downloading unreadable zip file in Android<p>My php script is converting a PDF file into a zip file containing images for each page of the PDF.</p...
72,914,323
IF(AND) formula where multiple criteria need to be a match is not working<p>I am trying to get a TRUE/FALSE value when 4 criteria match. On the Sheet3 tab, I would like to have either TRUE or FALSE under col C if the following are a match: Sheet3!F2 = ActionPlan!B2:B6; Sheet3!F1 = ActionPlan!A2:A6; Sheet3!B2 = ActionPl...
<p>If you change the empty values inside the &quot;Action Plan&quot; tab to <code>Yes</code>. You can use the following formulas:</p> <p><a href="https://i.stack.imgur.com/gWHUT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gWHUT.png" alt="enter image description here" /></a></p> <p><em>Note: I add...
IF(AND) formula where multiple criteria need to be a match is not working
if-statement|google-sheets|match|vlookup
1
61
1
72,915,905
72,915,905
1
true
2022-07-08T16:24:35.873Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: IF(AND) formula where multiple criteria need to be a match is not working<p>I am trying to get a TRUE/FALSE value when 4 criteria match. On the Sheet3 tab, I...
72,974,989
How to constraint a view min width equal to height in ConstraintLayout?<p>I have a TextView need to set the min width equal to the height, that means the view is square when the width &lt;= height, and rectangle when the width &gt; height.</p> <p>now I hardcode the min width via <strong>app:layout_constraintWidth_min=&...
<p>Try this code:</p> <pre><code>&lt;androidx.appcompat.widget.AppCompatTextView android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; app:layout_constrainedHeight=&quot;true&quot; app:layout_constraintHeight_max=&quot;20dp&quot; app:layout_constraintDimensionR...
How to constraint a view min width equal to height in ConstraintLayout?
android|android-constraintlayout
0
61
2
72,975,792
72,975,792
1
true
2022-07-14T03:50:21.823Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to constraint a view min width equal to height in ConstraintLayout?<p>I have a TextView need to set the min width equal to the height, that means the vie...
73,026,187
How to reuse static files across multiple APIRouters?<p>If I've got the following static file: <code>static/example.png</code> and I mount my staticfiles like so:</p> <pre><code>app.mount('/static', StaticFiles(directory='static'), name='static') </code></pre> <p>I can now use that file in my HTML as <code>static/examp...
<p><strong>UPDATE</strong> You can reference the absolute path by prefixing <code>static</code> in your html with a <code>/</code></p> <p>Below is a fully working example of this:</p> <pre><code>from fastapi import APIRouter, FastAPI, Request from fastapi.responses import HTMLResponse from fastapi.staticfiles import St...
How to reuse static files across multiple APIRouters?
python|fastapi
0
61
1
73,027,824
73,027,824
1
true
2022-07-18T17:18:41.780Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to reuse static files across multiple APIRouters?<p>If I've got the following static file: <code>static/example.png</code> and I mount my staticfiles lik...
72,802,794
List of objects, add properties together based of another property<p>I have a List that contains 2 properties per object. The properties are as follows:</p> <pre><code>string Project; double Value; </code></pre> <p>So in any given case we might have a List of 5 objects, where 3 of them have a Project property called &q...
<p>I think your initial thoughts regarding making use of a dictionary are good. Your use of <code>.GroupBy()</code> is a first step to create that dictionary, where the project name is the dictionary <code>Key</code> and the sum of values for that project is the dictionary <code>Value</code>.</p> <p>You already seem to...
List of objects, add properties together based of another property
c#|list|sum
0
61
3
72,803,577
72,803,577
1
true
2022-06-29T14:07:30.373Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: List of objects, add properties together based of another property<p>I have a List that contains 2 properties per object. The properties are as follows:</p> ...
72,870,622
CUSTOMER_REGISTER_EVENT subscribe not working<p>they not call the subscribe Event &quot;CUSTOMER_REGISTER_EVENT&quot;. I dont know what i make wrong. PHP:</p> <pre><code>public static function getSubscribedEvents(): array { return [ CustomerEvents::CUSTOMER_REGISTER_EVENT =&gt; ...
<p>Does this work for you ?</p> <pre class="lang-php prettyprint-override"><code> public static function getSubscribedEvents() { return [ GuestCustomerRegisterEvent::class =&gt; 'onRegisterGuest', CustomerRegisterEvent::class =&gt; 'onRegister' ]; } public functi...
CUSTOMER_REGISTER_EVENT subscribe not working
shopware|shopware6
0
61
4
72,872,981
72,872,981
1
true
2022-07-05T13:52:59.250Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CUSTOMER_REGISTER_EVENT subscribe not working<p>they not call the subscribe Event &quot;CUSTOMER_REGISTER_EVENT&quot;. I dont know what i make wrong. PHP:</p...
72,862,624
Subdivide values in a tensor<p>I have a PyTorch tensor that contains the labels of some samples.</p> <p>I want to split each label into <code>n_groups</code> groups, introducing new virtual labels.</p> <p>For example, for the labels:</p> <pre class="lang-py prettyprint-override"><code>labels = torch.as_tensor([0, 0, 0,...
<p>A variation of OP's approach can be vectorized with a grouped cumcount <a href="https://stackoverflow.com/a/40605209/14277722">(<code>numpy</code> implementation by @divakar)</a>. All tests pass, but the output is slightly different since <code>argsort</code> has no 'stable' option in <code>pytorch</code>, AFAIK.</p...
Subdivide values in a tensor
python|pytorch|vectorization|tensor
1
61
1
72,867,311
72,867,311
1
true
2022-07-04T22:54:11.300Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Subdivide values in a tensor<p>I have a PyTorch tensor that contains the labels of some samples.</p> <p>I want to split each label into <code>n_groups</code>...
72,798,491
How to run methods in certain time windows<p>I have a microservice that will receive a message, something like this:</p> <pre><code>[&quot;00:12&quot;, &quot;12:20&quot;, &quot;15:40&quot;] </code></pre> <p>Are there any out-of-the-box solutions to allow methods to run at a given time each day? Using cron from Spring d...
<p>Spring has the <code>@Scheduled</code> annotation. There a several ways to configure it, one way is to configure it like unix cron job.</p> <p>For example like this:</p> <pre><code>@Scheduled(cron = &quot;0 15 10 15 * ?&quot;) public void scheduleTaskUsingCronExpression() { long now = System.currentTimeMillis(...
How to run methods in certain time windows
java|spring|spring-boot|cron|quartz
1
61
2
72,798,601
72,798,601
1
true
2022-06-29T08:50:44.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to run methods in certain time windows<p>I have a microservice that will receive a message, something like this:</p> <pre><code>[&quot;00:12&quot;, &quot...
72,785,190
Populate hierarchy in Dictionary<p>I need to build a hierarchy and I am using a dictionary. I read strings randomly when I am trying to build this and they have this format:</p> <pre><code>address.city.streetname.housenumber address.areacode address.city.streetname.coAddress </code></pre> <p>I have a problem figuring...
<p>You have a tree structure made up of <code>JsonElement</code> nodes. This structure is the only data structure you need. Let's redefine <code>JsonElement</code>:</p> <pre class="lang-cs prettyprint-override"><code>public class JsonElement { public string Parent { get; set; } public string Name { get; set; } ...
Populate hierarchy in Dictionary
c#|dictionary
0
61
1
72,785,842
72,785,842
1
true
2022-06-28T10:56:36.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Populate hierarchy in Dictionary<p>I need to build a hierarchy and I am using a dictionary. I read strings randomly when I am trying to build this and they h...
72,782,556
Disambiguating a variable name in a function when a column with the same name as the variable exists (data.table)<p>I have a function with a variable named <code>source</code>. The function works properly, but if the data frame on which the function is applied has a column also named <code>source</code>, it doesn't wor...
<p>With <code>data.table</code> development version (1.14.3), this can be done with the new <code>env</code> argument, see <a href="https://rdatatable.gitlab.io/data.table/articles/datatable-programming.html" rel="nofollow noreferrer">programming on data.table</a>:</p> <pre><code>data.table::update.dev.pkg() source = &...
Disambiguating a variable name in a function when a column with the same name as the variable exists (data.table)
r|function|dplyr|data.table|nse
0
61
1
72,783,281
72,783,281
1
true
2022-06-28T07:47:39.153Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Disambiguating a variable name in a function when a column with the same name as the variable exists (data.table)<p>I have a function with a variable named <...
72,779,612
How to convert a soup to a Dataframe<p>I am new to the beautiful soup. I am working to scrape some excel files from a source. URL to source: <a href="https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&amp;aoi=county&amp;date=" rel="nofollow noreferrer">https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mod...
<p>It sends file <code>csv</code> so you don't need <code>BeautifulSoup</code></p> <p>You can use <code>io</code> with <code>pandas.read_csv()</code></p> <pre><code>import requests import pandas as pd import io url = 'https://droughtmonitor.unl.edu/DmData/GISData.aspx/?mode=table&amp;aoi=county&amp;date=2022-06-21' r...
How to convert a soup to a Dataframe
python|json|beautifulsoup
0
61
1
72,780,471
72,780,471
1
true
2022-06-28T00:44:36.677Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to convert a soup to a Dataframe<p>I am new to the beautiful soup. I am working to scrape some excel files from a source. URL to source: <a href="https:/...
72,838,497
Getting count of total documents when using aggregation along with skip and limit<p>How can I get the total count of documents when using the aggregation along with <code>limit</code> and <code>skip</code> like in the following query?</p> <pre><code> db.Vote.aggregate({ $match: { tid: &quot;e6d38e1ec...
<p>One option is using <code>$facet</code>, but the disadvantage is that it will group all your documents to one document:</p> <pre><code>db.Vote.aggregate( {$match: {tid: &quot;e6d38e1ecd&quot;, &quot;comment.topic&quot;: {$exists: 1}}}, {$group: {_id: {topic: &quot;$comment.topic&quot;, text_sentiment: &quot;$co...
Getting count of total documents when using aggregation along with skip and limit
javascript|mongodb|mongodb-query|aggregation-framework|aggregation
1
61
1
72,838,622
72,838,622
1
true
2022-07-02T10:55:37.267Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting count of total documents when using aggregation along with skip and limit<p>How can I get the total count of documents when using the aggregation alo...
72,803,979
Javascript: How many arrays of 7 elements can i get out of an array of 49 elements<p>I am given an array with 49 My task is to select unique groups of 7 elements and also find out the number of possible outputs.</p> <p>Eg. [A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,...
<p>Below you will find a working snippet that will generate all unique draws from a given array. Starting point is the initial draw vector <code>v</code>. This vector must contain exactly the number of array elements you want to have in each draw and the numbers must be in ascending order. Based on this initial vector ...
Javascript: How many arrays of 7 elements can i get out of an array of 49 elements
javascript|arrays
0
61
1
72,812,856
72,812,856
1
true
2022-06-29T15:22:54.173Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript: How many arrays of 7 elements can i get out of an array of 49 elements<p>I am given an array with 49 My task is to select unique groups of 7 elem...
72,897,083
Is there a more efficient way to format this list<p>I have a list of coordinates, but I want to format them so they form a grid. Right now, for every element of the list, I'm checking what its value is and then formatting it. Is there a smarter, more efficient way to do this?</p> <pre><code>def convertDataToCoords(xCoo...
<p>You can replace <code>if-else</code> with the list of min, max and expected values:</p> <pre><code>X = [(0, 150, 130), (150, 250, 230), (250, 350, 330)] Y = [(0, 175, 150), (175, 275, 230), (275, 350, 310)] def convert(coords, items): result = [] for coord in coords: for min_, ...
Is there a more efficient way to format this list
python
0
61
2
72,897,364
72,897,364
1
true
2022-07-07T11:33:35.643Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there a more efficient way to format this list<p>I have a list of coordinates, but I want to format them so they form a grid. Right now, for every element...
73,011,413
Problem with roc curve in scikit - DecisionTreeClassifier() , ExtraTreeClassifier()<p>I have a question to you (maybe i don't understand something). My target value is binary (Yes/No). I make a prediction using scikit learn for few classiefiers, and plot the roc curve. Everything look good except for roc curves for Dec...
<p>How many examples are included in your test data? Possibly only three? What the curve looks like will depend also on the number of samples that you used for testing. Using more samples will produce a more similar output to your expectations.</p> <p>For clarification: The curve is produced by increasing a cut-off thr...
Problem with roc curve in scikit - DecisionTreeClassifier() , ExtraTreeClassifier()
python|scikit-learn
1
61
1
73,011,538
73,011,538
1
true
2022-07-17T11:35:11.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem with roc curve in scikit - DecisionTreeClassifier() , ExtraTreeClassifier()<p>I have a question to you (maybe i don't understand something). My targe...
72,808,681
Passing JS variable value to PHP variable to update database<p>If you want to see the part where I tried AJAX, go look down below. It completely messed up the page and I'm stuck on how to do this. I've got some code here:</p> <pre><code>$id = $_SESSION[&quot;id&quot;]; $sql = &quot;SELECT riskcoin FROM klanten WHERE id...
<p>PHP and Javascript execute in different contexts. PHP on the server, Javascript on the client (browser). Keep your PHP code and Javascript separate. Since PHP executes first on the server, you can embed PHP output into your HTML/Javascript/CSS—BEFORE—it is sent to the browser.</p> <p>One problem you have with your c...
Passing JS variable value to PHP variable to update database
javascript|php|jquery
1
61
2
72,809,761
72,809,761
1
true
2022-06-29T22:55:44.043Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing JS variable value to PHP variable to update database<p>If you want to see the part where I tried AJAX, go look down below. It completely messed up th...
72,783,692
Replace strings by matching to a file<p>I have two huge files (with more than 1000 rows).</p> <p>File-1</p> <pre><code> head File-1 1_10 PL14 1_13 GH13 13_12 GH20 13_137 GH10 13_35 GT19 14_128 GH36 14_131 GH42 14_65 GH109 15_28 GT30 15_30 GH13 16_3 CE1 </code></pre> <p>File-2</p> <pre><code>head F...
<pre><code>awk ' NR==FNR{ # process File1 a[$1]=$2; # map File1 columns next # next line } { # process File2 NF-- # delete last column } FNR...
Replace strings by matching to a file
awk
0
61
1
72,787,758
72,787,758
1
true
2022-06-28T09:09:56.100Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Replace strings by matching to a file<p>I have two huge files (with more than 1000 rows).</p> <p>File-1</p> <pre><code> head File-1 1_10 PL14 1_13 GH13...
72,775,911
Javascript Improve collapsing element<p>I have created this toggle script which works well but I need to improve it so that <em>onclick</em>, any previously collapsed (i.e. open) subcats would simultaneously close and only the one clicked should collapse (i.e. open).</p> <p><div class="snippet" data-lang="js" data-hide...
<p>First, loop through the open elements and remove the class and set max height to null. Then do your normal code.</p> <p>I also changed your event Listener so you only have one instead of one for each element.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div cl...
Javascript Improve collapsing element
javascript|html|css
0
61
3
72,776,214
72,776,214
1
true
2022-06-27T17:08:21.320Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Javascript Improve collapsing element<p>I have created this toggle script which works well but I need to improve it so that <em>onclick</em>, any previously ...
72,885,605
How do I unit test a custom CacheInterceptor from NestJS?<p>I wrote an own <code>CacheInterceptor</code> to cache POST requests as well and take the Accept-Language header into account. Of course I want to unit test it, but I don't know how to properly do so, since the <code>trackBy</code> method needs an <code>Executi...
<p>Please bear in mind that the following example is testing the interceptor in isolation. Some tweaks may be needed for your use case, but the overall approach should be valid.</p> <ol> <li>I would inject the cache and reflector dependencies using the constructor:</li> </ol> <pre class="lang-js prettyprint-override"><...
How do I unit test a custom CacheInterceptor from NestJS?
unit-testing|testing|nestjs
2
61
1
72,888,476
72,888,476
1
true
2022-07-06T14:47:08.500Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I unit test a custom CacheInterceptor from NestJS?<p>I wrote an own <code>CacheInterceptor</code> to cache POST requests as well and take the Accept-L...
72,819,320
How to make a image dynamically change to text<p>I am making an online game using Phaser and I need to make buttons with text on them for it that can change based on the text because the text can be different each time. I tried checking the API document but when I put in the get size function to try to get the bounds o...
<p>You could use the <code>Phaser.GameObjects.Text</code> and it's <code>displayWidth</code> and / or <code>displayHeight</code> properties, together with the global <code>Phaser.Display.Align.In.Center</code> function.<br /> Maybe this works also for your UseCase.</p> <p><em><strong>Basically:</strong></em></p> <ol> <...
How to make a image dynamically change to text
html|phaser-framework
2
61
1
72,820,079
72,820,079
1
true
2022-06-30T16:44:05.693Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to make a image dynamically change to text<p>I am making an online game using Phaser and I need to make buttons with text on them for it that can change ...
72,400,763
Python How to use if else in next iterator in one line to find the string after a particular string in a list<p>I have tried so many times but getting failed got syntax error</p> <p>I want to do</p> <pre><code>next(x for x in ee if(re.findall(r&quot;\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b&quot;,x))) </code></pre> <p>Her...
<p>You can use this code to collect the IPs for the items specified in the input dictionary:</p> <pre><code>import re # Initial list ee = ['aa', 'kk', 'cv', '10.0.0.1', 'bb', '192.3.45.11', 'cc', '198.0.0.1', 'dd'] # Elements for which to collect the ip ips = {'kk': None, 'cc': None, } for element in e...
Python How to use if else in next iterator in one line to find the string after a particular string in a list
python
0
61
2
72,401,464
72,401,464
1
true
2022-05-27T05:18:10.077Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Python How to use if else in next iterator in one line to find the string after a particular string in a list<p>I have tried so many times but getting failed...
72,400,954
Condition Overlaps in Typescript<p>Lets say I have some simple logic like this:</p> <pre><code>let bool = false const seven = 7 const arr = [1,2,3,4,5,6,7] arr.forEach(element =&gt; { if (element === seven) { bool = true } }); </code></pre> <p>Now I wan't to call a function if &quot;bool&quot; has...
<p>I did not know that the Typescript compiler would complain on something like this, but again it's a strange way to have such a condition statement since:</p> <pre><code>if (bool === true) </code></pre> <p>is the same as:</p> <pre><code>if (bool) </code></pre> <p>But yeah you can either:</p> <ol> <li>Write the condit...
Condition Overlaps in Typescript
typescript|if-statement|types|conditional-statements|overlap
2
61
1
72,401,496
72,401,496
1
true
2022-05-27T05:45:39.673Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Condition Overlaps in Typescript<p>Lets say I have some simple logic like this:</p> <pre><code>let bool = false const seven = 7 const arr = [1,2,3,4,5,6,7] ...
72,356,307
Laser bouncing inside arbitrary shape<p>I've been mulling this problem over in my head for a while. Given an arbitrary closed 2d polygon, which is well defined, consisting of lines and curves (perhaps Bezier curves for consistency). Given a starting point and direction within the polygon. How would you go about efficie...
<p>This is a 2D ray-casting problem.</p> <p>Given a starting point and a direction, you compute the implicit equation of the ray <code>s(x, y):= ax + by + c = 0</code>, which is a straight line, and you want to find the first intersection with the shape outline.</p> <p>In the case of a polygonal shape, an edge can only...
Laser bouncing inside arbitrary shape
geometry|simulation|computational-geometry
1
61
3
72,360,507
72,360,507
1
true
2022-05-24T01:25:19.503Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Laser bouncing inside arbitrary shape<p>I've been mulling this problem over in my head for a while. Given an arbitrary closed 2d polygon, which is well defin...
72,372,778
Multiplying two 3d tensors with different shapes (Tensorflow)<p>In TensorFlow, If I have two 3 dimensional tensors, one of dimension (100, 9, 135) and the other has dimension (100, 29, 135):</p> <p>x1: Tensor(shape=(100, 9, 135), dtype=float64)</p> <p>x2: Tensor(shape=(100, 29, 135), dtype=float64)</p> <p>I need to mul...
<p>I am not sure what output shape you expect, but you can try experimenting with <code>tf.einsum</code> to do matrix multiplication:</p> <pre><code>import tensorflow as tf t1 = tf.random.normal((2, 9, 35)) t2 = tf.random.normal((2, 29, 35)) e = tf.einsum('bij,bkj-&gt;bik', t1, t2) # or e = tf.einsum('...ij,...kj-&g...
Multiplying two 3d tensors with different shapes (Tensorflow)
python|tensorflow|tensor
1
61
1
72,372,863
72,372,863
1
true
2022-05-25T06:21:28.753Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Multiplying two 3d tensors with different shapes (Tensorflow)<p>In TensorFlow, If I have two 3 dimensional tensors, one of dimension (100, 9, 135) and the ot...
72,389,332
How to animate TextView width from Visible to Gone state?<p>I want to animate <code>TextView</code> width when I change visibility of <code>TextView</code>. I don't wanna achieve generic &quot;fade in/out&quot; effect, but I wanna collapse <code>TextView</code> from sides to 0 width.</p> <p>Here are my functions:</p> <...
<p>I assume that you need the <em>TextView</em> to appear as if erased from both ends equally. Here is a technique that will do that:</p> <pre><code>private lateinit var buttonText: TextView private var viewWidth = 0 fun fadeOutTextViewSize() { with(buttonText) { // Enable scrolling for the view since we w...
How to animate TextView width from Visible to Gone state?
android|textview|android-animation
1
61
1
72,393,354
72,393,354
1
true
2022-05-26T09:03:06.013Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to animate TextView width from Visible to Gone state?<p>I want to animate <code>TextView</code> width when I change visibility of <code>TextView</code>. ...
72,293,464
Header Height Not Expanding to the Size of Child Elements<p>My header element has no height. I have a navigation bar, like so:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><cod...
<p>When an element has a <code>position</code> value other than <code>static</code> (default), it is out of the normal flow of the layout. Meaning it's behavior and the behavior of it's ancestors, descendants, and siblings are very different. See this article on <a href="https://medium.com/@jacobgreenaway12/taming-the-...
Header Height Not Expanding to the Size of Child Elements
css
1
61
1
72,293,565
72,293,565
1
true
2022-05-18T17:20:05.737Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Header Height Not Expanding to the Size of Child Elements<p>My header element has no height. I have a navigation bar, like so:</p> <p><div class="snippet" da...
72,355,592
which systemd TYPE of service to use at machine start i some code has to stay forever<p>at the system start, using a systemd service, I want to lauch a bash to run forever, executing an action every 5 seconds.</p> <p>Its code is simple (do_every_5_segons.sh)</p> <pre><code> while true do {read some JSON ...
<p>Do not use <code>nohup</code>. Do not use <code>&amp;</code>. Do not wrap your script in another script. Doing either of these first two things stops systemd from detecting when your program crashed and restarting it, and the third complicates signal handling.</p> <p><strong>Do</strong> use <code>Restart=always</cod...
which systemd TYPE of service to use at machine start i some code has to stay forever
bash|systemd
0
61
1
72,355,658
72,355,658
1
true
2022-05-23T22:58:40.263Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: which systemd TYPE of service to use at machine start i some code has to stay forever<p>at the system start, using a systemd service, I want to lauch a bash ...
72,243,273
Request for JavaScript works, but not for GoogleScreen. What's the difference?<p>Please, help. I can't find the error and I don't understand why the request is not working. It seems to me that it's just Google's IP blocked by the site I'm making a request to. The same request for JavaScript works.</p> <pre><code>functi...
<p>In your Google Apps Script, the data is sent as form by default. When I saw your Javascript, it seems that the data is required to be sent as data with <code>application/json</code>. So you'll need to modify the script as follows.</p> <h3>From:</h3> <pre><code>var requestOptions = { 'method': 'POST', 'headers': ...
Request for JavaScript works, but not for GoogleScreen. What's the difference?
javascript|google-apps-script|http-status-code-403|urlfetch
0
61
1
72,244,569
72,244,569
1
true
2022-05-14T19:24:23.273Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Request for JavaScript works, but not for GoogleScreen. What's the difference?<p>Please, help. I can't find the error and I don't understand why the request ...
72,318,336
C# Arrays in Classes<p>With these classes. How would I add a new widget with a few components? The Component cannot be a List&lt; Component&gt; as the real world models are from a web service that has that structure. I've done this using a List but when I try and add the 'Widget' class to the models further up the chai...
<p>If you want to stick to existing <code>Widget</code> implementation, you can create a <code>List&lt;Part&gt;</code> and then convert it into the array:</p> <pre><code>using System.Linq; ... List&lt;Part&gt; list = new List&lt;Part&gt;(); foreach(var c in SomeArray) { Part part = new Part() { Id = c.Id, ...
C# Arrays in Classes
c#|arrays|list|class
0
61
1
72,318,412
72,318,412
1
true
2022-05-20T11:38:54.040Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# Arrays in Classes<p>With these classes. How would I add a new widget with a few components? The Component cannot be a List&lt; Component&gt; as the real w...
72,287,890
Speed up a for-loop converting many JSON files to a Pandas dataframe<p>I have the following function:</p> <pre class="lang-py prettyprint-override"><code>def json_to_pickle(json_path=REVIEWS_JSON_DIR, pickle_path=REVIEWS_PICKLE_DIR, force_update=False): '''Create a pickled data...
<p>Instead of loading each file and appending it to an ever bigger temporary dataframe, load all files in dataframes and concatenate them in a single operation.</p> <p>The current code loads the N dataframes that correspond to the files <em>and</em> creates N-1 ever bigger dataframes with the exact same data.</p> <p>I ...
Speed up a for-loop converting many JSON files to a Pandas dataframe
python|pandas|dataframe|performance|for-loop
0
61
1
72,288,034
72,288,034
1
true
2022-05-18T10:56:15.327Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Speed up a for-loop converting many JSON files to a Pandas dataframe<p>I have the following function:</p> <pre class="lang-py prettyprint-override"><code>def...
72,244,950
Insert NA values in Mysql table RMySQL<p>I am trying to insert a data frame row in a mysql table, but I have NA values in character and numeric columns. I'm getting this error: Error in .local(conn, statement, ...) : could not run statement: Unknown column 'NA' in 'field list'</p> <p>This is my query:</p> <pre><code>sq...
<p>Three ways to look at this:</p> <ol> <li><p>Don't <code>sprintf</code>/<code>paste</code> <em>data</em> into a query string. In addition to security concerns about <em>malicious</em> <a href="https://en.wikipedia.org/wiki/SQL_injection" rel="nofollow noreferrer">SQL injection</a> (e.g., XKCD's <a href="https://xkcd....
Insert NA values in Mysql table RMySQL
mysql|sql|r|rmysql|r-dbi
0
61
2
72,245,041
72,245,041
1
true
2022-05-15T01:26:18.307Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Insert NA values in Mysql table RMySQL<p>I am trying to insert a data frame row in a mysql table, but I have NA values in character and numeric columns. I'm ...
72,289,244
How do I find the dtype of the content in a list using Python?<p>My code consists of the following workflow:</p> <pre><code>if my_list contains dict: do_this() elif my_list contains str: do_that() </code></pre> <p><code>my_list</code> contains a large number of elements.</p> <p><code>my_list</code> can contain only...
<p>AS OP SAY HE WANTS WITHOUT INDEXING THEN USE THIS ONE,</p> <pre class="lang-py prettyprint-override"><code>if set(map(type,l1)) == {str}: do_this() elif set(map(type,l1))=={dict}: do_that() </code></pre> <h2>Explanation (Because OP is familiar with the <a href="https://www.simplilearn.com/tutorials/python-tu...
How do I find the dtype of the content in a list using Python?
python
0
61
2
72,289,693
72,289,693
1
true
2022-05-18T12:31:57.853Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I find the dtype of the content in a list using Python?<p>My code consists of the following workflow:</p> <pre><code>if my_list contains dict: do_th...
72,373,002
fscanf read another format in same file.csv<p>My data file:</p> <pre><code>name/month/date/year 1.Moore Harris,12/9/1995 2.Ragdoll Moore,11/5/2022 3.Sax,Smart,3/1/2033 4.Robert String,9/7/204 </code></pre> <pre><code>bool success = fscanf(fptr, &quot;%[^,]&quot;, nameEmploy) == 1; bool success = fscanf(fptr, &quot;,%d&...
<p>To parse the CSV file, it is recommended to read one line at a time with <code>fgets()</code> and use <code>sscanf()</code> to parse all fields in one call:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; struct data { char name[32]; int month, day, year; }; int parse_csv(FILE *fp) { ...
fscanf read another format in same file.csv
c++|c|file
1
61
1
72,383,335
72,383,335
1
true
2022-05-25T06:45:31.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: fscanf read another format in same file.csv<p>My data file:</p> <pre><code>name/month/date/year 1.Moore Harris,12/9/1995 2.Ragdoll Moore,11/5/2022 3.Sax,Smar...
72,261,620
Grouped aggregate counts for each date in a series of dates<p>I am trying to get grouped <code>task</code> counts by <code>state</code> over a <strong>series</strong> of dates using the following tables:</p> <pre><code>tasks ----- | id | title | state_id | inserted_at | | -- | ----------- | -------- | ---...
<p>Consider a stored function to loop through the generated series of dates and capture each daily aggregated snapshot:</p> <pre class="lang-sql prettyprint-override"><code>CREATE OR REPLACE FUNCTION build_daily_log_agg(_interval_days TEXT) RETURNS TABLE (&quot;date&quot; TEXT, state_id INTEGER, ...
Grouped aggregate counts for each date in a series of dates
sql|postgresql
2
61
1
72,262,220
72,262,220
1
true
2022-05-16T15:21:40.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Grouped aggregate counts for each date in a series of dates<p>I am trying to get grouped <code>task</code> counts by <code>state</code> over a <strong>series...
72,388,547
Write multiple rows on Google Sheet (at once) with data from a dictionary (using Apps Script)<p>On app script, I have a dictionary object with the format: { name1: &quot;info1&quot;, name2: &quot;info2&quot;, … }.</p> <p>Screenshot of the sheet for reference: <a href="https://i.stack.imgur.com/FmOec.png" rel="nofollow...
<p>Try</p> <pre><code>function myFunction() { // building the dictionary const sh = SpreadsheetApp.getActiveSheet() const dict = `{ &quot;name1&quot;: &quot;info1&quot;, &quot;name2&quot;: &quot;info2&quot;, &quot;name3&quot;: &quot;info3&quot;}` // parsing the disctionary const obj = JSON.parse(dict) const...
Write multiple rows on Google Sheet (at once) with data from a dictionary (using Apps Script)
google-apps-script
1
61
2
72,389,689
72,389,689
1
true
2022-05-26T07:55:07.580Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Write multiple rows on Google Sheet (at once) with data from a dictionary (using Apps Script)<p>On app script, I have a dictionary object with the format: { ...
72,385,312
Vuejs show product page in combination with repeatable route params as nested categories<p>I would like to access a product details page within the set of categories. For example: <code>website.com/catalog/cat1/cat2/cat3/product-item-123</code></p> <p>I'm using a <a href="https://router.vuejs.org/guide/essentials/route...
<p>As you cannot use regex to help you sort products from categories, the simplest solution seems to be to add a separator section to your url to tell the router that what follows is a product: <br></p> <pre><code> path: '/catalog/:slug+/product/:productSlug', </code></pre> <p>Tell me if you're still facing an issue. ...
Vuejs show product page in combination with repeatable route params as nested categories
vue.js|vue-router
0
61
1
72,385,409
72,385,409
1
true
2022-05-26T00:01:48.080Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Vuejs show product page in combination with repeatable route params as nested categories<p>I would like to access a product details page within the set of ca...
72,308,830
How to create multiple API requests based on different param values?<p>So I have this list which stores different request URLS for finding an account.</p> <pre><code>accounts= [] </code></pre> <p>Each url looks something like this. <code>'https://example.somewebsite.ie:000/v12345/accounts/12345/users' </code></p> <p>Ea...
<p><code>accountReq</code> only holds the last data because you're redefining the variable on each iteration. You should change your code to this:</p> <pre><code>accountReq = [] for i in accounts: accountReq.append(requests.get(i, headers=headers).json()) for each in accountReq: account = each['data'] fo...
How to create multiple API requests based on different param values?
python|python-requests
1
61
3
72,309,424
72,309,424
1
true
2022-05-19T17:31:35.640Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to create multiple API requests based on different param values?<p>So I have this list which stores different request URLS for finding an account.</p> <p...
72,382,326
How to get typewriter to loop?<p>I want to figure out how to get the typewriter to loop infinitely with a subtle delay. Currently, it only triggers on page load.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;h1&gt;Typewriter&lt;/h1&gt; &lt;p id=&quot;demo&quot;&gt;&lt;/p&gt; &lt;script&gt; var ...
<p>Using <code>setTimeout</code>: reset the paragraph back to <code>&quot;&quot;</code> at the begging. When the length of the text is reached inside the loop, reset <code>i</code> to <code>0</code>. To add a delay simply use a different speed if it's the last character.</p> <p>But, it's better to use <code>setInterval...
How to get typewriter to loop?
javascript|html|css|loops
3
61
1
72,382,517
72,382,517
1
true
2022-05-25T18:03:48.167Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to get typewriter to loop?<p>I want to figure out how to get the typewriter to loop infinitely with a subtle delay. Currently, it only triggers on page l...
72,390,190
If previous element is x, then return it<p>I need to build a web-scraping tool for this page: <a href="https://www.valchov.cz/sluzby/specialni-sluzby-/" rel="nofollow noreferrer">https://www.valchov.cz/sluzby/specialni-sluzby-/</a></p> <p>I already figured out how to get the <code>&quot;Vyvěšeno&quot;</code> and <code>...
<p>Question and expected output is not that clear but assuming, that your goal is to get all the links and apply corresponding dates I would reccomend to adjust your script that way:</p> <ol> <li><p>You do not need extra <code>re</code> modul instead use <code>css selectors</code>:</p> <pre><code>soup.select('p:-soup-c...
If previous element is x, then return it
python|csv|web-scraping|beautifulsoup
0
61
1
72,391,274
72,391,274
1
true
2022-05-26T10:13:23.067Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: If previous element is x, then return it<p>I need to build a web-scraping tool for this page: <a href="https://www.valchov.cz/sluzby/specialni-sluzby-/" rel=...
72,286,565
Calculate properties using items in List with conditions<p>I have a list object that has several properties that I want to use for calculations for an model properties.</p> <p>something like:</p> <pre><code>List&lt;Cars&gt; </code></pre> <p>that has properties for Wheels/Windows/HasRoof/FuelType, etc.</p> <p>I have a m...
<p>I think I know what you're getting at, but tell me if I miss the mark!</p> <p>For most UIs including web apps, the UI box that is displaying something like <code>AmountOfWheels</code> is <em>bound</em> to changes of that property using the INotifyPropertyChanged interface. If your <code>Parts</code> class implements...
Calculate properties using items in List with conditions
c#
0
61
1
72,292,131
72,292,131
1
true
2022-05-18T09:29:12.690Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculate properties using items in List with conditions<p>I have a list object that has several properties that I want to use for calculations for an model ...
72,248,836
How to creating a new column with year of first date to each id in r<p>I have this dataset:</p> <pre><code>library(dplyr) library(lubridate) id &lt;- c(&quot;A&quot;, &quot;A&quot;, &quot;B&quot;, &quot;B&quot;) date &lt;- ymd_hms(c(&quot;2017-12-26 09:01:30&quot;, &quot;2018-01-01 09:06:40&quot;, &quot;2017-12-30 09:...
<p>A possible solution:</p> <pre class="lang-r prettyprint-override"><code>library(tidyverse) library(lubridate) df %&gt;% group_by(id) %&gt;% mutate(year = first(year(date))) %&gt;% ungroup #&gt; # A tibble: 4 × 3 #&gt; id date year #&gt; &lt;chr&gt; &lt;dttm&gt; &lt;dbl&...
How to creating a new column with year of first date to each id in r
r|dplyr|group-by|lubridate
2
61
2
72,248,931
72,248,931
1
true
2022-05-15T13:47:22.893Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to creating a new column with year of first date to each id in r<p>I have this dataset:</p> <pre><code>library(dplyr) library(lubridate) id &lt;- c(&quo...
72,342,278
How to Manipulate Sets of Buttons in React with UseStates?<p>Hi I am new to react and trying to get buttons to light up when you press them, however they are in sets of buttons and <strong>I'd like the other buttons in the set to not also light up when one is pressed.</strong></p> <p>Currently I used UseState() and it ...
<p>You just need to store a value you could use in the state (I used '1-5') and then check against that.</p> <pre><code>function RadioButtonGroup() { const [active, setActive] = useState(''); const handleClick = (value) =&gt; () =&gt; { setActive(value); }; return ( &lt;div&gt; &lt;button ...
How to Manipulate Sets of Buttons in React with UseStates?
javascript|reactjs|use-state
0
61
3
72,343,850
72,343,850
1
true
2022-05-23T00:55:01.190Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to Manipulate Sets of Buttons in React with UseStates?<p>Hi I am new to react and trying to get buttons to light up when you press them, however they are...
72,398,389
Is there another way to return an array in C instead using pointers?<p>I thought I could return an array like I do in Java, but I think there is no way to declare a <em>char</em> function in C.</p>
<p>No. You return an array via a pointer (possible embedded in a struct either as a pointer or an array). The array is either dynamically allocated in the function, or passed into the function as an argument and then returned again:</p> <pre><code>char *f() { char *s = malloc(42); ... return s; } </code></pre> ...
Is there another way to return an array in C instead using pointers?
c|pointers
-2
61
2
72,398,447
72,398,447
1
true
2022-05-26T21:50:13.130Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is there another way to return an array in C instead using pointers?<p>I thought I could return an array like I do in Java, but I think there is no way to de...
72,241,103
Improving the running time of SQL query<p>Assume the query below take a long time to run. To improve the running time of this SQL query, which of the options below are the best way to do so?</p> <pre><code>SELECT Name FROM People WHERE Birth_Date &gt; CAST('2000-01-01' AS DATE) ; </code></pre> <p>People is the name of ...
<p>Option 2.</p> <p>Option 1 performs an unnecessary type conversion as we may assume that <code>Birth_Date</code> is already a <code>DATE</code> (or compatible type), why else would <code>'2000-01-01'</code> be cast to <code>DATE</code>? It would not help to speed up the query, only to slow it down more, because of th...
Improving the running time of SQL query
sql
0
61
2
72,241,311
72,241,311
2
true
2022-05-14T14:25:15.873Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Improving the running time of SQL query<p>Assume the query below take a long time to run. To improve the running time of this SQL query, which of the options...
72,242,022
Why does "(echo <Payload> && cat) | nc <link> <port>" creates a persistent connection?<p>I began with playing ctfs challenges, and I encountered a problem where I needed to send an exploit into a binary and then interact with the spawned shell. I found a solution to this problem which looks something like this:</p> <pr...
<p>If you just type in <code>cat</code> at the command line, you'll be able to see that this command simply copies <code>stdin</code> to <code>stdout</code> one line at a time. It will carry on doing this until you either quit with <kbd>Ctrl-C</kbd> or send an EOF with <kbd>Ctrl-D</kbd>.</p> <p>In this example you're r...
Why does "(echo <Payload> && cat) | nc <link> <port>" creates a persistent connection?
shell|cat|netcat|ctf
2
61
1
72,244,465
72,244,465
2
true
2022-05-14T16:16:26.667Z
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does "(echo <Payload> && cat) | nc <link> <port>" creates a persistent connection?<p>I began with playing ctfs challenges, and I encountered a problem wh...