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 |
|---|---|---|---|---|---|
7,053,355 | So here is my problem:
I have an AppDelegate with a navigationController:
```
[self.window addSubview:navigationController.view];
```
In there i put an presendModalViewController:
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[self navigationC... | 2011/08/13 | [
"https://Stackoverflow.com/questions/7053355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/719261/"
] | You can use [`all()`](https://docs.python.org/3/library/functions.html#all) with a [generator expression](https://docs.python.org/3/reference/expressions.html#generator-expressions):
```
>>> all(x in dct for x in ('foo', 'bar', 'qux'))
False
>>> all(x in dct for x in ('foo', 'bar', 'baz'))
True
>>>
```
It saves you... | ```
all(x in dct for x in ('foo','bar','baz'))
``` |
315,004 | I am in the process of getting rid of `gnome-keyring` as an SSH agent.
Things that I have done
=======================
* Searched the internet for hours.
* Changed stuff and restarted, often.
* Finally just `rm`-ed all the autostart stuff related to SSH.
That last thing magically worked as there is **no more** the s... | 2016/10/07 | [
"https://unix.stackexchange.com/questions/315004",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/192872/"
] | *(OP's environment is not known, so the paths given here are those found on my Ubuntu machine)*
Where does gnome-keyring set SSH\_AUTH\_SOCK?
---------------------------------------------
To answer the main question in title, SSH\_AUTH\_SOCK is set by gnome-keyring in `/usr/share/upstart/sessions/gnome-keyring-ssh.co... | <https://wiki.archlinux.org/index.php/GNOME/Keyring#Disable_keyring_daemon_components>
>
> If you wish to run an alternative SSH agent (e.g. ssh-agent or gpg-agent, you need to disable the ssh component of GNOME Keyring. To do so in an account-local way:
>
>
>
> ```
> mkdir ~/.config/autostart
> cp /etc/xdg/autost... |
237 | I always feel that I should buy a Canon lens for my Canon camera, and Sigma would just be a cheap knock-off. Is that the case? | 2010/07/15 | [
"https://photo.stackexchange.com/questions/237",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/93/"
] | My wife and I own three Sigma lenses: the "bigma" (50-500mm), my 17-70mm f/2.8-4, and her 30mm f/1.4 prime. We absolutely love them, for their respective strengths:
* Noone touches the Bigma for range. Yes, it's soft. Yes, it's unbelievably big and heavy. But it's a disturbingly versatile lens.
* The 30mm is [incredib... | My experience is that some of the primes are on a par with their Canon equivalents - the 24mm f/1.8 and the 180mm macro are really good. The AF is always much slower. I find the colour cast different to the Canon L lenses - which are consistent with each other in my experience - but haven't found this to be a problem. |
352,697 | Every depiction I have seen shows the Eclipse path of totality travel Eastward from Oregon. Why Doesn't the path travel Westward from South Carolina as the Earth rotates Eastward? Shouldn't the Totality follow the Path of the Sun? | 2017/08/19 | [
"https://physics.stackexchange.com/questions/352697",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/165188/"
] | The answer posted by Sammy Gerbil is quite wrong. The passage of the eclipse from west to east has nothing to do with the sun overtaking the moon in the sky.
Sammy does correctly point out that, as viewed from above, the moon is circling the earth in a counterclockwise direction. And that means it is travelling from w... | As Earth orbits the Sun, the Sun appears to move to the east against the background stars by about 1°/day --- completing its apparent route around the ecliptic in about 365 days.
As the Moon orbits the Earth, the Moon appears to move to the east against the background stars by about 12°/day --- completing its apparent... |
1,829,013 | I'm having trouble understanding what the purpose of the `virtual` keyword in C++. I know C and Java very well but I'm new to C++
From wikipedia
>
> In object-oriented programming, a
> virtual function or virtual method is
> a function or method whose behavior
> can be overridden within an inheriting
> class... | 2009/12/01 | [
"https://Stackoverflow.com/questions/1829013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357024/"
] | >
> As you can see below, the function A::a is successfully overridden with B::a without requiring virtual
>
>
>
It may, or it may not work. In your example it works, but it's because you create and use an `B` object directly, and not through pointer to `A`. See [C++ FAQ Lite, 20.3](http://www.parashift.com/c++-fa... | Say you instantiated B but held it as an instance of an A:
```
A *a = new B();
```
and called function a() whose implementation of a() will be called?
If a() isn't virtual A's will be called. If a() was virtual the instantiated sub class version of a() would be called regardless of how you're holding it.
If B's co... |
31,709,075 | I'm doing a conditional search of part of a dataset that has multiple NA values within each row.
Something like this (a preview)..
```
time1 time2 time3 time4 slice1 slice2 slice3 slice4
pt1 1 3 NA NA NA 1 3 5
pt2 NA 1 3 5 5 2 2 4
```
I want... | 2015/07/29 | [
"https://Stackoverflow.com/questions/31709075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5065420/"
] | From [here](http://tldp.org/LDP/abs/html/x9644.html) -
>
> Within a script, running a command in the background with an ampersand (&)
> may cause the script to hang until ENTER is hit. This seems to occur with
> commands that write to stdout.
>
>
>
You should try redirecting your output to some file (or null if... | Why don't you trying using a separate thread?
Wrap up your process into something like
```
def run(my_arg):
my_process(my_arg)
thread = Thread(target = run, args = (my_arg, ))
thread.start()
```
Checkout join and lock for more control over the thread execution.
<https://docs.python.org/2/library/threading.html> |
13,913,923 | As output I have for `Range("H" & temp).Cells` :
```
234
0
(Empty)
2
```
I want to convert it into `long` or `int`, because it's a text value. So I did
```
Range("H" & temp).Cells = CInt(Range("H" & temp).Cells)
```
It works perfectly for 234, 0 and 2 but when the cell is empty it shows me error. What should ... | 2012/12/17 | [
"https://Stackoverflow.com/questions/13913923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847877/"
] | If you need to do this in formula, you can use this:
IF(IFERROR(VALUE(A1)); 0; A1) | ```
Sub t()
Dim colNum As Long
colNum = Range("H1").Column 'please coustomize which column
For i = 1 To 4 'Please customize the row range
Cells(i, colNum).Value = CLng(Cells(i, colNum).Value) 'blank --> 0
Cells(i, colNum).NumberFormat = "0.00" 'also changes the numberFormat
Next i
End Sub
``` |
758,158 | I am trying to use $f(x)=x^3$ as a counterexample to the following statement.
If $f(x)$ is strictly increasing over $[a,b]$ then for any $x\in (a,b), f'(x)>0$.
But how can I show that $f(x)=x^3$ is strictly increasing? | 2014/04/17 | [
"https://math.stackexchange.com/questions/758158",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/133993/"
] | You want to show that the function $f(x) = x^3$ is strictly increasing on $\mathbb{R}$.
Maybe you can just use the definition. That is, let $a < b$. Assume that $0<a$ (you can do the other cases I am sure). Let $h = b - a < 0$. You want to show that $f(a) < f(b)$.
So
$$\begin{align}
f(a) = a^3 &= (b - h)^3\\ &= b^3 -... | Here is an intuitive proof that could be made rigorous using Lebesgue measure.
Start with $x>0$. Place a cube with edge length $x$ so that it has three faces on the coordinate planes in three-dimensional space and two corners at $(0,0,0)$ and at $(x,x,x)$. Then $f(x)=x^3$ is the volume of the cube.
Strict monotonic... |
324,042 | I would like to print a number of 256-bit long hashes in hexadecimal (so 64 characters, I'm skipping the usual "0x" without white spaces or punctuation) in line and using a monospaced font.
So, I first went for \texttt, which does not hyphenate my strings.
I saw some questions with interesting answers, such as [How to... | 2016/08/09 | [
"https://tex.stackexchange.com/questions/324042",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/80719/"
] | There is already a package for this:
```
\documentclass{article}
\usepackage{seqsplit}
\newcommand{\hash}[1]{{\ttfamily\seqsplit{#1}}}
\begin{document}
SHA-256 is a hash function with a 256-bit long output:
\hash{d270f747a8743f11aef93c10e9cb6932cc0b862464c1133dc0f8889088740d15}
\end{document}
```
[![enter image ... | Solution Making TeX Treat Characters like Words
===============================================
This works, but has the limitation that denoted characters do not work. e.g. using hexidecimal (`\char"02C6`) or octal notation.
```
\documentclass{article}
\def\hash#1{\xscan#1\relax}% calls xscan which looks ahead one t... |
39,390,445 | `New` operator is often confusing for me, and using it can lead to memory leaks if I forget to use `delete`. Every time I have to allocate an array of objects without knowing its length at compile time, I just use `std::vector`. What is the point of using `new`?
Also, why would I need to use `new` operator to allocate... | 2016/09/08 | [
"https://Stackoverflow.com/questions/39390445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4746978/"
] | For normal use of dynamic arrays in most code, use `std::vector`. This is clearly the default and prevents many issues.
However, when you know what you are doing and you want some performance gain in special cases, you might want to see whether `new` or `malloc` could help you. Preferrably, you make a new specialized ... | I think your question is related to two things:
1. The usage of new operator: I just want to make one example. Managing memory with "new" and "delete" gives the programmer control of the program. Some program languages have Garbage Collection, but we don't know when GC will work, which causes uncertainty. However, wit... |
15,398,499 | After users registration I sent an email to activate the account, but user can log in even the account have not been activated. How can I validate if users account in activated?
```
if (Auth::attempt(array('email' => $email, 'password' => $password))) {
// Success login
} else {
// Login fail
}
``` | 2013/03/13 | [
"https://Stackoverflow.com/questions/15398499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/833394/"
] | ```
if (Auth::attempt(array('email' => $email, 'password' => $password, 'active' => 1)))
{
// The user is active, not suspended, and exists.
}
```
[Authenticating Users](http://laravel.com/docs/security#authenticating-users)
In Laravel 5.3 you might want to overwrite `Illuminate\Foundation\Auth\AuthenticatesUser... | Send a link to the users email with a secret key, the key has to be unique, such as a hash of their email address with your application secret key as a salt. Have an endpoint that this link points to which checks that the link is valid using the procedure I mentioned above. If the key you generate matches the one in th... |
108,156 | I am maintaining a legacy cygwin (with GNU tar v1.21) system and a legacy Solaris 9 system. The configuration of the Solaris 9 system is fixed and cannot be upgraded (i.e. I can't install gnu tar for Solaris).
I am trying to create a tarball on the cygwin system that can extracted on the Solaris 9 system but unfortuna... | 2014/01/07 | [
"https://unix.stackexchange.com/questions/108156",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/56096/"
] | Solaris tar and GNU tar have different interpretations of posix but both support ustar, which in turn [supports long(ish) pathnames](http://www.gnu.org/software/tar/manual/html_node/Formats.html#SEC132 "supports long pathnames").
Using GNU tar on cygwin:
```
$ tar -c --format=ustar -f dir.tar dir
```
This creates a... | [GNU tar formats](http://www.gnu.org/software/tar/manual/html_section/Formats.html#SEC132) suggests `tar -c --format=posix` or `tar -c --format=pax` is the only way to create a portable tar file containing path names longer than 255 characters.
The [Solaris tar man page](http://docs.oracle.com/cd/E19683-01/816-0210/6m... |
944 | [*Ars Goetia*](https://en.wikipedia.org/wiki/Lesser_Key_of_Solomon#Ars_Goetia) is a well-known book about demonology written in Mediaeval Latin. I'm having trouble analyzing the grammatical structure of the title. *Ars* is a feminine noun in the singular nominative form. *Goetia* looks like it is feminine and in the si... | 2016/05/26 | [
"https://latin.stackexchange.com/questions/944",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/9/"
] | I'd say *goetia* is clearly a noun, as you say. Some points to consider:
1. Nouns are sometimes used as adjectives: *victor exercitus* -- the victorious army (A&G, § 321 c);
2. There was some confusion as to what this word actually referred to.
See, e.g., Du Cange's entry:
>
> Getia, *Maleficiorum doctrina*. Gloss... | As you say, γοητεία “sorcery, witchcraft” is a noun. Apparently some mediaeval Latinist mistook it for the feminine singular nominative of an adjective. Classical Latin does have words like “musica” as a synonym for “ars musica”, so it could be that someone thought you could equate “goetia” with “ars goetia”, but this ... |
280,767 | I found something for videos, which looks like this.
```
ffmpeg -i * -c:v libx264 -crf 22 -map 0 -segment_time 1 -g 1 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*9)" -f segment output%03d.mp4
```
I tried using that for an audio file, but only the first audio file contained actual audio, the others were si... | 2016/05/03 | [
"https://unix.stackexchange.com/questions/280767",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/79979/"
] | To split a big audio file into a set of tracks with varying lengths, you can use the following command:
```
# -to is the end time of the sub-file
ffmpeg -i BIG_FILE -acodec copy -ss START_TIME -to END_TIME LITTLE_FILE
```
For example, I broke up a single .opus file of the Inception Original Soundtrack into sub-files... | Great python script by @isosceleswheel, I've just used it, but I made some modification of my own, so you can name the tracks with spaces.
Line 18 -> cmd\_string = 'ffmpeg -i {tr} -acodec copy -ss {st} -to {en} "{nm}".opus'
"{nm}", quotes, to take entire string as literal.
Line 28 -> start, end, name = line.strip().... |
45,836,075 | How to change or replace text under div, tag, row with JS. Here is the code:
```
$(document).ready(function() {
$("div .row .col-sm-4").each(function() {
if ($(this).text() == "Registrant ID:") {
$(this).text().replace("Registrant Number:");
}
});
});
```
HTML Code Here :
```
<div class="row">
<... | 2017/08/23 | [
"https://Stackoverflow.com/questions/45836075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8384919/"
] | Try like this.
```js
var data = {
"questions": {
"0": {
"0": "17",
"1": "12"
},
"1": {
"0": "22",
"1": "34"
},
"2": {
"0": "52",
"1": "61"
}
}
}
console.log(data.questions["... | You get the result without `Object.keys`.
```js
var data = { questions: { 0: { 0: "17", 1: "12" }, 1: { 0: "22", 1: "34" }, 2: { 0: "52", 1: "61" } } };
console.log(data.questions[0]); // { 0: "17", 1: "12" }
console.log(data.questions[0][0]); // 17
console.log(data.questions[0][1]); // 12
```
For searching a ... |
22,638,468 | I have this code
```
if (ScalarReturned is DBNull)
{
xCount = 0;
}
else
{
xCount = (Int32)ScalarReturned;
}
```
which works great but was just wanting to convert to an inline IF -- I tried below but get multiple compile errors. Can someone assist with this?
```
if (ScalarReturned is DBNull) ? xCount = 0 : ... | 2014/03/25 | [
"https://Stackoverflow.com/questions/22638468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954053/"
] | Do this:
```
xCount = ScalarReturned is DBNull || ScalarReturned == null ? 0 :
(Int32)ScalarReturned;
```
How it works:
Ternary operator acts a bit like function. Only thing here is, you don't need `return` keyword.
In plain English:
Assign 0 to xCount if... | The ternary operator works as follows:
```
condition ? true result : false result
xCount = (Int32)((ScalarReturned is DBNull || ScalarReturned == null) ? 0 : ScalarReturned);
``` |
17,417,256 | I want to display div on page load e.g."campaign-alert", but I am not able to do this .
This is sample code :
```
<div id="popup">
<div id="campaign-alert" style="display:none;">
.
.
.
</div>
</div>
```
I have tried this way as well :
```
document.getElementById('campaign-alert').style.display=""; ... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17417256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2527554/"
] | Try this. It will help you.
Using Jquery
```
$(document).ready(function () {
$("#campaign-alert").show();
});
```
Using JavaScript
```
window.onload = function () {
document.getElementById("campaign-alert").style.display = "block";
};
``` | You shaould try it using onload()
**HTML:**
```
<body onload="load()">
<div id="popup">
<div id="campaign-alert" style="display:none;">
.
.
.
</div>
</div>
</body>
```
**Javascript:**
```
function load(){
document.getElementById('campaign-alert').style.display="block";
}
``` |
109,810 | I was wondering what and why you would choose to be able to make a database that can support no more than 100 users with no more than 10 using it at once with a Visual Studio 2008 C# Windows Form front end to access it by. I have to access the database over a network connection, not just on the local machine. I also ne... | 2008/09/20 | [
"https://Stackoverflow.com/questions/109810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19802/"
] | I would probably go with Sql Server Express, it's free and works well with .NET. Assuming your schema is not changing at runtime you can probably still use the design time data source features in Visual Studio. The connection information is stored in the app.config file which you can update after the app is deployed to... | I'm not sure I totally get what you are asking, Matt, but I can tell you that I developed a series of apps written with VS 2008 and we used a MySQL DB for it. While I'm definitely not a DB guru at this point, I've not had many issues with using MySQL.
Perhaps if you rephrase your question, we can provide better answer... |
55,207,940 | ```
import pandas as pd
df = pd.read_csv('https://query.data.world/s/Hfu_PsEuD1Z_yJHmGaxWTxvkz7W_b0')
d= df.loc[df.isnull().sum(axis=1)>5]
d.dropna(axis=0,inplace=True)
print(round(100*(1-df.count()/len(df)),2))
```
i m getting output as
```
Ord_id 0.00
Prod_id 0.00
Ship_id ... | 2019/03/17 | [
"https://Stackoverflow.com/questions/55207940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11143510/"
] | Try this way:
```
df.drop(df[df.isnull().sum(axis=1)>5].index,axis=0,inplace=True)
print(round(100*(1-df.count()/len(df)),2))
``` | This works:
```
import pandas as pd
df = pd.read_csv('https://query.data.world/s/Hfu_PsEuD1Z_yJHmGaxWTxvkz7W_b0')
df = df[df.isnull().sum(axis=1)<5]
print(df.isnull().sum())
``` |
42,972,575 | I am using two `TextView`s to show contact name and company name, one below another with the use of DataBinding technique. Company name is optional field, so it can disappear.
**1.** I have been using such method in **item\_contact.xml** :
```
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>... | 2017/03/23 | [
"https://Stackoverflow.com/questions/42972575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6026222/"
] | Ok, summing up. Finally I have finished everything and it is working as I wanted, so if there is only one `TextView` visible than it is centralized verticaticaly, or if there are both `TextView`s visible, both of them are centered.
**item\_contact.xml** :
```
<layout xmlns:android="http://schemas.android.com/apk/res/... | This is a perfect case for using [ConstraintView](https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html).
Its support for "missing" views is much better. |
48,928,330 | When I try any kubectl command, it always returns:
```text
Unable to connect to the server: EOF
```
I followed these tutorials:
>
> <https://kubernetes.io/docs/tasks/tools/install-kubectl/>
>
>
> <https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/>
>
>
>
But they ... | 2018/02/22 | [
"https://Stackoverflow.com/questions/48928330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7288685/"
] | After Minikube is started, **kubectl** is configured automatically.
```
minikube start
Starting local Kubernetes cluster...
Kubernetes is available at https://192.168.99.100:8443.
Kubectl is now configured to use the cluster.
```
You can verify and validate the cluster and context with following commands.
```
kubec... | Check your VPN security as well as your anti virus internet security. in case it is ON then we have to make it off. and it worked for me after that.
Try it out this also. |
6,273,293 | I swear I've seen people add multiple background images to an element using the :after selector. For whatever reason, I can't get it to work. What am I doing wrong? Can anyone point me to a working example?
```
#el li { background:url(image1.jpg) top center;}
#el li:after { background:url(image2.jpg) bottom center;}
... | 2011/06/08 | [
"https://Stackoverflow.com/questions/6273293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/586706/"
] | `:before` and `:after` always need the following:
```
{
content: '';
}
``` | You can do it, but I've never tried. `:after` seems to create an inline-like element after your element. You can try adding this CSS (no idea if it works):
```
display: block;
position: relative;
top: -200px;
height: 200px;
width: 200px;
``` |
3,210,133 | I am not sure how to find the $x$ values of $2\cos(2x)-2\sin(x)=0$.
I am trying to find the absolute values of $f(x)=2\cos(x)+\sin(2x)$ in the range$[0, \frac{\pi}{2}]$.
I have differentiated $f(x)$ to produce $2\cos(2x)-2\sin(x)$, but I am unsure how to find the zeros of the function since I cannot think of a value... | 2019/05/01 | [
"https://math.stackexchange.com/questions/3210133",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/601849/"
] | You don't need any calculus to do this:
$$ 0=2\cos(2x)-2\sin(x) = 2(\cos^2x -\sin^2x -\sin x) = 2(1-\sin x - 2\sin^2x). $$
which is a quadratic equation (substitute $y=\sin x$). | **Hint**:
Rewrite the equation as $\;\cos(2x)=\cos \bigl(\frac\pi 2-x\bigr)$.
Then use that $$\cos\alpha=\cos\beta\iff \alpha\equiv\pm\beta \pmod{2\pi}.$$ |
58,006,255 | My application is in final stages and we have not implemented autofocus on input tags. Now we have a requirement where we wish to put focus on first input tag in each of the page.
There are lot of pages/forms in my application, so using ViewChild in each component can be a tedious task.
Hence I'm looking for some way... | 2019/09/19 | [
"https://Stackoverflow.com/questions/58006255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I came up with a method decorator which would do what you want. That is, if you don't mind to import this function to all pages. You would then simply attach this decorator to the `AfterViewInit` life cycle, like so:
```ts
@setFocus()
ngAfterViewInit() { }
```
The decorator function would then search after the first... | you can use tabindex property of HTML
element with tabindex="1" will receive focus first
eg:
see:<https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex>
:<https://developer.paciellogroup.com/blog/2014/08/using-the-tabindex-attribute/>
NB: Be careful using tabindex as it imposes a tab order ... |
9,559 | If it is even possible, what would the Goldilocks zone be like - in fact is such a system even possible of holding life - around a binary black hole? Could it have planets orbiting it?
EDIT 1: Oh well, no star no life. So now, how would it look like if there is a star that orbits the binary black hole system? Would th... | 2015/02/03 | [
"https://worldbuilding.stackexchange.com/questions/9559",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/6429/"
] | **Would there be a goldilocks zone?**
Probably around the star, but *not* in the way of the black holes.
**Would it be stable?**
No, I don't think it would.
Black holes are massive(read:*heavy*), as are stars. All massive objects produce gravity and are affected by gravity. All three would interact in a rather cha... | A black hole would act gravitationally towards an orbiting mass in the same way as a regular star would. Depending on the binary formation, quasi-stable orbits are possible around a binary system, even if one of the main centers of gravitational influence in the system is a black hole. The planet would have to be a sur... |
1,319,476 | This is a question related to another posted question:
The answer to the following question "Find all solutions to: $e^{ix}=i$" is as follows:
"Euler's formula: $e^{ix}=\cos(x)+i\sin(x)$,
so: $ \cos x+i\sin x=0+1⋅i$
compare real and imaginary parts
$\sin(x)=1$
and
$\cos(x)=0$
$x=\frac{(4n+1)π}2$, $n∈$
(W stands f... | 2015/06/10 | [
"https://math.stackexchange.com/questions/1319476",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/247098/"
] | I always find it easier to use a fixed method, and I thought you might find this explanation easier, so I'm posting it.
Start by putting everything into exponential form. Now $i = e^{\frac{i\pi}{2}}$. You can derive this from $e^{i\pi} = -1$ and taking square roots on both sides.
Now note that for *any* $\theta$, $e... | **Hint:**
* $i$ is **a point on the unit circle**.
* $e^{ix}$ is *also* **a point on the unit circle**, lying *x* radians away from $(1,0)$, in trigonometric or counterclockwise direction.
So, to answer a question with a question, What is the position of $i$ on the unit circle, and How many radians away from $(1,0)$ ... |
19,620,051 | I have an HTML page that contains a table. The table is dynamically generated from a database on the server side. I would like the width of the table to determine the width of the entire page. That is, other block elements above and below the table should take on the same width as the table.
I do not want to use fixed... | 2013/10/27 | [
"https://Stackoverflow.com/questions/19620051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/442006/"
] | * Lets call the initially rendered width of the `wrap` as X.
* `wrap`, when initially rendered and without any width specified, will automatically fill all available horizontal space on the screen available to it. In this case, the entire width of the document. Therefore, in this case, X = 100% of the document.
* You *... | What about set tablels with relative?
```
table{
width:100%;
}
```
Made a [fiddle](http://jsfiddle.net/spSSC/1/) with a fixed body width and a table inside with 100% width. |
37,038,258 | I'm building an HTML webpage that contains the following content:
>
> In order to proceed, please enter this code: GJBQTCXU
>
>
>
"GJBQTCXU" is a code comprised of a string of letters; however, screen readers attempt to pronounce this as a single word. How can I stop them from attempting to pronounce this nonsens... | 2016/05/04 | [
"https://Stackoverflow.com/questions/37038258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174719/"
] | try using CSS letter-spacing property -
```
<div>G J B Q T C X U</div>
div {
letter-spacing:-1.9px;
}
```
example:
<http://codepen.io/stevef/pen/grZGBP> | I feel like the real answer to this is:
```
<div aria-label="G J B Q T C X U">GJBQTCXU</div>
``` |
36,992,018 | I have a folder with images in that I need re-naming.
Currently the files are like this:
```
C:\Images\Today\4714\IMG_2342.jpg
C:\Images\Today\4714\IMG_2343.jpg
C:\Images\Today\4714\IMG_2344.jpg
C:\Images\Today\4714\IMG_2345.jpg
```
And I need them to be like this:
```
C:\Images\Today\4714\4714_1.jpg
C:\Images\Tod... | 2016/05/02 | [
"https://Stackoverflow.com/questions/36992018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4647684/"
] | If you know that no files named `4714_X.jpg` exist already, you can easily do this with a for loop:
```
$Files = Get-ChildItem C:\Images\Today\4714\ *.jpg
for($i = 0; $i -lt $Files.Count; $i++)
{
Rename-Item $Files[$i].FullName -NewName "4714_$i.jpg"
}
``` | try this
```
dir C:\Images\Today\4714\ *.jpg | ? {$_.name -NotMatch "^$($_.directory.name)"} | % {ren $_.fullname $($_.name -replace 'img(?=_)', $_.directory.name)}
``` |
16,390 | As a webmaster in charge of a tiny site that has a forum, I regularly receive complains from users that both the internal search engine and that external searches (like when using Google) are totally polluted by my users' signatures (they're using long signatures and that's part of the forum's experience because signat... | 2011/07/04 | [
"https://webmasters.stackexchange.com/questions/16390",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/8785/"
] | >
> Marking every part of the webpage that contains a signature as being
> non-crawlable.
>
>
>
You can use the directive **[nosnippet](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#nosnippet)**:
>
> Do not show a text snippet or video preview in the search results for
> this page. A ... | No, there is no way to prevent robots crawling parts of pages. It's a whole page or nothing.
The snippets in Google's search results are usually taken from the *meta description* on the page. So you could make Google show a specific part of the page by putting that in the meta description tag. With user-generated cont... |
53,705,708 | I've written a code which looks at projectile motion of an object with drag. I'm using odeint from scipy to do the forward Euler method. The integration runs until a time limit is reached. I would like to stop integrating either when this limit is reached or when the output for ry = 0 (i.e. the projectile has landed).
... | 2018/12/10 | [
"https://Stackoverflow.com/questions/53705708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10770669/"
] | Also try
```
df1 * t(C)
# F1 F2 F3
#1 2.0 2.0 2.0
#2 5.0 5.0 5.0
#3 16.0 16.0 16.0
#4 4.5 4.5 4.5
```
---
When we try to multiply data frames they must be of the same size.
```
df1 * C
```
>
> error in Ops.data.frame(df1, C) :
> ‘\*’ only defined for equally-sized data frames
>
>
>
`t()` t... | Another solution is `sweep(df1, 1, C$C, `*`)`, which means "sweep out" the statistic represented by `C$C` from each column of `df1` by multiplication. |
13,996,181 | If I add a font into my FTP for my website, when I am adding in my font, where do I put it in the FTP and how do I use the font with HTML or CSS ? | 2012/12/21 | [
"https://Stackoverflow.com/questions/13996181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1922317/"
] | You can upload the font where ever you want it, you just need to link to the right location. Please see exmaple below for font faces in CSS.
```
@font-face{
font-family:'Your Font Name';
src:url(http://www.example.com/fonts/YourFont.otf);
}
``` | I personally recommend use the [Font Squirrel Fontface generator](http://www.fontsquirrel.com/fontface/generator) for that. You will get something like:
```
/* @Fontface */
@font-face {
font-family: 'Yourfont';
src: url('fonts/yourfont.eot');
src: url('fonts/yourfont.eot?#iefix') format... |
1,319,135 | I am running Ubuntu 20.04.2, an up until today my samba file server was running great. Today However I cant access my main folder. (I am connecting through a windows 10 PC) It says:
```
Windows cannot access \\192.168.0.43\admin
You do not have permission... Contact an admin
```
Just one folder, I can access all the... | 2021/02/25 | [
"https://askubuntu.com/questions/1319135",
"https://askubuntu.com",
"https://askubuntu.com/users/1186269/"
] | Since your motherboard does in fact have an Ethernet port, I think it is a driver issue.
This site may help:
[no WiFi and Ethernet connection on msi gaming edge wifi. Where and how do I install the drivers if possible](https://askubuntu.com/questions/1299842/no-wifi-and-ethernet-connection-on-msi-gaming-edge-wifi-whe... | Here seems to have solved it with the mystery for the driver location not stated. A search on that model lead to the third link.
[no WiFi and Ethernet connection on msi gaming edge wifi. Where and how do I install the drivers if possible](https://askubuntu.com/questions/1299842/no-wifi-and-ethernet-connection-on-msi-g... |
59,877,207 | I'm trying to set an array of components styles directly from the store, so that when the store changes, the design of each component changes too.
I store a set of links in my Vuex store like this:
```
links: [
{id: 1, text: 'Banana is a test', design: {color: 'red', 'background-color': 'blue', padding: '51px', m... | 2020/01/23 | [
"https://Stackoverflow.com/questions/59877207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9447776/"
] | I was having the same problem for a while, if anyone is experiencing a case scenario where onClick is needed on the labels here's how I solved it:
```
componentDidMount () {
//get the DOM elements of the labels , classes may vary so check in dev tools.
const labels = document.querySelectorAll('.apexcharts-text... | Today (6 may 2022), there is a specific event for this, e.g.
```
legendClick: function(chartContext, seriesIndex, config) {
// get the id of the chart-element to get the specific chart (I have multiple charts on a page)
console.log('chartConfigId', chartContext.el.id.split("-")[2]);
... |
6,449,834 | I'm building an application in which I am using Socket Programming in Java using TCP. When the server side Firewall is running, I am unable to connect to the server. So how can I make a check in Java that the Firewall is running and tell the server administrator he should turn it off. | 2011/06/23 | [
"https://Stackoverflow.com/questions/6449834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/689853/"
] | The only guaranteed way of doing it is to actually try establishing a connection to the host:port.
But again, if you are unable to connect, you can't say that its because of firewall, it could be because of server being actually down. So you can't really tell with conformity that the firewall is turned on. | @Suraj is right. If you cannot to specific TCP port you do not know whether the host is unavailable, no one is listening to the port or firewall blocks you.
But there is a trick that helps in 90% of cases.
Typically firewall configuration has exceptions like HTTP:80, ICMP etc. So, you can try to connect to your port. ... |
24,917,700 | I was wondering if there is an equivalent way to add a row to a Series or DataFrame with a MultiIndex as there is with a single index, i.e. using .ix or .loc?
I thought the natural way would be something like
```
row_to_add = pd.MultiIndex.from_tuples()
df.ix[row_to_add] = my_row
```
but that raises a KeyError. I k... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24917700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3820991/"
] | You have to specify a tuple for the multi-indexing to work (AND you have to fully specify all axes, e.g. the `:` is necessary)
```
In [26]: df.ix[(dt.datetime(2013,2,3,9,0,2),0),:] = 5
In [27]: df
Out[27]:
vals
Time hsec
2013-02-03 09:00:01 1 45
... | **Update since `.ix` is deprecated**:
Use `[DataFrame.loc][1]` instead:
```py
# say you have dataframe x
x
Out[78]:
a b time
indA indB
a i 0.0 NaN 2018-09-12
b j 1.0 2.0 2018-10-12
c k 2.0 3.0 2018-11-12
f NaN NaN NaT
d i ... |
31,357,532 | I have a text file which is like this
```none
count="4"
data1
data2
data3
Data1
Data2
Data3
```
I need to search for the string `count` and take its value (4) and print the next 3 lines count(4) times.
The output in the file should be
```
data1
data2
data3
data1
data2
data3
data1
data2
data3
data1
data2
data3
Data... | 2015/07/11 | [
"https://Stackoverflow.com/questions/31357532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5105871/"
] | You can try something like this:
```
#!/usr/bin/perl
use strict;
use warnings;
my $count = 0;
while (my $line = <DATA>){
if ($line =~ /count="(\d+)"/ and $1){
$count = $1;
next;
}
if ($count){
print $line;
$count--;
}
}
__DATA__
count="2"
a
b
c
d
count="1":
e
f
g
count... | you can give file/input at `@data`
```
#!/usr/bin/perl
use strict;
use warnings;
my @data = qw /count="4" data1-1 data2-1 data3-1 Data1 Data2 Data3/;
my $repeat_line = 3;
foreach (@data)
{
if ( /count="(\d+)"/ ) {
for ( 1..$1 ) {
for my $no1 ( 1..$repeat_line ) {
print $data[$no1],"\n";
}
}
... |
33,407,448 | The new default Navigation Drawer Activity template in Android Studio
[](https://i.stack.imgur.com/kP4ZR.png)
defines its titles and icons in a menu file `activity_main_drawer` like this:
```
<group android:checkableBehavior="single">
<item
... | 2015/10/29 | [
"https://Stackoverflow.com/questions/33407448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2058547/"
] | In my case, I was having a style
```
<style name="MyToolbarStyle" parent="Theme.AppCompat">
<item name="actionOverflowButtonStyle">@style/ActionButtonOverflowStyle</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
<style name="ActionButtonOverflowStyle">
<item name="and... | This works for me for changing icon color from the menu xml file which you drag in the `app:menu` attribute of the `NavigationView` widget.
Use `app:iconTint` attribute to set the icon color.
```
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="htt... |
1,366,848 | When a web server responds to `HttpWebRequest.GetResponse()` with HTTP 304 (Not Modified), `GetResponse()` thows a `WebException`, which is so very weird to me. Is this by design or am I missing something obvious here? | 2009/09/02 | [
"https://Stackoverflow.com/questions/1366848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60188/"
] | The way to avoid this `System.WebException` is to set
[AllowAutoRedirect](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowautoredirect%28v=vs.110%29.aspx) property to `false`.
This disables the automatic redirection logic of the `WebRequest`. It seems to be broken for 304 redirection requests, a... | I also came across to this issue with code:
```
try
{
...
var webResponse = req.GetResponse();
...
}
catch (WebException ex)
{
Log.Error("Unknown error occured", ex);
//throw;
}
```
And it appears that if Remote Server returns 304 status it must be passed to Browser by throwing this error or ret... |
24,809,196 | I have 2 Stateless EJBs StatelessA and StatelessB, both of them have interceptors InterceptorA and InterceptorB respectively. Also, StatelessB has Asynchronous methods. Something like this:
```
@Stateless
@Interceptors(InterceptorA.class)
public class StatelessA{...
@Stateless
@Asynchronous
@Interceptors(InterceptorB... | 2014/07/17 | [
"https://Stackoverflow.com/questions/24809196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580636/"
] | I was thinking this over and over, and arrived to a solution, which is using the security context to pass data.
The solution involves using the only data propagated in an asynchronous invocation, as specified in EJB 3.1:
>
> **4.5.4 Security** Caller security principal propagates with an asynchronous method invocati... | Would it work to store the information you need in an @Entity object and then use the @PersistenceContext annotation to inject an EntityManager into the beans to persist and find the data? Something like:
```
@PersistenceContext
EntityManager entityManager;
...
method() {
MyEntityTimer met = new MyEntityTimer(getCurre... |
4,424,158 | The firebug console has various panels that can keep track of a lot of information. The net panel keeps track of almost all network traffic and reports various pieces of information on that traffic, e.g. headers, latency, request parameters, etc. What I would like to do is access all this information programatically fr... | 2010/12/12 | [
"https://Stackoverflow.com/questions/4424158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/165198/"
] | Check out firebug plugin [NetExport](http://www.softwareishard.com/blog/netexport/)
Edit: [Here is the source code:](http://code.google.com/p/fbug/source/browse/#svn/netexport/branches/netexport0.7)
Also this source code may interest you [tracingconsole](http://code.google.com/p/fbug/source/browse/#svn/extensions/t... | Well as far as I know, the only way to really "know" about in-flight XMLHttpRequests is to explicitly "remember" them in the code. It's like timeouts and interval timers - if your code doesn't hang on to a handle, it's lost.
If the pages in question do everything via jQuery or some other framework, then it might be po... |
25,268,800 | I'm having an issue in Angular where I have a controller that gets data from a service. The controller gets the data from the service but it only returns the last element.
See this jsfiddle for an example: <http://jsfiddle.net/c1104q9b/>
HTML:
```
<div ng-app="myApp">
<div ng-controller="MessageController">
... | 2014/08/12 | [
"https://Stackoverflow.com/questions/25268800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1227083/"
] | The method when() is not part of your class MyClass. It's part of the class Mockito:
```
Mockito.when(test.getUniqueId()).thenReturn(43);
```
or, with a static import:
```
import static org.mockito.Mockito.*;
...
when(test.getUniqueId()).thenReturn(43);
``` | you are trying to get when from the mocked class. You need to do something like:
```
...
MyClass test = Mockito.mock(MyClass.class);
Mockito.when(test.getUniqueId()).thenReturn(43);
...
``` |
21,104,514 | I'm trying to do something pretty simple with powershell and xml but haven't a bit of trouble.
Basically I'm trying to take the following xml... and sort the machine elements by name. Then put them back into the XML so that I can save back to a file.
Sorting seems to be working if output the $new object however, duri... | 2014/01/14 | [
"https://Stackoverflow.com/questions/21104514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1810969/"
] | There are various problems here. One is that your `sort` returns a list of xml elements rather than a single xml element. Another problem is that it returns the original xml elements rather than copies, so any manipulation of the xml DOM that you do using them will also affect the result.
Here's a simple way to get wh... | The reason this doesn't work is that $xml.Company.Machines is a single XmlElement. To get the collection of machine elements, you need to use $xml.Company.Machines.Machine, so this is the one you want to sort.
However, the ReplaceChild method doesn't take a collection, so I'm guessing you'll have to remove all childr... |
18,859,086 | Here's an example of the issue at hand:
A product costs 81.25 (that is price including 20% VAT, in other words, 81.25 is equal to 67.71+13.54). I've set the price calculations to the best of my belief (from Extensions->Order Totals) and within Shopping Cart, we'd see the following break-down:
A table of the product w... | 2013/09/17 | [
"https://Stackoverflow.com/questions/18859086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2788421/"
] | `"!"` is a string, you want to compare against a character: `'!'`. | You can't compare `"!"` and `'!'`.
I suggest using `rbegin()` to address the last character:
```
text2.append(text.begin(), text.end());
switch(*text.rbegin())
{
case '!':
case '?':
case ':': text2.append(". "); break;
}
getline(cin, text)... |
62,133,735 | Tried to understand the solution for Codility NailingPlanks.
Link for the Problem:
<https://app.codility.com/programmers/lessons/14-binary_search_algorithm/nailing_planks/>
>
> You are given two non-empty arrays A and B consisting of N integers.
> These arrays represent N planks. More precisely, A[K] is the start... | 2020/06/01 | [
"https://Stackoverflow.com/questions/62133735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11610073/"
] | <https://app.codility.com/demo/results/trainingR7UKQB-9AQ/>
Its a 100% solution. The planks are zipped into (begin, end) pairs and sorted which supports a binary search. For each nail, that nail is used to remove as many planks as possible before failing the search. When the Array of planks is empty the index of the c... | This is the summary of the entire algorithm. I think who understands it won't have any question in mind.
**What we are doing?**
1- Order the nails without losing their original indexes.
2- For each plank, find the min nail value that can nail the plank by using binary search.
3- Find each nail's min original index ... |
18,961,332 | This is a two part question:
1. I am using the resolve property inside $stateProvider.state() to grab certain server data before loading the controller. How would I go about getting a loading animation to show during this process?
2. I have child states that also utilise the resolve property. The problem is that ui-ro... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18961332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277697/"
] | How about adding content to the div that will be filled by ui-router once the properties have resolved?
In your `index.html`
```
<div ui-view class="container">
Loading....
</div>
```
The user will now see "Loading..." while the properties are resolved. Once everything is ready the content will be replace by ui... | My idea is to walk the path on state graph between transitioning states on `$stateChangeStart` and collect all involved views. Then every `ui-view` directive watches if corresponding view is involved in transition and adds `'ui-resolving'` class on it's element.
The [plunker](http://plnkr.co/edit/YZwGnHfIkSRxOlci8DHm)... |
44,177,869 | The installation of Workload Scheduler agent component fails during the step **Start up IBM Workload Scheduler** showing the following message:
>
> **tebctl-tws\_cpa\_agent\_agt94 agent not installed properly**
>
>
> | 2017/05/25 | [
"https://Stackoverflow.com/questions/44177869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8002777/"
] | I have solved the issue, the code below hope to help some 1
Swift :
```
@IBAction func uploadimages(_ sender: Any) {
Alamofire.upload(
multipartFormData: { multipartFormData in
var count = 1
for img in self.imagesdata{
let imgdata = UIImageJPEGRep... | Use this below code to upload multiple images to your server. I've put this in a method that takes in `NSMutableArray` of `UIImage` objects and their corresponding names in another array. You could change `NSMutableArray` to Swift Array if you want. After successful upload, the completion handler will get called and wo... |
4,134 | I found a way how to add tabs to magento product view, through XML layouts with add tab, where every tab is actually a one phtml template (So I can set description, and attributes in example and retrieve that templates to show in tabs).
What I would like to do is to show every attribute as one tab. I suppose I should... | 2013/05/28 | [
"https://magento.stackexchange.com/questions/4134",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/2212/"
] | You can create a setup script which grabs all product attribute sets. Iterate through the attributes which belong to each set, create a group for each attribute, and then set the attribute to that group.
*Viola*, solved. Cannot imagine why you would want to do this though. | very short version:
As the tabs are part of the product view, we can get the current product via
```
$product = Mage::registry('product')
```
then you should be able to get attributes with something like this:
```
$product->getAttributeText('attributeName')
``` |
2,652,135 | I have captured total desktop using CPP, COM and DirectShow. But how can I capture particular window only? | 2010/04/16 | [
"https://Stackoverflow.com/questions/2652135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/318390/"
] | Another differentiator is that CDI is very Java EE oriented. It provides a mechanism to **glue** the different **Java EE subsystems** together.
Ie. By annotating a bean with `@Named("book")`, the bean becomes known in the unified EL (Expression Language) as '`book`'.
Then you can use it in a JSF page for instance:
`... | I have used Guice in an AWS Lambda serverless application. AWS recommends using Guice or Dagger over Spring in a Lambda function. See [AWS Lambda best practices](https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html)
The primary reason is that Guice and Dagger are smaller frameworks and have faster start up... |
41,019,686 | How do I fill a `CAShapeLayer()` with a gradient and on an angle of 45 degrees?
For example, in **Image 1**, the below code draws a square and fills the layer blue (`UIColor.blueColor().CGColor`).
But, how do I fill it with a gradient on a 45 degree angle from blue to red like in **Image 2** (i.e. `UIColor.blueColor(... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41019686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4806509/"
] | Why not use `CAGradientLayer` which has `startPoint` and `endPoint` properties.
You can do:
```
import UIKit
import PlaygroundSupport
let frame = CGRect(x: 0, y: 0, width: 100, height: 100)
let view = UIView(frame: frame)
PlaygroundPage.current.liveView = view
let path = UIBezierPath(ovalIn: frame)
let shape = CA... | I think it's
```
shape.startPoint = CGPoint(x: 1.0, y: 0.0)
shape.endPoint = CGPoint(x: 0.0, y: 1.0)
```
, which is the first color at the bottom-right to the second color at the top-left. If you want the first color at the top-right and second color at the bottom-left, then you should have
```
shape.startPoint = C... |
31,974,243 | I am using Visual Studio Express 2013 for Web, I am attempting to create a new controller in my asp.net MVC application. I am using Entity Framework 5 with code first (.NET 4.5).
I want Visual Studio to create the template for me - However, every time I try to create the controller I get the following error message: ... | 2015/08/12 | [
"https://Stackoverflow.com/questions/31974243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5216986/"
] | Raising to a power is a relatively quick operation, even using big integers (it takes logarithmic time, excluding the cost of big integer arithmetic). But printing a number is a relatively slow operation (it takes quadratic time). So in your first problem printing the result takes a long time. In your second problem th... | In Common Lisp you have the `time` macro:
```lisp
(time (progn (expt 123456 123456) 1))
; Real time: 0.578002 sec.
; Run time: 0.577577 sec.
; Space: 733816 Bytes
; GC: 1, GC time: 0.007143 sec.
; ==> 1
(time (progn (princ (expt 123456 123456)) 1))
; a whole lot of numbers ...6
; Real time: 59.980278 sec.
; Run time:... |
14,168,030 | I know my code is bad and unsafe and everything but I just want it to overall work before I start making changes.
So i am making a little basic shop, and I want it to check the user to see if he has the right amount of money, and if he does, subtract the amount of money the item costs and give him the item, if he does... | 2013/01/05 | [
"https://Stackoverflow.com/questions/14168030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1908445/"
] | As you've pointed out your code is not great, however in answer to your actual question/problem.
As the whole thing hinges on one if statement, everything that is suppose to happen should be inside that if statement.
```
$sql23 = "SELECT * FROM users WHERE username='".$_SESSION['username']."')";
$result = mysql_quer... | ```
<?php
$playermoney = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'") or die(mysql_error());
if (isset($_POST['pokeball'])) {
if ($row['money'] >= 2000) {
echo "You have bought a pokeball!" ;
mysql_query("UPDATE users SET money=money-2000,pokeball=pokeball+1 WHERE... |
40,627,447 | There are simple filter from shared library
```js
.filter('minutes2hm', function () {
return function (min, apply) {
if (apply === false) {
return min;
}
var h = Math.floor(min / 60).toString();
min = (min - (h * 60)).toString();
return '' + '00'.substring(0, 2 -... | 2016/11/16 | [
"https://Stackoverflow.com/questions/40627447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/534802/"
] | If shared filter is in use in different places then first of all create second custom filter with **different name**, next get user settings from service ( filters can use dependency injections ), and last one - call "old" filter in custom filter by `$filter` service, example usage:
```
app.filter('userMinutes2hm', fu... | Why you using this below code? and what is the Use of the below code?
```
if (apply === false) { //and if (USERSettings.apply === false)
return min;
}
```
If you won't use filter, then don't call the filter on your `<th>`. Why you need pass `true|False`
So if you remove that code, then your `<t... |
8,306,170 | I have this program which worked find in my college lab, but when I run it at my home it gives different result
```
#include <stdio.h>
int main(int argc, char* argv[]) {
const int size=100;
int n, sum=0;
int* A = (int*)malloc( sizeof(int)*size );
for (n=size-1; n>0; n--)
... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8306170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1070616/"
] | You never assign a value to A[0] - the first loop ends to quickly. However you do include this unassigned value in the summation. | `A[0]` is undefined:
`for (n=size-1; n>0; n--)`
should be
`for (n=size-1; n>=0; n--)` |
49,669,049 | My code to resize images is :
```
from PIL import Image
ratio = 0.2
img = Image.open('/home/user/Desktop/test_pic/1-0.png')
hsize = int((float(img.size[1])*float(ratio)))
wsize = int((float(img.size[0])*float(ratio)))
img = img.resize((wsize,hsize), Image.ANTIALIAS)
img.save('/home/user/Desktop/test_pic/change.png')
... | 2018/04/05 | [
"https://Stackoverflow.com/questions/49669049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9533220/"
] | Masking with `0xFF` reduces any negative values into the range 0-255.
This is reasonable if, for example, your platform's `char` is an 8-bit signed type representing ISO-8859-1 characters, and your `wchar_t` is representing UCS-2, UTF-16 or UCS-4.
---
Without this correction (or something similar, such as casting to... | It looks like on conversion failure the code tries its own conversion by just copying the `string` into a `wstring` char for char.
The `& 0FF` is meant to "clean" any values higher than 255 to fit in the (extended) ASCII table. This is a no-op however because `input[i]` returns `char` and `sizeof(char) == 1` which wou... |
67,133 | I have a relationship like this:
Class Student Lookup on Student
Contact Student Master-Detail on Student
I want to create a visualforce page to create new Class and on the same page add Student to the class.
I created a controller extension of Class's controller.
I am now stuck on adding student for the class.
I... | 2015/02/22 | [
"https://salesforce.stackexchange.com/questions/67133",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/11923/"
] | You are not able to add students as you are using a master detail relationship on student with contact. So for adding a student u should also add the contact id in the master detail relationship of contact.
Example.
```
Class__C cl = new Class__c();
Student__C std = new Student__c();
Contact con =... | It's worth spending some time with *[Visualforce in Practice](http://www.developerforce.com/guides/Visualforce_in_Practice.pdf)*. The book has a whole section on creating "wizards" in Visualforce.
The gist of the situation is that you're going to want to pass a few page references around to step your user through the ... |
15,959,544 | I'm having an issue getting my model.destroy method to work properly in backbone. This is my function
```
deleteEvent: function(){
var self = this;
var check = confirm("Are you sure you want to remove record " + this.model.get("ticket_id"));
if (check == true){
this.model.id = this.model.get('sessi... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15959544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2272207/"
] | You need to set `paragraphy` and `linebreaks` settings like this :
```
$('#redactor').redactor({
linebreaks: true,
paragraphy: false
});
``` | ```
$("#editor").redactor({
pasteBeforeCallback: function (html) {
return html.replace(/<p>\s*<\/p>/g, " ");
}
});
``` |
78,334 | Given two polynomials `f,g` of arbitrary degree over the integers, your program/function should evaluate the first polynomial in the second polynomial. `f(g(x))` (a.k.a. the *composition* `(fog)(x)` of the two polynomials)
### Details
Builtins are allowed. You can assume any reasonable formatting as input/output, but... | 2016/04/23 | [
"https://codegolf.stackexchange.com/questions/78334",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24877/"
] | TI-Basic 68k, 12 bytes
======================
```
a|x=b→f(a,b)
```
The usage is straightforward, e.g. for the first example:
```
f(x^2+3x+5,y+1)
```
Which returns
```
y^2+5y+9
``` | [PARI/GP](http://pari.math.u-bordeaux.fr/), 19 bytes
====================================================
```
(a,b)->subst(a,x,b)
```
which lets you do
```
%(x^2+1,x^2+x-1)
```
to get
>
> %2 = x^4 + 2\*x^3 - x^2 - 2\*x + 2
>
>
> |
59,906,505 | Need a PowerShell regular expression pattern to delete left behind folders that were extracted by windows patches from root of C drive
```
c:\0260cbbd38dbbbea2543f8
c:\096ea4b36d877b65dc6c
c:\0cf52cad06ab7b5cfe2b4042c8
c:\0d90c7a3bdd67a5212aa527bc49b
c:\0e2180b528a8c152566816291c2252
c:\1050411ef7c0228177
c:\120dc98... | 2020/01/25 | [
"https://Stackoverflow.com/questions/59906505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11104335/"
] | here is a slightly different way to determine if the dir name is a hexadecimal string. [*grin*]
what it does ...
* creates a list of dirinfo items
you will need to get that via `Get-ChildItem` with the appropriate selectors to get only directories.
* iterates thru the list
* checks to see if the string contains ... | To find **all** folders with names contaning only hexadecimal characters (only digits 0..9 and letters a..f):
```
Get-ChildItem -Path 'C:\' -Directory -Force | Where-Object { $_.Name -match '^[a-f\d]+$' }
```
To find only those starting with a digit:
```
Get-ChildItem -Path 'C:\' -Directory -Force | Where-Object { ... |
7,123,666 | I have a table that I'm styling with CSS. Yes I know, tables are bad and all that. I want the "grid" of TD's to all have the height of the row they are positioned in.
<http://jsfiddle.net/p87Bv/1/>
You'll see if they have varying content, they look all jumbled up! Would prefer not to use Javascript. | 2011/08/19 | [
"https://Stackoverflow.com/questions/7123666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852025/"
] | tables are not automatically bad. tables are perfect for displaying tabular data... even though that doesn't seem to be what you are doing.
move the style from the div to the table cell...check out my updated fiddle for some CSS changes. i think you could remove the divs from the markup now that they aren't being used... | It's hard to understand your question. Maybe you can clarify - is this what you're looking for? Also notice how the overflowing text is in a scrollable div - more on that later.
Link: <http://jsfiddle.net/ZFHUm/>
If it is, it's as simple as adding the height CSS property. Also, it's always good to address the text ov... |
57,841,303 | 
How to change the red conatiner after pressing the continue button? In place of red container a new container should be formed having text field as phone number and other things should be as it is. Only red container is needs to be changed. | 2019/09/08 | [
"https://Stackoverflow.com/questions/57841303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12037323/"
] | Put your sub query into temp table :
```
DECLARE @tdate DATETIME = '2019-09-01 00:00:00.000'
SELECT holdingNo
into #TmpholdingNo
FROM [db_land].[dbo].tbl_bill
WHERE year(date_month) = YEAR(@tdate)
AND MONTH(date_month) = MONTH(@tdate)
AND ( update_by IS NOT NULL
OR ispay = 1 )
SELECT c.id... | give a try try this:
```
select main.* from
(SELECT c.id AS clid,
h.id AS hlid,
h.holdinNo,
c.cliendID,
c.clientName,
h.floor,
h.connect_radius
FROM [db_land].[dbo].tbl_client AS c
INNER JOIN [db_land].[dbo].tx_holding AS h
... |
35,651,567 | I have a string array of the same primitive type (don't know what). I need to convert that into the corresponding type. Is there any way if I pass a string and get the primitive type of the data if any in that string. Consider the string is supposed to be having a primitive type or it is treated as String
For e-g
``... | 2016/02/26 | [
"https://Stackoverflow.com/questions/35651567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5678086/"
] | No, that is not possible. For example this input:
```
5
```
* This could be an **int**
* But it could also be a **byte**, **short** or **long**
* It could as well be a **float** or a **double**
* It could even be a **char**
The only thing we know about it is, that it is probably not a **boolean**.
---
You could o... | Java Strings are abstractions for characters and see nothing but characters.
The String itself does not know what kind of representations are inside of it, other than that it is all a homogeneous(exclusive to) collection of characters.
If you are being mislead by the "+" operator. This operator condenses what you ar... |
46,822 | I came across the following problem:
>
> Show that if $x$ and $y$ are real numbers with $x <y$, then there exists an irrational number $t$ such that $x < t < y$.
>
>
>
We know that $y-x>0$.
By the Archimedean property, there exists a positive integer $n$ such that $n(y-x)>1$ or $1/n < y-x$. There exists an in... | 2011/06/22 | [
"https://math.stackexchange.com/questions/46822",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/12378/"
] | **Suggestion**: I expect that you can use the fact that $\sqrt{2}$ is irrational.
From the denseness of the rationals, you know that there is a non-zero rational $r$ such that
$$\frac{x}{\sqrt{2}} <r <\frac{y}{\sqrt{2}}.$$
Now it's essentially over. (I almost forgot to insist that $r$ be non-zero!) | One way to show this would be to use the fact that the rationals are countable, whereas the interval $(x,y)$ is uncountable (these facts must be proven, though), and therefore $(x,y)$ must contain some irrational number $t$, which will satisfy $x<t<y$. |
206,820 | I would like to either prevent or handle a `StackOverflowException` that I am getting from a call to the `XslCompiledTransform.Transform` method within an `Xsl Editor` I am writing. The problem seems to be that the user can write an `Xsl script` that is infinitely recursive, and it just blows up on the call to the `Tra... | 2008/10/15 | [
"https://Stackoverflow.com/questions/206820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27109/"
] | By the looks of it, apart from starting another process, there doesn't seem to be any way of handling a `StackOverflowException`. Before anyone else asks, I tried using `AppDomain`, but that didn't work:
```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
... | You can read up this property every few calls, `Environment.StackTrace` , and if the stacktrace exceded a specific threshold that you preset, you can return the function.
You should also try to replace some recursive functions with loops. |
492,115 | what is the proper contour for $$\int\_{-\infty}^{\infty}\frac{e^z}{1+e^{nz}}dz:2\leq n$$
I tried with rectangle contour but the problem which I faced how to make the contour contain all branches point because $1+e^{nz}=0$ for every $z=\frac{2k+1}{n}$ :$k\in Z$
,or how to avoid them | 2013/09/12 | [
"https://math.stackexchange.com/questions/492115",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58529/"
] | Set $w=nz$, then your integral is equal to $\displaystyle\frac{1}{n}\int\_{\mathbb R}\frac{e^{w/n}}{1+e^w}\,dw=\frac{I}{n}$. Now, for $M>0$ big, consider the following rectangle contour: $$t\_1\in[-M,M],\\ M+t\_2i,\,t\_2\in[0,2\pi],\\t\_3+2\pi i,\,t\_3\in[M,-M],\\-M+t\_4i,t\_4\in[2\pi,0].$$ On the second line, $$|I|\le... | Here is another solution for diversity.
In your integral, let $x\mapsto\log x$, so it becomes
$$\int\_{0}^\infty \frac{dz}{1+z^n}=\frac{1}{n}\int\_{0}^\infty \frac{z^{1/n-1}\,dz}{1+z}$$
The latter integral can be solved with a keyhole contour (and this avoids the branch cut along $\mathbb R^+$), as the integrand dis... |
26,847,594 | I have a multi-project (Android) build with library *L*, app *A*, and examples *E1*, *E2*, *E3* (and possibly more). The directory layout is:
```
root (contains `settings.gradle` and `build.gradle`)
|
+- A (contains `build.gradle`)
|
+- L (contains `build.gradle`)
|
+- examples
|
+- E1 (contains `build.gradle`)
... | 2014/11/10 | [
"https://Stackoverflow.com/questions/26847594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1127485/"
] | This work work me:
add this dependency in your maven pom file
```
<dependency>
<groupId>org.graylog2</groupId>
<artifactId>gelfj</artifactId>
<version>1.1.13</version>
</dependency>
```
and these lines in your log4j.properties
```
# Define the graylog2 destination... | Look in `catalina.out` (usually located under `tomcat/logs`) for error messages related to Gelf |
18,678,853 | I tried cloning my repository which I keep in my [Ubuntu One](https://en.wikipedia.org/wiki/Ubuntu_One#Features) folder to a new machine, and I got this:
```
cd ~/source/personal
git clone ~/Ubuntu\ One\ Side\ Work/projects.git/
Cloning into 'projects'...
done.
fatal: unable to read tree 29a422c19251aeaeb907175e9b321... | 2013/09/07 | [
"https://Stackoverflow.com/questions/18678853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/444763/"
] | **git-repair** (`sudo apt install git-repair`) with a few additional commands worked for me:
0. Create a backup copy of your corrupted repository.
1. Delete broken references:
`find .git/refs -size 0 -delete -print`
2. Repair repository from remote(s):
`git-repair --force`
3. Clean up dangling commits:
`git g... | I wanted to add this as a comment under [Zoey Hewil's awesome answer](https://stackoverflow.com/a/46604551/5669462) above, but I don't currently have enough rep to do so, so I have to add it here and give credit for her work :P
If you're using [Poshgit](https://github.com/dahlbyk/posh-git) and are feeling *exceptional... |
71,925,642 | I'm building a script that downloads a file from a URL and then executes it, but for some reason when I debug the script, it throws an error like:
System.ComponentModel.Win32Exception: 'An error occurred trying to start process "" with working directory "". The process cannot access the file because it is being used by... | 2022/04/19 | [
"https://Stackoverflow.com/questions/71925642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15070023/"
] | ```
yarn add react@17.0.2
```
Downgrade react 18 to react 17 | In my case I ended up removing the `react-hot-loader` and `hot-loader/react-dom` dependencies and its related Webpack config.
Since both of them only support till react-dom v17 which doesn’t have the new useSyncExternalStorage hook. |
63,737 | Is there a plugin (for any browser) anyone can recommend? An app?
It seems like all browsers got rid of this easy resource tracking feature (Chrome too). | 2012/09/12 | [
"https://apple.stackexchange.com/questions/63737",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/28957/"
] | You can see still browse resources in the web inspector.

To download a file, you can copy the URL from the right sidebar, paste it on the location bar, and press ⌥↩.
The web inspector can be shown by pressing ⌥⌘I if you've enabled showing the develop menu in the advanced pref... | Maybe you can try Firebug for Firefox. |
29,970,892 | I designed an application for android (I used android studio), which actually has an embedded web site, which was made by me in php.
The first screen of the application is a login. I would like to know how I can do to make the system to remember the user name and password, as happens in most of the android applications... | 2015/04/30 | [
"https://Stackoverflow.com/questions/29970892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1178303/"
] | You can ignore the platforms and plugins directories as long as you haven't added any custom code in them.
When adding plugins and platforms add --save to the command. e.g.
```
cordova platform add ios@3.8.0 --save
```
or
```
cordova plugin add cordova-plugin-device --save
```
This will save a record of the plu... | I followed these steps:
* create cordova project
* add platforms
* add plugins
Before build project, I commit and push generated files. After I build project and check for new files generated. I got these to add in .gitignore:
/platforms/android/gradlew.bat
/platforms/android/build
/platforms/android/gradle
/plat... |
38,807 | I'm currently writing a novel with 3-4 character POVs in it - two male, two female. Each have different upbringings, different cultural backgrounds, different professions, different motivators and driving factors - in short, how the characters think, the entire worldview, it changes from chapter to chapter.
So how d... | 2018/09/10 | [
"https://writers.stackexchange.com/questions/38807",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/33045/"
] | How do the people speaking around you, wherever you are, speak differently? How do your favorite authors give characters different voices?
Here are a few ways your characters might differ:
* Different vocabularies
* Different sentence lengths and complexities
* Different speeds
* Verbosity vs brevity
* Some think bef... | It is critical that you **use** *different* FONTS for each person "unless not practical". Different font sizes are especially effective.
HEY CHARACTER 1, WHAT TIME IT IS?
*oh hello 2 that is a secret* |
30,659,682 | I have this script and its triggering just when i click first time on textbox:
```
var day = parseInt($("#day_birthdate").val(), 10);
jQuery('input#day_birthdate').bind('input propertychange', function () {
if (day >= 1 || day <=31) {
jQuery(this).css({ 'background': 'green' });
} else... | 2015/06/05 | [
"https://Stackoverflow.com/questions/30659682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4511325/"
] | set on top html tag `ng-app ="scopeExample"` | ```
function HelloCntl($area) {
$area.test= 'Demo';
}
<div ng-controller="MyController">
Your name: <input type="text" ng-model="test"/>
<hr/>
Hello {{test|| "Demo"}}!
</div>
```
You Can Try This Code I check this code is properly working and i am also using this code
=======================================... |
54,093,132 | I'm searching a way to use scheduled tasks in a reactive API.
I know that it uses the thread pool so it's not very compatible with the webflux components.
Do you have an equivalent to do the job? | 2019/01/08 | [
"https://Stackoverflow.com/questions/54093132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1694403/"
] | You may try to use `Schedulers.immediate()` inside `@Scheduled` method:
```
doWork()
.subscribeOn(Schedulers.immediate())
.subscribe()
```
As a consequence tasks run on the thread that submitted them. | Webflux has it's own scheduler, and I gues this way should do it:
```
Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit);
``` |
40,926,635 | I'm running Nightwatch after launching a child process that starts up my local servers. Nightwatch runs the tests, they complete successfully, and the browser windows all close, but the `nightwatch` process continues to run after printing the message "OK. 10 total assertions passed.".
I thought it may have something t... | 2016/12/02 | [
"https://Stackoverflow.com/questions/40926635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1696044/"
] | I was not explicitly closing the Firebase connection. This caused the last test to hang indefinitely.
Here's how I am closing the connection after doing test cleanup:
```
browser.end(() => {
destroyUser(user).then(() => {
firebase.app().delete()
})
})
```
The `destroyUser` function now looks like this:
```... | In my case (nightwatch with vue/vuetify) after each test like so:
```
afterEach:function(browser,done){
done();
}
``` |
3,791,903 | Using python 2.6.5, I can use the `with` statement without calling `from __future__ import with_statement`. How can I tell which version of Python supports `with` without specifically importing it from `__future__`? | 2010/09/25 | [
"https://Stackoverflow.com/questions/3791903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446929/"
] | `__future__` features are self-documenting. Try this:
```
>>> from __future__ import with_statement
>>> with_statement.getOptionalRelease()
(2, 5, 0, 'alpha', 1)
>>> with_statement.getMandatoryRelease()
(2, 6, 0, 'alpha', 0)
```
These respectively indicate the first release supporting `from __future__ import with_st... | From the doc:
```
New in version 2.5.
``` |
50,142,154 | I cross checked everything SHA-1 is also correct as well as the packagename i am using real android device but still this error is showing.
`onVerificationFailed
com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SH... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50142154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5404432/"
] | I had the same issue recently. If Your app was on the play store,I would have told you to add the SHA-1 provided by play store as well. But since it is just a debug mode.Make sure you have the recent SHA-1 as it can change based on some factors. | This issue only happened to my OPPO phone. I guess some Chinese phone manufactories root Android system so the phone is detected as a simulator?
Anyway, cope SHA-1 from google play to firebase works with me.
You can find google play SHA-1 from Google Play Console -> Release management -> App signing.
[![Where you can... |
12,674,219 | I have a table that holds survey data, two data points are Ethnicity and Flavor\_Pref.
The Flavor\_Pref hold an integer 1, 2, 3,4,5. 1 = Dislike Very Much, 5 Like Very Much.
```
Ethnicity Flavor_Pref
African American 3
Caucasian 2
Asian 4
Hispanic ... | 2012/10/01 | [
"https://Stackoverflow.com/questions/12674219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/516801/"
] | the implementation is such that we have to implement listener to get signal strength of current cell, i have wrote the listener and stopped the listener at first read and then kept in variable. no any other way | I tried to use the "Hazmat" code, but unfortunately does not work on my device (Samsung S3 mini Android 4.1.2). It seems that some phones from Samsung have problems with this feature and nobody from Samsung cares. [Also other Samsung models have similar problem](http://forum.xda-developers.com/showpost.php?p=18846375&p... |
7,182,264 | I have a common unit that does some logging to GExperts Debugger and/or OutputDebugString. I am going to use it in a console app, so I want it to be able to output to stdout via `writeln()`.
The main executable has {$APPTYPE CONSOLE} already, but I don't think that'll help me here. The logging routine will be called... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7182264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/289135/"
] | Call `GetStdHandle(Std_Output_Handle)`. If it succeeds and returns zero, then there is no console to write to. Other return values indicate that a console is attached to the process, so you can write to it (although the console may not be the most desirable place to log messages in a console program since they'll inter... | Use constructor injection to inject a logger at the time you create the instance. [Here's a simple example.](http://www.nickhodges.com/post/Getting-Giddy-with-Dependency-Injection-and-Delphi-Spring-4-%E2%80%93-Dependency-Injection-Basics.aspx)
Your proposed solution of testing whether the app is a console app works fo... |
15,608,203 | I ran the following script using `php.exe`:
```
preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);
```
or its equivalent:
```
preg_replace('#(?:^[^\pL]*|[^\pL]*$)#u','',$string);
```
If `$string="S"` or `$string=" ذذ "` it works, if `string='ذ'` it yields `�` that is incorrect , and if `string='ذذ'` PHP cra... | 2013/03/25 | [
"https://Stackoverflow.com/questions/15608203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/752603/"
] | maybe this will help :
>
> these properties are usualy only available if PCRE is compiled with
> "--enable-unicode-properties"
>
>
>
<http://docs.php.net/manual/en/regexp.reference.unicode.php#96479> | From looking at the expression itself, there are two things that could be improved:
1. The `*` multipliers aren't very useful; why would you want to replace a potentially empty match with an empty string? In fact, running this on my system yields `NULL` from the `preg_replace()` operation.
2. The memory groups can be ... |
8,506,442 | What is the algorithm can be used to resolve the following classification problem?
We have Multi-touch screen, user that can touch it with two or three fingers simultaneously.
1. After user touches screen, we remember initial positions of his fingers. Each fingers gets a group of coordinates from the device.
2. When u... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8506442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/603019/"
] | One problem is to start with reports of N locations at time t and reports of N locations at time t+1 and work out that position 1 at time t is the same finger as position 3 at time t+1. The military have looked at this sort of thing a lot, often under the name of data fusion. One approach is to write down a cost of ass... | Solving the assignment problem is overkill for this, given that you are trying to assign three points to three fingers. Even if you are trying to assign five points to five fingers, you are better off using a brute force approach to figuring out the optimal configuration of points to fingers. Note that for three finger... |
1,165,384 | So I'm starting to hear more and more about [Web Workers](http://ejohn.org/blog/web-workers/). I think it's absolutely fantastic, but the question I haven't seen anyone really tackle so far is how to support older browsers that do not yet have support for the new technology.
The only solution I've been able to come up... | 2009/07/22 | [
"https://Stackoverflow.com/questions/1165384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5416/"
] | Here's what John Resig said [replying to a comment on his blog](http://ejohn.org/blog/web-workers/#comment-386781)
>
> I thought about this - but it'll be tricky. You would have to make your processing code use setTimeout/setInterval from the start (this code would end up working in both a worker and on a normal web ... | I had the funny problem that my task without Web Worker support was too slow in Firefox (unresponsive script), but fast enough in all other modern browsers.
With Web Workers it worked in all browsers except Opera (10.50) which doesn't support Web Workers at all, but Opera worked fine without them.
So I wrote a WorkerF... |
420,605 | I can't for the life of me figure this out. I feel like i'm missing some crucial detail about how batteries work.
Imagine two batteries connected in series, like this:
```
Circuit <= -(Battery A)+ <= -(Battery B)+ <= Circuit
```
**As far as I've studied, this is what happens:**
1. The negative side of Battery B ha... | 2018/08/01 | [
"https://physics.stackexchange.com/questions/420605",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/202938/"
] | **Chemistry and Physics of Batteries in Series**
>
> What happens at the atomic level inside a cell when putting two batteries in series?
>
>
>
**Short Answer:**
**Characteristics of a single cell vs. two cells in series:** (i.e., compare the voltage, current, $E$ field, stored energy, power, charge, and operati... | One way to think of this is as follows: for your two-battery system with the batteries in series, the positive terminal of battery "A" doesn't know or care what voltage the negative terminal of battery "B" is presenting to it. All battery "A" is going to do is pull electrons out of its positive terminal, lift them to a... |
2,064,701 | Let $\lim\_{n \to \infty} a\_n = a$. Then $\lim\_{n \to \infty} \frac {a\_1 + ... +a\_n} {n} = a $
How one can prove it? | 2016/12/19 | [
"https://math.stackexchange.com/questions/2064701",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/375772/"
] | Take any $E$ satisfying the Carathéodory condition. Consider first the case where $m^\*(E)$ is finite. The general case can be deduced by splitting $E$ into countably many pieces of finite outer measure.
1. Note that any open set of finite measure can be approximated by an elementary set, that is, if $U$ is open of fi... | I know that this is an old post but the existing answers don't seem to use the 'restricted' version of Caratheodory.
Pick an open set such that $m^\*(O)\leq m^\*(E) + \epsilon$ for some $\epsilon > 0$.
$$m^\*(O)=\color{red}{ \Sigma m^\*(B\_n) \geq \Sigma(m^\*(B\_n \cap E) + m^\*(B\_n-E))}\geq m^\*(\cup B\_n\cap E)+m^\... |
87,141 | I'm trying to get the description of a table in oracle because I need to know what foreign keys does it have and which tables they refer to.
I'm using desc
but all I get is "ORA-00900: invalid SQL statement"
Any idea why?
Thanks. | 2014/12/29 | [
"https://dba.stackexchange.com/questions/87141",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/55043/"
] | I suspect that you did not execute this command with sqlplus. Not every sql program can handle the `desc` command.
You can either use sqlplus or get the table definition with the following SQL command:
```
SELECT dbms_metadata.get_ddl (object_type, object_name, owner)
FROM all_objects
WHERE owner = '<owner>'
AND... | The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL\*Plus. If the PL/SQL banne... |
2,863,925 | Let $(A\_\*,\partial )$ and $(B\_\*,\partial' )$ be chain complexes, $f:A\_\*\to B\_\*$ a chain map and suppose that the map $f\_\*$ it induces on homology is an isomorphism.
The mapping cone $(C\_\*,D)$ is defined by $C\_n=A\_{n-1}\oplus B\_n$ and $D\_n(a\_{n-1},b\_n)=(-\partial\_{n-1}a\_{n-1},f\_{n-1}(a\_{n-1})+\pa... | 2018/07/26 | [
"https://math.stackexchange.com/questions/2863925",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/138929/"
] | That is probably not the answer you are looking for, but here is a proof using model category theory. Somehow, it says that this is a result not about chain complexes per se, and it is a motivation not to dive into chain complexes details.
In any model category $\mathcal C$, the mapping cone $C\_f$ of $f:X\to Y$ is de... | Assuming your question is why $C$ has trivial homology: $f\_\*$ is an isomorphism, so $p\_\*$ and $i\_\*$ must both be zero maps. |
141,725 | Inspired by [a bug](https://tio.run/##S9ZNT07@/z9TJ8s6TSM5I7FIq1izujwjMydVA8RKyy/SyLI1M7XOsrE0tM7S1tbUKra1zbIvKMrMK0nTUNMqBgpZQXlKCkqa1gWlJcUaSkBGbe3/3MTMPA2gIRpKUZER4WGhIcFBgQH@fr4@3l6eHu5uri7OTo4glf8B) in a solution to [this challenge](https://codegolf.stackexchange.com/q/141372/61563), your challenge is to produce t... | 2017/09/05 | [
"https://codegolf.stackexchange.com/questions/141725",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/61563/"
] | [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
==========================================================
```
ØAµ⁶ṁḊ;ṚµƤṚY
```
[Try it online!](https://tio.run/##y0rNyan8///wDMdDWx81bnu4s/Hhji7rhztnHdp6bAmQivz/HwA "Jelly – Try It Online")
```
ØAµ⁶ṁḊ;ṚµƤṚY Main Link
ØA "ABC...XYZ"
Ƥ ... | [Husk](https://github.com/barbuz/Husk), 15 bytes
================================================
```
mṠ+ȯR' ←Lhṫ…"ZA
```
[Try it online!](https://tio.run/##ASAA3/9odXNr//9t4bmgK8ivUicg4oaQTGjhuavigKYiWkH//w "Husk – Try It Online")
-5 thanks to [Zgarb](https://codegolf.stackexchange.com/users/32014/zgarb). Still a ... |
142,866 | I've seen dozens of articles on NFTs, and not comprehended a single one. So when someone [made an NFT of the first Twitter posting](https://decrypt.co/60437/tron-ceo-justin-sun-bids-1000000-for-the-first-ever-tweet), I didn't understand how that would be a means to generate any sort of financial return. Even if the *co... | 2021/07/27 | [
"https://money.stackexchange.com/questions/142866",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/110867/"
] | The other answers so far have missed an important point. As with a lot of expensive art, the object itself is almost beside the point. What's really at work is status seeking. By spending a lot of money on some "art object", even ones that most of us would throw out with the trash, you demonstrate that you:
a) have lo... | They are valuable because people value them. The same way that people like to own other trinkets that have no particular use. In many cases, people like to "own" something, even if that thing can easily be copied.
As an analogy, would you rather have a Van Gogh painting, or a *really good* copy of a Van Gogh painting?... |
1,008,430 | Why doesn't my iis Server pick up changes to local code? I've changed both css/js files and changed some images but iis just doesn't update anything on the website. I've tried restarting the website and refreshing it on the iis manager but nothing changes.
However when i edit the web.config file it detects it automati... | 2020/03/26 | [
"https://serverfault.com/questions/1008430",
"https://serverfault.com",
"https://serverfault.com/users/565585/"
] | Are you using any kind of CDN that has the page cached?
If so, you can purge the cache of that URL.
Also test if the changes update when you use Private Browsing/Incognito Mode on your browser. If this shows the updated page, then it is your browser cache that needs to be cleared.
But to really solve the problem, you... | I think the problem is your browser cache.
For Chrome and Firefox you can try `Ctrl`+`F5` to force refresh the page.
Failing that press `Ctrl`+`Shift`+`Del` and clear the cache. |
389,981 | I am diving in the domain driven design (DDD) and while I go more deeply in it there are some things that I don't get. As I understand it, a main point is to split the Domain Logic (Business Logic) from the Infrastructure (DB, File System, etc.).
What I am wondering is, what happens when I have very complex queries li... | 2019/04/08 | [
"https://softwareengineering.stackexchange.com/questions/389981",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/333103/"
] | If you've ever been on a project where the organization paying to host the application decides that the database layer licenses are too expensive, you'll appreciate the ease of which you can migrate your database/data storage. All things considered, *while this does happen, it doesn't happen often*.
You can get the be... | One of the possible ways to solve this dilemma is to think of SQL as of an assembly language: you rarely, if at all, code directly in it, but where performance matters, you need to be able to understand the code produced by your C/C++/Golang/Rust compiler and maybe even write a tiny snippet in assembly, if you cannot c... |
14,181,744 | I'm trying to display a custom yes/no product attribute only if "yes" is selected. Here's my code so far:
```
<?php $freeship = Mage::getModel('catalog/product')->load($this->getProduct()->getId())->getAttributeText('free_shipping_discount');
if ($freeship == "yes")
echo '<span class="free-ship">FREE SHIPPING</span>';... | 2013/01/06 | [
"https://Stackoverflow.com/questions/14181744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1906850/"
] | You should have something like:
```
CELERYBEAT_SCHEDULE = {
'proc': {
"task": "tasks.processing",
"schedule": timedelta(seconds=60),
},
}
```
in your `celeryconfig.py` or in django's settings.py
See full documentaion here <http://docs.celeryproject.org/en/latest/userguide/periodic-tas... | Check your system time-zone if is the same as Django time zone.
For Django: Change it from settings file.
For linux operating system: change it like that: `ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime` |
60,037,706 | Hi I am working on laravel project , I have to check about user's permission when he trying to access one page , my problem is after I created Permission middle ware , and add it in the kernel.php , it checking about permissions for all route even I did not call it in any route .
I don't want to apply this middleware o... | 2020/02/03 | [
"https://Stackoverflow.com/questions/60037706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8376370/"
] | I understand the problem as you want the most recent value for all countries, as the country can repeat in the table(?):
```
select distinct t1.DAY, t1.COUNTRY, t1.VALUE
FROM day_test t1
inner join day_test t2 on t1.day in
(select max(day) from day_test t3 where t1.country = t3.country )
... | You can use the following query:
Just replace the `TABLE_NAME` with the name of your table.
```
SELECT
COUNTRY,
VALUE,
MAX(DATE) AS "MostRecent"
FROM TABLE_NAME
GROUP BY COUNTRY;
``` |
11,996,005 | I'm trying to paste my query results from Mgmt Studio to Excel, but for whatever reason the columns in Mgmt Studio are concatenated into a single column when pasted into Excel.
This doesn't happen to any of my colleagues and we couldn't find any settings for changing this. Any ideas? | 2012/08/16 | [
"https://Stackoverflow.com/questions/11996005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149945/"
] | I have solved this problem in my SSMSBoost add-in for SSMS: it has possibility to export grid as native OpenXMLSpreadsheet, which can be easily "understood" by excel. As "bonus" to solution of your problem you will also see that even datatypes are preserved, so no problems anymore with conversion of dates to text or te... | I get this too and in the past i would shut down excel. I realized after a while that every day i do text to columns for a specific spreadsheet and i change the delimiter to other /. When i change it back to tab, it works fine. |
47,484,838 | I am making a timer as part of my app. I followed a tutorial, and made some modifications to the program to better suit my needs. However, when I run the app, I get the default value of the timerTextView (defined in xml), or just random numbers. What is going wrong?
**Update**: Here is the coomplete code for the activ... | 2017/11/25 | [
"https://Stackoverflow.com/questions/47484838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8555405/"
] | It looks that [Microsoft has neglected this topic](https://connect.microsoft.com/SQLServer/feedback/details/234143/populate-has-default-value-in-sys-parameters) and there is no trivial way to find parameters default values and even if a default value is present or not on a specific parameter:
>
> As we all know, T-SQ... | I implemented Alexei's brilliant solution, but one of my variables, and a comment on a parameter both had the word 'class' in it and I couldn't for the life of me figure out why it broke. I finally realized that the word 'class' has 'AS' in it. So the key to avoiding that situation is to differentiate the AS keyword de... |
282,101 | I have to store some amount of data for analytical purposes.
* The data source produces 2TB data per month.
* Data is collected on a monthly basis (not real-time).
* Data is fully structured.
* There are 100+ different columns of data.
* Availability of SQL is important.
* Engineer/developer resources are limited.
I ... | 2020/12/24 | [
"https://dba.stackexchange.com/questions/282101",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/220335/"
] | Aside from the recommendations made by Danielle and J.D., I suggest you examine how the data is represented and the frequency.
For example, if the data is transmitted in a JSON or XML format, which is handy for transmission and processing, the size will be large (e.g. a numeric string vice a float or an int). Also, st... | How many rows of data is generated in a month of 2 TB of data? In a year's time, how many months back will still be queried? In 5 years, how many years back of data needs to still be queried?...in 10 years, and in 20 years? What's the most amount of months (or rows of data) that will need to be queried at one time? Wha... |
1,409,548 | I have the following connection string, and you will notice "Provider's.Tests", notice the single quote, how do I enter this in to the web.config to make it valid?
```
<connectionStrings>
<clear/>
<add name="Provider" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Projects\Provider's.Tests\app... | 2009/09/11 | [
"https://Stackoverflow.com/questions/1409548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58309/"
] | I don't think its the `Provider's` that is the problem, It is the double quotes around the path.
Try to just remove it so it says `AttachDbFilename=C:\Projects\Provider's.Tests\app_data\db.mdf;`
If it is important in the connection string to have it, try encoding it:
`AttachDbFilename="C:\Projects\Provider's.... | You should encode both the quotation marks and apostropes. Quotation marks (") are encoded using `"` and apostrophes (') are encoded using `'`. The main issue here is the quotation marks, it might still work without encoding the apostrophes as you use quotation marks around the values.
```
<connectionStrings... |
9,626,059 | Obviously, window.onbeforeunload has encountered its fair share of problems with Chrome as I've seen from all the problems I've encountered. What's the most recent work around?
The only thing I've got even close to working is [this](https://stackoverflow.com/questions/4802007/window-onbeforeunload-not-working-in-chrom... | 2012/03/08 | [
"https://Stackoverflow.com/questions/9626059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/872150/"
] | As of Chrome 98.0.4758.109 and Edge 100.0.1185.29, Chromium has not met the standard. There is a [bug report](https://bugs.chromium.org/p/chromium/issues/detail?id=866818) filed, but the [review](https://chromium-review.googlesource.com/c/chromium/src/+/1154225) is abandoned.
[Test with StackBlitz!](https://stackblitz... | Here's a more straightforward approach.
```
$(window).on('beforeunload', function() {
return "You should keep this page open.";
});
```
The returned message can be anything you want, including the empty string if you have nothing to add to the message that Chrome already shows. The result looks like this:
![ent... |
45,365,658 | Why is it necessary to run 'npm install' when I already have all the dependence in node\_module folder.
After running 'npm install' successfully on my machine, I want to setup same project on another machine, why do I require run 'npm install' again when I already have downloaded all the dependence in node\_module fo... | 2017/07/28 | [
"https://Stackoverflow.com/questions/45365658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2810015/"
] | First of all I want to inform you 2 things:
* As your project depend on some packages (node\_modules), same as some packages are dependent on other packages.
* when we install some package with command `npm install package -g` then -g will install it in global folder which can be accessed by any project. by using -g, ... | `npm install` extract all your dependencies from your package.json, download it and save them in your node\_modules folder. You don't need to run npm install again and again if you already have installed all your dependencies locally.
When ever you installs a new dependency you run `npm install <package-name> --save` ... |
23,569,056 | Can someone explain to me why `ArrayIndexOutOfBoundsException` is a run-time exception instead of a compile-time error?
In obvious cases when the indexes are negative or greater than the array size, I don't see why it cannot be a compile-time error.
Edited: especially when the size of the array and even the indexing i... | 2014/05/09 | [
"https://Stackoverflow.com/questions/23569056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2824271/"
] | The size of the arrays may be defined only at runtime (for instance, the simplest case, if the size of an array depends on the user input).
Therefore it would be impossible to check at compile time for such kind of exceptions, by checking the accesses of an array without actually know its bounds (size). | As well as agreeing with the fact that array size can't be checked at compile time, I want to add another note on the limit of the size of an array, which is expected to be in the range of primitive `int`:
```
// This compiles, because the size evaluates to an integer.
int[] array = new int[Integer.MAX_VALUE + 1];
//... |
532,634 | Suppose a rocket at rest turns on its jet and is now moving with kinetic energy $\frac12 mv^2$ in the lab frame. Suppose the efficiency was maximum so that exactly $\frac12mv^2$ of chemical energy was just converted to this kinetic energy. Energy is conserved, obviously.
Now suppose I stay in the rocket's frame. In th... | 2020/02/23 | [
"https://physics.stackexchange.com/questions/532634",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/212603/"
] | >
> What is wrong with my thinking?
>
>
>
There are a couple of points where you make key errors. The first (and least important) is here:
>
> Suppose the efficiency was maximum so that exactly $\frac{1}{2}mv^2$ of chemical energy was just converted to this kinetic energy.
>
>
>
This is not possible for a r... | In an inertial frame, you should not see chemical energy being converted into kinetic energy. If you do, then you are also experiencing acceleration, and you will not be in an inertial frame. |
14,604,733 | I've been through the various answers here with this one already, but none give an answer that actually works.
The core issue (obviously) is that DateTime hasn't any concept of NULL, so the usual
```
string dateValue = myReader.IsDBNull (4) ? null : myReader.GetDateTime(4) ;
```
doesn't work.
I've tried
```
Date... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14604733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/971352/"
] | Firstly Your syntax here:
```
DateTime? nextDue = myReader.GetDateTime(3) = DBNull.Value ? null : (DateTime?)myReader.GetDateTime (3) ;
```
id wrong. Should be:
```
DateTime? nextDue = myReader.GetDateTime(3) == DBNull.Value ? null : (DateTime?)myReader.GetDateTime (3) ;
```
Secondly you could use:
```
DateTime?... | try
```
DateTime? nextDue = myReader.GetValue(3) == DBNull.Value ? null : (DateTime?)myReader.GetDateTime (3);
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.