Need help with web application settings [closed] - asp.net

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Pls give me the solutions for this two problem, which i was asked recently in interview.
Prob1: Suppose I have application with 10 admin, so they can change the data anytime their having own userid and password. For example, one user retrieve one data from database table, while retrieving it value was 2, after retrieving he didn't update the update button, then he went for breaks for 10 minits. In between other admin change the original database table with value 3, 4, 5 and Finally 10 value by the 10th admin. Now the current value in table 10. But when he comes from breaks and click on the update button value 2 will be saved, which is not at all expected value..it should be 10. How to approach to this problem????
Prob2: Suppose one user forget to logout his application while he was leaving for the day. And after 10 minits while he reached his house, due to urgency again he wants to open that application from his home computer. If he tries to login to the application in that period what will happen????(Session timeout was 30 Mints). If its a problem how to overcome this????
Pls give me the solutions......pls...pls
Thanks,
Sumit

The first problem is to do with dealing with database concurrency, see this blog post for a good explanation.
Two isn't really a problem, as he will simply login from his home computer and create a new session. Most web apps support multiple same user sessions. If that's not the behaviour you want, you have to do some work. Not if that is the desired behaviour.

Prob_1: Unless there is a lock-in approach to editing the data (the data is locked when you read it and untill you're done no-one can edit, in that case the other admins wouldn't have been able to edit while our guy was on his coffee-break) when the guy comes back and updates the values (assuming that all the values currently on screen will be overridden when click update on this app) there's no reason why the value you're talking about should not be 2.
Nevertheless, said so I suspect that:
my answer doesn't make any sense - I am trying to interpret your question to my best but there's good chances smt is getting lost in translation.
the interviewers wanted you to say something about the session timeout which expires during the coffee-break
Prob_2: this is a standard problem of web-apps. In asp.net there's plenty of ways of checking if a given user is already logged in leveraging global.asax. Here's a tutorial with all the answers - knock yourself out :)

Related

Asking for an approch to start building an Analysis app for top management industrial company [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I want your suggestions to start a simple software developement.
I'm an intern student and i want to build, preferably, something that can be acceced with a user authentication to a specific number of users < 5 so that each one of them can access the analysis of the data that concerns him. Preferably :
I want my users to get to the app through the browser
The users are those who will provide data to the app through an upload file button so this latter can output the whole analysis
the app should have a professional look
I'm supposed to work with these four-five peapole to determine what they want to see so i can prepare all the analysis code that corresponds to the right feeded data. genrally the data will have csv excel format.
I've start working with R shiny then I built a single shiny app for control and mangement director that contains a dahsboard with analysis/viZ elements. Then i figured out that I cannot add the feature of multiple users and neither the authotication feature. then I've start learning django but i realized that it's quite harder to do it in a month. I searched for django-plotly-library but I always hesitate to work and learn until the end.
well, now i'm open to learn anything that can solve this issue. I've been hesitating for a month to choose the right technology. I appreciate your suggestions and remarks.
Django User's Guide gives you most of the answers, mainly regarding the authentication. https://docs.djangoproject.com/en/3.2/topics/auth/
Corey Schafer does high quality videos, here on the authentication:
https://www.youtube.com/watch?v=q4jPR-M0TAQ
For the professional look : bootstrap + django-crispy-forms, it's very convenient.
To upload data: https://www.youtube.com/watch?v=vs6dXL9Wp7s&t=882s
In terms of Django it is completely possible to modify data served to each user. You can do it with the use of permissions or even with the use of front technologies such as filtering data.
"the app should have a professional look" is such a general statement I don't think there is anything to be suggested. If you want for this app to look "professional" you can try using some react templates such as react-admin.
Django has builtin auth system and it is highly configurable. But if you want that "industry standard" frontend you should write your backend in DRF and add React/Vue/Svelte etc.

How to keep track of users that belong to different companies in asp.net-mvc? [duplicate]

This question already has answers here:
ASP.NET MVC - Set custom IIdentity or IPrincipal
(9 answers)
Closed 6 years ago.
I have an application where I have created a authhenticaton login with the help of entityframework IDENTITY.
The point of this application is alot but for the relevance of this question it is that it should be used by several users that even perhaps belog to different companies. For this I assigned an OrgId in the usertable in the DB.
The thing I am trying to figure out is the best way to get this OrgId.
Every time a user logs in I get this info but I don't want to check the users info with each request or save to the db.
While searching for this i stumbled accross using a global variable like so:
ASP.NET MVC Global Variables
Which gives me an idea of how I can do this but I don't want to come to an impass weeks from now and realize that this was not the best way to go about doing this.
I'm searching for a good way of accomplishing what I am trying to do, pros, cons etc.
If you're using ASP.NET Identity, I suggest using claims to set additional information about the user.
You can set the claims once the authentication is successful.
See the following for more information:
Link 1
Link 2

Automatic quiz selfgrading websolution

I need a quiz for my students:
I have tried working with googleforms, using "super quiz" and "flubaroo". The problem with the two plugins, was that it did not send the email automatically.
Then i made a script to do that, but the problem here is the students don't have the permission (and i can't provide it). I tried to change the permission in googleform, did not work.
It should work something like this:
1. Student answer questions and submit the answer.
2. Student automatically receives a graded version and should be able to see their wrong answers.
3. Teacher receives the same version as nr 2.
Is there some kinda multiplechoice that does this? This should be easy and I assume im not the first one that want this solution.
I solved this by using google form and flubaroo.

How to deal with spam in a QA site where anon answers are allowed?

I have a Question Answer website. I had allowed anonymous users to post answers to question on the site.
Today I got 14 answers to a one question on my site, My site isn't all that famous and all. Its very new and build with Wordpress. I was shocked to see what these answers were... they were all spams.
Below is 3 out of 14 answers I had found on this question. As you can make out they are not at all related to the question which was "Difference between Encapsulation and Abstraction"
I have made the "add question" part private, meaning user needs to sign up to ask a question, for the answer part I thought I should allow anonymous answers.
I am confused about this now. Is there a way to deal with this ? I'm just hoping this question is fit for stackoverflow.com.
Please advice.
You'll want to add some form of captcha or anti-bot system to stop the bots posting random spam in the comments section.
I would recommend using a 3rd party plugin such as SI Captcha which is a widely used, well documented and easy to install & implement.
Alternatively, you could start blocking IPs, IP ranges or email addresses but you would have to keep doing this constantly whereas using a plugin like above would mean that the whole process is automated.
If you are using an outside commenting system such as Disqus, then you will need to let us know so we can find alternatives for you.

Good pattern or technique for webforms with 100s of fields [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
At my job, I have to implement web forms for loan applications with sometimes up to a hundred different input fields, and then save the application into the database for later retrieval.
The person whom I replaced created a sql table with 100s of columns where each row represents a loan application and there is a column for every field.
The problem with this is that I find myself having to type out the 100 fields a bunch of times, getting data from form, saving to database, retrieving from database, writing to output webform.
And then whenever there is a change to the application, I have to make the change in quite a few places.
So it can not only be cumbersome but error prone.
Is there a good design pattern that handles this?
See if you can come up with a better table design. 100 Cols is just too much IMO. If not you could use dynamic data. Also look for a better UI pattern or break it into more than 1 pages, looking at 100 fields to fill in could be over whelming for the users.
Code generation is the best bet. MyGeneration and CodeSmith are two very good tools.
I've had very similar projects and I used both generation tools and prefer CodeSmith.
100's of fields in a form is too many. Try to aim for max 20 per page.
If you can, try to isolate each part of this form into a separate page, and even better, into a wizard of some kind.
e.g. (example steps)
Step 1: Client Profile (name, age, SSN, etc.)
Step 2: Loan Data (Fixed, Variable, Amount, Terms, Special Deals...)
Step 3: Credit Check?, Pre-Approval?
Step 4: Variations/Calculations...
If you organize the data in structured groups, you should be able to make each portion work independently (e.g. you can input basic loan data, and get some preliminary numbers without needing to enter client data (yet).
More importantly, if the user enters a value in one of the 100 fields that causes the backend to not store (e.g. value out of range) what happens? does the user lose all the data they entered? - for usability make sure that nothing is lost when the user attempts to save/move to the next step.
Perhaps ASP.NET Dynamic Data would work for you. It is described as "a framework that enables you to quickly build a functional data-driven application"
I've worked with these loan applications before and I'll tell you straight out that your data model is broken. Are you gonna make a new row in the BigTable when a borrower comes in for a refi? What if the deal falls through but they want to try again for a different house? If you just edit the data in the row for that application then you're losing valuable metrics on your % of closed deals.
First, fix your data model. Then, embrace LINQ if at all possible.
With respect to the UI, I'd either do it as a wizard (which is pretty close to how these apps are filled out) or build it as one big form that the user scrolls through and adds stuff to (use AJAX in each section so that the user can save as they go along).
You also need to consider off the shelf solutions for this stuff. Don't reinvent the wheel here; these loan apps don't change often enough to throw a full time developer at them.
Edit: Sorry I was assuming that this was for residential mortgages. I don't know if that's true, but I still think your data model is broken. If you have the ability to change it you should.
Design pattern? But of course: The Adaptive Object-Model.
One thing that you can do is programmatically take the column names and put them on a file in the format you need. That will be to solve your immediate pain. Below is a piece of c# code that will get the column name from a oledbreader object.
internal List<string> GetFieldList(string sTableName)
{
tableName = sTableName;
BuildQuery("*");
command = SetupConnection();
List<string> FieldList = new List<string>();
OleDbDataReader reader = command.ExecuteReader();
for (int i = 0; i < reader.FieldCount; i++)
FieldList.Add(reader.GetName(i).ToString());
return FieldList;
}
To solve the situation in the long run, you probably want to do store procedures or functions with the fields as parameteres. you still have to put the values in each of the parameters, but is going to easy the management of each
he problem with this is that I find myself having to type out the 100 fields a bunch of times, getting data from form, saving to database, retrieving from database, writing to output webform.
hope it helps!!!
Ouch.
Is LINQ available to you? What version of .NET are we talking about here?
BTW, if it isn't obvious already, from a GUI perspective I suggest you hide most of these fields from the end user and reveal them in sections as the user progresses, which has the advantage that you can avoid showing what doesn't need to be and validate as you go.
And with some sort of progress indicator so they know there's an end in site (ha ha).
I've had issues like this before, and know there may be valid reasons for having so many columns. It's rare, but it can happen.
What you might want to do, is create a partial class in it's own file which contains all the data field code. This might be fields, properties, and possibly method parameters, and/or just your CRUD functionality. And generate that partial class, this will help ease your future maintanence.
Good Luck.

Resources