title stringlengths 10 150 | body stringlengths 17 64.2k | label int64 0 3 |
|---|---|---|
How to elegantly check if a number is within a range? | <p>How can I do this elegantly with C#?</p>
<p>For example, a number can be between 1 and 100.</p>
<p>I know a simple <code>if (x >= 1 && x <= 100)</code> would suffice; but with a lot of syntax sugar and new features constantly added to C#/.Net this question is about more idiomatic (one can all it elegan... | 0 |
How to fetch and reuse the CSRF token using Postman Rest Client | <p>I am using Postman Rest client for hitting the rest services. I am getting the following error when I try to execute the rest service from Postman client.</p>
<pre><code>HTTP Status 403 - Cross-site request forgery verification failed. Request aborted.
</code></pre>
<p><a href="https://i.stack.imgur.com/ynwWL.png"... | 0 |
TypeScript set css style for HTMLCollectionOf<Element>, NodeCollection<Element>,google autocomplete forms | <p>how I can set css style for HTMLCollectionOf or NodeCollection</p>
<pre><code> let items = document.querySelectorAll('.pac-item') as NodeListOf<HTMLElement>;
</code></pre>
<p><a href="https://i.stack.imgur.com/oLP5E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oLP5E.png" alt="enter imag... | 0 |
"You don't have an extension for debugging 'JSON with Comments'" warning when debugging VS Code theme | <p>I generated the files necessary for creating a color theme in VS Code. I did this with the <a href="https://www.npmjs.com/package/generator-code" rel="noreferrer">generator-code</a> node package.<br></p>
<p><a href="https://i.stack.imgur.com/aHL8k.png" rel="noreferrer">My file structure is as follows</a><br></p>
<p>... | 0 |
Pandas: for loop through columns | <p>My data looks like: </p>
<pre><code>SNP Name ss715583617 ss715592335 ss715591044 ss715598181
4 PI081762 T A A T
5 PI101404A T A A T
6 PI101404B T A A T
7 PI135624 T A... | 0 |
How to solve error: "Invalid type in JSON write (NSConcreteData)" | <p>I'm trying to write some code to validate a subscription on my iOS App. I'm following this tutorial: <a href="http://savvyapps.com/blog/how-setup-test-auto-renewable-subscription-ios-app/" rel="nofollow">http://savvyapps.com/blog/how-setup-test-auto-renewable-subscription-ios-app/</a></p>
<p>It's not in Swift 2.0,... | 0 |
Include my markdown README into Sphinx | <p>I would like to include my project's <code>README.md</code> into my Sphinx documentation like in
<a href="https://stackoverflow.com/questions/10199233/can-sphinx-link-to-documents-that-are-not-located-in-directories-below-the-root">Can sphinx link to documents that are not located in directories below the root docum... | 0 |
How to prevent the ip address of hyper-v virtual switch from being changed? | <p>I have a laptop with Windows 10 2004 installed. I configureded Hyper-V and created two VMs: On one VM runs windows 10 to enclose serveral malware IM softwares which I have to use for working contacts. On the other VM runs ubuntu server 20.04 for development.</p>
<p>I configured Hyper-V with a virtual switch of type ... | 0 |
Django Query __isnull=True or = None | <p>this is a simple question. I'd like to know if it is the same to write:</p>
<pre><code>queryset = Model.objects.filter(field=None)
</code></pre>
<p>than:</p>
<pre><code>queryset = Model.objects.filter(field__isnull=True)
</code></pre>
<p>I'm using django 1.8</p> | 0 |
How to properly create gcp service-account with roles in terraform | <p>Here is the terraform code I have used to create a service account and bind a role to it: </p>
<pre><code>resource "google_service_account" "sa-name" {
account_id = "sa-name"
display_name = "SA"
}
resource "google_project_iam_binding" "firestore_owner_binding" {
role = "roles/datastore.owner"
... | 0 |
Move body to a specific position - Box2D | <p>I have a b2Body which I would like to move at a certain target position. I don't want to use the SetPosition function. How can I achieve this using :</p>
<ol>
<li>Changing linear velocities.</li>
<li>Using mouseJoint. (The target position is fixed. Mouse is NOT involved.)</li>
</ol>
<p>I'm using Box2DAS3 2.1a. Hel... | 0 |
Debug jar file in eclipse | <p>I have a jar file which is having some issue and I would like to debug it.</p>
<p>I created the application on eclipse. During dev phase I have done debug but with the source code. I wanted to debug jar file to find out the reason of error i.e. it could be source code I have is different from jar file or some jar f... | 0 |
Emulating a mobile screen size through an iframe | <p>Just a random thought,
What if I wanted to showcase a responsive webdesign not by resizing the browser window, but actually loading the responsive site in an IFRAME having the same dimension as that of a mobile screen. Can this work?</p>
<p>assuming that I have an IFRAME </p>
<pre><code><iframe src="something" ... | 0 |
Setting Access-Control-Allow-Origin header on source server | <p>I am using <code>$.get</code> to parse an RSS feed in jQuery with code similar to this:</p>
<pre><code>$.get(rssurl, function(data) {
var $xml = $(data);
$xml.find("item").each(function() {
var $this = $(this),
item = {
title: $this.find("title").text(),
l... | 0 |
• doesn't work in IE? | <p>Is that not an acceptable HTML code to use when designing pages? It renders correctly in Chrome, Safari, Firefox, Opera, etc... but IE literally outputs <code>& bullet;</code></p>
<p>but even when I type the HTML code in this text box it gives me a bullet! •</p>
<p>Is this method deprecated? Should I... | 0 |
Install Redis on Alpine based image in docker | <p>I am trying to install Redis on the <code>golang:1.10.1-alpine3.7</code> image. I tried <code>RUN apk add --no-cache redis</code>, but when I tried to run the <code>redis-cli</code> command, I get an exit status 127, which means the given command in not found. I would like to know how I would be able to run the <cod... | 0 |
Definition of integration point in Abaqus | <p>I need to know the definition of "integration points" in abaqus subroutines.
I'm new to abaqus software and I'm waiting for your help</p> | 0 |
Using Team Foundation Server in Xcode | <p>Has anyone integrated Team Foundation Server in XCode? </p>
<p>I am migrating from Git to TFS.</p>
<p>How can this be done? </p>
<p>Are there any useful tutorials or articles on the matter?</p> | 0 |
Get country code from country name in IOS | <p>Im retrieving a country name from a server in english. For example, "Spain"</p>
<p>What I want to do is, assuming the country name is going to be written in english, get the country code. </p>
<p>What should I do? I´ve found getting the country name from the country code quite easy, but I´ve got no idea of how to ... | 0 |
How to remove selected items from a listbox | <p>This is for a VB.NET 4.5 project in VS2015 Community.</p>
<p>I am trying to remove certain selected items from a listbox, but only if the selected item meets a condition. I've found plenty of examples on how to remove selected items. But nothing that works with a condition nested in the loop going through the selec... | 0 |
Jest mock window.scrollTo | <p>My React component calls <code>window.scrollTo</code> and when I run my jest tests, they pass, but there is a console error:</p>
<pre><code> console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Not implemented: window.scrollTo
at Object.<anonymous>.module.exports (/private/var/www/sampl... | 0 |
iis-express file access permissions | <p>I'm running a wcf service hosted on iis express 7.5.
Inside the service, i have a service operation that needs to write a file on the filesystem, but when it tries to do so, i'm getting an exception.</p>
<p>i'm writing the file to the exact same folder where the project is hosted, by using:
string filePath = HttpCo... | 0 |
Pymongo: How to check if the update was successful ? | <p>How to check if the update was successful in Pymongo? If the record was updated with the same value it should be considered a successful update. ie, Even if the modified count is zero it is considered a successful update. How to do this. </p>
<pre><code>result = _db.testcollection.update_one({"_id": col_id}, {"$set... | 0 |
How to execute SqlQuery with Entity Framework Core 2.1? | <p>In Entity Framework 6, I can execute a raw SQL query on the database using the following command:</p>
<pre><code>IEnumerable<string> Contact.Database.SqlQuery<string>("SELECT a.title FROM a JOIN b ON b.Id = a.aId WHERE b.Status = 10");
</code></pre>
<p>On a new project, I am trying to use Entity Framew... | 0 |
Powershell Invoke-WebRequest returns "remote name could not be resolved" but not proxy error | <p>I am trying to download a page using <code>wget</code> (alias for <code>Invoke-WebRequest</code>) in powershell. The page in question is <code>www.privatahyresvärdar.nu</code>.</p>
<p>When using Internet Explorer I can navigate to <code>www.privatahyresvärdar.nu</code> but I cannot run wget from powershell nor can ... | 0 |
Get the number of days in the current month in Java | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2545110/find-the-number-of-days-in-a-month-in-java">Find the number of days in a month in Java</a> </p>
</blockquote>
<p>I know these are some ways to do it, but I'm having hard time find information how to do ... | 0 |
How to load images from a directory on the computer in Python | <p>Hello I am New to python and I wanted to know how i can load images from a directory on the computer into python variable.
I have a set of images in a folder on disk and I want to display these images in a loop.</p> | 0 |
How to color sliderbar (sliderInput)? | <p>I tried to make different color for a few sliderInput bar in R shiny. It requires css etc. I looked online and can only find how to make one <code>sliderInput</code>. How can I make create several different color to different bars?</p>
<p>Here are my testing code. It will show all bar in same style:</p>
<pre><code> ... | 0 |
Module AppRegistry is not a registered callable module | <p>I'm starting with React Native development and I encountered an issue in the very beginning. When trying to run my app I get errors:</p>
<blockquote>
<p>Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)<br>
Unhandled JS Exception: Invariant Violation: Native mo... | 0 |
Can an "SEO Friendly" url contain a unique ID? | <p>I'd like to start using "SEO Friendly Urls" but the notion of generating and looking up large, unique text "ids" seems to be a significant performance challenge relative to simply looking up by an integer. Now, I know this isn't as "human friendly", but if I switched from</p>
<pre><code>http://mysite.com/products/d... | 0 |
Unique identifier for an iPhone app | <p>For an iPhone app that submits images to a server I need somehow to tie all the images from a particular phone together. With every submit I'd like to send some unique phone id. Looked at <pre>
[[UIDevice mainDevice] uniqueIdentifier]<br>
and
[[NSUserDefaults standardDefaults] stringForKey:@"SBFormattedPhoneNu... | 0 |
What exactly is nullptr? | <p>We now have C++11 with many new features. An interesting and confusing one (at least for me) is the new <code>nullptr</code>.</p>
<p>Well, no need anymore for the nasty macro <code>NULL</code>.</p>
<pre><code>int* x = nullptr;
myclass* obj = nullptr;
</code></pre>
<p>Still, I am not getting how <code>nullptr</cod... | 0 |
How can I color Python logging output? | <p>Some time ago, I saw a Mono application with colored output, presumably because of its log system (because all the messages were standardized). </p>
<p>Now, Python has the <code>logging</code> module, which lets you specify a lot of options to customize output. So, I'm imagining something similar would be possible ... | 0 |
how to alter table Composite primary key | <pre><code>CREATE TABLE [dbo].[INVS_ITEM_LOCATIONS]
([DEPARTMENT_CODE] [varchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[IM_INV_NO] [numeric](10, 0) NOT NULL,
[LOCATION_CODE] [varchar](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CURR_QTY] [numeric](10, 0) NOT NULL CONSTRAINT [DF__INVS_ITEM__CURR___... | 0 |
How to start/stop/restart a thread in Java? | <p>I am having a real hard time finding a way to start, stop, and restart a thread in Java.</p>
<p>Specifically, I have a class <code>Task</code> (currently implements <code>Runnable</code>) in a file <code>Task.java</code>. My main application needs to be able to START this task on a thread, STOP (kill) the thread wh... | 0 |
Setting the titleLabel.font property of a of a UIButton not working | <p>In currently working with iOS 7 and I an attempting to increase the font size of the titleLabel of my UIButton. I am doing it like this,</p>
<pre><code>[[_centerButton titleLabel] setFont:[UIFont boldSystemFontOfSize:28.0]];
</code></pre>
<p>However this does not do anything. Every time I compile with a different ... | 0 |
Home directory does not exist JBOSS | <p>I'm trying to run jboos as 7.1 and when I run the standalone.bat I get this error.
I have configured everything as you can see here:</p>
<pre><code>Calling "C:\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
===============================================================================
JBoss Bootstrap Environment
... | 0 |
Can an oracle SQL query execute a string query selected from a table? | <p>When using oracle SQL is it possible to run a query based on a text_string from a subquery?
An example might clarify what I'm trying to do</p>
<pre><code> select count(sql_text), sql_text
from
(select sql_text
from query_table) sql_table
group by sql_text;
</code></pre>
<p>The outer que... | 0 |
Change keyboard shortcut in sublime text 2 | <p>How do i change the current keys for selecting all with the multiple cursor to CMD + G?</p> | 0 |
Communications link failure due to: java.io.EOFException | <p>My webapp is running on Tomcat 5.5, I declared the datasource in web.xml:</p>
<pre><code><resource-ref>
<res-ref-name>jdbc/OrdiniWebDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable&... | 0 |
Make applications similar to Talking Tom Cat | <p>I want to make an applications similar to Talking Tom Cat, Touch Pets Cats/, Virtual Monkey and the Tap Zoo.</p>
<p>I have knowledge of Iphone basic animation.</p>
<p>I want to know that can i make these apps without OpenGL ,cocos and other gaming environment...
Can i make it by using only basic frameworks...</p> | 0 |
'module' object has no attribute 'basicConfig' | <p>I have the following code, copied from the Python manual:</p>
<pre><code>import logging
LOG_FILENAME = 'example.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
logging.debug('This message should go to the log file')
</code></pre>
<p>When I try to run the script (via <code>python.exe script.py<... | 0 |
How to return an array from a function? | <p>How can I return an array from a method, and how must I declare it?</p>
<pre><code>int[] test(void); // ??
</code></pre> | 0 |
The form component needs to have a UIForm in its ancestry. Suggestion: enclose the necessary components within <h:form> | <p>Here is my form:</p>
<pre><code><form action="j_security_check">
<h:panelGrid columns="2" bgcolor="#eff5fa" cellspacing="5" frame="box" styleClass="center">
<h:outputLabel value="User ID:"/>
<h:inputText id="j_username" tabindex="1" />
<h:outputLabel value="Pas... | 0 |
How do I format a date with Dart? | <p>I have an instance of <code>DateTime</code> and I would like to format that to a String. How do I do that? I want to turn the date into a string, something like "2013-04-20".</p> | 0 |
CypressError: Timed out retrying: cy.click() failed because this element is detached from the DOM | <p>The dropdown basically takes long to get load itself once the back end response is received. If I put a wait of around 8 seconds, then it works. But, don't want to hard code the wait here. Any idea as what might be going wrong? I couldn't identify the css as well.</p>
<pre><code>cy.get('input').last().type(`{select... | 0 |
What is mean by +srv in mongoDb connection string | <p>I am new to MongoDB and just encountered two types of connection string.</p>
<ol>
<li><p>mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]</p>
</li>
<li><p>mongodb+srv://[username:password@]host[/[database][?options]]</p>
</li>
</ol>
<p>I know about the 1st one. B... | 0 |
add quotes around variable in ansible variables | <p>I've got problem with one of ansible playbooks (enrise.postgresql).</p>
<p>It accepts variable postgresql_listen_addresses (list of values to listen_addresses in /etc/postgresql/9.3/main/postgresql.conf).</p>
<p>I want to use value ansible_default_ipv4.address, but ansible provide it without quotes, and postgress ... | 0 |
PDOException SQLSTATE[HY000] [1049] Unknown database 'forge' failed | <p>I want to access a Mysql data the first step is to create a new table for "vanvlymen" and I typed mysql> USE vanvlymen; the database changed. and type SHOW tables; showing the available of the tables that the database contains.</p>
<pre><code>mysql -u root -p
enter password: ****
mysql> show databases;
-datab... | 0 |
How to read xlsx file with ExcelJS? | <p>How does the code should look like to get cell A1 value from the file "C:\1.xlsx"? I tried numbers of examples but still didn't managed to get it work.</p>
<pre><code>var Excel = require('exceljs');
var workbook = new Excel.Workbook();
workbook.xlsx.readFile("C:\1.xlsx")
.then(function() {
var workshe... | 0 |
How Can I Fix "TypeError: Cannot mix str and non-str arguments"? | <p>I'm writing some scraping codes and experiencing an error as above.
My code is following.</p>
<pre><code># -*- coding: utf-8 -*-
import scrapy
from myproject.items import Headline
class NewsSpider(scrapy.Spider):
name = 'IC'
allowed_domains = ['kosoku.jp']
start_urls = ['http://kosoku.jp/ic.php']
... | 0 |
Implement jQuery confirmation modal in a form submit? | <p>I am using jQuery modal confirmation like this:</p>
<pre><code>$(function() {
$( "#dialog-confirm" ).dialog({
resizable: false,
height:190,
width: 330,
modal: true,
buttons: {
"Yes": function() {
$( this ).dialog( "close" );
},
No: function() {
... | 0 |
What is a container manifest? | <p>The only <a href="https://docs.docker.com/registry/spec/manifest-v2-2/" rel="noreferrer">doc</a> on this topic seems to assume I already know what a manifest is, the problem it solves, and how it fits into the docker ecosystem. After reading the doc I'm still not sure how manifests actually work.</p>
<p>My private ... | 0 |
Magento: Disable module for any particular store | <p>Suppose, I have 3 stores.</p>
<p>I want to disable a module in Store 2. I only want it to be enabled in Store 1 and Store 3.</p>
<p>I see that I can do it by:- </p>
<ul>
<li><p>Going to <strong>System -> Configuration -> Advanced</strong> </p></li>
<li><p>Selecting desired store from <strong>Current Configuration... | 0 |
How do I use subscript and superscript in Swift? | <p>I want my <code>UILabel</code> to display text in following manner 6.022*10<sup>23</sup>. What functions does Swift have for subscript and superscript?</p> | 0 |
AWS S3: Force File Download using 'response-content-disposition' | <p>Few lines(below) generate signed URL to which browser is redirected to download a file from S3.</p>
<p>I am facing well known issue of Chrome not downloading pdf files from S3 when content type is set as Octet Stream.</p>
<p>The solution is to force chrome to download file instead of trying to read/open it.</p>
<... | 0 |
go tool: no such tool "tour" | <p>I'm trying out Go for the first time. I was following <a href="https://tour.golang.org/welcome/3" rel="noreferrer">these docs</a> and wanted to run the go tour locally, but I haven't figured out how to get it to work. </p>
<p>Where is the tool "tour" supposed to be found?<br>
I'm on OSX 10.11.3, and I installed Go... | 0 |
C - How do i read all lines of a file | <p>Im unsure how to read all the lines of a file, atm it only reads the first line of the code in the text file. Can someone show me how to make it read all the lines?</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
FILE *fp;
fp = ... | 0 |
Python realtime plotting | <p>I acquire some data in two arrays: one for the time, and one for the value. When I reach 1000 points, I trigger a signal and plot these points (x=time, y=value).</p>
<p>I need to keep on the same figure the previous plots, but only a reasonable number to avoid slowing down the process. For example, I would like to ... | 0 |
What is the difference between a Local Database in C# and a SQL Server Management Studio created database? | <p>I'm creating an application with MS Visual C# 2010 Express that requires a database.</p>
<p>I've learned that there seem to be two ways to create/use a SQL database with this application. </p>
<p>The first seems to be where from within C#, I can create a "local database" by right-clicking on my application in the... | 0 |
css: expand div on hover without displacing other divs | <p>I have the following code :</p>
<pre><code><style>
#items {width:300px;}
.item {width:100px;border:solid 1px #ccc;float:left;height:20px;overflow:hidden;}
.item:hover{height:auto}
</style>
<div id="items">
<div class="item">text 1<br>text 1<br>text 1</div>
... | 0 |
replace column values in one dataframe by values of another dataframe | <p>I have two dataframes, the first one has 1000 rows and looks like:</p>
<pre><code>Date Group Family Bonus
2011-06-09 tri23_1 Laavin 456
2011-07-09 hsgç_T2 Grendy 679
2011-09-10 bbbj-1Y_jn Fantol 431
2011-11-02 hsgç_T2 Gondow 56... | 0 |
Joining multiple tables using Entity Framework | <p>i am trying to join 3 tables using EF but it throws an error saying </p>
<pre><code>consider swaping conditions on either side of equals
</code></pre>
<p>can some one pls help</p>
<pre><code> var billdata = from billtotal in context.billTotals
join billcard in context.billClubca... | 0 |
Javascript TypeError: xxx is not a function | <p>Friends I came to a bit of problem. Everything was working fine before. But I can't rectify why it starts giving me such error.<br>
Here is my JavaScript Code:</p>
<pre><code>function newSupplier() {
$('div#AddSupplier div.msg').html('').hide();
$('div#AddSupplier div.loader').show();
registerSupplier($... | 0 |
Eclipse: Open in New Window | <p>In Package Explorer I right-clicked on project and selected "Open in New Window". New Eclipse window was opened with that project. Then I closed old, "main" Eclipse window, so only new "project" window remained.</p>
<p>Now each time I launch Eclipse I have this "project" window with project name in window title and... | 0 |
converting QdateTime to normal python dateTime? | <p>I have a lot of existing code that just uses the normal <code>dateTime</code> class in python, however in upgrading my program I am using the <code>QtGui.QdateTimeEdit()</code> class, but that class returns a <code>QdateTime</code> object that seems to be incompatible with the normal <code>dateTime</code> object. </... | 0 |
Python - access global list in function | <p>I am new to Python, Before this, I was using C.</p>
<pre><code>def cmplist(list): #Actually this function calls from another function
if (len(list) > len(globlist)):
globlist = list[:] #copy all element of list to globlist
# main
globlist = [1, 2, 3]
lst = [1, 2, 3, 4]
cmplist(lst)
print globlist
</... | 0 |
Xcode 6 won't let me develop on my iOS 8 phone | <p>I was developing an application with iOS 7, and I just updated to the beta of iOS 8. I downloaded Xcode 6 beta and now when I plug my phone in, it lists my phone under "Ineligible devices" and won't let me develop on it. Why is this?</p> | 0 |
Why does Request.Cookies return string instead of HttpCookie object in foreach loop? | <p>This morning I accidentally saw the following snippet code, I was fairly surprised because it work very well.</p>
<p>Don't look at its logic please, I'm just curious why does the HttpCookieCollection (Request.Cookies in this case) return a string (cookie name) instead of a HttpCookie object in foreach loop. Is it a... | 0 |
Can I use JavaScript to create a client side email? | <p>I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.</p>
<p>The mail created by the mailto action has the syntax:</p>
<... | 0 |
preg_match_all JS equivalent? | <p>Is there an equivalent of PHP's preg_match_all in Javascript? If not, what would be the best way to get all matches of a regular expression into an array? I'm willing to use any JS library to make it easier.</p> | 0 |
How to configure git to avoid accidental git push | <p>After git clone, the config in the new repo looks like:</p>
<pre><code>remote.origin.url=<some url>
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
</code></pre>
<p>Then, I can execute "git pull" and "git push". But I'm interested in o... | 0 |
DefaultCredentials in Accessing CRM / Sharepoint Web Services | <p>I made an application that access CRM's web service. The problem is, when I deployed the dll into Sharepoint server, it returned error 401 unauthorized. Apparently the System.Net.CredentialCache.DefaultCredentials didn't work (my suspicion). Here's the code.</p>
<pre><code>CrmSdk.CrmAuthenticationToken token = new ... | 0 |
Python decorators: how to use parent class decorators in a child class | <p><strong>Note</strong>:</p>
<p><em>The accepted answer on the other question shows how to use the parent decorater.</em></p>
<p><em>The accepted answer on this question shows moving the decorator to the module scope.</em></p>
<hr>
<p>EDIT: Using the previous example was a bad idea. Hopefully this is more clear:</... | 0 |
New Project: Ruby on Rails or Symfony2 ( or other framework) | <p>I am about to start a new project and I am hung up on which language/framework to use. I've been a PHP programmer professionally, but it wasn't on the scale of this project. I've played around with RoR and i've been very impressed so far. Right now, the two leading candidtates are RoR and Symfony2.</p>
<p>My major ... | 0 |
Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'aspNetCore | <p>I have recently published my ASP.NET Core application to my host. I am hitting a HTTP Error 500.19.</p>
<p>IIS 8.5 says the issue is:-</p>
<p><strong>"Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'aspNetCore'"</strong></p>
<p>It also highlights this key add line in m... | 0 |
How to properly catch a 404 error in .NET | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1949610/c-how-can-i-catch-a-404">How can I catch a 404?</a> </p>
</blockquote>
<p>I would like to know the proper way to catch a 404 error with c# asp.net here is the code I'm using</p>
<pre><code>HttpWebReque... | 0 |
2 different types of custom UITableViewCells in UITableView | <p>in my UITableView i want to set for the first news of an rss feed a custom tableViewCell(Type A lets say) and for the other news second, third etc.. another custom tableViewCell(trype B) the problem is that the custom tableViewCell(trype A) created for the first news is reused, but curiously the number of rows betwe... | 0 |
Database design for a survey | <p>I need to create a survey where answers are stored in a database. I'm just wondering what would be the best way to implement this in the database, specifically the tables required. The survey contains different types of questions. For example: text fields for comments, multiple choice questions, and possibly questio... | 0 |
Creating a simple black image with opencv using cvcreateimage | <p>Very basic question coming from a newbie in OpenCV. I just want to create an image with every pixel set to <code>0</code> (black). I have used the following code in the main() function:</p>
<pre><code>IplImage* imgScribble = cvCreateImage(cvSize(320, 240), 8, 3);
</code></pre>
<p>And what I get is a solid gray ima... | 0 |
Python 3, module 'itertools' has no attribute 'ifilter' | <p>I am new at Python, trying to build an old python file into Python 3. I got several build errors which I solved. But at this point I am getting above error. I have no idea how to fix this. The code section looks like below.</p>
<pre><code>return itertools.ifilter(lambda i: i.state == "IS", self.storage)
</code></pr... | 0 |
django admin many-to-many intermediary models using through= and filter_horizontal | <p>This is how my models look:</p>
<pre><code>class QuestionTagM2M(models.Model):
tag = models.ForeignKey('Tag')
question = models.ForeignKey('Question')
date_added = models.DateTimeField(auto_now_add=True)
class Tag(models.Model):
description = models.CharField(max_length=100, unique=True)
class Que... | 0 |
How to reset / change password in Node.js with Passport.js? | <p>I use Passport.js in Node.js to create a login system. Everything is ok, but I do not know how to reset user password when they forget their password or they want to change it. </p>
<p>User model in MongoDB</p>
<pre><code>var UserSchema = new Schema({
email: String,
username: String,
provider: String,
... | 0 |
PHPMailer: Using remote SMTP server, works under localhost, Connection refused (111) on remote server | <p>I've got a bizarre problem here. I'm trying to use PHPMailer to send an email, through SMTP. I have a website hosted by GoDaddy and it's that SMTP account that I'm trying to use to send the mail.</p>
<ol>
<li>It works if I execute my PHP file on my localhost server.</li>
<li>It does not work if I execute my PHP fil... | 0 |
Entity Framework Core does not save related data | <p>In continuation of yesterday's <a href="https://stackoverflow.com/questions/40364084/ef-core-cannot-insert-the-value-null-into-column-with-default-value">post</a></p>
<p>Two Entities</p>
<pre><code>public class Realtor
{
public Realtor()
{
Guid = Guid.NewGuid();
Registration = DateTime.Now;... | 0 |
Google Analytics doesn't work on new iOS project | <p>I have created a new iOS project and added Google Analytics support following by official instructions. </p>
<p>I've added to Frameworks:</p>
<pre><code>libGoogleAnalyticsServices.a
AdSupport.framework
CoreData.framework
SystemConfiguration.framework
libz.dylib
</code></pre>
<p>But it doesn't work with the errors... | 0 |
Function convert Hex String to BitArray C# | <p>I created the following function which will do as requested (convert HEX string to BitArray). I am not sure about the efficiency of the function, but my main problem now is that the <strong>Convert.ToInt64</strong> function is <em>endian specific</em>. When this is ported over to alternate chipsets we will get diffe... | 0 |
How to initiate array element to 0 in bash? | <pre><code>declare -a MY_ARRAY=()
</code></pre>
<p>Does the declaration of array in this way in bash will initiate all the array elements to 0?</p>
<p>If not, How to initiate array element to 0?</p> | 0 |
How to use RESTEasy client framework to send data in a POST | <p>I am using the RESTEasy client framework to call a RESTful webservice. The call is made via a POST and sends some XML data to the server. How do I accomplish this?</p>
<p>What is the magical incantation of annotations to use to make this happen?</p> | 0 |
Failed to build Android app (refer to both ActionBarSherlock & ViewPagerTabs) with Ant | <p>I have one Android app which uses ActionBarSherlock & ViewPagerTabs. I use Eclipse to write and build it, and it just works well until I try to build it with Ant. Here's what I did:</p>
<ol>
<li>go to ActionBarSherlock folder, run "android update <strong>lib-project</strong> --path ."</li>
<li>go to ViewPagerTa... | 0 |
nodejs write 64bit unsigned integer to buffer | <p>I want to store a 64bit (8 byte) big integer to a nodejs buffer object in big endian format.</p>
<p>The problem about this task is that nodejs buffer only supports writing 32bit integers as maximum (with buf.write32UInt32BE(value, offset)). So I thought, why can't we just split the 64bit integer?</p>
<pre><code>va... | 0 |
List of mso- attributes | <p>I'm searching for a list of Microsoft specific CSS attributes with mso- prefix.</p>
<p>Any link to an offical or unofficial source would be awesome.</p> | 0 |
How to share redux store in micro frontend architecture? | <p>I am trying to create a small project to implement micro-frontend architecture following <a href="https://martinfowler.com/articles/micro-frontends.html" rel="noreferrer">Micro Frontends</a> article. I am creating multiple repositories for each MFE(Micro frontend) and also using Redux for the application. I have the... | 0 |
Flutter Navigator.of(context).pop vs Navigator.pop(context) difference | <p>What's the difference between <code>Navigator.of(context).pop</code> and <code>Navigator.pop(context)</code>?</p>
<p>To me both seems to do the same work, what is the actual difference. Is one deprecated? </p> | 0 |
Forward HTTPS traffic thru Nginx without SSL certificate | <p>I want to use Nginx to expose my NodeJS server listening on port 443.</p>
<p>I don't want to manage the SSL certificate with Nginx. I would rather do that on the NodeJS server using the <code>SNICallback</code> option of <code>https.createServer</code>.</p>
<p>How do I setup the <code>nginx.conf</code> to support ... | 0 |
Elixir - Looping through and adding to map | <p>I'm rebuilding something in Elixir from some code I built in C#.</p>
<p>It was pretty hacked together, but works perfectly (although not on Linux, hence rebuild).</p>
<p>Essentially what it did was check some RSS feeds and see if there was any new content. This is the code:</p>
<pre><code>Map historic (URL as key... | 0 |
How can I disable some dates range in a fullcalendar? | <p>I want to disable days before and after dates range, anybody know how can I do that? (sorry for my english). </p>
<p>Hernan</p> | 0 |
Handling X-FORWARDED-PROTO header in Java web application | <p>Can any one guide me in working with <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto" rel="nofollow noreferrer">X-FORWARDED-PROTO</a> header in Java web application deployed to Apache Tomcat.</p>
<p>The application setup is in such a way that tomcat talks with Apache webserver, ... | 0 |
How do I compile sql? | <p>I am learning SQL but I have not been able to figure out what is used to compile and run SQL code.</p> | 0 |
Flip ordering of legend without altering ordering in plot | <p>I have found that when adding <code>coord_flip()</code> to certain plots using ggplot2 that the order of values in the legend no longer lines up with the order of values in the plot.</p>
<p>For example:</p>
<pre><code>dTbl = data.frame(x=c(1,2,3,4,5,6,7,8),
y=c('a','a','b','b','a','a','b','b'),
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.