w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Good location to add a 'save context' in stock Master/Detail application
There's no single right answer. It depends on how your app works and when, in your app, it makes sense to say "OK, let's make sure we don't lose this state". Where this is depends on the app-- it's not like there's one specific method that's always the right place to save state. Generally it's whenever the user has completed a specific action or task that you want to keep around. If your current approach makes sense in your app, then it is the right solution. If not, figure out where it does make sense and save changes there.

Categories : IOS

Either save state of Fragment or save file and update from that - Android
I think you are correct to try to find a simple approach to this. Case 1: You haven't posted your TabListener code, so firstly I am going to assume that you are adding fragments in onTabSelected and removing them in onTabUnselected. IF this is the case then you should look at using attach and detach instead. The difference is the same instance of the fragment will be used each time you press tab 1. Case 2: Based on what you have said (fragment 1 not being destroyed immediately) you may already using attach / detach. If this is the case, then the system may be responsible for destroying fragment 1 as part of its housekeeping. In this case, look at using setRetainInstance(true) for fragment 1. My concern about this approach is that you are updating your UI in this fragment , so you may ne

Categories : Android

Save view state data into database Error
When you are saving into the database, you redirect right after each insert. Hence, none of the subsequent inserts are executed. I would move the redirect out of the loop. Maybe you can pass the number of records inserted in the query string as well. protected void Button2_Click(object sender, EventArgs e) { foreach (GridViewRow oItem in GridView1.Rows) { string str1 = oItem.Cells[0].Text; string str2 = oItem.Cells[1].Text; string str3 = oItem.Cells[2].Text; insertData(str1, str2, str3); } Response.Redirect("WebForm1.aspx?stat=insert"); } public void insertData(string str1,string str2,string str3) { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CIMProRPT01ConnectionString"].Conn

Categories : Asp Net

Refresh Master page of Android Master/Detail Flow from the detail part
I had done the research and solved the issue. The solution is as follows. Create an interface in the detail fragment class and implement it in the parent activity. Use this interface to update the master list through notifyDataSetChanged() function of the adapter.

Categories : Java

iOS / Master Detail : how to pop the subdetail view when switching detail from the master controller?
OK, I added the following in the Master Controller didSelectRowAtIndexPath: [self.detailViewController.navigationController popToRootViewControllerAnimated:YES]; And it works expectedly with a push segue.

Categories : IOS

Oracle Forms 10g - why do I have to click save so that my insert query will save to database
Oracle Forms provides a great deal of functionality for you so that you don't have to write it. For example, if you base a block on a table, and if the user enters data and clicks "Save", Oracle Forms knows whether to execute Insert, Update or Delete statements appropriately followed by a Commit. In your case, you have ignored that functionality and have hardcoded an Insert and Commit in your button code. Therefore, the user does not have to click the Save button, because the data has already been "saved" by your Add button.

Categories : Oracle

Having an Ajax Save button and save in database
You can use jquery $.ajax() to send data from client side to PHP. (eg) $.ajax({ url : 'path/to/php/page', data : { id : '1', name : 'name' }, dataType : 'JSON', type : 'POST', cache: false, success : function(succ) { alert(succ); }, error : function(err) { alert(err); } }); Then in PHP page, use $_POST[] to capture data and insert it into database. $id = $_POST['id']; $name = $_POST['name']; Make sure you escape the values and make it safe for sql insert.

Categories : PHP

Add master-detail MySQL table data to another database
I can think of two easy ways: Do not use auto increments. Use, for example, UUIDs. OR: Add another field to Transaction-master, siteId, and make it part of a compound key. Then, use Transaction_master_ID and siteId as foreign key on transaction-details. See th4 answer to this question to see how to do this: Multiple-column foreign key in MySQL?

Categories : PHP

Select detail from master-detail list using lambda
You should use SelectMany instead of Select. The error you show has nothing to do with that query. Most likely you are not in the right scope when trying to watch this variable.

Categories : C#

Showing the correct item in a master Combobox coupled with a BindingNavigator in a master/detail relationship
Not sure if this is a proper solution: my idea was that the combobox could be updated automatically by means of some property or method of the involved objects. The quick and dirty solution I have implemented is: Subscribe the BindingSource.CurrentChanged event to be notified about stepping along the data Check for: if (BindingSource.Count == 0) Update manually the ComboBox.SelectedValue with values from the current row. I believe that a better and more ADO capabilities - aware must exists, but this anyway saved my Sunday.

Categories : C#

save state of switchview
You should use SharedPreferences for saving this type of information and you can lock/unlock messages in init time. Storing value you can do something like this: SharedPreferences prefs = this.getSharedPreferences("com.example.app", Context.MODE_PRIVATE); prefs.edit().putBoolean("value_name", true).commit(); And reading value: boolean value = prefs.getBoolean("value_name", false);

Categories : Android

Ember - How to 'save' DOM state
Looping through the DOM to extract the state would be useful to try things out but would get messy once you start having multiple types of objects, optional attributes, etc. What you have is essentially a Canvas that contains different types of objects. Each object is displayed with a different UI depending on its attributes. The objects on the Canvas are shapes with some manner of polymorphism. Eg:- Rectangle > Shape, Note > Shape, etc. A Shape would be a basic data structure that hold common data for a shape, like x,y coordinates, dimensions, so on. The subclasses like Note would have a label attribute that stores the text for that note. Similarly other shapes would store additional data that they need. Each Shape needs to provide some way to serialize and deserialize data into JSON

Categories : Javascript

Save CheckBox state to xml
Checkbox-state is nothing else than an Boolean? -> Nullable bool. You can simple serialize it using an xmlserializer or write it manually to the file: string s = checked.ToString(); and to parse it: bool checked = Boolean.Parse(s)

Categories : C#

How to save a state of on Intent
Do you want to pass data from activity B to C via A? If its that what I understand,then follow the foll steps: Calling A from B: Intent i=new Intent(getApplicationContext(),A.class); i.putExtra("key","value"); startAtivity(i); Fetching data from intent in class A: Bundle extras = getIntent().getExtras(); String value=extras.getString("key"); Passing same data to activity C from class A: Intent i=new Intent(getApplicationContext(),C.class); i.putExtra("key",value); startAtivity(i);

Categories : Java

How to save some state into the URL as a query parameter
I use the $location.search() array to hold search filter settings in an application I'm working on. I use the below $on to listen for these changes and run the appropriate search. $scope.$on('$routeUpdate', function () { ... });

Categories : Angularjs

Can't save instance state in android
If the list is not too large, one easy option would be to save it to Shared Preferences. However, you would need to serialize the ArrayList, as you can only store Strings. You could try something like this in your onSaveInstanceState()... Get a SharedPreferences editor SharedPreferences.Editor editor = getSharedPreferences("shared_preferences", 0).edit(); Add your value editor.putString("myList", serialize(myList)); Commit the changes editor.commit() Then later you can access this list anywhere, such as in your onCreate() method, even if your activity has been killed by doing SharedPreferences preferences = getSharedPreferences("shared_preferences",0); ArrayList<HashMap<String,String>> newsList = deserialize(preferences.getString("newsList", ""); Again, this would req

Categories : Java

Save state of DIV element to LocalStorage
You need to add the set and get from localStorage in your code. To set data you need something like this: // First we setup the data in key/value pairs var dataContainer = { 'check1':'checked', 'check2':'notchecked'} // Then save it to localStorage localStorage.setItem('storedData', JSON.stringify(dataContainer)); And to get data from localStorage: var dataRetrieved = localStorage.getItem('storedData'); console.log('Local Storage data:', JSON.parse(dataRetrieved)) More info on localStorage MDN Local Storage

Categories : Javascript

How to save Google chrome state?
This chrome plugin might do what you are looking for: https://chrome.google.com/webstore/detail/tabcloud/npecfdijgoblfcgagoijgmgejmcpnhof?utm_source=chrome-ntp-icon

Categories : Google Chrome

How to save object state/selection?
In your current code, you are creating new form instance every time, something like: private void OpenForm2 { //open form2: Form2 form2 = new Form2(); form2.ShowDialog(this); //read form2 values: if (form2.Checkbox1.Checked) { MessageBox.Show("Checkbox on form2 is checked") } } Instead, use one global instance and just show it every time, this way preserving its state: Form2 form2 = new Form2(); private void OpenForm2 { //open form2: form2.ShowDialog(this); //read form2 values: if (form2.Checkbox1.Checked) { MessageBox.Show("Checkbox on form2 is checked") } }

Categories : C#

How to save log-in state in Windows Phone 8?
First of all if the website you are trying to log in to is not yours then what you ask for cannot be done. Now assuming that you are using a WebBrowser in your XAML code and that the website you log in to is yours lets say you have a login successfull method: there you have to call this code: window.external.notify("LogInSuccess"); Then your WebBrowser should be like this: <phone:WebBrowser HorizontalAlignment="Stretch" Name="webBrowserControl" VerticalAlignment="Stretch" IsScriptEnabled="True" ScriptNotify="JavaScriptNotify"/> And the method that gets called in .cs file should actually store a success value into isolated storage that will be checked every time you open the login page: void JavaScriptNotify(Object sender, NotifyEventArgs notifyArgs) { // Check if the value

Categories : Windows

Canvas state save Android
My suggestion, make a boolean variable which only lets it happen once. Like this: `protected void onDraw(Canvas canvas) { canvas.drawBitmap(mVolleyBall, cx, cy, null); // Image to be redrawn if(!once){ canvas.drawBitmap(red,x, y, null); // Static image once = true } }` With the variable once being declared as false somewhere in your initialization.

Categories : Android

Backbone model save state
Backbone expects JSON as the default response format. When you get an integer, i suspect, backbone is using jquery $.parseJSON() on the number and returns it as valid JSON while it is not. If you want to return multiple errors messages, i suggest you put them into separate fields of an array and encode them then send as response to backbone. EDIT Just checked backbone source code and it doesn't call on $.parseJOSN() contrary to what was guessed above. EDIT 2 Assume you have the following PHP code (as much as I would like to create a framework agnostic example, it is possible but things will be quicker and smoother using a framework so I have picked Slim). When you save a model, backbone sends the data to the server using POST as the method. In Slim this will translate into the followi

Categories : PHP

Save element state in angularjs
Depends. Do you want the state to be saved even if the user leaves the site or reloads the page, or just while clicking around in Angular? If you only want the second, which is honestly enough if you are just looking to speed up the site a bit, you can save the state in a service. Services only have one instance so if you save something in a service and access it later it will contain the same data. However, this is still just saved inside the javascript, so an actuall page refresh or leaving the site will drop it. See the answer here for more info. If you want to persist for longer than that you need to use cookies or local storage. Angular has an extra plugin that you can download called angular-cookies that gives you the $cookies service to handle cookies. $cookies has some problems h

Categories : Javascript

how to save & restore Webview State?
Try this link, It may helps you, http://www.devahead.com/blog/2012/01/preserving-the-state-of-an-android-webview-on-screen-orientation-change/

Categories : Android

How to save state of Fragment having listview
As explained here you can use onSaveInstanceState() to save data in the Bundle and retrieve that data in the onRestoreInstanceState() method. Often setRetainState(true) is mentioned as way to keep the ui state in fragment, but it does not work for you because you are using the backstack. So a good way for you could be to save the scrollposition in onSaveInstanceState() and restore it in onRestoreInstanceState() like this: public class MyListFragment extends ListFragment { @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); int index = this.getListView().getFirstVisiblePosition(); View v = this.getListView().getChildAt(0); int top = (v == null) ? 0 : v.getTop(); outState.putInt("index", index); outState.putIn

Categories : Java

Save listview state (rows)?
It looks like you're trying to persist the list data on the device (rather than fetching it from a server). You should check out the Storage Options section in the guide. The easiest (but not necessarily the proper) way to do this is to dumped the serialized ArrayList into Internal Storage. Here's a snippet of what it may look like (not tested): ArrayList<String> filenames = ... FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(filenames); oos.close(); PS. Several recommendations for your code: Setup the ListView (setAdapters, setOnItemClickListener) in onCreate instead of in setFileName(). Try using setEmptyView() instead of emptyLibText

Categories : Java

Is it possible to serialize or save viewbag state?
The ViewBag is a DynamicViewDataDictionary, which inherits DynamicObject. Getting the keys is straightforward using "GetDynamicMemberNames", but getting the values is slightly more verbose. The following converts the ViewBag to a dictionary (shamelessly plagiarized borrowed from Aaronaught's answer here): var values = new Dictionary<string, object>(); IEnumerable<string> keys = ViewBag.GetDynamicMemberNames(); foreach (string key in keys) { var binder = Microsoft.CSharp.RuntimeBinder.Binder.GetMember( CSharpBinderFlags.None, key, ViewBag.GetType(), new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) }); var callsite = CallSite<Func<CallSite, object, object>>.Create(binder); var val = callsite.Target(callsite,

Categories : C#

Save program state in chrome extension between uses
You may use local storage of the browser. However if you want to be really flexible you may use nodejs and sockets. That's how I made my extension. I used nodejs, which has an access to the user's disk and sockets to communicate with the node app. The only one problem is that the user should install the module.

Categories : Javascript

Save div toggle state with jquery cookie
I used jquery cookie plugin (https://github.com/carhartl/jquery-cookie) $(function(){ if($.cookie){ //By default, if no cookie, just display. $("#marketing-message-global").toggle(!(!!$.cookie("toggle-state")) || $.cookie("toggle-state") === 'true'); } $('#hide-marketing-message-btn').on('click', function(){ $("#marketing-message-global").toggle(); //Save the value to the cookie for 1 day; and cookie domain is whole site, if ignore "path", it will save this cookie for current page only; $.cookie("toggle-state", $("#marketing-message-global").is(':visible'), {expires: 1, path:'/'}); }); });

Categories : Jquery

How do I save the instance state of a LinearLayout in Android?
Just store the visibility as an integer in the Bundle. private final static String VIEW_1_VISIBILITY = "view_1_visibility"; private View mView1; @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt(VIEW_1_VISIBILITY, mView1.getVisibility()); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if(savedInstanceState != null){ mView1.setVisibility(savedInstanceState.getInt(VIEW_1_VISIBILITY, View.VISIBLE)); } }

Categories : Android

Unable to save JStree state with cookies
There is a bug in jsTree cookies plugin. Plugin initialization code should unescape data read from jquery cookie plugin. To fix this, find and change following line tmp = $.cookie(s.save_opened); to tmp = unescape($.cookie(s.save_opened));

Categories : Jquery

Can not implement a save instance state for my switches
define "back out" of your app. if you cause the acitivity to be destoryed by finishing it, it shouldn't restore the state and you should store it in real storage (sharePreferences, DB, internal/external storage,...). however, if you wish to restore it after the configuration has changed (for example after rotating the device) , it should be restored for you automatically if you use android's normal views, and if you wish to restore totally new customized views, restore them on the onCreate() method and not on the onRestoreInstanceState() method. another alternative is not to finish the activity, and show everything as if it does close, by using fragments instead of multiple activities.

Categories : Android

Save dropdownlist state after form submit in mvc
Use the Selected property of SelectListItem Also, make sure the value of Model.DropList is set in your controller from the post. @using (Html.BeginForm("List", "Home", FormMethod.Post, new { id = "Form" })) { @Html.DropDownListFor(x => x.DropList, new[] { new SelectListItem() {Text = "first", Value = "first", Selected = Model.DropList == "first"}, new SelectListItem() {Text = "second", Value = "second", Selected = Model.DropList == "second"}, new SelectListItem() {Text = "third", Value = "third", Selected = Model.DropList == "third"} }, "DefaultState")

Categories : Asp Net Mvc

iOS. Save state when user exits an application?
You should use background tasks ! Take a look at the documentation here : Executing a Finite-Length Task in the Background Put the call of someFunc in the middle of the background task. If your app goes to the background state, you'll have extra time to finish the execution of the method.

Categories : IOS

Android Save Grid View State
In onResume(), gridView.setSelection(index, 0); in onPause, add the following line to the end: index = gridView.getFirstVisiblePosition();

Categories : Android

Openlayers draw feature : save map state
You can use vector formats with GeoJSON. Did you try this? http://openlayers.org/dev/examples/vector-formats.html

Categories : Javascript

Android: Listview don't save a state of checkbox
List does not save it state while scrolling , because each time new object is created for row item. So you need to explicitly save the state of CheckBox with help of Pojo class(Setter and getter). in getView() method you need to check the value for each checkbox. @Override public View getView(int position, View convertView, ViewGroup parent) { //////////////////// and on setOnCheckedChangeListener you need to save the state of checkbox holder.on_off .setOnCheckedChangeListener(new OnCheckedChangeListener() { // update list when we click on it @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

Categories : Android

More efficient way to save game level state
I don't know Objective C, so I can't give much in the way of example code (someone could edit and add that though). The best way to handle an undo method is just to store what changed rather than the entire state. So if the user interacted with a grid cell G and changed its color from A to B, store only G and A. Then, if they hit undo restore grid cell G to state A.

Categories : Objective C

save $location parameters state AngularJS
The easiest way is using cookies, angularjs provides a wrapping service for that. Simply when you go to "/search" save your current URL parameters with "$cookieStore.put()" and once you've back you've got what you need with "$cookieStore.get()". See the documentation at angularjs cookie store

Categories : Javascript

Save current page state javascript
Well depends, you can use localStorage to do that on the client side, or for example write a javascript function to send all variables to the server and store them there. You need to think more about that problem.

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.