Questions tagged [state]

The contents of memory locations, at any given point in the program's execution, is called the program's state.

The contents of memory locations, at any given point in the program's execution, is called the program's state.

More information is available on Wikipedia.

9107 questions
50
votes
7 answers

How to restore a minimized Window in code-behind?

This is somewhat of a mundane question but it seems to me there is no in-built method for it in WPF. There only seems to be the WindowState property which being an enum does not help since i cannot tell whether the Window was in the Normal or…
H.B.
  • 166,899
  • 29
  • 327
  • 400
50
votes
11 answers

How can I remove an attribute from a React component's state object

If I have a React component that had a property set on its state: onClick() { this.setState({ foo: 'bar' }); } Is it possible to remove "foo" here from Object.keys(this.state)? The replaceState method looks like the obvious method to try but…
Joshua
  • 6,320
  • 6
  • 45
  • 62
48
votes
5 answers

ST Monad == code smell?

I'm working on implementing the UCT algorithm in Haskell, which requires a fair amount of data juggling. Without getting into too much detail, it's a simulation algorithm where, at each "step," a leaf node in the search tree is selected based on…
mergeconflict
  • 8,156
  • 34
  • 63
45
votes
1 answer

STArray documentation for newbies and State/ST related questions

I have a hard time to understand STArray from the documentation and other howtos/discussion I've found through Google. I've got some more related questions below. According to the documentation, STArrays are Mutable boxed and unboxed arrays in the…
bbtrb
  • 4,065
  • 2
  • 25
  • 30
43
votes
6 answers

How to preserve control state within tab items in a TabControl

I am a newcomer to WPF, attempting to build a project that follows the recommendations of Josh Smith's excellent article describing The Model-View-ViewModel Design Pattern. Using Josh's sample code as a base, I have created a simple application that…
Tim Coulter
  • 8,705
  • 11
  • 64
  • 95
42
votes
5 answers

what does it mean when they say http is stateless

I am studing java for web and it mentions http is stateless. what does that mean and how it effects the programming I was also studying the spring framework and there it mentions some beans have to declared as inner beans as their state changes .…
John
42
votes
3 answers

How to change Tkinter Button state from disabled to normal?

I need to change the state of a Button from DISABLED to NORMAL when some event occurs. The button is currently created in the DISABLED state using the following code: self.x = Button(self.dialog, text="Download", state=DISABLED, …
scandalous
  • 912
  • 5
  • 14
  • 25
41
votes
9 answers

Replace individual list elements in Haskell?

I have a list of elements and I wish to update them: from this: ["Off","Off","Off","Off"] to this: ["Off","Off","On","Off"] As I am somewhat new to Haskell, I have been using (x:xs)!!y to extract and update individual components using the…
maclunian
  • 7,893
  • 10
  • 37
  • 45
40
votes
3 answers

is useMemo required to manage state via the context API in reactjs?

I am trying to understand this (mostly very helpful) article which describe how to use react's context API to manage application-level state. For a simple application (in this case a basic counter application), it uses the following solution: const…
tim-mccurrach
  • 6,395
  • 4
  • 23
  • 41
40
votes
2 answers

Android save state on orientation change

I've got an Android application which maintains state regarding distance traveled, time elapsed, etc. This state I can conveniently store in an object and store a reference to that object in the Bundle when Android calls onDestroy() when the user…
Intervention
  • 526
  • 1
  • 4
  • 8
38
votes
14 answers

Vagrant up error in headless Ubuntu: The guest machine entered an invalid state while waiting for it to boot

I need to install vagrant in headless ubuntu (Ubuntu 12.04.2 LTS-64 Bit). Vagrant ver-v1.3.0 and Virtual box- 4.2.18. After adding the vagrant package box, when I am giving "vagrant up" command, am getting the following error: Bringing machine…
user2846870
  • 571
  • 1
  • 8
  • 16
38
votes
6 answers

Get the html of the javascript-rendered page (after interacting with it)

I would like to be able to save the state of the html page after I've interacted with it. Say I click a checkbox, or the javascript set the values of various elements. How can I save the "javascript-rendered" page? Thanks.
user420667
  • 6,552
  • 15
  • 51
  • 83
37
votes
1 answer

AngularJS - How do I change the State from Inside the Controller

I am new to AngularJS and would like to know how I change the State from within the Controller. For example, I typically change the state on a button click:
anad2312
  • 787
  • 2
  • 8
  • 20
35
votes
3 answers

Detecting outgoing call and call hangup event in android

I have a requirement wherein I want to detect two kind of events related to Calls in Android Whenever an outgoing call is made, my application should get to know this along with the called number When the call is hanged up(due to success/failure),…
user669231
  • 1,371
  • 3
  • 18
  • 27
35
votes
3 answers

Accessing parent state in child in React

I have (e.g.) two components in React. The first, app.js, is the root component. It imports some JSON data and puts it in its state. This works fine (I can see it in the React devtools). import data from '../data/docs.json'; class App extends…
GluePear
  • 7,244
  • 20
  • 67
  • 120