qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
2,634,657 | I am wondering if there is a function I could use in the standard libary. Do I need another library (BTW, I am developing for unix). | 2010/04/14 | [
"https://Stackoverflow.com/questions/2634657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302206/"
] | Use `scanf()`
Format: `int scanf ( const char * format, ... );`
`Read formatted data from stdin.
Reads data from stdin and stores them according to the parameter format into the locations pointed by the additional arguments. The additional arguments should point to already allocated objects of the type specified by ... | 'Tis interesting - two answers so far both suggest `scanf()`; I wouldn't.
When everything goes right, `scanf()` is OK. When things go wrong, recovery tends to be hard.
I would normally use `fgets()` to read the user information for one line into a buffer (character array) first. I would then use `sscanf()` to collect... |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I have the same problem.
So far I was able to enable the launcher on every screen.
To do that you need to go to Settings -> Dock and pick "All displays" for "Show on" setting. | Have you tried setting the secondary display as your main one? The top panel only shows on the main display by default in Gnome 3.
Unfortunately multi monitor support in Gnome 3 is not really polished in my opinion. Hopefully things will get better now that Ubuntu is using it. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I think its simpler than that. Just set "show on" to "All displays" in the Dock settings on Ubuntu 17.10:
[](https://i.stack.imgur.com/v8FN1.png) | I am not entirely sure if what I will suggest is helpful for the very specific question, but I hope it is helpful to other users.
After upgrading some pcs from Ubuntu Gnome 17.04 to Ubuntu 17.10 with dual monitors, it occurred to me that the monitor order and the primary monitor gets changed from the first monitor to ... |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I am not entirely sure if what I will suggest is helpful for the very specific question, but I hope it is helpful to other users.
After upgrading some pcs from Ubuntu Gnome 17.04 to Ubuntu 17.10 with dual monitors, it occurred to me that the monitor order and the primary monitor gets changed from the first monitor to ... | Have you tried setting the secondary display as your main one? The top panel only shows on the main display by default in Gnome 3.
Unfortunately multi monitor support in Gnome 3 is not really polished in my opinion. Hopefully things will get better now that Ubuntu is using it. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | Install the Gnome Tweak Tool:
```
sudo apt install gnome-tweak-tool
```
Then launch it
```
gnome-tweak-tool
```
Or get to it by searching for "tweak" in the "Show Applications" area.
Bottom left will be a "workspaces" tab where you can tweak your workspaces. I found what I was looking for there.
[![enter image ... | Have you tried setting the secondary display as your main one? The top panel only shows on the main display by default in Gnome 3.
Unfortunately multi monitor support in Gnome 3 is not really polished in my opinion. Hopefully things will get better now that Ubuntu is using it. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I think its simpler than that. Just set "show on" to "All displays" in the Dock settings on Ubuntu 17.10:
[](https://i.stack.imgur.com/v8FN1.png) | I have the same problem.
So far I was able to enable the launcher on every screen.
To do that you need to go to Settings -> Dock and pick "All displays" for "Show on" setting. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | You might try enabling the "multi-monitors-add-on".
Follow the directions given here: <https://www.maketecheasier.com/extend-gnome-3-panel-dual-monitors/>,
Reproduced Here for convenience:
```
git clone https://github.com/spin83/multi-monitors-add-on.git
cd multi-monitors-add-on
cp -r multi-monitors-add-on@spin83 ~/... | I have the same problem.
So far I was able to enable the launcher on every screen.
To do that you need to go to Settings -> Dock and pick "All displays" for "Show on" setting. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I think its simpler than that. Just set "show on" to "All displays" in the Dock settings on Ubuntu 17.10:
[](https://i.stack.imgur.com/v8FN1.png) | Have you tried setting the secondary display as your main one? The top panel only shows on the main display by default in Gnome 3.
Unfortunately multi monitor support in Gnome 3 is not really polished in my opinion. Hopefully things will get better now that Ubuntu is using it. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | You might try enabling the "multi-monitors-add-on".
Follow the directions given here: <https://www.maketecheasier.com/extend-gnome-3-panel-dual-monitors/>,
Reproduced Here for convenience:
```
git clone https://github.com/spin83/multi-monitors-add-on.git
cd multi-monitors-add-on
cp -r multi-monitors-add-on@spin83 ~/... | I am not entirely sure if what I will suggest is helpful for the very specific question, but I hope it is helpful to other users.
After upgrading some pcs from Ubuntu Gnome 17.04 to Ubuntu 17.10 with dual monitors, it occurred to me that the monitor order and the primary monitor gets changed from the first monitor to ... |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | You might try enabling the "multi-monitors-add-on".
Follow the directions given here: <https://www.maketecheasier.com/extend-gnome-3-panel-dual-monitors/>,
Reproduced Here for convenience:
```
git clone https://github.com/spin83/multi-monitors-add-on.git
cd multi-monitors-add-on
cp -r multi-monitors-add-on@spin83 ~/... | Have you tried setting the secondary display as your main one? The top panel only shows on the main display by default in Gnome 3.
Unfortunately multi monitor support in Gnome 3 is not really polished in my opinion. Hopefully things will get better now that Ubuntu is using it. |
966,841 | Installed Ubuntu 17.10 today, menubar, launcher and the bar which indicates time/date/network connection status are missing.
I am using the secondary display and connecting the laptop to the secondary. Even without the secondary display, the top bar on the screen and launcher are missing. When secondary is enabled and... | 2017/10/20 | [
"https://askubuntu.com/questions/966841",
"https://askubuntu.com",
"https://askubuntu.com/users/360871/"
] | I think its simpler than that. Just set "show on" to "All displays" in the Dock settings on Ubuntu 17.10:
[](https://i.stack.imgur.com/v8FN1.png) | You might try enabling the "multi-monitors-add-on".
Follow the directions given here: <https://www.maketecheasier.com/extend-gnome-3-panel-dual-monitors/>,
Reproduced Here for convenience:
```
git clone https://github.com/spin83/multi-monitors-add-on.git
cd multi-monitors-add-on
cp -r multi-monitors-add-on@spin83 ~/... |
32,122,794 | I'm just starting with Meteor. In an app which is to be localized, I want to set the document title.
I am following the [advice given by Bernát](https://stackoverflow.com/a/19010848/1927589)
In my barebones version, I have just 2 documents:
head.html
```
<head>
<meta charset="utf-8">
<title>{{localizedTitle}}</... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32122794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1927589/"
] | Following Bernát's answer, your global helper should not be called in the head's `<title>` tag, but within the `<template>` tag of the template where you wish to have a given title. In Meteor, `<head>` does not count as a template, therefore you cannot use Spacebars notation in it: it will just be considered as simple ... | I've found it convenient to set the title in *onAfterAction* in my iron-router routes:
```
onAfterAction: function(){
document.title = 'foo'; // ex: your site's name
var routeName = Router.current().route.getName();
if ( routeName ) document.title = document.title + ': ' + routeName;
}
``` |
32,122,794 | I'm just starting with Meteor. In an app which is to be localized, I want to set the document title.
I am following the [advice given by Bernát](https://stackoverflow.com/a/19010848/1927589)
In my barebones version, I have just 2 documents:
head.html
```
<head>
<meta charset="utf-8">
<title>{{localizedTitle}}</... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32122794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1927589/"
] | Following Bernát's answer, your global helper should not be called in the head's `<title>` tag, but within the `<template>` tag of the template where you wish to have a given title. In Meteor, `<head>` does not count as a template, therefore you cannot use Spacebars notation in it: it will just be considered as simple ... | I think a more elegant solution is to make the title reactive and set it via a Session variable (other reactive data sources are of course also OK). Like that:
```
Template.body.onRendered(function() {
this.autorun(function() {
document.title = Session.get('documentTitle');
});
});
```
Now every time you set... |
32,122,794 | I'm just starting with Meteor. In an app which is to be localized, I want to set the document title.
I am following the [advice given by Bernát](https://stackoverflow.com/a/19010848/1927589)
In my barebones version, I have just 2 documents:
head.html
```
<head>
<meta charset="utf-8">
<title>{{localizedTitle}}</... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32122794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1927589/"
] | Following Bernát's answer, your global helper should not be called in the head's `<title>` tag, but within the `<template>` tag of the template where you wish to have a given title. In Meteor, `<head>` does not count as a template, therefore you cannot use Spacebars notation in it: it will just be considered as simple ... | Try this instead:
```
UI.registerHelper('title', function() {
return 'LocalizedTitle'
});
```
we can use title where ever you want
you can use like this `{{title}}` |
68,622,993 | How would I transform the array in imageCollection to get the array in carouselPhotos? (See code below).
```
export default class HomeScreen extends Component {
state = {
imageCollection: [
{
name: "Pictures of birds"
image1: "http://127.0.0.1:8000/media/image1A.jpg",
... | 2021/08/02 | [
"https://Stackoverflow.com/questions/68622993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16372363/"
] | You can simply retrieve the values from your `imageCollection` object, then map them to the desired format.
```
Object.values(state.imageCollection[0]).map(imgUrl => ({ image: imgUrl }));
```
### EDIT
Since the object in your `imageCollection` array contains keys that should be ignored, we can first filter them out... | You can use `reduce` & inside the callback iterate the current object and create a new object for each image and push it to the accumulator array
```js
const imageCollection = [{
image1: "http://127.0.0.1:8000/media/image1A.jpg",
image2: "http://127.0.0.1:8000/media/image2A.jpg",
image3: "http://127.0.0.1:8000/m... |
18,739,354 | I have some authentication requried to hit a particular url. In browser I need to login only once, as for other related urls which can use the session id from the cookie need not required to go to the login page.
Similarly, can I use the cookie generated in the cookie file using `--cookies-file=cookies.txt` in the com... | 2013/09/11 | [
"https://Stackoverflow.com/questions/18739354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/934913/"
] | Phantom JS and cookies
======================
`--cookies-file=cookies.txt` will only store non-session cookies in the cookie jar. Login and authentication is more commonly based on session cookies.
### What about session cookies?
To save these is quite simple, but you should consider that they will likely expire qui... | The file created by the option `--cookies-file=cookies.txt` is serialized from CookieJar: there are extra characters and it's sometimes difficult to parse.
It may looks like:
```
[General]
cookies="@Variant(\0\0\0\x7f\0\0\0\x16QList<QNetworkCookie>\0\0\0\0\x1\0\0\0\v\0\0\0{__cfduid=da7fda1ef6dd8b38450c6ad5632...
```... |
33,100,504 | I am trying to use android arsenal libraries. i found a library here: <https://android-arsenal.com/details/1/1615> , and i downloaded a .zip file. i want to use it in my project.i have followed the instruction to add the library
and add this code to the gradle
```
dependencies {
compile 'com.github.chenupt:SpringInd... | 2015/10/13 | [
"https://Stackoverflow.com/questions/33100504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3505951/"
] | Look what you have added to your gradle dependecies, and what is in a tutorial. And you don't need any zip file, gradle will download the dependecies for you.
It should be like this:
```
dependencies {
compile 'com.github.chenupt.android:springindicator:1.0.2@aar'
}
``` | According to Java [docs](https://docs.gradle.org/current/userguide/java_plugin.html) `compile` is deprecated.
>
> ~~compile~~ (Deprecated)
>
>
> Compile time dependencies. Superseded by implementation.
>
>
>
It should be like this:
```
dependencies {
implementation 'com.github.chenupt.android:springindicat... |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | The two code snippets produce *exactly* the same IL. Here's the C# code I used to test with:
```
public string[] strings = new string[5];
public void TestOne()
{
foreach (string s in strings)
{
string t = s;
}
}
public void TestTwo()
{
string t;
foreach (string s in strin... | You don't need to do this at all. Just use `s`.
Also, `string` in C#/BCL is a reference type. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | Well neither of those will compile (I guess that you want to use `foreach` instead of `ForEach`?), but if they did they should compile down to the same IL after optimizations and so there would be no difference. | strings are *immutable reference types*.
So the code
```
string t;
foreach(string s in strings)
{
t = s;
}
```
creates a new string instance for each step in the enumerator anyway (it doesn't "reuse" the instance `t`).
There is no practical difference between the two code examples you posted. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | The two code snippets produce *exactly* the same IL. Here's the C# code I used to test with:
```
public string[] strings = new string[5];
public void TestOne()
{
foreach (string s in strings)
{
string t = s;
}
}
public void TestTwo()
{
string t;
foreach (string s in strin... | I would bet that the compiler is intelligent enough to build them in exactly the same way. I don't think there is any difference, go on readability. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | Theoretically speaking, the second one should be more efficient because the memory allocation is performed only once before the loop starts, while the first one should try to allocate memory at every iteration.
However i do not know if there is any optimization performed by the compiler based on how the variable is us... | This is the same code, only the declaration is at another place. You should always try to declare the variables next to their use, using the smallest possible scope.
Note that `foreach` is written lowercase like all keywords in c#. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | Well neither of those will compile (I guess that you want to use `foreach` instead of `ForEach`?), but if they did they should compile down to the same IL after optimizations and so there would be no difference. | You don't need to do this at all. Just use `s`.
Also, `string` in C#/BCL is a reference type. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | strings are *immutable reference types*.
So the code
```
string t;
foreach(string s in strings)
{
t = s;
}
```
creates a new string instance for each step in the enumerator anyway (it doesn't "reuse" the instance `t`).
There is no practical difference between the two code examples you posted. | I would bet that the compiler is intelligent enough to build them in exactly the same way. I don't think there is any difference, go on readability. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | You don't need to do this at all. Just use `s`.
Also, `string` in C#/BCL is a reference type. | strings are *immutable reference types*.
So the code
```
string t;
foreach(string s in strings)
{
t = s;
}
```
creates a new string instance for each step in the enumerator anyway (it doesn't "reuse" the instance `t`).
There is no practical difference between the two code examples you posted. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | You don't need to do this at all. Just use `s`.
Also, `string` in C#/BCL is a reference type. | They're both the same for memory effiency, because behind the scenes they all point to the same string. This is a semantic used by .NET/Java, and the reason why strings are immutable. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | Theoretically speaking, the second one should be more efficient because the memory allocation is performed only once before the loop starts, while the first one should try to allocate memory at every iteration.
However i do not know if there is any optimization performed by the compiler based on how the variable is us... | I would bet that the compiler is intelligent enough to build them in exactly the same way. I don't think there is any difference, go on readability. |
5,884,402 | I wanted to find out what more efficient (if even) in the following code
**Value type**
```
ForEach(string s in strings)
{
string t = s;
}
// or
string t;
ForEach(string s in strings)
{
t = s;
}
```
and is there a different with reference types. | 2011/05/04 | [
"https://Stackoverflow.com/questions/5884402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544716/"
] | You don't need to do this at all. Just use `s`.
Also, `string` in C#/BCL is a reference type. | Theoretically speaking, the second one should be more efficient because the memory allocation is performed only once before the loop starts, while the first one should try to allocate memory at every iteration.
However i do not know if there is any optimization performed by the compiler based on how the variable is us... |
1,954,971 | I recently needed to configure [CocoaHttpServer](http://code.google.com/p/cocoahttpserver/), which we're using in our application with success, to handle HTTPS connections coming from a client application (running on Android devices). This is fine - there is copious sample code which allows for this, and we were able t... | 2009/12/23 | [
"https://Stackoverflow.com/questions/1954971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84727/"
] | *Please note that there are different ciphers that can be chosen - I chose to use the same one as our Windows implementation for consistency.*
With information from [another question](http://lists.apple.com/archives/Apple-cdsa/2008/Oct/msg00004.html) mentioned above, I figured out how to set the cipher for CFSocket to... | For what it's worth, I contributed a [patch](http://code.google.com/p/cocoaasyncsocket/issues/detail?id=37) to CocoaAsyncSocket about a week before you had this issue. Sorry that I didn't notice your question back then. :-) |
29,312,670 | I get some errors. I need pass a member to a **const** member with operator =.
I don't know what is error, my function declaration is:
```
template<class I> forceinline
void OverweightValues<I>::init(int t,
SharedArray<int>& elements0,
SharedArray<int>& weights0,
... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29312670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1334923/"
] | `const` members can only be set during creation. You'll need to use the constructor initializer list rather than two-phase construction. (Even the constructor body cannot assign them) | As @Ben Voigt mentioned, you can only initialize a const in the constructor initialization list. This is because, by the time the control reaches the constructor body all the class members are already created by the compiler using the default constructor.
Hence, member initialization within the constructor body will ... |
37,092,352 | [](https://i.stack.imgur.com/fUjQU.png)
As shown in the image, there are two circles connected by a line, I can animate the circle position by `createjs.Tween.get(circleOne).to({x: someCoord, y:anotherCoord},1000)`.
I would like to update the line en... | 2016/05/07 | [
"https://Stackoverflow.com/questions/37092352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500384/"
] | There is a better way to do this than what @tiago suggested: [Graphic Commands](http://blog.createjs.com/new-command-approach-to-easeljs-graphics/). You can update the values of commands that Graphics use any time by storing off the `command`.
Here is a quick demo, where I tween 2 circles, and on the "update" event o... | Every time the circles move you'll need to redraw the line by clearing the old graphics instructions and creating a new one in place, without TweenJS. Notice that this will be very expensive since you'll not gain any benefits from caching.
Here's a line from coordinates `{x: 20, y: 20}` to `{x: 40, y: 40}`:
```
line.... |
6,198,994 | I have two fields in my database for storing starttime and endtime. they are of datetime. I pick time from them using tostring("hh:mm tt"). Now I want to update only the time part of the date. I have dropdownlist to select hour and minutes and AM/PM. How can I update the time of date stored in sql server using Entity f... | 2011/06/01 | [
"https://Stackoverflow.com/questions/6198994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/634710/"
] | If I get this right, you want to look into using [foreign keys](http://www.postgresql.org/docs/9.0/static/tutorial-fk.html) and [triggers](http://www.postgresql.org/docs/9.0/static/plpgsql-trigger.html). | If it's a 1:1 relationship, could you not just combine the tables? |
7,242,804 | I Have a json array like
```
[{"name":"A","value":"A"},{"name":"B","value":"B"},{"name":"C","value":"C"}]
```
How can i pass(to the backend) and store(in db) that javascript object with asp.net??
**EDIT:**
OK to make it clearer, in some page, i got a javascript object
```
var array = [{"name":"A","value":"A"},... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7242804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342366/"
] | You have several options when dealing with JSON on .NET
* You can simply keep the array as is in the DB and retrieve it as is and use it
* You can parse it into an Object using [JSON.NET Library](http://json.codeplex.com/)
for example on the 2nd case you simple use the JSON.NET method:
```
Newtonsoft.Json.Converters... | You would store it just like any other string you wanted to store in the database. If you want to re-instantiate it later in JavaScript you use the eval() function on the string to convert it back into an object. |
7,242,804 | I Have a json array like
```
[{"name":"A","value":"A"},{"name":"B","value":"B"},{"name":"C","value":"C"}]
```
How can i pass(to the backend) and store(in db) that javascript object with asp.net??
**EDIT:**
OK to make it clearer, in some page, i got a javascript object
```
var array = [{"name":"A","value":"A"},... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7242804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342366/"
] | You have several options when dealing with JSON on .NET
* You can simply keep the array as is in the DB and retrieve it as is and use it
* You can parse it into an Object using [JSON.NET Library](http://json.codeplex.com/)
for example on the 2nd case you simple use the JSON.NET method:
```
Newtonsoft.Json.Converters... | The best way to do this is to de-serialize the json into object and save it to db as records.
Check JSON.NET library <http://json.codeplex.com/>
```
public class MyObj
{
public string name{get;set;}
public string value{get;set;}
}
void Main()
{
string json ="[{\"name\":\"A\",\"value\":\"A\"},{\"name\":\"... |
7,242,804 | I Have a json array like
```
[{"name":"A","value":"A"},{"name":"B","value":"B"},{"name":"C","value":"C"}]
```
How can i pass(to the backend) and store(in db) that javascript object with asp.net??
**EDIT:**
OK to make it clearer, in some page, i got a javascript object
```
var array = [{"name":"A","value":"A"},... | 2011/08/30 | [
"https://Stackoverflow.com/questions/7242804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342366/"
] | You have several options when dealing with JSON on .NET
* You can simply keep the array as is in the DB and retrieve it as is and use it
* You can parse it into an Object using [JSON.NET Library](http://json.codeplex.com/)
for example on the 2nd case you simple use the JSON.NET method:
```
Newtonsoft.Json.Converters... | Ok it turns out that using JSON.parse and JSON.stringify is a not-bad solution. |
2,948 | How do I query an EOSIO system contract table ?
As a learning challenge, I am trying to figure out how to calculate the amount of EOS votes cast and aggregate attributes of vote.
Can I use **eosjs** to do this ?
I can't figure out where all this information is documented. EOS dev portal seems to be missing this info... | 2018/10/25 | [
"https://eosio.stackexchange.com/questions/2948",
"https://eosio.stackexchange.com",
"https://eosio.stackexchange.com/users/2460/"
] | System tables are not (yet) well documented. You have to browse the source code.
E.g. for voters you will find table `eosio voters` here:
<https://github.com/EOSIO/eos/blob/905e7c85714aee4286fa180ce946f15ceb4ce73c/contracts/eosio.system/eosio.system.hpp#L115>
`cleos -u https://eu.eosdac.io get table eosio eosio voter... | You have two options two read any table (whether system table or table of another contract) by connecting to a public node:
* cleos `get table` call: <https://developers.eos.io/eosio-cleos/reference#cleos-get-table>
* rcp api `get_table_rows` call <https://developers.eos.io/eosio-nodeos/reference#get_table_rows> |
310,416 | I want to create a table with all the people who works in a store. What would be the title of such a table? "Members"? "Workers", "Employees", something else? | 2016/02/28 | [
"https://english.stackexchange.com/questions/310416",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/162774/"
] | Consider [Workforce](http://www.merriam-webster.com/dictionary/workforce)
>
> the group of people who work for a particular organization or business
>
>
>
Synonyms include [Personnel](http://www.merriam-webster.com/dictionary/personnel), [Staff](http://www.merriam-webster.com/dictionary/staff) | A boss is not necessarily an employer. A boss is someone who bosses (directs, manages, supervises,...) others.
If the employer is a corporation or other non-human entity/organization, and **if the boss is also an employee**, then the word is *employee*. This is perhaps the most common case.
If the boss is the employe... |
43,793,366 | Here is the screenshot from chrome dev tools. Here I want to override .ui-menu class and want to increase its with to "20em".
[](https://i.stack.imgur.com/qIcsf.png)
Here is what I am trying to override it :
```
.menu.ui-menu{
width:20em;
}
```... | 2017/05/04 | [
"https://Stackoverflow.com/questions/43793366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3550077/"
] | You just need a space between `.menu` and `.ui-menu`, like this:
```
.menu .ui-menu {
width:20em;
}
```
`.menu.ui-menu` is looking for an element with both the `menu` and `ui-menu` classes, whereas `.menu .ui-menu` is looking for an element with class `ui-menu` that is a child of `menu`. | The ui-menu class is on a div, so you could write:
```
div.ui-menu {
width:20em;
}
```
or
```
.ui-menu {
width:20em !important;
}
```
or
```
body .ui-menu{
width:20em;
}
```
or something else, all solutions are higher weighted than the ".ui-menu" style as there already is at the moment |
43,793,366 | Here is the screenshot from chrome dev tools. Here I want to override .ui-menu class and want to increase its with to "20em".
[](https://i.stack.imgur.com/qIcsf.png)
Here is what I am trying to override it :
```
.menu.ui-menu{
width:20em;
}
```... | 2017/05/04 | [
"https://Stackoverflow.com/questions/43793366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3550077/"
] | You just need a space between `.menu` and `.ui-menu`, like this:
```
.menu .ui-menu {
width:20em;
}
```
`.menu.ui-menu` is looking for an element with both the `menu` and `ui-menu` classes, whereas `.menu .ui-menu` is looking for an element with class `ui-menu` that is a child of `menu`. | I found answer to this problem. I am trying to set the css in angular 4 application and all styles are encapsulated by default. to fix this , use following code in component class:
```
import { ViewEncapsulation } from '@angular/core';
@Component({
encapsulation: ViewEncapsulation.None
})
```
Once this is done... |
43,793,366 | Here is the screenshot from chrome dev tools. Here I want to override .ui-menu class and want to increase its with to "20em".
[](https://i.stack.imgur.com/qIcsf.png)
Here is what I am trying to override it :
```
.menu.ui-menu{
width:20em;
}
```... | 2017/05/04 | [
"https://Stackoverflow.com/questions/43793366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3550077/"
] | I found answer to this problem. I am trying to set the css in angular 4 application and all styles are encapsulated by default. to fix this , use following code in component class:
```
import { ViewEncapsulation } from '@angular/core';
@Component({
encapsulation: ViewEncapsulation.None
})
```
Once this is done... | The ui-menu class is on a div, so you could write:
```
div.ui-menu {
width:20em;
}
```
or
```
.ui-menu {
width:20em !important;
}
```
or
```
body .ui-menu{
width:20em;
}
```
or something else, all solutions are higher weighted than the ".ui-menu" style as there already is at the moment |
18,295,126 | I have a big problem for getting/computing the minutes.
Scenario:
I have a form which is the user can input the seconds [5s, 10s, 25s, 30s, 60s]. I called the table *"Duration"*
I already have *"Duration"* [compose of minutes:seconds], in my database which is ***"1:5"*** [the last input]. Then I insert again another... | 2013/08/18 | [
"https://Stackoverflow.com/questions/18295126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2617970/"
] | Are you using `GET` or `POST` to submit your form data?
If you're using `POST`, you can check the request method:
```
if($_SERVER['REQUEST_METHOD'] == 'POST') {
// Validate form data
}
else {
// Display form
}
```
If you're using `GET` you should check if any of the data you need is set. For example:
```
i... | You can also have an `<input type="submit" name="submit" value="Submit" />` and you can check `if (isset($_POST['submit'])) { ...` (I assume you're using Post; most forms should be Post, but it'll work with Get too). You can easily have multiple forms on the same page, and just check the presence of different submit bu... |
18,295,126 | I have a big problem for getting/computing the minutes.
Scenario:
I have a form which is the user can input the seconds [5s, 10s, 25s, 30s, 60s]. I called the table *"Duration"*
I already have *"Duration"* [compose of minutes:seconds], in my database which is ***"1:5"*** [the last input]. Then I insert again another... | 2013/08/18 | [
"https://Stackoverflow.com/questions/18295126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2617970/"
] | I have done like this to solve the Issue
`public function funName(){`
`// to avoid validation when the page loads`
`if($_SERVER['REQUEST_METHOD'] != 'POST') {`
`$this->load->view('user/index');`
`}`
```
... //rest of content
```
`}` | You can also have an `<input type="submit" name="submit" value="Submit" />` and you can check `if (isset($_POST['submit'])) { ...` (I assume you're using Post; most forms should be Post, but it'll work with Get too). You can easily have multiple forms on the same page, and just check the presence of different submit bu... |
35,167,576 | I manage to get the data I want from database using `array_push` and `encode` it into `JSON` in `PHP`. The results I get are like below,
```
{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-v... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35167576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4697373/"
] | Try this:
* create a Json object from the Json string,
* reorganize the object into a temporary PHP array,
* create a Json object (string) from the PHP arrray.
Code
----
```
<?php
$sjson='{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"... | An example:
```
<?php
$data = json_decode('{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-voucher.jpg",
"\/c\/a\/cash-voucher2.jpg",
"\/c\/a\/cash-voucher50_1.jpg"
],
"price":[
... |
35,167,576 | I manage to get the data I want from database using `array_push` and `encode` it into `JSON` in `PHP`. The results I get are like below,
```
{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-v... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35167576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4697373/"
] | Try this:
* create a Json object from the Json string,
* reorganize the object into a temporary PHP array,
* create a Json object (string) from the PHP arrray.
Code
----
```
<?php
$sjson='{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"... | Try this..
```
$str = '{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-voucher.jpg",
"\/c\/a\/cash-voucher2.jpg",
"\/c\/a\/cash-voucher50_1.jpg"
],
"price":[
"50.0000",
"1500... |
35,167,576 | I manage to get the data I want from database using `array_push` and `encode` it into `JSON` in `PHP`. The results I get are like below,
```
{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-v... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35167576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4697373/"
] | Try this:
* create a Json object from the Json string,
* reorganize the object into a temporary PHP array,
* create a Json object (string) from the PHP arrray.
Code
----
```
<?php
$sjson='{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"... | >
> Use this code to get exact result what you expect..
>
>
> `$string = your json string.`
>
>
>
```
$json_decode = json_decode($string,true);
$temp = array();
$i = 0;
foreach($json_decode as $key=>$val){
$temp['catalog'][$i]['name'] = $json_decode['name'][$i];
$temp['catalog'][$i]['image'] = $j... |
35,167,576 | I manage to get the data I want from database using `array_push` and `encode` it into `JSON` in `PHP`. The results I get are like below,
```
{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"\/l\/u\/lucky_draw_ticket_1.jpg",
"\/c\/a\/cash-v... | 2016/02/03 | [
"https://Stackoverflow.com/questions/35167576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4697373/"
] | Try this:
* create a Json object from the Json string,
* reorganize the object into a temporary PHP array,
* create a Json object (string) from the PHP arrray.
Code
----
```
<?php
$sjson='{
"name":[
"Lucky Draw Ticket",
"KIP Voucher RM10",
"KIP Voucher RM20",
"KIP Voucher RM50"
],
"image":[
"... | Simply you can use `array_map` like as
```
array_map(null,$jsonArr['name'],$jsonArr['image'],$jsonArr['price']);
```
So your code looks like as
```
$jsonArr = json_decode($json, true);
$result['catalog'] = array_map(null,$jsonArr['name'],$jsonArr['image'],$jsonArr['price']);
echo json_encode($result);
```
Output:... |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | If you can match a regular expression then you could match:
```
<item1>\n[any whitespace]<item2>
```
and change it to:
```
<item3>\n[any whitespace]<item2>
```
and the same for
```
</item1>\n[any whitespace]</item2>
```
and change it to:
```
</item3>\n[any whitespace]</item2>
```
I haven't specified the [an... | Use a regular expression search or other advanced search/replace method to replace the inner <item1> tag with something else temporarily (by specifying the tab characters before it as well). Then replace the remaining item1 tags, which will now be the outer ones, before changing your temporary ones back again. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | [xmlstarlet](http://xmlstar.sourceforge.net/) can help. | If the XML is all formatted like that, you should be able to use regular expressions. You might also try formatters to get that format.
Otherwise you could read the XML with an XML-parser in a language you know, change it there and write it back to disk. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | If you can match a regular expression then you could match:
```
<item1>\n[any whitespace]<item2>
```
and change it to:
```
<item3>\n[any whitespace]<item2>
```
and the same for
```
</item1>\n[any whitespace]</item2>
```
and change it to:
```
</item3>\n[any whitespace]</item2>
```
I haven't specified the [an... | If the XML is all formatted like that, you should be able to use regular expressions. You might also try formatters to get that format.
Otherwise you could read the XML with an XML-parser in a language you know, change it there and write it back to disk. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Can you use the tabs to your advantage? If it is as regular as your example then you can probably search and replace on `\t\t\t<item>` (or whatever syntax you need to search with tabs) with whatever else you need. | If you can match a regular expression then you could match:
```
<item1>\n[any whitespace]<item2>
```
and change it to:
```
<item3>\n[any whitespace]<item2>
```
and the same for
```
</item1>\n[any whitespace]</item2>
```
and change it to:
```
</item3>\n[any whitespace]</item2>
```
I haven't specified the [an... |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Regex may have worked in this instance, but regex is generally NOT the best means of modifying XML.
[XML is not regular](http://welbog.homeip.net/glue/53/XML-is-not-regular). You should use XML tools to parse and manipulate XML data, or you will likely run into problems at some point.
Transforming the XML using an ... | If the XML is all formatted like that, you should be able to use regular expressions. You might also try formatters to get that format.
Otherwise you could read the XML with an XML-parser in a language you know, change it there and write it back to disk. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | If you can match a regular expression then you could match:
```
<item1>\n[any whitespace]<item2>
```
and change it to:
```
<item3>\n[any whitespace]<item2>
```
and the same for
```
</item1>\n[any whitespace]</item2>
```
and change it to:
```
</item3>\n[any whitespace]</item2>
```
I haven't specified the [an... | Regex may have worked in this instance, but regex is generally NOT the best means of modifying XML.
[XML is not regular](http://welbog.homeip.net/glue/53/XML-is-not-regular). You should use XML tools to parse and manipulate XML data, or you will likely run into problems at some point.
Transforming the XML using an ... |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Can you use the tabs to your advantage? If it is as regular as your example then you can probably search and replace on `\t\t\t<item>` (or whatever syntax you need to search with tabs) with whatever else you need. | [xmlstarlet](http://xmlstar.sourceforge.net/) can help. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Can you use the tabs to your advantage? If it is as regular as your example then you can probably search and replace on `\t\t\t<item>` (or whatever syntax you need to search with tabs) with whatever else you need. | Use a regular expression search or other advanced search/replace method to replace the inner <item1> tag with something else temporarily (by specifying the tab characters before it as well). Then replace the remaining item1 tags, which will now be the outer ones, before changing your temporary ones back again. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Can you use the tabs to your advantage? If it is as regular as your example then you can probably search and replace on `\t\t\t<item>` (or whatever syntax you need to search with tabs) with whatever else you need. | If the XML is all formatted like that, you should be able to use regular expressions. You might also try formatters to get that format.
Otherwise you could read the XML with an XML-parser in a language you know, change it there and write it back to disk. |
1,995,666 | I made a huge error in a gigantic XML file.
```
<item1>
<item2>
<item1>
//.. tons of stuff...
</item1>
</item2>
</item1>
```
I need to replace the outer item1 with something else. But find and replace isn't working because of the matching inner item1. I've tried searching by mult... | 2010/01/03 | [
"https://Stackoverflow.com/questions/1995666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84685/"
] | Can you use the tabs to your advantage? If it is as regular as your example then you can probably search and replace on `\t\t\t<item>` (or whatever syntax you need to search with tabs) with whatever else you need. | Regex may have worked in this instance, but regex is generally NOT the best means of modifying XML.
[XML is not regular](http://welbog.homeip.net/glue/53/XML-is-not-regular). You should use XML tools to parse and manipulate XML data, or you will likely run into problems at some point.
Transforming the XML using an ... |
63,429,311 | I need some help with my code, I have got a problem with fetch the text while ignore the class `menu-list-count` as it will display the value next to the text.
When I try this:
```
var mailfolder = $(this).not('[class="menu-list-count"]').text();
```
The return output will be:
```
test1 2
```
It should be:
test... | 2020/08/15 | [
"https://Stackoverflow.com/questions/63429311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12632670/"
] | Because you have a span in a span, in order to select the right one you need to change this line:
```
$(this).not('[class="menu-list-count"]')
```
to:
```
$(this).find('span:not([class="menu-list-count"])')
```
In order to get only the text belonging to the upper span you can combine [.contents()](https://api.jqu... | I'm not sure with JQuery, but with plain JS you can use `childNodes` to filter everything that is not a textNode and then concatenate the result.
I've wrote a small JSFiddle to show how it works: <https://jsfiddle.net/sandro_paganotti/4873muzp/6/>
HTML
```
<div>
Hello
<b>Some Text</b>
</div>
```
JS:
```
con... |
19,506,095 | Google Adwords Editor ver 10.2.1
It is possible to change the ad text for existing ads via the UI?
I would like to make changes by importing a csv file.
I have tried exporting my campaign, editing the csv file and re-importing the file using Adwords Editor. But the changed text is imported as a **new** ad - not a ch... | 2013/10/21 | [
"https://Stackoverflow.com/questions/19506095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9625/"
] | In AdWords, it is impossible to change the text of ads, no matter what method you use.
* Editor will create new ads for you.
* You can upload a CSV file into the web interface, and that will generate new ads.
* You can use the "edit" functionality in the UI, and that will still create new ads.
To summarize - nothing... | Since AdWords register data for a certain ad you can never have the old data assigned to a new/changed ad since that data wouldn't be correct for that new/changed ad.
Just remove all the old ads and import the new ones. |
13,411,260 | There is a tag `<tr:goButton>` in trinidad for which description is as below:
>
> The `goButton` creates a push button that navigates directly to another location instead of delivering an action. It can be used in place of commandButton where a server-side action is not needed.
>
>
>
Do we've similar one in JSF 2... | 2012/11/16 | [
"https://Stackoverflow.com/questions/13411260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693664/"
] | You should consider how many clients will use your app at the same time on server side, and the the time to transfer the data.
I suggest to convert to pdf on the client side if it is possible. | You could transfer the data to PHP and have it generate your tables using html2pdf.
It has css support so I recommend it. |
13,411,260 | There is a tag `<tr:goButton>` in trinidad for which description is as below:
>
> The `goButton` creates a push button that navigates directly to another location instead of delivering an action. It can be used in place of commandButton where a server-side action is not needed.
>
>
>
Do we've similar one in JSF 2... | 2012/11/16 | [
"https://Stackoverflow.com/questions/13411260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693664/"
] | You should consider how many clients will use your app at the same time on server side, and the the time to transfer the data.
I suggest to convert to pdf on the client side if it is possible. | Definitely create the PDF files on your client device:
[Drawing and Printing Guide for iOS](http://developer.apple.com/library/ios/#documentation/2ddrawing/conceptual/drawingprintingios/GeneratingPDF/GeneratingPDF.html) |
61,466,338 | Given the following ndarray `t` -
```
In [26]: t.shape
Out[26]: (3, 3, 2)
In [27]: t
Out[27]:
array([[[ 0, 1],
[ 2, 3],
[ 4... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61466338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309803/"
] | As the interpolation is 1d with changing `y` values it must be run for each 1d slice of t. It's probably faster to loop explicitly but neater to loop using np.apply\_along\_axis
```
import numpy as np
t = np.arange( 18 ).reshape(3,3,2)
x = np.linspace( 0, t.shape[0]-1, 4)
xp = np.arange(t.shape[0])
def interfunc( a... | You could try `scipy.interpolate.interp1d`:
```
from scipy.interpolate import interp1d
import numpy as np
t = np.array([[[ 0, 1],
[ 2, 3],
[ 4, 5]],
[[ 6, 7],
[ 8, 9],
[10, 11]],
[[12, 13],
[14, 15],
... |
61,466,338 | Given the following ndarray `t` -
```
In [26]: t.shape
Out[26]: (3, 3, 2)
In [27]: t
Out[27]:
array([[[ 0, 1],
[ 2, 3],
[ 4... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61466338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309803/"
] | As requested by @Tis Chris, here is a solution using `np.nditer` with the `multi_index` flag but I prefer the explicit nested `for` loops method above because it is 10% faster
```
In [29]: t = np.arange( 18 ).reshape(3,3,2)
In [30]: ax0old = np.arange(t.shape[... | You could try `scipy.interpolate.interp1d`:
```
from scipy.interpolate import interp1d
import numpy as np
t = np.array([[[ 0, 1],
[ 2, 3],
[ 4, 5]],
[[ 6, 7],
[ 8, 9],
[10, 11]],
[[12, 13],
[14, 15],
... |
61,466,338 | Given the following ndarray `t` -
```
In [26]: t.shape
Out[26]: (3, 3, 2)
In [27]: t
Out[27]:
array([[[ 0, 1],
[ 2, 3],
[ 4... | 2020/04/27 | [
"https://Stackoverflow.com/questions/61466338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309803/"
] | As the interpolation is 1d with changing `y` values it must be run for each 1d slice of t. It's probably faster to loop explicitly but neater to loop using np.apply\_along\_axis
```
import numpy as np
t = np.arange( 18 ).reshape(3,3,2)
x = np.linspace( 0, t.shape[0]-1, 4)
xp = np.arange(t.shape[0])
def interfunc( a... | As requested by @Tis Chris, here is a solution using `np.nditer` with the `multi_index` flag but I prefer the explicit nested `for` loops method above because it is 10% faster
```
In [29]: t = np.arange( 18 ).reshape(3,3,2)
In [30]: ax0old = np.arange(t.shape[... |
53,955,190 | I have this code
```
DefaultTableModel defaultTableModel = (DefaultTableModel) jTable1.getModel();
int row = defaultTableModel.getRowCount();
for (int i = 0; i < row; i++) {
String id = (String) defaultTableModel.getValueAt(row, 0);
```
But I'm getting exception at line :
```
String i... | 2018/12/28 | [
"https://Stackoverflow.com/questions/53955190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try below change. I think it should work.
```
for (int i = 0; i < row; i++) { // Changed row+1 to row
String id = (String) defaultTableModel.getValueAt(i, 0); // Changed row to i
``` | Your `for` statement should be:
```
for (int i = 0; i < row; i++) {
```
Also as scary wombat says:
```
String id = (String) defaultTableModel.getValueAt(i, 0);
``` |
69,072,718 | I have followed the documentation [here](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-sdk-brief-introduction-0000001061991343) and [here](https://developer.huawei.com/consumer/en/codelab/HMSMapKit/index.html#0) (which are pretty straight forward), but the map view does not load any ti... | 2021/09/06 | [
"https://Stackoverflow.com/questions/69072718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4227387/"
] | First you may refer to [this Docs](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/error-code-0000001050992007) to see if there's an error code.
The official demo also runs incorrectly. so there is a high probability that the problem is caused by a signature or API key problem.
Please check as... | You need to generate and upload to AppGallery Connect **two SHA-256 keys**, one for debug version and one for release.
for generating key for debug version you need to:
1. open cmd
2. run command `cd [path to directory with keytool.exe file]`
for example: `cd C:\Program Files\Java\jdk1.8.0_301\bin`
3. run command `ke... |
53,400,878 | I am trying to do something similar to a `Averageif` with `max` and `min`.
Current formula :
```
=IF(J15<0,MAX('CS+MS'!C:C),MIN('CS+MS'!C:C))
```
When I'm looking in CS+MS Sheet I want to do something like averageif where I can search column B for a word then return column C.
Is this possble? | 2018/11/20 | [
"https://Stackoverflow.com/questions/53400878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8462962/"
] | The ideal way to achieve this is with named queues.
Have multiple workers set up, some working on `Production-East` environment and some on `Production-West` environment. That way both DAGs show up in the UI but they execute only on the worker machines that have that specific environment on them.
From the [documentati... | Have the files for each group put inside a subfolder and then set the `dags_folder` path to point to the appropriate subfolder for the server. |
6,869,460 | I'm encountering a strange OpenGL Bug. OpenGL is pretty new to me, but we're required to use it in my AI class (because the teacher is really a Graphics professor).
Either way, this is happening: <http://img818.imageshack.us/img818/422/reversiothello.png>
It happens to only the topmost, leftmost polygon. In other wor... | 2011/07/29 | [
"https://Stackoverflow.com/questions/6869460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43790/"
] | The only bug worth giving an answer that I can find is that your `draw_board` function doesn't use properly the `glBegin` and `glEnd` statements. You have to use a `glEnd` statement before calling `gl_drawCircle`, otherwise you'll get a nasty behavior.
Edit: you first circle is drawn using lines because the `glBegin` ... | You need a call to glEnd after drawing the rows.
When you do not call glEnd, OpenGL ignores your call `glBegin( GL_POLYGON );` and assumes you still want to draw lines.
So just adding
`glEnd ();`
after drawing the rows should solve it. |
1,702,003 | I'm trying to zip a stream from .Net that can be read from Java code.
So as input I have a byte array, which I want to compress and I'm expecting to have a binary array.
I've tested with SharpZipLib and DotNetZip to the compressed byte array,
but unfortunately I always get an error when trying to uncompress it using t... | 2009/11/09 | [
"https://Stackoverflow.com/questions/1702003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207066/"
] | You shouldn't need to touch `Deflater`. `Deflater` deals with decompressing individual entries within the zip file.
[`ZipInputStream`](http://java.sun.com/javase/6/docs/api/java/util/zip/ZipInputStream.html) is the odd class to go for. There is also [`ZipFile`](http://java.sun.com/javase/6/docs/api/java/util/zip/ZipFi... | Here is the page from Sun on ZipStreams:
<http://java.sun.com/developer/technicalArticles/Programming/compression/>
Another library that deals with ZipStreams is POI. It is more focused on working with MS OFfic XML format docs but it might have some different insights as to how to handle the stream. <http://poi.apach... |
1,702,003 | I'm trying to zip a stream from .Net that can be read from Java code.
So as input I have a byte array, which I want to compress and I'm expecting to have a binary array.
I've tested with SharpZipLib and DotNetZip to the compressed byte array,
but unfortunately I always get an error when trying to uncompress it using t... | 2009/11/09 | [
"https://Stackoverflow.com/questions/1702003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207066/"
] | Inflater doesn't read zip streams. It reads ZLIB (or DEFLATE) streams. The ZIP format surrounds a pure DEFLATE stream with additional metadata. Inflater doesn't handle that metadata.
---
If you are inflating on the Java side, you need Inflater.
On the .NET side you can use the Ionic.Zlib.ZlibStream class from Dot... | Here is the page from Sun on ZipStreams:
<http://java.sun.com/developer/technicalArticles/Programming/compression/>
Another library that deals with ZipStreams is POI. It is more focused on working with MS OFfic XML format docs but it might have some different insights as to how to handle the stream. <http://poi.apach... |
1,702,003 | I'm trying to zip a stream from .Net that can be read from Java code.
So as input I have a byte array, which I want to compress and I'm expecting to have a binary array.
I've tested with SharpZipLib and DotNetZip to the compressed byte array,
but unfortunately I always get an error when trying to uncompress it using t... | 2009/11/09 | [
"https://Stackoverflow.com/questions/1702003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207066/"
] | You shouldn't need to touch `Deflater`. `Deflater` deals with decompressing individual entries within the zip file.
[`ZipInputStream`](http://java.sun.com/javase/6/docs/api/java/util/zip/ZipInputStream.html) is the odd class to go for. There is also [`ZipFile`](http://java.sun.com/javase/6/docs/api/java/util/zip/ZipFi... | Inflater doesn't read zip streams. It reads ZLIB (or DEFLATE) streams. The ZIP format surrounds a pure DEFLATE stream with additional metadata. Inflater doesn't handle that metadata.
---
If you are inflating on the Java side, you need Inflater.
On the .NET side you can use the Ionic.Zlib.ZlibStream class from Dot... |
1,114,693 | I'm in the mood to break things.
Current system:
```
Linux Kublai-1888 4.18.0-13-generic #14-Ubuntu SMP Wed Dec 5 09:04:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
```
I didn't even know 5 existed! Are there any benefits I should be aware about? I'm going to uninstall my graphics drivers beforehand since it'll prob... | 2019/02/01 | [
"https://askubuntu.com/questions/1114693",
"https://askubuntu.com",
"https://askubuntu.com/users/913404/"
] | After installing a mainline Linux kernel such as version 5 you can still reboot and select the previous version.
At the Grub menu select **Advanced Options**. A sub menu appears showing all your previously installed kernels that have not been auto removed or manually removed. | Everything went fine. It's always good to uninstall everything before upgrading. |
60,335,749 | 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
```
int* var = new int(100);
delete var;
var = NULL;
```
2. Does it also make sense in destructors?
3. In a getter, does... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60335749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8120645/"
] | >
> 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
>
>
>
> ```
> int* var = new int(100);
> // ...
> delete var;
> var = NULL;
>
> ```
>
>
Only useful if you test `var` a... | Avoid writing code like this
```
int* var = new int(100);
// ... do work ...
delete var;
```
This is prone to memory leaks if "*do work*" throws, `return`s or otherwise breaks out of current scope (it may not be the case right now but later when "*do work*" needs to be extended/changed). Always wrap heap... |
60,335,749 | 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
```
int* var = new int(100);
delete var;
var = NULL;
```
2. Does it also make sense in destructors?
3. In a getter, does... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60335749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8120645/"
] | >
> 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
>
>
>
> ```
> int* var = new int(100);
> // ...
> delete var;
> var = NULL;
>
> ```
>
>
Only useful if you test `var` a... | This question is really opinion-based, so I'll offer some opinions ... but also a justification for those opinions, which will hopefully be more useful for learning than the opinions themselves.
>
> 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? ... |
60,335,749 | 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
```
int* var = new int(100);
delete var;
var = NULL;
```
2. Does it also make sense in destructors?
3. In a getter, does... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60335749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8120645/"
] | >
> 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
>
>
>
> ```
> int* var = new int(100);
> // ...
> delete var;
> var = NULL;
>
> ```
>
>
Only useful if you test `var` a... | The case you describe remains relatively simple, because the variable is described in a local scope.
But look for example at this scenario:
```
struct MyObject
{
public :
MyObject (int i){ m_piVal = new int(i); };
~MyObject (){
delete m_piVal;
};
public:
static int *m_piVal;
};
int* MyObj... |
60,335,749 | 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
```
int* var = new int(100);
delete var;
var = NULL;
```
2. Does it also make sense in destructors?
3. In a getter, does... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60335749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8120645/"
] | Avoid writing code like this
```
int* var = new int(100);
// ... do work ...
delete var;
```
This is prone to memory leaks if "*do work*" throws, `return`s or otherwise breaks out of current scope (it may not be the case right now but later when "*do work*" needs to be extended/changed). Always wrap heap... | The case you describe remains relatively simple, because the variable is described in a local scope.
But look for example at this scenario:
```
struct MyObject
{
public :
MyObject (int i){ m_piVal = new int(i); };
~MyObject (){
delete m_piVal;
};
public:
static int *m_piVal;
};
int* MyObj... |
60,335,749 | 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? (bad design architecture of the legacy code excluded)
```
int* var = new int(100);
delete var;
var = NULL;
```
2. Does it also make sense in destructors?
3. In a getter, does... | 2020/02/21 | [
"https://Stackoverflow.com/questions/60335749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8120645/"
] | This question is really opinion-based, so I'll offer some opinions ... but also a justification for those opinions, which will hopefully be more useful for learning than the opinions themselves.
>
> 1. Is it always wise to use NULL after a delete in legacy code without any smartpointers to prevent dangling pointers? ... | The case you describe remains relatively simple, because the variable is described in a local scope.
But look for example at this scenario:
```
struct MyObject
{
public :
MyObject (int i){ m_piVal = new int(i); };
~MyObject (){
delete m_piVal;
};
public:
static int *m_piVal;
};
int* MyObj... |
42,435,469 | I have a query which calls a function in a package to create a percentage value as a sum of about 30 columns.
What I'd like to do is update each row based on the "sum of counted columns" as a percentage.
The select query is:
```
SELECT
checklist_id,
row_status,
eba_cm_checklist_std.get_row_percent_complete(pc.id,pc... | 2017/02/24 | [
"https://Stackoverflow.com/questions/42435469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3410393/"
] | Assuming there's not a library which will implement this functionality for you, using `path.parse` doesn't have to be clunky - I actually think using that is probably the cleanest way of doing this:
```
let { dir, name, ext } = path.parse("a/path/to/file.json");
let path1 = path.join(dir, name + "-original" + ext);
le... | In addition to @joe's answer, here's a simpler version that needs the [`modify-filename`](https://www.npmjs.com/package/modify-filename) package.
```
var modifyFilename = require('modify-filename');
const originalPath = "a/path/to/file.json";
const originalFilename = modifyFilename(originalPath, (name, ext) => {
... |
48,677,250 | From a web analyst perspective on any given website i am looking find out which same page anchors are clicked the most by console logging the anchor's text value (inner html text) in the console for now.
The approach i took was to take the current page url after every anchor click and check to see if their had been an... | 2018/02/08 | [
"https://Stackoverflow.com/questions/48677250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328610/"
] | How about using joblib ? This is not a straight vectorization, but the different starting points will be executed in parallel.
```
from scipy.optimize import fsolve
import numpy as np
from joblib import Parallel, delayed
def equations(x): # x+y^2-4, sin(x)+x*y-3
ret = np.array([x[0]+x[1]**2-4, np.sin(x[0]) + x[0]... | ```
def eq(x):
return x[0] + x[1]**2 - 4 , np.sin(x[0]) + x[0]*x[1] - 3
fsolve(eq, [0, 1])
output: array([ 1.23639399, 1.6624097 ])
```
In this case, I would suggest using a brute force method:
```
x0 = [[i, j] for i, j in zip(range(10), range(10))]
for xnot in x0:
print(fsolve(eq, xnot))
[ 1.33088471... |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | If there is only one match. You need to use find(). Inside of the find method, you want to use some() to look for an \_id match.
```js
const users = [
{
name: "Jack",
workspaces: [
{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
... | `users.map(u => u.workspaces).flat().filter(w => w._id === activeWorkspaceId);`
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | I adjusted the provided data from Joe so he doesn't have permissions
```js
const users = [{
name: "Jack",
workspaces: [{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
{
_id: "41ss16512315615645bk",
permissions: ["CAN_DELET... | `users.map(u => u.workspaces).flat().filter(w => w._id === activeWorkspaceId);`
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | You can use `map` and `filter` to "filter" out the unwanted ids from the `users` object. Something like :
```js
const users = [
{
"name": "Jack",
"workspaces": [
{
"_id": "61216512315615645jbk",
"permissions": [
"CAN_DELETE_WORKSPACE",... | `users.map(u => u.workspaces).flat().filter(w => w._id === activeWorkspaceId);`
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | This should work (tested):
```js
const filteredUsers = users.filter(
user => user.workspaces.reduce(
(acc, workspace) => acc || workspace._id === activeWorkspace._id, false)
)
)
```
Explanation:
We are using `filter` and `reduce` as evident from the code. What the code is doing is pretty simple, first, we want t... | `users.map(u => u.workspaces).flat().filter(w => w._id === activeWorkspaceId);`
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat> |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | If there is only one match. You need to use find(). Inside of the find method, you want to use some() to look for an \_id match.
```js
const users = [
{
name: "Jack",
workspaces: [
{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
... | I adjusted the provided data from Joe so he doesn't have permissions
```js
const users = [{
name: "Jack",
workspaces: [{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
{
_id: "41ss16512315615645bk",
permissions: ["CAN_DELET... |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | If there is only one match. You need to use find(). Inside of the find method, you want to use some() to look for an \_id match.
```js
const users = [
{
name: "Jack",
workspaces: [
{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
... | You can use `map` and `filter` to "filter" out the unwanted ids from the `users` object. Something like :
```js
const users = [
{
"name": "Jack",
"workspaces": [
{
"_id": "61216512315615645jbk",
"permissions": [
"CAN_DELETE_WORKSPACE",... |
70,276,149 | as i title says. I think code will describe what i want to do.
input:
```
words = ['oko', 'grzybobranie', 'żółw', 'jaźń', 'zażółcone krzewy', 'hipodrom', 'szczęki', 'kurs poprawkowy']
```
expected output:
```
sum of polish signs in words - [0, 0, 3, 2, 3, 0, 1, 0]
```
My work:
```
words = ['oko', 'grzybobranie'... | 2021/12/08 | [
"https://Stackoverflow.com/questions/70276149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17626416/"
] | If there is only one match. You need to use find(). Inside of the find method, you want to use some() to look for an \_id match.
```js
const users = [
{
name: "Jack",
workspaces: [
{
_id: "61216512315615645jbk",
permissions: ["CAN_DELETE_WORKSPACE", "CAN_EDIT_PROJECT"],
},
... | This should work (tested):
```js
const filteredUsers = users.filter(
user => user.workspaces.reduce(
(acc, workspace) => acc || workspace._id === activeWorkspace._id, false)
)
)
```
Explanation:
We are using `filter` and `reduce` as evident from the code. What the code is doing is pretty simple, first, we want t... |
53,878,969 | I want to find records in a (Oracle SQL) table using the creation date field where records are older than 24hrs and set some status once. To find records using a operators like > but if anyone can suggest quick SQL where clause statement to find records older than 24hrs that would be nice. | 2018/12/21 | [
"https://Stackoverflow.com/questions/53878969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9921755/"
] | You can use below query to fetch the same
SELECT \*
FROM mytable
WHERE record\_date >= SYSDATE - 1 | Get records younger than 24 hours:
```
SELECT * FROM table
WHERE record_date > SYSDATE - 1
```
Get records older than 24 hours:
```
SELECT * FROM table
WHERE record_date < SYSDATE - 1
```
Get records from today:
```
SELECT * FROM table
WHERE record_date >= TRUNC(SYSDATE)
```
Get records from before today:
... |
38,366,674 | When trying to install 'graphics tools' in xcode (Xcode -> open developer tool -> More developer tools, I get:
```
{"responseId":"ba7bd79e-487a-49b6-9bf1-f4085dc9e27e","resultCode":1003,"resultString":"request.uri.notfound","userString":"Invalid request, Service mapping to the requested URL is not available. ","creati... | 2016/07/14 | [
"https://Stackoverflow.com/questions/38366674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2353816/"
] | Passing an `attribute` to element might not work as element needs to be in `ready` state for that. Below are three ways that might help you with what you are trying
**One way** to `lazy register` your elements in `Polymer` is to use `Polymer.Class` instead of `Polymer` constructor. This way until you register your ele... | [Class Style Constructor](https://www.polymer-project.org/1.0/docs/devguide/registering-elements#element-constructor)
>
> If you want to set up your custom element's prototype chain but not register it immediately, you can use the Polymer.Class function. Polymer.Class takes the same prototype argument as the Polymer ... |
52,228,887 | I know the difference between `==` and `===` when applied to primitive values. But for objects, they both seem to be a simple identity comparison.
```
var a = {}
var b = a
var c = {}
a == b // true
a === b // true
a == c // false
a === c // false
```
Is there any situation where comparing two objects will provide ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52228887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7496073/"
] | Looks like it
The only way I know to "check for object equality" in javascript is to deep check every possible key (but even then it is just duck type checking) | Well... `===` is "compare identity and type". You've determined that you're comparing two objects (so "type" is the same), that leaves "compare identity", which is the same as `==`.
Likewise, if you compare two `number`s, since you already know they are the same type (`number`), `===` is the same as `==`. There is not... |
52,228,887 | I know the difference between `==` and `===` when applied to primitive values. But for objects, they both seem to be a simple identity comparison.
```
var a = {}
var b = a
var c = {}
a == b // true
a === b // true
a == c // false
a === c // false
```
Is there any situation where comparing two objects will provide ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52228887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7496073/"
] | Yes, comparing two objects with `==` is the same as comparing them with `===`. Just as comparing two strings with `==` is the same as `===`. If the type of values are the same, both comparing methods will give the same result. [As the specification states](http://www.ecma-international.org/ecma-262/9.0/index.html#sec-a... | Looks like it
The only way I know to "check for object equality" in javascript is to deep check every possible key (but even then it is just duck type checking) |
52,228,887 | I know the difference between `==` and `===` when applied to primitive values. But for objects, they both seem to be a simple identity comparison.
```
var a = {}
var b = a
var c = {}
a == b // true
a === b // true
a == c // false
a === c // false
```
Is there any situation where comparing two objects will provide ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52228887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7496073/"
] | Yes, comparing two objects with `==` is the same as comparing them with `===`. Just as comparing two strings with `==` is the same as `===`. If the type of values are the same, both comparing methods will give the same result. [As the specification states](http://www.ecma-international.org/ecma-262/9.0/index.html#sec-a... | Well... `===` is "compare identity and type". You've determined that you're comparing two objects (so "type" is the same), that leaves "compare identity", which is the same as `==`.
Likewise, if you compare two `number`s, since you already know they are the same type (`number`), `===` is the same as `==`. There is not... |
52,228,887 | I know the difference between `==` and `===` when applied to primitive values. But for objects, they both seem to be a simple identity comparison.
```
var a = {}
var b = a
var c = {}
a == b // true
a === b // true
a == c // false
a === c // false
```
Is there any situation where comparing two objects will provide ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52228887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7496073/"
] | The extra = in `===` ensures both sides are of the same type. `a` and `c` both are objects, the same type. So `==` or `===` is irrelevant here. | Well... `===` is "compare identity and type". You've determined that you're comparing two objects (so "type" is the same), that leaves "compare identity", which is the same as `==`.
Likewise, if you compare two `number`s, since you already know they are the same type (`number`), `===` is the same as `==`. There is not... |
52,228,887 | I know the difference between `==` and `===` when applied to primitive values. But for objects, they both seem to be a simple identity comparison.
```
var a = {}
var b = a
var c = {}
a == b // true
a === b // true
a == c // false
a === c // false
```
Is there any situation where comparing two objects will provide ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52228887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7496073/"
] | Yes, comparing two objects with `==` is the same as comparing them with `===`. Just as comparing two strings with `==` is the same as `===`. If the type of values are the same, both comparing methods will give the same result. [As the specification states](http://www.ecma-international.org/ecma-262/9.0/index.html#sec-a... | The extra = in `===` ensures both sides are of the same type. `a` and `c` both are objects, the same type. So `==` or `===` is irrelevant here. |
43,604,529 | My application will take data using form and save it to the database and then draw it using chartjs .
**I have tried this code but gives me an error. My code is as follows :**
```
def get_temperature_show(request):
all_temperatures = Temper.objects.all()
dates_label = []
sensor1_temp = []
sensor2_temp = []
sensor3_t... | 2017/04/25 | [
"https://Stackoverflow.com/questions/43604529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5045972/"
] | **View should be like this:**
```
def get_temperature_show(request):
data = Temper.objects.all()
return render(request,'weather/showtemper.html',{'data':data})
```
**In the template just iterate the data. Code is as follows:**
```
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Ch... | ```
from json import JSONEncoder
class MyEncoder(JSONEncoder):
def default(self, o):
if isinstance( o, datetime.datetime):
return o.isoformat()
return o
json.dumps(cls=MyEncoder)
```
try this when you are dumping in your django code |
64,801,905 | I have a requirement where I have to extract two lines of text just after the Table of Contents in a Word Document. The text is hidden and added just for use in VBA.
I did some research and found out that I can extract text from a word Document using the `Range` object and so I tried hardcoding it and I got the value ... | 2020/11/12 | [
"https://Stackoverflow.com/questions/64801905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7292231/"
] | You can use `String.prototype.toLowerCase` on both the input value and the word:
```js
function openPage() {
var x = document.getElementById("search").value;
if (x.toLowerCase() === "Oyaide".toLowerCase()) {
window.location.replace("/Products#!/oyaide/sort/manual");
}
}
``` | I think you may want something like this to have more than one location to go to
```js
const locations = {
"oyaide" : "/Products#!/oyaide/sort/manual",
"something" : "/Products#!/something/sort/manual"
}
window.addEventListener("load",function() {
document.getElementById("search").addEventListener("input",fun... |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | For low drag, you want to minimize the surface changes presented to the air flow. Large changes in the surface will create turbulence and pressure changes that contribute to drag. Small changes will minimize these sources of drag.
When you move a control surface like an aileron or elevator, air is flowing past both si... | The main answer is drag. A spoiler will create more drag than a surface that allows flow over both sides. In the case of speed brakes this is what you want to happen as you want to slow the plane down. With control surfaces you want to alter airflow with out creating excess drag. |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | The reason is that both sides of a control surface experience pressure changes, both ahead and aft of the hinge line. In case of spoilers and speed brakes, only one side is affected, so the effectiveness is only half as big.
Please see the pressure coefficient plots of an airfoil for three different flap deflections b... | The main answer is drag. A spoiler will create more drag than a surface that allows flow over both sides. In the case of speed brakes this is what you want to happen as you want to slow the plane down. With control surfaces you want to alter airflow with out creating excess drag. |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | The main answer is drag. A spoiler will create more drag than a surface that allows flow over both sides. In the case of speed brakes this is what you want to happen as you want to slow the plane down. With control surfaces you want to alter airflow with out creating excess drag. | I think you question comes to the difference between aerodynamic body and blunt body. It is no so much linked to exposing one or two surfaces to the external flow, but more linked to the shape exposed to the external flow.
An aerodynamic body has a shape which produces low drag, aerodynamic bodies have a very small si... |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | For low drag, you want to minimize the surface changes presented to the air flow. Large changes in the surface will create turbulence and pressure changes that contribute to drag. Small changes will minimize these sources of drag.
When you move a control surface like an aileron or elevator, air is flowing past both si... | The reason is that both sides of a control surface experience pressure changes, both ahead and aft of the hinge line. In case of spoilers and speed brakes, only one side is affected, so the effectiveness is only half as big.
Please see the pressure coefficient plots of an airfoil for three different flap deflections b... |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | For low drag, you want to minimize the surface changes presented to the air flow. Large changes in the surface will create turbulence and pressure changes that contribute to drag. Small changes will minimize these sources of drag.
When you move a control surface like an aileron or elevator, air is flowing past both si... | I think you question comes to the difference between aerodynamic body and blunt body. It is no so much linked to exposing one or two surfaces to the external flow, but more linked to the shape exposed to the external flow.
An aerodynamic body has a shape which produces low drag, aerodynamic bodies have a very small si... |
14,209 | For example, ailerons allow air to flow past both the top and bottom surfaces, which makes it more aerodynamic than speedbrakes. Also, plane rudders have air flowing on both sides, which is apparently mote efficient than a spoiler. Why does this happen? | 2015/04/17 | [
"https://aviation.stackexchange.com/questions/14209",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/8021/"
] | The reason is that both sides of a control surface experience pressure changes, both ahead and aft of the hinge line. In case of spoilers and speed brakes, only one side is affected, so the effectiveness is only half as big.
Please see the pressure coefficient plots of an airfoil for three different flap deflections b... | I think you question comes to the difference between aerodynamic body and blunt body. It is no so much linked to exposing one or two surfaces to the external flow, but more linked to the shape exposed to the external flow.
An aerodynamic body has a shape which produces low drag, aerodynamic bodies have a very small si... |
2,273,679 | I am having a problem with a linked image.
```
<TR class="a">
<TD><A href="http://CA_NB_1_1-pr.jpg" rel="lightbox"><IMG src="CA_NB_1_1-th-pr.jpg"><BR><BR></A></TD>
<TD class="hdsmlbr"><A href="http://127.0.0.1/odds/aptrqr2/view/1">35 Savoie Drive, Moncton, New Brunswick, Canada</A></TD>
</TR>
```
This ima... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2273679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202184/"
] | It might be the two `<br>`'s... | You're trailing your image with two break-tags: `<BR><BR>`. Those would give the same impression. Sure enough, when removed the "extra padding" vanishes. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.