This doesn't just automagically happen. Without saving each visit to a database, there's no way you'll be able to display it.
Here's another tidbit - the only person that cares about usage metrics are admins. Every-day users don't give a rat's ass about anything that doesn't directly affect their access to the web site.
So, this feature is for a very restricted/small set of users. If you're sure you really want to do this, plan ahead, and finger out and implement the mechanisms involved BEFORE coding the rest of the web site. I would recommend that you use the session ID so that you don't artificially add "connections" from the same user's session.
I had to do something similar recently, but for a single database that supports about 20 applications.
Lastly, you should have posted this in the Web developemnt forum instead of this one. It's too late now, but remember for the next question you'll inevitably have, to post it in the most appropriate forum.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I need to replace every 'a' char with 'b' char, every 'b' char with 'c' char and so on. I've tried to make this with if but code is very very long for every char. Exists a method how mo make this without if or switch or something like that?
You can use the collating sequence of alphabetic and numeric characters to test whether they are in a certain range, and also to increment them to the next character, as follows:
string inputString = "The quick brown fox jumps over the lazy dog";
char chars = newchar[inputString.Length];
for (int i = 0; i < inputString.Length; i++)
if (inputString[i] >= 'a' && inputString[i] <'h') // is it between a and g (lower case only)
chars[i] = (char)(inputString[i] + 1); // yes, add 1 to make it the next letterelse
chars[i] = inputString[i]; // no, copy direct to the output buffer
Yes, is homework, when i write the question i didn't know that for numbers is different than letters, then i tried and i realised that i don't know how to make this. If you are interested full task is that:
Make a crypt algorithm that replace all letters and number like that:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Z A B C D E F G H I J K L M N O P Q R S T U V W X Y
a b c d e f g h i j k l m n o p q r s t u v w x y z
b c d e f g h i j k l m n o p q r s t u v w x y z a
While this is fine as "proof of concept," I'd ask you to imagine a programming job interview where you submitted your code, or this:
public string Encode(string source)
StringBuilder sb = new StringBuilder();
int offset = '9' + '0';
foreach (char ch in source)
sb.Append((char) (offset - ch));
if (ch == 'Z')
sb.Append((char) (ch - 1));
if (ch == 'z')
sb.Append((char) (ch + 1));
Which version do you think more likely to get you a job ? Which version do you think you could more easily change if the encoding requirements changed ? Which version do you think another programmer could more easily understand ?
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
this is the first time when i use linq expresions and i like more than second version, i think that are more intuitive. About changes, i think that is easier to change second version because all code is more spaceful, i'm sure you understand what i mean. And the answer for third question, i think that is important how another programmer start, if he start with linq it will be easier for him to understand linq and if he start using functions without linq expressions is easier to understand second versions. I like both methods and i think that is important to know many methods for solving a task