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:
Change column names in dataframe based on matching to another dataframe by dplyr<p>I have a dataframe where I want to change the column names by matching to ... | <p>We could reshape wide-to-long, merge, then reshape again to long-to-wide:</p>
<pre><code>library(dplyr)
library(tidyr)
pivot_longer(df, cols = starts_with("S"), names_to = "Sample_name") %>%
left_join(df2, by = "Sample_name") %>%
pivot_wider(id_cols = Gene_Symbol, names_from = Tumor_name, values_from =... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hibernate OGM com MongoDB and JTA on Glassfish - javax.persistence.PersistenceException<p>Using Hibernate OGM, MongoDB and JTA on Glassfish 4.1. When a try t... | <p>After try everythig I found on the internet. The solution was stop using Hibernate OGM e try Eclipselink NoSQL. Just added a new dependency and changed some parts of my persistence xml and now its working just fine!</p>
<p><a href="https://wiki.eclipse.org/EclipseLink/Examples/JPA/NoSQL" rel="nofollow">https://wiki... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combine lists of tuples by pairs into specific length of new list of tuples<p>I am newish to Python. I'm trying to combine two lists of tuples pairwise into ... | <p>Using a buffer:</p>
<pre><code>b = [None] * 8
[tuple(b) for b[::2], b[1::2] in zip(y, x)]
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access an original TemplateInstace from the helper in Meteor<p>Could anybody point me how to access an <strong>original</strong> <code>TemplateInstance</code... | <p>It seems that it's known and already fixed (?) Meteor bug. More here: <a href="https://github.com/meteor/meteor/issues/3745" rel="nofollow">https://github.com/meteor/meteor/issues/3745</a></p>
<p>Comment from <code>rclai</code> on GitHub:</p>
<blockquote>
<p>This was already addressed and fixed for the next rele... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jade - Only output a property if defined?<p>I've not doubt somebody will have covered this:</p>
<pre><code>id="#{data.id}"
</code></pre>
<p><strong>Output<... | <p>You could simply code:</p>
<pre><code>input(id= data.id)
</code></pre>
<p>When the <code>id</code> is <code>undefined</code>, a falsy value, Jade won't add the attribute to the tag. This feature is also useful when you are setting <em>property</em> attributes like <code>checked</code> or <code>selected</code>.</p>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HttpURLConnection skipping the FILTER in J2EE application<p>I am working on application, which is skipping the FILTERS configured in application while connec... | <p>I think your Filter will not intercept the requests made by your code using <code>HttpURLConnection</code> as it's not in the scope of a Filter. A Filter can be configured at a container (your tomcat server) level to intercept requests fired using Container API something like RequestDispatcher's <code>forward()</cod... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Serialising XML from database with ServiceStack<p>An application I'm working with has a number of user-defined screens and fields which are stored in a SQL d... | <p>XML Serializers are particularly hard to deserialize into POCO's it doesn't know about and may require extra hints on the destination model attributed with either <code>[DataContract]</code> or <a href="https://msdn.microsoft.com/en-us/library/83y7df3e%28v=vs.110%29.aspx" rel="nofollow">XmlSerializer Attributes</a> ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to reuse in SQL the average calculated for a column in a different column?<p>What I would like to do is calculate the average value of a specific column,... | <p>I think this is easier with window functions:</p>
<pre><code>select t1.*,
(case when t1.col_1 = 'TypeB'
then t1.col_3 - avg(case when t1.col_1 = 'TypeA' then t1.col_2 end) over ()
end) as new_col_3
from table1 t1;
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Iterate over a list of dataframes and get a subset of each dataframe in R<p>I have a list of dataframes (mylist) and i want to iterate over them and get all ... | <p>As PeterDee also noted: you are using <code>|</code> incorrectly. Use <code>%in%</code> to do this as follows</p>
<pre><code>myfun <- function(df, words) {
good_col <- which(! df$column %in% words)
df[good_col,]
}
</code></pre>
<p>and then</p>
<pre><code>lapply(mylist, myfun, c("upstream", "downstream")... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
converting byte to str python2.7<p>I have a dictionary</p>
<pre><code>k ={'Creator': '\xfe\xff\x00M\x00i\x00c\x00r\x00o\x00s\x00o\x00f\x00t\x00\xae\x00 \x00... | <p>This gives the required string.</p>
<p>Code :</p>
<pre><code>>>> print(k['Creator'].decode('utf16','ignore')).encode('utf-8')
Microsoft® Office Word 2007
>>> type((k['Creator'].decode('utf16','ignore')).encode('utf-8'))
<type 'str'>
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the xampp localhost password to connect with putty?<p>I need to learn Linux shell commands ,so i tried to connect to my local host Xampp server via P... | <p>Putty is a Telnet and SSH client. You need to run a SSH or Telnet service for Putty to connect to. </p>
<p>For example, an SSH service setup on localhost. Then, you create a user account for the SSH service and that's what you type into Putty.</p>
<p>A better way to learn Linux is to install virtualization softwa... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add a single point in plot with scaled and offset axes?<p>I have the next code which represents a plot.</p>
<pre><code>x1<-0:200
a1<-dnorm(x1,88.24,15... | <p>Try this:</p>
<pre><code>points( x=100*diff(scale)/diff(range(x1)), #could also use remap(100, scale, range(x1))
y=remap(600, scale, range(x2) ),
col="red", cex=3)
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Loop for each group of variables in php<p>i have a form with multiple inputs and hidden fields.</p>
<p>query example when form submited:</p>
<blockquote>
... | <pre><code>for($i=0; $i<$_GET['number_of_records']; $i++) {
if(isset($_GET['qty'.$i])) {
$sqlQuery = "UPDATE cart SET qty='" . $_GET['qty'.$i] . "' WHERE prdcode='" . $_GET['prdcode'.$i] . "' AND sessionid='" . session_id() . "'";
$db->query($sqlQuery);
}
}
</code></pre>
<p><code>$db</co... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Implementing a minimal LSTMCell in Keras using RNN and Layer classes<p>I am trying to implement a simple LSTMCell without the "fancy kwargs" defaultly implem... | <p>Ok, so it seems that I managed to fix the problem. It turns out that it is always useful to read the documentation, in this case the <a href="https://github.com/tensorflow/tensorflow/blob/v2.1.0/tensorflow/python/keras/layers/recurrent.py#L196-L962" rel="nofollow noreferrer">docs for the RNN class</a>. First, the <c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to overlap two or more images using paste()?<p>I'm working on a little GUI for a program written in Python that takes an amount to pay, an amount given a... | <p>I'm basically following the advice given to you in the comments – but since I was already preparing some code, that'd be my solution:</p>
<pre class="lang-py prettyprint-override"><code>import tkinter as tk
from PIL import Image, ImageTk
# List of images (notes) to show
notes = ['fifty_pound.jpg', 'twenty_po... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pushing changes from clone to main branch in github gitlab clone vs fork vs branch<p>New to GitHub sorry if this is trivial I did not find it,<br>
How do yo... | <p>A clone is essentially a local copy of your code. In this instance the cloned copy is on Github, and your original copy is on Gitlab. There is some
<a href="https://help.github.com/en/github/using-git/pushing-commits-to-a-remote-repository" rel="nofollow noreferrer">Github Help Documentation</a> that might help you... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Problem in plotting a map graph using highcharter<p>I am having troubles trying to write R code for a choroplet using the highcharter package. I am trying to... | <p>I tried to replicate the example. I hope the following is enough for you to work by yourself and replicate the example. It seems that <code>countrycode_data</code> is on the psData package. This package requires the rJava package, which is not on my machine now. As you were looking for a workaround, I found my own w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why are the dimensions printed the wrong size?<p>I want a 6 cm (60 millimeter) wide rectangle.</p>
<p>As I understand it iText works with points as units, s... | <p>Your calculation is correct, 6 cm are about 170 points.</p>
<p>Your code is correct.</p>
<p>I used your code to generate a PDF. When I applied the measure tool, the 6 cm were confirmed:</p>
<p><a href="https://i.stack.imgur.com/eVClv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eVClv.png" al... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check attribute value of XML element with a regular expression pattern<p>I have this code, which does not work.</p>
<p>I want to iterate trough all <code>p<... | <p>The <code>matches</code> function requires XPath 2.0 (and hence XSLT 2.0) or later, there's no regular expression support in XSLT 1.0.</p>
<p>If you just want to check that the value ends with ".mov" you can do that using the substring function</p>
<pre><code>substring(@data, string-length(@data) - 3) = '.mov'
</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiple update only works on one of the query in jdbc<p>I have a section in my application which require to update two tables at the same time (WORKTR and B... | <p>Change to</p>
<pre><code>int rowsChanged = ps.executeUpdate();
if (rowsChanged >= 1) {
</code></pre>
<p>You were calling <code>executeUpdate</code> twice.</p>
<ul>
<li>Should not re-execute the PreparedStatement </li>
<li>Status has changed so even if you could re-use PreparedStatement , the update would pro... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL: joining tables with multi results rows to one row<p>I have 4 tables:</p>
<pre><code>secu_content
| id | created | modified |
| 910 | 26/12/1982... | <p>Fast and dirty solution is to use second join to secu_data like that (simplified, add logic you need)</p>
<pre><code>SELECT id, d1.data as `calc_date`, d2.data as `calc_link`
FROM secu_content
LEFT JOIN secu_data d1 ON secu_content.id = d1.element_id AND field_id = 1
LEFT JOIN secu_data d2 ON secu_content.id = d2.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Getting points from an anonymous function after integration in MATLAB<p>I want to get value of <code>v(U,n0)</code> for various points in MATLAB</p>
<pre><c... | <p>You are using function handles without specifying their arguments. For example, after you define <code>eq(q,U,n0)</code>, you use it in <code>hq</code> like a variable (<code>eq</code>) without any inputs. Whenever you use a function, you must give it inputs, so use <code>eq(q,U,n0)</code>, not just <code>eq</code>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
contenteditable div: capture input event, ignore paste event<p>I'm trying to build a shortcut expander, so when a user types a certain sequence of characters... | <p>The simplest solution would be to detect a keyboard event (keydown, keyup or keypress) instead of <code>oninput</code>, but which to choose, depends on what the handler actually will do.</p>
<p>If you don't want/can't use keyboard detection, there's a back-gate. It looks like <code>onpaste</code> would fire before <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Accessing Android Content Provider inside Webview<p>In Android. How do you access Content Provider inside your webview. It is showing content uri as not defi... | <p>It seems the chromium does not support content provider access of local files in android system. So the method is not possible. </p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
alert box automatic disappear<p>I'm using Bootstrap and want to realize the following:<br>
having a kind of an alert box which disappears after a short perio... | <p>Yes, that's also possible with alerts. Just add a timeout for the closing and add <code>position: fixed</code> style to have the alert in front of your content.</p>
<p>The following demo should give you an idea how you could use it.</p>
<p>The same code is also at this <a href="http://jsfiddle.net/awolf2904/bnvj2w... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add new column based on odd/even condition<p>Let's say I have the <code>dataframe</code> below:</p>
<pre><code>my_df = pd.DataFrame({'A': [1, 2, 3]})
my_df
... | <p>You were so close! </p>
<pre><code>my_df['b'] = np.where(my_df['A'] % 2 != 0, 'X', 'Y')
</code></pre>
<p><code>value % 2 != 0</code> will check if a number is odd. Where are <code>value % 2 == 0</code> will check for evens.</p>
<p>Output:</p>
<pre><code> A b
0 1 X
1 2 Y
2 3 X
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
OpenCV Thresholding adaptive to different lightning conditions<p>For a school project I am trying to write a program in Python that tracks the movement of th... | <p>The purpose of thresholding is to segment the desired objects from the background where you can then perform additional processing (applying morphological operations) then perform contour filtering to further isolate the desired objects. Instead of applying image processing techniques on a BGR (3-channel) image or a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to handle error: expected expression before ‘do’ when there is no "do"?<p>I get the following compiler error, even though there is no "do" expression in ... | <blockquote>
<p>I'm also aware that it appears snd_pcm_hw_params_alloca() doesn't even return anything worthwhile to check for errors against? That's not relevant though, this should valid C code regardless, even if it abuses the API.</p>
</blockquote>
<p>No, if <code>snd_pcm_hw_params_alloca()</code> does not have ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I get all contents from page including values from inputs with a button?<p>I would need to be able to copy the whole page I am viewing with a simple ... | <p>I think you should get all value of your form inputs then write on inline, for example:</p>
<pre><code>function getPageHTML() {
// Apply for all your input
$('input').attr('value', $('input').val());
return "<html>" + $("html").html() + "</html>";
}
</code></pre> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Removing undefined values from Array<p>In certain situations, it may happen that we have <code>undefined</code> or generally <em>falsy</em> values in Array s... | <p>To use <code>Array.prototype.filter</code> here might be obvious. So to remove only undefined values we could call</p>
<pre><code>var data = [42, 21, undefined, 50, 40, undefined, 9];
data = data.filter(function( element ) {
return element !== undefined;
});
</code></pre>
<p>If we want to filter out all the fa... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to lazy load module after api response in angular?<p>I want to lazy load a module after API response </p>
<p>below are my routes </p>
<pre><code>const ... | <p>Maybe dynamic loading in the routing could help you?</p>
<p>app-routing.module.ts:</p>
<pre><code> {
path: ':profile_token',
loadChildren: async () => {
const service = AppInjector.get(YourService);
if (service.isStudent()) {
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rebinding a page in AngularDart when the data is loaded via SignalR<p>I've got an AngularDart application that is working, but I feel like I'm doing it wrong... | <p><a href="https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:async.Stream" rel="nofollow">https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:async.Stream</a></p>
<p>You could add your events to stream and then listen for these and signalr will see these changes, for example:</p>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Does state reinitialize to initial state everytime an action is dispatched in react using redux?<p>For e.g. in the code below (NOTE: nothing particular in th... | <p>When you dispatch an action it will be sent to the reducer to compute the next state based on the <strong>CURRENT STATE</strong> and the <strong>ACTION</strong> dispatched.</p>
<p>Now your function <code>cartReducer</code> accepts 2 parameters, <code>state</code> and <code>action</code>. You are essentially telling... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
merging two class properties while serialization using jackson<p>Consider these classes:</p>
<pre><code>public class A {
private String a;
private B b;
... | <p>You can simply use <a href="https://fasterxml.github.io/jackson-annotations/javadoc/2.9/com/fasterxml/jackson/annotation/JsonUnwrapped.html" rel="nofollow noreferrer">@JsonUnwrapped</a> on field</p>
<blockquote>
<p>Annotation used to indicate that a property should be serialized "unwrapped"; that is, if it would ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Xamarin Forms App Shell OnPropertyChanged not updating for FlyoutHeader view<p>I am binding a text property from a viewmodel into a the FlyoutHeader view of ... | <p>The issue is basically because you are creating multiple instances of the same ViewModel, So the thing is you are trying to change a header that is bound to a property in your ViewModel, which is then bound to you View, so for your View to reflect the change that you made in your ViewModel it ought to have the insta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
alternative to sizeof that ignores the check for is_countable<p>I want to update an old PHP code, where there is used a lot of <code>sizeof()</code> function... | <p>If you want a function that checks <code>sizeof()</code> and ignores uncountable parameters, you could define the following in your project's header:</p>
<pre class="lang-php prettyprint-override"><code>function countableSizeof($obj) {
if(!is_countable($obj)) {
return 0; //or a sentinel value of your choosing... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to play/pause a JavaScript onClick event?<p>As I'm a JavaScript beginner, I wish to know how could I Play and Pause a JavaScript on an html page.
On the... | <pre><code>var colors = ...;
// All variable declarations for animated background
function updateGradient() {
// Update gradient function (unchanged)
}
var refreshIntervalId;
// Or var refreshIntervalId = setInterval(updateGradient, 10);
// If you want the updateGradient function to run by default when the page ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Cleaner way to compare array values?<p>I have a maze:</p>
<pre><code>||||||||||||||||||||||
| || | | . |
| |||||| | |||||| |
|||||| | ... | <pre><code># if diagonal movements are accepted
neighbours = ((-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1))
# if diagonal movements are NOT accepted
neighbours = ((0, -1), (-1, 0), (1, 0), (0, 1))
for neighbour in neighbours:
if theProblem[stateX + neighbour[0], stateY + neighbour[1]] == ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Default text in Angular select<p>By default angular uses an empty value if nothing has been selected in a <code><select></code>. How can I change this ... | <p>You didnt provide any code so I can't give an example relative to your code, but try adding an option element, e.g.</p>
<pre><code><select ng-model="item" ng-options="item.category for item in items"
ng-change="doSomething()">
<option value="">Please select one</option>
</select>... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using clearTimeout(x) in ajax call<p>I am writing codes where the code will do some polling for statistics to the server using AJAX. My web application is ge... | <p>It is because you are again creating a new timer in the complete callback which will get executed in the case of error also</p>
<pre><code>var myfunc = function () {
$.ajax({
type: "POST",
url: "pull.php",
error: function (xhr, status, error) {
if (status === "timeout" || sta... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is FIND call in request?<p>I am trying to convert a curl call to python request . The curl call looks like </p>
<pre><code>$ curl -b $COOKIE_FILE \
-X ... | <p>Requests allows using arbitrary request methods with the <code>request</code> function, take a look at the <a href="https://2.python-requests.org/en/v2.9.1/api/" rel="nofollow noreferrer">documentation</a>. </p>
<p>For example this is how it would look with a Session() object: </p>
<pre class="lang-py prettyprin... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
TypeError: string indices must be integers, not dict - nested values in dict<p>I am trying to write a code with multiple keys and value in python dict. For e... | <p>Based on the sample you gave, it looks like you are looking for something a little like this.</p>
<pre><code>def FunDictr(base_dictionary,string_key):
d = dict()
d[string_key] = dict()
d[string_key]["d1"] = dict()
with io.open("fileo.txt", "r", encoding="utf-8") as filei:
for line in file... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas read_html equivalent for a lxml table<p>Hi I have about 10 tables which I have used lxml to classify.</p>
<pre><code>>>>import pandas as pd
... | <p>I am able to now answer my own question and maybe this can be of assistance to others. </p>
<p>I tried modifying the read_html source code in pandas without much success because of some recognition issues. Nonetheless the answer is much simpler than you might think.</p>
<pre><code>>>>import pandas as pd
&... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Modify a date object to another format<p>I downloaded date information from an API which is in the format of (Java)</p>
<pre><code>day month monthnumber hou... | <p>You could use <a href="http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html" rel="nofollow"><code>SimpleDateFormat</code></a> to first parse the string to a <code>java.util.Date</code>, and then format it to the format you want:</p>
<pre><code>String orig = "Thu Feb 19 19:40:12 EST 2015";
Simple... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Scala how it is happening and why<p>I have following function for checking whether it is <code>List[Int]</code> or <code>List[String]</code>. But It is alway... | <p>As noted in other answer, type erasure makes your match expression check for <code>List</code>instead of <code>List[Int]</code>, hence the results are not as one might expect.</p>
<p>However, you can use <code>TypeTag</code>s to circumvent the type erasure of polymorphic types. Note that <code>TypeTag</code>s <em>p... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Comparing ddmmyy dates in bash<p>I would like some help for a bash script to read all the files in a ftp directory and delete the ones after the date range s... | <p>First -- change your filename format. Using <code>%Y%m%d</code> will greatly decrease the amount of pain and suffering involved (and, as a side effect, will make tools that sort by filename put your files in order by date automatically).</p>
<p>Answering your question as originally asked, however...</p>
<pre><code... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to hide all child elements except first child element using CSS<p>I have a table which is looping dynamically. Now I need to hide all <code><tr></c... | <p>Use <code>:not</code> to achieve what you need.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>table.dynamic-table:not(:first-child) .dynamic-tr {
display:none;
}</c... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NSDataWritingFileProtectionComplete with WriteToFile not encrypt the data<p>I hear that we can encrypt documents converting them to NSData and using the Writ... | <p>You used NSData to encode the string. Encoding is not encryption. There's a difference. If you want true encryption then you'll have to look into using the cryptography services of OSX.</p>
<p>However if you just want to make the string not easy to read (obscure it) then you can do something like this when converti... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating dynamic insert form with javascript<p>Hi i have the code below:</p>
<pre><code><form method="post" action="catalog2.php">
<div id="ta... | <p>Try using this javascript code</p>
<pre><code><form method="post" action="catalog2.php">
<div id="tabella" class="table-responsive">
<script>
var numrighe = prompt("Numero di prodotti da inserire", "Numero prodotti");
alert("stampo " + numrighe);
myt... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
errorplacement default style<p>I have created some pages jsp with the data entry form.
Some pages have defined the function validated:</p>
<pre><code><sc... | <blockquote>
<p>"In this case the error is displayed in this way:"</p>
</blockquote>
<p><img src="https://i.stack.imgur.com/DDaff.png" alt="enter image description here"></p>
<p>That is how the jQuery Validate plugin creates the error messages.</p>
<hr>
<blockquote>
<p>".... as is done by the default browser:"<... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to exclude a maven test scope from package phase?<p>I'm collecting all dependency libraries in a separator folder on <code>mvn package</code> as follows:... | <p>Use an <a href="http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#includeScope" rel="noreferrer"><code>includeScope</code></a> to include only <code>runtime</code> scoped dependencies:</p>
<pre><code><plugin>
<artifactId>maven-dependency-plugin</artifactId>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'error' procedure is undefined in plt-r5rs<p>I have this file named <code>myprog.scm</code>:</p>
<pre class="lang-lisp prettyprint-override"><code>(error "N... | <blockquote>
<p>Why did the authors of <code>plt-r5rs</code> not define the <code>error</code> procedure?</p>
</blockquote>
<p>It appears that <a href="https://docs.racket-lang.org/r5rs/r5rs-std/r5rs-Z-H-9.html#%25_chap_6" rel="nofollow noreferrer">The Revised<sup>5</sup> Report on the Algorithmic Language Scheme</a... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Vary color across plot points<p>The following code plots 3 points, all in red:</p>
<pre><code>a = reshape([92.571251 94.869889 97.283709 ],[3 1]);
b = resh... | <p>To colorize the points (and only the points, not the lines in between), you can use the <code>MarkerFaceColor</code> property of the <code>scatter</code> function (or <code>scatter3</code> in 3D).</p>
<p>For instance:</p>
<pre><code>scatter(a, b, 'MarkerFaceColor', rgb)
</code></pre>
<p>where rgb are RGB triplets... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I extracting code from org-mode code blocks?<p>Is there an easy way to dump code blocks in org-mode to files? Somehow naming them via markup near co... | <p>Use the <code>:tangle</code> keyword in your source block (see <a href="https://orgmode.org/manual/Extracting-Source-Code.html" rel="nofollow noreferrer">https://orgmode.org/manual/Extracting-Source-Code.html</a>)</p>
<p>Example:</p>
<pre><code>#+begin_src emacs-lisp :tangle "init.el"
(defmacro add-hook! (hook &am... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Authenticate users when login<p>I'm a beginner and I'm doing a Rails Tuturial https://www.learnenough.com/ruby-on-rails-6th-edition-tutorial/basic_login#sec-... | <p>I think that's because you are trying to authenticate an encrypted password but creating without given password_confirmation to user model. Here is a good <a href="https://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password" rel="nofollow noreferrer">link</a> for und... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Can left recursion be eliminated in all cases in ANTLR?<p>say I have the following</p>
<p>Grammar #1</p>
<pre><code>expr:
expr AND expr
| expr OR e... | <p>You could write it like this:</p>
<pre><code>grammar Test;
parse
: expr EOF
;
expr
: or_expr
;
or_expr
: and_expr (OR and_expr)*
;
and_expr
: primary (AND primary)*
;
primary
: TRUE
| FALSE
| '(' expr ')'
;
TRUE : 'true';
FALSE : 'false';
AND : 'and';
OR : 'or';
SPACES
: [ \t\r\n] -> sk... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Left join that defaults to zero if no results found?<p>I have a database of posts for my website. I am trying to return inside the query if the user has vote... | <p><strong>Problem:</strong></p>
<p>Eventhough you have used <code>LEFT JOIN</code> the <code>WHERE</code> clause which says <code>v.user_id = 1</code>. So all others (where <code>user_id</code> is <code>null</code>) are not being fetched.</p>
<p><strong>Solution:</strong></p>
<p>Add one condition to your <code>WHER... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SVM more than 2 class rapidminer<p>I have a dataset with 3 class positive, neutral and negative.
I try to create a classifier using SVM.
my dataset:
<img src... | <p>I found a solution. I used the operator "Polynominal by Bionominal Classification".
This operator training a model with 3 class using SVM. </p>
<p>here an example: </p>
<pre><code><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to effectively use HTTPClient (.Net 4.5) for sending request to different servers?<p>I am working with legacy ASP.NET application and would like to use H... | <ol>
<li><p>An <code>HttpClient</code> instance <strong><em>per host</em></strong> is totally appropriate here. Socket exhaustion typically happens at a number in the thousands; you should be fine with a "handful" of hosts. And a socket is specific to 1 host anyway, so you gain nothing in terms of socket conservation b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL Change in one table automatically change the other table<p>I am new to Database and in SQL also. I have two tables t1 and t2. There is a "name" column in... | <pre><code>CREATE TRIGGER [dbo].[trg_Table2]
ON [dbo].[table1] AFTER UPDATE
AS
BEGIN
IF UPDATE (name)
BEGIN
INSERT INTO table2 (name)
SELECT d.name FROM DELETED d
END
END
</code></pre>
<p>I provided you an idea. Use it for updating the record. Here 'Deleted' table is the one where the data change... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Android: Navigation-Drawer on all activities<p>I want to add navigation drawer on all actvities of my Android project. This is the code of the MainActivity: ... | <p>The easy way is that you should create fragments. If you are ready to for little hard thing then this is for you. It will let you have <strong>same navigation drawer</strong> in all activities.</p>
<p>Create <code>drawer_n_activity.xml</code></p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jqueryui: "TypeError: this.menu.element is undefined"<p>I'm trying to make an jquery-ui autocomplete widget out of an input created in JavaScript, like so:</... | <p>Your element isn't added to the page properly:</p>
<pre><code>window.document.firstChild.appendChild(fooBox);
</code></pre>
<p>Will try to append the data to the <code>doctype</code> (or <code>HTML</code>) tag.</p>
<p>Use </p>
<pre><code>window.document.body.appendChild(fooBox);
</code></pre>
<p>So your dynamic... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Prefer function-pointer or function-object when customizing sort and map?<p>I want to customizing sort template and map template in C++</p>
<p>Here are for ... | <p>For interchanging function object and pointer with <code>std::map</code> you need to specify type for function pointer, like following </p>
<pre><code>typedef std::function< bool(string,string)> compare;
</code></pre>
<p>Then,</p>
<pre><code>std::map<string, string, compare > m(Greater2) ;
</code></... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why in Ruby do uninitialized instance variables return nil, but uninitialized class variables raise an error?<p>In Ruby, why does an uninitialized instance v... | <p>My take is the following:</p>
<ul>
<li><p>uninitialized local variables return a name error because Ruby doesn't know if its intended to be a local variable or a non-existent method.</p></li>
<li><p>if uninitialized class variables returned <code>nil</code> when not defined, it could lead to nasty bugs when the var... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to Check whether a value is entered in editexts before submitting?<p>I have around 5 edittexts.When i click submit button,it has to check whether all fie... | <p>Android provides a <code>setError()</code> method for this:</p>
<pre><code>if(edttxtDescription.getText().toString().trim().equals(""))
{
edttxtDescription.setError("Please provide description");
}
</code></pre>
<p>Define a method to check whether your <code>EditText</code>s have valid data:</p>
<pre><code>pr... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How do you remove the 'flicker' when switching img src on hover?<p><a href="http://mintrain.co.uk/portfolio.html" rel="nofollow noreferrer">http://mintrain.c... | <p>You can just do</p>
<pre><code> #one {
background: url(/images/portfolio/1A.jpg) no-repeat; //same image here
background-size: contain;
transition: 0.3s;
filter: grayscale(100%);
}
#one:hover {
background: url(/images/portfolio/1A.jpg) no-repeat; //same image here
background-size: contain... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
See the number of new rows added to PostGRES tables each day<p>How can I see the number of new rows added to each of my database's tables in the past day?</p... | <p>The easiest way is to add a column in your table that keep a track of the insert/updated date.</p>
<p>Then to retrieve the rows, you can do a simple <code>select</code> for the last day.</p>
<p>From my knowledge, and I've also done a couple research to make sure, there is no intern functionality that allow you to ... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
make treesitter match classname<p>I am using <a href="http://tree-sitter.github.io/tree-sitter/" rel="nofollow noreferrer">Treesitter</a> to parse Clojure co... | <p>I'm a tree-sitter newbie, so please take that into account when processing the following :)</p>
<p><code>extras</code> contains whitespace for this grammar. IIUC, this means that if one does not use <code>token</code> around <code>seq</code> appropriately, tree-sitter will try to account for cases where whitespace... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MLCP Bulk Loading<p>I have almost 10000 XML (small) files and I am putting them into MarkLogic through MLCP. At the time of ingestion, I am doing some transf... | <p>The documentation for <a href="https://docs.marklogic.com/7.0/messages/XDMP-en/XDMP-XDQPNOSESSION" rel="nofollow">XDMP-XDQPNOSESSION</a> refers to a bug affecting MarkLogic 5.0-2 and before and 4.2-9 and before. If you're using one of those versions, it looks like the fix is to upgrade past them. </p>
<p>You mentio... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Background Issue on Chrome Mac OSX 10.9.5<p>I have a website at <a href="http://www.ucsmun.co.uk" rel="nofollow noreferrer">http://www.ucsmun.co.uk</a> that ... | <p>Add the following rule to the <code>#headerwrap</code> div</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>height: 100%;</code></pre>
</div>
</div>
</p>
<p>If I open up... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Need help automating IP list into file<p>I have a config file that needs to import a list of IPs and display them like this</p>
<pre><code>acl ip_1 myip 1.1... | <p>I edited your code as follow</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
my $n = 1;
open (my $tmph,"<", $ARGV[0]) or die "Error open file $ARGV[0]";
while (<$tmph>)
{
chomp;
my $line=$_;
if ($line=~/\d+\.\d+\.\d+\.\d+/)
{
print ("acl ip$n myip $line\n");
pri... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Sorting by a Date column in Datatables.net<p>I can't seem to figure this out to get my date columns sorting properly. I've been using this as a reference <a ... | <p>I took the advice of VDWWD in the comments above. I updated to return the hidden span with my data rather than using moment js that was giving me lots of issues.</p>
<p>First I created a function that recieves a nullable datetime:</p>
<pre><code>public static string createDateColumnSpan(DateTime? date)
{
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to link to an xxx.dll when the provider only ships it with an xxx.lib and you are using MinGW-w64 and not MSVC?<p><strong>Firebird</strong> and <strong>B... | <p>Windows DLLs can not be linked with a executable programs. For linking, we have
to create a export library for mingw-w64. This answer assumes you have already
install mingw-w64 in your development environment and mingw-w64 tools is
accessible in command line.</p>
<p>The export library can be created from DLL or LIB... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Creating test in NeoLoad from WSDL with http authentication<p>I am creating a performancetest in the tool NeoLoad for several webservices.
You can insert a s... | <p>Neotys fixed this problem in NeoLoad 5.1.4</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Find all alternative basic solutions using existing linear-programming tool<p>I have to find all basic solutions of some tiny linear-programming problems.</p... | <p>There is no routine to do that with <code>glpk</code>; and IMHO it is very unlikely that any real-world solver implements something like that, since it is not very useful in practise and it is certainly not a simple problem.</p>
<p>What is indeed easy to find <em>one</em> other basic solution once you reached optim... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Run a bash script within Automator using positional parameters<p>This is my first time using Automator and it seems like a pretty nifty tool. I am running in... | <p>Read about <a href="https://www.gnu.org/software/bash/manual/html_node/Quoting.html" rel="nofollow noreferrer">quoting</a></p>
<p>In: </p>
<pre><code>find /$1 -name '$2' -prune -o -type f -name '*$2*' -exec mv -- {} /$1/$2 \;
</code></pre>
<p><code>'$2'</code> will not interpolate the variables, you need to use <... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to automatically update column in database<p>I have a session_id column in users table and i set default as 0 and i want to make it automatically change ... | <h1><em><strong>Given below is an algorithm to implement what you have asked yesterday and today including this question</strong></em></h1>
<h2><em>Algorithm starts -</em></h2>
<h3><strong>When user fills the user-ID and Password in login form -</strong></h3>
<ol>
<li><p>Check the <em>user-ID && password</em> b... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
the best database for storing a large JSON<p>I have a large file of json after the parsing using JACKSON, I must store it into a database, it takes a several... | <p>Changes in SQLite are ACID (atomic, consistent, isolated, durable). This means that every update, insert and delete operation is ACID. Unfortunately this requires some overhead in the database processing therefore you should wrap updates in the SQLite database in an transaction and commit this transaction after seve... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Am I Instantiating an Object from File, when I want to create an ArrayList from File? Java<p>We've been assigned to convert a text file into an ArrayList of ... | <p>Just declare the ArrayList outside of the while loop then add the new object g within the loop...</p>
<pre><code>List<GeometricObject> geoList = new ArrayList<GeometricObject>();
while(diskScanner.hasNext()){
String list = diskScanner.nextLine();
g = recreateObject(list);
geoList.add(g);
}... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get absolute numbers of Array?<p>Can someone help me with this?</p>
<p>A series of 10 real numbers is given. Find the number closest to zero and the ... | <p><code>Math.abs</code> won't edit the array "in place" - all it'll do is return the value. You need to do</p>
<pre><code>nums[i] = Math.abs(nums[i]);
</code></pre>
<p>Also,</p>
<pre><code>nums[i] = najdalji;
</code></pre>
<p>will assign <code>najdalji</code> to the array. I think you actually meant to do the reve... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Rspec routing specs fail when route DOES exist<p>I'm trying to test the routing of a namespaced Rails controller action, and something isn't set up correctly... | <p>By running your spec (albeit in Rails 4), I got this error:</p>
<pre><code>Failure/Error: expect(post: '/v1/nphase/device_service/get_device_information').to route_to(
A route matches "/v1/nphase/device_service/get_device_information", but references missing controller: Api::V1::Nphase::DeviceServic... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
I have installed pytz via pip but "import pytz" throws a module not found exception<p>I installed pytz on Debian Buster via </p>
<pre><code>sudo pip install... | <p>Use <code>pip3</code> to install modules for <code>python3</code></p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
FragmentScenario and nested NavHostFragments don't perform navigations as expected in Instrumentation tests<p>I am writing a single Activity app that uses An... | <p>As seen in the <a href="https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java;l=314-317" rel="nofollow noreferrer"><code>FragmentScenario</code> source code</a>, it does <strong>not</strong> curren... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C64 Assembly Rendering a Sprite<p>I have written a short program in 6502 assembler for the Commodore 64 using the <a href="https://cc65.github.io/doc/ca65.ht... | <p>As @Jester pointed out in the comments, the X-position and Y-position memory addresses are wrong. The correct addresses are <code>$d000</code> and <code>$d001</code>:</p>
<pre><code>; set x and y position
lda #$80
sta $d000
sta $d001
</code></pre>
<p>This is the corrected code:</p>
<pre><code> .segment "CODE"
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
getSubimage gives me expection null<p>I'm trying to make chess game with java and I got image from google for pieces.
Now I want to cut it to 6*2 images(Bla... | <p>I'm not sure why you would iterate over the amount of width/height, but I suppose you want to iterate over 2 rows of 6 columns each (or 6 columns of 2 rows each in this case):</p>
<pre><code>public static final String PIECES_IMAGE_PATH = "Images/chess_pieces.png";
public static final int PIECE_IMAGES_INROW = 6;
pub... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to concatenate zip files in PHP<p>I've built a zip file using ZipArchive that contains a directory structure like this:</p>
<pre><code>analysis_name /
... | <p>What I ended up doing goes along these lines:</p>
<ol>
<li>Make a zip file for each analysis, putting it in /tmp and ensuring that the name is unique.</li>
<li>Put these temporary zip files and their sizes into a list, sorting by size, largest first.</li>
<li>Create a "real" zip file, and iterate through the list o... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
AWS RDS instance error: Unable to find main route table - timed out<p>I'm receiving the following error when trying create a new RDS instance.</p>
<p><img s... | <p>This happens when there are issues on the AWS region where you are creating the instance, I was experiencing the exact same issue, then switched to another region an was able to create the instance with no issues.</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Splitting the data.frame into 2 columns<p>I have a fasta file and I read the fasta file using "read.delim" into R. The corresponding data.frame looks like fo... | <p>Try</p>
<pre><code>lines <- readLines('deena.fasta')
indx <- grepl('>', lines)
Sequence <- tapply(seq_along(indx),cumsum(indx), FUN=function(x)
paste(lines[tail(x,-1)], collapse=""))
d1 <- data.frame(names=lines[indx], Sequence, stringsAsFactors=FALSE)
head(d1,2)
# names
#1 >... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why buffer is getting garbage value?<p>This code from my project. I am not able to understand from where <code>buffer</code> is getting this (<strong>潓敭慮敭(10... | <p>swprintf_s expects <strong>wchar_t</strong> string as <strong>'%S'</strong> argument and you are passing <strong>char</strong> string, thus <strong>treating two chars as single wchar_t</strong> (i.e.: 'So' -> '潓').</p> |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Basic Unicode encoding/decoding<p>Python 2.7.9 / Windows environment</p>
<p>when I</p>
<p><code>print myString</code></p>
<p>I'm seeing:</p>
<p><code>u'\... | <p>What you see is the result of <code>print repr(u'\u5df1\u6b66\u8d2a\u5929\u66f2')</code>. If <code>isinstancetype(myString, (str, unicode))</code> is true then find the source where the string is defined and fix it. If <code>myString</code> is some other type then look at how its <code>__str__</code>, <code>__repr__... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
'create table' event ... with Apache Cassandra<p>I am trying to run a Cassandra server. For that i just followed the tutorial on that page (<a href="http://w... | <p>You have to specify the type of the set like : </p>
<pre><code>CREATE TABLE event (
type text,
bucket text,
id timeuuid,
tags set<text>,
PRIMARY KEY ((type, bucket), id)
) WITH CLUSTERING ORDER BY (id DESC);
</code></pre>
<p>For more information see <a href="http://www.datastax.com/documentation/cq... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Jquery ajax,async:false not behaving properly while searching individual words to get image link from google<p>I am building a simple program that search the... | <p>As a workaround, you can fire each ajax request on completion of the previous one. Here is a <a href="http://jsfiddle.net/t195r1bx/4/" rel="nofollow">Fiddle</a>.</p>
<p>JS Code:</p>
<pre><code>var input = '1 2 3 4 5 6 7 8 9 10';
var search = input.split(' ');
var link = new Array();
var j = 0;
var clicked = 0;
$(... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MVC Model Navigation Links<p>I am trying to do a simple MVC project. The idea is to select information from the database and display it on a map. This is a... | <p>The property you set here: <code>[ForeignKey("Vehicles")]</code> is your navigation property which you set to Vehicles but you included <code>public virtual VehicleModel Vehicle { get; set; }</code> which is Vehicle and not Vehicles.</p>
<p>Ref:
<a href="http://peterkellner.net/2012/04/07/gaining-some-control-back-... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Filter output with ansible<p>So I'm connecting with ansible to an interconnect device running PicOS8. I'm issuing a command which has the following output:</... | <p>You have to traverse the list <code>stdout_lines</code> and split the string to the list. Try this one:</p>
<pre><code>- debug:
msg: "{{ item.split(',') | ipv4('address') }}"
loop: "{{smm_output.stdout_lines}}"
</code></pre>
<p>You can also create separate array with IPv4 only</p>
<pre><code>- set_fact:
... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
rn-fetch-blob: How to test upload image<p>How to mock RNFetchBlob for upload image using jestjs?</p>
<p><strong>Code:</strong></p>
<pre class="lang-js pret... | <p>You can use <a href="https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options" rel="nofollow noreferrer">jest.mock(moduleName, factory, options)</a> to mock <code>rn-fetch-blob</code> module. Below is a unit test solution.</p>
<p>E.g.</p>
<p><code>index.js</code>:</p>
<pre class="lang-js prettypri... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
unpickling model file python scikit-learn(Pipeline(memory=None, steps=None, verbose=None))<p>I am trying to convert pickle file from <code>Python 2</code> to... | <p>Found the solution:</p>
<p>While unpickling the file i used <code>encoding</code> as <code>bytes</code> instead of <code>latin1</code>.</p>
<h1>Open the pickle using latin1 encoding</h1>
<pre><code>with open(old_pkl, "rb") as f:
loaded = pickle.load(f, encoding="latin1")
</code></pre>
<p>and everything worke... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to read int from file after specific word in Java<p>Im trying to read an int that will be after a specific word. I tried doing it with delimiters and sca... | <p>When you do:</p>
<pre><code>setRow1VIAString(stringRow);
</code></pre>
<p>you are assuming that stringRow has a value read from the file.</p>
<p>What if this condition is never true?</p>
<pre><code>while(readFile.hasNextInt())
</code></pre>
<p>stringRow would be null and hence the error.</p>
<p>This is my best... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Javascript sorting Object dates<p>After looping I got following array. Is it possible to sort this from current date to latest.</p>
<pre><code>//Sortering
... | <p>By looping object, get all dates into array and sort them and make the object again</p>
<pre><code> var myObj = {
'7aaabbec': "2015-02-09T23:00:00.000Z",
'31ba19e7': "2015-02-24T23:01:00.000Z",
'31ff78e7': "2015-02-24T23:01:00.000Z",
'159a11... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Embedded Interop Types using WatiN<p>I'm trying to use <strong>WatiN</strong> for basic unit-testing purposes. I've installed the latest version through NuGe... | <p>I am not sure if using WatiN for unit testing is a great idea. We used WatiN for browser testing but decided to move to selenium. This was mainly because Watin has not been updated since 2011.
However in order to change the EmbedInteropType to false. In your project expand all references and find the assembly Micros... |
Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ruby more transparent and clean code when using map<p>I've got a simple 2 methods which fetch data from Jira project with assigned tasks to user which left t... | <p>You can create several methods and hide the logic inside them.</p>
<pre class="lang-rb prettyprint-override"><code>def assigned_task_list
assigned_tasks.map do |issue|
{
key: issue.key,
desired_time_to_resolution: desired_time_to_resolution(issue),
time_to_resolution: time_to_resolution(issu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.