qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | You definitely cannot assume that: Windows could be installed on a different drive letter, or in a different directory. On a previous work PC Windows was installed in D:\WINNT, for example.
The short answer is to use the API call GetSystemDirectory(), which will return the path you are after.
The longer answer is to ... | No, you can't assume that.
Windows can be installed to a different path. One solution is to look for it by calling GetSystemDirectory (implemented as part of the Windows API). |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | Windows can be installed on a different harddrive and or in a different folder. Use the %windir% or %systemroot% environment variables to get you to the windows folder and append system32. Or use the %path% variable, it's usually the first entrance and the preferred method of searching for files such as dlls AFAIK. As ... | It might be safer to use the "windir" environment variable and then append the "System32" to the end of that path. Sometimes windows could be under a different folder or different drive so "windir" will tell you where it is.
As far as i know, the system32 folder should always exist under the windows folder. |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | You definitely cannot assume that: Windows could be installed on a different drive letter, or in a different directory. On a previous work PC Windows was installed in D:\WINNT, for example.
The short answer is to use the API call GetSystemDirectory(), which will return the path you are after.
The longer answer is to ... | I would use the **GetWindowsDirectory** Win32 API to get the current Windows directory, append **System32** to it an then check if it exists. |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | No, you can't assume that.
Windows can be installed to a different path. One solution is to look for it by calling GetSystemDirectory (implemented as part of the Windows API). | I would use the **GetWindowsDirectory** Win32 API to get the current Windows directory, append **System32** to it an then check if it exists. |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | You definitely cannot assume that: Windows could be installed on a different drive letter, or in a different directory. On a previous work PC Windows was installed in D:\WINNT, for example.
The short answer is to use the API call GetSystemDirectory(), which will return the path you are after.
The longer answer is to ... | Just an FYI, but in a Terminal Server environment (ie, Citrix), GetWindowsDirectory() may return a unique path for a remote user.
[link text](http://msdn.microsoft.com/en-us/library/ms724454(VS.85).aspx)
As more and more companies use virtualized desktops, developers need to keep this in mind. |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | No, you can't assume that.
Windows can be installed to a different path. One solution is to look for it by calling GetSystemDirectory (implemented as part of the Windows API). | It might be safer to use the "windir" environment variable and then append the "System32" to the end of that path. Sometimes windows could be under a different folder or different drive so "windir" will tell you where it is.
As far as i know, the system32 folder should always exist under the windows folder. |
239,209 | On OS from win 2000 or later (any language) can I assume that this path will always exists?
For example I know that on win xp in some languages the "Program Files" directory have a different name.
So is it true for the System32 folder?
Thanks.
Ohad. | 2008/10/27 | [
"https://Stackoverflow.com/questions/239209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17212/"
] | No, you can't assume that.
Windows can be installed to a different path. One solution is to look for it by calling GetSystemDirectory (implemented as part of the Windows API). | Just an FYI, but in a Terminal Server environment (ie, Citrix), GetWindowsDirectory() may return a unique path for a remote user.
[link text](http://msdn.microsoft.com/en-us/library/ms724454(VS.85).aspx)
As more and more companies use virtualized desktops, developers need to keep this in mind. |
44,951,581 | I have a requirement where in the function takes different parameters and returns unique objects. All these functions perform the same operation.
ie.
```
public returnObject1 myfunction( paramObject1 a, int a) {
returnObject1 = new returnObject1();
returnObject1.a = paramObject1.a;
return returnObject1;
}
public r... | 2017/07/06 | [
"https://Stackoverflow.com/questions/44951581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6512806/"
] | Make `interface Foo` and implement this `interface` in both `paramObject1` and `paramObject2` class. Now your method should be look like:
```
public Foo myFunction(Foo foo, int a){
//Rest of the code.
return foo;
}
``` | you can using the 3rd `apply` method to remove the code duplications, you separate creation & initialization from the `apply` method in this approach. and don't care about which type of `T` is used. for example:
```
returnObject1 myfunction(paramObject1 a, int b) {
return apply(returnObject1::new, b, value -> {
... |
37,723,804 | I have to search a contact by name, surname or telephone number.
how can i do that?
I think i can't use java 8 stream in this case...
Another thing... I have to press "2" two times in order to see all the contact list but the if implementation seems right to me.
The code:
```
import java.util.ArrayList;
import java.u... | 2016/06/09 | [
"https://Stackoverflow.com/questions/37723804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6444835/"
] | This could be done in Java 8 as next:
```
Optional<Contatto> result = cont.stream().filter(c ->
(nome == null || nome.equalsIgnoreCase(c.getNome()))
&& (cognome == null || cognome.equalsIgnoreCase(c.getCognome()))
&& (num_Tel == null || num_Tel.equals(c.getNum_Tel()))
).findFirst();
```
Assuming ... | You can Add a method for each type of search that you are performing and call that method in choice "3". The method is simple and pretty straightforward, for example, for searching by phone number
```
private static Contatto SearchContattoNumber( ArrayList<Contatto> cont, int number ) {
for (Contatto tmp : cont){
... |
11,276,112 | Does anyone know if its possible to add specific files uncompressed to a Android APK file during the ANT build process using build.xml? All my files live in the *assets* folder and use the same extension. I do realise that i could use a different extension for the files that i don't want to be added compressed and spec... | 2012/06/30 | [
"https://Stackoverflow.com/questions/11276112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1184595/"
] | Have a look [here](http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/)
>
> The only way (that I’ve discovered, as of this writing) to control
> this behavior is by using the -0 (zero) flag to aapt on the command
> line. This flag, passed without any accompanying argument, will tell... | Just to provide closure for this one.
I don't think it is possible to mark individual files to be added uncompressed to the APK.
Being able to mark individual files as uncompressed to *aapt* could be useful. As would the addition of a *nocompress file* tag, eg:
```
<nocompress file="FileNoCompress.abc" />
```
:) |
11,276,112 | Does anyone know if its possible to add specific files uncompressed to a Android APK file during the ANT build process using build.xml? All my files live in the *assets* folder and use the same extension. I do realise that i could use a different extension for the files that i don't want to be added compressed and spec... | 2012/06/30 | [
"https://Stackoverflow.com/questions/11276112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1184595/"
] | If building using gradle, then it seems you can provide the aapt flags like this:
```
android {
aaptOptions {
noCompress 'foo', 'bar'
ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
}
```
<http://tools.android.com/tech-docs/new-build-system/use... | Just to provide closure for this one.
I don't think it is possible to mark individual files to be added uncompressed to the APK.
Being able to mark individual files as uncompressed to *aapt* could be useful. As would the addition of a *nocompress file* tag, eg:
```
<nocompress file="FileNoCompress.abc" />
```
:) |
62,043,889 | When I tried to use keras to build a simple autoencoder, I found something strange between keras and tf.keras.
```
tf.__version__
```
2.2.0
```
(x_train,_), (x_test,_) = tf.keras.datasets.mnist.load_data()
x_train = x_train.astype('float32') / 255.
x_test = x_test.astype('float32') / 255.
x_train = x_train.resha... | 2020/05/27 | [
"https://Stackoverflow.com/questions/62043889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9909121/"
] | The true culprit is the default learning rate used by [`keras.Adadelta`](https://github.com/keras-team/keras/blob/master/keras/optimizers.py#L401) vs [`tf.keras.Adadelta`](https://github.com/tensorflow/tensorflow/blob/r2.2/tensorflow/python/keras/optimizer_v2/adadelta.py#L63): `1` vs `1e-4` - see below. It's true that ... | If you use `adam`, the `tf.keras` model performs better. (`keras` and `tf.keras` uses two different version of the optimizers)
Most probably, it has to do with `momentum` for convergence for this data. It is very slow, maybe you'll need to train for more epochs with higher learning rate.
Here's an answer why adadelta... |
17,357,665 | I have **two tables** for one is `category` and another one is `sub-category`. that two table is assigned to `FK` for many table. In some situation we will move one record of **sub-category** to **main category**. so this time occur constraints error because that **key** associated with other table. so i would not crea... | 2013/06/28 | [
"https://Stackoverflow.com/questions/17357665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1089410/"
] | There might be a problem if you have multiple levels in the tree, and want to find all the subcategories of any category. This would require either multiple queries, or a recursive one.
You could instead look into the ["Nested Sets"](http://www.codeproject.com/Articles/4155/Improve-hierarchy-performance-using-nested-s... | How about creating one table as following:
```
categories(
id int not null auto_increment primary key,
name char(10),
parent_id int not null default 0)
```
Where parent\_id is a FK to the id, which is the PK of the table.
When parent\_id is 0, then this category is a main one. When it is > 0, this is a... |
35,317,633 | I'm trying to write what must be the simplest angular directive which displays a Yes/No select list and is bound to a model containing a boolean value. Unfortunately the existing value is never preselected. My directive reads
```
return {
restrict: 'E',
replace: true,
template: '<select class... | 2016/02/10 | [
"https://Stackoverflow.com/questions/35317633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1298045/"
] | There is no need for a custom sentinel image, or messing with the network. See my [redis-ha-learning](https://github.com/asarkar/spring/tree/master/redis-ha-learning) project using [Spring Data Redis](https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#reference), [bitnami/redis](https://hub.dock... | So, the solution that worked for me is simply reading the /etc/hosts file on the source container. I busy wait till the link is established and then use that network interface IP to start the sentinel process. This is just a stop gap solution and it is not scalable. Redis-sentinel is still not production ready in docke... |
35,317,633 | I'm trying to write what must be the simplest angular directive which displays a Yes/No select list and is bound to a model containing a boolean value. Unfortunately the existing value is never preselected. My directive reads
```
return {
restrict: 'E',
replace: true,
template: '<select class... | 2016/02/10 | [
"https://Stackoverflow.com/questions/35317633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1298045/"
] | I have this configuration example here using docker compose that can be of help.
<https://github.com/oneyottabyte/redis_sentinel> | So, the solution that worked for me is simply reading the /etc/hosts file on the source container. I busy wait till the link is established and then use that network interface IP to start the sentinel process. This is just a stop gap solution and it is not scalable. Redis-sentinel is still not production ready in docke... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | Let $V$ be the volume of the hanging block, $A$ the area of the water surface, $\rho$ the density of water, and $g$ the acceleration due to gravity.
The extra hydrostatic force felt by the bottom of the container after lowering the block is
$$\Delta F = \rho gA\Delta h,$$
where $\Delta h$ is the change in water height... | EDIT:
-----
Since this answer is not being very well received I will just say that *if* we neglect gravitational forces due to the height difference between the mass in the upper and lower pictures; then yes, the scales *will* be balanced as there is simply no net torque.
---
However, since the question did **not**... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | **The scale will not move.**
You don't need to think about buoyancy at all to answer this question. In the first picture, the scale is balanced, because the net force on each side (the weight) is equal. No mass is added to or removed from either side, so the net forces remain the same. | So various forces neglected (including gravity, air resistance, thermal forces, air pressure) - but your question suggest this is an inquiry about the effect of bouyancy.
That being the case, lowering the mass into the water brings into effect its bouyancy. This is a force lifting the mass and acting down on the water... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | So various forces neglected (including gravity, air resistance, thermal forces, air pressure) - but your question suggest this is an inquiry about the effect of bouyancy.
That being the case, lowering the mass into the water brings into effect its bouyancy. This is a force lifting the mass and acting down on the water... | Let $V$ be the volume of the hanging block, $A$ the area of the water surface, $\rho$ the density of water, and $g$ the acceleration due to gravity.
The extra hydrostatic force felt by the bottom of the container after lowering the block is
$$\Delta F = \rho gA\Delta h,$$
where $\Delta h$ is the change in water height... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | So various forces neglected (including gravity, air resistance, thermal forces, air pressure) - but your question suggest this is an inquiry about the effect of bouyancy.
That being the case, lowering the mass into the water brings into effect its bouyancy. This is a force lifting the mass and acting down on the water... | EDIT:
-----
Since this answer is not being very well received I will just say that *if* we neglect gravitational forces due to the height difference between the mass in the upper and lower pictures; then yes, the scales *will* be balanced as there is simply no net torque.
---
However, since the question did **not**... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | **The scale will not move.**
You don't need to think about buoyancy at all to answer this question. In the first picture, the scale is balanced, because the net force on each side (the weight) is equal. No mass is added to or removed from either side, so the net forces remain the same. | EDIT:
-----
Since this answer is not being very well received I will just say that *if* we neglect gravitational forces due to the height difference between the mass in the upper and lower pictures; then yes, the scales *will* be balanced as there is simply no net torque.
---
However, since the question did **not**... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | If you consider everything put in the right side of balance scale as one system, only the internal forces are changed which will not affect the balance.
No external force is applied and hence the balance will be maintained. | Let $V$ be the volume of the hanging block, $A$ the area of the water surface, $\rho$ the density of water, and $g$ the acceleration due to gravity.
The extra hydrostatic force felt by the bottom of the container after lowering the block is
$$\Delta F = \rho gA\Delta h,$$
where $\Delta h$ is the change in water height... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | The balance will be maintained because there is no EXTERNAL force applied on left or right side. This is because of the same reason you can't push a car while sitting in it! | So various forces neglected (including gravity, air resistance, thermal forces, air pressure) - but your question suggest this is an inquiry about the effect of bouyancy.
That being the case, lowering the mass into the water brings into effect its bouyancy. This is a force lifting the mass and acting down on the water... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | The balance will be maintained because there is no EXTERNAL force applied on left or right side. This is because of the same reason you can't push a car while sitting in it! | EDIT:
-----
Since this answer is not being very well received I will just say that *if* we neglect gravitational forces due to the height difference between the mass in the upper and lower pictures; then yes, the scales *will* be balanced as there is simply no net torque.
---
However, since the question did **not**... |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | The balance will be maintained because there is no EXTERNAL force applied on left or right side. This is because of the same reason you can't push a car while sitting in it! | If you consider everything put in the right side of balance scale as one system, only the internal forces are changed which will not affect the balance.
No external force is applied and hence the balance will be maintained. |
319,327 | 
This problem has bothered me for quite some time and I can't solve it. I have even tried to make a construction, but it sometimes tips to the left and sometimes tips to the right :).
When we submerge the body in the water the water pushes it up. Tha... | 2017/03/16 | [
"https://physics.stackexchange.com/questions/319327",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/145936/"
] | The balance will be maintained because there is no EXTERNAL force applied on left or right side. This is because of the same reason you can't push a car while sitting in it! | Let $V$ be the volume of the hanging block, $A$ the area of the water surface, $\rho$ the density of water, and $g$ the acceleration due to gravity.
The extra hydrostatic force felt by the bottom of the container after lowering the block is
$$\Delta F = \rho gA\Delta h,$$
where $\Delta h$ is the change in water height... |
11,878,292 | i want to find out total number of android APIs (Classes and Methods) used in my android application source code. but i want to do it programmatically. can any one suggest me how can i do so??
Thanks in Advance | 2012/08/09 | [
"https://Stackoverflow.com/questions/11878292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631803/"
] | You can do it with [Reflections API](http://code.google.com/p/reflections/).
You can get the list of classes using the following code :
```
Reflections ref = new Reflections("package_name");
Set<Class<?>> classes = ref.getSubTypesOf(Object.class);
```
Then by using the [Class.getDeclaredMethods()](http://docs.orac... | The eclipse metrics plugin looks promising. It is not specially designed for android but there's a chance that it will provide you with (most of) the informations you need.
**Reference**
* [project on sourceforge](http://metrics2.sourceforge.net/) |
47,678,197 | I tried asking this question before but was it was poorly stated. This is a new attempt cause I haven't solved it yet.
I have a dataset with winners, losers, date, winner\_points and loser\_points.
For each row, I want two new columns, one for the winner and one for the loser that shows how many points they have scor... | 2017/12/06 | [
"https://Stackoverflow.com/questions/47678197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5434602/"
] | ```
winner <- c(1,2,3,1,2,3,1,2,3)
loser <- c(3,1,1,2,1,1,3,1,2)
date <- c("2017-10-01","2017-10-02","2017-10-03","2017-10-04","2017-10-05","2017-10-06","2017-10-07","2017-10-08","2017-10-09")
winner_points <- c(2,1,2,1,2,1,2,1,2)
loser_points <- c(1,0,1,0,1,0,1,0,1)
test_data <- data.frame(winner, loser, date = as.Da... | I finally understood what you want. And I took an approach of getting cumulative points of each player at each point in time and then joining it to the original `test_data` data frame.
```
winner <- c(1,2,3,1,2,3,1,2,3)
loser <- c(3,1,1,2,1,1,3,1,2)
date <- c("2017-10-01","2017-10-02","2017-10-03","2017-10-04","2017-... |
47,678,197 | I tried asking this question before but was it was poorly stated. This is a new attempt cause I haven't solved it yet.
I have a dataset with winners, losers, date, winner\_points and loser\_points.
For each row, I want two new columns, one for the winner and one for the loser that shows how many points they have scor... | 2017/12/06 | [
"https://Stackoverflow.com/questions/47678197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5434602/"
] | I finally understood what you want. And I took an approach of getting cumulative points of each player at each point in time and then joining it to the original `test_data` data frame.
```
winner <- c(1,2,3,1,2,3,1,2,3)
loser <- c(3,1,1,2,1,1,3,1,2)
date <- c("2017-10-01","2017-10-02","2017-10-03","2017-10-04","2017-... | The difference to the [previous question of the OP](https://stackoverflow.com/q/44591583/3817004) is that the OP is now asking for the cumulative sum of points each player has scored *so far*, i.e., before the actual date. Furthermore, the sample data set now contains a `date` column which uniquely identifies each row.... |
47,678,197 | I tried asking this question before but was it was poorly stated. This is a new attempt cause I haven't solved it yet.
I have a dataset with winners, losers, date, winner\_points and loser\_points.
For each row, I want two new columns, one for the winner and one for the loser that shows how many points they have scor... | 2017/12/06 | [
"https://Stackoverflow.com/questions/47678197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5434602/"
] | ```
winner <- c(1,2,3,1,2,3,1,2,3)
loser <- c(3,1,1,2,1,1,3,1,2)
date <- c("2017-10-01","2017-10-02","2017-10-03","2017-10-04","2017-10-05","2017-10-06","2017-10-07","2017-10-08","2017-10-09")
winner_points <- c(2,1,2,1,2,1,2,1,2)
loser_points <- c(1,0,1,0,1,0,1,0,1)
test_data <- data.frame(winner, loser, date = as.Da... | The difference to the [previous question of the OP](https://stackoverflow.com/q/44591583/3817004) is that the OP is now asking for the cumulative sum of points each player has scored *so far*, i.e., before the actual date. Furthermore, the sample data set now contains a `date` column which uniquely identifies each row.... |
47,902,057 | I have a text as follows.
```
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
```
I want to convert it to lowercase, except the words that has `_ABB` in it.
So, my output should look as follows.
```
mytext = "this is AVGs_ABB an... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47902057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can use a one liner splitting the string into words, check the words with `str.endswith()` and then join the words back together:
```
' '.join(w if w.endswith('_ABB') else w.lower() for w in mytext.split())
# 'this is AVGs_ABB and NMN_ABB and most importantly GFD_ABB this is so important that you have to clean the... | Extended *regex* approach:
```
import re
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
result = re.sub(r'\b((?!_ABB)\S)+\b', lambda m: m.group().lower(), mytext)
print(result)
```
The output:
```
this is AVGs_ABB and NMN_ABB and... |
47,902,057 | I have a text as follows.
```
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
```
I want to convert it to lowercase, except the words that has `_ABB` in it.
So, my output should look as follows.
```
mytext = "this is AVGs_ABB an... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47902057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can use a one liner splitting the string into words, check the words with `str.endswith()` and then join the words back together:
```
' '.join(w if w.endswith('_ABB') else w.lower() for w in mytext.split())
# 'this is AVGs_ABB and NMN_ABB and most importantly GFD_ABB this is so important that you have to clean the... | Here is another possible(not elegant) one-liner:
```
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
print(' '.join(map(lambda x : x if '_ABB' in x else x.lower(), mytext.split())))
```
Which Outputs:
```
this is AVGs_ABB and NMN_AB... |
47,902,057 | I have a text as follows.
```
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
```
I want to convert it to lowercase, except the words that has `_ABB` in it.
So, my output should look as follows.
```
mytext = "this is AVGs_ABB an... | 2017/12/20 | [
"https://Stackoverflow.com/questions/47902057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Extended *regex* approach:
```
import re
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
result = re.sub(r'\b((?!_ABB)\S)+\b', lambda m: m.group().lower(), mytext)
print(result)
```
The output:
```
this is AVGs_ABB and NMN_ABB and... | Here is another possible(not elegant) one-liner:
```
mytext = "This is AVGs_ABB and NMN_ABB and most importantly GFD_ABB This is so important that you have to CLEAN the lab everyday"
print(' '.join(map(lambda x : x if '_ABB' in x else x.lower(), mytext.split())))
```
Which Outputs:
```
this is AVGs_ABB and NMN_AB... |
17,006,512 | I have a simple table layout, in the one of the row, I have time for sun rise in a text view and I am trying to have sun with purple colour for the row as background. How can I achieve this? I tried creating an image 1000px x 500px with sun and purple background, However, it does not look good on different screen sizes... | 2013/06/09 | [
"https://Stackoverflow.com/questions/17006512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2122179/"
] | You can set it programmatically by
```
[textField setSecureTextEntry:YES];
```
or in IB (secured checkbox at the bottom)
 | You could also try simply implementing your own "secure text field".
Simply create a normal, non-secure text field, and link it's "Editing Changed" action with a method in your view controller.
Then within that method you can take the new characters every time the text is changed, and add them to a private NSString... |
59,938,330 | I'm using a jsonb field in my Rails application and have installed the [gem attr\_json](https://github.com/jrochkind/attr_json). Is there a way to receive the defined json\_attributes programmatically? With a "normal" rails attribute, I would just do @instance.attribute\_names. But with attr\_json is there any way how ... | 2020/01/27 | [
"https://Stackoverflow.com/questions/59938330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3748376/"
] | I think you should clear your previous model inside loop so you could use this function which is keras.backend.clear\_session().From <https://keras.io/backend/>:
This will be solved your problem. | From a very simplistic point of view, the data is fed in sequentially, which suggests that at the very least, it's possible for the data order to have an effect on the output. If the order doesn't matter, randomization certainly won't hurt. If the order does matter, randomization will help to smooth out those random ef... |
5,578,250 | As I am writing my first grails webflow I am asking myself if there is anyy tool or script what can visualize the flow?
Result can be a state diagram or some data to render in a graph tool like graphviz. | 2011/04/07 | [
"https://Stackoverflow.com/questions/5578250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172590/"
] | There's no tool around currently that will do this for you I'm afraid. I've implemented something myself before, but this was very simple and was not automated in any way. It was a simple template where the model was a step number:
```
<g:render template="flowVisualiser" model="[step: 2]" />
```
You would have to pu... | As far as I know there's only 2 plugin for Grails which do visualization, but only build a class-diagram, They are [Class diagram plugin](http://grails.org/plugin/class-diagram/) and [Create Domain UML](http://www.grails.org/plugin/create-domain-uml).
You can have a look at [this page](http://www.grails.org/plugin/cat... |
5,578,250 | As I am writing my first grails webflow I am asking myself if there is anyy tool or script what can visualize the flow?
Result can be a state diagram or some data to render in a graph tool like graphviz. | 2011/04/07 | [
"https://Stackoverflow.com/questions/5578250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172590/"
] | There's no tool around currently that will do this for you I'm afraid. I've implemented something myself before, but this was very simple and was not automated in any way. It was a simple template where the model was a step number:
```
<g:render template="flowVisualiser" model="[step: 2]" />
```
You would have to pu... | probably this could be a solution for all people using intellij: <http://www.slideshare.net/gr8conf/gr8conf-2011-grails-webflow>
Slide 25 |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | Please use this code. Use background instead of background-image and make sure that you have inserted the correct image path in url().
```
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.home-body {
background: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: ... | very easy like this....
```
.play{
background: url("media_element/play.png") center center no-repeat;
position : absolute;
display:block;
top:20%;
width:50px;
margin:0 auto;
left:0px;
right:0px;
z-index:100
}
``` |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | Please use this code. Use background instead of background-image and make sure that you have inserted the correct image path in url().
```
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
.home-body {
background: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: ... | ```
body {
background-image: url('img-url');
background-size: cover;
background-repeat:no-repeat
}
``` |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | If you are using an external CSS file... make sure to link the image file relative to the CSS file. For instance
`-ROOT
-css
-file.css
-background.jpg
-index.html`
you would need:
`background("../background.jpg");`
because ".." takes you up one directory :) | very easy like this....
```
.play{
background: url("media_element/play.png") center center no-repeat;
position : absolute;
display:block;
top:20%;
width:50px;
margin:0 auto;
left:0px;
right:0px;
z-index:100
}
``` |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | If you are using an external CSS file... make sure to link the image file relative to the CSS file. For instance
`-ROOT
-css
-file.css
-background.jpg
-index.html`
you would need:
`background("../background.jpg");`
because ".." takes you up one directory :) | ```
body {
background-image: url('img-url');
background-size: cover;
background-repeat:no-repeat
}
``` |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | it may be caused by 3 problem
1- home-body is not a tag of html.so it should be id or class name of a tag.so you should use `.home-body` for class name and `#home-body` for id name.
2- you do not address the background image correctly.if you want to make sure, give the url as an absolute path to your image like `http... | very easy like this....
```
.play{
background: url("media_element/play.png") center center no-repeat;
position : absolute;
display:block;
top:20%;
width:50px;
margin:0 auto;
left:0px;
right:0px;
z-index:100
}
``` |
26,377,384 | I want adding background image with css but it did not work.Browser show me a blank page.
my application.css
```
home-body {
background-image: url('/home.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: ... | 2014/10/15 | [
"https://Stackoverflow.com/questions/26377384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4059461/"
] | it may be caused by 3 problem
1- home-body is not a tag of html.so it should be id or class name of a tag.so you should use `.home-body` for class name and `#home-body` for id name.
2- you do not address the background image correctly.if you want to make sure, give the url as an absolute path to your image like `http... | ```
body {
background-image: url('img-url');
background-size: cover;
background-repeat:no-repeat
}
``` |
1,817,508 | I have a vector class that has addition, multiplication, subtraction, division, etc operators. I'm trying to optimize my program (which does a lot of vector operations) and I'm realizing that about 50% of the time spent is in constructing and destructing vectors. I understand that this is because every time I call a no... | 2009/11/30 | [
"https://Stackoverflow.com/questions/1817508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217546/"
] | >
> I understand that this is because
> every time I call a non-compound
> mathematical operator for a vector, a
> new vector is constructed. Is there a
> way to prevent this without using
> compound operators or expanding vector
> operations?
>
>
>
Well, the nature of adding two things together to produce a... | Make sure you have optimizations turned on and that your compiler is applying [RVO](http://en.wikipedia.org/wiki/Return_value_optimization), which is designed for exactly this situation (but not required to be used). (You may have to use a form of NRVO in your op+ implementation, example below, which helps the compiler... |
1,817,508 | I have a vector class that has addition, multiplication, subtraction, division, etc operators. I'm trying to optimize my program (which does a lot of vector operations) and I'm realizing that about 50% of the time spent is in constructing and destructing vectors. I understand that this is because every time I call a no... | 2009/11/30 | [
"https://Stackoverflow.com/questions/1817508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/217546/"
] | >
> I understand that this is because
> every time I call a non-compound
> mathematical operator for a vector, a
> new vector is constructed. Is there a
> way to prevent this without using
> compound operators or expanding vector
> operations?
>
>
>
Well, the nature of adding two things together to produce a... | Whoa there. Your code is totally inefficient:
```
Vector a = Vector(x, y, z);
Vector b = Vector(a, b, c);
```
That's just inefficient. What you want to write is
```
Vector a(x, y, z);
Vector b(a, b, c);
``` |
234,979 | I maintain a set of command line bioinformatics tools which we distribute as source and binaries for Linux, Windows, and OS X. Currently the binary distribution for OS X is just a zip file containing directories for the binaries and the documentation. Our install guide directs the user to unzip the archive, copy the bi... | 2016/04/14 | [
"https://apple.stackexchange.com/questions/234979",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/7226/"
] | The standard package format is the "pkg" format. It's not often used for applications, but it's fine for a terminal-only utility.
* My go-to tool for creating packages is called [Packages](http://s.sudre.free.fr/Software/Packages/about.html).
* I haven't used it myself, but it looks like CMake [supports PackageMaker](... | You may want to have a look at **[EPM](http://www.msweet.org/projects.php?Z2)**, the Easy Package Manager.
It can package Mac OS X `pkg` as well as RedHat `RPM`, Debian `deb` and then some more package formats -- all from the same source files, immediately after the build step.
It was originally written by Michael Sw... |
13,358,503 | a gem intends to support gems `a` or `b` as alternatives for a functionality.
In code I check with `defined?(A)` if I fall back to `b` that's fine.
But as a gem developer how to specify these dependencies?
1) what do I put in the Gemfile.
```
group :development, :test do
gem 'a', :require => false
gem 'b', :req... | 2012/11/13 | [
"https://Stackoverflow.com/questions/13358503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/641672/"
] | Don't include the `a` gem in your dependencies, but `require` it anyway. If that fails, it will raise `LoadError`, from which you can rescue.
```
begin
require 'a'
rescue LoadError
# The 'a' gem is not installed
require 'b'
end
```
---
I believe this is the best way to use and test this setup:
1. Define an i... | I got this same question a while ago. My solution was to think that the developer should specify this behavior. I would not specify it on the gem, but on the wiki. I would recommend you to document it clearly that the developer need to define one of the dependencies.
To make it better, you can make a check on initiali... |
18,939,332 | Does anyone know what Facebook uses for their blurred toolbar?

Now, I **KNOW** there are already countless threads about iOS 7 blur. They all come to these same solutions:
1. Use a UIToolbar with translucent set to YES, and then set its barTintColo... | 2013/09/22 | [
"https://Stackoverflow.com/questions/18939332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87158/"
] | Apparently the trick here is to insert the translucent layer as a sublayer of the navigation bar. I take no credit for finding this, and the following snippet has been taken [**from this gist**](https://gist.github.com/alanzeino/6619253).
```
UIColor *barColour = [UIColor colorWithRed:0.13f green:0.14f blue:0.15f alph... | I couldn't get the desired results unless I have added the following lines to the answer above:
```
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
```
... |
54,558,029 | Here is my original df:
```
my_df_1 <- data.frame(col_1 = c(rep('a',5), rep('b',5), rep('c', 5)),
col_2 = c(rep('x',3), rep('y', 9), rep('x', 3)))
```
I would like to group by `col_1` and return 1 if `col_2` for given group contains `x`, and 0 if not.
Here is how final result is supposed to lo... | 2019/02/06 | [
"https://Stackoverflow.com/questions/54558029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1700890/"
] | What about this?
```
do <- as.data.frame(do.call(rbind, lapply(my.stuff, as.vector)))
do <- cbind(my.var=rownames(do), do)
do[do == "NULL"] <- NA
```
***Result***
```
> do
my.var my.col1 my.col2 my.col3 my.col4
AA AA 1 4 NA NA
BB BB NA NA NA NA
CC CC 13 ... | We can use a recursive `map`
```
library(tidyverse)
map_df(my.stuff, ~ map_df(.x, ~
replace(.x, is.null(.x), NA)), .id = "my.var")
# A tibble: 4 x 5
# my.var my.col1 my.col2 my.col3 my.col4
# <chr> <dbl> <dbl> <dbl> <dbl>
#1 AA 1 4 NA NA
#2 BB NA ... |
161,836 | I'm using Oracle 11g database in which I have more than 12 schema's consisting of many tables. I've created sequences for primary keys to these tables. I've also created synonyms to refer my application from the main schema.
My issue is,
while i try to export(using expdp) the schema's from DB in 1 server and import(... | 2017/01/21 | [
"https://dba.stackexchange.com/questions/161836",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/104331/"
] | If you run export command against live database without parameters like `flashback_scn` or `flashback_time` which ensures consistency during the export, then this can be an expected behavior because these objects are exported in different time and one can become inconsistent with another.
For example, if the sequence... | You can drop and create SEQ again:
Example:
DB1: DB export
DB2: DB import
1. select list drop SEQ from DB2, after that, drop SEQ with list drop in DB2
```
SELECT
'DROP ' || OBJECT_TYPE || ' ' || OWNER || '.' || OBJECT_NAME || ';' "DROP SEQUENCE"
FROM DBA_OBJECTS
where owner in ('USER_1')
and object_type = 'SEQ... |
43,053,550 | I want to change the default login validation error message like:
```
Username & Password doesn't match
```
instead of
```
these credentials do not match our records
```
How to do this ? | 2017/03/27 | [
"https://Stackoverflow.com/questions/43053550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7394739/"
] | You can change this message to another one in this file:
```
resources/lang/en/auth.php
```
This is the line:
```
'failed' => 'These credentials do not match our records.',
``` | do one thing make new file message.php in lang folder then enter the error message in that and access in the controller and where you want to use like this
in Authonticateduser.php
```
protected function sendLoginResponse(Request $request) {
$request->session()->regenerate();
$this->clearLoginAttempts($reques... |
43,053,550 | I want to change the default login validation error message like:
```
Username & Password doesn't match
```
instead of
```
these credentials do not match our records
```
How to do this ? | 2017/03/27 | [
"https://Stackoverflow.com/questions/43053550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7394739/"
] | You can change this message to another one in this file:
```
resources/lang/en/auth.php
```
This is the line:
```
'failed' => 'These credentials do not match our records.',
``` | In `app/Http/controllers/Auth/LoginController` add below code:
```
protected function sendFailedLoginResponse(Request $request)
{
throw ValidationException::withMessages([
'username or password is incorrect!!!'
]);
}
```
In the `sendFailedLoginResponse` function you can redirect user to custom... |
43,053,550 | I want to change the default login validation error message like:
```
Username & Password doesn't match
```
instead of
```
these credentials do not match our records
```
How to do this ? | 2017/03/27 | [
"https://Stackoverflow.com/questions/43053550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7394739/"
] | In `app/Http/controllers/Auth/LoginController` add below code:
```
protected function sendFailedLoginResponse(Request $request)
{
throw ValidationException::withMessages([
'username or password is incorrect!!!'
]);
}
```
In the `sendFailedLoginResponse` function you can redirect user to custom... | do one thing make new file message.php in lang folder then enter the error message in that and access in the controller and where you want to use like this
in Authonticateduser.php
```
protected function sendLoginResponse(Request $request) {
$request->session()->regenerate();
$this->clearLoginAttempts($reques... |
4,378,067 | I need to find the GUID for an existing USB device attached to my Windows XP system. How can this be done using WMI or the registry? Or, is there another avenue that I should explore? Thanks.
**Additional Information:**
I need to find the GUID for a specific known device; it is not expected to change. If I need to wr... | 2010/12/07 | [
"https://Stackoverflow.com/questions/4378067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214296/"
] | For a specific known device, the easiest way I've found is to open the .inf file for that device's driver (if you have the driver); it should be clearly indicated there.
You can probably also poke around under HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Enum\USB. | [DevViewer from Symantec](http://service1.symantec.com/SUPPORT/ent-security.nsf/ppfdocs/2007511906325898?Open&dtype=corp&src=&seg=&om=1&om_out=prod) also seems to do the trick. |
4,378,067 | I need to find the GUID for an existing USB device attached to my Windows XP system. How can this be done using WMI or the registry? Or, is there another avenue that I should explore? Thanks.
**Additional Information:**
I need to find the GUID for a specific known device; it is not expected to change. If I need to wr... | 2010/12/07 | [
"https://Stackoverflow.com/questions/4378067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214296/"
] | Control Panel > Device Manager > Right Click on Device > Properties > Details Tab > Change 'Property' to Driver Key > Guid will be displayed in 'value' section | [DevViewer from Symantec](http://service1.symantec.com/SUPPORT/ent-security.nsf/ppfdocs/2007511906325898?Open&dtype=corp&src=&seg=&om=1&om_out=prod) also seems to do the trick. |
12,104,391 | I am trying to instantiate the [StdRandom](http://algs4.cs.princeton.edu/stdlib/StdRandom.java.html) class (see below) in my own Java program so that I can generate random integers by calling it's *uniform* method. However, I kept getting this error during compilation:
>
> MyProgram.java:43: StdRandom() has private a... | 2012/08/24 | [
"https://Stackoverflow.com/questions/12104391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225998/"
] | All methods are static, you don't need to create an instance of that class to use it. To use e.g. the `random()` method, use `StdRandom.random()` | You don't instantiate it, you call the methods statically:
```
StdRandom.setSeed(42L);
double n = StdRandom.uniform(66);
```
etc. |
12,104,391 | I am trying to instantiate the [StdRandom](http://algs4.cs.princeton.edu/stdlib/StdRandom.java.html) class (see below) in my own Java program so that I can generate random integers by calling it's *uniform* method. However, I kept getting this error during compilation:
>
> MyProgram.java:43: StdRandom() has private a... | 2012/08/24 | [
"https://Stackoverflow.com/questions/12104391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225998/"
] | All methods are static, you don't need to create an instance of that class to use it. To use e.g. the `random()` method, use `StdRandom.random()` | All the methods in this class are static, you don't need to and can't instantiate as it has private constructor, you can use methods directly for eg `StdRandom.unifrom(...)` |
12,104,391 | I am trying to instantiate the [StdRandom](http://algs4.cs.princeton.edu/stdlib/StdRandom.java.html) class (see below) in my own Java program so that I can generate random integers by calling it's *uniform* method. However, I kept getting this error during compilation:
>
> MyProgram.java:43: StdRandom() has private a... | 2012/08/24 | [
"https://Stackoverflow.com/questions/12104391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225998/"
] | All methods are static, you don't need to create an instance of that class to use it. To use e.g. the `random()` method, use `StdRandom.random()` | This is 'util' class with hidden constructor. Instead of create new instance call methods directly: `StdRandom.uniform(100)`, `StdRandom.random()`, etc.. |
12,104,391 | I am trying to instantiate the [StdRandom](http://algs4.cs.princeton.edu/stdlib/StdRandom.java.html) class (see below) in my own Java program so that I can generate random integers by calling it's *uniform* method. However, I kept getting this error during compilation:
>
> MyProgram.java:43: StdRandom() has private a... | 2012/08/24 | [
"https://Stackoverflow.com/questions/12104391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225998/"
] | You don't instantiate it, you call the methods statically:
```
StdRandom.setSeed(42L);
double n = StdRandom.uniform(66);
```
etc. | All the methods in this class are static, you don't need to and can't instantiate as it has private constructor, you can use methods directly for eg `StdRandom.unifrom(...)` |
12,104,391 | I am trying to instantiate the [StdRandom](http://algs4.cs.princeton.edu/stdlib/StdRandom.java.html) class (see below) in my own Java program so that I can generate random integers by calling it's *uniform* method. However, I kept getting this error during compilation:
>
> MyProgram.java:43: StdRandom() has private a... | 2012/08/24 | [
"https://Stackoverflow.com/questions/12104391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225998/"
] | You don't instantiate it, you call the methods statically:
```
StdRandom.setSeed(42L);
double n = StdRandom.uniform(66);
```
etc. | This is 'util' class with hidden constructor. Instead of create new instance call methods directly: `StdRandom.uniform(100)`, `StdRandom.random()`, etc.. |
13,121,850 | I have used will\_paginate in my rails application but i come across a situation where i need to use to will\_paginate inside a block where the page should not reload when i click the pagination number, could anyone help me saying how to integrate will\_paginate with ajax to avoid page reloading......? | 2012/10/29 | [
"https://Stackoverflow.com/questions/13121850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/917833/"
] | I have a pagination javascript file
So in my index.html.erb file I addded
```
<%=javascript_include_tag "pagination.js"%>
```
In pagination.js file
```
$(function(){
$(".pagination a").live("click", function() {
$.get(this.href, null, null, "script");
return false;
});
});
```
I fetched ... | Here is how I set up things:
Let assume I have an `Item` model.
First in the index view, I render a partial where pagination is performed:
```
<div id="list">
<%= render 'items/paginate_list', :items => @items %>
</div>
```
In the partial, I add a css class to my `will_paginate` statement:
```
items/_paginate_li... |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | You should view in the xampp installation the file "\xampp\mysql\data\mysql\_error.log".
This file contais the error log of MySQL and in it you can detect any problem like por in use.
For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.
```
... | Check whether the value of port variable in the "my.ini" file in your xampp mysql folder is 3306 or 8888 |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | You should view in the xampp installation the file "\xampp\mysql\data\mysql\_error.log".
This file contais the error log of MySQL and in it you can detect any problem like por in use.
For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.
```
... | i was facing the same problem. I had to run setup-xampp.bat to make it working.
By the way I came across a new WAMP stack called AMPPS. It looks quite easier than XAMP. You should try. <http://www.ampps.com> |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql\_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you... | You should view in the xampp installation the file "\xampp\mysql\data\mysql\_error.log".
This file contais the error log of MySQL and in it you can detect any problem like por in use.
For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.
```
... |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | You should view in the xampp installation the file "\xampp\mysql\data\mysql\_error.log".
This file contais the error log of MySQL and in it you can detect any problem like por in use.
For example, this lines of log show that the port 3306 (the mysql default) is used by another application and can't be accessed.
```
... | I could not get XAMPP for Windows (1.7.4 Beta2--I know; ancient) to work on Windows 7 (32 bit) as the MySql would not "activate" or connect to Apache. Just by dumb luck I installed .NET Framework 4.6 for another application and suddenly--Whoopee! It started working! |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql\_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you... | Check whether the value of port variable in the "my.ini" file in your xampp mysql folder is 3306 or 8888 |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql\_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you... | i was facing the same problem. I had to run setup-xampp.bat to make it working.
By the way I came across a new WAMP stack called AMPPS. It looks quite easier than XAMP. You should try. <http://www.ampps.com> |
8,322,550 | I've installed XAMPP on my Windows XP. I started the XAMPP control panel and it shows apache and mysql are running.
When I check the status by going to `localhost/xampp` it shows:
```
mysql : deactivated
```
When I run php files that access the mysql database, it shows the following errors:
```
Warning: mysql_conn... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8322550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1029133/"
] | OK I got this issue resolved in my case, hopefully will help you too. Problem was system itself. If you run Vista, Win7, win8 you probably have permission issue. Simple go to XAMPP root and find mysql\_start.bat and run it. Immediately after clicking your firewall will appear with message asking for permission. All you... | I could not get XAMPP for Windows (1.7.4 Beta2--I know; ancient) to work on Windows 7 (32 bit) as the MySql would not "activate" or connect to Apache. Just by dumb luck I installed .NET Framework 4.6 for another application and suddenly--Whoopee! It started working! |
22,690,091 | I need to create simple icon in css like this - about 32x32 px.

I'd like to make it as simple as it could be (html - no unnecessary divs). The text should be vertically and horizontally aligned to the center of each half.
The text displayed will be short (about 9 chars m... | 2014/03/27 | [
"https://Stackoverflow.com/questions/22690091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3151531/"
] | What's Going On
---------------
I use the `i` element to create icons. Normally with an image, or more recently an icon font, but we can adapt for your needs. (Originally the `i` element wasn't used for icon, and it is debatable whether it's semantically correct. However, it's used in many icon fonts, and in some majo... | You may need to alter the below to match your requirements better, but it should give you a decent starting point:
[Sample Fiddle](http://jsfiddle.net/swfour/CkAS3/1/)
====================================================
HTML
```
<i></i>
```
CSS
```
i {
height:32px;
width:32px;
display:inline-block;
... |
3,439,265 | I have installed oracle 10g express edition and I did not find the option to
create schema..
Is there a option to create schema in oracle 10g express edition
or else I have to install other oracle 10g..?
To create schema which oracle 10g
I have to install... what? | 2010/08/09 | [
"https://Stackoverflow.com/questions/3439265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396486/"
] | You don't need to explicitly create schema, Oracle automatically creates a schema when you create a user (see **[`CREATE USER`](http://download.oracle.com/docs/cd/B13789_01/server.101/b10759/statements_8003.htm#i2065278)** documentation).
If you really want, you can use [**`CREATE SCHEMA`**](http://download.oracle.co... | As zendar said, creating a user automatically creates their schema (in Oracle these are pretty much the same concept).
When you create a Workspace in apex, it will ask you if you want to use an existing schema or create a new one - so that's another easy option you could use. |
3,439,265 | I have installed oracle 10g express edition and I did not find the option to
create schema..
Is there a option to create schema in oracle 10g express edition
or else I have to install other oracle 10g..?
To create schema which oracle 10g
I have to install... what? | 2010/08/09 | [
"https://Stackoverflow.com/questions/3439265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396486/"
] | You don't need to explicitly create schema, Oracle automatically creates a schema when you create a user (see **[`CREATE USER`](http://download.oracle.com/docs/cd/B13789_01/server.101/b10759/statements_8003.htm#i2065278)** documentation).
If you really want, you can use [**`CREATE SCHEMA`**](http://download.oracle.co... | The `CREATE SCHEMA` statement can include `CREATE TABLE`, `CREATE VIEW`, and `GRANT` statements. To issue a `CREATE SCHEMA` statement, you must have the privileges necessary to issue the included statements.
```
CREATE SCHEMA AUTHORIZATION oe
CREATE TABLE new_product
(color VARCHAR2(10) PRIMARY KEY, quantit... |
3,439,265 | I have installed oracle 10g express edition and I did not find the option to
create schema..
Is there a option to create schema in oracle 10g express edition
or else I have to install other oracle 10g..?
To create schema which oracle 10g
I have to install... what? | 2010/08/09 | [
"https://Stackoverflow.com/questions/3439265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/396486/"
] | The `CREATE SCHEMA` statement can include `CREATE TABLE`, `CREATE VIEW`, and `GRANT` statements. To issue a `CREATE SCHEMA` statement, you must have the privileges necessary to issue the included statements.
```
CREATE SCHEMA AUTHORIZATION oe
CREATE TABLE new_product
(color VARCHAR2(10) PRIMARY KEY, quantit... | As zendar said, creating a user automatically creates their schema (in Oracle these are pretty much the same concept).
When you create a Workspace in apex, it will ask you if you want to use an existing schema or create a new one - so that's another easy option you could use. |
46,328,375 | I have been following Gorail's tutorial to deploy on DigitalOcean. [See Here](https://gorails.com/deploy/ubuntu/16.04#capistrano) and [Here also](https://www.youtube.com/watch?time_continue=467&v=WBPV4vjzcjQ).
I've reached the part where I am using the cap production deploy in the command line, but I am getting the fo... | 2017/09/20 | [
"https://Stackoverflow.com/questions/46328375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7438959/"
] | You need to install [that dependency](https://github.com/capistrano/rbenv) by adding it to your `Gemfile`:
```
gem 'capistrano-rbenv'
```
Then `bundle install`.
Capistrano has started to shunt some of the lesser used features to optional modules lately. | Run Capistrano with `bundle exec cap production deploy`, in addition to making sure that the `capistrano-rbenv` gem is in your Gemfile, and `capistrano/rbenv` is in your Capfile as outlined in the other answers. |
46,328,375 | I have been following Gorail's tutorial to deploy on DigitalOcean. [See Here](https://gorails.com/deploy/ubuntu/16.04#capistrano) and [Here also](https://www.youtube.com/watch?time_continue=467&v=WBPV4vjzcjQ).
I've reached the part where I am using the cap production deploy in the command line, but I am getting the fo... | 2017/09/20 | [
"https://Stackoverflow.com/questions/46328375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7438959/"
] | You forgot to require capistrano/passenger in your Capfile. | Run Capistrano with `bundle exec cap production deploy`, in addition to making sure that the `capistrano-rbenv` gem is in your Gemfile, and `capistrano/rbenv` is in your Capfile as outlined in the other answers. |
46,328,375 | I have been following Gorail's tutorial to deploy on DigitalOcean. [See Here](https://gorails.com/deploy/ubuntu/16.04#capistrano) and [Here also](https://www.youtube.com/watch?time_continue=467&v=WBPV4vjzcjQ).
I've reached the part where I am using the cap production deploy in the command line, but I am getting the fo... | 2017/09/20 | [
"https://Stackoverflow.com/questions/46328375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7438959/"
] | First, this is not directly causing your problem, but you have a mistake in your Capfile. If you look at [the official documentation for capistrano-rbenv](https://github.com/capistrano/rbenv#usage), the `set` commands are supposed to go in `deploy.rb`, not in `Capfile`. I suggest removing those lines and moving them to... | Run Capistrano with `bundle exec cap production deploy`, in addition to making sure that the `capistrano-rbenv` gem is in your Gemfile, and `capistrano/rbenv` is in your Capfile as outlined in the other answers. |
4,313,867 | What does `performSelector` do? What is the difference between creating a new `NSThread` and the `performSelector` method?
How it works and where should we use it? | 2010/11/30 | [
"https://Stackoverflow.com/questions/4313867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/202735/"
] | All of these perform the same task, that is make the `doStuff` method on `anObject` execute synchronously on the **current** thread:
```
// 1
[anObject doStuff];
// 2
[anObject performSelector:@selector(doStuff)];
// 3
objc_msgSend(anObject, @selector(doStuff));
// 4
IMP imp = [anObject methodForSelector:@selector(... | `performSelector` executes a selector. In other words, it calls a method.
It is very different from running a new thread.
I think it would be best for you to read up on [selectors](http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocSelectors.html#//apple_ref/doc/uid/TP300011... |
173,361 | With regards to Thermal Radiation, given a stable body initially at 300 Kelvin placed in isolation, after continuous Thermal Radiation will it's temperature gradually reduce to 0 kelvin asymptotically? If so, does this mean that the body is now devoid of any Thermal Energy? And does it imply that the only energy it can... | 2015/03/31 | [
"https://physics.stackexchange.com/questions/173361",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/76641/"
] | In practice, no. In theory, also no.
The Universe is filled with photons with an energy distribution corresponding to $2.73\,\mathrm{K}$, called the [cosmic microwave background (CMB)](http://en.wikipedia.org/wiki/Cosmic_microwave_background). Every $\mathrm{cm}^3$ of space holds [around 400](https://physics.stackexch... | It´s impossible to drop a body temperature to absolute 0K. You must notice that, at the same time the body is radiating energy from its own temperature, it is also receiving temperature from other sources (regardless the distance of the source) like distant stars. |
6,363,710 | I am new to Objective C. On one of the developers documentation, I found the following statemenet.
**The following statement invokes the lockFocusIfCanDraw method and assigns the return value to
flag. It does not generate a compiler warning unless there is a mismatch between the type for flag
and the method’s return t... | 2011/06/15 | [
"https://Stackoverflow.com/questions/6363710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/402814/"
] | The dot syntax for calling methods should only be used for properties (i.e. when calling accessors). Since `lockFocusIfCanDraw` is not an accessor method, you should use the regular square brackets syntax, i.e. `flag = [aView lockFocusIfCanDraw];` instead. | flag = [aView lockFocusIfCanDraw]; |
9,855,673 | It's an interesting problem, really, for all you Devise masters you there.
We have Devise setup with OmniAuth, but the issue happens regardless if you are logged in via Facebook, or logged in via a normal username. What happens is we have a Flash game embedded on our website. When you finish playing the game, the game... | 2012/03/24 | [
"https://Stackoverflow.com/questions/9855673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200567/"
] | Does the form you are submitting have a valid CSRF token? I think Devise calls reset\_session if the csrf token is invalid or doesn't exist. | Try to set full URL address to the "/games/1/leaderboards/13/submitLeaderboardStatistic". Probably reason is cross-domail-policy, which should be received from the server, when you using POST method to the different domain. |
21,494,338 | I have some images in my Photo Album. I have already retrieved the asset urls of all of them.. I want to get a particular image using the asset url... below code gave me asset url..
```
ALAssetRepresentation *defaultRepresentation = [asset defaultRepresentation];
NSString *uti = [defaultRepr... | 2014/02/01 | [
"https://Stackoverflow.com/questions/21494338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1394304/"
] | Get Url by this,
```
NSURL *url= (NSURL*) [[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]];
```
And get image from url like below.
```
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
ALAssetRepresentati... | ```
UIImage *img = [UIImage imageWithCGImage:[[myAsset defaultRepresentation] fullResolutionImage]
```
Hope this helps |
994,426 | I know it's not *exactly* what SU is about, but I didn't know where else to turn at this point. I'm trying to hook up a Samsung LA32S81B television to my/a computer using HDMI. This is a moderately old TV, 2007 era, non-smart.
Originally, I tried to hook it up to my laptop, to no avail. I'll save you the long story of... | 2015/10/31 | [
"https://superuser.com/questions/994426",
"https://superuser.com",
"https://superuser.com/users/246510/"
] | In looking at the specs for that TV, it does not support 1080p. Likely, your PC is outputting a 1080p signal and the TV can't sync to it.
Try these things:
* Lower your display resolution to 1280x720 (that's the HDTV 720p spec).
* On the TV, make sure the HDMI input says PC as the source type (Samsungs in particular ... | I got so sick of this I just bought a new TV |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | From you image it seems like you presented the ViewController using push
The `dismissViewControllerAnimated` is used to close ViewControllers that presented using modal
**Swift 2**
```
navigationController.popViewControllerAnimated(true)
```
**Swift 4**
```
navigationController?.popViewController(animated: true)
... | **In Swift 3.0**
If you want to dismiss a presented view controller
```
self.dismiss(animated: true, completion: nil)
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | From you image it seems like you presented the ViewController using push
The `dismissViewControllerAnimated` is used to close ViewControllers that presented using modal
**Swift 2**
```
navigationController.popViewControllerAnimated(true)
```
**Swift 4**
```
navigationController?.popViewController(animated: true)
... | If you are presenting a ViewController modally, and want to go back to the root ViewController, take care to dismiss this modally presented ViewController before you go back to the root ViewController otherwise this ViewController will not be removed from Memory and cause Memory leaks. |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | I have a solution for your problem. Please try this code to dismiss the view controller if you present the view using modal:
Swift 3:
```
self.dismiss(animated: true, completion: nil)
```
OR
If you present the view using "push" segue
```
self.navigationController?.popViewController(animated: true)
``` | **In Swift 3.0**
If you want to dismiss a presented view controller
```
self.dismiss(animated: true, completion: nil)
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | From Apple [documentations](https://developer.apple.com/documentation/uikit/uiviewcontroller/1621505-dismiss):
>
> The presenting view controller is responsible for dismissing the view controller it presented
>
>
>
Thus, it is a bad practise to just invoke the [dismiss](https://developer.apple.com/documentation/u... | Since you used push presented viewController, therefore, you can use
```
self.dismiss(animated: false, completion: nil)
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | Use:
```
self.dismiss(animated: true, completion: nil)
```
instead of:
```
self.navigationController.dismissViewControllerAnimated(true, completion: nil)
``` | Try this:
```
@IBAction func close() {
dismiss(animated: true, completion: nil)
}
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | In Swift 3.0 to 4.0 it's as easy as typing this into your function:
```
self.dismiss(animated: true, completion: nil)
```
Or if you're in a navigation controller you can "pop" it:
```
self.navigationController?.popViewController(animated: true)
``` | If you using the present method in the parent VC then you should call this function, to dismiss the child VC use this
```
self.dismiss(animated: true, completion: nil)
```
if you calling child VC by using push method, to dismiss the child VC use this
```
self.navigationController?.popViewController(animated: true)
... |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | I have a solution for your problem. Please try this code to dismiss the view controller if you present the view using modal:
Swift 3:
```
self.dismiss(animated: true, completion: nil)
```
OR
If you present the view using "push" segue
```
self.navigationController?.popViewController(animated: true)
``` | In Swift 3.0 to 4.0 it's as easy as typing this into your function:
```
self.dismiss(animated: true, completion: nil)
```
Or if you're in a navigation controller you can "pop" it:
```
self.navigationController?.popViewController(animated: true)
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | Use:
```
self.dismiss(animated: true, completion: nil)
```
instead of:
```
self.navigationController.dismissViewControllerAnimated(true, completion: nil)
``` | Since you used push presented viewController, therefore, you can use
```
self.dismiss(animated: false, completion: nil)
``` |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | I have a solution for your problem. Please try this code to dismiss the view controller if you present the view using modal:
Swift 3:
```
self.dismiss(animated: true, completion: nil)
```
OR
If you present the view using "push" segue
```
self.navigationController?.popViewController(animated: true)
``` | If you are presenting a ViewController modally, and want to go back to the root ViewController, take care to dismiss this modally presented ViewController before you go back to the root ViewController otherwise this ViewController will not be removed from Memory and cause Memory leaks. |
24,668,826 | Im new to ASP. can any body give the sample code for select all the checkbox while selecting one checkbox from the check box list.
Select All
A
B
C
once checking the select all check from the checkbox list all other items also should get selected. | 2014/07/10 | [
"https://Stackoverflow.com/questions/24668826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3823967/"
] | From you image it seems like you presented the ViewController using push
The `dismissViewControllerAnimated` is used to close ViewControllers that presented using modal
**Swift 2**
```
navigationController.popViewControllerAnimated(true)
```
**Swift 4**
```
navigationController?.popViewController(animated: true)
... | If you presenting a controller without a Navigation Controller, you can call the following code from a method of the presented controller.
```
self.presentingViewController?.dismiss(animated: true, completion: nil)
```
If your ViewController is presented modally, optional presentingViewController will be not nil and... |
57,012,262 | i want to use the optional arguments without `-` or `--`,
want to achive something like this:
```
scriptname install <other options>
scriptname uninstall <other options>
```
my code:
```
parser = argparse.ArgumentParser()
parser.add_argument("install","INSTALL",action='store_true',help="INSTALL SOMETHING",default=... | 2019/07/12 | [
"https://Stackoverflow.com/questions/57012262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8369163/"
] | You don't have to use Selenium when you can just extract the match stats right off the HTML:
```py
import re
from ast import literal_eval
url = 'https://www.whoscored.com/Matches/1294545/LiveStatistics/Germany-Bundesliga-2018-2019-Bayern-Munich-Hoffenheim'
res = requests.get(
url,
headers={
'user-agen... | Request is not the best tool to parse data in this case because this website uses JavaScript, so it is better to use Selenium and a web driver.
I gave it a try and I could parse the names of the players of both teams in 2 different lists.
```
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.w... |
2,773,644 | I'd like to host a WCF web service in IIS. The service should keep a certain set of data all the time, it must never be lost.
My colleague told me this is impossible because IIS closes down the service after a certain time (I assume without any activity). Is that true? How do I prevent that behavior?
In case it matte... | 2010/05/05 | [
"https://Stackoverflow.com/questions/2773644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39590/"
] | By default, IIS recycles the worker process after a certain period of inactivity (20 mins if I recall correct). This causes your data to be lost.
You can turn off this behavior in the Properties page of the ApplicationPool under which your app is running.
EDIT: having said that, if it is *really* important that thi... | >
> My colleague told me this is
> impossible because IIS closes down the
> service after a certain time (I assume
> without any activity). Is that true?
> How do I prevent that behavior?
>
>
>
This is true, but you can get around it by using an out of process state server.
Here are three links describing sess... |
74,360,884 | I deleted a category which is an f-key of the items table. Now the view has an error saying 'Attempt to read property "category\_name" on null'. How do I render a null foreign key?
I tried if-else:
```
@if({{$item->category->category_name}} === 'null')
<h2>no category</h2>
@else
{{ $item->category->category_name... | 2022/11/08 | [
"https://Stackoverflow.com/questions/74360884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17040377/"
] | Try this:
```
@if ($item->category)
{{ $item->category->category_name }}
@else
<h2>no category</h2>
@endif
```
Or simply
```
<h2>{{ $item->category?->category_name ?? 'no category' }}</h2>
``` | In PHP8 or Larvel 8
simple use this one
```
<h2>{{ $item->category->category_name ? 'no category' }}</h2>
``` |
53,301,678 | I am using post navigation for my blog. For this portion i wrote some css. It's working fine. But the problem is for the very latest post , it's showing blank space for next post link. Same thing is happened with oldest post, it's showing again bank space for previous post link. [){?>
<div class="previous-post">
<span class="post-control-link">Previous Article</span>
<span class="post-name"><?php previous_post_l... | You cannot do this with php once the page is generated client-side, therefore you have to use javascript (for example):
```javascript
onclick = documet.getElementById('the id you have').style.property = "blue";
``` |
8,177,473 | ```
int array[10] = {1,2,3,4,5,6,7,8};
int *ptr = array;
std::cout<<*(ptr+ 2); => O/P = 3
int (*arr_ptr)[10] = &array;
std::cout<<*(*arr_ptr+2); => O/P = 3
```
Whats the difference between these 2. I know what they mean, but if they give same result why do we have 2 different notations? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8177473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996330/"
] | The first case is the normal case: `ptr` is a pointer to the first element of the array `array`, and it is indexed (using `*(ptr+2)`, which is a synonym for `ptr[2]`) to access the third element of that array.
The second case is contrived: `arr_ptr` is a pointer to the (enitre) array `array`. It is first dereferenced ... | Use the notation that you understand and that fits the problem domain. If your app has an array, then use array notation. If you have to push pointers around for some other reason, then the second version is appropriate. |
8,177,473 | ```
int array[10] = {1,2,3,4,5,6,7,8};
int *ptr = array;
std::cout<<*(ptr+ 2); => O/P = 3
int (*arr_ptr)[10] = &array;
std::cout<<*(*arr_ptr+2); => O/P = 3
```
Whats the difference between these 2. I know what they mean, but if they give same result why do we have 2 different notations? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8177473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996330/"
] | The first case is the normal case: `ptr` is a pointer to the first element of the array `array`, and it is indexed (using `*(ptr+2)`, which is a synonym for `ptr[2]`) to access the third element of that array.
The second case is contrived: `arr_ptr` is a pointer to the (enitre) array `array`. It is first dereferenced ... | After editing your question, following are the differences:
```
(1) int *ptr = array;
```
`array` gets decayed to the pointer. `ptr` is ideally allowed to point to any `int[]` irrespective of its size
```
(2) int (*arr_ptr)[10] = &array;
```
`arr_ptr` is a pointer to an `int[10]`. It's very specific definition an... |
8,177,473 | ```
int array[10] = {1,2,3,4,5,6,7,8};
int *ptr = array;
std::cout<<*(ptr+ 2); => O/P = 3
int (*arr_ptr)[10] = &array;
std::cout<<*(*arr_ptr+2); => O/P = 3
```
Whats the difference between these 2. I know what they mean, but if they give same result why do we have 2 different notations? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8177473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996330/"
] | The first case is the normal case: `ptr` is a pointer to the first element of the array `array`, and it is indexed (using `*(ptr+2)`, which is a synonym for `ptr[2]`) to access the third element of that array.
The second case is contrived: `arr_ptr` is a pointer to the (enitre) array `array`. It is first dereferenced ... | They are not in fact the same to the compiler, and will result in different assembly language being generated.
Here is some good reference on the difference: <http://cplusplus.com/forum/articles/10/> |
8,177,473 | ```
int array[10] = {1,2,3,4,5,6,7,8};
int *ptr = array;
std::cout<<*(ptr+ 2); => O/P = 3
int (*arr_ptr)[10] = &array;
std::cout<<*(*arr_ptr+2); => O/P = 3
```
Whats the difference between these 2. I know what they mean, but if they give same result why do we have 2 different notations? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8177473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996330/"
] | After editing your question, following are the differences:
```
(1) int *ptr = array;
```
`array` gets decayed to the pointer. `ptr` is ideally allowed to point to any `int[]` irrespective of its size
```
(2) int (*arr_ptr)[10] = &array;
```
`arr_ptr` is a pointer to an `int[10]`. It's very specific definition an... | Use the notation that you understand and that fits the problem domain. If your app has an array, then use array notation. If you have to push pointers around for some other reason, then the second version is appropriate. |
8,177,473 | ```
int array[10] = {1,2,3,4,5,6,7,8};
int *ptr = array;
std::cout<<*(ptr+ 2); => O/P = 3
int (*arr_ptr)[10] = &array;
std::cout<<*(*arr_ptr+2); => O/P = 3
```
Whats the difference between these 2. I know what they mean, but if they give same result why do we have 2 different notations? | 2011/11/18 | [
"https://Stackoverflow.com/questions/8177473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996330/"
] | After editing your question, following are the differences:
```
(1) int *ptr = array;
```
`array` gets decayed to the pointer. `ptr` is ideally allowed to point to any `int[]` irrespective of its size
```
(2) int (*arr_ptr)[10] = &array;
```
`arr_ptr` is a pointer to an `int[10]`. It's very specific definition an... | They are not in fact the same to the compiler, and will result in different assembly language being generated.
Here is some good reference on the difference: <http://cplusplus.com/forum/articles/10/> |
3,763,347 | I am trying to figure out the Taylor coefficient of $\exp\left\{\frac{z+1}{z-1}\right\}$. My idea is as follows:
$$f(z)=\exp\left\{\frac{z+1}{z-1}\right\}=\exp\left\{1+\frac{2}{z-1}\right\}=e\exp\left\{\frac{2}{z-1}\right\}.$$
Then we have $f(z)=e\sum\_{n=0}^{+\infty}\frac{w^n}{n!}$, where $w=\frac{2}{z-1}$. Clearly, w... | 2020/07/20 | [
"https://math.stackexchange.com/questions/3763347",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/83239/"
] | Write
$$ f(z):=\exp{\big(\frac{z+1}{z-1}\big)} =\frac{1}{e}\exp{\big(\frac{2z}{z-1}\big)} $$
Use the generating function for the Laguerre polynomials to show
$$ f(z)=\frac{1}{e} \sum\_{n=0}^\infty L\_n^{(-1)}(2)z^n $$
Thus, using the 'coefficient of' operator
$$ [z^n] f(z) = \frac{1}{e} L\_n^{(-1)}(2) .$$
It is perhaps... | You can easily generate the coefficients $a\_n$ of
$$f(z)=\exp\left(\frac{z+1}{z-1}\right)=\frac 1e\sum\_{n=0}^\infty a\_n \,z^n$$ using the reccurence formula
$$a\_n=\frac{n-2}n\,({2a\_{n-1}-a\_{n-2}}) \quad \text{with} \quad a\_0=1 \quad \text{and} \quad a\_1=- 2 $$ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.