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:
Cumulative count of occurrences per value in array in Kusto<p>I'm looking to get the count of query param usage from the query string from page views stored ... | <p>you could try something along the following lines:</p>
<pre><code>datatable(url:string)
[
"https://a.b.c/d?p1=hello&p2=world",
"https://a.b.c/d?p2=world&p3=foo&p4=bar"
]
| project parsed = parseurl(url)
| project keys = bag_keys(parsed["Query Parameters"])
| mv-expand key = ['keys'] to typeof(st... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
String interpolation: How do I make this function work with any type<p>This is a function to work with lists in string interpolation. It takes a List and an ... | <p>The .NET framework already gives you a generic function to achieve what you are trying to do <a href="https://docs.microsoft.com/en-us/dotnet/api/system.string.join?view=netframework-4.8" rel="nofollow noreferrer">String.Join</a> and you can combine it with a LINQ Select statement, which will allow you to use a lamb... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to write number of days in c#<p>how can I write program in c# that show the number of the day</p>
<p>for example :</p>
<p>I ask a user to type a day an... | <p>Try to use <a href="https://msdn.microsoft.com/en-us/library/system.datetime.dayofweek%28v=vs.110%29.aspx" rel="nofollow"><code>DateTime.Now.DayOfWeek</code></a>. Definition:</p>
<pre><code>namespace System
{
using System.Runtime.InteropServices;
[Serializable, ComVisible(true), __DynamicallyInvokable]
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Post form to controller in MVC(Orchard)<p>I have a simple form:</p>
<pre><code><form actions="/module_name/controller_name/function_name" action="GET">... | <p>You probably haven't set up routing for your module. Create a class that looks like this:</p>
<pre><code>public class Routes : IRouteProvider {
public void GetRoutes(ICollection<RouteDescriptor> routes) {
foreach (var routeDescriptor in GetRoutes())
routes.Add(routeDescriptor);
}
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Incompatible Declaration in Implementation file in C++<p>I have a couple incompatible declarations in my implementation file for my lab that I cant figure ou... | <pre><code>void setCourseName(std::string); // declaration in .h
void GradeBook::setCourseName() const // implementation in .cpp
</code></pre>
<p></p>
<pre><code>void setInstructorName(std::string); // declaration in .h
void GradeBook::setInstructorName() const // implementation in .cpp
</code></pre>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to update table after immediate insertion in SQL Server<p>I am inserting into a table with 5 rows and here after inserting every row I have to take the i... | <p>Try the following:</p>
<pre><code>DECLARE @id1 INT ,
@id2 INT ,
@id3 INT ,
@id4 INT ,
@id5 INT
INSERT INTO TABLEB
VALUES ( id1 )
SET @id1 = SCOPE_IDENTITY()
INSERT INTO TABLEB
VALUES ( id2 )
SET @id2 = SCOPE_IDENTITY()
INSERT INTO TABLEB
VALUES ( id3 )
SET @id3 = SCOPE_IDENTITY()
INSERT INTO... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I move the first tab above?<p>I want to rise above #first_tab so as to be in line with all the others.
I have done wrong in this code?</p>
<p>This i... | <p>Since you are using <code>display:inline-block</code> the default alignment is <code>baseline</code></p>
<p>You have to set this to <code>vertical-align:top</code></p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Glitch with internet explorer using a textarea and CSS font-size<p>I have created a js (with jQuery) to change the size of the text inside a textarea by chan... | <p>I think this should work for you :</p>
<pre><code>var value=$("#id").value();
$("#id").css("font-size",fontsize + "px").replaceWith( $("#id").clone().val(value) );
</code></pre>
<p>All I am doing is re-inserting the element in the DOM. I think this is the only way to solve this annoying bug.</p>
<p><em>Happy codi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SVN: Is there a way to copy to a branch all the latest revisions of the files committed under a revision, but only of those files?<p>I've read the entire "SV... | <p>First, an answer to your direct question: you will need to "cherry pick merge" each individual file. Luckly <code>svn merge</code> can act on individual files as well as on directory paths.</p>
<p>You <em>could</em> cherry-pick merge all revisions of interest and then revert the file changes you don't want, but the... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get file information from recursive folders<p>What I'd like to do is get 6 pieces of file information from every file in a folder, and all folders beneath it... | <p>You can get most of these using the <a href="https://msdn.microsoft.com/en-us/library/system.io.fileinfo(v=vs.110).aspx" rel="nofollow noreferrer"><code>FileInfo</code></a> class....</p>
<pre><code>var info = new System.IO.FileInfo(@"c:\folder\file.ext");
</code></pre>
<p>It has properties for <code>Length</code>,... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to do the following entry gathering?<p>I want <code>out[b,i,j,c]:=params[indices[b,i,j,c],b,i,j,c]</code>. I am aware of <a href="https://www.tensorflow.... | <p>You can do that like this:</p>
<pre><code>import tensorflow as tf
# 5D or more tensor
params = tf.placeholder(tf.float32, [2, 3, 4, 5, 6])
# 4D tensor
indices = tf.placeholder(tf.int32, [5, 4, 3, 2])
# We assume the number of dimensions of indices is statically known
# Otherwise you would need to use tf.while_loop... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring Boot + Spring Data JPA + Transactions not working properly<p>I have created a Spring Boot application using 1.2.0 version with spring-boot-starter-dat... | <p>From <a href="https://stackoverflow.com/questions/28606518/spring-boot-spring-data-jpa-transactions-not-working-properly#comment45520482_28606518">comment</a> by @m-deinum:</p>
<blockquote>
<p>Make your PersonService <code>public</code> as well as the method you are calling.</p>
</blockquote>
<p>This seems to ha... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using cin to read multiple int on one line<p>I am trying to take integers as input from a file using cin. The file is set up in a way that there are two sepa... | <p>This is very easy, just use a <code>while</code> loop with <code>cin</code>, and deal with each number inside the loop.</p>
<pre><code>int x;
while(cin >> x){
cout << x;
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Qt: Accessing a public object from another window<p>This program is supposed to create the object <code>mBulbPrimary</code> of the class <code>pointCloudBool... | <p>This is probably what @hyde is describing in the comments:</p>
<p>In mainwindow.h add:</p>
<pre class="lang-cpp prettyprint-override"><code>private slots:
void saveMBulb(const QString &filePath);
</code></pre>
<p>In mainwindow.cpp <code>MainWindow</code> constructor add:</p>
<pre class="lang-cpp prettyprin... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Debugging Prawn reached end of graphics state stack<pre><code>class Report
attr_reader :pdf
def to_pdf
Prawn::Document.new(page_layout: page_layout) ... | <p>You have a repeater which is applied to every page, and whose content is more than one page wide. That's what Prawn is telling you with that not very self-explaining error. </p>
<p>Now, from the stacktrace the error comes from <code>write_header</code> call. It seems your bounding box on that method has a fixed hei... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculation between 2 points in 2D-array<p>I am doing 2D array map like:</p>
<pre><code>* 0 1 2 3 4 5 6
0 # # # # # P #
1 # # # # # # #
2 # # # # # # #
3 # ... | <p>I think you are referring to being able to move in a diagonal. If you move in a diagonal, you actually move <code>sqrt(2)</code> "units", so you will be able to "move faster", because you take more than one unit per step when you do use diagonals.</p>
<p>It works in some situations for you when you have the troll a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to regenerate values in AutoSeededX917RNG<p>I need to regenerate the pseuorandom values when I need them. My code is:</p>
<pre><code>static const unsign... | <blockquote>
<p>How to regenerate values in AutoSeededX917RNG</p>
</blockquote>
<p>You can't because you are using an <code>AutoSeeded*</code> generator.</p>
<h2>-----</h2>
<blockquote>
<p>I need to regenerate the pseuorandom values when I need them...</p>
</blockquote>
<p>In that case, I think you only have tw... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Identify String in one Tab, spread String in another tab with the String data<p>My request is a little bit difficult to describe so I made an example of what... | <p>Here's an attempt in cell A2 on the MK.Idea tab.</p>
<pre><code>=ARRAYFORMULA(QUERY(UNIQUE(SPLIT(TRANSPOSE(SPLIT(TEXTJOIN("#",TRUE,SUBSTITUTE(TRIM(IF(LEN({Char!A2:A;Char!A2:A;Char!A2:A;Char!A2:A})*LEN(TRANSPOSE(Tags!B2:B))*REGEXMATCH({Char!B2:B;Char!C2:C;Char!D2:D;Char!E2:E},TRANSPOSE(SUBSTITUTE(Tags!B2:B,"All","")... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Update a buttons UIImage while a counter decreases iOS<p>I am trying to change a UIButton's UIImage every second, until a counter reaches 0. I have tried NS... | <p>Remember to make all UI changes on the main thread. And use a NSTimer! try this (I didn't run it myself, let me know if it doesn't work): </p>
<pre><code>- (void)startTimerWithDelay:(NSInteger)delay {
_timerDelay = delay;
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to iterate a simple callback with cursor in Java?<p>Here's a simple example of my problem. Suppose I have an API that returns the following:</p>
<pre><c... | <p>Try using <code>this</code> instead of <code>checkForMoreItems</code>:</p>
<pre><code>requestItems(response.getCursor(), this);
</code></pre>
<p>This should resolve the issue, that the variable is not initialized, since it is technically an attribute of the anonymous class object you created. Another solution migh... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
VBA enumeration to avoid copy/paste<p>I'm not sure how to name this, so feel free to update if you can make it more descriptive.</p>
<p>Here's what I'm tryi... | <p>I'm not able to test this comprehensively without a better idea of the data you're manipulating, but what about setting up your variables as arrays, and iterating through? It would look something like this:</p>
<pre><code>Call SetLocalSetting(LOCALE_SDECIMAL, ",")
Dim qty(0 To 10) As Variant
Dim price(0 To 10) As V... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ 2a - polymorphic range<p>I am writing a C++ library and have had this <em>amazing</em> idea of using as much C++2a/C++20 as possible. Thus, I am using th... | <p>Range views, and many other template techniques, are not meant to be used with inheritance-based polymorphism. This is much like how <code>vector<BaseClass></code> is not especially useful.</p>
<p>If you need runtime polymorphism, then the tool you want is not inheritance (directly); it's type erasure. That i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I check if dataTaskWithRequest is complete?<p>I'm new to iOS programming and trying to create my first app. I am fetching some data from a server usin... | <p>The view controller doesn't need to know when <code>completionHandler</code> is called. All you do is you have <code>completionHandler</code> actually dispatch a <code>tableView.reload()</code> back to the main queue (which then triggers the calling of the <code>UITableViewDataSource</code> methods). It's the <code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Changing linetype within timeseries ggplot2<p>I have a time series dataset of stream flow and water temperature that I’d like to plot and highlight when temp... | <p>Does this do what you want?</p>
<pre><code>ggplot(df, aes(date, val1))+
geom_segment(aes(xend = lead(date),
yend = lead(val1),
lty = lead(group))) +
geom_point(aes(col = group))
</code></pre>
<p><a href="https://i.stack.imgur.com/pWV3i.png" rel="nofollow noreferrer"><img s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you access a MongoDB database from two Openshift apps?<p>I want to be able to access my MongoDB database from 2 Openshift apps- one app is an interac... | <p><strong>2018 update: this applies to Openshift 2. Version 3 is very different, and however the general rules of linux and scaling apply, the details got obsolete.</strong></p>
<p>Although @MartinB answer was timely and correct, it's just a link, so let me put the essentials here.</p>
<p>Assuming that setting up a ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
hbm2ddl not working with mysql maven spring hibernate for sql file<p>I want to populate the DB with some data.</p>
<p>I have the sql script for that.
No matt... | <p>[Solved]</p>
<blockquote>
<p>Error was multiline comments in the sql file.</p>
</blockquote>
<p><code>src/main/resources/scripts/import1.sql</code></p>
<ul>
<li><p>here till scripts folder classpath should be set </p></li>
<li><p>and also multiline comments like in java will not work(Silly mistake)
and cause e... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get the last record when two columns have same values?<p>i want to get a last row based of Updated_ts on the bases of same gr_number and course</p>
<... | <p>I think you can use <code>row_number()</code>:</p>
<pre><code>select t.*
from (select st.gr_number, st.course, st.is_active_flg, st.status, st.updated_ts,
sum(case when st.status = 'COMPLETED'
then 1 else 0
end) over (partition by st.gr_number) as completedCourse,
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does % find the index which to split an array in python<p>So I am working on a codility training and working on the CyclicRotation where you rotate an ar... | <p>Imagine repeating your array infinitely in both directions. So, for example, if you have</p>
<p><code>A = [0,1,2]</code></p>
<p>imagine </p>
<p><code>[...,0,1,2,0,1,2,0,1,2,...]</code></p>
<p>Say we want to circular shift <code>A</code> to the right by <code>1</code>. Our array <code>A</code> should go from <cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git Python seems not work<p>I'm begin in python and trying to use <a href="http://gitpython.readthedocs.org/en/latest/tutorial.html" rel="nofollow" title="Gi... | <p>The module works fine, you're not using it properly.
If you want to access the commits in a git repository, use <code>Repo.iter_commits()</code>. The method <code>commits()</code> you're trying to use doesn't exist in <code>GitPython.Repo</code>. You can check the official module documentation <a href="http://gitpyt... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ohLibspotify not calling any callback after login<p>I'm trying to create a project where I use the ohLibspotify .Net libspotify wrapper to login to spotify a... | <p>I'm the original author of the ohLibSpotify wrapper library. I think you possibly have overlooked the need to call ProcessEvents. ohLibSpotify tries as far as possible to provide only a thin layer over libspotify. Almost everything in the libspotify docs remains relevant when you are using ohLibSpotify, and you shou... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TravisCI, building with Gradle and deploying with Crashlytics<p>I've successfully deployed to Crashlytics from TravisCI with iOS, and now I'm tackling our An... | <p>This is my build.gradle for crashlytics and it works</p>
<pre><code>buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.crashlytics.tools.gradle:c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala: filter with different conditions specified by tuples in a set<p>I have a RDD with it's field1 containing a drug name and field2 containing correspondi... | <p>It won't work like this, Scala string literal's won't be translated into operator.
Instead you need to use function to compare values from RDD with filter results.</p>
<p>Please, see code example below:</p>
<pre><code>type Compare[T : Numeric] = (T, T) => Boolean
type DoubleCompare = Compare[Double]
val > :... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cygwin Split Terminal Vertically<p>I've read online to split the window to do Ctrl+a | or Ctrl+a Shift+S but its not working for me. I am hoping I'm just mis... | <p>I don't see that option for Cygwin itself, but those commands match up to options in GNU Screen: <a href="http://aperiodic.net/screen/quick_reference" rel="nofollow">http://aperiodic.net/screen/quick_reference</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android Studio 1.0.2: java.lang.RuntimeException: Unable to start activity ComponentInfo: java.lang.NullPointerException<p>Here is the error:</p>
<pre><code... | <p>try changing your theme to this</p>
<pre><code><style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
</code></pre>
<p>and not the AppCompat Version.It basically depends on whch api you are targeting.If it less than 14 use </p>
<pre><code><style name="AppTheme" parent="Theme.AppCompat.L... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need an update query to update score from reference table to target table based on the columns of target table<p><a href="https://i.stack.imgur.com/RBT16.png... | <pre><code>UPDATE table1 t11
JOIN table1 t12 ON t11.batchid = t12.batchid
JOIN table2 t2 ON t12.id = t2.id
SET t11.score = t2.score
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rails 4 + Devise 3 - How to permit parameters for update action?<p>In the <code>users</code> controller:</p>
<pre><code>class UsersController < Applicati... | <p>Have you whitelisted your parameters?. In <code>applicationController</code>:</p>
<pre><code>before_filter :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) << [:name]
end
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Excel VBA - Setting one-row worksheet range of formula to blank multi-row range, relative references skipping rows<p>Excel VBA - Setting one-row worksheet ra... | <p>This is related to the range.range effect described <a href="https://docs.microsoft.com/en-us/office/vba/api/excel.range.range" rel="nofollow noreferrer">in remarks here</a>. A solution is to use the <a href="https://docs.microsoft.com/en-us/office/vba/api/excel.range.copy" rel="nofollow noreferrer">range.copy</a> m... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I make my dropdown work with display: none and display: block?<p>I have the following html code:</p>
<pre><code><li class="profile-dropdown">
... | <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>.profile-dropdown ul {
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 0.5s linear;
position: absolute;... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to construct a class from procedures with different signatures<p>Consider the following class structure.</p>
<pre><code>public class Employee
{
publ... | <p>If this is how you build a <code>Company</code>:</p>
<pre><code>private Company BuildCompany(SqlDataReader reader)
{
return new Company()
{
CompanyId = ConvertFromDbValue<string>(reader["CompanyId"]),
Name = ConvertFromDbValue<string>(reader["Name"])
};
}
</code></pre>
<p>An... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
typesafe activator dependency error<p>I just download the last activator version (version 1.2.12 - offline distribution) and I have found some errors in depe... | <p>Thank you singhakash and Sarvesh, it is a network problem.<br/></p>
<p>I think the best solution is to set environment variable ACTIVATOR_OPTS.
I add this line to my .bashrc file (~/.bashrc):</p>
<pre>
export ACTIVATOR_OPTS="-Dhttp.proxyUser=MyProxyAccount -Dhttp.proxyPassword=MyProxyPwd -Dhttp.proxyHost=MyProxyIp... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does select max from a column with querybuilder return an array?<p>I'm trying to get the last contact of a user, here is the query:</p>
<pre><code>publi... | <p><code>getOneOrNullResult()</code> returns a single row, which is still an array, even if it has only one column.</p>
<p>Use <code>getSingleScalarResult()</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Chocolatey list without version?<p>What is the secret flag to use for listing all Chocolatey install packages WITHOUT version (only package names) ? :)</p>
... | <p>There isn't a secret flag to enable this.</p>
<p>Part of the value of a package manager is to know what package is installed, and also what version of the package is installed.</p>
<p>You could run the command:</p>
<pre><code>choco list -l -r
</code></pre>
<p>Which would output the information in a slightly diff... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Output sentences in order in Java<p>I'm currently trying to get this output where the sentences in the text file are in order:</p>
<pre><code>0 : The cat in... | <p>You're not writing the contents to output. Do something like this:</p>
<pre><code> for(i = 0; i<list.size(); i++)
{
System.out.println(i + ":" + list.get(i));
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to extract +93 form Country name with code<p>I want to extract country code(+93)
ex: <code>Afghanistan(+93)</code> here i need only <code>+93</code> how... | <p>You can easily use something like this;</p>
<pre><code> String s = "Afghanistan(+93)";
int plusf = s.indexOf("(");
int plusl = s.indexOf(")");
String newString = s.substring(plusf+1, plusl);
System.out.println(newString);
</code></pre>
<p>Output is : +93</p>
<p>For your list try this;</p>
<pre><code> ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Power Bi Custom Column funtion<p>In MQuery, I'm trying to create a custom column. If another column has a value of 1 through 5 then the value in new column ... | <p>The IF condition in Power query needs to be capped off with an ELSE statement. Just add the ELSE and you should be good to go:</p>
<pre><code>=if[#"Chair Independence Level"] = "1" then "Same Product Line"
else if[#"Chair Independence Level"]= "2" then "Different Product Line"
else if[#"Chair Independence Level"]... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ionRangeSlider is undefined, unable to update<p>I'd like to reset the ionRangeSlider 'from' value the original when the bootstrap model closes. I'm however u... | <p>Bootstrap was causing some issues, i couldn't use <code>$(this)</code> to search for ionRangeSlider in the event.</p>
<p>This works:</p>
<pre><code> var indexModule = $(this).closest('.col-md-3').index();
// Get the ion range slider
var rangeSlider = $("#modules .col-md-3").eq(indexModule).find('.order... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create new variable in data table based on conditions on other variables<p>I would like to create a new variable in a data table whose value depends on the r... | <p>Your condition can be rewritten as</p>
<pre><code>bigcol <- apply(2*DT > rowSums(DT),1,which)
</code></pre>
<p>since a > b+c is equivalent to 2a > a+b+c, and so on. Your new column is</p>
<pre><code>DT[,newcol:=
sapply(bigcol,function(x) if(length(x)==0) 'x' else letters[x])
]
</code></pre>
<hr>
<p>A ma... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Openshift always gives 503 error for Node.js app<p>I'm trying to setup my very first Node.js + express web app using Openshift's free service.</p>
<p>I inst... | <p>The problem was, that the IP address was set up incorrectly , after the <code>app.listen</code> method. So, I had to change my code as follows:</p>
<pre><code>var express = require('express');
var app = express();
var fs = require('fs');
var parser = require('body-parser');
//Setup ip adress and port
var ipa... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Change MYSQL_DATABASE etc. in docker compose<p>I am having some issues getting docker to create a completely new image with a new database.</p>
<p>I first s... | <p>The script to generate the database from scratch (which evaluates the given environment variables) is only run on the first generation for the volume, as you can see in <a href="https://github.com/docker-library/mysql/blob/master/5.7/docker-entrypoint.sh" rel="nofollow noreferrer">https://github.com/docker-library/m... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inserting view to another view OnClick in Android<p>I'm trying to make a main screen with a bunch of tiles (think Windows 8), and when clicked, a sub-menu wi... | <p>Have a look at the <code>addView</code> method on the ViewGroup class (which LinearLayout and the other layouts inherit from). This will add the view you supply as a parameter to the layout.</p>
<p>For example, say you have a LinearLayout called myLayout which you have already got a reference to in your Activity co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
fullcalendar filter results from json<p>I'm fairly new to ruby and I'm trying to set up a calendar of room viewings.</p>
<p>So far I have got a calendar to ... | <p>What you need is to look up and generate the <code>@viewings</code> variable based on the <code>room_id</code>, so you need something like this:</p>
<pre><code>@viewings = Viewing.where(room_id: 1)
</code></pre>
<p>That would make <code>@viewings</code> get populated with only those viewings with that <code>room_i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why does this code not terminate<p>This code : </p>
<pre><code>object SpeedTest extends Application{
val l = (1 to 50).toList.par
println("par done")
... | <p>As Ben Reich stated, this is possibly a REPL bug, and I think it is one that is happening because of a sort of "recursion deadlock". I can get this to work if I move the counter variable into another object as below:</p>
<pre><code>object Somes{ var counter = 0}
object SpeedTest{
val l = (1 to 7).toList.par
p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Wordpress navigation <ul> additional fields<p>are there any chances to make output of <code>wp_nav_menu</code> look like:</p>
<p><code><ul class="..." da... | <p>This will do the trick:</p>
<pre><code><?php wp_nav_menu( array( 'items_wrap' => '<ul id="%1$s" class="%2$s" data-uk-nav="">%3$s</ul>' ) ); ?>
</code></pre>
<p><a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" rel="nofollow">http://codex.wordpress.org/Function_Reference/wp_na... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF: Which properties are applied to the ControlTemplate<p>I'd like to understand which properties of an xaml Control are applied to the ControlTemplate of t... | <p><code>Window</code> class inherit <code>FrameworkElement</code> and all its properties including <code>FrameworkElement.Margin</code>. Same goes for <code>Control.Background</code>. Your question is why you have to do something to have <code>Control.Background</code> working.</p>
<p>Answer is simple:</p>
<ul>
<li>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
LINQ to Entities DeleteAllOnSubmit throws Unknown Method<p>I'm re-writing an app that used to use LINQ to SQL DeleteAllOnSubmit and am now using LINQ to Enti... | <p>Something on following lines should work for you:</p>
<pre><code> public void DeleteAllOnSubmit<T>(IEnumerable<T> items) where T : class
{
foreach (var item in items)
{
Set<T>().Attach(item);
Set<T>().Remove(item);
}
SaveChanges... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to start minikube with Hyper-V on windows 10<p>When I run this command:</p>
<blockquote>
<p>minikube start --vm-driver=hyperv</p>
</blockquote>
<p... | <p>finally, i was able to launch minikube with --force flag, there is an issue with minikube 1.7.2 described here <a href="https://github.com/kubernetes/minikube/issues/6579" rel="noreferrer">#6579</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to declare or create a scheduled GCP function using serverless framework?<p>I'm using GCP and serverless framework. And wish to create a scheduled functi... | <p>Thanks for all the responses, this is the complete solution as i see it including yaml:</p>
<p>In serverless.yml:</p>
<pre><code>functions:
oneMinute:
handler: oneMinuteHandler
events:
- event:
eventType: providers/cloud.pubsub/eventTypes/topic.publish
resource: 'projects/${self... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you get the current url in Twig?<p>Inside a twig template I will check </p>
<pre><code>if url is: http://example.com/search?keyword=test
{% set page... | <p><a href="https://github.com/codeguy/Slim-Views" rel="nofollow">Slim-Views</a> is your friend. Install it via composer and add the <strong>TwigExtension</strong>.</p>
<pre><code><?php
require 'vendor/autoload.php';
$app = new \Slim\Slim(array(
'view' => new \Slim\Views\Twig()
));
$view = $app->view();... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ext.Ajax Cross-Domain post request<p>I'm testing ExtJS v.5.1.0.107 and I my goal is that to perform a post ajax request on a different server. I've found som... | <p>Make sure your files are reachable from the server...</p>
<p>If the server is well configured, try add a response header for</p>
<pre><code>Access-Control-Allow-Origin: *
</code></pre>
<p>This command will allow cross-domain through Ajax operations. Then, the requested file (test.php for instance on the targeted ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is KafkaProducer fault tolerant?<p>We have a system which receives data from the users and pushes data to kafka and only when we are sure that the data has b... | <p>According to <a href="https://kafka.apache.org/08/design.html" rel="nofollow">Kafka's Design</a> : </p>
<blockquote>
<p>Asynchronous send</p>
<p>Batching is one of the big drivers of efficiency, and to enable batching the Kafka producer has an asynchronous mode that accumulates data in memory and sends out l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I need help removing a border on post content in WordPress using CSS<p>I'm sure there is a painfully simple way to resolve this but I haven't been able to fi... | <p>To change style.css ..</p>
<p>line number 621 :</p>
<pre><code> .entry-thumb img{
border:none
}
</code></pre>
<p>and
line number 650:</p>
<pre><code> .hentry .post-content, .single .hentry, .page .hentry{
border:none
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to get the max path cost in binary tree<p>how to get the max path cost in binary tree,
and print a vector includes all the path data elements?</p>
<p>i ... | <ol>
<li>Bottom up process the tree, store the <code>data += max subtrees</code>.</li>
<li>Start at the top and print the value which is now <code>(data - max subtrees)</code> and then print the max child.</li>
<li>Go top down and restore data values, <code>data -= max subtrees</code>.</li>
</ol>
<p>Notes:</p>
<p>Thi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to change include_path in php.ini file?<p>I tried in many ways, but I am failing to make changes.,</p>
<p>I want to change include_path like this:</p>
... | <p>If you want to change your include path in your <code>php.ini</code> file just search for <code>include_path</code> And you should find something like this:</p>
<pre><code>; Windows: "\path1;\path2"
include_path=".;C:\xampp\php\PEAR"
</code></pre>
<p>Now you can change it here and restart the server and it should ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to run sample Android Wear app on physical device<p>I am trying to figure out the Android Wear APIs. I've imported the <a href="https://developer.andr... | <p>I have gotten it to work, but I'm not sure what was the issue for it not working. If you are seeing this problem, this is what I would do to make sure you're setup properly:</p>
<ol>
<li>Ensure your watch is paired with your phone in Android Wear.</li>
<li>Ensure both watch and phone have debugging enabled.</li>
<l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Java Game: Shooting Bullets<p>I am (kind of) new to creating games with Java. I created some simple games before like a bag collecting game but now I want to... | <p><strong>EDIT</strong>
I just read that you only have four directions. In that case you do not need a direction vector. Just set the direction once.
Ok so the code example.</p>
<p>First the gameloop. Add the firedBullets for update in the gameloop. Every fired bullet gets moved on its direction vector.</p>
<pre><co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sklearn syntax error despite existing working code<p>I have the following code in Python 2.7 whose goal is to create a plot of the results of an SVM using nu... | <p>I think you've missed some parentheses when casting to int in the line above. </p>
<pre><code>xx, yy = numpy.meshgrid(numpy.arange(x_min, x_max, (int(x_max)-int(x_min)/200.0)), numpy.arange(y_min, y_max, (int(y_max)-int(y_min)/200.0)))
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Django + Python social auth: How to configure OAuth for GitHub Enterprise?<p>With Django and social-auth-app-django, I can authorize with <code>https://githu... | <p><code>"{% url 'social:begin' 'github' %}"</code> should be <code>"{% url 'social:begin' 'github-enterprise' %}"</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use jquery to replace text in my cart<p>I'm trying to replace shipping text in my cart. The code below doesn't work. </p>
<pre><code> $("span#shippingOp... | <p>You need to use <a href="http://api.jquery.com/text/" rel="nofollow"><code>text()</code></a> jQuery method and JavaScript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace" rel="nofollow"><code>replace</code></a> method:</p>
<p><div class="snippet" data-lang="j... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compact way to produce a large sequence of strings in lexical order<p>I want to generate a sequence of strings with the following properties:</p>
<ol>
<li>L... | <p>A close idea to yours. (more rafined than my first edit...).</p>
<p>Let our alphabet be <code>A = {0,1,2,3}</code>.</p>
<p>Let <code>|2|</code> mean we iterate from 0 to 2 and <code>|2|^2</code> mean we generate the cartesian product in a lexically sorted manner <code>(00,01,10,11)</code>.</p>
<p>We start with </... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does LOCK IN SHARE MODE work with COUNT<p>Does</p>
<pre><code>SELECT COUNT(*) FROM parent WHERE NAME = 'Jones' LOCK IN SHARE MODE;
</code></pre>
<p>lock th... | <p>The documentation for <code>lock in share mode</code> specifies:</p>
<blockquote>
<p><code>SELECT ... LOCK IN SHARE MODE</code> sets a shared mode lock on any rows
that are read. Other sessions can read the rows, but cannot modify
them until your transaction commits. If any of these rows were changed
by ano... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getting cellular network status via ADB shell<p>Is it possible to check via ADB if the phone is connected to a cellular network?</p>
<p>I had a look at <a h... | <p>Certainly using the command from shell : </p>
<pre><code>dumpsys telephony.registry
</code></pre>
<p>or directly from adb :</p>
<pre><code>adb shell dumpsys telephony.registry
</code></pre>
<p>The values of <strong>mServiceState</strong> or <strong>mDataConnectionState</strong> will help you.
I tried in Plane mo... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Interactive credentials for Azure Blob<p>I got this code to obtain interactive credentials (this prints a url, and a device code to login) in Jupyter Noteboo... | <p>Yes, AAD token authentication is supported. See <a href="https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage/azure-storage-blob#types-of-credentials" rel="nofollow noreferrer">here</a>.</p>
<pre><code>from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClien... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Value in dropdown that doesnt exist<p>I have create a chart which pulls information from a pivot table.</p>
<p>One of the fields I am pulling in is the mont... | <p><em>In order to remove items that have been deleted to the data source...</em></p>
<ol>
<li>Right click on Pivot Table</li>
<li>Select <code>Pivot Table Options...</code></li>
<li>Select '<code>Data</code> Tab</li>
<li>Change <code>Number of items to retain per field</code> to <strong>None</strong></li>
</ol>
<hr>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get Pipeline Value of GitHub Issues?<p>I use ZenHub to manage my Issues on GitHub.
When I go to the detail of an issue I can see the property "pipeline" in ... | <p>With the Github API v4, you can query the <a href="https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#status" rel="nofollow noreferrer">combinedContexts of a commit</a> to retrieve a list of <a href="https://docs.github.com/en/free-pro-team@latest/graphql/reference/objects#statuscontext" rel="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculating Average in Google doc based on values in other columns<p><img src="https://i.stack.imgur.com/RS6Nb.jpg" alt="enter image description here"></p>
... | <p>The function you're looking for is <code>averageif</code>. If your two columns are A and B, and you have 10 rows:</p>
<pre><code>=AVERAGEIF(A1:A10,"Set 1",B1:B10)
=AVERAGEIF(A1:A10,"Set 2",B1:B10)
=AVERAGEIF(A1:A10,"Set 3",B1:B10)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TableViewCells Array reorders itself after updating TableView<p><strong>hello my fellow programmer friends,</strong></p>
<p>i have run into a problem with s... | <p>Long story short dequeueReusableCell is intended to be called from 'tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath)' which is why you are having issues.</p>
<p>A more elaborated story is that it returns cells which table view itself considers to be no longer used, the fact that you store refe... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to mock a Rails subclass contant in Rspec?<p>I have a <code>BaseController</code> that I want to superclass other controllers with. I also superclass som... | <p>I don't see the issue with using <code>FakeController2</code> or any other name, but the only public alternative I can think of is to introduce a module so that your second <code>FakeController</code> exists in a different namespace, as in:</p>
<pre><code>module Foo
class FakeController < ApplicationController... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Deleting data from cloudkit with swift<p>How do I delete some data I put into the cloud? I made an app that when you enter a url in 1 view controller it uplo... | <p>You can delete records with code like this:</p>
<pre><code>database.deleteRecordWithID(CKRecordID(recordName: recordId), completionHandler: {recordID, error in
NSLog("OK or \(error)")
}
</code></pre>
<p>where database is the CKDatabase that you are using.</p>
<p>But in your situation it might be better to updat... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Facet plot ordered by expression<p>I have a melted data frame like this:</p>
<pre><code>> head(Merged_Columns.m)
SYMBOL Cond logCPM variable val... | <p>Plotting order in ggplot is usually determined by the ordering of levels in the factor that you are using. Other questions show you how this is the case e.g. <a href="https://stackoverflow.com/questions/4774804/plotting-order-within-a-faceted-dotchart-in-ggplot2?rq=1">Plotting order within a faceted dotchart in ggpl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
isset() is not working as wishing in php form<p>I want to access a variable from <code>$_GET</code> in a php form but isset is not working as expect to fulfi... | <p>First, I recommend using POST method on such action (deletion) as with that you will avoid <a href="https://www.veracode.com/security/sql-injection" rel="nofollow noreferrer">SQL Injection</a>, And your code mistake is on spelling ($_GET inside isset function not $GET)</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Couldn't find "libgojni.so"<p>After importing a third party library into my Android project, I get the following error:</p>
<pre><code>java.lang.Unsatisfied... | <p>These have to added as <code>src/main/jniLibs/armeabi-v7a/libgojni.so</code> & <code>src/main/jniLibs/arm64-v8a/libgojni.so</code> (<code>jniLibs.srcDir</code> defines that path). <a href="https://github.com/golang/mobile" rel="nofollow noreferrer">golang/mobile</a> has examples. If these are custom JNI bindings... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Facebook Graph API - page_impressions inconsistent on set dateRange?<p>I'm using Facebook Graph API v2.2 (had this problem on v2.1 as well) and I'm requestin... | <p>Seems this is a Facebook Bug. Found a bugreport about it on the Facebook Developers forum. Different endpoint, same problem:
<a href="https://developers.facebook.com/bugs/877357682326329/" rel="nofollow">https://developers.facebook.com/bugs/877357682326329/</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Graphql Sangria Many-to-Many example<p>I'm working on a Many-to-Many relation with Sangria and Slick.
I have 3 objects: Role, Permission and RolePermission (... | <p>You have to define <code>Relation</code> type for both related entities. It's not easy to answer in short comment on StackOverflow, but I've explained such kind of relation in my blog post: <a href="https://scalac.io/akka-http-sangria-graphql-backend#implementing-many-to-many-relation" rel="nofollow noreferrer">http... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use minimum possible width<p>I have a container that effectively, I want to compress the contents to their minimum width without scroll bars. fit-content is ... | <p>I think what you are looking for is the <code>min-content</code> width value:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.box {
background-color: green;
padding... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to show specific element in table cells using angularjs<p>Based on my searches when you want to hide the visibility of element in html using angularjs ju... | <p>You should add <code>myVar</code> for each user in the <code>ng-repeat</code> list.</p>
<pre><code><tr ng-repeat="user in users">
<td><p ng-show ="user.myVar">CHECK</p>{{user.id}}</td>
<td>{{user.name}}</td>
<td>{{user.stat}}</td... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
replacing x[i by x[i] in R for i =1,2,3,4<p>I am trying to replace Gene1, Gene2, Gene3 and Gene4 by x[1], x[2], x[3] and x[4]. I was able to get one sided br... | <p>This is what is requested, although I admit I'm not sure what the purpose is:</p>
<pre><code> for (i in 1:4){
func[[i]]<-noquote(n$interactions[[paste0("Gene",i)]]$expression)
gfunc[[i]]<-gsub("(Gene)([[:digit:]])", "x[\\2]", func[[i]])
}
> gfunc
[[1]]
[1] (!x[1] & x[2] &... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pandas data frame: get maxima of a column after grouping by another coumn<p>I try to get maximum of B for each of the A's. C and D are there, because my data... | <p>You need to <code>groupby</code> the 'A' column, then select 'B' column and call <code>max()</code> on the column:</p>
<pre><code>In [42]:
df.groupby('A')['B'].max()
Out[42]:
A
10 1002
20 2003
30 3001
Name: B, dtype: int64
</code></pre>
<p>You can perform multiple functions on separate columns at once, s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Random 30 numbers (float) between 2 ranges (100 and 150 for example) that sums up to N<p>I want to generate random numbers between 2 ranges (100 and 150 for ... | <p>This function has four parameters: <code>size</code>, <code>min</code>, <code>max</code>, and <code>sum</code>- where <code>size</code> is the length of the array you want to produce. will return <code>false</code> if the <code>mix</code>/<code>max</code>/<code>size</code> combo you pass is an impossible task, meani... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
fetch value from a given array<p>I have an array stored in $result like this</p>
<pre><code>$result=$array
</code></pre>
<p>by using echo $result i get the... | <p>Try this,</p>
<pre><code> <?php
foreach($result as $res){
echo '<pre>'; echo $res['id'];
if(is_array($res['options']) && !empty($res['options'])) {
foreach($res['options'] as $option) {
echo '<pre>'; echo ($option['product_option_id']);
if(is_ar... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TNS:Protocol Adapter Error<p>I am attempting to connect to an Oracle 11.2.0.2 64 bit database from a Win 7 and Win 8.1 machine with the Oracle 11.2.0.4 32 bi... | <p>If I'm following what you're seeing, it sounds like you just want to set <a href="http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_two.htm#i1052303" rel="nofollow">the <code>LOCAL</code> enviroment variable</a> on your Windows boxes to the TNS alias; then you don't have to supply that as you try to connect.<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C++ pointer gets overwritten in for loops<p>Could someone explain why pointers gets overwritten when variables are declared inside a loop?</p>
<p>For exampl... | <p>There is only one <code>num</code>, and you are overwriting <em>that.</em> (And then causing Undefined Behavior, but never mind that.)</p>
<p>There are two simple ways to avoid this mistake.</p>
<p>1) Store objects, not pointers:</p>
<pre><code>int nums[2];
for(int i = 0; i < 2; i++){
cin >> nums[i];... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Issues when testing Epic with TestScheduler<p>I'm using an rxjs epic as a middleware for an async action in a react-redux app.</p>
<p>I'm trying to simulate... | <p>I'm guessing the use of Promise is causing the test to actually be asynchronous. Try changing the stub of <code>ajax</code> to use <code>of(response)</code> instead of <code>from</code> </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is NavigationLink not navigation with SwiftUI<p>I am trying to use a NavigationLink to navigate to the LoginScreen. However clicking up on the button doe... | <p>You have to wrap the view inside a NavigationView { } otherwise, NavigationLink will not work.</p>
<pre><code>struct SplashScreen: View {
@State
var shouldGoHome: Bool = false
@State
var goToDestination: Bool = false
@ObservedObject private var viewModel = SplashViewModel()
var body: some View {
NavigationVie... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Search in table using one or more of 3 parameters laravel<p>I have search page and there is 3 select lists as input. when user select one or more option and ... | <p>Simple use <code>whereOr()</code> logic, then its either by country, name or city. This will automatically deal with merging into one collection problem.</p>
<pre><code> $searchResult = DB::table('table_name')->where('country', $request->country)
->orWhere('name', $request->name )
->orWhere... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
File is stored couple of times instead of once<p>When I upload a file it is stored X times where X is the time count you upload it. If I try to upload it thr... | <p>The issue is because you're nesting your event handlers. To fix this move <code>submit()</code> outside of <code>click()</code>.</p>
<p>That said, now that you've added the HTML to the question, I can see that you don't need the <code>click</code> handler at all. You can simply read the <code>data-item</code> from ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Django, is on_delete implemented in Python, or using DB triggers, for PostgreSQL databases?<p>I have an application that shares a database between a large... | <p>The 2nd is true, per the <a href="https://docs.djangoproject.com/en/3.0/ref/models/fields/#django.db.models.ForeignKey.on_delete" rel="nofollow noreferrer">Django docs for ForeignKey</a>:</p>
<blockquote>
<p><code>on_delete</code> doesn’t create a SQL constraint in the database. Support for database-level cascade... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AngularJS Directives - specify defaults for callbacks<p>I have a directive that takes a few methods as callbacks. All of them require attributes to work.</p>... | <p>The usage of your functions implies that <code>blankHandler</code> must return one more "blank" function (<code>angular.noop</code> is convenient here). This is what I would do in link function in your case:</p>
<pre><code>var blankHandler = function() {
return angular.noop;
};
if (!attrs.onEventOne) {scope.on... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Get all products except that already had discount?<p>I have these two tables:</p>
<p>products table: </p>
<pre><code>name - price - quantity - etc
</code><... | <p>You can use <a href="https://laravel.com/docs/5.8/eloquent-relationships#querying-relationship-absence" rel="nofollow noreferrer">doesntHave</a> method,</p>
<p>The follow query will retrieve all products that don't have any discounts. </p>
<pre class="lang-php prettyprint-override"><code>Product::doesntHave('disco... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create an angular library that accepts dependency<p>I have a component that I would like to turn into an angular library, so I could use it in different proj... | <p>You should take a look at Angular's official documentation on modules and <a href="https://angular.io/guide/singleton-services" rel="nofollow noreferrer">singleton services</a> and more specifically the <code>forRoot</code> method.
The idea would be to create a module that declares your component. This module would... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the cause of this EF6 behaviour Find() does not return a proxy but Single() does return a proxy<p>I have a POCO class <code>BankAccount</code> which ... | <p>This could happen if your context is already tracking a non-proxy BankAccount with that key by the moment you query it. </p>
<p>The strange thing is that, although First and Single always query the database, they should return the same entity as Find does.</p>
<p>For example, if you have a unit test that runs this... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.