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 |
|---|---|---|---|---|---|
45,585,642 | When I try to export report in PDF/Excel/Word or print report, I got a error. Error description :
```
Server Error in '/' Application.
Operation could destabilize the runtime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more infor... | 2017/08/09 | [
"https://Stackoverflow.com/questions/45585642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8438590/"
] | I had the same issue and was able to resolve it by commenting out the Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule in the ApplicationInsights.config. | I had this issue too. Started to see this issue after I had upgraded NuGet packages in my application to the latest version. The application would worke fine on my development machine, but once I deployed the it to a production server I started to see this error when trying to access a ReportViewer page.
I ended up r... |
8,790,784 | For a project, we need a way to run user scripts that can come with attached JAR files with additional classes.
What are my options when I want to write a couple of tests to make sure normal script don't leave anything dangling behind?
I specifically need to know: Are all classes from the attached JARs "unloaded"?
N... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8790784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34088/"
] | The likely best option is to ensure your loaded jars are loaded by a specific class loader, and then to discard that class loader (after discarding all the objects).
As far as unit testing the unloading, if you go with this option, you need to extend your testing framework and customized class loaders to have a "creat... | I wouldn't try to unit test this. Instead, I'd run the JVM with -XX:-TraceClassUnloading and look to see if the classes in question show up in the trace output. |
9,346,188 | I'm trying to make a page where a user may enter a url into an input box, click submit, and the script will return the WebCite page. (WebCite is a url caching service. For example, if I "archive" www.google.com, the archive page is www.webcitation.org/65YgIgei6.) So WebCite has a query syntax that when given a url to c... | 2012/02/19 | [
"https://Stackoverflow.com/questions/9346188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190269/"
] | I strongly disagree with the answer by @Dzek Trek. When creating html emails i never use divs, and the only css i use is inline css. I say this with 6 months experience building emails.
An example of my overall email layout would be:
```
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> </td>
... | Well, yes for graphical layout you could use html5 and css3. Here is an example of it
```
<html>
<head>
<title>{blog_title}</title>
</head>
<body>
<h3>{blog_heading}</h3>
{blog_entries}
<h5>{title}</h5>
<p>{body}</p>
{/blog_entries}
</body>
</html>
```
And if you want to make it more user friendly and eye pleasen... |
36,294,955 | I've just tried to use a simple `date` pipe in my **angular2** app:
```
Registered: {{user.registered | date:'shortDate'}}
```
The error I get is:
```
Invalid argument '2016-03-28T07:25:40.824Z' for pipe 'DatePipe' in [{{user && user.registered | date:'shortDate' }} in UserDialog@16:57]
```
I do have a User model... | 2016/03/29 | [
"https://Stackoverflow.com/questions/36294955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162070/"
] | I see merits in both, but the OP's code somewhat limiting: it always returns the same date format all the time, you're ultimately going to write another Pipe to change that format anyway.
The second method sounds a whole lot more manageable: however, a few things, the pipes isn't something you include in the @Compone... | The argument is obviously a `string`, not a `Date`. You need to convert it to `Date` before passing it to the pipe. JSON doesn't support type `Date`.
```
user.registered = new Date(json.registered);
```
or similar depending on how you get the user object.
See also [Converting string to date in js](https://stackover... |
130,939 | If one or more of my players decide to go on a shopping spree, I've previously had problems describing the shop's inventory, without going into much detail or making it seem like the shop has only 2 items.
Of course, I can describe the atmosphere and the general nature of the inventory (e.g. "herbs" or "jewelry"), and... | 2018/09/01 | [
"https://rpg.stackexchange.com/questions/130939",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/38495/"
] | What is this browsing you speak of?
-----------------------------------
Note in the real medieval period you could not browse a shop. You were not even allowed *in* the shop most of the time: too much risk of theft. There was a window with a counter and you told the shop owner what you wanted and they brought it to yo... | If you already know that your players like to go shopping, prepare for that in advance.
Shops with limited sortiment
----------------------------
First of, don't include supermarkets. These didn't exist until quite recently. It would be better to design your shopping areas like a traditional village market place. You... |
2,080,167 | What is the closed form for
$$\sum\_{n=0}^{\infty}{(-1)^n\left({{\pi\over 2}}\right)^{2n}\over (2n+k)!}=F(k)?$$
My try:
I have found a few values of $F(k)$, but was unable to find a closed form for it.
$F(0)=0$
$F(1)={2\over \pi}$
$F(2)=\left({2\over \pi}\right)^2$
$F(3)=\left({2\over \pi}\right)^2-\left({2\over... | 2017/01/02 | [
"https://math.stackexchange.com/questions/2080167",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/343408/"
] | Note that
$$\sum\_{n=0}^\infty \frac{(-1)^nx^{2n}}{(2n)! } = \cos(x)$$
You can reach the result by integrating $k$-times.
$$\sum\_{n=0}^\infty \frac{(-1)^nx^{2n}}{(2n+k)! } = \frac{1}{x^{k}}\int^{x}\_0 \mathrm{d}t\_{k-1}\int^{t\_{k-1}}\_0 \mathrm{d}t\_{k-2} \cdots\int^{t\_1}\_0\mathrm{d}t\_0\cos(t\_0) $$
For examp... | The sum can also be expressed in terms of the *Regularized Incomplete Gamma* function ($Q(a,z)$).
In fact, premised that for a general function of a integer $f(k)$ we have
$$
\begin{gathered}
\frac{{\left( {i^{\,k} + \left( { - i} \right)^{\,k} } \right)}}
{2}f(k) = \left( {\frac{{e^{\,i\,k\frac{\pi }
{2}} + e^{\, ... |
103,123 | The problem is that the links (as well as the PDF bookmarks) of abstract, explanation, CV and appendix do not lead to the right pages. abstract leads to the `titlepage` and appendix to introduction etc. Also the sections belong to the introduction in the bookmarks :( Maybe it is due to the page numbering I did (and I n... | 2013/03/18 | [
"https://tex.stackexchange.com/questions/103123",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/27398/"
] | Load `hyperref` as last package and then
```
...
\phantomsection
\phantom{T}\vspace{5.3cm}
\renewcommand{\abstractname}{Abstract}
\begin{abstract}
TEXT
\end{abstract}
\addcontentsline{toc}{section}{Abstract}
\newpage
...
``` | Finally, I solved the problem. In my case of only one Appendix, this is sufficient:
```
\setcounter{table}{0}
\setcounter{page}{1}
\newcommand{\initAnhang}{
\renewcommand{\thepage}{A\arabic{page}}
\newpage
}
\renewcommand\appendix{\par
\renewcommand\thesection{A}
\renewcommand\thesubsec... |
14,605,075 | I need to copy each row as many times as how many hours there are between `StartTime` and `EndTime`.
Example data:
**[SQLFIDDLEExample](http://sqlfiddle.com/#!3/587a4/1)**
```
TimeKey HourKey SensorKey IdleTimeMinute StartTime EndTime
20121017 8 45 110 2012.10.17 08:31 2012.10.17 10:21
20121017 10 ... | 2013/01/30 | [
"https://Stackoverflow.com/questions/14605075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1076151/"
] | You should try using the [TabControl.SelectedTab Property](http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.selectedtab.aspx):
>
> Gets or sets the currently selected tab page.
>
>
>
The topic above also has the following remark:
>
> The tab page must be in the TabPages collection to make... | try this code:
```
tabControl1.SelectedPage = tabpage1;
``` |
43,303,003 | I'm working on a program that works with a linked list of generic objects, inside the class that defines a single list there is a method that returns the value of that link:
```
public class Link<E> {
private E _value;
public E getValue() {
return _value;
}
```
Then I want to use this ... | 2017/04/09 | [
"https://Stackoverflow.com/questions/43303003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7159699/"
] | It seems you should do like this:
```
Link<E> current = goTo(index);
```
as `Link current` (without `<E>`) pointed to list of Object class. | I think your problem is this line: Link current = goTo(index); You have to correct it to specify the type of Object you want to use: `Link <TypeOfObject> current = goTo(index);` replace "TypeOfObject with the return type value of goTo method. I am assuming it is an Integer, so if that is the case just replace `Link <Ty... |
51,780,304 | After installing tensorflow for python 3.7, I tried to import it but it gave me a syntax error.
the command used for installation :
sudo -H pip3 install --upgrade <https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl>
I don't think tensorflow has supported python3.7 yet. Is there a way... | 2018/08/10 | [
"https://Stackoverflow.com/questions/51780304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7584145/"
] | just use like this.
```
for i in range(256):
for j in range(256):
ip = "192.168.%d.%d" % (i, j)
print ip
```
output:
```
192.168.0.0
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
.
.
192.168.255.254
192.168.255.255
``` | If you want your range of IP addresses to be dynamic, you can do the following:
```
ip1='192.168.0.0'
ip2='192.168.255.255'
first, second, thirdStart, lastStart = list(map(int,ip1.split(".")))
thirdEnd, lastEnd = list(map(int,ip2.split(".")))[2:]
for i in range(thirdStart,thirdEnd+1,1):
for j in range(lastStart... |
204,465 | I'm planning to develop an app for the iPhone and that app would have to access a couple of SOAP services. While doing some basic checking in the iPhone SDK I was not able to find any support for accessing SOAP services, a bit of Googling lead to the conclusion that there is no support for SOAP in the iPhone SDK.
So ... | 2008/10/15 | [
"https://Stackoverflow.com/questions/204465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25277/"
] | I've historically rolled my own access at a low level (XML generation and parsing) to deal with the occasional need to do SOAP style requests from Objective-C. That said, there's a library available called SOAPClient ([soapclient](http://ditchnet.org/soapclient/)) that is open source (BSD licensed) and available on Goo... | Have a look at [gsoap](http://sourceforge.net/projects/gsoap2) that includes two iOS examples in the download package under ios\_plugin. The tool converts WSDL to code for SOAP and XML REST. |
14,095,552 | I am looking at and trying to understand the [DnDns](http://dndns.codeplex.com/) project, it's a very impressive project altogether, but I have come across a method, and I don't understand the reason behind it.
```
public static string GetServByPort(short port, ProtocolType proto)
{
StringBuilder ans = new StringB... | 2012/12/30 | [
"https://Stackoverflow.com/questions/14095552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/969613/"
] | Calling `ToString()` on an enum will use the enum value *name* if there is one. (It will give the numeric version when there's no corresponding named value.) So for example, in your `TcpServices` case, if the value is 53, the result would be `Domain (53)`
in the original code - but `53 (53)` in your suggested replaceme... | For well-known services, your output will look like this:
```
Domain (53)
HTTP (80)
HTTPS (445)
FTP (21)
```
etc. While the unknown ones will be like you've shown:
```
1 (1)
2 (2)
```
etc. |
168,956 | I am really struggling with this one - hopefully someone here can help...
I am installing a brand new, fresh version of Wordpress v4.0 (A task I've performed easily 100+ times before without incident)
I have setup a brand new sub-domain and database for it then run the install script... But, everytime I try, I get ca... | 2014/11/20 | [
"https://wordpress.stackexchange.com/questions/168956",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/10368/"
] | `wp_rel_nofollow()` add nofollow attribute to all links so we can not use it or may be I am not sure how.
You can use this function to add `rel="nofollow"` to all external links. This function will check all links in content against your blog/website URL (as internal domain) and add nofollow attribute if both does not... | Based on @Robert hue's answer and the wordpress functions [wp\_rel\_nofollow()](http://wpseek.com/function/wp_rel_nofollow/) and [wp\_rel\_nofollow\_callback](http://wpseek.com/function/wp_rel_nofollow_callback/) I came up with this very similar solution that works for me because for some reason Robert's wasnt adding t... |
3,496 | Let me preface by saying that this may not be the right SE. I considered asking on the Physics SE, but I thought I might try here first. If it is wrong, I am not against it being migrated.
From basic principles of Physics, power is computed as Work/time. So consider a rider and bike system climbing a hill. The work do... | 2011/04/21 | [
"https://bicycles.stackexchange.com/questions/3496",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/779/"
] | I suspect you mean efficiency rather than power.
In my opinion the main trade-off is between increased biomechanical losses at higher rpm (basically muscle friction) and decreased blood flow with higher forces at lower rpm. The balance depends both on the rider and the duration.
In the [IHPVA Journal of Human Power, ... | No, gear and gain ratios do not affect power. While you are correct in assuming that it would feel different to the rider, if the other three variables are equal, then the power rate will be the same. In this case, in an "easier" gear ratio, the cadence would require a significant increase to maintain the same climb ti... |
36,406 | I have two variables $X$ and $Y$ given as tuples of $(x, y)$, and I want to see if there is a relationship between the two variables. I can do so by finding the correlation coefficient.
However, I found that by selecting an arbitrary subset of the data (e.g. $(x, y) | x > k$ ), I can get a higher correlation coefficie... | 2018/08/03 | [
"https://datascience.stackexchange.com/questions/36406",
"https://datascience.stackexchange.com",
"https://datascience.stackexchange.com/users/57120/"
] | You do not want to remove all correlated variables. It is only when the correlation is so strong that they do not convey extra information. This is both a function of the strength of correlation, how much data you have and whether any small difference between correlated variables tell you something about the outcome, a... | It doesn't matter. But for efficiency before feature engineering. |
65,187,539 | I managed to convert the Koncorde indicator from version 2 to version 3 and then to 4, but I cannot see the graph of 2 variables ("azul" and "verde")
I have spent several hours and I decided to ask you because maybe for you this is easy to solve
This is the error I get:
line 14: Shadowing built-in variable 'nvi'
line... | 2020/12/07 | [
"https://Stackoverflow.com/questions/65187539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14781660/"
] | As @mat already mentioned in the comments, you need a `protocol` to mock `UserDefaults` dependency. Something like this will do:
```
protocol UserDefaultsStorage {
func value(forKey key: String) -> Any?
func setValue(_ value: Any?, forKey key: String)
}
extension UserDefaults: UserDefaultsStorage {}
```
The... | This might not be the best solution, however, I haven't figured out a way to inject `UserDefaults` that use property wrappers into a `ViewModel`. If there is such an option, then [gcharita](https://stackoverflow.com/users/6791677/gcharita)'s proposal to use another protocol would be a good one to implement.
I used the... |
18,419,558 | I have a search icon that when hovered over reveals an input text search box. I'm using jQuery to add a class to the input to reveal the text box when the search icon is hovered over. That is working fine.
The next function is that if the user decides not to click in the search box and elsewhere on the page, the sear... | 2013/08/24 | [
"https://Stackoverflow.com/questions/18419558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/819276/"
] | You get 3,3,3 because you have defined the variable indexNumber as static. So when instantiating three student objects the indexNumber gets value 3.
To increment define the indexNumber as instance variable and pass the value for it as parameter. | Static members are shared with all objects. You not indexed, you counted with your test. |
71,955,141 | this is my first question here. So please be merciful with me :-). I am grateful for any suggestions for improvement.
Here is my question:
I have a grouped and sorted tibble and I want to go through row by row and make comparisons with both the previous row and the next row. For this I have to treat the first and the... | 2022/04/21 | [
"https://Stackoverflow.com/questions/71955141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18893708/"
] | Your existing query will raise the same error. You can't concatenate first, and then apply `TO_CHAR`; `TO_CHAR` expects a number, not a string. First convert the number to string, and then concatenate `'dst.'` to the result of `TO_CHAR`.
After you fix this first mistake (even for your existing query), multiplying by 0... | You can use
```sql
SELECT 'dst.'||.01 * TO_NUMBER( per_growth,
'FM9G999G999G999G999G990D99999999999',
'NLS_NUMERIC_CHARACTERS = '',.'' ')
FROM dst__d_data;
```
prefix some string stuff after finishing the numerical conversion with **`'',.''`** pattern... |
68,249,781 | Looking for some help with my sanity please.
I have created an Azure Search Services instance (Cognitive Search) but when I attempt to create an Datasource for an Azure SQL Indexer I receive errors in the portal.
[](https://i.stack.imgur.com/t66i8.png)
I have also tried t... | 2021/07/05 | [
"https://Stackoverflow.com/questions/68249781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/219177/"
] | What you're doing is unsupported, so it's not really surprising if it doesn't work on all systems. The correct documented approach is to use KVO on the audio session `outputVolume` property: <https://developer.apple.com/documentation/avfaudio/avaudiosession/1616533-outputvolume> | I was also struggling to solve the task of handling volume buttons press event, aiming to
* get the event
* recognise if it is volume up or down
* be able to react even at system max/min level
* handle the event (in my case, executing the js callback in WKWebView)
* have it working on both iOS 15 / iOS below 15.
Fina... |
12,167,592 | If I have a URl like `"/api/User/Details/2c021192-25cb-43e1-9bba-3bd5604a0a3d"` what would be the best way to get the ID `"2c02ds92-25cb-43e1-9bba-3bd5604a0a3d"` out of the URL client side?
I need to be able to build a `$.getJSON` request with the ID and I'm looking for the cleanest way to do it using JavaScript, jQue... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12167592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/139599/"
] | Use [regular expressions](https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions) and extract the appropriate part (which seems to be UUID) from the URL.
The alternative is to just split the string by `/` and get last element.
**EDIT**: The example on how to retrieve UUID from the URI:
```
var... | using `split`, convert the url to an array of parameters. Then last array item in your case would be your ID.
there are very sophisticated URL parsers out there for javascript, perhaps you should look around on google for one that suits your needs. |
45,662,253 | I'm running a Keras model, with a submission deadline of 36 hours, if I train my model on the cpu it will take approx 50 hours, is there a way to run Keras on gpu?
I'm using Tensorflow backend and running it on my Jupyter notebook, without anaconda installed. | 2017/08/13 | [
"https://Stackoverflow.com/questions/45662253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8176285/"
] | Of course. if you are running on Tensorflow or CNTk backends, your code will run on your GPU devices defaultly.But if Theano backends, you can use following
>
> Theano flags:
>
>
>
> >
> > "THEANO\_FLAGS=device=gpu,floatX=float32 python my\_keras\_script.py"
> >
> >
> >
>
>
> | See if your script is running GPU in Task manager. If not, suspect your CUDA version is right one for the tensorflow version you are using, as the other answers suggested already.
Additionally, a proper CUDA DNN library for the CUDA version is required to run GPU with tensorflow. Download/extract it from [here](https:... |
656,651 | I've never used it in the professional software even though in our shop, and others I have worked for, we design large scale systems. The only time I messed with virtual inheritance was during my interview in a company. Nonetheless, I played with it during afterhours.
Do you guys use it? Do you understand how it work... | 2009/03/18 | [
"https://Stackoverflow.com/questions/656651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> I've never used it in the professional software even though in our shop,
>
>
>
Do you use `iostream`? We do. Look up the design of iostreams and you'll know you've been using virtual inheritance. | Virtual inheritance can also be used to make a class a final class, i.e. to make it so that no other classes can derive from it. I grabbed that trick once from Stroustroup (<http://www.research.att.com/~bs/bs_faq2.html#no-derivation> see below for updated hyperlinks and sources):
>
> The other variant of this problem... |
182,756 | Shell Type:
```
>echo $SHELL
/bin/ksh
```
Cronjob :
`15 * * * * /bin/ksh /wls_domains/resMGT/logs/bea/wlr3queuetransaction.sh > /wls_domains/resMGT/logs/bea/data/script.log`
The script is as below:
```
##log files and lookup file "wlr3queue.txt" are in the same path of the script ##/wls_domains/resMGT/logs/bea/w... | 2015/02/03 | [
"https://unix.stackexchange.com/questions/182756",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/101753/"
] | Items in crontab execute with a limited environment.
At the top of your script you can specify your PATH, for example,
```
PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
```
or alternatively you can call each executable with its absolute path. | First of all, for debugging purposes, redirect the stderr to some file as well. This way you'll know what goes wrong.
`15 * * * * /bin/ksh /wls_domains/resMGT/logs/bea/wlr3queuetransaction.sh 2>LOG_FILE > /wls_domains/resMGT/logs/bea/data/script.log`
Next if it isn't a file location issue, take a look at this quest... |
10,286 | Can we become God?
Most people believe that the Gods that we are worshipping are fixed and no human can reach the state of God. Is this true?
If a person is born and lives as the purest one and when he attains the state as God, can he be included in the Gods of today?
Can a person become God if he learns all the th... | 2016/01/30 | [
"https://hinduism.stackexchange.com/questions/10286",
"https://hinduism.stackexchange.com",
"https://hinduism.stackexchange.com/users/3996/"
] | If you can perform sarvamedha or purushmedha you can become Brahman or something close to it.
[What are the similarities and differences between Purushamedha Yagna and Sarvamedha Yagna?](https://hinduism.stackexchange.com/questions/21968/what-are-the-similarities-and-differences-between-purushamedha-yagna-and-sarvame)... | Lord May be realized on different levels. As Bhagavatam States [here](https://www.vedabase.com/en/sb/1/2/11)
>
> Learned transcendentalists who know the Absolute Truth call this
> nondual substance Brahman, Paramātmā or Bhagavān.
>
>
>
Just like Sun and Sunshine. There are three features viz, Sunshine(Brahman), ... |
38,415,421 | `S_IWGRP` and `S_IWOTH` flags does not make any effect when specified in `open(2)`.
File opened and created as
```
open(file,O_CREAT|O_WRONLY,S_IWGRP|S_IWOTH);
```
that resulting in
```
---------- 1 root root 0 Jul 16 21:25 file
```
any other flags works properly.
Where should I start the troubleshootin... | 2016/07/16 | [
"https://Stackoverflow.com/questions/38415421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6260800/"
] | Use the following format
```
(container)
row
col-md-4 col-xs-6
col-md-4 col-xs-6
...(6x)
```
The columns will wrap below each other, so on medium views, you'll get 3 columns in a row, and on mobile views, 2 columns in a row.
If the trailing columns bother you, just add the classes `col-xs-offset-3` a... | Try this :
```
<div class="row">
<div class="col-xs-6 col-md-4">
<img class="images img-responsive" src="" alt="text"></img>
</div>
<div class="col-xs-6 col-md-4"><img class="images img-responsive" src="" alt="text"></img>
</div>
<div class="col-xs-6 col-md-4"><img class="images img-resp... |
45,627,021 | The task is this: print out the first letter of the third word of SongLine.
The tutor/demonstrator says I should use a loop.
```
import java.lang.*;
public class SongApp{
public static void main(String[] args){
Song song1 = new Song("While my guitar weeps");
Song song2 = new Song("Let it be");
//Song song3 = new S... | 2017/08/11 | [
"https://Stackoverflow.com/questions/45627021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8448703/"
] | ```
public static void main(String[] args){
Song song1 = new Song("While my guitar weeps");
Song song2 = new Song("Let it be");
String str1 = song1.toString();
String str2 = song2.toString();
int x=0;
int currentSpace=0;
String wordResult="";
while (x<song1.length()){
if (song1.charAt(x)=' ') {
currentS... | A working solution: :-)
```
String x = "While my guitar weeps";
x= x.trim();
for(int i=1; i<=2; i++)
x = x.substring(x.indexOf(" ")+1) ;
char reqChar = x.charAt(0);
``` |
340,429 | Actually I'm trying to dive into Fourier series and have some trouble understanding the idea behind the Fourier coefficients.
Let's have a Fourier series $$f(x) = a\_0 + \sum\_{n=1}^{\infty}[a\_n\cos(\omega\_nx) + b\_n\sin(\omega\_nx)]$$ where $x \in \langle-\frac{T}{2}, \frac{T}{2}\rangle$, $n \in \mathbb{N}$, $\omeg... | 2013/03/25 | [
"https://math.stackexchange.com/questions/340429",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/68323/"
] | On mathoverflow.net Carlo Beenakker recommended <http://techhouse.brown.edu/~dmorris/projects/tutorials/fourier_tutorial.pdf>. He hit the nail (right) on the head. | The undestanding of intuition behind coefficients of the Fourier transform may be simplified as follows. The imaginary exponential runs from minus infinity to positive infinity. As a result, all imaginary parts (the sine functions) form the negative and positive sides cancel out. What is left is the cosine part. The co... |
54,752,748 | I'm a batch scripting novice. I can spin up basic menus for my own needs but I need a little nudge in the right direction regarding menus and variables.
So I wish to create a menu which defines a variable upon selection of one, from multiple items to define the path of an item where file operations begin.
So here's a... | 2019/02/18 | [
"https://Stackoverflow.com/questions/54752748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11080440/"
] | You have a many to many relationship between bus lines (loops) and bus stops : using a junction table is the standard way to go.
In the junction table, says loops\_stops, you want to store a fk to the bus lines, another fk to the bus stops, and the sequence of the stop of the line. You can have a unique key on the two... | You can do it without junction table as below:
```
Declare @Loop Table
(Loop_Id int,
Name varchar(50))
Insert into @Loop
Values
(1,'Red'),
(2,'Green'),
(3,'Blue')
Declare @Stop_Table Table
(Stops varchar(500),
Loops varchar(50),
DisplayOrder int,
Id int)
Insert into @Stop_Table
(Stops,Loops,DisplayOrder,Id)
Value... |
7,374,779 | This is the scenario: I have a WCF service running, who communicates with this method, in C#:
```
public bool ValidateUser(UserPass up)
{
initializeAttributes();
IMembershipService Member = new AccountMembershipService();
bool login = Member.ValidateUser(up.User, up.Pass);
return l... | 2011/09/10 | [
"https://Stackoverflow.com/questions/7374779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/915768/"
] | have you tried to look at the xml created by the soap call? you can compare it to the xml created by a .net proxy. maybe this helps to find a solution.
here is how you can enable the logging of the soap calls:
<http://msdn.microsoft.com/en-us/library/ms730064.aspx> | This line looks suspect to me:
```
request.addProperty(user, pass);
```
As far as I can tell, `SoapObject` comes from the KSOAP2 library, and according to the docs, addProperty takes the name of the property and the value. To set user and pass, I would expect something more like this:
```
request.addProperty("user"... |
947,819 | I have a HP ENVY 17-3200 (switchable graphics: Intel HD 4000 + AMD Radeon HD 7800M) with a triple monitor setup:
* Laptop's builtin LVDS 1080p display
* DisplayPort WQXGA display
* DisplayPort 1080p display
This configuration worked under Windows 7, 8, and 8.1. After upgrading to Windows 10, only 2 displays work. I h... | 2015/07/30 | [
"https://superuser.com/questions/947819",
"https://superuser.com",
"https://superuser.com/users/34958/"
] | Try this...
Right click anywhere on your screen and select "Graphic Properties". When the Intel HD Graphics Control Panel comes up click the "Display" tab.
Right under Intel HD Graphics Control Panel is a "Display" with a dropdown arrow.
Don't confuse it with the "Select Display".
Click the dropdown and select "Multi... | Please download the latest Intel display drivers.
<https://downloadcenter.intel.com/product/81499/Intel-HD-Graphics-4000-for-3rd-Generation-Intel-Core-Processors>
The newest driver just came out 2 days ago (19-9-2015).
For other models:
<https://downloadcenter.intel.com/>
I have a dual-monitor setup with my la... |
4,895,041 | I have used following 2 patterns to create a view.
```
@property (retain, nonatomic) SomeView* someView;
...
// First pattern
self.someView = [[SomeView alloc] initWithFrame frame];
// Second pattern
SomeView* aSomeView = [[SomeView alloc] initWithFrame];
self.someView = aSomeView;
[aSomeView release];
```
Now, l... | 2011/02/04 | [
"https://Stackoverflow.com/questions/4895041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/433570/"
] | Look at it like this:
```
[[SomeView alloc] initWithFrame: frame];
```
The above line creates an object and gives it a retain count of 1.
```
self.someView = [[SomeView alloc] initWithFrame: frame];
```
This line leaves it with a retain count of two, because the someView property is declared with retain:
```
@p... | Yes, you are right. `autorelease` means "release a bit later". |
49,801,611 | I have drawn an outline of a mobile phone. I need to fit some short video clips into the screen of the phone. How would you go about it?
The drawn screen and video ratio are the same. It needs to be responsive of course, so my video has to scale with the frame (the graphics). Because of the graphics it is not as simp... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49801611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4163155/"
] | I found a better solution using the options
```
function formatState(state) {
const option = $(state.element);
const color = option.data("color");
if (!color) {
return state.text;
}
return $(`<span style="color: ${color}">${state.text}</span>`);
};
jQuery(node).select2({
templateResult: formatState,... | You can use the CSS attribute selector like so on select2-results\_\_option elements:
```js
$(".select2").select2();
```
```css
.select2-selection__rendered[title="Apple"] {
color: red !important;
}
.select2-results__option[id*="Apple"] {
color: red;
}
select {
width: 200px;
}
```
```html
<script src... |
269,882 | If I do this:
```
// In header
class Foo {
void foo(bar*);
};
// In cpp
void Foo::foo(bar* const pBar) {
//Stuff
}
```
The compiler does not complain that the signatures for Foo::foo do not match. However if I had:
```
void foo(const bar*); //In header
void Foo::foo(bar*) {} //In cpp
```
The code will fail to c... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35227/"
] | In the first, you've promised the compiler, but not other users of the class that you will not edit the variable.
In your second example, you've promised other users of the class that you will not edit their variable, but failed to uphold that promise.
I should also note that there is a distinct difference between
`... | It probably doesn't care much about `void Foo::foo(bar* const pBar)` because how you treat the pointer itself (const or not) doesn't matter one bit outside of the routine. The C rules say that no change to pBar will travel outside of foo either way.
However, if it is `(const bar* pBar)`, that makes a difference, becau... |
13,738,955 | Can anybody explain why in python builtin buinction `all` return `True` in this case `all([])`?
```
In [33]: all([])
Out[33]: True
In [34]: all([0])
Out[34]: False
In [35]: __builtins__.all([])
Out[35]: True
``` | 2012/12/06 | [
"https://Stackoverflow.com/questions/13738955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/655500/"
] | I'm not convinced that any of the other answers have really address the question of *why* this should be the case.
The definition for Python's `all()` comes from boolean logic. If for example we say that "all swans are white" then a single black swan disproves the statement. However, if we say that "all unicorns are p... | Another explanation for this is that `all` and `any` are generalisations of the binary operators `and` and `or` for arbitrarily long numbers of parameters. Thus, `all` and `any` can be defined as:
```
def all(xs):
return reduce(lambda x,y: x and y, xs, True)
def any(xs):
return reduce(lambda x,y: x or y, xs, Fals... |
10,751,458 | So, every time I am developing something big, with multiple modules coming together to build a final functionality, I've been wondering the same question: Where to initialize the random seed if more than 1 module needs to use the random function?
If I have a certain class that needs random (e.g. class that initializes... | 2012/05/25 | [
"https://Stackoverflow.com/questions/10751458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/884412/"
] | I would suggest using Boost.Random rather than relying on some global state shared at the program level.
Boost.Random has two concepts:
* Engine: which generates random numbers
* Distributions: which adapt the result from the engines to provide results fitted to a certain distribution (normal, poisson, gaussian, ...)... | @penelope gave a correct answer. There is some complex algorithm for generating pseudo-random number sequence behind `rand()`. This is like some function `rand_func(prev_rand)`, which generates next pseudo-random number from previous. For the first time you call `srand(time(NULL))`, which sets `prev_rand` to in these t... |
51,573 | Similar to this question: [Visually stunning math concepts which are easy to explain](https://math.stackexchange.com/questions/733754/visually-stunning-math-concepts-which-are-easy-to-explain), what are some great visualizations of basic DSP concepts such as FFTs, filters, etc? | 2018/08/28 | [
"https://dsp.stackexchange.com/questions/51573",
"https://dsp.stackexchange.com",
"https://dsp.stackexchange.com/users/37197/"
] | Personally, I very much like the interactive visualisations of filters that connect various bits together. There is a great website called [MicroModeller DSP](http://www.micromodeler.com/dsp/) (I am not affiliated with it).
You can choose the filter type, its parameters and interactively see how impulse response, zero... | A colleague and friend, Vincent Mazet, has [DSP and digital communication animations](https://vincmazet.github.io/spetsi/) (in French), among which the [cisoid or complex exponential](https://vincmazet.github.io/spetsi/expo.html):
[](https://i.stack... |
33,680,380 | Consider this code:
```
os.mkdir('foo')
open('foo/bar.txt')
```
I tried this:
```
try:
os.makedir('foo')
except OSError, e:
if e.errno != errno.EEXIST:
raise
open('foo/bar.txt')
```
and this:
```
try:
open('foo/bar.txt')
except IOError:
os.makedir('foo')
open('foo/bar.txt')
```
But ... | 2015/11/12 | [
"https://Stackoverflow.com/questions/33680380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407054/"
] | `Arrays.sort(Object[])` expects that all elements in the array are `!= null` since it demands that
>
> all elements in the array must be *mutually* comparable (that is, e1.compareTo(e2) ...
>
>
>
What you see is the result of `null.compareTo(something)`.
Your `InventoryItem[] array` has presumable 100 slots, bu... | The InventoryItem array is initialized as 100, and if you don't read in 100 rows, then you'll have null pointers for the non-existent indexes. You'll need to use a List, rather than a java array.
```
List<InventoryItem> inventoryItems = new List<InventoryItem>();
```
then when you add them do something like this,
`... |
109,647 | I work in a Startup where I was hired at the first employee, after the founder. Naturally, after the company started growing, I rose the ranks quite fast.
I am still quite young and the founder of the company was an experienced Regional Director of a very big and famous multinational company.
He decided to implement ... | 2018/03/25 | [
"https://workplace.stackexchange.com/questions/109647",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/85326/"
] | It sounds like saying anything will be a career limiting move at this place, but that may not be a bad thing. Many companies may ask for occasional overtime to get past short-term deadlines, but it's clear that here a 60+ hour week is considered normal and expected of you. It is bad enough that you're not being paid fo... | I've seen this brought up briefly: **What are YOUR motivations for working 20-30 hours a week extra?**
A startup, to me, means they are aiming for one of two things: **Massive growth** or **getting bought out** by a bigger fish.
**What are you getting out of the extra hours?**
You question doesn't mention any detail... |
48,611,720 | So I'm trying to make a simple web application that takes data from a form and adds them to a table using VueJS. Here is the code:
```
<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Vue test</title>
<script src="https://cdn.jsdelivr.net/npm/... | 2018/02/04 | [
"https://Stackoverflow.com/questions/48611720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8800595/"
] | This is because by default `<button type="submit"/>` in a `<form>` tag will try to submit form and reload the page
Check detail at [How do I make an HTML button not reload the page](https://stackoverflow.com/questions/1878264/how-do-i-make-an-html-button-not-reload-the-page)
If you prevent the default action on the ... | I've had the same problem when working with forms in Vue and Nuxt. Make sure that there's no errors in the terminal window where you're running your Nuxt app. Then, empty your cache in your browser and everything should work fine. |
346,361 | I have Ubuntu 13.04 with Gnome 3.8.
I installed `compiz`, `CCSM`. I tried to activate Wobbly Windows, but it doesn't work. It was working properly on Ubuntu 10.10 with Gnome.
Why it isn't working now? | 2013/09/16 | [
"https://askubuntu.com/questions/346361",
"https://askubuntu.com",
"https://askubuntu.com/users/193476/"
] | The wobbly windows is a feature not of Gnome, but of the window manager e.g. Compiz. The Window manager in [Gnome Shell](http://en.wikipedia.org/wiki/GNOME_Shell) is Mutter. and this does does not support Wobbly Windows (yet). There is a [Gnome Shell extension](https://extensions.gnome.org/extension/669/wobbly-windows/... | *Gnome shell* does not support wobbly windows.
*Wobbly windows* use the default Ubuntu desktop (Unity). *Gnome shell* doesn't use the *compiz window manager*, so you can't configure it using `ccsm`. |
10,102,155 | I have a COM object (C#, visual studio) with a function that takes a two dimensional array as an in parameter. When I want to access this function via Agilent VEE is is not visible in the Function & Objects browser, and not accessible. If I change the array to be single dimension, is becomes visible right away.
I hav... | 2012/04/11 | [
"https://Stackoverflow.com/questions/10102155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455479/"
] | COM Automation supports SafeArray as the wrapper type for arrays. The CLR interop layer for COM automatically generates them from a C# array type. But they are equivalent to multi-dimensional arrays, not jagged arrays. There is no equivalent automation type for arrays-of-arrays, they'll be exposed as a single dimension... | Ok, found it, of course two minutes after posting a question.
I declared my arrays as jagged arrays,
`int [][] array = new [][];`and changed it to`int[,] array = new int [,];`
Now it works! |
50,643,873 | can you show me how to work with Dialogflow with node.js. Where can I find information?
For example, here I have found one example in Python, but how to make the same in node.js?
Python code:
```
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import apiai, json
updater = Updater(token='ВАШ... | 2018/06/01 | [
"https://Stackoverflow.com/questions/50643873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9275608/"
] | As you use it here, `withLatestFrom` will always be executed. You don't need logic to check for items, tweak your structure a bit:
```
@Effect()
updateAfterChanges$ = this.actions$.pipe(
ofType(ActionTypes.ChangesInItems),
switchMap(action => {
return this.store.pipe(
select(fromReducers.getItemsList),
... | This is an expected behaviour, it's how **withLatestFrom** works, so it will start listening to the given observable **immediately**, but it will only emit the value when source get emitted!
This [example](https://stackblitz.com/edit/withlatestfrom-test?file=index.ts) will explain what’s happening:
So the console.log... |
23,311,236 | I'm a SQL newbie.
I have a postgres table that has datetime, and values. with subminute entries. I want to create a new table that takes the average of each minute and saves that instead of having subminute entries. so something like this:
```
1-12-07 12:29:56:00 2
1-12-07 12:29:56:16 3
1-12-07 12:29:56:34 3
1... | 2014/04/26 | [
"https://Stackoverflow.com/questions/23311236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1871528/"
] | Why not using array\_keys()?
```
$new_array = array_keys($array);
``` | use `array_keys` function:
```
$keys = array_keys($arr);
```
It returns an array of all the keys in array. |
28,824,037 | If you are using TestNG you would find that to use a method as a data provider you have to create a method that returns a two dimensional Object array.
So if I have a List of (say) Students , is there any utility method to convert it into a two dimensional array.
I am **NOT** looking to convert it manually using a lo... | 2015/03/03 | [
"https://Stackoverflow.com/questions/28824037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/775603/"
] | So be it ... let stackoverflow call me a tumbleweed ... but here is the answer.
```
List<Student> studentList = getStudentList();
Object [][] objArray = new Object[studentList.size][];
for(int i=0;i< studentList.size();i++){
objArray[i] = new Object[1];
objArray[i][0] = studentList.get(i);
}
return obj... | IT worked for me in single dimension array also, I converted list to single dimension array in testng data provider, Might be useful to someone
```
@DataProvider(name = "Passing List Of Maps")
public Object[] createDataforTest3(){
TestDataReader testDataReader = new TestDataReader();
List<String> ca... |
23,338,511 | I'm hoping someone can help with an issue I'm having with RestSharp. It's all working; I'm getting my reply using the following code:
```
var client = new RestClient("http://mybaseuri.com");
var request = new RestRequest("service/{id}", Method.GET);
request.AddUrlSegment("id", id);
// execute the request
IRestRespons... | 2014/04/28 | [
"https://Stackoverflow.com/questions/23338511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3580862/"
] | Using LINQ:
```
string userId = response.Headers
.Where(x => x.Name == "userId")
.Select(x => x.Value)
.FirstOrDefault();
```
This requires no knowledge of the index of the element, and deals with the scenario where the header does not exist. | If you know the index of "userId" then you can do the following:
```
string userId = response.Headers.ElementAt(indexOfUserId).Value.ToString();
``` |
22,895,299 | I want to replace a comma followed by a < br > so I used regex et replace method to do that:
```
var str = "<a class=added> ,,, ,, blbl;test, </a><br>, <a class=added>"
str = str.replace(/br>(,\s)/g, " ");
alert(str);
```
In the result I noticed that 'br>' was also removed and it is not the exected result.
Is there... | 2014/04/06 | [
"https://Stackoverflow.com/questions/22895299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2578661/"
] | This question is similar to: [How to select option in drop down protractorjs e2e tests](https://stackoverflow.com/questions/19599450/how-to-select-option-in-drop-down-protractorjs-e2e-tests/20308276#20308276)
So long as you're on a recent version of protractor, you can just do:
```
element(by.cssContainingText('optio... | As you want to select option by value, you can use:
```
var select = element.one(by.model('selectData'));
select.$('[label="Option 1"]').click();
``` |
21,597,880 | I am having the hardest trouble trying to run SWI-prolog on my Mac.
When I type:
```
/opt/bin/local/swipl
```
I get an error saying:
```
/opt/local/bin/swipl: No such file or directory
```
When I just type "swipl" I get:
```
swipl: command not found
```
I've tried this on both terminal and XQuartz. I've eve... | 2014/02/06 | [
"https://Stackoverflow.com/questions/21597880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3278629/"
] | There are three sensible ways of installing SWI-Prolog on MacOS X, in increasing order of complexity:
1. Download the SWI-Prolog application. In this case, you just download a disk image, open it, and drag the application to your disk (e.g. to your `Applications` folder. You use the application as any other applicatio... | Homebrew has moved swi-prolog to the top a few days ago and because of this, the other answers are not valid anymore. The reason for that: the swi-prolog formula was located in the x11 bottle but the x11 dependency is only optional.
As of today, to install swi-prolog with homebrew, simply do:
```
brew install swi-pr... |
3,579,531 | how do I write an expression which checks for lowcaps, dots, and without any white space in the string?
the code below so far was trying to check for lowcaps and dots (it does not work anyway!) but I don't know how to add in the expression for white spaces.
```
# check for matches of lowcaps or lowcaps with a dot
if ... | 2010/08/26 | [
"https://Stackoverflow.com/questions/3579531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/413225/"
] | `[a-z0-9.]` matches a lower-case letter or a digit or a dot.
`[^a-z0-9.]` matches all characters that are not a lower-case letter or a digit or a dot.
So if `/[^a-z0-9.]/` matches anywhere the string contains something other than lc-letter,digit or dot. If it does not match your condition is fulfilled.
```
if ( ... | ```
/^[a-z0-9.]+$)/
```
Should do it. Just think about that *only small letters, dots and digits are allowed*. The expression will not match if any white-space is included. Btw. you don't have to escape meta-characters in a capture group.
`^` and `$` indicates that the whole string should only contain those charact... |
43,773,952 | How can I list all uppercase/lowercase permutations for any letter specified in a character array?
So, say I have an array of characters like so: ['h','e','l','l','o']
and I wanted print out possible combinations for say the letter 'l' so it would print out [hello,heLlo,heLLo,helLo].
This is what I have so far(the on... | 2017/05/04 | [
"https://Stackoverflow.com/questions/43773952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5016598/"
] | Sanket Makani answer is perfect.
I may offer a more objective approach of this problem.
As an input you have a string to modify, and characters, which should be replaced with the modified case ( upper or lower ).
As an output you will have all permutated strings.
I would create a structure which contains index, and ... | For the permutation case, I think recursion is the best fit in terms of readability, taking into account that maybe is not best in terms of performance.
My approach would be this:
```
public static void main(String[] args) {
generateCombinations("hello", "l", "");
}
public static void generateCombinations(String... |
59,334,343 | I'm trying to fill missing value with R.
If all other value is 0, then I want to fill missing with 0.
An example is shown below. In this data, All value in `c` column except `NA` is 0. So, I want to fill `Na` with 0.
```
set.seed(1000)
a<-rnorm(10)
b<-rnorm(10)
c<-rep(0,10)
c[c(2,4,8)]<-NA
test<-cbind(a,b,c)
... | 2019/12/14 | [
"https://Stackoverflow.com/questions/59334343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11275093/"
] | Quick value, if all your columns are numeric:
```
colSums(!is.na(test)) == colSums(test==0,na.rm=TRUE)
a b c
FALSE FALSE TRUE
```
We change the TRUE columns
```
wh = which(colSums(!is.na(test)) == colSums(test==0,na.rm=TRUE))
for(i in wh){test[is.na(test[,i]),i] = 0}
a b c
... | First convert `test` into data frame to access `$` operator
```
set.seed(1000)
a<-rnorm(10)
b<-rnorm(10)
c<-rep(0,10)
c[c(2,4,8)]<-NA
test<-cbind(a,b,c)
test <- data.frame(test)
```
Convert variable `c` into a factor and create a level "0", if `test$c` is "NA"
```
test$c <- as.factor(test$c)
t... |
222,284 | To start off, I'm not a physicist but a programmer, and only had a few years of physics education in high school so I'm sorry if I'm asking a stupid question.
I just finished watching the movie [Gravity](http://www.imdb.com/title/tt1454468/) (2013) and I found online already a whole list of things wrong with the movie... | 2015/12/04 | [
"https://physics.stackexchange.com/questions/222284",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/100459/"
] | >
> Is it true that debris can stay in orbit at the same height as space stations, while having a very large relative speed to the space stations?
>
>
>
Most [LEO](https://en.wikipedia.org/wiki/Low_Earth_orbit) objects orbit in the same direction, namely the direction the Earth rotates. This is done to take advant... | * The satellite did not start in the ISS orbit, and not all orbits are circles.
The ISS orbit is free of large satellites. So the fictional one from the movie was in a different orbit. Therefore it's not too difficult to believe that debris from it would have a high relative velocity. The debris might have been in a v... |
8,360 | I want to make a column in a relation unmodifyable for consistency reasons.
The backstory is that I have a n:n relationship where the "connecting" relation has additional values. I don't want that anyone is able to change the IDs of the relationship partners.
What I have come up with so far:
Creating a trigger tha... | 2011/11/24 | [
"https://dba.stackexchange.com/questions/8360",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/4689/"
] | [I actually learned a back-alley approach to aborting triggers](https://dba.stackexchange.com/q/2368/877). It is very crude, but works because SIGNAL processing is not implemented in MySQL's Stored Procedure Language. It can be emulated at best.
Chapter 11, Pages 254-256 of the book **[MySQL Stored Procedure Programmi... | It is actually possible to do this neatly without using triggers if you are using InnoDB.
Create another table with just one column. That column should have a foreign key (hence the innodb requirement in this solution) that points to the immutable column of the original table in question.
Put a restriction like "ON ... |
66,863,200 | I am using Vite (<https://vitejs.dev/>) for a static multipage site.
This is the default project folder structure after the build command.
```
my-app/
├─ node_modules/
├─ dist/
│ ├─ assets/
│ ├─ index.html
├─ index.html
├─ main.js
├─ style.scss
├─ package.json
```
But I want to make this a multipage site and chang... | 2021/03/30 | [
"https://Stackoverflow.com/questions/66863200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5705914/"
] | Create a `vite.config.js` file and define your project root and output directory as such:
```js
module.exports = {
root: 'src',
build: {
outDir: '../dist'
}
}
```
For more info, checkout [config](https://vitejs.dev/config/#build-outdir). | When you want to use defineConfig in your vite.config.ts you can use it like this:
```js
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'
import eslintPlugin from 'vite-plugin-eslint'
// https://vitejs.dev/config/
export default defineConfig({
plu... |
13,830,647 | I have a form
```
<form name="loginForm" method="POST">
Username: <input type="text" name="username" value="" />
<br />
Password: <input type="password" name="password" value="" />
<input type="submit" name="submitButton" />
</form>
```
How do I take the information above after hitting the submit but... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13830647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896252/"
] | Use the onSubmit event:
HTML:
```
<form name="loginForm" method="POST" onsubmit="checkLogin()">
Username: <input type="text" name="username" value="" />
<br />
Password: <input type="password" name="password" value="" />
<input type="submit" name="submitButton" />
</form>
```
Script:
```
function c... | You will use $.post in the following way {
```
$.post(URL_TO_YOUR_SCRIPT, { username: $("#username").val(),
password: $("#password).val() },
function(data) {
alert(data);
});
```
to achieve this, you will have to give ID's to your input boxes like
```
<input type="text" name="username"... |
52,187,980 | Having a lot of trouble solving this (I looked through other posts with the same problem but unfortunately I didn't have much luck in applying proposed solutions to my situation).
I have a single (very large) table with transactional information. One of the columns is Transaction Execution Time (field type Time). Exec... | 2018/09/05 | [
"https://Stackoverflow.com/questions/52187980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3760419/"
] | The complete solution to this problem consists of three steps:
**STEP 1**:
In the `onCreate()` of your `BaseActivity` (or all your `Activity`s), set the `Locale` as follows:
```
@Override
protected void onCreate(Bundle savedInstanceState) {
// set the Locale the very first thing
Utils.setLocale(Utils.getSav... | ```
public void setLocale(final Context ctx, final String lang) {
AppSettings.getInstance(ctx).save(PrefKeys.language, lang);
final Locale loc = new Locale(lang);
Locale.setDefault(loc);
final Configuration cfg = new Configuration();
cfg.locale = loc;
ctx.getResources().updateConfiguration(cfg, ... |
15,289,059 | Hello I am trying to install Java on my mac with osx 10.8.2.
If I am typing `java -version` in the terminal, I get the following error:
`No Java runtime present, requesting install.
2013-03-08 08:36:03.477 java[1192:707] JLRequestRuntimeInstall: Error calling: CFMessagePortCreateRemote`
Yesterday I completely uninst... | 2013/03/08 | [
"https://Stackoverflow.com/questions/15289059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1979703/"
] | I finally fixed it by uninstalling everything with java and installing the java packet with the sdk. | Install the JDK from [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) - Follow the instructions from: [here](http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html)
Once installed run `java -version` again. |
7,011,494 | I have declared an int e.g. int i;
I have a method that is looped:
```
public static void NumberUp(int i)
{
i++;
System.Console.WriteLine(i);
...
}
```
although each time the number is returned, it is always 1. Not 1,2,3 and so on..
I would have imagined that "i" increases by one which each ru... | 2011/08/10 | [
"https://Stackoverflow.com/questions/7011494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/887901/"
] | You can pass the variable [by reference](http://msdn.microsoft.com/en-us/library/14akc2c7.aspx).
```
public static void NumberUp(ref int i)
{
i++;
System.Console.WriteLine(i);
...
}
```
This, however is bad design, as you now have a method with a side effect on the passed in parameter (which the method name... | It would be better to define `NumberUp` like this
```
public static int NumberUp(int number)
{
System.Console.WriteLine(++number);
return number;
}
```
Then assign the return value in your loop. |
20,345,201 | I want get the id of the element that is clicked and within a specified class, and want to print the ID.
Here is my JS , I am really new JS , Please help
```
$('.wrapinner').click(function(e) {
$('.wrapinner').css("margin-top","0");
$('.wrapinner').css("opacity","0.4");
$(this).css("m... | 2013/12/03 | [
"https://Stackoverflow.com/questions/20345201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429059/"
] | You can call the native javascript object directly; `this.id`.
```
$('.wrapinner').click(function(e) {
$('.wrapinner').css("margin-top","0").css("opacity","0.4"); // chained these two
$(this).css("margin-top","25px").css("opacity","1"); // chained these two
var r = this.id; // this should already refere... | **Try this example:**
```
<table>
<tbody>
<tr id="CustomerScreen" class="rows"></tr>
<tr id="TraderScreen" class="rows"></tr>
<tr id="DistributorScreen" class="rows"></tr>
</tbody>
</table>
<script>
$('.rows').each(function () {
var ar = this.id;
console.log(ar);
});
</script>
``` |
5,819,297 | Do you know any C# based "puzzles and answers" like book? Article? Resource?
Why I am asking this is to enlarge my vision with some interesting quiz-like scenarios; to force myself think in a different way and which I can maybe have an advantage on unexpected interview questions.
Thanks! | 2011/04/28 | [
"https://Stackoverflow.com/questions/5819297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136141/"
] | Although it's not specific to C#, [Project Euler](http://projecteuler.net/) is a lot of fun. | A StackExchange site: [Programming Puzzles & Code Golf](https://codegolf.stackexchange.com/) |
29,278,480 | I have an array of objects, an example of a few of them being
```
[
{
"lang_code": "eng",
"site_language": "1",
"name": "English"
},
{
"lang_code": "afr",
"site_language": "1",
"name": "Afrikaans"
},
{
"lang... | 2015/03/26 | [
"https://Stackoverflow.com/questions/29278480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4622086/"
] | How about a `for` loop. Something like:
```
function find_lang(input_arr, lang_code) {
for(var i = 0; i < input_arr.length; i++) {
var o = input_arr[i];
if( o.lang_code === lang_code ) {
return o.name;
}
}
return "invalid";
}
``` | You could do it this way:
```
// configure your parameters
function checkArr(){
for (var i = 0; i < x.length; i++){
if (x[i].lang_code == "eng")
return "English";
}
return "invalid";
}
var x = [
{
"lang_code": "eng",
"site_language": "1",
"name": "English"... |
14,840,984 | I'm running two libraries that are dependency aware. What I mean is the order of their execution does not matter. They will detect each other and run in any order.
```
script1.js
script2.js
```
Would I benefit by running these scripts in parallel ([parallel processing](http://en.wikipedia.org/wiki/Parallel_processi... | 2013/02/12 | [
"https://Stackoverflow.com/questions/14840984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | No, javascript is executed on a single thread in the web browser. So you cannot run them in parallell unless they are not user interactive (does not interact with the DOM).
However, you can LOAD the script asynchronously to speedup initialization.
Simply use the `async=true` attribute on `<script>`. Like this:
```
<... | My bet, **YES**.
Its like asking
`1 man takes 6 days to do a task. How much time will 2 men take?`
:-)
Most **ideal** use-case for WebWorkers |
60,500,654 | I tried to fill the whole screen with black using `flex: 1`. but the result is like this
[](https://i.stack.imgur.com/7GpYd.png)
[](https://i.stack.imgur.com/dO7DN.jpg)
```
<View
... | 2020/03/03 | [
"https://Stackoverflow.com/questions/60500654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10207535/"
] | First import:
```
import { StatusBar } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
```
Change your layout to:
```
<StatusBar backgroundColor="black" barStyle="white-content"/>
<SafeAreaView
style={{
flex: 1,
backgroundColor: 'black',
}}
>
<Vie... | You can user Dimensions.get('window') to get the full height and width of the screen.
declare a const
```
const HEIGHT = Dimensions.get('window').height;
const WIDTH = Dimensions.get('window').width;
```
then use this inside style
```
style = {{
height = HEIGHT,
width = WIDTH,
b... |
19,145,999 | I'm using YQL to fetch a bunch of pages, some of which could be offline (obviously I don't know which ones). I'm using this query:
```
SELECT * FROM html WHERE url IN ("http://www.whooma.net", "http://www.dfdsfsdgsfagdffgd.com", "http://www.cnn.com")
```
Where the first and the last one are actual sites, while the s... | 2013/10/02 | [
"https://Stackoverflow.com/questions/19145999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774236/"
] | Unfortunately, I do not know a way where you can get a key=>value pair in the response where key being the url and value being the html response. But, you can try the following query and see if it meets your use case:
```
select * from yql.query.multi where queries="select * from html where url='http://www.whooma.net'... | You can figure out which urls aren't loading by using the YQL diagnostics flag. The diagnostics flag will cause the response to include a `diagnostics` property with a `url` array that indicates whether the corresponding servers were found. Presumably, once you eliminate the urls that didn't load, the result pages will... |
20,544,017 | **Hi All**
I'm running:
EXT.KEY: news on TYPO3 v. 6.1 with FLUID/EXTBASE.
I have 2 issue's/question.
1 - News Tag's disappear, when using "tag list" in plugin.
==========================================================
I have added a "tag list" as element on my TYPO3 page, and its working fine, my problem is when ... | 2013/12/12 | [
"https://Stackoverflow.com/questions/20544017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/514993/"
] | Split your functions so that they do *one thing*.
```
def switch_x_with_y(line):
return line.replace("x", "y")
def replace_z_with_a(line):
return line.replace("z", "a")
f_output = open("output.txt", "w")
for line in open("input.txt", "r"):
line = replace_x_with_y(line)
line = replace_z_with_a(line)
... | Your question is poorly written. Any way if you want to keep data and do some processing you can use [pandas](http://pandas.pydata.org/pandas-docs/dev/dsintro.html) `DataFrame`s.
```
import pandas as pd
import numpy as np
from pandas import read_csv
df = pd.read_csv('input.txt')
df.columns = ['col'] #I suppose you do... |
298,130 | I have a win 2003 DC that has failed and i'm trying to clean up the metadata using ntdsutil as per instructions from <http://www.petri.co.il/delete_failed_dcs_from_ad.htm> and <http://support.microsoft.com/kb/216498>
At the "remove selected server" step i get the following error
>
> DsRemoveDsServerW error 0x5(Acce... | 2011/08/05 | [
"https://serverfault.com/questions/298130",
"https://serverfault.com",
"https://serverfault.com/users/49410/"
] | You posted that you have full access Rights, but are you a member of the Enterprise Admin group? During a demotion, I ran into a few issues because at the time, I was only a Domain Admin. Once added to the Enterprise Admin group, I was able to complete the demotion. | Under AD Sites and Services, go to the NTDS folder of the server. Look at the properties. Under the Object tab, make sure "Protect object from accidental deletion" is unchecked. |
2,702 | En algunas ediciones del [translation-golf](https://spanish.stackexchange.com/questions/tagged/translation-golf "show questions tagged 'translation-golf'"), el texto original tiene referencias a números, expresadas en algunos casos con cifras y en otros con letras. Por poner un ejemplo, en [la edición XIV](https://span... | 2017/09/19 | [
"https://spanish.meta.stackexchange.com/questions/2702",
"https://spanish.meta.stackexchange.com",
"https://spanish.meta.stackexchange.com/users/12637/"
] | No
==
Se debe respetar el original si este ha decidido no usar números. Además, si todo el mundo usa números se pierde la competitividad al dejarse de buscar sinónimos o expresiones equivalentes escritas con letras (ejemplo: "doscientas treinta y siete" por "más de doscientas"). Si todos escribieran "237" no tendría g... | Si, pero deben ser normalizados
===============================
Hay casos en que los números parecen mejores y otros en que no lo parecen. Por ejemplo `T-101` vs `T-ciento uno` y `morirán mil` vs `moriran 1000`. La pregunta de cómo se escriben números no debería influir en los puntos. Una manera de garantizarlo sería ... |
43,122,911 | I'm using a scroll view which is having only one child linearlayout.
Linearlayout contains listview and some other items also, but only listview is scrolling. what should i do ?
Here is my layout
```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:f... | 2017/03/30 | [
"https://Stackoverflow.com/questions/43122911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7505436/"
] | Never put A `ListView` inside a `ScrollView`. It is a bad practice and it defeats the purpose of having a `ListView`. Who wants two scrollable areas on a screen anyway?
Instead add a header or footer view on your listView depending on what you need. | Try this layout:
changes:
1. Make your inner linearlayout wrap into `Scrollview`
2. Apply `android:layout_height="wrap_content"` for `scrollview`
3. End the `scrollview` before `Listview` as both can not be applied together
```
<?xml version="1.0" encoding="utf-8"?>
```
```
<include layout="@layout/toolbar" />
<S... |
2,176,544 | Hey, I'm just wondering how I could remove all the text if it encounters a certain string inside a string :
EX: 24 Season 1 Episode 3
I would like, that if it find the text Season that it removes it and everything after so it would just leave you with :
24
Thanks
Ah sorry I forgot to say I need this in PHP. | 2010/02/01 | [
"https://Stackoverflow.com/questions/2176544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/263192/"
] | ```
$string="24 Season 1 Episode 3";
$s = explode("Season",$string,2);
echo $s[0];
``` | 1.If u need all the strings which occurs after certain word this will work
$str="24 Season 1 Episode 3";
echo strstr($str, 'Season');
2.If u need all the strings which occurs before certain word this will work
```
$str="24 Season 1 Episode 3";
$arr = explode("Season", $str, 2);
$first = $arr[0];
echo $first;
``` |
8,769,656 | I want to redirect the user to login page on landing, While user is not logged in.
for example :-
```
example.com ->(not logged in)-> redirect to login page.
example.com ->(logged in)-> redirect to Home page.
```
How can i do this ?
I was found some function like this
```
public function preDispatch()
{
pa... | 2012/01/07 | [
"https://Stackoverflow.com/questions/8769656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430112/"
] | ```
$customerId = (int) $this->getRequest()->getParam('id');
$customer = Mage::getModel('customer/customer')
->load($customerId);
$userSession = Mage::getSingleton('customer/session');
$userSession->setCustomer($customer);
Mage::dispatchEvent('customer_login', array('customer'=>$customer));
$this-... | ```
$redirect_url = Mage::getUrl('customer/account/login/');
$current_url = Mage::helper('core/url')->getCurrentUrl();
if((!$this->helper('customer')->isLoggedIn()) && ($current_url != $redirect_url)){
Mage::app()->getFrontController()->getResponse()->setRedirect($redirect_url);
}
``` |
57,961,666 | I am writing code that will count the number of times each word in an array appears as well as the total of number of all the words appearing. I have managed to create an array which allows the user to add in a number of words they wish to check. However, I am struggling to find a way to count the number of times each ... | 2019/09/16 | [
"https://Stackoverflow.com/questions/57961666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Initialize Postgres container with Data
---------------------------------------
Create a `docker-compose.yml`
```
version: '2'
services:
postgress-postgresql:
image: postgres:11.3
volumes:
# - ~/volumes/jhipster/postgress/postgresql/:/var/lib/postgresql/data/
- ./init.sql:/docker-entrypoint-in... | The underlaying problem in our case was that the sql script was stored on a ntfs partition mounted with ntfs-3g which by default has got permissions' functionality disabled (<https://superuser.com/questions/451475/chmod-doesnt-work>). Running it on a normal ext4 partition solved the problem. |
9,521,568 | Should i include classes that are part of the Java API, such as `HttpURLConnection` or `JSONObject` in my class diagram, or should i include only the classes that was developed for the project?
My Program connecting to a server, retrieving data, constructing a `JSONObject` then uses this data to construct some objects... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9521568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/352660/"
] | This of course goes with personal taste. But I personally tend not to include them. Or only refer to them by name but without the properties/methods listed to bring in the point that we don't control this class. | What do you want to achieve / communicate with your UML diagram?
Does including these classes help achieving that?
Look, there it is. Your answer. |
65,586,826 | I have a 3d array in Java which is like this: (size 3x2x4)
```
{{{1,2,3,0},{1,2,0,3}},{{1, 1, 1, 0}, {1 , 1, 0, 1} } , {{ 2,2,2,0},{2,2,0,2}}};
```
I want to return the sum of every third and forth columns values, and to return as array the value of third and fourth columns. This means: (array value of third and fou... | 2021/01/05 | [
"https://Stackoverflow.com/questions/65586826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14947625/"
] | Solution
--------
**For the sum Method**
The code should be straightforward. So I go down all the three dimensions with the for loops and as you said the size is fixed.
>
> size 3x2x4)
>
>
>
In the last Dimension I just build the sum of the third and fourth element at index 2 and 3 and and then put it into a ... | The sum of the third dimension of the 3d array by the third and fourth columns:
```java
int[][][] arr3d = {
{{1, 2, 3, 0}, {1, 2, 0, 3}},
{{1, 1, 1, 0}, {1, 1, 0, 1}},
{{2, 2, 2, 0}, {2, 2, 0, 2}}};
int[][] arr = Arrays.stream(arr3d)
.map(arr2d -> Arrays.stream(arr2d)
/... |
24,323 | I'm currently trying to subscribe to my Google Contact's Birthday calendar from Hotmail, so far without success.
I've used the ical link from the calendar settings in Google to create the subscription and it appears to create successfully.
Going back into the calendar settings in Hotmail the same error is repeated ... | 2012/02/29 | [
"https://webapps.stackexchange.com/questions/24323",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/17746/"
] | Currently this isn't possible due to the fact that the iCal address for your Contact Birthdays Calendar isn't a personalized URL.
This is the url that you get for Google Contact Birthdays: `https://www.google.com/calendar/ical/%23contacts%40group.v.calendar.google.com/public/basic.ics`
This will only work from within... | Mismatch of syntax between calendars....
One syntax check which can lead to this in Outlook, is a line in the ics data
DTSTART;VALUE=DATE:20141014T193000Z
which should set the date but not the time. The time should be left at default 00:00
DTSTART:20141014T193000Z
will set the start time to 19:30.
If the top form... |
33,643,377 | I created my own function to reverse the words in a phrase such as:
```
reverse("Hello my name is Bob")
Bob is name my Hello
```
This is the code that I have
```
def first_word(string):
first_space_pos = string.find(" ")
word = string[0:first_space_pos]
return word
def last_words(string):
first_spa... | 2015/11/11 | [
"https://Stackoverflow.com/questions/33643377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5254097/"
] | Although you can use [::-1] to get a reversed list, you can also use `reversed`, cause it's more readable and explicit.
```
>>> words = "Hello my name is Bob"
>>> ' '.join(reversed(words.split(' ')))
'Bob is name my Hello'
``` | you need to modify your loop slightly
```
def reverse(string):
words = string.count(" ") +1
count = 1
string_reversed = ""
while count < words:
string_reversed = first_word(string) + str(" ") + string_reversed
string = last_words(string)
count += 1
print(string + " " + string_reversed)
return string +... |
26,443,642 | I am trying to get which of the \* is clicked in text of label as in picture.

NOTE : Number of \* is not known at first.User inputs it.So the position of mouse click is not useful. | 2014/10/18 | [
"https://Stackoverflow.com/questions/26443642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2511763/"
] | Answer is :
X of first \*'s location is known, equals = 10 .The asterisks are spaced equally,distance between two \* is ~15 pixel .
When user clicks on one of asterisks , index of asterisks can be calculated as the code below
```
private void label4_MouseDoubleClick(object sender, MouseEventArgs e)
{
... | It depends. If you are willing to display the text in a TextBox instead of Label (which is what it looks like you're using now), then you can use the [GetCharIndexFromPosition](http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.getcharindexfromposition(v=vs.110).aspx) method. Just make sure you sp... |
65,310 | I am using Apache Axis to connect my Java app to a web server. I used wsdl2java to create the stubs for me, but when I try to use the stubs, I get the following exception:
>
> org.apache.axis.ConfigurationException: No service named `<web service name>` is available
>
>
>
any idea? | 2008/09/15 | [
"https://Stackoverflow.com/questions/65310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328/"
] | According to the [documentation](http://wiki.apache.org/ws/FrontPage/Axis/DealingWithCommonExceptions) linked to by @arnonym, this exception is somewhat misleading. In the first attempt to find the service a ConfigurationException is thrown and caught. It is logged at DEBUG level by the ConfigurationException class. Th... | I don't know what version of Axis you're using but I'm using Axis2 for both server and client and the Java2WSDL create a default endpoint for the service on localhost. If you create the client stub with WSDL2Java, the default constructor of the stub will then point to localhost. If the service is on other endpoint you ... |
4,215,127 | I would like to map a file into memory using mmap function and would like to know if the amount of virtual memory on the current platform is sufficient to map a huge file. For a 32 system I cannot map file larger than 4 Gb.
Would `std::numeric_limits<size_t>::max()` give me the amount of addressable memory or is the... | 2010/11/18 | [
"https://Stackoverflow.com/questions/4215127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18775/"
] | Hi you can use GlobalMemoryStatusEx and VirtualQueryEx if you coding in win32 | You can try `sizeof(int*)`. This will give you the length (in bytes) of a pointer on the target platform. Thus, you can find out how big the addressable space is. |
50,480,098 | Our company is developing a very complex single page app(something like excel) with vue.js. There are 10000+ components(each cell is a component) and each component would have about 100 reactive props(data items). We also use vuex. It works but we are worried about its performance(Indeed it performs a little slowly). W... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50480098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1446907/"
] | >
> if it is rewritten by jQuery it will be faster
>
>
>
Even if that was true, it would make your app harder to maintain. But this statement is a **False Dichotomy**, as if the choice between the frameworks/libraries were the deciding factor in determining the application's performance. It's *not*. However if you... | The following [link](https://codepen.io/pdg/pen/MoVWKw) proves Vue/Vuex is not the problem, perhaps your design is flawed?
>
> This simple test measures the creation of elements in an array
> and the output to the DOM through a sync and an async loop, on a VUEjs
> reactive attribute. From the UX point of view, the ... |
174,795 | I have been job hunting for a few months, as of writing. I have gone through a number of interviews, in some of which the interviewer/hiring manager has asked "could you tell us about yourself?"/"what have you been doing over the past XXX period" (or phrased similarly.)
As someone who is graduating from university, ha... | 2021/07/20 | [
"https://workplace.stackexchange.com/questions/174795",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/-1/"
] | This is the most common opener question in any job interview for any applicant. They ask for exactly that: Tell us about yourself. They have read your resume, sometimes througoutly, sometimes just skimmed through. Doesn't matter. Now they want to hear it from your perspective. Not just the hard facts, but how you see y... | First, this seems to be a common complaint among new computer-workers on SE Workplace:
>
> I've found these questions to be mildly insulting... it comes across
> to me that the interviewer has not gone to the effort of glancing at
> my CV...
>
>
>
Well, they probably haven't, so you need to get over this. Maybe t... |
207,394 | Referring to question like [Differences between HashMap and Hashtable?](https://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable) I wonder how could it be accepted as it satisfy none of criteria mentioned in SO. I should be able to flag it off-topic as it falls under
*Questions concerning... | 2013/11/14 | [
"https://meta.stackexchange.com/questions/207394",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/232504/"
] | >
> Questions **concerning problems with code you've written** must describe the specific problem — and include valid code to reproduce it — in the question itself
>
>
>
The question is not concerning a problem with code the author wrote, so that doesn't apply.
>
> Questions **asking for code** must demonstrate ... | There's a tension here between being a repository of answers to questions and expecting people to do research. The first 1/2 of that question about hash tables is a factual question that many new Java programmers need to answer. It's also one with many perfectly good answers findable on Google. Now, of course, the stac... |
404,457 | I need to change the layout of the keyboard while working in the console on Linux. I need to set up English layout as the default for the console. How can I do it? | 2012/03/24 | [
"https://superuser.com/questions/404457",
"https://superuser.com",
"https://superuser.com/users/63329/"
] | To change the system-wide keyboard layout, run
```
sudo dpkg-reconfigure keyboard-configuration
```
or edit the `XKBLAYOUT` line in `/etc/default/keyboard`. | `loadkeys us`, it loads US keys but for a single session. |
115,685 | How can we refer to the polite phrase used at the beginning of a letter (email in my specific context)?
For example, we may start our letter:
>
> Dear Bob, I hope that you're well and had a nice weekend.
>
>
>
If we want to make reference to the line
>
> I hope that you're well and had a nice weekend
>
>
>
... | 2013/06/03 | [
"https://english.stackexchange.com/questions/115685",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3045/"
] | Either '[greeting](http://www.thefreedictionary.com/greeting)' or '[salutation](http://www.thefreedictionary.com/salutation)' would fit.
From the online dictionary, meaning 3 is appropriate:
>
> sal·u·ta·tion (sly-tshn) n.
>
>
> 1. a. A polite expression of greeting or goodwill. b. salutations Greetings indicating... | I don't know of a word that describes this kind of remark (sentence) when it is made in a written context such as a letter. On the other hand, the term *phatic* is used to describe similar sorts of remarks when they are spoken. "How are you?" is frequently used as a phatic utterance; consider, for example, the telephon... |
572,552 | How are they different in pronunciation?
In other words, how can one recognise the difference purely by sound? | 2021/08/10 | [
"https://english.stackexchange.com/questions/572552",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/426380/"
] | Here are some opinions voiced on [WordReference](https://forum.wordreference.com/threads/pronunciation-th-%CE%B8-%C3%B0-after-t-or-d-sound.2254580/) by native speakers about this difficulty of English pronunciation; it appears to be a matter of how careful the speakers like to be, and, apparently there is no solution t... | Cook the: /kʊk ðə/ or /kʊk ðiː/
Cooked the: /kʊkt ðə/ or /kʊkt ðiː/ |
23,736,216 | I need to send a data from a Symfony form with an Ajax call with an extra Data containing options for the controller.
I'm working on a custom framework including the Symfony form component.
So I try in my JS to send values like this :
```
$.ajax
(
{
type: "POST",
url: '/myUrl',
data:
... | 2014/05/19 | [
"https://Stackoverflow.com/questions/23736216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3652328/"
] | You need to set the id as String or UUID (or anything you need).
Below, an example of my class User with another possibility:
```
import java.util.UUID
class User {
String id = UUID.randomUUID().toString()
static mapping = {
id generator:'assigned'
}
}
``` | Here's what I did in my Grails 3 domain class...
```
class MyClass {
static constraints = {
}
UUID id
static mapping = {
id generator: "UuidGenerator", length: 36, type: "uuid-char"
}
}
```
Then here's what I have inside UuidGenerator.groovy
```
import org.hibernate.id.IdentifierGe... |
11,417,551 | I am trying to unbind a link from all functions. When I do:
```
$('a').unbind();
```
It works perfectly. But obviously this is not what I want - I only want one specific link to not be manipulated by any functions. So I tried selecting the specific link:
```
$('.page1->index').unbind();
```
But this did not work,... | 2012/07/10 | [
"https://Stackoverflow.com/questions/11417551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1464197/"
] | If the name of your class is `page1->index`, then you need to escape '`>`' symbol, because it has a [special meaning](http://www.w3.org/TR/css3-selectors/#child-combinators) in `CSS` selectors:
```
$('.page1-\\>index').unbind();
``` | Use the ID of the link. ID will be unique so you will get only one element in your jQuery selector
```
$('#yourLinkId').unbind();
```
Assuming your HTML is like this (with the ID)
```
<a href="somepage.aspx" id="yourLinkId">Wonderful Link</a>
<a href="somepage3.aspx" id="yourMagicLink">Magic Link</a>
``` |
10,079,304 | I've recently begun to realize that the use of the "extern" keyword is highly encouraged. Thus I began to wonder if there is anything wrong with the current (extern-less) way I use header files:
main.c:
```
#include "main.h"
#include "function.h"
int main(void){
globalvariable = 0;
testfunction();
retur... | 2012/04/09 | [
"https://Stackoverflow.com/questions/10079304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/860618/"
] | ```
extern int globalvariable;
```
is a *declaration*
```
int globalvariable;
```
is both a declaration and a *tentative definition*.
In C, it's illegal for the same variable to have multiple definitions, and that will happen if you use the latter in a header file that's included in more than one translation unit... | ANSI C standard says
>
> If the declaration of an identifier for an object has file scope and
> no storage-class specifier, its linkage is external.
>
>
> |
42,548,602 | I want to use Python's multiprocessing unit to make effective use of multiple cpu's to speed up my processing.
All seems to work, however I want to run `Pool.map(f, [item, item])` from within a class, in a sub module somewhere deep in my program. The reason is that the program has to prepare the data first and wait fo... | 2017/03/02 | [
"https://Stackoverflow.com/questions/42548602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/546465/"
] | >
> you are submitting form with array of text fields and select box, try
> below
>
>
>
```
public function store(Request $request)
{
$count = Client::count();
foreach( $request->client_id as $key=>$val){
$payment = Payment::create(['amount' => $request->amount[$key],
... | Ty to create the record like this:
```
$payment = Payment::create($request->input);
```
And change you redirect action to this:
```
View::make('path/to/view/')
```
or just use just `back();` just to test if it works |
2,610,416 | I am writing code that catches this `OutOfMemoryException` and throws a new, more intuitive exception:
```
/// ...
/// <exception cref="FormatException">The file does not have a valid image format.</exception>
public static Image OpenImage( string filename )
{
try
{
return Image.FromFile( filename );
... | 2010/04/09 | [
"https://Stackoverflow.com/questions/2610416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/233098/"
] | No, it is history. GDI+ was written quite a while before .NET ever came around. The SDK wrapper for it was written in C++. Exceptions are iffy in C++, not everybody buys into them. Google doesn't for example. So to keep it compatible it reports problems with error codes. That just never scales well, library programmers... | It's a misleading exception. Microsoft [says](http://support.microsoft.com/kb/810109):
>
> **You receive a "System.OutOfMemoryException" error message when you try to use the Bitmap.FromFile method in the .NET Framework 1.0**
>
>
> This problem may occur when you use the **Bitmap.FromFile** method and one of the fo... |
46,531 | in putting together a new installation, one of the requirements is that we use fiber to the desktop. we are going to use multimode, but im not sure which connector.
is there a material (ie cost) difference between SC and LC? what about durability?
It would seem to me that the fragile part (the fiber) doesnt benefit m... | 2009/07/27 | [
"https://serverfault.com/questions/46531",
"https://serverfault.com",
"https://serverfault.com/users/11087/"
] | The main benefit of LC over SC is the form factor. An LC connector is similar in size to an RJ45 jack whereas an SC connector is about twice the size.
I have not found any differences in the durability of the connectors. | It is worthwhile to note that with LC connectors, it is difficult to change the fiber pairs from crossover to straight through. SC is easier, and ST is obviously trivial. |
60,082,599 | For some reason, I have a code that is completely identical and it works fine when I test it on codepen, but it will not resize at all when I bring it to github for publishing.
The codepen is: <https://codepen.io/daniel-albano/pen/ExaedBr?editors=1100>
This is one extract of my CSS not properly resizing:
```
.miss... | 2020/02/05 | [
"https://Stackoverflow.com/questions/60082599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12847580/"
] | ```
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
... the code using the deprecated API ...
#pragma clang diagnostic pop
``` | @available in Objective-C is used when you want to check, if current iOS (/MacOS) version supports this API. It is called when you implement API which is supported starting by some iOS version, but not supported by older iOS.
As far as I know, you can't silent warning about deprecated API - you can only replace it wit... |
51,044 | There are two similar questions here:
[what are some dictionaries about vocabulary of classical chinese?](https://chinese.stackexchange.com/questions/9888/what-are-some-dictionaries-about-vocabulary-of-classical-chinese)
[Resources: Modern Chinese -> Classical Chinese (Dictionary/References/etc.)](https://chinese.stack... | 2022/04/23 | [
"https://chinese.stackexchange.com/questions/51044",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/27314/"
] | Not much, I suppose.
If you have access to Brill, then the [Chinese-English Dictionary Online](https://chinesereferenceshelf.brillonline.com/chinese-english) contains the entries, among others, from Paul W. Kroll's [A Student's Dictionary of Classical and Medieval Chinese](https://brill.com/view/title/20918). But rand... | I suggest dict.cn.com. It is an online, English-Chinese and Chinese-English, two-way dictionary.
[](https://i.stack.imgur.com/r5b9F.png) |
597,362 | I'm using Microsoft Office 2013 Word. Pages that have page numbers displayed as Roman numerals are displayed in the Table of Contents with Arabic numeral page numbers.
Here is a screenshot of the Table of Contents:

Here is a screenshot showing that... | 2013/05/19 | [
"https://superuser.com/questions/597362",
"https://superuser.com",
"https://superuser.com/users/88617/"
] | Word should automatically pick the correct numbering type from the section the heading comes from, just make sure that the numbering format is set per section, so that you insert a section break and then change the numbering type by going to the header/footer -> Page Number -> Format Page Number.
If you changed the n... | I had the issue and could fix it by double clicking the footer, Right-Click on the number field and go to "Format Page Numbers" and set it to roman numbers there.
The numbers were Roman before, dont get me wrong, but by changing this the TOC also recognized that. |
13,507,821 | i want to set banner(image) at top of list view dynamically.i am calling list view data from webservices .i did this coding in my lazy adapter class but no banner being visible.i wana set banner like this.
```
RelativeLayout layout1 = new RelativeLayout(mContext);
ImageView imag... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13507821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1317798/"
] | Your solution from the layout point of view:
```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:l... | Use this:
```
View headerView1 = ((LayoutInflater)getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.custom_add, null, false);///this is your imageview
list_view.addHeaderView(headerView1);
``` |
36,725,828 | --Short Version--
How do you get ng-pattern to use regex from angular constants?
--Long Version--
I'm working on a huge Angular 1 project and we have multiple forms. A lot of these forms have the same fields like Zip and Phone Number. I wanted to look for a consistent way to use ng-pattern but have the regex in one ... | 2016/04/19 | [
"https://Stackoverflow.com/questions/36725828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4139335/"
] | You can do it in two ways:
1: As string *literal*, when you must double slashes:
```
.constant("formPattern", {
zip: new RegExp("^\\d{5}(?:-\\d{4})?$")
})
```
2: As regular expression:
```
.constant("formPattern", {
zip: /^\d{5}(?:-\d{4})?$/
})
```
Both worked in your fiddle. | Just add the constants to a `$scope` variable
```
$scope.myPattern = /^\d{5}(?:-\d{4})?$/;
```
and then in html
```
ng-pattern=myPattern
``` |
44,214,802 | I am using Volley to acquire data from server.Some times when the network connection is slow I get the response twice or thrice or more than that.I followed the answer from a similar problem in [Android volley sending data twice](https://stackoverflow.com/questions/27873001/android-volley-sending-data-twice) .But still... | 2017/05/27 | [
"https://Stackoverflow.com/questions/44214802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5320053/"
] | What you are trying to do here, is remove a word from a string. When you try to `sentence.pop()`, you are trying to remove an element from an Immutable Sequence Type. Which means that you are trying to remove an element from a string, which does not make too much sense. What you should instead do, is break the string i... | See `pop()` is not a string function so going forward you can create a function, pass n as the index of the character you need to pop out of the string as str.
write below code into the popout:
```
def popout(str,n):
front = str[:n] # up to but not including n
back = str[n+1:] # n+1 through end of string
retu... |
33,864,160 | I am getting null pointer exception randomly, usually it works and sometime it crashes, I had searched a lot but didn't get any help as it there is no proper line from where I get any help,
I am also using handler with it.
My logcat error is as follows and code is added below it,
```
java.lang.NullPointerException:... | 2015/11/23 | [
"https://Stackoverflow.com/questions/33864160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3528461/"
] | you must call textview `getLayout()` after the textview measure ,so it's better to call `getLayout()` in
```
textview.post(new Runnable() {
@Override
public void run() {
textview.getLayout()....
}
});
``` | I think the error came from this line
```
mySpannable.setSpan(touchableSpan, GeneralFunctions.getText(myTextView).indexOf("Register"), GeneralFunctions.getText(myTextView).length(), 0);
```
try to logout you get the index value & textview text from
gettext(textview) & indexOf() method. |
13,576,031 | Suppose we have the following:
```
class StringClass
{
public:
...
void someProcessing( );
...
StringClass& operator=(const StringClass& rtSide);
...
private:
char *a;//Dynamic array for characters in the string
int capacity;//size of dynamic array a
int length;//Number of characters in... | 2012/11/27 | [
"https://Stackoverflow.com/questions/13576031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1218732/"
] | Consider what the value of `rtSide.a` is when you're inside the broken `operator=`.
It's the same as `this->a`, the values you just clobbered. Accessing non-owned memory is undefined behavior, thus accessing this->a is undefined behavior (since you just freed it).
```
delete [] a;
a = new char[capacity];
for (int i ... | It is because you've first deleted the pointer `delete [] a;`
and then later on trying to copy from the deleted location:
```
for (int i = 0; i < length; i++)
a[i] = rtSide.a[i]; //rtSide has already been deleted as 'this' and '&rtSide' are same.
```
Remember it is the same location you are trying to copy ... |
68,430,492 | I'm not too sure if I'm just completely forgetting basics here but can someone please tell me why after changing the flag only T1 stops?
```
#include <thread>
#include <iostream>
void job(const bool &flag)
{
using namespace std::chrono_literals;
while (flag)
{
std::cout << "Working T2" << '\n';
... | 2021/07/18 | [
"https://Stackoverflow.com/questions/68430492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7187050/"
] | As posters above have mentioned, you'd need to check whether the value is null. You simply can't loop through an object that doesn't exist! So your choice would be not to use null objects in your structure -I'm not quite sure why you need them in the first place, maybe you could have a structure you loop through and an... | Onclick function should be outside of both of for loops.
p.s: Using the snippet makes things easier.
```js
var myObject = [{
"field one": "something ",
"Image Gallery": [{
"src": "anImage.jpg",
"title": "more text"
},
{
"src": null,
"title": "a title here"
},
... |
24,193,845 | I have a Bootstrap webpage set up which displays a collapsible table. Each table row has a button which has a `glyphicon-chevron-down` icon. When a user clicks on this button, that icon needs to change to `glyphicon chevron-up`. I have tried doing this a few different ways to no avail.
Current set up is:
```
<script ... | 2014/06/12 | [
"https://Stackoverflow.com/questions/24193845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2887128/"
] | This works:
```
toggleChevron = function(button) {
$(button).find('span').toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
}
```
The main issue is that you are passing `this`, which isn't a jQuery object, so you need to wrap `button` in the jQuery function `$(button)`
<http://jsfiddle.net/V9LSS/4/> | ```
function toggleChevron(button) {
if ($(button).find('span').hasClass('glyphicon-chevron-down')) {
$(button).find('span').removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up");
}else{
$(button).find('span').removeClass("glyphicon-chevron-up").addClass("glyphicon-ch... |
12,016,235 | i have the following CSS style sheet in Site.css
```
.img
{
width: 1300px;
height: auto;
}
```
and the following codes in my default.aspx
```
<div class="img">
<img src="http://files.g4tv.com/images/blog/2008/06/18/633493967095957891.jpg" alt="DOMO" />
<div class="desc">Add a description of the image her... | 2012/08/18 | [
"https://Stackoverflow.com/questions/12016235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1470932/"
] | You are applying class to your division. If you want to select image inside division then
Change to:
```
.img img
{
width: 1300px;
height: auto;
}
```
[Example](http://jsfiddle.net/4dkUP/) | Apply class on your `img` instead on that `div`
```
<div >
<img class="img"
src="http://files.g4tv.com/images/blog/2008/06/18/633493967095957891.jpg"
alt="DOMO" />
<div class="desc">
Add a description of the image here
</div>
</div>
```
OR
You can create your css like ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.