• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run an application once

 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Goodday,


please i need help!! i have two forms, one creates a user name and password, the other asks the user to login normally.
I have no clue on how to make the first form to launch once and for all so that when next the application is run it will only display the login form.
please help me figure this out.


thank you
 
Hernan Tavella
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi you should use a data base to save registers of what user have already create an account or not, so the next time the program run it will check in the date base if it exist an bring the correct form.
 
Swastik Dey
Rancher
Posts: 1625
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the user logs in for the first time, persist the data in a file or database. Database will be a better option. Next time when the application starts, check whether you have already persisted the data, if this is the case login normally or else show the login form.
 
Viktor Pergjoka
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you could save the value in a properties file or whatever else what is persistence.
Then if the form was created you write the value. On loading you read the value and asks if the form was created or not.

In Pseudocode:
boolean wasCreated = getValue() //gets the persisted properry
if (!wasCreated)
....//your form
... wascreated = true
....

On the next call the value is true so the if statement is true and the form will not be created.
 
kelly devon
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, let me try it. thanks for the clue. I appreciate. let me get to work!! Love you guys
 
Joe Areeda
Ranch Hand
Posts: 331
2
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I'm a bit confused (a normal situation)

How do you know which user it is before they log in?

I suppose if this is an application that runs in a single user's account that is not shared you could do something with the login name, uid, or save some sort of config file in their home directory.

Most applications I know of, like this forum, combine the log in and register form since it is only used once to register.

Joe
 
Hernan Tavella
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Areeda wrote:I guess I'm a bit confused (a normal situation)

How do you know which user it is before they log in?

I suppose if this is an application that runs in a single user's account that is not shared you could do something with the login name, uid, or save some sort of config file in their home directory.

Most applications I know of, like this forum, combine the log in and register form since it is only used once to register.

Joe


You can persiste the user information in a file directory, and when the program run read the file first and evaluate if the first form is going to be shown or not.
 
Phil English
Ranch Hand
Posts: 62
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kelly devon wrote: Goodday,


please i need help!! i have two forms, one creates a user name and password, the other asks the user to login normally.
I have no clue on how to make the first form to launch once and for all so that when next the application is run it will only display the login form.
please help me figure this out.


thank you


What are you using for your GUI? If it is a web page then you could maybe try something with cookies.

It might also be worth taking a step back, what is wrong with having a standard landing page in your GUI with a Login/Password setup and adding an "I don't have one" button to launch your new user form?From empirical evidence of using the web this seems to be a pretty standard approach. This might be simpler than trying to recognise users and also means that you don't have to worry about recognition failing gracefully (i.e. if you fail to recognise an existing user you will need the new user form to have an option for them to log in using their original details otherwise they could end up having to create a new login each time).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic