input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Spotify docker-maven-plugin unauthorized: authentication required public repo <p>I am having trouble pushing my docker image to the hub using the following command:</p>
<pre><code>mvn clean package docker:build -DpushImage
</code></pre>
<p>Each time I get the following response:</p>
<pre><code>[WARNING] Failed to pu... | <p>Did you correctly configure the authentication settings? </p>
<p>User and password can be set in <strong>settings.xml</strong>:</p>
<pre><code><servers>
<server>
<id>docker-hub</id>
<username>jdruwe</username>
<password>secret-password</password>
&l... |
Which Eyeshot entity is more efficient? <p>I am using the WPF Control Eyeshot (<a href="http://www.devdept.com/" rel="nofollow">http://www.devdept.com/</a>) to build an application where I handle multiple 3D entities, but <strong>I do not perform boolean operations between them</strong>. </p>
<p>Eyeshot offers me the ... | <p>Mesh, definitely. Possibly with <code>Mesh.LightWeight = true</code>. This is the most cheap 3D object representation inside Eyeshot. It relies only on <code>Mesh.Vertices</code> and <code>Mesh.Triangles</code> arrays.</p>
|
C++ 'Word Jumble' <p>I have a small problem. I have attempted to make the game 'Word Jumble' with a scoring system. But sometimes, when the computer guesses a word, then it'll say: The word is: <em>blank here</em>. There should be a jumbled word there. When I try any word, it just subtracts 1.#INF points.</p>
<p>Code:... | <p>In the line:</p>
<pre><code>int num = rand() % size + 1;
</code></pre>
<p>You are saying to select a random number between 0 and 9 then add 1. </p>
<p>If the random number is 9 the + 1 will make it 10. This means that you are trying to access a value in the array <code>Words</code> and <code>Hints</code> at index... |
Creating and printing linked list from user input C++ <pre><code>#include <iostream>
using namespace std;
int main()
{
struct node
{
int data;
node * next;
};
node * head;
node * n;
node * temp;
node * q;
int number;
cout << "Enter numbers";
cin &g... | <p>Who sets the last node's next to NULL?</p>
<p>At n = new node; n->next is not NULL but undefined, in Debug versions usually it is 0xcccccccc or something similar value to make it visible that it is not initialized. If you try to dereference it, you will get an access violation.</p>
|
Changing colors of a group of shapes without selecting (fill & text) <p>With regard to the following code:</p>
<pre><code>Sub Macro1 ()
With ActiveSheet.Shapes.Range(Array("MyShapeGroup"))
.Fill.ForeColor.RGB = cPurp ''cPurp is global constant
.TextFrame.Characters.Font.ColorIndex = 2
End With
End Su... | <p>Try using the <code>TextFrame2.TextRange</code> property instead:</p>
<pre><code>Option Explicit
Sub test()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes.Range(Array("MyShapeGroup"))
shp.Fill.ForeColor.RGB = RGB(255, 255, 0)
shp.TextFrame2.TextRange.Font.Fill.ForeColor.RGB... |
Is there a way to send (python) code to a server to compile and run but display the results on the computer that sent them? <p>I just bought a server and was wondering if there was a way to run the code remotely but store/display the results locally. For example, I write some code to display a graph, the positions on t... | <p>This is a complete "<a href="http://therussiansusedapencil.com/post/175863624/the-pencil" rel="nofollow">The Russians used a pencil</a>" solution, but have you considered running a VNC server on the machine that is doing the computations? </p>
<p>You could install a VNC client onto your tablet/phone/PC and view it ... |
Inspect shows record but still get undefined method <p>I'm creating a report screen, and doing my relationship lookups for the associated data. For some reason I keep getting errors when trying to get an attribute of the relationship, yet .inspect shows the information plain as day.</p>
<pre><code>orders_detail.produ... | <p>As per discussion in comments to question, having that each of below works as expected:</p>
<pre><code>Flavor.first.flavor_id
Flavor.first.attributes
</code></pre>
<p>means, that attributes reading is not broken. The only reason is that as per error: you are referencing bad/invalid/inexistent object <code>flavor</... |
Java EE read resources from dispatched html <p>I'm building a servlet that uses a RequestDispatcher to load a html page for the log in.</p>
<p>The html is in /WEB-INF/templates/main.html</p>
<p>I'm trying to load an image for that html file which is on /WEB-INF/resources/image.jpg</p>
<p>I've tried with <code><im... | <p>You can't do this.</p>
<p>The problem is that the image is being loaded by the browser, not the application. And nothing outside the internals of the application can access anything in the <code>WEB-INF</code> directory.</p>
<p>So, you simply need to move the image someplace else.</p>
|
Is there a way to revert or undo replica set configuration <p>I have two standalone nodes, which have mongodb running on them. Both of them have a replica set configuration rs0 and start with <i>rs.initiate()</i>. But in some scenarios, I want them to run as individual nodes, but in some cases, I want one to become pri... | <p>you can simply prepare a new config document and reconfigure the replication.</p>
<p>rs.reconfig(new_config_file)</p>
|
SSRS - How to hide parent report's header in a subreport? <p>I've to create a report that must be printed along with an existing report. Since the dataset is largely the same, I've created this new report as a sub-report to the existing report, and have added a before page break. So now both the existing report and (ne... | <p>I guees SSRS doesn't allow to do exactly what your want, but if your subreport is on the last page, you can set PrintOnLastPage = False for report header, then it will not be printed, although I'm not sure how it will look if subreport generates many pages, I afraid that only the last of subreport's pages will be wi... |
Smart pointers and cache/memory locality <p>I am trying to understand smart pointers in context of locality. I have looked at several questions here on S/O regarding having a <code>std::vector</code> of <code>MyObject</code>s and a <code>std::vector</code> of smart pointers (<code>shared_ptr</code>/<code>unique_ptr</co... | <p>At least the elements in a vector are guaranteed to be stored contiguously. This is per the recent C++ standards.</p>
<p>The objects pointed to by the smart pointer are stored somewhere else. It will depend on the memory manager where your object will end up.</p>
<p>If you have a choice, it might be better (and fa... |
How to 'Post Follow' request in AJAX <p>I try to implement Slimpay payment solution API. But I have a problem during the process.</p>
<p>From this ressource (I got from a previous request) : </p>
<pre><code>{
"_links" : {
"self" : {
"href" : "https://api-sandbox.slimpay.net/"
},
"profile" :... | <p>"Follow(namespace#relation)" means look for the <code>namespace#relation</code> key in the <strong>_links</strong> attribute of the last response you got from the server.</p>
<p>In your case, the last request you sent is: <code>GET https://api-sandbox.slimpay.net/</code> and you already quoted the response from ... |
eregi or preg from txt file in php <p>I have website selling charge cards, I use this code for selling to customers they verify the mobile number, manually (add a line every time) recently I use SMS service and numbers stored in text file in the site, how can remove these lines, and I get the numbers from the .txt file... | <p>You can use <code>file</code> to read the contents of your text file into an array, and then <code>in_array</code> to see if the number is there.</p>
<pre><code>if (in_array($_data['mobile'], file('your_text_file.txt', FILE_IGNORE_NEW_LINES))) {
$error .= "Mobile number not valid, please verify your number<b... |
Concatenate unsigned char[] value and convert to char * <p>I'm using Java NDK in order to extract some info from a "bin" file using a C struct. I have to extract info about a gateway, in for loop. I'm able to extract info, but I need to concatenate the results and add dot <code>.</code> in order to print the final IP a... | <p>I made a mistake. It works!</p>
<pre><code>#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
string Result;
ostringstream convert;
//Gateway.info[4] is unsigned char type
int config_len = sizeof(ptr->Gateway.info);
for (int i = 0; i < config_len; i++) {
int number = ptr-... |
Rounding up and down a number C++ <p>I'm trying to allow my program to round a number up and down respectively. </p>
<p>For example, if the number is <code>3.6</code>, my program is suppose to round up the nearest number which is 4 and if the number is <code>3.4</code>, it will be rounded down to 3.</p>
<p>I tried us... | <pre><code>std::ceil
</code></pre>
<p>rounds up to the nearest integer</p>
<pre><code>std::floor
</code></pre>
<p>rounds down to the nearest integer</p>
<pre><code>std::round
</code></pre>
<p>performs the behavior you expect</p>
<p>please give a use case with numbers if this does not provide you with what you ... |
C# Razor model and passing <p>How can I transfer data/model between partial/views/controllers in C# MVC?</p>
<p>I'm trying to duplicate <a href="http://www.tutorialsteacher.com/mvc/mvc-view" rel="nofollow">this</a> example, but the <code>@model IEnumerable<MVC_BasicTutorials.Models.Student></code> is given me an... | <p>Your <code>Student</code> class is defined as a sub class of <code>StudentController</code>. So you need to use the proper namespace / fully qualified class name when using this class as the model type.</p>
<p>Change the first line to </p>
<pre><code>@model IEnumerable<PutYourNameSpaceHere.StudentController.Stu... |
How to find number of Reference Planes passing through a selected wall. <p>I need to find out the number of Reference planes and their names which are passing through a selected wall. I can get all the reference planes for a particular document but how shall I do this for a particular wall.</p>
<p>You help would be ap... | <p>I would start by trying the built-in <code>ElementIntersectFilter</code>. The documentation has a nice example, replace "<code>FamilyInstance</code>" with "<code>referencePlane</code>" and that may do it.</p>
<p><a href="http://www.revitapidocs.com/2017/19276b94-fa39-64bb-bfb8-c16967c83485.htm" rel="nofollow">http... |
Using If Statement With Formulas JAVA <p>I'm working on a workshop for my JAVA. There's one part I'm having difficulty understanding: <em>Apply the following formulas based on gender (must use an if statement(s)):</em>
<strong>Hmale_child = ((Hmother * 13/12) + Hfather)/2</strong> OR
<strong>Hfemale_child = ((Hfather ... | <p>You can use the <code>equals</code> or <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#equalsIgnoreCase-java.lang.String-" rel="nofollow"><code>equalsIgnoreCase</code></a> methods to check your string inputs:</p>
<pre><code>if (gender.equalsIgnoreCase("m")) {
child = ((Hmother * 13.0/12)... |
Replace variables extracted from database with theirs values <p>I'd like to translate a perl web site in several languages. I search for and tried many ideas, but I think the best one is to save all translations inside the mySQL database. But I get a problem...</p>
<p>When a sentence extracted from the database contai... | <p>You can use <code>printf</code> format strings in your database and pass in values to that.
<code>printf</code> allows you to specify the position of the argument so only have know what position with the list of parameters "$number" is.</p>
<p>For example</p>
<pre><code>#!/usr/bin/perl
use strict;
my $Details = ... |
Force wrapping an inline-block with CSS, after 'n' elements? <p>I am trying to display a list of divs as a grid, using purely CSS, but I can't get it to behave properly. I had looked at <code>white-space: wrap</code>, but that is meant to be applied to the parent element, so that isn't useable. I also tried <code>clear... | <p>Instead of inline block use <em>float</em>s:</p>
<pre><code>#results.grid .entry {
float: left;
}
#results.grid .entry:nth-child(3n+1){
background-color: yellow;
clear: left;
}
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
<div class="snipp... |
Next/previous buttons to add in a modal <p>Totally new in this world, but i just love it, and i want to get the best out of it.
I am making my own photosite and i am stuck here with the next/previous button in modal. What to do?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babe... | <p>Instead of re-doing something like this, why not try something that works? In doing something very similar to what you want to do, I used the <a href="https://blueimp.github.io/Gallery/" rel="nofollow">Blueimp gallery</a>. It was simple to set up, and the previous / next buttons work, including using the arrow key... |
Why php variables are not getting echoed on my webserver <p>I have wasted several hours just to make a textbook example of defining the php variables and trying to echo the values using my both XAMPP Sever and the actual hosting company. My goal is to display the results of a sql query into a html table. Unfortunately,... | <p>just use below code, there are multiple typos in your code:</p>
<p>php:</p>
<pre><code><?php
$email1 = "av104";
$email2 = "av1040";
$address1 = "Thousand Oaks";
$address2 = "Los Angeles";
echo $email1."<br/>";
echo $email2."<br/>";
echo $address1."<br/>";
echo $address2."... |
Bizzare matplotlib behaviour in displaying images cast as floats <p>When a regular RGB image in range (0,255) is cast as float, then displayed by matplotlib, the image is displayed as negative. If it is cast as uint8, it displays correctly (of course). It caused me some trouble to figure out what was going on, because ... | <p>I think you are on a wrong path here as you are claiming, that <code>np.random.randint()</code> should return an float-based array. <strong>It does not!</strong> (<a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.randint.html" rel="nofollow">docs</a>)</p>
<p><strong>This means</strong>:</p>
... |
Simulate an AR(1) process with uniform innovations <p>I need to plot an <code>AR(1)</code> graph for the process</p>
<pre><code>y[k] = 0.75 * y[k-1] + e[k] for y0 = 1.
</code></pre>
<p>Assume that <code>e[k]</code> is uniformly distributed on the interval <code>[-0.5, 0.5]</code>.</p>
<p>I am trying to use <code>ar... | <p>We want to use R base function <code>arima.sim</code> for this task, and no extra libraries are required.</p>
<p>By default, <code>arima.sim</code> generates ARIMA with innovations ~ <code>N(0,1)</code>. If we want to change this, we need to control the <code>rand.gen</code> or <code>innov</code> argument. For exam... |
Use a value on a cell as a Sheet name to work with a formula <p>I have 2 excel files , on one im using a vlookup to extract data from the other file but my issue is the following:</p>
<p>File 1 : this one has 12 sheets with names like January, February , Marc , etc.
.
File 2 : On this one I have the vlookup that makes... | <p>Yes, this is what formula <code>=INDIRECT()</code> is for:</p>
<pre><code> =IFERROR(VLOOKUP(A2,Indirect("'[Weekly Team Report- Salvador.xlsx]" & A1 & "'!$A$1:$B$3"),2,FALSE),"")
</code></pre>
<p>Notice that the entire range being referenced is stuck inside of the <code>indirect()</code> formula as a string... |
OneLogin .NET SAML CheckSignature Error <p>I've download <a href="https://github.com/onelogin/dotnet-saml" rel="nofollow">https://github.com/onelogin/dotnet-saml</a> and am testing against an internal IdP. Initially I thought the error was because of the certificate being SHA256 (since the one referenced in their code... | <p>The toolkit uses the System.Security.Cryptography.Xml library that includes the signedXml class.</p>
<p>That class has the <a href="https://msdn.microsoft.com/en-us//library/ms148731(v=vs.110).aspx" rel="nofollow">CheckSignature</a> method, that expects as parameter the X509Certificate2 object to use to verify the ... |
C++ - Weird function return value <p>I was making a simple min() function when I suddenly asked myself a question which got a bit more complex than I though</p>
<p>I created a valid function, and got the idea to omit a condition between the two numbers. Here is my function:</p>
<pre><code>int min(int x, int y) {
... | <p>Flowing off the end of a function results in undefined behavior in a value-returning function. The behavior of your program is undefined.</p>
<p>In practice this means the caller is going to try to read the returned <code>int</code> according to whatever calling convention is being used, and fail to do so.</p>
|
How can I wrap a paragraph on a Cucumber report? <p>How can I wrap a paragraph on a Cucumber report ?</p>
<p>I have a Cucumber report and I am printing text on the report using:</p>
<pre><code>puts "whatever i want to say"
</code></pre>
<p>In cases when that string is very long, the paragraph doesn't wrap on the HTM... | <pre><code>puts <any_long_value>.to_s.scan(/.{1,256}/).join("\n")
</code></pre>
<p>where 1,256 defines the number (256) of characters you want before wrapping.</p>
|
90-ball bingo - shortest path to winner-ticket <p>For a 90-ball bingo game engine in which I know how all the tickets look, I need to calculate the shortest path to a winner-ticket, based on the numbers that have been called for the given game. </p>
<p>For each game we expect to generate around 1000 tickets, and each ... | <p>The folllowing seems to be the way to go:
First we create a couple of views so to make the actual select query easier to comprehend</p>
<p>This first view represents rows that are already completely filled - meaning that all 5 numbers have also been called.</p>
<pre><code>create or replace view filled as
select
... |
Move a SKNode around a circle <p>i am moving my sknode around a circle created with this code:</p>
<pre><code> circleDiameter = 300;
pathCenterPoint = CGPointMake(self.position.x - circleDiameter/2, self.position.y - circleDiameter/2);
UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRe... | <p>A <code>UIBezierPath</code> is composed by path <code>Elements</code> where the first is <code>moveToPoint</code> that , as explained in the <a href="https://developer.apple.com/reference/uikit/uibezierpath" rel="nofollow">official document</a>, <strong><em>starts a new subpath at a specified location in a mutable g... |
What does the "AS DBO" part of a GRANT do? <p>Given...</p>
<pre><code>GRANT EXECUTE ON [dbo].[SomeSproc] TO [Some_User] AS [dbo]
</code></pre>
<p>What EXACTLY does the "AS DBO" part do?</p>
| <p>This just controls who (dbo) is recorded as having issued the GRANT. See here <a href="https://msdn.microsoft.com/en-us/library/ms187965.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms187965.aspx</a>.</p>
|
Spaces in string vs. Escape sequences <p>In Ruby (testing in the Interactive Ruby Shell), you can either use spaces in strings or use escape sequences. Is there a best practice in determining which to use, or does it never matter?</p>
<p>For example:</p>
<pre><code>"Hello World"
--> "Hello World"
vs.
"Hello\sWo... | <p>Use spaces. Makes it much more easier to read</p>
<p>If you cant, then use the escape sequences.</p>
<p>Also note that escape only works in double quotes </p>
<pre><code> 'Hello\sWolrd'
--> 'Hello\\sWorld'
</code></pre>
|
Import data into R from access <p>I'm attempting to pull data into R from access which, I've successfully done. </p>
<p>Now what I'm looking to do is pull in all the needed tables with one line of code opposed to one at a time. </p>
<p>Example: </p>
<p>I have 5 tables:
3/15 Policy Details
6/15 Policy Details
9/15... | <p>Consider using <code>grep()</code> on returned list of table names. Then bind table fetches into a list with <code>lapply()</code> and then out to separate dataframe objects with <code>list2env</code>:</p>
<pre><code>library(RODBC)
db <- file.path("C:\\Path\\To\\Database.accdb")
channel<-odbcConnectAccess20... |
Undertow Websocket Bean Injection CDI Issue <p>I don't understand why CDI use of injection doesn't work with websockets, using undertow. </p>
<p>Below is the code I have for a simple websocket endpoint. </p>
<pre><code>@ServerEndpoint("/")
public class TestWebSocketEndpoint {
@Inject
private RetrieveAccessor... | <p>Undertow is only a servlet container. Weld (or OWB) provide CDI support. I'm not sure how you're instantiating Undertow, but you need to leverage Weld (or some other CDI implementation).</p>
<p>Here's one example how to do it. Leverage a <a href="https://github.com/hammock-project/hammock/blob/master/web-underto... |
JavaScript: Catch users who did screen <p>I need catch users who make screen on my web page. I can do it easy, if they use key "PrntScr", but what should i do if they make screen on Mac, Android or iPad? And can i catch users who make screen with other software?</p>
<p>p.s. sorry for my bad english</p>
| <p>It would be next to impossible for you to detect such behavior. If your website was only available in the form of mobile apps you could detect when people take screenshots (as in the case of Snapchat), but it would be very easy for someone to bypass this on PCs.</p>
<p>In Linux, someone could use a tool such as <c... |
How can I add a row within each step of a PHP prepared statement? <p>I have a prepared statement that produces a list of prices. The prices are determined by the value of the item multiplied by the quantity. </p>
<pre><code>if ($select = $db -> prepare("SELECT value, quantity FROM items"))
{
$select -> execu... | <p>Declare a variable <code>$total = 0</code> outside of the prepared statement and use it in the <code>while()</code> loop to calculate total price value, like this:</p>
<pre><code>$total = 0;
if ($select = $db -> prepare("SELECT value, quantity FROM items")){
$select->execute();
$select->bind_result... |
Query for Mongoexport <p>I want to export a collection projection according to a query, the syntax I am using to execute mongoexport is:</p>
<pre><code>./mongoexport -d myDB -c myCollection -q "myQuery" -o output.json
</code></pre>
<p>I have tried to use this filter in mongo shell, but I can't format it correctly, so... | <p>It seems you are missing a <code>:</code> after the <code>$in</code> operator. Try to use:</p>
<pre><code>'run.session.device._id':{$in:['value1','value2']}
</code></pre>
|
JavaFX UI elements not showing up in Stage <p>I am making a basic JavaFx program. The program displays text and a button in the first scene and when clicking the button the program navigates to another scene. The code runs fine but there is no button or text showing up in the window. Can anyone suggest why this is happ... | <p>Here :</p>
<pre><code> StackPane layout2 = new StackPane();
layout1.getChildren().addAll(no2button, label2);
scene1 = new Scene(layout2, 400, 400);
</code></pre>
<p>You aren't actually adding anything to layout2, but right below this you are setting layout 2 as the scene</p>
<pre><code>scene1 = ... |
Login system with infinite loop error <p>I'm coding myself a "simple" login system everything works ok up until the <code>LOGIN</code> part.</p>
<p>The <code>while</code> loop at the end only happens once even though I put another user rather than what I created when I ran the program. I got it to work at some point, ... | <p>Try this:</p>
<pre><code>def login():
username = input("Username: ")
if username not in users:
print("User unregistered! Please register!")
register()
return
password = input("Password: ")
if users[username] != password
print("Password invalid")
</code></pre>
<p>I... |
Find nearest next even 100 <p>In javascript what's the simplest way to find the next even 100 ("even 100" = 200, 400, etc.) that's closest to the given number. For ex: 1723 should return 1800, 1402 should return 1600, 21 should return 200, 17659 should return 17800 etc. I have the following that finds the nearest 100 n... | <p>Based on <a href="http://stackoverflow.com/questions/39925970/find-nearest-next-even-100#comment67135733_39925970">bmb's comment</a>, it sounds like you want granularity of 200, not 100. If so:</p>
<p>Divide by 200, round up, multiply by 200:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-consol... |
Bootsrap v4-alpha not working Collapse <p>I'm using bootstrap with ASP.NET MVC. Here my accordion not start to collapse. </p>
<p>I've tried to add this javascript code:</p>
<pre><code> <script>
$(function () {
$('#accordion').collapse({
toggle: false
})
});
</script&g... | <p>Your code works for me.</p>
<p>I think you are not including jquery before including bootstrap. Reference this before bootstraps js file:</p>
<pre><code><script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
</code></pre>
<p>This is my codepen with your code working:</p>
<p><a href="http... |
Unit tests for connectException and IOException <p>I have unit test that tests to see if a method is throwing an error or not.</p>
<pre><code>@Test
public void getStockPriceWithNetworkErrorThrowsException()
{
StockPriceFetcher stockPriceFetcherWithNetworkError = Mockito.mock(StockPriceFetcher.class);
when(stoc... | <p>The easiest way to solve that is replacing the following line:</p>
<blockquote>
<p>when(stockPriceFetcherWithNetworkError.<strong>getPrice</strong>("YHOO"))</p>
</blockquote>
<p>with the line:</p>
<blockquote>
<p>when(stockPriceFetcherWithNetworkError.<strong>getStockPrice</strong>("YHOO"))</p>
</blockquote>
... |
fix width of one column in a row in Semantic ui <p>How can I have two column in a row in Semantic UI that one of column have a fix width and doesn't change with resizing of browser?</p>
<p>I tried this, but something went wrong:</p>
<pre><code><div class="ui grid container">
<div class="ui two column div... | <p>There is no SUI specific way (yet), so you'll have to write custom CSS</p>
<p>You are using too many SUI classes in your code.</p>
<p>This is not required: <code><div class="ui grid container"></code> when you are defining another grid inside it.</p>
<p>The <code>two column</code> class in <code><div cla... |
Google Chrome Extension Popup not loading when using jquery <p><strong>Problem:</strong>
I'm trying to use jquery in my Google Chrome extension. It doesn't seem to be working. I've tried adding it to my manifest referencing local copies of the jquery file and I've also tried adding different directives to allow remote ... | <p>As Granga pointed out above, this issue was caused by a version compatibility issue. So far, it seems the latest version of jQuery with the latest version of Google Chrome works fine. If anyone experiences an issue like this in the future try upgrading jQuery and/or Chrome. </p>
|
'operator =' is ambiguous for std::string <p>I am trying to write a class with my own cast operators but I am having issues with multiple <code>operator=</code>s</p>
<p>I managed to reproduce the issue with the small code below</p>
<pre><code>#include <string>
class X
{
public:
operator const char*() const {... | <p>As KerrekSB <a href="http://stackoverflow.com/questions/39926180/operator-is-ambiguous-for-stdstring/39926203#comment67135954_39926180">suggested</a>, you can use</p>
<pre><code>s = std::string(x);
</code></pre>
<p>Alternatively, you can perform a cast:</p>
<pre><code>s = (std::string) x;
// or
s = static_cast<... |
Python 3: Getting two user inputs from a single line in a text file <p>I am working on a program that asks the user to enter a username and password and the program checks if the username and password is in the text file. If the username and password is not in the text file, it asks if the user wants to create a new us... | <p>You may know the <code>open()</code> function. With this function you can open a file like this: </p>
<pre><code>open('text.txt', 'a')
</code></pre>
<p>Parameter 1 is the file and parameter 2 is the mode (r for read only, w for write only and a for both and appending)</p>
<p>So to read the open file line by line ... |
Combine multiple RDDs into one by column through key <p>Got an RDD problem.
Say, I have three RDD, they are <code>RDD[AttribClass1]</code>, <code>RDD[AttribClass2]</code>, <code>RDD[AttriClass3]</code>, and each <code>AttribClass</code> has one field name as id, what I want to do is to combine all the attributes into ... | <p>Never mind, I think the best way to know how to do this is to look through the RDD API. This can be done through groupByKey method, and then coGroup. </p>
|
Using awk and grep to add up <p>If I had a file that looks like this:</p>
<pre><code>23.00 33.44 abcd 44.44 abcd12345abcd
33.00 22.22 qt 44.00 zlkm12345ksda
</code></pre>
<p>...and I wanted to add up the first column whenever I encounter 12345 in the middle of the pattern in the fifth column, how would I go a... | <p>Something like this?</p>
<pre><code>awk '$5 ~ /12345/ { TOT = TOT + $1 } END { print TOT + 0 }' yourFile.txt
</code></pre>
<p>(Not at a computer, so my syntax might be a bit off.)</p>
<p>The first bit selects the lines you want and updates the total while the END bit just prints what's accumulated.</p>
<p>No gre... |
Multi Level Pretty URL for E-Commerce Products In htaccess <p><strong>Updated Version</strong>
I am developing an E-commerce portal where the products need to be shown with a pretty url and also under categories.</p>
<p><strong>My Current Link:</strong> <a href="http://abcd.xyz/products.php?pro_tag=1221212112" rel="no... | <p>Try with:</p>
<pre><code>RewriteEngine On
RewriteBase /
RewriteRule ^products/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$1 [QSA,NC,L]
RewriteRule ^products/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ products.php?pro_tag=$2&ctg=$1 [QSA,NC,L]
</code></pre>
<p>I add a <code>ctg</code> variable...</p>
|
Android Search option is not working? <p>android Search function in Custom list view is not working.
RestListModel is my model name.</p>
<ol>
<li>this is my code on ManActivity:</li>
</ol>
<pre class="lang-java prettyprint-override"><code>import android.support.v7.widget.SearchView;
private List<RestListM... | <p>You are only comparing with a array with String. I have need to add a model with three field of Different String.</p>
<pre><code> public CustomListAdapter(Activity activity, List<RestListModel> restItems) {
this.activity = activity;
this.rItems = restItems;
this.arraylist = new Arra... |
NCrunch integration with Typemock failing to run tests <p>I am getting the following exception from NCrunch when tests are being run.</p>
<pre><code>*** Failures ***
Execute
TypeMock.TypeMockException:
*** Typemock Isolator is currently disabled. Enable using the following:
* Within Visual Studio:
- Use Typemo... | <p>Disclaimer, I work in Typemock.</p>
<p>First of all, have you enabled "Integrate with Other Runners" in Typemock VS menu and "Enable Mocking integration" and "Enable Auto Linking" in Typemock->Options->Mocking Integration?</p>
<p>Which version of NCrunch you use?</p>
|
After adding Prism.unity 6.2.0 to Windows 10 UWP, application throws exception <p>When creating a Universal Windows Application with Prism, I always receive an error upon running the application (or, sometimes, upon exiting the running application). Here are the steps I take to reproduce the problem:</p>
<ul>
<li>Cre... | <p>After playing around for a while, I think I found a solution:</p>
<p>In the NuGet console, I ran "update-package -reinstall", and then rebuilt the solution. I still have a warning in the error window that says "Found conflicts between different versions of the same dependent assembly that could not be resolved. T... |
Grunt postman (newman) task hangs <p>I'm running a grunt task that runs forever, with no output:</p>
<p>My <code>grunt.initConfig</code> includes </p>
<pre><code>newman: {
default_options: {
options: {
iterationCount: 1,
collection: "tests/collection.postman_collect... | <p>Postman collections can be exported as <code>v1</code> and <code>v2</code>, and the Grunt task plugin only works with collections of type <code>v1</code></p>
|
Install pycharm Ubuntu <p>I recently had to wipe my computer and reinstall everything. I remember being able to install pycharm (community edition) with a single <code>sudo apt-get install</code> command and that was all. I can't find it? I am using Ubuntu 16.04 LTS.</p>
| <p>From the following website <a href="http://ubuntuhandbook.org/index.php/2016/07/latest-pycharm-ubuntu-16-04-ppa/" rel="nofollow">here</a> I found these two ways to install pycharm for ubuntu 16.04</p>
<p>You have several options:</p>
<p>First option:</p>
<pre><code>sudo add-apt-repository ppa:mystic-mirage/pychar... |
How to get weeks as an array for past 2 months from current date in javascript? <p>I want to get weeks for past two months in the following format. Is there a way i can achieve this in javascript. Any pointers on how to do this will is much appreciated.</p>
<pre><code>[
{
"week_start": "8/01/2016",
... | <p>You can use <a href="http://momentjs.com/" rel="nofollow">http://momentjs.com/</a> like this:</p>
<pre><code><script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.js"> </script>
<script>
var startDay = moment("2016-07-24"); //Sunday
var res = [];
for (var i = 1; i <... |
HOW TO INVOKE CMD COMMAND IN THE SAME PROCESS FROM JAVA? <p>"i want to know, does anyone know how to invoke cmd commands from java?</p>
<p>i already know about:</p>
<pre><code>java.lang.runtime.getruntime().exec("cmd /k \"command\"");
</code></pre>
<p>but this creates another console and executes command in there. i... | <p>One would control the console direct rather than asking CMD. See this API call. </p>
<blockquote>
<p><code>SetConsoleTextAttribute</code></p>
<p>The SetConsoleTextAttribute function sets the attributes of characters written to the screen buffer by the WriteFile or WriteConsole function, or echoed by the Read... |
UnboundLocalError: local variable 'number1' referenced before assignment <p>I am getting an error in line 2 saying that i have an unboundLocal error. can anyone explain to me how to fix this?</p>
<pre><code> def main():
number1=getNumber1(number1)
number2=getNumber2(number2)
userInt... | <p><code>number1</code> isn't defined until you create it - you can't pass it to another function while defining it. Seems like you need a simpler function that gets the <strong>name</strong> you want to assign to:</p>
<pre><code>def main():
number1 = getNumber('number1')
number2 = getNumber('number2')
def ge... |
Android permission automatically denied on requestPermission from MainActivity <p>In the main activity of an Android application I check for permissions (<code>Manifest.permission.MANAGE_DOCUMENTS</code>), detect I do not have them, and call <code>requestPermisions</code>.
Then in <code>onRequestPermissionResult</code>... | <p>Only <a href="https://developer.android.com/guide/topics/security/permissions.html#permission-groups" rel="nofollow">dangerous permissions</a> can be requested at runtime and <code>MANAGE_DOCUMENTS</code> is not a dangerous permission.</p>
<p>As per the <a href="https://developer.android.com/reference/android/Manif... |
TinyMCE how to dynamically get line breaks in a textarea <p>I need advice on how I can create dynamic line breaks ideally with an <code><li></code> inside TINY. I have tried using an each loop and also a for loop, and the values just do not appear in the text area. BUT, if I just add them to the text area with a ... | <p>If you're only modifying the value of the text area before tinymce is initialized then this might work for you:</p>
<pre><code>$('#wo_materials).val(materials.join('<br/>'));
</code></pre>
|
Python can't find setuptools <p>I got the following ImportError as i tried to setup.py install a package:</p>
<pre><code>Traceback (most recent call last):
File "setup.py", line 4, in <module>
from setuptools import setup, Extension
ImportError: No module named setuptools
</code></pre>
<p>This happens al... | <p>It's possible you have multiple python versions installed on your system. For example if you installed your python from source, and then again with apt-get. Apt-get will install to the default python version. Make sure you are being consistent. </p>
<p>Potentially using pip install setuptools could solve your probl... |
How to use authenticated middleware properly in nodejs <p>I just started working on node using express framework. </p>
<pre><code>app.use('/', auth, users);
</code></pre>
<p>and this is my route file</p>
<pre><code>router.get('/' , function(req, res, next) {
render("dashboard");
});
router.get('/first' , functi... | <p>Yes, it is fine to go with this approach if you don't want to have security issues. You have to check the user for every request, it is very simple someone to check the network tab in the browser debugger, understand what's going on and then start spoofing your requests. You can't sacrifice security for performance ... |
Cannot read property of undefined angular 2 <p>Here is my detail view component</p>
<pre><code>import {Component,Input,Output,EventEmitter,OnInit} from "@angular/core";
import { Router, ActivatedRoute, Params } from '@angular/router';
import {TypeService} from './type.service'
import { PropertyTypes } from './type';... | <p>Have you tried to use: <code>*ngIf="PropType"</code> at the parent of <code>{{(PropType | json).name}}</code>? Because when html render your properties not.</p>
|
When iterating through large set of string set, for loop received signal SIGSEGV, Segmentation fault <p>I have a loop through a very large set of names below got segment fault, where is the issue ?</p>
<pre><code> void test(std::set<std::wstring> *names)
{
std::set<std::wstring>::iterator itr... | <p>No problem with the code you show, as demonstrated by this <a href="http://ideone.com/npwoeh" rel="nofollow">MWE live at Ideone</a>:</p>
<pre><code>#include <iostream>
#include <set>
#include <string>
using namespace std;
void test(std::set<std::wstring> *names) {
std::set<std::wst... |
nodejs readFileSync output is garbage <p>heres my code:</p>
<pre><code>var fs = require('fs');
var corpus = fs.readFileSync('./TXT/tragedies/Macbeth.txt', 'utf8');
console.log(corpus.toString());
</code></pre>
<p>When I run this I get a bunch of nonsense unicode characters:</p>
<pre><code>00\r\u0000\n\u0000<\u00... | <p>Actually, you don't need to transform the output of readFileSync into a string, because it's already one.</p>
<pre><code>var fs = require('fs');
var file = fs.readFileSync("file.txt", "utf8");
console.log(file);
console.log(... |
wpf userControl's child controls' unsubscribe events <p>I am hoping to have a generic (extension) method which takes parent control and traverse through to its all children controls and unsubscribe their events if any. </p>
<p><strong>problem</strong>
i am closely looking at memory consumption when i create some wpf b... | <p>I can't speak to whether or not having many subscribed events negatively affects performance, but I can certainly answer your other two questions:</p>
<ol>
<li><p>You can use the following extension to enumerate all children:</p>
<pre><code>public static IEnumerable<T> GetVisualChildren<T>(this Depende... |
PHP script times, regardless of `set_time_limit(0);` <p>I've got a PHP script using the API of another site and because of the number of requests being extensive, I get a timeout.</p>
<p>My script should take ~2 hours to execute, I have tried to prepend:</p>
<pre><code>set_time_limit(0);
ignore_user_abort(1);
</code>... | <p>I figured a work around on this one. May be a little messy, but it works. </p>
<p>I performed 20 API calls to go under the timeout range. Then I used $_SESSION counting and page refresh to create the number of API calls I required. </p>
<p>This means the page never times out.</p>
|
Issue in updating data into oracle database using JTextfields in java <p>On Update button press, following code snippet needs to be executed:
Note that: t1, t2,. . .,t8 are JTextfields. Also note that CUST_PHONE and ADV receive datatype number, whereas rest all are varchar.<br>
CUST_NAME is the Primary Key assumed;</p>... | <p>Did you display the value of all your variables to make sure they contain data?</p>
<p>Is customer id a String or an Integer?</p>
<p>In any case use a <code>PreparedStatement</code> for the SQL to prevent errors. </p>
<p>A simple example to get your started:</p>
<pre><code>String sql = "UPDATE Page SET Title = ?... |
Need read some data from JSON <p>I need to make a get (id, name, fraction id) for each deputy in this json </p>
<pre><code>{
"id": "75785",
"title": "(за оÑновÑ)",
"asozdUrl": null,
"datetime": "2011-12-21T12:20:26+0400",
"votes": [
{
"deputy": {
"id": "9... | <p>You can access the list containing the deputies with <code>data['votes']</code>. Iterating through the list, you can access the keys you're interested in as you would with dict key lookups. Nested dicts imply you have to walk through the keys starting from the root to your point of interest: </p>
<pre><code>for d i... |
Count iterations in a loop <p>New to programming. How to count and print iterations(attempts) I had on guessing the random number?` Let's say, I guessed the number from 3-rd attempt.</p>
<pre><code>import random
from time import sleep
str = ("Guess the number between 1 to 100")
print(str.center(80))
sleep(2)
number =... | <p>There are two questions being asked. First, how do you count the number of iterations? A simple way to do that is by creating a counter variable that increments (increases by 1) every time the <code>while</code> loop runs. Second, how do you print that number? Python has a number of ways to construct strings. One ea... |
[jQuery]Page is reloading, why? <p>So this is my html code:</p>
<pre><code><form action="" id="set_username">
<td><input id="username" type="text" maxlength="12" /><button>Save</button></td>
</form>
</code></pre>
<p>And this is my jQuery:</p>
<pre><code>$('#set_usernam... | <p>If you want to stop the form to <em>actually</em> submit you can just <code>preventDefault</code>:</p>
<pre><code>$('#set_username').submit(function(e))
{
var username = $('#username').val();
alert(username);
e.preventDefault();
});
</code></pre>
|
Setting up static assets paths, routing endpoints with koa and various middleares <h2><strong>Question:</strong></h2>
<ol>
<li>How can I set up my static files so that both directories are visible to my <code>index.html</code>. </li>
<li>How can I send my <code>index.html</code> when you hit the default route using ko... | <p>Well. it happens that I'm developing a similar kind of app</p>
<p>There's no problem on using koa-static to serve you static content and koa-router for you api endpoint. I never used koa-send directly. but I think you doesn't need too, given your set up</p>
<p>The only thing that matters is the order when attachin... |
Flexbox - Weird img sizing issue <p>Weird issue keeps happening with this. </p>
<p>I want one of my flex items (an image) to be set to certain dimensions (w:300px h:300px).</p>
<p>When I open it to preview in my browser the image appears squashed up in the container as a flex item would normally behave (the text take... | <p>I suggest you to use <code>min-width</code> property. It will help you to avoid the weird img stretching.</p>
<p>JsFiddle: <a href="https://jsfiddle.net/5pbqfyam/" rel="nofollow">https://jsfiddle.net/5pbqfyam/</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
... |
jQuery-Page not loading correctly <p>I recently used accordion jquery to help me expand/collapse content ( like a drop-down menu )..I used this script and placed it in the <code><body></code></p>
<p>Script:</p>
<pre><code>jQuery(document).ready(function($)
{
$("#accordions-727.accordions").a... | <p>This is using jQueryUI accordion implicitly @Stew.</p>
<p>You have a wrong attribute in your accordion setup code, use the <code>animate</code> in place of <code>animated</code>.</p>
<p>Take a look in this API documentation: <a href="http://api.jqueryui.com/accordion" rel="nofollow">http://api.jqueryui.com/accordi... |
How to do iterations to change dummy variable in multiple columns from 1 to 0 in Python and Pandas? <p>I have a dataframe that have over 200 columns of dummy variable:</p>
<pre><code>Row1 Feature1 Feature2 Feature3 Feature4 Feature5
A 0 1 1 1 0
B 0 0 1 1 1... | <p>Here:</p>
<pre><code>df1 = df[df['Feature1'] == 1]
df1.iloc[:, :] = 0
df1.loc[:, 'Feature1'] = 1
df2 = df[df['Feature2'] == 1]
df2.iloc[:, :] = 0
df2.loc[:, 'Feature2'] = 1
df3 = df[df['Feature2'] == 1]
df3.iloc[:, :] = 0
df3.loc[:, 'Feature3'] = 1
</code></pre>
<p>That should be what you are looking for.</p>
|
How to query MySQL ignoring particular characters <p>In a database I have something like this "something (something_else)",
is it possible using a "LIKE" query for you to query and get aforementioned to result when querying the database with "something something_else" (so without the "()" characters).</p>
| <p>You can use replace on the criteria and the field to remove the characters. Something like:</p>
<pre><code>SELECT * FROM table
WHERE REPLACE(REPLACE(field, '(', ''), ')', '')
LIKE REPLACE(REPLACE('something something_else', '(', ''), ')', '')
</code></pre>
|
Getting a difference between time(n+1)-time(n) in a dataframe in r <p>I have a dataframe where the columns represent monthly data and the rows different simulations. the data I am working with accumulates over time so I want to take the difference between the months to get the true value for that month. There are not h... | <p>see <code>?apply</code>. If it's a data frame</p>
<pre><code>apply(df,2,diff)
</code></pre>
<p>should work. Also since a dataframe is a list of vectors <code>sapply(df,diff)</code> should work.</p>
|
PHP user profile page <p>Im trying to make a website with users on it, and I'm trying to create a script so that whenever a new user registers it will automatically create a user folder and profile for them but when I try to register it doesn't create the files,<br> could someone please help me with this, Thanks</p>
<... | <p><strong>To make a directory/file</strong></p>
<pre><code>if (!file_exists("parent_folder/$username")) {
//Create a file with read write execute PERMISSIONS ENABLED
//Please check : your parent folder also must have 0777 permissions to avoid any kind of read write error
mkdir("parent_folder/$username", 077... |
jQuery : How to replace an element with a new and only show the new one? <p>In the following code I am showing order_status in admin panel of opencart when admin edits an order. The order status is showing perfectly fine.</p>
<pre><code> <?php if ($info_data['order_status']) { ?>
<t... | <p>Try this:</p>
<p>from:</p>
<pre><code>$('#order-status').html($('select[name=\'order_status_id\'] option:selected').text());
</code></pre>
<p>to:</p>
<pre><code>$('#order-status').html($('#input-order-status option:selected').text());
</code></pre>
<p>if you want to call your selectbox with name then change it<... |
type java.lang.string cannot be converted to jsonarray <p>I am using volley to connect the php from android, but it's show me error please some help me here a my java & php code .php is connect to database php show -1 'success'=>false result.</p>
<pre><code>public class main extends Activity{
String i = "";
... | <p>According to the "problem" you've described I guess all the syntax errors in your code came from porting the code to here.</p>
<p>It seems that - if I understood you correctly - your only problem is a simple missing <code>'</code> in your sql:</p>
<pre><code> ... |
Jquery Modal on click add class then remove <p>This bit of code is supposed to add a class and then with a delay remove the div entirely. It just jumps to deleting the div. Any ideas why? </p>
<p>The HTML</p>
<pre><code> <!-- modal conent-->
<div class="modal" id="modal">
<div class="modal-con... | <pre><code>$(document).ready( function() {
$( "#close" ).click(function() {
$("#modal").addClass("red");
setTimeout(function() {
$("#modal").remove();
}, 800);
});
</code></pre>
|
Import-DscResource cannot find the package cChoco <p>I am trying to write a DSC script that will be published into Azure Virtual machine. So far I have been able to accomplish basic things like enabling windows features and creating directories. But now I want to install chocolatey on azure virtual machine. So this is ... | <p>You can bundle the module in the DSC package, either manually (by putting it in the a subfolder in the zip file) or by using the Publish-AzureVMDSCConfiguration cmdlets. If the module is installed on the machine where you run the cmdlet, it will look at all the import module statements in your PS1 file and package ... |
Data submission via PHP server-side <p>I am baffled why the form won't send and then be redirected to index.php page. I'm very new to PHP and trying to use the User object. Here's what I have so far. </p>
<pre><code><main>
<header>
<h1>Create New Account</h1>
</he... | <pre><code><?php
# In your CreateAccount.php,
# update your code like this
Class User {
public $first;
public $last;
public $emailaddress;
public $username;
public $password;
public $confirmpwd;
// validation function
function validate() {
if (($this->first != null || $t... |
Using rmarkdown::render to set document header (title, author, date) <p>I am using <code>rmarkdown::render("script.r")</code> to create an HTML version of an R script. The output starts with <strong>script.r</strong> as title, my login as author, and the current <code>date</code> as date. I don't want to give away my l... | <p>The Rmarkdown documentation (see <code>?compile_notebook</code>) describes one way to do this by including a specially formatted comment in your <code>script.R</code> file.</p>
<p>For example, include this comment in your script to set the title, author and date.</p>
<pre><code>#' ---
#' title: "Crop Analysis Q3 2... |
How many bytes are used by variable in hexadecimal? <p>I am currently studying for a test and I came across this question and for some reason I seem to be having a hard time with it and I was hoping I could get some clarification here. </p>
<p>I found an answer on yahoo answers but it came with no explanation and I do... | <p>Each address is a separate byte. Memory is byte-addressable. i.e. <code>0x0040006A</code> is the address of a whole byte.</p>
<p><code>0040006Ah - 00400020h</code> is a difference in address of 0x4A = 74, which means a difference of 74 bytes.</p>
<p>Addresses in asm map 1:1 with <code>char *</code> in C, on norm... |
Counting number of steps till a number gets to 1 <p>The goal of this function is to count the number of steps it takes a number to get to 1 after performing operations. The number you put into the function is divided by 2 if the number is even, and tripled and increased by 1 if the number is odd. These operations are p... | <p>You need to adjust the code to make it return after the <code>while</code> loop. Otherwise, it will return too early if it meet odd number.</p>
<p>Additionally, <code>total += 1</code> is done in both case; you can move it out of <code>if .. elif ..</code> block.</p>
<pre><code>def collatz_counts(n):
total = 0... |
Python3 requests library to submit form that disallows post request <p>I am trying to get the police district from a given location at the <a href="https://www.phillypolice.com/districts/" rel="nofollow">Philly Police webpage</a>. I too many locations to do this by hand, so I am trying to automate the process using Pyt... | <p>The data is retrieved after first querying google maps to the the coordinates where the final request is a get like the following:</p>
<p><a href="http://i.stack.imgur.com/gBwqd.png" rel="nofollow"><img src="http://i.stack.imgur.com/gBwqd.png" alt="enter image description here"></a> </p>
<p>You can setup a free ac... |
Is open() a system call? <p>I am sorry I asked a stupid question because I know open() is a system call for Linux kernel. What I really want to ask is I just had a homework about learning the difference between fopen() and open(). I know fopen() is in the C standard library, so that I definitely can call fopen() functi... | <p>Although the distinction between "system call" and "library function" can be a useful one to keep in mind, there's the issue that you have to be able to call system calls somehow. In general, then, every system call is present in the C library -- as a thin little library function that does nothing but make the tran... |
using sessions to add an edit button for the right user <p>Lets say I have a lot of reviews on a web page. and I have a <code>req.session.shortId = f43f1</code>. I'm new to sessions but I think that each person that goes to the page will have their own <code>req.session.shortId</code>. (I have this in my schema <code>s... | <p>It seems like you would have that shortId stored with your review in the database. Which should make it easy enough to do something like this in your node app:</p>
<p><code>res.render('index', {shortId: req.session.shortId, review: review});</code></p>
<p>Then on your ejs template you should be able to conditiona... |
Count days on a column case <p>I would like to create a SQL script that counts the number of age days and the something like:(The catch is I got the days value of breaking value of one column by case to three columns) This is the output I have created.</p>
<pre><code>Days0To30 Days30to60 Daysto60to90
--------------... | <p>You can use <code>conditional aggregation</code>:</p>
<pre><code>select count(case when Days0To30 <> 0 then 1 end) as Days0To30,
count(case when Days30to60 <> 0 then 1 end) as Days30to60,
count(case when Daysto60to90 <> 0 then 1 end) as Daysto60to90
from yourtable
</code></pre>
|
When i try to scrape details page for image I get an error <p>I am trying to get the image of the details page from a website. I am using the rss 'links' function to get the links. This is my code</p>
<pre><code>@app.task
def pan_task():
url = 'http://feeds.example.com/reuters/technologyNews'
name = 'noticiass... | <p>You need to do something like this:</p>
<pre><code>@app.task
def pan_task():
url = 'http://feeds.example.com/reuters/technologyNews'
name = 'noticiassin'
live_leaks = [i for i in feedparser.parse(url).entries][:10]
the_count = len(live_leaks)
ky = feedparser.parse(url).keys()
oky = [i.keys()... |
pull objects with a matching attribute from ngrx/store in Angular2 <p>if I have a store that consists of <code>preferences</code> with a sample looking like:</p>
<p><code>
preferences: [{
name: 'pref1',
accepted: true,
contents: {
type: 'boolean',
value: true
}, {
name: 'pref2',
accepted: false,
... | <p>Your preferences won't be flattened, the value emitted by the <code>select</code> will be an array of preferences, with a new array emitted upon changes.</p>
<p>You can use an RxJS <code>map</code> operator and the <code>Array.prototype.filter</code> method to filter your array of preferences:</p>
<pre><code>this.... |
RETURN PREVIOUS CONTROLLER UIbutton action <p>I want the method to implement in UIbutton action to return to a previous controller, when button is tapped.
Regards
Very grateful for the answer :)</p>
| <p><strong>Swift 3 Xcode 8</strong></p>
<pre><code>@IBAction func close(_ sender: AnyObject) {
dismiss(animated: true , completion: nil)
}
</code></pre>
|
case statement in sybase <p>I have following requirement for Sybase Query:-</p>
<p>Exclude below if:</p>
<ul>
<li>The SSN has more or less than nine digits</li>
<li>The SSN includes non-numeric characters</li>
<li>The SSN is blank</li>
<li>The SSN includes the same digits (for example, 000000000, 111111111 or 9999999... | <p>Here is a shorter version:</p>
<pre><code>SELECT (CASE WHEN LEN(a.MEMBER_SSN) <> 9 THEN ' '
WHEN a.MEMBER_SSN LIKE '%[^0-9]%' THEN ' '
WHEN REPLACE(a.MEMBER_SSN, LEFT(a.MEMBER_SSN, 1), '') = '' THEN ' '
WHEN a.MEMBER_SSN LIKE '9__[789]%' THEN ' '
WHEN a.MEMB... |
If statement skipping else if straight to else <p>I'm attempting to make the statement below do the following.
If age is greater than 20 and less than 50, continue.
If age is less than 20 and greater than 50, error restart.
if anything else, error, restart.</p>
<p>But, for some reason it skips right over the else if c... | <p>Wrong logic:</p>
<blockquote>
<p>else if (plyAge < 20 && plyAge > 50) // this condition can never be true</p>
</blockquote>
<p>should be</p>
<pre><code>else if (plyAge < 20 || plyAge > 50)
</code></pre>
|
Is there a more recursive way to do this? <p>I have the following code:</p>
<pre><code>{% if thing.parent.parent.parent.link %}
<a href="/y/{{ thing.parent.parent.parent.link }}">{{ thing.parent.parent.parent.name }}</a>
{% endif %}
{% if thing.parent.parent.link %}
<a href="/y/{{ thing.parent.... | <p>Return a list in your context and then you can use an iterative approach:</p>
<pre><code>{% for parent in parents %}
<a href="/y/{{ parent.link }}">{{ parent.name }}</a>
{% endfor %}
</code></pre>
<p>Since nothing special has to be done if it is a child (as you mentioned, the only difference is li... |
Can I list all users assigned to one or more user stories that are related to a specific feature in Rally? <p>I am trying to create a kanban board or custom grid that will show the following:</p>
<ul>
<li>Features tagged with "tag name"</li>
<li>All users assigned to any user stories/tasks linked to the feature</li>
<... | <p>This functionality exists in the API via the Collaborators field on PortfolioItem, but for some reason the Collaborators field was never really exposed correctly on boards/grids.</p>
<p>I forked the Custom List app and added support for the Collaborators field. You can copy/paste this into a Custom HTML app and gi... |
Can Kullback-Leibler be applied to compare two images? <p>I know that KL is not a metric, and cannot be considered one. However, is it possible to use KL to measure how one image varies from another? I am trying to make an intuitive sense out of this. Thanks in advance for all responses.</p>
| <p>The KL measures the difference between two probability distributions. </p>
<p>In order to apply it in images you will need to transform the image to a probability distribution.</p>
<p>A simple example will be the take the histogram of the image(in gray scale) and than divide the histogram values by the total numbe... |
How to start an android emulator in ubuntu 16.04? <p>I have android sdk installed, I've looked up directions which say to rune <code>~/android-sdk-linux/tools/android</code> and then click on a tools menu, but there is no tools menu.</p>
<p>I've also tried downloading virtual machine manager, but when I started that e... | <p>Run</p>
<pre><code>~/android-sdk-linux/tools/android avd
</code></pre>
<p>to start in AVD manager mode.</p>
|
My contact form will not validate its input fields. It will submit an email to me while my input fields are blank. Any suggestions? <p>As stated, my php contact form will send me a blank email message however, it will not validate null input values. Any suggestions? I've tried about everything I know to do. </p>
<p>I'... | <p>Here's my take on it:</p>
<pre><code>if (isset($_POST["submit"])) {
$name = !empty( $_POST['name'] ) ? $_POST['name'] : false;
$email = !empty( $_POST['email'] ) ? filter_var($_POST['email'],FILTER_VALIDATE_EMAIL) : false;
if( $name && $email ){
$from = 'Demo Contact Form';
$to... |
html - Why my three buttons are vertical instead of horizontal? <p>Sorry for the confusing I caused. I did not paste my code because it is part of my big assignment. Also, I do not sure what parts of code cause the problem. So I paste the parts of the code that contains these three buttons </p>
<p>I want to make these... | <p>Hard to say without the rest of your code present, but probably some other CSS is causing the buttons to render as <code>block</code> elements instead of their standard <code>inline</code> display mode.</p>
<p>You could write the following CSS rule:</p>
<pre><code>#energybutton, #wizardbutton, #slidebutton {
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.