title stringlengths 10 150 | body stringlengths 17 64.2k | label int64 0 3 |
|---|---|---|
How do you dynamically create an AWS IAM policy document with a variable number of resource blocks using terraform? | <p>In my current terraform configuration I am using a static JSON file and importing into terraform using the file function to create an AWS IAM policy.</p>
<p>Terraform code:</p>
<pre><code>resource "aws_iam_policy" "example" {
policy = "${file("policy.json")}"
}
</code></pre>
<p>AWS IAM Policy definition in JSON... | 0 |
input type number in html 5 is not working? | <pre><code><form name="form" method="get" action="" >
Number :
<input type="number" name="num" id="num" min="1" max="5" required="required"/> <br/>
Email :
<input type="email" name="email" id="email" required="required"/> <br />
<input type="submit" name="submit" id="submit" value="su... | 0 |
Cannot find entry symbol _start | <p>My c code on compiling on gcc is giving the error <code>Cannot find entry symbol _start defaulting to 00000</code>. Can anyone tell me why and how to correct it?</p>
<p>The command line is <code>arm-none-eabi-gcc -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp file path</code> and... | 0 |
Is JQuery namespace a good practice? | <p>Can anyone explain to me please that if using a namespace is a good coding practice. And why is it needed? If it was a good approach why JQuery didn't include it by default. There is a separate plugin to allow this functionality.</p>
<p>I saw this <a href="https://stackoverflow.com/questions/527089/is-it-possible-t... | 0 |
Angular 7 - Reload / refresh data different components | <p>How to refresh data in different component 1 when changes made in component 2. These two components are not under same parentnode.</p>
<p><strong>customer.service.ts</strong></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="... | 0 |
Installing wxPython on Ubuntu 12.04 | <p><strong>The Issue:</strong> I am having trouble installing wxPython on Ubuntu 12.04. <em>I would like to find a simple, straightforward way of doing this.</em></p>
<p><strong>What I've Done So Far:</strong> The most relevant instructions that I have been able to find so far can be found here: <a href="http://wiki.w... | 0 |
Wordpress wp-load.php | <p>I'm trying to reverse-engineer a plugin : <a href="http://wordpress.org/extend/plugins/wordpress-social-login/">http://wordpress.org/extend/plugins/wordpress-social-login/</a></p>
<p>In a part of it, there's this line:<br>
(I'm having a hard time understanding the first one, the rest are simply there for reference ... | 0 |
Better way to select all columns from first table and only one column from second table on inner join | <h2>Graphical Explaination</h2>
<p>Table 1's columns:</p>
<pre><code>|a|b|c|d|e|
</code></pre>
<p>Table 2's columns:</p>
<pre><code>|a|x|y|z|
</code></pre>
<p>I want only a, b, c, d, e, x. I only want column 'a' from table 1, not column 'a' from table 2.</p>
<h2>Wordy Explaination</h2>
<p>I have two tables with... | 0 |
Printing array elements with a for loop | <p>This is a challenge question from my online textbook I can only get the numbers to prin forward... :(</p>
<p>Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline.
Ex: If courseGrades = {7, 9, 1... | 0 |
How to create docx file using java? | <p>I am trying to create a .docx file using java but for some reason I can't open the file. The error comes "Problem with the content of file". Does anyone knows how to fix this problem?</p> | 0 |
How to include js.erb file in view folder | <p>I have a JavaScript file to use with a view. There needs to be Ruby code in it, and I need to do <code>render</code> in Ruby, so I understand that I can't put the JavaScript file in the asset pipeline. I can put it in the same view folder as the <code>.html.erb</code> file.</p>
<p>How do I include the JavaScript fi... | 0 |
Post-hoc test for glmer | <p>I'm analysing my binomial dataset with R using a generalized linear mixed model (glmer, lme4-package). I wanted to make the pairwise comparisons of a certain fixed effect ("Sound") using a Tukey's post-hoc test (glht, multcomp-package).</p>
<p>Most of it is working fine, but one of my fixed effect variables ("Sound... | 0 |
C# Design Pattern for Database Helper classes | <p>I'm designing a WCF Service that will called by several hundred clients, and I have a question about the best architecture for the classes that will run by database queries. Today I only access SQL Server, so I have a static class that I call internally that does all the dirty work of creating connections and datare... | 0 |
magento - quick search returns all products | <p>After upgrading from 1.4 to 1.5 the quick search returns all products. The advanced search works just fine. I've cleared the cache and re-indexed everything but still nothing. Any ideas why?</p>
<p>The search also doesn't apply the minimum query length set in the admin (ie, I can enter nothing and still be shown ev... | 0 |
Java format hour and min | <p>I need to format my time string such as this: </p>
<pre><code>int time = 160;
</code></pre>
<p>Here's my sample code:</p>
<pre><code>public static String formatDuration(String minute) {
String formattedMinute = null;
SimpleDateFormat sdf = new SimpleDateFormat("mm");
try {
Date dt = sdf.parse(... | 0 |
mongodb 3.4.2 InvalidIndexSpecificationOption error: The field 'unique' is not valid for an _id index specification | <p>The command <code>db.testCollection.createIndex( { _id: 1 }, {name: "_id_2", unique: true, background: true} )</code> fails on mongo version 3.4.2, but not 3.2.11. The mongo documentation indicates the version 3.4 supports both the <code>unique</code> and <code>background</code> attributes.</p>
<p>Mongo 3.4.2 fail... | 0 |
Accessing JSON object within Object using React/Axios | <p>I’m working with an API that shows data for cryptocurrencies called CryptoCompare. I’m a React noob but I’ve managed to use Axios to do the AJAX request. However I’m having trouble accessing the JSON elements I want.</p>
<p>Here’s what the JSON looks like: <a href="https://min-api.cryptocompare.com/data/all/coinlis... | 0 |
Add embedded image in emails in AWS SES service | <p>I am trying to write a Java app which can send emails to specify emails. In the email i also want to attach some pic.</p>
<p>Please find my code below :-</p>
<pre><code>public class AmazonSESSample {
static final String FROM = "abc@gmail.com";
static final String TO = "def@gmail.com";
static final Str... | 0 |
Use of SET ROWCOUNT in SQL Server - Limiting result set | <p>I have a sql statement that consists of multiple SELECT statements. I want to limit the total number of rows coming back to let's say 1000 rows. I thought that using the SET ROWCOUNT 1000 directive would do this...but it does not. For example:</p>
<pre><code>SET ROWCOUNT 1000
select orderId from TableA
select nam... | 0 |
How to get distinct instance from a list by Lambda or LINQ | <p>I have a class like this:</p>
<pre><code>class MyClass<T> {
public string value1 { get; set; }
public T objT { get; set; }
}
</code></pre>
<p>and a list of this class. I would like to use .net 3.5 lambda or linq to get a list of MyClass by distinct value1. I guess this is possible and much simpler th... | 0 |
How to use -dontwarn in ProGuard? | <p>I am using android studio to build debug and release application.
When i build debug/release application</p>
<pre><code>./gradlew assembleDebug
./gradlew assembleRelease
</code></pre>
<p>both build are created perfectly and run as well. Shows appropriate dialog box for debug or release</p>
<p>now i have added pr... | 0 |
Can float (or double) be set to NaN? | <p>Note: Similar to <a href="https://stackoverflow.com/questions/3949457/c-can-int-be-nan">Can an integer be NaN in C++?</a></p>
<p>I understand this has little practical purpose, but can a <code>float</code> or <code>double</code> be set to <code>NaN</code>?</p> | 0 |
Fetch the value of a given column in Eloquent | <p>I am trying to get the <strong>value</strong> of a single column using Eloquent:</p>
<pre><code>MyModel::where('field', 'foo')->get(['id']); // returns [{"id":1}]
MyModel::where('field', 'foo')->select('id')->first() // returns {"id":1}
</code></pre>
<p>However, I am getting anything but the value <code>... | 0 |
Laravel - Number with 4 decimals | <p>I want to store 1 number with 4 decimals, in my database.</p>
<p>If i use <strong>float</strong> i can add only 2 decimals</p>
<pre><code>$table->float('sell');
</code></pre>
<p><a href="https://i.stack.imgur.com/0ud10.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0ud10.png" alt="enter image descri... | 0 |
Changing the Projection of Shapefile | <p>I am trying to change or assign the projection of a Germany-Shapefile from <code>NA</code> to <code>+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0</code>, but somehow it doesn't work well.</p>
<p>Reproducible Example:
Shapefile and other files can be downloaded <a href="https://www.dropbox.com/s/oq... | 0 |
How to get R to recognize your working directory as its working directory? | <p>I use R under Windows on several machines.</p>
<p>I know you can set the working directory from within an R script, like this</p>
<pre><code>setwd("C:/Documents and Settings/username/My Documents/x/y/z")
</code></pre>
<p>... but then this breaks the portability of the script. It's also annoying to have to reverse... | 0 |
Static variables persisting across sessions in WCF service | <p>I have a WCF service with sessions required</p>
<pre><code> [ServiceContract(SessionMode = SessionMode.Required) ]
</code></pre>
<p>and some static fields. I thought that by having sessions, the static fields would remain the same for each session, but have new instances for different sessions. However, what I... | 0 |
PHP - Getting URL from localhost and online | <p>OK, so localhost, I use <code>WAMP</code> and its <code>http://localhost/PROJECTNAME/</code> and online it's <code>http://PROJECTNAME.COM/</code></p>
<p>So, by using</p>
<p><code><?php echo "Load config file from: http://".$_SERVER['SERVER_NAME']?></code></p>
<p>I get this running on <code>localhost/quiz</c... | 0 |
How to acess jvm default KeyStore? | <p>I want to use java key store to save keys and certificates. can anybody share some code to help me with this?</p> | 0 |
C++: Undefined symbols for architecture x86_64 | <p>I have read most of the other posts with this title, but I could not find a solution.</p>
<p>I have three files (I know the whole program doesn't make any sense, it is just for test purposes):</p>
<p>main.cpp</p>
<pre><code>#include "Animal.h"
Animal ape;
int main(int argc, char *argv[]){
ape.getRace();
... | 0 |
How to create a user in Django? | <p>I'm trying to create a new User in a Django project by the following code, but the highlighted line fires an exception.</p>
<pre><code>def createUser(request):
userName = request.REQUEST.get('username', None)
userPass = request.REQUEST.get('password', None)
userMail = request.REQUEST.get('email', None)
... | 0 |
nginx configure default error pages | <p>First off, first time nginx user. So, I'm still learning the differences from Apache and nginx.</p>
<p>I have a stock install of nginx. (apt-get install nginx-full) I modified the default configuration found at '/etc/nginx/sites-enabled/default' for my setup. However, error pages just don't work. My docroot is... | 0 |
Running multiple async queries with ADODB - callbacks not always firing | <p>I have an Excel workbook that fires three queries to a database to populate three tables on hidden sheets, and then runs three 'refresh' scripts to pull this data through to three visible presentation sheets (one per query). Running this synchronously is quite slow: The total time to refresh is the sum of the time o... | 0 |
How can I estimate the size of my gzipped script? | <p>How can I estimate the size of my JavaScript file after it is gzipped? Are there online tools for this? Or is it similar to using winzip for example?</p> | 0 |
Change the font path when using Font Awesome | <p>It works when I have my CSS file and the font files in the same folder.</p>
<p>But when I put my font files in side a folder, I can't get my icons.</p>
<p>Here is my CSS code..</p>
<pre><code> @font-face {
font-family: FontAwesome;
src: url(fontfile-webfont.eot?v=4.0.3);
src: url(fontfile-... | 0 |
ClassPathResource cannot access my spring properties file (using Spring web MVC) | <p>The actual location of the file is in "D:\eclipse\projects\issu\src\main\webapp\WEB-INF\spring\spring.properties"</p>
<p>I tried:</p>
<pre><code>Resource resource = new ClassPathResource("/src/main/webapp/WEB-INF/spring/spring.properties");
Resource resource = new ClassPathResource("/WEB-INF/spring/spring.propert... | 0 |
Stratified sampling with Random Forests in R | <p>I read the following in the documentation of <code>randomForest</code>:</p>
<blockquote>
<p>strata: A (factor) variable that is used for stratified sampling.</p>
<p>sampsize: Size(s) of sample to draw. For classification, if sampsize
is a vector of the length the number of strata, then sampling
... | 0 |
Angular Material mat-tree with checkboxes select all | <p>I'm using <a href="https://stackblitz.com/angular/gabkadkvybq?file=app%2Ftree-checklist-example.html" rel="nofollow noreferrer">Tree with checkboxes</a>, and I want to add a button to check all checkboxes, I tried different methods but no good, the best thing i was able to achieve is this:</p>
<pre><code> selectAl... | 0 |
Change 1's to 0 and 0's to 1 in numpy array without looping | <p>Let's say I have a numpy array where I would like to swap all the 1's to 0 and all the 0's to 1 (the array will have other values, and there is nothing special about the 0's and 1's). Of course, I can loop through the array and change the values one by one.</p>
<p>Is there an efficient method you can recommend using... | 0 |
getter setter for Hashmap using generics | <p>I have the following two classes</p>
<p>Animal Class</p>
<pre><code>class Animal {
Map<String, A> data = new HashMap <String, A>();
public void setValue(HashMap<String, ?> val)
{
this.data = val;
}
public Map getValue()
{
return this.data;
}
}
</code></pre>
<p>Dog Cl... | 0 |
How to return on the same page after submitting a form in php.? | <p>I am making an e-commerce website where I have lots of products. If a user goes to any product items page and submits any form there then they should come on the same page. </p>
<p>So, how to come on the same page?</p> | 0 |
How to display polygon title while using google map api | <p>I have drawn polygon for each state over united states map.
I wish to display a value (text/int) on top of it. I couldnt find any polygon options able to display text on top of polygon. What are the ways to do this?</p>
<pre><code>var poly = new google.maps.Polygon({
clickable: true,
... | 0 |
empty() vs isEmpty() in Java Stack class | <p>Why does <code>Stack</code> in Java have an <code>empty()</code> method along with the usual <code>isEmpty()</code>? All abstract classes that <code>Stack</code> extends have an <code>isEmpty()</code> method.</p> | 0 |
In Javascript a dictionary comprehension, or an Object `map` | <p>I need to generate a couple of objects from lists in Javascript. In Python, I'd write this:</p>
<pre><code>{key_maker(x): val_maker(x) for x in a_list}
</code></pre>
<p>Another way to ask is does there exist something like <code>jQuery.map()</code> which aggregates objects? Here's my guess (doesn't work):</p>
<pr... | 0 |
Getting undefined components in React Router v4 | <p>Just upgraded to <code>react-router-dom 4.0.0</code>. All my components are either regular <code>class</code>es or fat arrows. They are all exported using <code>export default ThatComponent</code>. Yet I'm getting this:</p>
<p><em>Uncaught Error: Element type is invalid: expected a string (for built-in components) ... | 0 |
Populate a column using if statements in r | <p>I have quite a simple question which I am currently struggling with. If I have an example dataframe:</p>
<pre><code>a <- c(1:5)
b <- c(1,3,5,9,11)
df1 <- data.frame(a,b)
</code></pre>
<p>How do I create a new column ('c') which is then populated using if statements on column b. For example:
'cat' for ... | 0 |
how to drag and drop files from a directory in java | <p>I want to implement dragging and dropping of files from a directory such as someones hard drive but can't figure out how to do it. I've read the java api but it talks of color pickers and dragging and dropping between lists but how to drag files from a computers file system and drop into my application. I tried writ... | 0 |
React Material UI - Export multiple higher order components | <p>I'm stuck on exporting material-ui styles with redux connector. Here is my code:</p>
<pre><code>import React, { Component } from 'react';
import { connect } from 'react-redux';
import Drawer from 'material-ui/Drawer';
import { withStyles } from 'material-ui/styles';
import PropTypes from 'prop-types';
const mapSta... | 0 |
SQL -- Assigning a bit variable in select statement | <p>For example:</p>
<pre><code>declare @bitHaveRows bit
select @bitHaveRows = count(*)
from table
where (predicate)
</code></pre>
<p>Are there any functions I can call on this line:</p>
<pre><code>select @bitHaveRows = count(*)
</code></pre>
<p>to assign this bit a value of 0 if there are no rows, or 1 if the... | 0 |
Is too many Left Joins a code smell? | <p>If you have for example > 5 left joins in a query is that a code smell that there is ...</p>
<ul>
<li>something wrong with your design?</li>
<li>you're doing too much in one query?</li>
<li>you're database is too normalized?</li>
</ul> | 0 |
How to pass password to scp? | <p>I know it is not recommended, but is it at all possible to pass the user's password to scp?</p>
<p>I'd like to copy a file via scp as part of a batch job and the receiving server does, of course, need a password and, no, I cannot easily change that to key-based authentication.</p> | 0 |
No Module named django.core | <p>I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?</p>
<pre><code>Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module>
... | 0 |
Use jQuery to find the label for a selected control or textbox | <p>I want a bit of jQuery code that will allow me to find the label for a control when I click on the textbox... so in my HTML I have this:</p>
<pre><code><label id="ctl00_WebFormBody_lblProductMarkup" for="ctl00_WebFormBody_txtPriceAdjustment">This Is My Label Value</label>
<input type="text" style="... | 0 |
Base Class Doesn't Contain Parameterless Constructor? | <p>I'm making my constructors a bit more strict by removing some of my empty constructors. I'm pretty new to inheritance, and was perplexed with the error that I got: Base Class Doesn't Contain Parameterless Constructor. How can I make A2 inherit from A without there being an empty constructor in A. Also, for my own... | 0 |
IE display: table-cell child ignores height: 100% | <p>I need to dynamically build a table to hold some data.<br>
I've followed the usual approach of using divs with <code>display: table</code>, <code>display: table-row</code> and <code>display: table-cell</code>:</p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div ... | 0 |
How to change visibility of layout programmatically | <p>There is a way to change the visibility of View in the XML, but how can I change programmatically visibility of the layout defined in XML? How to get the layout object?</p>
<pre><code><LinearLayout
android:id="@+id/contacts_type"
android:orientation="horizontal"
android:layout_widt... | 0 |
How to assign a PHP variable value to JavaScript variable | <p>In this code which I am posting i have one problem. I want my PHP variable to be stored in JavaScript variable but it shows error. The code is below.</p>
<pre><code><?php
$name="anurag singh";
echo '
<html>
<head>
<script type="text/javascript" src="jquery-... | 0 |
Butterknife is unable to bind inside my Adapter Class | <p>I have an Adapter that draws the layouts for my Navigation Drawer. My navigation drawer contains two inner xml files: One being the <code>Header</code> and the other being the <code>Row</code>. I draw these out in a single adapter, but when I'm trying to <code>setText()</code> on my header, I get failure to bind. He... | 0 |
matplotlib centered bar chart with dates | <p>To get the bars where the x-axis are dates, I am doing something like this:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
import datetime
x = [datetime.datetime(2010, 12, 1, 0, 0),
datetime.datetime(2011, 1, 1, 0, 0),
datetime.datetime(2011, 5, 1, 1, 0)]
y = [4, 9, 2]
ax = plt.subplot(... | 0 |
Autorun.inf file not lunching the exe on Windows 7 environment | <p>I am writing code for autorun.inf file such as </p>
<pre><code>[autorun]
open=Viewer\viewer.exe
icon=Viewer\viewer.exe,1
</code></pre>
<p>.exe is inside the Viewer Folder but i want to run or lunch this exe automatically (as Autoplay) whenever user insert CD/DVD inside the CD/DVD Drive.</p>
<p>But actually this i... | 0 |
Printing the value of EOF | <p>In Kernighan and Ritchie (the C programming language):</p>
<p>'Write a program to print the value of EOF'</p>
<p>I wrote:</p>
<pre><code>#include <stdio.h>
main(){
int c;
c = getchar();
if ((c = getchar()) == EOF)
putchar(c);
}
</code></pre>
<p>but it doesn't output anything Why?</p> | 0 |
EditText vs TextView | <p>I read the API's and see that <code>TextView</code> is a super class to <code>EditText</code>, but I have a short and simple question: Generally speaking, <code>EditText</code> is used when the text displayed is subject to change, whether it's from the user or the app. <code>TextView</code> is used when the text dis... | 0 |
Nested aggregate functions, Max(Avg()), in SQL | <p>I'm writing this query in SQL :</p>
<pre><code>select MAX(AVG(salary) ) from employees group by department_id;
</code></pre>
<p>First I will get groups by <code>department_id</code> , but next what will happen ?</p> | 0 |
Using SparseIntArray instead of HashMap <Integer, Integer> with putSerializable | <p>When I use a <code>HashMap</code> with an <code>Integer</code> key and data values in Android I get this message in Eclipse:</p>
<pre><code>Use new SparseIntArray(...) for better performance
</code></pre>
<p>Now the problem is that <code>SparseIntArray()</code> doesn't implement the <code>Serializable</code> inter... | 0 |
Java -version shows java 8 while java 11 is installed | <p>After installing java 11 on my system, runtime continues to be 1.8 </p>
<p>Versions of java installed: </p>
<ul>
<li>C:\Program Files\Java\jre1.8.0_201</li>
<li>C:\Program Files\Java\jdk-11.0.3</li>
</ul>
<p>JAVA_HOME env variable value: <code>C:\Program Files\Java\jdk-11.0.3</code></p>
<p>From command prompt r... | 0 |
VSTS unable to load the service index for source 401 | <p>I'm aware of the other posts about the same signature. I still can't resolve my issue after going thru them.</p>
<p>My team uses VSTS's build definition for continuous integration.
<a href="https://i.stack.imgur.com/6VpzE.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/6VpzE.jpg" alt="enter image descrip... | 0 |
How to add bootstrap in Eclipse for jsp pages | <p>I'm having problem while including Bootstrap.jar lib in my eclipse project. I'm unable to access it in my JSP page. </p>
<p>Can anyone help me out so that i can access it in my jsp page.</p> | 0 |
error: expected unqualified-id before ‘int’ | <p>I'm getting the following error when I try to compile my code. I've read through other questions from people who get the same error but none of the answers are relevant to me.</p>
<pre><code>user.cpp:15:7: error: expected unqualified-id before ‘int’
User(int user_id, string user_name, int user_year, int user_zip)... | 0 |
The opposite of the modulo operator? | <p>I remember in java that, the modulo operator could be inverted so that rather than seeing what the remainder is of an operation, you could invert it, so instead it will tell you many times a number was divided by:</p>
<pre><code>Console.WriteLine(1000 % 90);
Console.WriteLine(100 % 90);
Console.WriteLine(81 % 80);
... | 0 |
How to install the ia32-libs in a 64-bit Linux? | <p>I wanna to install the ia32-libs in my linux mint, but when i use <code>apt-get</code> ,it told me sth like this:</p>
<pre><code>Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have un... | 0 |
Reading a pickle file (PANDAS Python Data Frame) in R | <p>Is there an easy way to read pickle files (.pkl) from Pandas Dataframe into R? </p>
<p>One possibility is to export to CSV and have R read the CSV but that seems really cumbersome for me because my dataframes are rather large. Is there an easier way to do so?</p>
<p>Thanks!</p> | 0 |
Problems with unixODBC and FreeTDS config | <p>I have been working on this for way too long and can't seem to figure it out. I am sure I have something wrong in my freetds.conf, odbc.ini or odbcinst.ini. I can connect to my mssql 2008 server using tsql, but still can't with isql or of course through php.</p>
<p>I am on CentOS 5.6.</p>
<p>Can anyone offer some ... | 0 |
Can I delete a HttpSession manually in a servlet? | <p>I took a JSP class and we learnt that we should always remove all the attributes of the HttpSession before we use it. So one of my classmate asked - "How about we delete the HttpSession permanently after we've done using it?" </p>
<p>So, my question is "can a HttpSession be deleted?"</p>
<p>From what I understand ... | 0 |
Glossy gradient with android drawable xml | <p>I'm trying to bring out a glossy xml drawable gradient as a background to a layout. I am already using the start color and end color boring linear gradient. </p>
<pre><code><item>
<shape>
<gradient
android:angle="90"
android:startColor="#242424"
android... | 0 |
How do I define Foreign Key Optional Relationships in FluentAPI/Data Annotations with the Entity Framework? | <p>I have a (sample) application with the following code:</p>
<pre><code>public class Posts
{
[Key]
[Required]
public int ID { get; set; }
[Required]
public string TypeOfPost { get; set; }
public int PollID { get; set; }
public virtual Poll Poll { get; set; }
public int PostID { get... | 0 |
jdbc spring security, apache commons dbcp | <p>In a Spring Security, I defined a jdbc auth manager:</p>
<pre><code><security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="securityDataSource"/>
</security:authentication-provider>
</security:authentication-manager... | 0 |
extjs rowexpander how to expand all | <p>I'm using <code>Ext.ux.grid.RowExpander</code></p>
<pre><code>var expander = new Ext.ux.grid.RowExpander({
tpl : new Ext.Template(
'<p>{history}</p>'
)
});
</code></pre>
<p>it's used in my grid:</p>
<pre><code> var grid = new Ext.grid.GridPanel({
store: store,
columns: [
... | 0 |
How to disable some items of javaFX ComboBox? | <p>Can someone show me how to disable some item of my combobox (With FXML or Java code)? here is my ComboBox:</p>
<pre><code><ComboBox fx:id="cBox">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Easy" />
<String fx:value="Normal" />
<... | 0 |
How to use single & multiple comment line in twig | <p>I'm new in twig project. I need to comment some code like // or /**/. how to use comment in twig?</p>
<pre><code> {%if role=3 %}
<div class="col-md-6">
<div class="form-group">
<label class="control-label">&nbsp;</label>
<s... | 0 |
Searching all cells in a column Excel with vbscript | <p>I wrote a vbScript to gather computer information for each user's computer on login, and Id like to have the script record the information to an Excel sheet on the server, with each computer having its own row.</p>
<p>I wrote this like 6 years ago but lost the script and havent touched vbScript since.</p>
<p>So wh... | 0 |
Generate a sequence of numbers with repeated intervals | <p>I am trying to create sequences of number of 6 cases, but with 144 cases intervals. </p>
<p>Like this one for example </p>
<pre><code>c(1:6, 144:149, 288:293)
1 2 3 4 5 6 144 145 146 147 148 149 288 289 290 291 292 293
</code></pre>
<p>How could I generate automatically such a sequence with </p>
<pre>... | 0 |
'Can't create session Unable to connect to repo' when trying to migrate svn to git | <p>I'm trying to migrate my local svn repo to git. I've been following the steps on this post: <a href="https://stackoverflow.com/questions/79165/how-to-migrate-svn-repository-with-history-to-a-new-git-repository?noredirect=1&lq=1">How to migrate SVN repository with history to a new Git repository?</a></p>
<p>More... | 0 |
Which kind of pointer do I use when? | <p>Ok, so the last time I wrote C++ for a living, <code>std::auto_ptr</code> was all the std lib had available, and <code>boost::shared_ptr</code> was all the rage. I never really looked into the other smart pointer types boost provided. I understand that C++11 now provides some of the types boost came up with, but not... | 0 |
Is there a way to force Yii to reload module assets on every request? | <p>My website is divided into separate modules. Every module has it's own specific css or js files in <code>/protected/modules/my_module/assets/css</code> or <code>js</code> for js files. Yiis assets manager creates folder when I first use page that uses my assets.
Unfortunately if I change sth in my files - Yii does ... | 0 |
Swashbuckle.AspNetCore: 'No operations defined in spec!' problem after update of 'Microsoft.AspNetCore.Mvc.ApiExplorer' package to 2.2.0 | <p>we have .net core 2.1 mvc webapi project which uses Swagger.
we use following packages:</p>
<pre><code><PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" />
<PackageReference Include="Swashbuckle.AspNetC... | 0 |
split firstname and lastname but only on first space | <p>I'm trying to split a string in MSSQL by only the first whitespace
Considering here can have 2 spaces in their full name, I have no idea how to do this.</p>
<p>Example:</p>
<p><code>Henk de Vries</code></p>
<p>I would like to split it into:</p>
<pre><code>Firstname: Henk
Lastname: de Vries
</code></pre> | 0 |
Request-Promise throws "no auth mechanism defined" using async/await | <p>I was just trying out async/await with <code>request-promise</code> and ran into this error:</p>
<pre><code>RequestError: Error: no auth mechanism defined
at new RequestError (node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (node_modules/request-promise-core/lib/plumb... | 0 |
Why is a while loop needed around pthread wait conditions? | <p>I'm learning pthread and wait conditions. As far as I can tell a typical waiting thread is like this:</p>
<pre><code>pthread_mutex_lock(&m);
while(!condition)
pthread_cond_wait(&cond, &m);
// Thread stuff here
pthread_mutex_unlock(&m);
</code></pre>
<p>What I can't understand is why the line <... | 0 |
Create an assoc array with equal keys and values from a regular array | <p>I have an array that looks like</p>
<pre><code>$numbers = array('first', 'second', 'third');
</code></pre>
<p>I want to have a function that will take this array as input and return an array that would look like:</p>
<pre><code>array(
'first' => 'first',
'second' => 'second',
'third' => 'third'
)
</code>... | 0 |
Converting Int to Color in C# for Silverlight's WriteableBitmap | <p>In Silverlight 3 there is now a WriteableBitmap which provides get/put pixel abilities. This can be done like so:</p>
<pre><code>// setting a pixel example
WriteableBitmap bitmap = new WriteableBitmap(400, 200);
Color c = Colors.Purple;
bitmap.Pixels[0] = c.A << 24 | c.R << 16 | c.G << 8 | c.B;
</... | 0 |
Connection Timeout exception for a query using ADO.Net | <p><strong>Update</strong>: Looks like the query does not throw any timeout. The connection is timing out.</p>
<p>This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception.</p>
<p>I <strong>cannot</strong> use any of these techniques:
1) Increase tim... | 0 |
Getting SqlBulkCopy to honor column names | <p>I'm in the process of converting some stored procedure based reporting routines to run in C#. The general idea is to use all the wonders of C#/.NET Framework and then blast the results back into the DB. Everything has been going swimmingly, except for one issue I ran into yesterday and resolved today.</p>
<p>To d... | 0 |
Fastest way to find if int array contains a number | <p>This is an odd question. I have an integer array in Java, where each int represents a color. They will either be 0xFFFFFFFF or 0x0. What would be the FASTEST way to find if this array contains ANY values equal to 0xFFFFFFFF?</p>
<p>This is my current code: </p>
<pre><code>int length = w * h;
for (int i = 0; i <... | 0 |
Read data into Matlab using URL | <p>I want to read weather data from Weather Unground into Matlab directly. For a given site you can select to output the data in comma delimited format. How can I write a Matlab function that will read in the information into Matlab? I don't want to download the file but rather read it in from the URL. </p>
<p>For exa... | 0 |
Facing error of "The default schema does not exist." when executing runtime query inside sp using exec() | <p>i have made a runtime query inside a sp and am exceuting the query within the sp using exec(), but when creating the sp i am getting the error</p>
<pre><code>The default schema does not exist.
</code></pre>
<p>The SP is:</p>
<pre><code>CREATE PROCEDURE MySP
@tableName varchar(100)
AS
BEGIN
SET NOCOUNT... | 0 |
how do I find where a executable is present in macosx? | <p>I have a command called youtube-dl .. but dont know where it is installed.. i can run it from shell.. how do i find where it is installed ? which youtube-dl doesnt say anything.. </p> | 0 |
How to get process's grandparent id | <p>How can i get process id of the current process's parent?<br>
In general given a process id how can I get its parent process id?<br>
e.g. os.getpid() can be used to get the proccess id, and os.getppid() for the parent, how do I get grandparent,</p>
<p>My target is linux(ubuntu) so platform specific answers are ok.<... | 0 |
Run a loop in bash with timeout in a single line | <p>I need to have a single line command that does something in a loop with a timeout.</p>
<p>Something like</p>
<pre><code>export TIMEOUT=60
export BLOCK_SIZE=65536
COMMAND="timeout TIMEOUT while true; do dd if=/tmp/nfsometer_trace/mnt/TESTFILE of=/dev/null bs=BLOCK_SIZE; done"
</code></pre>
<p>The command will be e... | 0 |
jQuery Validation plugin: submitHandler not preventing default on submit when making ajax call to servlet - return false not working | <p>I have a simple form that uses jquery and a servlet. The jquery makes an ajax call to the servlet, the servlet makes some server side calculations, then displays the results on the same page via jQuery. I don't want the form to do a default submit (and go to the servlet) because I want to stay on the same page and... | 0 |
How to println a string and variable within the same parameters | <p>I am writing some code right now and I haven't done this in a while, how would I use the println function to write both a string and a variable?</p>
<p>I tried the following:</p>
<pre><code>System.out.println("randomtext"var);
</code></pre>
<p>and </p>
<pre><code>System.out.println("randomtext",var);
</code></pr... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.