state

How to prevent Custom Views from losing state across screen orientation changes

I've successfully implemented onRetainNonConfigurationInstance() for my main activity to save and restore certain critical components across screen orientation changes. But it seems, my custom views are being re-created from scratch when the orientation changes. This makes sense, although in my case it's inconvenient because the custom...

UISplitViewController's Master view loses state after rotation

On the iPad, I've noticed that apps like Mail and WebMD keep rows in the final level of the hierarchy of the "Master" (left) view highlighted when tapped. They also remember this state after rotation; if you select an e-mail in landscape and then rotate to portrait, and click the Inbox button to bring up the Master view popover, the corr...

how to save switch state with user defaults?

Hi, Is there a method to store the state of a UISwitch with NSUserDefaults? If the state is ON I'd like to set some action... Can I do this? Thanks! ...

Streaming data for state machine playback

Hey all, I have a state machine design that needs to support playback. We have states that perform actions and sometimes need to generate random numbers. In case the program shuts down while in the middle of the FSM's execution, the program needs to playback the whole FSM using the same random numbers as before. For a basic example, le...

Simple question about session...

I came across this example from Ruby's security page (http://guides.rubyonrails.org/security.html). It poses this scenario: A user receives credits, the amount is stored in a session (which is a bad idea anyway, but we’ll do this for demonstration purposes). The user buys something. His new, lower credit will be stored in the session. ...

Column type and size for international country subdivisions (states, provinces, territories etc)

I apologize if this is a duplication. What column standardization would you use for storing international country subdivision data? For example, if it was just US and Canada I believe all subdivisions have a 2-character abbreviation... which might lend to a Char(2) This cannot possibly be sustainable internationally lest we presume th...

Combine state with IO actions

Suppose I have a state monad such as: data Registers = Reg {...} data ST = ST {registers :: Registers, memory :: Array Int Int} newtype Op a = Op {runOp :: ST -> (ST, a)} instance Monad Op where return a = Op $ \st -> (st, a) (>>=) stf f = Op $ \st -> let (st1, a1) = runOp stf st (...

jcarousel - how can i make an image link in the carousel stay active

Have been succesful in adding a jcarousel to navigate around my html site which is built with dynamic template. However, i need an image link to appear active when i am on the page it is linked to so the viewer knows where they are. Also, whenever i go to a new page the jcarousel goes back to the beginning of its scroll position when i n...

Flex 4 Skin:Specifying state for an attribute in script

I'm trying to create a button skin, where i can set fillColors like in a Flex 3 button, using CSS. It was easy to set the color of the gradients, by reading them from the CSS: adding a few lines in updateDisplayList: fillGradient1.color = fillColors[0]; ... How can i set the colors for the other states, from script? I tried adding fil...

custom button: change style when pressed

I created button with some shadow using a style: <style name="test"> <item name="android:shadowColor">#FFFFFF</item> <item name="android:shadowRadius">1</item> <item name="android:shadowDx">1</item> <item name="android:shadowDy">1</item> </style> This applies a white shadow on the button's text in its normal state. I was just...

Passing state when using decorators (formencode) in pylons

I've met the same problem as this page: http://www.mail-archive.com/[email protected]/msg14292.html This is the main content from there: I am using formencode to validate my forms, and I've stumbled upon a problem. When using tha validator inside the controller action, I call to_python() and I can pass the sta...

Program/IDE to save state of a running program and restore later

I have a simulator written in C++ which reads a file and processes it line by line. This is a time consuming process. I mostly run into rum time errors where the program crashes after 15-20 mins. I start debugging and the program takes the same amount of time to hit the break point I set . I examine a few variables and step through the c...

What's the state of a pressed Tab in Android

Hi all, I'm trying to get my tabicon to change when a tab is pressed (i.e. when it changes color when you press the tab, but haven't released yet). I've created a selector as follows: <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; <!-- Non focused states --> <it...

What is the difference between system configuration and system state ?

Today in a design meeting we discussed the topic of where to store configuration and state of a distributed application. It turns out that in that meeting, some developers understand different things when they hear configuration or state. Some even think that configuration and state are exactly the same thing. My very shortly summariz...

Give me a real-life, non-trivial use of the State Pattern.

I'm looking for an example of where the State design pattern has been used to solve or simplify interesting or complicated state transitions. There are plenty of examples with three or four simple states. But what about code from real life projects that have sub-states and more than a handful of transitions? The kind of code that actuall...

How to make state-based model change in QML

Hi, I'm trying to make a QML-based dictionary application. It fetches the word definition via an XML RESTful API and displays them in a ListView. I have it working in this rudimentary mode. But now I'm trying to implement two states for the ListView: standard view with the definitions and a "did you mean" type suggestions list for when t...

Finite State Machine (FSM) and Android's Java

Hello, i'm willing to develop a soccer game for Android. Because the complexity of the AI, i really think i need to design it using a FSM (Finite State Machine) and not with a monster switch. Googling around i found some FSM written in Java, but nothing explicitly compatible with Android: i wonder if there is someone here that used a F...

how to save a uiview while closing the app

hi, I have a requirement to save the last screen viewed while closing the app so that i can show the same screen when he re-opens the app. Can anyone tell me how to save the view and show it after re-opening ? ...

PHP application state

In ASP.NET I can store both session and application state. Is the same true of PHP? I can't seem to find information on application state. If not, what are best practices for shared state information? I need to build a somewhat complex data structure that all clients can utilize. It takes a while to build but is never edited after i...

Problem with getLastNonConfigurationInstance() - Seems to only ever return null

public class XPBN extends Activity{ private Map _map; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); final Map data = (Map)getLastNonConfigurationInstance(); if (data == null) { Toast.makeText(this, "New Map", Toast.LE...