qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
44,414 | In *"Your brain hallucinates your conscious reality,"* Anil Seth's demo of the brain being able to understand a completely distorted audio clip was amazing.
(Just watch 60 seconds from [this point](https://youtu.be/lyu7v7nWzfo?t=6m5s) rather than the full 17 minute lecture.)
If I want to make my own audio clip demo ... | 2018/06/11 | [
"https://sound.stackexchange.com/questions/44414",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/20059/"
] | I wouldn't call this a distortion as it is a 'new', synthesized sound based on the original sound. A distortion would be the original sound, shaped (see [waveshapers](https://en.wikipedia.org/wiki/Waveshaper))
I believe this is a sine wave that is modulated based on the characteristics of the original phrase. It sound... | I found a really impressive free website that is almost ¹ good enough to use for this purpose: **<https://voicechanger.io/>**
The one I used is called "alien2" and is currently shown as the 8th option from the top left.
P.S. Behind the scenes (in the code of "alien2"), these seem to be the relevant settings (although... |
16,453,656 | On a phone without hardware buttons, the soft keys bar looks like:

In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:

How can ... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88597/"
] | Use ASIHTTPRequest.h class and ASINetworkQueue.h for downloading the file.
and use this code for progress bar
```
request = [ASIHTTPRequest requestWithURL:@"http://webaddress.com/pro/download/file.pdf];
[request setDelegate:self];
[request setDownloadProgressDelegate:progressView];
[request setShowAcc... | I'm afraid it's not normal, use asynchronous method to get the NSData. |
16,453,656 | On a phone without hardware buttons, the soft keys bar looks like:

In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:

How can ... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88597/"
] | **Using [AFNetworking](https://github.com/AFNetworking/AFNetworking),**
here **progress is the UIProgressview**
```
#import <AFNetworking/AFNetworking.h>//add to the header of class
-(void)downloadShowingProgress
{
progress.progress = 0.0;
currentURL=@"http://www.selab.isti.cnr.it/ws-mate/example.pdf";
... | I'm afraid it's not normal, use asynchronous method to get the NSData. |
16,453,656 | On a phone without hardware buttons, the soft keys bar looks like:

In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:

How can ... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88597/"
] | Use ASIHTTPRequest.h class and ASINetworkQueue.h for downloading the file.
and use this code for progress bar
```
request = [ASIHTTPRequest requestWithURL:@"http://webaddress.com/pro/download/file.pdf];
[request setDelegate:self];
[request setDownloadProgressDelegate:progressView];
[request setShowAcc... | First of all you should be clear whether to make a synchronous call or asynchronous.
For mobile apps or any other app asynchronous is preferred one.
Once you are clear use **[NSURLConnection](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Refere... |
16,453,656 | On a phone without hardware buttons, the soft keys bar looks like:

In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:

How can ... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88597/"
] | **Using [AFNetworking](https://github.com/AFNetworking/AFNetworking),**
here **progress is the UIProgressview**
```
#import <AFNetworking/AFNetworking.h>//add to the header of class
-(void)downloadShowingProgress
{
progress.progress = 0.0;
currentURL=@"http://www.selab.isti.cnr.it/ws-mate/example.pdf";
... | Use ASIHTTPRequest.h class and ASINetworkQueue.h for downloading the file.
and use this code for progress bar
```
request = [ASIHTTPRequest requestWithURL:@"http://webaddress.com/pro/download/file.pdf];
[request setDelegate:self];
[request setDownloadProgressDelegate:progressView];
[request setShowAcc... |
16,453,656 | On a phone without hardware buttons, the soft keys bar looks like:

In some app (e.g. the browser), the soft keys bar is minimized and more screen space is available:

How can ... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16453656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88597/"
] | **Using [AFNetworking](https://github.com/AFNetworking/AFNetworking),**
here **progress is the UIProgressview**
```
#import <AFNetworking/AFNetworking.h>//add to the header of class
-(void)downloadShowingProgress
{
progress.progress = 0.0;
currentURL=@"http://www.selab.isti.cnr.it/ws-mate/example.pdf";
... | First of all you should be clear whether to make a synchronous call or asynchronous.
For mobile apps or any other app asynchronous is preferred one.
Once you are clear use **[NSURLConnection](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Refere... |
40,874,752 | I am trying to build my app for iOS but I get this error :
```
Successfully prepared plugin tns-core-modules for ios.
Processing node_modules failed. TypeError: str.replace is not a function
```
I don't understand why this only occurs while building for iOS (android works fine).
I've already tried adding/removing pl... | 2016/11/29 | [
"https://Stackoverflow.com/questions/40874752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1596746/"
] | Starting with your `Node` class:
```
public class Node {
// add a parent attribute to the class
// this will be used in your shortestPath method
// i have explained it below
private Node parent;
}
```
The `Edge` class:
```
public class Edge {
// why do you have four of these? You only need two
... | You can use java.util.TreeSet as a priority queue. It contains methods add() for putting an element into the queue and pollFirst() for taking an element with the lowest value.
For comparison, you can either make the class objects of which you will put into the queue (most probably, it is not simply Node, but rather an... |
58,898,914 | Is there a way to access what the current time step is in `scipy.integrate.odeint`?
I am trying to solve a system of ODEs where the form of the ode depends on whether or not a population will be depleted. Basically I take from population `x` provided `x` doesn't go below a threshold. If the amount I need to take this ... | 2019/11/17 | [
"https://Stackoverflow.com/questions/58898914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2613271/"
] | Just use
```
str(currnetdate)
```
To convert the datetime object to a string. You could also use f-strings. | You can't concatenate `date` to `str`. If you use Python 3.6 or newer use f-string
```
main_api = f'https://www.sydneyairport.com.au/_a/flights/?query=&flightType=departure&terminalType=domestic&date={currnetdate}&sortColumn=scheduled_time&ascending=true&showAll=true'
```
otherwise cast `currnetdate` to `str`
```
m... |
16,676,669 | Im trying to update records in my table with the followin, my problem is however that my browser outputs an empty white page with no source, Can anybody see what I'm doing wrong?
```
<?php
require 'dbconfig.php';
//Always place this code at the top of the Page
session_start();
if (!isset($_SESSION['id'])) {
// ... | 2013/05/21 | [
"https://Stackoverflow.com/questions/16676669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | You have assigned a variable to your query, but you are not running it.
```
$query = mysql_query("UPDATE users SET email= '$email' WHERE id='$uid'") or die(mysql_error());
```
So, the above is just a redundant code. to run it, you should call `$query`, like this
```
if($query){
echo 'Updated performed';
}else{
ec... | You are not displaying anything after DB operation. So nothing will be printed. |
16,676,669 | Im trying to update records in my table with the followin, my problem is however that my browser outputs an empty white page with no source, Can anybody see what I'm doing wrong?
```
<?php
require 'dbconfig.php';
//Always place this code at the top of the Page
session_start();
if (!isset($_SESSION['id'])) {
// ... | 2013/05/21 | [
"https://Stackoverflow.com/questions/16676669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | You have assigned a variable to your query, but you are not running it.
```
$query = mysql_query("UPDATE users SET email= '$email' WHERE id='$uid'") or die(mysql_error());
```
So, the above is just a redundant code. to run it, you should call `$query`, like this
```
if($query){
echo 'Updated performed';
}else{
ec... | you can do like this:
```
$query = mysql_query("UPDATE users SET email= '$email' WHERE id='$uid'") or die(mysql_error());
$sql_query = mysql_query($query);
if(mysql_affected_rows()) {
$msg = "something has changed!";
} else {
$msg = "nothing has changed!";
}
``` |
16,676,669 | Im trying to update records in my table with the followin, my problem is however that my browser outputs an empty white page with no source, Can anybody see what I'm doing wrong?
```
<?php
require 'dbconfig.php';
//Always place this code at the top of the Page
session_start();
if (!isset($_SESSION['id'])) {
// ... | 2013/05/21 | [
"https://Stackoverflow.com/questions/16676669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766532/"
] | You are not displaying anything after DB operation. So nothing will be printed. | you can do like this:
```
$query = mysql_query("UPDATE users SET email= '$email' WHERE id='$uid'") or die(mysql_error());
$sql_query = mysql_query($query);
if(mysql_affected_rows()) {
$msg = "something has changed!";
} else {
$msg = "nothing has changed!";
}
``` |
3,037,193 | >
> If $f = g$ a.e. in $E \in \mathfrak{M}$ (the Lebesgue measurable sets)
> and $f$ is continuous a.e. in $E$, is $g$ continuous a.e. in $E$?
>
>
>
I think this is true.
My “proof”:
>
> Let us denote $D\_1 = \{ x \in E: f(x) \text{ discontinuous}\}$,
> $m(D\_1) = 0$ and $D\_2 = \{ x \in E: f(x) \neq g(x)\}$... | 2018/12/12 | [
"https://math.stackexchange.com/questions/3037193",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/397536/"
] | The claim is not true. An easy counterexample is obtained by letting $f$ be identically 0 and $g$ be the characteristic function of the rationals. We have $f=g$ a.e., $f$ is everywhere continuous and $g$ is nowhere continuous.
(Clearly, the restriction of $g$ to the irrationals is continuous (being constant), but thi... | $f$ continuous on $E\setminus D\_1$ implies $f$ continuous on $E\setminus(D\_1\cup D\_2)$. And of course, $g$ continuous on $E\setminus(D\_1\cup D\_2)$. Then the measure of $D\_3$ is at most that of $D\_1\cup D\_2$. |
3,037,193 | >
> If $f = g$ a.e. in $E \in \mathfrak{M}$ (the Lebesgue measurable sets)
> and $f$ is continuous a.e. in $E$, is $g$ continuous a.e. in $E$?
>
>
>
I think this is true.
My “proof”:
>
> Let us denote $D\_1 = \{ x \in E: f(x) \text{ discontinuous}\}$,
> $m(D\_1) = 0$ and $D\_2 = \{ x \in E: f(x) \neq g(x)\}$... | 2018/12/12 | [
"https://math.stackexchange.com/questions/3037193",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/397536/"
] | The claim is not true. An easy counterexample is obtained by letting $f$ be identically 0 and $g$ be the characteristic function of the rationals. We have $f=g$ a.e., $f$ is everywhere continuous and $g$ is nowhere continuous.
(Clearly, the restriction of $g$ to the irrationals is continuous (being constant), but thi... | No your proof does not work because the fact that $f(x)=g(x)$ on $E\setminus D\_1$ implies $g(x)$ is continuous from the continuity of $f(x)$ tells you that:
$D\_2\cap (E \setminus D\_1) \subseteq (E \setminus D\_3)$
which means:
$D\_3 \subseteq (E \setminus D\_2) \cup D\_1$ |
21,261,828 | Hi I have a c program that takes in two numbers and adds them. very simple and just learning c here. however i have a csv file with two columns that I have parsed with a bash script, and piping that into the c program does not yield a result. For example if I *manually* type in:
```
$ ./adder 1 2
$ 3
```
and then my... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21261828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219765/"
] | With `$ ./adder 1 2` you are passing `1 2` as command line arguments to the program, which are available in `argv[]`.
But with `$ ./parser | ./ adder` the output of `parser` is passed as input to `adder` i.e if `adder` tries to read from standard input - `stdin` (using functions like `scanf`, `gets` etc) , it will get... | Looks like adder accepts numbers in command line, and in the pipe you try to feed the numbers in standard input. You should be able to achieve what you want with xargs:
```
./parser | xargs ./adder
``` |
21,261,828 | Hi I have a c program that takes in two numbers and adds them. very simple and just learning c here. however i have a csv file with two columns that I have parsed with a bash script, and piping that into the c program does not yield a result. For example if I *manually* type in:
```
$ ./adder 1 2
$ 3
```
and then my... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21261828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219765/"
] | With `$ ./adder 1 2` you are passing `1 2` as command line arguments to the program, which are available in `argv[]`.
But with `$ ./parser | ./ adder` the output of `parser` is passed as input to `adder` i.e if `adder` tries to read from standard input - `stdin` (using functions like `scanf`, `gets` etc) , it will get... | You should try using `xargs` to read the output of one program into the command-line aruments of the next.
Pipes redirect *stdout* to *stdin*. stdin is different than entering your arguments on a command-line. xargs allows you to convert stdin (created by a pipe) to command-line arguments. Try this:
```
./parser | x... |
21,261,828 | Hi I have a c program that takes in two numbers and adds them. very simple and just learning c here. however i have a csv file with two columns that I have parsed with a bash script, and piping that into the c program does not yield a result. For example if I *manually* type in:
```
$ ./adder 1 2
$ 3
```
and then my... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21261828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3219765/"
] | Looks like adder accepts numbers in command line, and in the pipe you try to feed the numbers in standard input. You should be able to achieve what you want with xargs:
```
./parser | xargs ./adder
``` | You should try using `xargs` to read the output of one program into the command-line aruments of the next.
Pipes redirect *stdout* to *stdin*. stdin is different than entering your arguments on a command-line. xargs allows you to convert stdin (created by a pipe) to command-line arguments. Try this:
```
./parser | x... |
37,102,462 | I want to remove the following border but I do not know how to do it.
[](https://i.stack.imgur.com/qjwJA.png)
How would I be able accomplish to remove this using CSS? Please help me out, it's very much appriciated!
---
My HTML and CSS below:
```css
table {
width:100%;
... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37102462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6230907/"
] | You need to remove the border from the left side of the last `div` and right side of the previous `div`.
So I have added two classes `.no-left-border` and `.no-right-border` and applied them to the applicable `td` tags.
```css
table {
width: 100%;
font-size: 14px;
}
table,
th,
td {
border: 1px solid #00b... | Remove the **left border** from the **last** TD `:nth-last-child(1){`
Remove the **right border** from the **penultimate** TD `:nth-last-child(2){`
```css
table {
width:100%;
font-size:14px;
}
table, th, td {
border: 1px solid #00b0f0;
border-collapse: collapse;
}
th, td {
padding: 5px;
... |
37,102,462 | I want to remove the following border but I do not know how to do it.
[](https://i.stack.imgur.com/qjwJA.png)
How would I be able accomplish to remove this using CSS? Please help me out, it's very much appriciated!
---
My HTML and CSS below:
```css
table {
width:100%;
... | 2016/05/08 | [
"https://Stackoverflow.com/questions/37102462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6230907/"
] | You need to remove the border from the left side of the last `div` and right side of the previous `div`.
So I have added two classes `.no-left-border` and `.no-right-border` and applied them to the applicable `td` tags.
```css
table {
width: 100%;
font-size: 14px;
}
table,
th,
td {
border: 1px solid #00b... | Working code & preview
======================
---
```
<html>
<head>
<style>
body,th,td
{
font-family:Arial,Helvitica,Sans;
font-size:13px;
}
table
{ border-spacing:0; }
th
{
... |
52,188,780 | I want to write an application that prints an document.
Which design would be better? Variant A:
```
class Document
{
public string Title { get; set; }
public string Author { get; set; }
public string Content { get; set; }
// ...
}
class DocumentPrinter
{
public void PrintDocument(Document docume... | 2018/09/05 | [
"https://Stackoverflow.com/questions/52188780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6735292/"
] | From my opinion, solution A is better because it followed SOLID, and it easier for maintain, extend,... your app.
In addition, I think you should implement DocumentPrinter based on an interface( maybe IDocumentPrinter).
```
interface IDocumentPrinter
{
void PrintDocument(Document document);
}
class DocumentPrint... | The most common general response to this problem is to give `Document` a formatting function (possibly defined in an interface) that takes a string and substitutes its parameters thereinto, and then have a `Printer` or `DocumentPrinter` class that applies a given format and then "prints" the result (whether that means ... |
52,188,780 | I want to write an application that prints an document.
Which design would be better? Variant A:
```
class Document
{
public string Title { get; set; }
public string Author { get; set; }
public string Content { get; set; }
// ...
}
class DocumentPrinter
{
public void PrintDocument(Document docume... | 2018/09/05 | [
"https://Stackoverflow.com/questions/52188780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6735292/"
] | From my opinion, solution A is better because it followed SOLID, and it easier for maintain, extend,... your app.
In addition, I think you should implement DocumentPrinter based on an interface( maybe IDocumentPrinter).
```
interface IDocumentPrinter
{
void PrintDocument(Document document);
}
class DocumentPrint... | I would do as below. Your Printer class does not need to understand the intrinsics of a document as it can get the final output that is to be printed.
```
interface IPrintable
{
string GetOutput();
}
class Document : IPrintable
{
...
public string GetOutput()
{
return ...; // final formatted ... |
8,634,761 | I am workiong on the Android platform. I have just started with OpenGL and am trying to put an image on a rectangle. This is my code:
```
public class IntroActivity extends Activity {
private GLSurfaceView glsv = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInsta... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8634761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I modified your renderer a bit:
```
class IntroRenderer implements GLSurfaceView.Renderer {
private boolean textureReady = false;
public void onDrawFrame(GL10 gl) {
if (!this.textureReady) {
this.prepareTexture(gl); // only initialize once
}
gl.glClearColor(0,... | I'm not sure why is doesn't render, but your code is inefficient.
You are loading the bitmap and binding it on EVERY frame.
You should do it only once.
Also, this link can help you with great examples with this Nehe port for Android:
[Nehe Port for Android](http://code.google.com/p/nehe-android/)
Good luck :) |
36,095,905 | I don't understand how to import AndroidJUnit4.
Always I get an error: Can't resolve symobol AndroidJUnit4.
gradle сonfig:
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "test.test"
minSdkVersion 15
... | 2016/03/18 | [
"https://Stackoverflow.com/questions/36095905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4340987/"
] | In case you want to use `AndroidJUnit4` in unit testing, add the following dependency into your app's build.gradle file:
```
testImplementation "androidx.test.ext:junit:<version>"
```
Latest versions can be found in it's [Maven repository](https://mvnrepository.com/artifact/androidx.test.ext/junit). | I just needed to mark tests as Android Instrumentation tests and not as standard Unit Tests. |
36,095,905 | I don't understand how to import AndroidJUnit4.
Always I get an error: Can't resolve symobol AndroidJUnit4.
gradle сonfig:
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "test.test"
minSdkVersion 15
... | 2016/03/18 | [
"https://Stackoverflow.com/questions/36095905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4340987/"
] | In case you want to use `AndroidJUnit4` in unit testing, add the following dependency into your app's build.gradle file:
```
testImplementation "androidx.test.ext:junit:<version>"
```
Latest versions can be found in it's [Maven repository](https://mvnrepository.com/artifact/androidx.test.ext/junit). | This is done by adding the test to the
* /app/src/androidTest Directory instead of the
* /app/src/test Directory which is for unit tests only
Or, when you create the test class, add the test by selecting new class when in "Android Instrumentation Tests" tab of the Project tree |
23,724,929 | I have just created a program that uses file I/O and ***for interactive input and output it uses terminal window of IDE.*** I want to create a executable jar file of this program. Is it possible? If yes, then how?
I am using BlueJ as IDE.
The program have `**no GUI component**`
I have created a jar using BlueJ but it... | 2014/05/18 | [
"https://Stackoverflow.com/questions/23724929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3649310/"
] | You have to have an `Main-Class` entry in your Manifest. See [documentation](http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html) for details.
Given yours example
```
public class MainClass {
public static void main(String agrs[]) {
System.out.println("magic");
M... | basically you should type:
jar cf jar-file input-file(s)
You can find usage details at link below:
<http://docs.oracle.com/javase/tutorial/deployment/jar/build.html> |
23,724,929 | I have just created a program that uses file I/O and ***for interactive input and output it uses terminal window of IDE.*** I want to create a executable jar file of this program. Is it possible? If yes, then how?
I am using BlueJ as IDE.
The program have `**no GUI component**`
I have created a jar using BlueJ but it... | 2014/05/18 | [
"https://Stackoverflow.com/questions/23724929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3649310/"
] | You have to have an `Main-Class` entry in your Manifest. See [documentation](http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html) for details.
Given yours example
```
public class MainClass {
public static void main(String agrs[]) {
System.out.println("magic");
M... | It depends on the IDE you're using.
In eclipse for example you can do this by right-clicking the package in package explorer window and navigating `Export ->Java -> JAR file`. |
23,724,929 | I have just created a program that uses file I/O and ***for interactive input and output it uses terminal window of IDE.*** I want to create a executable jar file of this program. Is it possible? If yes, then how?
I am using BlueJ as IDE.
The program have `**no GUI component**`
I have created a jar using BlueJ but it... | 2014/05/18 | [
"https://Stackoverflow.com/questions/23724929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3649310/"
] | You have to have an `Main-Class` entry in your Manifest. See [documentation](http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html) for details.
Given yours example
```
public class MainClass {
public static void main(String agrs[]) {
System.out.println("magic");
M... | Export as a runnable jar if you're in eclipse |
20,516,942 | i made an android app using zxing library for barcode scan. barcode reader start when i tap on button, this is the code:
```
//scan
mScanBtn = (Button)findViewById(R.id.scan);
mScanBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
... | 2013/12/11 | [
"https://Stackoverflow.com/questions/20516942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2765132/"
] | No, you can't force the flashlight on when you start the app. The idea is that the user is in the best position to control whether it's on or not. I wouldn't want an app turning on a bright light in the wrong situation. | ```
Camera camera =Camera.open();
Camera.Parameters p;
p = camera.getParameters();
p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(p);
CameraConfigurationUtils.setTorch(p,true);
```
Using this you can on the torch on android studio integrated dependicy library. |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | It's not nearly as bad as you'd think.
Looking at it from the correct angle, you can see that the cockpit windows are *above* the mandibles.
[](https://i.stack.imgur.com/wwPLz.jpg)
[](https://i.stack.imgur.com/c... | Also, starships are largely flown using a sensor array. Pilots depend on their copilot and gunner as well as these sensors for input regarding situational awareness. It's not an automobile. |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | You're not wrong. As this rather nice [wireframe](https://sketchfab.com/models/19d11cfc6b1149bdacb2d55c407e73c2) shows, by looking out from the cockpit we can determine that the view from the left side of the ship is almost totally non-existent (blocked by the mandibles) whereas the starboard and front views are comple... | Well I for one just think they didn't think of it... I took this from [Starwars.com - five things you didn't know about the Millennium Falcon](http://www.starwars.com/news/5-things-you-might-not-know-about-the-millennium-falcon):
>
> 1. The original design wasn’t a hamburger
>
>
> The initial look for the Millenniu... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | You're not wrong. As this rather nice [wireframe](https://sketchfab.com/models/19d11cfc6b1149bdacb2d55c407e73c2) shows, by looking out from the cockpit we can determine that the view from the left side of the ship is almost totally non-existent (blocked by the mandibles) whereas the starboard and front views are comple... | >
> "What's the point in placing that capsule in such an extremely strange place?"
> ==============================================================================
>
>
>
This very question is (sort of) answered in Disney canon. In an inner monologue, Chewbacca is listing the reasons Luke thinks the Falcon is a pie... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | It's not nearly as bad as you'd think.
Looking at it from the correct angle, you can see that the cockpit windows are *above* the mandibles.
[](https://i.stack.imgur.com/wwPLz.jpg)
[](https://i.stack.imgur.com/c... | As many pointed out in [this question](https://scifi.stackexchange.com/questions/112998/why-does-everyone-think-that-the-millennium-falcon-is-a-piece-of-junk), the *Falcon* wasn't exactly designed for dog fights. The ship has the body of a freighter and an engine that's likely the most overhauled in the galaxy. As such... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | >
> "What's the point in placing that capsule in such an extremely strange place?"
> ==============================================================================
>
>
>
This very question is (sort of) answered in Disney canon. In an inner monologue, Chewbacca is listing the reasons Luke thinks the Falcon is a pie... | As many pointed out in [this question](https://scifi.stackexchange.com/questions/112998/why-does-everyone-think-that-the-millennium-falcon-is-a-piece-of-junk), the *Falcon* wasn't exactly designed for dog fights. The ship has the body of a freighter and an engine that's likely the most overhauled in the galaxy. As such... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | Also, starships are largely flown using a sensor array. Pilots depend on their copilot and gunner as well as these sensors for input regarding situational awareness. It's not an automobile. | The falcon has an excellent roll rate (note the nifty immilmen maneuver at cloud city) and "alluvial" (inertial) dampers. A bogey detected by sensors could easily be brought into the pilots field of vision with a flick of the wrist. Course could remain constant there is no up or down in space. Not bad for a souped up b... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | >
> "What's the point in placing that capsule in such an extremely strange place?"
> ==============================================================================
>
>
>
This very question is (sort of) answered in Disney canon. In an inner monologue, Chewbacca is listing the reasons Luke thinks the Falcon is a pie... | Well I for one just think they didn't think of it... I took this from [Starwars.com - five things you didn't know about the Millennium Falcon](http://www.starwars.com/news/5-things-you-might-not-know-about-the-millennium-falcon):
>
> 1. The original design wasn’t a hamburger
>
>
> The initial look for the Millenniu... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | You're not wrong. As this rather nice [wireframe](https://sketchfab.com/models/19d11cfc6b1149bdacb2d55c407e73c2) shows, by looking out from the cockpit we can determine that the view from the left side of the ship is almost totally non-existent (blocked by the mandibles) whereas the starboard and front views are comple... | As many pointed out in [this question](https://scifi.stackexchange.com/questions/112998/why-does-everyone-think-that-the-millennium-falcon-is-a-piece-of-junk), the *Falcon* wasn't exactly designed for dog fights. The ship has the body of a freighter and an engine that's likely the most overhauled in the galaxy. As such... |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | >
> "What's the point in placing that capsule in such an extremely strange place?"
> ==============================================================================
>
>
>
This very question is (sort of) answered in Disney canon. In an inner monologue, Chewbacca is listing the reasons Luke thinks the Falcon is a pie... | Also, starships are largely flown using a sensor array. Pilots depend on their copilot and gunner as well as these sensors for input regarding situational awareness. It's not an automobile. |
113,981 | To my understanding, the Galactic Republic has a group of separatists under Count Dooku, and they later on become the Galactic Empire? | 2016/01/07 | [
"https://scifi.stackexchange.com/questions/113981",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/58127/"
] | Well I for one just think they didn't think of it... I took this from [Starwars.com - five things you didn't know about the Millennium Falcon](http://www.starwars.com/news/5-things-you-might-not-know-about-the-millennium-falcon):
>
> 1. The original design wasn’t a hamburger
>
>
> The initial look for the Millenniu... | The falcon has an excellent roll rate (note the nifty immilmen maneuver at cloud city) and "alluvial" (inertial) dampers. A bogey detected by sensors could easily be brought into the pilots field of vision with a flick of the wrist. Course could remain constant there is no up or down in space. Not bad for a souped up b... |
2,342,759 | Let $ [a,b] \subseteq \mathbb{R} $ be a non-degenarate closed interval . For $ \epsilon >0 $ prove that there is a partition $ P $ of $ [a,b] $ such that $ || P|| < \epsilon $.
**Answer:** Let $P: \ a=x\_{0} <x\_{1} <x\_{2} <...........< x\_{n}=b $ be the partition of $ [a,b] $.
||P||=$ max \{|x\_{i}-x\_{i-1}| \}$ ,... | 2017/07/01 | [
"https://math.stackexchange.com/questions/2342759",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/417353/"
] | From a different perspective:
If $P:x\_0<x\_1<\ldots<x\_n$ is a partition, then $P':x\_0<\frac{x\_0+x\_1}2<x\_1<\frac{x\_1+x\_2}2<\ldots <x\_n$ is a partition with $\|P'\|=\frac 12\|P\|$.
As there exist some partition at all, this implies that the infimum of $\|P\|$ where $P$ runs over all partitions must be $0$. | Let $n$ be so large that $\frac{b-a}{n} < \epsilon$. Let $x\_i = a + \frac{i}{n}(b-a)$, for $i=0,..,n$.
Then $|x\_i - x\_{i-1}| = \frac{b-a}{n}< \epsilon$, for $i=1,..,n$. |
49,928,994 | How can I count same elements in array, for example if I have an array of `5` integers like this `arr[5] = { 1, 2, 3, 4, 5};` output should be : `0` since there's no repeated elements, but if I have `arr[5] = { 1, 1, 2, 3, 5};` output should be : `2` since `1` is repeated `2` times and so on. I've tried to solve this w... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49928994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9671636/"
] | The code is working fine, let me show how:
when `arr[5] = { 1, 1, 2, 3, 4};`
i = 0 => a[i] = 1 will be matched with j = 1 (a[j] = 1)
therefore count is 1
when `arr[5] = { 1, 1, 2, 1, 1};`
i = 0 => a[i] = 1 will be matched with j = 1, 3, 4 => count = 3
i = 1 will be matched with j = 3, 4 => count = 5
i = 3 will b... | You can use some functions of the standard template library (STL).
`std::sort()` to sort the array, which helps to count repetitions using `std::unique()`, because it needs a sorted container.
At first you sort your array, and then you count repetitions with a comparer while `std::unique()` removes repetitions from th... |
49,928,994 | How can I count same elements in array, for example if I have an array of `5` integers like this `arr[5] = { 1, 2, 3, 4, 5};` output should be : `0` since there's no repeated elements, but if I have `arr[5] = { 1, 1, 2, 3, 5};` output should be : `2` since `1` is repeated `2` times and so on. I've tried to solve this w... | 2018/04/19 | [
"https://Stackoverflow.com/questions/49928994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9671636/"
] | The code is working fine, let me show how:
when `arr[5] = { 1, 1, 2, 3, 4};`
i = 0 => a[i] = 1 will be matched with j = 1 (a[j] = 1)
therefore count is 1
when `arr[5] = { 1, 1, 2, 1, 1};`
i = 0 => a[i] = 1 will be matched with j = 1, 3, 4 => count = 3
i = 1 will be matched with j = 3, 4 => count = 5
i = 3 will b... | Maps are map unique keys to non-unique values. Each time we find a value in the array, you simply increment the number of times you saw it (the value).
```
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main() {
vector<int> a = {1, 1, 2, 1, 1};
// Associative array that associa... |
20,866,000 | And I am using NGUI for my project and i don't know how to code a button created from NGUI button. The only code I know is.:
```
void OnMouseDown
Application.loadlevel(1);
```
But it's not working in NGUI button, i want to go to the next scene when the Start button is clicked. Can someone help me with these simp... | 2014/01/01 | [
"https://Stackoverflow.com/questions/20866000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2737711/"
] | Try something like this: (C# script)
```
using UnityEngine;
using System.Collections;
public class SceneButton: MonoBehaviour {
public string targetScene; //Scene name
void Start(){
UIEventListener.Get(gameObject).onClick += OnButtonClick;
}
void OnButtonClick(GameObject g){
Applicat... | For any UI elements from NGUI that need to react to user input, attach the NGUIButtonMessage script to the object. The object must have a collider in order for this script to work. In that script, you could tell it when to trigger it. Some examples are when you single click the object or when you just pressed it or rel... |
20,866,000 | And I am using NGUI for my project and i don't know how to code a button created from NGUI button. The only code I know is.:
```
void OnMouseDown
Application.loadlevel(1);
```
But it's not working in NGUI button, i want to go to the next scene when the Start button is clicked. Can someone help me with these simp... | 2014/01/01 | [
"https://Stackoverflow.com/questions/20866000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2737711/"
] | Try something like this: (C# script)
```
using UnityEngine;
using System.Collections;
public class SceneButton: MonoBehaviour {
public string targetScene; //Scene name
void Start(){
UIEventListener.Get(gameObject).onClick += OnButtonClick;
}
void OnButtonClick(GameObject g){
Applicat... | Simply use void OnClick(){
} instead of OnMouseDown.It will work. |
20,866,000 | And I am using NGUI for my project and i don't know how to code a button created from NGUI button. The only code I know is.:
```
void OnMouseDown
Application.loadlevel(1);
```
But it's not working in NGUI button, i want to go to the next scene when the Start button is clicked. Can someone help me with these simp... | 2014/01/01 | [
"https://Stackoverflow.com/questions/20866000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2737711/"
] | Try something like this: (C# script)
```
using UnityEngine;
using System.Collections;
public class SceneButton: MonoBehaviour {
public string targetScene; //Scene name
void Start(){
UIEventListener.Get(gameObject).onClick += OnButtonClick;
}
void OnButtonClick(GameObject g){
Applicat... | ```
void OnClick()
{
Application.LoadLevel(1);
}
``` |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | Tomcat stores `Part`s in "X:\some\path\Tomcat 7.0\temp" (/some/path/apache-tomcat-7.0.x/temp) directory.
when a multipart request is parsed, if the size of a single part exceed a threshold, a temporary file is created for that part.
your servlet/jsp will be invoked when transfer of all parts has been completed.
when... | The `InputStream` will typically read from a temporary file which is created by the multipart framework during the request. The temp file is normally stored in the application server's temporary area - as specified by the servlet context attribute `javax.servlet.context.tempdir`. In Tomcat this is somewhere beneath `$C... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | The `InputStream` will typically read from a temporary file which is created by the multipart framework during the request. The temp file is normally stored in the application server's temporary area - as specified by the servlet context attribute `javax.servlet.context.tempdir`. In Tomcat this is somewhere beneath `$C... | Here is it
1. User's browser composes http multiple parts request
2. Tcp/ip stack of user's OS slices them into packets
3. Routers over the internet pass those packet to your server
4. Tcp/ip stack of your server's OS get back payloads and passes them
to tcp port listener
5. Tomcat http connector decodes http post req... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | Tomcat stores `Part`s in "X:\some\path\Tomcat 7.0\temp" (/some/path/apache-tomcat-7.0.x/temp) directory.
when a multipart request is parsed, if the size of a single part exceed a threshold, a temporary file is created for that part.
your servlet/jsp will be invoked when transfer of all parts has been completed.
when... | I think we should step back for a moment and give a thought on the web infrastructure. First of all the HTTP transmits text data, so binary information encoded in [base 64](http://en.wikipedia.org/wiki/Base64) so that data won't get messed up. This ends up leading to large amouts of data and this gives birth to the mul... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | I think we should step back for a moment and give a thought on the web infrastructure. First of all the HTTP transmits text data, so binary information encoded in [base 64](http://en.wikipedia.org/wiki/Base64) so that data won't get messed up. This ends up leading to large amouts of data and this gives birth to the mul... | Here is it
1. User's browser composes http multiple parts request
2. Tcp/ip stack of user's OS slices them into packets
3. Routers over the internet pass those packet to your server
4. Tcp/ip stack of your server's OS get back payloads and passes them
to tcp port listener
5. Tomcat http connector decodes http post req... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | Tomcat stores `Part`s in "X:\some\path\Tomcat 7.0\temp" (/some/path/apache-tomcat-7.0.x/temp) directory.
when a multipart request is parsed, if the size of a single part exceed a threshold, a temporary file is created for that part.
your servlet/jsp will be invoked when transfer of all parts has been completed.
when... | Tomcat follows the Servlet 3.0 specification which allows you to specify things such as how large of a multipart "part" can be before it gets stored (temporarily) on the disk, where temporary files will be written, what the maximum size of a file is, and what the maximum size of the whole request can be. You can find a... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | Tomcat stores `Part`s in "X:\some\path\Tomcat 7.0\temp" (/some/path/apache-tomcat-7.0.x/temp) directory.
when a multipart request is parsed, if the size of a single part exceed a threshold, a temporary file is created for that part.
your servlet/jsp will be invoked when transfer of all parts has been completed.
when... | Here is it
1. User's browser composes http multiple parts request
2. Tcp/ip stack of user's OS slices them into packets
3. Routers over the internet pass those packet to your server
4. Tcp/ip stack of your server's OS get back payloads and passes them
to tcp port listener
5. Tomcat http connector decodes http post req... |
20,242,672 | I have a question regarding file upload, which is more related to how it works rather than a code issue. I looked on the internet, but I couldn't find a proper answer.
I have a web application running on tomcat, which handles file uploads (through a servlet). Let's say I want now to upload huge files (> 1 Gb). My unde... | 2013/11/27 | [
"https://Stackoverflow.com/questions/20242672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1225463/"
] | Tomcat follows the Servlet 3.0 specification which allows you to specify things such as how large of a multipart "part" can be before it gets stored (temporarily) on the disk, where temporary files will be written, what the maximum size of a file is, and what the maximum size of the whole request can be. You can find a... | Here is it
1. User's browser composes http multiple parts request
2. Tcp/ip stack of user's OS slices them into packets
3. Routers over the internet pass those packet to your server
4. Tcp/ip stack of your server's OS get back payloads and passes them
to tcp port listener
5. Tomcat http connector decodes http post req... |
81,313 | It seems obvious but...
Alice and Bob have an existing business relationship. Alice sends Bob a letter demanding his response via U.S. Postal Service (USPS) Certified Mail, to be received on or before Tuesday, June 28, 2022 or Bob will loose rights under the business agreement - which, if lost, may also involve future... | 2022/06/24 | [
"https://law.stackexchange.com/questions/81313",
"https://law.stackexchange.com",
"https://law.stackexchange.com/users/11421/"
] | Receipt *means* receipt
-----------------------
If a contract (or law) requires receipt then that means **delivered** to Alice. It doesn’t mean **sent** by Bob.
Now, contracts (and laws) can (and do) place restrictions on how notices can and can’t be delivered. If a contract requires service by mail then service by e... | This is going to depend almost entirely on the wording of the contract between Alice and Bob. If it says that the document must be "sent by certified mail, postmarked by X" that is one thing. But if it says "must be delivered by X" that is quite aother,. In the second case it is Bob's responsibility to make sure that t... |
41,092,498 | I'm using [w3School's tutorial](http://www.w3schools.com/howto/howto_js_filter_lists.asp) to create a filter list. I was wondering if there was a way to check when the list is empty and to execute a function and also when there is something in the list and to execute a function. Is it possible? Thanks. | 2016/12/11 | [
"https://Stackoverflow.com/questions/41092498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7277839/"
] | You could use `querySelectorAll` to get all the `li`, and then check how much there are.
```
if(document.querySelectorAll("#myUL li").length === 0) {
// The list is empty
} else {
// The list is not empty
}
```
EDIT
----
As Punit noticed (see comments of this answer), `li` elements are not deleted but hidde... | If you want to know *only* whether or not the list is empty, you can check whether its height is zero:
```
if (document.getElementById('myUL').clientHeight)) {
console.log('The list contains at least one element.')
} else {
console.log('The list is empty.')
}
```
If you would like a more precise count of the... |
41,092,498 | I'm using [w3School's tutorial](http://www.w3schools.com/howto/howto_js_filter_lists.asp) to create a filter list. I was wondering if there was a way to check when the list is empty and to execute a function and also when there is something in the list and to execute a function. Is it possible? Thanks. | 2016/12/11 | [
"https://Stackoverflow.com/questions/41092498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7277839/"
] | I copied the code from the tutorial to this snippet.
It's as simple as having a `count` variable and incrementing it when the search query is matched, then checking if `count` is 0.
```js
function myFunction() {
// Declare variables
var input, filter, ul, li, a, i, count;
input = document.getElementById('myI... | If you want to know *only* whether or not the list is empty, you can check whether its height is zero:
```
if (document.getElementById('myUL').clientHeight)) {
console.log('The list contains at least one element.')
} else {
console.log('The list is empty.')
}
```
If you would like a more precise count of the... |
23,505,985 | I want to display success Alert pop-up or alert message after form submited and action succeded
In this example I want to show "successfully add" :
`Create Action` :
```
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(TAUX taux)
{
if (ModelState.IsValid)
{
... | 2014/05/06 | [
"https://Stackoverflow.com/questions/23505985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1310952/"
] | It seems the SITE\_ID setting in your settings file is pointing to an ID that doesn't exist in your database.
You either need to create a new site in the sites model (via admin) and change the ID in the settings file to match that one, or re-insert the item via SQL and give it the same ID as your settings file. | I just had to **remove** the `'django.contrib.sessions'` from `INSTALLED_APPS` in `settings.py` as it was causing problems and I was using this project only for **one** site.
**However**, if you are using your project for multiple different sites and need the Django **sites** framework, please check `SITE_ID` in your ... |
23,505,985 | I want to display success Alert pop-up or alert message after form submited and action succeded
In this example I want to show "successfully add" :
`Create Action` :
```
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(TAUX taux)
{
if (ModelState.IsValid)
{
... | 2014/05/06 | [
"https://Stackoverflow.com/questions/23505985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1310952/"
] | It seems the SITE\_ID setting in your settings file is pointing to an ID that doesn't exist in your database.
You either need to create a new site in the sites model (via admin) and change the ID in the settings file to match that one, or re-insert the item via SQL and give it the same ID as your settings file. | This problem will always seem to occur continually, so if you don't want to serve your model with multiple sites, then I suggest you remove the SITE\_ID from the setting file. Note this worked for me! |
23,505,985 | I want to display success Alert pop-up or alert message after form submited and action succeded
In this example I want to show "successfully add" :
`Create Action` :
```
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(TAUX taux)
{
if (ModelState.IsValid)
{
... | 2014/05/06 | [
"https://Stackoverflow.com/questions/23505985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1310952/"
] | This problem will always seem to occur continually, so if you don't want to serve your model with multiple sites, then I suggest you remove the SITE\_ID from the setting file. Note this worked for me! | I just had to **remove** the `'django.contrib.sessions'` from `INSTALLED_APPS` in `settings.py` as it was causing problems and I was using this project only for **one** site.
**However**, if you are using your project for multiple different sites and need the Django **sites** framework, please check `SITE_ID` in your ... |
39,812,514 | I need to iterate through a list and check if the value is a string or an int. Is there any easy way to do this in python?
For example:
`[1,2,3]` would be true.
`["a",2,3]` would be false. | 2016/10/01 | [
"https://Stackoverflow.com/questions/39812514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5755245/"
] | You could do this using [all](https://docs.python.org/3/library/functions.html#all), which would short circuit once a false condition is met.
```
>>> my_list = [1, 2, 3]
>>> all(type(d) == int for d in my_list)
True
>>> my_list = ['1', 2, 3]
>>> all(type(d) == int for d in my_list)
False
```
[isinstance](https://d... | You can use a combination of [`any()`](https://docs.python.org/3/library/functions.html#any) and [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance):
```
In [1]: def contains_string(l):
...: return any(isinstance(item, basestring) for item in l)
...:
In [2]: contains_string([1,2... |
39,812,514 | I need to iterate through a list and check if the value is a string or an int. Is there any easy way to do this in python?
For example:
`[1,2,3]` would be true.
`["a",2,3]` would be false. | 2016/10/01 | [
"https://Stackoverflow.com/questions/39812514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5755245/"
] | You can use a combination of [`any()`](https://docs.python.org/3/library/functions.html#any) and [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance):
```
In [1]: def contains_string(l):
...: return any(isinstance(item, basestring) for item in l)
...:
In [2]: contains_string([1,2... | Assuming you meant that you need to check through all the values of the list and that only if they were all integers the function would return True, this is how I'd do it:
```
def test(list):
result=True
for elem in list:
if type(elem)!=int:
result=False
return result
``` |
39,812,514 | I need to iterate through a list and check if the value is a string or an int. Is there any easy way to do this in python?
For example:
`[1,2,3]` would be true.
`["a",2,3]` would be false. | 2016/10/01 | [
"https://Stackoverflow.com/questions/39812514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5755245/"
] | You could do this using [all](https://docs.python.org/3/library/functions.html#all), which would short circuit once a false condition is met.
```
>>> my_list = [1, 2, 3]
>>> all(type(d) == int for d in my_list)
True
>>> my_list = ['1', 2, 3]
>>> all(type(d) == int for d in my_list)
False
```
[isinstance](https://d... | Assuming you meant that you need to check through all the values of the list and that only if they were all integers the function would return True, this is how I'd do it:
```
def test(list):
result=True
for elem in list:
if type(elem)!=int:
result=False
return result
``` |
50,391,152 | ```
<button pButton type="button" ></button>
```
Need to set the label in the component class as "delivery address" not using the label property in the html markup. | 2018/05/17 | [
"https://Stackoverflow.com/questions/50391152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6142949/"
] | Just bind your class property to the `label` property of `pButton`
**HTML**
```
<button pButton type="button" label="{{customLabel}}"></button>
```
**TS**
```
customLabel = 'My custom label';
```
See [StackBlitz](https://stackblitz.com/edit/angular-frjcsu) | Well, just try this :
```
<button
pbutton=""
type="button"
label="Button"
class="p-button p-component"
>
<span class="p-button-label"> {{buttonLabel}}</span>
</button>
```
In the ts file,
```
this.buttonLabel = condition ? 'string-truthy-condition' : 'string-falsy-condition';
``` |
58,595,576 | **Newbie** question.
I'm learning ReactJS in Typescript and am coming from an AngularJS background (trying to unlearn AngularJS).
The code below runs and displays the `props.compiler`. When I tap the `H1`, the `handler` fires but the React code doesn't update the display like it would in `AngularJS`.
What am I missi... | 2019/10/28 | [
"https://Stackoverflow.com/questions/58595576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | There is no [two-way binding like in AngularJS](https://docs.angularjs.org/tutorial/step_06), you need to use [`setState`](https://reactjs.org/docs/react-component.html#setstate) in [order to schedule an update](https://reactjs.org/docs/faq-state.html#what-does-setstate-do) to a component’s state object:
```
// A bit ... | In React you don't set the values like you did in your setter function.
React renders the DOM asynchronously by comparing the virtual DOM.
So you need to use setState() to update the state of your DOM.
You can add state in your code and pass it to the React component.
```
handler = async (t: any)=> {
const resp =... |
58,595,576 | **Newbie** question.
I'm learning ReactJS in Typescript and am coming from an AngularJS background (trying to unlearn AngularJS).
The code below runs and displays the `props.compiler`. When I tap the `H1`, the `handler` fires but the React code doesn't update the display like it would in `AngularJS`.
What am I missi... | 2019/10/28 | [
"https://Stackoverflow.com/questions/58595576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | There is no [two-way binding like in AngularJS](https://docs.angularjs.org/tutorial/step_06), you need to use [`setState`](https://reactjs.org/docs/react-component.html#setstate) in [order to schedule an update](https://reactjs.org/docs/faq-state.html#what-does-setstate-do) to a component’s state object:
```
// A bit ... | TypeScript's interface is purely for typechecking. You should not be directly referencing any of its properties.
Instead, I would recommend you to create an interface for your state, which holds the values of `current_user_url` from your `fetch` request.
Then, on your click handler, you update the state by calling [s... |
58,595,576 | **Newbie** question.
I'm learning ReactJS in Typescript and am coming from an AngularJS background (trying to unlearn AngularJS).
The code below runs and displays the `props.compiler`. When I tap the `H1`, the `handler` fires but the React code doesn't update the display like it would in `AngularJS`.
What am I missi... | 2019/10/28 | [
"https://Stackoverflow.com/questions/58595576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172861/"
] | In React you don't set the values like you did in your setter function.
React renders the DOM asynchronously by comparing the virtual DOM.
So you need to use setState() to update the state of your DOM.
You can add state in your code and pass it to the React component.
```
handler = async (t: any)=> {
const resp =... | TypeScript's interface is purely for typechecking. You should not be directly referencing any of its properties.
Instead, I would recommend you to create an interface for your state, which holds the values of `current_user_url` from your `fetch` request.
Then, on your click handler, you update the state by calling [s... |
851 | Using the terminology of [the ECDSA Wikipedia page,](http://en.wikipedia.org/wiki/Elliptic_Curve_DSA) ECDSA (and DSA) signatures require a random k value for each signature which ensures that the signature is different each time even if the message and key are the same. For some applications, a "constant" signature may... | 2011/09/29 | [
"https://crypto.stackexchange.com/questions/851",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/869/"
] | There is a [draft RFC](https://datatracker.ietf.org/doc/html/draft-pornin-deterministic-dsa-00) which describes a way to implement deterministic (EC)DSA (with test vectors). In this draft, both $h(m)$ (the hash of the message) and $x$ are used as input to a deterministic PRNG which uses HMAC (that's HMAC-DRBG as specif... | In their [1998 SAC paper](http://www.di.ens.fr/~pointche/Documents/Papers/1998_sac.pdf), M'Raihi et al showed how to use hash functions to turn Schnorr signatures (quite similar to (EC)DSA) deterministic, and proved that if the original signature scheme (with randomness) is secure, so is the deterministic one.
Bernste... |
851 | Using the terminology of [the ECDSA Wikipedia page,](http://en.wikipedia.org/wiki/Elliptic_Curve_DSA) ECDSA (and DSA) signatures require a random k value for each signature which ensures that the signature is different each time even if the message and key are the same. For some applications, a "constant" signature may... | 2011/09/29 | [
"https://crypto.stackexchange.com/questions/851",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/869/"
] | In their [1998 SAC paper](http://www.di.ens.fr/~pointche/Documents/Papers/1998_sac.pdf), M'Raihi et al showed how to use hash functions to turn Schnorr signatures (quite similar to (EC)DSA) deterministic, and proved that if the original signature scheme (with randomness) is secure, so is the deterministic one.
Bernste... | This certainly creates the opportunity to mount a birthday attack.
Oscar creates two Messages hashing to the same value - certainly doable at least with sha1 or MD5 and succeeds in making you sign both of them. He can then reconstruct your private key from the signatures.
I would certainly avoid deterministic ECDSA Si... |
851 | Using the terminology of [the ECDSA Wikipedia page,](http://en.wikipedia.org/wiki/Elliptic_Curve_DSA) ECDSA (and DSA) signatures require a random k value for each signature which ensures that the signature is different each time even if the message and key are the same. For some applications, a "constant" signature may... | 2011/09/29 | [
"https://crypto.stackexchange.com/questions/851",
"https://crypto.stackexchange.com",
"https://crypto.stackexchange.com/users/869/"
] | There is a [draft RFC](https://datatracker.ietf.org/doc/html/draft-pornin-deterministic-dsa-00) which describes a way to implement deterministic (EC)DSA (with test vectors). In this draft, both $h(m)$ (the hash of the message) and $x$ are used as input to a deterministic PRNG which uses HMAC (that's HMAC-DRBG as specif... | This certainly creates the opportunity to mount a birthday attack.
Oscar creates two Messages hashing to the same value - certainly doable at least with sha1 or MD5 and succeeds in making you sign both of them. He can then reconstruct your private key from the signatures.
I would certainly avoid deterministic ECDSA Si... |
4,137,944 | What object can I use that has rows and columns, but not DataTable as it looks like an Excel Table? | 2010/11/09 | [
"https://Stackoverflow.com/questions/4137944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/429902/"
] | I don't see why you can't keep on using [FieldRetrievingFactoryBean](http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html), that's what it's for.
It's a little bit easier to use than your example suggests, though. Also, there's the easier... | You can just use the enum name as the value, and Spring will automatically detect that it's a static field of the enum type and use it. So for example, if you have an enum com.mycompany.MyEnum with values SOMEVAL, ANOTHERVAL, you can use :
```xml
<property name="myEnumProperty" value="SOMEVAL" />
```
This will allow... |
15,573,393 | Recently I've encountered a problem with a function that accepts variable number of arguments and expects the last one to be a null pointer. *I don't have access to its implementation.*
Casting that last parameter to a `void*` worked, but passing in `NULL` (`nullptr` not available) directly wouldn't:
```
foo(x,y,(voi... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15573393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673730/"
] | Well, `NULL` is an integral constant in C++, whereas `(void *)NULL` is very definitely a pointer type.
So they could conceivably have different sizes when inserted into the var-arg list. So this would certainly make a difference if, say, there's another parameter following it. And if there isn't, you may end up readin... | `NULL` is a null pointer constant, so must be "*an integral constant expression prvalue of integer type that evaluates to zero or a prvalue of type `std::nullptr_t`.*" If `nullptr` isn't available we can assume that it is a zero-valued integer constant prvalue e.g. `0`. The failure indicates that the varargs calling se... |
15,573,393 | Recently I've encountered a problem with a function that accepts variable number of arguments and expects the last one to be a null pointer. *I don't have access to its implementation.*
Casting that last parameter to a `void*` worked, but passing in `NULL` (`nullptr` not available) directly wouldn't:
```
foo(x,y,(voi... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15573393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673730/"
] | Well, `NULL` is an integral constant in C++, whereas `(void *)NULL` is very definitely a pointer type.
So they could conceivably have different sizes when inserted into the var-arg list. So this would certainly make a difference if, say, there's another parameter following it. And if there isn't, you may end up readin... | When you are using variable numbers of arguments (a variadic function), the way the stack gets built follows type-based rules for building the stack. But the called function doesn't know, for sure, what's really on the stack. It just has to make assumptions and go on. That's why passing the wrong arguments to a printf ... |
15,573,393 | Recently I've encountered a problem with a function that accepts variable number of arguments and expects the last one to be a null pointer. *I don't have access to its implementation.*
Casting that last parameter to a `void*` worked, but passing in `NULL` (`nullptr` not available) directly wouldn't:
```
foo(x,y,(voi... | 2013/03/22 | [
"https://Stackoverflow.com/questions/15573393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673730/"
] | When you are using variable numbers of arguments (a variadic function), the way the stack gets built follows type-based rules for building the stack. But the called function doesn't know, for sure, what's really on the stack. It just has to make assumptions and go on. That's why passing the wrong arguments to a printf ... | `NULL` is a null pointer constant, so must be "*an integral constant expression prvalue of integer type that evaluates to zero or a prvalue of type `std::nullptr_t`.*" If `nullptr` isn't available we can assume that it is a zero-valued integer constant prvalue e.g. `0`. The failure indicates that the varargs calling se... |
12,865,465 | Is there a way to print out a list of Github issues? Other than by printing the HTML page.
I've tried using the [GitHub Issues Cappuccino App](http://cappuccino.org/discuss/2010/05/13/github-issues-cappuccino-app-desktop-and-web/). I got the app working in Chrome, but it never finishes loading the issues. I thought it... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12865465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945695/"
] | A couple of weeks ago I stumbled upon this blog article: <http://www.fullo.net/blog/2012/06/25/export-github-issues-as-csv-with-v3-api/>. It explains how to grab the issues via a command line curl call to the new API and stuff them into a csv file suing a simple php script. It's the easiest solution I've found so far. | I have a script to export github issues to a CSV file, which you could then print. It's at <https://github.com/josephhainline/export_github_issues_to_csv>
Feel free to fork it and modify to suite your needs. |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | Well.. you could do something like this?
```
$myArray = array("http://www.marleenvanlook.be/admin.php","http://www.marleenvanlook.be/checklogin.php","etc");
$i = 0;
foreach($myArray as $value){
${'something'.$i} = $value;
$i++;
}
echo $something0; //http://www.marleenvanlook.be/admin.php
```
This would... | PHP has something called [variable variables](http://php.net/manual/en/language.variables.variable.php) which lets you name a variable with the value of another variable.
```
$something = array(
'http://www.marleenvanlook.be/admin.php',
'http://www.marleenvanlook.be/checklogin.php',
'http://www.marleenvanl... |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | Well.. you could do something like this?
```
$myArray = array("http://www.marleenvanlook.be/admin.php","http://www.marleenvanlook.be/checklogin.php","etc");
$i = 0;
foreach($myArray as $value){
${'something'.$i} = $value;
$i++;
}
echo $something0; //http://www.marleenvanlook.be/admin.php
```
This would... | What I would do is:
```
$something1 = $the_array[2];
$something2 = $the_array[4];
``` |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | You can use `extract()`:
```
$data = array(
'something1',
'something2',
'something3',
);
extract($data, EXTR_PREFIX_ALL, 'var');
echo $var0; //Output something1
```
More info on <http://br2.php.net/manual/en/function.extract.php> | Well.. you could do something like this?
```
$myArray = array("http://www.marleenvanlook.be/admin.php","http://www.marleenvanlook.be/checklogin.php","etc");
$i = 0;
foreach($myArray as $value){
${'something'.$i} = $value;
$i++;
}
echo $something0; //http://www.marleenvanlook.be/admin.php
```
This would... |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | PHP has something called [variable variables](http://php.net/manual/en/language.variables.variable.php) which lets you name a variable with the value of another variable.
```
$something = array(
'http://www.marleenvanlook.be/admin.php',
'http://www.marleenvanlook.be/checklogin.php',
'http://www.marleenvanl... | What I would do is:
```
$something1 = $the_array[2];
$something2 = $the_array[4];
``` |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | You can use `extract()`:
```
$data = array(
'something1',
'something2',
'something3',
);
extract($data, EXTR_PREFIX_ALL, 'var');
echo $var0; //Output something1
```
More info on <http://br2.php.net/manual/en/function.extract.php> | PHP has something called [variable variables](http://php.net/manual/en/language.variables.variable.php) which lets you name a variable with the value of another variable.
```
$something = array(
'http://www.marleenvanlook.be/admin.php',
'http://www.marleenvanlook.be/checklogin.php',
'http://www.marleenvanl... |
25,815,605 | The following code returns an incorrect value for the sumHours field. It appears to prepare the sumHours field then once the GROUP BY runs, sum the sums together.
```
SELECT mmr_ID, mmr_projectName, SUM(mmr_hoursWorked.mmr_hoursWorked_hours) AS sumHours
FROM mmr
LEFT JOIN mmr_hoursWorked
ON mmr.mmr_ID = mmr_hoursWork... | 2014/09/12 | [
"https://Stackoverflow.com/questions/25815605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4035806/"
] | You can use `extract()`:
```
$data = array(
'something1',
'something2',
'something3',
);
extract($data, EXTR_PREFIX_ALL, 'var');
echo $var0; //Output something1
```
More info on <http://br2.php.net/manual/en/function.extract.php> | What I would do is:
```
$something1 = $the_array[2];
$something2 = $the_array[4];
``` |
18,145,522 | I want to add a column in datagridview which is NumericUpDown type. so i have created custom column type for that and it is working fine but this control is visible every time. I just want when i enter in a particular cell of this column(NumericUpdown column) then only this control show. i want as shown in following sc... | 2013/08/09 | [
"https://Stackoverflow.com/questions/18145522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2115657/"
] | I modify Web sample including MIN/MAX range.
```
public class NumericUpDownColumn : DataGridViewColumn
{
public NumericUpDownColumn()
: base(new NumericUpDownCell())
{
}
public override DataGridViewCell CellTemplate
{
get { return base.CellTemplate; }
set
{
... | This might be more of a workaround than a solution, but you could consider writing a simply custom form that displays directly over the cell when you click on the cell. That custom form would give you the numericUpDown behavior you want, and then as soon as you click back anywhere else on the DataGridView the custom fo... |
18,145,522 | I want to add a column in datagridview which is NumericUpDown type. so i have created custom column type for that and it is working fine but this control is visible every time. I just want when i enter in a particular cell of this column(NumericUpdown column) then only this control show. i want as shown in following sc... | 2013/08/09 | [
"https://Stackoverflow.com/questions/18145522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2115657/"
] | I modify Web sample including MIN/MAX range.
```
public class NumericUpDownColumn : DataGridViewColumn
{
public NumericUpDownColumn()
: base(new NumericUpDownCell())
{
}
public override DataGridViewCell CellTemplate
{
get { return base.CellTemplate; }
set
{
... | MSDN sample code: [DGV\_NUPD.exe](https://web.archive.org/web/20140901083508/download.microsoft.com/download/0/1/6/0165999a-7668-4643-a34b-87d2865da596/DGV_NUPD.exe)
pick the 3 .cs files, add them to your project you are good to go
Related MSDN tutorial: <http://msdn.microsoft.com/en-us/library/aa730881(v=vs.80).aspx... |
47,372,014 | I have coded a little MPI program that computes with an iterative scheme on a 2D domain : I apply a filter for each cell values (5 points stencil).
In my code, I split global domain into multiple subdomains depending of number of processes. I take `xcell` and `ycell` the size of each subdomain.
Once computation reach... | 2017/11/18 | [
"https://Stackoverflow.com/questions/47372014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773603/"
] | Here is a summary of the various comments on this question
In `Fortran`, or if your array is a `C` contiguous array, an other option is to use derived datatype so there is no need to "pack/unpack" the data to/from a temporary buffer. Since the data is very regular (e.g. a subset of a 2D array), MPI libraries should ha... | Awhile ago I wrote some preprocessor code to arbitrarily allocate pointer based 2D and 3D arrays of things. I did this to avoid the implicit multiplication required to access members. Note that you can access the array members linearly as well as dimensionally with this method. I hope it helps:
```
// allocate a 2D ar... |
64,630,121 | I'm building a music streaming platform and I'm trying to apply Domain-Driven design principles.
I can't determine the core domain though.
The core function of the system is to let users browse from a list of artists, albums, and tracks as well as stream audio files to their devices.
There are other sub-domain... | 2020/11/01 | [
"https://Stackoverflow.com/questions/64630121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5612892/"
] | You can use `strsplit` :
```
data.frame(text = strsplit(text, '\\*{4}\n\\s')[[1]])
# text
#1 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus metus sapien\n
#2 maximus id commodo vitae, i... | We can use `fixed = TRUE`
```
data.frame(text = strsplit(text, "****\n ", fixed = TRUE)[[1]])
#text
#1 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus metus sapien\n
#2 maximus id commo... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | When you say
>
> access in database
>
>
>
do you mean Microsoft Access or access the data in a database.
I would advise against MS Access if that is the case. If not, you could either use the JavaDB or HSQLDB and the use SQL scripts to create the database. As a summary
1. Package the application in one of the i... | In the last distribution of NetBeans I used, there was a wizard to create such application. The application used the Java Persistence API to store the Data. |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | I prefer [nullsoft](http://nsis.sourceforge.net/Main_Page). Take a look at [Open Source Installers Generators in Java](http://java-source.net/open-source/installer-generators)
@pratap: database should be created on client machine..
>
> Add an empty **access database** to your setup.
>
>
> | Have a look at [SQLite](http://sqlite.org), which is used by Mozilla (Firefox stores all bookmarks and history in a database) and several other major applications. |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | When you say
>
> access in database
>
>
>
do you mean Microsoft Access or access the data in a database.
I would advise against MS Access if that is the case. If not, you could either use the JavaDB or HSQLDB and the use SQL scripts to create the database. As a summary
1. Package the application in one of the i... | I recommend the [H2 database](http://www.h2database.com/) because it is simple, fast, pure Java, and small. See [this page](http://www.h2database.com/html/features.html#comparison) for how H2 compares to other Java databases, including those mentioned here in other answers. It has many features Derby/JavaDB and HSQLDB ... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Java 6 (enhanced for desktop application work) comes with a built-in database called [JavaDb](http://developers.sun.com/javadb/) (formerly IBM's Derby). That will do what you want.
[Here's](http://www.java2s.com/Tutorial/Java/0340__Database/NewtoJava6isalightweightdatabasecalledDerby.htm) a set of guides and tutorial... | Have a look at [SQLite](http://sqlite.org), which is used by Mozilla (Firefox stores all bookmarks and history in a database) and several other major applications. |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Java 6 (enhanced for desktop application work) comes with a built-in database called [JavaDb](http://developers.sun.com/javadb/) (formerly IBM's Derby). That will do what you want.
[Here's](http://www.java2s.com/Tutorial/Java/0340__Database/NewtoJava6isalightweightdatabasecalledDerby.htm) a set of guides and tutorial... | When you say
>
> access in database
>
>
>
do you mean Microsoft Access or access the data in a database.
I would advise against MS Access if that is the case. If not, you could either use the JavaDB or HSQLDB and the use SQL scripts to create the database. As a summary
1. Package the application in one of the i... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Have a look at [SQLite](http://sqlite.org), which is used by Mozilla (Firefox stores all bookmarks and history in a database) and several other major applications. | I would second the posters who recommend JavaDB.
It is absurdly easy to adminster from inside your application. Whats more because everything is native Java you dont get the char->unicode little-endian->big-endien and all the other conversion malarky you normally get when reading SQL into java.
The one tip is that wi... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Have a look at [SQLite](http://sqlite.org), which is used by Mozilla (Firefox stores all bookmarks and history in a database) and several other major applications. | I recommend the [H2 database](http://www.h2database.com/) because it is simple, fast, pure Java, and small. See [this page](http://www.h2database.com/html/features.html#comparison) for how H2 compares to other Java databases, including those mentioned here in other answers. It has many features Derby/JavaDB and HSQLDB ... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Java 6 (enhanced for desktop application work) comes with a built-in database called [JavaDb](http://developers.sun.com/javadb/) (formerly IBM's Derby). That will do what you want.
[Here's](http://www.java2s.com/Tutorial/Java/0340__Database/NewtoJava6isalightweightdatabasecalledDerby.htm) a set of guides and tutorial... | My option is HSQLDB since it's fast, reliable and easy to use.
[In the documentation](http://hsqldb.org/doc/guide/ch01.html#N101A8) it's explained how to use the standalone database mode, this is primarily used for unit testing but it fits your case too. The good thing with this is that you just connect to the file ba... |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Java 6 (enhanced for desktop application work) comes with a built-in database called [JavaDb](http://developers.sun.com/javadb/) (formerly IBM's Derby). That will do what you want.
[Here's](http://www.java2s.com/Tutorial/Java/0340__Database/NewtoJava6isalightweightdatabasecalledDerby.htm) a set of guides and tutorial... | In the last distribution of NetBeans I used, there was a wizard to create such application. The application used the Java Persistence API to store the Data. |
1,377,482 | ```
// ResxmlParser is globally declared as NSXMLParser
-(void)parsingXML:(NSString *)resXml
{
NSData *xmlNsData =[resXml dataUsingEncoding:NSASCIIStringEncoding];
ResxmlParser = [[NSXMLParser alloc] initWithData:xmlNsData ];
[ResxmlParser setDelegate: self];
[ResxmlParser setShouldResolv... | 2009/09/04 | [
"https://Stackoverflow.com/questions/1377482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168335/"
] | Java 6 (enhanced for desktop application work) comes with a built-in database called [JavaDb](http://developers.sun.com/javadb/) (formerly IBM's Derby). That will do what you want.
[Here's](http://www.java2s.com/Tutorial/Java/0340__Database/NewtoJava6isalightweightdatabasecalledDerby.htm) a set of guides and tutorial... | I recommend the [H2 database](http://www.h2database.com/) because it is simple, fast, pure Java, and small. See [this page](http://www.h2database.com/html/features.html#comparison) for how H2 compares to other Java databases, including those mentioned here in other answers. It has many features Derby/JavaDB and HSQLDB ... |
30,455,604 | I keep having this error, and honestly I can't really figure it out.
```
<?php
$servername="localhost"; //replace with database hostname
$username="root"; //replace with database username
$password=""; //replace with database password
$dbname="mybd"; //replace with database name
//create connection
$conn = new... | 2015/05/26 | [
"https://Stackoverflow.com/questions/30455604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3087971/"
] | The closing `}` is missing for your if statement. | You forget to close `if($cnt>0){` condition
```
<?php
$servername="localhost"; //replace with database hostname
$username="root"; //replace with database username
$password=""; //replace with database password
$dbname="mybd"; //replace with database name
//create connection
$conn = new mysqli($servername, $userna... |
30,455,604 | I keep having this error, and honestly I can't really figure it out.
```
<?php
$servername="localhost"; //replace with database hostname
$username="root"; //replace with database username
$password=""; //replace with database password
$dbname="mybd"; //replace with database name
//create connection
$conn = new... | 2015/05/26 | [
"https://Stackoverflow.com/questions/30455604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3087971/"
] | The closing `}` is missing for your if statement. | You are missing } for if($cnt>0){ |
55,147,281 | Assume:
`str = "Water - 3, Tomatos - 4, Melons - 5, Apples - 6"`.
My goal is to extract the numbers to a number array in order to perform some calculations on them.
Assuming each number is in range 0-9, in `C#` one could use the `int.TryParse` method on each character and parse those numbers into an array.
1) Is th... | 2019/03/13 | [
"https://Stackoverflow.com/questions/55147281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6395379/"
] | You can [split](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) on an empty string to get an array of characters. Then you can [filter](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) each character removing non-numeric character... | You can use [**match**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match)
```js
let str = "Water - 3, Tomatos - 4, Melons - 5, Apples - 6"
let op = str.match(/\d+/g).map(e=> +e)
console.log(op)
``` |
3,671,940 | Let $f : [0, 2] \to [0, 2]$ such that $f(x) = \frac{2}{1 + 2x - x^2}$ is a continuous function. Suppose $0 < x\_1 < 2$. We can create a sequence $(x\_n)$ using the recursive formula $x\_{n+1} = f(x\_n)$. How can we show that $(x\_n)$ converges?
I'm unsure how to proceed because $f$ is not monotone over the interval $... | 2020/05/12 | [
"https://math.stackexchange.com/questions/3671940",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/786888/"
] | For $4x^3+3bx^2+2cx+d=0$ to have only one real solution. The sign of the slope of $f'(x)=4x^3+3bx^2+2cx+d$ should not change, i.e. $f^{''} > 0$ (or $< 0$) for all $x$. Thus we want $12x^2+6bx+2c > 0$ for all $x$. This will happen only when the discriminant $3b^2-8c$ of this quadratic expression is $< 0$. | Suppose there were two (or more) (local) minima. Then there are two (or more) zeroes of the first derivative and, by the mean value theorem (or just Rolle's theorem), a zero of the second derivative, between any two zeroes of the first.
Now $f''(x) = 12 x^2 + 6 b x + 2c$ has discriminant $36b^2 - 96 b = 12(3b^2 - 8 c)... |
59,166,776 | We have the following setup -> An Azure API Management layer calling in to a web api hosted on Service Fabric in a container. The web API runs on asp netcore using MVC. We have a lot of middlewares in our code and we measure the latency of the request in each. We also measure the latency of the request at the caller (A... | 2019/12/03 | [
"https://Stackoverflow.com/questions/59166776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741488/"
] | Yes, it is possible for middleware to start writing response.
```
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Use(async (context, next) =>
{
await context.Response.WriteAsync(
$"Hello {CultureInfo.CurrentCulture.DisplayName}");
... | Yes, It's possible, in fact we Make it possible when we make Middlewares.
here is a custom middleware:
```
public class MyCustomMiddleware
{
private readonly RequestDelegate _next;
public CustomMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext httpCo... |
187,204 | How to write "y^2" in latex ? I need that hook in mathmode. The error says to put the expression within $...$. | 2014/06/29 | [
"https://tex.stackexchange.com/questions/187204",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/41277/"
] | Here are several methods for showing the `^` character -- in math mode, text mode, and "verbatim" ("monospaced font") mode. (The third text mode variant and the verbatim variant courtesy of cmhughes and Johannes\_B...)

```
\documentclass{article}
\b... | Here's a little experiment of what you are asking --
```
\documentclass{article}
\usepackage{tipa}
\usepackage{upgreek}
\begin{document}
$y\string^2$ \\
y\string^2 \\
y\^{}2 \\
y\textasciicircum2\\
\verb!y^2!\\
y\textsuperscript{\^{}}2 \\
$y \mathbin{\char`\^} 2$ \\
$y ^\wedge 2$\\
$y^\bigwedge 2$\\
% requires `tip... |
300,700 | **Problem:** I have 5V input from USB, I need to split it into four rails with +/-5V and +/-15V.
**Currently done**: I have built the following circuit in a breadboard.
[](https://i.stack.imgur.c... | 2017/04/20 | [
"https://electronics.stackexchange.com/questions/300700",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/146089/"
] | **Alternative solution:**
I generally think virtual grounding adds more issues than it resolves. As such I highly recommend a different power splitting approach that maintains the original ground.
For example....
[](https://i.stack.imgur.com/0meV9.... | If you re label your outputs as {0, +15, +30} for the 30V splitter and {0,+5,+10} for the 10V splitter then the problem becomes obvious.
You could use an isolating converter for the step up to 30V, at which point the problem goes away (possibly to be replaced by an EMC headache), or forgo the rail splitters and gener... |
2,700,421 | HI All,
I have a PDF file with a xml attached, i need to parse the xml file. Does anyone knows how i do that?
I´m using C#.
Thanks in advance. | 2010/04/23 | [
"https://Stackoverflow.com/questions/2700421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162752/"
] | If you want to return the "default" value for T:
```
public static T val<T>(this bool b, T v) { return b == true? v : default(T); }
```
[Default Values Table](http://msdn.microsoft.com/en-us/library/83fhsxwc.aspx)
[default Keyword in Generic Code](http://msdn.microsoft.com/en-us/library/xwth0h0d.aspx) | Try replacing `v : 0` with `v : default(T)` , if you have a good reason for generics. If you need to restrict it to int, then you're not writing a generic class. |
2,700,421 | HI All,
I have a PDF file with a xml attached, i need to parse the xml file. Does anyone knows how i do that?
I´m using C#.
Thanks in advance. | 2010/04/23 | [
"https://Stackoverflow.com/questions/2700421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162752/"
] | If you want to return the "default" value for T:
```
public static T val<T>(this bool b, T v) { return b == true? v : default(T); }
```
[Default Values Table](http://msdn.microsoft.com/en-us/library/83fhsxwc.aspx)
[default Keyword in Generic Code](http://msdn.microsoft.com/en-us/library/xwth0h0d.aspx) | Srsly!
To "restrict T to int" you take advantage of a special compiler feature known as `strong-typing`:
```
static public class Blah
{
public static int val(this bool b, int v) { return b == true? v:0; }
}
```
Tada! :)
Seriously, why are you using generics? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.