qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
36,814,390 | I have a simple `TopbarComponent` which basically adds a bootstrapish navbar at the top of my view.
Since 90% of my templates should have this directive included, i want to handle it through my `app.component` which looks like this:
```
import ...;
@Component({
selector: 'my-app',
templateUrl: 'app/app.comp... | 2016/04/23 | [
"https://Stackoverflow.com/questions/36814390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114201/"
] | Not sure if it is the right way, but you can add any data in the `data` parameter of the [`@RouteConfig()`](https://angular.io/docs/ts/latest/api/router/RouteConfig-decorator.html) object. For instance you can place in the [`RouteDefinition`](https://angular.io/docs/ts/latest/api/router/RouteDefinition-interface.html) ... | I has a similar problem. Maybe this is not the best way. But I solved it this way:
I created a new component. This component handles all the routes that need the navbar. The other routes are handled by `app.component`.
Here is some code to understand:
`app.component`
```
@RouteConfig([
{
path: '/...',
name... |
36,814,390 | I have a simple `TopbarComponent` which basically adds a bootstrapish navbar at the top of my view.
Since 90% of my templates should have this directive included, i want to handle it through my `app.component` which looks like this:
```
import ...;
@Component({
selector: 'my-app',
templateUrl: 'app/app.comp... | 2016/04/23 | [
"https://Stackoverflow.com/questions/36814390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114201/"
] | Not sure if it is the right way, but you can add any data in the `data` parameter of the [`@RouteConfig()`](https://angular.io/docs/ts/latest/api/router/RouteConfig-decorator.html) object. For instance you can place in the [`RouteDefinition`](https://angular.io/docs/ts/latest/api/router/RouteDefinition-interface.html) ... | This is probably not the right way to do it at all, but it worked for me. It's not changing the visibility depending on the route itself, but on the Component shown in that route.
I was already using a service to feed the Navigation Bar with all the sections, and so on, so I thought it could also tell the navigation ... |
36,814,390 | I have a simple `TopbarComponent` which basically adds a bootstrapish navbar at the top of my view.
Since 90% of my templates should have this directive included, i want to handle it through my `app.component` which looks like this:
```
import ...;
@Component({
selector: 'my-app',
templateUrl: 'app/app.comp... | 2016/04/23 | [
"https://Stackoverflow.com/questions/36814390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114201/"
] | Almost there, try this
**Template**
```ts
<my-topbar *ngIf="shouldShowTopbar()">
</my-topbar>
```
**App Component**
```ts
export class AppComponent implements OnInit{
hideWhen: Array<string> = ['Login', 'Help', 'SomeOtherRoute'];
// put all the route names where you want it hidden in above array
c... | I'm working in
```
"@angular/common": "~2.1.0"
```
The way that I solved this issue was to created an application-wide data object `global` and a service for it `GlobalService`. Any component can `subscribe()` to all or part of the global object. For your purposes, you should create a boolean property `isTopBar: tr... |
66,152,867 | So it should work like that
squareDigits("a22b") on "a44b"
squareDigits("a9b2") on "a81b4"
What I have got so far :
```
public class Code {
public static void main(String[] args) {
String ok = "a2b9";
System.out.println(squareDigits(ok)); // "a81b4"
}
public static String squareDigits(Str... | 2021/02/11 | [
"https://Stackoverflow.com/questions/66152867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15189687/"
] | What was the original problem was assigning the `EditContext`. It was necessary to access it but it can be done via `editForm.EditContext` as in the example below.
Working example <https://blazorrepl.com/repl/Glkmbcbr323MP1VS55>
Parent component:
```
<ChildComponent @ref="myTestComponent" testModel="testModel" />
<i... | I'll try to explain why your approach is not working and then suggest ways to solve it. I hope I understand your intentions correctly.
First you need to change the `<input type="text" ...>` to `<InputText @bind-Value="..." />`
When your method `buttonClick` is finished in your parent component, Blazor will call `Stat... |
66,152,867 | So it should work like that
squareDigits("a22b") on "a44b"
squareDigits("a9b2") on "a81b4"
What I have got so far :
```
public class Code {
public static void main(String[] args) {
String ok = "a2b9";
System.out.println(squareDigits(ok)); // "a81b4"
}
public static String squareDigits(Str... | 2021/02/11 | [
"https://Stackoverflow.com/questions/66152867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15189687/"
] | What was the original problem was assigning the `EditContext`. It was necessary to access it but it can be done via `editForm.EditContext` as in the example below.
Working example <https://blazorrepl.com/repl/Glkmbcbr323MP1VS55>
Parent component:
```
<ChildComponent @ref="myTestComponent" testModel="testModel" />
<i... | I have a different approach..
Your Parent have to look like this
```
<CascadingValue Value="testModel">
<EditForm Model="testModel">
<ChildComponent @ref="myTestComponent" />
<ObjectGraphDataAnnotationsValidator />
<ValidationMessage For="@(()=>testModel.Name)" />
<br />
<bu... |
33,694,064 | I have a QTableWidget that has QPushButtons as cell widgets. I use these push buttons as a means to delete a row from the table. I'm having a problem where the QPushButtons can be accidentally shifted from being centered in their cell. The image below shows what is happening.
[`.
If you did not specialize `QTableView`, you can't simply call this function (as it is protected), so here's a trick to simply do it:
```
class MyQTableView : public QTableView
{
public:
in... | Try `ui->tableWidget->clearSelection();` |
33,694,064 | I have a QTableWidget that has QPushButtons as cell widgets. I use these push buttons as a means to delete a row from the table. I'm having a problem where the QPushButtons can be accidentally shifted from being centered in their cell. The image below shows what is happening.
[`.
If you did not specialize `QTableView`, you can't simply call this function (as it is protected), so here's a trick to simply do it:
```
class MyQTableView : public QTableView
{
public:
in... | This happen only when scroll bar is added.to solve this you need to setvrticalscrollbarpolicy to scroll bar off then delete the row and add the scroll as needed by setverticalbarpolicy.
It will solve your problem.
I did the same way. |
31,669,397 | I have log file in tomcat logs and I want to write a script to merge last 7 days log files.
Log file names `catalina.2015-04-23.log`, `catalina.2015-06-05.log`, `catalina.2015-06-04.log`. | 2015/07/28 | [
"https://Stackoverflow.com/questions/31669397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1071083/"
] | This will produce the merged log file for 1 week
```
for a in `seq 6 -1 0`;
do
dt=`date "+%F" --date=" -"$a" days"`;
f=$dt".log";
cat $f >> "1_week.log";
done;
``` | For avoiding to use the explicit date, I assume that the files have been last modified on the date they are logging, allowing to use `find` and a one-liner for this:
```
find . -name '*catalina*' -daystart -mtime -6 -mtime +0 -exec cat '{}' >> this_weeks_logs.log \;
```
Explanation:
Find all files in local folder ... |
31,669,397 | I have log file in tomcat logs and I want to write a script to merge last 7 days log files.
Log file names `catalina.2015-04-23.log`, `catalina.2015-06-05.log`, `catalina.2015-06-04.log`. | 2015/07/28 | [
"https://Stackoverflow.com/questions/31669397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1071083/"
] | This will produce the merged log file for 1 week
```
for a in `seq 6 -1 0`;
do
dt=`date "+%F" --date=" -"$a" days"`;
f=$dt".log";
cat $f >> "1_week.log";
done;
``` | [*Super Speedy Syslog Searcher*](https://crates.io/crates/super_speedy_syslog_searcher) can merge multiple log files into one log file, sorting log messages by datetime, and filtering by a datetime range.
(assuming you have [rust installed](https://www.rust-lang.org/tools/install))
```
cargo install super_speedy_sysl... |
31,669,397 | I have log file in tomcat logs and I want to write a script to merge last 7 days log files.
Log file names `catalina.2015-04-23.log`, `catalina.2015-06-05.log`, `catalina.2015-06-04.log`. | 2015/07/28 | [
"https://Stackoverflow.com/questions/31669397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1071083/"
] | For avoiding to use the explicit date, I assume that the files have been last modified on the date they are logging, allowing to use `find` and a one-liner for this:
```
find . -name '*catalina*' -daystart -mtime -6 -mtime +0 -exec cat '{}' >> this_weeks_logs.log \;
```
Explanation:
Find all files in local folder ... | [*Super Speedy Syslog Searcher*](https://crates.io/crates/super_speedy_syslog_searcher) can merge multiple log files into one log file, sorting log messages by datetime, and filtering by a datetime range.
(assuming you have [rust installed](https://www.rust-lang.org/tools/install))
```
cargo install super_speedy_sysl... |
27,244,315 | I'm new to *Android*... I use *Eclipse Juno* IDE.
My aim is to just direct my app to a web page on opening it. I use `WebView` concept.
Have given all permissions correctly(upto my knowledge). Java Code seems error free on eclipse.
But, ON EMULATOR IT SAYS "net::ERR\_CACHE\_MISS".
When installed the app on mobile, th... | 2014/12/02 | [
"https://Stackoverflow.com/questions/27244315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4116560/"
] | Finally it works after some minor changes in my **MainActivity.java**. Below is the edited code:
```
package com.example.webview;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import... | try the full adress something like :
```
Browser.loadUrl("http://www.google.co.in");
```
All I know that only "www" does not work. |
68,359,312 | I have a data -
```
data = [['0092', 'ab cd [1]'], ['887', 'ab ef [2]'], ['776', 'ab gh ab [3]'],
['33101', 'ab ij [4]'], ['0922', 'ab kl [5]']]
df = pd.DataFrame(data, columns = ('col_1', 'col_2'))
df
col_1 col_2
0092 ab cd [1]
887 ab ef [2]
776 ab gh ab [3]
33101 ab ij [4... | 2021/07/13 | [
"https://Stackoverflow.com/questions/68359312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15437851/"
] | We can use `str.extract` here:
```py
df["col_3"] = df["col_2"].str.extract(r'^.*\[(\d+)\]')
df["col_2"] = df["col_2"].str.extract(r'^(.*?)(?=\s*(?:\[\d+\]|$))')
``` | You can use:
```
df['col_2'] = df['col_2'].str.replace(r"[[0-9]+]$","")
df['col_3'] = df['col_2'].str.extract('(\d+)')
``` |
68,359,312 | I have a data -
```
data = [['0092', 'ab cd [1]'], ['887', 'ab ef [2]'], ['776', 'ab gh ab [3]'],
['33101', 'ab ij [4]'], ['0922', 'ab kl [5]']]
df = pd.DataFrame(data, columns = ('col_1', 'col_2'))
df
col_1 col_2
0092 ab cd [1]
887 ab ef [2]
776 ab gh ab [3]
33101 ab ij [4... | 2021/07/13 | [
"https://Stackoverflow.com/questions/68359312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15437851/"
] | We can use `str.extract` here:
```py
df["col_3"] = df["col_2"].str.extract(r'^.*\[(\d+)\]')
df["col_2"] = df["col_2"].str.extract(r'^(.*?)(?=\s*(?:\[\d+\]|$))')
``` | Try this.
```py
df['col_3'] = df['col_2'].str.extract('(\d+)')
df['col_2'] = df['col_2'].apply(lambda x: ' '.join(x.split(' ')[:-1]))
``` |
68,359,312 | I have a data -
```
data = [['0092', 'ab cd [1]'], ['887', 'ab ef [2]'], ['776', 'ab gh ab [3]'],
['33101', 'ab ij [4]'], ['0922', 'ab kl [5]']]
df = pd.DataFrame(data, columns = ('col_1', 'col_2'))
df
col_1 col_2
0092 ab cd [1]
887 ab ef [2]
776 ab gh ab [3]
33101 ab ij [4... | 2021/07/13 | [
"https://Stackoverflow.com/questions/68359312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15437851/"
] | We can use `str.extract` here:
```py
df["col_3"] = df["col_2"].str.extract(r'^.*\[(\d+)\]')
df["col_2"] = df["col_2"].str.extract(r'^(.*?)(?=\s*(?:\[\d+\]|$))')
``` | First use the for loop to extract the element form column col\_2. Then split each values with '[' and ']' and append it to the empty list as given in following code,
```
col_2 = []
col_3 = []
for i in df['col_2']:
col_2.append(i.split(sep=' [')[0])
col_3.append(int(i.split(sep=' [')[1].split(sep=']')[0]))
```
... |
68,359,312 | I have a data -
```
data = [['0092', 'ab cd [1]'], ['887', 'ab ef [2]'], ['776', 'ab gh ab [3]'],
['33101', 'ab ij [4]'], ['0922', 'ab kl [5]']]
df = pd.DataFrame(data, columns = ('col_1', 'col_2'))
df
col_1 col_2
0092 ab cd [1]
887 ab ef [2]
776 ab gh ab [3]
33101 ab ij [4... | 2021/07/13 | [
"https://Stackoverflow.com/questions/68359312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15437851/"
] | You can use:
```
df['col_2'] = df['col_2'].str.replace(r"[[0-9]+]$","")
df['col_3'] = df['col_2'].str.extract('(\d+)')
``` | Try this.
```py
df['col_3'] = df['col_2'].str.extract('(\d+)')
df['col_2'] = df['col_2'].apply(lambda x: ' '.join(x.split(' ')[:-1]))
``` |
68,359,312 | I have a data -
```
data = [['0092', 'ab cd [1]'], ['887', 'ab ef [2]'], ['776', 'ab gh ab [3]'],
['33101', 'ab ij [4]'], ['0922', 'ab kl [5]']]
df = pd.DataFrame(data, columns = ('col_1', 'col_2'))
df
col_1 col_2
0092 ab cd [1]
887 ab ef [2]
776 ab gh ab [3]
33101 ab ij [4... | 2021/07/13 | [
"https://Stackoverflow.com/questions/68359312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15437851/"
] | You can use:
```
df['col_2'] = df['col_2'].str.replace(r"[[0-9]+]$","")
df['col_3'] = df['col_2'].str.extract('(\d+)')
``` | First use the for loop to extract the element form column col\_2. Then split each values with '[' and ']' and append it to the empty list as given in following code,
```
col_2 = []
col_3 = []
for i in df['col_2']:
col_2.append(i.split(sep=' [')[0])
col_3.append(int(i.split(sep=' [')[1].split(sep=']')[0]))
```
... |
65,020,252 | I am working with the cameraCalibration function of openCV and that works just fine. However, I'm having trouble understanding why it uses it's particular cost function
```
sqrt( 1/n * sum( d(xi', xi)**2 ,i , 1, n))
```
where `xi'` are the re-projected (or model) coordinates and `xi` the raw image coordinates (see ... | 2020/11/26 | [
"https://Stackoverflow.com/questions/65020252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2528453/"
] | The first quantity would be the RMS of re-projection error vector lengths.
For the sake of optimisation, the sum of squares, SSE, has the same extrema:
>
> sum( d(xi', xi)\*\*2 ) = sum( dot(xi' - xi, xi' - xi) )
>
>
>
Your alternative is the sum (or equivalently the mean) of error lengths:
>
> sum( d(xi', xi) )... | Interpreting the sets of n reprojections and data as vectors in a 2n-dimensional space, the squared reprojection error (your first formula) is 1/n times the square of the length of the difference between the vectors. Because the square of a vector's length grows monotonically with the length itself, optimizing the squa... |
61,272,019 | I am trying to convert [firefox-ctrl-q-workaround](https://github.com/sasawat/firefox-ctrl-q-workaround) to also handle Ctrl-Shift-C. This is because I keep using Ctrl-Shift-C in Firefox by mistake and popping open Developer Tools all the time is getting tedious. Firefox, incredibly annoyingly, does not have any way of... | 2020/04/17 | [
"https://Stackoverflow.com/questions/61272019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1381158/"
] | Perhaps you could restrict the match on `Control+Shift+c` by using criteria which matches just firefox, something like
```
bindsym Control+Shift+c [class="Firefox"] exec xdotool key --clearmodifiers ctrl+c
``` | With Autokey
============
*[This isn't really an answer to the question (how to stop infinite loops between xdotool and i3), but it's an alternative that is more flexible that the i3 `bindsym [class="firefox"]` approach in case you need to execute more logic that might send the original key. If you know you'll never s... |
67,788 | I am reading a computation that $\int\_{0}^{\infty} \frac{1 - \cos x}{x^{2}}\, dx = \frac{\pi}{2}.$ They integrate over the indented semicircle. Let $R\_{\varepsilon}$ be the semicircle in the upper half plane of radius epsilon around the origin going from $-\varepsilon$ to $\varepsilon$. My question is: what is the re... | 2011/09/26 | [
"https://math.stackexchange.com/questions/67788",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/8488/"
] | Since $z = -\epsilon \mathrm{e}^{-i \phi}$, where $\phi$ varies from $0$ to $\pi$. Then $\mathrm{d} z = i \epsilon \, \mathrm{e}^{-i \phi} \mathrm{d} \phi$, so
$$
\int\_{R\_\epsilon} \frac{1 - \mathrm{e}^{i z}}{z^2} \mathrm{d} z = \int\_0^\pi
\frac{ 1-\exp( -i \epsilon \mathrm{e}^{-i \phi} )}{ \epsilon^2 \mathrm... | Consider the Laurent series
$$
\frac{1-e^{iz}}{z^2}=-\frac{i}{z}+\frac{1}{2}+\frac{iz}{6}-\frac{z^2}{24}-\dots
$$
The only part that doesn't vanish as $\epsilon\to0$ is $-\frac{i}{z}$. The integral of $\frac{1}{z}$ is $\log(z)=\log|z|+i\arg(z)$. Since $\arg(z)$ drops by $\pi$ over $R\_\epsilon$ (and $|z|$ doesn't cha... |
36,818,877 | I wrote an function to determine if string `a` is a permutation of string `b`. The definition is as follows:
```
bool isPermutation(std::string a, std::string b){
if(a.length() != b.length())
return false;
int a_sum, b_sum;
a_sum = b_sum = 0;
for(int i = 0; i < a.length(); ++i){
a_sum +... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36818877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4907651/"
] | You can count characters separately:
```
bool isPermutation(std::string a, std::string b)
{
if(a.length() != b.length())
return false;
assert(a.length() <= INT_MAX);
assert(b.length() <= INT_MAX);
int counts[256] = {};
for (unsigned char ch : a)
++counts[ch];
for (unsigned cha... | A simple approach if you don't need UTF-8 support
-------------------------------------------------
The solution to this problem is surprisingly easy. There is a function in standard library handling this.
Assume that `a` and `b` are two `string`s:
```
return is_permutation(a.begin(), a.end(), b.begin(), b.end());
... |
36,818,877 | I wrote an function to determine if string `a` is a permutation of string `b`. The definition is as follows:
```
bool isPermutation(std::string a, std::string b){
if(a.length() != b.length())
return false;
int a_sum, b_sum;
a_sum = b_sum = 0;
for(int i = 0; i < a.length(); ++i){
a_sum +... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36818877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4907651/"
] | You can count characters separately:
```
bool isPermutation(std::string a, std::string b)
{
if(a.length() != b.length())
return false;
assert(a.length() <= INT_MAX);
assert(b.length() <= INT_MAX);
int counts[256] = {};
for (unsigned char ch : a)
++counts[ch];
for (unsigned cha... | ```
std::sort( strOne.begin(), strOne.end() );
std::sort( strTwo.begin(), strTwo.end() );
return strOne == strTwo;
```
will be sufficient.
---
My suggestion is to use `std::unordered_map`
i.e.
```
std::unordered_map< char, unsigned > umapOne;
std::unordered_map< char, unsigned > umapTwo;
for( char c : strOne ... |
36,818,877 | I wrote an function to determine if string `a` is a permutation of string `b`. The definition is as follows:
```
bool isPermutation(std::string a, std::string b){
if(a.length() != b.length())
return false;
int a_sum, b_sum;
a_sum = b_sum = 0;
for(int i = 0; i < a.length(); ++i){
a_sum +... | 2016/04/24 | [
"https://Stackoverflow.com/questions/36818877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4907651/"
] | A simple approach if you don't need UTF-8 support
-------------------------------------------------
The solution to this problem is surprisingly easy. There is a function in standard library handling this.
Assume that `a` and `b` are two `string`s:
```
return is_permutation(a.begin(), a.end(), b.begin(), b.end());
... | ```
std::sort( strOne.begin(), strOne.end() );
std::sort( strTwo.begin(), strTwo.end() );
return strOne == strTwo;
```
will be sufficient.
---
My suggestion is to use `std::unordered_map`
i.e.
```
std::unordered_map< char, unsigned > umapOne;
std::unordered_map< char, unsigned > umapTwo;
for( char c : strOne ... |
56,931,516 | I'm implementing a third party application to simply handle all the functionalities of AWS Lambda using AWS SDK. I'm using JetBrains IntelliJ Idea IDE for coding. Can someone explain how to create a lambda object in Java to create/invoke aws lambda functions?
I referred to [documentation](https://docs.aws.amazon.com/A... | 2019/07/08 | [
"https://Stackoverflow.com/questions/56931516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10302908/"
] | You don't have to create a lambda object. Lambda functions are frozen when not in use. That why global variables don't lose their data. You just have to send a invoke call, AWS will take care of the rest.
I thought the above info is good to know. Now you can find an example to invoke a lambda function in this [link](h... | Try with this class.
```
import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.lambda.AWSLambdaClient;
import com.amazonaws.services.lamb... |
120,047 | I'm from South India. My home roof is built with steel panels. During the summer, the roof will get too hot. I don't know much more about how cool in natural way.
Is there a way to cool the roof naturally? | 2017/07/24 | [
"https://diy.stackexchange.com/questions/120047",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/73442/"
] | Paint the roof white or silver to reflect as much sunlight as possible. This is a passive method once it is done.
Water removes heat better than air so if you have a source of water, or collected and stored rainwater, it could be sprayed on the roof during times of high heat.
This isn't "natural" but if you have an a... | What you want to do is to prevent the heat from the hot roof from flowing into the living space. In the US traditionally this was accomplished by insulating the ceiling of the living space. The attic (aka loft) would get very hot but the insulation on the attic side of the ceiling would prevent heat flow through the ce... |
65,340,943 | I've read about asynchronous programming in C#, but I still do not fully understand how continuation of async method is executed.
From my understanding, Asynchronous programming is not about multithreading. We can run async method on UI Thread, and it later continues on that UI Thread (while not blocking and continuing... | 2020/12/17 | [
"https://Stackoverflow.com/questions/65340943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4431369/"
] | >
> So my question is, how the rest code is executed? Is finished async operation triggers a new message, that is then handled by DispatchMessage() again? Or the message loop has another method (after dispatch), that checks for finished async operations?
>
>
>
`await` by default will capture a "context" and use th... | Alex Davies wrote an excellent book on this, it is called "Async in C# 5", I strongly recommend reading it.
I can't tell low level details behind this, but at the high level CLR will create something like this:
```
void __buttoncliked_remaining_code_1(...) {
loadingBar.Hide();
}
```
So, a specific event will ... |
19,032,798 | I use **JIBX** to create my entity classes from XSD files. It is configured in pom.xml and creates classes when I do a "maven: compile"
I also use spring-ws. When I test my web service with SOAPUI I get the infamous error;
```
"No adapter for endpoint GetTransactionsResponse getTransactions(GetTransactionsRequest), ... | 2013/09/26 | [
"https://Stackoverflow.com/questions/19032798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/379028/"
] | You can add two more window functions to get the 2nd and 3rd highest price, this should run in the same STAT-step as your current ROW\_NUMBER, so there's no additional overhead:
```
select
product,
price as Price1,
min(price)
over (partition by product
order by price desc
rows between 1 ... | I just give sort direction for each sort parameter , and then , it works , very fine. No Partition is used.
```
SELECT TOP (5) ROW_NUMBER() OVER (ORDER BY SCHEME ASC,APPLICATION_DATE DESC,TRANSACTION_REF_NO ASC,APPLICATION_STATUS DESC)
``` |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | Use [DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format):
```
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;
``` | I don't know what `FORMATDATE` is, but you can use `DATE-FORMAT`
<http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format> |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | Use [DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format):
```
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;
``` | If you are writing application containing different timezones and formats better practice will be using UNIX timestamp stored in int(8) field, otherwise you can format date fields in queries. |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | Use [DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format):
```
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;
``` | ```
select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
```
the result is something like this
**09-22-11**
as opposed to this
**2011-02-02 15:42:51** |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | Use [DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format):
```
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;
``` | you can put name of column in back of date\_format. like this :
```
$rs = mysql_query("select blablabla,DATE_FORMAT(name_column, '%d-%b-%y | %H:%i')name_column,DATE_FORMAT(name_column2, '%d-%b-%y | %H:%i')as name_column2 from db ORDER BY id DESC limit $offset,$rows");
```
or you can put "as"
yes, you must select on... |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | Use [DATE\_FORMAT](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format):
```
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;
``` | in the above solutions the select first extract all columns, then the date column with a requested format, this means that the date columns is returned twice, once in default format and once in requested format. Actually if you want to change the format of 1, 2 ou 3 date columns from you table and you also want to avoi... |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | ```
select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
```
the result is something like this
**09-22-11**
as opposed to this
**2011-02-02 15:42:51** | I don't know what `FORMATDATE` is, but you can use `DATE-FORMAT`
<http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format> |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | ```
select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
```
the result is something like this
**09-22-11**
as opposed to this
**2011-02-02 15:42:51** | If you are writing application containing different timezones and formats better practice will be using UNIX timestamp stored in int(8) field, otherwise you can format date fields in queries. |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | ```
select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
```
the result is something like this
**09-22-11**
as opposed to this
**2011-02-02 15:42:51** | you can put name of column in back of date\_format. like this :
```
$rs = mysql_query("select blablabla,DATE_FORMAT(name_column, '%d-%b-%y | %H:%i')name_column,DATE_FORMAT(name_column2, '%d-%b-%y | %H:%i')as name_column2 from db ORDER BY id DESC limit $offset,$rows");
```
or you can put "as"
yes, you must select on... |
9,087,363 | Is it possible to format a date field in a SELECT \* query? I want to get all of the columns from my table but need a different format from the date.
Something like:
```
SELECT *, FORMATDATE(date,'%m-%d-%y') AS date FROM my_table;
```
or do I have to process it in php after the query? | 2012/01/31 | [
"https://Stackoverflow.com/questions/9087363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1106526/"
] | ```
select DATE_FORMAT(your_date_field_name,'%m-%d-%y') AS whatever FROM your_table_name_here;
```
the result is something like this
**09-22-11**
as opposed to this
**2011-02-02 15:42:51** | in the above solutions the select first extract all columns, then the date column with a requested format, this means that the date columns is returned twice, once in default format and once in requested format. Actually if you want to change the format of 1, 2 ou 3 date columns from you table and you also want to avoi... |
35,370,623 | we have an app running in bluemix under two different routes:
myapp.shortname.com
myapp.reallyreallyreallyreallylongname.com
but the SSO service does not work with myapp.shortname.com giving an error:
>
> CWOAU0062E: The OAuth service provider could not redirect the request
> because the redirect URI was not valid.... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35370623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5409977/"
] | That's easy, just define a dictionary which maps characters to their replacement.
```
>>> replacers = {'A':'Z', 'T':'U', 'H':'F'}
>>> inp = raw_input()
A T H X
>>> ''.join(replacers.get(c, c) for c in inp)
'Z U F X'
```
I don't know where exactly you want to go and whether case-sensitivity matters, or if there's a m... | timgeb has a great solution; alternatively, you could also use what's on [this page of the docs](https://docs.python.org/3/library/random.html) and use a `for` loop to assign a random integer to each letter, and store it in a dictionary (see `randint`).
This would be more helpful if you want it to change every time yo... |
35,370,623 | we have an app running in bluemix under two different routes:
myapp.shortname.com
myapp.reallyreallyreallyreallylongname.com
but the SSO service does not work with myapp.shortname.com giving an error:
>
> CWOAU0062E: The OAuth service provider could not redirect the request
> because the redirect URI was not valid.... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35370623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5409977/"
] | That's easy, just define a dictionary which maps characters to their replacement.
```
>>> replacers = {'A':'Z', 'T':'U', 'H':'F'}
>>> inp = raw_input()
A T H X
>>> ''.join(replacers.get(c, c) for c in inp)
'Z U F X'
```
I don't know where exactly you want to go and whether case-sensitivity matters, or if there's a m... | ```
from string import maketrans
orginalCharacters = "aeiou"
encodedCharacters = "12345"
trantab = maketrans(orginalCharacters, encodedCharacters)
text = "this is string example";
print text.translate(trantab)
```
this will output:
```
th3s 3s str3ng 2x1mpl2
```
Look up the function **translate** for more info |
35,370,623 | we have an app running in bluemix under two different routes:
myapp.shortname.com
myapp.reallyreallyreallyreallylongname.com
but the SSO service does not work with myapp.shortname.com giving an error:
>
> CWOAU0062E: The OAuth service provider could not redirect the request
> because the redirect URI was not valid.... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35370623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5409977/"
] | ```
from string import maketrans
orginalCharacters = "aeiou"
encodedCharacters = "12345"
trantab = maketrans(orginalCharacters, encodedCharacters)
text = "this is string example";
print text.translate(trantab)
```
this will output:
```
th3s 3s str3ng 2x1mpl2
```
Look up the function **translate** for more info | timgeb has a great solution; alternatively, you could also use what's on [this page of the docs](https://docs.python.org/3/library/random.html) and use a `for` loop to assign a random integer to each letter, and store it in a dictionary (see `randint`).
This would be more helpful if you want it to change every time yo... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | **Note that this answer was for a previous, different version of the question.**
Your result is wrong for Java.
Please provide some context how you arrived at it (your program, implementation and version of Java).
From the [Java Language Specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls... | To overcome this, you could add `64` (or whatever your modulus base is) to the negative value until it is positive
```
int k = -13;
int modbase = 64;
while (k < 0) {
k += modbase;
}
int result = k % modbase;
```
The result will still be in the same equivalence class. |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | Both definitions of modulus of negative numbers are in use - some languages use one definition and some the other.
If you want to get a negative number for negative inputs then you can use this:
```
int r = x % n;
if (r > 0 && x < 0)
{
r -= n;
}
```
Likewise if you were using a language that returns a negative ... | **Note that this answer was for a previous, different version of the question.**
Your result is wrong for Java.
Please provide some context how you arrived at it (your program, implementation and version of Java).
From the [Java Language Specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | `x = x + m = x - m` in modulus `m`.
so `-13 = -13 + 64` in modulus `64` and `-13 = 51` in modulus `64`.
assume `Z = X * d + r`, if `0 < r < X` then in division `Z/X` we call `r` the remainder.
`Z % X` returns the remainder of `Z/X`. | In Java latest versions you get `-13%64 = -13`. The answer will always have sign of numerator. |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | `x = x + m = x - m` in modulus `m`.
so `-13 = -13 + 64` in modulus `64` and `-13 = 51` in modulus `64`.
assume `Z = X * d + r`, if `0 < r < X` then in division `Z/X` we call `r` the remainder.
`Z % X` returns the remainder of `Z/X`. | How to get only positive modulus numbers in C or C++ (since the `%` operator allows negative numbers)
-----------------------------------------------------------------------------------------------------
Java and C and C++ all appear to act similarly in this manner. Without opening a new question, I'd like to present ... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | Both definitions of modulus of negative numbers are in use - some languages use one definition and some the other.
If you want to get a negative number for negative inputs then you can use this:
```
int r = x % n;
if (r > 0 && x < 0)
{
r -= n;
}
```
Likewise if you were using a language that returns a negative ... | Your answer is in wikipedia:
[modulo operation](http://en.wikipedia.org/wiki/Modulo_operation)
It says, that in Java the sign on modulo operation is the same as that of dividend. and since we're talking about the rest of the division operation is just fine, that it returns -13 in your case, since -13/64 = 0. -13-0 = -... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | Since "mathematically" both are correct:
```
-13 % 64 = -13 (on modulus 64)
-13 % 64 = 51 (on modulus 64)
```
One of the options had to be chosen by Java language developers and they chose:
>
> the sign of the result equals the sign of the dividend.
>
>
>
Says it in Java specs:
<https://docs.oracle.com/jav... | **Note that this answer was for a previous, different version of the question.**
Your result is wrong for Java.
Please provide some context how you arrived at it (your program, implementation and version of Java).
From the [Java Language Specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | Modulo arithmetic with negative operands is defined by the language designer, who might leave it to the language implementation, who might defer the definition to the CPU architecture.
~~I wasn't able to find a Java language definition.~~
Thanks Ishtar, Java Language Specification for the [Remainder Operator %](ht... | How to get only positive modulus numbers in C or C++ (since the `%` operator allows negative numbers)
-----------------------------------------------------------------------------------------------------
Java and C and C++ all appear to act similarly in this manner. Without opening a new question, I'd like to present ... |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | To overcome this, you could add `64` (or whatever your modulus base is) to the negative value until it is positive
```
int k = -13;
int modbase = 64;
while (k < 0) {
k += modbase;
}
int result = k % modbase;
```
The result will still be in the same equivalence class. | I don't think Java returns 51 in this case. I am running Java 8 on a Mac and I get:
```
-13 % 64 = -13
```
Program:
```
public class Test {
public static void main(String[] args) {
int i = -13;
int j = 64;
System.out.println(i % j);
}
}
``` |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | `x = x + m = x - m` in modulus `m`.
so `-13 = -13 + 64` in modulus `64` and `-13 = 51` in modulus `64`.
assume `Z = X * d + r`, if `0 < r < X` then in division `Z/X` we call `r` the remainder.
`Z % X` returns the remainder of `Z/X`. | In my version of Java JDK 1.8.0\_05 -13%64=-13
you could try -13-(int(-13/64))
in other words do division cast to an integer to get rid of the fraction part
then subtract from numerator
So numerator-(int(numerator/denominator)) should give the correct remainder & sign |
4,403,542 | Am I doing modulus wrong? Because in Java `-13 % 64` evaluates to `-13` but I want to get `51`. | 2010/12/09 | [
"https://Stackoverflow.com/questions/4403542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146504/"
] | Are you sure you are working in Java? 'cause Java gives -13 % 64 = -13 as expected. The sign of dividend! | In my version of Java JDK 1.8.0\_05 -13%64=-13
you could try -13-(int(-13/64))
in other words do division cast to an integer to get rid of the fraction part
then subtract from numerator
So numerator-(int(numerator/denominator)) should give the correct remainder & sign |
53,205,672 | I casually pressed a key, i don't know which one, i want to remove it from the view, i don't use VScode debugger at all.
[](https://i.stack.imgur.com/CY7uZ.png)
I read the [docs](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) but i... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53205672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9277453/"
] | >
> F9
>
>
>
or
>
> Click on the editor margin
>
>
>
or
>
> (Top Bar) Debug -> Toggle Breakpoint
>
>
>
or
>
> (Icon on The left) Debug -> Breakpoint section -> Mouse Over -> Remove all breakpoints
>
>
>
should remove the breakpoint | To remove all breakpoints (red dot) you need go to `Command Palette -> Debug` and choose `Remove all breakpoints` from dropdown list.
More is in
[Docs](https://code.visualstudio.com/docs/editor/debugging) |
53,205,672 | I casually pressed a key, i don't know which one, i want to remove it from the view, i don't use VScode debugger at all.
[](https://i.stack.imgur.com/CY7uZ.png)
I read the [docs](https://code.visualstudio.com/docs/editor/debugging#_breakpoints) but i... | 2018/11/08 | [
"https://Stackoverflow.com/questions/53205672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9277453/"
] | >
> F9
>
>
>
or
>
> Click on the editor margin
>
>
>
or
>
> (Top Bar) Debug -> Toggle Breakpoint
>
>
>
or
>
> (Icon on The left) Debug -> Breakpoint section -> Mouse Over -> Remove all breakpoints
>
>
>
should remove the breakpoint | Search for debug in settings, disable "glyph margin", and all related settings, this will disable the option to make debugging dots, if you just want to remove them all but not disable adding them, use the answers above. |
41,887,413 | I have worked with many MVC frameworks and now i am developing a website using Slim Framework. I like it as it is very lightweight.
Only problem is how do i manage my file structure as writing all the routes and its closure functions in a single file will not be manageable as the size of application grows. | 2017/01/27 | [
"https://Stackoverflow.com/questions/41887413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3302016/"
] | Assuming you have folder that should contain all your routes:
```
$dir = 'path/to/routes';
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS)) as $file){
require $file;
}
```
Slim is not really fs aware, which is a good thing.
Routes should be decl... | I've had good success with breaking routes into different files grouped by usage or intent and simply using `require_once` for each file. It's simple, explicit, and keeps things pretty well organized, IMO.
Keeping all the route files in one place is important as well, so I usually put my routes into their own subdirec... |
12,376,974 | I have a simple Restful service being called from a console app so am using `WebClient`. I am wondering if this call for Delete is correct.
The url looks like `localhost/RestService1/Person/1`
```
using (var client = new WebClient())
{
client.UploadString(url, "DELETE", "");
}
```
I don't like that `UploadStri... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12376974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122029/"
] | The following works for me:
```
client.UploadValues(url, "DELETE", new NameValueCollection());
``` | The WebClient class doesn't really lend well to restful api consumption, I've used 3rd party libraries like [RestSharp](http://restsharp.org/) in the past that are geared more towards this type of web request. I'm pretty sure RestSharp just uses HttpWebRequest under the covers, but it provides a lot of semantics that m... |
12,376,974 | I have a simple Restful service being called from a console app so am using `WebClient`. I am wondering if this call for Delete is correct.
The url looks like `localhost/RestService1/Person/1`
```
using (var client = new WebClient())
{
client.UploadString(url, "DELETE", "");
}
```
I don't like that `UploadStri... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12376974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122029/"
] | The WebClient class doesn't really lend well to restful api consumption, I've used 3rd party libraries like [RestSharp](http://restsharp.org/) in the past that are geared more towards this type of web request. I'm pretty sure RestSharp just uses HttpWebRequest under the covers, but it provides a lot of semantics that m... | Sorry this is my solution in vb.net i sure that anyone can translate to c#
It's very important to drop headers, i had to comment header about Accept and Content-Type and work fine..... of course I did send the token
```
Dim rest As WebClient = New WebClient()
rest.Headers.Add(HttpRequestHeader.Authorization, "Bearer ... |
12,376,974 | I have a simple Restful service being called from a console app so am using `WebClient`. I am wondering if this call for Delete is correct.
The url looks like `localhost/RestService1/Person/1`
```
using (var client = new WebClient())
{
client.UploadString(url, "DELETE", "");
}
```
I don't like that `UploadStri... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12376974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122029/"
] | The following works for me:
```
client.UploadValues(url, "DELETE", new NameValueCollection());
``` | Go get the Microsoft.Net.Http client libraries <http://nuget.org/packages/Microsoft.Net.Http>
HttpClient is a much better client to use for working with an API. |
12,376,974 | I have a simple Restful service being called from a console app so am using `WebClient`. I am wondering if this call for Delete is correct.
The url looks like `localhost/RestService1/Person/1`
```
using (var client = new WebClient())
{
client.UploadString(url, "DELETE", "");
}
```
I don't like that `UploadStri... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12376974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122029/"
] | Go get the Microsoft.Net.Http client libraries <http://nuget.org/packages/Microsoft.Net.Http>
HttpClient is a much better client to use for working with an API. | Sorry this is my solution in vb.net i sure that anyone can translate to c#
It's very important to drop headers, i had to comment header about Accept and Content-Type and work fine..... of course I did send the token
```
Dim rest As WebClient = New WebClient()
rest.Headers.Add(HttpRequestHeader.Authorization, "Bearer ... |
12,376,974 | I have a simple Restful service being called from a console app so am using `WebClient`. I am wondering if this call for Delete is correct.
The url looks like `localhost/RestService1/Person/1`
```
using (var client = new WebClient())
{
client.UploadString(url, "DELETE", "");
}
```
I don't like that `UploadStri... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12376974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122029/"
] | The following works for me:
```
client.UploadValues(url, "DELETE", new NameValueCollection());
``` | Sorry this is my solution in vb.net i sure that anyone can translate to c#
It's very important to drop headers, i had to comment header about Accept and Content-Type and work fine..... of course I did send the token
```
Dim rest As WebClient = New WebClient()
rest.Headers.Add(HttpRequestHeader.Authorization, "Bearer ... |
29,698,006 | Well, I have a mind-scratcher that I cannot solve.
Total newbie :)
I need to calculate stock item quantity and detect negative values if they appear in calculation:
```
inquantity | outquantity
100 | 0
10 | 0
0 | 50
0 | 100
20 | 0
0 | 80
15 ... | 2015/04/17 | [
"https://Stackoverflow.com/questions/29698006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4787064/"
] | Consider the following as you mentioned you have `id`
```
mysql> select * from quantity ;
+------+------------+-------------+
| id | inquantity | outquantity |
+------+------------+-------------+
| 1 | 100 | 0 |
| 2 | 10 | 0 |
| 3 | 0 | 50 |
| 4 | ... | The idea is the get the cumulative sum. Assuming you have a column that provides ordering information, you can do this with subqueries or variables. The latter should be more efficient:
```
select t.*, (cumei - cumeo) as diff
from (select t.*, (@i := @i + inquantity) as cumei,
(@o := @o + outquantity) as... |
60,584,656 | I have currently deployed a web server via aws `ecs cli compose service up` cli command, and I further registered a domain in route 53 service, register a certificate through Amazon Certificate Manager. Making use of the ALB (application load balancer), I am able to perform dynamic port mapping and https for my web app... | 2020/03/08 | [
"https://Stackoverflow.com/questions/60584656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2361494/"
] | `ecs cli compose service up` contains a parameter `--target-groups` allowing you to add multiple target groups at once.
```
ecs-cli compose --file "../../src/docker-compose.yml" `
--ecs-params "../../src/ecs-params.yml" `
--project-name xxxxx service up `
--target-group... | 1. As far your question is a concern, it possible to perform that using AWS console, but `ecs cli` currently [does not support multiple target group](https://github.com/aws/amazon-ecs-cli/issues/910) at the moment.
you can check this [ecs-cli compose service up with a load balancer](https://stackoverflow.com/questions... |
15,074,618 | the date Picker I have right now has the style like : mm/dd/YYYY and it displays at Textfield in "YYYY/MM/DD".
how can I change my code so that the datepicker shown is also changed to " YYYY/MM/DD".
Here is my code:
```
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] ;
... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15074618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088191/"
] | What about:
```
string[] parts = s.Split(',').Select(x => x.Trim()).ToArray();
``` | ```
var parts = s.Split(',').Select(part => part.Trim());
``` |
15,074,618 | the date Picker I have right now has the style like : mm/dd/YYYY and it displays at Textfield in "YYYY/MM/DD".
how can I change my code so that the datepicker shown is also changed to " YYYY/MM/DD".
Here is my code:
```
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] ;
... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15074618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088191/"
] | What about:
```
string[] parts = s.Split(',').Select(x => x.Trim()).ToArray();
``` | If you *really* want to avoid LINQ, you can split on multiple characters and discard the extra "empty" entries you get between the "," and spaces. Note that you can end up getting odd results (e.g. if you have consecutive "," delimiters you won't get the empty string in between them anymore):
```
s.Split(new char[] { ... |
15,074,618 | the date Picker I have right now has the style like : mm/dd/YYYY and it displays at Textfield in "YYYY/MM/DD".
how can I change my code so that the datepicker shown is also changed to " YYYY/MM/DD".
Here is my code:
```
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] ;
... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15074618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088191/"
] | ```
var parts = s.Split(',').Select(part => part.Trim());
``` | If you *really* want to avoid LINQ, you can split on multiple characters and discard the extra "empty" entries you get between the "," and spaces. Note that you can end up getting odd results (e.g. if you have consecutive "," delimiters you won't get the empty string in between them anymore):
```
s.Split(new char[] { ... |
36,592,056 | I am trying to fetch json data from database and it shows an extra square bracket in the result. Due to this i got error in the result. How to remove this extra bracket from the JSON result.
```
[[{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0},{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0}]]
`... | 2016/04/13 | [
"https://Stackoverflow.com/questions/36592056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6148557/"
] | There's nothing wrong in your PHP code.
Since you are creating an array of array in PHP, hence `json_encode` is giving you array of array of objects.
To see exact contents of php array use `print_r($your_array_variable)`, don't use `echo` for printing arrays.
**UPDATE 1:**
Possible reasons for this could be
An ad... | Updated:
--------
Just replace `echo json_encode(array($result));` with `echo json_encode($result);`
```
<?php require_once('include/dbConnect.php');
$sql = "SELECT * FROM Items WHERE User_Id='1011'";
$r = mysqli_query($con,$sql);
//$res = mysqli_fetch_array($r);
$result = array();
while($res = mysqli_fetch_arr... |
36,592,056 | I am trying to fetch json data from database and it shows an extra square bracket in the result. Due to this i got error in the result. How to remove this extra bracket from the JSON result.
```
[[{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0},{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0}]]
`... | 2016/04/13 | [
"https://Stackoverflow.com/questions/36592056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6148557/"
] | You can use:
```
$object = json_encode($array, JSON_FORCE_OBJECT);
``` | Updated:
--------
Just replace `echo json_encode(array($result));` with `echo json_encode($result);`
```
<?php require_once('include/dbConnect.php');
$sql = "SELECT * FROM Items WHERE User_Id='1011'";
$r = mysqli_query($con,$sql);
//$res = mysqli_fetch_array($r);
$result = array();
while($res = mysqli_fetch_arr... |
36,592,056 | I am trying to fetch json data from database and it shows an extra square bracket in the result. Due to this i got error in the result. How to remove this extra bracket from the JSON result.
```
[[{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0},{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0}]]
`... | 2016/04/13 | [
"https://Stackoverflow.com/questions/36592056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6148557/"
] | There's nothing wrong in your PHP code.
Since you are creating an array of array in PHP, hence `json_encode` is giving you array of array of objects.
To see exact contents of php array use `print_r($your_array_variable)`, don't use `echo` for printing arrays.
**UPDATE 1:**
Possible reasons for this could be
An ad... | ```
require_once('include/dbConnect.php');
$sql = "SELECT Item_Name,Unit,Price,Discount,Remaining_Count FROM Items WHERE User_Id='1011'";
$r = mysqli_query($con,$sql);
//$res = mysqli_fetch_array($r);
$result = array();
while($row = mysqli_fetch_assoc($r)) {
... |
36,592,056 | I am trying to fetch json data from database and it shows an extra square bracket in the result. Due to this i got error in the result. How to remove this extra bracket from the JSON result.
```
[[{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0},{"Item_Name":"banana","Unit":"Kg","Price":0,"Discount":0}]]
`... | 2016/04/13 | [
"https://Stackoverflow.com/questions/36592056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6148557/"
] | You can use:
```
$object = json_encode($array, JSON_FORCE_OBJECT);
``` | ```
require_once('include/dbConnect.php');
$sql = "SELECT Item_Name,Unit,Price,Discount,Remaining_Count FROM Items WHERE User_Id='1011'";
$r = mysqli_query($con,$sql);
//$res = mysqli_fetch_array($r);
$result = array();
while($row = mysqli_fetch_assoc($r)) {
... |
32,443 | So, these two both mean 'to participate in' and there doesn't seem to be any difference in the types of things one might participate in.
Are they therefore interchangeable?
Thanks!
Hashamyim
P.s. I am categorising my 'what are the difference' questions under 'vocabulary'. As they are all HSK 5 verbs, should I open a n... | 2019/01/02 | [
"https://chinese.stackexchange.com/questions/32443",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/19074/"
] | Try a slightly different expression:
I don't like travelling **that** much. | "我不是太喜欢旅游" does mean you dislike travel
If you don't want to use 'dislike' to describe your feeling on traveling, you can say: "**I am not too keen on traveling**" (我不太热衷于旅行) |
32,443 | So, these two both mean 'to participate in' and there doesn't seem to be any difference in the types of things one might participate in.
Are they therefore interchangeable?
Thanks!
Hashamyim
P.s. I am categorising my 'what are the difference' questions under 'vocabulary'. As they are all HSK 5 verbs, should I open a n... | 2019/01/02 | [
"https://chinese.stackexchange.com/questions/32443",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/19074/"
] | We should not always translate too directly! Leave that to 谷歌!
我不是太喜欢旅游。
I'm a chary cruiser.
I'm not an eager excursionist.
I'm a grudging globe-trotter.
I'm a hesitant hiker.
I'm a reluctant rambler.
I'm a vacillating voyager.
I'm a wavering wanderer. | "我不是太喜欢旅游" does mean you dislike travel
If you don't want to use 'dislike' to describe your feeling on traveling, you can say: "**I am not too keen on traveling**" (我不太热衷于旅行) |
32,443 | So, these two both mean 'to participate in' and there doesn't seem to be any difference in the types of things one might participate in.
Are they therefore interchangeable?
Thanks!
Hashamyim
P.s. I am categorising my 'what are the difference' questions under 'vocabulary'. As they are all HSK 5 verbs, should I open a n... | 2019/01/02 | [
"https://chinese.stackexchange.com/questions/32443",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/19074/"
] | Try a slightly different expression:
I don't like travelling **that** much. | We should not always translate too directly! Leave that to 谷歌!
我不是太喜欢旅游。
I'm a chary cruiser.
I'm not an eager excursionist.
I'm a grudging globe-trotter.
I'm a hesitant hiker.
I'm a reluctant rambler.
I'm a vacillating voyager.
I'm a wavering wanderer. |
56,983,376 | There is an object and an array.
```
list: [
{
oldData: {
title: 'abc',
id: 1,
date: '1982-09-30',
budget: 250000,
},
newData: [
{
key: 1,
data: null,
value: 5,
},
{
key: 2,
data: null,
value: 22,
},
...... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56983376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8240369/"
] | You can use `map()` on the array. And use `Object.assign()` and spread operator to combine all the properties of all the elements in `newData` into one object.
```js
const arr = [
{
oldData: {
a:10,
b:20
},
newData: [
{
c:30,
d:40
},
{
e:5... | You can map over the array and use object destructuring (`...object`) to create a new, combined object:
```js
const data = [
{
oldData: {
foo: 'lorem',
},
newData: {
bar: 'ipsum',
},
},
{
oldData: {
foo: 'dolor',
},
newData: {
bar: 'sit amet',
... |
56,983,376 | There is an object and an array.
```
list: [
{
oldData: {
title: 'abc',
id: 1,
date: '1982-09-30',
budget: 250000,
},
newData: [
{
key: 1,
data: null,
value: 5,
},
{
key: 2,
data: null,
value: 22,
},
...... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56983376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8240369/"
] | Your desired result is unclear, but you did say you wanted old/new pairs. This answer is different than the others in that it produces an array of combined data objects made of old/new pairs, where the `oldData` values are duplicated in order to appear alongside each corresponding `newData` value within its list item.
... | You can map over the array and use object destructuring (`...object`) to create a new, combined object:
```js
const data = [
{
oldData: {
foo: 'lorem',
},
newData: {
bar: 'ipsum',
},
},
{
oldData: {
foo: 'dolor',
},
newData: {
bar: 'sit amet',
... |
56,983,376 | There is an object and an array.
```
list: [
{
oldData: {
title: 'abc',
id: 1,
date: '1982-09-30',
budget: 250000,
},
newData: [
{
key: 1,
data: null,
value: 5,
},
{
key: 2,
data: null,
value: 22,
},
...... | 2019/07/11 | [
"https://Stackoverflow.com/questions/56983376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8240369/"
] | Your desired result is unclear, but you did say you wanted old/new pairs. This answer is different than the others in that it produces an array of combined data objects made of old/new pairs, where the `oldData` values are duplicated in order to appear alongside each corresponding `newData` value within its list item.
... | You can use `map()` on the array. And use `Object.assign()` and spread operator to combine all the properties of all the elements in `newData` into one object.
```js
const arr = [
{
oldData: {
a:10,
b:20
},
newData: [
{
c:30,
d:40
},
{
e:5... |
2,860,117 | What am I missing here, it's driving me crazy..
```
>> user.current_login_at.utc > 24.hours.ago.utc
=> false
>> 24.hours.ago.utc
=> Mon May 17 18:46:16 UTC 2010
>> user.current_login_at.utc
=> Mon May 17 15:47:44 UTC 2010
```
user.current\_login\_at was 27 hours ago, yet the greater than comparison says it was not g... | 2010/05/18 | [
"https://Stackoverflow.com/questions/2860117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/139548/"
] | "Greater than" for a date means "after". `24.hours.ago` gives a time, not a length of time. Conceptually, you are asking "did the user log in after the time that was 24 hours ago?", not "did the user log in more than 24 hours ago?". So you want:
```
user.current_login_at.utc < 24.hours.ago.utc
```
Which says "did th... | You are using "greater than", which in date comparisons, means "later than"
Is current login later than 24 hours ago?
```
user.current_login_at.utc > 24.hours.ago.utc
```
Is current login earlier than 24 hours ago?
```
user.current_login_at.utc < 24.hours.ago.utc
``` |
56,716,397 | I'm new in Clojure and function programming in general.
I want to execute a set of if/else's and if the condition is true I want to append some string at the of a list.
In JavaScript would be like this:
```
const a = 1;
const b = 2;
const c = 1;
const errors = [];
if (a !== b) {
errors.push("A and B should not b... | 2019/06/22 | [
"https://Stackoverflow.com/questions/56716397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3000628/"
] | [`cond->`](http://clojuredocs.org/clojure.core/cond-%3E) is good for conditionally modifying some value, and threading those operations together:
```
(def a 1)
(def b 2)
(def c 1)
(cond-> []
(not= a b) (conj "A and B should not be different")
(= a c) (conj "A and C should not be equal"))
```
The first argument ... | `cond->` is nice, but as for me, i would rather make up an utility function to make it look a bit more declarative:
```
(defn validation-messages [& data]
(keep (fn [[check v]] (when (check) v)) data))
(validation-messages
[#(not= a b) "A and B should not be different"]
[#(= a c) "A and C should not be equal"])
... |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | I think that this may be a book by Angela Sommer-Bodenburg. Originally published in 1986 as My Friend The Vampire, it was apparently republished In 2005 under the title The Little Vampire, possibly to tie in with the movie made based on it. That was the first of a series so you might have read a later one possibly.
B... | I think this might be the "Gruesome and Bloodsocks" series by Jane Holiday.
The titular Gruesome was a vampire who was estranged from her family due to her vegetarianism, especially her reluctance to drink human blood. This didn't stop them showing up in her life and generally being rather antagonistic. She lived in -... |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | I think that this may be a book by Angela Sommer-Bodenburg. Originally published in 1986 as My Friend The Vampire, it was apparently republished In 2005 under the title The Little Vampire, possibly to tie in with the movie made based on it. That was the first of a series so you might have read a later one possibly.
B... | I know of a few different vampire books. One is a series called my sister the vampire. The other is called something like "a totally lame vampire" |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | Oh! I think I know what this is! I could be wrong, but there's a book called *[The Reluctant Vampire](https://www.goodreads.com/book/show/2272663.The_Reluctant_Vampire)*, by Eric Morecambe, of all people (yes, of Morecambe and Wise).
It's about a family of vampires, of the most traditional Hammer Horror kind - zey all... | I think that this may be a book by Angela Sommer-Bodenburg. Originally published in 1986 as My Friend The Vampire, it was apparently republished In 2005 under the title The Little Vampire, possibly to tie in with the movie made based on it. That was the first of a series so you might have read a later one possibly.
B... |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | I think this might be the "Gruesome and Bloodsocks" series by Jane Holiday.
The titular Gruesome was a vampire who was estranged from her family due to her vegetarianism, especially her reluctance to drink human blood. This didn't stop them showing up in her life and generally being rather antagonistic. She lived in -... | I know of a few different vampire books. One is a series called my sister the vampire. The other is called something like "a totally lame vampire" |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | Oh! I think I know what this is! I could be wrong, but there's a book called *[The Reluctant Vampire](https://www.goodreads.com/book/show/2272663.The_Reluctant_Vampire)*, by Eric Morecambe, of all people (yes, of Morecambe and Wise).
It's about a family of vampires, of the most traditional Hammer Horror kind - zey all... | I think this might be the "Gruesome and Bloodsocks" series by Jane Holiday.
The titular Gruesome was a vampire who was estranged from her family due to her vegetarianism, especially her reluctance to drink human blood. This didn't stop them showing up in her life and generally being rather antagonistic. She lived in -... |
204,855 | I'm reaching out to see if the community can help identify a book (or series of books) from my childhood in the 80s.
To the best of my recollection, the stories were about a family of vampires - but they may have been nonspecific "monsters."
I believe one among them was considered very handsome because he looked almo... | 2019/02/07 | [
"https://scifi.stackexchange.com/questions/204855",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/105070/"
] | Oh! I think I know what this is! I could be wrong, but there's a book called *[The Reluctant Vampire](https://www.goodreads.com/book/show/2272663.The_Reluctant_Vampire)*, by Eric Morecambe, of all people (yes, of Morecambe and Wise).
It's about a family of vampires, of the most traditional Hammer Horror kind - zey all... | I know of a few different vampire books. One is a series called my sister the vampire. The other is called something like "a totally lame vampire" |
35,361,254 | I have a problem with my code, even though it hasn't been modified in any way. It just suddenly threw this message. As you can see on the left, that they are all in the correct package, and have correct names.
What can I do to fix this problem?
[](... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35361254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5903893/"
] | [Clear](https://stackoverflow.com/questions/8689780/how-to-clear-the-cache-in-netbeans/10722287#10722287) the cache to fix it. In Windows, cache is located at:
```
C:\Users\username\AppData\Local\NetBeans\...
```
On Linux, cache is at:
```
/home/username/.cache/netbeans/...
```
After clearing the cache restart ne... | If clearing the cache still doesn't work try adding the jar files **themselves** instead of adding the folder. Looks like a bug in Netbeans. I did it that way and worked like a charm. |
35,361,254 | I have a problem with my code, even though it hasn't been modified in any way. It just suddenly threw this message. As you can see on the left, that they are all in the correct package, and have correct names.
What can I do to fix this problem?
[](... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35361254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5903893/"
] | [Clear](https://stackoverflow.com/questions/8689780/how-to-clear-the-cache-in-netbeans/10722287#10722287) the cache to fix it. In Windows, cache is located at:
```
C:\Users\username\AppData\Local\NetBeans\...
```
On Linux, cache is at:
```
/home/username/.cache/netbeans/...
```
After clearing the cache restart ne... | I had some compiled classes from a JAR which I wanted to include in my project. I created a new package, I added the complied classes in and then got this "package does not exist" error when trying to import the new package.
If you're adding compiled Java classes and getting this error, here's how I solved it:
1. Cre... |
35,361,254 | I have a problem with my code, even though it hasn't been modified in any way. It just suddenly threw this message. As you can see on the left, that they are all in the correct package, and have correct names.
What can I do to fix this problem?
[](... | 2016/02/12 | [
"https://Stackoverflow.com/questions/35361254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5903893/"
] | [Clear](https://stackoverflow.com/questions/8689780/how-to-clear-the-cache-in-netbeans/10722287#10722287) the cache to fix it. In Windows, cache is located at:
```
C:\Users\username\AppData\Local\NetBeans\...
```
On Linux, cache is at:
```
/home/username/.cache/netbeans/...
```
After clearing the cache restart ne... | I ran into this problem after we moved our NFS mount point containing my root project directory.
It seems there were some references to the old mount point in the `.nb-gradle` directory.
I closed all the projects in Netbeans and terminated Netbeans. I moved `.nb-gradle`to `hidden.nb-gradle` (*and .nb-gradle-propertie... |
65,189,297 | Since porcelain commands are built with the plumbing commands, I am interested to know how the `add` and `commit` are built.
For instance, the `add` command certainly use the `hash-object` command but I think it uses other commands as well (maybe the `update-index`). Can someone point me to a resource that explains th... | 2020/12/07 | [
"https://Stackoverflow.com/questions/65189297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14714788/"
] | >
> Since porcelain commands are built with the plumbing commands ...
>
>
>
Unfortunately, this premise isn't quite true ([j6t noted this as well](https://stackoverflow.com/q/65189297/1256452)). I would argue that it *should be* true, but for various reasons, it isn't. In particular `git log` does things for which... | Today, `git add` and `git commit` are built into `git` and are not scripted. I think that `git add` was never scripted, but `git commit` certainly was. You can find the old implementation in `contrib/examples` of [an old commit of the Git repository](https://github.com/git/git/tree/ae1644b08e85fb64367b273337d8ebcbdabe0... |
25,650 | 
I understand that the [Mollweide](http://en.wikipedia.org/wiki/Mollweide_projection) projection is used to show the map of the universe. Although I understand how this projection can be interesting for Earth where most populated (and of interest) are... | 2011/06/22 | [
"https://physics.stackexchange.com/questions/25650",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | The equatorial plane of the Mollweide projection applied to the whole sky is usually the plane of the Milky Way. We're blatant galactic chauvinists that way.
More importantly, this projection preserves area, which is more important than angular relations for this sort of thing. For instance, when studying the CMB, in ... | I think that the universe is oval since as Ernst Mach argued, the universe is ultimately sensation, specifically our visual field which in my case appears to be oval. This also explains why this insignificant life form should have a sense that can sense at the speed limit of the universe - how likely is that?! And it a... |
559,966 | **OBJECTIVE:** A device that floats on the water's surface and measures the depth. If any changes occur in the depth, it sends a report to a remote receiver.
**MY RESEARCH:** I have considered the following sensors but they don't seem to be effective:
1. IR won't work because water absorbs red light.
2. Ultrasonic: I... | 2021/04/13 | [
"https://electronics.stackexchange.com/questions/559966",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/282758/"
] | A pretty standard fluid level sensor (optical, capacitive, ultrasonic, IR) will mount to a fixed point and look down at the fluid.
If you must have the sensor float, consider measuring distance to some fixed point above the water (since your floating platform will be on the water, it is at water level).
Laser rangefi... | Does it have to float? A pressure sensor on the bottom would do the job and be simpler and more reliable, even if you need to run a tether to a surface antenna, whether that antenna is fixed or floats on a buoy. |
42,250,208 | In order to add markers on terrain in cesium I used the [`sampleTerrain`](https://cesiumjs.org/Cesium/Build/Documentation/sampleTerrain.html) function to get the height.
I'm able to add a marker on top of a mountain but the marker is located far from the mouse click. How can I add a marker on Cesium terrain so the mar... | 2017/02/15 | [
"https://Stackoverflow.com/questions/42250208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1053493/"
] | This line is your problem:
```
let positionCartesian3 = this.cesium.viewer.camera.pickEllipsoid(event.position);
```
The `pickEllipsoid` function picks values off the WGS84 ellipsoid (think "similar to sea level" but don't confuse it with actual MSL). This function will never return a point from the top of a mou... | I used that :
```
let ray = this.cesium.viewer.camera.getPickRay(event.position);
let positionCartesian3 = this.cesium.viewer.scene.globe.pick(ray, this.cesium.viewer.scene);
let positionCartographic = Cesium.Cartographic.fromCartesian(positionCartesian3);
let lngDeg: number = Cesium.Math.toDegr... |
33,794,405 | I am developing an extension using typescript,and I don't know how to use typescript to call web API, anyone know or can provide an sample to me? | 2015/11/19 | [
"https://Stackoverflow.com/questions/33794405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5579280/"
] | Typescript is compiled into javascript, in Javascript specifically node environemnt, there are many ways to make an HTTP call to the web API.
You can use these libraries:
1. axios
2. got
3. node-fetch
These libraries have type definitions. | >
> I am developing an extension using typescript,and I don't know how to use typescript to call web API, anyone know or can provide an sample to me
>
>
>
You need to write code generation code *specific* to your APP + front end framework.
For starters checkout <http://type.litesolutions.net/>
---
Just another... |
1,683,403 | I would like to project from one $2D$ plane onto another. Imagine that I have a picture taken with a camera that was looking onto a plane. Given camera's extrinsic and intrinsic parameters I want to know how the points in the picture map to the points on the pictured plane.
What I know so far is that this is normally ... | 2016/03/04 | [
"https://math.stackexchange.com/questions/1683403",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/285861/"
] | You were doing well up until the line $H'^{-1} = H'^T$. There’s no particular reason to believe that $H$ is orthogonal; quite the opposite, in fact. (I’m going to switch here to the more conventional name $\mathtt P$ for the projection matrix and also make use of the block decomposition $\mathtt P = \left[\mathtt M \mi... | Here is the code in OpenCV C++.
From 6ft away, I'm getting errors of less that 0.5 mm and 0.2 pixel.
```
typedef struct CameraCalibration {
bool isCalibrated = false;
Mat camMat;
Mat distCoeffs;
Mat rvec;
Mat tvec;
Mat invMat;
double reprojectionError;
} CameraCalibration;
std::vector<cv::... |
8,802,795 | I'm looking at the [Delicious API](http://delicious.com/help/api#posts_add) and see the following is the operation to create a new bookmark:
```
https://api.del.icio.us/v1/posts/add?&url={URL}&description={description}
```
It looks like they're using a GET request to create server-side database entries, which I've r... | 2012/01/10 | [
"https://Stackoverflow.com/questions/8802795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/792084/"
] | browse the website [programmableweb](http://www.programmableweb.com/),you can check who are providing their APIs. | Tweed Feed saves tweets as nodes in drupal CMS <https://www.drupal.org/project/tweet_feed> and is even free. Best commercial all-in-one solution seems to be newswhip.spike <https://www.newswhip.com/api/> (desktop search demo for 14 days is free, API costs thousands of euros/month, depending on how many areas and langua... |
2,399,632 | Find the area of the triangle defined in the figure below
[](https://i.stack.imgur.com/vI9jZ.png)
This question appeared in a math olympiad contest and was considered invalid later on without any specific reason. Is it solvable? If yes, provide the answer! | 2017/08/19 | [
"https://math.stackexchange.com/questions/2399632",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/460565/"
] | [](https://i.stack.imgur.com/rNfpN.png)
In $\triangle ABC$,
$|BC|=a$, $|CA|=b$, $|AB|=c$,
points $D,E,F$ are midpoints,
$|D\_1D\_2|=|E\_1E\_2|=|F\_1F\_2|=2\,R$.
Using the power of a points $D,E$ and $F$ with respect to
the circumscribed circle with r... | If the circle has radius $r>3$ then the three sides of the triangle are tangent to concentric circles having radii $r-1,r-2,r-3$.
Then using just the Pythagorean relationship the lengths of the three sides of the triangle are $2\sqrt{2r-1},2\sqrt{4r-4},2\sqrt{6r-9}$.
So long as $\sqrt{2r-1}+\sqrt{4r-4}\ge\sqrt{6r-9}$... |
53,668,200 | I have some gaps about this concept.
* I have an abstract class called User ().
* A RegisteredUser class ()
* An OfficerUser class ()
* an AdminUser class ()
The OfficerUser () and AdminUser () class extends to RegisteredUser().
How do I get the list of Registered users who are not officerUser() and AdminUser()? Bec... | 2018/12/07 | [
"https://Stackoverflow.com/questions/53668200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7277600/"
] | You can make it in two ways.
**First way:**
```
public class TestClass {
public static void main(String[] args) {
User base = new Registered();
User base2 = new Officer();
System.out.println(isOnlyRegisteredUser(base));
System.out.println(isOnlyRegisteredUser(base2));
}
s... | You can use a simply verification of their istance:
```
public static void main(String [] args)
{
AdminUser a1 = new AdminUser("admin1");
AdminUser a2 = new AdminUser("admin2");
OfficerUser o1 = new OfficerUser("officer1");
OfficerUser o2 = new OfficerUser("officer2");
RegisteredUser u1 = new Re... |
297,016 | I have a machine C with two NICs, namely `eth0` and `eth1`, with CentOS 4.9 installed on it. Also I have a machine A connecting to C through `eth0` and a machine B connecting to C through `eth1`. Now I want machine A to be in a subnet (e.g. 192.168.3.0/24) and machine B to be in another subnet (e.g. 192.168.4.0/24) and... | 2011/08/03 | [
"https://serverfault.com/questions/297016",
"https://serverfault.com",
"https://serverfault.com/users/89714/"
] | Do you *have* a CA key generated already? If not, you might want to [generate one](http://lmgtfy.com/?q=openssl+generate+CA+key). | Did you add a serial for your CA (it's just a counter that increments each time you sign with CA): <http://bookmarks.honewatson.com/2008/05/08/error-opening-ca-private-key-democaprivatecakeypem/> |
25,361,186 | **Background:**
I have an admin system, that needs to connect to and edit multiple databases. The database structures are 100% similar to each other, but the data varies.
**What I have tried:**
I'v tried to use `$this->Model->setDataSource('db_variable_here');` in the controllers to change the database on the fly. The... | 2014/08/18 | [
"https://Stackoverflow.com/questions/25361186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2686507/"
] | Just save the database that you need to use in Session/Cookie (whatever tickles your fancy), then in your AppModel's `__constructor()` if the Session variable is defined then override either `setDataSource()` or `setSource()` accordingly.
Note that IIRC Cake's Session/Cookie are not available on the Models by default ... | You could try making your own getDataSouce method in the AppModel.
You can see the CakePHP one here:
<https://github.com/cakephp/cakephp/blob/master/lib/Cake/Model/ConnectionManager.php>
So, in your AppModel, just make sure to accept/return the da
```
class AppModel extends Model {
//...
public function get... |
4,806,682 | We are using Ninject with Caliburn.Micro to create a MVVM WCF Silverlight app. The issue I am having is with the life cycle of my view models.
I have created a simple ninject module to bind my view model and wcf client.
```
public class IDCardModule : NinjectModule
{
public override void Load()
... | 2011/01/26 | [
"https://Stackoverflow.com/questions/4806682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100988/"
] | InTransientScoped objects lifecycle is not managed by Ninject. This means theese objects are not disposed and deactivated. If your view model is injected to another object you can use InParentScope from the named scope extension. See my blogpost about additional scopes of Ninject: <http://www.planetgeek.ch/2010/12/08/h... | Lucas B,
I am not sure if this is gonna help you but I had disposal problems with my objects too leading in some cases to huge memory use. I found out that it was a problem of event subscription. Each time I was subscribing to an event, I was never unsubscribing to it after the event completion. As far as I understand... |
1,530 | >
> **Possible Duplicate:**
>
> [Rules applied to the separation of syllables](https://spanish.stackexchange.com/questions/812/rules-applied-to-the-separation-of-syllables)
>
>
>
Diphthongs (or triphthongs) are sets of two or three vowels that are pronounced as a single syllable as opposed to being separated i... | 2012/01/20 | [
"https://spanish.stackexchange.com/questions/1530",
"https://spanish.stackexchange.com",
"https://spanish.stackexchange.com/users/54/"
] | There is an orthographic rule:
1. **a**, **e**, **o** are strong vowels, **i**, **u** are weak vowels. **y** is like **i**.
2. There can be only one strong vowel in a syllable, they never combine into a diphthong. *ca-os, le-ón, le-er*
3. When a strong and a weak vowel are next to each other (or separated by *h*) they... | Once I posted an answer about calculating syllables in Spanish, the question was "[Rules applied to the separation of syllables](https://spanish.stackexchange.com/questions/812/rules-applied-to-the-separation-of-syllables/813#813)".
A [guide](http://www.spanishdict.com/answers/100865/syllables-how-to-divide-a-word-in-... |
38,834 | An SPSiteDataQuery. So far I have:
```
...
query.ViewFields = @"<FieldRef Name=""Title"" /><FieldRef Name=""Author"" />";
...
```
I just happened to get these two FieldRef's right (purely because they were easy to guess the names of) - but is there an actual list available anywhere for me to find out the names of th... | 2012/06/18 | [
"https://sharepoint.stackexchange.com/questions/38834",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7904/"
] | Jup, there is a way - with calling Method [GetListAndView](http://msdn.microsoft.com/en-us/library/lists.lists.getlistandview%28v=office.12%29.aspx) | If you want to use a tool that exposes various properties of the SP object model (basically allows you explore all of the sites' fields, lists, content types, and other nitty gritty) and you don't want to have to return to sites like this to discover the next magical method, you really ought to try installing SharePoin... |
24,377,221 | I have this code and i only want to display a record from the table :
```
<?php
session_start();
echo $_SESSION['idu'];
$connect=mysql_connect("localhost","root","");
mysql_select_db("bilet");
$queryreg=mysql_query("SELECT * FROM oferte WHERE idu='$_SESSION['idu']' ");
while($row = mysql_fetch_array($queryreg)):
{
... | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2387786/"
] | Try with...
```
$queryreg=mysql_query("SELECT * FROM oferte WHERE idu='" . $_SESSION['idu'] . "'");
```
And you won't confuse to PHP interpreter. | The specific issue has to do with your line 6 (as the error suggests). You're not properly including your session variable into the string. Try this instead:
```
$queryreg = mysql_query("SELECT * FROM oferte WHERE idu='" . $_SESSION['idu'] . "'");
```
That being said, there are a few other things to keep in mind. If... |
12,326,833 | I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios?
```
function check() {
if($something == "something") {
exit;
}
echo "hello... | 2012/09/08 | [
"https://Stackoverflow.com/questions/12326833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Syntactically, it's perfectly fine.
It's also a very common pattern to use, and IMHO, makes code more readable.
For the sake of code clarity/clean coding, if you're returning a boolean you should return a boolean even if the if() doesn't match.
```
function check() {
if($something == "something") {
ret... | For the second scenario, if the function is supposed to return something, you don't 'need' the else, but you should at minimum return false. Personally, I don't like putting the else, because it requires the developer to read through more conditions to determine what is returned. Instead, at the bottom, put return true... |
12,326,833 | I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios?
```
function check() {
if($something == "something") {
exit;
}
echo "hello... | 2012/09/08 | [
"https://Stackoverflow.com/questions/12326833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Syntactically, it's perfectly fine.
It's also a very common pattern to use, and IMHO, makes code more readable.
For the sake of code clarity/clean coding, if you're returning a boolean you should return a boolean even if the if() doesn't match.
```
function check() {
if($something == "something") {
ret... | It's not necessary.
HOWEVER, the real question is if doing so improves readability. This is debatable, and can vary from developer to developer depending on preference and coding standards. |
12,326,833 | I am sorry for posting a pretty redundant question. I was wondering if it was really necessary to use `else {}` if the code just stops or returns a value. In theory, is it really necessary to put `else{}` in these scenarios?
```
function check() {
if($something == "something") {
exit;
}
echo "hello... | 2012/09/08 | [
"https://Stackoverflow.com/questions/12326833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Syntactically, it's perfectly fine.
It's also a very common pattern to use, and IMHO, makes code more readable.
For the sake of code clarity/clean coding, if you're returning a boolean you should return a boolean even if the if() doesn't match.
```
function check() {
if($something == "something") {
ret... | The code you have posted is valid, for more clarity i would include else also.
```
function check() {
if($something == "something") {
return true;
} else{
return false;
}
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.