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 many times the output statement is excuted in this fragement?<p>The fragment is</p>
<pre><code>for(int i=0;i<n;i++)
for(int j=n-1;j>=i;j--)
... | <p>You are basically printing every combination of 2 numbers from 1 to n without importance of order and with repeats (same element can be chosen twice).</p>
<p>There are <code>C(n,2) + n = n!/((n-2)!2!) + n = n(n-1)/2 + n = n(n+1)/2</code> such possibiities, where <code>n</code> is the number of elements.</p>
<ul>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Collapse and expand elements with CSS<p>I'm trying to build a page where only headlines are visible when it is loaded, and
the tables beneath each title togg... | <p>I will suggest use <code>checkbox</code> input and <code>:checked</code> instead of <code>a</code> and <code>:target</code> tags to trigger the event since the target will change always you click another link. Try this:</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre cl... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
php in external javascript file<p>I have a the code below in my js which obviously works if the js is in the php file </p>
<pre><code>filter: '<?php echo... | <p>You have to place this below code at the top part of your test.php page</p>
<pre><code><script>
var filter = '<?php echo $my_cat>';
</script>
</code></pre>
<p>and simply you can check it on your external.js file by alert</p>
<pre><code>alert(filter);
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should there be a transactional class when using Spring @Transactional Annotation<p>I understand that @Transactional belongs to the Service layer, however is... | <p>Attempt to focus on service purpose. It will be your guideline to decide where each rule should be. If perhaps you must compose multiple services into one transaction, then propagate the transaction. You don`t need to create another class just to group multiple calls to DAOs.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
providedIn platform vs root<p>I am struggling to see which one of the <code>root</code> and the <code>platform</code> options for <code>providedIn</code> in ... | <p>The difference between the <code>root</code> and <code>any</code> as per <a href="https://next.angular.io/api/core/Injectable" rel="nofollow noreferrer">offical documentation</a> :</p>
<ul>
<li><p><code>root</code> : The application-level injector in most apps.</p></li>
<li><p><code>platform</code> : A special sing... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I configure IntelliJ IDEA with JavaFX and scenebulider?<p>I'm trying to set up IntelliJ IDEA with screenbuilder and JavaFX and scenebuilder. I have bo... | <p>You have to add the file idea.jdk on
~/.IntelliJIdea2016.1/config folder.</p>
<p>Add the Oracle JDK path like
/usr/java/jdk1.8.0_73</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
program against known method, not the type<p>Lets say I have a class <code>A</code> which is going to be compiled into a <code>dll</code> to be used later. B... | <p>Yes, this is possible using the <code>dynamic</code> keyword (in C# 4.0 or higher). Check the <a href="https://msdn.microsoft.com/en-us/library/dd264736.aspx">MSDN documentation</a> for more info.</p>
<p>However, this leads to incredibly loose programming and can cause runtime issues that are difficult to debug. ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using var to unwrap an optional in Swift?<p>I've only seen people using <code>let</code> to unwrap optionals.<br>
I was wondering if it is a good practice an... | <p>As mentioned before, you should always use <code>let</code> when you can, as it allows compiler do some fancy stuff and thus makes your program run faster. </p>
<p>There is <strong>technically</strong> nothing wrong with using var, though.</p>
<p>For further reading, please check out this article:<br>
<a href="ht... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spring MVC equivalent to ASP.NET RouteData<p>I'm trying to extract a request routing data, similar to RouteData object in ASP.NET, to get the controller and ... | <p>This cannot be done from inside a filter. You have to do it with a <code>HandlerInterceptor</code> implementation. In the <code>preHandle</code> method you can get the PathVariables like this:</p>
<pre><code>Map pathVariables = (Map)request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
</code></pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Tensorflow Parameter Servers on SageMaker<p>I am trying to understand how parameters servers (PS's) work for distributed training in Tensorflow on Amazon Sag... | <blockquote>
<p>My questions are:</p>
<p>How does Tensorflow decide the distribution of variables on the PS's?
In the example code, there is no explicit reference to devices.
Somehow the distribution is done automatically.</p>
</blockquote>
<p>The TensorFlow image provided by SageMaker has the code to setup TF_CONFIG a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
mysqli_num_rows not working in MySQLi with PHP<p>I would like to check if there already exists a record before inserting a new one. But it doesn't work so fa... | <p>Try something like this:</p>
<pre><code><?php
/* Check if user exists */
$query = "SELECT count(1) FROM friends WHERE username_own=? AND username=?";
if($stmt = $db->prepare($query)){
$stmt->bind_param('ss', $uname, $friend);
$stmt->execute();
$stmt->bind_result($count_rows);
$stmt->fetc... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
1. Forward slash in routing parameter<p>I have a GET end point which will take user name as parameter. Below is the action</p>
<pre><code>[Route("user/{user... | <p>Try removing <strong>[FromUri]</strong> from the parameter as shown below,</p>
<pre><code>[Route("user")]
public User GetUserByName(string userName)
{
// logic here
}
</code></pre>
<p>And the request may look like, </p>
<blockquote>
<p>user?userName=Akbar/Badhush</p>
</blockquote> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get value of dropdown list from dynamic array?<p>I have dynamic table, in that table every row has a dynamic dropdown list. So every dynamic dropdown ... | <p>If you use jQuery you don't need use inline events like <code>onChange</code>, you should use <a href="http://learn.jquery.com/events/event-delegation/" rel="nofollow">event delegation</a>, like so (add this code to <code>.ready</code>., and remove <code>onChange='update(this.id)'</code>)</p>
<pre><code>$('.data-co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JOIN on multilple rows to SELECT only TOP row in SQL Sever<p>I have a table which has only 1 row per ID/Date while the other one can have overlapping ID/Date... | <p>You can do this using <code>APPLY</code>.</p>
<pre><code>SELECT
r.Id,
r.Date_,
r.Value,
t.Qty,
d.Quote
FROM #Row1Each r
LEFT JOIN #Table1 t
ON t.ID = r.ID
AND t.Date_ = r.Date_
OUTER APPLY(
SELECT TOP 1 *
FROM #Duplicates d
WHERE
d.ID = r.ID
AND r.Date_ BETWE... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How does absolute imports work with unrelated imports in sitecustomize.py?<p>I have a package with an unfortunately named module:</p>
<pre><code>(dev) go|c:... | <p>This works because <a href="https://github.com/python/cpython/blob/b138dd296a206e92ebec09b540bb88a1539563e4/Lib/_strptime.py#L15" rel="nofollow noreferrer"><code>_strptime</code></a> imports <code>calendar</code> itself, even before the main script's path is put on the <code>PATH</code>, since you specify that impor... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Set points of polyline programmatically (C#, vvvv/SVG-Library)<p>I'm using this curious <a href="https://github.com/vvvv/SVG" rel="nofollow">SVG-Library</a> ... | <p>follow these steps to manage that:<br />
1) you'll need a list with some values (ex. Y-Values) <br />
2) add every value form this list to a polyline and dont forget the X-Value as well as the space between the points<br />
3) generate your chart with <code>using Stream</code> and <code>File.Create(path)</code><br /... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Calculate vector gradient without using a Python library<p>I am trying to find the gradient of the function</p>
<pre><code> f(x) = w1 * x1^2 + w2 * x2
</cod... | <p>First things first:</p>
<pre class="lang-py prettyprint-override"><code>x1, x2 = x # unpack your coord tuple
</code></pre>
<p>And secondly:</p>
<pre class="lang-py prettyprint-override"><code>gradx2= w2 + w1 * x1 ** 2 # or gradx2= w2 + w1 * x1 * x1
</code></pre>
<p>in python <code>^</code> is bitwise XOR. Expon... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Findind array in an associative array php<p>I am trying to search array values in key of associative array and then make and array of key values. I a using i... | <p>That's because <code>in_array</code> doesn't take an array as the first argument. You can simply filter and check if <code>card_verify_id</code> is in <code>$card</code>. Decoding as an array:</p>
<pre><code>$cards = json_decode($json, true)['cards'];
$commons = array_filter($cards,
functi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Google Cloud vs. Google App Engine for a beginner?<p>Which do you think is easier for a beginner who lacks of knowledge of setting up a server?</p>
<p>Or, i... | <p><strong>AppEngine</strong> is <strong>PaaS</strong> - you can host there your apps. So you do not have to deal with the servlet container, datastore, cron jobs, scaling etc.</p>
<p><strong>Compute Engine</strong> is Google's <strong>IaaS</strong> - you get a VM and you can do with it whatever you like.</p>
<p>Basi... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
URL rewrite with .htaccess for multiple-language site (multiple variables)<p>I'm having some trouble here – basically because I'm having a hard time understa... | <p>That's not possible the way you're trying to do it since apache doesn't know when it's a language value (like <code>no</code> or <code>eng</code>) or when it's a page (like <code>about-us</code>.)</p>
<p>Let me explain you how I would do this:</p>
<pre><code>RewriteRule ^([^/]+)/?$ /index.php?g1=$1 [L,QSA]
</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data Grid view not reading null rows from image Column<p>I am trying to read data from Data grid View in Windows Csharp Form and I need to populate the Pictu... | <p>The problem is that you are testing <code>IsDBNull</code> against the <code>Cell</code> instead of the <code>.Value</code>. Change your code to this:</p>
<pre><code>if (row.Cells["emping"] != null && !Convert.IsDBNull(row.Cells["empimg"].Value))
{
var data = (Byte[])(row.Cells["empimg"].Value);
var ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas Dataframe rename duplicate values in Row<p>I have a dataframe</p>
<pre><code>COL1 COL2 COL3
Red Blue Green
Red Yellow Blue
Blue Red... | <p>We can use a custom function here which will check if values are <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.duplicated.html" rel="nofollow noreferrer"><code>duplicated</code></a> in a row and add an <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
tkinter catch value from lambda function<p>I'm trying to wrap my head around this problem.</p>
<p>Say I have a code like this:</p>
<pre><code>def get_input... | <p>Here is a simple example of how you could write this to get the results you are looking for.</p>
<ol>
<li><p>When using global is that all your root window and related fields are in a function. So you would have to define global in both function and this is not what you want to do.</p></li>
<li><p>Typically you wil... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In CLion, how do you set CMakeLists.txt option values?<p>I'm trying to use CLion (latest version - 2019.3) to work on a source repository of mine, which alre... | <h3>CLion 2022.2 and later</h3>
<p>CMake now supports setting (cached) option values:</p>
<ol>
<li>On the Menu, choose File | Settings...</li>
<li>In the navigation tree, locate Build, Execution, Deployment | CMake</li>
<li>In the Profiles pane, choose the CMake profile for which you want to edit options.</li>
<li>You ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
laravel advanced search<p>I want to make an advanced search in which the user has optional parameters to search,am joining data from three tables as follows<... | <p>I didn't try this code but its should work under laravel 4.2.</p>
<pre><code>$query = DB::table('rooms')
->join("salereservation", "salereservation.room_id", "=", "rooms.room_id")
->join("customers", "customers.id", "=", "salereservation.customer_id")
->where("salereservation.sale_s... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WPF: Bind ListView to a data structure<p>I would like to bind a data structure like the one below to a ListView or similar component. Desired result is in th... | <p>Finally it turned out the simplest way is to make a separate view-model class which turns the model data into a collection which can be easily bound to ListView. The solution is quite similar to Rafael Camelo's solution, but it does not fit to the comment.</p>
<p>When using this approach, the field names and descri... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Terraform executable not discovered by teamcity agent<p>I am writing a teamcity pipeline in which I am using terraform to spin up some AWS instances.
My pipe... | <p>Linux-based systems do not search for binaries in current working directory by default. After you have extracted <code>terraform</code>, you need to call it as <code>./terraform init</code>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jquery syntax for "also do this"?<p>This is possibly an easy question, but do to my lack of eduction in jQuery I don't know the answer. And I'm just curious.... | <p>jQuery methods allow chaining, ie most of the jQuery methods(excepts the getter methods and methods which does filtering or traversing etc) returns the jQuery object on which a method was called on, so you can simply add the call to the second function after <code>fadeToggle()</code></p>
<pre><code>jQuery(this).sib... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Spark: ClassNotFoundException when running hello world example in scala 2.11<p>I have an sbt project with subprojects. All of them use Scala 2.11.4. In one o... | <p>Apparently sbt was building some classes in scala 2.10 for a reason I failed to understand.</p>
<p>The solution was to use <code>fork := true</code> in the main <code>build.sbt</code></p>
<p><a href="https://stackoverflow.com/a/23283286/351195">Source</a></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Difference between IIFE and regular function (example)<p>Learning about IIFEs i understand that using them does:</p>
<ul>
<li>not pollute the global scope</... | <p>Let's say you have a decent sized codebase (a few thousand lines or more). Putting every function on the top level won't be a good idea, because then it'll be <em>pretty easy</em> to accidentally write a function name twice, which will cause bugs due to the name collision. For example:</p>
<pre><code>// code around... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to prevent jq from clicking recursively?<p>I have pop up and select html list when user select 1st item and save it to database but when user select 2nd... | <p>It appears that every time you call openInsertRoleDialog a new click event is bound to $("#saveRole"), which means for every call to openInsertRoleDialog you will have n click bindings. This would explain the first click working and every other click saving more than once.</p>
<p>Instead of using .click, I suggest ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Managed ODP.NET driver does not show up in Data Source dialog<p>Having installed managed ODP.NET on my computer, the <strong>ODP.NET Managed Driver</strong> ... | <p>Open your Registry editor and check if RegKey <code>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed</code> exists. It contains only the (Default) value with location of your Oracle.ManagedDataAccess.dll.</p>
<p>Add the key in case it is missing, example:<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Fill in missing rows as NaN in python<p>I have a file that has daily precipitation data form 83 weather stations and 101 years per station. I want to determ... | <p>What I'd probably do is create a target MultiIndex and then use that to index in. For example:</p>
<pre><code>>>> target_ix = pd.MultiIndex.from_product([df.station_id.unique(),
np.arange(1910, 2011, 1), np.arange(1,13)],
names=["station_id", "year", "month"])
>>> df = df.set_index(["sta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Best way to handle Python errors in a function<p>We got a serverless function and split the functionality in multiple smaller functions. One function transfo... | <p>You could write a function (e.g. <code>convert_to_string</code>) whose job is (1) to change the values to <code>str</code> and (2) log errors if necessary. Then you can use <code>convert_to_string</code> in <code>refactor_arrays</code>, avoiding code repetition:</p>
<pre class="lang-py prettyprint-override"><code>d... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating a single MySQL row<p>I have a table displaying the content of a MySQL table. For every row I added an 'edit button' so our users can update the cont... | <p><code>mysqli_real_escape</code> method requires the connection to be provided; this was not the case in deprecated mysqli_* methods..</p>
<p>see documentation at <a href="http://php.net/manual/en/mysqli.real-escape-string.php" rel="nofollow">http://php.net/manual/en/mysqli.real-escape-string.php</a></p>
<p>In your... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Correct way to change routing option No to Yes after ng new myapp was run<p>During the creation app process I was mistakenly answered N (No) instead of Y (Ye... | <p>If you have missed it while creating the app, you can create the routing as follows,</p>
<p><code>ng g module [module-name] --routing</code> will create the module and add the mappings/metadata linkings.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android - Keeping clicked on items highlighted in ListView (and in memory)<p>I have an app whereby i am accessing a RESt webservice and presenting the reques... | <p>Inside the getView</p>
<pre><code>public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.new_articlelistfragment, null);
}
Article en = getItem(position);
if(en.isRead() == true){
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
If variables in the global context are properties, then how are they distinguished for the purposes of closures?<p>If variables in the global context are pro... | <p>They are not distinguished - they are simply both a variable and a property. You might imagine that the global scope is the only scope object that is accessible as an actual language object.</p>
<p>The <a href="http://es5.github.io/#x10.2.3" rel="nofollow">global environment</a> consists of an environment record th... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
total solutions(recursive func)<p>I have this recursive function which is search possible solutions for Climbing Stairs problem.
Is it posible to return fina... | <p>In general, the idea in these kinds of recursive algorithms is to <em>use</em> the return value from the recursive calls, in the current call.</p>
<p>In this particular case: the number of ways to get to the top from the current position, is the <em>sum of</em> the ways that start with a single step, and the ways t... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Schema Using joigoose and mongoose for validation in node js<p>I am using <code>@hapi/joi</code> for validation in mongoose schema. I am converting joi objec... | <p><strong>UPDATE</strong>: Joigoose has fixed this error in 7.0.0 version: <a href="https://github.com/yoitsro/joigoose/issues/36" rel="nofollow noreferrer">https://github.com/yoitsro/joigoose/issues/36</a></p>
<p>Run the command below to list all dependencies of packages in your project's folder</p>
<pre><code>npm ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
what is difference between angular and meteor?<p>what is difference between angular and meteor?</p>
<p>as I know both follow model view view-model architec... | <p>well... I think the simplest answer to your question would be:</p>
<blockquote>
<p>AngularJS is a client UI Framework whereas Meteor is a full stack framework for client & server development which has embedded database support for mongodb (this is the default, other db's are also supported by the community)</... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create new array only to print checked rows from table<p>I have a table populated by a query, through a simple foreach loop. Now, I want to print the checked... | <p>Ok, creating the form in the first piece of code, use your primary key as the value for checkboxes:</p>
<pre><code><div class="tab-pane" id="TLL">
<table class="table table-bordered" style="color: Black" id="table-3">
<?php
$control_info= $this->db->query("select *
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to install Laravel 4 using composer<p>When laravel 5 is not yet released, I install Laravel 4 using this command <code>composer create-project laravel/la... | <p>I've tried the other answers but doesn't work for me. So here's the command I use. </p>
<p><code>composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist</code></p>
<p>Source :
<a href="https://stackoverflow.com/questions/23754260/installing-specific-laravel-version-via-composer-create-proj... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala type miss match<p>I am fairly new to scala and I am doing my assignment.
This is the code that I am using:</p>
<pre><code>case EqNumC(l,r) => (int... | <p>The <code>if</code> control structure needs to come before the <code>=></code> when pattern-matching. When it comes after, the compiler sees an <code>if</code> without an <code>else</code> and infers it to be <code>Unit</code> (no return type).</p>
<p>It should look like this:</p>
<pre><code>case (NumV(s),NumV(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
difference between DOS Format and MAC Format<p>When I save a file using nano on linux (bash), I get a message asking me to choose the format. There are two o... | <p>If you just press enter and no option, you save it in the same file-format which was detected. (That is the third option, and the option to prefer for Linux.)</p>
<p>If you selected an option you can deselect it again with pressing again "Alt" & "m" for deselecting [MAC-Format] or "Alt" & "d" for deselectin... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Name of node in launch file should be same as the name in script? #ROS #rospy<pre><code>if __name__ == '__main__':
rospy.init_node('ardrone_action_server')
... | <p>This is the common behavior of setting the node name in a launch files. It remaps (overrides) the node name which is defined in code. You can find the specification of this at <a href="http://wiki.ros.org/Nodes" rel="nofollow noreferrer">chapter 5 of the ROS node documentation</a>:</p>
<blockquote>
<p>__name is a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
file stream processing in python<p>I've got a data file where each "row" is delimited by <code>\n\n\n</code>. My solution is to isolate those rows by first s... | <p>So there is no such thing in the standard library. But we can make a custom generator to iterate over such records:</p>
<pre><code>def chunk_iterator(iterable):
chunk = []
empty_lines = 0
for line in iterable:
chunk.append(line)
if line == '\n':
empty_lines += 1
i... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In Applescript, finding only bold words in TextEdit causes app to hang<p>just trying to find a vanilla applescript way of setting a variable to all bold word... | <p>It may be that TextEdit is being unreasonably slow. I just used the following code for a document with 3600 words, with some random bold words interspersed throughout. It took way too long. I'd look into using different scriptable app, like Tex-Edit Plus (still goin' strong, still great).
The reason I used both "Bla... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Time sensitive handshaking between PLC and motor controller<p>I'm trying to setup handshaking between my PLC (using ladder-logic) and a motor controller (usi... | <p>Don't send commands as on/off but as a unique, increasing version number. The receiver acts upon each new number only once. Reset to zero after e.g. a day. I've used this "protocol" over and over again in container crane controls. If the receiver has seen a certain version, it reflects the number back to acknowledge... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find references to a Spring converter in Eclipse?<p>I'm working on a Java web app which utilises Spring's <a href="http://docs.spring.io/spring/docs/c... | <p>If you want to see all the references made to the method <code>ConversionService.convert</code>, you can highlight the <code>convert</code> method and use the Eclipse short-cut <code>Ctrl + Shift + G</code>. This will search the method inside your entire workspace. To search only in the project, you can right-click ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQLITE Full text: How to find all rows containing words with specific size?<p>I have a sqlite3 full text search table defined like this:</p>
<p><code>CREATE... | <p><a href="https://sqlite.org/fts5.html" rel="nofollow noreferrer">FTS5</a> solution. This makes use of the <a href="https://sqlite.org/fts5.html#the_fts5vocab_virtual_table_module" rel="nofollow noreferrer">fts5vocab virtual table</a> mechanism that gives a public interface to the internal index tables used by the se... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R, dplyr: Collapse character variable elements by group if there is only one unique non-NA element per group<p>Say I have the following data.frame <code>df</... | <p>As commented above, there is currently no way to use <code>dplyr::summarise_each</code> with variable number of rows to be returned.</p>
<p>If you want to go on using dplyr, you could circumvent this by using <code>mutate_each</code> and <code>distinct</code>.</p>
<p>Here's an example:</p>
<pre><code>f <- func... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Displacement of an element under floated element<p>Can someone explain why the element below the floated element gets displaced as if it had a padding of a w... | <p>It's not clear exactly what you are asking but based on comments I think this is just a case of clearing the float.</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>/* filters menu */
div.filter {
border: ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Alternative for deprecated TabLayout<p>I was using a set of regular buttons to change the property a discrete seek bar modifies the value of. Touching one of... | <p>Now you need to use <strong><code>com.google.android.material.tabs.TabLayout</code></strong></p>
<pre><code><com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</code></pre>
<p>For more information plea... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flutter Not found: 'package:html/parser.dart<p>i'm have tried using package Parser HTML with Flutter but i'm tried compile, this error is returned:</p>
<pre... | <p>You probably did not add package or did not get it.</p>
<p>add in following way.</p>
<pre><code>dependencies:
html: ^0.14.0+3
</code></pre>
<p>Now run following command in terminal:</p>
<pre><code>flutter pub get
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Flexbox - How to do space-around in vertical?<p>Probably it's a noob question, but I'm wondering how it's possible do something similar "space-around" but in... | <p>Resolved. It was a different mistake because image sizes. Solution is simple: codepen.io/devtips/pen/OPQYav (Made by youtube.com/user/DevTipsForDesigners)</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The procedure entry point axiom_attribute_create could not be located in the dynamic link library<p>I have a project in c and I want to compile it in CodeBlo... | <p>Your project contains 5 source files, which each has to be successfully compiled, and then all
need linked together, along with some <code>axis2c</code> DLLs, to build your program.</p>
<p>Let's look at your build log.</p>
<p>There is a compile command for each of the 5 source files:</p>
<pre><code>mingw32-gcc.ex... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is a disabled textbox any better than a div with role="textbox" for accessibility?<p>Consider that I have a form where one of the fields (name) is always dis... | <p>The use of label with input is better because the association between the text "Name" and the label is explicit and the user, using DOM navigation will be able to encounter and discover that explicit relationship which they would not in the case of the DIV.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to save NSMutableArray to Core Data?<p>I know it's not recommended to save NSMutableArray to Core Data but I need to access the array on another view con... | <ol>
<li>Saving NSArray to Core Data is possible via Transformable-type attributes.</li>
<li>Saving NSMutableArray is not possible. Only immutable ones.</li>
</ol>
<p>if you want to save a mutable array to core data, use <code>copy</code> method. It will return immutable copy of your mutable object.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Show notification only if previous one has been canceled<p>I'm creating a very simple application for myself. Basically, it gives me a certain notification e... | <p>Assuming you are using the same notification id (so that only one notification appears in the notification tray), you can use <a href="http://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setOnlyAlertOnce(boolean)" rel="noreferrer">setOnlyAlertOnce(true)</a> to ensure that so... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
meteor.call does not call method from meteor.method<p>i have an issue with callback method.</p>
<p>i have created on methods.js in server folder
and one cal... | <p>It makes no sense to have client-only method calls because Meteor methods are intended to perform RMI (remote method invokation) on the server.</p>
<p>Move your <code>methods.js</code> to either <code>server/methods.js</code> or <code>lib/methods.js</code> if you want your method to have a simulation counterpart on... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stored procedure to list all weeks between two dates<p>I've searched but could not find a solution on how to list the weeks inbetween two dates.</p>
<p>I've... | <p>You could select all days and filter on the first day of the week (<code>date_format(selected_date, '%w') = 0</code>):</p>
<pre><code>select selected_date, date_add(selected_date, INTERVAL 6 DAY)
from
(select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date
from
(select 0 i ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Opencv iOS install<p>Opencv for iOS wont work on my Mac
I've done this steps</p>
<p>1.Downloaded cmake</p>
<p>2.installed and runned it(opened ".dmg" and ... | <p>Try installing from either of the repositories <a href="http://brew.sh/" rel="nofollow"><strong>brew</strong></a> or <a href="https://www.macports.org/" rel="nofollow"><strong>macports</strong></a>.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I generate and knit personalized versions of an .Rmd report?<p>I have created a report PerfReport.Rmd that compares one person's performance to the p... | <p>You can use yaml parameter <code>params</code> to get this right. You will need</p>
<ul>
<li>one template (template.Rmd)</li>
<li>script to run the template (script.R)</li>
</ul>
<p>Here is a small trivial example:</p>
<h3>template.Rmd</h3>
<pre><code>---
title: no title
author: Roman
date: "`r Sys.Date()`"
para... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add members to trello board? (using rails app)<p>I'm using ruby trello gem for my rails app. I need to add members to the created trello board. How ca... | <p>This answer assumes you are using the <a href="https://rubygems.org/gems/ruby-trello/versions/2.2.0" rel="nofollow noreferrer">ruby-trello gem</a> at version 2.2.0.</p>
<p>First, instantiate your board. We will use your example here, but you could also <a href="https://www.rubydoc.info/gems/ruby-trello/2.2.0/Trello... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Move constructor for std::string from char*<p>I have a function <code>f</code> returning a <code>char*</code>. The function documentation says:</p>
<pre><co... | <p><code>std::string</code> will make a copy of the null terminated string argument and manage that copy. There's no way to have it take ownership of a string you pass to it. So what you're doing is correct, the only improvement I'd suggest is a check for <code>nullptr</code>, assuming that is a valid return value for ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unmet dependences! when install Cuda 6.5 on a freshly installed ubuntu 14.04<p>I follow the tutorial <a href="http://www.r-tutor.com/gpu-computing/cuda-insta... | <p>Use the Synaptic package manager. <a href="https://help.ubuntu.com/community/SynapticHowto" rel="nofollow">https://help.ubuntu.com/community/SynapticHowto</a> I think it tends to do better with finding dependencies.</p>
<p>Make sure to update your installation before trying to install it. Make sure there are no pac... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to bind data Modal window (MVC)<p>I have a Person class to hold data for Personel and their children as follows:</p>
<pre><code>public class Person
{
... | <p>1: No need to use <code>@Html.Partial("ChildView", Model)</code> in your page. Because you are loading partial view through ajax call. So Element <code>div#child-view</code> will be empty.</p>
<p>2: Move<code><div id="child-view" class="ui-modal-window" title=""></div></code> to your main view.</p>
<p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Go: Varint returns different values than read<p>Why does binary.Varint return different results than binary.Read?</p>
<pre><code>package main
import "fmt"
... | <p><a href="https://developers.google.com/protocol-buffers/docs/encoding?csw=1#varints" rel="nofollow">Varint</a> is a specific encoding, that means that the byte value it reads off the wire/from the file is not an actually integer value, but an encoding. Read on the other hand, just reads bytes in whichever byte order... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any way for implementing multiple interfaces in kotlin?<p>In <strong>java</strong> we implement <em>multiple interfaces</em> separated by comma, but... | <p>you can implement multiple interface in kotlin like this below - </p>
<pre><code>interface A {
fun callMe() {
println("From interface A")
}
}
interface B {
fun callMeToo() {
println("From interface B")
}
}
// implements two interfaces A and B
class Child: A, B
fun main(args: Array&l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: How to reform python list and print them line by line?<p>I have a file like this :</p>
<pre><code>2.nseasy.com.|['azeaonline.com']
ns1.iwaay.net.|['... | <p>What you are doing with json is not correct. <code>s = json.dumps(domain_list)</code> dumps the list into a string <code>s</code>. The <code>json.loads(s)</code> reads the string again, and then you range over the the string and print it, hence the single characters in the output.
Try something like:</p>
<pre><cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Azure instance stuck on "waiting for status"<p>My small Microsoft Azure site that uses just one instance was down for a few hours today, failing to respond t... | <p>What finally fixed it for me was to go back and do another Publish from Visual Studio. I'm afraid I don't understand for sure why that worked. I'm guessing that my site got deployed to a different server that way, and the server that it had been on before was having problems. But it worked and the site came right ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python: Prime number algortihm implementation with square root<p>I am trying to solve this problem and despite wrapping my head around it I get stucked over ... | <p>This works:</p>
<pre><code>prime_numbers = [2]
for prime_candidate in range(3, 100):
for known_prime in prime_numbers:
if known_prime <= sqrt(prime_candidate):
if prime_candidate % known_prime == 0:
break
else:
prime_numbers.append(prime_candidate)
</code></pre... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
php multidimensional array recursive<p>I have been searching very much and tried hard to get it to work but my brain can't just handle it. I'm calling out he... | <pre><code>function walkme($array, $c) {
if (!count($array)) {
echo "$c\n";
return;
}
$last=array_pop($array);
foreach ($last as $l) {
walkme($array, $l.$c);
}
}
$array = array(
array(4),
array(3,2),
array(4,2,1)
);
walkme($array, "")... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Proper Setup of Datadog Log Ingestion on Kubernetes<p>I have been working with Datadog log ingestion for about a year now. It's been (mostly) great to work w... | <p><a href="https://i.stack.imgur.com/MNeRh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MNeRh.png" alt="enter image description here"></a>Datadog has two agents.</p>
<ol>
<li>Cluster agent which is a proxy between Kubernetes API Server and Datadog node agents. The cluster agent is deployed as de... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do I import pcap or pyshark on python<p>I want to write the Ethernet packets capture while using python.
I googling and found that I should using Pcap li... | <p>The <code>pyshark</code> project requires that <a href="https://pypi.python.org/pypi/trollius" rel="nofollow"><code>trollius</code></a> is installed for Python versions before Python 3.4. You'll need to install that separately.</p>
<p>It <em>should</em> have been installed when you installed the <code>pyshark</code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel Routing URLs not working except for default URI<p>I have set up Laravel 5 for the first time on my localhost. I am able to load the default URL but n... | <p>The problem was the subdirectories. The default installation of Laravel 5 assumes that it is served from root (in this case localhost). When I reinstalled Laravel as root everything worked correctly. Instead of setting up Virtual Hosts I just switch out symlinks from a different directory to manage the various sites... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
List mysql row values horizontally without pivoting<p>In my table I have following columns </p>
<pre><code>--loannumber--disbid--username--docs--
----------... | <p>Not sure i understand you correctly, but try this:</p>
<pre><code>SELECT loannumber,
SUM(CASE WHEN docs='NCN'THEN 1 ELSE 0 END) 'NCN',
SUM(CASE WHEN docs='Missing'THEN 1 ELSE 0 END) 'Missing',
SUM(CASE WHEN docs='NF'THEN 1 ELSE 0 END) 'NF'
FROM claimloans
GROUP BY loannumber
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Knockout.js - Updating an array in parent view model, with value in second view model<p>So I have 2 view models, one that houses an array I use that binds ea... | <p>Since the name of <code>OurType</code> is supposed to change automatically when you change the ID, this is a good job for a <a href="http://knockoutjs.com/documentation/computedObservables.html" rel="nofollow">computed observable</a>:</p>
<pre><code>self.OurType = ko.computed(function() {
return ko.utils.array... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Firefox breaking page; not displaying images or CSS styles<p>For whatever reason, Firefox isn't liking my code. Looking at some related posts, I think it may... | <p>On line 30 you have this following line:</p>
<pre><code><link rel="stylesheet" type="text/stylesheet" href="http://labs.halfbake.me/wp-smooth/wp-content/themes/Breanne-New/library/css/main.css">
</code></pre>
<p>type="text/stylesheet" is NOT a valid MIME-type, use type="text/css" instead.</p>
<p>This caused... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Error on retrieving array length in bash<p>I've been trying to run a simple script that retrieves the penultimate subdirectory of a variable size directory. ... | <p>Following up on the comment, the syntax for initializing indexed array values in BASH is:</p>
<pre><code>array=( element1 element2 etc... )
</code></pre>
<p>In your case you were simply assigning the result of the command substitution to the array with:</p>
<pre><code>ARRAY=$(ls files-0/var/log/)
</code></pre>
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can association be used to filter data in rails where clause?<p>I have a <code>ProjectItem</code> model and <code>ProjectItemTransaction</code> Model. I want... | <p>Yes, you can use the association name if it is same as table name, which means ultimately you will be using table name only.
As mentioned by @Fabio, the correct way of querying is with join to avoid cross join and duplicate records</p>
<pre><code>ProjectItem.
joins(:project_item_transactions).
where("project_it... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i add these values to array?<p>I am having trouble while adding these array </p>
<pre><code>637301291068030997 => { guildMemberCount: 4,
guildOwn... | <p>With <code>doc.id = doc.data()</code> you are <em>assigning</em> the data to the <code>id</code> property. That cannot be what you want.</p>
<p>I would suggest to not create an array at all, but a plain (nested) object.</p>
<p>Like this:</p>
<pre><code>// ...
temp.guilds = {} // plain object, not array
snapshot.f... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
error code during application install -24 on Rooted device from Google Play Store<p>I am trying to install the App from Google Play Store. Gets downloaded an... | <p>Deleting the app through Terminal using adb shell command helped in one of the mobile.</p>
<p>In other mobile, even adb shell command did not work out.</p>
<p>Resetting mobile to Factory setting as final solution helped.</p>
<p>PS: Please voteup if you find this helpful.Thanks</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there any solution for getting current domain name by Reactjs?<p>I am working on ReactJs and the server direct to a domain name with id on it. So I want t... | <p>This isn't React specific.</p>
<p>Just look at <a href="https://developer.mozilla.org/en-US/docs/Web/API/Location" rel="nofollow noreferrer"><code>window.location</code></a>:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Compiling Tesseract Debugger to visualise region classification<p>I'm trying to follow <a href="https://code.google.com/p/tesseract-ocr/wiki/ViewerDebugging"... | <p>In the end, this worked for me:</p>
<pre><code>### Install version 3.0.4
brew install tesseract --HEAD
### Build the scollviewer jar for the debug tool
## To get jars for the debug viewer
cd /Library/Caches/Homebrew/tesseract--git/java
# cd /usr/local/Cellar/tesseract/HEAD
wget -O ./piccolo2d-core-3.0.jar "http:/... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Meaning of # symbol as argument in strcmp()<p>I came across this line of code in legacy code:</p>
<pre><code>#define func(x,y) if(strcmp(x,#y)==0)
</code><... | <p>as mentioned in the comments, this seems like <a href="https://gcc.gnu.org/onlinedocs/cpp/Stringification.html" rel="nofollow">stringification</a> in a c macro.</p>
<p>here is a little example that uses your sample code:</p>
<pre><code>#define doif(x, y) \
if(strcmp(x,#y)==0) { \
printf("doing! %s\n",x... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Send Data in a DataForm of one excel to another<p>I have the following code where BasedeDatos is a new sheet on a new excel (where my data will be displayed ... | <ol>
<li><code>Me.TextBox8</code> makes sense only if your code works on the module of the sheet keeping the text box code;</li>
</ol>
<p>Define the the sheet keeping the text boxes and use that like this:</p>
<pre><code>Dim sh As Worksheet, txtStr As String
Set sh = ActiveSheet 'use here your sheet
txtStr = sh.Sha... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loading multiple images in MATLAB from a specific folder<p><strong><em>im trying to load a group of images to matlab to do some process over each, and here i... | <p><code>s(n).name</code> returns just the filename without the path. You have to append the name to the entire path before passing it to <code>load()</code>:</p>
<pre><code>path = 'D:\Matlab\pics\dude2\';
s=dir(fullfile([path '*.jpg']));
numel(s)
for n=1:numel(s)
img = imread([path s(n).name]);
% your image pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
WCF request-response logging via custom Trace Listener at one go<p>At my WCF client application; </p>
<ul>
<li>I'm trying to log Request and Response messag... | <p>Ended up using <strong>IClientMessageInspector</strong> as I could not find a way to do it at Trace Listener level. </p>
<p>Using Ids in the headers to correlate the request to response. </p>
<pre><code>public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
var key = req... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript merge array of objects, no duplicates<p>I have the following data:</p>
<pre><code>// Data
const groups = [
[
{ group: 'All', entries:... | <p>Here's one option - for each group array, make an entry of the <code>group</code>, then <code>flatMap</code> the inner objects' entries, taking only non-group keys, and mapping each entry to add the index to each:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find triplets from the array(X1,X2,Y), such that X1*X2=Y^2<p>How to find <em>triplets</em>, form an <em>array</em> , </p>
<p>(X<sub>1</sub>, X<sub>2</sub>, ... | <p>Because a number Y <= 100000 can have at most 6 distinct prime factors, each Y<sup>2</sup> will have less than 4064 factor pairs. On average, about 100.</p>
<p>That leads to an O(N) algorithm... It has a factor of x000 in it, but it will still be faster than the O(N<sup>2</sup>) solutions for large inputs:</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Identify different replicas in docker swarm<p>I'm using docker swarm for deploying multiple services, which communicate between them via gRPC. Every service ... | <h3>TL;DR</h3>
<p>If the number of clients is much smaller than the number of replicas, consider using a look-aside server. Otherwise, there's no problem leaving the job to docker and just increase the replica count like specified above.</p>
<h3>Long description</h3>
<p>I ended up using a look-aside server for my speci... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
With PostgreSQL how to query for records contained within a date range of the created_at field?<p>In my PostgreSQL database I have an invitations table with ... | <p>The expression you are feeding to the first COUNT yields a boolean and never a NULL (unless its inputs are NULL). But COUNT counts all of its non-NULL input, so whether the expression returns true or false, the count still increments. There are many ways to fix this, a simple (but probably not the best--just the l... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pyspark - Combine Multiple Columns of Data into a Single Column Spread Out Across Rows<p>I have a pyspark data frame with multiple columns as follows:</p>
<... | <p>You can use <code>unionAll</code> to convert the columns to rows and <code>lit</code> can be used to specify the column name, as shown below,</p>
<pre><code>from pyspark.sql.functions import lit
df2 = df.select(df.columns[0], lit(df.columns[1]).alias('new_col'),
df[df.columns[1]].alias('new_col_val... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to find list of json date is witnin a month or not in android<p>Sorry for my bad English,I have list of dates coming from json </p>
<pre><code>{
"da... | <h2>java.time and ThreeTenABP</h2>
<pre><code> DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-uuuu");
List<Leads> allEventData = Arrays.asList(new Leads("16-02-2020"),
new Leads("04-02-2020"), new Leads("08-02-2020"),
new Leads("09-02-2020"));
if (allEve... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Git: Get a subfolder from a repository to a new one without losing history<p>I have a <code>git</code> repository of an application with multiple branches. T... | <p><strong>use <code>git splits</code></strong></p>
<p>it basically use your same <code>git filter-branch</code> approach but has an easier interface.</p>
<ol>
<li>install <a href="https://github.com/simpliwp/git-splits" rel="nofollow noreferrer"><code>git splits</code></a>. I created it as a git extension, based on ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
updating a wx MessageBox text<p>I'm reading a humidity/temperature sensor, and want to display the reading continuously (e.g. every 500ms)
Currently, I can o... | <p>Something simple like this, with a <code>wx.Timer</code> should get you started.</p>
<pre><code>import wx
import random # testing only
class MyFrame(wx.Frame):
def __init__(self, parent, id=wx.ID_ANY, title=""):
super(MyFrame, self).__init__(parent, id, title, size=(300,150))
self.temp = 10
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Bootstrap 3 animated columns when changing position media queries<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre cl... | <p>Based on what I've found in order to accomplish what you are asking you will need to <code>absolute</code> position each of your columns on the page and then based on the media query widths you will use the <code>transition</code> property to move the columns. Here is a simple example with a <a href="http://jsfiddle... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the previous value of a monadic computation in the function context?<p>I am struggeling with the function instance of monads (who does not?). Monads ... | <p>In this one-liner spelling, <code>mainM</code>'s definition is kinda hard to follow, so I'll begin by adding some indentation:</p>
<pre><code>mainM =
(\x ->
(\y ->
(\z w -> if w == 0 then (0,y,z) else (x,y,z))
=<< (\x -> x * x))
=<< (+1))
=<< (2/)
</code></pre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.