state

Why is a multithreaded environment considered harmful?

I understand if one were using a lot of widely scoped state, it's a bad idea but how about immutable computations and highly localized side effects? ...

How to avoid long switch ..need help refactoring

hi guys, i needed help refactoring the following class, Following is a class Operation with variety of Operations in switch : i want to avoid the switch statement.I read few articles on using polymorphism and state pattern .but when i refactor the classes i dont get access to many variables,properties Im confused on whether to use o...

Howto removeEventListener with <mx:SetEventHandler /> ?

Hi there, I'm trying to remove an eventlistener on (in this specific case) a HorizontalList. The list is initialized with the property itemRollOver="playPreview(event)" I'd like to remove this eventListener by switching state and stating something like: <mx:SetEventHandler target="{horList}" name="itemRollOver" handlerFunction="nu...

What happens if your asp.net app is using too much memory?

Lets say that you are using a shared hosting plan and your application stores lots of objects in the application state. If they start taking too much memory does this mean that the server will just remove them? If not what will happen then? What happens when the server has no memory left? Can you still store objects into the applicati...

WCF ChannelFactory State Property

What does it mean for a ChannelFactory to have a State property? I understand that a created channel can have connection based states. But am confused as to why the ChannelFactory also has such connection states. Does it too connect to the WCF service? ...

Rails error handling with AASM state machine

I'm using the rubyist-aasm state machine for handling the different states in my Event object (event initialized, event discussed, event published, etc.). I added guards to prevent state changes when certain conditions aren't met. This all works fine but it doesn't show any errors when a state change was rejected by the guard. Any idea...

rails state_machine pattern for credit card processing

I'm using the rails state_machine plugin (looks better than aasm) - it looks great - however, I've implemented it for a credit card processing system I wrote and it looks a bit strange... the code looks very un-DRY... I wonder if anyone can cast a quick eye over it and let me know what they think. In particular, to me the bits that does...

ASP.NET Page Double Event Firing

Details: Page has asynch true Double event does not fire every time. Page has a long running process. The double event can be simulated with a thread.sleep() Steps have been taken to prevent double post back. The second event often will fire 10 or 20 minutes after the first event. May not happen on development server Site is running ...

WPF TabControl - how to preserve control state within tab items (MVVM pattern)

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 contains a number of "workspaces", each represented by a tab in a TabControl. In my appl...

State machine workflow - VB.NET

I am creating a very simple state machine class library project in vb.net. This has only 3 states - CreateApplication, ProcessApplication and CompleteApplication. I have an interface created in the same project.I am invoking it from a web application by calling ApplicationService.CreateApplication(obj of ApplicationDetail) <ExternalDat...

Spring Roo how to maintain state between commands

I have written a couple of simple addon's for Spring Roo. How do you maintain state between succesive commands? ...

Maintaining state in the application server or in the database?

REST advocates web applications without client state on the server. The famous shopping cart example is translated to a resource which typically resides in a database. I wonder if it is a good practise to use a database for that kind of data, since the database is already the bottleneck in many applications. Wouldn't it be better to use...

Silverlight VisualStateManager

Is it possible to have nested visual states. What I mean is if a ParentControl has a ChildControl and both have their own visual states, is it possible by setting the state of the ParentControl to change the state of the ChildControl accordingly. ...

Can an object take part in two state machines at the same time?

I am writing an object oriented program whose business process calls for a "ticket" object. The "ticket" object acts in two ways. It is stock to be sold and it is stock we ourselves are either holding on a sale-or-return basis or have committed to buying. For this reason a ticket in the sales process can have a state of being "available...

Correct use of state pattern?

Hi, I originally posted about how I should use the state pattern correctly in an ecommerce application. I didn't get any replies so I have now completed my implementation and thought I would post it to get feedback. This is how I am managing inventory. It would seem that the only real reason for having an enumeration to also represent ...

Ignoring case, punctuation, and whitespace in Strings

What is the most efficient way of ignoring case, punctuation, and whitespace in strings? These strings should be divided into words instead of characters should ignore the aforementioned details on comparisons, and slices of these word-strings should be as efficient as possible with speed in mind. I was going to use case and punctuation...

Scala objects not changing their internal state

I am seeing a problem with some Scala 2.7.7 code I'm working on, that should not happen if it the equivalent was written in Java. Loosely, the code goes creates a bunch of card players and assigns them to tables. class Player(val playerNumber : Int) class Table (val tableNumber : Int) { var players : List[Player] = List() def...

Help on custom state transitions and persistance using "StateLess"

I am in the process of rewriting a data driven application in ASP.NET MVC and i am struggling to solve the following problem. The application allows the user to create one or more documents are to be reviewed by a chain of different type of reviewers. The reviews are done by users of different roles (Reviewer, Manager, FinanceApprover...

Android Bluetooth crashes after orientation change

Hi, My code is based on the BluetoothChat sample from the API. I connect to another device just fine and I can read and write to the connection no problem. But then if I turn the device the orientation of the UI changes automatically. After this, if I try to write to the Bluetooth connection, my application crashes! It seems weird that...

Any way to "save state" in a C# game?

It's ok if the answer to this is "it's impossible." I won't be upset. But I'm wondering, in making a game using C#, if there's any way to mimic the functionality of the "save state" feature of console emulators. From what I understand, emulators have it somewhat easy, they just dump the entire contents of the virtualized memory, instruct...