qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
18,215,486 | I am executing a python script on one server and needing to read the contents of the passwd file from a remote machine. Does anyone know of a way to do this? Normally I would do:
```
import pwd
pwlist = pwd.getpwall()
#perform operations
```
This only works for the current system of course, and I'm needing a way to ... | 2013/08/13 | [
"https://Stackoverflow.com/questions/18215486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2336976/"
] | I had the same problem, solved it by using:
```
modal:true,
```
instead of:
```
closeOnContentClick: false,
``` | I solved the problem removing HTML and BODY tags in result.php. |
7,569,354 | I'm having two property file called sample.properties and sample1.properties in src folder at same level.
It is having some information like,
```
A1 = please call {sample1:name}
```
Here,
sample1 -> property file name
name -> key defined in sample1 like [name = abc]
I want to call sample1 property file , get value... | 2011/09/27 | [
"https://Stackoverflow.com/questions/7569354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533326/"
] | Yes. The `<!doctype>` is used as rendering mode switch. This is notable especially in Internet Explorer, because this browser maintains (almost) full backwards compatibility in quirks mode, so there's no `getElementsByClassName`, Element Traversal, `addEventListener`, Selection API, ES5 support and many many other thin... | Not exactly, but there are some differences in DOM support between standards and quirks mode. (e.g. in standards mode the browser does not brokenly support name as id). |
37,319,400 | I have this jQuery Code:
```
$('#select-adults-room-1').change( function () {
og.removeErrorsOcio();
});
$('#select-kids-room-1').change( function () {
og.removeErrorsOcio();
});
```
What is the best way to do it? I know this looks weird, but not sure how to improve it if it's possible.
I'm looking for some like... | 2016/05/19 | [
"https://Stackoverflow.com/questions/37319400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3086998/"
] | You don't need to pass separate strings, place the comma between the selectors in a single string, like this:
```
$('#select-adults-room-1, #select-kids-room-1').change(function() {
og.removeErrorsOcio();
});
```
Also note that you can pass the reference of the function directly to the `change()` method, like th... | Tried to give common class to each element as
```
$('.your-element').change( function () {
og.removeErrorsOcio();
});
``` |
58,653,552 | Need to check the string has only digits. `any` is the only letter expects to be True
Psuedo Code
```
import re
test = '''123,456'''
bool(re.search('[\d+]', test))
```
Out
```
True
```
Below is one more string expects to True
```
test = '''123,456,any''' #any is the only string expects as True
```
Below are ... | 2019/11/01 | [
"https://Stackoverflow.com/questions/58653552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There is a re-authenticate method. You just need to obtain the user's password for calling the method.
```
FirebaseUser user = await FirebaseAuth.instance.currentUser();
AuthResult authResult = await user.reauthenticateWithCredential(
EmailAuthProvider.getCredential(
email: user.email,
password: password,
... | When you want to change sensitive informations on Firebase you need to re-authenticate first to your account using your current credentials then you can update it.
Currently flutter has no reAuthenticate method for Firebase so you need to call **signInWithEmailAndPassword** or any other signIn method. |
4,547,570 | I'm working on a terminal parser for a calculator written in C.
I cannot figure out how to concatenate all of the numbers that are in between operators to put them into an array.
For example, if the input (command line argument) was "`4+342`",
it would ideally be `input[] = {"4", "+", "342"}`.
Here's my code so far... | 2010/12/28 | [
"https://Stackoverflow.com/questions/4547570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472974/"
] | strsep is a good choice here - grab the token and then decide what you want to do with it...
char \*string = "(3+(5+6)/8)"
char *token;
while ((token = strsep(&string, "(+/*) "))) {
// Store token... if it's not a ( or ) or space
}
Here - token will be processed similar to a Split() in Java/C#. This does mutilate t... | Sounds like you want to look at the standard `strtok` function. |
205,663 | In *Avengers: Infinity War* (2018), Ebony Maw says to Doctor Strange, who wears necklace with Time Stone on it:
>
> In all the time I've served Thanos...I have never failed him. If I
> were to reach our rendezvous on Titan...with the Time Stone still
> attached to your vaguely irritating **person**... there would ... | 2019/02/19 | [
"https://scifi.stackexchange.com/questions/205663",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/111636/"
] | As per [Oxford dictionary](https://en.oxforddictionaries.com/definition/person), "Person" can refer to:
>
> A human being regarded as an individual.
>
>
> An individual characterized by a preference or liking for a specified thing.
>
>
> An individual's body.
>
>
>
Thus, that is **simply his manner of speech*... | **Ebony Maw is an orator. The "person" he is referring to is no less than the body of Doctor Strange. His language is unnecessarily ornate describing Doctor Strange as if he was a non-entity.**
The translation would be: "If I were to return to Thanos with the Time Stone still on your body, not available for his immedi... |
269,771 | Whats a good word to describe someone who isn't easily fooled or isn't gullible? | 2015/08/28 | [
"https://english.stackexchange.com/questions/269771",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/135719/"
] | Perhaps you can use *[shrewd](http://www.collinsdictionary.com/dictionary/english/shrewd)* or *[astute](http://www.collinsdictionary.com/dictionary/english/astute)*. *[Wary](http://www.collinsdictionary.com/dictionary/english/wary?showCookiePolicy=true)* may be also a good fit. | In the US, we call a person who is quick to "see through" others, ***"street-smart"***. While the expression can be used in other ways, it is often a way to describe someone who is not easily deceived. |
26,404,308 | How to compare only Date without Time in DateTime types in C#.One of the date will be nullable.How can i do that?? | 2014/10/16 | [
"https://Stackoverflow.com/questions/26404308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1559854/"
] | You can use the `Date` property of `DateTime` object
```
Datetime x;
Datetime? y;
if (y != null && y.HasValue && x.Date == y.Value.Date)
{
//DoSomething
}
``` | You could create a method like the one below, following the similar return values as the .net framework comparisons, giving -1 when the left side is smallest, 0 for equal dates, and +1 for right side smallest:
```
private static int Compare(DateTime? firstDate, DateTime? secondDate)
{
if(!firstDate.Ha... |
490,608 | >
> Life is not black and white. There seldom is a definitive right or wrong. We need to learn to **live in the gray**. We need to consider and take aspects from each side in order to make practical life choices.
>
>
>
What's another expression or idiom for telling someone to **"live in the gray"**? Preferably one... | 2019/03/20 | [
"https://english.stackexchange.com/questions/490608",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/340903/"
] | When people are said to be looking at things in only *black and white* terms, they are also said to be *inflexible*.
Therefore, to *live in the grey* is **be flexible**, to **see things from both sides**, and to **have an open mind**.
If trying to tell somebody to look at something from somebody else's perspective in... | As in:
*Life is not black and white. We need to learn to **adapt to** the in between.*
**adapt to** [TFD](https://idioms.thefreedictionary.com/adapt) idiom
>
> to change in order to be better suited to something:
>
>
> |
3,414,266 | It is an exercise in Rotman's "introduction to the theory of groups" to show that if $S \trianglelefteq G$ and $T \leq G$ are solvable, then so is $ST$.
I know $ST = S \vee T$ in the lattice of subgroups when $S$ is normal, so I'm curious if $S \vee T$ is solvable more generally (assuming, of course, both $S$ and $T$... | 2019/10/29 | [
"https://math.stackexchange.com/questions/3414266",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/655547/"
] | No. Indeed, every finite group can be written as a finite join of solvable subgroups, namely its cyclic subgroups. If a join of two solvable subgroups was always solvable, then by iterating we would conclude that every finite group was solvable. So, every finite non-solvable group must have a counterexample among its s... | If you don't assume that $S\trianglelefteq G$, then the product $ST$ need not be solvable. As the product is a subgroup of the join, and solvable groups are closed under taking subgroups, the join need not be solvable either. Below is a simple example.
We will take $G=S\_5$ the symmetric group on the set $\{1,2,3,4,5\... |
63,585,661 | So Im trying to use the Google GeolocationAPI. It sends the quest successfully and also authenticates successfully with my api key but it returns me this
```
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"errors": [
{
... | 2020/08/25 | [
"https://Stackoverflow.com/questions/63585661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12277653/"
] | I recommend you to check out the [documentation](https://developers.google.com/maps/documentation/geolocation/overview):
As you can read:
>
> Before you start developing with the Geolocation API, review the
> authentication requirements (you need an API key) and the API usage
> and billing information (you need to e... | You need to create and associate a billing account to your project. It will work immediately. |
20,147,671 | i got into a problem. I have 3 tables, I join them but cant get the right answer, if anyone could help me, I would appreciate it. So what i want is, for Answer to show me unused Materials. Tables: 
With a lot of help I got all the unused materials wit... | 2013/11/22 | [
"https://Stackoverflow.com/questions/20147671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2965118/"
] | Edit:
Disregard this solution. I'm leaving it up for the sake of having the complete discussion. Or woukd it be customary to remove this answer?
After comment-discussion under David Fleeman's solution, I did some profiling and the short answer is: go with David Fleemans solution, using NOT IN. It will be faster than ... | Johan above almost has it (unused materials will still exist in table\_2, since Table2 is just a lookup of Procedure\_Name to Material\_Number (which if it's a 1:1 relationship seems like a silly addition). Still need to join against Table1 to get the null values.
so
```
SELECT *
FROM Materials c
LEFT J... |
3,719,015 | Why does the following line
```
Object[] objects = new Object[10000000];
```
result in a lot of memory (~40M) being used by the JVM? Is there any way to know the internal workings of the VM when allocating arrays? | 2010/09/15 | [
"https://Stackoverflow.com/questions/3719015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116388/"
] | It creates an array with 10.000.000 reference pointers, all initialized with `null`.
What did you expect, saying this is "a lot"?
---
**Further reading**
* [Size of object references in Java](https://stackoverflow.com/questions/981073/how-big-is-an-object-reference-in-java-and-precisely-what-information-does-it-con... | I may be behind the times but I understood from the book Practical Java that Vectors are more efficient and faster than Arrays. Is it possible to use a Vector instead of an array? |
12,917 | My seven year old daughter plays on a soccer team. She loves soccer. She is not the best player and not the worst. She is however, the team crybaby. She finds some reason to cry every single game and practice. She fakes injuries, gets frustrated and cries in front of everyone when she doesn't score a goal, and is the f... | 2014/06/07 | [
"https://parenting.stackexchange.com/questions/12917",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/7976/"
] | >
> "We're never going to beat the other team."
>
>
>
Never? Absolutely never? Are you sure? Here I'd question the language she uses. The language we use out loud is often the same language we use in our thoughts. And the language we use in our thoughts tends to shape our thoughts and emotions.
For advice on how... | My daughter (also 7) acts the same way with her marching band. She plays the trumpet. I know she's not being bullied (in fact, most of them are very nice) and her coaches are wonderful. I asked her many times if she wants to quit but refuses to do so. She's even excited to go. That's why it was so confusing for me why ... |
10,448,047 | I want to include a .c file in another. Is it possible right? It works well if I include a header file in a .c file, but doesn't work as well if I include a .c file in another .c file.
I am using Visual Studio and I get the following error:
```
main.obj : error LNK2005: _sayHello already defined in sayHello.obj
... | 2012/05/04 | [
"https://Stackoverflow.com/questions/10448047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/898390/"
] | This is a linker error. After compiling all your .c files to .obj files (done by the compiler) the linker "merges" them together to make your dll/exe. The linker has found that two objects declare the same function (which is obviously not allowed). In this case you would want the linker to only process main.obj and not... | The problem seems to be that `sayHello.c` got compiled into an object file called `sayHello.obj`, and `main.c` (also including all the source text from `sayHello.c`), got compiled into `main.obj`, and so both `.obj` files got a copy of all the external symbols (like non-`static` function definitions) from `sayHello.c`.... |
57,961,964 | When setting the scale of a view programmatically, setScaleX() and setScaleY() do not accept decimal values like **"0.1"** and displays the error code **"setScaleX(float) in View cannot be applied to (double)"** when such a value is specified.
setScaleX() and setScaleY() only seems to accept integers like **1, -5 or 1... | 2019/09/16 | [
"https://Stackoverflow.com/questions/57961964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12019381/"
] | The best way is to use XSLT-1.0 to transform your input XML to your desired output XML.
This can be achieved by using [`XslCompiledTransform`](https://learn.microsoft.com/en-us/dotnet/api/system.xml.xsl.xslcompiledtransform?view=netframework-4.8).
The following stylesheet (`transform.xslt`) does the job:
```
<xs... | Using Xml Linq :
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
const string FILENAME = @"c:\temp\test.xml";
static void Main(string[] args)
{
... |
4,733,273 | I'm working on a (simple) caching solution of sorts, where a service can request a Cache object from a Map of caches. A Cache object works essentially just like a Map, too, with a key and a value and methods to access and store objects.
I came up with the following solution, but as you can see, it contains a cast (bec... | 2011/01/19 | [
"https://Stackoverflow.com/questions/4733273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204840/"
] | On the thread safety question, no it's not thread safe. You should look at [ConcurrentHashMap](http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentHashMap.html) or Google Guava's [MapMaker](http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html) | You can just make the whole method synchornized to make it thread safe. Provided its not called often it will be efficient enough. If you want to make the code safer I suggest you try the following add a runtime check for the types.
```
public <K, V> Cache<K, V> getOrCreateCache(String identifier, Class<K> kClass, Cla... |
163,785 | Is there a way I can monitor connections that are attempted/made to my linux server? I'm running Debian Lenny. | 2010/07/24 | [
"https://serverfault.com/questions/163785",
"https://serverfault.com",
"https://serverfault.com/users/49243/"
] | I find the **iptstate** tool really useful to monitor iptables entries in real time. On Fedora it is a *yum install iptstate* so I imagine in Debian you can install via *apt-get*.
As already mentioned, for very detailed analysis, *tcpdump* is awesome (or alternatively *Wireshark*).
Not sure about Debian, but on Fedor... | You could try scheduling command `ss -s` to check number of connections made on your server at some convenient interval using [cron tab](http://v1.corenominal.org/howto-setup-a-crontab-file/).
Or there is a free service, [SeaLion](https://sealion.com) which you can use to schedule commands and see output online. |
77,180 | >
> And he shall pass through the sea with affliction, and shall smite the waves in the sea, and all the deeps of the river shall dry up: and the pride of Assyria shall be brought down, and the sceptre of Egypt shall depart away. (Zechariah 10:11)
>
>
>
What was the pride of Assyria during the time of Zechariah be... | 2022/07/02 | [
"https://hermeneutics.stackexchange.com/questions/77180",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/40416/"
] | There is a similar "problem" in Ezra 6:22 where "Assyria" is used as the name for the nation that now controls it, ie, Persia. See appendix below.
Thus, the simplest way to understand the "pride of Assyria" in Zech 10:11 is to read "pride of Persia" because Persia now controlled and occupied the area once held by Assy... | When reading the whole passage of Zechariah 10;
vv1-3a - The Lord reminded the remnants the days their ancestors' wrong doings that led to the destruction of Jerusalem.
vv3b - However the Lord still care of His people
vv4 - Implying the coming Messiah
vv5 - 10 - Implying the salvation from the Lord eventually reins... |
13,845,020 | Using only Javascript, how can I iterate through every span id = "expiredDate"? I would think that this would be quite easy with a for each loop, but it doesn't appear to exist in javascript. My below code only works for the first element.
```
<script type="text/javascript">
window.onload = function() {
var define... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13845020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326111/"
] | Switch your IDs to classes and try the following
```
var spans = document.getElementsByTagName('span');
var l = spans.length;
for (var i=0;i<l;i++) {
var spanClass = spans[i].getAttribute("class");
if ( spanClass === "expiredDate" ) {
/*do stuff to current spans[i] here*/
}
}
``` | Two methods not said yet; for both you should be using the form
```
<span class="expiredDate">...</span>
```
1. [`.querySelectorAll`](https://developer.mozilla.org/en-US/docs/DOM/Document.querySelectorAll) method:
```
var result = document.querySelectorAll('span.expiredDate'); // NodeList
```
2. [`.getElementsByC... |
45,296,575 | I want two divs next to each other . one contains a button the other some text. i would like the text before the button with som margin. But the keep ending up on the wrong side.
My code:
```css
.helpButton {
display: inline-block;
float: right;
}
.helpText {
margin-right: 5em;... | 2017/07/25 | [
"https://Stackoverflow.com/questions/45296575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6804444/"
] | Dont' use floats (right floats reverses therorder of the elements). As you are using `display: inline-block`, a simple tex-align will work
```css
.help-block {
display: inline-block;
text-align: right
}
.helpButton {
display: inline-block;
}
.helpText {
display: inline-block;
}
```
```ht... | I would use a flexbox and avoid floats. This way, all elements will follow the document flow (and you need less CSS code).
```css
.helpText {
margin-right: 5em;
}
.help-block {
display: flex;
align-items: center;
justify-content: flex-end;
}
```
```html
<div class="help-block">
<div class="helpText... |
22,560,130 | I have seen many post with a similar issue.
My R.java file has been generated but it's missing the elements below
1. Project clean does nothing
2. There's no errors in my res folder
It cannot be resolved for the areas e.g. menu, action.edit, action.delete, action.new
Example 1:
```
@Override
public boolea... | 2014/03/21 | [
"https://Stackoverflow.com/questions/22560130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765446/"
] | If "Control Panel" -> "Regional and Language Options" -> "System Locale" is set correctly but you still suffer from this problem some times then note that **while you're copying** your keyboard layout must be switched to the non-English language.
This is applicable to all non-unicode-aware applications not only VBA.
... | I had a similar problem with Cyrillic characters. Part of the problem is solved when set the System locale correctly.
However, The VBA editor still does not recognize cyrillic characters when it has to interpret them from inside itself.
For example it can not display characters from the command:
```
Msgbox "Здравей"... |
20,418 | At the end of *Pirates of the Caribbean: Dead Man's Chest*, we see Barbossa reincarnated. Is there any in-movie explanations of how that was possible, since he was shot cleanly through the chest at the end of the first movie? If Tia Dalma was responsible, does that mean she had the power to make anyone come back from d... | 2012/07/12 | [
"https://scifi.stackexchange.com/questions/20418",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/1570/"
] | In-movie, there is no specific explanation as to just *how* Barbossa was resurrected. Similarly, as far as I can find, there is no explanation in any of the side-story books that were written.
When we first meet her, Tia Dalma is presented as a Voodoo priestess having performed [numerous acts related to the supernatur... | At the end of Pirates of the Carribean: The Curse of the Black Pearl, there is an after-credits scene that shows Barbossa's pet monkey (Jack) take one of the coins from the chest, which then curses the monkey again.
Now, perhaps the monkey *gave* the dead or dying Barbossa the coin for him to be cursed again, therefo... |
21,177,423 | I have two images:
-loading.gif (which is the loading animation)
-scenery.jpeg (which is i what i want to display after the loading process);
because scenery.jpeg is a small file, using load() function will only skip the loading.gif
so when I click the button how do i display the loading.gif for 3 seconds before it... | 2014/01/17 | [
"https://Stackoverflow.com/questions/21177423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205046/"
] | You can use [delay()](http://api.jquery.com/delay/) in this case:
```
$("#button1").click(function(){
$("#loading").fadeIn().delay(3000).fadeOut('slow', function() {
$(this).next().fadeIn()
});
});
```
[Demo](http://jsfiddle.net/5E2nK/) | One of the ways would be:
1. Replace image `src` with throbber `src`.
2. Create new `Image` object, set it's `src` to one of image.
3. Add `load` event listener on `Image`, and set img src inside `setTimeout` with desired value.
The function the does that:
```
function delayLoad (img, throbber, delay) {
var src = ... |
891 | There is [an article about this word in Urban Dictionary](http://www.urbandictionary.com/define.php?term=brogrammer). But what is the Russian for this word? "говнокодер" and "быдлокодер" are not suitable here (it means good developer, not bad).
An example of using:
*I don't write unit tests, interfaces, use IOC or he... | 2012/08/27 | [
"https://russian.stackexchange.com/questions/891",
"https://russian.stackexchange.com",
"https://russian.stackexchange.com/users/329/"
] | Есть выражение "погромист", но оно тоже скорее насмешливое, чем серьёзное.
Русского аналога "brogrammist" боюсь что нет. | Consider
программист-раздолбай |
46,450,246 | Need to make screenshot of some games. Found this JNA code, but when I try to do screen`s I just get black screen. When I try to do screen of some program, like WordPad ot smth it works well. As well I am bad in JNA, I want ask you about help. Is it possible to accomplish this task ?
```
public class Paint extends JFr... | 2017/09/27 | [
"https://Stackoverflow.com/questions/46450246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8199966/"
] | GDI32Util.getScreenshot(HWND hwnd)
Method is already provided in jna.
but my case is as the same as you.... the game screen is black... nothing... | Using JNA to take a screenshot sounds utterly complicated, besides not being platform-agnostic. Java has built-in functionality to take screenshots using the `Robot` class:
```
import java.awt.Robot;
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot()... |
59,931,063 | Here is my code:
```
import styles from 'styles.css';
// other code
render() {
return <CSSTransition
classNames= {{
enter: 'example-enter',
enterActive: 'example-enter-active',
exit: 'example-leave',
exitActive: 'example-leave-active'
}}
... | 2020/01/27 | [
"https://Stackoverflow.com/questions/59931063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/744519/"
] | The `lambda m: '19'+m` is wrong because `m` is a `MatchData` object, not a string. You might have tried `m.group()`, but since you also match any non-digit chars on both ends of a number (as whitespace) you might still get wrong results.
You may use
```
df['year'] = df['year'].str.strip().str.replace('^\d{2}$', r'19\... | IIUC, count strings that has a length of two and prefix it with 19
```
df.assign(year = np.where(df.year.str.strip().str.len()==2,
'19'+df.year.str.strip(),
df.year))
month year
0 2 2001
1 5 1989
2 8 1999
``` |
1,901,716 | Very strange situation here: I'm using L2S to populate a DataGridView.
Code follows:
```
private void RefreshUserGrid()
{
var UserQuery = from userRecord in this.DataContext.tblUsers
orderby userRecord.DisplayName
select userRecord;
UsersGridView.DataSource =... | 2009/12/14 | [
"https://Stackoverflow.com/questions/1901716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219993/"
] | The easiest would be to use a BindingSource. Create an instance of the BindingSource to the class initialize it to the data query then assign the BindingSource to the UsersGridView.
The BindingSource will handle the updates etc. There are several events that can be caught for custom management.
[This link gives an ex... | It seems that this is a bug in LINQ to SQL. I understand from the Janus GridEx folks that the cause of the problem is that LINQ presents a static list to the grid that is not refreshed after Refresh is called on the DataContext.
A solution is to simply re-instantiate the DataContext. |
19,378,987 | I've been trying to create a function that splits a string and return a pointer to the first element of the array. It compiles with no error but when i run the program it crashes. Here is my code. Any help on how to fix this. Thanks.
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define split_count(a... | 2013/10/15 | [
"https://Stackoverflow.com/questions/19378987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2461500/"
] | to save few computations:
```
boolean mod3 = x mod 3 == 0
boolean mod5 = x mod 5 == 0
if (mod3 && mod5) return "ab"
if (mod3) return "a"
if (mod5) return "b"
``` | Alternatively:
```
String result = "";
if (x mod 3 == 0) result += "a";
if (x mod 5 == 0) result += "b";
return result;
```
But it has the overhead of string concatenation |
36,435,521 | I know this question has been asked before, but my case is different and I have not found a solution yet. This is my problem:
I have a checkbox that when you click it, a hidden div becomes visible. However, my page shifts-moves to the left. However, with my case there is no scrollbar that appears.
If I click the che... | 2016/04/05 | [
"https://Stackoverflow.com/questions/36435521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5711970/"
] | I had the same issue with the same error message and it was a network issue. My replication instance didn't have access to the database.
My database is in a VPC with a subnet x and my replication instance is in the same VPC with the same subnet x. I opened the 3306 port in my Network ACL and in the security group of t... | You must add the security group from your DMS replication instance to your RDS database associated security group as an authorised inbound traffic.
* Go to Database Migration Service dashboard and them to "Replication Instances"
* Select your replication instance to get the "VPC Security Group" |
27,298 | I am translating in my main class `render`. How do I get the mouse position where my mouse actually is after I scroll the screen
```
public void render(GameContainer gc, Graphics g) throws SlickException
{
float centerX = 800/2;
float centerY = 600/2;
g.translate(centerX, centerY);
g.translate(-player... | 2012/04/12 | [
"https://gamedev.stackexchange.com/questions/27298",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/15290/"
] | Edit: just realised this is pretty old.
Anyways, I did something similar to this in a TD game so hopefully the same would apply here.
In my `TileMap` class I have a method called `getTileCoord(int mouseX, int mouseY)` and for your game it would be translated to something like this:
```
int tileX = (int) (mouseX - ca... | float mouseY = Math.abs(Mouse.getY() - Gamecontainer.getHeight()); |
24,059,880 | I can successfully create composite primary key in sql server management studio 2012 by selecting two columns (OrderId, CompanyId) and right click and set as primary key. But i don't know how to create foreign key on two columns(OrderId, CompanyId) in other table by using sql server management studio 2012. | 2014/06/05 | [
"https://Stackoverflow.com/questions/24059880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3004110/"
] | If you open the submenu for a table in the table list in Management Studio, there is an item `Keys`. If you right-click this, you get `New Foreign Key` as option. If you select this, the Foreign Key Relationships dialogue opens. In the section (General), you will find `Tables And Columns Specifications`. If i open this... | Add two separate foreign keys for each column. |
2,767,913 | If $A \in M\_n$, $A \succeq 0$ is positive semidefinite, and $a\_{ii} a\_{jj} = |a\_{ij}|^2$, then why $A$ is a non-invertible matrix?
Thank you in advance
p.s.: this problem is in "Matrix Analysis" by Horn and Johnson, second edition (please see [7.1.P1] page 434). | 2018/05/05 | [
"https://math.stackexchange.com/questions/2767913",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/550103/"
] | The claim is true for $n=2$ and symmetric $A$, as then $\det A=0$ follows from the conditions on $a\_{ij}$. | This is false for a general (possibly non-symmetric) positive semidefinite matrix:
$$\begin{pmatrix}1 & -1 \\ 1 & 1\end{pmatrix}$$
is positive semidefinite (its associated quadratic form is $x^2+y^2$) yet invertible |
5,215,781 | I'm maintaining a vb6 project(ActiveX DLL). When debugging, the app run into the following function:
```
Public Function HasValue(ByVal vValue) As Boolean
On Error GoTo Err
If IsMissing(vValue) Then
HasValue = False
ElseIf IsNull(vValue) Or Len(vValue) = 0 Then
HasValue = False
ElseIf... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5215781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/497033/"
] | As far as getting the popup running in the debugger, it is probably related to your "Error Trapping" settings in the IDE. Go To Tools->Options->General and see what selected under "Error Trapping". At first glance it seems odd that your error handler is testing the vValue in the event of an error. It makes more sense t... | As far as i know vb6 does not support **boolean short evaluation** in
```
ElseIf IsNull(vValue) Or Len(vValue) = 0 Then
```
so `Len(vValue) = 0` is executed even if `IsNull(vValue)` is true.
changing your code to
```
...
ElseIf IsNull(vValue) Then
HasValue = False
ElseIf Len(vValue) = 0 Then
HasValue = Fa... |
277,092 | I can't figure out how to set environment variables properly, even though I tried to follow <https://wiki.debian.org/EnvironmentVariables>.
I've added this to `~/.bashrc`:
```
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
```
It seemed logical to me to comment these lines in `~/.profile` after doing that... | 2016/04/17 | [
"https://unix.stackexchange.com/questions/277092",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/165260/"
] | See `man xsession`:
>
> `/etc/X11/Xsession.d/40x11-common_xsessionrc`
>
>
> Source global environment variables. This script will source anything in `$HOME/.xsessionrc` if the file is present. This allows the user to set global environment variables for their X session, such as locale information.
>
>
> | I finally added a `profile.desktop` file in `~/.config/autostart` that looks like this:
```
~/.config/autostart$ cat profile.desktop
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=profile
Comment=
Exec=/bin/bash /home/nicoco/.profile
OnlyShowIn=XFCE;
StartupNotify=false
Terminal=false
Hidden=false... |
192,860 | I have this sentence:
>
> The problem is he is very stingy with his money.
>
>
>
But I feel it sounds weird or even wrong with the two *is*es so close. Is the sentence structure grammatical? If it isn't, how to fix it? | 2014/08/23 | [
"https://english.stackexchange.com/questions/192860",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/85010/"
] | If you aren't happy with your (correct) sentence, and still feel it needs "fixing," you could reword to:
>
> The problem is his (great/considerable) stinginess with money.
>
>
> | >
> **[What comes after "the problem is...."?](https://english.stackexchange.com/questions/574726/what-comes-after-the-problem-is)** (This post does not seem to be a duplicate of the linked post as it offers no answer to the question.)
>
>
>
A statement of the nature of the problem, which can take several forms:
... |
8,938,107 | I am trying to post a date to a dateTime column in a SQL Server 2008 R2 database, but I have run into many problems that I don't know what are the causes.
First, I used this code but I got the error:cannot convert string to date.
```
ADOOF.SQL.Text:='UPDATE OFTab SET CA='''+ CA.Text + ''', demandeClient=''' + DateTim... | 2012/01/20 | [
"https://Stackoverflow.com/questions/8938107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/989318/"
] | in your first example use
```
FormatDateTime('YYYYMMDD hhmmss',demandeClient.DateTime)
```
instead of
```
DateTimeToStr(demandeClient.DateTime)
```
This is because DateTimeToStr without formatsettings uses your localized machine settings and your database just might or might not like the format. Using FormatDateT... | 1. I will strongly suggest to use SQL Native Client 11 when you are working with SQL Server 2008 R2. New SQL Server 2008 data types (including `DATE`, `TIME`, `DATETIME2`, and `DATETIMEOFFSET`) are not supported by the SQL Server 2000 OLEDB provider.
2. Your second code sample should work. Check that you have `TADOQuer... |
45,341,206 | Below is the code for my action creator:
```
export function fetchPosts()
{
const request = axios.get(`${ROOT_URL}/posts${API_KEY}`);
return
{
type: FETCH_POSTS;
payload: request
};
}
```
Next to type: FETCH\_POSTS, if i add , instead of ; i get the error Unexpected token. Is... | 2017/07/27 | [
"https://Stackoverflow.com/questions/45341206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8373663/"
] | GibboK's answer has already pointed out the syntax error.
However, I don't think you understand using actions properly. You run:
```
const request = axios.get(`${ROOT_URL}/posts${API_KEY}`);
```
This is creating a promise. You are currently returning this in an action. Reducers are meant to be deterministic & side ... | As per **[redux](http://redux.js.org/docs/basics/Actions.html)** documentation:
>
> `Actions` are plain JavaScript objects. Actions must have a `type
> property` that indicates the type of action being performed. Types
> should typically be defined as `string constants`. Once your app is
> large enough, you may wa... |
22,296,293 | In My DataBaseAdapter Class, I write a method getAll like that
```
public List<AllUserInfor> getAllInfor(int id) {
List<AllUserInfor> allInfor = new ArrayList<AllUserInfor>();
String selectQuery = "SELECT Name, Gender FROM MY_TABLE where _id = '"+id+"' ";
Cursor cursor = sqLiteDatabase.rawQuery(selectQue... | 2014/03/10 | [
"https://Stackoverflow.com/questions/22296293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3399020/"
] | Do not cast your `id` value into the `String` as its an `Integer` in your table.
Change your criteria as below to get value:
```
"SELECT Name, Gender FROM MY_TABLE where _id = "+id+" ";
```
Just remove the single `" ' "` and write as `"+id+"` not `'"+id+"'` | use this :
```
"SELECT Name, Gender FROM MY_TABLE where _id ="+id+";
```
instead of
```
"SELECT Name, Gender FROM MY_TABLE where _id = '"+id+"' ";
``` |
8,693,733 | I'm working on a project where I need to make modifications in more then 500 images to **give outerglow on hover** effect. I will need to modify each image to give the outer glow. It will be a very time consuming task.
**This is example of one image.** All images are transparent .png
 in photoshop and take the blur tool.
Then blur the whole image and save as (example-hover.png).
```
<div id="img1">
<img src="images/example.png">
</div>
#img1:hover{
background: url('images/example-hover.png') n... |
68,105 | If there is a segmented audience set, comprising of individuals as one segment, and various types of businesses as other segments, is there a good collective term that can be used as a top level navigation item:
Currently **Audiences** is the top level nav item, and the audience types are:
* Researchers (individual p... | 2014/11/28 | [
"https://ux.stackexchange.com/questions/68105",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/5900/"
] | Interesting problem to try solve in the general case.
I fairly frequently have an accurate, but abstract collective term that is derived from strong analysis of the domain. However as most people actually *in the domain* do not do the abstract analysis, and thus they would not recognise and engage with the term. Equa... | You could try "Clients" if it fits the context |
1,876,506 | For a list like:
```
Column1 Column2 Column3
DataA 1 1234
DataA 2 4678
DataA 3 8910
DataB 2 1112
DataB 4 1314
DataB 9 1516
```
How do I get a list like this:
```
Column4 Column5 Co... | 2009/12/09 | [
"https://Stackoverflow.com/questions/1876506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/127776/"
] | This exceptions means that you are trying to autowire `EntityManagerFactory` by type. Do you have any `@Autowired` annotation in your code?
Aslo, when using `@PersistenceContext`, set the `unit` attribute correctly. And (I'm not sure if this is a proper thing to do) - try setting the `name` attribute to your respectiv... | Ensure all of your @PersistenceContext specify unitName. I haven't figured out how to tell Spring that a particular EMF or PersistenceUnit is the default. I thought specifying primary="true" on the default EMF would work but doesn't appear to |
15,955,249 | I wrote this css code:
```
body.product.70 div.mydiv {
display:none
}
```
and the HTML:
```
<body class="product 70">
<div class="mydiv">
content
</div>
</body>
```
But it doesn't want to hide.
thanks | 2013/04/11 | [
"https://Stackoverflow.com/questions/15955249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2271447/"
] | Well for starters, your `class` attribute is missing a closing quote...
EDIT: Aside from that, you're applying two class names, one of which is `70`. This is NOT a valid CSS class name. CSS classes must begin with a hyphen, underscore, or letter. | You don't need to specify too many classes when you call it on css. If you have the class .product for every product, no need to use the class '70' on the css:
```
body.product {
display:none;
}
```
I recomend you to use something more semantic html like:
```
<body>
<div class="product">
<div class=... |
44,278,983 | I would like to know if it's possible to match one pattern multiple time (the number of match is not know) and extract each occurences for make a compare?
My goal is to find if a vlan is configure on an interface.
I have this file sample (I have trunc it) :
```
interface Ethernet1/16
shutdown
switchport access v... | 2017/05/31 | [
"https://Stackoverflow.com/questions/44278983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544062/"
] | I think this will work :
```
REGEX="^interface (.*)"
REGEX_TRUNKRANGEVLAN="^[ ]*switchport trunk allowed vlan (.*)"
vlan=$2
while read line
do
if [[ $line =~ $REGEX ]]
then
ifname=${BASH_REMATCH[1]}
fi
if [[ $line =~ $REGEX_TRUNKRANGEVLAN ]]
then
old=$IFS
IFS=","
for range in ${BASH_R... | Clearly not the prettiest way to do it, certainly not the most efficient way also, but because I put some time writing this command, I'll share it even if your problem is solved :
```
sed -r -e ':a' -e 'N' -e '$!ba' -e 's/\n//g' -e 's/(interface Ethernet)/\n\1/g' |awk '{gsub(",", " ", $15); print "echo "$1"_"$2" "$15}... |
46,118,361 | I have a data frame:
```
df = read.table(text="index Htype
3 AAAABABBAAAAAABBAAHBUUAUAABBAABA
4 AAAABABBAAABABBABBAAHBBBBAABAABB
7 AAAABABBAAAAAABBAAABUBAUAABBAABA
8 BBBABABAAAAAAAABBABBAUAUAABBAAAA
9 BBHABABAAAAAAAABBABBABAUAABBAAAA", header=T, stringsAsFactors=F)
```
I would like to fin... | 2017/09/08 | [
"https://Stackoverflow.com/questions/46118361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3354212/"
] | I think this is something on the Google's end. My application have been running on production for more than a week. Based on the logs everything was fine till 6 hours ago but since that the users don't get any answer back.
If I request on the API.AI the response is okay so it's not the firebase/fullfillment causing the... | Errors like this are usually caused by a syntax error or other problem in your Firebase Function after you've updated it. There are a few good approaches to diagnosing problems like this:
1. Check the Firebase function log. If there is an error, it will almost certainly show up here.
From the command line you can use... |
10,877,223 | I have an interface that I've exposed as a regular SOAP web service. One method of the interface consists for the client to send a file to the server, then the server processes the file and returns a result file. Processing the file may take some time, so I think using asynchronous invocation of this method is a better... | 2012/06/04 | [
"https://Stackoverflow.com/questions/10877223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1002972/"
] | You can use `Callback` approach of `Asynchronous InvocationModel`.
>
> Callback approach - in this case, to invoke the remote operation, you
> call another special method that takes a reference to a callback
> object (of javax.xml.ws.AsyncHandler type) as one of its parameters.
> Whenever the response message arri... | If you use some tool like WSDL2Java for client generation, you can even choose to generate an asynchronous client.
It will generate for you a callback handler with empty methods for each of the service operations and exceptions of the service. You then can just implement those methods to set the actions to do when the ... |
37,956 | I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me.
I've tried to use Direct Show with the SampleGrabber filter (using this sample <http://msdn.microsoft.com/en-us/library/ms7878... | 2008/09/01 | [
"https://Stackoverflow.com/questions/37956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1578/"
] | I know it is very tempting in C++ to get a proper breakdown of the video files and just do it yourself. But although the information is out there, it is such a long winded process building classes to hand each file format, and make it easily alterable to take future structure changes into account, that frankly it just ... | I would recommend FFMPEG or GStreamer. Try and stay away from openCV unless you plan to utilize some other functionality than just streaming video. The library is a beefy build and a pain to install from source to configure FFMPEG/+GStreamer options. |
22,505,609 | I want to force the user to write in an input values, which have max 2 digits after "."
For instance : 24.14 or 5.7 or 0.5 or 8 and NOT 4.321 or 5.133121. How can I do that ? | 2014/03/19 | [
"https://Stackoverflow.com/questions/22505609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3084005/"
] | I found a solution for this. You can use this api from Jquery: [click here](http://digitalbush.com/projects/masked-input-plugin/) | You can make use of [.toFixed()](http://www.w3schools.com/jsref/jsref_tofixed.asp) method which converts a number into a string, keeping a specified number of decimals.
**sample**:
```
var myNum = document.getElementById("textboxID").value;
myNum = parseFloat(myNum).toFixed(2); //I fixed my precision to 2 digits afte... |
3,137,094 | I have lines like these, and I want to know how many lines I actually have...
```
09:16:39 AM all 2.00 0.00 4.00 0.00 0.00 0.00 0.00 0.00 94.00
09:16:40 AM all 5.00 0.00 0.00 4.00 0.00 0.00 0.00 0.00 91.00
09:16:41 AM all 0.00 0.00 4.00 0.00 0.00 ... | 2010/06/29 | [
"https://Stackoverflow.com/questions/3137094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/368453/"
] | If all you want is the number of lines (and not the number of lines and the stupid file name coming back):
```
wc -l < /filepath/filename.ext
```
As previously mentioned these also work (but are inferior for other reasons):
```
awk 'END{print NR}' file # not on all unixes
sed -n '$=' file # (GN... | I know this is *old* but still: ***Count filtered lines***
My file looks like:
```none
Number of files sent
Company 1 file: foo.pdf OK
Company 1 file: foo.csv OK
Company 1 file: foo.msg OK
Company 2 file: foo.pdf OK
Company 2 file: foo.csv OK
Company 2 file: foo.msg Error
Company 3 file: foo.pdf OK
Company 3 file: fo... |
477,358 | I know that the signal was just tone pulses but why was it when (back in the 90s) when you first connected to the internet you heard a bunch of funny noises. After that if you were to use the internet, it still was using the telephone line, why no funny noises then? | 2012/09/20 | [
"https://superuser.com/questions/477358",
"https://superuser.com",
"https://superuser.com/users/137864/"
] | Because the modem speaker was turned on by default, to give the user the feedback that something was happening during the handshake. With the proper setup of the AT commands you could have 3 modes - always on for speaker, totally silent during operation, and the default with speaker turned on during connect.
They were... | The first modem I ever used was acoustically coupled--that is, you put the handset into a rubber dingus where transmitted/recieved the *sound* to/from a microphone/speaker on the modem body.
This was necessary for a while in the US because AT&T had government granted veto over the attachment of any electronic device t... |
3,739,661 | I'm trying to create a custom view `GhostSurfaceCameraView` that extends `SurfaceView`. Here's my class definition file
`GhostSurfaceCameraView.java`:
```
public class GhostSurfaceCameraView extends SurfaceView implements SurfaceHolder.Callback {
SurfaceHolder mHolder;
Camera mCamera;
GhostSurfaceCamera... | 2010/09/17 | [
"https://Stackoverflow.com/questions/3739661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/451119/"
] | @Tim - Both the constructors are not required, only the `ViewClassName(Context context, AttributeSet attrs )` constructor is necessary. I found this out the painful way, after hours and hours of wasted time.
I am very new to Android development, but I am making a wild guess here, that it maybe due to the fact that si... | Another possible cause of the "Error inflating class" message could be misspelling the full package name where it's specified in XML:
```
<com.alpenglow.androcap.GhostSurfaceCameraView android:id="@+id/ghostview_cameraview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
```
Opening ... |
5,402,564 | How to Add Not condition in the below select case.
Is <> works for single value, and 'To' works for a Range but the value are specific values there are not series of numbers. Is it possible to use select case in this scenario, or do i have to switch to if-else. Ex: i don't want case to execute when value is 0 and 3
`... | 2011/03/23 | [
"https://Stackoverflow.com/questions/5402564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116489/"
] | I'm not sure I understand the question...
Why can't you just write the example code like so:
```
Select Case value
Case 1, 2
DoWork()
End Select
```
Nothing gets executed when `value = 0` or `value = 3`. The series of values provided to a `Case` statement doesn't have to be sequential.
---
**Update in... | Building on what Cody wrote I would go with:
```
Select Case value
Case 1, 2
DoWork()
Case 0 ,3
'nothing to do, only log if needed
Case Else
Debug.Fail("Please provide a logical path for all possible values")
End Select
```
The extra branches are just to clarify the... |
36,161,805 | I need to delete rows where the positive values begin in column H after sorting. I was trying to use the find feature. I know >0 does not work but not sure where to go from here. I can switch the sort to descending and search for "-" if I can figure out how to select upwards and delete.
```
Source_Workbook.Worksh... | 2016/03/22 | [
"https://Stackoverflow.com/questions/36161805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6100243/"
] | Change the path in the .ini-file.
```
-vm
C:\Program Files\Java\JDK1.8.0_172\bin\javaw.exe
```
if you still see the issue
Change it into:
```
-vm
C:\Program Files\Java\jdk1.8.0_172\jre\bin\server\jvm.dll
```
Note: The path should be in the new line after -vm. | I installed java 9 JDK 64 bit.
The install took care of everything in my case and allowed me to start the Anypoint studio from my existing short cut. In some cases you may need to still manually edit your settings but try just a 64 bit install first |
37,113,840 | My older database version is 2.3.2. There I created a database and inserted nodes and relationships.
Now, I upgraded to 3.0 version and restarted the neo4j server. Changed the
`dbms.active_directory = xyz_path`
But unable to fetch the data from the db now.
Is there any more configurations or any specific changes ... | 2016/05/09 | [
"https://Stackoverflow.com/questions/37113840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2771169/"
] | The problem was the above js code was not generating array in proper JSON format. I tried and fixed that. here is working code:
```
var fs = require("fs");
var data = fs.readFileSync('India2011.json');
var myData=JSON.parse(data);//contains main array
var len=myData.length;//main array length
var k=1;
var count=0;... | The problem is caused by this line:
```
var displayMe = [];
```
You're initializing `displayMe` to be an empty array. However, you are subsequently treating that array as an object:
```
displayMe[myData[i]["Area Name"]] = (obj);
```
This won't stringify to JSON properly, because arrays are supposed to have partic... |
4,355,355 | In a past exam question we prove that the following function is well-defined and holomorphic on $\mathbb{C}$ \ $\mathbb{Z}$, and then we are asked to find the closed form. Let
$$
f(z)=\sum\_{n=-\infty}^{\infty}\frac{1}{(z+n)^2}.
$$
The mark scheme says:
>
> We have that $f$ is periodic as $f(z) = f(z+2) \forall z$. ... | 2022/01/12 | [
"https://math.stackexchange.com/questions/4355355",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/923821/"
] | What you wrote is very odd, it suggests a lot of confusion. First of all this is not a Laurent series, the terminology is "Mittag Leffler expansion".
Looking only at the poles and the periodicity is not enough, compare $\frac{\pi^2}{\sin^2(\pi z)}$ with $\frac{\pi^2}{\sin^2(\pi z)}+e^{2i\pi z}-e^{4i\pi z} $
The obvio... | I guess some of the information is not properly copied.
This looks to me like the following well known calculation.
You start with [Euler's infinite product formula for $\sin$](https://math.stackexchange.com/questions/674769/sinx-infinite-product-formula-how-did-euler-prove-it):
$$\frac{\sin(\pi z)}{\pi z} = \prod\_{... |
685,045 | I have a problem with conky.
I installed hddtemp and my ssd is shown like this:
```
/dev/sda: Crucial_CT120M500SSD1: 39°C
```
now in conky I wrote:
```
${alignr 10}${color}SSD M500 Crucial 120GB Temp ${color1}${hddtemp /dev/sda}ºC
```
But desktop shows N/A°C.
How can I fix it?
Regards | 2015/10/13 | [
"https://askubuntu.com/questions/685045",
"https://askubuntu.com",
"https://askubuntu.com/users/423264/"
] | If you don't want to have `hddtemp` running in daemon mode all the time, you could also run `hddtemp` as an external command instead. However, `hddtemp` needs to be run as root:
```
$ hddtemp /dev/sda
/dev/sda: open: Permission denied
$ sudo hddtemp /dev/sda
/dev/sda: ST3500418AS: 35°C
```
So, you will first need to... | You need to first start hddtemp as a background daemon with the commmand:
```
hddtemp -d /dev/sda
```
`${hddtemp ...}` is a conky built-in object. It connects to 127.0.0.1:7634
by default to get the disk temperatures. You therefore need to start, independently, the hddtemp daemon which listens on this port and repl... |
48,740,658 | I am trying to calculate renderRow in listView. actually i need to show index of the row with data. its working fine for subitems but not working for parent. i did like this-
```
render() {
return(
<ScrollView style={styles.drawer}>
<View style={styles.content} key={1}>
<ListView
... | 2018/02/12 | [
"https://Stackoverflow.com/questions/48740658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644708/"
] | In my case, I realized that this problem happens with all numbers that has ported from one provider to another. With phone numbers that has never ported Firebase Authentication works like a charm! | 1. Update your SHA keys. If your app is in Playstore then you will get new SHA keys from Play Console: release---> app intrigity---> SHAH keys.
sometimes they updates their website so it will better to search How to get SHA Keys from play console |
106,095 | I create a data collection system that has a tree-like structure built on the similarity to the pattern of the factory, and I have the difficulty in working with this structure, more stingrays lot of code to find the element opredelnie.
```
public interface ITag : IRegister
{
string Name { get; set; }
stri... | 2015/09/30 | [
"https://codereview.stackexchange.com/questions/106095",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/85693/"
] | I believe the `while()` loops are the best way to accomplish your task with how your code is now, so I'm not sure why you "can't stand" them.
You could use a `for()` loop, and `break` out of it using an `if` statement to check the same thing that your `while` loops are doing, but I would prefer the `while` loops mysel... | I'd go with removing the `try-catch` block. In the `while` conditions you just have to check that `xIndex` is smaller than the array's length.
I'd also avoid throwing the `InvalidMazeException` and instead just return a `Point` that cannot exist in any maze, if such a point exists, or `null`, but that's just a prefer... |
13,270 | I would like to write a package offering a number of commands. The package should accept options, and some of these options should be available as command options. Usage should be as follows:
```
...
\usepackage[optA=val1,optB=val2]{mypackage}
\begin{document}
\mycommand[optB=val3]
...
```
It seems as if the `xkeyva... | 2011/03/12 | [
"https://tex.stackexchange.com/questions/13270",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/3391/"
] | Let me provide a simple (but full) example:
```
\ProvidesPackage{myemph}[2011/03/12 v1.0 a test package]
\providecommand\my@emphstyle{\em}
% Note that the argument must be expandable,
% or use xkvltxp package before \documentclass (see manual of xkeyval)
\RequirePackage{xkeyval}
\DeclareOptionX{style}{%
\def\my@em... | An example with some code from the documentation
```
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mypackage}[12/03/2011]
\RequirePackage{xkeyval}
\DeclareOptionX{parindent}[20pt]{\setlength\parindent{#1}}
\ExecuteOptionsX{parindent=0pt}
\ProcessOptionsX\relax
% etc.
\endinput
```
`\DeclareOptionX` is equivalent to (... |
31,014 | I have a database of GPS points. There aren't any tracks, only points. I need to calculate some value for every 100 meters, but sometimes GPS gave a wrong coordinates that lies far from real GPS points, and instead of calculating values for a small square, I have to calculate it for a really big rectangular area.
Wha... | 2012/08/07 | [
"https://gis.stackexchange.com/questions/31014",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/9372/"
] | Run Anselin Local Moran's I against the points and throw out anything with a z-score below -1.96.
That's a statistical method for locating spatial outliers.
You must ensure that all points have a value related to their spatial position to do that.
But in checking on the tools in 10.1 after whuber's comment, I realize ... | I think you've got junk data. Realistically, if you care about the fact that some of the data is wrong, and you can't reliably identify every wrong point using some other factor, then you're going to have some bad data in your analysis.
If that matters, then you should probably consider tossing everything, figuring ou... |
9,220,300 | I'm new to jquery and am trying to alter an existing page template that uses jquery for a contact form to handle form validation. If the form elements are valid, it submits the data elements to a page that processes it (sends an email). What I'm trying to do is to alter the existing code as I have two additional forms ... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9220300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1200843/"
] | You can use more easily
```
$('form').submit(function(e){
e.preventDefault();
var id=$(this).attr('id');
var action=$(this).attr('action');
if(id=='some_id')
{
$.ajax({
type: "POST",
url:action,
data:{...},
success: function(){...}
});
... | Step one: Name your forms so you can easily retrieve them
```
//example
<form id="joebob" name="jimbob" ...
// in jquery can be called dynamically as:
$("#joebob")
//or
$("form[name=jimbob]")
//or you can create one dnamically
var frmJoeBob = $("<form />").attr({ id: "joebob", action: "#smartUrl" });
```
Step two: I... |
33,590,402 | I'm very new to plsql and am having a bit of trouble with one of my assignments. I've been asked to create a date dimension table and populate it with various date information.
I created my table as follows
```
CREATE TABLE date_dimension_table
(
v_date DATE NOT NULL,
full_date VARCHAR2(50) NOT NULL,
day_of_week N... | 2015/11/08 | [
"https://Stackoverflow.com/questions/33590402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5537908/"
] | First of all, you have procedure that get
```
v_first_date_in DATE,
v_second_date_in DATE
```
*DATEs*, but you're trying to pass even not a string. Try something like this
```
BEGIN
sp_populate_dates(TO_DATE('01/01/2005', 'dd/mm/yyyy'), TO_DATE('01/01/2005', 'dd/mm/yyyy'));
END;
```
another thing is - you proces... | You can populate such a table (for the dates between 2000-2030) by using the following query:
```
CREATE TABLE DIM_DATE
as
(
select
TO_NUMBER(TO_CHAR(DATE_D,'j')) as DATE_J,
DATE_D,
TO_CHAR(DATE_D,'YYYY-MM-DD') as DATE_V,
TO_NUMBER(TO_CHAR(DATE_D,'YYYY')) as YEAR_NUM,
TO_NUMBER(TO_CHAR(DATE_D,'Q')) as QUART... |
47,547,589 | In my application I want use `RecyclerView` and for this I set **multiple layout** in `RecyclerView`.
**I changed layouts with button in fragment with below codes:**
```
public class AuctionCurrentFragment extends BaseFragment {
@BindView(R.id.recyclerList)
RecyclerView recyclerList;
private ImageView l... | 2017/11/29 | [
"https://Stackoverflow.com/questions/47547589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9024349/"
] | You are creating adapter everytime when you are clicking the listview.Instead Create a method inside you adapter to set the itemlayout
```
public void setItemLayout(int itemLayout){
this.itemLayout = itemLayout;
notifyDataSetChanged();
}
```
Inside your onclick method call the setItemLayout method.
```
if(... | ```
recyclerView.setHasFixedSize(true);
recyclerView.setItemViewCacheSize(50);
```
this worked for me.
Recycler view executes only once. |
1,685,575 | I am aware of [another question](https://stackoverflow.com/questions/1103149/non-greedy-regex-matching-in-sed) that is quite similar, but for some reason I'm still having problems.
I have a GC log that I'm trying to *trim out* the Tenured section enclosed in `[]`.
```
63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0... | 2009/11/06 | [
"https://Stackoverflow.com/questions/1685575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/199305/"
] | Almost: s/\[Tenured:[^]]\*\]//
The manual says:
>
> To include a literal ']' in the list, make it the first character
> (following a possible '^').
>
>
>
i.e. No backslash is required in this context.
* Raz | This worked:
```
echo "63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs]" | sed -e s/\\[Tenured:[^\]]*\\]//
``` |
3,272,883 | The code snippet below works fine, but I'm having a little trouble with the `wait.until()` line:
```
wait.until(new ElementPresent(By.xpath("//a[@title='Go to Google Home']")));
```
It works but I want to send my `PageFactory` `WebElement` `homePageLink` instead:
```
wait.until(new ElementPresent(homePageLink));
`... | 2010/07/17 | [
"https://Stackoverflow.com/questions/3272883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394810/"
] | There was a request for implementation on C#.
Here it is:
```
IWebDriver driver = new ChromeDriver();
RetryingElementLocator retry = new RetryingElementLocator(driver, TimeSpan.FromSeconds(5));
IPageObjectMemberDecorator decor = new DefaultPageObjectMemberDecorator();
PageFactory.InitElements(retry.SearchContext, thi... | AjaxElementLocatorFactory uses SlowLoadableComponent internally. Check the source code [here](http://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java) |
287,507 | I just downloaded Electricsheep four days before I updated my Ubuntu software and I fell in love with it.
After I upgraded to 13.04, I'm kind of upset in saying that Electricsheep no longer works. I have no idea how to fix it and I feel helpless with Linux.
As I said, it was working completely fine in 12.10, but now... | 2013/04/28 | [
"https://askubuntu.com/questions/287507",
"https://askubuntu.com",
"https://askubuntu.com/users/153398/"
] | Here's what I did:
1. Get rid of xscreensaver: apt-get purge xscreensaver
2. Get rid of old electricsheep: apt-get purge electricsheep
3. Reinstall by following these directions precisely: <http://electricsheep.org/node/51>
Warning: This install process is why the software center was invented! ;-) It works but it tak... | I was also unable to get electricsheep to work on 13.04 and 13.10. I tried building the latest version from source using instructions at <http://electricsheep.org/node/51> but this also failed to build due to some wxWidget problems.
However, I found a solution which works, but isn't ideal: the windows version works fi... |
6,387,854 | I have a table as below;
```
<table>
<tr>
<td id="prev">prev</td>
<td class="content"></td>
<td class="content"></td>
<td class="content"></td>
<td class="content"></td>
<td class="content"></td>
<td id="next">next</td>
</tr>
</table>
```
and a PHP file, `ajax.php` for AJAX calls as;
```
<?php
$array = array(1,2,3,... | 2011/06/17 | [
"https://Stackoverflow.com/questions/6387854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/484082/"
] | Save yourself a TON of time. Use a pre-done grid solution like [DataTables](http://www.DataTables.net) that does all this work for you. It allows you to sort, filter, paginate, order, and limit your table results that can be fed via the dom, JSON, or true server-side AJAX.
Since DataTables is such a mature project, it... | This should help you get started:
```
<table id="pageLinks">
<tr>
<td id="prev">prev</td>
<td class="content">1</td>
<td class="content">2</td>
...
<td id="next">next</td>
</tr>
</table>
var currPage = 1;
$("#pageLinks tr td").click(function() {
if($(this).hasClass("content")) {
var currPage = $(this).tex... |
7,213,697 | good evening,
i need to check if the input match my regex or not
i use this pattern `'@^[a-zA-Z\@]{3,30}$@is'`
```
<?php
if( preg_match('@^[a-zA-Z\@]{3,30}$@is', 'input@input') ){ echo 'matched'; }else{ echo 'no match'; }
?>
```
if i removed the `@` char the regex still return `TRUE`
```
<?php
if( preg_match('... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7213697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893623/"
] | You can use a look-ahead assertion to assert that:
```
/^(?=[^@]*@)[a-zA-Z@]{3,30}$/is
```
Here the look-ahead assertion `(?=[^@]*@)` ensures that there is at least one `@`. | try this
```
~^[a-z]?@[a-z@]+$~i
```
If you need only 1 `@` char between a-z blocks you may use
```
~^[a-z]+@[a-z]+$~i
```
if you want to check full length of string you may use `strlen`, if you want do it for every part separately just replace `+` by `{mincnt,maxcnt}` |
7,200,281 | >
> **Possible Duplicate:**
>
> [How do you close/hide the Android soft keyboard programmatically?](https://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard)
>
>
>
First thing first I already saw [this](https://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard) thr... | 2011/08/26 | [
"https://Stackoverflow.com/questions/7200281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/640731/"
] | Try this code.
For showing Softkeyboard:
```
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm != null){
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
}
```
For Hiding SoftKeyboard -
```
InputMethodManager ... | Did you try `InputMethodManager.SHOW_IMPLICIT` in first window.
and for hiding in second window use `InputMethodManager.HIDE_IMPLICIT_ONLY`
**EDIT :**
If its still not working then probably you are putting it at the wrong place. Override `onFinishInflate()` and show/hide there.
```
@override
public void onFinishInf... |
1,793,411 | What's the advantage, for someone who is not a theoretical computer scientist, of learning a purely functional language like Haskell or Erlang instead of an "impure" language with a strong functional component, like Python or version 2 of the D programming language? My arguments are as follows:
1. No paradigm is perfe... | 2009/11/24 | [
"https://Stackoverflow.com/questions/1793411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23903/"
] | Is Erlang purely functional? I honestly thought it wasn't.
I'm not an expert on this, so take my words with a grain of salt.
Side-effects prevent (or make more complicated) lots of optimizations, including parallelism. So, in theory, going pure functional should mean better optimization for faster code, although I'm ... | Because [only pure is declarative](https://stackoverflow.com/questions/602444/what-is-functional-declarative-and-imperative-programming/15382180#15382180) at the operational semantics level. Pure functional programming (i.e. eliminating accidental dependencies) is [required for parallelism](http://existentialtype.wordp... |
7,213,927 | I use rspec, devise and cancan at the moment. To be honest, I find cancan to be very confusing and I am encountering a lot difficulties in picking it up and using it effectively. The docs are not very in depth making this extremely difficult for me to debug (check my past questions).
Is there an alternative to CanCan ... | 2011/08/27 | [
"https://Stackoverflow.com/questions/7213927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140330/"
] | Some guys are continuing the development of cancan. Check it out:
<https://github.com/CanCanCommunity/cancancan> | I'd recommend [Action Access](//github.com/matiasgagliano/action_access), it's much simpler and straightforward, has seamless integration with Rails and it's very lightweight. It boils down to this:
```
class ArticlesController < ApplicationController
let :admin, :all
let :user, [:index, :show]
# ...
end
```
... |
54,905,561 | I try to make a grep like on a PDL matrix or array of Vector :
```
my @toto;
push(@toto, pdl(1,2,3));
push(@toto, pdl(4,5,6));
my $titi=pdl(1,2,3);
print("OK") if (grep { $_ eq $titi} @toto);
```
I also tried
```
my @toto;
push(@toto, pdl(1,2,3));
push(@toto, pdl(4,5,6));
my $titi=pdl(1,2,3);
print("OK") if (grep {... | 2019/02/27 | [
"https://Stackoverflow.com/questions/54905561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3752927/"
] | The way to do this efficiently, in a way that scales, is to use [PDL::VectorValued::Utils](https://metacpan.org/pod/PDL::VectorValued::Utils#vv_intersect), with two ndarrays (the "haystack" being an ndarray, not a Perl array of ndarrays). The little function `vv_in` is not shown copy-pasted into the `perldl` CLI becaus... | You can use [`eq_pdl`](https://metacpan.org/pod/Test::PDL#eq_pdl) from [`Test::PDL`](https://metacpan.org/pod/Test::PDL):
```
use PDL;
use Test::PDL qw( eq_pdl );
my @toto;
push(@toto, pdl(1,2,3));
push(@toto, pdl(4,5,6));
my $titi = pdl(4,5,6);
print("OK\n") if (grep { eq_pdl( $_, $titi) } @toto);
```
**Output**:
... |
56,618,684 | I have a text file named Profile.txt which is in key:value pair form.
For ex:
```
Name: ABC
Father's Name: XYZ
DOB: 11-11-2011
```
How do I access value ABC by key Name so I could store it in database?
Here's the code:
```
<?php
$my_file = fopen('../img/uploads/ABC_1/Profile.txt' ,"r");
$content = fi... | 2019/06/16 | [
"https://Stackoverflow.com/questions/56618684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9639887/"
] | You could try jQuery `.after()`
Instead of :
`document.getElementById('output').innerHTML += `<p>${message}</p>`;`
try:
`$('#typing-indicator').after(`<p>${message}</p>`)`
ref: <http://api.jquery.com/after/>
```js
function send(){
var message = document.getElementById('input').value;
$('#typing-indicator').... | so you send function has to be as following
```
function send(){
var p = document.createElement("p"); // Create a <button> element
p.innerHTML = document.getElementById('input').value;;
document.getElementById('output').insertBefore(p,document.getElementById('typing-indicator')) ;
document.getElementById('out... |
14,583,761 | I have defined a class in a file named `Object.py`. When I try to inherit from this class in another file, calling the constructor throws an exception:
```
TypeError: module.__init__() takes at most 2 arguments (3 given)
```
This is my code:
```
import Object
class Visitor(Object):
pass
instance = Visitor() ... | 2013/01/29 | [
"https://Stackoverflow.com/questions/14583761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1955240/"
] | Your error is happening because `Object` is a module, not a class. So your inheritance is screwy.
Change your import statement to:
```
from Object import ClassName
```
and your class definition to:
```
class Visitor(ClassName):
```
**or**
change your class definition to:
```
class Visitor(Object.ClassName):
... | In my case where I had the problem I was referring to a module when I tried extending the class.
```
import logging
class UserdefinedLogging(logging):
```
If you look at the Documentation Info, you'll see "logging" displayed as module.
In this specific case I had to simply inherit the logging module to create an ... |
8,825,030 | I'm wondering how I can extract (get a copy) of the Default Template of a given control using Visual Studio. I know this can be done with Expression Blend (right click a control, "Edit Template" -> "Edit a Copy...") which then copies the default control template in my Xaml. But can this be done with Visual Studio at al... | 2012/01/11 | [
"https://Stackoverflow.com/questions/8825030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257558/"
] | One thing to keep in mind: if you already have a style defined somewhere that targets the given control then all of the above described options will be disabled. I had the following bit of code in my App.xaml file:
```
<Application.Resources>
<Style TargetType="Button">
<Setter Property="IsTabStop" Value="... | As far as I know it's not possible. However, you can use [Show Me The Template](http://www.sellsbrothers.com/posts/details/2091) to view the default template for a given control. |
51,457,921 | I'm trying to connect my phone to Android Studio to follow up with some app development. I am currently struggling with connecting my phone to the computer properly, as ADB never seems to connect to the device.
When attempting to boot the app on the device, this is what Android Studio tells me in the run console
```... | 2018/07/21 | [
"https://Stackoverflow.com/questions/51457921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2535257/"
] | A friend told me to try to swap ports to a USB 2.0 instead of USB 3.0. After doing so it worked instantly as expected.
[EDIT]
It appears that this has more to do with the capabilities of the motherboard than the version of USB the port is. The opposite might be true for you, or just any other port. | I had the same problem and found that the issue was solved by switching off USB debugging on the device, then switching it on again. |
13,169,298 | I can do this to search the Table for emails.
```
// controller method
public function forgot_password() {
if ($this->Session->read('Auth.User')) {
$this->redirect(array('action' => 'add'));
} else {
if ($this->request->is('post') || $this->request->is('put')) {
$user = $this->User-... | 2012/11/01 | [
"https://Stackoverflow.com/questions/13169298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37532/"
] | You could do this from your controller.
```
App::uses('Validation', 'Utility');
if (Validation::email($this->request->data('User.email'))) {
...
}
``` | I agree with @Dave that you're not quite clear about what you are trying to do.
First your access of the request data should probably be $this->request->data['User']['email']; if you are posting data in the standard form helper format.
I'm pretty sure that model validation would fail before querying the database in y... |
244,957 | I want to get a list of products from only pending orders!
i have this is code but works only for register customers i need to show product for all orders even for guests and multi store.
```
<?php
require_once 'app/Mage.php';
Mage::app();
//Get All Users/Customers
$users = mage::getModel('customer/customer')->getColl... | 2018/10/03 | [
"https://magento.stackexchange.com/questions/244957",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/65887/"
] | This issue is particularly related to the optional parameter that you are setting in the `public function __construct`.
In this particular case the original constructor parameters are like this (which is incorrect and not allowed anymore):
```
public function __construct(
\Magento\Framework\Model\Context $con... | Please replace your this "Sugarcode/Test/Model/Total/Fee.php" model file function \_construct.
```
protected function _construct()
{
$this->_init('Sugarcode\Test\Model\ResourceModel\Fee');
}
```
and check after that. |
746,525 | I have seen this character a number of times in CSS files but I have no idea how its used. Can anyone explain it to me and show how they are useful in making a page style easier? | 2009/04/14 | [
"https://Stackoverflow.com/questions/746525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59730/"
] | ```
p em
```
will match any `<em>` that is within a `<p>`. For instance, it would match the following `<em>`s:
```
<p><strong><em>foo</em></strong></p>
<p>Text <em>foo</em> bar</p>
```
On the other hand,
```
p > em
```
Will match only `<em>`s that are immediate children of `<p>`. So it will match:
```
<p>Text... | this is known as a Child Combinator:
>
> A child combinator selector was added
> to be able to style the content of
> elements contained within other
> specified elements. For example,
> suppose one wants to set white as the
> color of hyperlinks inside of div tags
> for a certain class because they have
> a d... |
162,458 | $$\ce{MnS + 2HCl -> MnCl2 + H2S}$$
If oxidation and reduction is taken to be the **loss of hydrogen** and the **gain of hydrogen** respectively, then I can see how the aforementioned reaction is redox — $\ce{S}$ gains hydrogen and is therefore reduced while $\ce{Cl}$ loses it, and hence is oxidized. But how can this b... | 2022/01/23 | [
"https://chemistry.stackexchange.com/questions/162458",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/108921/"
] | >
> If oxidation and reduction is taken to be the loss of hydrogen and the gain of hydrogen respectively...
>
>
>
The loss of hydrogen is oxidation in cases of homolytic breaking the bond with hydrogen when the electron goes away with the proton. Heterolytic losing hydrogen ion(=hydrated proton), when the electron... | Oxidation state involves a counting of valence electrons, so you have to look at whether and how electrons are transferred between atoms, not how the atoms themselves are transferred. Follow the definitions given by the IUPAC Gold Book for all species:
[Oxidation](https://goldbook.iupac.org/terms/view/R05222):
>
> 1... |
7,589,528 | I have two buttons in a row and they are shown in two td's, and its not lined up correctly in IE, I doubt that hidden spaces( ) in the td's somewhere mayby after the input or before the input button, unfortunately I cant access the html code, its automatically generated. The only way is to control by using jQuery I... | 2011/09/28 | [
"https://Stackoverflow.com/questions/7589528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852602/"
] | Rather than answering the OP's specific scenario, if we take the question title ("Is it possible to remove ' ' using JQuery..?") and answer this in a general way (which I think is useful), then any answers using `.html()` have one fundamental flaw: replacing the html this way also removes any data and event handler... | try this
```
$('#div').text($('#div').text().replace(/ /g, ' '));
``` |
800,094 | I've noticed that various services for this IP 85.222.136.21 returns different AS numbers.
For example, <http://bgp.he.net/ip/85.222.136.21#_ipinfo> says `AS14340`, while on the Whois section, there it says `AS15982`. Why is that?
I've also asked my friend from different continent to run a traceroute with AS number ... | 2016/08/30 | [
"https://serverfault.com/questions/800094",
"https://serverfault.com",
"https://serverfault.com/users/188319/"
] | [`dig`](http://linux.die.net/man/1/dig) (domain information groper) as the manual explains, is a flexible tool **for interrogating DNS name servers**, it does not query or use your local DNS cache (and/or `hosts` file) but directly queries the name server you point it at. By default that will be the one(s) from `/etc/r... | This is really an OS resolver question at its heart, but you did not specify the operating system. Since `dig` is mentioned, I'm going to assume that we're working with some flavor of UNIX here.
UNIX based operating systems do not implement a DNS cache within the kernel itself. There are a few topics that need to be s... |
26,972,822 | I am working on an application in Xcode 6.1, iOS 8.1; the application was working completely fine till 2 days before, but today as I executed it I got an error in the web service & the error is printed below.
>
> Error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed
> out." UserInfo=0x7c6899b0 {NSErrorF... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26972822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3840908/"
] | Ok, I lost a lot of time investigeting similar issue.
In my case the problem was strange (bad?) firewall on the server. It was banning device when there was many (not so many) requests in short period of time.
I believe you can do easy test if you are facing similar issue.
1. Send a lot of (depends of firewall setti... | You must close the firewall and it will work. I tried this solution and it worked for me. |
48,104,433 | In **Chrome 61**, support for modules in JavaScript was added. Right now I am running Chrome 63.
I am trying to use `import`/`export` syntax in Chrome extension content script to use modules.
In **`manifest.json`**:
```
"content_scripts": [
{
"js": [
"content.js"
],
}
]
```
In *... | 2018/01/04 | [
"https://Stackoverflow.com/questions/48104433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444998/"
] | The best way would be to use bundlers like webpack or Rollup.
I got away with basic configuration
```
const path = require('path');
module.exports = {
entry: {
background: './background.js',
content: './content.js',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../build')
... | Export the module as a object:
```
'use strict';
const injectFunction = () => window.alert('hello world');
export {injectFunction};
```
Then you can import its property:
```
'use strict';
import {injectFunction} from './my-script.js';
``` |
10,335,741 | I need to create `generic list` that can act as `List<ClassA>` or `List<ClassB>` because I have following situation.
```
if(e instanceof A)
return A;
else
return B
```
But I want to populate one `List Result` which can act as either `List<ClassA> Result` or `List<ClassB> Result`, am sure we can use generics here bu... | 2012/04/26 | [
"https://Stackoverflow.com/questions/10335741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/164299/"
] | You should use a common interface that both of your classes implement. Say your interface is called `MyInterface`. Both of your classes can implement this interface and your generic list can be of type `List<MyInterface>`.
The alternative is that both of your classes have a common base class.
**Edit:**
Added some ex... | Something like this perhaps:
```
public class Test {
static class A {}
static class B {}
private static List<?> getList() {
List<A> aList = new ArrayList<A>();
List<B> bList = new ArrayList<B>();
aList.add(new A());
if (aList.size() > 0) {
return aList;
} else {
return bList;
... |
30,405,413 | I import a dataframe via `read_csv`, but for some reason can't extract the year or month from the series `df['date']`, trying that gives `AttributeError: 'Series' object has no attribute 'year'`:
```
date Count
6/30/2010 525
7/30/2010 136
8/31/2010 125
9/30/2010 84
10/29/2010 4469
df = pd.read_csv('sample... | 2015/05/22 | [
"https://Stackoverflow.com/questions/30405413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4263878/"
] | If you're running a recent-ish version of pandas then you can use the datetime attribute [`dt`](http://pandas.pydata.org/pandas-docs/stable/api.html#datetimelike-properties) to access the datetime components:
```
In [6]:
df['date'] = pd.to_datetime(df['date'])
df['year'], df['month'] = df['date'].dt.year, df['date'].... | Probably already too late to answer but since you have already parse the dates while loading the data, you can just do this to get the day
```
df['date'] = pd.DatetimeIndex(df['date']).year
``` |
61,139 | In quantum mechanics, we think of the Feynman Path Integral
$\int{D[x] e^{\frac{i}{\hbar}S}}$ (where $S$ is the classical action)
as a probability amplitude (propagator) for getting from $x\_1$ to $x\_2$ in some time $T$. We interpret the expression $\int{D[x] e^{\frac{i}{\hbar}S}}$ as a sum over histories, weighted by... | 2013/04/15 | [
"https://physics.stackexchange.com/questions/61139",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/8163/"
] | Up to a universal normalization factor, $\exp(iS\_{\rm history}/\hbar)$ *is* the probability amplitude for the physical system to evolve along the particular history. All the complex numbers in quantum mechanics are "probability amplitudes of a sort".
This is particularly clear if we consider the sum over histories i... | At a time when my hammer was the Dirac's delta distribution, I *conjectured* that the answer was **Feynman Integral is a generalization of a Dirac's delta**, the use of this delta being to find the extreme of the action.
Given a function $f(x)$, find a
Dirac measure $\delta\_f$ concentrated in the critical points of ... |
22,243,718 | Hey guys I am attempting to save an image in my android applicaiton as a blob in mysql database, as far as the actual code goes. I would love some help as for how to connect to the database in the first place, using the html docs and the actual android code itself. | 2014/03/07 | [
"https://Stackoverflow.com/questions/22243718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2159030/"
] | Do not save the image itself in DB. Better is it to save the image on your server and only save the path to the image (relative) in DB. Send the needed image to the phone. | You can encode your image in string using base64. & while accessing from mysql sever decode it again |
8,169,999 | I've gone through the steps detailed in [How do you use https / SSL on localhost?](https://stackoverflow.com/questions/5874390/how-do-you-use-https-ssl-on-localhost) but this sets up a self-signed cert for my machine name, and when browsing it via <https://localhost> I receive the IE warning.
Is there a way to create ... | 2011/11/17 | [
"https://Stackoverflow.com/questions/8169999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4782/"
] | You can use PowerShell to generate a self-signed certificate with the new-selfsignedcertificate cmdlet:
```
New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation "cert:\LocalMachine\My"
```
Note: makecert.exe is deprecated.
Cmdlet Reference:
<https://technet.microsoft.com/itpro/powershell/windows/pkicli... | Here's what I did to get a valid certificate for localhost on Windows:
1. Download mkcert executable (<https://github.com/FiloSottile/mkcert/releases>) and rename it to mkcert.exe
2. Run "mkcert -install"
3. Open Windows certificate manager (certmgr.msc)
4. Right click on "Trusted Root Certification Authorities" -> Im... |
14,154 | I am trying to perform a hashing trick and then a random forest with scala. I have the following code:
```
val documents: RDD[Seq[String]] = sc.textFile("hdfs:///tmp/new_cromosoma12v2.csv").map(_.split(",").toSeq)
val hashingTF = new HashingTF()
val tf: RDD[Vector] = hashingTF.transform(documents)
val splits = tf.ra... | 2016/09/22 | [
"https://datascience.stackexchange.com/questions/14154",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/8710/"
] | Let's look at the error message:
```
found : Array[org.apache.spark.mllib.linalg.Vector] required: org.apache.spark.mllib.linalg.Vector
```
"found" is the type of object that it came across, "required" is the type of the object that the function accepts. The types look mostly the same ( org.apache.spark.mllib.linalg... | `LabeledPoint` expects: `LabeledPoint(label: Double, features: Vector)`
when you execute `val trainingData2=LabeledPoint(1.0,trainingData.collect())` you're actually getting all the Rows in your trainingData set so you will have `Array(Row(???), Row(???), ???)` but what you need is to apply `def transformToLabeledPoin... |
2,816,285 | Let's just I had the following code:
**foo.h**
```
class Foo
{
// ...
};
```
**foo.cpp**
```
#include "foo.h"
// Functions for class Foo defined here...
```
Let's say that `Foo` are built into a static library `foo.lib`.
Now let's say I have the following:
**foo2.h**
```
class Foo
{
// ...
};
```
**... | 2010/05/12 | [
"https://Stackoverflow.com/questions/2816285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22489/"
] | No, neither compiler nor linker required to complain. They might; but it's not required.
See the [One Definition Rule](http://en.wikipedia.org/wiki/One_Definition_Rule). | Part of the issue is that each class is in a static library. Linkers treat static libraries specially and only extract the necessary objects to satisfy missing symbols that have linkage.
Whether you get a linking error or not will depend on what symbols each implementation of foo has and how they are packaged up toget... |
12,216,720 | I have a WCF method:
```
public IQueryable<AmenitySummary> GetAmenities(string searchTerm)
```
Now, `AmenitySummary` is defined thus
```
[DataContract]
public class AmenitySummary
{
[DataMember]
public int AmenityId { get; set; }
[DataMember]
public string Amenity { get; set; }
[DataMember]
... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12216720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/991788/"
] | Here you go:
```
SELECT
JobName,
SUM(CASE CounterName WHEN 'Kilos' THEN ProductionCounter ELSE 0 END) AS SumKilos,
SUM(CASE CounterName WHEN 'Bars' THEN ProductionCounter ELSE 0 END) AS SumBars,
MIN(StartDate),
MAX(COALESCE(EndDate, 'undefined date')),
MAX(Stage)
FROM vwOeeInterval
WHERE CounterName IN ('Kilos', '... | ```
select jobname, max(bars) as "TotalBars", max(kg) as "Total Kilos", sd as "Start date", ed as "End date" from(
SELECT JobName, if(countername="bars",SUM(ProductionCounter),null) as "bars" , if(countername="kilograms",SUM(ProductionCounter),null) as "kg" , min(startdate) as sd, max(enddate) as ed
FROM vwOeeInterval
... |
181,338 | I have two servers: one that runs Apache and another one just for MySQL. I don't have any monitoring tools installed on any of them.
Every once in a while it appears that my SQL queries are running very very slow (queries that would normally run in 0.3 seconds now take 20 seconds). I don't know if this is a MySQL iss... | 2010/09/15 | [
"https://serverfault.com/questions/181338",
"https://serverfault.com",
"https://serverfault.com/users/25543/"
] | Analyzing the slow query log is a good idea.
My guts tells me though that you are using MyISAM storage engine for your tables and suddenly there's a spike in delete/update/insert activity combined with some long-running selects ... that leads to all kind of funky stuff with MyISAM, whereas with InnoDB everything stays... | I've used [mytop](http://jeremy.zawodny.com/mysql/mytop/) to get slow queries very often. When our webmasters start complaining about the performance of the (virtual) mysql server, I ask them politely to come and watch the output of mytop together. We find the culprit query very easily like this and from there you know... |
16,724,869 | The function below is breaking at the first `if` statement in IE8. I'm not sure what would cause this since from what I have researched none of this should cause an issue. I also tried adding the `toLowerCase()` method after the `referrer` property as well, still no luck. Any ideas?
```
function returnToLogin() {
... | 2013/05/23 | [
"https://Stackoverflow.com/questions/16724869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1211604/"
] | IE doesn't always set the `document.referrer` property. The solution is to check if it is defined before calling methods on it. Change your `if` to:
```
if (document.referrer&&document.referrer.indexOf('attendant_login') > 0) {
```
Now if `document.referrer` doesn't exist, it won't try to call the `indexOf` method o... | IE has problems with using `Array.indexOf()`. Use `jQuery.inArray()` instead. |
11,062,841 | How can I start and stop a windows service from a c# Form application? | 2012/06/16 | [
"https://Stackoverflow.com/questions/11062841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1083913/"
] | Add a reference to `System.ServiceProcess.dll`. Then you can use the [ServiceController](http://msdn.microsoft.com/en-us/library/yb9w7ytd) class.
```
// Check whether the Alerter service is started.
ServiceController sc = new ServiceController();
sc.ServiceName = "Alerter";
Console.WriteLine("The Alerter service stat... | You can do it like this, [Details of Service Controller](http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx)
```
ServiceController sc = new ServiceController("your service name");
if (sc.Status == ServiceControllerStatus.Stopped)
{
sc.Start();
}
```
Similarly you can stop using s... |
47,026,578 | (I have read other answers on SO, but they do not appear to address the problem at hand.)
[Swift 4, Xcode 9]
I need to get the path representing the drawn areas following the `stroke()` of a path. i.e. a path that represents the outline of the stroke.
Given a `UIBezierPath` with the following attributes:
```
let do... | 2017/10/31 | [
"https://Stackoverflow.com/questions/47026578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1452758/"
] | [EDITED]
My previous answer was incorrect.
Using CGPath's `copy(dashingWithPhase: phase, lengths: pattern)` will not work in this situation. Despite the method's description, it will not actually produce a *full* outline path of the resulting stroke.
A working solution is:
* create a temporary `CGContext`
* on the... | Since there are two different algorithms discussed here, let me show the difference:
```
cgPath.copy(dashingWithPhase: phase, lengths: pattern)
```
creates one-dimensional polylines as subpaths that are *not* closed for each dash. They do not contain a `closeSubpath` element. "strokes"
on the other hand
```
contex... |
11,656,071 | I have four (relevent) tables
```
CAKETABLE
CAKE ICING
RESERVEDSPRINKLES
CAKE SPRINKLE
SPRINKLETABLE
SPRINKLE CONSUMED
ICINGTABLE
ICING CONSUMED
```
Each cake has exactly 3 sprinkles and 1 icing.
I want to query the database and get all the cakes that have 1 icing and 3 sprinkles where neither ici... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11656071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1065671/"
] | You can use `not exists` to demand that no icing or sprinkle is consumed:
```
select cake
from caketable c
where not exists
(
select *
from icingtable i
where i.cake = c.cake
and i.consumed = '1'
)
and not exists
(
select *
... | I think the following does what you want:
```
select ct.cake
from caketable ct join
reservedsprinkle rs
on ct.cake = rs.cake join
sprinkletable st
on rs.sprinkle = st.sprinkle join
icingtable it
on ct.cake = it.cake
where it.consumed = 0
group by ct.cake
having count(distinct rs.sprinkle)... |
34,740,362 | I've the following Java program and I don't want "," to be assign after my last element, what to do ?
```
String range = "400-450";
Integer startRange = null;
Integer endRange = null;
StringTokenizer st = new StringTokenizer(range,"-");
while(st.hasMoreTokens()) {
startRa... | 2016/01/12 | [
"https://Stackoverflow.com/questions/34740362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As @Jan says, use `StringJoiner` if you have Java8. Otherwise you could add a separator before the new entry and treat the first item differently by initialising the separator to blank.
```
String separator = "";
for (int i = startRange; i <= endRange; i++) {
sb.append(separator).append(i);
sepa... | Just let the last loop appending the commas stop before the last element is reached:
```
String range = "400-450";
Integer startRange = null;
Integer endRange = null;
StringTokenizer st = new StringTokenizer(range,"-");
while(st.hasMoreTokens()) {
startRange = Integer.par... |
17,135,109 | I am following Scott gu's trick of placing a App\_Offline.htm page at the route of my application to bring it offline - <http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx>
It does not seem to be working on one of my sites though. I place the file in IIS7 of one my sites, and all traffic is redirected to it... | 2013/06/16 | [
"https://Stackoverflow.com/questions/17135109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373674/"
] | I had this issue with a MVC site recently, and I managed to solve it by replacing the web.config I originally had with a clean, minimal one when wanting to use the app\_offline.htm file.
```
<?xml version="1.0"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
... | Here's how you do it using the GUI (note the last line - that's the one you should add/edit)
[](https://i.stack.imgur.com/7vOB2.png) |
208,959 | I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values.
I'm curious if there is a good way in C++ to store variant data for a situation like th... | 2008/10/16 | [
"https://Stackoverflow.com/questions/208959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21254/"
] | As of C++17, there’s [`std::variant`](http://en.cppreference.com/w/cpp/utility/variant).
If you can’t use that yet, you might want [Boost.Variant](http://www.boost.org/doc/libs/1_36_0/doc/html/variant.html). A similar, but distinct, type for modelling polymorphism is provided by [`std::any`](http://en.cppreference.com... | You can also go down to a more C-ish solution, which would have a void\* the size of a double on your system, plus an enum for which type you're using. It's reasonably clean, but definitely a solution for someone who feels wholly comfortable with the raw bytes of the system. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.