qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
25,673,707 | I have a situation which only occurs on IE11. Chrome, Firefox, Safari (tablet and phone) all work as expected. I have created a transition for a panel(DIV) that slides in/out from the side. On pageload it should NOT "animate" but snap into the appropriate position. But on IE11 when the page loads the transition is "pla... | 2014/09/04 | [
"https://Stackoverflow.com/questions/25673707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3546826/"
] | Not a completely javascript free solution but you can add a class to the entire page on the body tag:
```
body.pageload * {
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
-o-transition: none !important;
}
```
and remove that class after the pag... | The answer of user3546826 works when the window is larger than the defined `max-width`. When the window is smaller than the transition is still animated by IE / Edge. This can be avoided with the following workaround (just an example):
```
#sidebar-wrapper {
position: fixed;
width: 240px;
bottom:0;
right:0;
... |
25,673,707 | I have a situation which only occurs on IE11. Chrome, Firefox, Safari (tablet and phone) all work as expected. I have created a transition for a panel(DIV) that slides in/out from the side. On pageload it should NOT "animate" but snap into the appropriate position. But on IE11 when the page loads the transition is "pla... | 2014/09/04 | [
"https://Stackoverflow.com/questions/25673707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3546826/"
] | Worked with MicroSoft support and logged a bug. There is a workaround for this issue.
Instead of using the media query
```
@media only screen and (max-width:800px)
```
change the query to be the following:
```
@media only screen and (min-width:1px) and (max-width:800px)
```
This should not be required (it should... | The answer of user3546826 works when the window is larger than the defined `max-width`. When the window is smaller than the transition is still animated by IE / Edge. This can be avoided with the following workaround (just an example):
```
#sidebar-wrapper {
position: fixed;
width: 240px;
bottom:0;
right:0;
... |
57,233,138 | I'm learning OpenCV and Python. I captured some images from my webcam and saved them. But they are saved by default into the local folder. I want to save them to another folder from direct path. How can I do that?
I tried this code
```
import cv2
import os
img = cv2.imread('image.jpg', 1)
path = 'C:\\Users\MJ-INFO\De... | 2019/07/27 | [
"https://Stackoverflow.com/questions/57233138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11549035/"
] | Kindly look at the following code and see the commented out changes:
```
import cv2
import os
img = cv2.imread('image.jpg', 1)
path = r'C:\\Users\MJ-INFO\Desktop\amaster\test' #use r here as in windows sometimes there is a Unicode problem
cv2.imwrite(path, img) #use path here
cv2.waitKey(0)
cv2.destroyAllWindows()
`... | As mentioned in the comment above, change this line
cv2.imwrite(path+'\test.jpg', img) |
38,651,266 | I am trying to inject $scope into angular-translate directive. But it shows
```
angular.min.js:6 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=navBar&p1=Error%3A%…eb%20(http%3A%2F%2Flocalhost%3A8080%2Fsrc%2Fjs%2Fangular.min.js%3A41%3A249)
```
the above error is encount... | 2016/07/29 | [
"https://Stackoverflow.com/questions/38651266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6554634/"
] | maybe this question will help you understand what you need to do
[How to inject a service into app.config in AngularJS](https://stackoverflow.com/questions/22682753/how-to-inject-a-service-into-app-config-in-angularjs)
instead of app.config($translateProvider, $scope)
try it app.run($translateProvider, $rootScope)
... | Please find the documentation for config here: <https://docs.angularjs.org/guide/module>
Inside config block you can only inject Providers.
In order to work with it, you can use `$rootScope` provider because `$scope` is module.
Hope it helps you!
Cheers! |
38,651,266 | I am trying to inject $scope into angular-translate directive. But it shows
```
angular.min.js:6 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=navBar&p1=Error%3A%…eb%20(http%3A%2F%2Flocalhost%3A8080%2Fsrc%2Fjs%2Fangular.min.js%3A41%3A249)
```
the above error is encount... | 2016/07/29 | [
"https://Stackoverflow.com/questions/38651266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6554634/"
] | maybe this question will help you understand what you need to do
[How to inject a service into app.config in AngularJS](https://stackoverflow.com/questions/22682753/how-to-inject-a-service-into-app-config-in-angularjs)
instead of app.config($translateProvider, $scope)
try it app.run($translateProvider, $rootScope)
... | You can not ask for instance during configuration phase - you can ask only for providers. for more information read this [guide](https://docs.angularjs.org/guide/module)
```
app.config(function (MyFactory){
console.log(MyFactory.test);
});
app.factory('MyFactory', function(){
return {
test: 'testing'
... |
6,219,629 | I am looking to build a multilingual website using MS expressions web. The website will consist of a blog and possibly a art display portions. I would like to do all translations manually but I don't want to have more then one CSS stack. What would be the best way to populate the website text. Because this is just a le... | 2011/06/02 | [
"https://Stackoverflow.com/questions/6219629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/738326/"
] | In my professional opinion I would use SQL simply because databases are always easier to edit and handle (in my opinion...) than XML, I like KatieK's idea of simply querying a different database based on which language it is in. However, if this is a learning experience I would use whichever language you know least of ... | If it were me, I'd do it using SQL. I'd have two database tables, each with the different language content, and change the SQL call server-side based on query strings.
But the best implementation method **for you** depends entirely on your skills and abilities. Do you have experience designing databases and writing S... |
60,545,710 | I am trying to post a request to an API with an `userid` and a list of products
I have made a similar model pass this model to post request of API
this is my model class
```
public class Checkout
{
public string userId { get; set; }
public productList productlist { get; set; }
public class productList
{
... | 2020/03/05 | [
"https://Stackoverflow.com/questions/60545710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12855681/"
] | The purposes of `setMyRoom` isn't to change the local variable `myRoom`. `myRoom`'s probably a `const`, so that would be impossible to change, and even if it's a `let` that's not what setting state is trying to do.
Instead, the purpose of calling setState is to tell react that you want the component to rerender. When... | `setMyRoom` is an async function and you can get the `myRoom` immediate after calling it.
You can solve your problem:
```js
function(){
const newRoom = "test 2";
setMyRoom(newRoom)
console.log(newRoom)
}
``` |
61,870,022 | My form:
```
@if(!empty($Product) && !empty($ProductSpec))
<form action="{{route('update_product')}}" method="POST">
<div class="form-group">
<label for="product_code">Product Code</label>
<input class="form-control" name="product_code" i... | 2020/05/18 | [
"https://Stackoverflow.com/questions/61870022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13561638/"
] | We can use `rename_at` :
```
library(dplyr)
df %>% rename_at(vars(starts_with('OQ')), ~paste0('OQ_45_', seq_along(.)))
```
---
In base R, you can do it with
```
cols <- grep('^OQ', names(df))
names(df)[cols] <- paste0('OQ_45_', seq_along(cols))
``` | If all columns you need to alter start with 'QO' then you can rename\_all using gsub.
```r
library(dplyr)
tibble(OQ1 = NA, OQ2 = NA, OQ3 = NA) %>%
rename_all( ~ gsub("^OQ", "OQ_45_", .x))
#> # A tibble: 1 x 3
#> OQ_45_1 OQ_45_2 OQ_45_3
#> <lgl> <lgl> <lgl>
#> 1 NA NA NA
```
Created on 2020-05... |
61,870,022 | My form:
```
@if(!empty($Product) && !empty($ProductSpec))
<form action="{{route('update_product')}}" method="POST">
<div class="form-group">
<label for="product_code">Product Code</label>
<input class="form-control" name="product_code" i... | 2020/05/18 | [
"https://Stackoverflow.com/questions/61870022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13561638/"
] | We can use `rename_at` :
```
library(dplyr)
df %>% rename_at(vars(starts_with('OQ')), ~paste0('OQ_45_', seq_along(.)))
```
---
In base R, you can do it with
```
cols <- grep('^OQ', names(df))
names(df)[cols] <- paste0('OQ_45_', seq_along(cols))
``` | We can use `str_c`
```
library(dplyr)
library(stringr)
library(dplyr)
df %>%
rename_at(vars(starts_with('OQ')), ~str_c('OQ_45_', seq_along(.)))
``` |
61,870,022 | My form:
```
@if(!empty($Product) && !empty($ProductSpec))
<form action="{{route('update_product')}}" method="POST">
<div class="form-group">
<label for="product_code">Product Code</label>
<input class="form-control" name="product_code" i... | 2020/05/18 | [
"https://Stackoverflow.com/questions/61870022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13561638/"
] | If all columns you need to alter start with 'QO' then you can rename\_all using gsub.
```r
library(dplyr)
tibble(OQ1 = NA, OQ2 = NA, OQ3 = NA) %>%
rename_all( ~ gsub("^OQ", "OQ_45_", .x))
#> # A tibble: 1 x 3
#> OQ_45_1 OQ_45_2 OQ_45_3
#> <lgl> <lgl> <lgl>
#> 1 NA NA NA
```
Created on 2020-05... | We can use `str_c`
```
library(dplyr)
library(stringr)
library(dplyr)
df %>%
rename_at(vars(starts_with('OQ')), ~str_c('OQ_45_', seq_along(.)))
``` |
29,662,193 | I have a dashboard/posts and a frontpage/posts that both use the same 'posts' controller model.
I basically want all the actions available for both dashboard and frontpage except with different layouts.
Whats the best practice for my situation? | 2015/04/15 | [
"https://Stackoverflow.com/questions/29662193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821450/"
] | I would create two new controllers that inherit from that 'posts' controller that you are using right now. Then just override the layout method in those new controllers.
If you can't do that, `layout` also takes a symbol instead of a string.
i.e. add `layout :dashboard_or_frontpage` to that controller. By specifying ... | take a look at this post <http://guides.rubyonrails.org/layouts_and_rendering.html>, you can use a :layout param with the render method. |
213,127 | My alien creature has ability to manipulate oceans enmasse without any magic ,no technology but only a biological method like powerful magnetic field how could it work? what materials is it reinforcedd to withstand its own field? what compounds are mixed that allows it to create this effect? (All ways like spraying an ... | 2021/09/10 | [
"https://worldbuilding.stackexchange.com/questions/213127",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/81971/"
] | Really, Really, Really big fins
===============================
This is pretty much the only thing I could think of. Magnetic fields do not significantly affect water, definitely not enough for an organism to make waves. The best way this organism could move water is with giant fins.
This is an image of an Killer wha... | Thinking of manipulating a lot of water my first thought is the moon and the north sea tides- aka gravity manipulation. Now your creature could maniplulate the orbit of the moon, but it might as well just create extra gravity itself (e.g. by creating a controlled black hole but idk how to realistically give your creatu... |
213,127 | My alien creature has ability to manipulate oceans enmasse without any magic ,no technology but only a biological method like powerful magnetic field how could it work? what materials is it reinforcedd to withstand its own field? what compounds are mixed that allows it to create this effect? (All ways like spraying an ... | 2021/09/10 | [
"https://worldbuilding.stackexchange.com/questions/213127",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/81971/"
] | **Energy requirements say No**.
>
> My alien creature has ability to manipulate oceans enmasse without any magic ,no technology but only a biological method like powerful magnetic field how could it work?
>
>
>
It's a creature and the inertia of an entire ocean (even a "small" ocean) is enormous. There is no way ... | Thinking of manipulating a lot of water my first thought is the moon and the north sea tides- aka gravity manipulation. Now your creature could maniplulate the orbit of the moon, but it might as well just create extra gravity itself (e.g. by creating a controlled black hole but idk how to realistically give your creatu... |
73,087,485 | I am stuck on how to align this diagonal line inside the inner circle. I have tried using position: absolute and display: flex and other methods, but cannot seem to get something that works.
[](https://i.stack.imgur.com/JtOh3.jpg)
jsFiddle: <https://... | 2022/07/23 | [
"https://Stackoverflow.com/questions/73087485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19293623/"
] | You can center the line using flexbox on div3
```
display: flex;
align-items: center;
justify-content: center;
```
Then adjust the transform of the line as required.
I'm assuming from the design this is supposed to be an clock of some kind and this a "second hand".
```css
.container {
display: flex;
flex... | Use `position:absolute` and make it relative to the outer container:
```css
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: start;
height: 500px;
border: 1px solid gray;
}
.elem {
box-sizing: border-box;
}
.div1 {
border-top: 3px solid #0DA8AA;
border-left:... |
648,589 | Let $D$ be an open bounded subset in $\mathbb{R}^{n}$, with sufficiently smooth boundary. Prove that there is a weak solution in $W^{1,2}\_0$$(D)$ to following equation
$$\Delta u+\cos u=0.$$
Help me some hints to start.
Thanks in advanced. | 2014/01/23 | [
"https://math.stackexchange.com/questions/648589",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/100751/"
] | Another way to solve this problem is the following: first, let's prove a more general theorem. Assume that $f:\mathbb{R}\to\mathbb{R}$ is a bounded continuous function. Consider the problem $$-\Delta u=f(u),\ u\in H\_0^1(D)\tag{1}$$
Let $F(x)=\int\_0^x f(s)ds$ and $I:H\_0^1(D)\to\mathbb{R}$ the energy functional assoc... | Fixed point idea for the operator $Tv=\Delta^{-1}\cos(v)$.
So let $v\in H^1\_0(D)=W^{1,2}\_0(D)$, define $\ell(w)=\int\_D w\cos(v)\,dx$ and $a(u,w)=\int\_D \nabla u \cdot \nabla w\, dx$; solve the variational problem $a(u,w)=\ell(w), \forall w\in H^1\_0$ and call the weak solution $u=:Tv \in H^1\_0$; we have reached t... |
648,589 | Let $D$ be an open bounded subset in $\mathbb{R}^{n}$, with sufficiently smooth boundary. Prove that there is a weak solution in $W^{1,2}\_0$$(D)$ to following equation
$$\Delta u+\cos u=0.$$
Help me some hints to start.
Thanks in advanced. | 2014/01/23 | [
"https://math.stackexchange.com/questions/648589",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/100751/"
] | **Existence of a weak solution.** An alternative approach using a fixed point method:
Let $v\in L^2(D)$ and $\varphi(v)\in W^{1,2}\_0(D)$ be a weak solution of
$$
\Delta u+\cos v=0.
$$
Such a weak solution exists as this means for $\varphi(v)$ that
$$
\int\_D \nabla\varphi(v)\cdot\nabla w\,dx=
\int\_{D}w\cos v\,dx \q... | Fixed point idea for the operator $Tv=\Delta^{-1}\cos(v)$.
So let $v\in H^1\_0(D)=W^{1,2}\_0(D)$, define $\ell(w)=\int\_D w\cos(v)\,dx$ and $a(u,w)=\int\_D \nabla u \cdot \nabla w\, dx$; solve the variational problem $a(u,w)=\ell(w), \forall w\in H^1\_0$ and call the weak solution $u=:Tv \in H^1\_0$; we have reached t... |
648,589 | Let $D$ be an open bounded subset in $\mathbb{R}^{n}$, with sufficiently smooth boundary. Prove that there is a weak solution in $W^{1,2}\_0$$(D)$ to following equation
$$\Delta u+\cos u=0.$$
Help me some hints to start.
Thanks in advanced. | 2014/01/23 | [
"https://math.stackexchange.com/questions/648589",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/100751/"
] | **Existence of a weak solution.** An alternative approach using a fixed point method:
Let $v\in L^2(D)$ and $\varphi(v)\in W^{1,2}\_0(D)$ be a weak solution of
$$
\Delta u+\cos v=0.
$$
Such a weak solution exists as this means for $\varphi(v)$ that
$$
\int\_D \nabla\varphi(v)\cdot\nabla w\,dx=
\int\_{D}w\cos v\,dx \q... | Another way to solve this problem is the following: first, let's prove a more general theorem. Assume that $f:\mathbb{R}\to\mathbb{R}$ is a bounded continuous function. Consider the problem $$-\Delta u=f(u),\ u\in H\_0^1(D)\tag{1}$$
Let $F(x)=\int\_0^x f(s)ds$ and $I:H\_0^1(D)\to\mathbb{R}$ the energy functional assoc... |
18,006,008 | I am doing a homework assignment, which pretty much asks the user to choose between two rooms and calculates how much it would cost to stay in that room for a certain number of weeks.
So I'm trying to have my program start out by asking to choose between the rooms, and then, after that choice is made, to have the user... | 2013/08/01 | [
"https://Stackoverflow.com/questions/18006008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2421290/"
] | After reading your issues, this is what I came up with. I kept it as simple as I could to meet your needs. There is a comment on most lines.
```
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.s... | First of all, you should limit the number of frames/windows you dump onto the user. See [The Use of Multiple JFrames: Good or Bad Practice?](https://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice) for some more details.
Instead, I would create each "screen" in a separate `JPanel` and... |
338,686 | I am making a race between me and my brother, and one part is from getting to one place to another by elytra and a rocket. His works like it should, but I just fall, even when spamming them in creative mode. My brother is an eye witness to this and we were both shocked, since our favorite way to travel is by elytra. We... | 2018/09/15 | [
"https://gaming.stackexchange.com/questions/338686",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/213695/"
] | **Edit**: A Family Group is not required for this; you only need to add your account to the other switch.
From Nintendo's website:
>
> Non-Primary Console:
>
>
> * A Nintendo Account can be linked to Nintendo Switch consoles that are
> not designated as the primary console, however, some functionality
> differs ... | >
> The same game. The game will only pause for your friend if you begin to play the same game.
>
>
>
This is not true. You cannot play games at the "same time"
Basically the secondary console will have to go online and check if anyone on the same account is playing the any digital games. If someone is, you get su... |
7,704,371 | Let's say I have a closure:
```
def increment = {value, step ->
value + step
}
```
Now I want to loop over every item of my integers collection, increment it with 5, and save new elements to a new collection:
```
def numbers = [1..10]
def biggerNumbers = numbers.collect {
it + 5
}
```
And now I want to... | 2011/10/09 | [
"https://Stackoverflow.com/questions/7704371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100516/"
] | The solution to your problem would be nesting your call of increment in a closure:
```
def biggerNumbers = numbers.collect {increment(it, 5)}
```
If you wanted to pass a premade closure to the `collect` you should have made it compatible with `collect` - accepting a single parameter that is:
```
def incrementByFive... | mojojojo has the right answer, but just thought I'd add that this looks like a good candidate for [currying](http://mrhaki.blogspot.com/2009/09/groovy-goodness-add-some-curry-for.html) (specifically [using `rcurry`](http://mrhaki.blogspot.com/2010/04/groovy-goodness-new-ways-to-curry.html))
If you have:
```
def incre... |
7,704,371 | Let's say I have a closure:
```
def increment = {value, step ->
value + step
}
```
Now I want to loop over every item of my integers collection, increment it with 5, and save new elements to a new collection:
```
def numbers = [1..10]
def biggerNumbers = numbers.collect {
it + 5
}
```
And now I want to... | 2011/10/09 | [
"https://Stackoverflow.com/questions/7704371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100516/"
] | The solution to your problem would be nesting your call of increment in a closure:
```
def biggerNumbers = numbers.collect {increment(it, 5)}
```
If you wanted to pass a premade closure to the `collect` you should have made it compatible with `collect` - accepting a single parameter that is:
```
def incrementByFive... | The main issue is that `[1..10]` creates a `List<IntRange>` which you are trying to increment. You should `collect` on the IntRange directly (note the lack of brackets):
```
(1..10).collect { it + 5 }
```
Or with curry:
```
def sum = { a, b -> a + b }
(1..10).collect(sum.curry(5))
``` |
7,704,371 | Let's say I have a closure:
```
def increment = {value, step ->
value + step
}
```
Now I want to loop over every item of my integers collection, increment it with 5, and save new elements to a new collection:
```
def numbers = [1..10]
def biggerNumbers = numbers.collect {
it + 5
}
```
And now I want to... | 2011/10/09 | [
"https://Stackoverflow.com/questions/7704371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100516/"
] | mojojojo has the right answer, but just thought I'd add that this looks like a good candidate for [currying](http://mrhaki.blogspot.com/2009/09/groovy-goodness-add-some-curry-for.html) (specifically [using `rcurry`](http://mrhaki.blogspot.com/2010/04/groovy-goodness-new-ways-to-curry.html))
If you have:
```
def incre... | The main issue is that `[1..10]` creates a `List<IntRange>` which you are trying to increment. You should `collect` on the IntRange directly (note the lack of brackets):
```
(1..10).collect { it + 5 }
```
Or with curry:
```
def sum = { a, b -> a + b }
(1..10).collect(sum.curry(5))
``` |
62,514,540 | I have a horizontal scroll section on my website but i want to change the scroll style, iv'e managed to change the scroll bar style using '''::-webkit-scrollbar''' tag but it also affects the vertical scroll. I only want to change the scroll bar when its to slide content horizontally.
Any responses are greatly appreci... | 2020/06/22 | [
"https://Stackoverflow.com/questions/62514540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13791854/"
] | Assuming that you want to retain `<span>` as your component, you can target the `h5` variant by targeting the CSS class added by `Typography` which is `MuiTypography-h5`.
In the syntax shown below, the `&` refers to the class generated for `bottomArea` and then the space indicates targeting `.MuiTypography-h5` as a [d... | You are using the `Typography` props the wrong way. The `variant` props only defines the style applied to the component whereas the `component` props defines which tag will be used to render this component.
If you want your `Typography` component to be a `h5`:
```
<Typography variant="h5" component="h5">Bed Count</Ty... |
62,514,540 | I have a horizontal scroll section on my website but i want to change the scroll style, iv'e managed to change the scroll bar style using '''::-webkit-scrollbar''' tag but it also affects the vertical scroll. I only want to change the scroll bar when its to slide content horizontally.
Any responses are greatly appreci... | 2020/06/22 | [
"https://Stackoverflow.com/questions/62514540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13791854/"
] | Assuming that you want to retain `<span>` as your component, you can target the `h5` variant by targeting the CSS class added by `Typography` which is `MuiTypography-h5`.
In the syntax shown below, the `&` refers to the class generated for `bottomArea` and then the space indicates targeting `.MuiTypography-h5` as a [d... | you can use `withStyle` to update the specific component classes
check this [Typography API](https://material-ui.com/api/typography/)
```js
const Typography = withStyles(() => ({
h5: {
color: "red",
},
}))(MuiTypography);
export default function Types() {
return (
<div>
<Box display="flex" flexDi... |
12,548,176 | It's taking forever for my social sharing links to load on my page (it's in my sandbox still, so I can't provide access). Looking through all three of the main players, they're all using `getElementsByTagName` and are searching through all the elements of the page.
Since I'm already assigning classes to all social in... | 2012/09/22 | [
"https://Stackoverflow.com/questions/12548176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691542/"
] | Just ran across pretty much the same thing. [CSS-Tricks](http://css-tricks.com/snippets/javascript/async-sharing-buttons-g-facebook-twitter/) has a snippet for it:
```
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
... | First of all, I doubt it’s the DOM traversing that really slows things down (DOM traversing is usually quick in modern browsers) – usually it’s rather the HTTP requests to the iframe sources that make it seem “slow” to the user.
But if you wanna give it a try, here’s what you can do for Facebook (if the others offer s... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | In fact, the class library you are implementing, is retrieving information from *app.config* inside the application that is consuming it, so, the most correct way to implement configuration for class libraries at .net in VS is to prepare *app.config* in the application to configure everything it consumes, like librarie... | Actually, for some rare case you could store app.config in class libraries (by adding manually) and parse it by [OpenExeConfiguration](https://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.openmappedexeconfiguration%28VS.80%29.aspx).
```
var fileMap =
new ExeConfigurationFileMap {ExeC... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | In fact, the class library you are implementing, is retrieving information from *app.config* inside the application that is consuming it, so, the most correct way to implement configuration for class libraries at .net in VS is to prepare *app.config* in the application to configure everything it consumes, like librarie... | There is no automatic addition of app.config file when you add a class library project to your solution.
To my knowledge, there is no counter indication about doing so manualy. I think this is a common usage.
About log4Net config, you don't have to put the config into app.config, you can have a dedicated conf file in... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | If you want to configure your project logging using log4Net, while using a class library, There is no actual need of any config file. You can configure your log4net logger in a class and can use that class as library.
As log4net provides all the options to configure it.
Please find the code below.
```
public static ... | You do want to add *App.config* to your *tests* class library, if you're using a tracer/logger. *Otherwise nothing gets logged* when you run the test through a test runner such as TestDriven.Net.
For example, I use `TraceSource` in my programs, but running tests doesn't log anything unless I add an *App.config* file w... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | I don't know why this answer hasn't already been given:
Different callers of the same library will, in general, use different configurations. This implies that the configuration must reside in the *executable* application, and not in the class library.
You may create an app.config within the class library project. It... | If you want to configure your project logging using log4Net, while using a class library, There is no actual need of any config file. You can configure your log4net logger in a class and can use that class as library.
As log4net provides all the options to configure it.
Please find the code below.
```
public static ... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | In fact, the class library you are implementing, is retrieving information from *app.config* inside the application that is consuming it, so, the most correct way to implement configuration for class libraries at .net in VS is to prepare *app.config* in the application to configure everything it consumes, like librarie... | You do want to add *App.config* to your *tests* class library, if you're using a tracer/logger. *Otherwise nothing gets logged* when you run the test through a test runner such as TestDriven.Net.
For example, I use `TraceSource` in my programs, but running tests doesn't log anything unless I add an *App.config* file w... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | Jon, a lot of opinion has been given that didn't correctly answer your question.
I will give MY OPINION and then tell you how to do exactly what you asked for.
I see no reason why an assembly couldn't have its own config file. Why is the first level of atomicy (is that a real word?) be at the application level? Why n... | You do want to add *App.config* to your *tests* class library, if you're using a tracer/logger. *Otherwise nothing gets logged* when you run the test through a test runner such as TestDriven.Net.
For example, I use `TraceSource` in my programs, but running tests doesn't log anything unless I add an *App.config* file w... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | You do want to add *App.config* to your *tests* class library, if you're using a tracer/logger. *Otherwise nothing gets logged* when you run the test through a test runner such as TestDriven.Net.
For example, I use `TraceSource` in my programs, but running tests doesn't log anything unless I add an *App.config* file w... | I would recommend using Properties.Settings to store values like ConnectionStrings and so on inside of the class library. This is where all the connection strings are stores in by suggestion from visual studio when you try to add a table adapter for example.
[enter image description here](https://i.stack.imgur.com/7EnK... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | Jon, a lot of opinion has been given that didn't correctly answer your question.
I will give MY OPINION and then tell you how to do exactly what you asked for.
I see no reason why an assembly couldn't have its own config file. Why is the first level of atomicy (is that a real word?) be at the application level? Why n... | I would recommend using Properties.Settings to store values like ConnectionStrings and so on inside of the class library. This is where all the connection strings are stores in by suggestion from visual studio when you try to add a table adapter for example.
[enter image description here](https://i.stack.imgur.com/7EnK... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | You generally should *not* add an `app.config` file to a class library project; it won't be used without some painful bending and twisting on your part. It doesn't *hurt* the library project at all - it just won't do anything at all.
Instead, you configure the application which is using your library; so the configurat... | I would recommend using Properties.Settings to store values like ConnectionStrings and so on inside of the class library. This is where all the connection strings are stores in by suggestion from visual studio when you try to add a table adapter for example.
[enter image description here](https://i.stack.imgur.com/7EnK... |
5,674,971 | I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?... | 2011/04/15 | [
"https://Stackoverflow.com/questions/5674971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648045/"
] | Jon, a lot of opinion has been given that didn't correctly answer your question.
I will give MY OPINION and then tell you how to do exactly what you asked for.
I see no reason why an assembly couldn't have its own config file. Why is the first level of atomicy (is that a real word?) be at the application level? Why n... | Actually, for some rare case you could store app.config in class libraries (by adding manually) and parse it by [OpenExeConfiguration](https://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.openmappedexeconfiguration%28VS.80%29.aspx).
```
var fileMap =
new ExeConfigurationFileMap {ExeC... |
52,428,847 | I am using airflow cli's `backfill` command to manually run some backfill jobs.
```
airflow backfill mydag -i -s 2018-01-11T16-00-00 -e 2018-01-31T23-00-00 --reset_dagruns --rerun_failed_tasks
```
The dag interval is hourly and it has around 40 tasks. Hence this kind of backfill job takes more than a day to finish... | 2018/09/20 | [
"https://Stackoverflow.com/questions/52428847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5299351/"
] | Adding `--donot_pickle` switch to the `backfill` command [may help](https://issues.apache.org/jira/browse/AIRFLOW-1482?attachmentSortBy=dateTime). | If I understand your issue correctly, the behaviour you seek can be achieved by setting
```
'depends_on_past': False
```
among the DAG args.
Source: <https://airflow.incubator.apache.org/tutorial.html#backfill> |
52,428,847 | I am using airflow cli's `backfill` command to manually run some backfill jobs.
```
airflow backfill mydag -i -s 2018-01-11T16-00-00 -e 2018-01-31T23-00-00 --reset_dagruns --rerun_failed_tasks
```
The dag interval is hourly and it has around 40 tasks. Hence this kind of backfill job takes more than a day to finish... | 2018/09/20 | [
"https://Stackoverflow.com/questions/52428847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5299351/"
] | Have experienced the same problem with the backfill command.
Tried the --donot\_pickle option and depends\_on\_past set to False without success.
**Possible workaround:** Set a start date and catchup=True for the DAG, and unpause it in the web gui. This worked like a backfill.
I could not get backfill CLI command... | If I understand your issue correctly, the behaviour you seek can be achieved by setting
```
'depends_on_past': False
```
among the DAG args.
Source: <https://airflow.incubator.apache.org/tutorial.html#backfill> |
52,428,847 | I am using airflow cli's `backfill` command to manually run some backfill jobs.
```
airflow backfill mydag -i -s 2018-01-11T16-00-00 -e 2018-01-31T23-00-00 --reset_dagruns --rerun_failed_tasks
```
The dag interval is hourly and it has around 40 tasks. Hence this kind of backfill job takes more than a day to finish... | 2018/09/20 | [
"https://Stackoverflow.com/questions/52428847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5299351/"
] | Adding `--donot_pickle` switch to the `backfill` command [may help](https://issues.apache.org/jira/browse/AIRFLOW-1482?attachmentSortBy=dateTime). | From what I understand backfilling stops execution when the tasks that has in queue fail.
A trick that worked for me is to load the queue with all the tasks that I need to be run irrespective of failures. That is to say, I increase the max\_active\_runs to a ridiculous number so that all dag runs are executed.
e.g.
`... |
52,428,847 | I am using airflow cli's `backfill` command to manually run some backfill jobs.
```
airflow backfill mydag -i -s 2018-01-11T16-00-00 -e 2018-01-31T23-00-00 --reset_dagruns --rerun_failed_tasks
```
The dag interval is hourly and it has around 40 tasks. Hence this kind of backfill job takes more than a day to finish... | 2018/09/20 | [
"https://Stackoverflow.com/questions/52428847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5299351/"
] | Have experienced the same problem with the backfill command.
Tried the --donot\_pickle option and depends\_on\_past set to False without success.
**Possible workaround:** Set a start date and catchup=True for the DAG, and unpause it in the web gui. This worked like a backfill.
I could not get backfill CLI command... | From what I understand backfilling stops execution when the tasks that has in queue fail.
A trick that worked for me is to load the queue with all the tasks that I need to be run irrespective of failures. That is to say, I increase the max\_active\_runs to a ridiculous number so that all dag runs are executed.
e.g.
`... |
72,723,912 | I'm trying to programmatically populate a template (.docx file) and save it as a PDF. Is there a free library to do this? Or possibly another format to use for the template?
Would prefer not to pay to use interop methods, online services, or pay tons of money if possible.
I could use RDLC but I'd prefer to be able to... | 2022/06/23 | [
"https://Stackoverflow.com/questions/72723912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3953989/"
] | DocX has specifically MS Office Objects thus traditionally uses features like OLE, MS WordArt etc.
Hence the No 1 quality convert MS Word DocX to MS PDF is export from Word.
The simpler native windows method is use WordPad print probably pre processed via tar to inject the template forms data xml into the zip.docx.
... | You could try to use [Microsoft.interop.Word](https://learn.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word?view=word-pia) or you could try to make a tests with the [Open-XML-SDK](https://github.com/OfficeDev/Open-XML-SDK)
I tried to make a test with the Microsoft.interop.Word in the Asp.Net Core 6 projec... |
3,865 | I want host my web site using osCommerce on CentOS, we have our own server at our office on that we have install CentOS 5.5 with LAMP. We want to host a web site using our live IP address using osCommerce. If any one has a step by step how to for osCommerce on CentOS please share with us.
We have unzipped `oscommerce... | 2010/10/15 | [
"https://webmasters.stackexchange.com/questions/3865",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/2443/"
] | This is actually a function built in by Google originally to help newspapers etc. It's called "first page free". News sites want their content to be indexed by Google so they can get search traffic, however, Google does not want to send users to a login page, so they compromised Google will index content that is normal... | Google doesn't know that Experts Exchange is doing this because Experts Exchange only shows questions with answers to Google.
It used to be the case that Experts Exchange would hide the answers from the user but Google caught on to the tricks that Experts Exchange and other sites were using and EE had to change or ris... |
66,379,596 | First off I have the following restrictions
1. 'Do NOT attempt to explicitly find the exact type of the objects being copied,'
2. 'do NOT attempt to find the object type inside the copy constructors'
3. 'and Do NOT use clone().'
Keep in mind this is only a programming 2 class, we aren't allowed to use things like Ser... | 2021/02/26 | [
"https://Stackoverflow.com/questions/66379596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8485093/"
] | >
> 'do NOT attempt to find the object type inside the copy constructors'
>
>
>
What is that supposed to mean?
If you take as given: *The object in question is of a type which has the property that it has a public copy constructor*, which is definitely not true for all types, and plays havoc with ad-hoc created a... | Did you miss this note?
>
> Display the contents of both arrays, then add some comments indicating whether or not the copying is correct. If not; you need to explain why it has not been successful or as you might have expected.
>
>
>
Maybe it's impossible with those restrictions, just explain why they're differen... |
48,398,218 | I have the code:
```
package core;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent ... | 2018/01/23 | [
"https://Stackoverflow.com/questions/48398218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2037559/"
] | You have not set a resources folder in your project structure in order the `getResourse` method to work.
Since you don't have the common Java structure, try providing the full path instead:
```
FXMLLoader loader = new FXMLLoader(new File("fullpath").toURI().toURL());
Parent root = loader.load();
```
And if you want... | As @user2037559 said in comment you can load it like:
```
FXMLLoader.load(getClass().getResource("/your-fxml-file.fxml"));
```
or loaded directly
```
Scene scene = new Scene(FXMLLoader.load(getClass().getResource("/your-fxml-file.fxml")), 320, 240);
``` |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | Your code invokes Undefined Behaviour because `myArray` goes out of scope as soon as `getArray()` returns and any attempt to *use* (dereference) the dangling pointer is UB. | Static ..or.. Global within your .c will do the trick ;)
However the entire time the program will occupy those 3 bytes BUT you avoid doing malloc on simple things like this (malloc recommended for big arrays)
On the other hand if the outside function modify the pointer, then the internal 'myArray' will be modified ca... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | You can't access a local variable once it goes out of scope. This is what it means to be a local variable.
When you are accessing the array in the `replaceNumberAndPrint` function the result is undefined. The fact it appears to work first time is just a fortunate coincidence. Probably the memory location you are poin... | In this code you have used pointer to local objects but when a function returns all local variables goes out of scope. If you will allocate memory (using `malloc()` function for allocation) then no data will be lost or overwrite.
```
int* getArray(int size) {
int *myArray = (int*)malloc(size*sizeof(int));
myAr... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | `myArray` is a local variable and as thus the pointer is only valid until the end of its scope (which is in this case the containing function `getArray`) is left. If you access it later you get undefined behavior.
In practice what happens is that the call to `printf` overwrites the part of the stack used by `myArray` ... | Static ..or.. Global within your .c will do the trick ;)
However the entire time the program will occupy those 3 bytes BUT you avoid doing malloc on simple things like this (malloc recommended for big arrays)
On the other hand if the outside function modify the pointer, then the internal 'myArray' will be modified ca... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | You can't access a local variable once it goes out of scope. This is what it means to be a local variable.
When you are accessing the array in the `replaceNumberAndPrint` function the result is undefined. The fact it appears to work first time is just a fortunate coincidence. Probably the memory location you are poin... | Static ..or.. Global within your .c will do the trick ;)
However the entire time the program will occupy those 3 bytes BUT you avoid doing malloc on simple things like this (malloc recommended for big arrays)
On the other hand if the outside function modify the pointer, then the internal 'myArray' will be modified ca... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | Try something like that. The way you do it "kills" `myArray` cause if it locally defined.
```
#include <stdio.h>
#include <stdlib.h>
void replaceNumberAndPrint(int * array) {
printf("%i\n", array[0]);
printf("%i\n", array[1]);
printf("%i\n" , array[2]);
free(array);
}
int * getArray() {
int * myArray = malloc(s... | myArray goes out of scope as soon as you leave getArray. You need to allocate space for it on the heap instead. |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | You can't access a local variable once it goes out of scope. This is what it means to be a local variable.
When you are accessing the array in the `replaceNumberAndPrint` function the result is undefined. The fact it appears to work first time is just a fortunate coincidence. Probably the memory location you are poin... | Right way to do this is as follows:
```
struct Arr {
int array[3];
};
Arr get_array() {
Arr a;
a.array[0] = 4;
a.array[1] = 65;
a.array[2] = 23;
return a;
}
int main(int argc, char **argv) {
Arr a = get_array();
for(size_t i=0; i<3; i++)
printf("%d\n", a.array[i]);
return 0;
}
```
T... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | Local variables go out of scope upon return, so you can't return a pointer to a local variable.
You need to allocate it dynamically (on the heap), using `malloc` or `new`. Example:
```
int *create_array(void) {
int *array = malloc(3 * sizeof(int));
assert(array != NULL);
array[0] = 4;
array[1] = 65;
... | Static ..or.. Global within your .c will do the trick ;)
However the entire time the program will occupy those 3 bytes BUT you avoid doing malloc on simple things like this (malloc recommended for big arrays)
On the other hand if the outside function modify the pointer, then the internal 'myArray' will be modified ca... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | You can't access a local variable once it goes out of scope. This is what it means to be a local variable.
When you are accessing the array in the `replaceNumberAndPrint` function the result is undefined. The fact it appears to work first time is just a fortunate coincidence. Probably the memory location you are poin... | myArray goes out of scope as soon as you leave getArray. You need to allocate space for it on the heap instead. |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | Local variables go out of scope upon return, so you can't return a pointer to a local variable.
You need to allocate it dynamically (on the heap), using `malloc` or `new`. Example:
```
int *create_array(void) {
int *array = malloc(3 * sizeof(int));
assert(array != NULL);
array[0] = 4;
array[1] = 65;
... | **C++ solution:**
>
> "May I have any access to a local variable in a different function? If so, how?"
>
>
>
The answer is no, not after the function has ended. Local variables are destroyed at that point.
In `C++` the way to deal with returning arrays is to manage them in a *container* like a [std::array](http:... |
4,570,366 | May I have any access to a local variable in a different function? If so, how?
```
void replaceNumberAndPrint(int array[3]) {
printf("%i\n", array[1]);
printf("%i\n", array[1]);
}
int * getArray() {
int myArray[3] = {4, 65, 23};
return myArray;
}
int main() {
replaceNumberAndPrint(getArray());
}
... | 2010/12/31 | [
"https://Stackoverflow.com/questions/4570366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335717/"
] | `myArray` is a local variable and as thus the pointer is only valid until the end of its scope (which is in this case the containing function `getArray`) is left. If you access it later you get undefined behavior.
In practice what happens is that the call to `printf` overwrites the part of the stack used by `myArray` ... | myArray goes out of scope as soon as you leave getArray. You need to allocate space for it on the heap instead. |
22,145,014 | I'm sure there's an answer to this but I can't seem to find it, I've been searching for hours.
The title pretty much sums it up, how do I test if X = A, B or C
Qhey = "hey";
Qhi = "hi";
Qhello = "hello";
I got this little piece of code:
```
if(InputField.getText().contains(Qhey))
{
try {
t... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22145014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3374534/"
] | Use the `or` operator. <http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html>
```
if(InputField.getText().contains(Qhey) || InputField.getText().contains(Qhi) || InputField.getText().contains(Qhello))
``` | Try that:
```
if(InputField.getText().contains(Qhey) || InputField.getText().contains(Qhi) || InputField.getText().contains(Qhello))
```
`||` means "or". |
22,145,014 | I'm sure there's an answer to this but I can't seem to find it, I've been searching for hours.
The title pretty much sums it up, how do I test if X = A, B or C
Qhey = "hey";
Qhi = "hi";
Qhello = "hello";
I got this little piece of code:
```
if(InputField.getText().contains(Qhey))
{
try {
t... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22145014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3374534/"
] | Use the `or` operator. <http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html>
```
if(InputField.getText().contains(Qhey) || InputField.getText().contains(Qhi) || InputField.getText().contains(Qhello))
``` | Replace
>
> if(InputField.getText().contains(Qhey, Qhi, Qhello))
>
>
>
with
```
String text = InputField.getText();
if(text.contains(Qhey) || text.contains(Qhi) || text.contains(Qhello))
``` |
22,145,014 | I'm sure there's an answer to this but I can't seem to find it, I've been searching for hours.
The title pretty much sums it up, how do I test if X = A, B or C
Qhey = "hey";
Qhi = "hi";
Qhello = "hello";
I got this little piece of code:
```
if(InputField.getText().contains(Qhey))
{
try {
t... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22145014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3374534/"
] | If you'll potentially have a lot more than just three strings to match against, then you should use a `Set`:
```
static final Set<String> matches = Collections.unmodifiableSet(
new HashSet(Arrays.asList("A", "B", "C")));
boolean isMatch(String s) { return matches.contains(s); }
```
An additional advantage of t... | Use the `or` operator. <http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html>
```
if(InputField.getText().contains(Qhey) || InputField.getText().contains(Qhi) || InputField.getText().contains(Qhello))
``` |
22,145,014 | I'm sure there's an answer to this but I can't seem to find it, I've been searching for hours.
The title pretty much sums it up, how do I test if X = A, B or C
Qhey = "hey";
Qhi = "hi";
Qhello = "hello";
I got this little piece of code:
```
if(InputField.getText().contains(Qhey))
{
try {
t... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22145014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3374534/"
] | If you'll potentially have a lot more than just three strings to match against, then you should use a `Set`:
```
static final Set<String> matches = Collections.unmodifiableSet(
new HashSet(Arrays.asList("A", "B", "C")));
boolean isMatch(String s) { return matches.contains(s); }
```
An additional advantage of t... | Try that:
```
if(InputField.getText().contains(Qhey) || InputField.getText().contains(Qhi) || InputField.getText().contains(Qhello))
```
`||` means "or". |
22,145,014 | I'm sure there's an answer to this but I can't seem to find it, I've been searching for hours.
The title pretty much sums it up, how do I test if X = A, B or C
Qhey = "hey";
Qhi = "hi";
Qhello = "hello";
I got this little piece of code:
```
if(InputField.getText().contains(Qhey))
{
try {
t... | 2014/03/03 | [
"https://Stackoverflow.com/questions/22145014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3374534/"
] | If you'll potentially have a lot more than just three strings to match against, then you should use a `Set`:
```
static final Set<String> matches = Collections.unmodifiableSet(
new HashSet(Arrays.asList("A", "B", "C")));
boolean isMatch(String s) { return matches.contains(s); }
```
An additional advantage of t... | Replace
>
> if(InputField.getText().contains(Qhey, Qhi, Qhello))
>
>
>
with
```
String text = InputField.getText();
if(text.contains(Qhey) || text.contains(Qhi) || text.contains(Qhello))
``` |
1,126,041 | Anyone can possibly explain me why am I getting these huge fluctuations?
[](https://i.stack.imgur.com/sFfUK.png) | 2016/09/19 | [
"https://superuser.com/questions/1126041",
"https://superuser.com",
"https://superuser.com/users/642886/"
] | This is a [frequently asked question.](https://www.google.com/search?num=100&q=Torrent+HUGE+download+speed+fluctuations) Unfortunately it rarely gets a correct answer.
While there are many different causes to fluctuations in the download speed, in this case with many peaks over 30 MB/s, the most likely reason is that... | Busy torrents will find these speed fluctuations.
It is unlikely to be your hard drive, as others have suggested. The peaks are, on average, 30MB/s. While many folks are claiming these to be random, they really are sequential writes, but in different spots on the disk. Streams of data, cached in memory, which are buff... |
1,126,041 | Anyone can possibly explain me why am I getting these huge fluctuations?
[](https://i.stack.imgur.com/sFfUK.png) | 2016/09/19 | [
"https://superuser.com/questions/1126041",
"https://superuser.com",
"https://superuser.com/users/642886/"
] | This is a [frequently asked question.](https://www.google.com/search?num=100&q=Torrent+HUGE+download+speed+fluctuations) Unfortunately it rarely gets a correct answer.
While there are many different causes to fluctuations in the download speed, in this case with many peaks over 30 MB/s, the most likely reason is that... | Some networks throttle your download speed if you are limiting your upload speed too much. Try increasing upload limit/connections and observe results |
1,126,041 | Anyone can possibly explain me why am I getting these huge fluctuations?
[](https://i.stack.imgur.com/sFfUK.png) | 2016/09/19 | [
"https://superuser.com/questions/1126041",
"https://superuser.com",
"https://superuser.com/users/642886/"
] | Some networks throttle your download speed if you are limiting your upload speed too much. Try increasing upload limit/connections and observe results | Busy torrents will find these speed fluctuations.
It is unlikely to be your hard drive, as others have suggested. The peaks are, on average, 30MB/s. While many folks are claiming these to be random, they really are sequential writes, but in different spots on the disk. Streams of data, cached in memory, which are buff... |
1,174,279 | I have searched high and low and can only find some very bad documentation on how to properly save the data from a rich text editor to a SQL Server database. I am not working with personal profiles, I just want to understand how it is properly done, including how to properly escape said data. | 2009/07/23 | [
"https://Stackoverflow.com/questions/1174279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24875/"
] | Use parameterized queries and you don't need to escape or encode the data going into or coming out of the DB.
What you should be more concerned about is the composition of the HTML that you're receiving when it's be rendered back out from the database. It's not really enough to trust the person submitting the HTML to ... | One simple way would be to HtmlEncode the content of the TinyMCE control when saving and Decode it when retrieving. |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | You can use an anchor, and watch the value of the document's location href;
Start off with `http://acme.co/`, append something to the location, like '#b';
So, now your URL is `http://acme.co/#b`, when a person hits the back button, it goes back to `http://acme.co`, and the interval check function sees the lack of the... | I had the same issue with using 3 different anchor links to the next page. When coming back from the next page and choosing a different anchor the link did not change.
so I had
```
<a href="https://www.example.com/page-name/#house=house1">House 1</a>
<a href="https://www.example.com/page-name/#house=house2">View Hous... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | You can use an anchor, and watch the value of the document's location href;
Start off with `http://acme.co/`, append something to the location, like '#b';
So, now your URL is `http://acme.co/#b`, when a person hits the back button, it goes back to `http://acme.co`, and the interval check function sees the lack of the... | There are many ways to disable the bfcache. The easiest one is to set an 'unload' handler. I think it was a huge mistake to make 'unload' and 'beforeunload' handlers disable the bfcache, but that's what they did (if you want to have one of those handlers *and* still make the bfcache work, you can remove the beforeunloa... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | You can use an anchor, and watch the value of the document's location href;
Start off with `http://acme.co/`, append something to the location, like '#b';
So, now your URL is `http://acme.co/#b`, when a person hits the back button, it goes back to `http://acme.co`, and the interval check function sees the lack of the... | The behavior is related to Safari's Back/Forward cache. You can learn about it on the relevant Apple documentation: <http://web.archive.org/web/20070612072521/http://developer.apple.com/internet/safari/faq.html#anchor5>
Apple's own fix suggestion is to add an empty iframe on your page:
```
<iframe style="height:0px;w... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | You can use an anchor, and watch the value of the document's location href;
Start off with `http://acme.co/`, append something to the location, like '#b';
So, now your URL is `http://acme.co/#b`, when a person hits the back button, it goes back to `http://acme.co`, and the interval check function sees the lack of the... | First of all insert field in your code:
```
<input id="reloadValue" type="hidden" name="reloadValue" value="" />
```
then run jQuery:
```
jQuery(document).ready(function()
{
var d = new Date();
d = d.getTime();
if (jQuery('#reloadValue').val().length == 0)
{
jQuery('#... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | Yes the Safari browser does not handle back/foreward button cache the same like Firefox and Chrome does. Specially iframes like vimeo or youtube videos are cached hardly although there is a new iframe.src.
I found three ways to handle this. Choose the best for your case.
Solutions tested on Firefox 53 and Safari 10.1
... | There are many ways to disable the bfcache. The easiest one is to set an 'unload' handler. I think it was a huge mistake to make 'unload' and 'beforeunload' handlers disable the bfcache, but that's what they did (if you want to have one of those handlers *and* still make the bfcache work, you can remove the beforeunloa... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | All of those answer are a bit of the hack. In modern browsers (safari) only on `onpageshow` solution work,
```
window.onpageshow = function (event) {
if (event.persisted) {
window.location.reload();
}
};
```
but on slow devices sometimes you will see for a split second previous cached view before it... | I had the same issue with using 3 different anchor links to the next page. When coming back from the next page and choosing a different anchor the link did not change.
so I had
```
<a href="https://www.example.com/page-name/#house=house1">House 1</a>
<a href="https://www.example.com/page-name/#house=house2">View Hous... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | I had the same issue with using 3 different anchor links to the next page. When coming back from the next page and choosing a different anchor the link did not change.
so I had
```
<a href="https://www.example.com/page-name/#house=house1">House 1</a>
<a href="https://www.example.com/page-name/#house=house2">View Hous... | There are many ways to disable the bfcache. The easiest one is to set an 'unload' handler. I think it was a huge mistake to make 'unload' and 'beforeunload' handlers disable the bfcache, but that's what they did (if you want to have one of those handlers *and* still make the bfcache work, you can remove the beforeunloa... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | All of those answer are a bit of the hack. In modern browsers (safari) only on `onpageshow` solution work,
```
window.onpageshow = function (event) {
if (event.persisted) {
window.location.reload();
}
};
```
but on slow devices sometimes you will see for a split second previous cached view before it... | There are many ways to disable the bfcache. The easiest one is to set an 'unload' handler. I think it was a huge mistake to make 'unload' and 'beforeunload' handlers disable the bfcache, but that's what they did (if you want to have one of those handlers *and* still make the bfcache work, you can remove the beforeunloa... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | All of those answer are a bit of the hack. In modern browsers (safari) only on `onpageshow` solution work,
```
window.onpageshow = function (event) {
if (event.persisted) {
window.location.reload();
}
};
```
but on slow devices sometimes you will see for a split second previous cached view before it... | Yes the Safari browser does not handle back/foreward button cache the same like Firefox and Chrome does. Specially iframes like vimeo or youtube videos are cached hardly although there is a new iframe.src.
I found three ways to handle this. Choose the best for your case.
Solutions tested on Firefox 53 and Safari 10.1
... |
8,788,802 | Got an issue with safari loading old youtube videos when back button is clicked. I have tried adding onunload="" (mentioned here [Preventing cache on back-button in Safari 5](https://stackoverflow.com/questions/5297122/preventing-cache-on-back-button-in-safari-5)) to the body tag but it doesn't work in this case.
Is t... | 2012/01/09 | [
"https://Stackoverflow.com/questions/8788802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365380/"
] | The behavior is related to Safari's Back/Forward cache. You can learn about it on the relevant Apple documentation: <http://web.archive.org/web/20070612072521/http://developer.apple.com/internet/safari/faq.html#anchor5>
Apple's own fix suggestion is to add an empty iframe on your page:
```
<iframe style="height:0px;w... | First of all insert field in your code:
```
<input id="reloadValue" type="hidden" name="reloadValue" value="" />
```
then run jQuery:
```
jQuery(document).ready(function()
{
var d = new Date();
d = d.getTime();
if (jQuery('#reloadValue').val().length == 0)
{
jQuery('#... |
24,142,561 | I have a website, all coded in PHP (well and HTML, JavaScript, SQL, etc). I am currently making an iPhone App for this website, and to access the different SQL data I need, I am building a kind of API. Up until now, I only needed very simple data, so with one query, an if/else, I would have my data, and I'd just echo i... | 2014/06/10 | [
"https://Stackoverflow.com/questions/24142561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3209448/"
] | Use:
```
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.locations = jsonLoader.locationsFromJSONFile(url)
dispatch_async(dispatch_get_main_queue(),{
self.tableView.reloadData()
})
})
``` | for convenience, you can use Costant
```
let diffQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
let diffMain = dispatch_get_main_queue()
```
and then used in a viewDidLoad()
```
override func viewDidLoad() {
super.viewDidLoad()
dispatch_async(diffQueue) {
self.locations ... |
24,142,561 | I have a website, all coded in PHP (well and HTML, JavaScript, SQL, etc). I am currently making an iPhone App for this website, and to access the different SQL data I need, I am building a kind of API. Up until now, I only needed very simple data, so with one query, an if/else, I would have my data, and I'd just echo i... | 2014/06/10 | [
"https://Stackoverflow.com/questions/24142561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3209448/"
] | Use:
```
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
self.locations = jsonLoader.locationsFromJSONFile(url)
dispatch_async(dispatch_get_main_queue(),{
self.tableView.reloadData()
})
})
``` | Replace your code
```
self.tableView.performSelectorOnMainThread(selector:(reloadData), withObject: nil, waitUntilDone: true)
```
with this
```
self.tableView.performSelectorOnMainThread(Selector("reloadData"), withObject: nil, waitUntilDone: true)
```
The diff is in creating selector |
24,142,561 | I have a website, all coded in PHP (well and HTML, JavaScript, SQL, etc). I am currently making an iPhone App for this website, and to access the different SQL data I need, I am building a kind of API. Up until now, I only needed very simple data, so with one query, an if/else, I would have my data, and I'd just echo i... | 2014/06/10 | [
"https://Stackoverflow.com/questions/24142561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3209448/"
] | for convenience, you can use Costant
```
let diffQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)
let diffMain = dispatch_get_main_queue()
```
and then used in a viewDidLoad()
```
override func viewDidLoad() {
super.viewDidLoad()
dispatch_async(diffQueue) {
self.locations ... | Replace your code
```
self.tableView.performSelectorOnMainThread(selector:(reloadData), withObject: nil, waitUntilDone: true)
```
with this
```
self.tableView.performSelectorOnMainThread(Selector("reloadData"), withObject: nil, waitUntilDone: true)
```
The diff is in creating selector |
40,146,562 | Main Activity
```
public class MainActivity extends AppCompatActivity {
Button b1,b2;
DBHelper mydb;
TextView id;
ListView listView;
SimpleCursorAdapter adapter;
String[] from = new String[] { mydb.ID,
mydb.NAME, mydb.ADDRESS };
int[] to = new int[] { R.id.id, R.id.name, R.id.address };
@Override
protected v... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40146562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6742238/"
] | You are only saving the cookie (using `CURLOPT_COOKIEJAR`) from your first curl call, but not loading during your second curl call. That's why no cookie is used during second call. Use the following with your second curl call.
```
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
```
Secondly, you have ... | For save and use cookie file with CURL, i use this code:
```
$ckfile = tempnam('/tmp', 'CURLCOOKIE');
curl_setopt($curl, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($curl, CURLOPT_COOKIEFILE, $ckfile);
``` |
40,146,562 | Main Activity
```
public class MainActivity extends AppCompatActivity {
Button b1,b2;
DBHelper mydb;
TextView id;
ListView listView;
SimpleCursorAdapter adapter;
String[] from = new String[] { mydb.ID,
mydb.NAME, mydb.ADDRESS };
int[] to = new int[] { R.id.id, R.id.name, R.id.address };
@Override
protected v... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40146562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6742238/"
] | You are only saving the cookie (using `CURLOPT_COOKIEJAR`) from your first curl call, but not loading during your second curl call. That's why no cookie is used during second call. Use the following with your second curl call.
```
curl_setopt($curl, CURLOPT_COOKIEFILE, realpath(COOKIE_FILE));
```
Secondly, you have ... | ```
/*
1) Make first request in main page and after do the login
2) I added some headers
3) Check if are all parameters in post ( ex: "&login=Submit" )
4) If is basic authorization use curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
5) Debug header/ errors ...
*/
$url1 = "http://website... |
1,797,194 | I have a large, PHP-based CMS that manages web pages.
All items are organized in a tree structure.
When I edit an item, the "back" button usually points to its parent item.
So, the usual workflow is navigating through the tree.
Now every now and then, the need arises for a workflow that "jumps" to other items without ... | 2009/11/25 | [
"https://Stackoverflow.com/questions/1797194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187606/"
] | Just a couple suggestions
Preview Problem: preview in an IFRAME, so the history doean't get lost?
Cluttered URL problem: If you have some sort of key for each page, other than the URL path
```
(i.e. /frontpage/edit = 952,
/frontpage/edit&from=/somepage/edit = 763,
/template/preview = 651,
template/edit = 612,
templa... | As long as you're only needing to backstep once, why not pass in whatever linkback page IDs you want whenever you produce the page you're jumping to? |
1,797,194 | I have a large, PHP-based CMS that manages web pages.
All items are organized in a tree structure.
When I edit an item, the "back" button usually points to its parent item.
So, the usual workflow is navigating through the tree.
Now every now and then, the need arises for a workflow that "jumps" to other items without ... | 2009/11/25 | [
"https://Stackoverflow.com/questions/1797194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187606/"
] | You could build a stack of visited pages for the session as the user clicks around, pushing on a new page each time the open it, popping off when they click back. Store it as a session variable.
The trick then is to always check their referrer string, since they may also use their browser's back and forward buttons. I... | As long as you're only needing to backstep once, why not pass in whatever linkback page IDs you want whenever you produce the page you're jumping to? |
1,797,194 | I have a large, PHP-based CMS that manages web pages.
All items are organized in a tree structure.
When I edit an item, the "back" button usually points to its parent item.
So, the usual workflow is navigating through the tree.
Now every now and then, the need arises for a workflow that "jumps" to other items without ... | 2009/11/25 | [
"https://Stackoverflow.com/questions/1797194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/187606/"
] | Just a couple suggestions
Preview Problem: preview in an IFRAME, so the history doean't get lost?
Cluttered URL problem: If you have some sort of key for each page, other than the URL path
```
(i.e. /frontpage/edit = 952,
/frontpage/edit&from=/somepage/edit = 763,
/template/preview = 651,
template/edit = 612,
templa... | You could build a stack of visited pages for the session as the user clicks around, pushing on a new page each time the open it, popping off when they click back. Store it as a session variable.
The trick then is to always check their referrer string, since they may also use their browser's back and forward buttons. I... |
73,289,520 | I have 3 errors
I tried all possible solutions
look at this
```
Widget defaultFormField ({
@required TextEditingController? controller,
@required TextInputType? keyboardType,
@required IconData? prefix,
@required String? label,
VoidCallback? onChange,
@required VoidCallback? validate,
}) => TextFormFie... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73289520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17553674/"
] | 1. remove `const` from this line `decoration: const InputDecoration(` .
2. `required Function? onChange`,
3. `required Function? validator`,
use `onChanged` like this
```
onChanged: (value) {
return onChanged != null ? onChanged(value) : null;
},
```
use `validator` like this
```
validator: (value) {
... | `onChanged` provide string on callback, do it like
```dart
Function(String)? onChange,
```
Also for `validator` it can be
```dart
required Function(String?) validate,
validator : (value) => validate(value),
```
`defaultFormField` method
```dart
Widget defaultFormField({
required TextEditingController? co... |
62,973,484 | I'm trying to use `TensorImage.load()` to load a bitmap of picture the user took with the camera app. When I pass in the bitmap I get this error:
`java.lang.IllegalArgumentException: Only supports loading ARGB_8888 bitmaps`
This is my code for when I call the `load` function. First, it starts with the `onActivityResul... | 2020/07/18 | [
"https://Stackoverflow.com/questions/62973484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9830958/"
] | I solved the issue by changing the bitmap configuration in simplest way.
Bitmap bmp = imageBitmap.copy(Bitmap.Config.ARGB\_8888,true) ;
Here
ii - Bitmap is immutable therefore I have make a copy with Bitmap.Config.ARGB\_8888 configuration and a new Bitmap with refrence,
for further reference
<https://developer.and... | For anyone else this is how I solved the issue by changing the bitmap configuration.
```
// Convert the image to a Bitmap
var bitmap: Bitmap? = null
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val source = ImageDecoder.createSource(requireContext().contentRes... |
9,516,330 | I am developing **Android 2.1 API 7** app.
In my Activity, I add the `onTouchEvent()` callback to handle **screen touch** event:
```
public class MyActivity extends Activity{
...
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9516330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959734/"
] | My questions: is there any onTouchListener? Have you registered the listener? Why don't you return just true, even though you handle the event by yourself?
This will work for sure:
```
public class TouchTestActivity extends Activity implements OnTouchListener {
TextView textView;
String text;
/** Called... | Here is some code, I think it will do what you want.
I used a toast widget so you can easily see it works.
```
package com.aendroid.tuetsh;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.Toast;
public class Tuetsh extends Activi... |
29,660,512 | So my program is suppose to take the input from a user about the brand, serial number, and price of a cellphone. Then, if the user wants, the program will compare the entered values ( namely brand and price in my case) and compare it to the objects from the array to see if any matches occur. However, eclipse just termi... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29660512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4793801/"
] | You're comparing apples to oranges (or a `String` to a `Cellphone`) here:
```
brand.equals(phone);
```
which is why `Cellphone.equals()` always returns `false`. You should compare the brand `String`s of the phones instead:
```
brand.equals(phone.brand);
```
Also, by convention, you should declare the `equals` met... | Change your last for-statement:
old:
```
for(int i=0; i>=cellphoneArr.length; i++)
```
new:
```
for(int i=0; i<=cellphoneArr.length; i++)
``` |
29,660,512 | So my program is suppose to take the input from a user about the brand, serial number, and price of a cellphone. Then, if the user wants, the program will compare the entered values ( namely brand and price in my case) and compare it to the objects from the array to see if any matches occur. However, eclipse just termi... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29660512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4793801/"
] | You're comparing apples to oranges (or a `String` to a `Cellphone`) here:
```
brand.equals(phone);
```
which is why `Cellphone.equals()` always returns `false`. You should compare the brand `String`s of the phones instead:
```
brand.equals(phone.brand);
```
Also, by convention, you should declare the `equals` met... | I'm not sure if the IF statement in the equals method is a typo, but there should be a return statement instead. If it is indeed a typo then another reason to this could be the fact that the Price field, just like the other ones, is private and you might be calling the field outside of the class but I'm not sure if tha... |
29,660,512 | So my program is suppose to take the input from a user about the brand, serial number, and price of a cellphone. Then, if the user wants, the program will compare the entered values ( namely brand and price in my case) and compare it to the objects from the array to see if any matches occur. However, eclipse just termi... | 2015/04/15 | [
"https://Stackoverflow.com/questions/29660512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4793801/"
] | Change your last for-statement:
old:
```
for(int i=0; i>=cellphoneArr.length; i++)
```
new:
```
for(int i=0; i<=cellphoneArr.length; i++)
``` | I'm not sure if the IF statement in the equals method is a typo, but there should be a return statement instead. If it is indeed a typo then another reason to this could be the fact that the Price field, just like the other ones, is private and you might be calling the field outside of the class but I'm not sure if tha... |
2,824,219 | My organisiation uses Sharepoint for its 'intranet'. I have been given the task of creating a site for my department. One of the things I need on there is a procedure guide, which is basically a 150 page document, whereby each page is a separate procedure. Is there an efficient way within sharepoint that these procedur... | 2010/05/13 | [
"https://Stackoverflow.com/questions/2824219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339912/"
] | There's no difference, you will always use .Update to commit changes from where the current cursor is pointing at. AddNew allocates new row at the end of ADODB recordset
ADODB recordset is a cursor-based data set, when you load rows into recordset, the cursor is automatically on first row, so anything you do on record... | To edit an existing record: .Edit to start, .Update to finish.
To create a new record: .AddNew to start, .Update to finish. |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | NHibernate's SessionFactory is an expensive operation so a good strategy is to creates a Singleton which ensures that there is only ONE instance of SessionFactory in memory:
```
public class NHibernateSessionManager
{
private readonly ISessionFactory _sessionFactory;
public static readonly NHib... | I am only allowed to limit my answer to one option? In that case I would select that you implement the second-level cache mechanism of NHibernate.
This way, for each object in your mapping file you are able to define the cache-strategy. The secondlevel cache will keep already retrieved objects in memory and therefore... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | NHibernate generates pretty fast SQL right out of the box.
I've been using it for a year, and have yet to have to write bare SQL with it.
All of my performance problems have been from [Normalization](http://www.codinghorror.com/blog/archives/001152.html) and lack of indexes.
The easiest fix is to examine the execution... | If you're not already using lazy loading (appropriately), start. Fetching collections when you don't need them is a waste of everything.
[Chapter Improving performance](http://nhibernate.info/doc/nhibernate-reference/performance.html) describes this and other ways to improve performance. |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | NHibernate's SessionFactory is an expensive operation so a good strategy is to creates a Singleton which ensures that there is only ONE instance of SessionFactory in memory:
```
public class NHibernateSessionManager
{
private readonly ISessionFactory _sessionFactory;
public static readonly NHib... | Caching, Caching, Caching -- Are you using your first level caching correctly [closing sessions prematurely, or using StatelessSession to bypass first level caching]? Do you need to set up a simple second level cache for values that change infrequently? Can you cache query result sets to speed up queries that change in... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | No a recommendation but a tool to help you : NH Prof ( <http://nhprof.com/> ) seems to be promising, it can evaluate your use of the ORM framework. It can be a good starting point for your tunning of NHibernate. | Without any specifics about the kinds of performance issues you're seeing, I can only offer a generalization: In my experience, most database query performance issues arise from lack of proper indices. So my suggestion for a first action would be to check your query plans for non-indexed queries. |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | Avoid and/or minimize the [Select N + 1 problem](http://ayende.com/Blog/archive/2008/12/01/solving-the-select-n1-problem.aspx) by recognizing when to switch from lazy loading to eager fetching for slow performing queries. | Caching, Caching, Caching -- Are you using your first level caching correctly [closing sessions prematurely, or using StatelessSession to bypass first level caching]? Do you need to set up a simple second level cache for values that change infrequently? Can you cache query result sets to speed up queries that change in... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | The first and most dramatic performance problem that you can run into with NHibernate is if you are creating a new session factory for every session you create. Only one session factory instance should be created for each application execution and all sessions should be created by that factory.
Along those lines, you ... | No a recommendation but a tool to help you : NH Prof ( <http://nhprof.com/> ) seems to be promising, it can evaluate your use of the ORM framework. It can be a good starting point for your tunning of NHibernate. |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | NHibernate generates pretty fast SQL right out of the box.
I've been using it for a year, and have yet to have to write bare SQL with it.
All of my performance problems have been from [Normalization](http://www.codinghorror.com/blog/archives/001152.html) and lack of indexes.
The easiest fix is to examine the execution... | Profiling is the first step - even simple timed unit tests - to find out where the greatest gains can be made
For collections consider setting the batch size to reduce the number of select statements issued - see section [Improving performance](http://nhibernate.info/doc/nhibernate-reference/performance.html) for deta... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | If you're not already using lazy loading (appropriately), start. Fetching collections when you don't need them is a waste of everything.
[Chapter Improving performance](http://nhibernate.info/doc/nhibernate-reference/performance.html) describes this and other ways to improve performance. | What lotsoffreetime said.
Read Chapter 19 of the documentation, "Improving Performance".
NHibernate: <http://nhibernate.info/doc/nhibernate-reference/performance.html>
Hibernate: <http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html>
Use SQL Profiler (or equivalent for the database you're... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | The first and most dramatic performance problem that you can run into with NHibernate is if you are creating a new session factory for every session you create. Only one session factory instance should be created for each application execution and all sessions should be created by that factory.
Along those lines, you ... | What lotsoffreetime said.
Read Chapter 19 of the documentation, "Improving Performance".
NHibernate: <http://nhibernate.info/doc/nhibernate-reference/performance.html>
Hibernate: <http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html>
Use SQL Profiler (or equivalent for the database you're... |
67,103 | I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer) | 2008/09/15 | [
"https://Stackoverflow.com/questions/67103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] | No a recommendation but a tool to help you : NH Prof ( <http://nhprof.com/> ) seems to be promising, it can evaluate your use of the ORM framework. It can be a good starting point for your tunning of NHibernate. | Caching, Caching, Caching -- Are you using your first level caching correctly [closing sessions prematurely, or using StatelessSession to bypass first level caching]? Do you need to set up a simple second level cache for values that change infrequently? Can you cache query result sets to speed up queries that change in... |
57,851,343 | Lately, I've been working with reading text files by hardcoding them inside.
```
let filename = "input.txt"
let data = fs.readFileSync(process.cwd() + "/" + filename).toString().split(/\r?\n/)
```
This leads me to wonder how could I replace it with something I would specify in terminal while loading the code
(I me... | 2019/09/09 | [
"https://Stackoverflow.com/questions/57851343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12040780/"
] | What you are looking for is command line arguments.
try to create a `test.js` file with this single line :
```
console.log(process.argv);
```
It will behave like this :
```
$ node test.js
> [ '/usr/bin/node', '/tmp/test.js' ]
$ node test.js some command line arguments
> [ '/usr/bin/node',
'/tmp/test.js',
'... | You could read the input arguments are stored in `process.argv` |
10,264,705 | I'm looking to have users upload an image and then it will be cropped to a set size. What I'd like to have happen is essentially a div that's set to the specific crop size and the image inside that box. The user would then be able to slide the image around and whatever was visible in that div is what the image would be... | 2012/04/22 | [
"https://Stackoverflow.com/questions/10264705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1197720/"
] | You don't really need a plugin for that. This can be done by vanilla jQuery and CSS by setting the background-position value.
```
<div id="CroppedImageDiv"></div>
<script type="text/javascript">
function cropImage(imgUrl, cropWidth, cropHeight, cropStartX, cropStartY) {
var bgPos = cropStartX + "px " + cro... | You can use the JCrop plugin.
[Jcrop Plugin](http://deepliquid.com/content/Jcrop_Download.html) |
10,264,705 | I'm looking to have users upload an image and then it will be cropped to a set size. What I'd like to have happen is essentially a div that's set to the specific crop size and the image inside that box. The user would then be able to slide the image around and whatever was visible in that div is what the image would be... | 2012/04/22 | [
"https://Stackoverflow.com/questions/10264705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1197720/"
] | You don't really need a plugin for that. This can be done by vanilla jQuery and CSS by setting the background-position value.
```
<div id="CroppedImageDiv"></div>
<script type="text/javascript">
function cropImage(imgUrl, cropWidth, cropHeight, cropStartX, cropStartY) {
var bgPos = cropStartX + "px " + cro... | I would recomend "Guillotine": <http://github.com/matiasgagliano/guillotine>
It's a jQuery plugin that does just what you are asking, it also throws in rotation and zoom.
It supports touch devices and it's responsive.
Check out the demo: <http://matiasgagliano.github.io/guillotine> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.