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 |
|---|---|---|---|---|---|
5,822 | Greetings all,
Political demonstrations and unrest on such a grand scale as what is occurring in Egypt, Iran and Syria right now are rare - that's what makes them so interesting to record and preserve. Although they can be unnerving and violent, finding a way to safely record an event like this is important, so long a... | 2011/02/02 | [
"https://sound.stackexchange.com/questions/5822",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/61/"
] | Protests can be fun and crazy. In '97 I recorded protests in NYC for police brutality cases that were very consuming. Your heart tore as you heard the details of young kids who were accused of attacking police yet autopsy reports noted numerous bullet wounds entering the palms of these kids hands and palm side of their... | A Brazilian voice-over talent I worked with said he used to work for a TV station in Brazil in the late 80s to 90s. He recorded a protest over there where he had to lug a 50-pound recorder around - he had a great story about it and he said he has never recorded nor heard that type of human emotion since - very intense.... |
46,481,883 | I created a Bot and added to Skype and Microsoft Teams. Both are responding fine for user messages (reply to user messages).
Following the [documentation](https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-proactive-messages), I tried to send (ad-hock) proactive messages to users. This worked w... | 2017/09/29 | [
"https://Stackoverflow.com/questions/46481883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8473606/"
] | Figured out what was the error. Following code line should be added before calling SendToConversationAsync, CreateConversationAsync etc..
**MicrosoftAppCredentials.TrustServiceUrl(ServiceUrl);**
And I tested this for [documentation](https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-proactive-... | The documentation for this is found in this article: [Starting a 1:1 conversation](https://msdn.microsoft.com/en-us/microsoft-teams/bots1on1#starting-a-11-conversation). There's also some [sample source](https://github.com/OfficeDev/microsoft-teams-template-bot-CSharp/blob/master/template-bot-master-csharp/src/dialogs/... |
53,686,146 | My question is pretty simple, I have input that looks like this...
```
0 0 0 1 1 1 -1 -1 -1 1
```
And I need to store these values into an array but I can't figure it out. This is what I have so far...
```
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type arr is array(1..10) of Integer;
... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53686146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8623823/"
] | You can use Get\_Line to get the whole line as a string and then Ada.Integer\_Text\_IO to parse the string:
```ada
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Hello is
Line : String := Get_Line;
Value : Integer;
Last : Positive := 1;
begin
while Las... | If you know that you have 10 elements to read, it can be done a little more simply like this:
```
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Hello is
A: array (1..10) of Integer;
begin
for V of A loop
Get(V);
end loop;
for I in A'Range loop
... |
53,686,146 | My question is pretty simple, I have input that looks like this...
```
0 0 0 1 1 1 -1 -1 -1 1
```
And I need to store these values into an array but I can't figure it out. This is what I have so far...
```
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type arr is array(1..10) of Integer;
... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53686146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8623823/"
] | You can use Get\_Line to get the whole line as a string and then Ada.Integer\_Text\_IO to parse the string:
```ada
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Hello is
Line : String := Get_Line;
Value : Integer;
Last : Positive := 1;
begin
while Las... | Even though this already was answered, I'd like to add a couple improvements to Jere's answer.
It is more Ada-like to terminate the recursion using End\_Of\_File rather than an exception. Plus, it makes the program clearer.
Also, using tail-call recursion instead of normal recursion allows the compiler to perform som... |
53,686,146 | My question is pretty simple, I have input that looks like this...
```
0 0 0 1 1 1 -1 -1 -1 1
```
And I need to store these values into an array but I can't figure it out. This is what I have so far...
```
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
type arr is array(1..10) of Integer;
... | 2018/12/08 | [
"https://Stackoverflow.com/questions/53686146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8623823/"
] | If you know that you have 10 elements to read, it can be done a little more simply like this:
```
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Hello is
A: array (1..10) of Integer;
begin
for V of A loop
Get(V);
end loop;
for I in A'Range loop
... | Even though this already was answered, I'd like to add a couple improvements to Jere's answer.
It is more Ada-like to terminate the recursion using End\_Of\_File rather than an exception. Plus, it makes the program clearer.
Also, using tail-call recursion instead of normal recursion allows the compiler to perform som... |
37,837,043 | How can I remove elements from a webview. I mean, I need to remove sidebar, so is there any way to remove the whole tag of sidebar from HTML? Thanks. | 2016/06/15 | [
"https://Stackoverflow.com/questions/37837043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4174267/"
] | One practical approach is to use JavaScript injection in one or another way. In particular you can consider using the [`InvokeScriptAsync`](https://msdn.microsoft.com/ru-ru/library/windows/apps/windows.ui.xaml.controls.webview.invokescriptasync.aspx) method to run whatever JavaScript code you want.
```
var script = 'v... | You can read HTML source, edit it content as you like and use [NavigateToString](https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.navigatetostring.aspx) instead of [Navigate](https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.navigate.aspx) |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | I'm going to assume that you know basic things about compactness. And give you two steps to begin with.
1. If $A$ is a closed and bounded set, then it is compact. Prove, even in general, that a compact metric space is *always* the closure of a countable set (or in other words, a compact metric space is always countabl... | Hint: $A$ contains a countable dense subset. |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | I'm going to assume that you know basic things about compactness. And give you two steps to begin with.
1. If $A$ is a closed and bounded set, then it is compact. Prove, even in general, that a compact metric space is *always* the closure of a countable set (or in other words, a compact metric space is always countabl... | Let $\mathcal I\_1$ be the set of unit length intervals with endpoints at the integers.
Let $\mathcal I\_2$ be the set of half unit length intervals with endpoints at the half-integers.
Let $\mathcal I\_3$ be the set of quarter unit length intervals with endpoints at the quarter-integers.
…
Let $\mathcal I\_n$ be t... |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | I'm going to assume that you know basic things about compactness. And give you two steps to begin with.
1. If $A$ is a closed and bounded set, then it is compact. Prove, even in general, that a compact metric space is *always* the closure of a countable set (or in other words, a compact metric space is always countabl... | First suppose $K\subseteq M$ is a compact subset of $\textit {any}$ metric space $M$.
For $n\in \mathbb N$, we have the open cover
$\mathcal A'\_{n}=\left \{ B\_{1/n}(x) \right \}\_{x\in K}$
from which we can extract a finite subcover $\mathcal A\_{n}=\left \{ B\_{1/n}(x\_{ni}) \right \}\_{1\leq i\leq J\_{n}}$ wher... |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | Let $\mathcal I\_1$ be the set of unit length intervals with endpoints at the integers.
Let $\mathcal I\_2$ be the set of half unit length intervals with endpoints at the half-integers.
Let $\mathcal I\_3$ be the set of quarter unit length intervals with endpoints at the quarter-integers.
…
Let $\mathcal I\_n$ be t... | Hint: $A$ contains a countable dense subset. |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | First suppose $K\subseteq M$ is a compact subset of $\textit {any}$ metric space $M$.
For $n\in \mathbb N$, we have the open cover
$\mathcal A'\_{n}=\left \{ B\_{1/n}(x) \right \}\_{x\in K}$
from which we can extract a finite subcover $\mathcal A\_{n}=\left \{ B\_{1/n}(x\_{ni}) \right \}\_{1\leq i\leq J\_{n}}$ wher... | Hint: $A$ contains a countable dense subset. |
1,383,558 | Let $X$ be a random day of the week, coded so that Monday is 1, Tuesday is 2,
etc. (so $X$ takes values 1, 2,..., 7, with equal probabilities). Let $Y$ be the next day after $X$ (again represented as an integer between 1 and 7). Do $X$ and $Y$ have the same distribution? What is $P(X < Y )$? | 2015/08/03 | [
"https://math.stackexchange.com/questions/1383558",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258445/"
] | First suppose $K\subseteq M$ is a compact subset of $\textit {any}$ metric space $M$.
For $n\in \mathbb N$, we have the open cover
$\mathcal A'\_{n}=\left \{ B\_{1/n}(x) \right \}\_{x\in K}$
from which we can extract a finite subcover $\mathcal A\_{n}=\left \{ B\_{1/n}(x\_{ni}) \right \}\_{1\leq i\leq J\_{n}}$ wher... | Let $\mathcal I\_1$ be the set of unit length intervals with endpoints at the integers.
Let $\mathcal I\_2$ be the set of half unit length intervals with endpoints at the half-integers.
Let $\mathcal I\_3$ be the set of quarter unit length intervals with endpoints at the quarter-integers.
…
Let $\mathcal I\_n$ be t... |
6,393,073 | I've read a lot of examples on locking threads.. but why should you lock them?
From my understanding, when you initiate threads without joining them, they will compete with the main thread and all other threads for resources and then execute, sometimes simultaneously, sometimes not.
Does locking ensure that threads DO... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6393073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/747254/"
] | A lock allows you to force multiple threads to access a resource one at a time, rather than all of them trying to access the resource simultaneously.
As you note, usually you do want threads to execute simultaneously. However, imagine that you have two threads and they are both writing to the same file. If they try to... | First, locks are designed to protect resources; threads aren't 'locked' or 'unlocked' they /acquire/ a lock (on a resource) and /release/ a lock (on a resource).
You are correct that you want threads to run concurrently as much as possible, but let's take a look at this:
```
y=10
def doStuff( x ):
global y
a... |
66,822,181 | I'm trying to keep my project readable for myself, and I'm trying to create new custom HTML elements.
```js
document.createElement("name", {is: "h2"});
document.createElement("avatar", {is: "img"});
document.createElement("description", {is: "p"});
```
This is how I use them
```js
$(`<avatar class="dropshadow" src=... | 2021/03/26 | [
"https://Stackoverflow.com/questions/66822181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9615988/"
] | `* + *` means 'any element that has a previous sibling' - in other words, is not a first child.
You can refer to this question link:
[CSS selector *+* definition](https://stackoverflow.com/questions/29989318/css-selector-definition#:%7E:text=4%20Answers&text=*%20%2B%20*%20means%20%27any%20element,is%20not%20a%20first%... | `.class` will select specific class
`.class > *` will select all elements with specified class
`.class > * + *` will select all first element of elements that will be children of `.class`
*For Example*
```
<div class="class">
<span>
<h1></h1>
<p></p>
</span>
<span>
<h1></h1>
<p></p>
</span>
... |
22,161,506 | I am making a Wordpress website and some the buttons have a background image, and the image changes on hover. This is done through just simple CSS. When the user first goes to the page and hovers over a button, the space goes blank until the new image loads.
What is the best way to load all the images so it has a smoo... | 2014/03/04 | [
"https://Stackoverflow.com/questions/22161506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3266433/"
] | You can use "Sprite" images for your buttons.
Thus all button, normal bg and hover bg will remain in an image.
And that image will load initially with the button normal state.
For hover, you have to use same sprite image, but different background-position in css. | Make a div with an id of preload that contains all the images you want to have show up when the user hovers over the buttons and put it anywhere in your html (it doesn't matter where)
ex:
```
<div id="preload">
<img src="path/image-01.png" width="1" height="1" alt="Image 01" />
<img src="path/image-02.png" width... |
69,704,010 | I have 2 arrays like below:
```
const array1 = [{name: "1"}, {name: "2"}, {name: "3"}, {name: "4"}, {name: "4"}];
const array2 = [{name: "1"}, {name: "5"}, {name: "3"}, {name: "4"}, {name: "4"}, {name: "4"}, {name: "1"}, {name: "1"}, {name: "2"}];
```
Expected Output is:
```
[{name: "1"}, {name: "2"}, {name: "3"}, ... | 2021/10/25 | [
"https://Stackoverflow.com/questions/69704010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3471509/"
] | Try like following `this.documentItems[itemIndex][name]` :
```js
new Vue({
el: '#demo',
data() {
return {
documentItems: [{id: 1, barcode: 99, product_name: 'aaa'}],
errors: []
}
},
methods: {
checkInput(name, itemIndex){
console.log(this.documentItems[itemIndex])
if(this.docu... | Just remove all `[index]` in your v-model first like this:
```
<tr v-for="(item, index) in documentItems" :key="item.id" class="border-b border-l border-r border-black text-center">
<td>{{index + 1}}.</td>
<td class="">
<div class="flex items-center itemContainer">
<textarea @focusout="checkInput(barcode... |
27,089,841 | I am performing a Load Test using VS, but the results are not saved in SQL Server.
When I run the test, the table `LoadTestRun` is populated with data, but when the test is done, the table `LoadTestTestSummaryData` stays empty.
Let me know if you need more information.
Thank you | 2014/11/23 | [
"https://Stackoverflow.com/questions/27089841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2717226/"
] | This should give you want you want:
```
var3 = var
var3['root'][0].update(var2['root'][0])
```
Although I'm not sure why the `value` at the key `'root'` is a list with a single `dict` element.
If this isn't necessary, it'd be a lot cleaner if the `value` was just the `dict` itself, then you can do:
```
var3 = va... | This is not a JSON question, but a Python dict() one, since the output of `json.loads()` is a dictionary. What you really want is a way to combine 2 dictionaries. To create the desired result, you can do this
```
var3['root'] = var1.update(var2['root'])
```
Cheers! |
6,109,810 | I want to use InterlockedExchange from the WinAPI to use a lock free synchronization of threads.
At the moment I have a class like this.
```
struct DataExchange
{
volatile LONG m_value;
void SetValue(LONG newVal)
{
InterlockedExchange(&m_value, newVal);
}
LONG GetValue()
{
L... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264338/"
] | No there isn't unless you can fit your struct into 32 bits, in which case you can continue to use InterlockedExchange. | Only if the struct is exactly 32 bits.
An alternative is to use an InterlockedExchange on a pointer to a struct. The struct has to be immutable (or never change it). To update the struct, make a new one and then exchange the pointer. You have to be careful about destroying the struct to make sure it is only done once,... |
6,109,810 | I want to use InterlockedExchange from the WinAPI to use a lock free synchronization of threads.
At the moment I have a class like this.
```
struct DataExchange
{
volatile LONG m_value;
void SetValue(LONG newVal)
{
InterlockedExchange(&m_value, newVal);
}
LONG GetValue()
{
L... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264338/"
] | No there isn't unless you can fit your struct into 32 bits, in which case you can continue to use InterlockedExchange. | The best you can do is to use [`InitializeCriticalSectionAndSpinCount`](http://msdn.microsoft.com/en-us/library/ms683476%28VS.85%29.aspx) function which will not wait for the lock if it is possible to take an ownership fast enough. |
6,109,810 | I want to use InterlockedExchange from the WinAPI to use a lock free synchronization of threads.
At the moment I have a class like this.
```
struct DataExchange
{
volatile LONG m_value;
void SetValue(LONG newVal)
{
InterlockedExchange(&m_value, newVal);
}
LONG GetValue()
{
L... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264338/"
] | No there isn't unless you can fit your struct into 32 bits, in which case you can continue to use InterlockedExchange. | You can get an atomic operation on a 64-bit value using [InterlockedExchange64](http://msdn.microsoft.com/en-us/library/ms683593%28v=vs.85%29.aspx) on 64-bit platforms and Windows Vista/7. That would be enough to fit two 32-bit `int` values in a struct.
Since the function is implemented with a complier instrinsic, it'... |
6,109,810 | I want to use InterlockedExchange from the WinAPI to use a lock free synchronization of threads.
At the moment I have a class like this.
```
struct DataExchange
{
volatile LONG m_value;
void SetValue(LONG newVal)
{
InterlockedExchange(&m_value, newVal);
}
LONG GetValue()
{
L... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264338/"
] | You can get an atomic operation on a 64-bit value using [InterlockedExchange64](http://msdn.microsoft.com/en-us/library/ms683593%28v=vs.85%29.aspx) on 64-bit platforms and Windows Vista/7. That would be enough to fit two 32-bit `int` values in a struct.
Since the function is implemented with a complier instrinsic, it'... | Only if the struct is exactly 32 bits.
An alternative is to use an InterlockedExchange on a pointer to a struct. The struct has to be immutable (or never change it). To update the struct, make a new one and then exchange the pointer. You have to be careful about destroying the struct to make sure it is only done once,... |
6,109,810 | I want to use InterlockedExchange from the WinAPI to use a lock free synchronization of threads.
At the moment I have a class like this.
```
struct DataExchange
{
volatile LONG m_value;
void SetValue(LONG newVal)
{
InterlockedExchange(&m_value, newVal);
}
LONG GetValue()
{
L... | 2011/05/24 | [
"https://Stackoverflow.com/questions/6109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/264338/"
] | You can get an atomic operation on a 64-bit value using [InterlockedExchange64](http://msdn.microsoft.com/en-us/library/ms683593%28v=vs.85%29.aspx) on 64-bit platforms and Windows Vista/7. That would be enough to fit two 32-bit `int` values in a struct.
Since the function is implemented with a complier instrinsic, it'... | The best you can do is to use [`InitializeCriticalSectionAndSpinCount`](http://msdn.microsoft.com/en-us/library/ms683476%28VS.85%29.aspx) function which will not wait for the lock if it is possible to take an ownership fast enough. |
27,755,535 | I have a c# desktop app.
I load a DLL using reflection. The DLL is loaded as bytes.
I need to bind to the event in the DLL.
The eventInfo is null.
This is my code:
//in my DLL
```
namespace injectdll
{
public class Class1
{
public delegate void delResponseEvent(string message);
public stat... | 2015/01/03 | [
"https://Stackoverflow.com/questions/27755535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/846281/"
] | First thing to know when using `Reflection` methods that starts with `Get` is that they use `BindingFlags` combination to determine which members should be returned and the default is `instance` and `public` members. Now, since your method and the event is `static` and `public` so you need to specify those flags:
```
... | Try overload with `BindingFlags` to search for **static** events.
```
var eventInfo = program.GetType().GetEvent("ResponseEvent",BindingFlags.Static);
```
or
```
var eventInfo = program.GetType().GetEvent("ResponseEvent",BindingFlags.Static|BindingFlags.Instance);
``` |
72,360 | I am going to Amsterdam on Vueling. On the boarding pass it is written **AMS** as destination, but I don't know which airport that is. I was planning some trips using <http://www.ns.nl/en> and that website is giving me two options when writing *airport*
[. Search engines usually let you search either by the airport name directly, or by the city.
The airport name is sometimes given as one, sometimes as the other, most of the time... | The two items you see in the selection list are alternate names for the same station. Try asking for the schedule for trips from *Amsterdam Airport* to *Schiphol Airport* and you'll see what I mean. The site is unable to provide them.
Alternately, compare the schedules for trips between one airport and another station... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | Try first to reload ALSA:
```
sudo alsa force-reload
```
If that won't help, try to reinstall ALSA and pulseaudio:
```
sudo apt-get remove --purge alsa-base pulseaudio
sudo apt-get install alsa-base pulseaudio
``` | Follow all the process described here : <http://www.unixmen.com/2012003-howto-resolve-nosound-problem-on-ubuntu/> (I solved my problem using the Sound Manager and selecting the correct output) |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | Follow all the process described here : <http://www.unixmen.com/2012003-howto-resolve-nosound-problem-on-ubuntu/> (I solved my problem using the Sound Manager and selecting the correct output) | I had no sound on headphones jack, but when I tried above to remove alsa and re-install I lost the sound completely instead!
Reinstalling the operating system it will sort the problem out for sure but I think it has to do with the installation of Skype from ubuntu repositories. I have done a fresh install and after in... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | None of the above worked for me on my Ubuntu 14.04. I had a fresh reinstall due to video problems, keeping my home folder alone. Then after a few shutdowns, BAM no sound! Tried all of the above solutions.
[Sound Troubleshooting Procedure](https://help.ubuntu.com/community/SoundTroubleshootingProcedure), worked like a ... | I had a similar problem and I fix it trough alsamixer settings. Enter alsamixer in terminal and then change channel from 2ch to 4ch. |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | Try first to reload ALSA:
```
sudo alsa force-reload
```
If that won't help, try to reinstall ALSA and pulseaudio:
```
sudo apt-get remove --purge alsa-base pulseaudio
sudo apt-get install alsa-base pulseaudio
``` | I had no sound on headphones jack, but when I tried above to remove alsa and re-install I lost the sound completely instead!
Reinstalling the operating system it will sort the problem out for sure but I think it has to do with the installation of Skype from ubuntu repositories. I have done a fresh install and after in... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | **Reinstall Alsa and Pulse Audio**
Try to reinstall pulse audio and Alsa, open terminal and enter the following commands:
Purge Alsa and Pulse audio using the command:
```
sudo apt-get remove --purge alsa-base pulseaudio
```
Now install again Alsa and Pulse Audio:
```
sudo apt-get install alsa-base pulseaudio
``... | Follow all the process described here : <http://www.unixmen.com/2012003-howto-resolve-nosound-problem-on-ubuntu/> (I solved my problem using the Sound Manager and selecting the correct output) |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | In my case, this problem occurs because of my system start using intel sound driver. Which was not compatible with my Dell laptop.
So, I choose 'Do not use the device' and restart my system and problem gone.
Simply follow these steps...
[](https://i.... | I had no sound on headphones jack, but when I tried above to remove alsa and re-install I lost the sound completely instead!
Reinstalling the operating system it will sort the problem out for sure but I think it has to do with the installation of Skype from ubuntu repositories. I have done a fresh install and after in... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | **Reinstall Alsa and Pulse Audio**
Try to reinstall pulse audio and Alsa, open terminal and enter the following commands:
Purge Alsa and Pulse audio using the command:
```
sudo apt-get remove --purge alsa-base pulseaudio
```
Now install again Alsa and Pulse Audio:
```
sudo apt-get install alsa-base pulseaudio
``... | In my case, this problem occurs because of my system start using intel sound driver. Which was not compatible with my Dell laptop.
So, I choose 'Do not use the device' and restart my system and problem gone.
Simply follow these steps...
[](https://i.... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | **Reinstall Alsa and Pulse Audio**
Try to reinstall pulse audio and Alsa, open terminal and enter the following commands:
Purge Alsa and Pulse audio using the command:
```
sudo apt-get remove --purge alsa-base pulseaudio
```
Now install again Alsa and Pulse Audio:
```
sudo apt-get install alsa-base pulseaudio
``... | I had no sound on headphones jack, but when I tried above to remove alsa and re-install I lost the sound completely instead!
Reinstalling the operating system it will sort the problem out for sure but I think it has to do with the installation of Skype from ubuntu repositories. I have done a fresh install and after in... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | None of the above worked for me on my Ubuntu 14.04. I had a fresh reinstall due to video problems, keeping my home folder alone. Then after a few shutdowns, BAM no sound! Tried all of the above solutions.
[Sound Troubleshooting Procedure](https://help.ubuntu.com/community/SoundTroubleshootingProcedure), worked like a ... | I had no sound on headphones jack, but when I tried above to remove alsa and re-install I lost the sound completely instead!
Reinstalling the operating system it will sort the problem out for sure but I think it has to do with the installation of Skype from ubuntu repositories. I have done a fresh install and after in... |
469,834 | I've managed to install Ubuntu 14.04 on my new Samsung ATIV Book 9 Lite ultrabook. After updating some configuratiosn in the UEFI installation was very easy. The only questions and issue I believe I'm still experience is when booting.
I believe when the laptop would be displaying the grub boot options I see the follow... | 2014/05/20 | [
"https://askubuntu.com/questions/469834",
"https://askubuntu.com",
"https://askubuntu.com/users/-1/"
] | None of the above worked for me on my Ubuntu 14.04. I had a fresh reinstall due to video problems, keeping my home folder alone. Then after a few shutdowns, BAM no sound! Tried all of the above solutions.
[Sound Troubleshooting Procedure](https://help.ubuntu.com/community/SoundTroubleshootingProcedure), worked like a ... | Follow all the process described here : <http://www.unixmen.com/2012003-howto-resolve-nosound-problem-on-ubuntu/> (I solved my problem using the Sound Manager and selecting the correct output) |
15,613,088 | I am using wget in my windows PC to download files from an ftp server. But it downloads files into a folder where wget.exe is located. But i want it to download files to another folder.How it can be done?( i saw some links which i guess works only in linux). | 2013/03/25 | [
"https://Stackoverflow.com/questions/15613088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1997066/"
] | This is only fot that field? The format of datetime is based on user options. If it's only for that field see this [answer](https://stackoverflow.com/questions/7274115/crm-2011-set-datetime-field-from-string-with-javascript). | I suspect that the date-time field is formatted according to the system settings (be that picked from CRM or the user's computer). Not sure if it's editable other than that. I'll take a look at it later today.
In case it's not possible to customize the date format of a single field you've got three options (listed in ... |
1,231,259 | **System**: Acer Aspire 5542 laptop using legacy mode (UEFI is not available).
**Processor**: AMD Athlon II X2 M300
**Graphics**: ATI Radeon HD 4200
**Memory**: 4 GB
This system is currently running Xubuntu 18.04.4 LTS perfectly OK.
I decided to do a clean **Xubuntu 20.04** install on an external USB hard di... | 2020/04/26 | [
"https://askubuntu.com/questions/1231259",
"https://askubuntu.com",
"https://askubuntu.com/users/362910/"
] | I had the same problem. What worked for me was to downgrade the NVIDIA driver to version 390. | Check in the NVIDIA Server. If it is empty, this implies your video graphics card (NVIDIA) is not being loaded. if so, reboot your system and while booting stop at the grub system and press `e` to change to edit mode.
You should see some line that starts with `Linux`. In that line, if `nomodeset` is written, remove it... |
38,354,193 | I'm trying to set the tab bar to have a different background image on each view controller.
```
class CharacterVC: UIViewController {
var tabBarApparence = UITabBar.appearance()
override func viewDidLoad() {
super.viewDidLoad()
tabBarApparence.backgroundImage = UIImage(named: "BlueTB") //Loaded from Image ... | 2016/07/13 | [
"https://Stackoverflow.com/questions/38354193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5399099/"
] | If you want to change appearance of TabBar in a view controller is very easy. You can this in function viewDidLoad or viewWillAppear. The code is the next:
```
// Set color of titles and icons in tabBar
self.tabBarController?.tabBar.tintColor = UIColor.redColor()
// Set color of background tabBar
self.tabBarController... | 1. Replace code to `viewWillAppear()`
2. Better set backgroundImage to tabBar, not to `UITabBar.appearance()` |
50,246,614 | As an input xml example I have
```
<Elem1>
<Obj name="1">
<Obj name="2">
<Obj name="3">
</Elem1>
```
Using a xslt rule I would like to obtain something like below
```
<Elem1>
<Obj1 name="1">
<Obj2 name="2">
<Obj3 name="3">
</Elem1>
```
Basically if the name of the child elements are the sa... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50246614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9762748/"
] | Try this
```
<xsl:template match="*[@name][count(../*[name() = current()/name()]) > 1]">
<xsl:element name="{name()}{@name}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
```
For copy other data use identity transform as
```
<xsl:template match="node() | @*">
<xsl:co... | [Rupesh\_Kr](https://stackoverflow.com/users/7533349/rupesh-kr) answer is very general and works in any situation.
However, if you want to use a specific `xpath` under which you only want to change the nodes based on your rule, then you can use the following `stylesheet`
**INPUT:**
```
<?xml version="1.0"?>
<Elems>
... |
50,246,614 | As an input xml example I have
```
<Elem1>
<Obj name="1">
<Obj name="2">
<Obj name="3">
</Elem1>
```
Using a xslt rule I would like to obtain something like below
```
<Elem1>
<Obj1 name="1">
<Obj2 name="2">
<Obj3 name="3">
</Elem1>
```
Basically if the name of the child elements are the sa... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50246614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9762748/"
] | Try this
```
<xsl:template match="*[@name][count(../*[name() = current()/name()]) > 1]">
<xsl:element name="{name()}{@name}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
```
For copy other data use identity transform as
```
<xsl:template match="node() | @*">
<xsl:co... | Refining Rupesh's fine answer with a key in XSLT 2 or 3 you can use
```
<xsl:key name="group-by-name" match="*[@name]" use="node-name(.)"/>
<xsl:template match="*[@name and key('group-by-name', node-name(.), ..)[2]]">
<xsl:element name="{name()}{@name}" namespace="{namespace-uri()}">
<xsl:apply-te... |
50,246,614 | As an input xml example I have
```
<Elem1>
<Obj name="1">
<Obj name="2">
<Obj name="3">
</Elem1>
```
Using a xslt rule I would like to obtain something like below
```
<Elem1>
<Obj1 name="1">
<Obj2 name="2">
<Obj3 name="3">
</Elem1>
```
Basically if the name of the child elements are the sa... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50246614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9762748/"
] | Try this
```
<xsl:template match="*[@name][count(../*[name() = current()/name()]) > 1]">
<xsl:element name="{name()}{@name}">
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
```
For copy other data use identity transform as
```
<xsl:template match="node() | @*">
<xsl:co... | ```
<xsl:template match="Elem1">
<xsl:element name="Elem1">
<xsl:for-each select="Obj">
<xsl:element name="{concat(local-name(),position())}">
<xsl:apply-templates select="@*"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
... |
50,246,614 | As an input xml example I have
```
<Elem1>
<Obj name="1">
<Obj name="2">
<Obj name="3">
</Elem1>
```
Using a xslt rule I would like to obtain something like below
```
<Elem1>
<Obj1 name="1">
<Obj2 name="2">
<Obj3 name="3">
</Elem1>
```
Basically if the name of the child elements are the sa... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50246614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9762748/"
] | [Rupesh\_Kr](https://stackoverflow.com/users/7533349/rupesh-kr) answer is very general and works in any situation.
However, if you want to use a specific `xpath` under which you only want to change the nodes based on your rule, then you can use the following `stylesheet`
**INPUT:**
```
<?xml version="1.0"?>
<Elems>
... | ```
<xsl:template match="Elem1">
<xsl:element name="Elem1">
<xsl:for-each select="Obj">
<xsl:element name="{concat(local-name(),position())}">
<xsl:apply-templates select="@*"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
... |
50,246,614 | As an input xml example I have
```
<Elem1>
<Obj name="1">
<Obj name="2">
<Obj name="3">
</Elem1>
```
Using a xslt rule I would like to obtain something like below
```
<Elem1>
<Obj1 name="1">
<Obj2 name="2">
<Obj3 name="3">
</Elem1>
```
Basically if the name of the child elements are the sa... | 2018/05/09 | [
"https://Stackoverflow.com/questions/50246614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9762748/"
] | Refining Rupesh's fine answer with a key in XSLT 2 or 3 you can use
```
<xsl:key name="group-by-name" match="*[@name]" use="node-name(.)"/>
<xsl:template match="*[@name and key('group-by-name', node-name(.), ..)[2]]">
<xsl:element name="{name()}{@name}" namespace="{namespace-uri()}">
<xsl:apply-te... | ```
<xsl:template match="Elem1">
<xsl:element name="Elem1">
<xsl:for-each select="Obj">
<xsl:element name="{concat(local-name(),position())}">
<xsl:apply-templates select="@*"/>
</xsl:element>
</xsl:for-each>
</xsl:element>
... |
19,648,833 | I am trying to draw an image to a JPanel in java and I have that down, good. My problem now is I am attemping to make it scale to the full size of the window, but it is not doing so. I have tried methods, and they either make the image disappear, or there is no graphical change at all.
The code I am currently working ... | 2013/10/29 | [
"https://Stackoverflow.com/questions/19648833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2896866/"
] | Let's say that this is your `Activity` that contains `DetailsPlacesFragment`
```
================================================================
| | |
| ListView | FrameLayout |
| | ... | You should use your Activity as a mediator between the two fragments. What I would do is create an interface that the activity will implement like PlaceClickListener:
```
public interface PlaceClickListener{
public void onPlaceClicked(int index);
}
```
In your activity, you have to implement it:
```
class MainA... |
29,414,020 | I have a tab control on my form. I prompt the user through user input (using the Visual Basic library) how many pockets does the header have. The number in the textbox generates that many number of tabs.
**Question**
How do I add textboxes when new tabs are generated? Since the number is unknown until I tell it, it ... | 2015/04/02 | [
"https://Stackoverflow.com/questions/29414020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4430188/"
] | [Tab Selecting Event](https://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selecting%28v=vs.110%29.aspx):This explains the Tab Selecting Event, you can then use this to dynamically generate the textbox you need on the tab that is being selected.
[How to dynamically add a textbox](https://msdn.micro... | Get the current TabPage and add the textbox to the tabpage.
```
TabPage current = tabControl1.TabPages[i-1];
current.Controls.Add(txt);
```
Or in 1 statement:
```
tabControl1.TabPages[i-1].Controls.Add(txt);
``` |
58,158,363 | This is my homework question:
>
> Add the symbols to the links. To do that, use the background-image, background-
> repeat, and background-position properties as shown in figure 5-11. The symbol is in
> the images file, and it is named right.jpg. In this case, you don’t want to repeat the
> image, and you want to ... | 2019/09/29 | [
"https://Stackoverflow.com/questions/58158363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10241961/"
] | The background image should be on the `li` element, rather than the parent `ul`.
Also, you can position the background image via X and Y axis in the same property.
```
#nav_list ul {
list-style: none;
margin-left: 1.25em;
margin-bottom: 1.5em;
}
#nav_list ul li {
width: 200px;
margin-bottom: .5em;
borde... | Use a small "Arrow" image (for example 32x32 px) for the LI element. To be sure to see the arrow give the A element a transparent background. Also give the A some padding on the right side to prevent text will be over the arrow.
```
#nav_list ul {
list-style: none;
margin-left: 1.25em;
margin-bottom: 1.5em;
}
#... |
13,233,676 | I'm using SQL Server 2005.
I have a problems with executing SQL statements like this
```
DECLARE @Param1 BIT
SET @Param1 = 1
SELECT
t1.Col1,
t1.Col2
FROM
Table1 t1
WHERE
@Param1=0 OR
(t1.Col2 in
(SELECT t2.Col4
FROM
Table2 t2
WHERE
... | 2012/11/05 | [
"https://Stackoverflow.com/questions/13233676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1800248/"
] | Well, the explanation seems simple enough. For your current condition, since `@Param1=0` is false (you set the parameter to 1 previously), it needs to evaluate your second condition, wich has a subquery and might take a long time. If you change your first filter to `@Param1=1`, then you are saying that it is true and t... | You seem to be confusing the optimiser with your OR statement. If you remove it, you should find it generates two different execution plans for the SELECT statement - one with a filter, and the other without:
```
DECLARE @Param1 BIT
SET @Param1 = 1
if @Param1=0
begin
SELECT
t1.Col1,
t1.Col2
F... |
13,233,676 | I'm using SQL Server 2005.
I have a problems with executing SQL statements like this
```
DECLARE @Param1 BIT
SET @Param1 = 1
SELECT
t1.Col1,
t1.Col2
FROM
Table1 t1
WHERE
@Param1=0 OR
(t1.Col2 in
(SELECT t2.Col4
FROM
Table2 t2
WHERE
... | 2012/11/05 | [
"https://Stackoverflow.com/questions/13233676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1800248/"
] | Well, the explanation seems simple enough. For your current condition, since `@Param1=0` is false (you set the parameter to 1 previously), it needs to evaluate your second condition, wich has a subquery and might take a long time. If you change your first filter to `@Param1=1`, then you are saying that it is true and t... | This is commonly referred to as the N+1 problem.
You're doing a select in table 1 and for each record you find you will go look for something in table 2.
By setting your @Param1 to an value which will never be found in your select the sql engine will skip the subquery.
To avoid this behavior you could use a JO... |
41,613,518 | I have this segment of code selecting **one** column from a table which works fine:
```
db.Database.SqlQuery<string>("select Col1 from ....).ToList();
```
However, as expected when trying to select more than one column it errors as the result structure is incorrect.
I've tried the following:
```
db.Database.SqlQue... | 2017/01/12 | [
"https://Stackoverflow.com/questions/41613518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347816/"
] | Was facing the same issue in my code, and it turned out that *beginning* the write transaction was triggering a collection notification that in turn created a new RLMResults and added a notification block to it, which means I was calling `addNotificationBlock` inside of a write transaction and crashing.
If you can rep... | It seems that you are mutating `messages` in the `forEach`, this might be the cause of crash.
Try something like this:
```
let realm = try Realm()
let allMessages = realm.objects(Message.self)
let results = allMessages.filter("(state == 1) AND (dateSent <= %@)", dateSent)
let messages = Array(results)
try realm.writ... |
41,613,518 | I have this segment of code selecting **one** column from a table which works fine:
```
db.Database.SqlQuery<string>("select Col1 from ....).ToList();
```
However, as expected when trying to select more than one column it errors as the result structure is incorrect.
I've tried the following:
```
db.Database.SqlQue... | 2017/01/12 | [
"https://Stackoverflow.com/questions/41613518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347816/"
] | Was facing the same issue in my code, and it turned out that *beginning* the write transaction was triggering a collection notification that in turn created a new RLMResults and added a notification block to it, which means I was calling `addNotificationBlock` inside of a write transaction and crashing.
If you can rep... | I think you just need to move the queries into the transaction.
```
let realm = try Realm()
try realm.write ({
let allMessages = realm.objects(Message.self)
let messages = allMessages.filter("(state == 1) AND (dateSent <= %@)", dateSent)
messages.forEach { message in message.state = .seen }
})
``` |
41,613,518 | I have this segment of code selecting **one** column from a table which works fine:
```
db.Database.SqlQuery<string>("select Col1 from ....).ToList();
```
However, as expected when trying to select more than one column it errors as the result structure is incorrect.
I've tried the following:
```
db.Database.SqlQue... | 2017/01/12 | [
"https://Stackoverflow.com/questions/41613518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4347816/"
] | Was facing the same issue in my code, and it turned out that *beginning* the write transaction was triggering a collection notification that in turn created a new RLMResults and added a notification block to it, which means I was calling `addNotificationBlock` inside of a write transaction and crashing.
If you can rep... | This can happen if you are doing findAllAsync inside a change listener
<https://github.com/realm/realm-java/issues/5771#issuecomment-442004078>
I've handled the queries with async/await and everything is good now. |
60,619,891 | Assuming we have the next code in the **App.js**,
```
console.log(`This is the port ${process.env.PORT}`);
```
Is there a way to access to the value of PORT outside the runtime process? | 2020/03/10 | [
"https://Stackoverflow.com/questions/60619891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12985243/"
] | No! squeeze doesn't respect the batch dimension. It's a potential source of error if you use squeeze when the batch dimension may be 1. Rule of thumb is that only classes and functions in torch.nn respect batch dimensions by default.
This has caused me headaches in the past. **I recommend using `reshape` or only using... | Accepted answer is sufficient for the problem - to `squeeze` last dimension. However, I had tensor of dimension `(batch, 1280, 1, 1)` and wanted `(batch, 1280)`. `Squeeze` function didn't allow for that - `squeeze(tensor, 1).shape` -> `(batch, 1280, 1, 1)` and `squeeze(tensor, 2).shape` -> `(batch, 1280, 1)`. I could h... |
72,182,542 | I have an enum like this:
```
public enum DocumentType {
A,
B,
C,
D;
}
```
I want a list like this:
```
1 A
2 B
3 C
4 D
``` | 2022/05/10 | [
"https://Stackoverflow.com/questions/72182542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16633119/"
] | ```
public class EnumId {
public enum DocumentType {
A(1), B(2), C(3), D(4);
final int id;
DocumentType(int id) {
this.id = id;
}
int getId() {
return this.id;
}
}
public static void main(String[] args) {
for (DocumentType d... | Since you want to return this in a response you could do something like this:
```java
public String yourEndpoit() {
final DocumentType[] values = DocumentType.values();
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < values.length; i++) {
builder.append(i)
.a... |
72,182,542 | I have an enum like this:
```
public enum DocumentType {
A,
B,
C,
D;
}
```
I want a list like this:
```
1 A
2 B
3 C
4 D
``` | 2022/05/10 | [
"https://Stackoverflow.com/questions/72182542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16633119/"
] | ```
public class EnumId {
public enum DocumentType {
A(1), B(2), C(3), D(4);
final int id;
DocumentType(int id) {
this.id = id;
}
int getId() {
return this.id;
}
}
public static void main(String[] args) {
for (DocumentType d... | You can even use `ordinal` & `name` methods available in `Enum`; this don't need you to modify anything in existing `DocumentType` :
```
for(DocumentType e:DocumentType.values()) {
System.out.println((e.ordinal()+1)+" "+e.name());
}
```
Output:
```
1 A
2 B
3 C
4 D
``` |
72,182,542 | I have an enum like this:
```
public enum DocumentType {
A,
B,
C,
D;
}
```
I want a list like this:
```
1 A
2 B
3 C
4 D
``` | 2022/05/10 | [
"https://Stackoverflow.com/questions/72182542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16633119/"
] | ```
public class EnumId {
public enum DocumentType {
A(1), B(2), C(3), D(4);
final int id;
DocumentType(int id) {
this.id = id;
}
int getId() {
return this.id;
}
}
public static void main(String[] args) {
for (DocumentType d... | A solution that leverages method declarations within enumerated types:
```java
public enum DocumentType {
A, B, C, D;
public String asListItem() {
return String.format("%d %s", ordinal()+1, name());
}
public static String toList() {
return Arrays.stream(values())
.map(... |
23,560,021 | Imagine I'm sorting my rows based on a rating, and I want just a certain amount based on the total amount of the rows exposed (which varies every now and then, so it should be calculated on the way). Here's the subquery showing every row, and the creepy trick I tried to use with no success:
```
SELECT (
SELECT
... | 2014/05/09 | [
"https://Stackoverflow.com/questions/23560021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616225/"
] | The percentage CPU being used is irrelevant, for most cases. Your app will be killed if it takes too long to start up, which is time spent loading the storyboard, but it's *time* that matters, not CPU load as such. Unless you're pegging at 100%, don't worry about it.
Test on the device - if it launches, you're fine. ... | It shouldn't crash. If its taking loads out of your CPU, pop up a loading screen, load offscreen, and delegate back to your main and continue onward. An app shouldn't crash loading storyboards. |
27,701,802 | USing the below code works correctly, however if I use a search term like "Weather in Florida", it opens 5 tabs, all with the exact same search URL. The search URL looks like this "<https://www.google.com/search?q=weather+in+florida>", so it seems like it's getting passed correctly, I'm just not sure why multiple tabs ... | 2014/12/30 | [
"https://Stackoverflow.com/questions/27701802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114503/"
] | This is working fine on my machine. You should check the extensions of Chrome.
Due to some extensions this problem may occurs. | Ah, I found the problem. Was actually a loop that I was using, and the code was looping 5 times because I didn't have an if returning properly. It does work correctly, as Chetan mentioned. |
75,947 | When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here](http://twitpic.com/bud1 "IE7 dithering"). In this image, the dark background and background image should be both #001122, and the medium backgr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | IE has a known bug with PNG gamma info, though I thought they had fixed it in version 7 :-?
I remove the gamma info from PNG files using "PNG Crush". I've created a right-click shortcut in Windows explorer. Further info: [using pngcrush in windows](http://www.weirdlooking.com/blog/64) | I think this has to do with Gamma correction. Take a look at this
<http://www.hanselman.com/blog/GammaCorrectionAndColorCorrectionPNGIsStillTooHard.aspx> |
75,947 | When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here](http://twitpic.com/bud1 "IE7 dithering"). In this image, the dark background and background image should be both #001122, and the medium backgr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | I think this has to do with Gamma correction. Take a look at this
<http://www.hanselman.com/blog/GammaCorrectionAndColorCorrectionPNGIsStillTooHard.aspx> | Additional resource on this issue: <http://www.modernblue.com/web-design-blog/tweak-that-gamma/> |
75,947 | When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here](http://twitpic.com/bud1 "IE7 dithering"). In this image, the dark background and background image should be both #001122, and the medium backgr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | IE has a known bug with PNG gamma info, though I thought they had fixed it in version 7 :-?
I remove the gamma info from PNG files using "PNG Crush". I've created a right-click shortcut in Windows explorer. Further info: [using pngcrush in windows](http://www.weirdlooking.com/blog/64) | Additional resource on this issue: <http://www.modernblue.com/web-design-blog/tweak-that-gamma/> |
75,947 | When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here](http://twitpic.com/bud1 "IE7 dithering"). In this image, the dark background and background image should be both #001122, and the medium backgr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | IE has a known bug with PNG gamma info, though I thought they had fixed it in version 7 :-?
I remove the gamma info from PNG files using "PNG Crush". I've created a right-click shortcut in Windows explorer. Further info: [using pngcrush in windows](http://www.weirdlooking.com/blog/64) | An alternative to PNGOUT is TweakPNG. Comes with a GUI and no installer, very easy to remove the gAMA (just right click and delete it!)
<http://entropymine.com/jason/tweakpng/> |
75,947 | When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen [here](http://twitpic.com/bud1 "IE7 dithering"). In this image, the dark background and background image should be both #001122, and the medium backgr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | An alternative to PNGOUT is TweakPNG. Comes with a GUI and no installer, very easy to remove the gAMA (just right click and delete it!)
<http://entropymine.com/jason/tweakpng/> | Additional resource on this issue: <http://www.modernblue.com/web-design-blog/tweak-that-gamma/> |
18,703,525 | I'm working on Python and have defined a variable called "\_headers" as shown below
```
_headers = ('id',
'recipient_address_1',
'recipient_address_2',
'recipient_address_3',
'recipient_address_4',
'recipient_address_5',
'r... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18703525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1345260/"
] | You want `f.write`, not `outfile.write`...
`outfile` is the name of the file as a string. `f` is the file object.
As noted in the comments, `file.write` expects a string, not a sequence. If you wanted to write data from a sequence, you could use `file.writelines`. e.g. `f.writelines(self._headers)`. But beware, this ... | Assuming that you want 1 header per line, try this:
```
with open(outfile, 'w') as f:
f.write('\n'.join(self._headers))
print done
``` |
18,703,525 | I'm working on Python and have defined a variable called "\_headers" as shown below
```
_headers = ('id',
'recipient_address_1',
'recipient_address_2',
'recipient_address_3',
'recipient_address_4',
'recipient_address_5',
'r... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18703525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1345260/"
] | You want `f.write`, not `outfile.write`...
`outfile` is the name of the file as a string. `f` is the file object.
As noted in the comments, `file.write` expects a string, not a sequence. If you wanted to write data from a sequence, you could use `file.writelines`. e.g. `f.writelines(self._headers)`. But beware, this ... | To stay as close to your script as possible:
```
>>> _headers = ('id',
... 'recipient_address_1',
... 'recipient_address_2',
... 'recipient_address_3',
... 'recipient_address_4',
... 'recipient_address_5',
... 'recipient_address_6',
... ... |
18,703,525 | I'm working on Python and have defined a variable called "\_headers" as shown below
```
_headers = ('id',
'recipient_address_1',
'recipient_address_2',
'recipient_address_3',
'recipient_address_4',
'recipient_address_5',
'r... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18703525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1345260/"
] | Assuming that you want 1 header per line, try this:
```
with open(outfile, 'w') as f:
f.write('\n'.join(self._headers))
print done
``` | To stay as close to your script as possible:
```
>>> _headers = ('id',
... 'recipient_address_1',
... 'recipient_address_2',
... 'recipient_address_3',
... 'recipient_address_4',
... 'recipient_address_5',
... 'recipient_address_6',
... ... |
433,484 | Let $(M,g)$ be a compact complete Riemannian manifold. Consider the geodesic quadrupel $ABCD$ where $l:=d(A,B)=d(B,C)=d(C,D)=d(A,D) \geq \frac{1}{2}$ and $d(B,D),d(A,C) \geq 1$. Let $x \in CD$ and $y \in AB$. Is it true that then $d(x,y)\geq \frac{1}{4}$ ? I have tried a lot of things but non of them worked, mostly I t... | 2013/06/30 | [
"https://math.stackexchange.com/questions/433484",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | No (unless you assume something like a lower curvature bound).
Consider two very long segments (say, of length 100) in $\mathbb R^3$ that meet orthogonally at their midpoints. Let $M$ be a smoothened boundary of an $\varepsilon$-neighborhood of the union of these segments. It is a Riemannian manifold invariant under a... | Surface $z = y^2 - x^2$, with proper scaling (say, one scaling per $\epsilon > 0$), will provide counter-examples, with $\frac 14$ replaced by arbitrary $\epsilon > 0$. (Perhaps something like this was suggested by Anton Petrunin in his comment above).
By the way, all four mid-points of "edges" of $A... |
12,197,345 | Here is what I want to do:
```
$newArray = array();
foreach($student as $s){
$newArray[$s->id][$s->grade] = $s;
}
```
I want to sort the students by their grades (more of a group than a sort) but I just want the grades to be sorted not the id. I could have don't this:
```
$newArray[$s->id] = $s->grade
asort($... | 2012/08/30 | [
"https://Stackoverflow.com/questions/12197345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1537158/"
] | *Edit:*
Sine you're working in a framework, best declare your sort callback as a member function (inside the same class as where you'll be needing it, of course):
```
private function sortCB(array $a, array $b)
{//the array type hinting in arguments is optional
$i = array_keys($a);//but highly recommended
$j... | You can do something like:
```
foreach($student as $s){
$newArray[$s->id] = $s;
}
usort($newArray, function ($a, $b) { return $a->grade - $b->grade; });
```
Edit
----
For later versions that don't support anonymous functions you can define comparison function first:
```
function sortByGrade($a, $b)
{
retu... |
10,634,626 | am trying to implement a multiuser communication app. I want to identify a user's socket with his id, so can i set socket's id to user' id like
```
socket.id=user.userId;
``` | 2012/05/17 | [
"https://Stackoverflow.com/questions/10634626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180313/"
] | You can do this, but use property that doesn't clash with Node.js or any other frameworks keys
```
socket.myappsuperuserid = user.userId;
``` | Here
client side
```
var socket = io.connect();
socket.on('connect', function () {
console.log("client connection done.....");
socket.emit('setUserId','random value');
});
```
On server side
```
io.sockets.on('connection', function (socket) {
socket.on('setUserId',function(uId){
... |
10,634,626 | am trying to implement a multiuser communication app. I want to identify a user's socket with his id, so can i set socket's id to user' id like
```
socket.id=user.userId;
``` | 2012/05/17 | [
"https://Stackoverflow.com/questions/10634626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180313/"
] | You can do this, but use property that doesn't clash with Node.js or any other frameworks keys
```
socket.myappsuperuserid = user.userId;
``` | In socket.io when a user connects, socket.io will generate a unique socket.id which basically is a random unique unguessable id. What i'd do is after i connect i call socket.join('userId'). basically here i assign a room to this socket with my userId. Then whenever i want to send something to this user, i'd do like thi... |
10,634,626 | am trying to implement a multiuser communication app. I want to identify a user's socket with his id, so can i set socket's id to user' id like
```
socket.id=user.userId;
``` | 2012/05/17 | [
"https://Stackoverflow.com/questions/10634626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180313/"
] | This may help you
```
io.sockets.on('connection', function (socket) {
console.log("==== socket ===");
console.log(socket.id);
socket.broadcast.emit('updatedid', socket.id);
});
```
you can save socket id in client side. When you want 1-1 message (private chat) use updated socket id. Some thing like ... | Here
client side
```
var socket = io.connect();
socket.on('connect', function () {
console.log("client connection done.....");
socket.emit('setUserId','random value');
});
```
On server side
```
io.sockets.on('connection', function (socket) {
socket.on('setUserId',function(uId){
... |
10,634,626 | am trying to implement a multiuser communication app. I want to identify a user's socket with his id, so can i set socket's id to user' id like
```
socket.id=user.userId;
``` | 2012/05/17 | [
"https://Stackoverflow.com/questions/10634626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180313/"
] | Here
client side
```
var socket = io.connect();
socket.on('connect', function () {
console.log("client connection done.....");
socket.emit('setUserId','random value');
});
```
On server side
```
io.sockets.on('connection', function (socket) {
socket.on('setUserId',function(uId){
... | In socket.io when a user connects, socket.io will generate a unique socket.id which basically is a random unique unguessable id. What i'd do is after i connect i call socket.join('userId'). basically here i assign a room to this socket with my userId. Then whenever i want to send something to this user, i'd do like thi... |
10,634,626 | am trying to implement a multiuser communication app. I want to identify a user's socket with his id, so can i set socket's id to user' id like
```
socket.id=user.userId;
``` | 2012/05/17 | [
"https://Stackoverflow.com/questions/10634626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1180313/"
] | This may help you
```
io.sockets.on('connection', function (socket) {
console.log("==== socket ===");
console.log(socket.id);
socket.broadcast.emit('updatedid', socket.id);
});
```
you can save socket id in client side. When you want 1-1 message (private chat) use updated socket id. Some thing like ... | In socket.io when a user connects, socket.io will generate a unique socket.id which basically is a random unique unguessable id. What i'd do is after i connect i call socket.join('userId'). basically here i assign a room to this socket with my userId. Then whenever i want to send something to this user, i'd do like thi... |
62,770,130 | I need to create filtered browsing of movie titles. A user could search for all movies that have romance,drama genres/tags in them but they must NOT have comedy in them.
```
CREATE TABLE `movies` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
);
CREATE TABLE `ge... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62770130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10117171/"
] | ```
SELECT m.title, GROUP_CONCAT(g.gname) genres
FROM movies m
JOIN genres g
JOIN genres_in_movies gm ON m.id = gm.movie_id AND g.id = gm.genre_id
GROUP BY m.title
HAVING SUM(g.gname = 'Romance') -- must be present
AND NOT SUM(g.gname = 'Comedy') -- must be absent
/* AND SUM(g.gname IN ('Romance', 'Comedy')) ... | Is adding a simple `AND NOT EXISTS` with a subquery helping you?
```
SELECT DISTINCT m.id, m.title, gim.genres
FROM movies m
INNER JOIN genres_in_movies AS inclusionGenres ON inclusionGenres.movie_id = m.id
INNER JOIN (
SELECT movie_id, group_concat(genres.gname) as genres
FROM genres_in_movies
INNER JOIN genres... |
62,770,130 | I need to create filtered browsing of movie titles. A user could search for all movies that have romance,drama genres/tags in them but they must NOT have comedy in them.
```
CREATE TABLE `movies` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
);
CREATE TABLE `ge... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62770130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10117171/"
] | Here's my take:
```
SELECT movie_id, title, group_concat(genres.gname) as genres
FROM genres_in_movies
INNER JOIN genres ON genre_id = genres.id
INNER JOIN movies ON genres_in_movies.movie_id=movies.id
GROUP by movie_id
HAVING FIND_IN_SET('Romance',genres)
AND NOT FIND_IN_SET('Comedy',genres);
```
Bec... | Is adding a simple `AND NOT EXISTS` with a subquery helping you?
```
SELECT DISTINCT m.id, m.title, gim.genres
FROM movies m
INNER JOIN genres_in_movies AS inclusionGenres ON inclusionGenres.movie_id = m.id
INNER JOIN (
SELECT movie_id, group_concat(genres.gname) as genres
FROM genres_in_movies
INNER JOIN genres... |
62,770,130 | I need to create filtered browsing of movie titles. A user could search for all movies that have romance,drama genres/tags in them but they must NOT have comedy in them.
```
CREATE TABLE `movies` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY(`id`)
);
CREATE TABLE `ge... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62770130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10117171/"
] | ```
SELECT m.title, GROUP_CONCAT(g.gname) genres
FROM movies m
JOIN genres g
JOIN genres_in_movies gm ON m.id = gm.movie_id AND g.id = gm.genre_id
GROUP BY m.title
HAVING SUM(g.gname = 'Romance') -- must be present
AND NOT SUM(g.gname = 'Comedy') -- must be absent
/* AND SUM(g.gname IN ('Romance', 'Comedy')) ... | Here's my take:
```
SELECT movie_id, title, group_concat(genres.gname) as genres
FROM genres_in_movies
INNER JOIN genres ON genre_id = genres.id
INNER JOIN movies ON genres_in_movies.movie_id=movies.id
GROUP by movie_id
HAVING FIND_IN_SET('Romance',genres)
AND NOT FIND_IN_SET('Comedy',genres);
```
Bec... |
31,159,835 | Marshaled data is in redis server and I need to access it with PHP. No other options. | 2015/07/01 | [
"https://Stackoverflow.com/questions/31159835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/696933/"
] | As far as I know, there is no deserializer for Ruby's internal Marshal format for PHP. You can write one, of course, [here's the documentation](https://github.com/ruby/ruby/blob/trunk/doc/marshal.rdoc).
Also, it simply might not be possible to represent the Ruby object as a PHP object, if the Ruby object uses features... | You need to use another format (that easier because you don't need to write your own unmarshal library) instead of ruby internal marshalling, something like JSON, XML etc.
Or you can simple execute ruby script from php which unmarshal ruby object. |
51,890,512 | I wanted to make a program that takes the inventory as a dictionary data and prints it with the total at the bottom.
```
# inventory.py
stuff = {"coal":42,"dagger":1,"iron":
20,"torch":2}
total_items = 0
def display_inventory(inventory):
for k,v in inventory.items():
print(k,v)
... | 2018/08/17 | [
"https://Stackoverflow.com/questions/51890512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10225706/"
] | You can use string format, code looks elegant more details is here <https://www.programiz.com/python-programming/methods/string/format>
```
# inventory.py
stuff = {"coal":42,"dagger":1,"iron":
20,"torch":2}
total_items = 0
def display_inventory(inventory):
for k,v in inventory.items():
... | ```
# inventory.py
stuff = {"coal":42,"dagger":1,"iron":
20,"torch":2}
total_items = 0
def display_inventory(inventory):
for k,v in stuff.items():
print(k+':',v,end=' ') # (k+': '+v,end =' ')
global total_items
total_items = total_items + v
print("\n")
print("Tota... |
271,110 | In our SharePoint 2013 on-premise environment, we have Approval workflows. Using SSRS reports, we display a report, who approved those tasks in a Grid view.
Now we are migrating our complete on-premise environment to SharePoint online, and two things i understood.
1) SharePoint online doesnt have SSRS reports.
2) Wh... | 2019/10/22 | [
"https://sharepoint.stackexchange.com/questions/271110",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/67262/"
] | You cannot add icons directly in **Text** webpart. You may need to develop your own SPFx webpart.
You can use Office UI Fabric icons in SPFx webpart as stated in below official documentation by Microsoft:
[Usage of the Office UI Fabric icons in SPFx components](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/off... | If you want to add custom icons in SPFX webparts then you can convert your image to base64 and set your image src with this base64 code. Like below
```
<img src='data:image/png;base64,iVB...' />
```
---
*If the answer is helpful, please upvote and mark as accepted.* |
271,110 | In our SharePoint 2013 on-premise environment, we have Approval workflows. Using SSRS reports, we display a report, who approved those tasks in a Grid view.
Now we are migrating our complete on-premise environment to SharePoint online, and two things i understood.
1) SharePoint online doesnt have SSRS reports.
2) Wh... | 2019/10/22 | [
"https://sharepoint.stackexchange.com/questions/271110",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/67262/"
] | You cannot add icons directly in **Text** webpart. You may need to develop your own SPFx webpart.
You can use Office UI Fabric icons in SPFx webpart as stated in below official documentation by Microsoft:
[Usage of the Office UI Fabric icons in SPFx components](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/off... | You can use html encoding of your icons which should work. All available HTML icons can be found [here](https://www.toptal.com/designers/htmlarrows/symbols/) |
9,956,329 | I see that a feature I want to build from HEAD (to get the benefit of bug fixes) is in git.eclipse.org. It used to be a bit tricky to build some Eclipse features from source, but now there is Tycho which is supposed to make it easier, because it uses Maven. Fortunately, I see that this feature has already been set up t... | 2012/03/31 | [
"https://Stackoverflow.com/questions/9956329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/495796/"
] | The usual approach is to execute the following two IMAP commands for each folder:
```
. EXAMINE "<foldername>"
. FETCH 1:* (UID FLAGS)
```
The first command selects a folder and returns the *UIDVALIDITY* of this folder. If this value matches the previously returned *UIDVALIDITY* for this folder, you can rely on the ... | Maybe too late for your app, but you can find a **complete IMAP sync strategy** in this RFC: <https://www.rfc-editor.org/rfc/rfc4549> ! |
72,308,131 | **Context**
I have created a small sample dataframe to explain my problem. The original one is larger, as it has many more columns. But it is formatted in the same way.
```
df = data.frame(Case1.1.jpeg.text="the",
Case1.1.jpeg.text.1="big",
Case1.1.jpeg.text.2="DOG",
Ca... | 2022/05/19 | [
"https://Stackoverflow.com/questions/72308131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7819673/"
] | A loop is probably better here, unless you need to collect to such `ChapterPage` objects in multiple places in your code or your input is already a stream and you want to avoid materializing it into a list first. Just to demonstrate how this could still be done, this is an example using a custom downstream `Collector`:... | You can convert List to Json, and then convert Json to Map |
2,842 | I found a example of Java PostMethod [here](http://www.java2s.com/Code/Java/Apache-Common/HttppostmethodExample.htm).
But I want to post several times by using for loop. I made it like this.
```
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.common... | 2011/06/07 | [
"https://codereview.stackexchange.com/questions/2842",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/4862/"
] | I think this pattern of creating an instance, running it through the loop, and at the end of the loop re-initializing it, is a bad one. This case is a good example of what can go wrong... because you have introduced a bug as a result
The first time through the loop your `method` is configured as:
```
PostMethod metho... | I find your indentation a bit strange. You have two-space indentation in one place, and eight-space in another. Keep it consistent.
Java conventions recommend four-space indents.
```
public class PostMethodExample {
public static void main(String args[]) {
HttpClient client = new HttpClient();
cl... |
2,842 | I found a example of Java PostMethod [here](http://www.java2s.com/Code/Java/Apache-Common/HttppostmethodExample.htm).
But I want to post several times by using for loop. I made it like this.
```
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.common... | 2011/06/07 | [
"https://codereview.stackexchange.com/questions/2842",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/4862/"
] | **Avoid catching all exceptions**
Do not use `catch (Exception e)` as this will also catch `NullPointerException`, `ArrayIndexOutOfBoundsException` and a whole lot of other ones. **Only catch the Exceptions you need to catch**, such as `IOException`. It is said that one should [be specific in throws clause](http://www... | I find your indentation a bit strange. You have two-space indentation in one place, and eight-space in another. Keep it consistent.
Java conventions recommend four-space indents.
```
public class PostMethodExample {
public static void main(String args[]) {
HttpClient client = new HttpClient();
cl... |
64,699,683 | ```
List<String> dataTypes = const <String>[
'int',
'double',
'num',
'Byte',
'bool',
'byte',
'short',
'int',
'long',
'float',
'double',
'boolean',
'char'
];
List<String> keywords = const <String>[
'async',
'await',
'break',
'case',
'catch',
'class',
'const',
'continue',
'default',
'deferred',
'do',
'dynamic',
'else',... | 2020/11/05 | [
"https://Stackoverflow.com/questions/64699683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13986273/"
] | How about you use this [package](https://pub.dev/packages/rich_text_controller/example).
Here is example related to package.
[](https://i.stack.imgur.com/8gO21.png)
```
import 'package:flutter/material.dart';
import 'package:rich_text_controller... | You can use [rich\_text\_controller](https://pub.dev/packages/rich_text_controller) package. There is an onMatch property in it.
```
import 'package:flutter/material.dart';
import 'rich_text_controller/rich_text_controller.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Wi... |
112,282 | Just reading through Charles Schwab's margin brochure and saw this section...
>
> The securities used as collateral must maintain a minimum value relative to the account’s
> margin debit balance. **Schwab’s basic maintenance requirement for equity securities (“stock”)
> is 30% of the current market value of the sec... | 2019/08/07 | [
"https://money.stackexchange.com/questions/112282",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/64290/"
] | >
> Because from this it seems like if you bought $100k worth of stock and $1k of that was bought on margin, then the min. req. is going to be $100k x 0.3 = $30k, which seems odd relative to the amount borrowed. Am I misinterpreting something here?
>
>
>
Yes, you are misinterpreting this. If you buy $100k of stoc... | To address your last paragraph.
>
> Because from this it seems like if you bought $100k worth of stock and $1k of that was bought on margin, then the min. req. is going to be $100k x 0.3 = $30k, which seems odd relative to the amount borrowed.[...]
>
>
>
You want to buy $100K worth of stock but only have $99K. I... |
112,282 | Just reading through Charles Schwab's margin brochure and saw this section...
>
> The securities used as collateral must maintain a minimum value relative to the account’s
> margin debit balance. **Schwab’s basic maintenance requirement for equity securities (“stock”)
> is 30% of the current market value of the sec... | 2019/08/07 | [
"https://money.stackexchange.com/questions/112282",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/64290/"
] | In your example( of Charles Schwab's margin brochure ) when the stock was purchased margin debt was $5000 and Client Equity was $5000 and required Min Equity was $2k, so at that time client can further borrow $5k-$2k= $3k.
When price of the stock rise( if it does ?) , per example, then $7000-$3600 = $3400 can be borro... | To address your last paragraph.
>
> Because from this it seems like if you bought $100k worth of stock and $1k of that was bought on margin, then the min. req. is going to be $100k x 0.3 = $30k, which seems odd relative to the amount borrowed.[...]
>
>
>
You want to buy $100K worth of stock but only have $99K. I... |
112,282 | Just reading through Charles Schwab's margin brochure and saw this section...
>
> The securities used as collateral must maintain a minimum value relative to the account’s
> margin debit balance. **Schwab’s basic maintenance requirement for equity securities (“stock”)
> is 30% of the current market value of the sec... | 2019/08/07 | [
"https://money.stackexchange.com/questions/112282",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/64290/"
] | >
> Because from this it seems like if you bought $100k worth of stock and $1k of that was bought on margin, then the min. req. is going to be $100k x 0.3 = $30k, which seems odd relative to the amount borrowed. Am I misinterpreting something here?
>
>
>
Yes, you are misinterpreting this. If you buy $100k of stoc... | In your example( of Charles Schwab's margin brochure ) when the stock was purchased margin debt was $5000 and Client Equity was $5000 and required Min Equity was $2k, so at that time client can further borrow $5k-$2k= $3k.
When price of the stock rise( if it does ?) , per example, then $7000-$3600 = $3400 can be borro... |
44,169,342 | I keep seeing people claim that the MOV instruction can be free in x86, because of register renaming.
For the life of me, I can't verify this in a single test case. Every test case I try debunks it.
For example, here's the code I'm compiling with Visual C++:
```
#include <limits.h>
#include <stdio.h>
#include <time... | 2017/05/24 | [
"https://Stackoverflow.com/questions/44169342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/541686/"
] | Register-copy is never free for the front-end, only eliminated from actually executing in the back-end (with zero latency) by the issue/rename stage on the following CPUs:
* AMD Bulldozer family for XMM vector registers, not integer.
* AMD Zen family for integer and XMM vector registers. (And YMM in Zen2 and later)
... | Here are two small tests that I believe conclusively show evidence for mov-elimination:
```
__loop1:
add edx, 1
add edx, 1
add ecx, 1
jnc __loop1
```
versus
```
__loop2:
mov eax, edx
add eax, 1
mov edx, eax
add edx, 1
add ecx, 1
jnc __loop2
```
If `mov` added a cycle to a d... |
22,048,703 | I am having problems getting **RCurl** function `getURL` to access an HTTPS URL on a server that is using a self-signed certificate. I'm running R 3.0.2 on Mac OS X 10.9.2.
I have read the [FAQ](http://www.omegahat.org/RCurl/FAQ.html) and the [curl page](http://curl.haxx.se/docs/sslcerts.html) on the subject. So this ... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22048703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2482776/"
] | You need to specify the right encoding when opening the file. Try
```
open(path+fn, 'r', encoding="utf-16")
```
(I'm guessing utf-16 because ASCII characters seem to be encoded in two bytes in the sample string) | If you don't want to mess with encoding, `string.printable` is a list of 'printable' chars which may be what you're looking for.
```
>>> from string import printable
>>> best_string_ever = filter(lambda x: x in printable, a)
>>> best_string_ever
'"Balance'
``` |
22,048,703 | I am having problems getting **RCurl** function `getURL` to access an HTTPS URL on a server that is using a self-signed certificate. I'm running R 3.0.2 on Mac OS X 10.9.2.
I have read the [FAQ](http://www.omegahat.org/RCurl/FAQ.html) and the [curl page](http://curl.haxx.se/docs/sslcerts.html) on the subject. So this ... | 2014/02/26 | [
"https://Stackoverflow.com/questions/22048703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2482776/"
] | You need to specify the right encoding when opening the file. Try
```
open(path+fn, 'r', encoding="utf-16")
```
(I'm guessing utf-16 because ASCII characters seem to be encoded in two bytes in the sample string) | If you can show the character value, then you can use the strip(u'\uxxx') command
use the replace() method
```
newstring = textstring.replace(u'\uxxx', '')
```
In this case pass in the actual character encoding that you want. |
72,408 | We can always see modulated charge density, the Friedel Oscillation, around an probe charge due to other electrons' response. Can this be called charge density wave (I believe not)? If not, what is the fundamental difference between this situation and charge density wave? Is Peierls Transition a precondition to charge ... | 2013/07/27 | [
"https://physics.stackexchange.com/questions/72408",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/25748/"
] | Symmetry is the key to distinguish charge density wave (CDW) and other charge modulations.
CDW is not just a wavy pattern in the charge density as literally indicated by its name, it is an order that spontaneously breaks the translation symmetry. Note that the symmetry must be spontaneously broken but not be broken by... | You are right that modulated charge density like the Friedel oscillation cannot be called a charge density wave (CDW). In a CDW, the charge distribution does oscillate but with constant amplitude as opposed to a Friedel oscillation which decays out in space. The CDW is a stable **phase** usually arising from the openin... |
65,477,038 | I am having a NSOutlineView in which the textfield is editable by either pressing return or using the right click. I am also overriding the `menu(for event: NSEvent) -> NSMenu?` to menu based on which row is clicked
When I right click on the textfield, it opens the correct menu as expected but it also makes the textfi... | 2020/12/28 | [
"https://Stackoverflow.com/questions/65477038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666861/"
] | I have a similar NSTableView where right-clicking is supported to display a menu, but the fields are also directly editable. I took a look to see why/how the editing doesn't seem to be a problem in my case, and I narrowed the behavior down to the presence of this line of code in my NSTableView subclass:
```
// This tr... | I ran into this same problem trying to get my Swift-based app on Monterey working. I was surprised there was not a more simple/obvious solution, but here is what I came up with:
```
class MyOutlineView: NSOutlineView {
// prevent text field from becoming editable when context menu is used
override func valida... |
9,260,198 | well,I wrote a little snappet trying to know how to use python threading .
But strangely the following code just quit quickly without the expected output.
Is it because I shouldn't spawn threads by overiding the run() method?
```
import threading
from time import sleep
class mythread(threading.Thread):
def __init_... | 2012/02/13 | [
"https://Stackoverflow.com/questions/9260198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1117789/"
] | You need to start the thread to make it actually do something:
```
t = mythread()
t.start()
```
If you bother to accept a `target` parameter in your constructor (why?), you shouldn't ignore this parameter. Maybe you want to pass it on to the `Thread` constructor. (Why?) | When you write `mythread()`, you instantiate the object. THe default constructor will be called, so `__init__()` will be executed.
You constructor doesn't have the any instruction of starting the thread. |
8,101,950 | A very simple Vector in Java that produces the output that is somewhat difficult to follow. The code snippet is as show below.
```
package main;
import java.util.Vector;
final public class Main
{
public static void main(String[] args)
{
Vector<String> r = new Vector<String>();
r.addEl... | 2011/11/12 | [
"https://Stackoverflow.com/questions/8101950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037210/"
] | Did you notice that one of them was `removeElement`? | Actually you would have forget about the statement removeElement("F"). Since it is called it was removed and remaining elements alone shown. If you comment this line and try again, your expected result will come. Cheers up!!! |
6,649,361 | I wish to create a new list each time a for loop runs
```
#Reading user input e.g. 10
lists = int(raw_input("How many lists do you want? "))
for p in range(0,pooled):
#Here I want to create 10 new empty lists: list1, list2, list3 ...
```
Is there any smart way of doing this?
Thanks,
Kasper | 2011/07/11 | [
"https://Stackoverflow.com/questions/6649361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838744/"
] | Use a list comprehension:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = [[] for i in xrange(num_lists)]
``` | The easiest way is to create a list of lists:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = []
for p in range(num_lists):
lists.append([])
```
Then you can access, for example, list 3 with `list[2]`, and the ith item of list 3 with `list[2][i]`. |
6,649,361 | I wish to create a new list each time a for loop runs
```
#Reading user input e.g. 10
lists = int(raw_input("How many lists do you want? "))
for p in range(0,pooled):
#Here I want to create 10 new empty lists: list1, list2, list3 ...
```
Is there any smart way of doing this?
Thanks,
Kasper | 2011/07/11 | [
"https://Stackoverflow.com/questions/6649361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838744/"
] | The easiest way is to create a list of lists:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = []
for p in range(num_lists):
lists.append([])
```
Then you can access, for example, list 3 with `list[2]`, and the ith item of list 3 with `list[2][i]`. | perhaps in your situation you could use a defaultdict?
```
>>> from collections import defaultdict
>>> m=defaultdict(list)
>>> m
defaultdict(<type 'list'>, {})
>>> for i in range(5):
... len(m[i])
...
0
0
0
0
0
>>> m
defaultdict(<type 'list'>, {0: [], 1: [], 2: [], 3: [], 4: []})
``` |
6,649,361 | I wish to create a new list each time a for loop runs
```
#Reading user input e.g. 10
lists = int(raw_input("How many lists do you want? "))
for p in range(0,pooled):
#Here I want to create 10 new empty lists: list1, list2, list3 ...
```
Is there any smart way of doing this?
Thanks,
Kasper | 2011/07/11 | [
"https://Stackoverflow.com/questions/6649361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838744/"
] | The easiest way is to create a list of lists:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = []
for p in range(num_lists):
lists.append([])
```
Then you can access, for example, list 3 with `list[2]`, and the ith item of list 3 with `list[2][i]`. | To create our lists we generate names on the fly and assign them an empty list:
```
lists = int(input("How many lists do you want? "))
varname = 'list'
for i in range(lists):
exec(f"{varname}{i} = []")
exec(f'print(f"list{lists-1} is", list{lists-1})')
# list9 is []
``` |
6,649,361 | I wish to create a new list each time a for loop runs
```
#Reading user input e.g. 10
lists = int(raw_input("How many lists do you want? "))
for p in range(0,pooled):
#Here I want to create 10 new empty lists: list1, list2, list3 ...
```
Is there any smart way of doing this?
Thanks,
Kasper | 2011/07/11 | [
"https://Stackoverflow.com/questions/6649361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838744/"
] | Use a list comprehension:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = [[] for i in xrange(num_lists)]
``` | perhaps in your situation you could use a defaultdict?
```
>>> from collections import defaultdict
>>> m=defaultdict(list)
>>> m
defaultdict(<type 'list'>, {})
>>> for i in range(5):
... len(m[i])
...
0
0
0
0
0
>>> m
defaultdict(<type 'list'>, {0: [], 1: [], 2: [], 3: [], 4: []})
``` |
6,649,361 | I wish to create a new list each time a for loop runs
```
#Reading user input e.g. 10
lists = int(raw_input("How many lists do you want? "))
for p in range(0,pooled):
#Here I want to create 10 new empty lists: list1, list2, list3 ...
```
Is there any smart way of doing this?
Thanks,
Kasper | 2011/07/11 | [
"https://Stackoverflow.com/questions/6649361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838744/"
] | Use a list comprehension:
```
num_lists = int(raw_input("How many lists do you want? "))
lists = [[] for i in xrange(num_lists)]
``` | To create our lists we generate names on the fly and assign them an empty list:
```
lists = int(input("How many lists do you want? "))
varname = 'list'
for i in range(lists):
exec(f"{varname}{i} = []")
exec(f'print(f"list{lists-1} is", list{lists-1})')
# list9 is []
``` |
7,029,531 | I am trying to access various functions from the 'Approximate nearest neighbor' ([ANN](http://www.cs.umd.edu/~mount/ANN/)) library from within Delphi (actually, it is Lazarus/FreePascal, but that shouldn't matter much).
Here is the deceleration in C++:
```
#include <cstdlib> // C standard lib def... | 2011/08/11 | [
"https://Stackoverflow.com/questions/7029531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/737297/"
] | Maybe importing by index works:
```
procedure annMaxPtsVisit(input: Integer); stdcall; external 'ANN.dll' index 39;
```
(That's the index gotten via [Dependecy Walker](http://www.dependencywalker.com/))
And you might have to change to `cdecl` calling convention, depending on how the DLL was built:
```
procedure an... | First of all declare `annMaxPtsVisit` as ordinary procedure, not a TForm1 method:
```
procedure annMaxPtsVisit(input: Integer); stdcall; external 'ANN.dll';
``` |
5,056,699 | I am trying to update my application , but after uploading the binary , Itunes connect sends me this email :
>
> Dear Developer, Thank you for your
> recent binary submission for "MY APP"
> to the App Store. Unfortunately we
> discovered an issue with your binary
> that you will need to correct in order
> for yo... | 2011/02/20 | [
"https://Stackoverflow.com/questions/5056699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319097/"
] | Note that this QA is incredibly old. Apple have largely ameliorated this problem. Enjoy.
---
99 times out of 100, here is the problem:
### Select "TARGETS", not "PROJECT"
Click on the name of your project at the Top Left of the main XCode6 window. (ie, just above where it probably says "Classes".)
![enter image de... | A main point I'd like to offer is that Archive Validation (or submission thru App Loader) is **supposed** to identify the signature problem *before* sending the application to iTunes Connect. This is a first indication that the problem is related to a developer tools error.
Having witnessed this problem with multiple ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.