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 |
|---|---|---|---|---|---|
71,032,428 | I generated some options using shell script, `echo $NLB_EIPS` resulting in `-p "route 1.1.1.1 255.255.255.255" -p "route 2.2.2.2 255.255.255.255" -p "route 3.3.3.3 255.255.255.255"`
I need to append this option to my original command of `docker run <SOME_OTHER_OPTIONS...> -p "route 192.0.0.0 255.255.0.0" -p "route 10.... | 2022/02/08 | [
"https://Stackoverflow.com/questions/71032428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10690874/"
] | Using a loop:
```py
df = pd.DataFrame({})
for row in query.rows():
data = {'primaryIdentifier': row["primaryIdentifier"],
'symbol': row["symbol"],
'organism.name': row["organism.name"],
'homologues.homologue.primaryIdentifier': row["homologues.homologue.primaryIdentifier"... | Pandas would help you.<https://pandas.pydata.org>. Feel free to ask questions if you stuck with something. |
71,032,428 | I generated some options using shell script, `echo $NLB_EIPS` resulting in `-p "route 1.1.1.1 255.255.255.255" -p "route 2.2.2.2 255.255.255.255" -p "route 3.3.3.3 255.255.255.255"`
I need to append this option to my original command of `docker run <SOME_OTHER_OPTIONS...> -p "route 192.0.0.0 255.255.0.0" -p "route 10.... | 2022/02/08 | [
"https://Stackoverflow.com/questions/71032428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10690874/"
] | Your example is not reproducible because we can't construct the query but I suppose, this should work:
```
import pandas as pd
df = pd.DataFrame(list(query.rows()))
# OR
df = pd.DataFrame(query.rows(), columns=query.views)
```
Output:
```
>>> df
Gene.briefDescription Gene.desc... | Using a loop:
```py
df = pd.DataFrame({})
for row in query.rows():
data = {'primaryIdentifier': row["primaryIdentifier"],
'symbol': row["symbol"],
'organism.name': row["organism.name"],
'homologues.homologue.primaryIdentifier': row["homologues.homologue.primaryIdentifier"... |
62,039 | When you want to create a bootable usb memory stick, then you must identify as a sudoer. Why is that? I have no difficulty understanding why unprivileged users shouldn't be allowed to fiddle with the installed system, but why shouldn't you be allowed to copy grub onto the memory stick if you have write access to it? | 2011/09/19 | [
"https://askubuntu.com/questions/62039",
"https://askubuntu.com",
"https://askubuntu.com/users/19779/"
] | Policy Kit foresees the following actions related to *Usb Creator*
```
$ pkaction --verbose | grep -A1 '\.usb' | less
com.ubuntu.usbcreator.bootloader:
description: Install the bootloader
--
com.ubuntu.usbcreator.format:
description: Format the device
--
com.ubuntu.usbcreator.image:
description: ... | It needs to to format the USB drive, and access the device through `/dev/sd***x***`. So it needs `root` privileges. |
102,538 | I wanted to generate a cover page for a tech report and so put the following in my preamble
```
\makeatletter
\newcommand{\coverpage}{\onecolumn \centering \large
\thispagestyle{empty}
{\noindent\includegraphics[width=3.5in]{Logo_black}}\vspace*{0.4in}\\
{\noindent\huge Electrical Engineering and Computer Science}\vsp... | 2013/03/14 | [
"https://tex.stackexchange.com/questions/102538",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/5313/"
] | By surrounding the `coverpage` macro with a `\begingroup` and `\endgroup` you limit the effect of the macros to be within that scope.
Notes:
------
* [The `lipsum` package](http://www.ctan.org/pkg/lipsum) was used just to provide dummy text. It is not needed in your document.
* The `[demo]` option was used for [the `... | ```
\newcommand{\coverpage}{\onecolumn {\centering \large
%%
```
Start a group to limit the scope of `\centering`
```
\setcounter{page}{0}%
\par}%
```
End the group to stop `\centering` (always make sure that size changing and paragraph formatting commands include a `\par` at t... |
59,493,824 | I'm modifying decounce code for a push button system, where momentary buttons will be monitored for a short press and a long press to carry out some action. I'm having trouble using the code in Typedef though as it seems to not be working as I expect. Can anyone help explain what I'm missing? Specifically, I'm modifyin... | 2019/12/26 | [
"https://Stackoverflow.com/questions/59493824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7564872/"
] | You have "numberButtons" buttons each with "numberButtons" outputs. This means you have numberButtons\*numberButtons outputs, which sounds wrong. If this is what is intended, you would need a loop like this
```
for (int b_idx = 0; b_idx < numberButtons; ++b_idx) // once per button
for (int o_idx = 0; o_idx < num... | First of, the `typedef` isn’t need in C++! That’s a C thing. It is allowed but actually doesn’t really have any useful effect.
It seems you are trying to create a class and hope to initialize a global array to reference the elements in the class. That won’t work as C++ is based on *values* rather than references. You ... |
59,493,824 | I'm modifying decounce code for a push button system, where momentary buttons will be monitored for a short press and a long press to carry out some action. I'm having trouble using the code in Typedef though as it seems to not be working as I expect. Can anyone help explain what I'm missing? Specifically, I'm modifyin... | 2019/12/26 | [
"https://Stackoverflow.com/questions/59493824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7564872/"
] | You have "numberButtons" buttons each with "numberButtons" outputs. This means you have numberButtons\*numberButtons outputs, which sounds wrong. If this is what is intended, you would need a loop like this
```
for (int b_idx = 0; b_idx < numberButtons; ++b_idx) // once per button
for (int o_idx = 0; o_idx < num... | **constexpr** or **template**
not typedef
```
// ...
#include <windows.h> // for byte type:
const byte numberButtons = 5;
// ...
int dimValue = 0; //dimmer value initialized
template<byte DIM>
struct Buttons {
const int debounce = 10;
unsigned long counter=0;
bool prevState = NOT_PRESSED;
... |
36,686,590 | ```
{"cities":[{"city":{"id":1,"name":"Bangalore","status":"Active"}},
{"city":{"id":2,"name":"Mysore","status":"Active"}},... ]}
```
The above is the JSON format and this is how I fetch from JSON as shown below,
```
$city=$data['cities'];
$citycount=count($city);
for($i=0;$i<$citycount;$i++)
{
echo $data['cities'... | 2016/04/18 | [
"https://Stackoverflow.com/questions/36686590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3828306/"
] | Try it like this.
```
$result = json_decode($newjson);
$result = $result->result;
$data = [];
$headers= $result[0]; // get the first row.
foreach($result as $key => $row) {
// ignore the headers row.
if($key != 0) {
array_push($data, [
$headers[0] => $row[0],
$headers[1] => $row[1],
... | Try this
```
$json = '{"result":[["id","name","status"],[1,"Bangalore","Active"],[2,"Mysore","Active"]]} ';
$result = json_decode($json,true);
$dataArray = [];
foreach($result['result'] as $key => $value) {
if($key != 0) {
array_push($dataArray, [
$result['result'][0][0] => $value[0],
$r... |
36,686,590 | ```
{"cities":[{"city":{"id":1,"name":"Bangalore","status":"Active"}},
{"city":{"id":2,"name":"Mysore","status":"Active"}},... ]}
```
The above is the JSON format and this is how I fetch from JSON as shown below,
```
$city=$data['cities'];
$citycount=count($city);
for($i=0;$i<$citycount;$i++)
{
echo $data['cities'... | 2016/04/18 | [
"https://Stackoverflow.com/questions/36686590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3828306/"
] | Try it like this.
```
$result = json_decode($newjson);
$result = $result->result;
$data = [];
$headers= $result[0]; // get the first row.
foreach($result as $key => $row) {
// ignore the headers row.
if($key != 0) {
array_push($data, [
$headers[0] => $row[0],
$headers[1] => $row[1],
... | Here you have a more dynamic method, does not matter what headers you have it will combine automatically, but is very important that each row need to contain the same array length.
```
$data = '{"result":[["id","name","status"],[1,"Bangalore","Active"],[2,"Mysore","Active"]]}';
$_data = json_decode($data);
if(!empty(... |
36,686,590 | ```
{"cities":[{"city":{"id":1,"name":"Bangalore","status":"Active"}},
{"city":{"id":2,"name":"Mysore","status":"Active"}},... ]}
```
The above is the JSON format and this is how I fetch from JSON as shown below,
```
$city=$data['cities'];
$citycount=count($city);
for($i=0;$i<$citycount;$i++)
{
echo $data['cities'... | 2016/04/18 | [
"https://Stackoverflow.com/questions/36686590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3828306/"
] | Try this
```
$json = '{"result":[["id","name","status"],[1,"Bangalore","Active"],[2,"Mysore","Active"]]} ';
$result = json_decode($json,true);
$dataArray = [];
foreach($result['result'] as $key => $value) {
if($key != 0) {
array_push($dataArray, [
$result['result'][0][0] => $value[0],
$r... | Here you have a more dynamic method, does not matter what headers you have it will combine automatically, but is very important that each row need to contain the same array length.
```
$data = '{"result":[["id","name","status"],[1,"Bangalore","Active"],[2,"Mysore","Active"]]}';
$_data = json_decode($data);
if(!empty(... |
73,960,696 | I have small web/mail server with apache/mariadb. Last week we changed some of the WWW code and to make it work I changed in php.ini line :
```
max_input_vars to 5000 (now 4000, it was 1000 at the start)
```
And it seems changed something because our mariadb 10.3.28 starts making problems.
It just stops reciving any... | 2022/10/05 | [
"https://Stackoverflow.com/questions/73960696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11221263/"
] | Checkout the [next-i18next](https://github.com/i18next/next-i18next) library. They do a really good job on documenting common use cases. As for your specific question, you can set the locale of the Next.js router in next-i18next by using the following code:
```
const { i18n } = useTranslation();
// These are mock loc... | next js make auto-detection by the browser you can stop auto-detection by adding
localeDetection: false
<https://nextjs.org/docs/advanced-features/i18n-routing#automatic-locale-detection>
you can change the locale in \_document.jsx
```html
class MyDocument extends Document {
static async getInitialProps(ctx) {
... |
4,639 | I have rules in my .htaccess file that I use in order to completely eliminate index.php from all URLs in a Magento installation I have (currently in a subdomain).
```
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http:/... | 2013/06/11 | [
"https://magento.stackexchange.com/questions/4639",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/2267/"
] | Thanks for your help. I figured it out. To backtrack, I believe the options in Magento remove index.php visually, however the website still responds to it, if I were to type in www.mysite.com/index.php for example the home page will still load. I never want to see index.php anywhere, so I'd like to redirect any URLs wi... | What is this? This rule shouldn't be in your htaccess:
```
RewriteRule ^(.*)index.php$ http://my.website.com/$1 [R=301,L]
```
I'm not sure what you're trying to accomplish here - seems like it's not well-formed, as it's logically saying:
>
> If you see a file named index.php, which has any number of required chara... |
18,481 | Context
-------
I am planning an experiment where the subjects would need to determine the language of the stimulus after listening to it once, given two alternatives, L1 or L2.
In total I have 500 trials separated in 5 blocks.
Problem
-------
One of my supervisors insists that I have to give the subjects a feedbac... | 2017/11/16 | [
"https://cogsci.stackexchange.com/questions/18481",
"https://cogsci.stackexchange.com",
"https://cogsci.stackexchange.com/users/17531/"
] | **Short answer**
Giving subjects feedback may affect their performance over time because of learning effects. The choice of giving feedback may be far less trivial than subjects getting bored yes or no. And quite frankly, subjects will get bored after a 100 trials, let alone 500, feedback or no feedback...
**Backg... | Let me give the opposite advice. Note that I don't know the language field. But in perception people distinguish between so-called type A and type B experiments (or type 1, type 2, the classification is actually quite confusing as all authors have a different one). In type A experiments you know what the correct answer... |
3,154,959 | Find the pdf of Y = $e^{\frac{1}{2}x}$ if x is exponentially distributed with parameter $\lambda =$ 3.
This question was given to me as a review for an upcoming exam, I am not really sure where to start.
I'm thinking :
$F\_Y(y) =$
\begin{cases}
\lambda e^{-\lambda x} & x\geq 0 \\
0 & otherwise
\end{cases}
as ... | 2019/03/20 | [
"https://math.stackexchange.com/questions/3154959",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/645151/"
] | The first thing you have to do is master case sensitivity, otherwise you are just going to confuse yourself. Don't mix up when you use random variable $Y$ and term $y$.
Also, your final answer should not contain any term $x$. $F\_Y(y)$ will clearly be a function of term $y$.
But moving on...
---
If $X$ is expon... | From your attempt, you have written $P(Y\le y)= 1-e^{-\lambda y}$. This would be true if $Y$ were $Expo(\lambda)$, but we are not told $Y$ is (we are told $X$ is). Instead, note that for $y> 0$, we have $$Y\le y \iff e^{X/2}\le y\iff X \le 2\ln y.$$
Thus $P(Y\le y) = P(X\le 2\ln y)$. See if you can finish from here. |
5,166,337 | I would know if is possible to play a sound on AX 2009. With a fast search on internet I found a WInAPI function that allows me to play a sound (sndPlaySound()), but this function works on AX 4.0, not on AX 2009 because this function not exists on AX 2009.
How I can play a sound? Is there a new function? | 2011/03/02 | [
"https://Stackoverflow.com/questions/5166337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/321022/"
] | You need to use the `#` convert token to string command of the preprocessor. You should define your second macro this way:
```
#define SOMEDEFINE(x) &x, __LINE__, # x
```
Or if `x` can also be a macro call, and you want the string to contains the expansion of the macro, you need to use an auxiliary macro:
```
#def... | You can actually do a lot better than that: `#define SOMEDEFINE( X, ... ) aDebugFunction( &(X), __LINE__, #X, __VA_ARGS__ )`
You could then simply call into this code like this: `SOMEDEFINE( ptrToFunction, param1, param2, etc )`
And that would effectively call: `aDebugFunction( &( ptrToFunction ), __LINE__, "ptrToF... |
3,798,919 | I was using simple textarea element and then replaced it with iframe with designMode='on' to give user the possibility to mark some text and make it italic. But I still want an iframe to look like textarea, so I need a border around it similar to that which appears in Chrome and Safari when textarea is active. How can ... | 2010/09/26 | [
"https://Stackoverflow.com/questions/3798919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430083/"
] | You can get the rounded outline in webkit like this:
```
outline: 2px auto red;
```
Notice that the width of the outline will not obey the specified width, and the color isn't completely accurate either.
To use the normal focus color, you can do this:
```
outline: 2px auto -webkit-focus-ring-color;
```
In moz, y... | You can use the `:focus` psuedo-selector and the `outline` property:
```
`.elementClass:focus {
outline: 1px solid #ffa;
}
```
This will add a yellow outline to the element, I'm not sure what colour Chrome and Safari uses, but just add your preferred colour-to-taste.
---
**Edited** in response to OP's comment:... |
3,798,919 | I was using simple textarea element and then replaced it with iframe with designMode='on' to give user the possibility to mark some text and make it italic. But I still want an iframe to look like textarea, so I need a border around it similar to that which appears in Chrome and Safari when textarea is active. How can ... | 2010/09/26 | [
"https://Stackoverflow.com/questions/3798919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430083/"
] | You can get the rounded outline in webkit like this:
```
outline: 2px auto red;
```
Notice that the width of the outline will not obey the specified width, and the color isn't completely accurate either.
To use the normal focus color, you can do this:
```
outline: 2px auto -webkit-focus-ring-color;
```
In moz, y... | I solved my problem in a following way.
When I need to highlight iframe for the first time I’m creating textarea with negative 'left' coordinate (so that it’s invisible to user), give it a focus and get its CSS properties via window.getComputedStyle. Then I’m applying four of these properties to focused iframe: 'outli... |
3,798,919 | I was using simple textarea element and then replaced it with iframe with designMode='on' to give user the possibility to mark some text and make it italic. But I still want an iframe to look like textarea, so I need a border around it similar to that which appears in Chrome and Safari when textarea is active. How can ... | 2010/09/26 | [
"https://Stackoverflow.com/questions/3798919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430083/"
] | You can get the rounded outline in webkit like this:
```
outline: 2px auto red;
```
Notice that the width of the outline will not obey the specified width, and the color isn't completely accurate either.
To use the normal focus color, you can do this:
```
outline: 2px auto -webkit-focus-ring-color;
```
In moz, y... | I found an article that mentions browser specific colours [for FireFox](http://help.dottoro.com/lanifqvh.php#mozillaColors) and [for Safari/Chrome](http://help.dottoro.com/lanifqvh.php#safariColors).
I was trying to read the focus ring colour in javascript, so I could soften it and use it within our UI, but I gave up.... |
2,453,773 | I am trying to prove that, if $\rho:S^n\times S^n\to \Bbb{R}$ is the distance induced by the Riemannian metric on the sphere $S^n\subset \Bbb{R}^{n+1}$, then $$\rho(p,q)=\arccos \langle p,q\rangle,\,\,\,\forall p,q\in S^n$$
with $\arccos$ defined from $[-1,1]$ to $[0,\pi]$.
If $p=q$, then the formula is trivial. We ha... | 2017/10/02 | [
"https://math.stackexchange.com/questions/2453773",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/177211/"
] | Let $p=(1,0,\dots,0)$ and $q=(-1,0,\dots,0)$. Then any path from $p$ to $q$ is of the form $\gamma(t)=(t,h(t))$,
where $h(t)\in \Bbb{R}^n$. Then the length of the path is
$$
L=\int\_{-1}^{1}|\gamma'(t)|dt.
$$
But $\gamma'(t)=(1,h'(t))$, and so $|\gamma'(t)|=\sqrt{1+|h'(t)|^2}$.
Now $t^2+\langle h(t),h(t)\rangle=\langl... | To get a lower bound for the length of a path joining two points,
you may place one point at the north pole, introduce one angular coordinate and mimic the standard proof from Euclidean space. It is convenient to use a slightly singular coordinate system (essentially the same as you are discussing):
Let $x=(x\_0,x\_1... |
2,135,328 | Is there a known reason why `FormatException` does not inherit from `ArgumentException`? An invalid format would seem to be a very specific case of an argument being invalid, similar to `ArgumentOutOfRangeException`.
The [MSDN article for the class](http://msdn.microsoft.com/en-us/library/system.formatexception.aspx)... | 2010/01/25 | [
"https://Stackoverflow.com/questions/2135328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/138578/"
] | `FormatException` is not necessarily thrown when a formal argument of a method is invalid. It can also happen if the method is consuming an external resource and the format of the data from the external resource is inappropriate.
For example, [`BinaryReader.Read7BitEncodedInt`](http://msdn.microsoft.com/en-us/library... | This is a bit snotty: but Richter in **CLR Via C#** (page 432) suggests that maybe it's because Exception class hierarchy wasn't implemented very well in .NET:
>
> Microsoft's original idea was that `System.Exception` would be the base type for all exceptions and that two other types, `System.SystemException` and `Sy... |
41,251,020 | I have a React component written in Typescript 2.0.6 + JSX (TSX) that needs to make use of the LinkedStateMixin. How do I include the mixin in my class definition? I have searched the official documentation without success. Is there a way to include a mixin in my component class?
Note: I'm using ReactJS v0.14.6 | 2016/12/20 | [
"https://Stackoverflow.com/questions/41251020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797252/"
] | I don't know if you know about mixins current state... so:
<https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html>
Consider update to React v15.4.0 and use High-order Components.
**You've Been Warned**
by the way, if you really need it. Install this mixin: `npm install react-addons-linked-s... | Unfortunately, React has officially moved away from the mixin pattern: <https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html>. You can still use them if you're not using ES6 style react components. However, if you really need it, you could use this library: <https://github.com/brigand/react-m... |
5,174,871 | I want my application to have a single document but several screens without resorting to several windows. What's the best way to achieve this? I'm thinking of using a single NSPersistentDocument that will start with a NSViewController displaying a set of controls and then swap that view for another NSViewController.
M... | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70600/"
] | Yes, it's completely possible to do. Yes, you should use view controllers but you don't have to. That's strictly a stylistic choice. If you don't use a view controller then all the controller logic would likely be in your single window controller. That might get painful for a big app. View controllers help you break do... | It can be done as you describe but you will have to manage the relationship to the document manually because the default configuration assumes a one-document --> one-controller relationship for simplicity sake.
Once move away from the standard design, you lose all the built-in functionality.
You might want to rethin... |
5,174,871 | I want my application to have a single document but several screens without resorting to several windows. What's the best way to achieve this? I'm thinking of using a single NSPersistentDocument that will start with a NSViewController displaying a set of controls and then swap that view for another NSViewController.
M... | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70600/"
] | It can be done as you describe but you will have to manage the relationship to the document manually because the default configuration assumes a one-document --> one-controller relationship for simplicity sake.
Once move away from the standard design, you lose all the built-in functionality.
You might want to rethin... | What about using a NSNavigationController to manage the multiple views - it makes it easy to push and pop the various views ? |
5,174,871 | I want my application to have a single document but several screens without resorting to several windows. What's the best way to achieve this? I'm thinking of using a single NSPersistentDocument that will start with a NSViewController displaying a set of controls and then swap that view for another NSViewController.
M... | 2011/03/02 | [
"https://Stackoverflow.com/questions/5174871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/70600/"
] | Yes, it's completely possible to do. Yes, you should use view controllers but you don't have to. That's strictly a stylistic choice. If you don't use a view controller then all the controller logic would likely be in your single window controller. That might get painful for a big app. View controllers help you break do... | What about using a NSNavigationController to manage the multiple views - it makes it easy to push and pop the various views ? |
60,145,940 | I want to get students who fulfill the following criteria in a WPF application-
1. Are "passed" the examination
2. Except first "passed" student in each "group" (Example: Group 1 & 3)
3. If a group contains only one "passed" student, that student should be omitted (Example: Group 2)
4. Original grouping should be pres... | 2020/02/10 | [
"https://Stackoverflow.com/questions/60145940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Well, let's try to apply conditions one after one:
```
var result = myList
.Where(student => student.Status == "Passed") // passed only
.GroupBy(student => student.GroupId) // grouped by Group Id
.SelectMany(group => group.Skip(1)) // Skip 1st student in each group
.ToList(); ... | Do the Skip in the select so it applies to each group, not the overall results:
```
var results = myList.GroupBy(x => x.GroupID)
.Where(g => g.Status == "Passed")
.Select(g => g.OrderBy(x => x.Status).Skip(1))
.ToList();
``` |
31,700,476 | I have defined an array `$array[1][1][test]="hello world"`. I would like to get this value by using variable variables. I have tried this, without success:
```
$var1="array";
$var2="[1][1]";
$var3="['test']";
echo ${$var1}{$var2}{$var3};
```
Output is `null`. | 2015/07/29 | [
"https://Stackoverflow.com/questions/31700476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5169372/"
] | As far as I can see, you *never* add your values in your `VALUES(..)` part in your query.
My suggestion is;
* Define your parameter in your `VALUES` part
* Add your values with `myAccessCommand.Parameters.Add` in your for loop.
* Execute your query.
* `Clear()` your parameters just before your wanna insert values for... | You probably need to modify your code like that:
(Let me note that this is only a TEST CODE to check that it solves your problem, you will have to construct your command by using parameter.add() for your code to be safe)
```
private void submitbutton_Click(object sender, EventArgs e){
availabilitytabControl.Selec... |
579,784 | So, I have three servers in my moss farm. A database server and two front-end servers...
On server 1 I am able to access my web application just fine and the services are running fine. However, on server 2 I am unable to start the Web Application service; I receive a error message on the screen stating "Check the serv... | 2009/02/23 | [
"https://Stackoverflow.com/questions/579784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55862/"
] | I would guess that either you have something up with IIS on Server 2 or that there's a deeper MOSS problem on Server 2. First thing is to figure out which web application is causing the problem.
Under Central Administration > Application Management > Web Application List. When you click on a web application name you'l... | I would check that the service account used for the web application has got the nessecary rights.
Go to central administration
then open "operations" > "service accounts"
click web application
Select the web application or check what users are used for the different web applications. Then check if they have the nessec... |
66,838,823 | I'm using an AWS Lambda function written in Go with Dynamo stream but I don't see any way where I can marshall the old & new image to my struct because it's returning the image as `map[string]DynamoDBAttributeValue`.
I can check individual key and then assign it to my struct one by one, but is there an direct way to... | 2021/03/28 | [
"https://Stackoverflow.com/questions/66838823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5377229/"
] | Unfortunately there is no elegant way yet, sot you have to check each key/value pairs and assign them to your struct.
PS: As small sugar you can use func `FromDynamoDBMap` from [this package](https://github.com/thepkg/awsl) and work with `map[string]interface{}` not with `map[string]events.DynamoDBAttributeValue` whic... | I have created a solution for the problem. This was crucial to my implementation since my implementation uses custom keys.
Unfortunately, the Number type has to be cast to Float64 to make sure that it is not lost.
This will result in a completely usable struct against the changeset. You may need a map of your models ... |
55,759,133 | I am stuck in writing a SQL query, the function is something like to return a student's latest formal exam score in a month, or latest mock exam score if there is no formal for a student.
For example, here is a table to keep exam scores, column 'mode' is for formal exam or mock exam.
```
name class ... | 2019/04/19 | [
"https://Stackoverflow.com/questions/55759133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2741394/"
] | In Postgres, I prefer `DISTINCT ON` to get top record per group. It has slightly better performance.
```
select DISTINCT ON (name,class) t.*
from t ORDER BY name,class,
case when mode = 'formal'
then 0 else 1 end,exam_time desc ;
```
[**DEMO**](https://dbfiddle.uk/?rdbms=postgres_10&fiddle=6a864ceb8446aeb... | We can use `row_number` here:
```
select name, class, mode, score, exam_time
from
(
select t.*, row_number() over (partition by name, class
order by case when mode = 'formal' then 0 else 1 end,
date_trunc('month', exam_time) desc) rn
... |
55,759,133 | I am stuck in writing a SQL query, the function is something like to return a student's latest formal exam score in a month, or latest mock exam score if there is no formal for a student.
For example, here is a table to keep exam scores, column 'mode' is for formal exam or mock exam.
```
name class ... | 2019/04/19 | [
"https://Stackoverflow.com/questions/55759133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2741394/"
] | This is a slight variation of Kaushik's approach. `distinct on` is the way to go, but I would write the logic as:
```
select distinct on (name, class) t.*
from t
order by name, class, (mode = 'formal') desc, exam_time desc;
```
`distinct on` returns one row for each set of values in the grouping (what is in the par... | We can use `row_number` here:
```
select name, class, mode, score, exam_time
from
(
select t.*, row_number() over (partition by name, class
order by case when mode = 'formal' then 0 else 1 end,
date_trunc('month', exam_time) desc) rn
... |
55,759,133 | I am stuck in writing a SQL query, the function is something like to return a student's latest formal exam score in a month, or latest mock exam score if there is no formal for a student.
For example, here is a table to keep exam scores, column 'mode' is for formal exam or mock exam.
```
name class ... | 2019/04/19 | [
"https://Stackoverflow.com/questions/55759133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2741394/"
] | This is a slight variation of Kaushik's approach. `distinct on` is the way to go, but I would write the logic as:
```
select distinct on (name, class) t.*
from t
order by name, class, (mode = 'formal') desc, exam_time desc;
```
`distinct on` returns one row for each set of values in the grouping (what is in the par... | In Postgres, I prefer `DISTINCT ON` to get top record per group. It has slightly better performance.
```
select DISTINCT ON (name,class) t.*
from t ORDER BY name,class,
case when mode = 'formal'
then 0 else 1 end,exam_time desc ;
```
[**DEMO**](https://dbfiddle.uk/?rdbms=postgres_10&fiddle=6a864ceb8446aeb... |
2,434,310 | Suppose $a\_n$ is a divergent sequence . Does $b\_n = n \times a\_n$ diverge or converge ? Obviously , There is no general rule for the limit of multiplication divergent sequences but I can't find a counterexample that shows $b\_n$ is convergent . | 2017/09/18 | [
"https://math.stackexchange.com/questions/2434310",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/325808/"
] | Since $h>0$ can take any value, you can use the substitution $\bar h=2h$ and you get the same term. Note that the important part in the truncation error is the exponent of $h$ (and, possibly, the maximum for the derivative); the constant is not too significant.
However, the derivation of the second order centered diff... | The difference in the constant is because you are using $2\,h$ instead of $h$. The Taylor expansion gives
$$
\frac{u(x+h)-2\,u(x)+u(x-h)}{h^2}=u''(x)+\frac{h^2}{12}\,u''''(x)+O(h^5),
$$
and
$$
u''(x)-\frac{u(x+h)-2\,u(x)+u(x-h)}{h^2}=-\frac{h^2}{12}\,u''''(x)+O(h^5).
$$ |
31,731,368 | I have a problem with `preg_replace` in PHP.
My text:
```
[Derp] a
• [Derp] a
```
My regex:
```
$simple_search[0] = '/\[(.*?)\] (.*?)/is';
$simple_search[1] = '/\• \[(.*?)\] (.*?)/is';
```
My subject:
```
$simple_replace[0] = "[color=#009D9D][$1][/color] $2";
$simple_replace[1] = "[color=#30BA76]• [$1][/color... | 2015/07/30 | [
"https://Stackoverflow.com/questions/31731368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5174939/"
] | `$_POST` will most likely be used, whether or not you do this with jQuery. The default limit of `$_POST` is already high enough to handle most user input, short of file uploads. If you need it to be greater than 8MB, you can change that on the webserver in your `php.ini` file. I've had a similar application, and in tes... | Using $\_POST is a pretty good way to start, if it's getting bigger then 8MB change the php.ini. If it's getting much larger you can start slice your string and send the chunks via jQuery to your web server and concatenate them afterwards.
But at the first run I would prefer with the standard way and use $\_POST. |
3,261,079 | I’m not familiar enough with probability to be able to even begin to approach this myself, but this puzzle has been plaguing me.
Assume I have $m$ black shirts and $n$ white shirts, where $m > n$. Black shirts have durability $d \ge 0$, and white shirts have durability $u \ge 0$. (Feel free to pick better variable nam... | 2019/06/13 | [
"https://math.stackexchange.com/questions/3261079",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/3392/"
] | For specific numbers of shirts and durabilities, the problem can be modeled as a finite-state [absorbing Markov chain](https://en.wikipedia.org/wiki/Absorbing_Markov_chain), but the number of states quickly gets out of hand. Say that a shirt has initial durability of $d$. Its durability can be anything from $0$ to $d$ ... | *This is a partial answer*. Update built on top of this: [as a self contained answer](https://math.stackexchange.com/q/3270791).
---
---
Part 1/3: Solving for any $(m,n)$ and $u,v=1,1$
-----------------------------------------------
**Let's restate the problem for convenience**
Each day a shirt is worn (uniformly ... |
3,261,079 | I’m not familiar enough with probability to be able to even begin to approach this myself, but this puzzle has been plaguing me.
Assume I have $m$ black shirts and $n$ white shirts, where $m > n$. Black shirts have durability $d \ge 0$, and white shirts have durability $u \ge 0$. (Feel free to pick better variable nam... | 2019/06/13 | [
"https://math.stackexchange.com/questions/3261079",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/3392/"
] | *This is a partial answer*. Update built on top of this: [as a self contained answer](https://math.stackexchange.com/q/3270791).
---
---
Part 1/3: Solving for any $(m,n)$ and $u,v=1,1$
-----------------------------------------------
**Let's restate the problem for convenience**
Each day a shirt is worn (uniformly ... | *This is a generalization that was considered at the end of my previous answer. [That answer](https://math.stackexchange.com/q/3266965) represents a detailed and elementary base case, and an update hinting towards this.*
Here I show how you can reach exact probabilities using just raw combinatorics and probability. No... |
3,261,079 | I’m not familiar enough with probability to be able to even begin to approach this myself, but this puzzle has been plaguing me.
Assume I have $m$ black shirts and $n$ white shirts, where $m > n$. Black shirts have durability $d \ge 0$, and white shirts have durability $u \ge 0$. (Feel free to pick better variable nam... | 2019/06/13 | [
"https://math.stackexchange.com/questions/3261079",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/3392/"
] | For specific numbers of shirts and durabilities, the problem can be modeled as a finite-state [absorbing Markov chain](https://en.wikipedia.org/wiki/Absorbing_Markov_chain), but the number of states quickly gets out of hand. Say that a shirt has initial durability of $d$. Its durability can be anything from $0$ to $d$ ... | *This is a generalization that was considered at the end of my previous answer. [That answer](https://math.stackexchange.com/q/3266965) represents a detailed and elementary base case, and an update hinting towards this.*
Here I show how you can reach exact probabilities using just raw combinatorics and probability. No... |
16,404,728 | I want to grab the first char of a var string and the first char of the following caracter
Example:
```
$var1 = "Jean-Martin"
```
I want a way to grab the first letter "J" then I want to take the first char following the "-" (dash) which is "M". | 2013/05/06 | [
"https://Stackoverflow.com/questions/16404728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980690/"
] | ```
$var1 = "Jean-Martin"
```
To get the first character:
```
$var1[0]
```
To get the first character after the dash:
```
$characterToSeek = '-'
$var1[$var1.IndexOf($characterToSeek)+1]
``` | Something like this?
```
$initial1 = $var1[0]
$initial2 = $var1.Split('-')[1][0]
```
Strings in Powershell use the System.String class from the .Net framework. As such, they are indexable to retrieve individual characters and have many methods available such as the Split method used above.
See the documentation [he... |
16,404,728 | I want to grab the first char of a var string and the first char of the following caracter
Example:
```
$var1 = "Jean-Martin"
```
I want a way to grab the first letter "J" then I want to take the first char following the "-" (dash) which is "M". | 2013/05/06 | [
"https://Stackoverflow.com/questions/16404728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980690/"
] | Something like this?
```
$initial1 = $var1[0]
$initial2 = $var1.Split('-')[1][0]
```
Strings in Powershell use the System.String class from the .Net framework. As such, they are indexable to retrieve individual characters and have many methods available such as the Split method used above.
See the documentation [he... | Another option using regex:
```
PS> $var1 -replace '^(.)[^-]+-(.).+$','$1$2'
JM
``` |
16,404,728 | I want to grab the first char of a var string and the first char of the following caracter
Example:
```
$var1 = "Jean-Martin"
```
I want a way to grab the first letter "J" then I want to take the first char following the "-" (dash) which is "M". | 2013/05/06 | [
"https://Stackoverflow.com/questions/16404728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980690/"
] | ```
$var1 = "Jean-Martin"
```
To get the first character:
```
$var1[0]
```
To get the first character after the dash:
```
$characterToSeek = '-'
$var1[$var1.IndexOf($characterToSeek)+1]
``` | Another option using regex:
```
PS> $var1 -replace '^(.)[^-]+-(.).+$','$1$2'
JM
``` |
677,815 | I am a bit confused on how to configure certificate for my local host. My scenario is like:
We've two windows 2012 servers (not joined in a domain) and I need to execute a powershell script remotely from one machine. This has to be done using the IP of the other machine. I've tried a bit and could finally know that th... | 2015/03/24 | [
"https://serverfault.com/questions/677815",
"https://serverfault.com",
"https://serverfault.com/users/234362/"
] | From <https://support.microsoft.com/en-us/kb/2019527> :
>
> The purpose of configuring WinRM for HTTPS is to encrypt the data
> being sent across the wire.
>
>
> WinRM HTTPS requires a local computer "Server Authentication"
> certificate with a CN matching the hostname, that is not expired,
> revoked, or self-s... | There's no problem with using a self-signed cert for WinRM https, but when connecting to that computer's endpoint you need to specify that the (winRM) client should skip cert checks. You can do this using:
```
$options = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
```
and then set up the sessi... |
47,271,177 | How to reduce to data scanned size for 'select' query in AWS athena. By scanning only one of the column.
Example:
SELECT \* FROM TABLE1 WHERE STATUS='Fail'; | 2017/11/13 | [
"https://Stackoverflow.com/questions/47271177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8654250/"
] | ```
int foo() {
extern i;
return i++;
}
```
Here you instrument the interpreter to see that `i` is declared somewhere in some outside block, and to connect this object with an object `i` declared somewhere before -- in your case, in file scope.
In the second case you tell the interpreter to store the variable ... | **Extern** : extern variable are having **external linkage** ,main usage of extern varaible to link variable in other file so you are saying "**since it is a local variable, it isn't accessible outside of foo**" which is wrong, check the below code.
```
xyz@xyz-PC:~/s_flow/alec$ vi one.c
#include<stdio.h>
... |
47,271,177 | How to reduce to data scanned size for 'select' query in AWS athena. By scanning only one of the column.
Example:
SELECT \* FROM TABLE1 WHERE STATUS='Fail'; | 2017/11/13 | [
"https://Stackoverflow.com/questions/47271177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8654250/"
] | For starters this function definition and the variable declaration
```
int foo() {
^^^
extern i;
^^^^^^^^^
return i++;
}
```
are invalid because there is absent a parameter list and a type specifier for the variable `i`.
It should be written like
```
int foo( void ) {
^^^^
extern int i;... | **Extern** : extern variable are having **external linkage** ,main usage of extern varaible to link variable in other file so you are saying "**since it is a local variable, it isn't accessible outside of foo**" which is wrong, check the below code.
```
xyz@xyz-PC:~/s_flow/alec$ vi one.c
#include<stdio.h>
... |
24,576,055 | I generate my image `src` from databse field called [pictureName]. I want when Picture name is null or the name doesn't return image to display [image not found] picture.
Here is my aspx code to generate img:
```
<img src="WEBIMAGES/<%#Eval("BrandName")%>/<%# Eval("PictureName") %>" alt="" title="<%# Eval("ProductNam... | 2014/07/04 | [
"https://Stackoverflow.com/questions/24576055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2844833/"
] | You could use a coalesce on the picture name as follows:
```
<img src="WEBIMAGES/<%#Eval("BrandName")%>/<%# Eval("PictureName") ?? 'noImage.jpg' %>" alt="" title="<%# Eval("ProductName") %>">
``` | Replace your code like this
```
<img src="WEBIMAGES/<%#Eval("BrandName")%>/<%# string.IsNullOrEmpty(Eval("PictureName").ToString()) ? "noImage.jpg" : Eval("PictureName") %>" alt="" title="<%# Eval("ProductName") %>">
``` |
183,706 | In *The Last Jedi,* after the opening battle, the Resistance makes a jump to hyperspace. Shortly after exiting hyperspace (Spoilers follow),
>
> it is discovered that the First Order has somehow followed them, and another brief battle ensues. This results the *Raddus's* bridge being destroyed, with many of the highe... | 2018/03/17 | [
"https://scifi.stackexchange.com/questions/183706",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/45514/"
] | In the official novelisation it's explicitly stated that **she entered an airlock.** She then used the Force to close the outer door and the crew then opened the inner door.
>
> *Even as her senses dimmed, her body rose toward the gaping maw of the
> shattered bridge. **It slid through the wreckage and into the loc... | A related answer is [here](https://scifi.stackexchange.com/questions/82320/how-do-the-death-stars-retain-atmosphere-in-the-landing-bays). Most starship hangars in the films are open to vacuum, and covered by magnetic shields or force fields.
This isn't a definitive canon answer, but it seems reasonable to speculate th... |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | I'd actually *not* cross reference a new csv file, and instead do it like this:
```
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
my $last_timestamp;
my $interval = 600;
#read stdin line by line
while ( <> ) {
#extract date and time from this line.
my ( $date, $time, @fields ) = split /,/;... | here is the answer..
cat 1.csv 2.csv|sort -u -t, -k2,2 |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | Here's another Perl solution
It initialises `$date` to the date contained in the first line of the file, and a time of `00:00:00`
It then fills the `%values` hash with records using the value of `$date` as a key, incrementing the value by ten minutes until the day of month changes. These form the "default" values
Th... | here is the answer..
cat 1.csv 2.csv|sort -u -t, -k2,2 |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | I'd actually *not* cross reference a new csv file, and instead do it like this:
```
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
my $last_timestamp;
my $interval = 600;
#read stdin line by line
while ( <> ) {
#extract date and time from this line.
my ( $date, $time, @fields ) = split /,/;... | ...or a shell script:
```
#! /bin/bash
set -e
file=$1
today=$(head -1 $file | cut -d, -f1)
line=0
for (( h = 0 ; h < 24 ; h++ ))
do
for (( m = 0 ; m < 60 ; m += 10 ))
do
stamp=$(printf "%02d:%02d:00" $h $m)
if [ $line -eq 0 ]; then IFS=',' read date time data; fi
if [ "$time" = "$stamp" ]; then
... |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | I'd actually *not* cross reference a new csv file, and instead do it like this:
```
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
my $last_timestamp;
my $interval = 600;
#read stdin line by line
while ( <> ) {
#extract date and time from this line.
my ( $date, $time, @fields ) = split /,/;... | I would write it like this in Perl
This program expects the name of the input file as a parameter on the command line, and prints its output to STDOUT, which may be redirected as normal
```perl
use strict;
use warnings 'all';
use feature 'say';
use Time::Piece;
use Time::Seconds 'ONE_MINUTE';
my $format = '%Y-%m-%d... |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | Here's another Perl solution
It initialises `$date` to the date contained in the first line of the file, and a time of `00:00:00`
It then fills the `%values` hash with records using the value of `$date` as a key, incrementing the value by ten minutes until the day of month changes. These form the "default" values
Th... | ...or a shell script:
```
#! /bin/bash
set -e
file=$1
today=$(head -1 $file | cut -d, -f1)
line=0
for (( h = 0 ; h < 24 ; h++ ))
do
for (( m = 0 ; m < 60 ; m += 10 ))
do
stamp=$(printf "%02d:%02d:00" $h $m)
if [ $line -eq 0 ]; then IFS=',' read date time data; fi
if [ "$time" = "$stamp" ]; then
... |
35,860,916 | I am trying to access a database which is on a remote server. Database is fine as it works fine with php code, but when I try to add data in that database using android app, data doesn't insert in database.
I have basically followed following tutorials for this purpose
<https://www.youtube.com/watch?v=WgOSIEWOXbQ>
Th... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35860916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6032632/"
] | Here's another Perl solution
It initialises `$date` to the date contained in the first line of the file, and a time of `00:00:00`
It then fills the `%values` hash with records using the value of `$date` as a key, incrementing the value by ten minutes until the day of month changes. These form the "default" values
Th... | I would write it like this in Perl
This program expects the name of the input file as a parameter on the command line, and prints its output to STDOUT, which may be redirected as normal
```perl
use strict;
use warnings 'all';
use feature 'say';
use Time::Piece;
use Time::Seconds 'ONE_MINUTE';
my $format = '%Y-%m-%d... |
19,465,644 | I just want to save some gnuplot-generated data to a data file with help of the 'set table' command.
The data should be a vector and his length. The vector offset is calculated to any point of an input-file 'filed.dat'.
Printing the vector-data to the file is no problem. I do it this way:
```
splot 'field.dat' using... | 2013/10/19 | [
"https://Stackoverflow.com/questions/19465644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959116/"
] | This is not possible in gnuplot, because a maximum of six columns is written to the output file (for other plotting styles than `vectors` its less).
However, you could pipe the table output through e.g. `awk` to add this information:
```
set output '| awk ''{\
if (!match($1, "^#") && length()) {\
print $1, $2... | **Just as an update:**
gnuplot 5.0 introduced the plotting style `with table` (check `help with table`).
With this you can plot max. 14 columns to a file (or datablock).
So, basically you should be able to plot any string formatted via `sprintf()` and hence more than 14 columns to a file (check `help sprintf`),
however... |
49,596 | In Scandinavian countries such as Denmark and Sweden, their parliaments tend to be comprised of district seats (allocated based on vote count within the district) and levelling seats (allocated based on vote count nationwide).
It's not clear to me how they allocate **levelling seats** to political parties when they ar... | 2020/01/21 | [
"https://politics.stackexchange.com/questions/49596",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/28067/"
] | The system for using lists to fill the leveling seats (or "adjustment seats") varies per country. This answer summarises information from [this document (PDF)](https://www.venice.coe.int/webforms/documents/default.aspx?pdffile=CDL-PI(2015)006-bil) published by the European Committee for Democracy Through Law in 2015.
... | <https://en.wikipedia.org/wiki/Leveling_seat> seems to explain it
TLDR; is Denmark has 179 seats, 4 of those are for north atlantic representation, 2 faeroe island, and 2 for greenland. remaining 175 is then what your talking about. of those 135 are district seats, and 40 are leveling seats, or as you call them adjust... |
49,596 | In Scandinavian countries such as Denmark and Sweden, their parliaments tend to be comprised of district seats (allocated based on vote count within the district) and levelling seats (allocated based on vote count nationwide).
It's not clear to me how they allocate **levelling seats** to political parties when they ar... | 2020/01/21 | [
"https://politics.stackexchange.com/questions/49596",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/28067/"
] | The system for using lists to fill the leveling seats (or "adjustment seats") varies per country. This answer summarises information from [this document (PDF)](https://www.venice.coe.int/webforms/documents/default.aspx?pdffile=CDL-PI(2015)006-bil) published by the European Committee for Democracy Through Law in 2015.
... | 39 seats (349 in total) in the Swedish Riksdagen is utjämningsmandat (leveling seats)
It is an modified Sainte-Laguë method.
All parties can leave notifications of their candidates with valmyndigheten (state election administration) pre-election (locked/closed candidate lists.) If a party doesn't create these lists ... |
32,720,143 | I'm using ruby 2.1.5p273, Rails 4.2.3 but have upgraded from much older versions recently.
I'm getting a "ArgumentError: wrong number of arguments (1 for 0)" error on this line from the **Phone** model:
```
Phone.all(:joins => :phone_page, :conditions => [query, condition_values], :order => "date")
```
**query** ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3103686/"
] | The syntax changed in Rails 4. Now you are supposed to do as following:
```
Phone.joins(:phone_page).where(query, condition_values).order(:date)
``` | You should rewrite this query. One of the solutions is:
```
Phone.joins(:phone_page).where(query, condition_values).order('date')
```
Also take a look at ActiveRecord querying interface documentation here:
<http://guides.rubyonrails.org/active_record_querying.html> |
32,720,143 | I'm using ruby 2.1.5p273, Rails 4.2.3 but have upgraded from much older versions recently.
I'm getting a "ArgumentError: wrong number of arguments (1 for 0)" error on this line from the **Phone** model:
```
Phone.all(:joins => :phone_page, :conditions => [query, condition_values], :order => "date")
```
**query** ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3103686/"
] | The syntax changed in Rails 4. Now you are supposed to do as following:
```
Phone.joins(:phone_page).where(query, condition_values).order(:date)
``` | .all doesn't take arguments, see [here](https://github.com/rails/rails/blob/b1879124a82b34168412ac699cf6f654e005c4d6/activerecord/lib/active_record/scoping/named.rb#L24). Product.find(:all, your-arguments)
[See related question here](https://stackoverflow.com/questions/2333970/rails-activerecord-conditions) |
32,720,143 | I'm using ruby 2.1.5p273, Rails 4.2.3 but have upgraded from much older versions recently.
I'm getting a "ArgumentError: wrong number of arguments (1 for 0)" error on this line from the **Phone** model:
```
Phone.all(:joins => :phone_page, :conditions => [query, condition_values], :order => "date")
```
**query** ... | 2015/09/22 | [
"https://Stackoverflow.com/questions/32720143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3103686/"
] | .all doesn't take arguments, see [here](https://github.com/rails/rails/blob/b1879124a82b34168412ac699cf6f654e005c4d6/activerecord/lib/active_record/scoping/named.rb#L24). Product.find(:all, your-arguments)
[See related question here](https://stackoverflow.com/questions/2333970/rails-activerecord-conditions) | You should rewrite this query. One of the solutions is:
```
Phone.joins(:phone_page).where(query, condition_values).order('date')
```
Also take a look at ActiveRecord querying interface documentation here:
<http://guides.rubyonrails.org/active_record_querying.html> |
5,494,259 | I need jquery to change numbers in all of pages. for example i want change 1 to ۱ so i tried this way:
```
$("*").each(function(){
$(this).html( $(this).html().replace(1,"۱") );
})
```
but this will change css rules and attributes also. is there any trick to escape css and attributes? | 2011/03/31 | [
"https://Stackoverflow.com/questions/5494259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/678758/"
] | This isn't a job that jQuery naturally fits into. Instead of getting jQuery to fetch a flat list of all elements, recursively traverse through the DOM tree yourself, searching for **text nodes** to perform the replace on.
```
function recursiveReplace(node) {
if (node.nodeType === Node.TEXT_NODE) {
node.no... | Without seeing an actual example of your code it is hard to provide a good answer, but I will do my best.
Here is what I would do. I would wrap all of your page numbers in a tag with a particular ID, like this...
```
<span class="pageNumber">1</span>
...
<span class="pageNumber">n</span>
```
Then here is the jQuery... |
5,494,259 | I need jquery to change numbers in all of pages. for example i want change 1 to ۱ so i tried this way:
```
$("*").each(function(){
$(this).html( $(this).html().replace(1,"۱") );
})
```
but this will change css rules and attributes also. is there any trick to escape css and attributes? | 2011/03/31 | [
"https://Stackoverflow.com/questions/5494259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/678758/"
] | Try this:
```
$("body *").each(function() {
if ( this.childElementCount > 0 ) { return; }
$(this).text(function(i, v) { return v.replace('1','۱'); });
});
```
**Update:** doesn't work... | Without seeing an actual example of your code it is hard to provide a good answer, but I will do my best.
Here is what I would do. I would wrap all of your page numbers in a tag with a particular ID, like this...
```
<span class="pageNumber">1</span>
...
<span class="pageNumber">n</span>
```
Then here is the jQuery... |
5,494,259 | I need jquery to change numbers in all of pages. for example i want change 1 to ۱ so i tried this way:
```
$("*").each(function(){
$(this).html( $(this).html().replace(1,"۱") );
})
```
but this will change css rules and attributes also. is there any trick to escape css and attributes? | 2011/03/31 | [
"https://Stackoverflow.com/questions/5494259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/678758/"
] | This isn't a job that jQuery naturally fits into. Instead of getting jQuery to fetch a flat list of all elements, recursively traverse through the DOM tree yourself, searching for **text nodes** to perform the replace on.
```
function recursiveReplace(node) {
if (node.nodeType === Node.TEXT_NODE) {
node.no... | Try this:
```
$("body *").each(function() {
if ( this.childElementCount > 0 ) { return; }
$(this).text(function(i, v) { return v.replace('1','۱'); });
});
```
**Update:** doesn't work... |
48,948,678 | I have an OSGI service that has an @Activate method. In the activate method I call a method called 'buildTitleList' where I query some resources (pages) and gather their titles in a list. This code is working in a running environment but not in my unit tests.
I create the page in my context the following way:
```
aem... | 2018/02/23 | [
"https://Stackoverflow.com/questions/48948678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1725624/"
] | As CBroe noted, [this](http://php.net/manual/en/datetime.createfromformat.php#121431) is the right solution for you. You should use `Y-m-d\TH:i:s.uP` instead of `DateTime::RFC3339_EXTENDED`, which is `Y-m-d\TH:i:s.vP`:
```
$date = DateTime::createFromFormat("Y-m-d\TH:i:s.uP", "2018-02-23T11:29:16.434Z"); //works
```
... | Yes, apparently it only got fixed in PHP 7.3.0, see this <https://3v4l.org/4nMi4>
[](https://i.stack.imgur.com/O4UV1.png) |
25,116,174 | i want to run netgen in a command line in EIDORS Matlab but every time i come across this problem that matlab ask me for the path of the netgen. i receive this message every time.
'ng' is not recognized as an internal or external command,
operable program or batch file.
Netgen call failed. Is netgen installed and on... | 2014/08/04 | [
"https://Stackoverflow.com/questions/25116174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3905307/"
] | Install netgen first. Go here to download:
<http://sourceforge.net/projects/netgen-mesher/>
Go "Files" entry to download more variant version of netgen. Take note that EIDORS 3.6 is only compatible up to the latest version of netgen-5.0.
I am using Windows 7, 64-bit Operating System. Installation of netgen with x64 a... | You can place the `netgen.exe` path " `...\bin` " within the matlab toolbox:
[How to Set Path in Matlab](https://stackoverflow.com/questions/29193897/how-to-set-path-in-matlab)
thereby not needing to paste the path into EIDORS each time you run it in MATLAB.
Also downloading [EIDORS 3.8 with Netgen 5.3](http://www.s... |
56,875,130 | I'm trying to compare to matrices. When the values aren't equivalent then I want to use the value from `mat2` so long as it is greater than 0; if it is zero, then I want the value from `mat1`. As the code is currently, it appears to constantly return the value of `mat1`.
Here is my attempt:
```
mat.data1 <- c(1, 0, 1... | 2019/07/03 | [
"https://Stackoverflow.com/questions/56875130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11735666/"
] | You need to use another format from clipboard - `XML Spreadsheet`. The copied data is contained in special XML with its own structure and attributes. Let's take the following sheet's data:

As you see, every cell has some formatting. The XML for this data is the following:
```... | When I want to allow data copied from Excel into a custom windows app that I wrote, I use GetText() instead of GetData().
Dim ClipboardText As String = Nothing
```
ClipboardText = My.Computer.Clipboard.GetText()
```
If it is multiple cells that are copied to the Clipboard from Excel, they could be seperated by v... |
11,655 | Apparently Dijkstra wrote in an article in Datamation1 in 1977:
>
> It's very illuminating to think about the fact that some – at most four
> hundred – years ago, professors at European universities would tell the
> brilliant students that if they were very diligent, it was not
> impossible to learn how to do long... | 2020/04/12 | [
"https://hsm.stackexchange.com/questions/11655",
"https://hsm.stackexchange.com",
"https://hsm.stackexchange.com/users/6443/"
] | **TL;DR** Dijkstra basically got it right.
The primary means for computing with Roman numerals were the [abacus](https://en.wikipedia.org/wiki/Roman_abacus) and the reckoning board. The use of small pebbles in this manner of computation is the origin of our word [calculus](https://www.etymonline.com/search?q=calculus)... | There were at least two very different kinds of calculations performed in
medieval Europe: a) calculation with integers, for example in accounting, and
b) calculation with long fractional numbers in astronomy. Positional, sexagesimal system was invented in Babylon for astronomy and other theoretical purposes, and it w... |
67,283,333 | I am trying to create a static library using a shell script.
For creating the library I used following script:
```c
gcc -c -Wall -Wextra -Werror *.c
ar -cr libft.a *.o
```
There are 5 different functions in 5 .c files.
Now I wanted to test the library and created a main.c file with this content:
```c
#include "li... | 2021/04/27 | [
"https://Stackoverflow.com/questions/67283333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15125036/"
] | If you can't move the animated items outside the Vue mounting element, a workaround is to remove their animation in Vue's [`created` lifecycle hook](https://v2.vuejs.org/v2/api/#created):
```js
setTimeout(() => {
new Vue({
created() {
document.querySelector('.title').style.setProperty('animation-name', 'no... | Using templates
===============
Is better if you can use components for this case and add the title with templates.
HTML:
```
<body>
<div id="app"></div>
</body>
```
JS:
```
setTimeout(() => {
new Vue({
el: "#app",
template: "<h1 class='show'>Type Something.</h1>",
});
}, 3000);
```
CSS:
```
@key... |
172,594 | I was reading about ***tensor product*** of graphs. We know that if we take tensor product of *n* graphs and want this product to be a connected graph then at most one graph should be bipartite. In the book ***Handbook of Product graphs***, its written that if we have *k* number of bipartite graphs then the number of c... | 2014/06/25 | [
"https://mathoverflow.net/questions/172594",
"https://mathoverflow.net",
"https://mathoverflow.net/users/37759/"
] | The adjacency matrix of a bipartite graph $G$ can be partitioned into $2\times 2$ blocks with the diagonal blocks zero. Let $B(G)$ be the upper right block. Let $H$ be another bipartite graph; define $B(H)$ similarly. Then the tensor product $G\otimes H$ consists of two bipartite components $X$ and $Y$, where $B(X)=B(G... | To generalize: Let $G\_0 \ldots$ be general graphs. Separate each graph into its connected components. Since tensor product distributes over disjoint union, it suffices to consider the case where every $G\_i$ is connected.
Connected graphs fall into three cases: (1) the trivial graph (one vertex, no edges), (2) non-tr... |
172,594 | I was reading about ***tensor product*** of graphs. We know that if we take tensor product of *n* graphs and want this product to be a connected graph then at most one graph should be bipartite. In the book ***Handbook of Product graphs***, its written that if we have *k* number of bipartite graphs then the number of c... | 2014/06/25 | [
"https://mathoverflow.net/questions/172594",
"https://mathoverflow.net",
"https://mathoverflow.net/users/37759/"
] | The adjacency matrix of a bipartite graph $G$ can be partitioned into $2\times 2$ blocks with the diagonal blocks zero. Let $B(G)$ be the upper right block. Let $H$ be another bipartite graph; define $B(H)$ similarly. Then the tensor product $G\otimes H$ consists of two bipartite components $X$ and $Y$, where $B(X)=B(G... | Here's an alternative approach, which might allow using machinery from linear algebra. It's based on the sort of analysis used on Markov chains, and various details may well be wrong. The key idea is that the spectrum (multiset of eigenvalues) of the tensor product of two matrices is the multiset of pairwise products o... |
172,594 | I was reading about ***tensor product*** of graphs. We know that if we take tensor product of *n* graphs and want this product to be a connected graph then at most one graph should be bipartite. In the book ***Handbook of Product graphs***, its written that if we have *k* number of bipartite graphs then the number of c... | 2014/06/25 | [
"https://mathoverflow.net/questions/172594",
"https://mathoverflow.net",
"https://mathoverflow.net/users/37759/"
] | Call the factor graphs $G\_0$, $G\_1$, etc. A vertex in the tensor product $P$ corresponds to a sequence $(g\_0, g\_1, g\_2, \ldots)$, with $g\_n\in G\_n$. Since each $G\_n$ is bipartite, its vertices can be divided into two sets $L\_n$ and $R\_n$, and all edges of $G\_n$ are between vertices in $L\_n$ and $R\_n$. Thus... | To generalize: Let $G\_0 \ldots$ be general graphs. Separate each graph into its connected components. Since tensor product distributes over disjoint union, it suffices to consider the case where every $G\_i$ is connected.
Connected graphs fall into three cases: (1) the trivial graph (one vertex, no edges), (2) non-tr... |
172,594 | I was reading about ***tensor product*** of graphs. We know that if we take tensor product of *n* graphs and want this product to be a connected graph then at most one graph should be bipartite. In the book ***Handbook of Product graphs***, its written that if we have *k* number of bipartite graphs then the number of c... | 2014/06/25 | [
"https://mathoverflow.net/questions/172594",
"https://mathoverflow.net",
"https://mathoverflow.net/users/37759/"
] | Call the factor graphs $G\_0$, $G\_1$, etc. A vertex in the tensor product $P$ corresponds to a sequence $(g\_0, g\_1, g\_2, \ldots)$, with $g\_n\in G\_n$. Since each $G\_n$ is bipartite, its vertices can be divided into two sets $L\_n$ and $R\_n$, and all edges of $G\_n$ are between vertices in $L\_n$ and $R\_n$. Thus... | Here's an alternative approach, which might allow using machinery from linear algebra. It's based on the sort of analysis used on Markov chains, and various details may well be wrong. The key idea is that the spectrum (multiset of eigenvalues) of the tensor product of two matrices is the multiset of pairwise products o... |
44,426,898 | How could I select a variable with an input and than change its value,
this is the best that I could come up with but it doesn't seem to work.
```
itm1 = 1
itm2 = 1
x = raw_input()
x += 1
print (itm1)
```
I'm trying to get it so that anyone of the variables could be changed depending on the input. | 2017/06/08 | [
"https://Stackoverflow.com/questions/44426898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8129076/"
] | What do you want to do exactly?
If you want to add the input value to an existing variable you can just do this:
```
itm1 = 1
itm2 = 1
x = raw_input()
itm1 += x
print (itm1)
```
Your question is unclear regarding the aim.
If you want to select one variable to change depending on the input, you can try this:
```
it... | You could use 'exec'. This takes variable name through raw\_input and executes "variable += 1"
```
itm1 = 1
itm2 = 1
exec(raw_input()+'+=1')
print(itm1)
```
But this isn't the best method. Use dictionaries or lists instead |
44,426,898 | How could I select a variable with an input and than change its value,
this is the best that I could come up with but it doesn't seem to work.
```
itm1 = 1
itm2 = 1
x = raw_input()
x += 1
print (itm1)
```
I'm trying to get it so that anyone of the variables could be changed depending on the input. | 2017/06/08 | [
"https://Stackoverflow.com/questions/44426898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8129076/"
] | It's possible, but you really shouldn't do that in most cases. Nicer way is to store the parameters in a dictionary and do something like:
```
d = {
'itm1': 1,
'itm2': 1,
}
x = raw_input()
d[x] += 1
print (d['itm1'])
```
If you really need to change the local variables and have a good reason not to rewrite it to... | What do you want to do exactly?
If you want to add the input value to an existing variable you can just do this:
```
itm1 = 1
itm2 = 1
x = raw_input()
itm1 += x
print (itm1)
```
Your question is unclear regarding the aim.
If you want to select one variable to change depending on the input, you can try this:
```
it... |
44,426,898 | How could I select a variable with an input and than change its value,
this is the best that I could come up with but it doesn't seem to work.
```
itm1 = 1
itm2 = 1
x = raw_input()
x += 1
print (itm1)
```
I'm trying to get it so that anyone of the variables could be changed depending on the input. | 2017/06/08 | [
"https://Stackoverflow.com/questions/44426898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8129076/"
] | It's possible, but you really shouldn't do that in most cases. Nicer way is to store the parameters in a dictionary and do something like:
```
d = {
'itm1': 1,
'itm2': 1,
}
x = raw_input()
d[x] += 1
print (d['itm1'])
```
If you really need to change the local variables and have a good reason not to rewrite it to... | You could use 'exec'. This takes variable name through raw\_input and executes "variable += 1"
```
itm1 = 1
itm2 = 1
exec(raw_input()+'+=1')
print(itm1)
```
But this isn't the best method. Use dictionaries or lists instead |
10,036,844 | I'm trying to get a GUI with a UITabBar and UITableViews set up.
I've got a UITabView that is programmatically created.
One of the Tabs displays a UITableView that is also programmatically created.
This UITableView then displays other views when didSelectRowAtIndexPath is called.
Unfortunately, when a table cell is ... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10036844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1058199/"
] | You should use a UITabBarController to display the UITabBar rather than doing it directly.
Then use a UITableViewController as the view controller for a given tab. Though I get the impression that you want to present descendent UITableViews when a row is selected. If this is the case, you ought to use a UINavigationCo... | Use UITabBarController instead of UITabBar. |
30,982,245 | I am working on a C# project that is pulling data from `SQL Server`, `ODBC data-sources` and `Oracle Databases` at different times.
At this point, I have created 3 different classes - Once for each type of DB access. However, I am seeing that 95% of the code is identical between each of the libraries - The main differ... | 2015/06/22 | [
"https://Stackoverflow.com/questions/30982245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693085/"
] | The key here is to step back and think about the problem from another angle. You are duplicating lots of code because you are creating instances of the database and command classes within the method. So inject them instead:
```
public class SomeDBClass
{
static DataTable exec_DT(DBConnection conn, DBCommand cmd)
... | I like [David's answer](https://stackoverflow.com/a/30982431/15498). In the alternative, if you do still want to be creating connections and commands from within your shared code, what you could do is pass a [`DbProviderFactory`](https://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory(v=vs.110).as... |
30,982,245 | I am working on a C# project that is pulling data from `SQL Server`, `ODBC data-sources` and `Oracle Databases` at different times.
At this point, I have created 3 different classes - Once for each type of DB access. However, I am seeing that 95% of the code is identical between each of the libraries - The main differ... | 2015/06/22 | [
"https://Stackoverflow.com/questions/30982245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693085/"
] | The key here is to step back and think about the problem from another angle. You are duplicating lots of code because you are creating instances of the database and command classes within the method. So inject them instead:
```
public class SomeDBClass
{
static DataTable exec_DT(DBConnection conn, DBCommand cmd)
... | The [`DbProviderFactory`](https://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory(v=vs.110).aspx) class does exactly what you're looking for.
```
static DataTable exec_DT(string query, string conn_str)
{
DataTable retVal = new DataTable();
using (DbConnection conn = MyDbProvider.CreateC... |
30,982,245 | I am working on a C# project that is pulling data from `SQL Server`, `ODBC data-sources` and `Oracle Databases` at different times.
At this point, I have created 3 different classes - Once for each type of DB access. However, I am seeing that 95% of the code is identical between each of the libraries - The main differ... | 2015/06/22 | [
"https://Stackoverflow.com/questions/30982245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693085/"
] | I like [David's answer](https://stackoverflow.com/a/30982431/15498). In the alternative, if you do still want to be creating connections and commands from within your shared code, what you could do is pass a [`DbProviderFactory`](https://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory(v=vs.110).as... | The [`DbProviderFactory`](https://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory(v=vs.110).aspx) class does exactly what you're looking for.
```
static DataTable exec_DT(string query, string conn_str)
{
DataTable retVal = new DataTable();
using (DbConnection conn = MyDbProvider.CreateC... |
19,725,506 | In my backbone+marionette application I have used morris.js Line Chart.
This chart takes an array of data from the model. And must be created after DOM creating (DOM dependent).
Сode to create the chart:
```
_createChartData: function () {
var trends = this.model.get("trends"),
chartData = [];
$.each... | 2013/11/01 | [
"https://Stackoverflow.com/questions/19725506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2944449/"
] | It seems like you're creating the chart when the element it uses isn't in the DOM yet. Try creating the chart in the view's `onShow` function:
```
var PromoView = Marionette.ItemView.extend({
// code...
onShow: function(){
// create chart here
}
});
``` | onDomRefresh function in the view could be what you are looking for. |
59,749,538 | I have a table 1:
```
CREATE TABLE table1
INSERT INTO table1 values('XYZ')
INSERT INTO table1 values('ABC')
INSERT INTO table1 values('XYZ~ABC~AAA')
INSERT INTO table1 values('123')
```
Then, I have string 'ABC~XYZ~123'. I need to split this string into each word by using SQL:
```
Select VALUE FROM STRING_SPLIT('AB... | 2020/01/15 | [
"https://Stackoverflow.com/questions/59749538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10062336/"
] | If I understand your case correctly, the next statement may help:
Text and table:
```
DECLARE @text varchar(100) = 'ABC~XYZ~123'
CREATE TABLE Data (
Id int,
[Text] varchar(100)
)
INSERT INTO Data
(Id, [Text])
VALUES
(1, 'XYZ'),
(2, 'ABC'),
(3, 'XYZ~ABC~AAA'),
(4, '123~ABC')
```
Statement:
```
... | Apart from the suggestions as in comment you can use [Count()](https://www.sqlservertutorial.net/sql-server-aggregate-functions/sql-server-count/) function as below. But storing in this format will give you difficulty for the extraction as well as in join with the other tables.
```
Select T1Value, Count(*) as [NoCount... |
59,749,538 | I have a table 1:
```
CREATE TABLE table1
INSERT INTO table1 values('XYZ')
INSERT INTO table1 values('ABC')
INSERT INTO table1 values('XYZ~ABC~AAA')
INSERT INTO table1 values('123')
```
Then, I have string 'ABC~XYZ~123'. I need to split this string into each word by using SQL:
```
Select VALUE FROM STRING_SPLIT('AB... | 2020/01/15 | [
"https://Stackoverflow.com/questions/59749538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10062336/"
] | If I understand your case correctly, the next statement may help:
Text and table:
```
DECLARE @text varchar(100) = 'ABC~XYZ~123'
CREATE TABLE Data (
Id int,
[Text] varchar(100)
)
INSERT INTO Data
(Id, [Text])
VALUES
(1, 'XYZ'),
(2, 'ABC'),
(3, 'XYZ~ABC~AAA'),
(4, '123~ABC')
```
Statement:
```
... | Setup
```
create table STRINGS (ID int, STRINGS varchar(max));
insert into STRINGS (ID, STRINGS) values (1, 'XYZ');
insert into STRINGS (ID, STRINGS) values (1, 'ABC');
insert into STRINGS (ID, STRINGS) values (1, 'XYZ~ABC~AAA');
insert into STRINGS (ID, STRINGS) values (1, '123~ABC');
declare @VALUES varchar(max) =... |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | I think you are referring to a common technique used in poetry to create a musical effect: [rhyme](http://www.thefreedictionary.com/rhyming)
>
> * Correspondence of terminal sounds of words or of lines of verse.
> * A word that corresponds with another in terminal sound, as fold and cold.
>
>
>
(TFD) | I think you are thinking, "homonym" |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | It's called a slant rhyme, or oblique rhyme. | I think you are thinking, "homonym" |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | Words that have only one phonological difference between them are called [**minimal pairs**](http://en.wikipedia.org/wiki/Minimal_pair). | I think you are thinking, "homonym" |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | It's called a slant rhyme, or oblique rhyme. | I think you are referring to a common technique used in poetry to create a musical effect: [rhyme](http://www.thefreedictionary.com/rhyming)
>
> * Correspondence of terminal sounds of words or of lines of verse.
> * A word that corresponds with another in terminal sound, as fold and cold.
>
>
>
(TFD) |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | I think you are referring to a common technique used in poetry to create a musical effect: [rhyme](http://www.thefreedictionary.com/rhyming)
>
> * Correspondence of terminal sounds of words or of lines of verse.
> * A word that corresponds with another in terminal sound, as fold and cold.
>
>
>
(TFD) | It should be a homophone or a heterograph.
**Homophone**: words with different meaning; same or different spelling; same pronunciation
**Heterograph**: words with different meaning; different spelling; same pronunciation
Check: <http://en.wikipedia.org/wiki/Homophone> |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | It's called a slant rhyme, or oblique rhyme. | It should be a homophone or a heterograph.
**Homophone**: words with different meaning; same or different spelling; same pronunciation
**Heterograph**: words with different meaning; different spelling; same pronunciation
Check: <http://en.wikipedia.org/wiki/Homophone> |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | It's called a slant rhyme, or oblique rhyme. | Words that have only one phonological difference between them are called [**minimal pairs**](http://en.wikipedia.org/wiki/Minimal_pair). |
236,845 | What is the term for the relationship between two words when they have similar but not identical pronunciation? For example the words "cheat" and "sheet", "core" and "sour", "think" and "thank", "tough" and "cuff" sound very similar. I am not talking in the context of poetry but to clarify these words may be used in po... | 2015/04/01 | [
"https://english.stackexchange.com/questions/236845",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/115618/"
] | Words that have only one phonological difference between them are called [**minimal pairs**](http://en.wikipedia.org/wiki/Minimal_pair). | It should be a homophone or a heterograph.
**Homophone**: words with different meaning; same or different spelling; same pronunciation
**Heterograph**: words with different meaning; different spelling; same pronunciation
Check: <http://en.wikipedia.org/wiki/Homophone> |
21,205,213 | First of all I have two different implementation that I believe are correct, and have profiled them and thinking they are about of the same performance:
```
depth::Tree a -> Int
depth Empty = 0
depth (Branch b l r) = 1 + max (depth l) (depth r)
depthTailRec::Tree a -> Int
depthTailRec = depthTR 0 where
... | 2014/01/18 | [
"https://Stackoverflow.com/questions/21205213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1370639/"
] | 1. Why isn't your function tail recursive?
------------------------------------------
For a recursive function to be tail recursive, all the recursive calls must be in *tail position*. A function is in tail position if it is the last thing to be called before the function returns. In your first example you have
```
d... | A partially tail recursive version would be this:
```
depth d Empty = d
depth d (Branch _ l Empty) = depth (d+1) l
depth d (Branch _ Empty r) = depth (d+1) r
depth d (Branch _ l r) = max (depth (d+1) l) (depth (d+1) r)
```
Note that tail rescursion in this case (as opposed to the more complex full case in Chris'... |
21,205,213 | First of all I have two different implementation that I believe are correct, and have profiled them and thinking they are about of the same performance:
```
depth::Tree a -> Int
depth Empty = 0
depth (Branch b l r) = 1 + max (depth l) (depth r)
depthTailRec::Tree a -> Int
depthTailRec = depthTR 0 where
... | 2014/01/18 | [
"https://Stackoverflow.com/questions/21205213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1370639/"
] | 1. Why isn't your function tail recursive?
------------------------------------------
For a recursive function to be tail recursive, all the recursive calls must be in *tail position*. A function is in tail position if it is the last thing to be called before the function returns. In your first example you have
```
d... | to your 3., yes, e.g. by use of CPS technique (as shown in Chris's answer);
to your 4., correct.
to your 2., with [lazy corecursive breadth-first tree traversal](http://en.wikipedia.org/wiki/Corecursion#Discussion) we naturally get a solution similar to Chris's last (i.e. his #5., depth-first traversal with explica... |
21,205,213 | First of all I have two different implementation that I believe are correct, and have profiled them and thinking they are about of the same performance:
```
depth::Tree a -> Int
depth Empty = 0
depth (Branch b l r) = 1 + max (depth l) (depth r)
depthTailRec::Tree a -> Int
depthTailRec = depthTR 0 where
... | 2014/01/18 | [
"https://Stackoverflow.com/questions/21205213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1370639/"
] | A partially tail recursive version would be this:
```
depth d Empty = d
depth d (Branch _ l Empty) = depth (d+1) l
depth d (Branch _ Empty r) = depth (d+1) r
depth d (Branch _ l r) = max (depth (d+1) l) (depth (d+1) r)
```
Note that tail rescursion in this case (as opposed to the more complex full case in Chris'... | to your 3., yes, e.g. by use of CPS technique (as shown in Chris's answer);
to your 4., correct.
to your 2., with [lazy corecursive breadth-first tree traversal](http://en.wikipedia.org/wiki/Corecursion#Discussion) we naturally get a solution similar to Chris's last (i.e. his #5., depth-first traversal with explica... |
1,338,764 | When I try to I get this:
```
# systemctl enable systemd-timesyncd.service
Failed to enable unit: Unit file systemd-timesyncd.service does not exist.
```
NTP is installed:
```
# apt-get install ntp
Reading package lists... Done
Building dependency tree
Reading state information... Done
ntp is already the new... | 2021/05/16 | [
"https://askubuntu.com/questions/1338764",
"https://askubuntu.com",
"https://askubuntu.com/users/966205/"
] | As @Christian Ehrhard wrote. I installed "systemd-timesyncd" and set a local NTP server as target. After restarting the service it worked just fine.
```
sudo apt install systemd-timesyncd
sudo nano /etc/systemd/timesyncd.conf
```
set
NTP=<IP\_of\_your\_NTP\_Server>
```
systemctl restart systemd-timesyncd
```
res... | unfortunately by "installing NTP" you did effectively remove `systemd-timesyncd`. I can understand that it can fly by too fast on an install/upgrade to notice - but those are mutually exclusive.
This is due to the fact that there can only be one NTP service reasonable working on a system.
So you could either `$ apt in... |
31,210,790 | I am trying to index documents to be searchable on their tag array.
```
CREATE INDEX doc_search_idx ON documents
USING gin(
to_tsvector('english', array_to_string(tags, ' ')) ||
to_tsvector('english', coalesce(notes, '')))
)
```
Where `tags` is a `(ci)text[]`. However, PG will refuse to index `array_t... | 2015/07/03 | [
"https://Stackoverflow.com/questions/31210790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/720164/"
] | In my initial answer I suggested a plain cast to text: `tags::text`. However, while most casts to text from basic types are defined `IMMUTABLE`, this it is not the case for array types. Obviously because ([quoting Tom Lane in a post to pgsql-general](https://www.postgresql.org/message-id/27130.1323443398@sss.pgh.pa.us)... | Here's my naive solution, to wrap it and call it immutable, as suspected.
```
CREATE FUNCTION immutable_array_to_string(arr ANYARRAY, sep TEXT)
RETURNS text
AS $$
SELECT array_to_string(arr, sep);
$$
LANGUAGE SQL
IMMUTABLE
;
``` |
13,242,974 | I'd like to write to a text file, skipping the first line, but otherwise writing over everything else. I have an array that I'm reading from the file into, and using it to store and manipulate data if the data in the text file needs to be corrected, then I want to immediately write back the data. the original text file... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13242974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1144431/"
] | Thanks to @Bryan Oakley's major hint, I have come up with this working code.
(Update: threw a few years of programming experience and some recent readers' sharp eyes at improving the code.)
```
from __future__ import print_function
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
class Dat... | I have discovered a very simple solution. I hope someone can find it useful.
```py
self.entry1=tk.Entry(self)
self.entry1.insert(END, " / / ")
self.entry1.config(fg="grey")
def datemask(self, event):
if len(self.entry1.get()) is 2:
self.entry1.insert(END,"/")
elif len(self.entry1.get()) is 5:
se... |
499,361 | I need to type only half triangular part of a chessboard with different coloring setting and label the rows and columns not by a,b,...;1,2,... but by other letters. More explicitly, I need to type something like the following figure but I couldn't find anyway to do this with any package. Are there any simple way to do ... | 2019/07/10 | [
"https://tex.stackexchange.com/questions/499361",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/192536/"
] | You can start from following code:
```
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix, positioning}
\begin{document}
\begin{tikzpicture}
\matrix (A) [matrix of nodes,
nodes={draw, fill, minimum size=9mm}]
{~&~&~&~&|[fill=white]|~&|[fill=white]|~&|[fill=white]|~\\
&~&~&~&|[fill=white]|... | Just for fun, an alternative that fills the entries programmatically.
```
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of nodes,nodes in empty cells,column sep=-\pgflinewidth,row
sep=-3*\pgflinewidth,nodes={align=center,minimum width=4em,min... |
40,611,478 | I would like to ask you if it is possible to secure a server with AI/machine learning based on the following concepts:
1) the server is implemented in a way to recognize a normal behavior(authorized access, modification, ...) .
2) the server must recognize any abnormal behavior and adapt to it if encountered.
3) if ... | 2016/11/15 | [
"https://Stackoverflow.com/questions/40611478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7162175/"
] | You are really close. You just have to escape the quotes that you want to use.
e.g. `WHERE Failo_vardas=\"$pavadinimas\"` | You have to leave the single quoting or your variable won't be evaluated.
So insert a single quote after the double quote, put your variable to evaluate, and re-insert a quote after your variable. Where the single-quoting ends, your env. variable will be evaluated instead of being treated literally.
Demo:
```
$ pava... |
10,427,047 | this layout:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<TextView
android:id="@+id/main_tv"
android:layo... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10427047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1143354/"
] | Possibly because there is other code in between that will trigger the event, and they don't want `eventHandler` to act on it. IMHO this isn't the best way to do things, but it's easy and it works.
If there is *no* other code in between there cannot possibly be a reason to remove and add the same event handler again. | I can explain this in a simple screnerio.
Imagine you have a "button1"
And you added the event on the run-time.
But once this button is clicked. The process behind it take let say "3Mins" to complete.
And you don't want the user to click this button again.
So you can do by Unwiring it in the first time.
So that the... |
10,427,047 | this layout:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<TextView
android:id="@+id/main_tv"
android:layo... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10427047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1143354/"
] | Possibly because there is other code in between that will trigger the event, and they don't want `eventHandler` to act on it. IMHO this isn't the best way to do things, but it's easy and it works.
If there is *no* other code in between there cannot possibly be a reason to remove and add the same event handler again. | If you call code that wires an event, and you don't wont to accidentally wire it up again if it was already wired, you can unwire, and then rewire it. This is the code sample above.
If it wasn't already wired in the first place, no error is thrown. But if the code had already been run first, you don't wont the event t... |
10,427,047 | this layout:
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<TextView
android:id="@+id/main_tv"
android:layo... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10427047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1143354/"
] | I can explain this in a simple screnerio.
Imagine you have a "button1"
And you added the event on the run-time.
But once this button is clicked. The process behind it take let say "3Mins" to complete.
And you don't want the user to click this button again.
So you can do by Unwiring it in the first time.
So that the... | If you call code that wires an event, and you don't wont to accidentally wire it up again if it was already wired, you can unwire, and then rewire it. This is the code sample above.
If it wasn't already wired in the first place, no error is thrown. But if the code had already been run first, you don't wont the event t... |
89,557 | I’m a 17 year old private pilot, and my friend and his girlfriend who are also 17 want to fly with me. It’s not clear whether they are asking their parents permission. If their parents didn’t want them to go and find out, would I, the pilot, get in trouble? Are there any regulations regarding this subject? Should I get... | 2021/10/06 | [
"https://aviation.stackexchange.com/questions/89557",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/54739/"
] | There’s no FAA regulation requiring that. That being said, if your passengers are minors, their parents have the ultimate say as to what they can and cannot do. It would be wise to make sure that your friends have permission from their parents for the activity prior to taking them as passengers. | If you are asking about *FAA regulations*, the answer is "no, there are no regulations on this subject". I've been involved in *EAA Young Eagle Rides*, *CAP glider encampments*, etc, and if there had been any FAA regulations bearing on a requirement for obtaining parental permission before giving young people rides in ... |
89,557 | I’m a 17 year old private pilot, and my friend and his girlfriend who are also 17 want to fly with me. It’s not clear whether they are asking their parents permission. If their parents didn’t want them to go and find out, would I, the pilot, get in trouble? Are there any regulations regarding this subject? Should I get... | 2021/10/06 | [
"https://aviation.stackexchange.com/questions/89557",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/54739/"
] | If you are asking about *FAA regulations*, the answer is "no, there are no regulations on this subject". I've been involved in *EAA Young Eagle Rides*, *CAP glider encampments*, etc, and if there had been any FAA regulations bearing on a requirement for obtaining parental permission before giving young people rides in ... | You don't need their parents explicit consent anymore then you would to give them a lift in your car, but you do need to ensure you are legally covered. As PiC you have legal responsibilities and liabilities so before you can take on the risks associated with carrying passengers you should check with whomever would be ... |
89,557 | I’m a 17 year old private pilot, and my friend and his girlfriend who are also 17 want to fly with me. It’s not clear whether they are asking their parents permission. If their parents didn’t want them to go and find out, would I, the pilot, get in trouble? Are there any regulations regarding this subject? Should I get... | 2021/10/06 | [
"https://aviation.stackexchange.com/questions/89557",
"https://aviation.stackexchange.com",
"https://aviation.stackexchange.com/users/54739/"
] | There’s no FAA regulation requiring that. That being said, if your passengers are minors, their parents have the ultimate say as to what they can and cannot do. It would be wise to make sure that your friends have permission from their parents for the activity prior to taking them as passengers. | You don't need their parents explicit consent anymore then you would to give them a lift in your car, but you do need to ensure you are legally covered. As PiC you have legal responsibilities and liabilities so before you can take on the risks associated with carrying passengers you should check with whomever would be ... |
8,724,119 | I'm responsible for delivering pages to display primary results for the US elections State by State. Each page needs a banner with an image of the State, approx 250px by 250px. Now all I need to do is figure out how to serve / generate those images...
1. I've dug into the docs / examples for [Protovis](http://mbostock... | 2012/01/04 | [
"https://Stackoverflow.com/questions/8724119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/526133/"
] | `s.charAt(i + 1)` in `!Character.isWhitespace(s.charAt(i + 1))`
It fails when `i == s.length() - 1`
You might want to use `s.replaceAll("\\s\\s+"," ")` instead of reinventing the wheel. | You are using this statement
```
Character.isWhitespace(s.charAt(i + 1)
```
meaning you are accessing an character of your string length plus 1. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.