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,985,798 | Can I parse an OffsetDateTime from an HTML form without asking for the offset?<p>I'm trying to receive a date from a JSP form where a user enters a date and time for an event to start. Each event will occur at that instant (i.e. it will be represented by an <code>OffsetDateTime</code> object so it can be stored in my D... | <p>You could try to get an offset from the browser as noted in the Comments.</p>
<p>But really you should <strong>verify the intended time zone</strong> with the user.</p>
<p><a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" rel="nofollow noreferrer">Time zones are named</a> in the format of <code>... | Can I parse an OffsetDateTime from an HTML form without asking for the offset? | java|html|spring|jsp | -1 | 55 | 1 | 72,987,616 | 72,987,616 | 1 | true | 2022-07-14T19:34:56.887Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can I parse an OffsetDateTime from an HTML form without asking for the offset?<p>I'm trying to receive a date from a JSP form where a user enters a date and ... |
72,841,211 | Invert Binary Tree Js Leet problem - confused about the returned variable<p>So there is this <a href="https://leetcode.com/problems/invert-binary-tree/" rel="nofollow noreferrer">problem</a>
essentially, What we are doing to invert the Tree is</p>
<ol>
<li>Create a new TreeNode</li>
<li>Assign root->left to ->rig... | <p>As the problem states, you must return the root. But before that, you have to invert it.</p>
<p>The logic is to keep an array named <code>queue</code> that stores <strong>the next <code>TreeNode</code> to be inverted</strong> and it does that iteratively inside a while-loop.</p>
<p>Firstly, the algorithm starts with... | Invert Binary Tree Js Leet problem - confused about the returned variable | javascript | 2 | 55 | 2 | 72,841,349 | 72,841,349 | 1 | true | 2022-07-02T17:39:51.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Invert Binary Tree Js Leet problem - confused about the returned variable<p>So there is this <a href="https://leetcode.com/problems/invert-binary-tree/" rel=... |
72,933,215 | How to load a html to a variable in next.config.js<p>I use standard nextron (Next + electron.js) to jump start my project (<a href="https://github.com/saltyshiomix/nextron" rel="nofollow noreferrer">https://github.com/saltyshiomix/nextron</a>)</p>
<p>In one particular case, I need to <a href="https://www.geeksforgeeks.... | <p>I think the problem is that you are trying to use fs module (which is node.js native module) on the client side. The webpack change you've added tells webpack to ignore fs module for the client (or replace it with the stub), but you are still trying to use it.</p>
<p>One way to workaround this is to render your comp... | How to load a html to a variable in next.config.js | javascript|node.js|reactjs|next.js|electron | 0 | 55 | 1 | 72,933,383 | 72,933,383 | 1 | true | 2022-07-11T02:37:45.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to load a html to a variable in next.config.js<p>I use standard nextron (Next + electron.js) to jump start my project (<a href="https://github.com/saltys... |
72,940,181 | How to call complete internal flows multiple times in Sequence Diagrams<p>Main Idea: To convert an activity diagram into a sequence diagram.</p>
<p>Problem: I want that if "Action 2" fails then, in that case all the flows get triggered again from "Action 1".</p>
<p>(i.e Action 1 --> Action 2 --&g... | <p>The activity and sequence diagrams are not supposed to be equivalent. Both set a different focus (flow vs interactions) and as a consequence you might have to do the mapping by identifying higher-level constructs.</p>
<p>Here you have clearly a loop:</p>
<p><a href="https://i.stack.imgur.com/Ut9iR.png" rel="nofollo... | How to call complete internal flows multiple times in Sequence Diagrams | uml|sequence-diagram | 2 | 55 | 1 | 72,944,201 | 72,944,201 | 1 | true | 2022-07-11T14:29:27.290Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call complete internal flows multiple times in Sequence Diagrams<p>Main Idea: To convert an activity diagram into a sequence diagram.</p>
<p>Problem: ... |
72,911,077 | How to solve TypeError: 'bool' object is not iterable in Python<p>This is my function which throws this error</p>
<pre><code> TypeError: 'bool' object is not iterable
</code></pre>
<p>in line:</p>
<pre><code> if all(v == 0):
</code></pre>
<p>My goal is in this line to check whether all values are equal to Zero.</p>... | <pre><code>def main():
def checklist( thelist ):
if len(thelist) > 2:
if all(vs == 0.0 for vs in thelist):
print( "All zero")
if any(v < 0.0 for v in thelist):
print ("At least one negative")
else:
print("All good")... | How to solve TypeError: 'bool' object is not iterable in Python | python|typeerror | 0 | 55 | 2 | 72,911,352 | 72,911,352 | 1 | true | 2022-07-08T12:01:05.980Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to solve TypeError: 'bool' object is not iterable in Python<p>This is my function which throws this error</p>
<pre><code> TypeError: 'bool' object is n... |
72,828,561 | Why does chrono add a leading plus character when displaying DateTime in far future?<p>In chrono's code we can find the following test:</p>
<pre><code>assert_eq!(format!("{:?}", NaiveDate::from_ymd(2012, 3, 4)), "2012-03-04");
assert_eq!(format!("{:?}", NaiveDate::from_ymd(0, 3, 4)), "... | <p><a href="https://docs.rs/chrono/0.4.19/src/chrono/naive/date.rs.html#1639-1650" rel="nofollow noreferrer">https://docs.rs/chrono/0.4.19/src/chrono/naive/date.rs.html#1639-1650</a></p>
<pre class="lang-rust prettyprint-override"><code>// ISO 8601 requires the explicit sign for out-of-range years
write!(f, "{:+05... | Why does chrono add a leading plus character when displaying DateTime in far future? | rust|datetime-format | 0 | 55 | 1 | 72,828,621 | 72,828,621 | 1 | true | 2022-07-01T11:26:30.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does chrono add a leading plus character when displaying DateTime in far future?<p>In chrono's code we can find the following test:</p>
<pre><code>assert... |
72,955,539 | How to interact with mouse in Windows Form<p>I have a dictionary of buttons and also an null variable button. When you click on an button from the dictionary, we get the values that should be sent to an empty variable.</p>
<pre><code>public static Button selectedfigure=null;
public Dictionary<(int x, int y), But... | <p>Your question is about <strong>how to interact with Mouse</strong> events on your "board". The answer is to subscribe to Mouse events like <code>Click</code> for each control you add. Your code is using a normal <code>Button</code> but will be much simpler if you make a custom class that <em>inherits</em> ... | How to interact with mouse in Windows Form | c#|windows|winforms|mouseevent|mouse | 1 | 55 | 2 | 72,959,973 | 72,959,973 | 1 | true | 2022-07-12T16:28:55.137Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to interact with mouse in Windows Form<p>I have a dictionary of buttons and also an null variable button. When you click on an button from the dictionary... |
72,972,446 | Yup and Formik - how to set variables for different conditions on password field<p>I have been searching through other posts and finding issues similar to but not quite what I am looking for.</p>
<p>I need to know simultaneously if the different conditions are met for a password to highlight the visual below.</p>
<p>Wh... | <p>First of all you need to create states for each condition like</p>
<pre><code>const [isRequired, setRequired] = useState(false);
const [isMinLength, setMinLength] = useState(false);
const [isUppercase, setUppercase] = useState(false);
const [isSpecial, setSpecial] = useState(false);
//other validation states like is... | Yup and Formik - how to set variables for different conditions on password field | reactjs|formik|yup | 1 | 55 | 1 | 72,977,338 | 72,977,338 | 1 | true | 2022-07-13T20:45:15.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Yup and Formik - how to set variables for different conditions on password field<p>I have been searching through other posts and finding issues similar to bu... |
72,809,488 | How to smooth-scroll to an anchor tag from another page in NextJS?<p>I have 2 pages in my NextJS (1 is Home and another is Leaderboard page). And I have a <code>navbar</code> as such:</p>
<pre><code><div className={styles.navItem}>
<Link href="/">
<a className={styles.navLinks... | <p>Your problem is you call <code>setTimeout</code> directly which is executed right away on the server (more specifically, NextJS does not have <code>window</code> and <code>document</code> objects on the server-side) that's why <code>document</code> is not available.</p>
<p>You should wrap it into a function like bel... | How to smooth-scroll to an anchor tag from another page in NextJS? | javascript|html|css|next.js | 0 | 55 | 1 | 72,809,736 | 72,809,736 | 1 | true | 2022-06-30T01:45:20.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to smooth-scroll to an anchor tag from another page in NextJS?<p>I have 2 pages in my NextJS (1 is Home and another is Leaderboard page). And I have a <c... |
73,000,897 | How to turn an object into an array with JavaScript?<p>i´m trying to return the data from the bookstore API, i can add the data and i see the data in the code inspector, but for some reason it doesn´t show on my project.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"... | <p>The problem is that you get an object from the API and you want an array.</p>
<h1>How to turn an object into an array ?</h1>
<p>Let's say you have the following object:</p>
<pre class="lang-json prettyprint-override"><code>{
"1": { color: "blue" },
"2": { color: "green"... | How to turn an object into an array with JavaScript? | reactjs|redux | -2 | 55 | 1 | 73,006,946 | 73,006,946 | 1 | true | 2022-07-16T01:15:25.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to turn an object into an array with JavaScript?<p>i´m trying to return the data from the bookstore API, i can add the data and i see the data in the cod... |
72,778,707 | jQuery prop counter with updated iterations<p>I've used the jQuery <a href="https://api.jquery.com/prop/" rel="nofollow noreferrer">prop</a>-method with the <code>counter</code>-property to create an animation that counts from 0 to the value from the <code>.count</code>-string through an <code>each</code>-loop.</p>
<p>... | <p>Use an object that maps element IDs to the corresponding increments. Then use a <code>complete:</code> function that starts repeated animations with 3-second durations and the appropriate increment.</p>
<p>The key to getting the animations to repeat at the end is to use a named function, so it can call itself in the... | jQuery prop counter with updated iterations | javascript|html|jquery|prop | 0 | 55 | 1 | 72,790,043 | 72,790,043 | 1 | true | 2022-06-27T21:57:23.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery prop counter with updated iterations<p>I've used the jQuery <a href="https://api.jquery.com/prop/" rel="nofollow noreferrer">prop</a>-method with the ... |
72,393,639 | Google Speech-to-Text: Cannot use Custom Classes<p>I am following the <a href="https://cloud.google.com/speech-to-text/docs/reference/rpc/google.cloud.speech.v1p1beta1?&_ga=2.21261435.-1508770839.1617306393#phrase" rel="nofollow noreferrer">Google Docs</a> to do Transcription jobs by providing it with a <code>Phras... | <p>I figured out the problem.</p>
<p>For those of you who land here, I found the solution by digging deeper into the <a href="https://cloud.google.com/speech-to-text/docs/adaptation-model#improve_transcription_results_using_a_customclass" rel="nofollow noreferrer">code samples</a>.</p>
<p>Instead of just using the <cod... | Google Speech-to-Text: Cannot use Custom Classes | google-cloud-platform|google-speech-to-text-api | 1 | 55 | 1 | 72,394,011 | 72,394,011 | 1 | true | 2022-05-26T14:41:38.917Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Speech-to-Text: Cannot use Custom Classes<p>I am following the <a href="https://cloud.google.com/speech-to-text/docs/reference/rpc/google.cloud.speech... |
72,393,211 | How is computation time affected by calculating comparison values before if statements?<p>I am currently writing a simulation framework in python, which will then moved to C.</p>
<p>Assume that I need 8 comparisons for further evaluation.</p>
<pre class="lang-py prettyprint-override"><code>A=q<x<r
B=q<y<r
C... | <blockquote>
<p>Is <code>if A:</code> also called a comparison? Does it have a specific name?</p>
</blockquote>
<p>Well, I don't know if it has a dedicated name. I'd call <code>A</code> an identity expression and the If statement evaluates its truth value. At least that last part is <a href="https://docs.python.org/3.8... | How is computation time affected by calculating comparison values before if statements? | python|c|if-statement|time | 0 | 55 | 1 | 72,394,390 | 72,394,390 | 1 | true | 2022-05-26T14:10:57.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How is computation time affected by calculating comparison values before if statements?<p>I am currently writing a simulation framework in python, which will... |
72,393,574 | How to allow staff to easily turn off or on connect to call widget in twilio studio flow?<p>Our call system is built through a Studio Flow in Twilio. Within that flow we have a connect to call widget that relays the incoming call to staff members' personal cell phones. Presently it is two staff members including my own... | <p>I think the solution you need here is an interface that your staff can access to enable or disable their number. And then a way for your Studio Flow to determine currently active numbers and only direct calls to them.</p>
<p>The simplest thing that comes to mind would be a Google Sheet that your staff do have access... | How to allow staff to easily turn off or on connect to call widget in twilio studio flow? | twilio|twilio-api|twilio-twiml|twilio-programmable-voice | 1 | 55 | 1 | 72,399,471 | 72,399,471 | 1 | true | 2022-05-26T14:37:39.640Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to allow staff to easily turn off or on connect to call widget in twilio studio flow?<p>Our call system is built through a Studio Flow in Twilio. Within ... |
72,300,125 | How to modify TeX before it is processed by MathJax v3?<p>I am attempting to do something similar to <a href="https://github.com/shd101wyy/markdown-preview-enhanced/issues/722" rel="nofollow noreferrer">this MathJax v2</a> startup hook, that modifies the TeX command before it is processed (every time before typesetting... | <p>Here is a configuration for MathJax v3 that should do the trick, provided you are loading a component that has only one input processor.</p>
<pre class="lang-js prettyprint-override"><code>MathJax = {
startup: {
ready() {
MathJax.startup.defaultReady();
MathJax.startup.document.inputJax[0].preFilte... | How to modify TeX before it is processed by MathJax v3? | javascript|mathjax | 0 | 55 | 1 | 72,399,522 | 72,399,522 | 1 | true | 2022-05-19T07:11:57.210Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to modify TeX before it is processed by MathJax v3?<p>I am attempting to do something similar to <a href="https://github.com/shd101wyy/markdown-preview-e... |
72,399,831 | Using Boolean for plot style or linewidth causes error. How to do it the right way?<p>In this simplified example, we alter the <code>style</code> of a plot function.</p>
<pre><code>plot(Something, "SomethingWePlot", color=colorful, linewidth = 1, style = BooleanVariable ? plot.style_line : plot.style_cross)
<... | <p>The workaround is the only way as the linewidth and style arguments are required to be known at compilation as constants/input variables and can't be modified during script execution.</p>
<p>If you really cant do without the additional plots, you can achieve a workaround by separating the required plots into multipl... | Using Boolean for plot style or linewidth causes error. How to do it the right way? | pine-script|pinescript-v5 | 0 | 55 | 1 | 72,399,959 | 72,399,959 | 1 | true | 2022-05-27T02:25:44.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using Boolean for plot style or linewidth causes error. How to do it the right way?<p>In this simplified example, we alter the <code>style</code> of a plot f... |
72,393,718 | Visual Studio Code squiggly lines are misaligned<p>My Visual Studio Code is doing something weird: squiggly lines (ones that indicate error or warning in the code) are misaligned by some characters away from place where they should be:</p>
<p><a href="https://i.stack.imgur.com/1t6GY.png" rel="nofollow noreferrer">Scree... | <p>The problem was with the rust-analyzer extension (or at least it seems like it) and once I switched to pre-release version of the extension the problem disappeared. I guess that was a bug</p> | Visual Studio Code squiggly lines are misaligned | visual-studio-code | 1 | 55 | 1 | 72,404,278 | 72,404,278 | 1 | true | 2022-05-26T14:47:08.800Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Visual Studio Code squiggly lines are misaligned<p>My Visual Studio Code is doing something weird: squiggly lines (ones that indicate error or warning in the... |
72,388,326 | Azure notification hubs - can they send psh notifications without third parties<p>Doing some learning around Azure Notification hubs and trying to understand one of the basic concepts but not able to find any documentation that states it explictly.</p>
<p>Is an azure notification hb able to send a push notification dir... | <p>Azure Notification Hubs (ANH) must be configured with credentials for one or more of the push notification services (PNS) that you've enumerated.</p>
<p>Essentially, each of these providers have a reliable mechanism for delivering a specific notification to a specific device, some of them also provide mechanisms for... | Azure notification hubs - can they send psh notifications without third parties | azure|azure-notificationhub | 1 | 55 | 1 | 72,409,255 | 72,409,255 | 1 | true | 2022-05-26T07:34:35.607Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure notification hubs - can they send psh notifications without third parties<p>Doing some learning around Azure Notification hubs and trying to understand... |
72,378,391 | How to get maximum similarity value between lists with numpy?<p>I have two lists, the idea is that each of the elements of one of the lists is compared with all the elements of the second, in order to extract the element with the greatest similarity. Like a search engine.</p>
<p>Variables used in NLU:</p>
<pre><code>im... | <p>Alternative solution that gives something similar:</p>
<pre><code># Cosine Similarity Calculation
def cosine_similarity(vector1, vector2):
vector1 = np.array(vector1)
vector2 = np.array(vector2)
return np.dot(vector1, vector2) / (np.sqrt(np.sum(vector1**2)) * np.sqrt(np.sum(vector2**2)))
for i in range... | How to get maximum similarity value between lists with numpy? | python|pandas|numpy|nlp | 0 | 55 | 2 | 72,468,295 | 72,468,295 | 1 | true | 2022-05-25T13:17:29.633Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get maximum similarity value between lists with numpy?<p>I have two lists, the idea is that each of the elements of one of the lists is compared with ... |
72,299,933 | Search function in PHP<p>I'm trying to insert a <strong>search function</strong> into my website, the one I found can find data from multiple columns (which is great) but the problem is that after the search results get displayed, The <strong>text header isn't showing</strong> (which isn't good). Does anyone know how t... | <p>You need to skip the first row (which is the header row)</p>
<p>So start your loop from 1</p>
<pre><code>for (i = 1; i < tr.length; i++) {
</code></pre> | Search function in PHP | javascript | 2 | 55 | 3 | 72,300,086 | 72,300,086 | 1 | true | 2022-05-19T06:56:50.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Search function in PHP<p>I'm trying to insert a <strong>search function</strong> into my website, the one I found can find data from multiple columns (which ... |
72,313,895 | order_by date_join in Django<p>I am displaying user information to the admin dashboard I want to order Users by their join date.
and on another page, I want to display only 10 users information which are recently logged in.</p>
<p>I am filtering user data like this:</p>
<pre><code>data = Profile.objects.filter(Q(user__... | <p>I am assuming you have certain fields like last login in Profile to track login history</p>
<p>Use</p>
<pre><code>user__last_login
</code></pre>
<p>Now you can filter as</p>
<pre><code>data = Profile.objects.filter(Q(user__is_superuser=False), Q(user__is_staff=False)).order_by('-user__last_login')[:10]
</code></pre> | order_by date_join in Django | python|django|django-models|django-views|django-queryset | 0 | 55 | 2 | 72,313,983 | 72,313,983 | 1 | true | 2022-05-20T05:19:53.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
order_by date_join in Django<p>I am displaying user information to the admin dashboard I want to order Users by their join date.
and on another page, I want ... |
72,247,334 | using shared_ptr of a type of Class A as a member variable of class B<p>Assume that my class B is something like this:</p>
<pre><code>class B {
B (double d,double e)
private:
std::shared_ptr < class A > sp;
}
</code></pre>
<p>The Constructor from class A looks like:</p>
<pre><code>A(double a, double b){...};
</c... | <blockquote>
<p>How can i use the constructor initilizer list using :</p>
</blockquote>
<p>If you want to initialize <code>sp</code> you can do it in the <strong>constructor initializer list</strong> as shown below, (and not inside the body of the constructor as you were doing):</p>
<pre><code>//---------------------v... | using shared_ptr of a type of Class A as a member variable of class B | c++|constructor|shared-ptr | 0 | 55 | 1 | 72,247,589 | 72,247,589 | 1 | true | 2022-05-15T10:15:16.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
using shared_ptr of a type of Class A as a member variable of class B<p>Assume that my class B is something like this:</p>
<pre><code>class B {
B (double d,d... |
72,325,558 | Creating new dataframe from existing dataframes using a mathematical calculation<p>I have 2 dataframes that look like this:</p>
<pre><code>monthly_abscount = pd.DataFrame(df.groupby(df["Month"])["Abscount"].sum())
monthly_abscount["Abscount"] = monthly_abscount["Abscount"].astype... | <p>Use:</p>
<pre><code>#The reason of empty result.
df1=df1.reset_index()
#######
df2['Month']=df2['Month'].astype(float).astype(int)
df1['Month']=df1['Month'].astype(int)
out = df1.merge(df2, on='Month')
out['Abscount']=out['Abscount'].astype(float)
out['Workdays']=out['Workdays'].astype(float)
out['needed'] = out['A... | Creating new dataframe from existing dataframes using a mathematical calculation | python|pandas|merge | 1 | 55 | 1 | 72,326,339 | 72,326,339 | 1 | true | 2022-05-20T23:19:29.583Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating new dataframe from existing dataframes using a mathematical calculation<p>I have 2 dataframes that look like this:</p>
<pre><code>monthly_abscount =... |
72,310,815 | Verified users access home and unverified users stay in the login<p>I am checking if the user got a verification email after registration inside login function:</p>
<pre><code>static func authenticate(withEmail email :String,
password:String,
completionHandler:@escaping... | <p>As you didn´t post your Views I have to answer with an abstract answer.</p>
<p>in your main App struct</p>
<pre><code>@main
struct TestApp1App: App {
@Environment(\.scenePhase) private var scenePhase
@AppStorage("emailVerified") private var emailVerified: Bool = false
var body: some Scene {
... | Verified users access home and unverified users stay in the login | ios|swift|swiftui|verification|email-verification | 1 | 55 | 1 | 72,310,929 | 72,310,929 | 1 | true | 2022-05-19T20:37:58.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Verified users access home and unverified users stay in the login<p>I am checking if the user got a verification email after registration inside login functi... |
72,276,264 | Make a frame to an image in Julia<p>Images are represented as matrices. Is there a practical way to make sort of frame around the content of the image? (in a monoton color)</p> | <pre><code>using Images, TestImages, Colors
img = testimage("mandrill")
padarray(img, Fill(colorant"magenta", (40, 40), (40, 40)))
</code></pre>
<p><img src="https://i.stack.imgur.com/2rkGu.png" alt="magenta mandrill1" /></p>
<h3>Update</h3>
<p>I don't understand your comment - but you might be as... | Make a frame to an image in Julia | image|julia | 2 | 55 | 1 | 72,280,282 | 72,280,282 | 1 | true | 2022-05-17T14:56:23.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Make a frame to an image in Julia<p>Images are represented as matrices. Is there a practical way to make sort of frame around the content of the image? (in a... |
72,323,634 | Issue in tensor value assignment. What can be wrong in script?<p>I am getting error too many indices for tensor of dimension 1. Can anyone please help how it can be rectified?</p>
<p>The function extract_triplets is a function to parse the generated text and extract the triplets</p>
<pre><code>from transformers import... | <p>It should be :</p>
<pre><code>extracted_text = triplet_extractor.tokenizer.batch_decode(triplet_extractor("Punta Cana is a resort town in the municipality of Higuey, in La Altagracia Province, the eastern most province of the Dominican Republic", return_tensors=True, return_text=False)[0]["generated_t... | Issue in tensor value assignment. What can be wrong in script? | python|pipeline|tensor|transformer-model | 0 | 55 | 1 | 72,430,915 | 72,430,915 | 1 | true | 2022-05-20T18:54:23.387Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Issue in tensor value assignment. What can be wrong in script?<p>I am getting error too many indices for tensor of dimension 1. Can anyone please help how i... |
72,318,258 | python how to delete a line from a txt file and add data<p>my program reads all txt files from a folder and convert the numbers in the txt files.
one of my txt file for example is this</p>
<pre><code>1 0.487500 0.751667 0.112500 0.246667
0 0.464375 0.648333 0.046250 0.083333
4 0.500000 0.352500 0.055000 0.098333
</code... | <p><strong>Important</strong>: It is preferred to write your results into new files, so that the original files don't get destroyed in case of a failure.</p>
<p>Either way, here is code that does what you specified:</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import os
def main():
f... | python how to delete a line from a txt file and add data | python | 0 | 55 | 1 | 72,318,497 | 72,318,497 | 1 | true | 2022-05-20T11:32:02.337Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
python how to delete a line from a txt file and add data<p>my program reads all txt files from a folder and convert the numbers in the txt files.
one of my t... |
72,298,298 | GDI: Create Mountain Chart/Graph?<p>I can use <code>Polyline()</code> GDI function to plot values to create a graph but now I want the lower part of it filled in to create a mountain type chart. Is there something built-in to help create that? (I don't need gradient, but that would be a nice touch).</p>
<p>TIA!!</p> | <p>For this diagram type you need to draw a <a href="https://docs.microsoft.com/en-us/windows/win32/gdi/filled-shapes" rel="nofollow noreferrer">filled shape</a>. The <a href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polygon" rel="nofollow noreferrer"><code>Polygon</code></a> function can be ... | GDI: Create Mountain Chart/Graph? | winapi|gdi | -1 | 55 | 1 | 72,328,561 | 72,328,561 | 1 | true | 2022-05-19T03:27:58.810Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
GDI: Create Mountain Chart/Graph?<p>I can use <code>Polyline()</code> GDI function to plot values to create a graph but now I want the lower part of it fille... |
72,287,815 | Hide featured products on WooCommerce shop and archives pages for guest users or for a certain user role<p>I am attempting to restrict products from appearing in archives/search results if a visitor is NOT LOGGED IN <strong>OR</strong> if there user Role is "Customer"</p>
<p>I'm using this snippet:</p>
<pre c... | <p>It seems you are using unnecessary steps. This shortened and modified version of your code attempt should suffice to hide featured products for customers who are not logged in or for users with the user role <code>'customer'</code></p>
<p>So you get:</p>
<pre class="lang-php prettyprint-override"><code>function filt... | Hide featured products on WooCommerce shop and archives pages for guest users or for a certain user role | php|wordpress|woocommerce|product|user-roles | 1 | 55 | 1 | 72,288,797 | 72,288,797 | 1 | true | 2022-05-18T10:51:14.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hide featured products on WooCommerce shop and archives pages for guest users or for a certain user role<p>I am attempting to restrict products from appearin... |
72,329,813 | How to set the width of the table by settig the first <td> to 100% and the second <td> to a fixed width?<p>I have a table</p>
<pre><code><div class="width1200">
<table>
<th colspan="2">Title:</th>
<tr>
<td>Harry Potter</td>
<td class="... | <p>You're contradicting yourself. I think you mean to say that on a big screen the table should have a maximum width of 1200px. Right?</p>
<pre><code><style>
table {
border-collapse: collapse;
table-layout: auto;
width: 100%;
}
td {
border: solid 1px black;
padding: 10px;
}
.width1200 {
... | How to set the width of the table by settig the first <td> to 100% and the second <td> to a fixed width? | html|css | -1 | 55 | 3 | 72,329,859 | 72,329,859 | 1 | true | 2022-05-21T13:01:01.103Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to set the width of the table by settig the first <td> to 100% and the second <td> to a fixed width?<p>I have a table</p>
<pre><code><div class="... |
72,305,383 | How to create timberplots in R<p>i am looking for a way to display estimates of a meta-analysis with lots of comparisons in a wide format instead of a forestplot. I came across a timberplot as displayed in this publication in figure 1:
<a href="https://www.researchgate.net/publication/283078594_Translational_failure_of... | <p>It's fairly easy to create a plot like this using <code>geom_linerange</code> in ggplot. Here's an example with made up data. Whether you will be able to do this with your own data can't be known without a reproducible example:</p>
<pre class="lang-r prettyprint-override"><code>library(ggplot2)
set.seed(1)
df <... | How to create timberplots in R | r|ggplot2|plot | -2 | 55 | 1 | 72,305,766 | 72,305,766 | 1 | true | 2022-05-19T13:23:51.410Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to create timberplots in R<p>i am looking for a way to display estimates of a meta-analysis with lots of comparisons in a wide format instead of a forest... |
72,280,236 | im using dart 2.16.2 Raisedbutton onpressed Change page no affect<p>i want to changed my page when i press my RaisedButton.</p>
<p><strong>here's my code :</strong></p>
<pre><code>Padding( padding: const EdgeInsets.fromLTRB(56, 0, 56, 24),
child: RaisedGradientButton(
onPressed: () {
... | <p>Modify the following code in your RaisedGradientButton.dart</p>
<pre><code>InkWell(
onTap: () => onPressed,
child: Center(
child: child,
)),
</code></pre>
<p>With:</p>
<pre><code> InkWell(
onTap: onPressed,
child: Center(
chi... | im using dart 2.16.2 Raisedbutton onpressed Change page no affect | flutter|dart|flutter-layout | 0 | 55 | 1 | 72,281,566 | 72,281,566 | 1 | true | 2022-05-17T20:22:31.890Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
im using dart 2.16.2 Raisedbutton onpressed Change page no affect<p>i want to changed my page when i press my RaisedButton.</p>
<p><strong>here's my code :</... |
72,334,126 | How can I build logic checks for wins, losses, and ties in a JavaScript Tic-Tac-Toe game?<p>I am creating a tic-tac-toe game in html,CSS,and JavaScript. I want to check when the game is over in the form of tie, win or loss. However for some reason my functions aren't working and aren't returning either a tie win or los... | <p>Place <code>gameLogic</code> into <code>playGame</code>. Do remember to remove the <code>whoever wins the game</code> when users reset the game. Also, the tie function is not working.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre ... | How can I build logic checks for wins, losses, and ties in a JavaScript Tic-Tac-Toe game? | javascript|html | 1 | 55 | 1 | 72,334,520 | 72,334,520 | 1 | true | 2022-05-22T00:56:29.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I build logic checks for wins, losses, and ties in a JavaScript Tic-Tac-Toe game?<p>I am creating a tic-tac-toe game in html,CSS,and JavaScript. I wa... |
72,272,090 | append multiple dataframes in a single df using the index position in python<p>I have a multiple dataframes in the below format. 0 and 1 represents the index within a single DF in a sequential order(For example column name emp_number has length as 55 from the below sample)</p>
<pre><code>0 Tablename
1 xyz
0 Tablename... | <p>Input</p>
<pre><code>
### assuming this is your data
data = ('tablename', 'xyz'),('tablename','xyz'),('columnname', 'emp_number'),('columnname', 'Organization_unit'),('columnlen', 55),('columnlen', 60),('edge_cases','so edgy')
### create empty lists that will be your columns in your final df
TableName_list = []
Col... | append multiple dataframes in a single df using the index position in python | python|python-3.x|pandas | -1 | 55 | 1 | 72,273,067 | 72,273,067 | 1 | true | 2022-05-17T10:10:20.880Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
append multiple dataframes in a single df using the index position in python<p>I have a multiple dataframes in the below format. 0 and 1 represents the index... |
72,262,038 | how to sort a nested object that contains date and time based on time in elasic<p>I have an index named <code>store</code> and it's contain a nested object as a list which is <code>WorkTimes</code>.</p>
<p><code>WorkTimes</code> list has open time and close time and maybe it has more than one <code>OpenTime</code> and ... | <p>you can do like this</p>
<pre><code>var allfilters = new List<Func<QueryContainerDescriptor<Store>, QueryContainer>>();
if (storeCategoryIds.Any())
{
allfilters.Add(fq => fq.Terms(t => t.Field(f => f.StoreCategoryIds).Terms(storeCategoryIds)));
... | how to sort a nested object that contains date and time based on time in elasic | elasticsearch | 1 | 55 | 1 | 72,307,022 | 72,307,022 | 1 | true | 2022-05-16T15:51:41.827Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to sort a nested object that contains date and time based on time in elasic<p>I have an index named <code>store</code> and it's contain a nested object a... |
72,369,820 | Order columns individually in R<p>I am after reshaping the data, and get the below, see screenshot. How can I push the values up? Such that column 2 b row 5, value b, will go into column 2, element 1? Like removing the ID vector and pushing the remaining data upwwards.</p>
<p>I have tried d <- apply(d, 2, sort) and ... | <p>I think it the easiest approach is to convert into a list and remove the blanks, and then put the list back together as a data frame.</p>
<pre><code>dat <- structure(list(ID = 1:17, a = c(1L, 1L, 1L, 1L, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA), b = c(NA, NA, NA, NA, 2L,
2L, 2L, 2L, 2L, NA, NA, NA, N... | Order columns individually in R | r | 1 | 55 | 3 | 72,374,372 | 72,374,372 | 1 | true | 2022-05-24T21:46:08.990Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Order columns individually in R<p>I am after reshaping the data, and get the below, see screenshot. How can I push the values up? Such that column 2 b row 5,... |
72,353,069 | Filter sumproduct formula based on array<p>Given Table 1, I am able to calculate the sum of the revenue with the <code>SUMPRODUCT</code> formula. Though, I would like to be able to filter out specific areas directly in the formula. The formula listed below gives the correct result <code>(13,000)</code> when area B is f... | <p>Use <code>ISERROR(MATCH())</code>:</p>
<pre><code>=SUMPRODUCT(--(ISERROR(MATCH(Sales[Area];Exceptions[Area];0)));Sales[Quantity];Sales[Price per unit])
</code></pre>
<p><code>--(ISERROR(MATCH(Sales[Area];Exceptions[Area];0)))</code> will return 1 if the area is not found in the search area, because the MATCH will re... | Filter sumproduct formula based on array | excel|excel-2010 | 0 | 55 | 1 | 72,353,119 | 72,353,119 | 1 | true | 2022-05-23T18:10:04.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter sumproduct formula based on array<p>Given Table 1, I am able to calculate the sum of the revenue with the <code>SUMPRODUCT</code> formula. Though, I w... |
72,279,611 | two way binding string separated by commas<p>This is my object:</p>
<pre><code>const [opportunity, setOpportunity] = useState({
name: '',
description: '',
experience: '',
});
</code></pre>
<p>I want to store it in the opportunity experience property like a string separated by commas. Like this for example: ... | <p>Replace <code>.filter(x => x !== '')</code> with <code>.replace(/\s+/g, " ")</code> and place it before you call the <code>.split()</code> method. This will replace multiple spaces with a single space, and prevent the user from entering in more than one space at a time, while letting them change the con... | two way binding string separated by commas | javascript|reactjs | 2 | 55 | 2 | 72,280,782 | 72,280,782 | 1 | true | 2022-05-17T19:22:00.817Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
two way binding string separated by commas<p>This is my object:</p>
<pre><code>const [opportunity, setOpportunity] = useState({
name: '',
description... |
72,268,400 | How to proceed with calculations on dataframe<p>I dont know how to proceed with a calculation on this database.</p>
<p>Database example:</p>
<pre><code>Indicator Market Sales Costs Volume
Real Internal 30512 -16577 12469
Real External 23 -15 8
Real Other ... | <p>This works</p>
<pre><code># aggregate Costs and Volumes by Indicator
aggregate = df.groupby('Indicator')[['Costs', 'Volume']].sum()
# plug the values into the cost effect formula
cost_effect = (aggregate.loc['Real', 'Costs'] / aggregate.loc['Real', 'Volume'] - aggregate.loc['Budget', 'Costs'] / aggregate.loc['Budget... | How to proceed with calculations on dataframe | python|pandas|dataframe|formula | -1 | 55 | 1 | 72,268,894 | 72,268,894 | 1 | true | 2022-05-17T04:58:33.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to proceed with calculations on dataframe<p>I dont know how to proceed with a calculation on this database.</p>
<p>Database example:</p>
<pre><code>Indic... |
72,398,194 | How to replace part of string with python pandas?<p>I'm having a problem replacing a part of the string in Pandas.</p>
<p>I have a list of links of a website like this (for example):</p>
<pre><code>https://stackoverflow.com/questions
https://stackoverflow.com/some_page
https://stackoverflow.com/about
</code></pre>
<p>a... | <p>This should get you what you need as long as the URLs are consistent.</p>
<pre><code>data = {
'Column1' : ['https://stackoverflow.com/questions', 'https://stackoverflow.com/another', 'https://stackoverflow.com/last']
}
df = pd.DataFrame(data)
df['Column1'] = df['Column1'].apply(lambda x : 'Link/' + x.split('/')... | How to replace part of string with python pandas? | python|pandas | 1 | 55 | 3 | 72,398,220 | 72,398,220 | 1 | true | 2022-05-26T21:27:57.737Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace part of string with python pandas?<p>I'm having a problem replacing a part of the string in Pandas.</p>
<p>I have a list of links of a website... |
72,254,522 | Autocomplete Search Via Another Paramter<p>In below example , -</p>
<p><a href="https://codesandbox.io/s/g5ucdj?file=/demo.tsx" rel="nofollow noreferrer">https://codesandbox.io/s/g5ucdj?file=/demo.tsx</a></p>
<p>I want to achieve functionality such that , If I have array -</p>
<pre><code>const top100Films = [
{ title... | <p>You can use MUI <code>createFilterOptions</code></p>
<pre><code>import { createFilterOptions } from '@mui/material/Autocomplete';
</code></pre>
<p>Declare filterOptions</p>
<pre><code>const filterOptions = createFilterOptions({
matchFrom: 'any',
stringify: (option) => option.year.toString(), //.toString beca... | Autocomplete Search Via Another Paramter | javascript|jquery|reactjs|material-ui|autocomplete | 0 | 55 | 2 | 72,259,158 | 72,259,158 | 1 | true | 2022-05-16T05:30:42.423Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Autocomplete Search Via Another Paramter<p>In below example , -</p>
<p><a href="https://codesandbox.io/s/g5ucdj?file=/demo.tsx" rel="nofollow noreferrer">htt... |
72,379,531 | Inheritance In React Native Style Sheets<p>So in a regular cascading style sheet we can inherit from other styles doing so:</p>
<pre><code>.myStyle .temp {
height: 100px,
width: 80px,
}
</code></pre>
<p>My question is:</p>
<p>is there a way for me to do this in react native. I have tried a few different ways but ... | <p>Your first idea does not work because you are trying to use a style object defined inside the create function of <code>StyleSheet</code> for another style object defined within the same create function. You cannot access them inside the create function.</p>
<p>However, you could define your styles in a plain JS obje... | Inheritance In React Native Style Sheets | react-native|react-css-modules | 1 | 55 | 2 | 72,380,034 | 72,380,034 | 1 | true | 2022-05-25T14:30:00.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inheritance In React Native Style Sheets<p>So in a regular cascading style sheet we can inherit from other styles doing so:</p>
<pre><code>.myStyle .temp {
... |
72,350,385 | Enumerating regions of a two-dimensional array and interacting with them<p>I have two two-dimensional arrays res1, res2 of size 1501x780.
I have to take slices from them, process these slices with a function and add the result to the array.
The slice on res1 starts at <code>(0,0)</code> and goes up to <code>(100,100)</... | <p>To obtain an <code>(x, y)</code> matrix of results by performing an <code>operation</code> on <code>(size_x, size_y)</code> slices of input arrays <code>res1</code> and <code>res2</code>, you can use a nested for loop and <code>numpy</code>:</p>
<pre class="lang-py prettyprint-override"><code>import numpy as np
def... | Enumerating regions of a two-dimensional array and interacting with them | python|arrays|algorithm|loops|slice | 0 | 55 | 1 | 72,389,235 | 72,389,235 | 1 | true | 2022-05-23T14:39:07.203Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Enumerating regions of a two-dimensional array and interacting with them<p>I have two two-dimensional arrays res1, res2 of size 1501x780.
I have to take slic... |
72,304,056 | Firebase Storage URL is FutureString<p>in my flutter app, the user picture is loaded by Cached Network image command, which gets its url by stream builder from firestore.</p>
<p>I am trying to add the functionality to the user of changing his pic by pressing on the pic as following:</p>
<ol>
<li>Selecting his pic with ... | <p>Like many calls in your code `` is an asynchronous call, whose result won't be available immediately, so it returns a <code>Future</code> that will at some point contain the value. You can use <code>await</code> to wait for such a <code>Future</code> to complete and get its value, similar to what you already do in <... | Firebase Storage URL is FutureString | flutter|firebase-storage | 0 | 55 | 1 | 72,305,113 | 72,305,113 | 1 | true | 2022-05-19T11:51:40.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firebase Storage URL is FutureString<p>in my flutter app, the user picture is loaded by Cached Network image command, which gets its url by stream builder fr... |
72,353,137 | How to deny action for Administrator user in AWS<p>I want deny "sqs:CreateQueue" permission to Administrator user in AWS. is that possible ?.
The user is having the below admin permission</p>
<blockquote>
<p>{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Al... | <p>The recommended way to restrict a user from being able to perform a particular action is to use a <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html" rel="nofollow noreferrer">permission boundary</a>.</p>
<p>Add a permission boundary for the user with the following content:</p>... | How to deny action for Administrator user in AWS | amazon-web-services|amazon-iam | 0 | 55 | 1 | 72,353,494 | 72,353,494 | 1 | true | 2022-05-23T18:16:29.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to deny action for Administrator user in AWS<p>I want deny "sqs:CreateQueue" permission to Administrator user in AWS. is that possible ?.
The u... |
72,272,309 | How can I reevaluate params of Snakemake rule in every run?<p>I have a toy Snakefile:</p>
<pre><code>rule DUMMY:
output: "foo.txt"
resources:
mem_mb=lambda wildcards, attempt: 1024 * 2 ** (attempt - 1)
params:
max_mem=lambda wildcards, resources: resources.mem_mb * 1024
shell:
... | <p>The <code>resources</code> directive by default will assume that a given resource is unlimited, so specifying an arbitrary resource and referring to it inside the <code>shell</code> is another solution:</p>
<pre class="lang-py prettyprint-override"><code>rule DUMMY:
output: "foo.txt"
resources:
... | How can I reevaluate params of Snakemake rule in every run? | python|snakemake | 1 | 55 | 2 | 72,329,942 | 72,329,942 | 1 | true | 2022-05-17T10:24:17.513Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I reevaluate params of Snakemake rule in every run?<p>I have a toy Snakefile:</p>
<pre><code>rule DUMMY:
output: "foo.txt"
resource... |
72,272,526 | Generate a specific number of rows in MySQL (without using a table)<p>How to generate a defined number of rows with an SQL query — without using a table (where these rows already exist) ?</p>
<p>For example, in order to return 3 rows, we could do this:</p>
<pre class="lang-sql prettyprint-override"><code>select * from ... | <p>You can use:</p>
<pre><code>WITH recursive numbers AS
( select 1 as Numbers
union all
select Numbers
from numbers
limit 1000
)
select * from numbers;
</code></pre>
<p>Change the limit as you need.</p>
<p>Another option is :</p>
<pre><code>WITH recursive numbers AS
( select 1 as Numbers
union all
... | Generate a specific number of rows in MySQL (without using a table) | mysql|sql|select|rows|data-generation | 0 | 55 | 1 | 72,272,723 | 72,272,723 | 1 | true | 2022-05-17T10:36:39.047Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Generate a specific number of rows in MySQL (without using a table)<p>How to generate a defined number of rows with an SQL query — without using a table (whe... |
72,298,038 | When I run my program I get the 'Segmentation fault 11' error. I'm not sure what in my code would cause this error<p>I understand that this error has to do with how much memory my program tries to use when I run it, but I'm new to C and I don't quite have a handle on memory management yet. If anyone wants to take the t... | <p>The first 3 of these are the main issues:</p>
<ol>
<li><code>main()</code>: allocate space for result.</li>
<li><code>getRandomHex()</code> assign to <code>result[i]</code> instead of using <code>strncat()</code> incorrectly.</li>
<li><code>getRandomHex()</code>: don't assume that <code>result</code> argument contai... | When I run my program I get the 'Segmentation fault 11' error. I'm not sure what in my code would cause this error | c|memory-management | 0 | 55 | 1 | 72,298,742 | 72,298,742 | 1 | true | 2022-05-19T02:39:48.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
When I run my program I get the 'Segmentation fault 11' error. I'm not sure what in my code would cause this error<p>I understand that this error has to do w... |
72,305,737 | How to test Docker container on another machine?<p>I wrote a simple script as follows:</p>
<pre><code>#main.py
def test_function():
val = input('please enter a number')
for i in range(int(val)):
print (i)
</code></pre>
<p>I dockerized it and put it in a container, and ran it from there. Everything is w... | <p>You need to install Docker on the other machine, and then push the image to a docker registry (e.g dockerhub / AWS ECR).</p>
<p>I use ECR. You need to create a registry and then tag your docker image with the url of the registry by running <code>docker tag <source image> <url of the registry></code>,
the... | How to test Docker container on another machine? | python|docker | 0 | 55 | 2 | 72,305,860 | 72,305,860 | 1 | true | 2022-05-19T13:46:59.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to test Docker container on another machine?<p>I wrote a simple script as follows:</p>
<pre><code>#main.py
def test_function():
val = input('please ... |
72,239,071 | How to I set a symbol inside the record separator of awk<p>How do I include symbols into the record separator of awk. I know the basic syntax like this:</p>
<pre><code>awk 'BEGIN{RS="[:.!]"}{if (tolower($0) ~ "$" ) print $0 }'
</code></pre>
<p>which will separate a single line into separate records ... | <p>You need to use a regex with an alternation operator (<code>|</code>) because the character you want to split with consists of three separate UTF8 code units: <code>E2</code>, <code>9C</code> and <code>85</code>.</p>
<p>You can use</p>
<pre class="lang-sh prettyprint-override"><code>awk 'BEGIN{RS="[:.!]|\xE2\x9... | How to I set a symbol inside the record separator of awk | awk|unicode|ascii|text-manipulation | 2 | 55 | 1 | 72,239,116 | 72,239,116 | 2 | true | 2022-05-14T09:49:51.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to I set a symbol inside the record separator of awk<p>How do I include symbols into the record separator of awk. I know the basic syntax like this:</p>
... |
72,266,284 | error: expected unqualified-id before ‘{’ token on Linux gcc<p>i get the following error message when trying to compile the following code on linux with gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) while it works on windows without problems.</p>
<pre><code>...
#include "DDImage/NoIop.h"
static const char* const... | <p>Simple example</p>
<pre class="lang-cpp prettyprint-override"><code>// -------------------- Header --------------------\\
class RemoveChannels
{
public:
int operation = 0;
};
int main ()
{
RemoveChannels r;
r.operation++;
}
</code></pre>
<p>when a line ends in a backslash, it is continued on the next line... | error: expected unqualified-id before ‘{’ token on Linux gcc | c++|gcc | 0 | 55 | 1 | 72,266,475 | 72,266,475 | 2 | true | 2022-05-16T22:30:39.483Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error: expected unqualified-id before ‘{’ token on Linux gcc<p>i get the following error message when trying to compile the following code on linux with gcc ... |
72,278,352 | Problem with connecting (ssh) to an AWS EC2 instance<pre><code>AWSTemplateFormatVersion: "2010-09-09"
Parameters:
VPCCIDR:
Type: String
Default: 10.1.0.0/16
PrivateSubnetCIDR:
Type: String
Default: 10.1.1.0/24
PublicSubnetCIDR:
Type: String
Default: 10.1.2.0/24
Resources:
... | <p>Everything is fine except that you <strong>constrained</strong> your <code>JumpBoxEC2Instance</code> to be accessed only from <code>62.162.179.210/32</code>. This is probably not your real address, even if you may think it is. If you double check your IP, or change the SG as shown below, it should work:</p>
<pre><co... | Problem with connecting (ssh) to an AWS EC2 instance | amazon-web-services|amazon-ec2|ssh|yaml|git-bash | 1 | 55 | 1 | 72,282,418 | 72,282,418 | 2 | true | 2022-05-17T17:29:07.353Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem with connecting (ssh) to an AWS EC2 instance<pre><code>AWSTemplateFormatVersion: "2010-09-09"
Parameters:
VPCCIDR:
Type: String
... |
72,283,440 | when i try to enter decimal numbers like 0.5 infields given it is instantly changing to .5 in oracle forms<p><a href="https://i.stack.imgur.com/w0uUI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w0uUI.png" alt="enter image description here" /></a></p>
<p>If I enter values as 0.5 the zero before .... | <p>Open item's Property Palette and set <strong>Format mask</strong> to desired value. For example:</p>
<p><a href="https://i.stack.imgur.com/9bMb4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9bMb4.png" alt="enter image description here" /></a></p> | when i try to enter decimal numbers like 0.5 infields given it is instantly changing to .5 in oracle forms | oracle|oracleforms | -1 | 55 | 2 | 72,283,508 | 72,283,508 | 2 | true | 2022-05-18T05:02:52.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
when i try to enter decimal numbers like 0.5 infields given it is instantly changing to .5 in oracle forms<p><a href="https://i.stack.imgur.com/w0uUI.png" re... |
72,286,412 | Processing of HTTP status codes<p>I am creating forms in Orbeon 2021.1.2 PE and I have a problem with handling error calls. I'm creating HTTP service and Action via form builder. I hope to work it out and be able to stay with Builder.
I call API witch works similarly to Twitter, so it returns Error HTTP Status Codes al... | <p>Writing your own XForms will give you the most flexibility. You can put that XForms either directly in the form definition, using Edit Source in Form Builder, or in a custom model, which is a file on disk on the server, which I would recommend, see <a href="https://doc.orbeon.com/form-runner/advanced/custom" rel="no... | Processing of HTTP status codes | orbeon | 1 | 55 | 2 | 72,294,535 | 72,294,535 | 2 | true | 2022-05-18T09:19:08.077Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Processing of HTTP status codes<p>I am creating forms in Orbeon 2021.1.2 PE and I have a problem with handling error calls. I'm creating HTTP service and Act... |
72,303,553 | Replace values across time series columns based on another column<p>My question is similar to another one: <a href="https://stackoverflow.com/questions/69422463/r-replace-specific-value-in-many-columns-across-dataframe">R replace specific value in many columns across dataframe</a></p>
<p>However I need to replace value... | <p>Using <code>ifelse</code> instead of <code>replace</code> should solve your problem.</p>
<pre><code>library(dplyr)
df %>%
mutate(across(starts_with('yr'), ~ifelse(.x=="missing", right, .x)))
# yr1 yr2 right
#1 1 3 2
#2 3 4 3
</code></pre>
<p>In general, I would suggest to use <code>... | Replace values across time series columns based on another column | r|dplyr|replace | 1 | 55 | 2 | 72,303,636 | 72,303,636 | 2 | true | 2022-05-19T11:15:56.357Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Replace values across time series columns based on another column<p>My question is similar to another one: <a href="https://stackoverflow.com/questions/69422... |
72,306,843 | TypeScript Template literals Array Join<p>I found a definition for a type level <a href="https://www.typescriptlang.org/play?ts=4.1.0-dev.20201028&ssl=1&ssc=1&pln=2&pc=1#code/PTAEBUFMFsAcBsCGAXSp4EtUCdHwM6gDGiAdqAEZoCu+kAJqMgPaiQAeyuRyoZj0MhljUkqUPi4ZSAc3RZIueEwCesSPgB0AWABQICAAsNaSdmlzMOPKvX4ANKGlNq2Uo... | <p>Sure there is:</p>
<pre><code>type Stringable = string | number | bigint | boolean | null | undefined;
type Join<A, Sep extends string = ""> = A extends [infer First, ...infer Rest] ? Rest extends [] ? `${First & Stringable}` : `${First & Stringable}${Sep}${Join<Rest, Sep>}` : "&q... | TypeScript Template literals Array Join | typescript|type-level-computation | 1 | 55 | 1 | 72,306,971 | 72,306,971 | 2 | true | 2022-05-19T14:58:26.647Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeScript Template literals Array Join<p>I found a definition for a type level <a href="https://www.typescriptlang.org/play?ts=4.1.0-dev.20201028&ssl=1&... |
72,328,903 | CSS not applying to footer <p> element<p>I am having some trouble understanding why <code>margin: 1rem</code> is not applying to my footer element. When I modify the size, only the text content in the <code><p></code> for the <code>article</code> div and <code>aside</code> element are modified. There is no margin... | <p>The <code>margin</code> is applied - your problem is just that you have declared a 10px <code>border</code> without declaring a <code>border-style</code>, so essentially it looks like the <code>p</code>-element's <code>margin</code> is overflowing, because there is an invisible <code>border</code> of 10px. Apply a <... | CSS not applying to footer <p> element | html|css | 2 | 55 | 4 | 72,328,961 | 72,328,961 | 2 | true | 2022-05-21T10:55:57.270Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS not applying to footer <p> element<p>I am having some trouble understanding why <code>margin: 1rem</code> is not applying to my footer element. When I mo... |
72,333,014 | web scraping returns list of None<pre><code>import requests
from bs4 import BeautifulSoup
import csv
from itertools import zip_longest
job_title = []
company_name = []
location_name = []
job_skill = []
links = []
salary = []
result = requests.get("https://wuzzuf.net/search/jobs/?q=python%5C&a=hpb")
sou... | <p>The salary data is dynamically generated, if you check the source code/Page source (ctrl+U on chrome) of the job post you can see that the data is not in the HTML element. But it can be found under <code><script></code> tag inside <code>Wuzzuf.initialStoreState</code> object</p>
<p><a href="https://i.stack.img... | web scraping returns list of None | python|web-scraping | 3 | 55 | 1 | 72,335,392 | 72,335,392 | 2 | true | 2022-05-21T20:28:58.773Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
web scraping returns list of None<pre><code>import requests
from bs4 import BeautifulSoup
import csv
from itertools import zip_longest
job_title = []
compan... |
72,339,994 | Kotlin - output type from type parameter<p>I am parsing multiple CSV files and would like to provide my application with some generic parsers with logging capabilities. Is it possible to give some generic solution for it?</p>
<p>My try to do that is:</p>
<pre><code>
interface Converter<out T> {
fun convert(fi... | <p>Your solution is almost correct one. The only problem is that the compiler is not smart enough to understand that you verified the type of <code>T</code> and you return the right type of the converter. You just need to cast the converter to <code>T</code>:</p>
<pre class="lang-kotlin prettyprint-override"><code>retu... | Kotlin - output type from type parameter | kotlin|generics|jvm | 0 | 55 | 1 | 72,340,551 | 72,340,551 | 2 | true | 2022-05-22T17:48:54.823Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kotlin - output type from type parameter<p>I am parsing multiple CSV files and would like to provide my application with some generic parsers with logging ca... |
72,349,563 | Clojure sending data with nested vector to function and use the items<p>First, I'm sorry if my question is something simple or not clear. I'm almost new to Clojure and I need help.</p>
<p>I want to create a function to generate some HTML link for a menu. This is what I have now and it works fin:</p>
<pre><code>(defn te... | <p>You can use <a href="https://cljs.github.io/api/cljs.core/for" rel="nofollow noreferrer"><code>for</code></a>, then <a href="https://clojure.org/guides/destructuring" rel="nofollow noreferrer">destructure</a> each element into <code>id</code> and <code>name</code> (I just renamed <code>name</code> to <code>li-name</... | Clojure sending data with nested vector to function and use the items | clojure | 1 | 55 | 1 | 72,350,342 | 72,350,342 | 2 | true | 2022-05-23T13:39:31.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Clojure sending data with nested vector to function and use the items<p>First, I'm sorry if my question is something simple or not clear. I'm almost new to C... |
72,355,272 | Print available and show missing items from two dictionaries<p>I have a dictionary containing my available food in my fridge and I want to print the recipes I can make but also the ones that I could make if I had enough items (showing the number of items missing) and also print the ones that have an ingredient missing ... | <p>You can use this example how to find missing items from the fridge:</p>
<pre class="lang-py prettyprint-override"><code>fridge = {
"orange": 5,
"citron": 3,
"sel": 100,
"sucre": 50,
"farine": 250,
"tomates": 6,
"huile":... | Print available and show missing items from two dictionaries | python|loops|dictionary|key|items | 1 | 55 | 2 | 72,355,428 | 72,355,428 | 2 | true | 2022-05-23T22:07:58.780Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print available and show missing items from two dictionaries<p>I have a dictionary containing my available food in my fridge and I want to print the recipes ... |
72,368,251 | Why is StreamWriter adding random bytes to a file?<p>I'm trying to translate a virtual key code with ToAsciiEx() and write it to a debug file. For some reason, the output file contains a load of random trash bytes interspersed with the key codes I want to log.</p>
<p>I'm importing ToAsciiEx() like this:</p>
<pre><code>... | <p>The return value from <code>ToAsciiEx</code> <a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-toasciiex#return-value" rel="nofollow noreferrer">tells you how many characters were copied to the output</a>, but you never use that information to trim the <code>StringBuilder</code>.</p>
<p>... | Why is StreamWriter adding random bytes to a file? | c# | 0 | 55 | 1 | 72,368,373 | 72,368,373 | 2 | true | 2022-05-24T19:08:46.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is StreamWriter adding random bytes to a file?<p>I'm trying to translate a virtual key code with ToAsciiEx() and write it to a debug file. For some reaso... |
72,368,086 | Google App Script - Export Active Sheet Without Sheet Name<p>I am using the script below to export a sheet as Excel file but the output file name is always Document Name + Sheet Name ("Exported - Report.xlsx"). How can I modify this to only use the sheet name as file name of the exported file ("Report.xl... | <p>In your situation, unfortunately, using the URL of <code>ShtURL.toString().replace("/edit", "/export?format=xlsx&gid=" + ShtGID)</code>, the filename cannot be directly changed. So, in this case, how about the following modification?</p>
<h3>Modified script:</h3>
<pre class="lang-js prettypri... | Google App Script - Export Active Sheet Without Sheet Name | javascript|google-apps-script|google-sheets | 1 | 55 | 1 | 72,370,367 | 72,370,367 | 2 | true | 2022-05-24T18:53:10.487Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google App Script - Export Active Sheet Without Sheet Name<p>I am using the script below to export a sheet as Excel file but the output file name is always D... |
72,382,995 | Powershell: Using Invoke-WebRequest, How To Use Variable Within JSON?<p>Using Powershell, I'm trying to PUT data into an API, but I'm having trouble using a variable within the JSON:</p>
<p>This code below does not generate an error from the API, but it PUTS the <code>singer</code> as, literally, "$var_currentsing... | <p>JSON requires double-quotes, so one example way to handle is by escaping the quotes or with a double-quoted here-string:</p>
<pre><code># here-string
$json = @"
"singer": $currentsinger,
"songwriter": "Etta James"
"@
# escaped
$json = "
`"singer`": $curre... | Powershell: Using Invoke-WebRequest, How To Use Variable Within JSON? | json|powershell | 0 | 55 | 1 | 72,392,824 | 72,392,824 | 2 | true | 2022-05-25T19:09:52.860Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Powershell: Using Invoke-WebRequest, How To Use Variable Within JSON?<p>Using Powershell, I'm trying to PUT data into an API, but I'm having trouble using a ... |
72,392,670 | How to get First element from a map that includes something?<p>I am trying to select the first path directory from the api that includes an Image so I can set the value to the Image source and display the first image but when i use fl[0] i get all values</p>
<p>here is the code :</p>
<pre><code>{useLesson &&
... | <p>You could create a new component to show the first file</p>
<pre class="lang-js prettyprint-override"><code>const FilePreview = ({ mimetype, files, basepath }) => {
const firstFileOfType = files.find((file) =>
file.mimetype.includes(mimetype)
);
if (!firstFileOfType) return null;
return (
<... | How to get First element from a map that includes something? | javascript|reactjs | 1 | 55 | 1 | 72,392,963 | 72,392,963 | 2 | true | 2022-05-26T13:33:03.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get First element from a map that includes something?<p>I am trying to select the first path directory from the api that includes an Image so I can se... |
72,401,552 | Change value in a column if a criterion is meet and use value from another column<p>I would like to replace the values in the column called Expenses with the value of the column Average Expenses if the value in column Expenses is zero or negative.</p>
<p>This is my data:</p>
<pre><code>structure(list(Product = c("... | <p>You need to index the return variable within your <code>replace</code> statement to tell it that you want those values returned WHEN the condition is satisfied. If you omit that, you get the warnings that say that it is trying to return more values for each entry (instead of just one that would be the one matching t... | Change value in a column if a criterion is meet and use value from another column | r|dplyr|replace|warnings | 0 | 55 | 4 | 72,401,662 | 72,401,662 | 2 | true | 2022-05-27T06:54:32.783Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change value in a column if a criterion is meet and use value from another column<p>I would like to replace the values in the column called Expenses with the... |
72,370,379 | Pydrake: how to get a single sine wave out of sine.get_output_port(0).Eval(sine_context)? (currently generates 3 waves)<p>| drake 0.38.0 | python 3.7 | OS: ubuntu 20.04 | pycharm |</p>
<p>I want to use a sine wave (amplitude: 0.01, f: 2) as the joint torque input for the base of a kuka iiwa simulated robot. (i.e. I jus... | <p>The plot looks correct. When you sample sin(x) every 2 radians, that's what it should look like:</p>
<pre class="lang-py prettyprint-override"><code>import matplotlib.pyplot as plt
from math import sin
amplitude = 0.01
frequency = 2.0
t = list(range(0, 50))
y = [amplitude * sin(frequency * x) for x in t]
plt.plot(... | Pydrake: how to get a single sine wave out of sine.get_output_port(0).Eval(sine_context)? (currently generates 3 waves) | python|drake | 2 | 55 | 2 | 72,381,469 | 72,381,469 | 2 | true | 2022-05-24T23:11:59.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pydrake: how to get a single sine wave out of sine.get_output_port(0).Eval(sine_context)? (currently generates 3 waves)<p>| drake 0.38.0 | python 3.7 | OS: u... |
72,386,679 | How to replace jquery variable values with php array values<p>I am working with php and i want to change value of dropdown using jquery, i want to pass php array into jquery variable(make dynamic dropdown value)
Right now i am getting array($data) in following format</p>
<pre><code>Array
(
[0] => stdClass Object... | <pre><code>var newOptions = <?php echo json_encode($array); ?>;
</code></pre>
<p>and then change your append line to this and you are good to go</p>
<pre><code>$el.append('<option value="'+ value.UserId +'">'+ value.name +'</option>');
</code></pre>
<p>Working snippet:</p>
<p><div class="sni... | How to replace jquery variable values with php array values | javascript|php|jquery|arrays | 3 | 55 | 2 | 72,386,751 | 72,386,751 | 2 | true | 2022-05-26T04:25:57.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to replace jquery variable values with php array values<p>I am working with php and i want to change value of dropdown using jquery, i want to pass php a... |
72,271,248 | Map to a Trans capacity request from transit(Nodal) points using pandas dataframes<h1>Input Dataframe With TerminalID,TName,XY cordinate, PeopleID</h1>
<pre><code>import pandas as pd
data = {
'TerminalID': ['5','21','21','2','21','2','5','22','22','22','2','32','41','41','42','50','50'],
'TName': ['AD'... | <p>My solution aggreagte join per <code>TerminalID</code> and <code>TName</code> and assign to another DataFrame by aggreagte list, last filter values by positions in list comprehension with <code>join</code>:</p>
<pre><code>s = df.groupby(['TerminalID','TName'])['Pcode'].agg(list).rename('P_list')
df = df2.join(s, on=... | Map to a Trans capacity request from transit(Nodal) points using pandas dataframes | python-3.x|pandas|group-by|mapping|operations-research | 2 | 55 | 2 | 72,271,325 | 72,271,325 | 2 | true | 2022-05-17T09:10:31.533Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Map to a Trans capacity request from transit(Nodal) points using pandas dataframes<h1>Input Dataframe With TerminalID,TName,XY cordinate, PeopleID</h1>
<pre>... |
72,326,710 | Promote nested array of struct by multi level for XML decoding<p>I have a struct with nested array of struct in format below, I have promoted News struct which is in struct array <strong>URL</strong></p>
<p><strong>My RSS Feed is</strong> : <a href="https://foreignpolicy.com/feed/" rel="nofollow noreferrer">https://for... | <p>You can do</p>
<pre class="lang-golang prettyprint-override"><code>URL []struct { News } `xml:"channel>item"`
</code></pre>
<p>and remove the <code>channel>item</code> from the <code>Loc</code>'s tag.</p>
<hr />
<p>The embedding of the <code>News</code> type in <code>[]struct{ }</code> seems superflu... | Promote nested array of struct by multi level for XML decoding | xml|go|struct | 1 | 55 | 1 | 72,328,224 | 72,328,224 | 2 | true | 2022-05-21T04:39:12.870Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Promote nested array of struct by multi level for XML decoding<p>I have a struct with nested array of struct in format below, I have promoted News struct whi... |
72,284,661 | MongoDB - query to get items that match key in first item of sort in aggregate<p>We have the following records in a collection:</p>
<pre><code>{ "_id" : ObjectId("1"), "date" : ISODate("2017-02-01T00:00:00Z") }
{ "_id" : ObjectId("2"), "date" : ISODa... | <ol>
<li><p><code>$group</code> - Group by the first day of the month year from <code>date</code> and add documents into <code>data</code> array.</p>
</li>
<li><p><code>$sort</code> - Sort by <code>_id</code> DESC.</p>
</li>
<li><p><code>$skip</code></p>
</li>
<li><p><code>$limit</code> - Take the first document from t... | MongoDB - query to get items that match key in first item of sort in aggregate | javascript|node.js|mongodb | 3 | 55 | 3 | 72,285,058 | 72,285,058 | 2 | true | 2022-05-18T07:14:15.233Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MongoDB - query to get items that match key in first item of sort in aggregate<p>We have the following records in a collection:</p>
<pre><code>{ "_id&qu... |
72,329,585 | UseContext Get Data from API Returns null<p>I am trying to get data from the user but it always returns null, the problem here that the return function runs first so the getUser is null how can i render the useEffect before it returns the provider ?</p>
<p>Here is my code :</p>
<pre><code>import React, { useState, useE... | <p>You can do this outside of the context, in the root of the same file:</p>
<p><code>const userPromise = axios.post("/check",{}, { withCredentials: true })</code></p>
<p>Then in useEffect do</p>
<pre class="lang-js prettyprint-override"><code>useEffect(async () => {
try {
const { data } = await ... | UseContext Get Data from API Returns null | reactjs | 1 | 55 | 1 | 72,329,625 | 72,329,625 | 2 | true | 2022-05-21T12:33:34.363Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
UseContext Get Data from API Returns null<p>I am trying to get data from the user but it always returns null, the problem here that the return function runs ... |
72,353,825 | Sum Values Based on Specific Value in a Column Within Group<p>I have a sequential dataset where I need to sum values by distinct groups, which are already parsed. Every time a 1 appears in the <code>Distinct Group</code> column, I want to start the sum again.</p>
<p>Thanks so much in advance!! :)</p>
<p>Original Table:... | <p>The idea is to use windowed SUM to generate subgrp column and then use aggregate SUM to per Name, and subgrp.</p>
<pre><code>Name | Val | Distinct_Group | subgrp
A | 1 | 1 | 1
A | 2 | 0 | 1
A | 3 | 0 | 1
B | 4 | 1 | 2
C | 5 | 1 ... | Sum Values Based on Specific Value in a Column Within Group | sql|snowflake-cloud-data-platform|window-functions | 0 | 55 | 1 | 72,353,907 | 72,353,907 | 2 | true | 2022-05-23T19:22:36.753Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sum Values Based on Specific Value in a Column Within Group<p>I have a sequential dataset where I need to sum values by distinct groups, which are already pa... |
72,338,745 | Test is not executed when pytest.fixture is used<p>I have a simple Python library, for which I use the following command to run tests:</p>
<p><code>python setup.py pytest</code></p>
<p>The following test works as expected:</p>
<pre><code>def test_out():
assert 1 == 2
</code></pre>
<p>Test result:</p>
<pre><code>pla... | <p>First of all, <code>pytest.fixture</code> is a decorator, so it is affecting the function below, and the right way to use it is to put them together (no empty lines in between), like this:</p>
<pre class="lang-py prettyprint-override"><code>import pytest
@pytest.fixture
def test_out():
assert 1 == 2 # This st... | Test is not executed when pytest.fixture is used | python|pytest | 2 | 55 | 1 | 72,338,791 | 72,338,791 | 2 | true | 2022-05-22T15:04:11.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Test is not executed when pytest.fixture is used<p>I have a simple Python library, for which I use the following command to run tests:</p>
<p><code>python se... |
72,340,397 | Type safety in C# using custom ValueType<p>In my code I have variables of type <strong>System.Double that either represent a quantity or a quantityDifference</strong>. In order to make my code safer, I would like to pass in a value of either <strong>type Quantity or QuantityDelta rather than double</strong> (to avoid p... | <p>Use the <a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" rel="nofollow noreferrer">implicit operator</a>.</p>
<pre><code>public struct Quantity
{
private readonly double value;
public Quantity(double value) { this.value = value; }
pu... | Type safety in C# using custom ValueType | c# | 1 | 55 | 3 | 72,340,483 | 72,340,483 | 2 | true | 2022-05-22T18:43:01.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Type safety in C# using custom ValueType<p>In my code I have variables of type <strong>System.Double that either represent a quantity or a quantityDifference... |
72,361,970 | Perl `send` pitfall with "connected" UDP `IO::Socket::INET`, ignoring destination address?<p>I'm debugging some odd issue when a packet sent via an INET UDP socket is <strong>not</strong> sent to the given destination address.</p>
<p>The documentation (<code>perldoc -f send</code>) says:</p>
<blockquote>
<p>On unconnec... | <p>See your system's man pages for details on systems calls such as <code>connect</code> and <code>send</code>.</p>
<p><a href="https://pubs.opengroup.org/onlinepubs/009695399/functions/connect.html" rel="nofollow noreferrer">On POSIX systems</a>, <code>connect</code> says</p>
<blockquote>
<p>For <code>SOCK_DGRAM</code... | Perl `send` pitfall with "connected" UDP `IO::Socket::INET`, ignoring destination address? | perl|sockets|udp|connection | 1 | 55 | 1 | 72,365,647 | 72,365,647 | 2 | true | 2022-05-24T11:20:31.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Perl `send` pitfall with "connected" UDP `IO::Socket::INET`, ignoring destination address?<p>I'm debugging some odd issue when a packet sent via an INET UDP ... |
72,379,938 | Chain of RxJava calls<p>I am new to RxJava. I am struggling with chaining multiple API calls. The class structures are as follows:</p>
<pre><code>Location(location_id, location_name)
Hub(hub_id, hub_name, location_id)
Room(device_id, room_id, room_name)
</code></pre>
<p>LocationList is defined as</p>
<pre><code>Locatio... | <p>You would need to use few RxJava operators in order to accomplish it, you can nest them in order to keep track of the values that you will need in order to create the HubItem</p>
<pre><code> val hubItems: Single<List<HubItem>> = Observable.fromIterable(locations)
.flatMap { location ->
... | Chain of RxJava calls | android|kotlin|rx-java|rx-java2|rx-kotlin2 | 0 | 55 | 1 | 72,386,259 | 72,386,259 | 2 | true | 2022-05-25T14:55:55.447Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chain of RxJava calls<p>I am new to RxJava. I am struggling with chaining multiple API calls. The class structures are as follows:</p>
<pre><code>Location(lo... |
72,328,292 | cmake, scribus - List all required libraries<p>I'm trying to build Scribus (1.5.8 and 1.7) from source in Ubuntu 20.04. It uses cmake as its build system. I have no experience with cmake.</p>
<p><strong>Is there a way to get a list of all the required and/or optional libraries from cmake or any command line tool?</stro... | <blockquote>
<p>Is there a way to get a list of all the required and/or optional libraries from cmake or any command line tool?</p>
</blockquote>
<p>Not in an automated way. Generally that is not possible. There may be dependencies not managed by CMake, outside of CMake code, there may be dependencies of dependencies, ... | cmake, scribus - List all required libraries | c++|cmake|build|dependencies|scribus | 0 | 55 | 1 | 72,328,812 | 72,328,812 | 2 | true | 2022-05-21T09:30:41.017Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
cmake, scribus - List all required libraries<p>I'm trying to build Scribus (1.5.8 and 1.7) from source in Ubuntu 20.04. It uses cmake as its build system. I ... |
72,317,889 | mysys downloaded wrong sfml libaries, is it possible?<p>So i am really new to windows environment and i am trying to understand how to work with c++ libraries and cMake.
My first goal was to convert a linux project that I was developping in linux to windows by changing cMake and downloading mysys to download packages. ... | <p>This line is wrong:</p>
<blockquote>
<pre><code>add_executable(Pong main.cpp ${SFML_LIBRARIES})
</code></pre>
</blockquote>
<p>First of all, the SFML <em>libraries</em> are not <em>source files</em> for <code>Pong</code>. So you probably meant to write:</p>
<pre><code>add_executable(Pong main.cpp)
target_link_librar... | mysys downloaded wrong sfml libaries, is it possible? | c++|windows|cmake|sfml|msys2 | 1 | 55 | 1 | 72,321,440 | 72,321,440 | 2 | true | 2022-05-20T11:04:41.750Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
mysys downloaded wrong sfml libaries, is it possible?<p>So i am really new to windows environment and i am trying to understand how to work with c++ librarie... |
72,351,446 | how do I generate random group names using lists<p>I can not figure out my mistake. Can someone help me?</p>
<p>We are supposed to create the lists outside of the function. then create an empty list inside a function. We should return 9 different names.</p>
<pre><code> first_names = ["Gabriel", "Reinh... | <p>The problem is that you're using a variable <code>full_name</code> twice: once as a string to store a new name in, and once as the list. This is closer to what you want:</p>
<pre><code> import random
first_names = ["Gabriel", "Reinhard", "Siebren"]
last_names = ["Colom... | how do I generate random group names using lists | python|list|random | -1 | 55 | 2 | 72,351,494 | 72,351,494 | 2 | true | 2022-05-23T15:51:34.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do I generate random group names using lists<p>I can not figure out my mistake. Can someone help me?</p>
<p>We are supposed to create the lists outside o... |
72,314,802 | Tensor split to dynamic length tensors based on continuous mask values in tensorflow?<p>I'm trying to figure out how to split my tensor of sequential data into multiple parts based on partitioning continuous masks with value of binary number '1'.</p>
<p>I've read the official documentation.
Howerver I can't find any fu... | <p>I recently discovered a method to do it in a very clean way in <a href="https://stackoverflow.com/a/72258918/2246849">this answer</a> by @AloneTogether:</p>
<pre><code>import tensorflow as tf
data_tensor = tf.constant([3,5,6,2,6,1,3,9,5])
mask_tensor = tf.constant([0,1,1,1,0,0,1,1,0])
# Index where the mask change... | Tensor split to dynamic length tensors based on continuous mask values in tensorflow? | python|tensorflow | 2 | 55 | 1 | 72,315,371 | 72,315,371 | 2 | true | 2022-05-20T06:59:55.993Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tensor split to dynamic length tensors based on continuous mask values in tensorflow?<p>I'm trying to figure out how to split my tensor of sequential data in... |
72,257,591 | How to do conditional merge Pandas<p>I have two different dataframes shown below.</p>
<p>This is the <code>tel_times</code> dataframe</p>
<p><a href="https://i.stack.imgur.com/mU8uL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mU8uL.png" alt="enter image description here" /></a></p>
<p>And this is... | <p>I believe what you want is:</p>
<pre><code>maint_tel_comp1 = tel_times.merge(maint_comp1, on='machineID', how='inner')
maint_tel_comp1[maint_tel_comp1['datetime_tel'].gt(maint_tel_comp1['datetime_maint'])]
</code></pre>
<p>The problem is your merge was also ensuring <code>datetime_tel == datetime_maint</code>, hence... | How to do conditional merge Pandas | python|python-3.x|pandas|pyspark | 2 | 55 | 1 | 72,258,261 | 72,258,261 | 3 | true | 2022-05-16T10:15:41.983Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do conditional merge Pandas<p>I have two different dataframes shown below.</p>
<p>This is the <code>tel_times</code> dataframe</p>
<p><a href="https:/... |
72,282,332 | Converting string time to find difference in time from Time.now ~ Ruby on Rails<p>I have the time of this format "20:10 PM", I need to find the difference between <code>Time.now</code> with the given time</p>
<p>For example If <code>Time.now</code> says <code>2022-05-17 18:32:52.133290553 -0700</code>, I need... | <p>Very simple way:</p>
<pre><code>>> Time.now - Time.parse("20:10 PM")
=> 10995.706874
</code></pre>
<p><code>Time.parse</code> will assume today's date if it is not given a date. Returned result is in seconds.</p> | Converting string time to find difference in time from Time.now ~ Ruby on Rails | ruby-on-rails|ruby | 1 | 55 | 2 | 72,282,822 | 72,282,822 | 3 | true | 2022-05-18T01:34:41.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Converting string time to find difference in time from Time.now ~ Ruby on Rails<p>I have the time of this format "20:10 PM", I need to find the dif... |
72,302,630 | Remove duplicated values from multi array<p>How do I remove all values that are duplicated? So only nondublicated values are left.</p>
<pre><code>const sample = [["08:00",true,],["09:00",true,],["09:00",false,], ["10:00",true,]]
const newArray = [["08:00", true,], [&qu... | <p>Try this <strong>:</strong></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>const sample = [["08:00",true,],["09:00",true,],["09:00",false,], ["10:00",true,]];
const flatAr... | Remove duplicated values from multi array | javascript|arrays | 0 | 55 | 2 | 72,302,765 | 72,302,765 | 3 | true | 2022-05-19T10:07:06.697Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Remove duplicated values from multi array<p>How do I remove all values that are duplicated? So only nondublicated values are left.</p>
<pre><code>const sampl... |
72,362,391 | How can I force an error in code without stoping the execution in quarto?<p>I'm creating a document for students using quarto.
One of the things I want to teach is how to read and understand error messages, so I was planning in creating wrong code blocks to force certain error messages (like the one below):</p>
<pre cl... | <p>The following works for me:</p>
<pre><code>---
title: test-error
---
```{python}
#| error: true
a_list = [1,2,"a"]
a_list[3]
```
</code></pre>
<p>It produces the following output:</p>
<p><a href="https://i.stack.imgur.com/xrBEE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xrBEE.p... | How can I force an error in code without stoping the execution in quarto? | quarto | 1 | 55 | 1 | 72,369,933 | 72,369,933 | 3 | true | 2022-05-24T11:50:03.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I force an error in code without stoping the execution in quarto?<p>I'm creating a document for students using quarto.
One of the things I want to te... |
72,380,380 | Fit iText 7 Table to Single Page with Images using JPype<p>I am attempting to fit all the content of a table to a single A4 PDF.</p>
<p>I found another SO article linked to the itextpdf page <a href="https://kb.itextpdf.com/home/it7kb/faq/how-to-resize-a-pdfptable-to-fit-the-page" rel="nofollow noreferrer">here</a> on ... | <p>Suppose that this is the table to be fully fit into an A4 page:</p>
<pre><code> Table table = new Table(2);
for (int i = 0; i < 100; i++) {
table.addCell(new Cell().add(new Paragraph(i + " Hello")));
table.addCell(new Cell().add(new Paragraph(i + " World")));
}
</cod... | Fit iText 7 Table to Single Page with Images using JPype | java|python-3.x|itext|pdf-generation|jpype | 0 | 55 | 1 | 72,385,258 | 72,385,258 | 3 | true | 2022-05-25T15:24:03.897Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fit iText 7 Table to Single Page with Images using JPype<p>I am attempting to fit all the content of a table to a single A4 PDF.</p>
<p>I found another SO ar... |
72,330,428 | How can I let one element do two events at the same time<p>so, I'm having a game, and I want the user to reset the score when he clicks the button, and reset boundaries when he hovers over it.
How can I do it so that he can both, hover and click</p>
<pre><code>function reset_bounderies() {
let start = document.ge... | <p>You can add two differents <code>EventListener</code> to your button</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>function functionOne(){
console.log("functionOne")
}
... | How can I let one element do two events at the same time | javascript | -2 | 55 | 1 | 72,330,442 | 72,330,442 | 3 | true | 2022-05-21T14:22:57.710Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I let one element do two events at the same time<p>so, I'm having a game, and I want the user to reset the score when he clicks the button, and reset... |
72,294,818 | Get a running count of group over time in r<p>Ok so we have some pretty standard data that looks like this with a date and user id column, but the id can occur multiple times in a day:</p>
<pre><code>id Date
as7fyaisdf 2017-11-08
p98ashdfp9 2017-11-08
p98ashdfp9 2017-11-08
p98ashdfp9 ... | <p>You could group by <code>id</code> and get the <code>row_number</code>:</p>
<pre><code>library(tidyverse)
df %>%
left_join(distinct(.) %>%
group_by(id) %>%
mutate(running_count = row_number()))
id Date running_count
1 as7fyaisdf 2017-11-08 1
2 p98ashdfp9 2017-11-08 ... | Get a running count of group over time in r | r|dplyr|data.table|tidyverse|tidyr | 0 | 55 | 2 | 72,294,868 | 72,294,868 | 3 | true | 2022-05-18T19:16:49.153Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get a running count of group over time in r<p>Ok so we have some pretty standard data that looks like this with a date and user id column, but the id can occ... |
72,250,075 | Pandas foward fill in between - same values<p>I am trying to do the following:</p>
<p>Supposing I have the following column on pandas, where there will be always two values that are equal in sequence.</p>
<pre><code>l = [np.nan, np.nan, 10, np.nan, np.nan, np.nan, 10, np.nan, 4, np.nan, 4, 5, np.nan, 5, np.nan, 2, np.... | <h3>Solution with <code>ffill</code> and <code>bfill</code></h3>
<pre><code>f = df['col'].ffill()
b = df['col'].bfill()
df['col'].mask(f == b, f)
</code></pre>
<hr />
<pre><code>0 NaN
1 NaN
2 10.0
3 10.0
4 10.0
5 10.0
6 10.0
7 NaN
8 4.0
9 4.0
10 4.0
11 5.0
12 5.... | Pandas foward fill in between - same values | pandas|numpy | 4 | 55 | 2 | 72,250,196 | 72,250,196 | 4 | true | 2022-05-15T16:18:13.037Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas foward fill in between - same values<p>I am trying to do the following:</p>
<p>Supposing I have the following column on pandas, where there will be al... |
72,345,302 | save Jalali(Hijri shamsi) datetime in database in django<p>I have a Django project, and I want to save created_at datetime in the database. I generate datetime.now with jdatetime (or Khayyam) python package and try to save this in DateTimeField. But sometimes it raises error because the Gregorian(miladi) date of the en... | <p>In my idea, you can save two model fields.
One is DateTimeField contains gregorian datetime, and
another one, CharField contains converted Jalali to a String value and save it.
The DateTimeField for functionality, e.g., filter between to datetime.
The StringField for representing in response(without overload).</p> | save Jalali(Hijri shamsi) datetime in database in django | python|django|django-models|hijri|jalali-calendar | 4 | 55 | 1 | 72,345,305 | 72,345,305 | 4 | true | 2022-05-23T08:18:01.190Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
save Jalali(Hijri shamsi) datetime in database in django<p>I have a Django project, and I want to save created_at datetime in the database. I generate dateti... |
72,350,956 | Displaying percentages within category for continuous/ordered variable (with ggplot)<p>I have two questions, the first a (hopefully) straightforward mechanical one and the second more theoretical (though still with a technical element).</p>
<ol>
<li><p>I am trying to do something nearly identical to <a href="https://st... | <p>How about this:</p>
<pre class="lang-r prettyprint-override"><code> library(tidyverse)
set.seed(123)
d <- data.frame(
race = sample(c("White", "Hispanic", "Black", "Other"), 100, replace = TRUE),
question1 = sample(0:4, 100, replace = TRUE),
question2 = sample(0:4, 1... | Displaying percentages within category for continuous/ordered variable (with ggplot) | r|ggplot2|facet-wrap|geom-col | 1 | 55 | 2 | 72,351,235 | 72,351,235 | 4 | true | 2022-05-23T15:17:28.433Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Displaying percentages within category for continuous/ordered variable (with ggplot)<p>I have two questions, the first a (hopefully) straightforward mechanic... |
72,359,438 | Save Python dictionary to the JSON format (adding names)<p>I filtered and processed some data and I got it in the following format:</p>
<pre><code>{'2020-04-20': [('EUR', 34.02), ('USD', 30.18), ('AWG', 24.44), ('GPB', 20.68)],
'2020-04-25': [('EUR', 16.88), ('USD', 15.06), ('AWG', 12.17), ('GPB', 10.4)],
'2020-04-... | <p>formatting your data is quite simple:</p>
<pre><code>filtered_data = [{"data": k, "currencies": dict(v)} for k, v in data.items()]
</code></pre>
<p>the trick here is that your currency data is already in a perfect format to feed directly to <code>dict</code></p>
<p>now all you have to do is</p>
<... | Save Python dictionary to the JSON format (adding names) | python|json|python-3.x|dictionary|grafana | 0 | 55 | 2 | 72,359,612 | 72,359,612 | 4 | true | 2022-05-24T08:15:44.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Save Python dictionary to the JSON format (adding names)<p>I filtered and processed some data and I got it in the following format:</p>
<pre><code>{'2020-04-... |
72,302,041 | Constructors as object keys<p>I'm trying to construct a map of types and callbacks so I started with an structure like this:</p>
<pre class="lang-js prettyprint-override"><code>type Instantiable<T = unknown> = new (...args: any[]) => T;
type SingleParamFn<TInput = unknown, TOuput = unknown> = (arg: TInpu... | <blockquote>
<p>Given all of this, is using the constructors as object keys a reliable approach?</p>
</blockquote>
<p>No. As you said, an object's keys can only be strings or <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol" rel="nofollow noreferrer">Symbols</a>. A Symbol... | Constructors as object keys | javascript|typescript|dictionary | 3 | 55 | 1 | 72,302,138 | 72,302,138 | 4 | true | 2022-05-19T09:30:33.787Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Constructors as object keys<p>I'm trying to construct a map of types and callbacks so I started with an structure like this:</p>
<pre class="lang-js prettypr... |
72,303,852 | How to verify that nulls are in the end of the list<p>I need to verify that data is sorted according to rule that all null values are in the end of the list.
Is any appropriate method exist for it in assertj? I don't want to write something like - I am looking for first null in the list and then verify that all next va... | <p>I think you can use the below code it's just an example I have not tested it yet.</p>
<p>assertThat(actual).isSortedAccordingTo(Ordering.natural().nullsLast().isOrdered(list));</p> | How to verify that nulls are in the end of the list | java|null|assertion|assertj | 1 | 55 | 1 | 72,303,974 | 72,303,974 | 4 | true | 2022-05-19T11:36:30.443Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to verify that nulls are in the end of the list<p>I need to verify that data is sorted according to rule that all null values are in the end of the list.... |
72,343,424 | how do i select the first value of "for" loop within the for loop?<p>I used following code to descending the degree value of a network, using networkx. Now I want to select only the fist value of the iteration whithin the same for loop. code as follows:</p>
<pre class="lang-py prettyprint-override"><code>for i in sorte... | <p>It looks like you only want the max? Then no need to sort as this is more expensive than <code>max</code>.</p>
<pre class="lang-py prettyprint-override"><code>list_id = max(G.degree, key=lambda x: x[1])
</code></pre> | how do i select the first value of "for" loop within the for loop? | python|pandas|networkx | 1 | 55 | 4 | 72,343,496 | 72,343,496 | 4 | true | 2022-05-23T04:58:09.950Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how do i select the first value of "for" loop within the for loop?<p>I used following code to descending the degree value of a network, using networkx. Now I... |
72,382,592 | Get keys from a dictionary that contains duplicate list values, then store their corresponding keys in a nested list<p>I've tried to word this the best way that I possibly can, but it will probably be more clear if I provide an example of what I am trying to acheive:</p>
<p>Input:</p>
<pre class="lang-py prettyprint-ov... | <p>Assuming you want to join the keys by identical value, use a <a href="https://docs.python.org/3/library/collections.html#collections.defaultdict" rel="nofollow noreferrer"><code>defaultdict</code></a>:</p>
<pre class="lang-py prettyprint-override"><code>source_dictionary = {"person1": ["x1","... | Get keys from a dictionary that contains duplicate list values, then store their corresponding keys in a nested list | python|list|dictionary|nested|list-comprehension | 1 | 55 | 2 | 72,382,632 | 72,382,632 | 4 | true | 2022-05-25T18:28:41.503Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get keys from a dictionary that contains duplicate list values, then store their corresponding keys in a nested list<p>I've tried to word this the best way t... |
72,374,533 | CSS Style TD bottom border<p>I'm trying to style the bottom border of a TD. The attached image shows this working as I'd like but the border is slightly too long, I'd like it to match the width of the blue cell above it.</p>
<p><a href="https://i.stack.imgur.com/OXhJu.jpg" rel="nofollow noreferrer"><img src="https://i.... | <p>You could use a pseudo element instead of a bottom border:</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"><code>table {
border-collapse: collapse;
width: 100%;
}
.active,
... | CSS Style TD bottom border | html|css | 0 | 55 | 1 | 72,374,761 | 72,374,761 | 5 | true | 2022-05-25T08:48:20.160Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
CSS Style TD bottom border<p>I'm trying to style the bottom border of a TD. The attached image shows this working as I'd like but the border is slightly too ... |
72,347,485 | Why does the array print zero in the beginning with the last digit missing?<p>I am trying to separate digits of a number and print those individual digits. When I do this -:</p>
<pre><code>#include <stdio.h>
#define size 100
int main()
{
int num, remainder, arr[size], i=0;
printf("Enter a number : ... | <p>This should work:</p>
<pre><code>#include <stdio.h>
#define size 100
int main()
{
int num, remainder, arr[size], i=0;
printf("Enter a number : ");
scanf("%d", &num);
while(num != 0)
{
remainder = num%10;
arr[i]=remainder;
i++;
num /... | Why does the array print zero in the beginning with the last digit missing? | c|codeblocks | 0 | 55 | 1 | 72,347,558 | 72,347,558 | -1 | true | 2022-05-23T11:03:50.437Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does the array print zero in the beginning with the last digit missing?<p>I am trying to separate digits of a number and print those individual digits. W... |
72,282,387 | How to substitute values enclosed in double quotes<p>I need to substitute values enclosed in double quotes. The goal is to replace commas with question marks and replace double quotes surrounded by double quotes with hyphens.</p> | <pre><code>use Text::ParseWords;
my $dlm = ","; # 区切り文字を定義
open(RH, "<", "from.csv");
open(WH, ">", "to.csv");
while(<RH>){
chomp;
my @parsed = parse_line($dlm, 1, $_);
for(my $i=0; $i<=$#parsed; $i++){
$parsed[$i] =~ s/$dlm//g;
}
pr... | How to substitute values enclosed in double quotes | perl | -2 | 55 | 1 | 72,293,110 | 72,293,110 | -1 | true | 2022-05-18T01:47:39.987Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to substitute values enclosed in double quotes<p>I need to substitute values enclosed in double quotes. The goal is to replace commas with question ma... |
72,945,360 | Mapping list changes to their new index Python<p>I am working on a piece of software that clusters images for the user to label. Each iteration the user can merge clusters or rename the label of the clusters and I am looking for an algorithm to map the previous cluster index to its new index based on the previous clust... | <p>Note that you don't need <code>previous_clusters</code> (although it was helpful for me to understand the context). The only information you need is something like "as for index 0, the user selects <code>'ClassA'</code>". You can collect all indices that maps to <code>'ClassA'</code>, and then <em>invert</... | Mapping list changes to their new index Python | python|algorithm|dictionary | 0 | 55 | 1 | 72,945,455 | 72,945,455 | 1 | true | 2022-07-11T22:42:02.003Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Mapping list changes to their new index Python<p>I am working on a piece of software that clusters images for the user to label. Each iteration the user can ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.