state

ASP.NET maintain control state that has collection items

╄→гoц情女王★ 提交于 2019-12-13 02:11:22
问题 Interesting. I have a control QuickContacts with Contacts collection. When I declare Contacts of type List<Contact> it works perfectly, but when use ContactsList<Contact> which is a Generic that implements IList<T> it gives "Parser Error : Type 'Controls.ContactList'1[[Controls.Contact, Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not have a public property named 'Contact'." Here, this code works perfectly with List<Contact> [DefaultProperty("Contacts"),

can't save spinner state android

℡╲_俬逩灬. 提交于 2019-12-13 00:57:49
问题 I tried an tutorial but I cannot save the state of my spinner. Here is my code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Firebase.setAndroidContext(this); setContentView(R.layout.activity_main); //language selection list ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( this, R.array.language_list, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner

Loop through states - scope? ruby/rails

亡梦爱人 提交于 2019-12-12 18:45:15
问题 I'd like to be able to loop through the model based on its current state. I've created fairly simple states for my model as follows: models/job.rb class Job < ActiveRecord::Base has_many :events, class_name: "JobEvent" STATES = %w[bids in_progress complete canceled] delegate :bids?, :in_progress?, :complete?, :canceled?, to: :current_state def current_state (events.last.try(:state) || STATES.first).inquiry end end and models/job_event.rb class JobEvent < ActiveRecord::Base belongs_to :job

Models with persistent state between HTTP requests

梦想与她 提交于 2019-12-12 15:57:49
问题 I want to create a web application with a model that persists between HTTP requests. From what I understand languages like PHP treat each HTTP request as a brand new connection except for some global variables like SESSION; so each time the user changes pages all my PHP classes are loaded into memory again (and each AJAX request does this too) - requiring me to build from the database each time. Am I mistaken or am I trying to make a circle fit in a square? Memcached seems to be a good

How to implement status transitions for an Entity in java?

三世轮回 提交于 2019-12-12 15:27:11
问题 I have multiple entities in my application like Users, Accounts, Licenses etc. Each entity has a status associated with it like Active, Ok, Suspended, Unverified, PendingPayment, PendingApproval etc. I want to make sure the entities can move from a predefined status to another like User can only move from Ok to Suspended but not from Unverified to Suspended. What would be the best design pattern to implement this ? I have looked around and mostly find state machines for such problems, but

keep checkboxes checked after page refresh

走远了吗. 提交于 2019-12-12 14:58:53
问题 I have a couple of checkboxes. when any of them are clickd/checked and the search button is clicked, will grab their values and pass to the url as querystring and refresh the page returning results matching the passed query values. like this: mysite.com/result.aspx?k="Hospital" OR "Office" OR "Emergency" I am able to grab the values after 'k='. I have "Hospital" OR "Office" OR "Emergency" captured and stored in a variable. Now I need to reset the checked state of checkboxes based on these

$stateChangeStart don't work when user refresh browser

一世执手 提交于 2019-12-12 14:03:54
问题 Please, I'm using ui-router on my project. $stateChangeStart event work fine when the user navigate between the states. But it doesn't work if I refresh the browser. This is my source code: (function(){ 'use strict'; angular.module('app.overlay') .directive('ibLoading', ['$rootScope' , '$timeout', loading]); function loading($rootScope , $timeout){ console.log("In dirrective"); var directive = { restrict:'EAC', link:link }; function link(scope, element) { $rootScope.$on('$stateChangeStart',

React Native Change State With Unexpected Logging

两盒软妹~` 提交于 2019-12-12 12:33:08
问题 For context, I am working on this React Native Tutorial The way this logs confuses me. The following is the console output when I changed an empty input field by typing "a" then "b". Here's my SearchPage class. Why does console.log('searchString = ' + this.state.searchString); show the previous value for this.state.searchString ? class SearchPage extends Component { constructor(props) { super(props); this.state = { searchString: 'london' }; } onSearchTextChanged(event) { console.log(

android: media recorder : start failed: -38

浪子不回头ぞ 提交于 2019-12-12 12:29:06
问题 Brief: How to check if voice recording is already running in background in some other app. Detail: if voice recording is already running in background from native app: Voice recorder. Now I have implemented voice recording as one of feature in my application. Problem: when i try recording in my app at the same time, it gives error : : E/MediaRecorder: start failed: -38 : E/MyApp: [1162][com.sec.MyApp.multimedia.RecordMyVoice]java.lang.IllegalStateException : E/MyApp: at android.media

Google Maps Android API v2 - restoring map state

ぐ巨炮叔叔 提交于 2019-12-12 11:40:29
问题 I'm building a very simple map app using Google Maps Android API v2. As expected, when the user leaves and then returns to the app, any changes they've made in location, zoom, etc. are lost as the activity is destroyed and re-created. I know I can save the map's camera state programmatically (perhaps as values in shared preferences) in onPause() and restore it in onResume() , but does the API have any built-in mechanism for persisting map state between activity launches? 回答1: I don't think