Can't retrieve the session on clicking of browser's back button - ruby-on-rails-3

I have rails application that calculates prices of goods and I set prices in session. I have 'back' button in my application. When I clicks on 'back' link, I will get my previous session values like 'prices','goods' I purchased.
But when I clicks on 'browsers' back button,I won't get my session values, I have to refresh the page for that.

I'd say you have caching issues... The browser remembers what it saw before, and thinks it's the same (without even going to the trouble to ask the server any more). Try if this article helps

You probably want to prevent the browser from caching your pages so that they get refreshed when the user clicks the Back button. This article should help.

Related

react-admin pristine state after loading data via dataprovider

I've got an issue due to a timing issue with react-admin, that i'm looking for a little help on.
The situation is where user A creates a resource, and user B, on a different PC, then goes to list and edit that resource.
For user B, the list page loads the full dataset of 10 resources, then the edit page re-loads the single resource that is being edited.
However, the specific process on the edit page seems to be:
Render page
Render resource cached from the list page
Request the single resource from the API
Populate the edit form with the updated values from the API
Set the form to dirty
That last point is critical, since I have an action button that is only enabled if the form is pristine, so the user has to save any changes before triggering the action.
But in this case, the list view and the edit view seem to return the same data for the resource, so I'm not sure why the form is being set to dirty.
Any thoughts?
Regards,
Andy
This isn't a complete answer, but I hope it helps you save some time. I recently upgraded React Admin version from 3.5.3 to 3.6.0. I noticed that the Save button is now sometimes disabled unexpectedly, and inconsistently. For example, I may navigate to the edit view of a resource by clicking a link and the Save button is enabled, but if I refresh the page, the Save button is disabled. Apparently, the Save button is supposed to be disabled when the form is pristine. So between 3.5.3 and 3.6.0, it seems that some changes were made to either the pristine handling or the Save button's reaction to pristine, and it is not working consistently.
I see there is a new issue opened three days ago regarding overriding the Save button behavior, wrt pristine. https://github.com/marmelab/react-admin/issues/4913 . So, it seems the dust hasn't settled on this behavior. Perhaps a bug will be found.

Is it possible to detect if the user can go back?

Basically, I need to replicate the browser back button on my app (I do not want it, but I need to do it :/)
On durandal, I can navigate back by calling router.navigateBack();. But there is not always a page back (the browser back button get disabled when there is not). So, it is possible to detect if there is a previous page?
I am thinking in creating a simple counter that increments when the user navigate and decrement when it clicks on my "back" button, but I do not now how can I detect the user clicked the browser back button. If there is some way to know that there is not any previous page, it would be nice.
I was able to do this by intercepting the router.on('router:route:activating') event. When the user navigate, I increment a variable, when he goes back (router.navigatingBack will be true even if he clicked on the browser back button!) I decrement it. When it is 0, I disable the go back button.

If on URL then message box

So I have this weird problem. I have a WebBrowser starting on the page https://live.xbox.com/en-US/MyXbox/GamerProfile (It is a page for editing information on your account) but whenever it goes there it takes the user to live.com to log in, and then goes back to the page to edit his profile. This is how I want it to function, but I want a message box to display if it takes the user to the page again (to verify he's logged in). This is what I have so far:
If WebBrowser1.Url.OriginalString() = "https://live.xbox.com/en-US/MyXbox/GamerProfile" Then
MessageBox.Show("You are logged in!")
End If
But I never get the message box to show, and I don't think it works :\
Does anyone know why it isn't working?
which part of your application is that code running? I mean, does your program knows when xbox takes the webrowser to the login page and back? If your code only run once when the webbrowser object is created, then this doesn't get run.
EDIT:
In that case, the code should be within the WebBrwoser.DocumentCompleted() event. Take a look at this: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted.aspx

Detecting last value of database after refresh the application

I am making an iPad app. I have got some problem. Actually I want to show one view at the starting of the app after launching of splash screen. I have made one checkbox on it. It will work as on/off button. Very first time launching of the app, this screen will show to the user. If user click the off button then this screen will never show to him even after refresfing the app. For it, I have made a database table in which at the starting I have stored 0 value in it. When user click button then it becomes 1. But whenever user will refresh the app it becomes again zero but I want to retrieve the last value from the database. Anyone has idea that how to retrieve last value from database table even after refreshing the app.
Thanks to all.
You really should use user defaults for this purpose. There is a method, registerDefaults that is used to set initial values for a default, but once the user has changed it, that initial value isn't used again on subsequent launches of the app

VB.NET - Log into website with out website open

I want to create a program to fetch information from a website (that's fine). However, you need to be logged in to get this information.
I just want two simple textbox controls that I would type my username and password into and hit submit and the information would be returned to me so I can use it. (I don't want to use a webbrowser control)
Sorry if I wasn't clear
And also
(this really isn't important, but its up to you if you want to answer, it's probably hard)
How would I go about checking if I am still logged into a website or not (as in TRUE or FALSE)
you can pass credentials into a HttpWebRequest object.
You could use a webbrowser control since it is easy, and just set its display to not visible - the user would never see anything. You could still interact with the page just like normal. You could use the same control to log yourself out by clicking on the logout button. You would set everything up and test it with visible=true, and when it all works, set visible to false.