input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Implementing a concentrated distribution curve <p>I am working on a project right now and I need to map a variable amount of elements (say between 12 and 18 for this case) across 10 depth levels. Up until now, no worries here.</p>
<p>The thing that bothers me is this: We are currently looking at implementing a concent... | <p>Well, one way to make it clear is to use discrete distribution with a peak, and Poisson might be a good choice</p>
<p>Sample Poisson up to 9, if it is above 9 reject and resample. Otherwise shift it by 1 and return.</p>
<p>Some pseudo-code based on <a href="http://numerics.mathdotnet.com/api/MathNet.Numerics.Distr... |
Generate unique download link for a PDF file <p>Hello everybody I'm new here please be friendly and don't get angry cause I'm a beginner.</p>
<p>To introduce you:</p>
<p>First I generated a <code>pdf</code> and save it after the user bought the file in a protected folder on my server. Than I save the path to this fil... | <p>Ahh, do you mean how to display the link as <code>"http://my-website.de/download?link=baksjcbasduo123231sdsad"</code> instead of <code>"http://my-website.de/download?link=baksjcbasduo123231sdsad.php"</code> ?</p>
<p>If that's the case:
First, You'll need to create an <code>.htaccess</code> file</p>
<p>Then put thi... |
Displaying youtube video from mysql database using php? <p>I want to display youtube video on a page, the following is my code in order to fetch youtube video URL from the database stored in mysql and then display it by iterating using while loop. However, the iframe does not display any video inside it.</p>
<pre><cod... | <p>You can use Youtube with embed, like this:</p>
<pre><code><iframe width="560" height="315" src="https://www.youtube.com/embed/<?php echo $row["url"]; ?>?autoplay=1&autohide=1&controls=1&showinfo=0&modestbranding=1&rel=0"></iframe>
</code></pre>
|
Laravel updating eloquent event: getting the data <p>I have been reading about eloquent events. There is an event for every interaction with a Model: creating, created, updating, updated, saving, saved, deleting, deleted, restoring, restored.</p>
<p>I want to know the data from a Model when it has been updated and the... | <p>You're looking for <a href="https://laravel.com/api/5.2/Illuminate/Database/Eloquent/Model.html#method_getDirty" rel="nofollow"><code>getDirty()</code></a> and <a href="https://laravel.com/api/5.2/Illuminate/Database/Eloquent/Model.html#method_getOriginal" rel="nofollow"><code>getOriginal()</code></a> methods.</p>
... |
How to find the html element of a given text <p>Assume I have the following code to be parsed using JSoup</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-html lang-html prettyprint-override"><code><body>
... | <p>Not elegant but simple way could look like :</p>
<pre><code>import java.util.HashSet;
import java.util.Set;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;
import org.jsoup.select.Elements;
public class JsoupTest {
public static void main(String argv[]) {
String ht... |
Redirecting subdomain URL to specific URL <p>On my site, each group has a specific URL, eg: domain.com/my-group, domain.com/my-group2 and so on..</p>
<p>What I would like is that the user uses my-group.domain.com, my-group2.domain.com to get to its group.</p>
<p>How can I achieve that?</p>
| <p>You can setup Apache to listen on both  my-group.domain.com and my-group2.domain.com using the Virtual Host configuration.</p>
<p>Apache's documentation on this topic should be enough to get you started:
<a href="https://httpd.apache.org/docs/current/vhosts/" rel="nofollow">https://httpd.apache.org/docs/current/v... |
Custom Exception override message with JSON.NET <p>If you create a custom Exception that overrides the virtual property <code>Message</code> with something like this:</p>
<pre><code>public class GrossException : Exception
{
public GrossException() : base("Eww, gross") { }
}
public class BarfException : GrossExcep... | <p>You are correct that this is happening because <code>Exception</code> implements <a href="https://msdn.microsoft.com/en-us/library/system.runtime.serialization.iserializable(v=vs.110).aspx" rel="nofollow"><code>ISerializable</code></a> and Json.NET <a href="http://www.newtonsoft.com/json/help/html/serializationguide... |
Random images from file without duplicating any <p>Hello Working on a poker game. I have my cards randomly being called from a file, but I want there to be no duplicates. for example, no 2 five of clubs, or 2 jack of spades in the same hand. That's basically what I have been trying to do, and once I get that done, m... | <p>I recommend using LINQ to accomplish this:</p>
<pre><code>string[] fileNames = Directory.GetFiles(MapPath("~/GameStyles/VideoPoker/Images/Poker/"));
var randomCards = fileNames
.OrderBy(i => Guid.NewGuid())
.Take(5)
.Select(filePath => Path.Combine("~/GameStyles/VideoPoker/Images/Poker/", Path.Ge... |
How do I refactor this code to make it shorter? <pre><code>import math
def roundup(x):
return int(math.ceil(x / 10.0)) * 10
w=0
while w == 5:
print("Would you like to *work out* a missing letter in a GTIN-8 code, or *check* a code?")
response = input(":")
if response == 'work out':
print("Input a 7 digit GTIN-8 cod... | <p>To get you started, here is one simple way of reducing the number of lines</p>
<pre><code>c = [int(x) for x in input("Input a 8 digit GTIN-8 code and I'll check if it's correct").split("")]
</code></pre>
<p>Now you can access each character with <code>c[n]</code>.</p>
|
Jquery to append text in textbox from other textboxes in the same Mvc view <p>I have 3 textboxes on a form in my mvc view, FirstName, LastName, UserName. The UserName needs to be the FirstName + LastName. I tried the following Jquery which will add the letters of the FirstName field to UserName on the FirstName.KeyUp... | <p>You can read both the input values(<em>FirstName and LastName</em>) and append it to get the final value and still overwrite the UserName input value.</p>
<pre><code>$(function(){
$("#FirstName").keyup(function () {
$("#UserName").val($(this).val()+ $("#LastName").val());
});
$("#Last... |
Column Manipulations in Spark Scala <p>I am learning to work with Apache Spark(Scala) and still figuring out how things work out here</p>
<p>I am trying to acheive a simple task of
1. Finding Max of column
2. Subtract each value of the column from this max and create a new column</p>
<p>The code I am using is </p>
... | <p>Here is a solution using window functions. You'll need a <code>HiveContext</code> to use them</p>
<pre><code>import org.apache.spark.sql.hive.HiveContext
import org.apache.spark.sql.functions._
import org.apache.spark.sql.expressions.Window
val sqlContext = new HiveContext(sc)
import sqlContext.implicits._
val tr... |
how connect to multiple hosts/databases in laravel <p>I'm new in laravel and wondering how could I connect to multiple hosts and multiple databases in Laravel ? </p>
<p>if yes how i could do that dynamically ?</p>
<p>how to add new host connection dynamically ?</p>
<p>how to add new database connection dynamically ?... | <p>In your database.php, you can add multiple databases. </p>
<pre><code>'mysql' => [
'driver' => 'mysql',
'host' => '',
'port' => '',
'database' => '',
'username' => '',
'password' => '',
'charset' => 'utf8',
'co... |
cannot register aframe component in js file <p>I am trying to register an aframe component in a js file which is included from the base html file.
The components are registered correctly when in the html inside script tags, but do not register when in the js file.</p>
<p>example of code in html:</p>
<p><div class="sn... | <p>Best to place the script tag after A-Frame before the scene. </p>
<pre><code><head>
<meta charset="utf-8">
<title>Gravity Puzzle</title>
<meta name="description" content="">
<script src="dist/aframe-v0.3.0.js"></script>
<script src="mycomponent.js></sc... |
Angular directive nesting bizarrely broken when upgrading from 1.4.9 to 1.5.0 <p>Apologies for the vague title; I have yet to figure out exactly <em>what</em> is breaking after the upgrade. Possibly the nesting of directives or template issues?</p>
<p>(example images & links to CodePens below)</p>
<h2>Problem</h2... | <p>This isn't exactly 100% an answer, but that specific library relies heavily on the <code>replace</code> directive flag, which has since been deprecated <a href="https://github.com/angular/angular.js/commit/eec6394a342fb92fba5270eee11c83f1d895e9fb" rel="nofollow">see here</a>. I downloaded the source and removed the ... |
Maven compilation of my Java 8 source code fails <p>On my mac, I am trying to compile some Java 8 source code I wrote. It compiles fine in Eclipse, but in Maven, the compilation is failing. </p>
<p>I get multiple errors of the form:</p>
<pre><code>[INFO] -------------------------------------------------------------
[... | <p>Set</p>
<pre><code><maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</code></pre>
<p>in the <a href="https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html" rel="nofollow">properties of your pom</a>.</p>
<p>You should n... |
Issues with delimiter ("\t | \n") Java <p>I am having issues using my delimiter in my scanner. I am currently using a scanner to read a text file and put tokens into a string. My tutor told me to use the delimiter (useDelimiter("\t|\n")). However each token that it is grabbing is ending in /r (due to a return in the... | <p>Try this:</p>
<pre class="lang-java prettyprint-override"><code>studentData.useDelimiter("\\t|\\R");
</code></pre>
<p>The <code>\R</code> pattern matches any linebreak, see <a href="https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html" rel="nofollow">documentation</a>.</p>
<p>I guess the remaini... |
Making a namepaced function asynchronous using setimeout <p>I have this function which is using namespace. I want to make it asynchronous. Assuming that this function is being called on click of some button ?</p>
<pre><code>var ns = {
somemfunc: function (data) {
alert("hello");
... | <p>You can set this function to be called asynchronously by adding a <code>setTimeout</code> block within the definition of <code>somefunc</code>, note that I am using the term asynchronous loosely here as this function isn't really doing any asynchronous work. An async function would be a function that does some work... |
Docker container date/time totally different to host PC <p>When I run a docker container on my PC it has a totally different date/time to the host PC. See commands below. The time on the container recognizerDev is for the previous day, different hour, different minutes to the host. Any idea what is going on? </p>
<pre... | <p>This is only a partial answer (because it does not necessarily resolve the problem), but may help with diagnosis.</p>
<p>When you are running docker under Linux (as on your AWS host), you are just running processes on the host. That is, there isn't a substantial difference between <code>docker run fedora ls</code>... |
Stopping CSRF checking for subdomains <p>For our Laravel 5.3 API, I want to remove the need for CSRF tokens since everything is handled with OAuth2 and JWT.</p>
<p>Currently the API operates on the subdomain: <code>api.example.com</code></p>
<p>I tried this but it still requests CSRF tokens:</p>
<pre><code>class Ver... | <p>You can overwrite the <code>shouldPassThrough</code> method in the <code>BaseVerifier</code> class, where-in it would support a subdomain in <code>$except</code> such as <code>api.yourdomain.com</code></p>
<pre><code>/**
* Determine if the request has a URI that should pass through CSRF verification.
*
* @param ... |
Alamofire: [Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-999 "cancelled" <p>The service I'm connecting to is using a self signed certificate.
For dev purposes I do not want to validate that chain. </p>
<p>Using swift 3 with Alamofire 4.
Fixed the ATS accordingly:</p>
<pre><code><key>NSAppTransportSec... | <p>Please add this statement to the end of responseJson block:</p>
<pre><code>manager.session.invalidateAndCancel()
</code></pre>
<p>It happens if the object of the manager is not retained till execution of the block completes, so this would ensure its retention.</p>
<p>Cheers!</p>
|
AndroidManifest.xml with key com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME <p>I am getting this random exceptions on some devices. I wonder what I am doing wrong. Please let me know what more information I can provide for this issue. I am clueless what else I can provide to help make this question m... | <p>Your app is attempting to connect to the MediaNotificationService somewhere, which relies on the Google Cast SDK. You need to create a class that extends OptionsProvider. Then, you need to register the class you created in your Manifest, like this:</p>
<pre><code><application>
...
<meta-data
androi... |
Monitor.Wait and Task.Delay on main thread <p>I want to do work on the main UI thread(dispatcher), populating data but paginatedly so that the dispatcher is not held long enough for UI to hang. I also want the work requests to be executed in order.</p>
<p>My solution was to use a FIFO guaranteed locking mechanism that... | <p>Found a solution!</p>
<p><a href="https://github.com/StephenCleary/AsyncEx/wiki" rel="nofollow">AsyncEx</a> provides the AsyncLock and AsyncMonitor classes, which not only solve the problem of Monitor.Wait only handling requesters, it allows for yielding up control of the thread within the asynchronous lock itself!... |
Java Action Listener and JButtons <p>I have a gui class which has three different <code>JButtons</code> linked to one <code>ActionListener</code>. </p>
<p>In the <code>ActionListener</code> class I want an interaction between these three <code>JButtons</code> in a way that allows the program to "remember" which button... | <p>From my understanding of what you are looking todo...</p>
<p>So one way of achieving this is to create a instance variable that is a Boolean, so will be set true is the button has been previously clicked and then you could check inside your method if that flag has been set true.
Drawback of that approach would be ... |
Prevent database commit on assert failure in php <p>For the sanity testing of my code I am putting asserts at various places in my code.</p>
<p>I want it to be the case that whenever an assert is hit, the database transaction should not be completed (i.e. the data should not be committed to database, instead it should... | <p>The functionality should not be part of an assert. If it is the case then the functionality will be distorted in production mode when asserts are disabled.</p>
<p>We can perform additional database operation on assert failure to record and track more details of the error, but should not abort/interfere with outside... |
Tool to parse Java thread dump output <p>The Dropwizard metrics library has a servlet to output a thread dump of the server: <a href="https://github.com/dropwizard/metrics/blob/3.2-development/metrics-servlets/src/main/java/com/codahale/metrics/servlets/ThreadDumpServlet.java" rel="nofollow">https://github.com/dropwiza... | <p>Give <a href="https://github.com/irockel/tda" rel="nofollow">TDA - Thread Dump Analyzer</a> a try.</p>
<p>This will let you easily view locked monitors and waiting threads and provides overview of heap objects at a thread dump (if class histograms were logged).</p>
<p>You could also try:</p>
<ul>
<li><a href="htt... |
Docx4j.toPDF - hf.fo file <p>I'm creating a pdf like this:</p>
<pre><code>WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
OutputStream os = new java.io.FileOutputStream(outputFilePath);
Docx4J.toPDF(wordMLPackage, os);
</code></pre>
<p>It works fine.
After the ... | <pre><code>if (log.isDebugEnabled()) {
foSettings.setFoDumpFile(new java.io.File(System.getProperty("user.dir") + "/hf.fo"));
}
</code></pre>
<p>Turn off DEBUG level logging for org.docx4j.convert.out.fo.FOPAreaTreeHelper</p>
|
Compiling againts especific version of armhf g++ <p>I'm doing a crossbuild of a QT app from a Debian (Stretch) PC to a Debian (Jessie) BeagleBone Black, and when I executed this, I got the message </p>
<pre><code>/home/bbuser/totemguard/totemguard: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.22' ... | <p>solution 1) use -static (full libraries) or compile-in only libstdc++ as static to the binary</p>
<p>solution 2) distribute the appropriate libstdc++ version with the binary (possibly using LD_PRELOAD)</p>
<p>solution 3) use exactly the same g++ libstdc++ version for crosscompiling (at least matching)</p>
<p>usua... |
Compare two strings and output result where both are equal <p>I have two strings, and I want to output one string where both give the same values.
e.g.</p>
<pre><code>var string1 = "ab?def#hij@lm";
var string2 = "abcd!f#hijkl]";
//expected output would be "abcdef#hijklm"
</code></pre>
<p>I have thought a way to do ... | <p>You could use <code>replace</code> with its callback argument:</p>
<pre><code>string1.replace(/[^a-z]/ig, (_, i) => string2[i])
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="true">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-c... |
How to use `const`ness in this example? <p>I have some code which implements graph algorithms; in particular, there are these snippets, which cause problems:</p>
<pre><code>class Path{
private:
const Graph* graph;
public:
Path(Graph* graph_) : graph(graph_) {
...
}
</code></pre>
<p>(which is supp... | <p>The problem is that your <code>Path</code>'s constructor expects a pointer to non-<code>const</code> <code>Graph</code>.</p>
<p>To get rid of this problem simply change your constructor declaration:</p>
<pre><code>Path(const Graph* graph_) : graph(graph_) {
...
}
</code></pre>
|
Ceph pool deleted but files remain in list <p>I filled up my OSDs through Rados-gw, and the only thing I could do to get Ceph working again was delete the pool that was taking up all the room, and recreate it. Nevertheless, when I list the contents of all pools (using <code>boto</code>), it shows all the files that we... | <p>If you only deleted the buckets pool, typically <strong>.rgw.buckets</strong>, then that would explain why you still have the list of all the objects.</p>
<p>The index pool takes care of the list of objects. You would also need to delete the <strong>.rgw.buckets.index</strong> pool as well. Make sure you stop your ... |
Generalizing map-values in Racket <p>Suppose I have the following function:</p>
<pre><code>(define foo
(lambda (n)
(values n (* 2 n))))
</code></pre>
<p>I want to call map <code>foo</code> over the list <code>'(1 2 3 4)</code>. Hence, I create a <code>map-values</code> function:</p>
<pre><code>(define map-valu... | <p>This does what you want:</p>
<pre class="lang-scm prettyprint-override"><code>(define (map-values proc lst)
(define (wrap e)
(call-with-values (lambda () (proc e)) list))
(apply values
(apply map list (map wrap lst))))
(define (foo n)
(values n (* 2 n) (/ 1 n)))
(map-values foo '(1 2 3 4)... |
Grails with external log4j with name "${appname}.log", it not work <p>1.Grails version 2.5.1</p>
<p>i used Grails external log4j like this in env:</p>
<pre><code>grails.config.locations = ["file:${basedir}/grails-app/config/log4j.groovy"]
</code></pre>
<p>and log4j.groovy like this</p>
<pre><code>log4j = {
app... | <p>I have something similar in my environment and it's working just fine. The difference may be that I have a log4j section in both my internal and external Config.groovy files. In my <code>\grails-app\conf\Config.groovy</code> file I have:</p>
<pre><code>grails.config.locations = ["file:path\to\external-config.groovy... |
Reading protobuf messages via winpcap API <p>I'm using winpcap to capture network traffic, and I know for a fact that this traffic mainly consists of serialized Protocol Buffer exchanges. How can I detect those messages in the traffic if I know all the types of message that a system is likely to transmit?</p>
| <p>This will be a bit difficult, because protocol buffers are not self-describing and when you read through a raw stream of bytes there is no easy way to determine when one message ends and another begins. However, with a bit of effort you may be able to recover some of the data if you have a good understanding of the ... |
recursively iterate nested python dictionary <p>I have nested python dictionary like this.</p>
<pre><code>d = {}
d[a] = b
d[c] = {1:2, 2:3}
</code></pre>
<p>I am trying to recursively convert the nested dictionary into an xml format since there can be more nested dictionary inside such as <code>d[e] = {1:{2:3}, 3:4}<... | <p>The way you recall encode does not look correct. Maybe this helps. For simplicity I just append stuff to a list (called <code>l</code>). Instead, you should do your <code>etree.SubElement(...)</code>.</p>
<pre><code>def encode(D, l=[]):
for k, v in D.items():
if isinstance(v, dict):
l2 = [k]... |
expected unqualified-id before '.' token arduino library <p>I am getting this error:</p>
<blockquote>
<p>In function 'void loop()': headers_stepper_test:12: error: expected
unqualified-id before '.' token expected unqualified-id before '.' token</p>
</blockquote>
<p>in this code:</p>
<pre><code>#include "Stepper... | <p>Lets recap your code:</p>
<pre><code>void loop() {
// put your main code here, to run repeatedly:
void StepperMotor.moveDegrees(-180);
delay(1000);
}
</code></pre>
<p>First thing first: Don't put <code>void</code> in the call to <code>moveDegress()</code> there.</p>
<p>Second: </p>
<p>The method <cod... |
C#: Can't seem to wrap my head around a compile error <p>I'm facing a compilation issue in "PromoteEmployee" within "public static void PromoteEmployee(List employeeList, IsPromotable IsEligibleToPromote)".</p>
<p>Would appreciate if someone could give me a hint on how I should go about this.</p>
<p>EDIT:</p>
<p>The... | <p>The error I get compiling your program is:</p>
<pre><code>(67:28) Inconsistent accessibility: parameter type 'Program.IsPromotable' is less accessible than method 'Program.Employee.PromoteEmployee(System.Collections.Generic.List<Program.Employee>, Program.IsPromotable)'
</code></pre>
<p>This error occurs bec... |
set weird sorting behavior (python) <p>I found out something weird and I was wondering if it was a known thing.
This is my code: -Python 3.5.2-</p>
<pre><code>numbers = [9,4,6,7,1]
setlist = set()
for item in numbers:
setlist.add(item)
print(setlist)
numbers = [9,4,6,7,1,5]
setlist = set()
for item in numbers:
... | <p>sets are unordered collections by design. If you want a collection of items that retain order, consider using a list, instead. Lists have <code>insert</code> and <code>append</code> methods available to you.</p>
<pre><code>my_list = []
for item in some_iterable:
my_list.append(item)
</code></pre>
|
How to create Android Games <p><strong>How are professional Android Games made?</strong> </p>
<p>I'm interested in starting a little project for a game on android.</p>
<p>I have already developed an android app so I have got some experience with Android Studio, Java, and Android in general.</p>
<p>I have looked onli... | <p>I would consider making regular Java games to practice before diving into Android games. Look <a href="http://zetcode.com/tutorials/javagamestutorial/" rel="nofollow">here</a> for a good start. There are plenty of others if you just search in google.</p>
<p>This forum is not meant for getting answers and tutorials ... |
Does anyone know details about PERM-AR-DO? <p>According to <a href="https://source.android.com/devices/tech/config/uicc.html" rel="nofollow">https://source.android.com/devices/tech/config/uicc.html</a>,</p>
<blockquote>
<p>AR-DO (E3) is extended to include PERM-AR-DO (DB), which is an 8-byte bit mask representing 64... | <p>The data object PERM-AR-DO (tag 0xDB), just as the other data objects defined on the <a href="https://source.android.com/devices/tech/config/uicc.html" rel="nofollow">UICC Carrier Privileges page</a> (DeviceAppID-REF-DO with SHA-256 and PKG-REF-DO), is a Google-specific extension to the GP Secure Element Access Cont... |
Search multi-dimesional array and return specific value <p>Hard to phrase my question, but here goes. I've got a string like so: "13,4,3|65,1,1|27,3,2". The first value of each sub group (ex. <strong>13</strong>,4,3) is an id from a row in a database table, and the other numbers are values I use to do other things. </p... | <p>You can loop through the dataset building an array that you can use to search:</p>
<pre><code>$data = '13,4,3|65,1,1|27,3,2';
$data_explode = explode("|",$data); // make array with comma values
foreach($data_explode as $data_set){
$data_set_explode = explode(",",$data_set); // make an array for the comma value... |
Unable to use sudo commands within Docker, "bash: sudo: command not found" is displayed <p>I have installed TensorFlow using the following command "docker run -it b.gcr.io/tensorflow/tensorflow:latest-devel" and I need to set up TensorFlow Serving on a windows machine. I followed the instructions given at "<a href="htt... | <p>Docker images typically do not have <code>sudo</code>, you are already running as <code>root</code> by default. Try</p>
<pre><code>apt-get update && apt-get install -y \ build-essential \ curl \ git \ libfreetype6-dev \ libpng12-dev \ libzmq3-dev \ pkg-config \ python-dev \ python-numpy \ python-pip \ softw... |
Is MySQL Query framed properly? <p>I'm attempting to run the following Query on an AWS ec2 xlarge instance: </p>
<pre><code>mysql> CREATE TABLE 3 SELECT * FROM TABLE 2 WHERE ID IN (SELECT ID FROM TABLE1);
</code></pre>
<p>I attempted using ec2 as I thought perhaps it was my laptop making the query taking long as T... | <p>Try split logically the query </p>
<pre><code>CREATE TABLE3
SELECT *
FROM TABLE2
WHERE ID IN (SELECT ID FROM TABLE1 where id between 1 and 10000);
</code></pre>
<p>and then </p>
<pre><code>insert into table3
SELECT *
FROM TABLE2
WHERE ID IN (SELECT ID FROM TABLE1 where id between 10001 and 20000);
</code>... |
How to SQL select duplicates by one field and differs by another <p>I have the table <code>person_log</code> with the following fields:</p>
<ul>
<li><code>id</code></li>
<li><code>timestamp</code></li>
<li><code>first_name</code></li>
<li><code>last_name</code></li>
<li><code>action</code></li>
</ul>
<p>with some exa... | <p>Use a derived table to get the persons having atleast 2 distinct actions and join it to the original table to get the other columns in the result.</p>
<pre><code>select p.*
from person_log p
join (select first_name,last_name
from person_log
group by first_name,last_name
having count(*) >=2 and... |
Rails/Devise: XHR returns 401 <p>I have a Rails app that uses Devise for authentication. I authenticate through the usual Rails views, and most of the app is done with the usual Rails ActionView pages. </p>
<p>One page of my app includes a React app that requests data via XHR with the isomorphic-fetch library. I've be... | <p>I got this to work. I checked my previous app, which used jQuery for the AJAX calls. When I replaced <code>fetch</code> with <code>jquery-ujs</code>, it worked! I saw my problem was that it had not been sending the session cookie with the request. I researched how to do this with <code>isomorphic-fetch</code>, and f... |
SQL Server count orders within dates per customer <p>I'm trying to get the following data:</p>
<ul>
<li>List all customers who have ordered twice or more in the last 12 months</li>
<li>List all customers who have ordered just once in last 12 months</li>
<li>List any customers who do not fit in the criteria above</li>
... | <p>Try something like this:</p>
<p><strong>List all customers who have ordered twice or more in the last 12 months</strong></p>
<pre><code>SELECT COUNT(o.OrderID), o.CustomerID
FROM Order o
WHERE o.UserID = '6EAE3206-519E-4DE7-B10B-6F2476D7D20F'
AND o.OrderDate > DATEADD(MONTH, -12, GETDATE())
GROUP BY o.Cust... |
PHP output Excel-The file format and extension don't match <p>I have made a script that outputs a XLS file with data brought from my database. Problem is that when you view the file on OSX and Linux it looks as it is supposed to. </p>
<p><strong>Behaviour on Windows</strong></p>
<p>On Windows excel shows the followin... | <p>I've had the same problem using Laravel with <a href="http://www.maatwebsite.nl/laravel-excel/docs" rel="nofollow">http://www.maatwebsite.nl/laravel-excel/docs</a> and i solve the problem by checking if there was a clean code, i had a apostrophe (') character somewhere in my code and when i detected it i just erased... |
Can't see the extension I've installed in GeneXus 15 <p>I've installed the SmartDevicePlus (from DVelop) extension in my Genexus15 folder. The setup ends telling me it completed successfully. Yet, I can't find the SD+ menu in Tools. </p>
<p>I've also tried to install the WorkWithPlus (from DVelop) extension from the A... | <p>You should install the proper setups for Gx 15 for both WorkWithPlus and SmartDevicesPlus, you can download them from www.dvelop.com.uy/downloads.</p>
<p>By using this setups you should use the products on Gx15. If you have other problems please write us to support@workwithplus.com or by Skype (supportwwp) so we ca... |
Assembly "movdqa" access violation <p>I am currently trying to write a function in assembly and i want to move 128 bits of a string located at the memory address stored in <code>rdx</code> into the <code>xmm1</code> register.</p>
<p>If i use <code>movdqa xmm1, [rdx]</code>, i get a access violation exception while rea... | <p>Most of this has been said in the comments already, but let me summarise. There are three problems raised by your code/question:</p>
<p>1) <code>MOVDQA</code> requires the addresses it deals with (<code>[rdx]</code> in your case) to be aligned to a 16-byte boundary and will trigger an access violation otherwise. Th... |
Prevent size of canvas chart js to equal window height and width <p>I am <a href="http://www.chartjs.org/docs/#doughnut-pie-chart-introduction" rel="nofollow">using chartjs</a> to display data and the chart (canvas) takes up 100% width and 100% height of the window.</p>
<p>I want to reduce this to be <code>600px</code... | <p>Add 'responsive: false' to the chart options </p>
<pre><code>options: {
responsive: false,
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
}
</code></pre>
|
reading through a .txt file <p>I'm just trying to get the hang of c++ and I'm having problems reading through the lines of a .txt file. For the project that I am working on, I'm trying to read though a text file that has some placeholder elements, and then I'm trying to create a new output file that will store txt inpu... | <p>You should use:</p>
<p>if (line.compare ("_DATE")==0)</p>
<p>to test for equality.</p>
<p><a href="http://www.cplusplus.com/reference/string/string/compare/" rel="nofollow">http://www.cplusplus.com/reference/string/string/compare/</a></p>
|
Database server and public website communication <p>So, i'm getting slightly familiar with html, css and frameworks in general and i have a fair understanding of Java. However, i can only see how you can make inbuilt functions and computations with Javascript that you add to your html file. But i don't understand how i... | <p>I achieve this functionality by sending an ajax request via javascript to a java servlet on the server here is an example that I use:</p>
<p>Say you have a link:</p>
<pre><code><a href="#" onclick = 'shipProduct(1)'>Test</a>
</code></pre>
<p>When this link is clicked it will look for the corresponding... |
SQL Server: Joining three tables while showing null matches <p>I have spent a couple of hours trying to figure out this particular join. I have these three SQL Server tables (assume all the requisite indexes and foreign keys):</p>
<pre><code>create table [mykey] (keyname varchar(32) not null);
go
create table [myinsta... | <p>You need to use <a class='doc-link' href="http://stackoverflow.com/documentation/sql/261/join/8033/cross-join#t=201610112041488869063"><code>CROSS JOIN</code></a> to get all combinations of keyname and instancename before you join the third table. Look at this query</p>
<pre><code>SELECT *
FROM myinstance mi
CROSS... |
Yii2 assets bundle max folder size limit <p>I want to theme integration in Yii2. I have a theme which have 24 MB assets folder.I'm using asset bundle.Other theme folders are created but asset folder is not created on backend/asset folder.</p>
| <p>Google cache exceed over 618 MB and asset bundle is not working
I clear google cache and fixed the problem
<a href="https://i.stack.imgur.com/ZRuC2.png" rel="nofollow"><img src="https://i.stack.imgur.com/ZRuC2.png" alt="enter image description here"></a></p>
|
How to recursively get records in Laravel? <p>I have entity called posts in my app. Posts can be children of other posts, so that parent post has hasMany('posts') and children have hasOne('post') the inclusion is infinite.</p>
<p>Here is the schema: </p>
<p><a href="https://i.stack.imgur.com/KjSz4.jpg" rel="nofollow"... | <p>Since you specifically asked us not to comment about performance you should just add a <code>with</code> attribute on the post model to include all children eagerly.</p>
<pre><code>class Post extends Model
{
protected $with = [
'posts'
];
public function posts() {
return $this->hasMany... |
Javascript/ES2015, count the number of occurrences and store as objects within an array <p>I am extracting data from a JSON feed and am trying to count the number of times each name (name_class) occurs.</p>
<p>I want to return an array of objects in the following format, where count refers to the number of times the n... | <pre><code>function count(names){
// Count occurrences using a map (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
let map = new Map();
for (let name of names) {
map.set(name, (map.get(name) || 0) + 1);
}
// Transform to array of { name, count }
le... |
Overflow hidden doesn't work despite having height set <p>I'm not able to make the overflow to be hidden: <a href="http://codepen.io/aiwatko/pen/zKjaLx" rel="nofollow">http://codepen.io/aiwatko/pen/zKjaLx</a></p>
<pre><code>.loader-overlay {
position:absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
... | <p>By setting your <code>.loader-overlay</code> height to be 100%, you are telling it to occupy 100% of its <em>parent</em>. Being that the parent in your case is <code>body</code>, which does not have a set height, it will not behave as you expect.</p>
<p>What I would suggest is trying out CSS3 Viewport Height (vh). ... |
UIPickerView selection row with click event, not scrolling <p>I created <code>UIPickerView</code> but I did not find a way to select row with click event.I can only select row with scrolling picker rows.</p>
<p>Is there any way to select a row with click event?</p>
| <p>Click event is not possible in <code>UIPickerView</code>.</p>
<p>You can use <code>UITapGestureRecognizer</code> to get <code>CGPoint</code> and then calculate index of row clicked. But I will highly recommend not to do such things (Apple may reject the App) as <code>PickerView</code> is all about scrolling the lis... |
Handling tel: links in voip app <p>Is there any method in iOS (CallKit? perhaps) where a VoIP app can register to handle tel: links? That way when a user selects a phone number (in safari for instance). They would be presented with two options to complete the call.</p>
| <p>That capability does not exist in iOS today. If you are interested in that, I recommend filing a bug report to request it on Apple's <a href="http://bugreport.apple.com" rel="nofollow">Bug Report</a> website.</p>
|
Rails 5: rails s vs. bundle exec rails s <p>I'm starting a project on Rails 5 for the first time and I was curious why running 'rails s' when I was on Rails 4 worked fine, but now that I'm on Rails 5 I need to preface it with 'bundle exec' in order to run the command properly.</p>
<p>Below is my Gemfile. Again, everyt... | <p>It sounds like the <code>rails</code> command you have installed globally is rails 4 and it's the reason "it doesn't run properly" like you say. When you run <code>bundle exec</code> then it uses the <code>rails</code> commands from the current <code>Gemfile</code>, since you have <code>rails 5</code> in your Gemfil... |
What is the best way to maintain a C++ library which will be used by both managed and unmanaged code? <p>The C++(unmanaged) library in question is an evolving entity, and the way that it is currently handled is by providing a C++\CLI wrapper around it so that it can be used by C# code.</p>
<p>The issue however is that... | <p>Create a C++Library.dll.
As this library is being used by both managed and unmanaged clients, doing the following could be useful</p>
<p>Create a static library C++StaticLibrary.lib
Then wrap the C++StaticLibrary.lib in a C++DynamicLibrary.dll by exporting the required interfaces. </p>
<p>Refer C++DynamicLibrary.... |
Avoid react-native navigator scene overlapping <p>I have a <code>ScrollView</code> with a list of items. When I click on one item I navigate to a new scene (slide in from the right). However, during the transition period the two scenes overlap; they are fine after the animation/transition is done. </p>
<p>Here's an ex... | <p>Navigator uses animations during transitions between two scenes. In your case it uses fade during the transition. How about using a different animation. Navigator has <a href="https://facebook.github.io/react-native/docs/navigator.html#scene-transitions" rel="nofollow">Scene Transitions</a> feature that you may try ... |
SQL MAX Date Does Not Decipher Seconds <p>I have a table which contains the following data:</p>
<pre><code>ID | ObjectID | ActionDate
=======================================
12345 | 422107 | 2016-10-05 11:24:23.790
12346 | 422107 | 2016-10-05 11:24:28.797
</code></pre>
<p>I want to return the ID a... | <p>One option is to use the window function Row_Number()</p>
<pre><code>Select *
From (
Select *
,RowNr=Row_Number() over (Partition By ObjectID Order by ActionDate Desc
From YourTable
) A
Where RowNr=1
</code></pre>
|
How to pass data from one page to another page in python tkinter? <p>my program is this..
import tkinter as tk
from tkinter import *</p>
<pre><code>TITLE_FONT = ("Helvetica", 18, "bold")
class SampleApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
cont... | <p>Firstly, correct the code of the class <strong>PageOne</strong> and <strong>StartPage</strong> and add <em>self.controller = controller</em> to the __init__ function:</p>
<pre><code>class PageOne(tk.Frame):
def __init__(self, parent, controller):
#your code
self.controler = controller
</code></p... |
Typical coin change program in python that asks for specific amounts of each coin <p>Given a number "x" and a sorted array of coins "coinset", write a function that returns the amounts for each coin in the coinset that sums up to X or indicate an error if there is no way to make change for that x with the given coinset... | <p>As a concept, change <strong>coins_so_far</strong> to <strong>coins_this_call</strong>.</p>
<p>Your recursion steps change to something of this ilk; although it's not complete, I hope you see the idea.</p>
<pre><code>for c in change(n-sum(coins_this_call), coins_available[:]):
yield coins_this_call.append(c)
<... |
How to reuse variables from previous request in the Paw rest client? <p>I need to reuse value which is generated for my previous request.</p>
<p>For example, at first request, I make a POST to the URL /api/products/{UUID} and get HTTP response with code 201 (Created) with an empty body.</p>
<p>And at second request I... | <p>The problem is in your first requests answer. Just dont return "[...] an empty body."</p>
<p>If you are talking about a REST design, you will return the UUID in the first request and the client will use it in his second call: GET /api/products/{UUID}</p>
<p>The basic idea behind REST is, that the server doesn't st... |
Making a dropdown in Bootstrap Select <p>Im trying to show my options in a group but I want it would be something like a dropdown menu, for example we have </p>
<ul>
<li>option 1</li>
<li>option 2 </li>
<li>option 3</li>
</ul>
<p>when user clicked on option 2 a dropdown menu opens and it contains </p>
<ul>
<li>sub_o... | <p>Here you go:</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 prettyprint-override"><code>$(document).ready(function() {
$('#Rank').bind('change', function() {
var elements = $('div.con... |
React router configuration for an SPA with fixed layout <p>This is my first post here, hope I'm covering everything and did a search for various topics, watched some vids, read the react router docs before getting stuck. :-(</p>
<p>I'm working on a single page app, which has the following components:</p>
<ul>
<li><p>... | <p>React-router controls what should be visible by injecting component into <code>children</code> prop. </p>
<p>Let's imagine you have the following routes:</p>
<pre><code><Route path="/" component={Layout} >
<Route path="/maps" component={Maps} />
<Route path="/events/" component={Events}>
... |
Can I use a menu or buttons to switch react components on a single page app? <p>This is somewhat of a continuation of <a href="http://stackoverflow.com/questions/39984426/using-nested-routes-with-react-route/39984817#39984817">this thread</a>, since I found a better way to word my question.</p>
<p>All I want to do, is... | <p>i have build solution for this task. not perfect but it works.<br>
check it out <a href="http://codepen.io/dagman/pen/gwzBjX" rel="nofollow">http://codepen.io/dagman/pen/gwzBjX</a>.<br>
so when you click on <code>option2</code> <code><HelpPanel2 /></code> substitutes <code><HelpPanel1 /></code> and so on... |
Google Map: Remove all Circles <p>I'm looking for a javascript function that will clear all drawings from my map; something like <code>map.removeMarkers()</code> or <code>map.removeOverlays()</code>, but for shapes - specifically circles.</p>
<p>I've seen some answers about how to do this on Android, but I'm looking f... | <p>One easy solution is to store the objects in an array</p>
<pre><code><input type="button" value="Clear all" onclick="removeAllcircles()"/>
<script>
var circles = [];
// create circle loop
for( i = 0; i < data.mapArray.length; i++ ) {
var circle = map.drawCircle({
lat: data.mapArray[i].lat... |
ng-bind-html vs bind-html-compile? <p>I want to know the difference between ng-bind-html and bind-html-compile directives. For example I gave </p>
<pre><code><p style='color:red'>test<p>
</code></pre>
<p>to ng-bind-html, this strips out the style where as bind-html-compile does not. May I know when e... | <p><strong>bind-html-compile</strong> is not a standard Angular directive, it comes with the module <a href="https://github.com/incuna/angular-bind-html-compile" rel="nofollow">https://github.com/incuna/angular-bind-html-compile</a> and it is used to compile binded data.To make it simple, it is equivalent to write html... |
Reading from S3 Throws NoSuchMethodError, specifically, SSLConnectionSocketFactory <p>I am trying to read ORC file from S3, using <code>spark-shell</code>, following the guide below:</p>
<p><a href="http://stackoverflow.com/questions/30792494/read-orc-files-directly-from-spark-shell">Read ORC files directly from Spark... | <p>I have noticed that some Spark versions are not compatible with some AWS versions. For example, with Spark 1.6 and hadoop 2.6 I had to use AWS 1.10.77 ( I was having the same problem).</p>
|
js-data multiple models in a single route <p>I'm using 3.0.0-rc.4 of js-data and I'm in need of loading multiple models from a single call to the backend API. I'm still building the backend as well and would prefer to be able to retrieve all the data from the different tables at one time instead of making multiple call... | <p>You can. Say the route your web app is trying to load is /posts/123, and you need to load Post #123 and its Comments, which reside in two different tables. In your client-side app you can do something like</p>
<pre><code>store.find('post', 123)
</code></pre>
<p>or even</p>
<pre><code>store.find('post', 123, { par... |
Checking for Active Network connection and exiting the app if not active in ionic using ngCordova <p>i am developing a conference app that is data driven and constantly will be updated from the web server. i am storing data on the local storage for persistence, but when the app is installed and launched for the first t... | <p>A few aspects to keep in mind:</p>
<ul>
<li><p>your implementation of exitApp() is reported not to work in iOS devices</p></li>
<li><p>kill an app is a big no for usability, you'd better present the interface with the latest chached data or if any data is cached a "no network connection" message integrated into the... |
Why do I get garbled output when I decode some HTML entities but not others? <p>In Perl, I am trying to decode strings which contain numeric HTML entities using <a href="https://metacpan.org/pod/HTML::Entities" rel="nofollow">HTML::Entities</a>. Some entities work, while "newer" entities don't. For example:</p>
<pre><... | <p>The decoding works fine. It's how you're outputting them that's wrong. For example, you may have sent the strings to a terminal without encoding them for that terminal first. This is achieved through the <code>open</code> pragma in the following program:</p>
<pre><code>$ perl -e'
use open ":std", ":encoding(UTF... |
How to check, whether exception was raisen in the current scope? <p>I use the following code to call an arbitrary callable <code>f()</code> with appropriate number of parameters:</p>
<pre><code>try:
res = f(arg1)
except TypeError:
res = f(arg1, arg2)
</code></pre>
<p>If <code>f()</code> is a two parameter fun... | <p>You can capture the exception object and examine it.</p>
<pre><code>try:
res = f(arg1)
except TypeError as e:
if "f() missing 1 required positional argument" in e.args[0]:
res = f(arg1, arg2)
else:
raise
</code></pre>
<p>Frankly, though, not going the extra length to classify the excep... |
Getting the value outside the foreach php loop <p>Here is the code used to get the ids of a images in a gallery</p>
<pre><code><?php $images = get_field('photogallery');?>
<?php foreach( $images as $image ): ?>
<?php echo $image['ID']; ?>
<?php echo ','; ?>... | <p>You don't need to put <code><?php ... ?></code> everytime everywhere for each statement. Keep in mind that each time you close with <code>?></code> all characters are sent to the client until the next opening <code><?php</code>, that's why you obtain spaces around each comma:</p>
<pre><code><?php for... |
PHP: MySQL update always returns 0 <p>I'm trying to update some records in my database but the result always seems to be 0, although the query's syntax is correct.</p>
<p>This is my code:</p>
<pre><code>$results = mysqli_query($con, "SELECT * FROM scores LIMIT 10");
while ($row = mysqli_fetch_array($results)) {
... | <p>try $query = "UPDATE scores SET final = '1' WHERE id = '$id'";</p>
|
How to permit hash with * key => values? <p>I want to create an object with strong params that can accept dynamic hash keys.</p>
<p>This is my code,</p>
<pre><code>Quiz.create(quiz_params)
def quiz_params
params.require(:quiz).permit(:user_id, :percent, :grade, questions: {})
end
</code></pre>
<p>data that gets ... | <p>Until now I have only seen this:</p>
<pre><code>def quiz_params
questions_params = (params[:quiz] || {})[:questions].keys
params.require(:quiz).permit(:user_id, :percent, :grade, questions: questions_params)
end
</code></pre>
|
Randarray not definied <p>I'm trying to create a two dimensional Array - but in the JS console it keeps saying my "Randarray" function isn't defined. I can't seem to figure out why it's undefined, maybe I just need another pair of eyes to look over it.</p>
<p>Any help is appreciated!</p>
<p><h1> Part 2 </h1></p>
<pr... | <p>You forgot to close the <code>Randarray</code> function before the <code>getArray</code> function. Do this:</p>
<pre><code>} // Missing.
function getArray(row,col)
</code></pre>
<p>Also, don't use event listener as well as <code>onclick</code> inline function.</p>
<pre class="lang-html prettyprint-override"><cod... |
React with Redux - unable to bind action to parent <p>I am new to the Redux pattern i'm having some trouble linking an action in a separate JS file to it's parent component. Here is the component:</p>
<pre><code>import React, {Component} from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 're... | <p>You aren't exporting 'playSample' as the default export, you have two ways to reslove this:</p>
<p>You can do:</p>
<p><code>import { playSample } from './sampleActions/clickToPlay';</code></p>
<p>or </p>
<p>you can change <code>export const playSample</code> to <code>const playSample</code> Then add <code>export... |
Disallow certain urls from googlebots <p>I have the following urls:</p>
<pre><code>http://www.website.com/somethingawesome/?render=xml
http://www.website.com/somethingawesome/?render=json
</code></pre>
<p>What I want is to disallow google from indexing when the url has <code>?render=xml</code> or <code>?render=json<... | <p>You will need the wildcard first:</p>
<pre><code>Disallow: /*?render=xml
Disallow: /*?render=json
</code></pre>
|
Sending push notification to specific user in Parse <p>I am trying to create a flow in Cloud Code where I need to send a push notification not to the user that just signed up, but to his partner.</p>
<p>In my app, two Users can be connected as partners. My User table has a <code>partnerUser</code> column that points t... | <p>I finally found what the problem was. It was this line:</p>
<pre><code>pushQuery.equalTo('installationId', request.object.get("installationId"));
</code></pre>
<p>this is actually taking the installationId from the second user, and not the first one, as it should have been. I changed the line to:</p>
<pre><code>p... |
Swift 3 comparing array indexes <p>If i have two arrays & i want to compare their indexes, for ex:</p>
<pre><code>let var a1 = ["1", "2", "3"]
let var a2 = ["3", "2", "3"]
</code></pre>
<p>And i wanted to print something to say which index wasn't the same, such as:</p>
<pre><code>if a1[0] != a2[0] && a1[... | <p>You can get all indexes like this:</p>
<pre><code>let diffIndex = zip(a1, a2).enumerated().filter {$1.0 != $1.1}.map {$0.offset}
</code></pre>
<p>Explanation:</p>
<ul>
<li><code>zip</code> produces a sequence of pairs</li>
<li><code>enumerated()</code> adds an index to the sequence</li>
<li><code>filter</code> ke... |
Typescript version conflict in Visual Studio Code <p>I have an Angular2 project created with the angular-cli project templates in <em>Visual Studio Code</em>. Also, I installed the latest version of Typescript (2.0.3) via npm as well as via the Microsoft link (<a href="https://www.microsoft.com/en-us/download/details.a... | <p>Did you install TypeScript via NPM? If this is the case, try uninstalling it via <code>npm uninstall -g typescript</code>. Now reinstall it via <code>npm install -g typescript</code> and check if the problem is solved.</p>
|
Extracting first column that meets certain criteria for each row <p>I will try to explain what I am doing the best I can it is kind of confusing but I'll give it a shot. Essentially I start with 2 data frames. Each one containing a unique row per person and two items per user as columns. My goal is to turn this into 1 ... | <p>Would the following do what you're looking for:</p>
<pre><code># Keep only first column of first data.frame
df <- cbind(d1,r1,r2)[,-3]
names(df) <- c("id","r1_final","r2_i1","r2_i2")
df$r2_final <- df$r2_i1
# Keep only second column of second data.frame
# if the value in the first column is found in first... |
Identify first occurence of event based on multiple criterias <p>I have a dataset in PowerPivot and need to find a way to flag ONLY the first occurrence of a customer sub event</p>
<p>Context: Each event (COLUMN A) can have X number of sub events (COLUMN B),
I already have a flag that identifies a customer event base... | <p>Create a calculated column in your model using the following expression:</p>
<pre><code>=
IF (
[Customer_Event] = 1
&& [Sub_Event]
= CALCULATE (
FIRSTNONBLANK ( 'Table'[Sub_Event], 0 ),
FILTER (
'Table',
'Table'[... |
What does "E2E use case" mean? <p>I know what is "use case", but I haven't any idea about "E2E" in this context.</p>
<p>What does "E2E use case" mean ? All references are welcome.</p>
| <p>It should be "End to End" Use Case.</p>
|
Displaying two different heatmaps in one file <p>I am new to Heatmaps and R as well. I have two different Heatmaps as image, how can I display them in single file one above the other. It's a cancer data. I want to show data of two stages of cancer. Column names are same in both datasets but row names differ. Want some... | <p>Have you tried facet from ggplot2?</p>
<p>(Using the cookbook-r example it would be like this)</p>
<pre><code>library(reshape2)
library(ggplot2)
sp <- ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1)
sp
</code></pre>
<p>Gives you the single plot: </p>
<p><a href="https://i.stack.imgur.c... |
Fill input field when an item has changed in a drop down menu (html,javascript) <p>Im trying to get acquainted with javascript and how to use it with html. What i want to do is very simple, when a value has changed in a dropdownmenu id like to fill an input field with a string.</p>
<p>This is the HTML:</p>
<pre><code... | <p>You should give the parameter to <code>getElementById</code> as String:</p>
<pre><code>document.getElementById("field_id").value = "asdsads";
</code></pre>
<p>Watch for the quotation marks around <code>field_id</code>.</p>
<p>In your code the <code>field_id</code> is an (undefined) variable. You should see an err... |
Using a data_frame as an argument into a mutate and group_by routine <p>I have this data_frame (db) here with lots of columns:</p>
<pre><code>A B C D ... ZZ
1 .23 .21 ... .23
2 .45 .12 ... .23
1 .47 ... .53
2 .49 ... .27
</code></pre>
<p>I want to employ group_by and mu... | <h2><code>dplyr</code></h2>
<p>My trick has been to use <code>bind_cols</code>. By itself it won't honor any groups, so you need to nest it within a <code>do</code> block, such as:</p>
<pre><code>library(dplyr)
mtcars %>%
group_by(cyl) %>%
do(bind_cols(., {
# "insert complex stuff here"
... |
HTTP Response 503, however site works <p>At this moment I'm working with the Facebook API; I Need to fill in a Privacy Policy, so I did. However, after some research I discovered that the HTTP Response code will always be 503, But I can't find out why. The page is there, and when visiting it in a Browser it works, with... | <p>It is possible to have 503 only when robot is visiting the page. Try to simulate Facebook User Agent from your browser or rest client.</p>
<p>You can check Facebook user agents on developers facebook page:
<a href="https://developers.facebook.com/docs/sharing/webmasters/crawler" rel="nofollow">https://developers.fa... |
What is the Difference between using Cloud or VPS server? <p>What is the Difference between using Cloud or VPS server?</p>
<p>I want to know what method get more performance, have more speed and bandwich</p>
| <p>Check out these links they should answer your question(s);</p>
<p><a href="http://www.rackspace.co.uk/cloud-computing/vps" rel="nofollow">http://www.rackspace.co.uk/cloud-computing/vps</a></p>
<p>or</p>
<p><a href="https://www.greenhousedata.com/blog/whats-the-difference-between-vps-and-cloud-servers" rel="nofoll... |
Update Pandas Cells based on Column Values and Other Columns <p>I am looking to update many columns based on the values in one column; this is easy with a loop but takes far too long for my application when there are many columns and many rows. What is the most elegant way to get the desired counts for each letter?</p>... | <p>The most elegant is definitely the CountVectorizer from sklearn. </p>
<p>I'll show you how it works first, then I'll do everything in one line, so you can see how elegant it is. </p>
<h3>First, we'll do it step by step:</h3>
<p>let's create some data</p>
<pre><code>raw = ['ABC', 'AAA', 'BA', 'DD']
things = [lis... |
Removing last added Marker with number on .title <p>I immediately want to point out that I know such methods as setVisible () and remove (), but I do not know how to use them in this particular case. Well, in my application I add markers on the map in different places, which are numbered .titles and would like to make ... | <p>hold pointers to them then you will be able to remove them, here is sample:</p>
<pre><code>// Somewhere above:
private Marker mMyLocationMarker;
// Add marker with options
mMyLocationMarker = mGoogleMap.addMarker(options);
// And to remove:
mMyLocationMarker.remove();
</code></pre>
<p>need more markers? - hold p... |
Read many files from Kafka <p>I am reading 1 log file in Kafka, and creating a topic. This is succesful. To read this file, I am editing the file <em>config/connect-file-source.properties</em> to this purpose, and according to Step 7 of Kafka Quickstart (<a href="http://kafka.apache.org/quickstart#quickstart_kafkaconne... | <p>In <code>config/connect-file-source.properties</code>, </p>
<p>source class is <code>FileStreamSource</code> and it uses task class as <a href="https://github.com/apache/kafka/blob/41e676d29587042994a72baa5000a8861a075c8c/connect/file/src/main/java/org/apache/kafka/connect/file/FileStreamSourceTask.java#L79" rel="n... |
Python equivalent of SQL: SELECT w/ MAX() and GROUP BY <p>I have data like this:</p>
<pre><code>df = pd.DataFrame( {
'ID': [1,1,2,3,3,3,4],
'SOME_NUM': [8,10,2,4,0,5,1]
} );
df
ID SOME_NUM
0 1 8
1 1 10
2 2 2
3 3 4
4 3 0
5 3 5
6 4 1
</code></pre>
<p>And I want ... | <p>Seeing as how you are using Pandas... use the groupby functionality baked in</p>
<pre><code>df.groupby("ID").max()
</code></pre>
|
Remote build doesn't install dependencies using python 3.2 standard runtime <p>i'm uploading a worker to iron worker running Python 3.2 with in the standard environment, using my own http client directly (not the ruby or go cli) according to the REST API. However, despite having a .worker file along with my python scri... | <p>You should use the new Docker based workflow, then you can be sure you have the correct dependencies, and that everything is working, before uploading. </p>
<p><a href="https://github.com/iron-io/dockerworker/tree/master/python" rel="nofollow">https://github.com/iron-io/dockerworker/tree/master/python</a></p>
|
How to use browser.js to solve es6 class issue in IE 11 <p>I am using javascript classes and ran into the SCRIPT1002 issue in IE 11, where IE is unable to interpret the 'class' keyword that is available in es6. I have been reading that using babel is a way to work around this unfortunate issue. However, I am having iss... | <p>Don't even try to run babel in ie. It will be awfully slow. Use a compiler toolchain (babel) to create an offline build process, and serve the compiled files. It's true that all modern browsers understand the class keyword, but until you have to support at least one browser that doesn't, you will have to compile. Th... |
How to create one generic RewriteRule for these cases? <p>I have a lot of rules with the same structure as below.
Is there any way to have only one that will satisfy all of these cases?</p>
<pre><code>RewriteRule ^ecology/?$ /content.php?slug=ecology [NC,L]
RewriteRule ^vraveia/?$ /content.php?slug=vraveia [NC,L]
Rewr... | <p>Use:</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ /content.php?slug=$1 [NC,L]
</code></pre>
<p>This way, you avoid rewriting an existing file or directory</p>
<p>With -f you test for files, and with -d for directories. <a href="http://httpd.apache.org... |
Converting to non-scalar type <p>I have 2 structs of the same size, layout and alignment, but of different types. I would like to copy one onto the other.</p>
<pre><code>struct one s1;
struct two s2;
...
s1 = (struct one)s2; // error: conversion to non-scalar type requested
s1 = *((struct one*)&s2); // fine?
<... | <p>The second method is undefined behaviour due to violating the strict aliasing rule. Even though <code>struct one</code> and <code>struct two</code> have the same layout, it is not permitted to use an lvalue of type <code>struct one</code> to access an object of type <code>struct two</code> or vice versa. </p>
<p>In... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.