input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Handling empty files when concatenating files in bash <p>I have a number (say, 100) of CSV files, out of which some (say, 20) are empty (i.e., 0 bytes file). I would like to concatenate the files into one single CSV file (say, <code>assorted.csv</code>), with the following requirement met:</p>
<p>For each empty file, ... | <p>Just make a loop and detect if the file is not empty. If it's empty, just echo the file name+comma in it: that will create a near blank line. Otherwise, prefix each line with the file name+comma.</p>
<pre><code>#!/bin/bash
out=assorted.csv
# delete the file prior to doing concatenation
# or if ran twice it would ... |
Filter group of rows based on sum of values from different column in R <p>I'm trying to filter out whole rows in R, but only if the frequencies for a particular set don't add up to more than 5. </p>
<p>The data I have looks a bit like this. It's a dataframe that I'm currently calling "Words":</p>
<pre><code>HEADWORD ... | <p>We need to get the <code>sum</code> of 'FREQUENCY' and check whether it is greater than 5 in the <code>filter</code> after grouping by 'HEADWORD'</p>
<pre><code>Words1 %>%
group_by(HEADWORD) %>%
filter(sum(FREQUENCY) >5)
# HEADWORD VARIANT FREQUENCY
# <chr> <chr> <... |
Compare RegExp-string with special characters in PowerShell <p>it is needed to compare $string1 to certain string-template in PowerShell</p>
<pre><code>PS C:\ $string1 = '\\<a href="main\\.php\\?act=forum\\&hdl=read_\\&id=(\d+)\\&pid=313" class="small_name2"\\>Learn the powershell tool\\</a\\>'... | <p>The <code>-match</code> operator is not commutative, so you can't switch the operands. First operand must be the string you want to match against a regular expression, second operand must be the regular expression. Also, the double backslashes in your regular expression evaluate to literal backslashes instead of esc... |
Typeerror when using S3 and Carrierwave <p>I've been looking for hours but I can't resolve this problem.</p>
<p>Everything worked fine, until I had to update Carrierwave and use fog-aws gem.</p>
<p>I get the following error only in production when trying to upload an image:</p>
<pre><code>TypeError (no implicit conv... | <p>config.permissions takes an integer not a string. Change this: </p>
<pre><code>config.permissions = '0666'
</code></pre>
<p>to </p>
<pre><code>config.permissions = 0666
</code></pre>
<p>from <a href="https://github.com/carrierwaveuploader/carrierwave" rel="nofollow">https://github.com/carrierwaveuploader/carrie... |
Send String and NSData at the same time over peer to peer? <p>I am adding text fields which are of type (String) and an image which is of type (NSData) to a dictionary sending it to a peer, and on the other side it is decoding the dictionary in to a Strings with key value pairs. </p>
<p>The image data in the dictiona... | <p>You are currently converting the <code>NSData</code> to a String using the data's <code>description</code> method. Never do that.</p>
<p>A much better solution would be to simply put the data in the dictionary as-is since you are archiving the dictionary and sending the data. No need to convert the image data into ... |
Project Server connection on SQL Server <p>Is there any way to create a connection between Project Server and SQL Server?</p>
<p>We can create a connection with Excel by using an OData Data Feed, is there a way of doing something similar on SQL Server, like a specific linked server?</p>
| <p>Hy Matheus,</p>
<p>If I understand your question, you would like to connect to Project Server using SQL Server?</p>
<p>If this is it, you must be able to connect to the database where SharePoint points and check the Project Server database.</p>
<p>Try using Microsoft SQL Management Studio and connect to the SQL i... |
Is bind(this) necessary in Thinking in React tutorial example? <p>Within React's <a href="https://facebook.github.io/react/docs/thinking-in-react.html" rel="nofollow">Thinking in React</a> tutorial, in the creation of a ProductTable component, the table is initially created statically in part like this:</p>
<pre><code... | <p>That's beacuse <code>.forEach()</code> will have it's own context. So, if use use <code>this</code> within <code>forEach()</code> you may get unexpected error. </p>
<p>That's why you should <code>.bind()</code> the <code>forEach()</code> with the context of the component to use it's context within <code>forEach()</... |
asp.net - How to get content of dynamically changed div block <p>I am fairly new to asp.net and I am trying to get the content of a div block, that its content is is changed at run time. When user click on Button1 (asp:button) I would like it to retrieve the whole content (not just default content) of frm_div and displ... | <p>Add a hidden input and in func() populate the hidden input's value with the content.</p>
<pre><code>[... snip ...]
<asp:Hidden id="myhidden" runat="server" />
[... snip ...]
function func() {
document.getElementById('frm_div').innerHTML =
'<p>' +
document.getElementById('frm_div')... |
what is encrypted file size using elgamal cryptosystem? <p>What is the elgamal encrypted file size after encrypting, say, a 1mb file of normal text using elliptical curves?</p>
<p>I'm getting a 250mb encrypted file size? How much off is it from normal standards?</p>
| <p>You should <strong>not only</strong> use asymmetric encryption for any amount of bytes that can go over the size of the key, minus a certain minimum overhead. This overhead depends on the algorithm used, for instance RSA PKCS#1 padding overhead takes 11 bytes minimum and OAEP takes about 42 bytes minimum. If you dir... |
Where to go when Chrome Packaged Apps are no more <p>I have developed and regularly use a chrome packaged app (written in HTML,CSS,Javascript) that takes a set of local javascript files in a local folder on my machine and minifies them (as a group) and writes the new minified files (one per original source file) to my ... | <p>If you need to run on ChromeOS (Chromebooks, Chromeboxes, Chromebits) you need to keep your Chrome App (what they are called now), and Google has said they will maintain support.</p>
<p>Otherwise, I suggest moving to Electron, although NW.js is also an option. (I like Electron better, and have had great results.)</... |
golang viant dsunit testing config error <p>when trying to setup my Db using ds <a href="https://github.com/viant/dsunit" rel="nofollow">https://github.com/viant/dsunit</a>
I am using the following config </p>
<pre><code>{
"DatastoreConfigs": [
{
"Datastore": "db_test",
"AdminDbName": "mysql",
... | <p>I looks like you have case mismatch in your json config, </p>
<p>Schema<strong>URL</strong> vs Schema<strong>Url</strong></p>
<p>See TableDescriptor <a href="https://github.com/viant/dsc/blob/master/api.go" rel="nofollow">Api</a> for expected case format.</p>
|
how to make procedure to update in mysql <p>i want to make procedure in mysql ..
but i see 42000 error ..</p>
<p>i want to count(id) and update data.</p>
<p>// my source</p>
<pre><code>create or replace procedure Update_Sleepuser
(in_time TIMESTAMP)
IS
n_id INT;
count INT;
BEGIN
select u_id INTO n_id
fr... | <p>Lots of syntax errors - 1) Count is a reserved word change it to something like cnt 2) Is ? 3) local variables have to appear immediately after the begin statement and be preceded by a Declare statement 4) every sql statement has to be terminated by ; 5) -- is sql server syntax for a comment mysql equivalent is #.
I... |
Aggregrate character in R <p>Hi I have a list of header at below:</p>
<pre><code>> head(qu3)
fips SCC Pollutant Emissions type year
114288 24510 10100601 PM25-PRI 6.532 POINT 1999
> str(qu3)
'data.frame': 2096 obs. of 6 variables:
$ fips : chr
$ SCC : chr
$ Pollutant: chr ... | <p>First I agree on what Rohit Das wrote.</p>
<p>If you get the last error the first code should not have worked as well. </p>
<p>You need to specify the data to use, so it should look like this:</p>
<pre><code>qu2.aggreg <- aggregate(qu3$emission, by=list(qu3$year), sum)
</code></pre>
<p>The error for the lin... |
.libPaths() not changing <p>I have set R_LIBS in my .bash_profile to </p>
<pre><code>export R_LIBS=/lib/R-3.3.0
</code></pre>
<p>and when I <code>echo $R_LIBS</code>, it returns <code>/lib/R-3.3.0</code> but, when I start R and type <code>.libPaths()</code> I get <code>/Software/R</code>. </p>
<p>What is going wrong... | <p>You want <code>R_LIBS_USER</code>:</p>
<pre><code>$ Rscript -e 'print(.libPaths())'
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"
[3] "/usr/lib/R/library"
$ R_LIBS_USER="/tmp" Rscript -e 'print(.libPaths())'
[1] "/tmp" "/usr/local/lib/R/site-library"
[3]... |
How can I speed up my Xagent? <p>I am creating powerpoints files via Apache Poi in an XPages app. </p>
<p>On an xpage I have a repeat control, each row in the repeat displays a button which initiates an "xagent" that does the job (SSJS). </p>
<pre><code><xp:button id="button7" value="Download">
<xp:event... | <p>There are many many factors that determine the all over speed of an application. If you want to get to the bottom of total computation time, you need to look at each operation to get an idea.</p>
<p>There are quite some resources out there, for your convenience</p>
<ul>
<li><a href="https://www-10.lotus.com/ldd/dd... |
Is there any way to parse this soap response? <p><strong>My Code</strong></p>
<pre><code>protected void getComplaits(String Payroll_no) {
SoapObject request = new SoapObject(sd.NAMESPACE, sd.GET_COMPLAINTS_LIST);
PropertyInfo Payroll_info = new PropertyInfo();
Payroll_info.setName("Payroll_no");
Payrol... | <p><strong>I Found Out Solution after reading several post. Thank you , Stack overflow Members</strong></p>
<pre><code> try {
androidHttpTransport.call(sd.GET_COMPLAINTS_LIST_SOAP_ACTION, envelope);
SoapObject root = (SoapObject) envelope.bodyIn;
SoapObject t = (SoapObject)root.getProperty(0);
... |
Why and when should we use asynchronous messaging like JMS or AMQP? <p>Conceptually speaking, when should we use asynchronous messaging ? And why? Couldn't we store message contents to some DB Store and evetually running a scheduled job in order to process those messages ?</p>
<p>Using JMS or AMQP, for example, brings... | <p>Shortly, yes, you can use DB instead if it fits your needs by speed and other resources like (CPU/RAM). As any specialized solution, JMS allows you to maximally effictively solve the specific class of tasks - asyncronous messaging. </p>
<p>Also, for example, using JMS you can have some sort of scalability solutions... |
Airflow DB session not providing any environement vabiable <p>As an Airflow and Python newbie, even don't know if I'm asking the right question, but asking anyway.
I've configured airflow on a CentOS system. Use remote MySql instance as the backend. In my code, need to get a number of Variables, the code looks like be... | <p>Ok, finally got the problem resolved. What I've done is print out the query, and figured out the variable must be from some relational database table called variable. And dig into the backend DB, found the DB, made the comparation between it and the working one, and figured out that the "variable" table data missed.... |
How to use SQL variable to iterate XML nodes <p>I have this XML in SQL Server 2008:</p>
<pre><code>DECLARE @xml xml = '<Root>
<Contacts>
<Contact name="John Doe" type="REG" other="value" />
<Contact name="Jane Doe" type="REG" ot... | <p>Your own code would work with just one more <code>[1]</code>. The function <code>.modify()</code> cannot interpret the <code>[sql:variable(...)]</code>... This might be any filter, even one with more than one result... So just change this to:</p>
<pre><code>DECLARE @xml xml = '<Root>
<... |
Code to position instantiated UI prefab based on screen size? <p>I am struggling with this situation on how to position a instantiated prefab based on the screen size, my following code is this :=</p>
<pre><code>using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class UPStand : MonoBehaviour
{... | <p>Select your canvas and in the inspector choose scale with screen size and put in the highest resolution you want for your game , always base your GUI on it and dont use free aspect in the game view always use the resolution you want to see , but still try changing changing the pivots manually by dragging them to th... |
Why are certain characters not being injected correctly to SQL Server from a CFQUERY? <p>I have a Coldfusion app running on Lucee which connects to a SQL Server database.</p>
<p>When I run the following query directly in SQL Server Manager:</p>
<pre><code>UPDATE article
SET content='20m²'
WHERE id=3159
</code></pre>... | <p>If it's hard coded, I believe you'll want to make sure you save that file in Unicode UTF-8.</p>
<p><a href="http://i.stack.imgur.com/9BCCW.png" rel="nofollow"><img src="http://i.stack.imgur.com/9BCCW.png" alt="enter image description here"></a></p>
<p>Also make sure your JVM arguments will process that as well.
Ad... |
Transform from interval " 1:05:04" to HH:MM format Informix 11.50 <p>I have a column <em>acdtime</em> that gives me the time on a call in <strong>seconds</strong>. I need to transform those fields to <em>HH:MM</em> format.</p>
<p>My idea is first to convert the seconds to interval using 3904 as parameter:</p>
<blockq... | <p>Unless you have a very archaic version of Informix, what you want is the <code>TO_CHAR()</code> function, but you need a DATETIME value as the base, not an interval:</p>
<pre><code>TO_CHAR(TODAY::DATETIME YEAR TO SECOND + 3904 UNITS SECOND, '%H:%M')
</code></pre>
<p>... which will produce:</p>
<pre><code>(express... |
angularjs routing template not working <p>below code works fine in stackoverflow console, but not on my browser.
BAsicall ngRoute not working for me.Appreciate your help. New to angularJS.</p>
<pre><code><!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.m... | <p>You need to enclose the templates with quotes,</p>
<pre><code>var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
template :"<h1>Main</h1><p>Click on the links to change this content</p>"
})
.when("/banana"... |
HTTPPost with multiple params in body <p>I'm kinnda newbie at android, so i need your help, guys.
I'm developing an android application which needs a connection to an api.</p>
<p>First time the user logs in, using <code>api/login</code> url. The post method needs to have <code>X-Requested-With : XMLHttpRequest</code> ... | <p>Try with <a href="https://square.github.io/retrofit/" rel="nofollow">retrofit</a>. Here you can handle all HTTP client related code from Android and Java to consume the API. </p>
|
How to make a custom function available to all Codeception tests <p>I'm working on some Codeception acceptance tests, and one thing that I want to check is whether or not my application's e-mails are being sent with the correct text.</p>
<p>In order to do that, I'm comparing the actually <em>sent</em> text with a txt ... | <p>Make it a helper method.</p>
<ol>
<li>Create new helper: <code>codecept generate:helper Utf8</code></li>
<li>Add your method to <code>tests/_support/Helper/Utf8.php</code></li>
<li>Enable helper in each suite:
<code>
modules:
enabled:
- \Helper\Utf8
</code></li>
</ol>
<p>Documentation: <a href="http://codece... |
strange behavior of POSIX date-times <p>This behavior of POSIX objects baffles me. I make two POSIX date-time vectors, one POSIXct and other POSIXlt, that have the same dates and times. They are identical by <code>==</code> but not by <code>%in%</code> as seen in the following.</p>
<pre><code>d.ch = c("2016-09-26 0:00... | <p>It all works if you just convert the <code>strptime()</code> result to <code>POSIXct</code>.</p>
<p>Or if you use <code>anytime()</code> which creates <code>POSIXct</code> by default too:</p>
<pre><code>R> library(anytime)
R> d1 <- anytime(c("2016-09-26 00:00:00", "2016-09-26 01:00:00",
+ "2016-09-26 02... |
Matlab colorbar indicator which dynamical change <p>Running the next code I get a black bar in the colorbar that change in every loop. </p>
<p>If I change the limits, from 200 to 2000, and run for <code>y= x.^2 +10*i +1000</code>, 2nd version, then the bar sometimes appears , others not. Is anyone knows why? and how c... | <p>Here is an idea of how to implement @Suever suggestion in the comments:</p>
<pre><code>x = 1:10;
cb_width = 0.04;
c = sum(jet(4000),2);
c = c(1:2000);
h = imagesc(c);
h.Parent.Position(1) = 1-cb_width-0.07;
h.Parent.Position(3) = cb_width;
h.Parent.YAxisLocation = 'right';
h.Parent.XAxis.Visible = 'off';
axis xy
bo... |
Excel Screen Updating to False Using ExcelDna <p>I am trying to set Excel Screen Updating to false using ExcelDna. I do not want to use COM. Using its XlCall is preferred. Can someone help?</p>
| <p>You can use <code>XlCall.xlcEcho</code> to enable/disable screen updating. E.g.:</p>
<pre><code>// Disable screen updating
XlCall.Excel(XlCall.xlcEcho, false);
// Enable screen updating
XlCall.Excel(XlCall.xlcEcho, true);
</code></pre>
|
How to stop the flat file disassembler debatching <p>I have a flat file input that looks like this:</p>
<pre><code>D1~0000002~917~NEGS515968~NEFS1606091~09062016~Some Random Company ~33330~
D2~0000003~NEFS1606091~1~~~0~0~NEGS~AC40010~54110~C90~0000~00~0000~33330~EXEMPT~0~~~~~~~~~~~
D1~0000004~2112~NEGS518497~NEFS16060... | <p>Your issue is that you have defined the repeat (maxoccurs) on the DataRecType1 & DataRecType2 and as part of a <strong>Sequence</strong>, which means it expects 1 to many of DataRecType1 and then 1 to many of DataRecType2.</p>
<p>e.g.</p>
<pre><code>D1~0000002~917~NEGS515968~NEFS1606091~09062016~Some Random Co... |
REST - post to get data. How else can this be done? <p>According to my understandings, you should not post to get data.
For example, I'm on a project and we are posting to get data.</p>
<p>For example, this following. </p>
<pre><code>{
"zipCOde":"85022",
"city":"PHOENIX"
"country":"US"
"products":[
... | <p>One potential option is to JSON.serialize your object and send it as a query string parameter on the GET.</p>
|
Using Ada to Read and write to a file (parse data for processing) <p>For those who know about Ada programming, what is a good way to bring data from a file into this program so it can be used in this algorithm?</p>
<p>Using Ada I am trying figure out how to read a series of matrix connection data grids from a file the... | <p>I am not sure what your question is, but I sense some confusion about not only I/O but also constrained arrays vs unconstrained arrays, representation of boolean values, and possibly the use of binary I/O vs text I/O. If you have labels for rows and columns, are they randomly assigned, or are the rows conceptually f... |
Unable to clear snapshot using Nodetool. Snapshot is never deleted <p>When I run nodetool clearsnapshot I get the normal "Requested clearing snapshot(s)" message, but the snapshot is never removed. What can I do to troubleshoot why this is occurring? Is it acceptable for me to just manually remove the snapshot direct... | <blockquote>
<p>Is it acceptable for me to just manually remove the snapshot directories from the tablespace directories as a workaround for this?</p>
</blockquote>
<p>Yes, you can always safely remove the snapshots directories manually. They are just hard links to actual SSTables</p>
|
Is it possible to do a elastic dump with a lambda task in AWS? <p>I need to do a elastic dump every week. I think that i could create a lambda function do that job but I don't know how to setup <a href="https://www.npmjs.com/package/elasticdump" rel="nofollow">elasticdump</a> there. is it possible? </p>
<p>Thanks!</p>... | <p>I believe that your options are the below:</p>
<ol>
<li>Use the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html" rel="nofollow">snapshot api</a>. Read carefully the documentation so you know exactly what you are saving. It's not only data. After that you can use the <... |
How do I make a minimum number of <tr> from an @foreach? <p>I have a data set that I need to output to a pdf. I am building the pdf in a view and then using dompdf to generate. I am trying to get the pdf to resemble a printed form used for the same data. I'd like to run one @foreach to create the table rows but have... | <p>If you know the number of rows beforehand, one option would be to craft the array properly and then send it to the view.</p>
<pre><code>// Assuming that $arr is your array of objects
if(sizeof($arr) < 15) {
for($i=0; $i < (15-sizeof($arr)); $i++) {
$arr[] = new YourObject;
}
}
// Then return ... |
Update set of fields in django model passed in request.POST <p>This is my Model class</p>
<pre><code>class SubJobs(models.Model):
id = models.AutoField(primary_key = True)
subjob_name = models.CharField(max_length=32,help_text="Enter subjob name")
subjobtype = models.ForeignKey(SubjobType)
jobstatus = ... | <p>You'd better use Forms. But if you insist on your code it could be done like this.</p>
<p>Suppose you have variable <code>field_to_update</code> where every field that you are waiting in request is listed.</p>
<pre><code>subjobs_subjobid = request.POST[('subjob_id')]
field_to_update = ('subjob_name','subjob_type'... |
JDeveloper 12.2.1.1 doesn't work in MacOS Sierra <p>Seems like JDeveloper doesn't work with macOS Sierra. I tried to reinstall, it didn't help. It just doesn't launch.
Is there some walkaround to solve the problem?
I tried also 12.2.1.0 version. The result is the same.</p>
<p>Upd. Setting Java home in product.conf doe... | <p>Which Java version do you have installed (java -version)?
Try removing the systemxxx directory (usually under .jdeveloper directory) and restarting JDeveloper.</p>
<p>Works for me fine on El Capitan</p>
|
What symbol table can I use to store ~50 mil strings with fast lookup without running out of heap space? <p>I have a file of ~50 million strings that I need to add to a symbol table of some sort on startup, then search several times with reasonable speed.</p>
<p>I tried using a DLB trie since lookup would be relativel... | <p>If you expect low prefix sharing, then a trie may not be your best option.</p>
<p>Since you only load the lookup table once, at startup, and your goal is low memory footprint with "reasonable speed" for lookup, your best option is likely a sorted array and binary search for lookup.</p>
<p>First, you load the data ... |
Editing a shapefile uploaded using leaflet.shapefile <p>I'm using Mapbox with Leaflet for drawing, editing and removing polygons etc. There might also be a case in which the user might have zipped shapefiles and want to use that directly, instead of drawing the polygons. So I'm using <a href="https://github.com/calvinm... | <p>When you do <code>var layergeojson = layer.toGeoJSON()</code>, the <code>layergeojson</code> now contains a plain GeoJSON object, not a Leaflet layer.</p>
<p>Therefore, <code>featureGroup.addLayer(layergeojson)</code> should throw an error (open your browser console). Instead, you should probably use the <a href="h... |
How to send information about mobile platform to sever <p>I'm designing api for mobile clients and I have few request (about 3 from 40 endpoints) that need to be handle differently according to the client platform eg: <code>ios</code> and <code>android</code>.</p>
<p>At first I wanted to add extra parameter to those e... | <p>Use the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent" rel="nofollow">User-Agent</a> header. It should contain enough information for you to identify the mobile operating system. </p>
|
When to use special sequences \b \f and \r in JavaScript <p>I know how <code>\n</code> works but I have trouble to understand these three special sequences in javascript<br>
- \b (backspace)<br>
- \f (form feed)<br>
- \r (carriage return)<br>
For example for two first sequences I get as output a string with a "strange"... | <p>These ASCII control characters have a long historical legacy that is probably a bit off topic for this question, but it's important to understand that they have slightly different meanings or sometimes <em>no</em> meaning in different contexts.</p>
<p><code>\b</code> - One thing to keep in mind is that characters a... |
Display two images in one slideshow using php <p>I am working on an application where i have a slider made in bootstrap but in slider there are two images in one slide show instead of one, so i have wrote a simple select query to get record but the problem is that it showing same images on boxes, i dont know how i can ... | <p>try this: </p>
<pre><code> <div class="carousel-inner">
<?php if($blog) : $counter = 0; foreach($blog as $blogs) : $counter++; ?>
<?php if($counter === 1) : ?>
<div class="item active">
<?php else : ?>
<div class="item">
<?php endif; ?>
<div class="row">
... |
Scala: Generic Implicit class <p>I'm trying to catch the Type from the class I'm implicitly inferring:</p>
<pre><code>case class ToGet(key: String)
class Builder[T <: AnyRef] {
def get(key: String)(implicit mf: Manifest[T]): ToGet = {
ToGet(key)
}
}
object Builder {
import scala.reflect.runtime.univer... | <p><code>obj.get("myKey")</code> returns a <code>ToGet</code>. At this point, the manifest was provided and ignored. All we have now is a <code>ToGet</code>.</p>
<p>Now the <code>future</code> call pimped on the <code>ToGet</code> has no type information it can use, so it infers <code>Nothing</code>.</p>
<p>Depending... |
Ionic tap pushnotification not redirecting ios10 <p>Made an app using ionic and published on app store. When ever app receives notification and user taps on it , User profile settings view is opened. It is working fine on ios 9 but on ios 10 after clicking on notification . App showing home view(1st screen) not redire... | <p>Need to do two thing to get push notification work again in iOS 10.<br>
1) Enable push notification in xCode 8 GM capabilities in targets.<br>
2) Update your existing ionic plugin to support push notification for iOS 10 and re submit app to app store.</p>
<p>Adding push notifications capability does 2 things<br>
1)... |
using google map plugin with cordova show blank map <p>I want to use google map plugin in my cordova app. I Create Successfully my sha1 key with following command:</p>
<blockquote>
<p>keytool -exportcert -alias androiddebugkey -keystore C:\Users\Morsali.android\debug.keystore -list -v</p>
</blockquote>
<p>and I cre... | <p>Cordova does a lot of rendering in WebViews instead of natively in Android's View API. Your API key you generated is strictly for "Android apps". Since you are not using the Android Google Maps API, I suggest you try restricting your key to "HTTP referrers" or even testing with "None"</p>
|
Why does the loop ignore multiples of five? <p>I've just started learning Java, so my question is probably incredibly stupid.</p>
<p>I'm trying to solve one of the simpliest problems.</p>
<blockquote>
<p>Modify the previous program such that only multiples of three or five
are considered in the sum, e.g. 3, 5, 6,... | <p>The problem here is the <code>else</code> statement, which will add one to "i" if it's not divisble by <code>3</code> or <code>5</code>. Now, let's see what your method does if <code>n = 5</code>. First, the for loop runs with <code>0</code>, which is divisble by <code>5</code> and <code>3</code>, so the <code>for</... |
Security using AJAX and set innerHTML? <p>Consider the following circumstances:</p>
<ul>
<li>I send an AJAX request (no user input) to PHP which starts a function.</li>
<li>The function returns a string of raw HTML. Could be anything - a list of links, a bunch of empty divs, SVGs to insert inline, most of a page... No... | <p>As long as the response is truly static and does not involve user input <em>of any kind</em>, this is fine. AJAX itself (as you hinted) does not make it vulnerable to XSS (as long as transport is secure, which practically means https).</p>
<p>One caveat (not necessarily in your case, but in general) could be what y... |
How can I flip an image using a nested for loop? <p>I want to make a program that uses x and y counter variables to read pixels from the bottom right corner all the way to the top left corner from an image. The program would assign the bottom right pixel to the top left and would assign every pixel in this way which wo... | <p>This should do it:</p>
<pre><code>for(int x = 0; x < width; y++){
for(int y = 0; y < height; y++){
flipped.setPixel(width - 1 - x, height - 1 - y, original.getPixel(x,y));
}
}
</code></pre>
|
AEM6 starting from console with -debug -nofork options <p>As I know when AEM is started in debug mode from the console using the <strong>-debug</strong> option, the JVM will be forced to fork, but what will be the result if the AEM is started with the <strong>-debug -nofork</strong> options? e.g:</p>
<p><strong><em>ja... | <p>Fork or nofork does not matter. aem6 will decide based on the available memory. if you want to debug, using following command</p>
<p>java.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9669,suspend=n -XX:+PrintGC -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -jar aem-quickstart-6.2.1.jar</p>
<p>then in intellj... |
iOS: log to file any crashing exception <p>Any of you knows how can I log any crash exception from iOS app?.</p>
<p>I forcing a crash on my viewController:</p>
<pre><code>- (void)viewDidLoad {
[super viewDidLoad];
NSArray *myArray = [NSArray new];
NSLog(@"%@", [myArray objectAtIndex:0]);
}
</code></pre>
... | <p>Are you actually setting the exception handler using
<code>NSSetUncaughtExceptionHandler</code>?</p>
<p>Something like:</p>
<p><code>NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);</code></p>
<p><a href="https://developer.apple.com/reference/foundation/1409609-nssetuncaughtexceptionhandler" rel="nof... |
Move QUERY Function from Google Sheets to Excel <p>I am trying to move my Google Sheets spreadsheet to excel. Is there a way to replace the following:
<code>=QUERY(A:B,"select B, max(A) where not A is null group by B label B 'Name', max(A) 'Most Recent'")</code></p>
| <p>Your request is not accomplished by the current 2016 version of excel. </p>
<p>I think, there's a reason why Microsoft doesn't provide auto-comleted formulas into excel. The excel sheet is huge and contains more then a million of rows, so it will stuck trying to autofill formulas. Google sheets is a lighter version... |
Namespace Conflict in swift with cocoa pod module <p>I have an enum in one of my Swift files called <code>Foo</code>.
One of the Cocoapods called <code>NameA</code> also has the same enum with name <code>Foo</code> (<code>public enum</code>, not inside any class).
This module also has a class with the same name as it... | <p>I ran into a similar issue recently. You won't like the solution I found, but I'll share it anyway. I had to fork the pod I was using and rename it to something new. The new project name no longer conflicted with the class name and I was able to namespace it as <code>MyForkedName.ClassName</code>. This is really an ... |
Failed to get driver instance <p>I'm new to Spring (Boot) and trying to get a pooled database connection to a HSQLDB server.</p>
<p>pom.xml</p>
<pre><code><parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1... | <p>Your URL seems wrong. As far as I remember, it should be:</p>
<pre><code>jdbc:hsqldb:hsql://localhost:9001/devel
</code></pre>
<p>And also, you didn't provide driver class name (<code>org.hsqldb.jdbc.JDBCDriver</code>).</p>
<pre><code>config.setDriverClassName("org.hsqldb.jdbc.JDBCDriver");
</code></pre>
<p>If y... |
How do I display a saved treemap object? MWE included? <p>This may be a silly question but does anyone know how to display a treemap object after it's generated in R? Consider the code below:</p>
<pre><code>loadpackages <-function(package.list = c("ggplot2", "Rcpp")) {new.packages <-package.list[!(package.list %... | <p>Looking at the source code it does not appear to store enough information to allow re-drawing. The <code>treemap()</code> is meant to be called for it's plotting side effects. Given that, I have no idea why they have a <code>draw=FALSE</code> option if there is no way to plot it later.</p>
<p>Even though the offici... |
Call a javascript function when form is not valid <p>I have experience with web frameworks for PHP (Laravel) and Python (Django).
But I'm lost with C# and ASP.NET!</p>
<p>I'm trying to make a login page with ASP.NET core and C#.
Using an example, I have a login form, with username and password input fields:</p>
<pre>... | <p>In case you need to get the value in razor:</p>
<p>You can remove the validation summary tag:</p>
<pre><code>@*<div asp-validation-summary="All" class="text-danger"></div>*@
</code></pre>
<p>Render this inside the form:</p>
<pre><code>@if (ViewData.ModelState.Any(x => x.Key == string.Empty))
... |
Css + jQuery dropdown submenu overflow <p>I have a css menu as shown in the picture:
<a href="http://i.stack.imgur.com/cJMge.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/cJMge.jpg" alt="enter image description here"></a></p>
<p>When I put the mouse over "Haschildren" I obtain:
<a href="http://i.stack.imgur.c... | <p>You can make your <code>.has-children</code> li parent relative and make the <code>.submenu</code> absolute. You can then position the submenu with <code>top, left</code> etc. properties to fit your design</p>
|
Trouble when trying to create a database with Entity Framework and migrations <p>I want to create database EF migrations via the developer command prompt for VS2015. When I try to use this command line:</p>
<pre><code>dotnet ef migrations add v1
</code></pre>
<p>I get this error:</p>
<blockquote>
<p>The property '... | <p>The problem here is how you are defining the primary key for the PartCategoryPart intermediate entity. You are using the navigation properties to define the PK and you have to use the FKs like this:</p>
<blockquote>
<p>modelBuilder.Entity().HasKey(t => new { t.PartCategoryId, t.PartId});</p>
</blockquote>
|
How to match an entity to a defined list of words in LUIS <p>I'm using <a href="https://www.microsoft.com/cognitive-services/en-us/language-understanding-intelligent-service-luis" rel="nofollow">LUIS</a> to work with the <a href="https://www.microsoft.com/cognitive-services/en-us/emotion-api" rel="nofollow">Cognitive S... | <p>I'm not entirely sure what your scenario is, so my answer may be a bit off. </p>
<p>From your description, I understand you want to create a mapping between entity types and the Emotion API's emotion categories. What I would do is create 8 different entity types in LUIS, e.g Emotion_Anger, Emotion_Sadness etc. and ... |
Gradle build failed - illegal character '\u0094' <p>I've encoutered an error while trying to build the Android project using Gradle. I added the API Key of OpenWeatherAPI to the gradle.properties (copied from their site) and the following code to build.gradle:</p>
<pre><code>buildTypes.each {
it.buildConfigFie... | <p>Found the solution. In my gradle.properties file, the APIKey provided by me was in format:</p>
<pre><code>MyOpenWeatherMapApiKey=âmyapiâ
</code></pre>
<p>Instead of:</p>
<pre><code>MyOpenWeatherMapApiKey="myapi"
</code></pre>
<p>Don't ask me how. Thanks for the tip regarding cancel character, zgc7009.</p>
|
Indirection through ESI and Pointers <p>I am new to the assembly programming(x86 asm with MASM) and was learning about indirection supported by the <strong>ESI</strong> register you just need to place the address into the <strong>ESI</strong> and then use indirection operator and you would be able to access the pointed... | <p>This is a quirk of the MASM syntax. The <code>[</code>...<code>]</code> is auto-inserted around memory address labels. In other words</p>
<pre><code>mov eax, [ptr4]
</code></pre>
<p>means "Load 4 bytes at the address <code>ptr4</code> into the <code>eax</code> register." But <code>ptr4</code> is the label for a me... |
Unable to implement both OnCardClickListener and OnLongCardClickListener on Cards from CardsLib <p>I'm using Cards from the CardsLib library inside a CardGridView. I'm able to catch single clicks OR long clicks when implementing one of the listeners, but I'm unable to implement both.
Like for regulars views, I'm return... | <p>try this ,</p>
<pre><code> myCard.setOnLongClickListener(this);
public void onClick(View view) {
}
</code></pre>
|
Firebase get child ID swift ios <p>My Firebase looks like this. Bellow <code>Active_Orders</code> it appear <code>childs</code> with different names depending on their <code>UID</code>(user ID).</p>
<p><a href="http://i.stack.imgur.com/FjfaQ.png" rel="nofollow"><img src="http://i.stack.imgur.com/FjfaQ.png" alt=""></a>... | <p>It is hard to tell from your question exactly what you are doing, but does this get you the list you need?</p>
<pre><code>databaseRef.child("Active_Orders").observeEventOfType(.Value, withBlock: { (snapshot) in
if let result = snapshot.children.allObjects as? [FIRDataSnapshot] {
for child in result {
... |
Aligning text to bottom of justified tabs (Bootstrap 3.3.6) <p>I have a working set of justified bootstrap tabs (Bootstrap 3.3.6). I need to vertically align the text along the bottom of the tabs.</p>
<p><a href="http://www.bootply.com/l7byiP8RsS" rel="nofollow">http://www.bootply.com/l7byiP8RsS</a> </p>
<p>I've tri... | <p>Try adding this </p>
<pre><code>display: table-cell;
vertical-align: bottom;
</code></pre>
<p>to your</p>
<p>.nav-tabs>li>a </p>
<p>is this what you wanted?</p>
|
Cant create file via suitescript 2.0 <p>I'm trying to create a file via a restlet with code such as:</p>
<pre><code> /**
*@NApiVersion 2.x
*@NScriptType Restlet
*/
define(['N/file'], function (file) {
var fileRequest = {
name: 'test' + '.txt',
fileType: file.Type.PLAINTEXT,
contents: 'te... | <p>With SuiteScript 2.0, you need to have a JSDoc comment block at the top of the file.</p>
<p>It looks like you're trying to create a custom module so at a minimum you will need: </p>
<pre><code>/**
* @NAPIVersion 2.0
* @NModuleScope Public
*/
</code></pre>
<p>If you're trying to create a script for one of the... |
Installing Firebase Pods to my project and getting a terminal error <p>Programming Novice here, I hope you all are having a good Monday. I've been trying to install these pods to my project and I keep getting an error. It was telling me this...</p>
<p>[!] Your Podfile has had smart quotes sanitised. To avoid issues in... | <p>The <code>pod</code> command is lowercase. Try changing <code>Pod</code> to <code>pod</code> inside your <code>Podfile</code>.</p>
|
Outlook Save multiple attachments using the subject line, and incrementing that name <p>I've spent a couple of weeks playing with VBA, I am not by any means an expert on this. </p>
<p>What I'm looking for is a modification of this code.</p>
<pre><code>Public Sub SaveAttachments()
Dim objOL As Outlook.Application
Dim ... | <p>You are not changing the filename within the loop. Something like</p>
<pre><code>strFileName = objSubject & "(" & i & ").pdf"
</code></pre>
<p>should take care of that.</p>
<p>If you only want numbers if there is more than one attachment you can check lngCount before setting the name or use <code>IIf<... |
Flexbox align-items not working <p>So I am facing a little issue where the pictures aren't moving according to the <code>align-items</code> property in flexbox and I'm not sure why.</p>
<p>They just act as if I've applied <code>align-items: flex-start</code>, when I've set the width of my elements as <strong>35%</stro... | <p>There's no such thing as <code>align-items: space-around</code>.</p>
<p>You need <code>align-content: space-around</code>.</p>
<p><code>align-items</code> applies primarily to a single-line in a flex container (<code>flex-wrap: nowrap</code>).</p>
<p><code>align-content</code> applies to a multi-line flex contain... |
Row span is not working as i expected <p>I want to achieve this:
<a href="http://i.stack.imgur.com/xmwqo.png" rel="nofollow"><img src="http://i.stack.imgur.com/xmwqo.png" alt="enter image description here"></a></p>
<p>and I did these with <code><td></code> tag but only col span is working correctly</p>
<pre><co... | <p>The purpose of rowspan is to span existing rows, like you are spanning existing columns in your example.</p>
<p>If you will add some rows below, you will see it.</p>
<pre><code><tr>
<td colspan="4" rowspan="4">&nbsp;</td>
</tr>
<tr style='height:20px;'></tr>
<tr style... |
Multiple push errors w/ git <p>Getting several errors while trying to do a push.</p>
<p><strong>Notes & attempted fixes</strong>: </p>
<ul>
<li>I've updated to the latest git (2.10.0)</li>
<li>I've increased my <a href="http://stackoverflow.com/questions/2702731/git-fails-when-pushing-commit-to-github">buffer si... | <p>I ended up creating an empty folder, pulling down my remote repository and then copy/pasted the local files from the previous folder (except for /.git/) into the new local repository.</p>
<p>It recognized my changes and I was able to push them just fine.</p>
|
Change tab content using router <p>I am making a react application. Can I change the "tab content area" on a button click using react-router. I have two tabs. I want to change content of one of the tab when I click a button. Everything else on the page should remain same but the content of the tab. How can I do this?</... | <p>I am not very knowledgeable on react-router but I would recommend using <a href="http://www.material-ui.com/#/components/tabs" rel="nofollow">material-ui</a>. It's very neat and extremely easy to implement (albeit, there are some <a href="http://stackoverflow.com/questions/36953711/i-cannot-use-material-ui-component... |
Permissions issue in SQL Server 2016 and R <p>Weâre very experienced with SQL Server as well as R (as a standalone product). Weâve setup SQL Server 2016 test server (production version from MSDN) with R also installed. The machine works fine, and weâve tried some rudimentary R, and that works fine as well (which ... | <p>SQL Server R Services always runs the scripts in the context of worker accounts that are local to the system, for security and isolation purposes. And it is not possible to run them in the AD user context.</p>
|
Implementing Receipt Validation in Swift 3 <p>I am developing an iOS app in Swift 3 and trying to implement receipt validation following this tutorial: <a href="http://savvyapps.com/blog/how-setup-test-auto-renewable-subscription-ios-app" rel="nofollow">http://savvyapps.com/blog/how-setup-test-auto-renewable-subscripti... | <p>Eventually I was able to solve the problem by having my app call a Lambda function written in Python, as shown in <a href="http://stackoverflow.com/questions/39757852/ios-receipt-validation-through-node-js-using-lambda?noredirect=1#comment66811789_39757852">this</a> answer. I'm still not sure what was wrong with my ... |
python add array of hours to datetime <p>import timedelta as td
I have a date time and I want to add an array of hours to it. </p>
<p>i.e. </p>
<pre><code>Date[0]
datetime.datetime(2011, 1, 1, 0, 0)
Date[0] + td(hours=9)
datetime.datetime(2011, 1, 1, 9, 0)
hrs = [1,2,3,4]
Date[0] + td(hours=hrs)
</code></pre>
<p>B... | <p>Use a nested <em>list comprehension</em> and <a href="https://docs.python.org/2/library/datetime.html#datetime.datetime.replace" rel="nofollow"><code>.replace()</code> method</a>. Sample for a list with 2 datetimes:</p>
<pre><code>In [1]: from datetime import datetime
In [2]: l = [datetime(2011, 1, 1, 0, 0), datet... |
Encryption and decryption with ASCII in C++ <p>As I am new to coding c++ and am taking a object oriented class, I need some help. For this code I want to encrypt it by shifting all of the text that is enter by 1 ascii digit i.e. a -> b, b-> etc. I am suppose to use all ascii values 32 - 126 but I cant figure out why wh... | <p>I did something similar to this in my level one programming class last year. We created a Vigenere Cipher that is based off of the architecture of the Cesar cipher.
Something that is useful is to first create a 0 base, i.e. if you are working with values a through b, subtract a from each of the characters that you a... |
My JS function keeps getting "Uncaught ReferenceError: ... is not defined" even when wrappred into (document).ready <p>I'm trying to show the selected option on a select input type in an HTML form.</p>
<h2>This is my input type:</h2>
<pre><code> <div id="selectorTemaMensaje" class="form-group"><la... | <p><code>opcionesMensaje</code> is not scoped properly. It's scoped within the anonymous function passed into <code>$(document).ready</code>. It shouldn't be accessible at that level unless you attach it to the <code>window</code> global object. Try something like <code>window.opcionesMensaje = function() { ... }</code... |
URL works until I set it to process.env.MONGOLAB_URI via command line <p>I've been experimenting with the API of flickr and am looking to deploy the application to Heroku now that I am finished. In order to do this, since I'm using MongoDB, I'm trying to get it to run with mLab. I can log into the shell just fine, I ... | <p>Heroku uses <code>MONGODB_URI</code>, but you have <code>MONGOLAB_URI</code>. </p>
<p>This could explain why the string works but the environment variable doesn't.</p>
<p>Try typing this in your shell: <code>heroku config</code> </p>
<p>Find the heroku config variable. I would venture to guess it is <code>MONGODB... |
VARMA from the MTS package <p>I am learning about the VARMA model from the MTS package. I am applying the function on one of the dataset "ibmspko" that I got from <code>data("mts-examples", package="MTS")</code>. When I applied the function, I'm getting the below error</p>
<blockquote>
<p>Error in solve.default(xpx,... | <p>If you ran the following:</p>
<pre><code>library(MTS)
data("mts-examples",package="MTS")
VARMA(ibmspko)
</code></pre>
<p>You received an error because <code>ibmspko</code> has dates in its first column, and this results in a near perfect linear dependence in a certain matrix which should be invertible, but sudde... |
How Can I check if $property exist in a list @properties in msbuild <p>I have a list of properties that return some list of strings value v1;v2;V3. I have property that contain a string value and I need to check if this value contain in the list of string, if the value exist return an error</p>
<pre><code><Error Co... | <p>I was able to solve it myself </p>
<pre><code><Error Condition="%(ListOfValues.Identity)== $(property)" Text="This Value already exists!"/>
</code></pre>
|
google foobar challenge error with dfs solution <p>I received the invite to attened google code challenge. I got a problem like find the minimun path in the maze while you are allow to remove at most one wall. I submit my code and only got <code>400 bad request</code>. I am a bit confused about this because I do not kn... | <p>Excuse me for asking, but how did you get the invite ? </p>
<p>Had one when everyone noticed it (when the impossible game came out), but didn't solved all the challenges in time, and I just get invitation expired.</p>
<p>And someone on stack overflow actually came into the same issue, altho don't know if figured i... |
Why isn't my radio button list working anymore? (After styling with CSS) <p>I created a simple postage calculator in Visual Studio with Web Forms (I know, I know, we had to use Web Forms in Class) using C#. I used some Bootstrap while styling , and at some point, my RadioButtonList stopped working. None of the radio bu... | <p>The div with the ID boxiediv is covering your whole page by the looks of it, which is blocking the rest of your components. I bet your radio button will work if you comment out that div.</p>
<p>I'm not sure how you want it to look, you may need to use a z-index to move it behind or potentially play around with the ... |
How can I export dual model from Cplex using java? <p>I know that we can export the model formulation from cplex in java using exportmodel. But can we do the same for dual formulation?</p>
<p>Thanks.</p>
| <p>Using the <a href="http://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.3/ilog.odms.cplex.help/CPLEX/homepages/interactiveoptimizercommands.html" rel="nofollow">interactive</a>, you can export to the <a href="https://www.ibm.com/support/knowledgecenter/SS9UKU_12.5.0/com.ibm.cplex.zos.help/FileFormats/topics/brief_... |
Understanding how Flexbox works with Bootstrap <p>I have the following HTML and CSS layout:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>html {
position: relative;
... | <p>you need to give <code>flex:1</code> to <code>.row</code> which it shorthand for <code>flex-grow</code>, <code>flex-shrink</code> and <code>flex-basis</code> combined. Default is <code>0 1 auto</code>, using <code>flex:1</code> means it will be <code>1 1 0</code></p>
<p><div class="snippet" data-lang="js" data-hide... |
PHP Order array based on elements dependency <p>Fairly hard one to explain, but effectively I've got an array of items which have IDs, of which can contain a list of IDs for other array items. for example</p>
<pre><code>$items = [
[id: 'one', deps: ['three']],
[id: 'two'],
[id: 'three', deps: ['four', 'two']]... | <p>you can use a function like this, that iterates until all dependencies are met, or no more dependencies can be resolved:</p>
<pre><code>$items = array(array('id' => 'one', 'deps' => array('three')),
array('id' => 'two'),
array('id' => 'three', 'deps' => array('four', '... |
Functional Programming: Perimeter of a polygon. <p>I am trying to find the perimeter of a polygon in a functional way. I tried my best but I couldn't make it purely functional. This is my code:</p>
<pre><code>object Solution {
def main(args: Array[String]) {
var x:Double = 0
val N = scala.io.StdIn.readInt
... | <p>Start with separating concerns:</p>
<pre><code>// dist should just take 2 points
def dist(a: (Double,Double), b: (Double,Double)): Double = ...
// calculate perimeter
def perimeter (points: List[(Double,Double)]): Double = {
// create a list of lines by connecting adjacent points
val lines = points zip (points... |
Cannot insert the value NULL into column 'Id' (Database first) <p><strong>Database-first solution.</strong></p>
<p>I'm using two tables called <code>User</code> and <code>Profile</code>. They are both using <code>uniqueidentifier</code> (SQL Server) as their primary key. The way I let <code>User</code> to automaticall... | <p>As @Gert Arnold mentioned in comments, I forgot to add <code>newsequentialid()</code> for <code>Profile</code>table in SQL Server. Once I did that, I were finally able to generate unique Guids with <code>DatabaseGeneratedOption.Identity</code>.</p>
<p>You can read more about this method <a href="http://www.develop... |
How do I write SQL to Substring data in this table? <p>Here's the data in 1 field in the database:</p>
<pre><code>{"image": null, "endDate": "2016-08-26",
"features": {"Attendee List": true, "Event Feedback": true, "Session Feedback": true},
"startDate": "2016-08-25",
"description": null, "selectedTimeZone": "Ameri... | <p>Use <a href="https://www.postgresql.org/docs/current/static/functions-json.html" rel="nofollow">Postgres' JSON functions</a>:</p>
<pre><code>select (content::json ->> 'startDate')::date as start_date,
(content::json ->> 'endDate')::date as end_date,
e.some_column
from events e
</code></pr... |
How to convert between different instantiations of the same variadic template? <p>Assume we have a data structure Foo that maintains a set of elements. It should be possible to associate attributes with the elements as needed. The attributes should be stored in a separate vector each. We implement this by means of vari... | <p>We can just make a bunch of independent decisions. First, let's add a constructor so that we can construct <code>Foo</code> from its attribute constituents:</p>
<pre><code>Foo(Attrs const&... attrs)
: Attrs(attrs)...
{ }
</code></pre>
<p>Next, for each attribute in <code>Others</code>, we will either downcast ... |
No provider for TestingCompilerFactory! in Angular 2 Jasmine tests <p>I am working on upgrading an Angular 1 app to Angular 2 using <code>@angular/upgrade</code>. For the most part this has gone well. I now have an Angular 2 component that works within my Angular 1 app when manually testing.</p>
<p>However, so far I'v... | <p><strong>The main problem is that you need to declare a provider for your all services that are in your component in your <code>beforeEach</code>.</strong> </p>
<p>Try the following code in your spec. I'm not sure what <code>TestingCompilerFactory</code> is in your app, but you may have to mock it. <a href="https://... |
RxJava .toblocking.tosingle() not returning at all <p>I am trying to do parallel calls to two different REST services which returns different type of response. So I have used <code>observable.zip(...).toBlocking().single()</code> but it never returns at all.</p>
<p>Here is what I am doing ...</p>
<ol>
<li>Trying to m... | <p>Don't use <code>create(OnSubscribe)</code>, backpressure and unsubscription can be tricky to honour. However, when you did use <code>create</code> you didn't emit any items to the subscriber <code>s</code> so the single item never arrives.</p>
<p>Instead of <code>create</code> use <code>fromCallable</code>:</p>
<p... |
is it possible to attach HTML through JS on a page? <p>im curious to know if it's possible to remotely upload or reference a .html document from a file server through the javascript <strong>onload</strong> function. I have found out how to implement CSS & JS through the onload function but not quite the HTML. . i w... | <p>I believe what you want to do is to make an AJAX call to that HTML file. Please read <a href="https://developer.mozilla.org/en-US/docs/AJAX/Getting_Started" rel="nofollow">Getting started with AJAX</a>.</p>
<p>What you would need to do next is to add the result to your page, not with <code>body.appendChild(script);... |
Angular2 FormBuilder unit testing <p>I have two question in regards to mocking Formbuilder in Angular2.</p>
<p>1) How do I mock formBuilder in a spec? Are there any given mocks that we can use? I would like to for instance, update the values of a form in my spec, and then test to see if the form is still valid - or te... | <p>If you are using the newest version of Angular2, and want to use their testbed, here is a working spec.</p>
<pre><code>describe('Login Component', () => {
let comp: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
d... |
Does Javascript filter preserve order? <p>I looked at the documentation and while looking at examples it looks like filter preserves order of the original list (though it returns a new one). Can I rely on that?</p>
<p><a href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.20" rel="nofollow">Ecmascript spe... | <p>Yes. From the <a href="https://es5.github.io/#x15.4.4.20" rel="nofollow">spec</a>,</p>
<blockquote>
<ul>
<li>Let <em>selected</em> be the result of calling the [[Call]] internal method of <em>callbackfn</em> with <em>T</em> as the this value and argument list containing <em>kValue</em>, <em>k</em>, and <em>O</e... |
Android thread memory Leak <p>I write to the shared preferences when Ever I get a certain broadcast msg from a service I have running. I want to know If this will cause a memory leak?
If so how can I fix it. I will be required to run this code ever 20-25 min. Do the old thread Die?</p>
<pre><code>if(Wifi_Connected)
{... | <p>No, it may cause some UI hiccups. Commit operation is very fast, so it will not hold outer class too long. But you better use apply() method which performs operation in background thread.
Generally speaking leaks appear when you hold reference to the 'big' objects like activity, and because of that it can be destroy... |
Towers of Hanoi recursive/iterative hybrid <p>I have to make a iterative solution to the Towers of Hanoi problem. I am trying to convert a tail recursive call to an iterative one. I am following an algorithm I found in my textbook to transform it. I followed this algorithm and even though my code is similar to the recu... | <p>You have a problem with your algorithm. Most important for your own understanding of this, slap a <strong>print</strong> statement at the top of your routine and print out the arguments. Also insert one at the bottom of the loop to help track that execution.</p>
<p>To summarize, I don't think you understand the c... |
How to show unsynchronicity of arraylist java? <p>We know that <strong>ArrayList</strong> are not thread safe and <strong>VectorList</strong> are. I wanted to make a program to show that operation are being performed synchronously in VectorList and not in ArrayList. The only problem, I am facing is how? What kind of op... | <p>Small test program:</p>
<pre><code>public class Test extends Thread {
public static void main(String[] args) throws Exception {
test(new Vector<>());
test(new ArrayList<>());
test(Collections.synchronizedList(new ArrayList<>()));
test(new CopyOnWriteArrayList<... |
How to map different values from 2 sets in clojure based on unique value <p>I have a function A which gives the data </p>
<pre><code>{{id 1,:obs/A "11", :obs/value 2.0, :obs/color "yellow"}
{id 2,:obs/A "12", :obs/value 4.0, :obs/color "blue"}
{id 3,:obs/A "13", :obs/value 3.0, :obs/color "green"}
{id 3,:obs/A "15", :... | <p>UPDATE 2016-9-26 1727: I added a better solution that uses DataScript to do all of the hard work. Please see the additional solution at the end.</p>
<hr>
<p>Here is an answer that works (w/o DataScript): </p>
<pre><code>(ns clj.core
(:require [tupelo.core :as t]
[clojure.set :as set] ))
(t/refer... |
Django: Which way is better way to find(search) a equal data object? <p>I am implementing searching functions in <code>Django</code>, which of these would be better?</p>
<pre><code>def same_cart_item_in_cart(cart, new_cart_item):
already_exist_cart_item = cart.cartitem_set.filter(
Q(variation__product=new_... | <p>As i said in the comment <1> option is better.</p>
<p>And it you are trying to save new instance and check it before saving, Django made it for you. You can add <a href="https://docs.djangoproject.com/en/1.10/ref/models/options/#unique-together" rel="nofollow"><code>unique_together</code></a> to your <code>Model... |
Accessing other class's properties through paremeterized constructors in ASP.NET MVC <p>I'm working to generate HTML Table Rows in a TagHelper class to be added to a DataTables table that displays a few buttons in a hidden child row (shown on clicking a given row). For one of these buttons, I need the value from a pro... | <p>You need a link back from <code>Survey</code> to <code>Report</code>. Without <code>Survey</code> code, that one is hard to tell. What you can do is save the report as a reference in the survey, and call that from your code.
What you did now is creating a new <code>Report</code>, such that is has always a default id... |
Split string in T-SQL and inserting into parameter <p>I need to split a string by delimiters <code>|</code>, then for every value obtained, I need to insert same in the name field like so:</p>
<pre><code>INSERT INTO Monitoring (UserId, Name, DateCreated)
VALUES (@UserId, 'abc', getdate())
VALUES (@UserId, 'def', getda... | <p>There are many split/parsing functions out there.</p>
<p>Assume variables:</p>
<pre><code>Declare @UserID int = 1
Declare @String varchar(max)='abc|def'
</code></pre>
<hr>
<pre><code>Insert Into Monitoring (UserId,Name,DateCreated)
Select UserID = @UserID
,Name = Key_Value
,DateCreated = ... |
How can I automate WiFi testing using Xcode Instruments? <p>I want to automate the UI flow on iOS, specifically below steps:</p>
<ol>
<li>User taps on Settings</li>
<li>Opens WiFi options</li>
<li>Taps on the desired SSID</li>
<li>Enters Username and Password</li>
<li>Taps connect</li>
<li>Opens up a browser</li>
</ol... | <p>The standard is now to use UI Unit tests from XCode. Automation via instruments is deprecated (as far as I know).</p>
<p>However you can automate iOS itself, only the app you are testing. So accessing the settings like this will not work. </p>
<p>I'm also wondering why you need to test this. It's part of iOS and n... |
approximate nearest neighbor (A1NN) for high dimension spaces <p>I read <a href="http://stackoverflow.com/questions/4350215/fastest-nearest-neighbor-algorithm">this</a> question about finding the closest neighbor for 3-dimensions points. Octree is a solution for this case.</p>
<p><a href="https://en.wikipedia.org/wiki... | <p>You might look at <a href="http://papers.nips.cc/paper/2666-an-investigation-of-practical-approximate-nearest-neighbor-algorithms.pdf" rel="nofollow">http://papers.nips.cc/paper/2666-an-investigation-of-practical-approximate-nearest-neighbor-algorithms.pdf</a> and <a href="http://research.microsoft.com/en-us/um/peop... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.