input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How to test disabled field in ruby on rails and assert_select? <p>I want to test presence of disabled field generated in rails(5) view helper</p>
<pre><code>form_for(@metric) do |f|
f.text_field :type, disabled: true
end
</code></pre>
<p>it creates HTML </p>
<pre><code><input id="metric_type" type="text" name="... | <p>One solution is </p>
<pre><code>assert_select ".field input#metric_type" do |input|
assert input.attr("disabled").present?
end
</code></pre>
|
Talend data Integration : How to maintain input columns in all the components? <p>My Input sheet has 3 fields
I1,I2 and I3</p>
<p>I have to insert these fields in two tables.</p>
<p>Table1 should have I1 and I2 from input field and It has ID as PK column.
Table2 should have I3. Foreign key relation Table1 ID. </p>
... | <p>You should be able to do so with a simple tMap with 2 outputs : </p>
<pre><code>tDBInput --- tMap ---tDBOutput1
---tDBOutput2
</code></pre>
<p>In tMap, you just have to select the fields to put in the right output.
You can use Talend sequence Numeric.sequence("s1",1,1) in the 'Var' section of the... |
How to deal with this unbalanced-class skewed data-set? <p>I have to deal with <code>Class Imbalance Problem</code> and do a <code>binary-classification</code> of the input test data-set where majority of the class-label is 1 (the other class-label is 0) in the training data-set.</p>
<p>For example, following is some ... | <blockquote>
<p>but got no significant improvement in accuracy.</p>
</blockquote>
<p>Accuracy isn't the way to go (e.g. see <a href="https://en.wikipedia.org/wiki/Accuracy_paradox" rel="nofollow">Accuracy paradox</a>). With a 10:1 ratio of classes you can easily get a 90% accuracy just by always predicting <code>cla... |
Combining ordinal scales to produce a single axis <p>I have created a bar chart, which consists of grouped data. Each group has its own ordinal scale, using <code>rangeBands</code> to position the bars:</p>
<p><img src="http://i.stack.imgur.com/QOkIm.png" alt="chart with two ordinal scales"></p>
<p>Using two scales a... | <p>Here's how I managed to combine the two ordinal scales. </p>
<ul>
<li>Each tick needs to be offset by half the width of each bar, i.e. <code>rangeBand() / 2</code>. </li>
<li>In order to make the axis reach either end of the scale, extra points need adding to either end of the range, with corresponding <code>null</... |
How to check (strpos(...)) all elements of an array efficiently? <p>I want to check all elements of an array and find out, whether at least one of them is prefixed by a given string:</p>
<pre><code>public function validateStringByPrefix(string $string, $prefix)
{
$valid = false;
if (is_string($prefix)) {
... | <p>You can try next solution:</p>
<pre><code>public function validateStringByPrefix(string $string, $prefix)
{
return (bool)array_filter((array)$prefix, function($prefix) use ($string) {
return strpos($string, $prefix)===0;
});
}
</code></pre>
<p>P.S. In case you have few large arrays (with prefixes),... |
calculating Gini coefficient in Python/numpy <p>i'm calculating <a href="https://en.wikipedia.org/wiki/Gini_coefficient" rel="nofollow">Gini coefficient</a> (similar to: <a href="http://stackoverflow.com/questions/31416664/python-gini-coefficient-calculation-using-numpy">Python - Gini coefficient calculation using Nump... | <p>This is to be expected. A random sample from a uniform distribution does not result in uniform values (i.e. values that are all relatively close to each other). With a little calculus, it can be shown that the <em>expected</em> value (in the statistical sense) of the Gini coefficient of a sample from the uniform d... |
Cancellation of pthread seems weird <p>I have a simple test of cancellation of a pthread when assigning this function as a work function:</p>
<pre><code>static void * thread_start(void *arg)
{
printf("New thread started\n");
pthread_cleanup_push(cleanup_handler, NULL);
pthread_cancel(pthread_self());
p... | <p>Looking at <a href="http://man7.org/linux/man-pages/man3/pthread_cleanup_push.3.html" rel="nofollow">the man</a></p>
<blockquote>
<p>POSIX.1 permits pthread_cleanup_push() and pthread_cleanup_pop() to
be implemented as macros that expand to text containing '{' and '}',
respectively. <strong>For... |
dest.write is not a function in gulp with broswerify <p>I try to build my react project using gulp and browserify. But every time I try to build the bundle I get this error:</p>
<pre><code>[16:19:54] Using gulpfile /var/www/html/new-webclass/gulpfile.js
[16:19:54] Starting 'build'...
[16:19:54] 'build' errored after 3... | <p>It took me a while (actually all day) to figure it out. The whole configuration was wrong. This is the right one:</p>
<pre><code>gulp.task('build', function() {
return browserify({
extensions: ['.jsx', '.js'],
debug: true,
cache: {},
packageCache: {},
fullPaths: true,
entries: ... |
After Joomla update from 3.5.1. to 3.6.0 I get the following error: JLIB_CLIENT_ERROR_JFTP_APPEND_BAD_RESPONSE <p>When I Update my current Joomla from 3.5.1 to 3.6.0 the update process starts as expected. But at the end the browser switches to a blank white site. Afterwards when i call the admininstration or the fronte... | <p>The only solution i found right now is the following:</p>
<ul>
<li>I restored a backup of the entire site with the data of yesterday.</li>
<li>Then I entered the administration panel</li>
<li>Switched to configuration and server and disabled the FTP-Layer (which was enabled before)</li>
<li>Now i called the compone... |
Use of curl Paypal API in php <p>How to use the curl function in php for implementing paypal</p>
<p>The curl code is below</p>
<blockquote>
<p>curl <a href="https://api.sandbox.paypal.com/v1/oauth2/token" rel="nofollow">https://api.sandbox.paypal.com/v1/oauth2/token</a> \</p>
<p>-H "Accept: application/json" \... | <p>First of all, check it out @ <a href="http://php.net/manual/en/function.curl-init.php" rel="nofollow">PHP.net</a></p>
<p>Second, you will have to use setopt for the -H, -u, -d options. </p>
<pre><code><?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($c... |
Order of Operations for System Testing? <p>I was taking an exam yesterday, and I noticed they asked in which order the following occur (and I'll put the order I deemed it to be here):</p>
<ol>
<li>Unit Testing (Always write your unit tests first!)</li>
<li>Integration Testing (After you have some code and it works wit... | <p>This question doesn't make a whole lot of sense.</p>
<p>For one thing, different people have different definitions of pretty much every kind of testing you have mentioned. For example, in Extreme Programming (XP) <a href="http://www.extremeprogramming.org/rules/functionaltests.html" rel="nofollow">Acceptance Tests<... |
How do I make a textbox read only using code when an event happens in VB? <p>I've made a program in VB where the user selects from a drop down box whether they would like to find out speed, distance or time. There are three textboxes on the form where the user can enter speed, distance and time, and they don't enter an... | <p>You can make a Textbox read only by using the following code:</p>
<p><code>textbox1.ReadOnly = true</code></p>
<p>You can also found out more <a href="https://msdn.microsoft.com/en-us/library/aa983585(v=vs.71).aspx" rel="nofollow">here</a>.</p>
|
downloadUrlToStorageInBackground in ImageList model for imageViewer downloads & overrides the image every time <pre><code>class ImageList implements ListModel<Image> {
private int selection;
private Image[] images;
private EventDispatcher listeners = new EventDispatcher();
public ImageList() {
... | <p>The download method will always download regardless...</p>
<p>You need to check if the <code>Storage</code> file exists and if so load that. </p>
<p>See the WebServices/Dogs demo in the new kitchen sink: <a href="http://www.codenameone.com/blog/kitchensink-ii.html" rel="nofollow">http://www.codenameone.com/blog/ki... |
How to filter a list in anguler js by sublevels of object <p>I received a list of objects from server in something like this</p>
<pre><code>[
{id: 'a', checked :true,test:{sub:{var:4}}},
{id: 'b', checked:true,test:{sub:{var:3}}},
{id: 'c', checked:true,test:{sub:{var:2}}},
{id: 'd', checked:true,test... | <p>Try this <a href="https://plnkr.co/edit/GfzDbUMMr7CoTPSgomjX?p=preview" rel="nofollow">solution</a>. You can just specify <code>{$ : myPrecious.id}</code> at <code>filter</code> without worrying about hierarchy level, as said at <a href="https://docs.angularjs.org/api/ng/filter/filter" rel="nofollow">docs.angularjs.... |
multiple request "/" to asp.net web form <p>I have a simple web form application(C# with .NET 4.5) that has some css and script. </p>
<p>When I call "localhost:4765/Default.aspx" every things are going right and page loads normally,
But when i call "localhost:4765", it seems some thing! makes multiple request like the... | <p>I don't know what is your problem, but i sometimes(in past) copy a file to my web site root that named 'Index.html' for redirection only with blow simple content (but, if your website does not contains 'Index.html' file).</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" /&... |
MySQL Order rows by date <p>I'm trying to order my rows by the date that each row has.</p>
<p>One row has <code>2016-09-15 15:36</code> and one has <code>2016-08-15 13:12</code> How would i order them so that the highest one is at top?</p>
<p>Their row is called <code>th_activity</code> and i know that in a normal qu... | <p>If your date is year-month-day hour:minute, you can order alphabetically without any problems, so <code>ORDER BY th_activity DESC</code> should work fine.</p>
|
Trying to pass three parameters from one php file to another <p>I am trying to pass three parameters from one php file to another. Two of those parameters are in variables that are already determined long before the button is clicked to call the second php file, but one will be taken from a text box at the time the bu... | <p>If you use <code>$_GET["StudentNum"]</code>, it must come from an HTML-form or a html-link:</p>
<pre><code><a href="form.html?StudentNum=1337">example</a>
</code></pre>
<p>or </p>
<pre><code><form method="GET"><input name="StudentNum" value="1337"></form>
</code></pre>
<p>Good luck<... |
Postgresql - Reducing rows to one if a condition is met <p>I have a table that returns a series of objects. This is a small section of an example result (in JSON):</p>
<p>Query:</p>
<pre><code>SELECT id, starttime, endtime, duration, type FROM things
</code></pre>
<p>Result:</p>
<pre><code>{
"id": 3,
"start... | <p>You can use <code>ROW_NUMBER()</code> :</p>
<pre><code>SELECT MAX(CASE WHEN s.rnk = 1 THEN s.starttime END) as starttime,
MAX(CASE WHEN s.rnk = 2 THEN s.endtime END) as endtime,
SUM(s.duration) as dur,
--You didn't say which status you want
FROM (
SELECT t.*,
ROW_NUMBER() OVER(OR... |
Hammer js - off() method doesn't work <p>I am using Hammer this way, it works (it just triggers next/prev buttons):</p>
<pre><code>var slider = document.getElementsByClassName('slider');
Hammer(slider[0]).on("swiperight", function() {
prev.click();
});
</code></pre>
<p>A according to <a href="http://stackoverflo... | <p>Save <code>Hammer</code> instance to a variable. It works this way. The following example will remove <code>pan</code> event after 5 seconds. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyp... |
Selenium or Coypu Wait for element show and get time before show <p>I using Selenium for UI testing.</p>
<p>What I want to when I click on a button once . Then I'll wait until an element exists. And take time on how long it takes . If it takes longer than timeout ms . So it will give 0 or not exist.</p>
<p>I have try... | <p>I find one soltuion for Coypu:</p>
<pre><code>Public Module BrowserSessionExtension
<Extension>
Public Function WaitUntilElementIsPresent(browser As BrowserSession, cssSelector As String, Optional timeout As Integer = 10) As Long
Dim vExist As Boolean = False
Dim vStopwatch = Stopwatch... |
Github - automatically merge base branch into pull request? <p>Does Github provide a facility to automatically merge the <em>base</em> branch into a pull request? In a development team following a gitflow branching workflow, it would be useful to see what the result of "Merge Pull Request" is in the <strong>PR diff</st... | <blockquote>
<p>Does Github provide a facility to automatically merge the base branch into a pull request?</p>
</blockquote>
<p>There cannot be one. Automatical merges are generally impossible because nobody would be there to resolve the conflicts.</p>
<p>To achieve what you want: Ask your developers/contributers t... |
What causes the HTML to look differently based on the way the PHP is placed? <p>Here are the photo examples to illustrate what I mean.</p>
<p>Edit:</p>
<pre><code>echo '
<input type="text" name="city" class="" placeholder="City" disabled="true"/>
'.displayStateSelect('state', null).'
... | <p>First off, you should really post your code and not screenshots of the code. The screenshots make it much harder to get the full context of your issue and lead to more speculation about an answer. That being said...</p>
<p>It is displaying like that because you are inserting a function that "echo"s or "print"s it's... |
Return value conditional on characters <p>I am dealing with a dataset that looks something like this</p>
<pre><code>Year Column1
2000 yes no
2001 yes yes
2002 yes
2003 N/A yes
2004 N/A N/A
2005 no no
</code></pre>
<p>As you can see, there are multiple and different strings... | <p>We can use <code>str_count</code> (from <code>stringr</code>) and <code>grep</code> to do this. </p>
<pre><code>library(stringr)
library(dplyr)
df %>%
mutate(any_yes = +(grepl("yes", Column1)),
yes_count = str_count(Column1, "yes"))
# Year Column1 any_yes yes_count
#1 2000 yes no 1 ... |
CSS - text flow and centering <p>I'm building an events app using Rails. On my index page each event is represented by a relevant image upon which the event title and date are transposed upon it. Like this - </p>
<p><a href="http://i.stack.imgur.com/G4JCS.png" rel="nofollow"><img src="http://i.stack.imgur.com/G4JCS.pn... | <p>I was trying to do that effect, and I found many tutorials that help me. Unfortunately the <code>border-radius</code> like that I found nothing usefull. <strong>But</strong>, on the other hand, the spaces on the begin and end of the line, I fixed it:</p>
<p><a href="https://fiddle.jshell.net/s112Lao0/" rel="nofollo... |
Run and terminate external .m-file from GUI <p>I created a small MATLAB-GUI to choose a directory and to start an external MATLAB-script in this directory with a click on a button. The path to the script is saved in a variable <code>file</code> and I start it with <code>run(file)</code>. But now I want to stop this scr... | <p>If you don't want to make any changes in the scripts that you are calling, you could try to run the script in a new Matlab instance and then kill that matlab process when you want to stop the script running. Something like:</p>
<pre><code>oldPids = GetNewMatlabPIDs({}); % get a list of all the matlab.exe that are ... |
Restful URL design full text search on any specified field <p>My api should support text search on specified fields. So I am thinking what kind of URL style handles it in the best way.</p>
<p>The below pattern, using <strong>"q"</strong> ,is mentioned in many blogs and documents to be used for full text search but I a... | <p>Soheil, you are thinking right. "Search" is a "filter parameter" wich always go in the Query String.</p>
|
Why is Google Chrome running all these tasks when closed? <p>since this morning, I have like 20 tasks from Google Chrome using a lot of memory for nothing even when the software is completely closed. </p>
<p>Here is the screenshot of the Taskmanager :
<a href="http://i.stack.imgur.com/eUvMU.png" rel="nofollow"><img s... | <p>Because you did not disable the option to keep background apps running.</p>
<p>It can be found in the settings(chrome://settings) at the bottom of the advanced settings.</p>
<p>The use of these services depends on the extensions you have installed.</p>
|
send broadcast message when service is stopped <p>I would like to send the broadcast message back to the activity when the service is stopped by the user or OS. I have tried to add the code in onDestroy of the service while onDestroy have not been called every time.</p>
<p>Can anyone give me suggestion how I can send ... | <p>Try using StartSticky and sending a broadcast every time the service start(onStart). So when it is destroyed, the service will try to run again by itself and will send the broadcast. This way you will know when the server have been closed and open again.</p>
<p>P.D: Remember to send the broadcast in the onStart, no... |
My if statement keeps returning 'None' for empty list <p>I'm a beginner at coding in Python and I've been practising with exercises CodeWars.</p>
<p>There's this exercise which basically wants you to recreate the display function of the "likes" on Facebook, i.e. how it shows the number likes you have on a post etc.</p... | <p>If <code>names</code> is an empty list the <code>for</code> loop won't be executed at all, which will cause the function to return <code>None</code>. You should change the structure of your function (hint: you might not even need a loop, not an explicit one at least). There is no point in having a loop and then <cod... |
jQuery autocomplete list item icons <p>I'm using jQuery autocomplete and I want to add a font-awesome icon on the right side of all list items from the autocomplete source. </p>
<p>The solutions I found so far were setting the background of every list item but I want the font-awesome icon to listen for a click event s... | <p>The following code solved the problem for me:</p>
<pre><code> var data = ["a", "b", "c"];
$(this).autocomplete({
source: data,
open: function(event, ui) {
$(this).autocomplete("widget").css({
"width": $(this).parent().width()
... |
Need help stopping - Update or CancelUpdate without AddNew or Edit - Access error <p>I have built a database at work that I get an occasional error in that I can't quite figure out. </p>
<p>I have a bound form in split form/datasheet view. Occasionally when updating records, I get the "Update or CancelUpdate without A... | <p>I concur with dbmitch; adding some extra info to your error message would be a great help.</p>
<p>In addition, if that doesn't get you exactly what you want, you can also implement the little-known ERL function. Most people don't even know that Access can trap at the line level if they add line numbers (are you ol... |
How to use type parameter correctly <p>I'm confused about type parameter.In the following code, types inside CollectionData angle bracket can be called type parameter. Types inside ArrayList and Generator are not type parameter and should be the same in CollectionData. How to understand it?</p>
<pre><code>//correct
p... | <p>These generic types are just type <em>variables</em>.</p>
<p>Writing</p>
<pre><code>public class CollectionData<T> extends ArrayList<E> {
</code></pre>
<p>is similar to writing</p>
<pre><code>public int func(int x) {
return y;
}
</code></pre>
<p>If there is no variable <code>y</code>, then this... |
Mocking a service to call local json-server instead of remote endpoint - test syntax? (Angular 2) <p>I'm trying to write a unit test to determine that a property on my angular 2 component is populated after a service call that returns a promise.</p>
<p>My component contains a method:</p>
<p><div class="snippet" data-... | <p>If you are mocking the service, you should not be using <code>Http</code>. Just return your own promise, without interacting with <code>Http</code>.</p>
<pre><code>class MockEmployeeService {
public loadEmployees() {
return Promise.resolve({some:'object'});
}
}
</code></pre>
<p>With the <code>Http</code> s... |
Selecting a range with VBA <p>I am trying to copy column k(rows 4 to the end) & column c(rows 4 to the end), Copy them, and Paste them into into column BL(starting at row 4) & column BM(Starting at row 4) without duplicates. (basically trying to replicate the first provided code but to start at row 4 instead of... | <p>Do two separate copy pastes and look to how I changed the range on the RemoveDuplicates:</p>
<pre><code>Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Sheets("Sheet1").Range("K4:K" & Lastrow).Copy Sheets("Sheet1").Range("BL3")
Sheets("Sheet1").Range("C4:C" & Lastrow).Copy ... |
Angular ng-repeat inside ng-repeat collapse <p>I have been attempting to perform an ng-repeat inside an ng-repeat collapse. My inner ng-repeat, repeats the entire array inside of every div. I have tried to track by index but still no resolve:</p>
<pre><code><div class="col-md-4">
<div id="markets">
<... | <p>You need to add the second array as a property of each item in first array. See below code:</p>
<p><strong>HTML:</strong>
Instead of writing ng-repeat = "s in stuff", we will write ng-repeat = "s in m.stuff"</p>
<pre><code><div class="col-md-4">
<div id="markets">
<div class="panel panel-default... |
How to disable lighttpd access log? <p>I'm using lighttpd and access.log is increasing too fast.</p>
<p>Is there a good way to disable access log?</p>
<p>At the lighttpd.conf seems that is possible to disable "mod_accesslog" in the "server.modules", but the comment advices to don't do.</p>
<p>lighttpd 1.4.35</p>
| <p>If you have neither <code>accesslog.filename = "..."</code> or <code>accesslog.use-syslog = "enable"</code> in your lighttpd.conf, then there will be no access logging. If you want to disable access logging, comment these lines out of your lighttpd.conf and restart the lighttpd server to pick up the changes.</p>
|
Extended Metadata <p>The <code>meta</code> function in kdb/q returns the following info about the table:</p>
<ol>
<li>c â (symbol) column names </li>
<li>t â (char) data type </li>
<li>f â (symbol) domain of foreign keys </li>
<li>a - (symbol) attributes.</li>
</ol>
<p>I would like to extend this to include mor... | <p><code>meta</code> is a reserved word and therefore cannot be redefined. But you can create your own implementation and use it in place of <code>meta</code>:</p>
<pre><code>TimeZone:{[Table;Col] ... } / your TimeZone function
metaExtended:{meta[x],'([]z:TimeZone[t]each cols x)}
metaExtended Price
</code></pre>
<p... |
Accessing UI from outside thread in Winforms <p>In WPF, one could use something like:</p>
<pre><code>Application.Current.Dispatcher.BeginInvoke(new Action(() => Form1.grid.Items.Refresh()));
</code></pre>
<p>to access UI functions outside of the main thread. In Winforms however, the same functionality isn't there.... | <p>You MUST access your UI from your UI Thread only. But you can use the <a href="https://msdn.microsoft.com/en-us/library/zyzhdc6b(v=vs.110).aspx" rel="nofollow"><code>Control.Invoke</code></a> method - a <code>Form</code> IS a <code>Control</code> - to ensure your code is run from the UI Thread.</p>
<p>Also, you hav... |
array showing undefined in variable <p>I have imorted a module that performs a function on an array of data. When I run the function I get the results in my server but they seem not to be stored in my variable, which comes back undefined. Can someone tell me why my array comes back undefined when I can see the array in... | <p>First, what is wrong with your code:</p>
<ul>
<li><code>var results={}</code>: the var <code>results</code> is not used.</li>
<li>you have 3 functions <code>lastName</code>, <code>addEmp</code> and <code>lookId</code>. All are called and nothing is passed, therefore the <code>results</code> var is always undefined.... |
what is the meaning of " = > " in typescript? <p>I saw many code snippets which has <code>=></code></p>
<p>symbol in typescript file. Could any one explain what is the exact meaning and why to use.</p>
| <p>=> is a lambda function. For a great intro take a look <a href="https://basarat.gitbooks.io/typescript/content/docs/arrow-functions.html" rel="nofollow">here</a>, or the documentation <a href="https://www.typescriptlang.org/docs/handbook/functions.html" rel="nofollow">here</a>.</p>
|
How to predict world position of moving Object (Velocity)? <p>I have a rigidbody created with cannon.js where i apply velocity on to move it.</p>
<pre><code>this.body.velocity.set(coord.x, this.body.velocity.y, coords.z);
</code></pre>
<p>Now i want to predict the future position of this object before velocity was se... | <p>To get the position in the future: newpos = position + velocity<em>amtseconds.
To get the position in the next timestep: newpos = position + velocity</em>deltatime.</p>
|
Styling DropdownListFor when Error appears <p>In my application the user must select Product Categories from a DropDownList. So what I want to do is, if he doesen't select a category and tries to send his order, the DropDownList should be highlighted so he sees, that he has to select a category. My problem now is, not ... | <p>For anyone interested in this, the problem is solved and the solution can be found <a href="http://How%20to%20set%20a%20background-color%20for%20DropdownlistFor" rel="nofollow">here</a></p>
|
bootstrap table with clickable row event and how to exclude a column or cell <p>I have this function for row click:</p>
<pre><code>$("#table").on("click-row.bs.table", function (row, $el, field) {
if (column != 4) {
}
});
</code></pre>
<p>and what condition I could add which would exclude a specific column or ce... | <p>I've finally found the answer for my question (if somebody would need it, it's more simple then I thought):</p>
<pre><code> $("#table").on("click-cell.bs.table", function (field, value, row, $el) {
if (value !="column_name"){
//the code
}
});
</code></pre>
<p>here is an example (with the access to a... |
Launch CUDA-Kernel with a timeout <p>I'm trying to launch a CUDA-kernel with a specific timeout. I know there is a device timeout for CUDA-kernels, but as I am working on a shared server I have no access to set this timeout, even if it was possible.</p>
<p>I need this for an auto tuning application. I'd like to set a ... | <p>Thanks to the link posted by <a href="http://stackoverflow.com/questions/39513830/launch-cuda-kernel-with-a-timeout/39514902#comment66344178_39513830">tera</a> I was able to implement a timeout myself. As stated in that thread it can be done as follows:</p>
<pre><code>const int timeout = 2000000;
int progressed = 0... |
Count result array to string conversion error in codeigniter <p>I am using this method in my model to get a count result from my database:</p>
<pre><code>function members($group_id)
{
$this->db->where('group_id',$group_id);
$query = $this->db->query('SELECT COUNT(group_id) FROM member');
re... | <p>Try this</p>
<p>Model</p>
<pre><code>function members($group_id) {
return $this->db->get_where('member', array('group_id' => $group_id))->num_rows();
}
</code></pre>
<p>Controller</p>
<pre><code>function total_members() {
$group_id = $this->input->post('group_id');
$this->load-&g... |
How should docker-compose jobs discover etcd? <p>The <a href="https://coreos.com/etcd/docs/latest/getting-started-with-etcd.html" rel="nofollow">documentation for etcd</a> says that in order to connect to etcd from a job running inside a container, you need to do the following:</p>
<pre><code>[...]you must use the IP ... | <p>The documentation you reference is making a few assumptions without stating those assumptions.</p>
<p>I think the big assumption is that you want to connect to an etcd that is running on the host from a container. If you're running a project with <code>docker-compose</code> you should run etcd in a container as par... |
Do something when div is created without knowing the event that creates it (javascript) <p>I'm wanting to create an overlay when a popup is created, but I don't know what event is triggering the popup. Is 'listening' for a specific div to be created possible?</p>
<p>Just in case that wasn't clear, here's another way o... | <p>you can use <a href="https://www.w3.org/TR/2014/CR-dom-20140508/#mutation-observers" rel="nofollow">Mutation observer</a> to detect the event when div is created</p>
|
Return a modal confirmation box in a JsonResult from controller if a condition <p>Hi everyone i have the following situation: I have a view in which I have a save button that is serializing a form and sending it by Ajax to a JsonResult in the Controller. Inside this JsonResult I'm adding/editing tables in the database.... | <p>Yes it is possible. All you have to do is, return the HTML markup needed to show in the modal dialog.</p>
<p>Here, i am using the <code>RenderRazorViewToString</code> method (from the <a href="http://stackoverflow.com/users/135786/ben-lesh">Ben Lesh's</a> answer on<a href="http://stackoverflow.com/questions/483091/... |
Using viewport width=device-width, initial-scale=1, maximum-scale=1 doesnt fit my page to my phone screen <p>I have this but when I open the webpage on my phone it is wider than the screen.</p>
<pre><code> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
</code></pre>
<p>s... | <p><strong>Couple things:</strong></p>
<p>Your meta viewport tag is simply setting the scale at which the viewport is set to. It has nothing to do with your images.</p>
<p>Your image is not a background image in the technical sense. A background image is a css property of an element.</p>
<p>You have a fixed width o... |
How to append array to a json file which already have a array? <p>I have a name.json file having :</p>
<pre><code>[
{"name" : "James",
"Surname" : "Bond"
},
{
"name" : "Abc",
"Surname" : "Xyz"
}]
</code></pre>
<p>Now I want to add another array to this existing file :</p>
<pre><code> [
{"name" : "Brad",
"... | <p>The one <strong>reasonable</strong> way here:</p>
<ol>
<li>Use any of the plenty JSON parsers around to <strong>read</strong> the JSON file</li>
<li>This will result in an in-memory representation of that array</li>
<li>Add the additional elements to that array</li>
<li>Use another library to <strong>write</strong>... |
Function return a tuple made of vectors <p>I am trying avoid output arguments in my functions. The old function is:</p>
<pre><code>void getAllBlockMeanError(
const vector<int> &vec, vector<int> &fact, vector<int> &mean, vector<int> &err)
</code></pre>
<p>Here <code>vec</cod... | <p>You function signature is <code>tuple< vector<int>, vector<int>, vector<int> ></code>, which is a temporary and the elements are eligible to be moved, so</p>
<pre><code>std::tie(fact, mean, err) = getAllBlockMeanErrorTuple(vec)
</code></pre>
<p>should move-assign <code>fact</code>, <code>me... |
How can I pass parameters from parallel builds downstream in a jenkins pipeline <p>I have been trying to set up a pipeline in jenkins which runs all my robot test builds in parallel and then, after they all finish, runs another build which includes sending 1 email with results for all the tests (rather than spamming wi... | <p>From <a href="https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job" rel="nofollow">Jenkins pipeline steps reference</a>, you can call a downstream job with parameters like this :</p>
<pre><code>build job: downstreamJob, parameters: [
[$class: 'StringParameterValue', name: 'passPercenta... |
Progress 4GL nesting blocks to display related data <p>First all I'm very new to Progress 4GL and still trying to get my head around how nesting FOR EACH blocks works. I have the following two tables that I'm getting information out of, ivc_header and ivc_mchgs: </p>
<pre><code>ivc_header
invoice_nbr | sold_t... | <p>I think you might not be aware that you can specify multiple BY clauses. </p>
<p>IOW you might want to code the inner FOR EACH something like this:</p>
<pre><code>FOR EACH ivc_mchgs NO-LOCK WHERE ivc_header.invoice_nbr = ivc_mchgs.invoice_nbr
BREAK BY ivc_mchgs.invoice_nbr
BY ivc_mchgs.sold_to_cust... |
xmonad layout withIM stays the same size <p>I have a problem with xmonad and the XMonad.Layout.IM module.
I have the following configuration for my layout and no matter to what I change the parameter of "withIM", the window stays always the same size.</p>
<p>Config:</p>
<pre><code> 38 import XMonad.Layout.IM
39 ... | <p>I had the same problem and the solution is quite simple: restart the pc (or session) after you changed the rational parameter (e.g. 1%7, or 3%7, ...) and it works:)</p>
|
Pass data to VC that is not the previous VC <p>When I go from VC1 to VC2, if VC2 gets dismissed, I could easily pass data back to VC1 by setting protocal in VC2 and have VC1 conform to it. I want to do something similar, however, with the following difference</p>
<p>When I go from VC1-> NavVC->VC2-> VC3. When VC3 gets... | <p>You have multiple patterns that you can apply in similar situations. i will go with the delegation (recomended) example. Imagine you have VC1->
that presents modally a UINavigationController as a root controller and from there VC2 pushes VC3 to the stack. You have to define multiple protocols that will be called on ... |
TYPO3 - Ext cal - PHP Catchable Fatal Error <p>I use the Ext "cal", when I add an Image to an Event, i got this Error: </p>
<blockquote>
<p>PHP Catchable Fatal Error: Object of class
TYPO3\CMS\Core\Resource\FileReference could not be converted to string
in typo3/sysext/core/Classes/Resource/ResourceFactory.php l... | <p>Show your code or the error didn't happen. ;-)</p>
<p>Educated guess: you use a file reference in your view helper instead of using <code>treatIdAsReference = "1"</code></p>
|
Stored procedure Not Accepting Newline character in parameter <p>I am trying to put comma separated values as parameter to stored procedure, but when I am pressing "Enter" key for continuing the values so that it can be seen in single screen (without scrolling) , SP is not accepting the values which are provided after ... | <p>It's not possible to be certain without seeing the code of your stored procedure, but I suspect that the newline character somehow breaks the code which is used to split the delimited string into a result set; the newline character is interpreted as a terminator and all the values following it are ignored.</p>
<p>T... |
WSO2 API import not doing anything (from Swagger) <p>I've just installed WSO2 2.0.0 (as far as I know, this is the version following v1.9.0, not a breaking compatibility version). I'm using it via Firefox 40.0.2 on Windows.</p>
<p>When I try to add a new API via "I have an existing API" menu, whatever I do, it always ... | <p>It seems the swagger document you are trying to import is of swagger version 1.2 ("swaggerVersion":"1.2"). From API Manager 1.9 onwards we should use swagger 2.0 compatible definitions.</p>
<p>You can use <a href="http://editor.swagger.io/#/" rel="nofollow">http://editor.swagger.io/#/</a> to validate your swagger d... |
How do I use Process.Start to open a word file (Path with Spaces)? <p>The file is in the directory but the spaces cause this error:</p>
<pre><code>string outfile = @"C:\Users\hp\Desktop\New folder (4)\outFile.doc";
Process.Start("WINWORD.EXE", outfile);
</code></pre>
<p>Shows me this message</p>
<p><img src="htt... | <p>Since your path contains spaces and normally, program arguments are separated by spaces, your <code>outfile</code> is interpreted as 3 different arguments. You need to enclose the path in quotes to make it work.</p>
<pre><code>string outfile = @"""C:\Users\hp\Desktop\New folder (4)\outFile.doc""";
</code></pre>
<p... |
Exclude directories from tar archive with a .tarignore file <p>In a similar way to <code>.gitignore</code>, is it possible to do that a <code>.tarignore</code> file in a subdirectory makes it excluded from archive when doing</p>
<pre><code>tar cfjvh backup.tar.bz2 .
</code></pre>
<p>(I know the <code>--exclude</code>... | <p>You can do something like</p>
<pre><code>$ COPYFILE_DISABLE=true tar -c --exclude-from=.tarignore -vzf archiveName.tar.gz
</code></pre>
<p>The breakdown:-</p>
<ul>
<li>Reason for <code>COPYFILE_DISABLE=true</code>is for making sure files starting with <code>._</code> are not included in the <code>.tar</code> file... |
Dojo Query returns undefined <p>I am trying to get a DOM element by class and not sure why its returning undefined. I can query the parent element without any problems. Here is my code:</p>
<pre><code> var contentPane = query('.contentPane', this.map.infoWindow.domNode)[0];
var header = query('.header',... | <p>the <code>.header</code> was not rendered at the time of query. I have resolved this by using <code>query</code> when the containing function was completed.</p>
|
Is it possible to delete or segment a bucket in the forge API <p>I'm building an app where users will add collections of CAD files to an engineering project. </p>
<p>My plan was to have one <code>transient</code> and <code>temporary</code> bucket for the whole app to use for temp storage. Then create a <code>persisten... | <p>Yes it is. It is simply not documented yet.
The API works like this when using OSS v2:</p>
<p>DELETE
<a href="https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey" rel="nofollow">https://developer.api.autodesk.com/oss/v2/buckets/:bucketKey</a></p>
<p>requires 'bucket:delete' scope</p>
<p>action cannot be ... |
How to take input as String with spaces in java using scanner <p>I need to read spaces (present before string and after String) given as input using Scanner
Note : if there is no spaces given in input it should not add space in output</p>
<p>Please find the below code: </p>
<pre><code>package practise;
import java... | <p>Your code work fine. I just add little modification:</p>
<pre><code>package practise;
import java.util.Scanner;
public class scanccls {
public static void main(String[] args) {
System.out.println("Enter your name:");
Scanner scan = new Scanner(System.in);
String name="";
na... |
Active record, results illustration <p>Can someone explain this?</p>
<pre><code>Post.where(:p_date => ((Time.now - 7.days)..(Time.now))).count
-> 4507
Post.where(:p_date => ((Time.now - 7.days).beginning_of_day..(Time.now).end_of_day)).count
-> 4794
</code></pre>
<p>While <strong>p_date</strong> is only <... | <p>If <code>p_date</code> is a date column, pass dates into your query</p>
<pre><code>Post.where(p_date: (7.day.ago.to_date .. Date.today)).count
</code></pre>
<p>which uses this query</p>
<pre class="lang-sql prettyprint-override"><code>SELECT COUNT(*) FROM `posts` WHERE (`posts`.`p_date` BETWEEN '2016-09-08' AND '... |
Vue.js hello world won't render <p>I'm trying to create an Hello world app like in the get started documentation on the Vue.js site. Everything looks fine but the text isn't displayed on the page, just the html code.</p>
<p>Vue version : 1.0.26</p>
<p>Here's the html code :</p>
<p><div class="snippet" data-lang="js"... | <blockquote>
<pre><code><script src="app.js"></scrip>
</code></pre>
</blockquote>
<p>You have a typo. The <code>t</code> is missing from your end tag. Consequently the <code>app.js</code> script will never load.</p>
<p>Methods that might have detected this:</p>
<ul>
<li>Look at the Developer Tools Networ... |
ImportError: No module named durationfield.db.models.fields.duration (Python, Django 1.9) <p>I'm trying to put a duration field in my models and I'm following the instructions <a href="https://django-durationfield.readthedocs.io/en/latest/" rel="nofollow">here</a>. First problems I run into is that I can't seem to imp... | <p>It's here:</p>
<pre><code>from django.db.models import DurationField
</code></pre>
<p>And yes, it comes with Django 1.8+ so you don't need to install it. </p>
|
How to remove user permissions from a SharePoint 2013 document library using c# <p>I've seen many ways to remove groups from a document library in SharePoint 2013. But what I need to do is to remove an individual's permissions to a document library and not a group.</p>
<p>This is the code I've been using. It runs with... | <p>what you are doing is break inheritance and remove a user permission for each item on your document library. The permissions on the library itself will stay the same. You are in fact setting item level permissions. </p>
<p>Just try and do the same actions on the list object, and remove the foreach through the list ... |
Meteor 1.4.1.1 how installing react and kadira:react-layout? <p>i'm trying installing packages of react but the console log return this
the same issue when i trying installing kadira:react-layout. How can I fix it?</p>
<p><code>I20160915-17:27:56.255(2)? [Error: Can't find npm module 'react-addons-transition-group/pa... | <p>You need to install follow packages from react to fix the issue.</p>
<ul>
<li>react-addons-create-fragment</li>
<li>react-addons-css-transition-group</li>
<li>react-addons-linked-state-mixin</li>
<li>react-addons-perf</li>
<li>react-addons-pure-render-mixin</li>
<li>react-addons-test-utils</li>
<li>react-addons-tra... |
From one component trigger scroll to top of element in another component <p>I have this table which is part of <code>TableComponent</code>:</p>
<pre><code><table class="th-tracker-table th-environmental-table" #trackerTable>
</code></pre>
<p>I want to access it from <code>MyComponent</code> and scroll to top of... | <p>I guess you can't do it with template variable. Try to wrap your table into a component and then </p>
<pre><code>@ViewChild(YourComponent) _yourComponent: YourComponent;
</code></pre>
<p>remember that _yourComponent is first available in ngAfterViewInit event.</p>
|
Does Pattern Lab "not mix well" with Angular? <p>âAs an interaction designer looking for better ways to collaborate with developers, I have tried to introduce Pattern Lab to my current client. The lead developer for the front end framework pushes back, however. Main gist of his argument:</p>
<blockquote>
<p>Our to... | <p>Maintainer of Pattern Lab Node here.</p>
<p>I just created this reductive sample repository illustrating Angular within Pattern Lab. </p>
<ul>
<li><p><strong>Repository</strong> <a href="https://github.com/bmuenzenmeyer/patternlab-node-angular-example" rel="nofollow">https://github.com/bmuenzenmeyer/patternlab-nod... |
Mockito throws exception <pre><code>public interface ABC {
public boolean removeUser(String userId) throws OTPServiceException, RemoteException;
}
ABC abc= mock(ABC.class);
doNothing().when(abc).removeUser(anyString());
</code></pre>
<p>I have tried like this. I got below exception.</p>
<pre><code>org.mockit... | <p>You method returns a boolean, so you should mock a boolean response.</p>
<p>You should have something like this:</p>
<pre><code>when(abc.removeUser(anyString())).thenReturn(true);
</code></pre>
<p>You can check <a href="http://stackoverflow.com/questions/28836778/usages-of-dothrow-doanswer-donothing-and-doreturn-... |
Trying to convert CSV to XLSX, but columns are being split up using the wrong commas <p>I am using the accepted answer from <a href="http://stackoverflow.com/questions/18077264/convert-csv-to-xls-xlsx-using-apache-poi">here</a>. Basically, I am converting a csv to .xlsx, and it looks like the solution pulls everything ... | <p>Well, CSV is something more than just text file with lines separated with commas.</p>
<p>For example, some fields in CSV can be quoted; this is the way comma is escaped within one field.</p>
<p>Quotes are quoted as well, with double-quotes.</p>
<p>And there also could be newlines within one CSV line, they must al... |
set data attributes with ajax and select2 <p>I'm trying setup data attributes into select2 options but without success, at this moment i have the following JS code</p>
<pre><code>_properties.$localElement.select2({
ajax: {
url: "url",
type: "POST",
dataType: 'json',
delay: 250,
... | <p>I find the solution, looks that resultTemplate dont format the "visual" selected option , need to use templateSelection option:</p>
<pre><code> templateSelection: function(container) {
$(container.element).attr("data-source", container.source);
return container.text;
}
</code></pre>
|
RealmSwift with xCode 8 <p>I developed an app using swift 2.2 and Xcode 7.3.1 and I've used Realm 1.0.1 for the database adding manually the framework to the project.
Today I've updated to xCode 8 but now Realm doesn't work anymore.</p>
<p>I've tried to both "Convert to Swift 2.3" and "Convert to Swift 3" but I always... | <p>While there will be official support for Swift 3, currently you have to build Realm yourself using the instructions <a href="https://github.com/realm/realm-cocoa/issues/3796" rel="nofollow">here</a>. </p>
|
LSTM/RNN many to one <p>I have the below dataset for a chemical process comprised of 5 consecutive input vectors to produce 1 output. Each input is sampled every minute while the output os sample every 5.</p>
<p><a href="http://i.stack.imgur.com/Gvq8T.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/Gvq8T.jpg" a... | <p>Since you are going for many to one sequence modelling, you don't need to pad zeros to your output (it's not needed). The easiest thing would be to perform classification at last time-step i.e after RNN/LSTM sees the 5th input. The dimension of your 3D input tensor will be [batch_size, sequence_length, input_dimensi... |
Calling a subroutine as part of a SQL Transaction <p>My project is an orders application, where users can enter orders from different customers, using an <code>UltraGrid</code> to enter and edit data. When the Delete key is pressed on the keyboard, it prompts a <code>MsgBox</code> for the user to confirm they want to d... | <p>Simplest way of doing it, is keeping all of your changes in-memory (additions, modifications and deletions) and then synchronizing them to the database when you hit your Save button.</p>
<p>Possibly, you'll need an AJAX action to add the operation to the server-side and a client-side script to update the row on the... |
Knockout.js won't be recognized after using require.js <p>Calling require.js before knockout.js throws the following message:</p>
<blockquote>
<p>Uncaught ReferenceError: ko is not defined</p>
</blockquote>
<p>Assuming I have knockout.js at the very top of the combined file, I have this:</p>
<pre><code><script ... | <p>When Knockout detects RequireJS, it doesn't create a global <code>ko</code> object but expects you to use <code>define</code> to get the object.</p>
|
Terminal (bash) - mkdir from read input string <p>I am using Terminal (bash) in OSX and trying to create an executable script that will create a directory from input, but I'm having problems when inputting a string with spaces (and I need spaces). </p>
<p>For example, when inputting "new folder" in the code below, it ... | <p>You are using curly quotes, not regular ASCII quotes, in your script. Your script is UTF-8 encoded, which means the argument to <code>mkdir</code> is stored as the following byte stream:</p>
<ul>
<li><code>e2 80 9c</code> - left curly quote</li>
<li><code>24 64 4e 61 6d 65</code> - <code>$dbash</code></li>
<li><cod... |
Cmake: cannot open output file no such file or directory <p>I am learning to use cmake for a project using a shared library, but I keep getting this error:</p>
<pre><code>Linking CXX executable test/test/robot_test
/usr/bin/ld: cannot open output file test/test/robot_test: No such file or directory
collect2: error: ld... | <p>The first parameter for command <a href="https://cmake.org/cmake/help/v3.0/command/add_executable.html" rel="nofollow">add_executable</a> is not a <em>filename</em> but a name of <strong>target</strong>. Target's name shouldn't contain special symbols like slash ("/").</p>
<p>You may control output directory of exe... |
Bash For loop logic in oracle sql <p>I am looking for something similar to the bash for loop in oracle </p>
<pre><code>for i in 1 5 3 8; do echo "print $i"; done
</code></pre>
<p>so this would result as</p>
<pre><code>print 1
print 5
print 3
print 8
</code></pre>
<p>I want something similar logic in Oracle SQL like... | <p>I hope that I understood your request correctly:</p>
<pre><code>SELECT r FROM (
SELECT ROWNUM r
FROM DUAL
CONNECT BY ROWNUM <= 8)
WHERE r IN (1, 5, 3, 8)
</code></pre>
<p>Basically, we're creating a column of all numbers from 1 through 8 and then selecting the ones you requested. If you'r... |
Using Orbeon Forms, is it possible to group radio buttons into radiogroups? <p>I would like to be able to create a radio button list where radio buttons are contained in a radiogroup with a heading. Such as using the <code><optgroup label=""></code> in HTML select lists or a <code><fieldset> <legend>.... | <p>I imagine that you're asking this question in the context of accessibility. If you're using a regular <code><xf:select1 appearance="full"></code> with an <code><xf:label></code>, Orbeon Forms will put all the radio buttons inside a <code><span></code> that has a:</p>
<ul>
<li><code>role="radiogrou... |
How to expose ports defined in EXPOSE without explicitly setting ports via CLI options? <p><a href="http://stackoverflow.com/questions/22111060/difference-between-expose-and-publish-in-docker">Difference between "expose" and "publish" in docker</a> this post describes 3 different options to expose p... | <p>To map to specific ports like you've asked you have to use the -p PORT:PORT option.</p>
<p>The other option is to use -P to publish all ports and then docker will randomly assign ports starting typically in the 32700 range to the various ports are that are defined by the image.</p>
|
undefined reference to `longjmp' while using library for regex in Arduino IDE <p>I am getting this error while using <a href="https://github.com/nickgammon/Regexp" rel="nofollow">Nick Gammon's Regexp library</a>. The error is below:</p>
<pre>
libraries/Regexp/Regexp.cpp.o:(.text._ZL5errorc+0x4): undefined reference to... | <p><code>setjmp</code> and <code>longjump</code> are normaly part of libc that is not used by <a href="https://github.com/esp8266/Arduino" rel="nofollow">ESP8266 core for Arduino</a>. </p>
<p>This issue is described in <a href="https://github.com/esp8266/Arduino/issues/910" rel="nofollow">#910</a>. A comment suggests... |
WSO2 Identity Server caching after role change <p>I would like to share with you the levels of frustration that I experienced trying to fix a WSO2 issue that i had.
I'm having a system with Api Manager and Identity Server working together. Api Manager is responsible for the apis, and Identity Server is in charge of us... | <p>Make sure you have disabled <code>EnableKeyMgtValidationInfoCache</code>, to generate JWT tokens per every call, as mentioned in <a href="https://docs.wso2.com/display/AM190/Configuring+Caching#ConfiguringCaching-Keycache" rel="nofollow">this document</a>. </p>
|
CompilerException java.lang.RuntimeException: Unable to resolve symbol: var in this context <p>I use following code to get function name as symbol type</p>
<p><code>(:name (meta (var +)))</code></p>
<p>However, when I change to this, </p>
<p><code>((comp :name meta var) +)</code></p>
<p><code>CompilerException</cod... | <p><code>var</code> is one of Clojure's <a href="http://clojure.org/reference/special_forms" rel="nofollow">special forms</a>. Special forms define a way in which its subexpressions are treated; they may define special syntax and evaluation rules for those subexpressions. Special forms (and <code>var</code> operator in... |
How can I get a renderer in a-frame <p>I try to use three.js library in a-frame.<br>
For example, </p>
<pre><code>var helper = new THREE.MMDHelper(renderer);
</code></pre>
<p>I don't know how to get a renderer in a-frame.</p>
<p>a-scene has a renderer property.<br>
=> <a href="https://aframe.io/docs/0.3.0/core/sc... | <p>You'll need to wait for the scene to initialize before a renderer is available:</p>
<pre><code> sceneEl.addEventListener('render-target-loaded', function () {
// sceneEl.renderer is now set.
});
</code></pre>
|
How to get all existing tags outside the loop in Wordpress <p>Here is my situation.</p>
<p>In my home page, I want to have the list of all existing tags and use them as filter for an isotope grid containing posts.</p>
<p>So for each post I already check the associated tags and output them as class name on the post gr... | <p>This is an example:</p>
<pre><code>$tags = get_tags();
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
$html .= "{$tag->name}</a>";
}
... |
SQL Server - sum a column using group by <p>I have columns in the below format
<a href="http://i.stack.imgur.com/zHEYL.png" rel="nofollow"><img src="http://i.stack.imgur.com/zHEYL.png" alt="enter image description here"></a></p>
<p>and I am looking for an output by adding the last column based on the first column
<a h... | <p>used Over(Partition by.....)
in the following way and it worked</p>
<p>,Sum(NewBill) OVER (PARTITION BY wouid) AS Newfield</p>
<p>Thanks for all your support guys.</p>
|
SOLR is not searching across all SHARDS <p>I have created one node(shrd1) in solr and created one core inside that and run the below command</p>
<blockquote>
<p>..solr-5.1.0\bin>solr.cmd -s solr/shrds/shrd1 -p 8886 -f</p>
</blockquote>
<p>and import data which is having id and name as field and query the same and i... | <p>Try this</p>
<pre><code>http://localhost:8887/solr/souro_core2/select?q=name:souro&indent=true&shards=shard1,shard2
</code></pre>
<p>That should work
If you have collection with name souro_core2 which has two shard. </p>
|
Receiving download popup when trying to access any PHP files using MAMP <p>I am trying to add an existing wordpress project to my local machine for testing. I am using MAMP on a Mac El Capitan environment. I am able to start MAMP and see two green lights for Apache server and MySql server, I am able to restore the da... | <p>Seems PHP is not installed, or Apache is not configured to use it on PHP files.</p>
<p>Try this first, create an .htaccess file with the following text and put it in your htdocs folder.</p>
<pre><code> AddType application/x-httpd-php5 .php
</code></pre>
<p>If that doesn't work, I suggest downloading and re-instal... |
React - pre-populate form <p>I need to prepopulate a form so that users can edit a blog they have previously created. I'm looking for the best-practices way of doing this in React. I am currently passing the value to a component through props, and then setting a state property to equal a props property, but I have rea... | <p>If publication is maintained in the parent, then there is no need to maintain state, unless there are other reasons: validations for one.</p>
<p>The input could be an uncontrolled component. The onBlur of the input can be used to update the parent.</p>
<pre><code><input
onBlur={e => this.props.onTitleChan... |
Union a List of Flume Receivers in Spark Streaming <p>In order to increase parallelism as recommended in the Spark Streaming Programming guide I'm setting up multiple receivers and trying to union a list of them. This code works as expected:</p>
<pre><code> private JavaDStream<SparkFlumeEvent> getEventsWorkin... | <p>Can you please try out the below code, It would solve your problem:</p>
<pre><code>private JavaDStream<SparkFlumeEvent> getEventsNotWorking(JavaStreamingContext jssc, List<String> hosts, List<String> ports) {
List<JavaDStream<SparkFlumeEvent>> receivers = new ArrayList<JavaDStr... |
Initial state Redux store - invalid prop <p>After arguing a lot with my coworkers about the initial state value for async data fetched via the API, we decided that it would be more clear to have initial values set as empty array / empty object instead of null.</p>
<p>But when I implemented it today I realized that an ... | <p>if anything is required in your app state, you should make it part of the initial state, starting always with an empty object will make you add defensive code all over your components (you'd be making every component handle undefined properties, when that's not a useful state to support).</p>
<p>to make it simpler,... |
In PHP, Is it possible to extract a twitter status from a string that has surrounding BBCode? <p>I basicly have the following string</p>
<pre><code>$string = 'Blah blah blah [url]https://twitter.com/NBCBlacklist/status/776165827104026624[/url] blah blah';
</code></pre>
<p>Im trying to do a preg_replace on this $strin... | <p>To get rid of the url tags you can use something like this </p>
<p>Find: </p>
<p><code>'/\[url\](https?:\/\/twitter\.com\/(?:\#!\/)?\w+\/status(?:es)?\/(?:\d+))\[\/url\]/'</code></p>
<p>Replace: <code>'TWITTER Link $1'</code> </p>
<hr>
<p>If the tags might not exist, you'd use a branch reset. This </p>
<p... |
How to save camera images in sqlite database using content providers? <p>I am making an example inventory app, one string and two integer values are being stored in the database using content provider and then being populated on a listview and through itâs <code>setOnItemClickListener()</code> on listâs detail view... | <pre><code> protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
mPhoto = (Bitmap) data.getExtras().get("data");
mPhotoImage.setImageBitmap(mPhoto);
ByteArrayOutputStream bytes = n... |
Sublime tab size only working for some files <p>Im using Sublime Text 3 for a javascript app. When I tab, I want it converted to 4 sapces. So I have set:</p>
<pre><code>"tab_size": 4,
"translate_tabs_to_spaces": true,
</code></pre>
<p>This works fine. But weirdly, on some files (that also have .js extension like the... | <p>All settings in Sublime Text follow an <a href="http://docs.sublimetext.info/en/latest/extensibility/packages.html#merging-and-order-of-precedence" rel="nofollow">Order of Precedence</a>. Here's an hypothetical example for JavaScript (in ascending order):</p>
<ul>
<li>Packages/Default/Preferences.sublime-settings</... |
Python: Get Gmail server with smtplib never ends <p>I simply tried:</p>
<pre><code>>>> import smtplib
>>> server = smtplib.SMTP('smtp.gmail.com:587')
</code></pre>
<p>in my Python interpreter but the second statement never ends.</p>
<p>Can someone help? </p>
| <p>You might find that you need a login and password as a prerequisite to a successful login-in.<br>
Try something like this:</p>
<pre><code>import smtplib
ServerConnect = False
try:
smtp_server = smtplib.SMTP('smtp.gmail.com','587')
smtp_server.login('your_login', 'password')
ServerConnect = True
except S... |
Access value from XAML and code behind file <p>I'm trying to access a value, which should be shared between the XAML and the code behind file. Therefore I thought I could use <a href="https://developer.xamarin.com/guides/xamarin-forms/xaml/xaml-basics/xaml_markup_extensions/#The_xStatic_Markup_Extension" rel="nofollow"... | <p>The Width property is expecting one object of type <code>GridLength</code> while your are assigning a <code>double</code> value.</p>
<p>Try this in your DetailPage.xaml.cs:</p>
<pre><code>public static readonly GridLength Width = new GridLength(40, GridUnitType.Pixel);
</code></pre>
<p>And test your app again.
Yo... |
Verilog behavioral code getting simulated properly but not working as expected on FPGA <p>`timescale 1ns / 1ps</p>
<pre><code>module StateMachine(
input [1:0] OP,
input [1:0] RESULT_COM,
input clk,
input rst,
output reg [1:0] CONTROL_AS=0,
output reg RESET_C,
output reg CONTROL_C,
output reg [... | <pre><code>always @ (n_state)
begin
p_state_copy = p_state;
end
</code></pre>
<p>This logic can't be synthesized. There's no practical way for an FPGA to latch a value (like <code>p_state_copy</code>) on the change of a logic signal (like <code>n_state</code>).</p>
<p>Generally speaking, <code>always</code> ... |
how can I seperate method in MainActivity to other class , and call <p>I call a method like this.</p>
<p><code>finishedFlag = new HttpUtil().execute(url, userid, workflag).get();</code></p>
<p>and I want to seperate this method to another class.
(ex, create a class : <code>httpUtil</code>.)</p>
<p>how can I call, a... | <p>Hey you should create class which extends async adapter to deal with background operations (you did it) and create interface callback to get your data in activity/fragment.</p>
<p>This is AsyncTask class:</p>
<pre><code>public class HttpUtilClass extends AsyncTask<String, Void, Boolean> {
TestListener test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.