SQL Server 2008 Sessions - sql

We are extremely new to ASP.net...actually working with an outside consultant which I don't currently have access to.
I am looking for:
Good documentation/best practices for session and session management.
I'm finding some info now:
http://support.microsoft.com/kb/317604
Review of application below for comments about how to best handle this scenario.
We have the following scenario:
OEM machine on floor providing status UPDATES every x.x seconds to Device_Status table.
When ASP.net client/user wants to view status of a particular machine, I want to notify the OEM machine on the floor to increase update rate to near real-time. Potentially with "realtimeupdate" flag in Device_Status table.
When ASP.net client/user moves on or logs out, update rate needs to return to x.x seconds.
Since we are very new to ASP.net, we don't have any clue about sessions and session management or if it is possible.
The only problem I see so far is if the ASP.net client connection is terminated prior to setting the "realtimeupdate" flag to 0. If this happens, the OEM machine will continue to provide real-time updates when they are no longer needed.

you can't count on a browser (or the user) to say "hey I'm done". People walk away from thr PC, surf to stackoverflow.com, hit the X to close the browser, etc. you'll need to code your web page to request "live" frequency with every page refresh. and have some independent server process turn off the "live" frequency if you don't get a page refresh asking for "live" frequency after some set amount of time. In addition to your page turning it off if the user asks for that.

Related

Counts actual runs of same application

I have a public web application and need to know (for statistics) how many simultaneous executions occurs. An example would be the equivalent of how many visitors are on a web page or how many users are connected into DB.
I think one way to achieve this is by registering users in a DB on Internet and count the records periodically. The problem with this, if the application loses connection to the Web or the OS crash, the application not send the code to subtract the count, giving false positives.
Please if you can give me a starting point to made this code.
Regards Amigos

How can i design better a Inventory, Order sync web app

I have a web application that displays inventory, orders, tracking information from drop-shippers for orders and tracking updates. When a customer logs in, he will see all the above information in different pages.
I have a Console based application in the server that hosts 4 background workers to do each of the above tasks and updates the database. Now i have one console application for each customer. I did this because for any reason the console application fails because of one customer's data, it should not effect others.
Is there a better approach or any existing tools, api, frameworks available to support this kind of stack in Microsoft? Or what i am doing is correct and best approach? Are there any technologies that are more stable to support Subscription based membership, Offline data sync, Queue User requests and notifying user when they are completed.
I would take a look at the Azure Queues and Webjobs (Links below)
With a queue structure, you can simply decouple your application and make the application only do what is needed. Your main application can then just put relevant and needed information in the Queue and forget about it.
Next (and perhaps the most crucial part of this) you can write a simple console application that will run when a queue is present and ready. The beauty of this is that you not only can have multiple webjobs doing the same thing (I don't recommend it) but also, you only need to have and maintain one Console application. If the application crashes, it will simply restart it again (within a few seconds) and go back at it again.
Below, please find a link to the tutorial of how to make a sample Queue and Webjob:
http://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-get-started/?rnd=1

Auto Suggest for very slow internet connections

I have an auto suggestion mechanism that works fairly nice for desktop version where we have a wireless or a wired internet connection. The worst response time is 320ms.
(Without using solr as of now, I use a storage system on the server that gives back the result).
I have users that belong to the group where you can have a slow internet connection also known as a 2G connection where the downspeed can be ~10Kbps-50Kbps.
I have seen that google provides Auto Suggestion to this speed as-well, my my system cannot.
I have tried these:
Make a txt and JSON file on the server and when the user does a keydown (1st) it fires ajax to bring the entire 2.2MB data inside a JS variable on client side and show suggestions.
Make a service that is called when the user types 2 characters, service reads the txt/JSON file for those 3 character occurence anywhere in the words and gives data into a JS variable.
Repeat the above step and store the result in localStorage, for a fresh 3 characters again the same process occurs and storage happens. The benefit is that the user in future gets a prompt suggestion but according to me browser storage is used very sensibly.
Anyone with suggestions how www.google.com and www.flipkart.com handles auto suggestions for slow internet connections on mobile (smartphones).

Close the application after 10 minutes of inactivity without security enabled (offline application)

I have the requirement to close the application after 10 minutes if the user has not interacted with the application.
All the questions about this are related to the session time out, the problem here is that the application has no security and is a requirement to run it without connectivity.
Any idea about how to implement this?
Thank you.
First of all, as I mentioned in the comments above, this is a really bad user experience. You should tell your customer you just don't do something like this to your users. never.
If I understand you correctly, the application is running offline, meaning it does not connect to the Worklight Server...
So you should probably just maintain some counter... if the user does any action in the application (touch a button, whatever), reset it. If no action was done and 10 minutes have passed, called WL.App.close.
Please note that using WL.App.close in such a manner in iOS can make your application be rejected from the App Store if found.

Synchronizing of user's browser refresh

I did comprehensive Google research but I cannot find any good solution, so any help (or just showing direction of next research) would by REALLY appreciated!
What I need is simple in idea, but looks like hard to implement:
I have data (say just picture) I want to show to all (even anonymous) users of website in the very same time. This data should change regularly (say once in 5 minutes), so the browsers of all users must refresh in given time.
The woflow is simple:
User will open page with countdown (which will show of course different time for each user depends of when the user has had connected).
At the end of countdown shall all browsers of connected users refresh to see new content.
The refresh should be ideally invoked by server to prevent prematured refresh when data doesn't changed yet.
I was thinking of "refresh" meta tag, but it is problematic for SEO and it rely on user computer's clock.
It can be done by javascript, but in that moment I rely on user computer's clock.
I have hearded it is possible "push" data from server to browser using e.g. Perl, it is correct (is there somewhere some example)?
And in which scripting language would you write script which would "tick". I cannot see way in PHP I am familiar with (use cron to execute counting script every minute looks really ugly)...
Thank you!
Michal
It's not possible to push data from a web server to a web brower, given the request-response architecture of HTTP. It is, however, possible to poll the webserver using JavaScript and window.setInterval(); combined with AJAX.
If not using local system time is an issue, why not respond to periodic AJAX requests with the number of microseconds until the next reload of data should commence? I would suggest you use AJAX for all of this instead of refreshing the browser with META REFRESH, or window.location.
The server-side code could be anything really, you simply need a page that will return the number of microseconds until the next schedule refresh (And perhaps an error if no refresh is scheduled yet, telling the client JavaScript to poll again in a few seconds).