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 |
|---|---|---|---|---|---|
58,701,955 | I have this array (it is an example) and I'd like to get the duplicate items and push it into another array.
```
let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"]
```
I tried to loop with `foreach` and got this:
My code:
```
var counts = [];
arr.... | 2019/11/04 | [
"https://Stackoverflow.com/questions/58701955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11512309/"
] | The `counts` object has strings as it's indexes. Use `Object.keys` to get a list of keys.
[](https://i.stack.imgur.com/3IuR3.png) | Your first code is just fine, you just add another array for distinct values add push into that also if must.
```
var counts = [], dist=[];
arr.forEach(function(x) {
counts[x] = (counts[x] || 0)+1
var didAdd = counts[x]==1 ? (dist.push(x)):false
});
``` |
10,958,904 | I am trying to generate the pdf from following python programming but generated output doesn't display hebrew letters correctly
```
# -*- coding: utf-8 -*-
from reportlab.pdfgen import canvas
def hello(c):
c.drawString(100,100, "ืื ืฉืืืื")
c = canvas.Canvas("hello.pdf")
hello(c)
c.showPage()
c.save()
``` | 2012/06/09 | [
"https://Stackoverflow.com/questions/10958904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/634615/"
] | This code (see below) works! All you need to do is place `ArialHB.ttf` (or any other font that supports Hebrew characters) into `site-packages/reportlab/fonts`...
The desired output will be at the bottom of the pdf page.
```
# -*- coding: utf-8 -*-
from reportlab.pdfgen import canvas
from reportlab.pdfbase import ... | If you use the proper decode call like `"ืื ืฉืืืื".decode("utf-8")` it works.
```
# -*- coding: utf-8 -*-
from reportlab.pdfgen import canvas
def hello(c):
c.drawString(100,100, "ืื ืฉืืืื".decode("utf-8"))
c = canvas.Canvas("hello.pdf")
hello(c)
c.showPage()
c.save()
``` |
33,341 | We can have this Graph:
```
v = {1 \[UndirectedEdge] 9, 1 \[UndirectedEdge] 10,
1 \[UndirectedEdge] 8, 10 \[UndirectedEdge] 2,
10 \[UndirectedEdge] 5, 9 \[UndirectedEdge] 3,
9 \[UndirectedEdge] 6, 8 \[UndirectedEdge] 7,
8 \[UndirectedEdge] 4, 7 \[UndirectedEdge] 3,
7 \[UndirectedEdge] 2, 6 \[UndirectedEdge] 2,
6... | 2013/10/02 | [
"https://mathematica.stackexchange.com/questions/33341",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/7035/"
] | I am sure there must be an easier way (I cannot see at the moment), but it is possible to use `VertexLabels` the way you want:
```
labs = CharacterRange["a", "j"];
g = Graph[v,
VertexLabels -> (With[{vtx = Range@VertexCount@Graph@v},
Rule @@@ Transpose[{vtx, Placed[ToString@# <> "\n" <> labs[[#]] "\... | Quite similar to Pinguin Dirk's answer, but here it is:
```
v = {1 \[UndirectedEdge] 9, 1 \[UndirectedEdge] 10,
1 \[UndirectedEdge] 8, 10 \[UndirectedEdge] 2,
10 \[UndirectedEdge] 5, 9 \[UndirectedEdge] 3,
9 \[UndirectedEdge] 6, 8 \[UndirectedEdge] 7,
8 \[UndirectedEdge] 4, 7 \[UndirectedEdge] ... |
33,341 | We can have this Graph:
```
v = {1 \[UndirectedEdge] 9, 1 \[UndirectedEdge] 10,
1 \[UndirectedEdge] 8, 10 \[UndirectedEdge] 2,
10 \[UndirectedEdge] 5, 9 \[UndirectedEdge] 3,
9 \[UndirectedEdge] 6, 8 \[UndirectedEdge] 7,
8 \[UndirectedEdge] 4, 7 \[UndirectedEdge] 3,
7 \[UndirectedEdge] 2, 6 \[UndirectedEdge] 2,
6... | 2013/10/02 | [
"https://mathematica.stackexchange.com/questions/33341",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/7035/"
] | You could use `Labeled`. Because 2 of the 3 elements are placed outside the vertex, you can use smaller vertices.
```
Graph[{ Labeled[1, Placed[{1, "New York", "USA"}, {Center, Above, Below}]],
Labeled[2, Placed[{2, "Paris", "France"}, {Center, Above, Below}]],
Labeled[3, Placed[{3, "Rome", "Italy"},... | Quite similar to Pinguin Dirk's answer, but here it is:
```
v = {1 \[UndirectedEdge] 9, 1 \[UndirectedEdge] 10,
1 \[UndirectedEdge] 8, 10 \[UndirectedEdge] 2,
10 \[UndirectedEdge] 5, 9 \[UndirectedEdge] 3,
9 \[UndirectedEdge] 6, 8 \[UndirectedEdge] 7,
8 \[UndirectedEdge] 4, 7 \[UndirectedEdge] ... |
22,869,637 | You can set a variable for a single command like this:
```
MY_VARIABLE=my_value ./my_script.sh
```
You can hand off to another script like this:
```
exec ./my_script.sh
```
But when I try to do both like this:
```
exec MY_VARIABLE=my_value ./my_script.sh
```
I get an error:
```
exec: MY_VARIABLE=my_value: not... | 2014/04/04 | [
"https://Stackoverflow.com/questions/22869637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1570226/"
] | You need to use `env` to specify the environment variable:
```
exec env MY_VARIABLE=my_value ./my_script.sh
```
If you want your script to start with an empty environment or with only the specified variables, use the `-i` option.
From `man env`:
```
env - run a program in a modified environment
``` | In bash, you can set environment variables for a command by putting the assignments at the beginning of the command. This works the same for `exec` as any other command, so you write:
```
MYVARIABLE=my_value exec ./my_script.sh
``` |
295,110 | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | From [MSDN](http://msdn.microsoft.com/en-us/library/yt3yck0x(VS.71).aspx), its scope is the file | Although could you not go down the route of Mock objects, ala [Mock.Rhinos](http://ayende.com/projects/rhino-mocks.aspx) ? |
295,110 | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | As Chris said, the scope of #define is just the file. (It's worth noting that this isn't the same as "the class" - if you have a partial type, it may consist of two files, one of which has symbol defined and one of which doesn't!
You can also define a symbol project-wide, but that's done with [project properties](http... | From [MSDN](http://msdn.microsoft.com/en-us/library/yt3yck0x(VS.71).aspx), its scope is the file |
295,110 | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | From [MSDN](http://msdn.microsoft.com/en-us/library/yt3yck0x(VS.71).aspx), its scope is the file | Yes as Chris mentioned, its scope is the whole file. You can use the defined keyword anywhere in the file.
i.e;
```
#define something
... some code ...
```
and in any method, class body or namespace, you could use it like;
```
#if something
... some conditional code ...
#else
... otherwise ...
#endif
``` |
295,110 | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | As Chris said, the scope of #define is just the file. (It's worth noting that this isn't the same as "the class" - if you have a partial type, it may consist of two files, one of which has symbol defined and one of which doesn't!
You can also define a symbol project-wide, but that's done with [project properties](http... | Although could you not go down the route of Mock objects, ala [Mock.Rhinos](http://ayende.com/projects/rhino-mocks.aspx) ? |
295,110 | I'm looking to use:
```
#define
```
and
```
#if
```
to allow me to simulate potentially absent hardware during unit tests. What are the rules for using the `#define` statements?
i.e. what is its default scope? can I change the scope of the directive? | 2008/11/17 | [
"https://Stackoverflow.com/questions/295110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | As Chris said, the scope of #define is just the file. (It's worth noting that this isn't the same as "the class" - if you have a partial type, it may consist of two files, one of which has symbol defined and one of which doesn't!
You can also define a symbol project-wide, but that's done with [project properties](http... | Yes as Chris mentioned, its scope is the whole file. You can use the defined keyword anywhere in the file.
i.e;
```
#define something
... some code ...
```
and in any method, class body or namespace, you could use it like;
```
#if something
... some conditional code ...
#else
... otherwise ...
#endif
``` |
57,936,210 | This is my first post here.
My question is, how to combine row when timestamp (base on date only Y-m-d), item\_condition and equipment\_spare\_id are same. Then GROUP\_CONCAT remark and serial\_number.
In this case, it should has 2 row.
Thanks in advance.
 | 2019/09/14 | [
"https://Stackoverflow.com/questions/57936210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11784133/"
] | For step 1, just use conditional aggregation:
```
SELECT
id,
MAX(CASE WHEN field = 'Color' THEN value END) color,
MAX(CASE WHEN field = 'Price' THEN value END) price,
MAX(CASE WHEN field = 'Size' THEN value END) size
FROM mytable
GROUP BY id
```
Step 2 does not look like something that can be done ... | For step 2:
```
select t1.id as id1, t2.id as id2
from eav t1
join eav t2
on t2.Id > t1.id
and t2.Field = t1.Field
and t2.Value = t1.value
group by t1.id, t2.id
having count(*) >= 2
```
Result:
```
| id1 | id2 |
| --- | --- |
| 1 | 2 |
| 3 | 4 |
```
See [demo](https://www.db-fiddle.com/f/eQx1Kzqwf... |
14,171,332 | given the following array:
```
Array
(
[0] => Array
(
[id_contract] => 1
[contract_months] => 5
[months_with_expenses] => 1
)
[1] => Array
(
[id_contract] => 2
[contract_months] => 12
[months_with_expenses] => 0
... | 2013/01/05 | [
"https://Stackoverflow.com/questions/14171332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161397/"
] | Try this:
```
foreach ($array as $key => $element) {
if (conditions) {
unset($array[$key]);
}
}
``` | A simple loop with an if condition and unset would work
```
<?php
for( i=0; i<count($arr); i++){
if($arr[i]['contract_months'] != $arr[i]['months_with_expenses']) {
unset($arr[i]);
}
}
``` |
14,171,332 | given the following array:
```
Array
(
[0] => Array
(
[id_contract] => 1
[contract_months] => 5
[months_with_expenses] => 1
)
[1] => Array
(
[id_contract] => 2
[contract_months] => 12
[months_with_expenses] => 0
... | 2013/01/05 | [
"https://Stackoverflow.com/questions/14171332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161397/"
] | You can try this :
```
foreach($arr as $key=>$value) {
if($value['contract_months'] != $value['months_with_expenses']) {
unset($arr[$key]);
}
}
``` | A simple loop with an if condition and unset would work
```
<?php
for( i=0; i<count($arr); i++){
if($arr[i]['contract_months'] != $arr[i]['months_with_expenses']) {
unset($arr[i]);
}
}
``` |
14,171,332 | given the following array:
```
Array
(
[0] => Array
(
[id_contract] => 1
[contract_months] => 5
[months_with_expenses] => 1
)
[1] => Array
(
[id_contract] => 2
[contract_months] => 12
[months_with_expenses] => 0
... | 2013/01/05 | [
"https://Stackoverflow.com/questions/14171332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/161397/"
] | Try this:
```
foreach ($array as $key => $element) {
if (conditions) {
unset($array[$key]);
}
}
``` | You can try this :
```
foreach($arr as $key=>$value) {
if($value['contract_months'] != $value['months_with_expenses']) {
unset($arr[$key]);
}
}
``` |
40,082 | I had problem using admin-ajax.php while creating one plugin. I had problem using
"add\_action( 'wp\_ajax\_ajax\_action', 'ajax\_action\_stuff' )" in my plugin where i have used oop module. So I want to go with jquery native way like below :
```
$.ajax({
url: "test.html",
context: document.body,
success: functi... | 2012/01/25 | [
"https://wordpress.stackexchange.com/questions/40082",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11668/"
] | Try
```
function foo_edit_post_link($link) {
if (is_home()) {
return FALSE;
}
return $link;
}
``` | Assuming you're using a custom template why not just remove the\_loop from your template? |
43,002,845 | I'm trying to build a webserver in **Google Cloud Platform** that hosts multiple websites (GBP, IE, FR, DK etc.)
Generally, we assign a range of IPs to the server statically, set the bindings in IIS, then loadbalance using a virtual IP.
It seems near enough impossible to assign another internal IP in GCP. Lots of gu... | 2017/03/24 | [
"https://Stackoverflow.com/questions/43002845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7049520/"
] | Answer that I recieved from GCE discussion group, in Google Groups:
"You can add additional internal IP addresses to a VM instance. This is possible by enabling IP forwarding for the VM, creating a static network route, adding appropriate firewall rules, and setting additional internal IP addresses to network adapter ... | Update:
Now, you can create instances with multiple network interfaces On Google Compute Engine and assign IPs. For more information, refer to this [public documentation link](https://cloud.google.com/vpc/docs/create-use-multiple-interfaces). However, currently it has following limitations:
* Alias IP ranges are not... |
31,379,952 | I have a div like this:
```
<div class="alert alert-danger">Please enter an email address</div>
```
I want to write a XPath expression such that if the div contains `Please enter an email address` and class is exact equal to `alert alert-danger` it should return me the element. Currently I have this xpath `"//*[cont... | 2015/07/13 | [
"https://Stackoverflow.com/questions/31379952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1323697/"
] | You could use LINQ to find out if there are any visible and empty TextBoxes like so:
```
var query =
from t in Page.Controls.OfType<TextBox>()
where t.Visible && t.Text == ""
select t;
bool hasUnanswered = query.Any();
``` | This can be easily done on the client side .
1. First you need to identify which all text box are visible . For this you can use jquery [Visible Selector](https://api.jquery.com/visible-selector/)
2. Now If more than one text box is visible . Show some message to the user and focus and highlight the text box which ne... |
31,379,952 | I have a div like this:
```
<div class="alert alert-danger">Please enter an email address</div>
```
I want to write a XPath expression such that if the div contains `Please enter an email address` and class is exact equal to `alert alert-danger` it should return me the element. Currently I have this xpath `"//*[cont... | 2015/07/13 | [
"https://Stackoverflow.com/questions/31379952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1323697/"
] | You could use LINQ to find out if there are any visible and empty TextBoxes like so:
```
var query =
from t in Page.Controls.OfType<TextBox>()
where t.Visible && t.Text == ""
select t;
bool hasUnanswered = query.Any();
``` | I managed to do it using a very long `if` statement. Here goes nothing:
```
if ((pnlQ1Yes.Visible == true && txtQ1Specify.Text.Length == 0) ||
(pnlQ2Yes.Visible == true && txtQ2Specify.Text.Length == 0) ||
(pnlQ3Yes.Visible == true && txtQ3Specify.Text.Length == 0) ||
(pnlQ4Yes.Visi... |
1,628,037 | After my measurements I end up with a row of failed and passed tests (`x` = failed, `o` = passed).
This row starts with `x` or `o` and changes one time.
```
Example A) xxxoo
Example B) ooox
Example C) ooxxxxx
```
I am now searching for a function that gives me the second part of the string where all letters are the ... | 2021/02/22 | [
"https://superuser.com/questions/1628037",
"https://superuser.com",
"https://superuser.com/users/1276890/"
] | Running WSL within WSL will work:
```
/mnt/c/Windows/System32/wsl.exe -l -v
```
The output isn't ascii so you could convert then match on the env var WSL\_DISTRO\_NAME:
```
/mnt/c/Windows/System32/wsl.exe -l -v | iconv -f unicode | dos2unix |grep $WSL_DISTRO_NAME | awk '{print $NF}'
```
'
Your installation may n... | I think I prefer @DuncG's answer. I think the only way it could fail would be if `Interop` was disabled in `/etc/wsl.conf`. As long as you are confident that interop is always turned on, that seems like the way to go.
But I'll add that there are quite a few differences between WSL1 and WSL2 that could be used as class... |
68,782,380 | I inserted into `.content` some buttons with `innerHTML`, and I used `addEventListener` to got the onclick event and show a message when each button clicked. The problem is that only the last button's `onclick` works, What is the problem?
```js
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68782380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10307137/"
] | Using `var btn = btn_option[btn_option.length - 1]` makes you select the second button as `btn-option.length - 1` is 1. Thats means you select the button at index 1. and not both 0 & 1.
Try using
```
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
x.innerHTML += `
<button type="button... | try this code
```js
var wrapper = document.getElementById("content")
wrapper.addEventListener("click", function(ev){
var btn_option = document.getElementsByClassName("click-btn");
Object.keys(btn_option).forEach(function(key){
if(ev.target == btn_option[key]){
console.log("btn "+ btn_option[key].getAttr... |
68,782,380 | I inserted into `.content` some buttons with `innerHTML`, and I used `addEventListener` to got the onclick event and show a message when each button clicked. The problem is that only the last button's `onclick` works, What is the problem?
```js
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68782380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10307137/"
] | Using `var btn = btn_option[btn_option.length - 1]` makes you select the second button as `btn-option.length - 1` is 1. Thats means you select the button at index 1. and not both 0 & 1.
Try using
```
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
x.innerHTML += `
<button type="button... | You also can loop your code like this.
```
var x = document.getElementById("content");
for(let i = 0; i < 2; i++) {
x.innerHTML += `<button type="button" class="click-btn" id="click-btn-id" value="${i}"> click me</button>`;
// get last button that was INNER to .content
var btn_option = document.getElementsByClassN... |
68,782,380 | I inserted into `.content` some buttons with `innerHTML`, and I used `addEventListener` to got the onclick event and show a message when each button clicked. The problem is that only the last button's `onclick` works, What is the problem?
```js
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68782380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10307137/"
] | It's because you override the content by setting `innerHTML` directly.
The working way is to append button html to the DOM using `insertAdjacentHTML`, for example.
```js
var x = document.getElementById("content");
for (let i = 0; i < 2; i++) {
buttonHTML = `
<button type="button" class="click-btn" id="click... | try this code
```js
var wrapper = document.getElementById("content")
wrapper.addEventListener("click", function(ev){
var btn_option = document.getElementsByClassName("click-btn");
Object.keys(btn_option).forEach(function(key){
if(ev.target == btn_option[key]){
console.log("btn "+ btn_option[key].getAttr... |
68,782,380 | I inserted into `.content` some buttons with `innerHTML`, and I used `addEventListener` to got the onclick event and show a message when each button clicked. The problem is that only the last button's `onclick` works, What is the problem?
```js
var x = document.getElementById("content");
for(let i = 0; i < 2; i++)
{
... | 2021/08/14 | [
"https://Stackoverflow.com/questions/68782380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10307137/"
] | It's because you override the content by setting `innerHTML` directly.
The working way is to append button html to the DOM using `insertAdjacentHTML`, for example.
```js
var x = document.getElementById("content");
for (let i = 0; i < 2; i++) {
buttonHTML = `
<button type="button" class="click-btn" id="click... | You also can loop your code like this.
```
var x = document.getElementById("content");
for(let i = 0; i < 2; i++) {
x.innerHTML += `<button type="button" class="click-btn" id="click-btn-id" value="${i}"> click me</button>`;
// get last button that was INNER to .content
var btn_option = document.getElementsByClassN... |
23,583,649 | I am wondering if there any algorithm where I can compute the center of a polygon in OSM because I've found that each polygon has a different parameters expression:
```
"POLYGON((-171379.35 5388068.23,-171378.8 5388077.59,-171368.44 5388076.82,-171368.89 5388067.46,-171379.35 5388068.23))"
"POLYGON((-171379.3 5374226... | 2014/05/10 | [
"https://Stackoverflow.com/questions/23583649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3623674/"
] | The polygons are described using [WKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry).
Using Python? Use [Shapely](https://shapely.readthedocs.io/).
```
from shapely import wkt
p1 = wkt.loads("POLYGON((-171379.35 5388068.23,-171378.8 5388077.59,
-171368.44 5388076.82,-171368... | You can use [PostGIS functionality](http://postgis.refractions.net/docs/ST_Centroid.html) or for example the python lib [shapely](https://web.archive.org/web/20121015010336/http://forrst.com/posts/Find_the_centroid_of_any_SimpleGeo_polygon_using-zrK) to realize it. |
33,250,795 | I need to write a program that using run length encoding to compress a list. I have no idea how to do it and after changing my program a little bit at a time I don't even know what it is doing now.
We aren't allowed to import and libraries or use python string or list object methods (like `append()`).
This is prett... | 2015/10/21 | [
"https://Stackoverflow.com/questions/33250795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5434683/"
] | What is the encoding supposed to be? Assuming tuples of `(element, count)` then you could implement a generator:
```
def rle(iterable):
it = iter(iterable)
e, c = next(it), 1 # StopIteration silently handled before Py3.7
for n in it:
if n == e:
c += 1
continue
... | ```
def rle(x):
prev = x[0]
count = 0
for item in x:
if item == prev:
count += 1
else:
yield prev, count
prev = item
count = 1
yield prev, count
x = [8,8,8,4,5,5,5,6,6,6,6,9,8,1,1,1,1,3,3]
print list(rle(x))
```
prints
```
[(8, 3), (4,... |
28,488,045 | I would like to scan all my emails in Gmail, and extract only the mailer-daemon messages (to identify rejected email addresses).
When I'm using these methods, None of the mailer-daemon messages are returned - only the "valid" messages:
```
var ss = SpreadsheetApp.openById("1e29xgV1UU63SJEwF2aWQpWpcXMxyiylwEMGbuvbwADw... | 2015/02/12 | [
"https://Stackoverflow.com/questions/28488045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2488499/"
] | You need to use `this` when you want to reference the class level variable which has the same name as the local variable in the method. It is only required when the variables have the same name. You *can always* use `this` if you want, but it isn't necessary. And the difference between
```
this.s = s;
```
and
```
s... | Yes, they are entirely equivalent in their function and resulting bytecode (afaik).
The โthisโ keyword is only used when referencing an instance variable (a non-static variable that is defined with the class or relevant super-classes), in order to differentiate it from a local variable of the same name. Omitting the โ... |
28,488,045 | I would like to scan all my emails in Gmail, and extract only the mailer-daemon messages (to identify rejected email addresses).
When I'm using these methods, None of the mailer-daemon messages are returned - only the "valid" messages:
```
var ss = SpreadsheetApp.openById("1e29xgV1UU63SJEwF2aWQpWpcXMxyiylwEMGbuvbwADw... | 2015/02/12 | [
"https://Stackoverflow.com/questions/28488045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2488499/"
] | You need to use `this` when you want to reference the class level variable which has the same name as the local variable in the method. It is only required when the variables have the same name. You *can always* use `this` if you want, but it isn't necessary. And the difference between
```
this.s = s;
```
and
```
s... | It is the same.
If your method has a variable with the same name of a class field (eg "name") you need to write "this.name" to refer to class field, because writing only "name" you are refering to method variable.
So in the second example you wrote, you have two different names ("name" and "n") and you don't need to w... |
800,705 | I have couple of Hetzner 'root servers' (as they call it - dedicated co-located linux machines) and all of them experience the same problem (which i simply do not fully understand).
The domain www.dnsblchile.org does not want to resolve to an IP (servers are installed from Hetzner own Debian Jessie images). All other ... | 2016/09/02 | [
"https://serverfault.com/questions/800705",
"https://serverfault.com",
"https://serverfault.com/users/373656/"
] | I don't understand why you are still trying to use the Hetzner DNS servers if they are demonstrably not working correctly. Just update your /etc/resolv.conf appropriately and get on with your life.
I usually chuck 8.8.8.8 and 8.8.4.4 (or 2001:4860:4860::8888, 2001:4860:4860::8844) in and forget about it. | See also: <https://cwiki.apache.org/confluence/display/SPAMASSASSIN/CachingNameserver> for a lot of good options to avoid this problem, e.g. by installing a local caching DNS server like: unbound
After you make sure it starts upon reboot make sure to change /etc/resolv.conf to begin with:
`nameserver 127.0.0.1`
Fin... |
54,713,496 | Under `Windows` 10, after successfully installing `tensorflow gpu,` and `keras gpu`, I installed `theano gpu` using:
```
conda install theano pygpu
```
Everything still worked fine, `tensorflow gpu, keras gpu`, etc. I ran simple example in `theano`, and on executing the line in `jupyter`,
```
import numpy
import th... | 2019/02/15 | [
"https://Stackoverflow.com/questions/54713496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817659/"
] | You could filter the non numeric using a generator expression:
```
arr = [5,3,6,"-",3,"-",4,"-"]
result = min(e for e in arr if isinstance(e, int))
print(result)
```
**Output**
```
3
``` | Here's a way using directly the `max` and `min` built-in funtions with a custom `key`:
```
arr = [5,3,6,"-",3,"-",4,"-"]
max(arr, key=lambda x: (isinstance(x,int), x))
# 6
```
And similarly for the `min`:
```
min(arr, key=lambda x: (not isinstance(x,int), x))
# 3
```
---
**Details**
For the min, consider the ... |
54,713,496 | Under `Windows` 10, after successfully installing `tensorflow gpu,` and `keras gpu`, I installed `theano gpu` using:
```
conda install theano pygpu
```
Everything still worked fine, `tensorflow gpu, keras gpu`, etc. I ran simple example in `theano`, and on executing the line in `jupyter`,
```
import numpy
import th... | 2019/02/15 | [
"https://Stackoverflow.com/questions/54713496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817659/"
] | Here's a way using directly the `max` and `min` built-in funtions with a custom `key`:
```
arr = [5,3,6,"-",3,"-",4,"-"]
max(arr, key=lambda x: (isinstance(x,int), x))
# 6
```
And similarly for the `min`:
```
min(arr, key=lambda x: (not isinstance(x,int), x))
# 3
```
---
**Details**
For the min, consider the ... | You can convert `list` into `set` to speed up calculations:
```
min(i for i in set(arr) if isinstance(i, int))
```
### Benchmark:
```
setup = "arr = [5, 3, 6,'-', 3,'-', 4, '-'] * 1000"
solution1 = "min(i for i in set(arr) if isinstance(i, int))"
solution3 = "min(e for e in arr if isinstance(e, int))"
solution2 = ... |
54,713,496 | Under `Windows` 10, after successfully installing `tensorflow gpu,` and `keras gpu`, I installed `theano gpu` using:
```
conda install theano pygpu
```
Everything still worked fine, `tensorflow gpu, keras gpu`, etc. I ran simple example in `theano`, and on executing the line in `jupyter`,
```
import numpy
import th... | 2019/02/15 | [
"https://Stackoverflow.com/questions/54713496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817659/"
] | You could filter the non numeric using a generator expression:
```
arr = [5,3,6,"-",3,"-",4,"-"]
result = min(e for e in arr if isinstance(e, int))
print(result)
```
**Output**
```
3
``` | You can convert `list` into `set` to speed up calculations:
```
min(i for i in set(arr) if isinstance(i, int))
```
### Benchmark:
```
setup = "arr = [5, 3, 6,'-', 3,'-', 4, '-'] * 1000"
solution1 = "min(i for i in set(arr) if isinstance(i, int))"
solution3 = "min(e for e in arr if isinstance(e, int))"
solution2 = ... |
36,195,763 | We love BigQuery it is amazing and we use it a lot but we have an issue with the Select statement, for some reason if you create a Select based on Variables you defined it does not work, but when you use the full code of the variables it does
The error I get is the following -
```
Error: (L5:47): Expression 'Request... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36195763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3601946/"
] | >
> Any Ideas on how to fix it?
>
>
>
The [GROUP BY](https://cloud.google.com/bigquery/query-reference#groupby) clause allows you to group rows that have the same values for a given field or set of fields so that you can compute aggregations of related fields. Thus, in SELECT list you can have either fields that y... | >
> Any Ideas on how to fix it?
>
>
>
try below "workaround"
```
SELECT
ch,
COUNT(Distinct(AC_SessionID),15000000) As UniqueSessions,
COUNT(IF(Action CONTAINS "request_data",1,NULL)) AS Requests,
ROUND(Requests/UniqueSessions,1) * MAX(1) AS RequestsPerSession
```
I realized that looks like engine needs... |
16,645,281 | In this example If I animate the div red it makes a strange movement to the right. I think the problem comes only with Firefox, the div is right, there is a scroll bar and position fixed.
(If I use position absolute I solve the movement. But If the user scrolls, the div moves, and it should be "fixed" to the right, bo... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16645281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016409/"
] | <http://jsfiddle.net/CGkEU/2/>
try this jsfiddle
```
.background{
position:static;
}
``` | Is this what you're looking for?
[Demo](http://jsfiddle.net/CGkEU/3/)
```
.background{
position:relative;
}
$(function(){
$("#red").click(function() {
$("#red").animate({bottom:'15px'},1000);
$("#red").css({"position":"absolute","right":"15px"});
});
})
``` |
16,645,281 | In this example If I animate the div red it makes a strange movement to the right. I think the problem comes only with Firefox, the div is right, there is a scroll bar and position fixed.
(If I use position absolute I solve the movement. But If the user scrolls, the div moves, and it should be "fixed" to the right, bo... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16645281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016409/"
] | It looks like a workaround was found, change the fixed box's position to absolute and put it inside another fixed position div:
[CSS fixed position movement under scrollbar in Firefox](https://stackoverflow.com/questions/15779203/css-fixed-position-movement-under-scrollbar-in-firefox)
Also, there is an open bug on thi... | <http://jsfiddle.net/CGkEU/2/>
try this jsfiddle
```
.background{
position:static;
}
``` |
16,645,281 | In this example If I animate the div red it makes a strange movement to the right. I think the problem comes only with Firefox, the div is right, there is a scroll bar and position fixed.
(If I use position absolute I solve the movement. But If the user scrolls, the div moves, and it should be "fixed" to the right, bo... | 2013/05/20 | [
"https://Stackoverflow.com/questions/16645281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016409/"
] | It looks like a workaround was found, change the fixed box's position to absolute and put it inside another fixed position div:
[CSS fixed position movement under scrollbar in Firefox](https://stackoverflow.com/questions/15779203/css-fixed-position-movement-under-scrollbar-in-firefox)
Also, there is an open bug on thi... | Is this what you're looking for?
[Demo](http://jsfiddle.net/CGkEU/3/)
```
.background{
position:relative;
}
$(function(){
$("#red").click(function() {
$("#red").animate({bottom:'15px'},1000);
$("#red").css({"position":"absolute","right":"15px"});
});
})
``` |
2,967,890 | **Exercise :**
>
> Let $Y$ be a subspace of the Banach space $(X, \| \cdot \|)$. Show that $(Y, \| \cdot \|)$ is Banach **iff** $Y$ is closed.
>
>
>
**Question :** Any tips or hints on how to start this ? I see myself to be lost, mostly due to me struggling with real analysis definitions, such as a topological sp... | 2018/10/23 | [
"https://math.stackexchange.com/questions/2967890",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/335894/"
] | 1. Suppose $Y$ is closed. Let $y\_n$ be a Cauchy sequence in $Y$; show that it converges to a member of $Y$.
2. Suppose $Y$ is not closed. Find a Cauchy sequence in $Y$ that does not converge to a member of $Y$. | Simply use the fact that a subspace of a complete metric space is complete if and only if it is closed. |
59,215,573 | I have a column filled with text in tabulator. The text is displayed with line breaks.
```
{title:"Title", field:"title", formatter:"textarea"},
```
[](https://i.stack.imgur.com/N8XZP.png)
When I introduce the [built in URL formatter](http://tabula... | 2019/12/06 | [
"https://Stackoverflow.com/questions/59215573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5696601/"
] | By default, tabulator renders the cells with "white-space: nowrap" (as defined in CSS class *tabulator-cell* in *tabulator.css*).
The formatter "textarea" overrides that by manually setting "pre-wrap" on the style of the cell element: [modules/format.js](https://github.com/olifolkerd/tabulator/blob/f9bad23f57c5bcad50... | >
> <http://tabulator.info/docs/4.0/format#format-height>
>
>
> Variable Height Formatters
> ==========================
>
>
> By default formatters will keep their contents within the height of the current row, hiding any overflow.
> The only exception to this is the **textarea** formatter which will
> automatic... |
59,117,206 | Once a function environment has some stuff in it, serializing all this stuff (even when it is not needed) adds a big overhead to parallelization. Is there then an effective way to use parallelization within a function? I've tried the future library but I need persistent workers, and would rather stick with base R if fe... | 2019/11/30 | [
"https://Stackoverflow.com/questions/59117206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2152521/"
] | Your problem is that you create the function `function(x) 1` with environment being the evaluation frame of the `test` call. If you modify its environment (e.g. set it the same as `test`, which would normally be the global environment), it will be much faster. For example, on my system your original version gave timing... | This is to be expected. You have a trivial function that takes very little time to process. Communication for doing things in parallel takes its toll, though. Give an example with a non-trivial function and we can talk. |
150,289 | This sounds really simple, but I'm so stuck I'm needing some help here to think about this.
I'm creating a book kind of document and needed guides for my Master Pages, so I started making them on a left page, and then wanted to copy it to the right one so they could be on the same place but both on the left and right ... | 2021/06/21 | [
"https://graphicdesign.stackexchange.com/questions/150289",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/165500/"
] | I think the way I would approach this is by adding guide lines around the page edges. With those you can position the guides accurately when copying.
If you need to mirror them as well I think there is no other way than to rebuild them (either with some math and numeric positioning or with rectangle as spacing guides) | Hold down the `Command/Ctrl` key when dragging out a guide.
That will force the guide extend across *both* pages.
[](https://i.stack.imgur.com/a4Eu4.gif)
Note that holding the `Option/Alt` key down, while dragging a guide out, will toggle between a ... |
3,560,831 | This question comes from Boas, Mathematical Methods in the Physical Sciences, chapter 4, section 11: "Change of variables". Exercise question 3.
>
> *Suppose that $w=f(x,y)$ satisfies
> $$
> \frac{\partial^2 w}{\partial x^2}-\frac{\partial^2 w}{\partial y^2}=1. \tag{1}
> $$
> **Put $x=u+v$, $y=u-v$ and show that $w$... | 2020/02/26 | [
"https://math.stackexchange.com/questions/3560831",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/567549/"
] | Your difficulty stems from an abuse of notation which is very common in these circles: The same letter $w$ is used for two different functions, one in the $(x,y)$-world, and one in the $(u,v)$-world.
At the start you are given a function
$$(x,y)\mapsto f(x,y)\ ,$$
satisfying a certain pde. Now you introduce a new fun... | Another way to think about it which surely is the same as Christian Blatter wrote but from other perspective would be to notice that you are using the same name for two different function.
You're using $w$ for the function that send $(x,y)$ to $w(x,y)$ as in
$\frac{\partial^2 w(x(u,v),y(u,v))}{\partial x^2} - \frac{... |
61,105,428 | How can I make a PowerShell script to check the current Power plan, change it to "High performance" (if it's not already), then run a long PowerShell script, then after the script, switch back to the original power plan?
I came up with something like this, but it feels like the -and statements fail to work, or am I do... | 2020/04/08 | [
"https://Stackoverflow.com/questions/61105428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13261218/"
] | In Windows 10, the `Activate()` method on the COM object does not work anymore, giving you error message `Exception calling "Activate" : "This method is not implemented in any class "`.
To manipulate the power scheme settings you will have to make use of `PowerCfg.exe`:
```
# fill a hashtable with power scheme guids ... | Your $PowerSettings variable contains the settings for all three power plans. You need to test to see which plan is active.
```
$PowerSettings = Get-WmiObject -Namespace root\cimv2\power -Class win32_powerplan
($PowerSettings | Where-Object { $_.IsActive }).ElementName
``` |
61,105,428 | How can I make a PowerShell script to check the current Power plan, change it to "High performance" (if it's not already), then run a long PowerShell script, then after the script, switch back to the original power plan?
I came up with something like this, but it feels like the -and statements fail to work, or am I do... | 2020/04/08 | [
"https://Stackoverflow.com/questions/61105428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13261218/"
] | So this is my fix, since the `.Activate()` method has mysteriously disappeared on newer versions of PS:
Old Way Using Activate Method and CIM
-------------------------------------
```
$p = Get-CimInstance -Name root\cimv2\power -Class win32_PowerPlan -Filter "ElementName = 'High Performance'"
Invoke-CimMethod -... | Your $PowerSettings variable contains the settings for all three power plans. You need to test to see which plan is active.
```
$PowerSettings = Get-WmiObject -Namespace root\cimv2\power -Class win32_powerplan
($PowerSettings | Where-Object { $_.IsActive }).ElementName
``` |
61,105,428 | How can I make a PowerShell script to check the current Power plan, change it to "High performance" (if it's not already), then run a long PowerShell script, then after the script, switch back to the original power plan?
I came up with something like this, but it feels like the -and statements fail to work, or am I do... | 2020/04/08 | [
"https://Stackoverflow.com/questions/61105428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13261218/"
] | So this is my fix, since the `.Activate()` method has mysteriously disappeared on newer versions of PS:
Old Way Using Activate Method and CIM
-------------------------------------
```
$p = Get-CimInstance -Name root\cimv2\power -Class win32_PowerPlan -Filter "ElementName = 'High Performance'"
Invoke-CimMethod -... | In Windows 10, the `Activate()` method on the COM object does not work anymore, giving you error message `Exception calling "Activate" : "This method is not implemented in any class "`.
To manipulate the power scheme settings you will have to make use of `PowerCfg.exe`:
```
# fill a hashtable with power scheme guids ... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [K (ngn/k)](https://codeberg.org/ngn/k), 26 bytes
=================================================
```
**((~/2 0N#)')#(1_)\(46=)_
```
[Try it online!](https://ngn.codeberg.page/k#eJxtTLkNwzAM7D2FIReRXDAiKfEJkBUyQQB3HiOzRw/c+UDiHoJ3vvY9xt+T1vzZ0iNtEY/0jUXe6ViWcw0Z0NBClwIiQzBwmLdcSRirmhdlsUJ4k8wfhcw6tRm4m7kPh1IVVLVzw... | [Python 3](https://docs.python.org/3/), 93 bytes
================================================
```
def f(s):s=s.replace(".","");return[s[-i:][0]for i in range(len(s))if s[-i:]==s[-2*i:-i]][-1]
```
[Try it online!](https://tio.run/##bY7dasMwDIXv9xQhN3VGIyy7tuWMPEnIRdmczVDc4GQXffpUbWGYMCFx4NPP0Xxbf65Jb9tXmKpJLE239A... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Python](https://www.python.org), 74 bytes
==========================================
```
f=lambda s,i=0:s[n:=i-len(s)]*(s[n:]==s[2*n:n])or f(s.replace(".",""),i+1)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bU45bsMwEOz5CkIV6cgLHhYPEaoD5AuGCiWRYAIyRYhKkbekUeP8yb8JCbvMYBeDHezM7s9v_N4uS9j329c2Hc39berm4fr-O... | [Haskell](https://www.haskell.org), ~~95~~ 83 bytes
===================================================
*-12 bytes thanks to [@Unrelated String](https://codegolf.stackexchange.com/users/85334/unrelated-string)*
```
g.filter(>'.')
g x=[x!!d|d<-[0..],uncurry(==)$div(length x-d)2`splitAt`drop d x]!!0
```
[Attempt This ... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Jelly](https://github.com/DennisMitchell/jelly), 13 bytes
==========================================================
```
แธโ.ลHแบf/ฦรฦคFแธข
```
[Try it online!](https://tio.run/##bY4xCgJBDEX7XGS7OMnsTDIXEK/gAbSQvYCdWChYib0IYmlpsWi5uPcYLzJmsPXzPy98@JDVouvWpeT@8tmc8X2a5eduORkPw3G8TXN/Lfn1GPaf7X1eStM0DklJIWKM4NGDQxc4egqiqR... | Excel VBA, 107 bytes
====================
```vb
Sub o(a)
a=Replace(a,".","")
b=Left(a,Len(a)/2)
If a=b &b Then MsgBox Left(b,1):Exit Sub
o Mid(a,2)
End Sub
```
1. Remove any decimal points from the input.
2. Get the first half (rounded up) of the input.
3. If the whole string is the first half twice, output the firs... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Retina](https://github.com/m-ender/retina/wiki/The-Language), 19 bytes
=======================================================================
Uses `,` as a decimal separator.
```
,
.*?((.).*)\1$
$2
```
[Try it online!](https://tio.run/##bYs7DgIxDET7OccW2ZW1sp2NPxUll6CAgoICCsT9QyJaRjN60kjvff88Xjfpz3K@dgL27VTKvu7b... | Excel VBA, 107 bytes
====================
```vb
Sub o(a)
a=Replace(a,".","")
b=Left(a,Len(a)/2)
If a=b &b Then MsgBox Left(b,1):Exit Sub
o Mid(a,2)
End Sub
```
1. Remove any decimal points from the input.
2. Get the first half (rounded up) of the input.
3. If the whole string is the first half twice, output the firs... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~14~~ ~~13~~ ~~12~~ 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
================================================================================================================================================
```
RรพฮทD2รรฮธฮธ
```
-1 byte p... | [Python 3](https://docs.python.org/3/), 93 bytes
================================================
```
def f(s):s=s.replace(".","");return[s[-i:][0]for i in range(len(s))if s[-i:]==s[-2*i:-i]][-1]
```
[Try it online!](https://tio.run/##bY7dasMwDIXv9xQhN3VGIyy7tuWMPEnIRdmczVDc4GQXffpUbWGYMCFx4NPP0Xxbf65Jb9tXmKpJLE239A... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | Regex (ECMAScript or better), ~~38~~ ~~34~~ 20 bytes
====================================================
```
((.).*),?(.*)\1,?\3$
```
Uses `,` as the decimal separator. Returns its output as capture group `\2`.
[Try it on regex101](https://regex101.com/r/SDieAA/13) - ECMAScript (and can be switched to others)
[... | Excel, ~~118~~ 104 bytes
========================
```
=LET(a,MID(SUBSTITUTE(A1,".",),ROW(1:32767),2^15),b,LEFT(a,LEN(a)/2),LEFT(INDEX(b,MATCH(TRUE,a=b&b,0))))
```
Input is in cell A1 of the active sheet. Output is wherever the formula is. Breaking down the `LET()` function into the `variable,value,...,output` format... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Husk](https://github.com/barbuz/Husk), 8 bytes
===============================================
```
โแธoEยฝแนซfยฑ
```
[Try it online!](https://tio.run/##bYu9DcJADIV3uRpZZzvnH1EzBaJFSCiiQAwABTUbMAAVXShoskmyyOFTWp5sv09PfofL@Vj7dT/frnW@P6bhedqM3@nz2o/vWus2ZUBDS6skIBLGwHEz5ELCWNS8UxbrCP8k7V8hszYyA3cz92CUoqCqzUORFMiLgqmYxTSD2... | [Brachylog](https://github.com/JCumin/Brachylog), 7 bytes
=========================================================
```
แปหขaโ~jh
```
[Try it online!](https://tio.run/##bYsxCgJBDEWvskytYZLZmWQaPYhYrBYuIgg2i4iCWwhi4xk8gY2NHsFT7F5kzLCtnyT/8clf7Kplvd9sV5QOjSnGk8I00/7y7Nu2e1@P3eueus/t@6j69nxa1ynNjAUUFDMyAUJQc@D0WrCegkPPEk... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Python](https://www.python.org), 74 bytes
==========================================
```
f=lambda s,i=0:s[n:=i-len(s)]*(s[n:]==s[2*n:n])or f(s.replace(".",""),i+1)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bU45bsMwEOz5CkIV6cgLHhYPEaoD5AuGCiWRYAIyRYhKkbekUeP8yb8JCbvMYBeDHezM7s9v_N4uS9j329c2Hc39berm4fr-O... | [Charcoal](https://github.com/somebody1234/Charcoal), 22 bytes
==============================================================
```
ยงโฮฆ๏ผฅฮธโฆโฎโปฮธ.ฮบยฌโโฎโปฮธ.รยฒฮนยฑยน
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMOxxDMvJbVCIyC/QMMtM6cktUjDN7FAo1BHwbkyOSfVOQMoHpRallpUnKrhm5lXWgySUtJT0tTUUcgGEX75JUCNeSk4VYVk5qYWaxjpK... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~14~~ ~~13~~ ~~12~~ 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
================================================================================================================================================
```
RรพฮทD2รรฮธฮธ
```
-1 byte p... | [JavaScript (Node.js)](https://nodejs.org), 46 bytes
====================================================
```js
s=>/^.*?(.*)\1$/.exec(s.replace('.',''))[1][0]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bVFLbsIwEFW3PoUXSLZpGGKHxE5RwqqnACqi4LRIIYnykZAQJ-kGVe2RumhPUxsX1EVHHs28mfeeLfn1vaq3-vxWJB9DX0zUF3RJOn... |
250,066 | **Story:**
The ฯ was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits ... | 2022/07/18 | [
"https://codegolf.stackexchange.com/questions/250066",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/101306/"
] | [Python](https://www.python.org), ~~68~~ ~~62~~ 57 bytes
========================================================
```python
lambda x:re.split(r"(.+),?(.*)\1,?\2$",x)[1][0]
import re
```
[Attempt This Online!](https://ato.pxeger.com/run?1=bVBLTsMwEBVbn2JksYhLGPnT-FOr6kGaLgIkIlKbRK4rlbOwqYTgTnAabAKsOmPPk97Ms0fv9WN6ic_... | [Brachylog](https://github.com/JCumin/Brachylog), 7 bytes
=========================================================
```
แปหขaโ~jh
```
[Try it online!](https://tio.run/##bYsxCgJBDEWvskytYZLZmWQaPYhYrBYuIgg2i4iCWwhi4xk8gY2NHsFT7F5kzLCtnyT/8clf7Kplvd9sV5QOjSnGk8I00/7y7Nu2e1@P3eueus/t@6j69nxa1ynNjAUUFDMyAUJQc@D0WrCegkPPEk... |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | The Oxford English Dictionary quotes early uses of the term rail-road in Britain, for example:
1775 Smeaton *Rep.* (1837) II. 411 'It seems perfectly practicable to carry the coals upon a rail-road.'
Many other early uses in Britain are cited, suggesting the term was as familiar there as it was later in the United S... | The earliest instances of *railroad* as a verb have the literal sense "traveled by railroad" or "constructed railroads"โneither of which meanings is particularly relevant to the OP's question.
---
***Dictionary definitions of the slang verb 'railroad'***
According to one early dictionary of slang, the first slang s... |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | The Oxford English Dictionary quotes early uses of the term rail-road in Britain, for example:
1775 Smeaton *Rep.* (1837) II. 411 'It seems perfectly practicable to carry the coals upon a rail-road.'
Many other early uses in Britain are cited, suggesting the term was as familiar there as it was later in the United S... | Related and worthy of mention, in my humble opinion, but not a direct usage of "to railroad". Found in **[Charcoal Sketches; or, Scenes in a metropolis](http://hdl.handle.net/2027/hvd.32044051149474). By Joseph C Neal", 1837**
In 1837, "railroad" was being used as slang for a cheap liquor (probably whiskey) "[because ... |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | The Oxford English Dictionary quotes early uses of the term rail-road in Britain, for example:
1775 Smeaton *Rep.* (1837) II. 411 'It seems perfectly practicable to carry the coals upon a rail-road.'
Many other early uses in Britain are cited, suggesting the term was as familiar there as it was later in the United S... | I had always been to the term โhe was railroadedโ came from the was railroads would conduct investigations of their operating employees. A fixed court. |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | The earliest instances of *railroad* as a verb have the literal sense "traveled by railroad" or "constructed railroads"โneither of which meanings is particularly relevant to the OP's question.
---
***Dictionary definitions of the slang verb 'railroad'***
According to one early dictionary of slang, the first slang s... | Related and worthy of mention, in my humble opinion, but not a direct usage of "to railroad". Found in **[Charcoal Sketches; or, Scenes in a metropolis](http://hdl.handle.net/2027/hvd.32044051149474). By Joseph C Neal", 1837**
In 1837, "railroad" was being used as slang for a cheap liquor (probably whiskey) "[because ... |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | The earliest instances of *railroad* as a verb have the literal sense "traveled by railroad" or "constructed railroads"โneither of which meanings is particularly relevant to the OP's question.
---
***Dictionary definitions of the slang verb 'railroad'***
According to one early dictionary of slang, the first slang s... | I had always been to the term โhe was railroadedโ came from the was railroads would conduct investigations of their operating employees. A fixed court. |
274,533 | The term "railroaded" in the sense of having something forced through, either unjustly or without proper regard for those affected, clearly has it's [origins in](http://ask.metafilter.com/143985/Etymologyfilter-Can-anyone-help-explicate-the-origins-of-railroad-v) analogy to the way early railroads were build, often run... | 2015/09/17 | [
"https://english.stackexchange.com/questions/274533",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/10197/"
] | Related and worthy of mention, in my humble opinion, but not a direct usage of "to railroad". Found in **[Charcoal Sketches; or, Scenes in a metropolis](http://hdl.handle.net/2027/hvd.32044051149474). By Joseph C Neal", 1837**
In 1837, "railroad" was being used as slang for a cheap liquor (probably whiskey) "[because ... | I had always been to the term โhe was railroadedโ came from the was railroads would conduct investigations of their operating employees. A fixed court. |
56,932,071 | I'm trying to calculate what proportion of my data are male and what proportion are female.
I have the following code:
```
select
SUM(CASE WHEN Gender = 'M' THEN 1 ELSE 0 END) / COUNT(Gender) as perc_male,
SUM(CASE WHEN Gender = 'F' THEN 1 ELSE 0 END) / COUNT (Gender) as perc_female
From [my_table]
```
However... | 2019/07/08 | [
"https://Stackoverflow.com/questions/56932071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7545840/"
] | Note that the problem is a specific combination of a quirk of the DXGI debug layer and the way that the "hybrid graphics" solutions are implemented depending on which device you are using at the time.
The best option here is to just suppress the error:
```
#if defined(_DEBUG)
// Enable the debug layer (requires t... | I have found a solution. Use IDXGIFactory6::EnumAdapterByGpuPreference() method instead of IDXGIFactory::EnumAdapter() method then the error will disappear. |
3,046,308 | I have jquery tabs like
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a href="#tab-2">Name 2</a></li>
<li><a href="http://www.google.com/">Name 3</a></li>
</ul>
<div id="tab-1">content 1</div>
<div id="tab-2">content 2</div>
```
the first two tabs load the respective divs. But the thi... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3046308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306961/"
] | I'm not sure what you want it to do, but if it should open the link as a new page/replacement for the current page, the documentation explains:
>
> [How to...] ...follow a tab's URL instead of
> loading its content via ajax
>
>
> Note that opening a tab in a new
> window is unexpected, e.g.
> inconsistent behavi... | You cannot since requesting content from google.com will be a cross domain call and the xhr call will fail.
Why not put an iframe inside the third content div with the src attribute pointing to google?
Demo [here](http://jsfiddle.net/P3tr9/)
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a ... |
3,046,308 | I have jquery tabs like
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a href="#tab-2">Name 2</a></li>
<li><a href="http://www.google.com/">Name 3</a></li>
</ul>
<div id="tab-1">content 1</div>
<div id="tab-2">content 2</div>
```
the first two tabs load the respective divs. But the thi... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3046308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306961/"
] | When i saw the generated source code, the
```
<li><a href="http://www.google.com/">Name 3</a></li>
```
was changed to
```
<li><a href="#ui-tabs-[object Object]">Name 3</a></li>
```
But other lists were same. I still don't know whether it is due to the problem of testing in local server.
So i tried this option... | You cannot since requesting content from google.com will be a cross domain call and the xhr call will fail.
Why not put an iframe inside the third content div with the src attribute pointing to google?
Demo [here](http://jsfiddle.net/P3tr9/)
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a ... |
3,046,308 | I have jquery tabs like
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a href="#tab-2">Name 2</a></li>
<li><a href="http://www.google.com/">Name 3</a></li>
</ul>
<div id="tab-1">content 1</div>
<div id="tab-2">content 2</div>
```
the first two tabs load the respective divs. But the thi... | 2010/06/15 | [
"https://Stackoverflow.com/questions/3046308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306961/"
] | I just had the same problem.
I solved it by giving the tab anchor that should be loaded externally a class named "followtablink". Then I modified my tabs() call to this:
```
$('.tabs').tabs({
select: function(event, ui) {
var url = $.data(ui.tab, 'load.tabs');
var className = ui.tab.className;
if( classNa... | You cannot since requesting content from google.com will be a cross domain call and the xhr call will fail.
Why not put an iframe inside the third content div with the src attribute pointing to google?
Demo [here](http://jsfiddle.net/P3tr9/)
```
<ul id="tabsList">
<li><a href="#tab-1">Name 1</a></li>
<li><a ... |
45,324,872 | Is there a method to detect the mouseleave while an element is dragged?
I try to drag and drop and element and if it is outside the viewport to show a popup that contains elements from the div.
The mouseleave is fired only when I don;t drag the element, but if I try to drag outside the mouseleave is not fired
So mou... | 2017/07/26 | [
"https://Stackoverflow.com/questions/45324872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3696613/"
] | write in strings.xml file like this
```
<string name="hello">\"</string>
```
and in layout xml file use in textview like this
```
[![<TextView
android:id="@+id/kwh1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtdevicename"
... | You can try to use Font Awesome for Turkish Lira. Some devices might not have the Turkish Lira code, therefore you need to implement a new way. Icon : <http://fontawesome.io/icon/try/> after downloading font, create a custom text view for it(for easy use)
```
public class FontAwesome extends TextView {
public ... |
68,705,856 | Hi I am trying to fill a vector with the information from a text file. The text file looks something like this:
```none
10 8
5 6
15 4
```
I wrote some code in C++ trying to do this and it is not being filled. Here is my code:
```
#include <iostream>
#include <fstream>
#include <vector>
void duplicate() {
ifstr... | 2021/08/09 | [
"https://Stackoverflow.com/questions/68705856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14227930/"
] | Your code has no problem in my environment. I'm using Visual Studio 2017.
Please check that the file exists in the same folder with your program.
```
std::ifstream in("Measured-Isotopes.txt");
if (!in.is_open())
{
std::cout << "File is not exist" << std::endl;
return;
}
``` | So it turns out the problem was that my first row in the text file was a label that was a string so because I made my vector 2 ints it was getting messed up and not filling. I deleted the label and now it fills fine. |
68,705,856 | Hi I am trying to fill a vector with the information from a text file. The text file looks something like this:
```none
10 8
5 6
15 4
```
I wrote some code in C++ trying to do this and it is not being filled. Here is my code:
```
#include <iostream>
#include <fstream>
#include <vector>
void duplicate() {
ifstr... | 2021/08/09 | [
"https://Stackoverflow.com/questions/68705856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14227930/"
] | The most likely cause of the failure is `"Measured-Isotopes.txt"` isn't in the current working directory when you run your program leading to `ifstream in("Measured-Isotopes.txt");` failing.
For any I/O operation, including file opening, you must always ***validate the stream state*** after each operation. In your cas... | So it turns out the problem was that my first row in the text file was a label that was a string so because I made my vector 2 ints it was getting messed up and not filling. I deleted the label and now it fills fine. |
1,585,410 | DNS servers have to be fast in order to avoid latency. What algorithms do DNS Servers use to reduce latency? Are they any caching mechanisms that could be effectively used to improve speed? | 2009/10/18 | [
"https://Stackoverflow.com/questions/1585410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77087/"
] | Latency is a huge problem with DNS. The slowest part of DNS is reaching out across the 'Net and querying other servers. *Any* caching a client or server does will speed up the process. In fact, that's exactly what happens.
When a DNS server responds to a query, the answer comes back with a TTL (time-to-live). The TTL ... | I know this question already has an accepted answer, but there's much more you can do than just caching. For example:
1. Use BGP to establish a network of geographically distributed servers, reachable via Anycast. This can reduce the average number of hops that a DNS query packet has to traverse.
2. Eliminate latency-... |
27,201,028 | I have a php-file that returns a JSON-array that i will use in conjunction with javascript to populate a website with news from a sql-database.
The sql-query works on the server and returns the information i want. While the php-file returns this:
```
[{"rubrik":null,"ingress":null,"datum":"2014-11-10 16:11:54},{"rubri... | 2014/11/29 | [
"https://Stackoverflow.com/questions/27201028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4304864/"
] | I didnt test it but I think this should work.
```
$result = mysqli_query($con, "SELECT rubrik, ingress, datum FROM svensta_news");
$return_arr = array();
while ($row = mysqli_fetch_array($result))
{
$return_arr[] = array(
'title' => $row['rubrik'],
'ingress' => $row['ingress'],
'date'... | ```
array_push($return_arr, $row);
```
Doesn't get values from while condition, since you declare `$return_arr = array();`
You should use :
```
$return_arr['title']=$row['rubrik'];
$return_arr['ingress']=$row['ingress'];
$return_arr['date']=$row['datum'];
```
in your while condition to get the values.
Query usin... |
27,201,028 | I have a php-file that returns a JSON-array that i will use in conjunction with javascript to populate a website with news from a sql-database.
The sql-query works on the server and returns the information i want. While the php-file returns this:
```
[{"rubrik":null,"ingress":null,"datum":"2014-11-10 16:11:54},{"rubri... | 2014/11/29 | [
"https://Stackoverflow.com/questions/27201028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4304864/"
] | I didnt test it but I think this should work.
```
$result = mysqli_query($con, "SELECT rubrik, ingress, datum FROM svensta_news");
$return_arr = array();
while ($row = mysqli_fetch_array($result))
{
$return_arr[] = array(
'title' => $row['rubrik'],
'ingress' => $row['ingress'],
'date'... | initialize $row\_array as an array()
also change code as
```
array_push($return_arr, $row_array);
``` |
236,963 | Consider two data series, $X = (x\_1, x\_2, ..., x\_n)$ and $Y = (y\_1, y\_2, ..., y\_n)$, both with mean zero. We use linear regression (ordinary least squares) to regress $Y$ against $X$ (without fitting any intercept), as in $Y = aX + ฮต$ where $ฮต$ denotes a series of error terms. Suppose $\rho\_{XY}$ is the sample c... | 2016/09/26 | [
"https://stats.stackexchange.com/questions/236963",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/132059/"
] | There's enough information.
The correlation coefficient would be equal to a standardized regression coefficient. If the standardized regression coefficient is significant then the regression coefficient is significant. And finally, the only thing that is necessary to determine significance of a found correlation is th... | If I was asked in an *interview* (i.e. verbally rather than on paper), where I'd think the focus would be on demonstrating on-hand understanding of facts that give a quick approximate answer, I'd respond as follows:
>
> Since when the population correlation is 0, the sample correlation has an asymptotic standard erro... |
18,379,948 | Why doesn't the next Fiddle give me 102 ?
I'm looking for the smallest number that doesn't exist in both columns.
NOTICE: one column is a number, and the other is a varchar.
```
SELECT NVL(MIN(a1.id_int)+1, 111)
FROM bPEOPLE a1
WHERE NOT EXISTS (SELECT 1
FROM PEOPLE a2
WHER... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18379948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1517569/"
] | You doesn't get 102 because you start from the `id_int` column and then add `1`. You have to have 101 in `id_int` column in order to have a chance to get 102.
In other words, your error is, that you start with `MIN(a1.id_int)` and ignores `MIN(TO_NUMBER(a3.id_str))`.
Here is probably what you want
```
SELECT NVL(MIN... | I'm not sure why it's giving you the wrong result but I'm thinking you could create a union of the two columns and find the min that doesn't have a next one and add one to it
Try
```
SELECT MIN(t1.id)+1
FROM (
SELECT CAST(id_str AS INT) id
FROM people
UNION
SELECT id_int
FROM people
) t1
LEFT JOIN... |
18,379,948 | Why doesn't the next Fiddle give me 102 ?
I'm looking for the smallest number that doesn't exist in both columns.
NOTICE: one column is a number, and the other is a varchar.
```
SELECT NVL(MIN(a1.id_int)+1, 111)
FROM bPEOPLE a1
WHERE NOT EXISTS (SELECT 1
FROM PEOPLE a2
WHER... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18379948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1517569/"
] | Because your expression:
```
NVL(MIN(a1.id_int)+1, 111)
```
is only referencing the int column, in which the next value is 108.
You need to combine the two columns into a single column, then get the MIN:
```
SELECT NVL(MIN(a.id_int)+1, 111) as next_id
FROM ( SELECT id_int
FROM PEOPLE
... | You doesn't get 102 because you start from the `id_int` column and then add `1`. You have to have 101 in `id_int` column in order to have a chance to get 102.
In other words, your error is, that you start with `MIN(a1.id_int)` and ignores `MIN(TO_NUMBER(a3.id_str))`.
Here is probably what you want
```
SELECT NVL(MIN... |
18,379,948 | Why doesn't the next Fiddle give me 102 ?
I'm looking for the smallest number that doesn't exist in both columns.
NOTICE: one column is a number, and the other is a varchar.
```
SELECT NVL(MIN(a1.id_int)+1, 111)
FROM bPEOPLE a1
WHERE NOT EXISTS (SELECT 1
FROM PEOPLE a2
WHER... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18379948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1517569/"
] | You doesn't get 102 because you start from the `id_int` column and then add `1`. You have to have 101 in `id_int` column in order to have a chance to get 102.
In other words, your error is, that you start with `MIN(a1.id_int)` and ignores `MIN(TO_NUMBER(a3.id_str))`.
Here is probably what you want
```
SELECT NVL(MIN... | Your `not exists` clauses are saying "exclude rows where there is another row with a value one greater than the current row". The only row this is true for is the final row, whereas your question implies you want the first one.
To fix this, you just need to move the `+1` in your `not exists` clauses to the other colu... |
18,379,948 | Why doesn't the next Fiddle give me 102 ?
I'm looking for the smallest number that doesn't exist in both columns.
NOTICE: one column is a number, and the other is a varchar.
```
SELECT NVL(MIN(a1.id_int)+1, 111)
FROM bPEOPLE a1
WHERE NOT EXISTS (SELECT 1
FROM PEOPLE a2
WHER... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18379948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1517569/"
] | Because your expression:
```
NVL(MIN(a1.id_int)+1, 111)
```
is only referencing the int column, in which the next value is 108.
You need to combine the two columns into a single column, then get the MIN:
```
SELECT NVL(MIN(a.id_int)+1, 111) as next_id
FROM ( SELECT id_int
FROM PEOPLE
... | I'm not sure why it's giving you the wrong result but I'm thinking you could create a union of the two columns and find the min that doesn't have a next one and add one to it
Try
```
SELECT MIN(t1.id)+1
FROM (
SELECT CAST(id_str AS INT) id
FROM people
UNION
SELECT id_int
FROM people
) t1
LEFT JOIN... |
18,379,948 | Why doesn't the next Fiddle give me 102 ?
I'm looking for the smallest number that doesn't exist in both columns.
NOTICE: one column is a number, and the other is a varchar.
```
SELECT NVL(MIN(a1.id_int)+1, 111)
FROM bPEOPLE a1
WHERE NOT EXISTS (SELECT 1
FROM PEOPLE a2
WHER... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18379948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1517569/"
] | Because your expression:
```
NVL(MIN(a1.id_int)+1, 111)
```
is only referencing the int column, in which the next value is 108.
You need to combine the two columns into a single column, then get the MIN:
```
SELECT NVL(MIN(a.id_int)+1, 111) as next_id
FROM ( SELECT id_int
FROM PEOPLE
... | Your `not exists` clauses are saying "exclude rows where there is another row with a value one greater than the current row". The only row this is true for is the final row, whereas your question implies you want the first one.
To fix this, you just need to move the `+1` in your `not exists` clauses to the other colu... |
2,973,795 | I just installed Visual Studio 2010 Express via Web Platform.
I forgot to install MVC 1.0, so i just downloaded it, and installed.
Go til File -> New Project -> And there is no MVC project Just ASP.NET Web Application and some other stuff.
I then downloaded MVC 2.0, and the same happend. In Control Panel -> Add/Remov... | 2010/06/04 | [
"https://Stackoverflow.com/questions/2973795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83713/"
] | If the contents of the $\_SESSION['loggedon'] var are just 0/1 you can use the if statement (PHP reads 1 as true and the rest of the numbers as false) which will work a bit faster.
Just do the following:
```
if($_SESSION['loggedon']){
echo "logged in";
echo "<br /><a href='../logoff.php'>Log off</a>";
}el... | ```
switch ($_SESSION['loggedon'])
{
case 1:
echo "logged in";
echo "<br /><a href='../logoff.php'>Log off</a>";
break;
default:
include("../includes/login.php");
```
}
Is less verbose and should do the same :-)
Sorry for the code not being formatted as code... |
369,453 | Is there a way to find a maximum depth of given directory tree? I was thinking about using find with incrementing maxdepth and comparing number of found directories, but maybe there is a simpler way? | 2017/06/06 | [
"https://unix.stackexchange.com/questions/369453",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/2646/"
] | One way to do it, assuming GNU `find`:
```
find . -type d -printf '%d\n' | sort -rn | head -1
```
This is not particularly efficient, but it's certainly much better than trying different `-maxdepth`s in turn. | Try this, for example trying to find max depth of tree under `/`, using
```
find / -type d
```
will give every directory under `/` irrespective of depth. So `awk` the result with `/` as delimiter to find the count, and `count-1` would give max depth of tree from `/`, so the command would be:
```
find / -type d | a... |
369,453 | Is there a way to find a maximum depth of given directory tree? I was thinking about using find with incrementing maxdepth and comparing number of found directories, but maybe there is a simpler way? | 2017/06/06 | [
"https://unix.stackexchange.com/questions/369453",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/2646/"
] | One way to do it, assuming GNU `find`:
```
find . -type d -printf '%d\n' | sort -rn | head -1
```
This is not particularly efficient, but it's certainly much better than trying different `-maxdepth`s in turn. | Consider using `updatedb` and then `locate`. It performs really fast, as `locate` queries a database and it's much faster than asking for each file sepereately. `updatedb` is fast too, since it only updates the database with changes instead of creating it anew. The only drawback is that you may need root privilages to ... |
369,453 | Is there a way to find a maximum depth of given directory tree? I was thinking about using find with incrementing maxdepth and comparing number of found directories, but maybe there is a simpler way? | 2017/06/06 | [
"https://unix.stackexchange.com/questions/369453",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/2646/"
] | Try this, for example trying to find max depth of tree under `/`, using
```
find / -type d
```
will give every directory under `/` irrespective of depth. So `awk` the result with `/` as delimiter to find the count, and `count-1` would give max depth of tree from `/`, so the command would be:
```
find / -type d | a... | Consider using `updatedb` and then `locate`. It performs really fast, as `locate` queries a database and it's much faster than asking for each file sepereately. `updatedb` is fast too, since it only updates the database with changes instead of creating it anew. The only drawback is that you may need root privilages to ... |
2,284,438 | I'm stuck on a question in relation with complex numbers:
If $z\neq0$, and that
$$\left\vert{\frac{z+1}{z-1}}\right\vert=1,$$
prove that $z$ is purely imaginary.
I tried breaking the modulus up into two separate parts, and then multiplying both sides. Then I squared both sides and used the formula $\vert{z}\vert^2=z\b... | 2017/05/17 | [
"https://math.stackexchange.com/questions/2284438",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/419491/"
] | If $|z-1|=|z+1|$, then writing $z=x+iy$ and squaring both sides we get
$$ (x-1)^2+y^2=(x+1)^2+y^2$$
which implies that $x=0$. If $z\neq 0$, this means that $z$ is purely imaginary.
There is also a nice geometric interpretation: $|z-1|$ is the distance from $z$ to $1$, and $|z+1|$ is the distance to $-1$. If these are ... | The easiest way to see this is to note that this equation is equivalent to $|z-1|=|z+1|$.
This is just the locus of points whose distance from $1$, (precisely $|z-1|$) is the same as they're distance from $-1$ (precisely $|z+1|$).
The set of points equidistant from $1$ and $-1$ in the complex plane is clearly just ... |
2,284,438 | I'm stuck on a question in relation with complex numbers:
If $z\neq0$, and that
$$\left\vert{\frac{z+1}{z-1}}\right\vert=1,$$
prove that $z$ is purely imaginary.
I tried breaking the modulus up into two separate parts, and then multiplying both sides. Then I squared both sides and used the formula $\vert{z}\vert^2=z\b... | 2017/05/17 | [
"https://math.stackexchange.com/questions/2284438",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/419491/"
] | If $|z-1|=|z+1|$, then writing $z=x+iy$ and squaring both sides we get
$$ (x-1)^2+y^2=(x+1)^2+y^2$$
which implies that $x=0$. If $z\neq 0$, this means that $z$ is purely imaginary.
There is also a nice geometric interpretation: $|z-1|$ is the distance from $z$ to $1$, and $|z+1|$ is the distance to $-1$. If these are ... | Doing it OP's way:
>
> Then I squared both sides and used the formula $|z|^2 =z \bar z$
>
>
>
$$\require{cancel}
\begin{align}
|z+1|^2=|z-1|^2 &\iff (z+1)(\bar z + 1) = (z-1)(\bar z - 1) \\
&\iff \cancel{z \bar z}+ z + \bar z + \bcancel{1} = \cancel{z \bar z}- z - \bar z + \bcancel{1} \\
&\iff 2(z+\bar z) = 0 ... |
63,598,983 | Unsure why indexOf is not recognizing the word 'error'.
The PHP script is returning text that reads:
```
echo "Error: user was not updated.";
```
In the JQuery, I have the following:
```
$.post('api/editUser.php', {robj:robj}, function(data){
if(data.indexOf('Error')){
console.log("bad - " + data);
}
els... | 2020/08/26 | [
"https://Stackoverflow.com/questions/63598983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4262571/"
] | `indexOf` returns `0` because your word is placed as first word in string. Zero is `falsy` value, so try to rewrite to check `indexoOf() != -1`:
```
if( data.indexOf('Error')!= -1){
console.log("bad - " + data);
}
else{
console.log("good - " + data);
```
[As mdn says:](https://developer.mozilla.org/en-US/docs/... | If you try to log the `indexOf` return you'll see it returns `0`
```js
console.log( "Error: user was not updated.".indexOf("Error") )
```
then doing `if (0)` you see that you get into the `else` block
```js
if (0) {console.log("in if")} else {console.log("in else")}
```
This happens because `0` is a [`falsy value`]... |
63,598,983 | Unsure why indexOf is not recognizing the word 'error'.
The PHP script is returning text that reads:
```
echo "Error: user was not updated.";
```
In the JQuery, I have the following:
```
$.post('api/editUser.php', {robj:robj}, function(data){
if(data.indexOf('Error')){
console.log("bad - " + data);
}
els... | 2020/08/26 | [
"https://Stackoverflow.com/questions/63598983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4262571/"
] | `indexOf` returns `0` because your word is placed as first word in string. Zero is `falsy` value, so try to rewrite to check `indexoOf() != -1`:
```
if( data.indexOf('Error')!= -1){
console.log("bad - " + data);
}
else{
console.log("good - " + data);
```
[As mdn says:](https://developer.mozilla.org/en-US/docs/... | Try using `search()`. It's mostly used for regular expressions, but if you use a plain text it will still work since it will be a valid Regular Expression.
Please note that it's not as performant as `indexOf`, since it's treated as a **RegEx**.
P.s. I know you know the exact text that is coming from the server, but it... |
63,598,983 | Unsure why indexOf is not recognizing the word 'error'.
The PHP script is returning text that reads:
```
echo "Error: user was not updated.";
```
In the JQuery, I have the following:
```
$.post('api/editUser.php', {robj:robj}, function(data){
if(data.indexOf('Error')){
console.log("bad - " + data);
}
els... | 2020/08/26 | [
"https://Stackoverflow.com/questions/63598983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4262571/"
] | If you try to log the `indexOf` return you'll see it returns `0`
```js
console.log( "Error: user was not updated.".indexOf("Error") )
```
then doing `if (0)` you see that you get into the `else` block
```js
if (0) {console.log("in if")} else {console.log("in else")}
```
This happens because `0` is a [`falsy value`]... | Try using `search()`. It's mostly used for regular expressions, but if you use a plain text it will still work since it will be a valid Regular Expression.
Please note that it's not as performant as `indexOf`, since it's treated as a **RegEx**.
P.s. I know you know the exact text that is coming from the server, but it... |
68,719,073 | I want to save the number that is printed using the print() function R. For example,
I have a print(bf(X, Y) command that prints a sentence "Estimated value is : 0.5". How to save only the number 0.5 to a txt/excel file? because I have a loop that will print hundreds of that sentence with different numbers and I want t... | 2021/08/09 | [
"https://Stackoverflow.com/questions/68719073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13545777/"
] | >
> Is there any way to account for the precision round-off error of IEEE 754 32bit floating-point that is keeping Out from reaching 0 without needing a multitude of conditional statements?
>
>
>
`expf(-0.1f / 1.0f)` is 0.904837..., so any multiplication of `FLT_TRUE_MIN` will, with round-to-nearest, rounds to `FL... | Because you're losing precision, you should do intermediate calculations in higher precision (e.g. `double`) and only convert back at the end.
So, you're better off doing:
```
void
Exp_Filt(double In, float *Out, double time_base, double time_constant)
{
*Out = In + ((*Out - In) * exp(-time_base / time_constant))... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | you would want to only capture traffic that is destined for your host's IP:
```
dst host <your Ip>
```
Sorry, read that as display filter. the above has been corrected for CAPTURE filter syntax. | *Because tcpdump filters are the capture filters, and can be passed through tshark or tcpdump as well to avoid running a GUI just for capture if you're reviewing later*
`[tcpdump] ether dst $YOUR_MAC_ADDRESS` should cover most of what you want.
`[tcpdump] ether src not $YOUR_MAC_ADDRESS` would be broader. You may som... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | you would want to only capture traffic that is destined for your host's IP:
```
dst host <your Ip>
```
Sorry, read that as display filter. the above has been corrected for CAPTURE filter syntax. | Your request to capture `only incoming traffic` leads to some ambiguity. The word incoming may has at least two different meanings in networking.
The first meaning packets received by a particular interface/device is relatively simple. The answer [Jeff provides](https://serverfault.com/a/348152/984) is what you want. ... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | you would want to only capture traffic that is destined for your host's IP:
```
dst host <your Ip>
```
Sorry, read that as display filter. the above has been corrected for CAPTURE filter syntax. | You can use a capture filter with a network address instead of your machine's single IP such as "dst net 10.0.0.0/21". This would capture any packets being sent to 10.0.0.1 through 10.0.7.254.
Alternatively, you can use tshark to post-filter a capture file using -r ORIGINAL\_FILE -w NEW\_FILE -Y "display filters". In ... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | you would want to only capture traffic that is destined for your host's IP:
```
dst host <your Ip>
```
Sorry, read that as display filter. the above has been corrected for CAPTURE filter syntax. | Please stop this madness. It's very impractical to list the local host's mac/IP address every time you need this feature (not to mention the cases where these details can change while running the dump), and the pcap library has this facility already. You just have to use 'inbound' in the filter, and you'll only see the... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | Your request to capture `only incoming traffic` leads to some ambiguity. The word incoming may has at least two different meanings in networking.
The first meaning packets received by a particular interface/device is relatively simple. The answer [Jeff provides](https://serverfault.com/a/348152/984) is what you want. ... | *Because tcpdump filters are the capture filters, and can be passed through tshark or tcpdump as well to avoid running a GUI just for capture if you're reviewing later*
`[tcpdump] ether dst $YOUR_MAC_ADDRESS` should cover most of what you want.
`[tcpdump] ether src not $YOUR_MAC_ADDRESS` would be broader. You may som... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | *Because tcpdump filters are the capture filters, and can be passed through tshark or tcpdump as well to avoid running a GUI just for capture if you're reviewing later*
`[tcpdump] ether dst $YOUR_MAC_ADDRESS` should cover most of what you want.
`[tcpdump] ether src not $YOUR_MAC_ADDRESS` would be broader. You may som... | You can use a capture filter with a network address instead of your machine's single IP such as "dst net 10.0.0.0/21". This would capture any packets being sent to 10.0.0.1 through 10.0.7.254.
Alternatively, you can use tshark to post-filter a capture file using -r ORIGINAL\_FILE -w NEW\_FILE -Y "display filters". In ... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | *Because tcpdump filters are the capture filters, and can be passed through tshark or tcpdump as well to avoid running a GUI just for capture if you're reviewing later*
`[tcpdump] ether dst $YOUR_MAC_ADDRESS` should cover most of what you want.
`[tcpdump] ether src not $YOUR_MAC_ADDRESS` would be broader. You may som... | Please stop this madness. It's very impractical to list the local host's mac/IP address every time you need this feature (not to mention the cases where these details can change while running the dump), and the pcap library has this facility already. You just have to use 'inbound' in the filter, and you'll only see the... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | Your request to capture `only incoming traffic` leads to some ambiguity. The word incoming may has at least two different meanings in networking.
The first meaning packets received by a particular interface/device is relatively simple. The answer [Jeff provides](https://serverfault.com/a/348152/984) is what you want. ... | You can use a capture filter with a network address instead of your machine's single IP such as "dst net 10.0.0.0/21". This would capture any packets being sent to 10.0.0.1 through 10.0.7.254.
Alternatively, you can use tshark to post-filter a capture file using -r ORIGINAL\_FILE -w NEW\_FILE -Y "display filters". In ... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | Your request to capture `only incoming traffic` leads to some ambiguity. The word incoming may has at least two different meanings in networking.
The first meaning packets received by a particular interface/device is relatively simple. The answer [Jeff provides](https://serverfault.com/a/348152/984) is what you want. ... | Please stop this madness. It's very impractical to list the local host's mac/IP address every time you need this feature (not to mention the cases where these details can change while running the dump), and the pcap library has this facility already. You just have to use 'inbound' in the filter, and you'll only see the... |
348,124 | I am trying to setup a Filter (so my log files aren't massive) that will capture only incoming traffic. I have looked on <http://wiki.wireshark.org/CaptureFilters> but so far have been unable to find a way to do this. Does anyone know how?
Just as a side question, when logging to multiple files in Wireshark, can you v... | 2012/01/09 | [
"https://serverfault.com/questions/348124",
"https://serverfault.com",
"https://serverfault.com/users/74198/"
] | You can use a capture filter with a network address instead of your machine's single IP such as "dst net 10.0.0.0/21". This would capture any packets being sent to 10.0.0.1 through 10.0.7.254.
Alternatively, you can use tshark to post-filter a capture file using -r ORIGINAL\_FILE -w NEW\_FILE -Y "display filters". In ... | Please stop this madness. It's very impractical to list the local host's mac/IP address every time you need this feature (not to mention the cases where these details can change while running the dump), and the pcap library has this facility already. You just have to use 'inbound' in the filter, and you'll only see the... |
355,188 | I'm having a strange problem since I moved from Centos5 to Centos6. I have three disks, first two are used as a RAID1, and third one is a stand-alone backup disk that is not listed in `/etc/fstab` (it is mounded when needed and then unmounted).
**My problem**: After a boot, `/dev/sdc` exists but `/dev/sdc1` does not.... | 2011/11/08 | [
"https://superuser.com/questions/355188",
"https://superuser.com",
"https://superuser.com/users/37440/"
] | I finally found the reason for this issue. The disk has been a member of Intel RAID array, and Intel's RAID signature survived re-partitioning and re-formatting in another computer:
>
> mdadm -Evvv /dev/sdc
>
>
>
```
Magic : Intel Raid ISM Cfg Sig.
Version : 1.1.00
............................. | I had the same problem on Debian Squeeze and VMware disks, partitions for one disk were simply not in `/dev`, but they were visible by fdisk and in dmesg. I have upgraded `udev` package from 164 (found in stable) to 175 (found in testing) and after reboot everything works as it should. |
8,637,052 | I'm trying to use beaneditform in Tapestry 5.3 and I would like to know how to don't use the forms default css styles.
I would like to use my css styles from my layout component.
I tryed to override it but I think it would generate overhead in my application.
Best regards | 2011/12/26 | [
"https://Stackoverflow.com/questions/8637052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/819285/"
] | Order matters in CSS; what you need to do is ensure that your CSS is added after the default Tapestry CSS. In you layout component:
```
@Import(stylesheet="context:css/mysite.css")
void afterRender() { }
```
This means that the import of the stylesheet happens during the AfterRender phase, which occurs at the end, a... | in appmodule.java
do the folowing for Tapestry versions 5.3 and Tapestry 5.5.
```
public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) {
...
// myStyles.css will now be the default css provided by Tapestry
configuration.add(SymbolConstants.DEFAULT_STYLESHEET, "context:c... |
57,855,551 | I am trying to populate datatables with a complex json scheme, however I don't know exactly how to do it.
* First, some parts of json are nested and it needs iteration.
* Second I need to create some markup, basically a href link.
Here is what I have:
```
$(document).ready(function(){
$('#empTable').DataTable({
... | 2019/09/09 | [
"https://Stackoverflow.com/questions/57855551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564979/"
] | @Andronicus made an earlier comment that
>
> fetch should do the job, but it's just a suggestion for hibernate, if
> it doesn't, then that could be the result of complex mapping
>
>
>
So trying a different approach, I was able to achieve what I was after by constructing a DAO in this manner:
```
/** DAO to int... | This annotation will do the trick:
```
@EntityGraph(attributePaths = { "changes" })
Stream<EntityHistory> findByIdGreaterThanOrderByIdAsc(Long id);
```
It will create a join query (the listed properties will be loaded eagerly), so all the data will be loaded in one query, so you don't even need the `@Transactional` ... |
1,965,845 | I need help finding general formula for factoring these two polynomials:
$$P\_{2n}(x) = x^{2n} \pm 1$$
$$P\_{2n+1}(x) = x^{2n+1} \pm 1$$
where $n$ is an integer. So the goal is to find formula for odd and even polynomials. I tried experimenting with real numbers to find a pattern, but that failed. I only know that com... | 2016/10/12 | [
"https://math.stackexchange.com/questions/1965845",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/377927/"
] | Hint:
let us do it for $x^{2n}-1$
we have to solve the equation
$z^{2n}=1$ with $z=e^{it}$
so
$e^{2int}=e^{2ik\pi}$
which gives the roots
$z\_k=e^{i\frac{k\pi}{n}}$ with
$k\in \{0,1,2,...2n-1\}$.
$x^{2n}-1=
(x-1)(x+1)(x^2-2xcos(\frac{\pi}{n}+1).....
(x^2-2xcos( \frac{ (n-1)\pi }{n})+1)$ | This is most simply done with some simple algebra:
$$x^k-a=0$$
$$x^k=a$$
$$x=\sqrt[k]a$$
More specifically, when we are dealing with all complex solutions:
$$x\_\phi=e^{2\pi i/\phi}\sqrt[k]a$$
For $\phi\in\{1,2,3,\dots,k\}$. Since you've found all the roots, see the factored form:
$$x^k-a=(x-x\_1)(x-x\_2)(x-x\_3... |
1,965,845 | I need help finding general formula for factoring these two polynomials:
$$P\_{2n}(x) = x^{2n} \pm 1$$
$$P\_{2n+1}(x) = x^{2n+1} \pm 1$$
where $n$ is an integer. So the goal is to find formula for odd and even polynomials. I tried experimenting with real numbers to find a pattern, but that failed. I only know that com... | 2016/10/12 | [
"https://math.stackexchange.com/questions/1965845",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/377927/"
] | Over $\mathbb C$ you don't need to split into odd and even cases -- we always have
$$ x^n-1 = (x-1)(x-e^{2\pi i/n})(x-e^{4\pi i/n})\cdots(x-e^{2(n-1)\pi i/n}) $$
and
$$ x^n+1 = (x-e^{\pi/n})(x-e^{3\pi i/n})(x-e^{5\pi i/n})\cdots(x-e^{(2n-1)\pi i/n}) $$
because $x^n=1$ and $x^n=-1$ both have $n$ different solutions, so ... | This is most simply done with some simple algebra:
$$x^k-a=0$$
$$x^k=a$$
$$x=\sqrt[k]a$$
More specifically, when we are dealing with all complex solutions:
$$x\_\phi=e^{2\pi i/\phi}\sqrt[k]a$$
For $\phi\in\{1,2,3,\dots,k\}$. Since you've found all the roots, see the factored form:
$$x^k-a=(x-x\_1)(x-x\_2)(x-x\_3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.