input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Ajax Sourced DataTable inside jquery Tab returns all rows as selected <p>I am fairly new to DataTables and still finding my feet. I have come across an issue with which I require assistance. I have a page with 2 jquery tabs. Inside each tab, exist an ajax sourced DataTable.</p>
<p>The Issue:
When I do a count to deter... | <p>For those whom this may be of assistance; instead of(which works fine outside jquery tabs):</p>
<pre><code>table.rows({ selected: true }).every(function(index){
// Get and store row ID
data.push(this.data()[0]);
$count++;
});
</code></pre>
<p>Use the ... |
Loop throught Twitter followers with rtweet package in R <p>I have a list of Twitter IDs that used a specific hashtag and now I'm trying to make a network graph to see who they follow. With the brand new <strong>rtweet</strong> package, the idea is that for each <code>user_id</code> I use <code>get_friends</code> funct... | <p>The following piece of code works, although maybe It's not the most efficient way for large datasets.</p>
<pre><code>for (i in 1:totalusers)
{
userids[i] <- ids[i,1]
following <- get_friends(userids[i])
final <- rbind(final, data.frame(userids=userids[i], following=following))
}
</code></pre>
<p>I ended u... |
express app.get(' /* ') and api CORs issue <p>can you tell me how I can get my json api? </p>
<p>server.js</p>
<pre><code>app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
})
app.get('/api', function(req, res) {
res.header()
res.json({'message' : 'hi this is my js... | <p>You have cors issue because you are trying to retrieve the data from this url <a href="http://localhost:3000/api" rel="nofollow">http://localhost:3000/api</a> and this is quite normal. The thing is that if you serve your application from another server (let's assume port 80 for apache) it is normal that you have the... |
produce max, min and meanarithmetic mean in C <pre><code>#include <stdio.h>
#include <math.h>
int main( void )
{
float values[999999];
int number = 0;
float max = -100000, min = 100000, total = 0, mean = 0;
while ((scanf("%f", &values[number++])) != EOF )
for(int a = 0; a < numbe... | <p>This for-loop</p>
<pre><code>for( int a=0;a<number;a++){
</code></pre>
<p>seems wrong. It makes you recalculate <code>total</code> for each new input number. Try to remove the for-loop. Like:</p>
<pre><code>while ((scanf("%f",&values[number])) != EOF )
{
total=total+values[number];
if(values[number... |
How To Prevent Binding Refresh <p>In my application, i bind the my string property to textblock tooltip.
The problem is the property that i bind is updating too frequently in runtime. So every time when it is updated tooltip refreshes even property value is same.</p>
<p>Following is the code:</p>
<pre><code><TextB... | <p>Something like this.</p>
<pre><code> public string stringProperty
{
get { return _stringProperty; }
set
{
if (!_stringProperty.Equals(value))
{
_stringProperty = value;
OnPropertyChanged("stringProperty"); //Notify UI only if th... |
How to specify split in a decision tree in R programming? <p>I am trying to apply decision tree here. Decision tree takes care of splitting at each node itself. But at first node I want to split my tree on the basis of "Age". How do I force that.?</p>
<pre><code>library(party)
fit2 <- ctree(Churn ~ Gender + Age... | <p>At every iteration, a decision tree will choose the best variable for splitting (either based on information gain / gini index, for CART, or based on chi-square test as for conditional inference tree). If you have better predictor variable that separates the classes more than that can be done by the predictor Age, t... |
retrofit httpLogInterceptor java.lang.NoSuchMethodError: <p>I was going through <code>HttpLogInterceptor</code> achieve to print log.but it was happened a error.</p>
<pre><code>10-04 05:22:55.753 21294-21851/com.tc.retorfit_okhttp_cache_technique E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.tc.ret... | <p>make sure your <strong>okHttp</strong> and <strong>logging-interceptor</strong> have same version in build.gradle</p>
<p>like</p>
<p><strong>com.squareup.okhttp3:okhttp:3.4.1</strong></p>
<p>and </p>
<p><strong>com.squareup.okhttp3:logging-interceptor:3.4.1</strong></p>
<p>here versions are same <strong>3.4.1</... |
How to setup multi-host networking with docker swarm on multiple remote machines <p>Before asking this question I have read quiet of articles and stackoverflow questions but I couldn't get the right answer for my setup(perhaps it is already answered). Here is the architecture I have been struggling to get it to work.</... | <p>The latest version of Docker has <a href="https://docs.docker.com/engine/swarm/swarm-mode/" rel="nofollow">Swarm Mode</a> built in, so you don't need Consul.</p>
<p>To set up on your boxes, make sure they all have <code>docker version</code> of 1.12 or higher and then you just need to initialise the swarm and join ... |
for loop convert to foreach loop with PDO in php <p>Convert to "foreach loop" from "for loop" where using array and counting array positon with $serviceTitle after data will insert into MySQl</p>
<pre><code>for($i=0;$i<count($serviceTitle);$i++){
$statement = $db->prepare("INSERT INTO invoice (orderN... | <pre><code><?php
if( $_SERVER['REQUEST_METHOD']=='POST' ) {
date_default_timezone_set('Asia/Dacca');
/* check that all variables exist in the POST array */
if( isset( $_POST['Submit'], $_POST['serviceTitle'], $_POST['price'], $_POST['quantity'], $_POST['amount'], $_POST['orderNo'], $_PO... |
Login with twitter to get user profile asp.net <p>I have a web application in asp.net . I want to use login with twiiter to get get user info. I have followed all instructions mentioned in below article</p>
<p><a href="http://www.aspsnippets.com/Articles/Login-with-Twitter-in-ASPNet-using-Twitter-Button.aspx" rel="nof... | <p>Tweetinvi provides a sample project doing exactly what you want to do : <a href="https://github.com/linvi/tweetinvi/tree/master/Examplinvi.Web" rel="nofollow">https://github.com/linvi/tweetinvi/tree/master/Examplinvi.Web</a>.</p>
<p>I have highlighted the lines you will be interested in :</p>
<p><a href="https://g... |
Error "sigemptyset was not declared in this scope" when using C++ compiler with -std=XXX <p>We are catching compiler errors when using <code>sigemptyset</code> on Cygwin. The error occurs with a C++ compiler, but only when <code>-std=XXX</code> is used. Without a standard option, the test program compiles and executes ... | <p>The function is an extension over the ISO C standard.<br>
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigemptyset.html" rel="nofollow">http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigemptyset.html</a></p>
<p>as such is protected on <code>/usr/include/sys/signal.h</code> by<br>
_... |
FCM receive message Issue <p>I'm integrating FCM to my project. But I'm getting below error in Log while notification received. (Error text color is blue)</p>
<pre><code>W/FirebaseMessaging: Received message with unknown type: text
</code></pre>
<p>My code is like this:</p>
<pre><code>public void onMessageReceived(R... | <p>Finally I got the solution</p>
<p>In php side I'm sending </p>
<pre><code>"message_type":"text"
</code></pre>
<p>That's why I got above error.</p>
|
Total duration of the route with time windows is not optimal <p>I prepared a test case illustrating the problem.
The <a href="http://i.stack.imgur.com/PaATw.png" rel="nofollow">route</a> consists of three points:</p>
<pre><code>1001 - depot.
1002 - timewindow 10:00-15:00.
1003 - timewindow 8:00-15:00.
</code></pre>... | <p>In the <code>optaplanner-examples</code> implementation, which follows the academic paper's problem definition, the score implementation soft score is only the time spend on the road. <strong>The current score constraints do not include any penalty for lost time (if any) of vehicles before leaving the depot.</strong... |
Using ARRAY_AGG() with all null values in input <p>I want to select distinct values of columns for each user in my table (in Google BigQuery). I've thought about using <code>ARRAY_AGG()</code> like:</p>
<pre><code>SELECT user_id, ARRAY_AGG(DISTINCT field1) AS f1, ARRAY_AGG(DISTINCT field2) AS f2
FROM t GROUP BY user_i... | <p>From <a href="https://cloud.google.com/bigquery/sql-reference/data-types#array-type" rel="nofollow">https://cloud.google.com/bigquery/sql-reference/data-types#array-type</a></p>
<blockquote>
<p>BigQuery raises an error if query result has ARRAYs which contain NULL
elements, although such ARRAYs can be used insi... |
how to create grid view with 3 columns in MFC using CMFCPropertyGridCtrl class? <p>I am new to mfc and I need to have a control with 3 columns with 3rd column being editable. I want to know that whether CMFCPropertyGridCtrl class can be used for this case? if so, can someone provide me a basic flow/code snippet for it?... | <p>The <code>CMFCPropertyGridCtrl</code> by design supports only two columns <strong>Name</strong> and <strong>Value</strong>. You should use <code>CListCtrl</code> to achieve what you need. Placing an edit control in <code>CListCtrl</code> is easier by setting the <code>LVS_EDITLABELS</code> style. Use <code>EditLabel... |
VBA Excel: Compile error: Syntax error <pre><code>Sub LoopCertain() 'Excel VBA to loop through only include sheets (1-3)
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets ' Start of the VBA loop
Select Case sh.Name
Case Is = "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "D10", "D11", "D12", "... | <p>You can either double the quotation marks or </p>
<pre><code>sh.[D15].Value = "=(4-(D16+D17+D18+D19))+(SUMIF(J27:J38,""Operational"",N27:N38))"
</code></pre>
<p>use <a href="https://msdn.microsoft.com/en-us/library/office/gg264465.aspx?f=255&MSPPError=-2147217396" rel="nofollow"><code>CHR(34)</code></a>.</p>
... |
Android, RXJava, search using debounce <p>I'm using <code>debounce()</code> for handling user searching and dealing with it's pause on typing (searches 1 second after the last char):</p>
<pre><code>RxSearchView.queryTextChanges(searchView)
.debounce(1, TimeUnit.SECONDS)
.subscribe(new Action1&l... | <p>In your case just <code>debounce</code> operator with different parameters is needed:</p>
<p><a href="https://github.com/ReactiveX/RxJava/blob/1.x/src/main/java/rx/Observable.java#L5341" rel="nofollow"><code>public final <U> Observable<T> debounce(Func1<? super T, ? extends Observable<U>> de... |
How can I split an image into multiple files with an action in photoshop? <p>I use Stamps.com to print shipping labels that are 2.4" wide. Stamps.com unfortunately will only generate a pdf of this size label with 4 labels on the sheet. It is not paginated, and will not print sequentially. Their template assumes you wil... | <p>I would be inclined to do that with <strong>ImageMagick</strong> which is installed on most Linux distros and is available for OSX and Windows.</p>
<p>Unfortunately, you haven't provided a sensible sample image, so I'll provide a fake one. I have made the border yellow intentionally so you can see it on StackOverfl... |
signal r storing the Context.connectionID <p>I am new to signalr, I am want to generate connection ID to particular client and store it in database and once any updates is done by any clients will be notify to all but is it good practice to store context.connectionID to database, if not I want to know maintain connecti... | <p>When a client invokes a function on the server side you can retrieve their connection ID via <code>Context.ConnectionId</code>. Now, if you'd like to access that connection Id via a mechanism outside of a hub, you could:</p>
<p>Just have the Hub invoke your external method passing in the connection id.
Manage a lis... |
Generate/storing/reading Secure MCRYPT Salt <p>I know this may be somewhat a common question, there are SO many articles across the net about generating secure salts for password hashing. So far I've picked up the <em>mcrypt_create_iv</em> is generally used for initialisation vectors for encryption, it can be used to c... | <p>I recommend using the <code>password_hash()</code> family of functions, as these will take care of the hashing for you completely. They also offer future-compatibility, and is generally <em>the</em> recommended method for handling passwords in PHP.</p>
<p>Read more about how to use them in this answer:
<a href="htt... |
Stored Procedure is setting variable to value from wrong row <p>I am writing a stored procedure to query a specific table. The behavior I am seeing is really weird though. First let me layout my table design and some sample queries, to make this easier to explain:</p>
<p><strong>Table Structure:</strong></p>
<p><a hr... | <p>In your screenshot your code is:</p>
<pre><code>WHERE [FieldName] = FieldName
</code></pre>
<p>, not what you think:</p>
<pre><code>WHERE [FieldName] = @FieldName
</code></pre>
<p>Effectively, you are not using the <code>@FieldName</code> parameter.</p>
<p>Same problem one line below:</p>
<pre><code>AND [ToCur... |
how to give required in google captcha <p>My PHP:</p>
<pre><code>include_once ('db.php');
$capt_err = '';
$error = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$captcha = $_POST['g-recaptch... | <p>Try something like this</p>
<pre><code> <input type="text" class="inputcontact" id="captcha_contact" placeholder="Cod securitate" name="captcha" onchange="isEmpty('captcha_contact', 'hiba-captcha_contact')">
<div id="error-captcha_contact"><span style="font-size: 8px;"></span>... |
Input data into table and auto sort <p>I am trying to figure out this simple problem. I want to have the user be able to input data and then the data automatically sorts in ascending order to whatever has already been submitted in the table. I'm stuck on the auto-sorting part. Here is my JS Fiddle
<a href="http://jsfid... | <p>If I am not misunderstanding to your question, you can try this:</p>
<hr>
<p><strong>UPDATE:</strong></p>
<p>I've update the code for auto sort while appending new row. You can change default sort order column by configuring <code>defaultSortColIndex</code> value.</p>
<p><div class="snippet" data-lang="js" data-... |
ios - presentRenderbuffer triggers EXC_BAD_ACCESS <p>I've found that when I use textures above <code>GL_TEXTURE18</code> on ios (tested on iOS 10), <code>presentRenderbuffer</code> triggers an <code>EXC_BAD_ACCESS</code>. Is there any reason for that? Can I not use textures up to <code>GL_TEXTURE31</code></p>
| <p>The <code>GL_TEXTUREX</code> are just some defined values, defined enumerations. In your case a GPU is the one that defines the actual number of supported textures and it is your responsibility to check what are these limitations.</p>
<p>You can get that by using <code>glGet</code> something like:</p>
<pre><code>G... |
Returning an object derived from an interface with generic list <p>My application reads in JSON from disk and deserialising using JSON.net; which is working fine.</p>
<p>My JSON is laid out like this:</p>
<pre><code>{
"driver": {
"driverTag": "blah_blah",
"driverName": "Blah Blah",
"driverTransp... | <p>I'm not sure if this solution fits your need but if you create your method and SerialDriverConfig with using generic type T you can use your interface as a returning type. Can you try the code below;</p>
<p><strong>Your Method:</strong></p>
<pre><code>private static DriverConfig<T> DeserialiseDriverConfig&l... |
How to write media queries in sass? <p>I was trying to figure out ways to write media queries in sass. This is my code</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>devi... | <p>You have some errors in your code, missing the <code>$</code> in <code>$devices</code> variable. You write <code>@include screen-width("mobile")</code> but mobile isn't in devices list. In <code>$media</code> variable <code>max-width</code> must be a string and then you have to use interpolation to add in the <code>... |
add a class on product if its $0 - $10,000 woocommerce <p>This is my example</p>
<pre><code>product 1 = $20
product 2 = $50
product 3 = $150
product 4 = $1000
.price50 = products 1 & 2
.price100 = product 3
.price200+ = product 4
</code></pre>
<p>I would like to have a class on its li.product</p>
<p>so it woul... | <p>If class based on product amount than you can use simple conditions as:</p>
<p><em>Store product amount in <code>$productPrice</code>, than use it in simple conditions.</em></p>
<pre><code><?php
if($productPrice >= 20 && $productPrice <= 50){
$class = 'price50';
}
elseif($productPrice >= 50 ... |
Laravel Scheduling - Is a Domain Name Required <p>Is a domain name required to run chronjobs in a Laravel application on a server? Or can I get by without it? There will be no human interaction with this application, only day-to-day automated tasks.</p>
<p>My understanding is that for a regular Laravel application, yo... | <p>Let's see, the domain is for web access, if you don't need to provide nothing over HTTP ports, then I don't see why you would need to buy some domain, you can perfectly deploy the app in a server, and if it is a VPS, even better, because of the freedom of settings you have, my final answer is, no, you don't need any... |
How do i change the if statement to iterate backwards through the array? <p>How do I iterate backwards through the array? What do I need to do to the <code>for</code> statement?</p>
<pre><code>public static void main(String args[])
{
int a[] = {0, 1, 2, 3};
for (int i=1; i<=a.length; i++)
{
Syst... | <p>In case it about traversing the array backwards you can do like this</p>
<pre><code>public static void main(String args[])
{
int a[] = {0, 1, 2, 3};
for (int i=a.length -1 ; i>=0; i--)
{
System.out.println("a[i] = " + a[i]);
}
}
}
</code></pre>
<p>Output</p>... |
Could not retrieve the repositories: Visual Studio Team Services and Azure <p>I'm trying to do <a href="https://azure.microsoft.com/en-us/documentation/articles/cloud-services-continuous-delivery-use-vso/" rel="nofollow">Continuous delivery to Azure using Visual Studio Team Services</a>. But when i try to connect Azure... | <p>I can reproduce that issue with azure classic portal too. But you can achieve that with new azure portal.</p>
<p>Simple steps:</p>
<ol>
<li>Log on <a href="https://portal.azure.com" rel="nofollow">new azure portal</a>.</li>
<li><a href="https://www.visualstudio.com/en-us/docs/setup-admin/team-services/set-up-billi... |
detect when div width is change using javascript <p>I am new in javascript and I want to perform some action when the div with is changed</p>
<p>in jquery, I use this code </p>
<pre><code>var width = $(window).width();
$(window).resize(function(){
if($(this).width() != width){
width = $(this).width();
... | <p>You can use on-resize-event like this:</p>
<pre><code>var body = document.getElementsByTagName("BODY")[0];
var width = body.offsetWidth;
if (window.addEventListener) { // all browsers except IE before version 9
window.addEventListener ("resize", onResizeEvent, true);
} else {
if (window.attachEvent) { // IE... |
send data to server when app is background <p>I'm developing an iOS app which interacts with BLE device. what I wanted to do is, app detects BLE device and gets info from it in background mode. After getting info from BLE in background mode, I want to send that info to server. how can i achieve this functionality.</p>
| <p>Yes you can do this,</p>
<p>Keep one connection request alive in background, whenever your BLE device advertised your app should automatically connect with BLE device and getting information from your BLE device as per your services implementation. After getting data from BLE device you can send that data via web s... |
How to change CSS with ':hover' <p>HTML code</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>.navbar li {
color: #B7B7B7;
font-family: 'Montserrat', sans-serif;
f... | <p>I'm guessing what you're asking for is something like this:</p>
<pre><code>.navbar li:hover ul {
display: block;
}
</code></pre>
<p>But your code is not clear. You currently have <code>.navbar ul ul</code> in your selector, but you don't have two nested <code>ul</code>s anywhere in your markup.</p>
|
convert to mysql prepared statement <p>I am trying to study how prepared statement works in MySQL, I was told that all the codes I am using are vulnerable to MySQL injection, I am using codeigniter php models to write this mysql query code like this for example.</p>
<pre><code>public function getOpenLoans($id){
... | <pre><code>public function getOpenLoans($id){
$sql = "select a.Amount as OpenLoanAmount , a.monthly_amortization as totalInstallment from useropenloan a where a.Owner = ? and UPDATE_DT is null";
$query = $this->db->query($sql, array($id));
$result - $query->result();
return $result;
}
</code></pre>
|
Node ExpressJS Routes issue in routing <p>I am using express-generator to generate the basic routes.</p>
<p>Here is what i have so far in routes</p>
<pre><code>var express = require('express');
var router = express.Router();
var ctrl = require('../controller/index');
var validation = require("../validations/user");
/... | <p>it seems you have not exported ctrl.registerUser function in index.js.</p>
<p>Make sure you have something like this</p>
<p>in validation/user.js</p>
<pre><code>exports.registerUser=function(req,res,next){...};
exports.loginUser=function(req,res,next){...};
</code></pre>
<p>in controller/index.js</p>
<pre><cod... |
Cannot call the php file from angular2 http post request using node server <p>I have rest call like below. Its like cross domain. I want to call the php file which is in the same project folder. But I am getting 404 error. I can able to download the file using error link. That means link what I am giving is correct. </... | <p>Angular2 uses lite-server its default port is 3000.
Enter the host as wamp/lamp server path (where the php files you placed).
Example: localhost,localhost:80 or localhost:8080
Check the below code.</p>
<pre><code>return this._http
.post('http://localhost/app/php/reports.php', data.toString(), {headers: this.hea... |
Android - Multiple Menus in Toolbar <p>I added a menu to my <code>toolbar</code>, but I don't know how to add multiple menus.</p>
<p>main_menu.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/... | <p>do it like this it will show 3 menus on toolbar</p>
<p>try like below</p>
<pre><code><item android:id="@+id/common_menu_settings"
android:icon="@drawable/settings"
android:title="@string/settings"
app:showAsAction="always" />
<item android:id="@+id/common_menu_settings1"
android:icon="@dr... |
ASP WEB API multiple DBContext <p>I have app asp.net core web api app with 2 controllers
OracleController.cs </p>
<pre><code> [Route("api/[controller]")]
public class OracleController : Controller
{
private readonly OracleDbContext _db;
public HeatsController(OracleDbCo... | <p>As you can see in the error message you are missing <code>InitialCatalog</code> property in your connection string. This is required to specify to which database EntityFramework should connect and launch queries against.</p>
|
ArtifactDescriptorException: Failed to read artifact descriptor <p>I'm trying to do a simple app with Spring. I installed the plugin spring (Spring Tool Suite (STS)) for eclipse. I added Maven dependencies in the file pom.xml.im trying to add same Spring dependencies.
i have problem with:
Spring-tx,
Spring-orm,
Spri... | <p>Please try the steps in order as it might just be a glitch.</p>
<ol>
<li>Project -> Clean</li>
<li>Restart Eclipse</li>
<li>Disable then re-enable dependency management (right-click Maven -> Disable Dependency Management then Maven -> Enable Dependency Management</li>
<li>Close and Reopen Project</li>
<li>Project -... |
Registering Different types of Users in Django <p>I wont be needing to write codes much,I just need an idea.I am trying to make users in two different categories.That is a User can either have a Profile or Shop both not both.</p>
<pre><code>class Profile(models.Model):
user=models.OneToOneField(User,on_delete=mode... | <p>As per answer given by Prabhakar, you should use django auth groups.
But, if you want to write your custom permission class, you could also do it.</p>
<p>1) Assuming file name -> self_defined_permission.py</p>
<pre><code> from rest_framework import permissions
from django.contrib.auth.models import Group
class ... |
How do I set write permissions for a directory in AWS for ec2-user? <p>I have created an instance in AWS with Red Hat Enterprise Linux Server release 7.2 (Maipo) and also install PHP on this server.</p>
<p>I have given permission using this command
<strong>chown -R apache:ec2-user /var/www/html/</strong> and also giv... | <p>run this flowing command on terminal.</p>
<pre><code>setenforce 0
nano /etc/sysconfig/selinux
SELINUX=disabled
</code></pre>
|
JAVA program for interview <p>i was asked below question in a java interview for which i am seeking answer </p>
<p>Given String <strong>input</strong>= "good morning"
we have to achieve String <strong>output</strong> = "morning good" </p>
<p><strong>condition</strong> :
1) you have to use 1 for loop and you can only... | <p><strong>The purpose of this answer is not to provide a ready chunk of code but rather the instructions for you to create the script that you need.</strong></p>
<p>What you could do is:</p>
<p>Loop through the string using the <code>charAt(int index)</code> function until you find the space <strong><code>*</code></... |
Sum of difference of squares between each combination of rows of 17,000 by 300 matrix <p>Ok, so I have a matrix with 17000 rows (examples) and 300 columns (features). I want to compute basically the euclidian distance between each possible combination of rows, so the sum of the squared differences for each possible pai... | <p>You could always divide your computation time by 2, noticing that d(i, i) = 0 and d(i, j) = d(j, i).</p>
<p>But have you had a look at <code>sklearn.metrics.pairwise.pairwise_distances()</code> (in v 0.18, see <a href="http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.pairwise_distances.html... |
How to do POST using requests module with Flask server? <p>I am having trouble uploading a file to my Flask server using the Requests module for Python. </p>
<pre><code>import os
from flask import Flask, request, redirect, url_for
from werkzeug import secure_filename
UPLOAD_FOLDER = '/Upload/'
app = Flask(__name__)... | <p>You upload the file as the <code>random.txt</code> field:</p>
<pre><code>files={'random.txt': open('random.txt', 'rb')}
# ^^^^^^^^^^^^ this is the field name
</code></pre>
<p>but look for a field named <code>file</code> instead:</p>
<pre><code>file = request.files['file']
# ^^^^^^ the fiel... |
xo lint error: `document` is not defined <p>I've been a long time user of <a href="http://standardjs.com" rel="nofollow">Standard</a>, and now that I'm working on a new project, I've been asked to start writing semicolons.</p>
<p>I'm trying to use both xo, Babel and React, but I keep getting an error when I try to lin... | <p>The <code>envs</code> option for <code>xo</code> <a href="https://github.com/sindresorhus/xo#envs" rel="nofollow">defaults to <code>node</code></a>, so it won't be expecting to see <code>document</code>, etc.</p>
<p>You can include <a href="http://eslint.org/docs/user-guide/configuring#specifying-environments" rel=... |
How to use "date" and "number" type TextBox in ASP.NET 2.0 and allow server side for them <p>I am working in ASP.NET framework 2.0 and i want to use the <code>Date</code>, <code>Time</code> and <code>Number</code> text box fields as below,</p>
<pre><code><asp:TextBox ID="text_number" TextMode="Number" runat="server... | <p>You should be able to do this, asp will render the type attribute as is</p>
<pre><code><asp:TextBox ID="text_number" type="number" runat="server"></asp:TextBox>
<asp:TextBox ID="text_date" type="date" runat="server"></asp:TextBox>
<asp:TextBox ID="text_time" type="time" runat="server">... |
Pagination after reindex in Azure Search <p>I am new in Azure Search Service and I am not sure I got one important thing about it:</p>
<p>Let's pretend the situation when I am as a client scrolling down through results of my search query:</p>
<p><em>"New Y"</em>. I have 1000 elements, every page contains 10 of it. Bu... | <p>You'll see the changes as you execute subsequent requests. To Azure Search each request is independent and it represents a new search (caching aside), which for paging scenarios just happens to have a different "skip" number. </p>
<p>This means that if your data is changing you might see an item more than once (if ... |
Not getting count From this query through mysqli_fetch_object <p>this is my query for count value and its count </p>
<pre><code>echo $getq2 = "SELECT publisher,COUNT(publisher) from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage W... | <p>change the query to like this.</p>
<pre><code>echo $getq2 = "SELECT publisher,COUNT(publisher) as publisherCount from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage WHERE $getq2_ UNION ALL SELECT publisher FROM indianjournal WH... |
work with Html::button in Yii 2 <p>i create a gridview in Yii 2 like below :</p>
<pre><code> <?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\ActionColumn'],
['class' => 'karti... | <p>Definition of <code>Html::button()</code> is</p>
<pre><code>public static string button ($content = 'Button', $options = [])
</code></pre>
<p>so first parameter is anything you want to put inside.</p>
<p>You can use plain HTML</p>
<pre><code>Html::button('<b>xxx</b><span>yyyy</span>');
</... |
Botkit And Aws Lambda <p>How to deploy an slack bot which is built using Botkit in Aws Lambda.
If it is a slash command we can respond to event by using below code.</p>
<pre><code>exports.handler = function(event, context) {
//Echo back the text the user typed in
context.succeed('You sent: ' + event.text);
};
... | <p>Slack support two API integration styles RTM through WebSockets (original style with lowest latency) and Events API pushed over HTTP whenever something you're interested in happens (newer and more efficient but a bit more latency which is usually not a problem). You can read more in the <a href="https://api.slack.co... |
How do I use this API in vba? <p>so I've never used API's before and I'm fairly new to VBA. However, I'm trying to use the following API
<a href="http://api.scb.se/OV0104/v1/doris/sv/ssd/START/FM/FM0401/MFIM1" rel="nofollow">http://api.scb.se/OV0104/v1/doris/sv/ssd/START/FM/FM0401/MFIM1</a>
to automatically downloa... | <p>That's JSON data, which, for example, can be parsed using JScript:</p>
<p>VBA module:</p>
<pre><code>Option Explicit
Function GetData(myUrl As String) As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("Microsoft.XMLHTTP")
winHttpReq.Open "GET", myUrl, False
winHttpReq.Send
Ge... |
Adaptive Gridview depending on content <p>Wanting an adaptive gridview to change depending on how much content is given to the gridview item. can only really get this to work with one column by setting vertical content alignment to stretch, but i would like to have more than one column. Below is a an example of what I'... | <p>Maybe take a look at the VariableSizedWrapGrid, you can indicate for each item how much row or columnspan you want.</p>
<p>A good example and detail on how to use it is available here <a href="http://www.bartlannoeye.com/blog/windows-10-grouped-variablesizedwrapgrid-similar-to-windows-8" rel="nofollow">http://www.b... |
POST JSON in body request with Jersey <p>I have a dynamic web project in Java (deployed on a local application server Tomcat 7) which uses Jersey for creating REST APIs.</p>
<p>I do not use any build automation tools (so my libraries are added to the build path and the servlet is inserted in the web.xml file).</p>
<p... | <p>You should tell Jersey to use Gson for JSON handling. You can do this implementing the <code>MessageBodyReader</code> and <code>MessageBodyWriter</code> interfaces provided by Jersey.
In this <a href="http://stackoverflow.com/questions/9516224/using-gson-instead-of-jackson-in-jersey">stackoverflow question</a> you ... |
How can I make my UI to load faster and imrpove performance? <p>I have an UI which contains a button and a list which contains some data. When the user clicks on the button before the list is loaded, it gives a NPE. I added a null check like this which prevents the crash.</p>
<pre><code>//here cardData is the List wh... | <p>try this :</p>
<pre><code>if (cardData.lenght > 0) {
for (CardDisplayData display : cardData) {
// do something
}
}
</code></pre>
|
Remove malicious code <p>A few days ago I found many infected files with malicious code on my serwer (a few wordpress, prestashop, and some php apps).
I can use simple commands, but lack of SSH knowledge gets in the way to find a solution of my own...</p>
<p>To search infections I use find command like this: </p>
<pr... | <ol>
<li>When I faced with situation like yours, on one of my clients hosting I used <a href="https://github.com/emposha/" rel="nofollow">PHP Shell Detector</a> and modified it to delete or change each file in half-manual mode. There were some "false detections", but it helped with most of the files.</li>
</ol>
<p>Abo... |
Get date from <td> if there is one <p>There are multiple table rows. The table cell with class "dates" can contain a date or the value "Permanent". If there is a date and this is greater than today's date, it should be colored in red.</p>
<p>I tried (but won't work):</p>
<pre><code>if(($(".dates").getDate() < new ... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(".dates").each(function(){
if(new Date($(this).html()) < new Date()) {
$(this).css("color", "green");
}
... |
Node JS: Call external HTTP request by 'https' library <p>When i call external http request by basic 'https' library , i cannot mention port address ,but when i show log error it shows port address is '80' why it shows and where is the problem in my code??</p>
<pre><code> var http = require("http");
http.create... | <p>"<code>getaddrinfo ENOTFOUND</code> means client was not able to connect to the given address. Please try specifying host without http." Try this:</p>
<pre><code>var options = {
host: 'example',
method: 'GET',
headers: {
'Authorization':'Bearer 22bc5ce9f7934da6616ac7d883dbb8c9',
... |
Unity, to what object should I attach my game engine script <p>Me and my friend are building a simple idle game as our first project in unity.
We got to the point at which we build a script that handles all calculations, and communicates with each <code>GameObject</code> the player sees.</p>
<p>Now, to what should we ... | <p>Convention says to put it on the main camera or an empty <code>GameObject</code>.</p>
<p>If you really don't want to do either of those, you could make your class static.</p>
<p>If your class inherits from <code>MonoBehaviour</code> you have to attach it to a <code>GameObject</code>. If you want to attach it to a ... |
undeclared identifier, object vector <p>I am getting an error and I don't know how to fix it. I checked everything and maybe I overlooked something, but I am not able to find the problem.</p>
<p>Errors:</p>
<blockquote>
<pre><code>1>------ Build started: Project: Aquarium, Configuration: Release x64 ------
1> ... | <p>The problem is that when you include <em>EntityControl.h</em> you have also included <em>Fish.h</em> which refers to <code>Fish</code> defined in <em>Fish.h</em>. However <em>EntityControl.h</em> refers to <em>Fish.h</em> which won't get included because of the <code>pragma once</code> directive. If you remove <code... |
Unable to retrive data from webservice ionic1 framework <p>I am new to <code>ionic1 framework</code> and working on <em><code>sidemenu ionic app</code></em>. I want to get list of playlist from <code>Mysql Database</code>.<br>
I have tried this in my <strong>controller.js</strong> :</p>
<pre><code>.controller('Playlis... | <p>Your code works asynchron. That is why you add an anonymous function to retrieve the data.</p>
<p>The <code>console.log</code> is called right after the request but before the response is there. So <code>$scope.playlists</code> is empty.</p>
<p>You have to put the <code>console.log</code> inside the success callba... |
Alamofire multiple request <p>I have <code>tableView</code> and I use <code>Alamofire</code> to send and get request from server.
as you can see in picture, in my <code>tableView</code> I send multiple request in table's header and <code>cell</code> at index 0,1. if I send my request in one function it will too long to... | <p>You should create <strong>one request</strong>.</p>
<p>So by parsing your request you should <strong>set up your data source into an array</strong>, so <strong>each row</strong> will get the data <strong>from a single item</strong> of that array.</p>
<p>Then you would update your table view with this data source.<... |
Microsoft Visual Studio Express not processing } correctly <p>So, I am new to C#, and I was messing around creating a simple password form. This is the code to the password part</p>
<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using Sy... | <p><strong>Problem Cause:</strong></p>
<p>Your if/else statement syntax is incorrect. You need to remove the <code>;</code> after <code>if</code> and <code>else</code></p>
<p><strong>Solution:</strong></p>
<p>Change this:</p>
<pre><code>if (PSW2 == "MyPassword") ;
{
if (PSW2 == "MyPassword") ;
{
Mes... |
How to re-use dynamically added views in custom `CursorAdapter` <p>I use <code>bindView()</code> method is custom <code>CursorAdapter</code> implementation to dynamically add text views to a list. </p>
<p>Each list item is represented by <code>list_item</code> layout which contains <code>flow_layout</code> layout from... | <pre><code>if(LinearLayout.getChildCount() > 0)
LinearLayout.removeAllViews();
</code></pre>
|
Display tooltip through invisible control /button WPF <p>Why is tooltip not displaying when hovering item behind transparent control in WPF?
How can i make the UserControl display the tooltip through the invisible control? I also tried with a rectangle instead of button, same result, no tooltip.</p>
<pre><code><Gr... | <p>Set <code>IsHitTestVisible="False"</code> for the <code>Button</code> .</p>
<p>EDIT #1 after user comments.</p>
<p>I think you should do this : </p>
<pre><code> <Button BorderThickness="0" BorderBrush="Transparent" Background="Transparent" Height="100" Width="100">
<Grid Height="100" Width="100">... |
Tomcat Server "Commons Daemon Service Manager" Command prompt <p>I have installed the latest tomcat 9.0.0.M10 server on my windows 10 laptop.
I have successfully configured the tomcat in Eclipse Luna IDE as well.</p>
<p>But I want to open the command prompt "Commons Daemon Service Manager" in my windows to run a jspap... | <p>Let's describe step by step.</p>
<ol>
<li><p>Creating *.war file. Right click on your app, Export and select WAR File.
<a href="http://i.stack.imgur.com/htKoJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/htKoJ.png" alt="enter image description here"></a></p></li>
<li><p>Locate this <code>WAR File</code> i... |
JSON Parse error: Unexpected identifier "RCTWebSocketModule" <p>I have upgraded react and react-native dependencies. When I try to build and run my react-native application on a real device, I get following stacktraces in xcode and app freezes on a white screen after launching.</p>
<pre><code>2016-10-04 12:33:37.501 [... | <p>I ran into this tonight. It was a cache issue for me. Restart the React Native Packager. </p>
|
seaborn violinplot out of valid range <p>I am using seaborn to create violin plots. Right now I am creating violin plots out of proportion values (so all values are between 0 and 1), but the resulting violin plot is quite off. Its bottom ranges into negative values and its top ranges into values greater than 1. Below ... | <p>The link provided by mbatchkarov answers my question. Thanks!</p>
|
Open not index page with Framework7 <p>I try to open link with Framework7.
For example I need to open</p>
<p><a href="http://name.com/about.html" rel="nofollow">http://name.com/about.html</a></p>
<p>But it open about.html without Framework7</p>
| <p>I am going to quote a paragraph from the documentation of Framework7.</p>
<p><a href="https://framework7.io/docs/pages-ajax.html" rel="nofollow">https://framework7.io/docs/pages-ajax.html</a></p>
<blockquote>
<p>By default Framework7 will load all links using Ajax, except links with additional external class (<c... |
How to parse text from html file <pre><code>import urllib2
import nltk
from HTMLParser import HTMLParser
from bs4 import BeautifulSoup
l = """<TR><TD><small style=font-family:courier> >M. tuberculosis H37Rv|Rv3676|crp<br />VDEILARAGIFQGVEPSAIAALTKQLQPVDFPRGHTVFAEGEPGDRLYIIISGKVKIGRR<br... | <p>I notice you import BeautifulSoup, so you can use BeautifulSoup to help you extract these information.</p>
<pre><code>soup = BeautifulSoup(l,"html.parser")
print soup.get_text()
</code></pre>
<p>I've tried and it worked, but the sentence in the last tag will also be extracted, you have to cut the result if needed.... |
how ftp client knows about ftp server port no?while sending data <p>I open ftp connection,it is opening with server port 21 and client port is random(49938).
but while try to download file from ftp server,client opens one more tcp connection,like client port is 49939 and server port is 51681.
my question is How client ... | <p><a href="http://i.stack.imgur.com/9j8RS.png" rel="nofollow">Server passive port</a></p>
<p>When client request for passive mode, server reply with passive port number which will be used by client to open TCP connection for Data.Please see attached wireshark pic.</p>
|
UITextView html text - Refer font from project <p>I am setting <code>HTML</code> text for <code>UITextView</code> using <code>NSAttributedString</code>. All tags are working except for font family and color. Font family is OpenSans which is not <strong>Microsoft supported font</strong> as mentioned <a href="https://www... | <p>You just need to add <em>OpenSans.ttf</em> file to your project, then set the <code>font-family</code> and <code>color</code>.</p>
<p>This would be the code (in Swift 2):</p>
<pre><code>let htmlString = "<html><body style='font-family:OpenSans; color: rgba(74, 143, 137, 1)'>The Breakthrough Course ..."... |
How to make an async button click update a TextView dynamically with Xamarin Android <p>In Xamarin Native Android app I am calling methodOne() and getting some details. After this I want to updated the details to text view and then calls the methodTwo(). After executing MethodTwo I have to clear the text details from t... | <p>Without access to the full code it is tricky to give you an answer but</p>
<pre><code>Ticket = act.ExecuteTicket(httpUrl, "Ticket");
</code></pre>
<p>this line has the potential to take a while to complete if it performs network operations and probably runs in a background thread not to freeze the UI.</p>
<p>Pres... |
Laravel Run Function in Specified Time <p>How to run a function at specified time that specify when insert a data to database (date and time)?</p>
<p>When i save data January 30, 2017. The function will run at January 30, 2017,</p>
<p>When i create another data February 01, 2017, then the function will run at Februar... | <p>Use Cron is a time-based job scheduler in Unix-like computer operating systems.</p>
|
Operators in Java <p>I am studying operators in Java and I have a problem that I can't solve.</p>
<pre><code> public static boolean first(){
System.out.println("first");
return true;
}
public static boolean second(){
System.out.println("second");
return true;
}
public static ... | <p>Don't confuse operator precedence with <em>evaluation order</em>. <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.7" rel="nofollow">Java always evaluates expressions left-to-right</a>:</p>
<blockquote>
<p>The Java programming language guarantees that the operands of operators appear ... |
Registration isn't working <p>I wrote jsp to handle registration. Here is the code: </p>
<pre><code><%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import... | <p>You should use validation on userside. Thats mean when a user dint enter the name or last name it should show some message that username can't be blank.</p>
<p>For that you can use java script for validation.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div... |
Does empty add/remove event definition prevent references? <p>I'm implementing an interface which defines an event which I don't need/want, but I want to avoid keeping unwitting subscribers 'alive'.</p>
<p>I think that if I define the event explicitly, this should suffice, but will the compiler add code in there and t... | <p>Yes this should work. I use the same trick if an interface forces INotifyPropertyChanged and some of the implementations are immutable.</p>
<p>But I wasn't sure so I tested it using this class:</p>
<pre><code>public class Foo : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged
... |
How to rewrite or redirect in subdirectory with htaccess? <p>I have difficulties to understand how htaccess rewrite / redirect is working. I have been trough already more than 20 article about it but I don't catch the logic and the syntax of how to write rules properly.</p>
<p>I currently have a server with public_htm... | <p>The following code will need to be added to the .htaccess file in the public_html folder of your hosting account. </p>
<p>You will need to insert the following code block and make modifications as noted in the (#) comments. </p>
<pre><code># .htaccess main domain to subdirectory redirect
# Do not change this line.... |
How to display div element always when checkbox is not marked <p>I have checkboxes and when I start maring them, a div appears. How can I make the div to be visible always and not only when a checkbox is marked?</p>
<p>Live example: <a href="https://www.advokatami.bg/poruchki/bundle/" rel="nofollow">https://www.advoka... | <p>The div you're talking about gets appended when a checkbox is checked from line 208 of the code you provided:</p>
<pre><code>var html = '<dl class="product-addon-totals"><dt>' + woocommerce_addons_params.i18n_addon_total + '</dt><dd><strong><span class="amount">' + formatted_addo... |
System.Data.SqlClient.SqlException: Invalid object name 'dbo.PersonWorkplaces'. After changing from one-to-many into many-to-many relationship <p>I've changed from a one-to-many relationship between my two models <code>Workplace</code> and <code>Person</code>. Entity Framework has correctly created the table that conne... | <p>You can define <code>OnModelCreating</code> in your <code>DbContext</code>:</p>
<p>You need to tell Entity Framework which way around you want the mapping, as currently its guessing and getting the tables the wrong way around. in your <code>OnModelCreating</code> add something like:</p>
<pre><code>protected overri... |
Is there a better way to parse this Map? <p>Fairly new to Go, essentially in the actual code I'm writing I plan to read from a file which will contain environment variables, i.e. <code>API_KEY=XYZ</code>. Means I can keep them out of Version control. The below solution 'works' but I feel like there is probably a better... | <p>1- You may read all with just one function call <code>r.ReadAll()</code> using <code>csv.NewReader</code> from <code>encoding/csv</code> with:</p>
<pre><code>r.Comma = '='
r.TrimLeadingSpace = true
</code></pre>
<p>And result is <code>[][]string</code>, and <strong>input order is preserved</strong>, Try it on <a h... |
Xcode 8 Swift 3 Why does generateBoundaryString() generate an error? <p>The compiler says the method is an unresolved identifier. What is wrong with: <code>var boundary=generateBoundaryString()</code>?</p>
<pre><code>import UIKit
import Foundation
class ViewController: UIViewController,
UIImagePickerControllerDe... | <p>The <code>generateBoundaryString()</code> function is not defined by UIKit, so it needs to be added.</p>
<p>Here's a suitable definition to add below the <code>IBAction</code>:</p>
<pre><code>func generateBoundaryString() -> String {
return "Boundary-\(NSUUID().uuidString)"
}
</code></pre>
|
How do I edit jquery.validate message in angular <p>I have installed jquery.validate by bower.</p>
<p>and I wanna edit message above.</p>
<pre><code>messages: {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a val... | <p>resolve this problem. </p>
<p>I add above. </p>
<pre><code>$scope.$on('$viewContentLoaded', function() {
jQuery.extend(jQuery.validator.messages, {
required: "This field is required.",
remote: "Please fix this field.",
email: "Please enter a valid email address.",
url: "Please enter a valid URL."... |
net surgery on a custom caffe model <p>I'm trying to modify the weights of a caffemodel which is part of a caffe-branch called Deep Lab. Although there is a tutorial on <a href="http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/net_surgery.ipynb" rel="nofollow">how to do net surgery</a>, when I try to ... | <p>I found it already. I had literally to remove every custom layer and especially adapt the data layer such that it could read all the input images and thereby calculate the input dimensions.</p>
|
Variables C# UWP <p>I have two files. Need to get variables from one to another. I set them as global in the file where they are defined and filled. But in the second file when it reads variables, they are empty. How can I solve this problem? The code from the first file:</p>
<pre><code>public sealed partial class New... | <p>replace your code with this,</p>
<pre><code> public string Name1 = string.Empty;
public string Mob = string.Empty;
public string Adres = string.Empty;
public string Email = string.Empty;
public string telephone = string.Empty;
</code></pre>
|
How to pass state/props when redirecting to another route in React? <p>I have a signup form and after a user signs up, it will redirect to the email confirmation page(/confirmation) where a user types a confirmation code that I sent via an email. When a user submits a confirmation code, I want to send the code and a us... | <p>I figured it out.</p>
<pre><code> this.context.router.push({
pathname: '/confirmation',
state: {email: this.state.email}
})
</code></pre>
<p>and access state by:</p>
<pre><code> this.props.location.state.email
</code></pre>
|
write.df failing in sparkr <p>I am trying to write a SparkDataFrame using SparkR.</p>
<pre><code>write.df(spark_df,"/mypartition/enablers/Prod Data/data2/tempdata/tempdata_l2/","csv")
</code></pre>
<p>But getting the following error-</p>
<pre><code>InsertIntoHadoopFsRelationCommand: Aborting job.
java.io.IOException... | <p>The checksum file is not deleted properly. Can you try renaming checksum (crc) file and re-execute.</p>
<pre><code>cd /mypartition/enablers/Prod Data/data2/tempdata/tempdata_l2/__temporary/0/task_201610040736_0200_m_000110/
mv .part-r-00110-c4c5f30e-343d-4b02-a0f2-e9e5582047e5.snappy.parquet.crc .part-r-00110-c4c... |
Allocating additional members of a dynamic array in c++ <p>I am trying to find out if I can allocate additional memory for additional members for a dynamic array in C++. The code below is stripped down to just essential stuff for simplicity's sake.</p>
<p>What I am basically trying to do is read elements into <code>ar... | <p>I just liked the question and did some experiments myself, using <code>MSVC14</code> compiler (optimizations disabled).<br>
C++11/14 has the following sequence containers (intentionally excluded <code>dynarry</code> introduced in C++14): </p>
<ol>
<li>No dynamic resizing (up to the programmer to allocate and deall... |
Encode all XML tags in a string <p>I got the codes below to encode XML content in String. It's working fine to encode a single tag, but not all the tags within.</p>
<pre><code>String a = @"<main>" +
"<Title title=\"Hello & <> World\" />" +
"<Content content=\"bla bla &... | <p>I resolved the problem by using the codes below:</p>
<pre><code>static class SubstringExtensions
{
public static String MakeXMLCompatible(this String value, String tag = "")
{
Int32 valueLength = value.Length;
Int32 currentIdx = 0;
String tmp = value;
while (currentIdx < ... |
Display component's content from @ContentChildren in multiple rows using *ngFor on Angular 2 <p>I'm trying to write a simple list view (grid view?) with multiple columns using Angular 2 that I can instantiate this way:</p>
<pre><code><file-list [items]="items">
<file-list-column title="Id" field="id">&... | <p>So, I found the solution for the problem based on the links in Günter Zöchbauer's answer.</p>
<p>In the <code>FileList</code> component I added a <code><template></code> element to load the template from my <code>FileListColumn</code> component. It looks like this now:</p>
<pre><code><tr *ngFor="let ite... |
Can I get an compatible version of WebSphere Application Server 8.5.5 for free for testing my source code? <p>I'm coding an application for a firm that runs <em>WAS 8.5.5 - Java IBM SDK 7.0</em>. </p>
<p>I haven't found a developers version for free. There's a free option for <strong>develop and test</strong> my appli... | <p>Yes. For traditional WAS, you can obtain a <a href="http://www.ibm.com/developerworks/downloads/ws/wasdevelopers/index.html" rel="nofollow">no-charge/no-support runtime version for development and testing</a>. The restriction is that its usage is limited to a combined 2 GB of memory across all instances of applicati... |
How to match multiple arrays inside foreach loop? <p>m'y question is: How to match multiple arrays (two, or even more) inside a foreach loop (or while)</p>
<p><a href="http://i.stack.imgur.com/4pst9.png" rel="nofollow"><img src="http://i.stack.imgur.com/4pst9.png" alt="here is m'y <code>Var_dump</code>... | <p>How about getting both the name and the id in the sql query? </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>$cat = $bdd->query('SELECT cat_name, cat_id FROM cate... |
How to avoid a user from writing specific info in Firebase? <p>I have this scenario, we have a userA visiting another userB's profile and he clicks on follow. Once he follows userB we want him to write to Firebase and add to userB's followers: { userA: true }... looking at rules I understand we can authenticate the use... | <p>So it sounds like you want to have this structure:</p>
<pre><code>followers
<uid>
<follower_uid>: true
</code></pre>
<p>And you want to allow only the user with <code>follower_uid</code> to write the value.</p>
<p>This can be done with the following security rules.</p>
<pre><code>{
"rules":... |
Find the numbers larger than them in the collection <p>Let's say we have a collection of numbers like { 16,17,4,3,5,2 }. Now the objective is to find those numbers which are greater than the rest in the collection while compare with their right elements.
Indicates that 16 compared to 17 is less and cannot be consider. ... | <p>You can go from right to left and filter increasing sequence of numbers</p>
<p>Example: </p>
<pre><code>class Program
{
static void Main( String[] args )
{
var intCollection = new List<Int32>() { 16, 17, 4, 3, 5, 2 };
var intResults = new List<Int32>();
var currentMaxVal... |
Optional belongsTo relationship not pushed to store <p>I'm having a problem where an optional belongsTo relationship isn't properly pushed to store. In my Ember application I have a relationship between 2 models that is optional. For example imagine:</p>
<pre><code>App.User = DS.Model.extend({
profile: DS.hasMany('p... | <p>After a second look at the JSON-API it seems I have interpreted it wrong. The normalized payload should instead be</p>
<pre><code>...
relationships: {
user: {
data: null
}
}
...
</code></pre>
<p>which solved it for me. </p>
|
Rewrite htaccess rule : hide the main url and call it on another url <p>I want to rewrite the URL to achieve this.</p>
<p><a href="http://example.com/testcompany/login" rel="nofollow">http://example.com/testcompany/login</a></p>
<p>should call to</p>
<p><a href="http://example.com/u/testcompany/login" rel="nofollow"... | <p>Try it like this, you can use it for any string in your given format we are rewriting to your working url.</p>
<p>try this in root.</p>
<pre><code>RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\w-]+)$ u/$1/$2 [NC,L]
</code></pre>
|
How can I build a database-based Spring Boot environment / property source? <p>The goal is running Spring Boot application with an Environment containing keys & values loaded and generated by a database connection (DataSource).</p>
<p>Or, more abstract defined: While a configuration by files only should be preferr... | <p>Spring Boot provides some different extensions point for this early processing step: <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-boot-application.html#howto-customize-the-environment-or-application-context" rel="nofollow">http://docs.spring.io/spring-boot/docs/current/referenc... |
Different colors for annotations in google charts <p>I have two types of annotations, one has links and other doesn't. I want to color them both in different colors. Is it possible?</p>
<p>type 1 is -<br>
<code>{
v: 'sample',
Link: 'some link
}</code></p>
<p>type 2 is - </p>
<p><code>{
v: 'sample',
}</co... | <p>you can style the annotations for the overall chart,<br>
or for each series individually </p>
<p>see following working snippet,<br>
the <code>fontSize</code> is set to <code>10</code> for all annotations<br>
then the colors are changed for the individual series </p>
<p><div class="snippet" data-lang="js" data-hi... |
Use constants in Swift like Objective-C <p>How i can use global constants like:</p>
<pre><code>#define EXAMPLE 123
</code></pre>
<p>from Objective-C in Swift???</p>
<p>I need to use string constants, which must be defined in AppDelegate to use in all App with <code>#include "AppDelegate.h"</code> in each class files... | <p>I suggest making a structure, in a seperate file, with its properties as <code>let</code> constants. So something like this</p>
<pre><code>struct myConstants {
static let firstConstant = "hello"
static let secondConstant = "goodbye"
}
</code></pre>
|
Clear textfield on button click action in Swing <p>I have a number of buttons, that when clicked on will run a script and if successful will generate a Passed/Failed message displayed in a text field on a GUI using Swing. I have noticed that the text for the previous result is still displayed even after clicking on a n... | <p>The simplest solution is to create another thread.</p>
<pre><code>if (Test1.isEnabled()) {
errorLabel.setText("");
new Thread(()->{
Result result = JUnitCore.runClasses(Test1.class);
EventQueue.invokeLater(()->errorMessageDisplay(result));
}).start();
}
</code></pre>
<p>That is no... |
Why does MEF2 not apply metadata attributes to all part exports? <p>I'm trying to port a collection of .NET Framework-based applications to .NET Core, and as part of this process I need to switch from using MEF1 to MEF2. I've been having a lot of difficulty wrapping my head around issues relating to MEF2 (though I've f... | <p>Turns out I just needed to delete 6 characters. Instead of making <code>TargetDeviceAttribute</code> inherit from <code>ExportAttribute</code>, it should just inherit from <code>Attribute</code> instead:</p>
<pre><code>[MetadataAttribute, AttributeUsage(AttributeTargets.Class)]
public class TargetDeviceAttribute : ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.