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 |
|---|---|---|---|---|---|
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | Follow these steps:
1. Change the console window font to *Lucida Console* for both when debugging / not debugging.
2. Execute the following code:
```
public static void Main(String[] args)
{
Console.OutputEncoding = System.Text.Encoding.GetEncoding("Cyrillic");
Console.InputEncoding = System.Text.Encoding.Get... | Your text looks like it is in Russian.
File Explorer is in Unicode.
Console application probably isn't in Unicode.
When you paste into your Console window your Unicode characters will convert to a non-Unicode system based on your current system locale. If your system locale doesn't support Russian, your characters w... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | Follow these steps:
1. Change the console window font to *Lucida Console* for both when debugging / not debugging.
2. Execute the following code:
```
public static void Main(String[] args)
{
Console.OutputEncoding = System.Text.Encoding.GetEncoding("Cyrillic");
Console.InputEncoding = System.Text.Encoding.Get... | Its very easy if you just want to have input copy pasted into your text box .
Have a check Box Control in your application and you can have code to changed your font something like this .
```
enter code here
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | Follow these steps:
1. Change the console window font to *Lucida Console* for both when debugging / not debugging.
2. Execute the following code:
```
public static void Main(String[] args)
{
Console.OutputEncoding = System.Text.Encoding.GetEncoding("Cyrillic");
Console.InputEncoding = System.Text.Encoding.Get... | the code below helps me. Please use **Encoding.Unicode** instead of Encoding.UTF8
```
Console.OutputEncoding = Console.InputEncoding = Encoding.Unicode;
Console.Write("Введите свое имя: ");
string name = Console.ReadLine();
Console.WriteLine($"Привет {name}");
``` |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | This seems like a complete overkill for C# but it worked for me:
```
using System.Runtime.InteropServices;
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll")]
static extern bool ReadConsoleW(IntPtr hConsoleInput, [Out] byte[]
lpBuffer, u... | Its very easy if you just want to have input copy pasted into your text box .
Have a check Box Control in your application and you can have code to changed your font something like this .
```
enter code here
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | the code below helps me. Please use **Encoding.Unicode** instead of Encoding.UTF8
```
Console.OutputEncoding = Console.InputEncoding = Encoding.Unicode;
Console.Write("Введите свое имя: ");
string name = Console.ReadLine();
Console.WriteLine($"Привет {name}");
``` | This seems like a complete overkill for C# but it worked for me:
```
using System.Runtime.InteropServices;
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll")]
static extern bool ReadConsoleW(IntPtr hConsoleInput, [Out] byte[]
lpBuffer, u... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | Your text looks like it is in Russian.
File Explorer is in Unicode.
Console application probably isn't in Unicode.
When you paste into your Console window your Unicode characters will convert to a non-Unicode system based on your current system locale. If your system locale doesn't support Russian, your characters w... | Its very easy if you just want to have input copy pasted into your text box .
Have a check Box Control in your application and you can have code to changed your font something like this .
```
enter code here
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | the code below helps me. Please use **Encoding.Unicode** instead of Encoding.UTF8
```
Console.OutputEncoding = Console.InputEncoding = Encoding.Unicode;
Console.Write("Введите свое имя: ");
string name = Console.ReadLine();
Console.WriteLine($"Привет {name}");
``` | Your text looks like it is in Russian.
File Explorer is in Unicode.
Console application probably isn't in Unicode.
When you paste into your Console window your Unicode characters will convert to a non-Unicode system based on your current system locale. If your system locale doesn't support Russian, your characters w... |
14,969,859 | I apologize for such a simple question, but I've been working on fixing this code for several hours now and I can't make any headway.
I have a project that calls for the usage of three classes: a customer, a employee, and a customer group. The classes are populated from file (.csv) and are then dumped back onto consol... | 2013/02/19 | [
"https://Stackoverflow.com/questions/14969859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2088808/"
] | the code below helps me. Please use **Encoding.Unicode** instead of Encoding.UTF8
```
Console.OutputEncoding = Console.InputEncoding = Encoding.Unicode;
Console.Write("Введите свое имя: ");
string name = Console.ReadLine();
Console.WriteLine($"Привет {name}");
``` | Its very easy if you just want to have input copy pasted into your text box .
Have a check Box Control in your application and you can have code to changed your font something like this .
```
enter code here
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
... |
64,162,812 | Given a problem set, with values and their associated frequencies, how can the `sample` be created in a dataframe?
```
Find the mean of this dataset
Value: 1 | 2 | 3
Freq: 3 | 4 | 2
```
Which represents the `sample`, `[1, 1, 1, 2, 2, 2, 2, 3, 3]`.
I input this into Python:
```
>>> import pandas as pd
>>> df = pd.... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64162812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14211183/"
] | You could use tuple or list multiplication:
```
# Duplicate the value `freq` times.
values = [(value,)*freq for (value, freq) in zip(df["value"], df["freq"])]
>>> [(1, 1, 1, 1), (2, 2, 2, 2, 2), (3, 3)]
# Flatten the list of tuples into a list of values.
values = [item for sublist in values for item in sublist]
>>> [... | Alternative solution:
```
df = df.loc[df.index.repeat(df['freq'])]
df['value'].mean()
``` |
64,162,812 | Given a problem set, with values and their associated frequencies, how can the `sample` be created in a dataframe?
```
Find the mean of this dataset
Value: 1 | 2 | 3
Freq: 3 | 4 | 2
```
Which represents the `sample`, `[1, 1, 1, 2, 2, 2, 2, 3, 3]`.
I input this into Python:
```
>>> import pandas as pd
>>> df = pd.... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64162812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14211183/"
] | An option is to use [`np.repeat`](https://numpy.org/doc/stable/reference/generated/numpy.repeat.html)
```
import numpy as np
values = [1,2,3]
frequency = [3,4,2]
df = pd.DataFrame(np.repeat(values, frequency), columns=['data'])
df.mean()
``` | You could use tuple or list multiplication:
```
# Duplicate the value `freq` times.
values = [(value,)*freq for (value, freq) in zip(df["value"], df["freq"])]
>>> [(1, 1, 1, 1), (2, 2, 2, 2, 2), (3, 3)]
# Flatten the list of tuples into a list of values.
values = [item for sublist in values for item in sublist]
>>> [... |
64,162,812 | Given a problem set, with values and their associated frequencies, how can the `sample` be created in a dataframe?
```
Find the mean of this dataset
Value: 1 | 2 | 3
Freq: 3 | 4 | 2
```
Which represents the `sample`, `[1, 1, 1, 2, 2, 2, 2, 3, 3]`.
I input this into Python:
```
>>> import pandas as pd
>>> df = pd.... | 2020/10/01 | [
"https://Stackoverflow.com/questions/64162812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14211183/"
] | An option is to use [`np.repeat`](https://numpy.org/doc/stable/reference/generated/numpy.repeat.html)
```
import numpy as np
values = [1,2,3]
frequency = [3,4,2]
df = pd.DataFrame(np.repeat(values, frequency), columns=['data'])
df.mean()
``` | Alternative solution:
```
df = df.loc[df.index.repeat(df['freq'])]
df['value'].mean()
``` |
7,709 | This [link](http://www.miscellanies.org/mythology/mag2/heroes/argo.html) makes it seems like it was referred to as "Koraki" but it seems like fan-fiction and I cannot validate using any of the accessible references. | 2020/10/26 | [
"https://mythology.stackexchange.com/questions/7709",
"https://mythology.stackexchange.com",
"https://mythology.stackexchange.com/users/2703/"
] | Koraki in Greek is κοράκι meaning crow or raven.
Noticing other articles on that site the authors name is on top just like the "koraki". It's probably a made up name used to make the story more interesting. I certainly found no other references to Koraki in the ancients texts applicable to this story. | Argo
----
The idea of *Argo* containing a branch of the Dodona Oak comes from the Hellenistic epic *[Argonautica](https://www.gutenberg.org/files/830/830-h/830-h.htm)* by Appolonius of Rhodes. In Book 1, the Argonauts are getting in the ship preparing to leave Pagasae in Magnesia, when an astonishing thing happened:
... |
46,651,162 | Latest Boostrap 4 and popper.js as of time of writing are loaded from CDN.
[Codepen here](https://codepen.io/tmrczk/pen/pWLXbO).
**Problem**.
My dropdown code:
```
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="f... | 2017/10/09 | [
"https://Stackoverflow.com/questions/46651162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84626/"
] | I have not worked that one either. However, a workaround that I'm using and so far fixes the problem everywhere is:
```
.dropdown-menu-right {
right:0;
left:auto;
}
``` | Here's a rather crude but fully working solution to your problem.
```
.dropdown-menu-right{
left: -85px;
}
```
Edit:
I'd put it in a media query so that the drop down doesn't look off on mobile.
```
@media screen and (min-width: 991px) {
.dropdown-menu-right{
left: -85px;
}
}
``` |
46,651,162 | Latest Boostrap 4 and popper.js as of time of writing are loaded from CDN.
[Codepen here](https://codepen.io/tmrczk/pen/pWLXbO).
**Problem**.
My dropdown code:
```
<div class="btn-group">
<button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="f... | 2017/10/09 | [
"https://Stackoverflow.com/questions/46651162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/84626/"
] | I have not worked that one either. However, a workaround that I'm using and so far fixes the problem everywhere is:
```
.dropdown-menu-right {
right:0;
left:auto;
}
``` | Answers in this post didn't help me. I solved it by placing placement="bottom-right".
```
<div ngbDropdown class="d-inline-block float-right" placement="bottom-right">
<button class="btn btn-secondary dropleft" id="grade-dropdown" ngbDropdownToggle>
Button
</button>
<div ngbDropdownMenu class="dro... |
71,637,736 | I am trying to add types to function that takes array of objects and groups them by key.
Here is my code:
```
interface ITask {
assignedTo: string;
tasks: Array<string>,
date: string;
userId: number;
};
interface IFormattedOutput<T> {
[prop: string]: Array<T>;
}
const testData: Array<ITask> = [
{
... | 2022/03/27 | [
"https://Stackoverflow.com/questions/71637736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4895188/"
] | 2 problems:
1. not typing the reducer seed properly, causing your current error
2. even if you fix 1, you'd get a similar error, because you haven't restricted `K` to only point at string values of T, so the compiler will correctly warn you that it doesn't know if type `T[K]` can index `IFormattedOutput<T>`
ideal sol... | There are 2 steps, I tested on my local and succeeded.
First, I changed your `interface IFormattedOutput<T>` to this:
```js
interface IFormattedOutput<T> {
[key: string]: Array<T>;
}
```
The `groupByKey` function will be like as follow:
```js
// type guard for T[K] to be string otherwise throw an error
const isS... |
73,669,091 | ```
using System.Net;
using System.Text;
namespace HttpServer
{
class Program
{
// Main method
static void Main()
{
using var listener = new HttpListener();
listener.Prefixes.Add("http://localhost:10060/");
listener.Start();
Console.Writ... | 2022/09/10 | [
"https://Stackoverflow.com/questions/73669091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | try using the ip address instead of localhost. or try \*:10060 | In another machine try to modify firewall rule to allow port 80.
1. Windows defender firewall with advance security on local Computer.
2. Inbound rules
3. New Rule
4. Select the port, Next, TCP, specific local port, type 80
5. Allow the connection and save the rule.
Let us know if this worked. |
1,121 | I am using Drupal 6 and, therefore, jQuery 1.2.6.
When a user clicks inside my text, there is a pop-up that comes up with a few more options in it. I would like this pop up to disappear when the focus is moved to anywhere outside. [This answer on SO](https://stackoverflow.com/questions/2426438/jquery-on-form-input-fo... | 2011/03/21 | [
"https://drupal.stackexchange.com/questions/1121",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/686/"
] | Add a [`.mouseleave()`](http://api.jquery.com/mouseleave/) event to the popup div
Taking the example code from the [SO question you mentioned](https://stackoverflow.com/questions/2426438/jquery-on-form-input-focus-show-div-hide-div-on-blur-with-a-caveat), see the working version at <http://jsfiddle.net/Laxman13/Mw8VD/... | Will it work as expected with jQuery 1.3.2, because you can install the [jQuery\_update](http://drupal.org/project/jquery_update) module. I normally upgrade jQuery on all drupal 6 sites that I work with due to most jquery plugins etc have compatibility with 1.3.x |
1,121 | I am using Drupal 6 and, therefore, jQuery 1.2.6.
When a user clicks inside my text, there is a pop-up that comes up with a few more options in it. I would like this pop up to disappear when the focus is moved to anywhere outside. [This answer on SO](https://stackoverflow.com/questions/2426438/jquery-on-form-input-fo... | 2011/03/21 | [
"https://drupal.stackexchange.com/questions/1121",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/686/"
] | Add a [`.mouseleave()`](http://api.jquery.com/mouseleave/) event to the popup div
Taking the example code from the [SO question you mentioned](https://stackoverflow.com/questions/2426438/jquery-on-form-input-focus-show-div-hide-div-on-blur-with-a-caveat), see the working version at <http://jsfiddle.net/Laxman13/Mw8VD/... | you could try the blur() function.
from the jquery docs
>
> The blur event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as . In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keybo... |
1,121 | I am using Drupal 6 and, therefore, jQuery 1.2.6.
When a user clicks inside my text, there is a pop-up that comes up with a few more options in it. I would like this pop up to disappear when the focus is moved to anywhere outside. [This answer on SO](https://stackoverflow.com/questions/2426438/jquery-on-form-input-fo... | 2011/03/21 | [
"https://drupal.stackexchange.com/questions/1121",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/686/"
] | you could try the blur() function.
from the jquery docs
>
> The blur event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as . In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keybo... | Will it work as expected with jQuery 1.3.2, because you can install the [jQuery\_update](http://drupal.org/project/jquery_update) module. I normally upgrade jQuery on all drupal 6 sites that I work with due to most jquery plugins etc have compatibility with 1.3.x |
89,420 | How can I prevent features being clipped at tile boundaries in an WMS layer as per the picture

The arrow and line segments are being clipped when viewed in openlayers as a WMS layer. The map file is as follows:-
```
MAP
NAME "WM... | 2014/03/12 | [
"https://gis.stackexchange.com/questions/89420",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/16132/"
] | There are two techniques known as `Metatiles` and `Metabuffer` for solving such issues. Unfortunately MapServer doesn't support them out of box so you should use intermediate tile server (MapCache, MapProxy, etc.) Also you can use untiled version of your WMS. | What abput "tile\_map\_edge\_buffer" and "tile\_metatile\_level" metadata params?
I was able to solve a similar problem, drawing points with png icons. The icons appeared cutted in adjacent tiles, but using "tile\_map\_edge\_buffer" and "tile\_metatile\_level" metadata params in mapfile was the solution. Also you need... |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | Usually it takes me around 30-45 minutes for a fresh install so I would assume at least 15 minutes more time as it has to migrate the old settings and files to Windows 8. | It depends on various factors such as processor speed, hard drive write speed, the orientation of the moons of Jupiter etc.
But you can reasonably expect about 40-60 minutes on a mid-grade machine. Faster on SSD systems, slower on your Pentium 4. |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | Usually it takes me around 30-45 minutes for a fresh install so I would assume at least 15 minutes more time as it has to migrate the old settings and files to Windows 8. | It depends both on how you are upgrading, and your hardware... if you are planing on doing an actual upgrade it will depend on how much data the installer has to move around. You could choose to back up your data, to a HD or Partition and do a clean install, which will drastically cut down on your upgrade, once again t... |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | Usually it takes me around 30-45 minutes for a fresh install so I would assume at least 15 minutes more time as it has to migrate the old settings and files to Windows 8. | I depends *a lot* on the hardware, but it took [Ars Technica](http://arstechnica.com/information-technology/2012/10/the-windows-8-upgrade-install-experience/2/) 11 minutes for a fresh install and 27 for an upgrade install. This was on a fairly new computer that saw light daily use. |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | It depends on the network connection you have now and the hardware you have.
For me, it takes 38 mins.
my computer:
Intel Dual-core 2.0GHz. | It depends on various factors such as processor speed, hard drive write speed, the orientation of the moons of Jupiter etc.
But you can reasonably expect about 40-60 minutes on a mid-grade machine. Faster on SSD systems, slower on your Pentium 4. |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | It depends on the network connection you have now and the hardware you have.
For me, it takes 38 mins.
my computer:
Intel Dual-core 2.0GHz. | It depends both on how you are upgrading, and your hardware... if you are planing on doing an actual upgrade it will depend on how much data the installer has to move around. You could choose to back up your data, to a HD or Partition and do a clean install, which will drastically cut down on your upgrade, once again t... |
495,788 | I'm planning to upgrade my Windows 7 PC to Windows 8.
I've read several articles concerning the upgrade.
Now I ask myself how much time must be included to perfom the upgrade.
Does the upgrade take much longer than a new installation? (only the pure installation, without all backups and further configuration work)
W... | 2012/10/29 | [
"https://superuser.com/questions/495788",
"https://superuser.com",
"https://superuser.com/users/26024/"
] | It depends on the network connection you have now and the hardware you have.
For me, it takes 38 mins.
my computer:
Intel Dual-core 2.0GHz. | I depends *a lot* on the hardware, but it took [Ars Technica](http://arstechnica.com/information-technology/2012/10/the-windows-8-upgrade-install-experience/2/) 11 minutes for a fresh install and 27 for an upgrade install. This was on a fairly new computer that saw light daily use. |
43,094,428 | ```
class Test3
{
public static void main(String [] args)
{
String str[] = new String[] {"bharani"};
for(int i = 0; i < 7; i += 2)
{
System.out.println(str[i]);
}
}
```
What is the error? I am getting error as invalid main. | 2017/03/29 | [
"https://Stackoverflow.com/questions/43094428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7740454/"
] | You should initialize b pointer before assign value to it
```
node *b = new node();
b->value = 1;
``` | You are using a non allocated structure. malloc (C) or new (C++) your structure before using it
```
int main(){
node* b;
b = malloc(sizeof(node));
b->value=1;
linkedList a;
}
int main(){
node* b = new node();
b = malloc(sizeof(node));
b->value=1;
linkedList a;
}
``` |
43,094,428 | ```
class Test3
{
public static void main(String [] args)
{
String str[] = new String[] {"bharani"};
for(int i = 0; i < 7; i += 2)
{
System.out.println(str[i]);
}
}
```
What is the error? I am getting error as invalid main. | 2017/03/29 | [
"https://Stackoverflow.com/questions/43094428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7740454/"
] | You should initialize b pointer before assign value to it
```
node *b = new node();
b->value = 1;
``` | ```
int main(){
node* b;
b->value=1;
linkedList a;
```
Problem is pointer b, you declared a pointer type of node, but it points null(nowhere),then you try assign b->value, therefore throw a segmentation fault.
You must assign a address your pointer b ,like below,
```
b=new node;
b->value=1;
```
then yo... |
596,385 | I have the following source:
```
\item {\large \begin{multline*}
\neg \left(\forall r_1, r_2 \in \R \right)[\left(r_1 \cdot r_2 <0 \right) \Leftrightarrow \\
\left( \left( \left( r _ 1 < 0 \right) \land \left(r_ 2 < 0 \right) \right) \lor \left( \left( r _ 1 > 0 \right) \land \left( r_ ... | 2021/05/09 | [
"https://tex.stackexchange.com/questions/596385",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/14080/"
] | Use the `multlined` environment, from `mathtools`, with the relevant options:
```
\documentclass{article}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{enumitem}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\begin{document}
\leavevmode\vskip 3ex
\begin{enumerate}[label=(\roman*), s... | Here's a solution that employs an `aligned` environment.
[](https://i.stack.imgur.com/VFwYN.png)
Observe that I've deleted all `\left` and `\right` sizing directives as they don't seem to be doing anything useful.
```
\documentclass[12pt]{article}
\... |
31,368,035 | I'm making a simple CRUD, but my crud app shown an error message Message: Trying to get property of non-object in update form. This is my controller
```
public function ubah($id){
$this->load->model('m_property');
$data = array();
$data['msg'] = $this->_get_flashdata();
$data... | 2015/07/12 | [
"https://Stackoverflow.com/questions/31368035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4558459/"
] | Cordova will not be available in the browser; only on your device.
In your **index.html** you should have this script reference:
```
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
```
As the note says, the script won't be available during the development.
It will... | What you easily could do is copy cordova.js yourself to your root directory for testing.The file resides e.g in the directory
>
> cordova-project/platforms/ios/platform\_www
>
>
>
You could easily just copy it over.
If you do it the cordova object is available and can be accessed in your code e.g.
```
cordova.fi... |
27,194,932 | I just started with learning Python 3.4.x.
I really want to keep learning and developing on all devices. That's why I'm using Codeanywhere.
But the problem is I don't know how to execute a .py file in Codeanywhere.
Is there a method to do it?
Thanks | 2014/11/28 | [
"https://Stackoverflow.com/questions/27194932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3902657/"
] | You run your .py files just like you would if you were running the python commandline in windows.
ex.
python myfile.py
Open a SSH terminal from your python devbox and type it in the cmd line and you're all set. | I'm not familiar with codeanywhere. Have you looked into [pythonanywhere](https://www.pythonanywhere.com)? This seems like it would suit your needs. |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | If you need a strict hash, simply:
```
class StrictHash < Hash
alias [] fetch
end
```
It works as expected:
```
hash = StrictHash[foo: "bar"]
hash[:foo]
# => "bar"
hash[:qux]
# stricthash.rb:7:in `fetch': key not found: :qux (KeyError)
# from stricthash.rb:7:in `<main>'
``` | It's brutal, but you could overwrite the [new\_ostruct\_member](http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html#method-i-new_ostruct_member) method to generate an error:
```
require 'ostruct'
class CustomError < StandardError; end
os = OpenStruct.new({:a=>1, :b=>1})
def os.new_ostruct_member(n... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | I use something like
```
hash = { a: 2, b: 3 }
Struct.new(*hash.keys).new(*hash.values).freeze
```
to get an immutable object which will raise `NoMethodError` in case unexpected method is invoked | In ruby, whenever you write `object.horray` the message `horray` is sent to the object `object`, that will return a value. Since every `horray` is a message. If the object don't respond to this message, you can't distinguish between the object don't having an attribute with this name or if it don't have a method with t... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | If you need a strict hash, simply:
```
class StrictHash < Hash
alias [] fetch
end
```
It works as expected:
```
hash = StrictHash[foo: "bar"]
hash[:foo]
# => "bar"
hash[:qux]
# stricthash.rb:7:in `fetch': key not found: :qux (KeyError)
# from stricthash.rb:7:in `<main>'
``` | I went with this solution which does exactly what I need:
```
class Request < Hash
class RequestError < StandardError; end
class MissingAttributeError < RequestError; end
def initialize(hash)
hash.each do |key, value|
self[key] = value
end
end
def [](key)
unless self.include?(key)
r... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | I went with this solution which does exactly what I need:
```
class Request < Hash
class RequestError < StandardError; end
class MissingAttributeError < RequestError; end
def initialize(hash)
hash.each do |key, value|
self[key] = value
end
end
def [](key)
unless self.include?(key)
r... | In ruby, whenever you write `object.horray` the message `horray` is sent to the object `object`, that will return a value. Since every `horray` is a message. If the object don't respond to this message, you can't distinguish between the object don't having an attribute with this name or if it don't have a method with t... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | If you need a strict hash, simply:
```
class StrictHash < Hash
alias [] fetch
end
```
It works as expected:
```
hash = StrictHash[foo: "bar"]
hash[:foo]
# => "bar"
hash[:qux]
# stricthash.rb:7:in `fetch': key not found: :qux (KeyError)
# from stricthash.rb:7:in `<main>'
``` | In ruby, whenever you write `object.horray` the message `horray` is sent to the object `object`, that will return a value. Since every `horray` is a message. If the object don't respond to this message, you can't distinguish between the object don't having an attribute with this name or if it don't have a method with t... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | I went with this solution which does exactly what I need:
```
class Request < Hash
class RequestError < StandardError; end
class MissingAttributeError < RequestError; end
def initialize(hash)
hash.each do |key, value|
self[key] = value
end
end
def [](key)
unless self.include?(key)
r... | It's brutal, but you could overwrite the [new\_ostruct\_member](http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html#method-i-new_ostruct_member) method to generate an error:
```
require 'ostruct'
class CustomError < StandardError; end
os = OpenStruct.new({:a=>1, :b=>1})
def os.new_ostruct_member(n... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | OpenStruct defines singleton accessor methods on the object when you set a new member, so you can use `respond_to?` to see if the member is valid. In fact you can probably just capture any method not defined with method\_missing and throw the error unless it's a setter method name, in which case you pass it along to su... | I went with this solution which does exactly what I need:
```
class Request < Hash
class RequestError < StandardError; end
class MissingAttributeError < RequestError; end
def initialize(hash)
hash.each do |key, value|
self[key] = value
end
end
def [](key)
unless self.include?(key)
r... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | In ruby, whenever you write `object.horray` the message `horray` is sent to the object `object`, that will return a value. Since every `horray` is a message. If the object don't respond to this message, you can't distinguish between the object don't having an attribute with this name or if it don't have a method with t... | It's brutal, but you could overwrite the [new\_ostruct\_member](http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html#method-i-new_ostruct_member) method to generate an error:
```
require 'ostruct'
class CustomError < StandardError; end
os = OpenStruct.new({:a=>1, :b=>1})
def os.new_ostruct_member(n... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | OpenStruct defines singleton accessor methods on the object when you set a new member, so you can use `respond_to?` to see if the member is valid. In fact you can probably just capture any method not defined with method\_missing and throw the error unless it's a setter method name, in which case you pass it along to su... | It's brutal, but you could overwrite the [new\_ostruct\_member](http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html#method-i-new_ostruct_member) method to generate an error:
```
require 'ostruct'
class CustomError < StandardError; end
os = OpenStruct.new({:a=>1, :b=>1})
def os.new_ostruct_member(n... |
16,905,205 | I need to keep some binary data in my MongoDB collection. It seems that I'm getting different JSON representation of my documents when retrieving the same record using either the C++ driver or the Java driver.
Here is an example. Insert three record in MongoDB collection using Mongo shell:
```
db.binary_test.insert({... | 2013/06/03 | [
"https://Stackoverflow.com/questions/16905205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2449156/"
] | I use something like
```
hash = { a: 2, b: 3 }
Struct.new(*hash.keys).new(*hash.values).freeze
```
to get an immutable object which will raise `NoMethodError` in case unexpected method is invoked | It's brutal, but you could overwrite the [new\_ostruct\_member](http://www.ruby-doc.org/stdlib-2.0/libdoc/ostruct/rdoc/OpenStruct.html#method-i-new_ostruct_member) method to generate an error:
```
require 'ostruct'
class CustomError < StandardError; end
os = OpenStruct.new({:a=>1, :b=>1})
def os.new_ostruct_member(n... |
31,746,645 | In my `UITableView` I have Four cell. Each cell has its own class. But I can only `return` one of the cells. Here is my code
```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let firstCell = tableView.dequeueReusableCellWithIdentifier("FirstCell", forIn... | 2015/07/31 | [
"https://Stackoverflow.com/questions/31746645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5036573/"
] | ```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.row == 0 // or your custom condition
{ let firstCell = tableView.dequeueReusableCellWithIdentifier("FirstCell", forIndexPath: indexPath) as! FirstTableViewCell
return firstCell
... | This function is called multiple times. The `indexPath.row` would be used to determine which cell to return. You should check the value of this and only return the requested cell.
```
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell
switch inde... |
486,000 | I'm working on a WCF service that will be communicating over net.tcp to n instances of a client app (that is being developed by another programmer in my office).
At the moment I am using net.tcp without any security as I felt setting this up at this stage wasn't necessary, at least not until we are closer to rolling ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/486000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459159/"
] | While your overall design should consider security from the very beginning, I don't think it's a good idea to couple your components to any particular security strategy. You may very well want to use some of your components in a non-secure manner or across a different protocol which offers different security options.
... | Security should be thought about from the start, and not added on at the end.
Develop a plan for your security, and implement it as you go, rather then at the end.
Reference: Microsoft .NET: Architecting Applications for the Enterprise
<http://www.amazon.com/Microsoft>®-NET-Architecting-Applications-PRO-Developer/dp... |
486,000 | I'm working on a WCF service that will be communicating over net.tcp to n instances of a client app (that is being developed by another programmer in my office).
At the moment I am using net.tcp without any security as I felt setting this up at this stage wasn't necessary, at least not until we are closer to rolling ... | 2009/01/28 | [
"https://Stackoverflow.com/questions/486000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459159/"
] | While your overall design should consider security from the very beginning, I don't think it's a good idea to couple your components to any particular security strategy. You may very well want to use some of your components in a non-secure manner or across a different protocol which offers different security options.
... | You have two choices, bake it in from the beginning, or slap it on at the end. With security in general I would say it really does not work in the icing so you have to make a mess of your cake to get it in there.
However, the way I see your question is you already know you need to do something to solve a security issu... |
61,840,826 | I was trying to find a way to get a User object from a user's ID alone. `Client#fetchUser()` seemed to be what I was looking for, referring to this
[older question.](https://stackoverflow.com/questions/56619167/how-to-get-specific-member-username-with-discord-js)
However that function is no longer in the [Discord.js ... | 2020/05/16 | [
"https://Stackoverflow.com/questions/61840826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10318466/"
] | There are 2 ways to go about doing this:
Getting the user from the `client.users.cache` collection
```js
const user = client.users.cache.get(UserID)
```
Fetching the user using the `fetch()` method in the `UserManager` of `client.users`
```js
const user = client.users.fetch(UserID)
``` | It seems they merged the functionality of [UserManager#fetch()](https://discord.js.org/#/docs/main/stable/class/UserManager?scrollTo=fetch)
into what I was looking for, in which it is described as
```
Obtains a user from Discord, or the user cache if it's already available.
PARAMETER TYPE OPTIONAL DEFAULT D... |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | He could just
>
> go to his son and pull the emergency lever, doing both jobs together?
>
>
> | If he still has time to make it to the lever
>
> then he can also make it to his son first, since his son was on his way to the lever. So on his way to the lever, he lifts his son up (which should only take a few seconds) and then run towards the lever to lower the bridge.
>
>
>
Or
>
> he first runs towards t... |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | If he still has time to make it to the lever
>
> then he can also make it to his son first, since his son was on his way to the lever. So on his way to the lever, he lifts his son up (which should only take a few seconds) and then run towards the lever to lower the bridge.
>
>
>
Or
>
> he first runs towards t... | This is a very far-fetched answer and is not meant to be taken seriously
>
> The railroad operator is actually Jesus, and he lays down his life to save everyone from eternal punishment.
>
>
>
Offending anyone was not my intention. |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | He could just
>
> go to his son and pull the emergency lever, doing both jobs together?
>
>
> | Going with the lateral thinking tag,
>
> The father should tell the son to duck(then pull the lever) and since the child is young, he may be small enough to fit under the train. An article on what to do when stuck on a subway rail, "[A final option is to simply lie flat — there may be enough clearance for the train t... |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | Going with the lateral thinking tag,
>
> The father should tell the son to duck(then pull the lever) and since the child is young, he may be small enough to fit under the train. An article on what to do when stuck on a subway rail, "[A final option is to simply lie flat — there may be enough clearance for the train t... | This is a very far-fetched answer and is not meant to be taken seriously
>
> The railroad operator is actually Jesus, and he lays down his life to save everyone from eternal punishment.
>
>
>
Offending anyone was not my intention. |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | This is a brutal answer, but:
>
> You didn't ask "How can he save **these** hundreds of innocent people?" He could save his son and force his son to have children, thus saving hundreds of his progeny. **OR** He could save his son, then do humanitarian work to save hundreds of *other* innocent people.
>
>
> | This is a very far-fetched answer and is not meant to be taken seriously
>
> The railroad operator is actually Jesus, and he lays down his life to save everyone from eternal punishment.
>
>
>
Offending anyone was not my intention. |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | What's wrong with:
>
> Just signalling the red flag to the train so that it stops. Then, lower the bridge after it has stopped. If he has time to lower the bridge when the train is moving, surely he would have time when the train is decelerating to rest.
>
>
> | If he still has time to make it to the lever
>
> then he can also make it to his son first, since his son was on his way to the lever. So on his way to the lever, he lifts his son up (which should only take a few seconds) and then run towards the lever to lower the bridge.
>
>
>
Or
>
> he first runs towards t... |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | What's wrong with:
>
> Just signalling the red flag to the train so that it stops. Then, lower the bridge after it has stopped. If he has time to lower the bridge when the train is moving, surely he would have time when the train is decelerating to rest.
>
>
> | This is a brutal answer, but:
>
> You didn't ask "How can he save **these** hundreds of innocent people?" He could save his son and force his son to have children, thus saving hundreds of his progeny. **OR** He could save his son, then do humanitarian work to save hundreds of *other* innocent people.
>
>
> |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | What's wrong with:
>
> Just signalling the red flag to the train so that it stops. Then, lower the bridge after it has stopped. If he has time to lower the bridge when the train is moving, surely he would have time when the train is decelerating to rest.
>
>
> | This is a very far-fetched answer and is not meant to be taken seriously
>
> The railroad operator is actually Jesus, and he lays down his life to save everyone from eternal punishment.
>
>
>
Offending anyone was not my intention. |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | He could just
>
> go to his son and pull the emergency lever, doing both jobs together?
>
>
> | This is a brutal answer, but:
>
> You didn't ask "How can he save **these** hundreds of innocent people?" He could save his son and force his son to have children, thus saving hundreds of his progeny. **OR** He could save his son, then do humanitarian work to save hundreds of *other* innocent people.
>
>
> |
66,685 | A railroad operator lived with his only son. One day, a train was to cross the moveable bridge. Because of the operator's mistake, the bridge was lifted. His son saw the train and went up to pull the emergency lever, but slipped and got struck there. The man had still time to lower the bridge. But that would kill his s... | 2018/06/02 | [
"https://puzzling.stackexchange.com/questions/66685",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/47961/"
] | What's wrong with:
>
> Just signalling the red flag to the train so that it stops. Then, lower the bridge after it has stopped. If he has time to lower the bridge when the train is moving, surely he would have time when the train is decelerating to rest.
>
>
> | Going with the lateral thinking tag,
>
> The father should tell the son to duck(then pull the lever) and since the child is young, he may be small enough to fit under the train. An article on what to do when stuck on a subway rail, "[A final option is to simply lie flat — there may be enough clearance for the train t... |
11,162,846 | I have a datetime called dispatched\_time which I am subtracting from Time.now which results in a float number ie: 302.332 which is a method called elapsed\_time. I need to figure out a way to take the value of that number and format it into a time in my view. ie: 13:20.
I've tried to use elapsed\_time.strftime("%H%M"... | 2012/06/22 | [
"https://Stackoverflow.com/questions/11162846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392718/"
] | You could try `Time.at(elapsed_time).utc.strftime("%H:%M")`. This should give you the hours/minutes between the two times, created as if it were a time itself. Note that this may not work as well if there are more than 24 hours between the two times, in which case you would need to add a days parameter (`"%d"`) to the ... | You can try to use dotiw or ruby-duration gem. It may simplify things for you. |
96,572 | I have a problem with WSTP in the newest version of *Mathematica*. I get the same problem on Ubuntu 14.04 and Mint 17.2.
Using the pre-built examples (`...DeveloperKit/Linux-x86-64/PrebuiltExamples/...`) with `Install[...]` works fine.
However, after I successfully compile the examples in (`...DeveloperKit/Linux-x86-... | 2015/10/09 | [
"https://mathematica.stackexchange.com/questions/96572",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/34704/"
] | The hang (or wait for a WSTP connection) is due to the WSTP executable not starting. As the "error while loading shared libraries" message indicates, this is because it cannot find its shared library dependencies. This is expected behavior, per the [documentation](http://reference.wolfram.com/language/tutorial/WSTPDeve... | Ok, the problem was with the shared libraries. Things started working after I changed the Makefile to statically link to WSTP64i4lib.o. Thanks for the tips.
P.S. This helped:
[WSTP broken by upgrade to 10.0.1?](https://mathematica.stackexchange.com/questions/60445/wstp-broken-by-upgrade-to-10-0-1/60448#60448) |
278,389 | I had a problem [discovered on another thread here](https://stackoverflow.com/questions/265919/why-doesnt-multithreading-in-c-reach-100-cpu), I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21668/"
] | **On the topic of multiple STA components**
It is possible to have two instances of the same STA COM component and access them from C#. The only thing that could prevent you from such scenario is the object itself if implemented as a singleton object.
However, if both instances are on the same STA thread, an active c... | Try registering a second class using the same DLL. Consider that you may actually need a separate copy of the DLL with a different name in order to be completely safe.
Just remember that the STA COM class (and perhaps its DLL) is not considered thread safe for multi-threading and there is nothing you can do about that... |
278,389 | I had a problem [discovered on another thread here](https://stackoverflow.com/questions/265919/why-doesnt-multithreading-in-c-reach-100-cpu), I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21668/"
] | Franci Pernov,
I've tried work with two threads, and initialize the com instances on the context of each thread, but the error is the same: (Exception from HRESULT: 0x80004005 (E\_FAIL))
I am storing and retrieving the instance through CallContext GetData and SetData. | Try registering a second class using the same DLL. Consider that you may actually need a separate copy of the DLL with a different name in order to be completely safe.
Just remember that the STA COM class (and perhaps its DLL) is not considered thread safe for multi-threading and there is nothing you can do about that... |
278,389 | I had a problem [discovered on another thread here](https://stackoverflow.com/questions/265919/why-doesnt-multithreading-in-c-reach-100-cpu), I need to access a COM component that is STA. I'll run it on a dual-core computer, a process using this component only reaches 50% of CPU. Unfortunately, the owners said they can... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21668/"
] | **On the topic of multiple STA components**
It is possible to have two instances of the same STA COM component and access them from C#. The only thing that could prevent you from such scenario is the object itself if implemented as a singleton object.
However, if both instances are on the same STA thread, an active c... | Franci Pernov,
I've tried work with two threads, and initialize the com instances on the context of each thread, but the error is the same: (Exception from HRESULT: 0x80004005 (E\_FAIL))
I am storing and retrieving the instance through CallContext GetData and SetData. |
65,273,919 | so I've been struggling with this example for a good hour now and I can't even begin to process how should I do this.
>
> Write a program that, for given n and m, forms a matrix as described.
> The matrix should be m x m, and it's filled "spirally" with it's
> beginning in the upper left corner. The first value in th... | 2020/12/13 | [
"https://Stackoverflow.com/questions/65273919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14544094/"
] | *Some time ago I had made a function to display the numbers 1 to n on an odd-sized grid.
The principle was to start from the center and to shift by ;*
* x = 1
* x box on the right
* x box on the bottom
* x++
* x box on the left
* x box at the top
* x++
*With this simple algorithm, you can easily imagine to maybe star... | I finally solved it. If anybody's interested, here's how I did it:
```
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//Fills the row number "row" with the number n
int fillRow(int m, int n, int arr[m][m], int row)
{
int j;
for(j=0;j<m;j++)
{
if(arr[row][j] == -1 || arr[row][j] == n-1) ... |
48,259,076 | I am running Jmeter test in distributed mode. I have set up SSH tunneling for slaves since they are not in same region. I have executed 2700 users which ran fine. When we try to run 5200 users, users are going into finished status although steady state is 1 hours. I am using ultimate thread group.
4500 users are runni... | 2018/01/15 | [
"https://Stackoverflow.com/questions/48259076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9014818/"
] | In Startup.cs file add service like this:
```
services.AddAntiforgery(options => options.HeaderName = "RequestVerificationToken");
```
In your cshtml file add:
```
@Html.AntiForgeryToken()
$.ajax({
type: 'GET',
url: '/home/Demo1',
beforeSend: function (xhr) {
xhr.setRequestHeader("RequestVerifi... | If you don't want `[ValidateAntiForgeryToken]` remove it and it will work. If you want it, then you have to pass the auto generated cookie value to validate as mentioned below, check [this](https://stackoverflow.com/questions/13621934/validateantiforgerytoken-purpose-explanation-and-example).
```
[HttpPost]
[ValidateA... |
48,259,076 | I am running Jmeter test in distributed mode. I have set up SSH tunneling for slaves since they are not in same region. I have executed 2700 users which ran fine. When we try to run 5200 users, users are going into finished status although steady state is 1 hours. I am using ultimate thread group.
4500 users are runni... | 2018/01/15 | [
"https://Stackoverflow.com/questions/48259076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9014818/"
] | In Startup.cs file add service like this:
```
services.AddAntiforgery(options => options.HeaderName = "RequestVerificationToken");
```
In your cshtml file add:
```
@Html.AntiForgeryToken()
$.ajax({
type: 'GET',
url: '/home/Demo1',
beforeSend: function (xhr) {
xhr.setRequestHeader("RequestVerifi... | First change the URL to like 'Testing/Home' and Make sure you're passing data because if you don't it might throw 500 status code error.
In my case I wasn't passing any data I mean I was sending an empty form that was why. I thought it might help someone. |
21,310,734 | I've tried to read the documentation on `ng-include` with no luck thus far. All I want to do is have the `ng-include` evaluate the path of where the template/partial is and load the contents:
```
<div data-ng-include src="'{{pageData.src}}'"></div>
```
I can see `pageData.src` is returning `"tpl/page.html"` in the c... | 2014/01/23 | [
"https://Stackoverflow.com/questions/21310734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/152493/"
] | In ng-include src takes a javascript expression so in your case the following should work:
```
<div data-ng-include src="pageData.src"></div>
```
when you see it like this
```
<div data-ng-include src="'templates/myTemplate.html'"></div>
```
the extra single quote inside the double quotes is a javascript expres... | Try this:-
```
<div data-ng-include="pageData.src"></div>
```
If you can post a jsFiddle, it would be easy for me to see the exact problem. |
67,730,750 | The following code doesn't work with MSVC++ 2019, but it works on GCC compiler.
```
#include <set>
#include <string>
#include <iostream>
struct MyData {
MyData() {}
MyData(std::string keyA, std::string keyB) :keyA(keyA), keyB(keyB) {}
std::string keyA;
std::string keyB;
};
struct Compare {
boo... | 2021/05/27 | [
"https://Stackoverflow.com/questions/67730750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/255412/"
] | Your comparator fails to adhere to the rules for [strict weak ordering](https://www.boost.org/sgi/stl/StrictWeakOrdering.html), that is to say it is possible to have the following situation:
```
a < b
b < c
a >= c
```
MSVC has evidently detected this and raised an assertion failure.
To fix this, you can change your... | `Compare::operator()` is not correct. It does not meet the criteria of [strict weak ordering](https://www.boost.org/sgi/stl/StrictWeakOrdering.html).
You can change it to:
```
bool operator() (const MyData& lhs, const MyData& rhs) const
{
if (lhs.keyA != rhs.keyA)
return (lhs.keyA < rhs.keyA)
return ... |
71,372,741 | I'm trying to make a bot that keeps waiting for new tweets that contain certain keywords so that the bot likes and retweets them and I found a template code that seemed very good to me but it doesn't work for me, I don't know if it's because I have a updated version of Tweepy, could you help me please? This is the code... | 2022/03/06 | [
"https://Stackoverflow.com/questions/71372741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18386813/"
] | You're specifying all your credentials as the same `KEY` environment variable, which seems to not be defined. | Yo, not sure if you were able to solve this yet, but I'll provide a solution since no-one else did. As mentioned by @harmon758, you haven't specified where your .env file is stored.
A workaround to this can be to use the [dotenv plugin](https://pypi.org/project/python-dotenv/). Make sure that your .env file is stored ... |
71,372,741 | I'm trying to make a bot that keeps waiting for new tweets that contain certain keywords so that the bot likes and retweets them and I found a template code that seemed very good to me but it doesn't work for me, I don't know if it's because I have a updated version of Tweepy, could you help me please? This is the code... | 2022/03/06 | [
"https://Stackoverflow.com/questions/71372741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18386813/"
] | You're specifying all your credentials as the same `KEY` environment variable, which seems to not be defined. | I was actually having the same problem returning null value form my keys, but i didn't notice that in my .env file, instead of being like:
```
API_KEY='mykey'
```
was like:
```
API_KEY:'mykey'
```
try to verify if your keys are correct declared, maybe this should work. |
62,897,725 | I have following R-Code:
```
mat <- matrix(0L,500,10)
for(i in 1:500){
mat[i,] <- rnorm(10,0,1)
}
mat <- mat[mat[,10] >=-0.5,]
dim(mat)
```
I don't want to have values below -0.5 for my 10th column. However, I still want to have a matrix with 500 rows. Therefore I have to loop over my for-loop until dim(mat)[... | 2020/07/14 | [
"https://Stackoverflow.com/questions/62897725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12482394/"
] | You can initialize the matrix in one step, without using a loop:
```
mat <- matrix(rnorm(500*10,0,1), 500, 10)
```
Then, using a while loop, replace the values below `-0.5` in the 10th column by sampling the normal distribution until all of them are greater or equal than `0.5`:
```
while (sum(mat[, 10] < -0.5)) {
... | Using base r you could try this approach.
First create a matrix, using random normal values across 500 rows and 10 columns:
```
mat <- matrix(rnorm(500, 0, 1), nrow = 500, ncol = 10)
```
Then remove values below -0.5 from the 10th column:
```
mat[which(mat[, 10] < -0.5), 10] <- NA
```
Replace NA with an alternat... |
2,485,601 | c# .Net 3.5 visual studio 2008, windows xp
I have a main form in a project, given a specific set of circumstances another form is instantiated and displayed to the user:
```
Form frmT = new frmTargetFolder(expName, this);
frmT.Show();
```
As you can see, I am passing a reference to the new form from the cur... | 2010/03/21 | [
"https://Stackoverflow.com/questions/2485601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109614/"
] | You need to store an instance of `frmDataXfer` as a field in the `frmTargetFolder` class, then call the methods on that instance. | Your `setOverride` property is not marked `public`. Aside from the fact that properties shouldn't be named this way (`setOverride` sounds like the name of a method, not a property), the default access modifier for class members is `private`. You need to add the `public` modifier to **all** members that you want to make... |
2,485,601 | c# .Net 3.5 visual studio 2008, windows xp
I have a main form in a project, given a specific set of circumstances another form is instantiated and displayed to the user:
```
Form frmT = new frmTargetFolder(expName, this);
frmT.Show();
```
As you can see, I am passing a reference to the new form from the cur... | 2010/03/21 | [
"https://Stackoverflow.com/questions/2485601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109614/"
] | You need to store an instance of `frmDataXfer` as a field in the `frmTargetFolder` class, then call the methods on that instance. | Just remember that forms are first-and-foremost classes like any other, they just inherit from System.Windows.Forms.Form to give it special UI functions.
So, that being said, any `public` (or `internal` in the same project) field, property or method is accessible provided you have an instance of the object.
You don't... |
2,485,601 | c# .Net 3.5 visual studio 2008, windows xp
I have a main form in a project, given a specific set of circumstances another form is instantiated and displayed to the user:
```
Form frmT = new frmTargetFolder(expName, this);
frmT.Show();
```
As you can see, I am passing a reference to the new form from the cur... | 2010/03/21 | [
"https://Stackoverflow.com/questions/2485601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109614/"
] | it's already discussed something similiar to ur question here..
Anyway to access a variable of a form class, simply make the variable public and you can access it using an object of that class
Simple Example:
```
class Test : Form
{
___public int variable = 10; // visible!
___public Test() {}
}
```
[This](... | Your `setOverride` property is not marked `public`. Aside from the fact that properties shouldn't be named this way (`setOverride` sounds like the name of a method, not a property), the default access modifier for class members is `private`. You need to add the `public` modifier to **all** members that you want to make... |
2,485,601 | c# .Net 3.5 visual studio 2008, windows xp
I have a main form in a project, given a specific set of circumstances another form is instantiated and displayed to the user:
```
Form frmT = new frmTargetFolder(expName, this);
frmT.Show();
```
As you can see, I am passing a reference to the new form from the cur... | 2010/03/21 | [
"https://Stackoverflow.com/questions/2485601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109614/"
] | it's already discussed something similiar to ur question here..
Anyway to access a variable of a form class, simply make the variable public and you can access it using an object of that class
Simple Example:
```
class Test : Form
{
___public int variable = 10; // visible!
___public Test() {}
}
```
[This](... | Just remember that forms are first-and-foremost classes like any other, they just inherit from System.Windows.Forms.Form to give it special UI functions.
So, that being said, any `public` (or `internal` in the same project) field, property or method is accessible provided you have an instance of the object.
You don't... |
45,514,609 | I downloaded the map data from Open Street Map and also overpass-api.de (one of the alternative download sources) for a small section of Toronto, and one major road is missing, even though that same road is visible in the map when viewed on Open Street Map. That area of Toronto was recently updated on Open Street Map (... | 2017/08/04 | [
"https://Stackoverflow.com/questions/45514609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/577455/"
] | You can always use the openstreetmap.org Query Tool (the "?" question mark icon on the right) and point to any location on the map to request further details about a particular object.
If you downloadeded data from overpass-api.de and used some specific filter rules (like `way[highway=residential]`), that may also cau... | Alternatively to mmd's suggestion you can also just open your favorite OSM editor (e.g. [iD](https://wiki.openstreetmap.org/wiki/ID) or [JOSM](https://wiki.openstreetmap.org/wiki/JOSM)) and take a look at the data. This works a lot better than looking at raw XML. |
60,954,948 | I’m working on a project for the company I work at. They have a program that generates an XML file and would like to extract and format specific tag names as formatted output. To accomplish this, I’ve turned to Python and am currently writing two programs.
The first program successfully formats the raw data in the XML... | 2020/03/31 | [
"https://Stackoverflow.com/questions/60954948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13171731/"
] | Using lxml and xpath:
```
from lxml import etree
employees = '''your xml above'''
doc = etree.fromstring(employees)
outpersonals = doc.xpath('//ws_Personal')
for op in outpersonals:
fname = op.xpath('//ws_Formatted_Name/text()')[0]
eid = op.xpath('//ws_Employee_ID/text()')[0]
site = op.xpath('//ws_Business... | Instead of getting all the tags separately, just iterate through the workers.
xmldoc.getElementsByTagName("ws\_Worker") will return all instances of ws\_worker as a NodeList. When you specify the first one with the [0], you're only looking at the first element.
Why not iterate through it?
```
workers = xmldoc.getEle... |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | for brew installation: `sudo brew services restart nginx` | ```
sudo pkill nginx
sudo nginx
```
If the `pkill` can't be found, then install it using `brew install proctools` first. |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | For a one-liner, you could just do:
```
sudo nginx -s reload
```
The `-s` options stands for signal, and is the option you'll use to send `stop`, `quit`, `reopen` and `reload` signals to nginx.
For more info on the options, just do `nginx -h` for a list of all of them and their functions.
Cheers! | ```
sudo pkill nginx
sudo nginx
```
If the `pkill` can't be found, then install it using `brew install proctools` first. |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | If you are using **brew**:
To see all services:
```
brew services list
```
Start nginx service:
```
brew services start nginx
```
Stop nginx Service:
```
brew services stop nginx
``` | Just another note, if you want to start nginx with launchctl, when your Mac boots up, you can do as follows:
```
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
```
In short, you need to put your `plist` file in `/Library/LaunchDaemo... |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | for brew installation: `sudo brew services restart nginx` | sudo nginx -s quit && sudo nginx
Checkout [nginx guide](http://nginx.org/en/docs/beginners_guide.html) |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | for brew installation: `sudo brew services restart nginx` | Just another note, if you want to start nginx with launchctl, when your Mac boots up, you can do as follows:
```
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
```
In short, you need to put your `plist` file in `/Library/LaunchDaemo... |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | For a one-liner, you could just do:
```
sudo nginx -s reload
```
The `-s` options stands for signal, and is the option you'll use to send `stop`, `quit`, `reopen` and `reload` signals to nginx.
For more info on the options, just do `nginx -h` for a list of all of them and their functions.
Cheers! | If you installed nginx with brew and you started it as a service `brew services start nginx` then you can issue: `brew services restart nginx` |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | ```
sudo pkill nginx
sudo nginx
```
If the `pkill` can't be found, then install it using `brew install proctools` first. | Just another note, if you want to start nginx with launchctl, when your Mac boots up, you can do as follows:
```
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
```
In short, you need to put your `plist` file in `/Library/LaunchDaemo... |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | If you are using **brew**:
To see all services:
```
brew services list
```
Start nginx service:
```
brew services start nginx
```
Stop nginx Service:
```
brew services stop nginx
``` | sudo nginx -s quit && sudo nginx
Checkout [nginx guide](http://nginx.org/en/docs/beginners_guide.html) |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | ```
sudo nginx -s stop && sudo nginx
``` | If you are using **brew**:
To see all services:
```
brew services list
```
Start nginx service:
```
brew services start nginx
```
Stop nginx Service:
```
brew services stop nginx
``` |
225,948 | I just installed Nginx on Mac OS X (thanks <http://www.kevinworthington.com/nginx-mac-os-snow-leopard-2-minutes/>), but **how do I restart Nginx on Mac OS X?**
Thanks! | 2011/01/23 | [
"https://serverfault.com/questions/225948",
"https://serverfault.com",
"https://serverfault.com/users/67949/"
] | For a one-liner, you could just do:
```
sudo nginx -s reload
```
The `-s` options stands for signal, and is the option you'll use to send `stop`, `quit`, `reopen` and `reload` signals to nginx.
For more info on the options, just do `nginx -h` for a list of all of them and their functions.
Cheers! | for brew installation: `sudo brew services restart nginx` |
23,312,006 | I want hash-tags to be removed from URL after they are used.
For example, when i click on the link below:
```
<a href="#btnq1"><button type="button" name="" value="" id="btnq1">Just a button</button></a>
```
I want the hash-tag #btnq1 that appears to the URL of the page to be removed just after the action on this li... | 2014/04/26 | [
"https://Stackoverflow.com/questions/23312006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/501986/"
] | You could try that:
```
$(window).on('hashchange', function(e){
history.replaceState ("", document.title, e.originalEvent.oldURL);
});
``` | first add a class to your a tag that you want this behavior for, or a html 5 data- attribute. Then your link becomes;
```
<a href="#btnq1" class="remove-hash"><button>Button</button></a>
$('body').on('click', ".remove-hash", function(e){
$(this).removeAttr('href');
});
``` |
1,219,867 | I just recently bought a Samsung Earphones (3 mm one jack) with legit & working inline controls & mic, tho it only works on smartphones and tablets? **Is it possible to make it work on PC too?** Do I need drivers for that?
[My headphones here](https://i.stack.imgur.com/AlBm7.png)
I'm just using the Generic Sound Driv... | 2017/06/16 | [
"https://superuser.com/questions/1219867",
"https://superuser.com",
"https://superuser.com/users/739227/"
] | The standard audio outputs are output only. There is no hardware to receive the feedback. A headphone with a microphone built in has 4 channels where a normal plug has 3. Count the black bands on the plug. You will see either 2 black bands or 3.
There is only one audio input on most sound cards. If you need multiple a... | For the Headphones to work properly. You should use an adapter like this one :
[Jack Spliter](http://rads.stackoverflow.com/amzn/click/B0016LDZ36)
---
For the advanced functions to work (separate volumes etc..), you need to install compatible and proper drivers. The main issue here is that your OEM probably does not ... |
1,219,867 | I just recently bought a Samsung Earphones (3 mm one jack) with legit & working inline controls & mic, tho it only works on smartphones and tablets? **Is it possible to make it work on PC too?** Do I need drivers for that?
[My headphones here](https://i.stack.imgur.com/AlBm7.png)
I'm just using the Generic Sound Driv... | 2017/06/16 | [
"https://superuser.com/questions/1219867",
"https://superuser.com",
"https://superuser.com/users/739227/"
] | The standard audio outputs are output only. There is no hardware to receive the feedback. A headphone with a microphone built in has 4 channels where a normal plug has 3. Count the black bands on the plug. You will see either 2 black bands or 3.
There is only one audio input on most sound cards. If you need multiple a... | I've found the perfect solution. I've recently bought one of these too and it worked after these steps:
1. Search HD audio manager
2. Click the folder on top right.
3. Tick the box where it says to popup when new device plugged in
4. Reconnect your earphones
5. Now when popup select 'HEADSET'
6. Now you are ready, jus... |
15,538,835 | I am getting some part of my button dropdown out of the page viewing area.

I am using standard bootstrap code:
```
<div class="btn-group">
<button class="btn btn-info">Log In</button>
<button class="btn btn-info dropdown-toggle" data-toggle... | 2013/03/21 | [
"https://Stackoverflow.com/questions/15538835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/922929/"
] | I guess you didn't position the `.btn-group` in the right way.
Put it into the `.navbar-inner`-div and add the class `.pull-right`.
DEMO [JSFIDDLE](http://jsfiddle.net/handtrix/MgcDU/8244/)
```
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Title</a>
<ul class="nav">
... | You can make the following:
```
.dropdown-menu {
left: -80px;
}
```
I don't know why but pulling left is useless. |
2,330,094 | $$1=4a+2b+c$$
$$4=9a+3b+c$$
$$\frac{-b^2+4ac}{4a}=-\frac{b}{2a}+1$$
It's all the afternoon I try to solve this...
Can you point me in the right direction or show me how it's done?
I replaced c with $-4a-2b+1$ in the other two...
First post, sorry for any mistake... | 2017/06/20 | [
"https://math.stackexchange.com/questions/2330094",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/456587/"
] | multiplying the third equation by $$4a$$ we obtain:
$$4ac-b^2=-2b+4a$$
solving this equation for $c$ we get
$$c=\frac{b^2-2b+4a}{4a}$$
plugging this in equation (1) and (2):
$$1=4a+2b+\frac{b^2-2b+4a}{4a}$$
$$4=9a+3b+\frac{b^2-2b+4a}{4a}$$
the equation above is equivalent to
$$0=a^2+\frac{1}{2}ab+\frac{b^2-2b}{16}$$
fr... | Well, we have the following system of equations:
$$
\begin{cases}
4\cdot\text{a}+2\cdot\text{b}+\text{c}=1\\
\\
9\cdot\text{a}+3\cdot\text{b}+\text{c}=4\\
\\
\frac{4\cdot\text{a}\cdot\text{c}-\text{b}^2}{4\cdot\text{a}}=1-\frac{\text{b}}{2\cdot\text{a}}
\end{cases}\tag1
$$
Using the first and the third equation:
$$\... |
2,330,094 | $$1=4a+2b+c$$
$$4=9a+3b+c$$
$$\frac{-b^2+4ac}{4a}=-\frac{b}{2a}+1$$
It's all the afternoon I try to solve this...
Can you point me in the right direction or show me how it's done?
I replaced c with $-4a-2b+1$ in the other two...
First post, sorry for any mistake... | 2017/06/20 | [
"https://math.stackexchange.com/questions/2330094",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/456587/"
] | multiplying the third equation by $$4a$$ we obtain:
$$4ac-b^2=-2b+4a$$
solving this equation for $c$ we get
$$c=\frac{b^2-2b+4a}{4a}$$
plugging this in equation (1) and (2):
$$1=4a+2b+\frac{b^2-2b+4a}{4a}$$
$$4=9a+3b+\frac{b^2-2b+4a}{4a}$$
the equation above is equivalent to
$$0=a^2+\frac{1}{2}ab+\frac{b^2-2b}{16}$$
fr... | This make lay out makes me think of polynomials of degree 2.
$p(x) = ax^2 + bx +c\\
p(1) = 1\\
p(2) = 4\\
$
It would be really nice if $p(x) = (x-1)^2$ unfortunately it doesn't fit with the last equation
$9a + 3b + c = 4\\
4a + 2b + c = 1\\
5a + b = 3\\
b = 3-5a$
substitute
$4a + 2(3-5a) + c = 1\\
c = 6a - 5$
And... |
133,378 | In my institution, we have various lab exams in which part of the exam is completing a programming task, and a computer is available to each student for this purpose.
There are there various ways to submit the exercise then: for instance, files can be submitted through a dedicated web service (elegant and easy to use... | 2019/07/15 | [
"https://academia.stackexchange.com/questions/133378",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/958/"
] | My university in the UK provides such "locked down exam mode". Students log in with special "exam accounts", while their normal accounts are disabled for the time being. Exam accounts have limited access to network, permitting access to the University network (including submission servers, licensing servers, and other ... | Your locked-down exam mode only need to be some special network rules. You probably want it to be a restriction so that the computer can only communicate with:
* The Active Directory
* The license server
* The server providing the questions
* The server where answers are submitted
* Maybe a DNS server
This could be p... |
463,575 | >
> Его авторы утверждают, что за оппозиционным журналистом Владимиром
> Кара-Мурзой — младшим, который дважды оказывался в больнице с тяжелым
> отравлением, следили...
>
>
>
<https://www.rbc.ru/politics/11/02/2021/602542d49a7947d83d38ff6d>
Стоит ли «отодвигать» обозначение «младший» посредством тире, или коль ск... | 2021/02/11 | [
"https://rus.stackexchange.com/questions/463575",
"https://rus.stackexchange.com",
"https://rus.stackexchange.com/users/4345/"
] | Думаю, что написание *Владимир Кара-Мурза — младший* является вполне возможным.
Ориентируемся на ПАС ([§ 154](https://orfogrammka.ru/%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D0%B0_%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D0%B9_%D0%BE%D1%80%D1%84%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D0%B8_%D0%B8_%D0%BF%D1%83%D0%BD%D0%BA%D1%82%D... | >
> Стоит ли «отодвигать» обозначение «младший» посредством тире, или коль
> скоро оно нередко присоединяется дефисом, не избегать повтора?
> Кара-Мурза-младший?
>
>
>
Дефис здесь не подходит просто по той причине, что "младший" относится не к только к фамилии, но и к имени. Здесь, конечно, чувствуется влияние анг... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | Thanks to 42's comment, I've managed to write a function to recode the file:
```
fix.encoding <- function(df, originalEncoding = "latin1") {
numCols <- ncol(df)
for (col in 1:numCols) Encoding(df[, col]) <- originalEncoding
return(df)
}
```
The meat here is the command `Encoding(df[, col]) <- "latin1"`, which ... | Thank you for posting this. I took the liberty to modify your function in case you have a dataframe with some columns as character and some as non-character. Otherwise, an error occurs:
```
> fix.encoding(adress)
Error in `Encoding<-`(`*tmp*`, value = "latin1") :
a character vector argument expected
```
So here is ... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | Thanks to 42's comment, I've managed to write a function to recode the file:
```
fix.encoding <- function(df, originalEncoding = "latin1") {
numCols <- ncol(df)
for (col in 1:numCols) Encoding(df[, col]) <- originalEncoding
return(df)
}
```
The meat here is the command `Encoding(df[, col]) <- "latin1"`, which ... | following up on previous answers, this is a minor update which makes it work on factors and dplyr's tibble. Thanks for inspiration.
```
fix.encoding <- function(df, originalEncoding = "UTF-8") {
numCols <- ncol(df)
df <- data.frame(df)
for (col in 1:numCols)
{
if(class(df[, col]) == "character"){
... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | Thanks to 42's comment, I've managed to write a function to recode the file:
```
fix.encoding <- function(df, originalEncoding = "latin1") {
numCols <- ncol(df)
for (col in 1:numCols) Encoding(df[, col]) <- originalEncoding
return(df)
}
```
The meat here is the command `Encoding(df[, col]) <- "latin1"`, which ... | Another option using dplyr's `mutate_if`:
```
fix_encoding <- function(x) {
Encoding(x) <- "latin1"
return(x)
}
data <- data %>%
mutate_if(is.character,fix_encoding)
```
And for factor variables that have to be recoded:
```
fix_encoding_factor <- function(x) {
x <- as.character(x)
Encoding(x) <- "latin1... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | following up on previous answers, this is a minor update which makes it work on factors and dplyr's tibble. Thanks for inspiration.
```
fix.encoding <- function(df, originalEncoding = "UTF-8") {
numCols <- ncol(df)
df <- data.frame(df)
for (col in 1:numCols)
{
if(class(df[, col]) == "character"){
... | Thank you for posting this. I took the liberty to modify your function in case you have a dataframe with some columns as character and some as non-character. Otherwise, an error occurs:
```
> fix.encoding(adress)
Error in `Encoding<-`(`*tmp*`, value = "latin1") :
a character vector argument expected
```
So here is ... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | Thank you for posting this. I took the liberty to modify your function in case you have a dataframe with some columns as character and some as non-character. Otherwise, an error occurs:
```
> fix.encoding(adress)
Error in `Encoding<-`(`*tmp*`, value = "latin1") :
a character vector argument expected
```
So here is ... | Another option using dplyr's `mutate_if`:
```
fix_encoding <- function(x) {
Encoding(x) <- "latin1"
return(x)
}
data <- data %>%
mutate_if(is.character,fix_encoding)
```
And for factor variables that have to be recoded:
```
fix_encoding_factor <- function(x) {
x <- as.character(x)
Encoding(x) <- "latin1... |
34,024,654 | I have an .RData file to read on my Linux (UTF-8) machine, but I know the file is in Latin1 because I've created them myself on Windows. Unfortunately, I don't have access to the original files or a Windows machine and I need to read those files on my Linux machine.
To read an Rdata file, the normal procedure is to ru... | 2015/12/01 | [
"https://Stackoverflow.com/questions/34024654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1169233/"
] | following up on previous answers, this is a minor update which makes it work on factors and dplyr's tibble. Thanks for inspiration.
```
fix.encoding <- function(df, originalEncoding = "UTF-8") {
numCols <- ncol(df)
df <- data.frame(df)
for (col in 1:numCols)
{
if(class(df[, col]) == "character"){
... | Another option using dplyr's `mutate_if`:
```
fix_encoding <- function(x) {
Encoding(x) <- "latin1"
return(x)
}
data <- data %>%
mutate_if(is.character,fix_encoding)
```
And for factor variables that have to be recoded:
```
fix_encoding_factor <- function(x) {
x <- as.character(x)
Encoding(x) <- "latin1... |
61,219,493 | I have a list of dictionaries in `event_records` and a subset of the list is below. Each dictionary contains 2 or 3 key-value pairs. The first key is `item` and the corresponding value is `event#status`.
The second key is `count` and the corresponding value consists of a dictionary containing 8 key-value pairs + 1 ke... | 2020/04/15 | [
"https://Stackoverflow.com/questions/61219493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12022786/"
] | Since your domain is limited, I would just go with something like this:
```
trait Risk extends Product with Serializable
object Risk {
def isUnacceptableRisk(risk: Risk): Boolean = risk match {
case UnacceptableRisk(_) => true
case _ => false
}
// Repeat for other types if needed.
}
fi... | It helps:
```
def any[T <: Risk: Manifest] =
seq.collect { case x: T => x }.nonEmpty
``` |
27,602 | *Local History* is a feature in IntelliJ and Eclipse, which for every file keeps a history of its changes:
* [IntelliJ Local History](https://www.jetbrains.com/help/idea/2016.2/local-history.html)
* [Eclipse Local History](http://help.eclipse.org/mars/topic/org.eclipse.platform.doc.user/gettingStarted/qs-55.htm)
It i... | 2016/10/06 | [
"https://emacs.stackexchange.com/questions/27602",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/8261/"
] | I think [undo-tree](https://melpa.org/#/undo-tree) looks like the closest match to these features. Although, it's hardly a one-to-one match.
It is possible to navigate between changes more readily by visualizing the 'tree' of changes using `C-x``u`. It is then possible to navigate to the various changes.
There are no... | That is the plugin you are searching
[Emacs-localhistory](https://github.com/cneira/emacs-localhistory) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.