input_text_instruct
stringlengths
288
45.8k
output_text
stringlengths
37
33.2k
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to initiate the interval variable bounds in docplex (python)?<p>I have the following OPL code and need to implement it in docplex (python), i'm newbie in...
<pre><code>from docplex.cp.model import CpoModel mdl=CpoModel() I1=mdl.interval_var(0,10) I2=mdl.interval_var(0,10) I3=mdl.interval_var(0,10) over1=mdl.integer_var() start1=mdl.integer_var() end1=mdl.integer_var() artificialInterval=mdl.interval_var() mdl.add(over1==mdl.overlap_length(I1,I2)) start1=mdl.max(mdl.st...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Runtime error while running a Spring Session + Spring Boot application<p>I am trying to run this <a href="https://github.com/spring-projects/spring-session/a...
<p>I see a few places for cleanup:</p> <ul> <li>You have conflicting Spring versions in your pom. Specifically spring-web-4.1.3 is explicitly listed and Spring Boot 1.1.10 brings in Spring 4.0.8. Remove every version from your pom (except Spring Session &amp; embedded-redis) which are not yet managed by Spring Boot) a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Load Open layers 3 jsonp vector layer with bounding box strategy?<p>I have problem with loading features from geoserver to a vector layer using OpenLayers3 a...
<p>In your URL, you already define the name of the callback function. It is <code>success</code>, and is defined by <code>'&amp;format_options=callback:success&amp;srsname='</code>. If you want to use your <code>createVectorLayer</code> function for multiple layers, you will want to change that to <code>'&amp;format_op...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android Apache POI error when reading Microsoft Word document: org.apache.xmlbeans.SchemaTypeLoaderException Cannot resolve type for handle<p>I am trying to ...
<p>owner of the lib here. <code>poi-android</code> has only been tested with Excel files and is tailored to work well with proguard to minimize binary size for an app I wrote.</p> <p>If I had to guess, <a href="https://github.com/SUPERCILEX/poi-android/blob/e1231c732f35a7f984c8c0903a7fee15291f7385/poi/build.gradle#L15...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Save datetime into Parquet in Spark<p>I want to create Parquet file with data of unknown format at compilation time. I'm getting schema as a text later on an...
<p>I'm facing exactly the same issue. It seems that DateType and Timestamp support for Parquet file will be added in Spark 1.3 (More info in <a href="https://github.com/apache/spark/pull/3820" rel="noreferrer">https://github.com/apache/spark/pull/3820</a> and <a href="https://issues.apache.org/jira/browse/SPARK-4709" r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: First X items in foreach loop<p>This may well be a silly question to many, but I've fried my brain sorting out various things today and can't think where to ...
<p>You could just keep a counter, then use <code>break</code> to exit the loop when you hit the maximum value you want.</p> <pre><code>$i = 0; foreach($x-&gt;channel-&gt;item as $entry) { echo "&lt;li&gt;&lt;a href='$entry-&gt;link' title='$entry-&gt;title'&gt;" . $entry-&gt;title . "&lt;/a&gt;&lt;/li&gt;"; $i...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to add information to the x-axis label of the plotted graph in Python?<pre><code>import pandas as pd import matplotlib.pyplot as plt my_funds = [10, 20,...
<p>For the sake of this question it is easier to create an extra column with the values you desire and then pass it to the <code>df.plot()</code>:</p> <pre><code>df['Friends_actions'] = df['Friends'] + " " + df['Actions'] df.plot(kind='bar', x = "Friends_actions" , y = 'Funds', color='red', figsize=(5,5)) </code></pre...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: redirecting awk output to file in bash<p>I am working on a bash script that captures beacon frame packets (without bad fcs) and output them in a preferred fo...
<p>After a bit of reading on awk and gawk..I came across a very interesting topic on buffering behaviour in one of my text.This solved my problem..I changed the buffering behaviour of awk using the following</p> <pre><code>fflush("") ==&gt; gawk and newer versions of awk </code></pre> <p>or</p> <pre><code>system(""...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Why does Git ignore these folders?<p>I added a Laravel App under Git so that I could push to Bitbucket. On root folder, I ran <code>git add -A</code> and pus...
<p>You can use <a href="http://git-scm.com/docs/git-check-ignore"><code>git check-ignore</code></a> to determine if a path is getting ignored by git.</p> <p>Furthermore <code>check-ignore</code> offers a <code>-v</code> (<code>--verbose</code>) option which will tell you about the pattern that ignores your file and wh...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: List with checked checkboxes in Django<p>So, i want to get the checked checkboxes items ids as a list and show them on another page. But when i get to that s...
<p>You can try use <a href="https://docs.djangoproject.com/en/3.0/topics/forms/formsets/" rel="nofollow noreferrer">FORMSETS</a> A formsets is a layer of abstraction to work with multiple forms on the same page. </p> <p>You can paint the list of questions according to records in the table and get ids (or other fields)...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Spring boot reactive WebClient calling legacy endpoint<p>In a Spring Boot (2.2.2.RELEASE) application, I have reactive endpoints (returning Mono or Flux), ea...
<p>If we're talking about HTTP endpoints, we can call them with blocking or non-blocking (asynchronous) clients, but not fully reactive.</p> <p>If your "new" application is reactive, you have to use non-blocking client (WebClient in your case), otherwise you will block NIO-threads and loose all the advantages of the r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert for loop to forEach Lambda<p>I am learning about Lambdas and am having a little difficulty in a conversion. I need to introduce a List into which the...
<p><code>Stream.of(Field.values()).forEach()</code> should do the trick:</p> <pre><code>public AreaData (String... data) { List&lt;String&gt; list = Arrays.asList(data); /* Assert to check that the data is of the expected number of items. */ assert data.length == Field.values().length : "Incorr...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: JOIN table with itself and show on screen<p>This is my table</p> <pre><code>row_id | category | parent_id 1 | News | 0 2 | Toys | 0 ...
<p>Since OP does not mention whether the menu needs to be printed immediately or returning a string of HTML, this is how I will do it with just one SQL query and handling it with PHP recursive function.</p> <p><strong>Please note that there are many ways to do this, I'm just showing you one of that many ways.</strong>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Modifying a batch file from another batch file<p>I am trying to create a batch file that updates another batch file. This is what I got.</p> <p>Waiter.bat</...
<p>Here's a version that migt work - it doesn't change the batch file...</p> <p><strong>menu.bat</strong></p> <pre class="lang-dos prettyprint-override"><code>@ECHO OFF SETLOCAL @echo off set /p Waiter="What would you like to eat? " Call q28612146_Menu.bat "%Waiter%" Pause GOTO :EOF </code></pre> <p>Note: The batchf...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: First Apache Server, Webpage Images Missing<p>I just built my first AWS Apache Server and uploaded my website from my school project. The site works in Dream...
<p>I found that the file extension on some of the pictures was capitalized. These pictures wouldn't load until I changed .JPG to .jpg. </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CSS - fixed position header & page border combination<p>My requirement is a page with a fixed position header and full border around the page. </p> <p>Setti...
<p>replace <code>width: 100%</code> with <code>right: 10px</code> and <code>left: 10px</code></p> <pre><code>.site-header { min-height: 100px; background: blue; position: fixed; right: 10px; left: 10px; z-index: 10; } </code></pre> <p>Example: <a href="http://codepen.io/anon/pen/yyKGyJ" rel="nofollow nore...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How should you prefix transform properties in CSS3 animations?<p>I have the following snippet of Sass that works like a charm, but I wonder if I need to pref...
<p>Given that:</p> <blockquote> <p>Im not asking about using something like autoprefixer</p> </blockquote> <p>It depends on which browsers and <a href="http://caniuse.com/#search=transform" rel="nofollow"><strong>which versions you want to support</strong></a>:</p> <p><code>-ms-</code> can be used for IE9 (below I...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Displaying Yesterday's Date<p>How can the following code be modified to display yesterday's date instead of today's date? For example, "Sunday, February 1, 2...
<p>Just put a line <code>now.setDate(now.getDate()-1);</code> it will set the Date to yesterday's date.</p> <pre><code> var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var monthNames = new Array("January","February","March","April","May","June","July","August","Sept...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Material UI TextField event for field leave<p>Is there an event for leaving the field or loosing focus in the Material UI TextField?</p> <p>I need two event...
<pre><code>&lt;TextField value={this.state.fieldFirstName} onChange={(e: any) =&gt; this.onChangeFieldFirstName(e.target.value)} onFocus={() =&gt; this.onFocusFieldFirstName()} onBlur={() =&gt; this.onBlurField()}/&gt; </code></pre> <p>Use onBlur event this will solve your problem</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Convert rows data into column in sqlserver 2008<p>IN the below case i have 2 records but the no or records per id is not fixed...</p> <pre><code>SELECT Insu...
<p><strong>SAMPLE TABLE</strong></p> <pre><code>CREATE TABLE #EdgeServer_EligibilityConsolidated_Part3 (InsuredMemberIdentifier INT, CoverageStartDate DATE, CoverageEndDate DATE) INSERT INTO #EdgeServer_EligibilityConsolidated_Part3 SELECT 10190 , '2014-01-01', '2014-01-31' UNION ALL...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Coding the Next and Previous button<p>I want to code for the next and previous buttons. I have made the action listener but do not know how to code for next ...
<p>Use List to store the data, so when your data look like say:</p> <pre><code>a.csv - b.csv - c.csv </code></pre> <p>So when you are reading b.csv, sp using listIterator, iterating to previous could be done using <code>iterator.previous()</code> i.e. reading a.csv while <code>iterator.next()</code> will lead you rea...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Expected scheme-specific part at index 5: null:<p>I'm getting the following exception when trying to get HTTP get response using Spock framework.</p> <pre><...
<p>Remove the colon from</p> <pre><code>def SERVER_PORT = "8082" </code></pre> <p>Or remove the colon from</p> <pre><code>def client = new RESTClient("$SERVER_URL$SERVER_PORT") </code></pre> <p>You have one too many colons before the port</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java binarySearch return is being ignored<p>So as the title suggests, I am writing some code to perform a version of a binary search in Java. However, my ret...
<p>Your method is recursive. This means that every time you recurse, you need to do something with the returned value from the recursive call. What you are seeing is that the recursive calls reach a termination point, return a value, and then bubble back out. However since the instance that made the recursive call does...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Calculate sum by grouping by column value in R<p>I have a data frame with two columns, a <code>Ref_Date</code> column and a <code>Value</code> column. The da...
<p>You can use the following code with dplyr:</p> <pre><code>library(dplyr) df %&gt;% group_by(year = substr(Ref_Date, 1, 4)) %&gt;% # create the groups summarise(Value = sum(Value)) #Source: local data frame [2 x 2] # # year Value #1 1989 11543 #2 1990 8703 </code></pre> <p>Or similarly with <code>data.t...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: AngularJS Multiple directives asking for ngModel<p>Here's a <a href="http://jsfiddle.net/hr121r18/3/" rel="nofollow">jsfiddle example</a> of what I'm trying ...
<p>Thank you for looking @mimir137 but I appear to have solved it: </p> <p><a href="http://jsfiddle.net/hr121r18/8/" rel="noreferrer">http://jsfiddle.net/hr121r18/8/</a> </p> <p>The directive was using <code>replace: true</code>, which ends up with this structure:</p> <pre><code>&lt;form ng-controller="FooCtrl" clas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passenger 403 error<p>I am trying to install passenger for my rails app, but I dont know where is the problem.</p> <p>Fallow the files:</p> <p>httpd.conf</...
<p>The user that execute passenger and the web server doesn't have access to </p> <blockquote> <p>/home/vagrant/shitatta/public</p> </blockquote> <p>You should in my opinion make some changes:</p> <ul> <li>Login with your user (vagrant)</li> <li>Create a directory /opt/web/</li> <li>Copy your project in /opt/web/s...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Linker can't find existing library<p>I'm working on an OpenGL project recently and decided to move to 64 bit, so i changed the compiler to g++ 4.9.2 which su...
<blockquote> <p>Strangely these do also have the 32 suffix... whatever, probably for easier porting.</p> </blockquote> <p>To maintain source compatibility with programs that use functions like <code>LoadLibrary</code> or <code>GetModuleHandle</code>: Keep them working without having to alter the strings that go into...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: DOS Multiline batch command. How to add comments between arguments?<p>Id like to add comments like this:</p> <pre><code>makecert -r ^ // This means S...
<p>Nothing official, but there is a simple and very effective hack - use undefined variables. At least one <code>=</code> is added to guarantee that the content cannot be a valid variable name, since the character cannot be used in a variable name. I use one at the beginning and end just for symmetry. Also, the comment...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How do I use jQuery selectors to iterate through unordered lists independently?<p>I am working on a menu to display products for a cannabis dispensary. When ...
<p>Essentially what you need to do is keep tabs on each list for both the currently visible list item and the length of the list. When you click next, you need to see if you're at the end of the list and if so, reset the visibility to the first item. Conversely when you click previous, if you're on the first item you n...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: LAG function with two different partitions<p>I have a table with multiple calendars inside it and I need to get the previous business day for each row in the...
<p>This is NOT a gaps-and-islands problem. This is merely a cumulative max problem:</p> <pre><code>select t.*, max(case when businessday = 'Y' then date end) over (partition by calendarid order by date rows between unbounded preceding and 1 preceding ) as prev_busi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fallback on a enum if values don't match in OpenAPI generator's Moshi<p>I have an enum class and would like it to fallback to null if values don't mat...
<pre><code>class NullableEnumAdapter&lt;T:Enum&lt;T&gt;&gt; : JsonAdapter&lt;T&gt; { @FromJson fun fromJson(jsonReader: JsonReader, delegate: JsonAdapter&lt;T&gt;): T? { val value = jsonReader.nextString() return try { delegate.fromJsonValue(value) } catch (e: Exception) { null } } } obje...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Issues getting data from array's dictionary JS<p>I'm having issues to get the stored data in my array. I can't see where is the problem on my function and wh...
<p>In your code you have </p> <pre><code>var task_kids = $(this).find('ul').eq(0).find('li'); </code></pre> <p>and later you log task_kids. The log output shows li elements because that was what you selected.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Combinations of DataFrames from list<p>I have this:</p> <p><code>dfs_in_list = [df1, df2, df3, df4, df5]</code></p> <p>I want to concatenate all combinatio...
<pre><code>import itertools import pandas as pd dfs_in_list = [df1, df2, df3, df4, df5] combinations = [] for length in range(2, len(dfs_in_list)): combinations.extend(list(itertools.combinations(dfs_in_list, length))) for c in combinations: pd.concat(c, axis=1) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Closing a Django FieldFile<p>When should I close the file handle from a Django FieldFile? I tried to close it after each use, but the second time I try to re...
<p>It seems that I should not rely on the FieldFile's implicit call to <code>open()</code>. The file will automatically open itself the first time, but not after you close it.</p> <p>Adding explicit calls to <code>open()</code> makes it work.</p> <pre><code> p2.data_file.open('rU') with p2.data_file: f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the advantage of async over BeginXXX/EndXXX?<p>When looking for an elegant way to asynchronously receive a stream of datagrams from a UDP socket, I c...
<p>First of all, in a naturally asynchronous API there are no blocked threads in both the <code>async-await</code> (TAP) version and <code>Begin/End</code>(APM) (<a href="http://blog.stephencleary.com/2013/11/there-is-no-thread.html" rel="nofollow">There Is No Thread</a>).</p> <p>In this specific case however, the lin...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame<p>I'm creating a run-able jar from a projec...
<p>the issue got resolved after i built a jar using maven by using package as goal.Thanks for the help :-D </p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to prevent non-nullable types in Typescript including generics?<p>I have a situation very similar to this one: <a href="https://github.com/microsoft/Type...
<p>The compiler can't reason very well about whether a value is assignable to a type that depends on an unspecified generic type parameter, like the <code>T</code> and <code>D</code> inside the implementation of <code>simpleWrapper()</code>. It <em>especially</em> cannot do it when the type is a <a href="http://www.ty...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What's the use of cache in csv type provider?<p>I am a bit confused about <code>Cache</code> and <code>CacheRows</code>.</p> <p>It seems <code>MyCsvType.Loa...
<p>If you look at F# Data source code, you can see that <code>Cache</code>, <code>Take</code> and other operators are just calling the corresponding <code>Seq.xyz</code> operations under the cover (this is <a href="https://github.com/fsharp/FSharp.Data/blob/fe5ba3afab12d855b9a9739387719b101dde6d21/src/Csv/CsvRuntime.fs...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: What is the meaning of base 10 in ValueError in Python3?<p>I was trying some outputs with int() and tried to convert a string containing char into an int. An...
<p><code>int</code> will always return a base-10 integer, but it needs to be given the base of the string it receives (if it is not base-10). <code>3ca</code> is not a base-10 string hence the error. </p> <p>In this case, the base is <strong><em>probably</em></strong> 16, assuming <code>3ca</code> (<code>3CA</code>) r...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting variables within the __init__ def in python in some class<p>I have a class with certain inside variables in it, let's take a simple example</p> <pre...
<p>I don't think you need <code>inspect</code>:</p> <pre><code>class Example: def __init__(self): self.variable = "something" self.anotherVariable = "somethingElse" print(Example.__init__.__code__.co_names) </code></pre> <p>Output:</p> <pre><code>('variable', 'anotherVariable') </code...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Can I use javascript to uppercase the first letter from the prompt input<p>I was wondering a way of upper-casing the first letter, my code is:</p> <pre><cod...
<p>Just compare against lowercase version of the entered string:</p> <pre><code>var userChoice = prompt("Do you choose rock, paper or scissors?").toLowerCase(); if (userChoice !== "rock" &amp;&amp; userChoice !== "paper" &amp;&amp; userChoice !== "scissors") { throw new Error("Incorrect choice."); }; </code></pre>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to store different objects of arrayList in memory and later retrieve them?<p>I am new to Java, and I am stuck at a place here. I have a student class th...
<p>It doesn't make sense for <code>Student</code> to contain a <code>List</code> of students, it's beyond it's scope of responsibility.</p> <p>Instead, <code>List</code> should be independent of it, for example...</p> <pre><code>import java.util.ArrayList; import java.util.List; import java.util.Scanner; public clas...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C++ Comparing vector elements to determine correct answer<p>I have been fighting with this for awhile. I am trying to create a score results from 2 vectors, ...
<p>You could do it like this</p> <pre><code>#include &lt;vector&gt; #include &lt;iostream&gt; #include &lt;string&gt; //#include &lt;cstring&gt; using namespace std; int main(int, char**) { int i; int score = 0; int totalQ = 3; vector&lt;string&gt; questions; vector&lt;string&gt; answers; f...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting "ORA-03115: unsupported network datatype or representation" error while fetching array of varchar from anonymous pl/sql<p>I am getting "ORA-03115: un...
<blockquote> <p>java.sql.SQLException: ORA-03115: unsupported network datatype or representation</p> </blockquote> <p>This is caused by the following statement:</p> <pre><code>cstmt.registerOutParameter(1, OracleTypes.ARRAY); </code></pre> <p>This statement says array will be the output, but didn't specify the actual O...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to preg_match in php for numeric with fixed range?<p>how can I preg_match in php for numeric with fixed range?</p> <p>I want to allow 8 digit number in ...
<p>Your pattern is just slightly off, and you should be expecting <em>seven</em> digits after the initial digit which is not zero:</p> <pre><code>if (!preg_match("/^[1-9][0-9]{7}$/", $PhNum)) { $error .= '&lt;p&gt;&lt;label class="text-danger"&gt;Only 8 digit numbers are allowed&lt;/label&gt;&lt;/p&gt;'; } </code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to import recursively all classes in a module?<p>Is it possible to use <code>__all__</code> recursively? This imports modules in <code>__all__</code> ......
<p>Solved by adding this to <code>__init__.py</code>. May not be the best approach for most situations, but it is good enough for my use case.</p> <pre><code>from pathlib import Path # Include all classes when 'from mypkg import *' is called. fs = [f for f in Path('mypkg').rglob('*.py') if not f.name.startswith('_')...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to move to previous TextField when delete button is clicked on built-in keyboard iOS<p>I am building an iOS app which requires user to input pin which co...
<p>I have worked with this just follow these steps and you will get results as per your need: </p> <pre><code> @IBOutlet weak var txt4: UITextField! @IBOutlet weak var txt3: UITextField! @IBOutlet weak var txt2: UITextField! @IBOutlet weak var txt1: UITextField! </code></pre> <p>Add textField Delegate in view cont...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to fetch data from DB according to time stamp range in HQL<p>I have a HQL query that fetch data from DB given user time stamp.the query works fine but no...
<p>The correct dateformat is <code>MM/dd/yyyy</code></p> <p>Correct: <code>DateFormat df = new SimpleDateFormat("MM/dd/yyyy");</code></p> <p><code>mm</code> represent minutes while <code>MM</code> represents months. Official format description:</p> <pre><code>Letter Date or Time Component Presentation Examples ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Polarity and Sentiment Analysis in Power BI with Python<p>I would like to use Python's Textblob for sentiment analysis in Power BI desktop. The code below wo...
<p>I assume you could do something like this and get similar fields that you got in your first script.</p> <pre><code>dataset['polarity'] =dataset['Comment'].apply(lambda x: TextBlob(str(x).lower()).sentiment.polarity) dataset['subjectivity'] =dataset['Comment'].apply(lambda x: TextBlob(str(x).lower()).sentiment.subje...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using ConfigureAwait<p>Please take a look at following two methods. The first function <strong>GetQuoteImageContent</strong> is calling <strong>GetFileHeader...
<p>From the comments, i'm understand that you're not awaiting on <code>GetQuoteImageContent</code>, and that is why you seem to think your method isn't returning the images. </p> <p>If you want to iterate the images right after your get, you'll have to <code>await</code> on that too:</p> <pre><code>IEnumerable&lt;Fil...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Accepting a byte array parameter in MVC API as Base64<p>I am currently building an ASP.NET MVC WebAPI service for which I'd like a small piece of binary data...
<p>Eventually I found an interesting article on model binders that enabled me to implement the above:</p> <p><a href="http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api" rel="noreferrer">http://www.asp.net/web-api/overview/formats-and-model-binding/parameter-binding-in-as...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: multiply two columns from two different pandas dataframes<p>I have a pandas.DataFrame.</p> <pre><code> df1 Year Class Price EL ...
<p>Use map,</p> <pre><code>df1['Price_factor'] = df1['Year'].map(df2.set_index('Year')['Price_factor']) df1['Price_adjusted']= df1['Price'].str.strip('$').astype(int) * df1['Price_factor'] df1 </code></pre> <p>Output:</p> <pre><code>| | Year | Class | Price | EL | Price_factor | Price_adjusted | |----...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Knockout combining multiple json data into single vm<p>I want to combine multiple json data into a single vm. I read that you can map from js into the model ...
<p>The mapping plugin can take an existing model but I don't believe it will merge data.</p> <p>For example you could map twice like so:</p> <p><code>{one: "yo"}</code> and <code>{two: "dawg"}</code></p> <p>into the same model and you would now have two observables, one() and two()</p> <p>But if you was to do this...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: template argument deduction/substitution failed in multithreading<p>I'm running into this template deduction/substitution problem when passing a function thr...
<p><code>setAllValues</code> is called with Lvalue:</p> <pre><code>template&lt; class D &gt; bool Region&lt; D &gt;::setRegion( D&amp; dataPack ) { auto func = std::bind( &amp;Region::computeValue, this, std::placeholders::_1, std::placeholders::_2 ); return setAllValues( dataPack, func )...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Asp.net MVC 5 Ajax POST throws exception 404 (Not Found) after application is published<p>Everything works fine locally (When i run with localhost), But afte...
<p>I changed to <code>'@Url.Action("FilterData", "Dashboard")'</code> and it works fine! Thank you, guys.</p> <p>Below is my code</p> <pre><code> $.ajax({ type: "POST", url: '@Url.Action("FilterData", "Dashboard")', data: '{FromDate: "' + txtFDate.val() + '", ToDate: "' + txtTDate.val() + '", ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to overwrite backend / tabulator labels in page properties?<p>I have added new input fields to the page properties (below the categories):</p> <p><em>TC...
<p><strong>UPDATE</strong>:</p> <p>Sorry that I misunderstood. You can overwrite backend labels with your own xlf files.</p> <p><em>ext_localconf.php</em></p> <pre><code>$GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:core/Resources/Private/Language/locallang_tca.xlf'][] = 'EXT:your_extension/Resour...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: QueryDict to string loses list within JSON<p>My request is of type QueryDict and I want to convert it to a JSON object or string so I can validate it against...
<p>Convert your <code>QueryDict</code> into a standard Python <code>dict</code> and call <code>json.dumps()</code> on the resulting <code>dict</code>:</p> <pre><code>import json from django.http import QueryDict qd = QueryDict('people=Aaron&amp;people=Randy&amp;people=Chris&amp;people=Andrew&amp;message=Hello!') &gt...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Passing table valued parameter to stored proc with different number of fields<p>I have a requirement where I need to pass a table valued parameter to a store...
<p>I ended up generating data table dynamically as follows:</p> <pre><code> public static DataTable GetDataTableFromSchema(string userDefinedTableTypeName, SqlConnection connection) { var query = "SELECT SC.name, ST.name AS datatype FROM sys.columns SC " + "INNER JOIN sys.types ST ON ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Make directive function accessible in parent scope without events<p>I have a <em>directive</em> with an isolated <em>scope</em> and want to call its function...
<p>You could apply this solution. </p> <p>In this way you are passing a variable in two way binding:</p> <ul> <li><code>my-directive="myFunction"</code> in the html</li> <li>and <code>myFunction: '=myDirective'</code> in the directive)</li> </ul> <p>Then assign the function in the directive:</p> <pre><code> scop...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Problem with exporting data to excell with Symfony 4<p>I have a problem .I want to export my data book from my database to excell with symfony. I tried to us...
<p>You are overwriting the variable <code>$columnValues</code> instead of appending new values to the array. Try to initialize the array first and add the values to the array (<code>$columnValues[] = …</code>) like this:</p> <pre class="lang-php prettyprint-override"><code>$columnValues = []; foreach ($books as $book...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: StackOverFlowException while filling color using Graphics - Code Included<p>I want to fill an applet with blue color. I am doing this using paint(Graphics g)...
<p>Look at your code: first call to <code>flood()</code> is with coordinates <code>(0, 0)</code> which later calls <code>flood()</code> with coordinates <code>(1, 0)</code> which calls <code>flood()</code>... With your dimensions, you get to a recursion 500 levels deep. Change your code to not using recursion.</p> <p>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Formula Parse Error in Google Spreadsheet Sparkline<p>I'm having some trouble using the SPARKLINE function on Google Spreasheets. If I use the "default" form...
<p>From <a href="https://productforums.google.com/forum/#!topic/docs/QzVhyW5bi-A" rel="noreferrer">https://productforums.google.com/forum/#!topic/docs/QzVhyW5bi-A</a></p> <blockquote> <p>When you address the option like an object, then you should use a backslash: <code>=SPARKLINE(C11:N11;{"charttype"\"bar"}</code></...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Getting a matching element from a different array<p>I have an array called <code>groupUsers</code> and another array within an array called <code>tasks.users...
<p>You can expand to this function to fit your needs, right now it will return one name of the passed in id, $filter is an angular-service, remember to include it in your controller</p> <pre><code>$scope.getName = function(id){ return $filter('filter')(groupUsers, { name: id})[0].name; }; </code></pre> <p>here is...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: pexpect sendline is too slow<p>I'm running a subprocess using pexpect. I'm communicating with it off and on via sendline and readline. cProfile indicates my ...
<p>pexpect has a default 50ms wait time for send(). You can disable this by setting:</p> <pre><code>proc.delaybeforesend = None </code></pre> <p>See <a href="https://pexpect.readthedocs.io/en/3.x/_modules/pexpect.html" rel="nofollow noreferrer">the documentation</a> for an explanation of why they put this delay in.</...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to crash web server via php<p>I need to test the behaviour of some tool I use on my web server, but it works only in cause of server fault. So I need to ...
<p>I think it might be possible to get apache to segfault with mod_php by providing a regex that needs backtracking, setting high pcre limits and low php memory limits. I can't recall which versions where involved unfortunately.</p> <p>Are you sure it's not good enough to just send a kill signal?</p> <p>--edit--</p> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: CREATE OR REPLACE FUNCTION in HSQLDB<p>When creating a function, Oracle allows the following syntax:</p> <pre><code>CREATE OR REPLACE FUNCTION </code></pre>...
<p>CREATE OR REPLACE is supported in ORA compatibility mode but it works only when the function does not exist.</p> <p>The ALTER SPECIFIC ROUTINE syntax is supported when the function does exist and allows you to change the body of the function without changing its parameter.</p> <p>You can use SELECT * FROM INFORMAT...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I add onmessage handling to a subclass of WebSocket?<p>I am trying to subclass WebSocket so that all traffic coming and going can be JSON-ified on th...
<p>I was able to do this, maybe it can help someone looking to achieve this</p> <pre><code>// proxy the window.WebSocket object var WebSocketProxy = new Proxy(window.WebSocket, { construct: function (target, args) { const instance = window.socket = new target(...args); // WebSocket "onopen" handler ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to customize the tab shortcode to apply only for one product<p>I have created a tab using "tab responsive" plugin. I want that tab to apply under the pro...
<p>You could check against the product id like this:</p> <pre><code>function enfold_customization_extra_product_content() { global $product; if ( $product-&gt;get_id() == '123' ) { // change 123 to your product ID echo do_shortcode("[your_shortcode]"); } } </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: MessageBox without focus on a MessageBoxButton<p>Is there a way to show an MessageBox in C# without a focus on a button in the message box? For example the f...
<p>This isn't possible with the standard MessageBox - you'll need to implement your own if you want this functionality.</p> <p>See <a href="http://www.dotnetperls.com/customized-dialog" rel="nofollow">here</a> to get you started.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: EF inheritance failing<p><img src="https://i.stack.imgur.com/oqCwa.png" alt="Class Diagram"></p> <p><a href="https://i.stack.imgur.com/oqCwa.png" rel="nofol...
<p>Ok, just for the records if it can help someone else, I found the answer in this tutorial:</p> <p><a href="https://msdn.microsoft.com/en-us/data/jj618293.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/data/jj618293.aspx</a></p> <p>The key is deleting the relationship between the base table and the derived o...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Image not rendering when appending it with javascript<p>I am attempting to append a <code>&lt;img&gt;</code> element made in JavaScript into a <code>&lt;td&g...
<pre><code> var circle = document.createElement("img"); circle.innerHTML = "src='Circle.png'" </code></pre> <p>should be:</p> <pre><code> var circle = document.createElement("img"); circle.src = 'Circle.png'; </code></pre> <p>The circle is an image so it doesn't have any property called innerHTML...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Should I put my getter functions inside or outside my functional component?<p>If I have a React functional component that uses a <code>useState</code> hook:<...
<p>You should put out side when your function <strong>only depends on it's parameters</strong>.</p> <p>Why? Because if that function will never change, you don't need to recreate it on every render. You could also put it in a utils file or something like that if you need to use in another component.</p> <blockquote> ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Global find and replace in C#<p>I have a string in C# that will looks something like this:</p> <pre><code>GET TEXT'somethign' OR TEXT'another' ... </code></...
<p><code>string.Replace</code> isn't best suited for this, what you need is a <code>Regex.Replace</code>.</p> <pre><code>var input = "GET TEXT'somethign' OR TEXT'another' ..."; var output = Regex.Replace(input, "TEXT'([^']+)'", "$1"); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create Weka Instance with string attribute<p>I'm trying to convert an ArrayList that is custom code I have inherited to a Weka Instances structure so I can u...
<p>You can create an attribute per key (get all your distinct keys in a list, sort it to keep the order fixed). The attributes will have numeric values which are the number of occurrences.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: today I can't open markdown file on markdown viewer chrome extension<p>Today I've got error like this. </p> <p><a href="https://i.stack.imgur.com/HoJ2B.jpg"...
<p>I can fixed this problem by accessing local data files chrome use this command. </p> <p>open /Applications/Google\ Chrome.app --args --allow-file-access-from-files</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Ignore empty cells and skip duplicate entries in Google Sheets/Calendar sync<p>I'm trying to write a script for a Google Sheets to sync to Google Calendar. M...
<ul> <li>You want to remove the error as shown in your question. <ul> <li>In this case, the empty values are included in <code>signups</code>. You want to ignore these empty values.</li> </ul></li> <li>You don't want to create the duplicated events.</li> </ul> <p>If my understanding is correct, how about this answer?...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java Programming - Beginner<p>I need some assistance correctly setting up my Terminal on Mac to run Java programs, and I also need some assistance with my fi...
<p>I work with Eclipse when I program in Java. If you want to remember the code it is better if you use Notepad++ where you have to write everything without autocompletion.</p> <p>To run java programs in terminal on MAC :</p> <ul> <li>Open the terminal</li> <li><p>Change the directory to the folder where your java fi...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to return observable with RxJS in proper format with additional separate paging data<p>I have an API that returns the following:</p> <pre><code>{ 'dat...
<p><strong>Interfaces</strong></p> <pre><code>interface Player { id; name; } interface Paging { current; totalPages } interface HttpPlayer { data: { players: Player[] }; paging: Paging; } interface UiPlayer { id; name; current; totalPages; } </code></pre> <p><strong>Mapping to merge play...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Want to make font-awesome icons thinner<p>I was working with font awesome icons but the problem is they have default font weight . i want it a little bit thi...
<p>Sorry, it´s not possible to do that using standards (if it is not important in your project you can use the Kiryl Ply suggestion). Font-Awesome comes with just one font-weight variant. There is a new project to solve that problem (not ready yet):</p> <p><a href="https://www.kickstarter.com/projects/232193852/font-a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Java interface access different classes by calling same interface<p>I want to use java interface in a way that i will make a call defining interface in my ot...
<p>Your implementation looks correct. To make use of it, you can do this in main:</p> <pre><code>SoapURL reset = new ResetPasswordSoap(); System.out.println(reset.getUrl()); </code></pre> <p>This is a method of minimizing coupling in large systems. And reduces dependency between objects by making use of a common inte...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: C# Split array into individual variables using syntactic sugar<p>I am working on a project to convert Matlab code to C# and there are numerous methods that h...
<p>No there is no magic that would make any similar syntax work.</p> <p>C# <em>does</em> have a tuple class (<a href="https://msdn.microsoft.com/en-us/library/system.tuple%28v=vs.110%29.aspx" rel="nofollow">MSDN</a>), so you could write:</p> <pre><code>var tupleResult = someFunction(); var1 = tupleResult.Item1; var2 ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Does calling an asynchronous Hook trigger multiple requests?<p>Imagine the following components:</p> <pre class="lang-js prettyprint-override"><code>functio...
<p>You will have two network requests, custom hooks don't share state.</p> <p>From the <a href="https://reactjs.org/docs/hooks-custom.html#using-a-custom-hook" rel="nofollow noreferrer">docs</a></p> <blockquote> <p><strong>Do two components using the same Hook share state?</strong> No. Custom Hooks are a mechanism ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: NLog MySql .Net Core 3.0 logging not saving to database<p>I have setup NLog on my project that will save the logging to my audit database (separate from the ...
<p>For MySQL, make sure you have installed the <a href="https://www.nuget.org/packages/MySql.Data/" rel="nofollow noreferrer">MySql.Data</a> package.</p> <p>There are also some mistakes in your config and code:</p> <ul> <li><code>${log_date}</code>, <code>${log_level}</code> and <code>${thread}</code> don't exist. I ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Inorder successor in a reversed binary search tree<p>I have a slight confusion on inorder successor/predecessor if the BST is flipped. What I meant when the ...
<p>If you do an in-order traversal of a reversed BST you will get the numbers sorted in <strong>descending</strong> order. So in that case the order for your values will be: 20, 15, 10, 8, 6, 4, 2. <strong>So the successor of 8 will be 6</strong>.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Using Variables in SQL Query Run Through Code<p>I want to pass a variable to a sql string being executed via C#. I am hitting a compile error tho, and I am ...
<p>You are missing the closing double quote. See below.</p> <pre><code>SqlCommand("IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = Main_'" + Fire + "') DROP VIEW dbo.Main_'" + Fire + "'**"**); </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How can I iterate over a xpath with two variables?<p>I try to iterate over the Xpath as follows:</p> <pre class="lang-py prettyprint-override"><code>for i i...
<p>Because you're accessing index 1 not index 0 in the formatting . Use 0 between the brackets or just the brackets alone as it will default to the first input.</p> <pre><code>xpath = '/ html / body / div / div / div / main / section / div / div [2] / div / div [1] / div [2] / div [1] / table / tb...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Create collection of type<p>I created a record type</p> <pre><code>type IpRanges = {ipStart: IPAddress; ipEnd: IPAddress; subnet: IPAddress; mask: IPAddress...
<p>What kind of collection do you want to create?</p> <p>A list of IPRanges? If so you can do it like this:</p> <pre><code>type CollRanges = List&lt;IpRanges&gt; </code></pre> <p>But since list is generic your <code>CollRanges</code> doesn't really need to be a new type, indeed the previous line will create a type a...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Is Android BluetoothLE support two way communication between glass and mobile?<p>My Google Glass and Mobile supports Bluetooth LE.Can I use the Bluetooth LE ...
<p>Yes it is possible. First, decide which device is Central; usually the smartphone should be, as it's got more resources and power. Then when the two connect, their GATT roles (Client and Server) are interchangeable at any time, because GATT roles are independent of GAP roles (Central and Peripheral). Simply issue a ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to put a table at the center of the window (Set table position)<p>So, I'm working on an application and I'm using QTableWidget to generate a table. I wan...
<p>An item view has a default size "hint" for Qt, which is the size that the widget suggests as the best to show its contents and make it as usable as possible. Also, each widget has a <a href="https://doc.qt.io/qt-5/qwidget.html#sizePolicy-prop" rel="nofollow noreferrer"><code>sizePolicy</code></a> property, which tel...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: How to set a Perl environment variable from an XSUB?<p>I am trying to set a Perl environment variable from an XSUB. I want it to take immediate effect before...
<p>I don't know why <code>my_setenv</code> doesn't work (since <code>$ENV{PERL_MEM_LOG} = "abc";</code> ends up <a href="https://perl5.git.perl.org/perl5.git/blob/44523d1ffde5f23de2e13216cdbac46357631904:/mg.c#l1279" rel="nofollow noreferrer">calling <code>my_setenv</code></a>), but the following does:</p> <pre><code>...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Undesired reordering of keys in PHP array<p>I have a quick question. When building an associative array key casting rules mean that strings containing valid ...
<p>The workaround for the issue I have found is to avoid the associative array structure. This is what my loop looks like now:</p> <pre><code>while ($array = mysqli_fetch_assoc($result)) { $experiment[0] = array_keys($array); $experiment[] = array_values($array); }; </code></pre> <p>The annoying thing is that <code>$...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: One of two Android ListView filling too much space<p>I would like to obtain this layout for an Android app for mobile phones:</p> <pre><code>Icon - Object1 ...
<p>It should work if you put your <code>ListView</code>s inside of the child <code>LinearLayout</code>s which hold the <code>LinearLayout</code> that has the <code>TextView</code> and <code>ImageView</code>. You also should be using <code>"0dp"</code> for the <code>height</code> when using <code>weight</code> with a ve...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Android - Playing mp3 directly from the input stream without writing into temp files<p>I'm creating an input stream to buffer and stream a mp3 from cloud . <...
<p>This problem persists even today !!! Check these link out <a href="https://code.google.com/p/android/issues/detail?id=29870" rel="nofollow noreferrer">https://code.google.com/p/android/issues/detail?id=29870</a> and </p> <p><a href="http://www.piterwilson.com/blog/2014/03/11/android-mediaplayer-not-quite-there-yet/...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Identify an array with the maximum value, element wise in numpy<p>I'm looking for a variation on the answer for <a href="https://stackoverflow.com/questions/...
<p>Build a new array from the three and take the <a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.argmax.html" rel="nofollow noreferrer"><code>argmax</code></a> along the first axis:</p> <pre><code>np.array([array0, array1, array2]).argmax(0) # array([0, 1, 1]) </code></pre>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: VHDL: How to declare a variable width generic<p>I want to create a VHDL entity with a one generic that changes the width of another generic.</p> <pre><code>...
<p>If you want the <code>POLYNOMIAL</code> parameter to remain a generic you can specify it as an unconstrained array. You can also dispense with the <code>WIDTH</code> parameter by replacing all references by <code>POLYNOMIAL'range</code>, <code>POLYNOMIAL'length-1 downto 0</code>, or <code>POLYNOMIAL'length</code> as...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: how to draw dynamically images in canvas from database<p>I am developing canvas and i am storing multiple images in database with its x and y co-ordinates. A...
<p>For each image, create a javascript object containing the image url and its x,y position and push those objects into an array.</p> <pre><code>var images=[]; images.push({x:10,y:20,url:{'myImage1.png'}); images.push({x:10,y:20,url:{'myImage2.png'}); </code></pre> <p>Then turn that array into a string using <code>J...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Images are not loading in live server, which was working fine in local server<p>My images in site was show correctly in local server but not showing in live ...
<p>If you open Firebug while your page is loading, you'll see that for all the images you get a 403 Forbidden. </p> <p>You have to update the .htaccess or apache configuration from the subdomain on which you are hosting your images to allow files to be server on your main domain.</p>
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Hide Layout/View on ListView scroll up<p><img src="https://i.stack.imgur.com/gkWYd.png" alt="enter image description here"></p> <p>Excuse my terrible paint ...
<p>Please have a look at this library <a href="https://github.com/nirhart/ParallaxScroll" rel="nofollow noreferrer">ParallaxScroll</a></p> <p>It very easy to implement and it supports both scrollviews, listviews wtc</p> <p>I use the following to browse for new libraries etc..enjoy :D</p> <p><img src="https://i.stack...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Cannot access a method<p>I'm having error with the below code. I cannot call the function ShowUp(). Is the class Dx in wrong place or was the method declared...
<p>The function is not static.</p> <p>So either change your function definition or create an instance. And also your function needs to be internal or public as @uguraldanmaz mentioned:</p> <ol> <li><p>Changing your function into static function</p> <p><em>public static</em> void ShowUp()</p></li> <li><p>Creating an ...
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions. Stackoverflow question: Add has many association with devise<p>I wonder if is possible to relations with the user model devise. For example, a user can have multiple phone numbers a...
<p>You can create different model to save detail information of the user if you have multiple phone numbers and addresses. Say information.rb is new model with its corresponding table as informations. In information.rb write <code>belongs_to :user</code> and in user.rb write</p> <pre><code>has_many :informations </co...