input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Angular2 Cli Test (Webpack) Erros: "Error: Template parse errors" <p>This is my AppModule:</p>
<pre><code>import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http'... | <p>You have forgotten to add CitiesComponent to the TestModule, here is an example test of mine</p>
<pre><code>import {
ComponentFixture, TestBed, inject, async
} from '@angular/core/testing';
import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { AppComponent } from... |
Select multiple COUNTs for every day <p>I got a table of Visitors.
Visitor has the following columns:</p>
<p><strong>Id</strong></p>
<p><strong>StartTime</strong> (Date)</p>
<p><strong>Purchased</strong> (bool)</p>
<p><strong>Shipped</strong> (bool)</p>
<p>For each day within the last 7 days, I want to select 3 co... | <p>For the last 7 days use the query proposed by Stanislav but with this <code>WHERE</code> clause</p>
<pre><code> SELECT DAY([StartTime]) theDay,
COUNT(*) AS Tot,
SUM(CASE WHEN Purchased=true THEN 1 ELSE 0 END) as TotPurch,
SUM(CASE WHEN Shipped=true THEN 1 ELSE 0 END) as TotShi... |
How to issue a dragstart event with jQuery? <p>I have an event like this:</p>
<pre><code> $(document).on('dragstart', '#' + gridID + ' tr.rgRow, #' + gridID + ' tr.rgAltRow ', function (ev) {
console.log(ev);
});
</code></pre>
<p>I would like to issue a <code>dragstart</code> event, like th... | <p>I have solved my problem using this <code>function</code>:</p>
<pre><code>TT.CustomEvent = function () {
var me = this;
var overrideMode = false;
var customEvents = [];
this.getEvent = function(type, data) {
if ((!customEvents[type]) || (overrideMode)) {
var event = document.crea... |
Invalid object name error on SELECT statement alias <p>I've written a SQL query which assigns an alias to each of two nested SELECT statements and attempts to join on these aliases.</p>
<p>My SQL query is as follows:</p>
<pre><code>SELECT EmpID,
(SELECT EmpID
,Count(*) * 8 AS [FullDayHours]
... | <p>I believe this is what you're after instead moving the subqueries to the <code>join</code>:</p>
<pre><code>SELECT EmpID, FullDayHours, HalfDayHours
FROM [StaffSuite].[dbo].[tblLogTimes] E
INNER JOIN (SELECT EmpID
,Count(*) * 8 AS [FullDayHours]
FROM [StaffSuite].[dbo].[tblLogTimes]
WH... |
I want to send the following web page request using a cronjob with raspberry pi <p>can anyone point me in the right direction?
I want to send the following webpage request using a cron job with raspberry pi,</p>
<p><a href="http://10.0.1.224/socket1On" rel="nofollow">http://10.0.1.224/socket1On</a> </p>
<p>thanks</p... | <p>Install <code>curl</code> using <code>aptitude install curl</code>, then <code>crontab -e</code> and...</p>
<pre><code>0 * * * * curl http://10.0.1.224/socket1On >/dev/null
</code></pre>
<p>(This runs once on each full hour - adjust as necessary of course.)</p>
<p>This throws away the answer; if you need it, y... |
java.lang.IllegalArgumentException - dialog.dismiss <p>I am getting this error in my published application, only clients receive this error. I already tried several times to replicate the same mistake however unsuccessfully.
I also already tried to use the below code at all locations where there is a Dialog but also no... | <p>You are calling dismiss on a dialog that is currently not being shown anymore. As in: your Activity/Fragment is possibly already destroyed when you call dismiss.</p>
|
How to insert (order form data) in multiple rows of mysql having same name <p>Here is code.</p>
<pre><code><form id="form.Id" name="form.Id" action="order" method="POST">
<ul>
//loading dynamically with javascript
<li class="singalProductList'+ productId +'">
<input type="text"... | <p>Here is working php code for processing Order form data and insert it in mysqli using php.</p>
<pre><code>include 'includes/db.php';
$did = $_POST['dishId'];
$dqty = $_POST['dishQuantity'];
$dname = $_POST['dishName'];
$dprice = $_POST['dishPrice'];
$totaldishes = sizeof($did);
for($i=0;$... |
What is "track by" in AngularJS and how does it work? <p>I don't really understand how <code>track by</code> works and what it does.<br>
My main goal is to use it with <code>ng-repeat</code> to add some precision.</p>
| <p>When you add <code>track by</code> you basically tell angular to generate a single DOM element per data object in the given collection.</p>
<p>You can <code>track by $index</code> if your data source has duplicate identifiers.</p>
<p>If you do need to repeat duplicate items, you can substitute the default tracking... |
elasticsearch python client - work with many nodes - how to work with sniffer <p>i have one cluster with 2 nodes. </p>
<p>i am trying to understand the best practise to connect the nodes, and check failover when there is downtime on one node.</p>
<p>from <a href="http://elasticsearch-py.readthedocs.io/en/master/api.h... | <p>You need to set <code>sniff_timeout</code> to a higher value than the default value (which is 0.1 if memory serves).</p>
<p>Try it like this</p>
<pre><code>es = Elasticsearch(
['esnode1', 'esnode2'],
# sniff before doing anything
sniff_on_start=True,
# refresh nodes after a node fails to respond
... |
Working with multiple npm registries and user accounts <p>For all my own stuff I use the public npm registry however one of the clients I am working with at the moment has just installed sinopia and wants to use that for private modules hosted on site.</p>
<p>This is fine, however as I use my laptop in various places ... | <p>Turns out all you need to do is:</p>
<p><code>npm login --registry=http://myreg.mycompany.com:8080 --scope=@myco</code></p>
<p>That tells npm the login you want to use for that registry, so that way you can add as many users for different registries as you need.</p>
<p>(You dont need the scope but as most compani... |
Keeping instances of a recurring event synchronized <p>I've been trying all day to figure out how to "rehydrate" instances of a recurring event from my app.</p>
<p>Let me explain the flow real quick:</p>
<ol>
<li>User grants access to my app to edit their calendar</li>
<li>The app sets up a recurring event</li>
<li>T... | <p>To answer my own question:</p>
<ol>
<li><code>x-goog-resource-id</code> is the identifier of the calendar, as that is the entity you're putting the watcher on</li>
<li>Once an event that is part of a recurring set is edited, it is no longer part of that set</li>
</ol>
|
Angular 2.0.0 with angular-cli 1.0.0-beta.15: using typescript, how to integrate external libraries as in previous versions <p>I'm creating an application using <code>Angular 2</code>. I started using it in the RC2 phase and after alot of updates I made to my app according to the released RC I finally got it to run on ... | <p>For now I use the libraries globally so I include them in the <code>angular-cli.json</code></p>
<pre><code>"apps": [
{
"root": "src",
"outDir": "dist",
"assets": "assets",
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"p... |
Django Admin: Numeric field filter <p>How to create filter for numeric data in Django Admin with range inputs?</p>
<p>P.S. Found only this similar question, but here suggest only how to group by concrete ranges and last question activity was 2 years ago.</p>
<p><a href="http://stackoverflow.com/questions/4060396/djan... | <p><strong>Warning!</strong> Some parts of API from django, mentioned in my answer, are considered internal and may be changed in future releases of django without any notification.</p>
<p>Taking that note to your mind, it is actually pretty easy to create your own filter. All you need to do is:</p>
<ol>
<li>subclass... |
Issue with lookup filter criteria and subgrid issue in a specific scenario <p>Following is the exact scenario in my Dynamics CRM application:</p>
<p>There are two entities "Departments" and "Employees", where there is 1:N relationship from Departments to Employees.</p>
<p>I have created a lookup view on Employees whi... | <p>You could change the lookup's filter to show all employees (just call myCustomFilter() from onLoad method on your Department form)</p>
<pre><code>function myCustomFilter(){
Xrm.Page.getControl("employeeid").addPreSearch(addFilter);
}
function addFilter()
{
//show all employees : empty filter
var customFi... |
onActivityResult not called on facebook sign in <p>I have an android app with facebook sign in.I initialized facebook sdk in a fragment.But the onActivityResult was never called when launching sign in procedure.</p>
<pre><code>@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
... | <p>This is because you Integrating facebook in Fragment to get result in fragment onActivty result you have to call it from Activty OnActivity result Like </p>
<p><a href="http://i.stack.imgur.com/Kf7gb.png" rel="nofollow">check this image for better understanding</a></p>
<p>you this code in your activity OnACtivity ... |
change color according to day night time in android <p>I want to develop a sample app which can continuously track time and can update app UI with respect to time. i.e. if time is 9:00 am the image is showing morning and after some time interval image is looking different.</p>
<p>may be I am not able to explain my que... | <p>Here is a code that may solve your purpose.The concept is simple.Just take the time you want to validate from Calendar class and compare it with the current time and then take an appropriate action.</p>
<pre><code>TextView textView = (TextView) findViewById(R.id.text);
Calendar cal = Calendar.getInstance();
cal.set... |
Mysql insert into duplicate key on a non-duplicate key <p>I use PHP and Mysql.</p>
<p><strong>This SQL works:</strong></p>
<pre><code>INSERT INTO products (id, title, description)
VALUES (10, 'value1', 'value2')
ON DUPLICATE KEY UPDATE
id=10,
title='value25',
... | <p>If you define the columns <code>sku</code> and <code>type</code> as <code>unique</code> columns, the <code>ON DUPLICATE KEY UPDATE</code> expression will also work as well as e.g. with only one <code>PrimaryKey</code> in your <code>products</code> table. </p>
<p><strong>Example (based on your data):</strong></p>
<... |
Using BB promise to create server with free port <p>When I run the create server & listen in my unit test some times I'm getting the following error:</p>
<p>EADDRINUSE,</p>
<p>Now I want to handle it by using module portscanner to find free port</p>
<p>I do it like this</p>
<pre><code>var http = require('http')... | <p>You could promisify portscanners findAPortNotInUse() and call server.listen in the promises then()-function</p>
<pre><code>Promise.promisifyAll(portscanner);
portscanner.findAPortNotInUseAsync(3000, 4000, '127.0.0.1').then(function(port){
server.listen(port);
}).catch(function(){
// your error handling
})
... |
Create a sinus wave with increasing steps frequencies matlab <p>I'm novice in matlab programing and I thank you in advance for your help.
I would like to generate un sinus wave function starting to 0.25 Hz and increasing every 8 oscillations by 0.05 Hz until 0.7 Hz. The amplitude is constant. </p>
<p>I try this code:<... | <p>1) Try this:</p>
<pre><code>cyc = 8; % number of cycles
wave = [];
T = [];
for f = 0.25:0.05:0.7 %% Frequency Increment
t=0.01/f:0.01/f:(cyc/f); % time per freq step
wave = [wave,sin(2*pi*f*t)];
if isempty(T)
T = t;
else
T = [T,T(end)+t];
end
end
plot(T,wave)
</code></pre>
<p>2) F... |
Can't attach 2nd interface to ec2 instance <p>I've got 2 instances running nicely</p>
<pre><code>web - t2.medium - us-east-1d - Private IP - 10.1.1.6
vpn - t2.micro - us-east-1d - EIP assigned
</code></pre>
<p>I'm trying to add a 2nd interface onto the vpn server within the 10.1.1.0/24 network.</p>
<p>After I creat... | <p>It looks like you're trying to assign an IP that isn't in that <em>subnet</em> range. if your instance is in <code>subnet-foo</code> and <code>subnet-foo</code> is us-east-1a with <code>10.1.1.0/24</code> it should work. It would fail for instance if you tried to attach a nic with IP <code>10.0.1.6</code> in my exam... |
legend in a plot using flot jquery api <p>I'm trying to modify a plot in order to insert a custom legend.
The code is the following</p>
<pre><code>$(document).ready(function(){
graph = $('.Graph').plot(formatFlotData(), {
colors: [ '#20f', '#00ff4b', '#f00', '#fdff00'],
xaxis: {
show: false,
... | <p>The <code>container</code> option needs to be a <a href="https://github.com/flot/flot/blob/master/API.md#customizing-the-legend" rel="nofollow">jQuery object/DOM element/jQuery expression</a>:</p>
<pre><code>legend: {
show: true,
container: $('#legend-container')
}
</code></pre>
<p>This <a href="https://js... |
What precautions should I take to make a memory pool that does not invoke undefined behavior? <p>My initial problem is that I have, on a project, several objects which share a lifetime (i.e., once I free one of them, I'll free them all), then I wanted to allocate a single block of memory. I have arrays of three differe... | <p>However hard you try, it's not possible to implement <code>malloc</code> in pure C.</p>
<p>You always end up violating strict aliasing at some point. For the avoidance of doubt, using a <code>char</code> buffer that doesn't have dynamic storage duration will also violate strict aliasing rules. You would also have t... |
Create JSON object with array array as attribute in PHP <p>I'm trying to create a JSON-String that looks like this:</p>
<pre><code>{"id":"1","name":"new group test","beschreibung":"this is a description","gewerbe":"1" , "members":[{"uniqueid":"100110001"},{"uniqueid":"100110002"},{"uniqueid":"100110003"}]}
</code></pr... | <pre><code>$data['members'] = $members;
return json_encode($data);
</code></pre>
|
how to access pillar data with variables? <p>I have a pillar data set like this;</p>
<pre><code>vlan_tag_id:
nginx: 1
apache: 2
mp: 3
redis: 4
</code></pre>
<p>in the formula sls file I do this;</p>
<pre><code>{% set tag = pillar.get('vlan_tag_id', 'u') %}
</code></pre>
<p>so now I have a variable <code>tag... | <p>Since <code>tag</code> is just another dictionary, you can do a get on that as well:</p>
<pre><code>{%- set tag = pillar.get('vlan_tag_id', 'u') %}
{%- set app = pillar.get('app') %}
{{ tag.get(app) }} # Note lack of quotes
</code></pre>
<p>If you want to use the colon syntax, you can append the contents of <code>... |
Re-deploy spring boot service without restart? <p>I have developed a micro service (Spring Boot REST service, deployed as executable JAR) to track all activities from third party projects as my requirement and its working now.</p>
<p>Currently it's working apart of some projects, and now I have updated service with so... | <p>What about <a href="https://zeroturnaround.com/software/jrebel/" rel="nofollow">JRebel</a> plugin. It worked perfectly for me, but, unfortunately, it's not free app. Like alternative (i used this approach with Spring MVC, with Spring Boot it could be otherwise), i set up soft link in work directory on compiled path ... |
About Android Emulator Error <p>Output:</p>
<blockquote>
<p>Hax is enabled Hax ram_size 0x60000000 HAX is working and emulator
runs in fast virt mode. emulator: Listening for console connections on
port: 5554 emulator: Serial number of this emulator (for ADB):
emulator-5554 emulator: WARNING:
./android/metri... | <p>that's not a system problem, just a google usage statistics;</p>
<p>you can :
Open the Android Studio->Preferences, go to Appearance & Behavior->System Settings->Usage Statistics, and uncheck "Send usage statistics to Google". Now the matrics_reporter will be disabled during emulator starting.
then restart emu... |
Node.js request method callback <p>client.get method does not work in redis for node.js</p>
<pre><code>//blog function
module.exports = {
index: function () {
var data = new Object();
data.ip = base.ip();
var redis = require("redis");
var client = redis.createClient(6379,'192.168.33.10');
clie... | <p>Your problem is that <code>client.get</code> is an asynchronous method, which you can't return from. You need some sort of asynchronous control flow, such as callbacks.</p>
<pre><code>//blog function
module.exports = {
index: function (callback) {
var data = new Object();
data.ip = base.ip();
var redi... |
Finding all combination sequences from array in JS <p><em>Disclaimer: I know part of this question has been asked and answered here before and yes, they have helped me get to this point so far.</em></p>
<p>Let's say I have an array that contains 2 elements and I want to find ALL possible combinations that could be mad... | <p>Can you make two arrays in reverse order:</p>
<pre><code>var myArr = ['a','b']
var myArr2 = ['b','a']
var recurFn = function(prefix, myArr) {
for (var i = 0; i < myArr.length; i++) {
var newArray = prefix !== '' ? [prefix, myArr[i]] : [myArr[i]];
result.push(newArray);
recurFn(prefix +... |
Running logstash forwarder as a daemon service <p>I found this article who explain how to make a start stop service ; <a href="http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html" rel="nofollow">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html</a>... | <p>Here is a working vesion who uses kill instead of killproc :</p>
<pre><code>#!/bin/bash
#
# chkconfig: 3 80 20
# description: boop-logstash-forwarder
#
# Get function from functions library
. /etc/init.d/functions
# Start the service
LOGSTASH_FORWARDER="/logiciels/logstash-forwarder/logstash-forwarder"
LF_CONF="/a... |
Is it possible to implicitly add object fields to XML using XStream? <p>I have to convert a sorted set of objects of type <strong>Organization</strong> to an XML file.
The said type contains, along with primitive types and String objects, other reference type objects.</p>
<p>Here are the fields of <strong>Organization... | <p>Turns out it is impossible to do it quite the way I originally imagined.</p>
<p>However, the solution to my problem comes in form of a <a href="https://www.tutorialspoint.com/xstream/xstream_custom_converter.htm" rel="nofollow">custom Converter</a>, which implements the Converter interface from XStream package. Ins... |
Angular 2 (click) sometimes does not fire <p>In my Angular 2 / Bootstrap / AdminLTE I have the following template:</p>
<pre><code><button type="button" class="btn btn-default"><i class="fa fa-cutlery" (click)='munch(1);'></i></button>
</code></pre>
<p>Which is calling this method:</p>
<pre><c... | <p>Could it be, that your i-tag is smaller than your button?
Why not put the (click) inside the button instead of the i tag?</p>
|
Optimal control of a boiler: using Fluid Library w. the DynamicPipe component using JModelica <p>Im interested in using <strong>JModelica</strong> together with a model I have constructed in <strong>Dymola</strong>.</p>
<p>Specifically, I have a model of a boiler using the <strong>DynamicPipe</strong> component, and I... | <p>So an acceptable answer was provided on the JModelica forums by Fredrik:
<a href="http://www.jmodelica.org/27776#comment-6468" rel="nofollow">http://www.jmodelica.org/27776#comment-6468</a></p>
<p>Simply put: <strong>The MSL Media Library is not supported.</strong></p>
<p>My solution was to instead built my own sm... |
Jquery math less than 0 show 0 <p>how would i stop the below returning a value less than 0. I want anything less than 0 to show as 0. Any help appreciated.</p>
<pre><code>$("#spanrPower_CO2").text (Math.round(-data[0] * 16.8) * 100 / 100);
</code></pre>
| <p><code>data[0] > 0 ? 0 : -Math.round(16.8 * data[0]);</code> is probably clearer.</p>
<p>Note that unless you're approaching floating point infinity, <code>* 100 / 100</code> is a no-op.</p>
|
Converting a MPAndroidChart view to a bitmap gives ArrayIndexOutOfBoundsException <p>I am trying to convert a MPAndroidChart LineChart view to a Bitmap object when the user taps on a button, to save the chart as an image. However, I get an ArrayIndexOutOfBoundsException. I am using MPAndroidChart v. 3.0.0. The code is ... | <p>if you want to save chart as image, then you should use </p>
<p><code>mChart.saveToGallery("test.png", 50);</code> </p>
<p>in this <code>test.png</code> is your image name and <code>50</code> quality of your image and this image saved in your device storage.</p>
|
Concatenating data and text on select mysql <p>Fellows,</p>
<p>I'm using PHP and this code:</p>
<pre><code>SELECT DATE_FORMAT(data,'%d/%m/%Y'' Ã s ''%H:%i:%s') as data FROM infografico GROUP BY data
</code></pre>
<p>Displays something like this:</p>
<pre><code>(última atualização: 22/09/2016' às '09:37:16)
</co... | <pre><code>SELECT DATE_FORMAT(data,'%d/%m/%Y'' Ã s ''%H:%i:%s') as data FROM infografico GROUP BY data
^--start string
^^--escaped quote
^^--escaped quote
^---end of string
</... |
How to read a header from a specific line with CsvHelper? <p>I'm trying to read a CSV file where header is at row 3:</p>
<pre><code>some crap line
some empty line
COL1,COL2,COl3,...
val1,val2,val3
val1,val2,val3
</code></pre>
<p>How do I tell <a href="https://joshclose.github.io/CsvHelper/" rel="nofollow">CSVHelper</... | <p>Try this:</p>
<pre><code>using (var reader = new StreamReader(stream)) {
reader.ReadLine();
reader.ReadLine();
using (var csv = new CsvReader(reader)) {
csv.ReadHeader();
}
}
</code></pre>
|
Regular Expressions Pattern Java <p>I'm still not sure how to deal with regular expressions.
I have the following method that takes in a pattern and return the number of pictures that is taken in the year.</p>
<p>However, my method only takes in a perimeter year.
I was intending to do something like
<code>String patt... | <p>If I understand your question correctly, this is what you need:</p>
<pre><code>public class SO {
public static void main(String[] args) {
int count = countPicturesTakenIn(new Album(), 2016);
System.out.println(count);
}
public static int countPicturesTakenIn(Album album, int year) {
// Modify the code... |
AWS Lambda cannot connect to Kinesis Firehose "Max retries exceeded with url" <p>I've followed several tutorials and added different IAM configurations and security groups to keep things as open and obvious as possible and nothing has worked. Here is the debug log, and the main error pasted below. Let me know if there'... | <p>Please follow my answer in this <a href="http://stackoverflow.com/a/39206646/3454745">thread</a>.
This will explain how to make lambda contact any service on the internet (such as S3, kinesis and so).</p>
|
How do I pull the time until sleep of the active power plan? <p>I'm looking for either a PowerShell script or command that allows me to get the active power plan's time until sleep. </p>
<p>In the below example, I know from the previous screen that "Balanced" is the Active Power plan. Selecting that, gets to this scre... | <p>Use powershell command to find out current and active Power plan.</p>
<pre><code>gwmi -Namespace Root\CIMV2\power -Class win32_powerplan -Filter isActive=âtrueâ | select ElementName , Description, InstanceID
</code></pre>
<p>and then use <code>instanceID</code> to query <strong>powercfg</strong></p>
<pre><co... |
Drag and Drop in Android Studio layout editor <p>I have a problem with adding images to my app's layout. I've searched for an answer for a while, but even when doing exactly what friendly people of the internet told me, there is still no success. </p>
<ul>
<li>images are in PNG format in res/drawable folder.</li>
<li>... | <ol>
<li><p>You must store your images on <code>Drawables</code> folders not in <code>drawable</code>
-drawable-hdpi,drawable-mdpi,drawable-xhdpi.....</p></li>
<li><p>You should drag an <code>ImageView</code>, then add the image with the <code>src param</code>. You can't directly drag and drop images</p></li>
<li><p>Y... |
How to secure/encrypt Inno Setup from decompiling <p>I am using an Inno Setup Tool to pack/setup all my files (dll,exe,jpg, etc).
But I found that there is a software called <strong><a href="http://www.havysoft.cl/innoextractor.html" rel="nofollow">InnoExtractor</a></strong> which can really open my setup and read all ... | <p>There's no way to protect code from an user, if you need to be able to run the same code on the user's machine. Once you deliver files to client's machine, no matter what method you used to pack them, the client can extract the files. </p>
<p>You can only make it harder, but there's no absolute solution.</p>
<p>Mo... |
open conditional python files but read data from one <p>I want to open and read a file depending on a condition, read only if condition met true. I wrote the following scriptlet: </p>
<pre><code>def bb(fname, species):
if species in ('yeast', 'sc'):
pm = open('file.txt', 'rU')
for line in pm:
... | <p>You can put the filename value in a variable</p>
<pre><code>def bb(fname, species):
if species in ('yeast', 'sc'):
fname2 = 'file.txt'
elif species in ('human', 'hs'):
fname2 = 'file2.txt'
else:
raise ValueError("species received illegal value")
with open(fname2, 'rU') as p... |
Convert String to Datetime Error <p>I am writing a query to poll one of our devices and report back to the status to our Solarwinds server. It is a semi-advanced SQL Query, my results come out correct but I get this error message: </p>
<p>Msg 242, Level 16, State 3, Line 1
The conversion of a nvarchar data type to a d... | <p>It looks like you have some invalid data in the tbl4.Status column.</p>
<p>To identify the invalid data temporarily modify the select and where clause statement to:</p>
<pre><code>select tbl4.Status, *
...
where isdate(SUBSTRING (@status,5,3)
+ ' ' + SUBSTRING(@status,9,2)
+ ' , ' + SUBSTRING(@st... |
Access VBA - Reference to Subform disappears after database has been open a while <p>I have a Microsoft Access 2013 database that has a form with a hidden subform. There is a text box for a search value and a button to click to search. There is a subform on the form that is hidden until the search button is clicked. On... | <p>This is really odd and I have never seen anything like this. Yet, it is happening to you.</p>
<p>One crude approach would be to handle with error handling. When the user clicks the Search button, add error handling that closes, reopens the form, then applies the search using the OpenArgs data in the OpenForm method... |
Ajax Post request example <p>I was wondering if anyone could help me with a simple ajax request example just so I can wrap my head around the whole idea. I tried testing an ajax request to search the word "rails" on github. So my code looks something like this:</p>
<pre><code>$.ajax({
url: 'www.github.com',
type: 'pos... | <p>Try to add http in your url, but, for security reason you can't do Ajax Crossdomain request without autorisation of the github.com domain in your case. </p>
<p><a href="http://api.jquery.com/jquery.ajax/" rel="nofollow">http://api.jquery.com/jquery.ajax/</a></p>
|
Adding pixel tracking to a link <p>I had a marketing company send me a bunch of 1x1 pixel tracking images to add to a page. These all work fine, no issues.</p>
<p>They also wanted one of the trackers added to a link that goes out to another page, which is where the problem is.</p>
<p>Heres an example of the pixel tra... | <p>You can append the image to the DOM so that it renders on click of the link, while preventing the default until after the tracker appends:</p>
<pre><code>$("a#imgtracker").click(function (e) {
e.preventDefault();
$("body").append('<img class="fmfjfemzqkmxnkeezyst" width="1" height="1" src="//insight.... |
How do I extract attributes from xml tags using Beautiful Soup? <p>I am trying to use Beautiful Soup in Django to extract xml tags. This is a sample of the tags that I'm using:</p>
<pre><code><item>
<title>
Title goes here
</title>
<link>
Link1 goes here
</link>
<description>
Descri... | <p>The issue is because not every item has a <em>media:thumbnail</em> so you need to check first:</p>
<pre><code>In [60]: import requests
In [61]: from bs4 import BeautifulSoup
In [62]: soup = BeautifulSoup(requests.get("https://rss.sciencedaily.com/computers_math/computer_programming.xml").content, "xml")
In [63... |
Hosting a custom skill to Alexa by implementing a web service <p>I am working on developing a web service which is used to <strong>Handling Requests Sent by Alexa</strong> and respond back with specific response in .net framework. The request body sent by Alexa to your service in JSON format like below :</p>
<pre><co... | <p>I've just published a project that uses the same AlexaSkillsKit.NET package that you mention. The goal is to help everyone create Alexa Custom Skills using .NET + Visual Studio that you can easily deploy to Azure. </p>
<p><a href="https://github.com/tamhinsf/Azure4Alexa" rel="nofollow">https://github.com/tamhins... |
Why is it the if statement with valid condition that is suppose to be true but then the result is always false? <p>I'd created an if statement "if ($user_roles == 3) " and this $user_roles has a value of "3" the condition is suppose to be true but the result is always false.</p>
<p>here is my code below:</p>
<pre><co... | <p><code>$user_roles</code>is not 3 and can never be. it's an array.
its contents, however, can be three.</p>
<p>try:</p>
<pre><code>if(in_array(3, $user_roles)) { ...}
</code></pre>
<p>for reference: <a href="http://php.net/manual/en/function.in-array.php" rel="nofollow">in_array</a></p>
|
can't define a udf inside pyspark project <p>I have a python project that uses pyspark and i am trying to define a udf function inside the spark project (not in my python project) specifically in spark\python\pyspark\ml\tuning.py but i get pickling problems. it can't load the udf.
The code:</p>
<pre><code>from pyspar... | <p>add the following to your code. It isn't recognizing the datatype.</p>
<pre><code>from pyspark.sql.types import *
</code></pre>
<p>Let me know if this helps. Thanks.</p>
|
Split column and use first array to headerin awk <p>I have file looks like this:</p>
<pre><code>A=10 B=8 C=12
A=15 B=12 C=5
A=6 B=4 C=9
A=8 B=8 C=9
</code></pre>
<p>Columns are much more. I would like to split all file using awk and use letter before "=" like a header:</p>
<pre><code>A B C
10 8 12
15 12 5
6 4 9
8 8 ... | <pre><code>$ awk 'NR==1{h=$0;gsub(/=[^ ]+/,"",h);print h} {gsub(/[^ =]+=/,"")} 1' file
A B C
10 8 12
15 12 5
6 4 9
8 8 9
</code></pre>
|
Siddhi How to track what's going on inside ExecutionPlanRuntime <p>Is there any way to track/log the inner execution of the Siddhi execution plan? Now I'm talking about vanilla Siddhi not WSO2 CEP. I didn't find any way how to turn it on. How do you debug your rules?
Thanks.</p>
| <p>You can use built-in Logger function of Siddhi. Please refer this <a href="https://docs.wso2.com/display/CEP420/SiddhiQL+Guide+3.1#SiddhiQLGuide3.1-Siddhilogger" rel="nofollow">documentation</a>. However, this is only available after Siddhi 3.1.0</p>
|
Azure WebApp Deployment Slot: Pre-Swap Job <p>Hy</p>
<p>We have two app services:</p>
<ul>
<li><p>RESTService (Azure App Service Web App -> ASP.NET)</p></li>
<li><p>WebApplication (Azure App Service Web App -> Angular.JS SPA)</p></li>
</ul>
<p>The RESTService has a web.config and the WebApplication a appconfig.json ... | <p>As I know, it is very easy to do this if you only store the settings in web.config. You only need to select "slot setting" in Azure portal. If you want to do some swap job before swapping, I would suggest you use <a href="https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.WebSites/" rel="nofollow">Micr... |
updating java software require any downtime of the application <p>I'm not sure whether I can post this question here or not. I have an application deployed into my tomcat server and the application is running fine. Now if I have to upgrade my java version, does it stop my application? In other words Do I need any down... | <blockquote>
<p>Now if I have to upgrade my java version, does it stop my application until my upgrade completed?</p>
</blockquote>
<p>That would be advisable.</p>
<p>You probably could install a newer version of Java with the existing one is being used to run your application. However, you will need to restart To... |
Advice on supporting screenreaders (fully) on a sliding widget (think iOS settings panels) <p>I am building a container with nested sliding sub-containers - which themselves will have their own set of nested containers.</p>
<p>Basically it will behave very similar to how iOS handles settings (see attached image). </p>... | <blockquote>
<p>The WAI-ARIA Authoring Practices Guide is intended to provide an understanding of how to use WAI-ARIA to create an accessible Rich Internet Application. It describes recommended WAI-ARIA usage patterns and provides an introduction to the concepts behind them.</p>
<p>Source: - <a href="https://www... |
iOS 10 Quicklook Memory Usage <p>When ill load some images to my QuicklookController, the used memory is never freed by the Memory Management. For Example:</p>
<pre><code>override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let photoFile = photos[indexP... | <p>Seems to be fixed with iOS 10.0.2 </p>
|
Missing rac_signalForControlEvents in RAC5 <p>Now i update the ReactiveCocoa to 5(version 4.2.2) for the swift3.
But there has not api <code>rac_signalForControlEvents(.TouchUpInside)</code> for UIButton,which i use in previous version</p>
<p>Is there anyone know? How to resolve that?</p>
| <p>Some part of the Obj-C API have been divided in another framework : ReactiveObjC.</p>
<p>I needed to install this framework to access these methods.</p>
<p>Solution :</p>
<blockquote>
<p>As stated in README (Objective-C and Swift section), those Objective-C
API are splitted out to ReactiveObjC framework. You ... |
Eclipse to Android Studio Import <p>I am moving all my source codes to AS as suggested by Android official website. However, the experience is not very good. It is very sluggish as described <a href="http://stackoverflow.com/questions/30817871/android-studio-is-too-slow">here</a>. But this is not my ultimate problem fo... | <p>First of all, make sure you rebuild project, after importing (Build - Clean, Builde - Rebuild Probject). Fixing this issue with limitation methods reference:</p>
<pre><code>android {
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependenc... |
Backburner rake task - NameError: undefined local variable or method <p>I'm starting up with Backburner to run some jobs in the background of my app. I've tried following the <a href="https://github.com/nesquena/backburner" rel="nofollow">documentation</a> under "Working Jobs", but I'm clearly doing something very obvi... | <p>Apparently I'm in the business of asking dumb questions, lately. I was passing a variable to my <code>Backburner.enqueue</code> that is an ID, so I expected it to be numerical, like so: <code>@admin.id</code>. This would have been fine if @admin was defined in the scope of the helper I'm calling my enqueue in, but I... |
Setting up Laravel Homestead with existing project - Laravel commands not recognized <p>I am setting up homestead on my mac. </p>
<p>I have made sure that the settings are right on my storage folder.
I have installed composer on the vagrant box.
If I navigate to /home/vagrant/Code then my code is there.</p>
<p>Here ... | <p>Your yaml is wrong. Should look like this..</p>
<pre><code>folders:
- map: ~/Sites
to: /home/vagrant/Sites
sites:
- map: my.app
to: /home/vagrant/Sites/MYAPP/public
</code></pre>
|
Mongo query for field name <p>I have a collection that summarizes some data related to documents in other collections. It's structure is roughly like:</p>
<pre><code>{
campaignId : ObjectId(...)
impressions : {
...
'2016-09-20': 1800,
'2016-09-21': 1500,
'2016-09-22': 2000
}... | <p>As you need to query based on the field key instead of the value you first need to provide keys for all previous N days(7 days in your case).
After building these keys(programmatically or manually ), you can achieve this in different ways ----- </p>
<p>1 - Using <a href="https://docs.mongodb.com/manual/reference/o... |
Pass a YAML-based property value to @Scheduled annotation in Spring Boot <p>This question is possibly a duplicate of this older <a href="http://stackoverflow.com/questions/27445702/inject-scheduled-fixedrate-value-from-spring-boot-application-yml-file">question</a>.</p>
<p>I'm working on a <strong>Spring Boot 1.4</str... | <p>Try putting it in a Javaconfig first and it should work with EL:</p>
<pre><code>@Configuration
@ConfigurationProperties(prefix = "app")
public class CronConfig() {
private cron;
@Bean
public String cron() {
return this.cron();
}
public void setCron(String cron) {
this.cron = cr... |
Azure Easy API JavaScript: How to return multiple result set from MSSQL query <p>I have created an Azure Easy API (on an app service that was recently migrated from a mobile service). I want to return three result sets from an SQL stored procedure. But it only returns the first result set. I have read that setting <cod... | <p>Please try to use the <a href="https://azure.github.io/azure-mobile-apps-node/module-azure-mobile-apps_src_data_execute.html#~execute" rel="nofollow"><code>execute()</code></a> function in Azure Mobile Apps in Node.js, and add the parameter <code>multiple</code> to true as described at <a href="http://azure.github.i... |
I am getting "pointer being freed was not allocated" <p>I am reading from stdin. Since I do not know the length of what I will read, I have to use malloc.</p>
<p>I am getting a <strong>pointer being freed was not allocated</strong> </p>
<p>Sometimes, it happens before free(final), sometimes before free(tmp).</p>
<p>... | <p>I believe you are a bit confused when it comes to pointers.
When you write </p>
<pre><code>final = (char *)malloc(sizeof(char) * total_size);
</code></pre>
<p>You allocate memory equivalent to <code>sizeof(char) * total_size</code>, and malloc then returns the pointer to that memory.
Then you go on to write </p>
... |
UItextField restrict user to enter number only IOS app on ipad <p>I'm developing an app for Ipad. I'm designing a forgot password screen to allow user to enter password to <code>UITextField</code>. By design, the password only allow numeric input. I can set <code>UITextFiled</code> <code>keyboardtype</code> to be <code... | <p>The keyboard type does not dictate what sort of input the textfield accepts, even if you use a custom keyboard that only displays numbers, the user can always paste something or use an external hardware keyboard.<br><br/>To do that, you need to observe the input, for example, by becoming the UITextFieldDelegate and ... |
Laravel 5.2: session and token guard on the same routes <p>We had session guard and that was enough.</p>
<p>Now we need to add authorization via token (in headers or GET params) and via session <strong>on the same routes</strong>.</p>
<p>Authorization via token must be stateless.</p>
<p>UPD:
First, we think about c... | <p>Create new middleware AuthenticateWithToken:</p>
<pre><code>class AuthenticateWithToken
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function hand... |
How to query the data in a join table by two sets of joined records? <p>I've got three tables: <code>users</code>, <code>courses</code>, and <code>grades</code>, the latter of which joins <code>users</code> and <code>courses</code> with some metadata like the <code>user</code>'s <code>score</code> for the <code>course<... | <p>I think a simple pivot query should work here, since you only have 4 courses in your data set to pivot.</p>
<pre><code>SELECT t1.name,
MAX(CASE WHEN t3.title = 'Biology' THEN t2.score ELSE NULL END) AS Biology,
MAX(CASE WHEN t3.title = 'Algebra' THEN t2.score ELSE NULL END) AS Algebra,
... |
gcc 4.9.1 not standard compliant? (std::runtime_error) <p>We would like to have a own definition of <code>std::runtime_error:runtime_error(const string& arg)</code>. We implement such constructor in terms of the other constructor, i.e., <code>std::runtime_error:runtime_error(const char*)</code>, like:</p>
<pre><co... | <p>Perhaps this does not answer your original question, but if the intention really is to intercept the <code>runtime_error</code> instantiation, you can do like this (asuming gcc is used):</p>
<pre><code>namespace std {
runtime_error::runtime_error(const string& arg)
#if (__GNUC__ > 4)
: runtime_error(... |
Adding up Multiple Checkbox values to a label, Based on if they are Checked or notC# <p>Alright I have 8-10 check boxes and radio buttons, and i need to sum up the double values that are assigned to them. The only problem is that I only want to check some of the boxes not all of them. If you could help me out that woul... | <p>I have this version as a solution:</p>
<pre><code> private readonly Dictionary<CheckBox, double> mapping;
public MainWindow()
{
InitializeComponent();
mapping = new Dictionary<CheckBox, double>
{
{cbBean, 2d},
{cbSpringMix, 2d}
//..... |
What does it mean by saying conflating environment and object is the fundamental sin of Javascript? <p>I was watching programming languages courses given by Prof. Shriram Krishnamurthi on youtube.</p>
<p>In this episode,
<a href="https://youtu.be/SUh7jhrtktk?t=1600" rel="nofollow">https://youtu.be/SUh7jhrtktk?t=1600<... | <p>After a little bit of digging, Iâve found a paper from Professor Shriramâs group.</p>
<p><a href="https://cs.brown.edu/research/plt/dl/jssem/v1/" rel="nofollow">https://cs.brown.edu/research/plt/dl/jssem/v1/</a></p>
<p>In section 2.5, they pointed out that it is not clear whether JavaScript is lexically scoped... |
Swift 3 Error - Type Any has no subscript members <p>I recently converted my code to Swift 3 and these errors have popped up. I have no clue what the following error means.</p>
<blockquote>
<p>Type 'Any' has no subscript members</p>
</blockquote>
<p>I have tried to change [String: AnyObject] to other types but it h... | <blockquote>
<p><a href="http://stackoverflow.com/questions/39641676/type-any-has-no-subscript-members-swift-3-0">This Other Stack Overflow Question Might Be Helpful</a></p>
</blockquote>
<p>(From the link)</p>
<pre><code>let responseMessage = json["response"]! as? String
</code></pre>
<p>Must be changed to</p>
<... |
Sort a list where there are strings, floats and integers <p>I need some help because I wanted to know if there is a way in Python to sort a list where there are strings, floats and integers in it.</p>
<p>I tried to use list.sort() method but of course it did not work.</p>
<p>Here is an example of a list I would like ... | <p>Python's comparison operators wisely refuse to work for variables of incompatible types. Decide on the criterion for sorting your list, encapsulate it in a function and pass it as the <code>key</code> option to <code>sort()</code>. For example, to sort by the <code>repr</code> of each element (a string):</p>
<pre><... |
Android DataBinding expression with Listener Bindings <p>I'm using Android Data Binding library in the app which follows the <a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter" rel="nofollow">MVP</a> pattern. In the <a href="https://realm.io/news/data-binding-android-boyar-mount/" rel="nofollow... | <p>from <a href="https://developer.android.com/topic/libraries/data-binding/index.html#listener_bindings" rel="nofollow">listener_bindings</a></p>
<p>If you need to use an expression with a predicate (e.g. ternary), you can use void as a symbol. </p>
<pre><code>android:onClick="@{(v) -> v.isVisible() ? doSomething... |
Days between dates will not compile <p>I have been trying to get this to work. I need to input 2 dates (MM DD) and then have the program tell me the amount of days between the 2 dates. But for some reason when i try to use month 2 (February) I dont think its registering that I indicated it having only 28 days. Also whe... | <pre><code>if (first.month == 1||3||5||7||8||10){
</code></pre>
<p>This won't do what you want it to do. It will be evaluated as (first.month == 1)||3||5||7||8||10, which will evaluate to true for all non-zero months.</p>
<p>This would be better written as a case statement;</p>
<pre><code>switch (first.month) {
... |
C# to JSON conversion, dictionary <p>I have a class as follows and I want its JSON signature. It's the last property <code>Actions</code> that I am unsure about how to transfer to JSON. I have tried C# to JSON converter online but it gives null for <code>Actions</code>.</p>
<pre><code> public class Notification
{
... | <p>The json for that class would be:</p>
<pre><code>{
"Name":"Test",
"Body":"TestBody",
"Subject":"TestSubject",
"Users":"TestUsers",
"Date":"9/22/2016 12:26:20 PM",
"Action":[
{
"key":{
"innerKey":"value"
}
}
]
}
</code></pre>
<p>for this C# code... |
How to use the content element in Polymer? <p>From the <a href="https://www.polymer-project.org/1.0/docs/devguide/local-dom#dom-distribution" rel="nofollow">documentation</a> it says that the <code><content></code> element supports a <code>select</code> attribute which filters nodes via a simple selector. </p>
... | <p>So we have this little description about the <a href="https://www.polymer-project.org/1.0/docs/devguide/local-dom#dom-distribution" rel="nofollow">DOM Distribution</a>:</p>
<blockquote>
<p>To support composition of an element's light DOM with its local DOM, Polymer supports the <code><content></code> elemen... |
VB.NET DirectorySearcher Won't retrieve AD users with empty properties <p>I am using this code to retrieve a user from AD to a datagridview on a windows form. It works well so long as none of the properties are empty. </p>
<pre><code>Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles But... | <ol>
<li>As I know on AD samAccountName cannot be null or empty.</li>
<li>When an attribute is not set it will be null, but not "".<br/>
For safety you may check both "" and null.<br/></li>
</ol>
|
Spring: When getting a ManyToOne entity, reference entity (OneToMany) is not showing in JSON <p>When I send a GET request in POSTMAN to get all my child entity (Town) the parent entity (Province) is not shown in the JSON response.</p>
<p>This is my controller.</p>
<pre><code>@RequestMapping(value ="api/v1/town",metho... | <p>Swap <code>@JsonBackReference</code> and <code>@JsonManagedReference</code>. Basically:</p>
<pre><code>@JsonManagedReference
private Province province;
@JsonBackReference
private List<Town> towns;
</code></pre>
|
Create mask from skimage contour <p>I have an image that I found contours on with <code>skimage.measure.find_contours()</code> but now I want to create a mask for the pixels fully outside the largest closed contour. Any idea how to do this? </p>
<p>Modifying the example in the documentation: </p>
<pre><code>import nu... | <p>Ok, I was able to make this work by converting the contour to a path and then selecting the pixels inside:</p>
<pre><code># Convert the contour into a closed path
from matplotlib import path
closed_path = path.Path(contour.T)
# Get the points that lie within the closed path
idx = np.array([[(i,j) for i in range(r.... |
Matlab spline function in Julia <p>I am trying to interpolate two points in Julia, using the same approach of Matlab (<a href="https://uk.mathworks.com/help/matlab/ref/spline.html" rel="nofollow">https://uk.mathworks.com/help/matlab/ref/spline.html</a>). I have tried the Interpolations (<a href="https://github.com/tlyc... | <p>If you make the assumption that they are evenly spaced, then you are assuming a linear interpolation for which you can use linspace. You just need the start, the end, and the number of values inbetween:</p>
<pre><code>linspace(a[1],a[end],sum(isna(a)))
</code></pre>
<p>More generally, to do an interpolation betwee... |
How can I reset PublisherAdView layout? <p>I am using PublisherAdView in our app to show banner advertisements. So the requirement is to reload ad every 5 minutes and show each ad for 20 seconds. </p>
<p>Now I am using loadAd method but whenever the second ad load's it shows the previous ad and populates the new ad. S... | <p>There's no way to clear the content of the PublisherAdView before loading the second ad, I'm afraid.</p>
<p>You can, however, use an <a href="https://developers.google.com/android/reference/com/google/android/gms/ads/AdListener" rel="nofollow">AdListener</a> to determine when the second ad has finished loading and ... |
Deploy Angular 2 app to Heroku <p>In the past I always bundled my Angular 1 and Rails apps together and typically used heroku, which has worked great for me. Now that I'm over to Angular 2 I want to separate out my Angular and Rails code. I've created a very basic Angular 2 app via the Angular-Cli, but I haven't been... | <p>Ok I came up with a solution. I had to add a very basic PHP backend, but it's pretty harmless. Below is my process.</p>
<p>First setup a heroku app and Angular 2 app.</p>
<ol>
<li>Create your heroku app</li>
<li>Set the heroku buildpack to heroku/php
<ul>
<li><code>heroku buildpacks:set heroku/php --app heroku-... |
Design: Background thread with a Spring service <p>I have Spring service which after performing some tasks,initiates a background Async tasks. The task itself I have defined as a component.
Now, If I have to use some method belonging to my the service which initiated the thread. I can Autowire the service in the thread... | <p>What about using an @Async annotated method as described <a href="https://spring.io/guides/gs/async-method/" rel="nofollow">here</a></p>
<p>A non tested example: </p>
<pre><code>@Service
public class MyService {
private final RestTemplate restTemplate;
public String mySyncMethod(){
return "Hello W... |
azure app service plan memory abstraction <p>Does the Azure app service(specifically App service plan) offering provide memory abstraction?</p>
<p><a href="https://azure.microsoft.com/en-us/pricing/details/app-service/" rel="nofollow">https://azure.microsoft.com/en-us/pricing/details/app-service/</a></p>
<p>If i crea... | <p>If you specify two instances within an App Service plan, that's exactly what you get: Two instances, each having the spec of the size you chose for the App Service plan. They are not bridgeable into a single virtual double-size instance.</p>
<p>So, no - you cannot combine the resources of the two instances. If you ... |
Why am I losing precision while converting float32 to float64? <p>While converting a float32 number to float64 precision is being lost in Go. For example converting 359.9 to float64 produces 359.8999938964844. If float32 can be stored precisely why is float64 losing precision?</p>
<p>Sample code:</p>
<pre><code>packa... | <p>You <em>never</em> lose precision when converting from a <code>float</code> (i.e. float32) to a <code>double</code> (float64). The former <em>must</em> be a subset of the latter.</p>
<p>It's more to do with the defaulting precision of the output formatter.</p>
<p>The nearest IEEE754 <code>float</code> to 359.9 is ... |
CRM 2016 web apis with C# <p>We have CRM 2016 on premise and want to consume the API using c# :</p>
<pre><code>var credentials = new NetworkCredential(username, password);
HttpClient client = new HttpClient(new HttpClientHandler() {Credentials = credentials});
client.BaseAddress = new Uri("https://xxx.elluciancrmrecr... | <p>You should query the OData endpoint to get the information you are looking for assuming <code>date1_events</code> is a custom entity (although the naming convention seems to be off).</p>
<p>As an example to query <code>contacts</code>:</p>
<pre><code>var credentials = new NetworkCredential(username, password);
var... |
System.IO.Compression DLL Missing and Possible Version Conflict <p>I'm building an ASPNET Core/EF Core/MVC 6 website which will ultimately run under Azure. I'm running into an odd problem involving a dependency DLL which I've never encountered before.</p>
<p>The solution consists of a number of projects. Several of th... | <p>The problem ended up being easy to solve...but hard to diagnose.</p>
<p>My project.json file had the following frameworks entry:</p>
<pre><code> "frameworks": {
"net46": {
}
},
</code></pre>
<p>It also stated a dependency, under the dependency section, for System.IO.Compression.</p>
<p>Unfortunately, ... |
Q: (R Programming) Keep completeness of record when subsetting time series datasets <p>I'll explain the problem better. I have downloaded from a databasee some 300,000 observations for a time span of 16 years.
I want to subset the database by taking in account completeness.</p>
<ul>
<li>I want to keep only the observ... | <p>In a simple way, having not seen the data, </p>
<pre><code>name <- c('a', 'a', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'c')
year <- c(1, 2, 3, 4, 5, 1, 2, 4, 5, 3)
data <- data.frame(name, year)
tmp <- aggregate(year ~ name, data, length)
tmp1 <- subset(tmp, year >=5)
</code></pre>
|
How do I match two arrays in C# like in Javascript? <p>To make sure two arrays are the same in Javascript, this is what I do:
(inserting zeroes where there is missing data in item1)</p>
<pre><code> var viewModel = @Html.Raw(Json.Encode(Model));
var items = viewModel.Date1;
var items2 = viewModel.Date2;
... | <p>Something like this should work:</p>
<pre><code>@foreach (var item1 in Model.Date1.Reverse())
{
var item2Count = Model.Date2.Where(i2 => i2.theDate == item1.theDate)
.Select(i2 => i2.theCount)
.FirstOrDefault();
<tr>
<td>@item1.theDate.Value.ToString("MMMM-yyyy") &l... |
In React.js how do you create a link to change the active tab using react-bootstrap? <p>I am using <a href="https://react-bootstrap.github.io/components.html#tabs" rel="nofollow">React-bootstrap Tabs</a> and I want to create a link within my tab content that changes the active tab and opens the second tab.</p>
<p>For ... | <p>The <code>Tabs</code> component has a prop called <code>activeKey</code> - use your component's state to control that value (<a href="https://react-bootstrap.github.io/components.html#tabs-controlled" rel="nofollow">as shown in this example</a>), and then use an <code>a</code> tag with an onClick for your link.</p>
... |
Overlay balance to credit and debit Line graph in PowerBI <p>I am creating a dashboard from a direct query. Using the line graph visulations I am plotting the transaction volumes and splitting them: Credit or Debit.
On the same graph I would like to overlay the current balance. Please see attached image. I would like t... | <p>I would change the visualization to a <strong>Line and stacked column chart</strong>. You can use <strong>Account Balance</strong> for the <strong>Column series</strong>.</p>
<p>The <strong>Line values</strong> is a little trickier. You will need 2 new calculated measures, something like:</p>
<pre><code>Credit = ... |
AngularJS ngCloak not working <p>I have a post category page that should show a message if there are no posts. It's showing the HTML when the page loads and then hiding it. ngCloak sounds like it should do the job but i'm not having any luck with it. Here's the HTML in my template file:</p>
<pre><code> <div ng-sho... | <p>Ng-cloack directive works completely in another way than you expect it. It does not hide HTML, it does show it once template becomes compiled.
The reason is that template compilation in the browser takes some time upon which ugly template without data will be shown to user. To hide uncompiled template you need to ad... |
How to guarantee order in Kafka partition <p>Ok so I understand that you only get order guarantee per partition.</p>
<p>Just random thought/question.</p>
<p>Assuming that the partition strategy is correct and the messages are grouped correctly to the proper partition (or even say we are using 1 partition)</p>
<p>I s... | <p>Yes, you are correct that the order the producing application sends the message dictates the order they are stored in the partition. </p>
<blockquote>
<p>Messages sent by a producer to a particular topic partition will be appended in the order they are sent. That is, if a message M1 is sent by the same producer a... |
Mysql query to get count result and group by <p>I've got three tables with different records for users,</p>
<pre><code>User
username | realname | date
evn-az-3ju john 11/2012 03:09:40 p.m.
jwyvm_rdyt steve 12/2012 03:09:40 p.m.
bsMIAtWkhi mahesh 01/2013 03... | <pre><code>select c.jid as username,c.realname,COUNT(NULLIF(TRIM(o.message), '')) as count from (select r.`jid`,u.realname from roster r join User u on r.jid=u.username where r.username='jwyvm_rdyt' ) c left join offline o on o.message like CONCAT('%', c.jid, '%') and o.username='jwyvm_rdyt' group by jid
</code><... |
Best way to split computation too large to fit into memory? <p>I have an operation that's running out of memory when using a batch size greater than 4 (I normally run with 32). I thought I could be clever by splitting this one operation along the batch dimension, using <code>tf.split</code>, running it on a subset of t... | <p>I discovered that the functional ops, specifically <code>map_fn</code> in this case, address my needs. By setting the <code>parallel_iterations</code> option to 1 (or some small number that would make the computation fit in memory), I'm able to control the degree of parallelism and avoid running out of memory.</p>
|
Find span from a table containing specific aria label <p>I found a table in html containing a specific aria label using the following line</p>
<pre><code>var list = document.querySelectorAll('[aria-label="Help"]');
</code></pre>
<p>Now I get a table with :</p>
<pre><code><thead></thead>
<tbody>
... | <p>You'll have to loop through the collection:</p>
<pre><code>var spans = list.getElementsByTagName("SPAN"),
count = spans.length,
filtered_spans = '',
i = 0;
for(; i < count; i++) {
if (!spans[i].innerHTML.match(/X-Men\s(2|3)/gi)) filtered_spans += spans[i];
}
</code></pre>
|
Python Scraping - Unable to get required data from Flipkart <p>I was trying to scrape the customer reviews from Flipkart website. The following is the <a href="https://www.flipkart.com/samsung-galaxy-j5-6-new-2016-edition-white-16-gb/product-reviews/itmegmrnzqjcpfg9?pid=MOBEG4XWJG7F9A6Z" rel="nofollow">link</a>. The fo... | <p>The reviews etc.. are populated using <em>reactjs</em>, the data is retrieved using an ajax request which you can mimic with requests:</p>
<pre><code>import requests
data = {"productId": "MOBEG4XWJG7F9A6Z", # end of url pid=MOBEG4XWJG7F9A6Z
"count": "15",
"ratings": "ALL",
"reviewerType:ALL... |
Use module in Node js and reassign values <p>I have a javascript module simplified as an eye pose.</p>
<pre><code>var pose = {};
var eye = {};
var left = {};
left.pitchPos = 37;
left.yawPos = 47;
exports.init = function () {
eye.left = left;
pose.eye = eye;
return this;
};
exports.eye = function (e) {
... | <p>The "problem" is with wrong usage of <code>this</code> keyword in this function:</p>
<pre><code>exports.init = function () {
eye.left = left;
pose.eye = eye;
return this;
};
</code></pre>
<p>Returning <code>this</code> in this context means "return the module itself". This means that your assignment (... |
Javascript - Playing sound on variable change <p>I'll try to explain this as much as possible, but basically what I'm trying to do is create an Instant Messaging Service for my website to be used by privately by a group of people. I've got the sending and receiving down pat, but I can't seem to find a work around for t... | <p>I have taken your code, moved a few variable declarations up and switched to using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" rel="nofollow">Array.prototype.forEach()</a> so we don't have to handle incrementing the index manually... This works for me...</... |
Is it possible to change the localStorage file name where i saved data? <p>I would appreciate if someone could help me out with this,
Basically, I am creating a google chrome extension with the objective of saving data from forms in the localStorage folder, so far, so good, it's all working fine and stuff, my question ... | <p>No. </p>
<p>How the browser records data for localstorage is an implementation detail. It is not exposed to JavaScript in a webpage at all.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.