|
Well you should flippen well ask that! And why vote me down when I gave you the correct answer for your original question?
The answer is you cant do that. (You can probably but that will require a lot of work, and I have not gone down that route).
|
|
|
|
|
Well sorry for voting you down but your answer wasn't verry complete and I thought the word Dynamicly made it pretty clear I wasn't looking for a static solution.
But we might disagree on that one.
Although I found a project in wich it is done (link[^]), this was way to complex for me so I'm using a workaround now.
Anyway thanks for your reply. and sorry again for the "down voting".
|
|
|
|
|
KBou wrote: Although I found a project in wich it is done (link[^]), this was way to complex for me so I'm using a workaround now.
That's what I thought
KBou wrote: I thought the word Dynamicly made it pretty clear I wasn't looking for a static solution.
Dynamic can mean a lot
KBou wrote: Anyway thanks for your reply. and sorry again for the "down voting".
No problem
|
|
|
|
|
hi every buddy,
I'm working in an ASP .NET project and in that I need to generate a unique key which is to be used instead of the primary key in the database of 6 digits and it should be random in nature yet it should be unique ofcourse. Actually the client doesnt want to issue numbers such as 000001, 000002... he wants it to be like 872731. The problem in my mind is that how are we gonna generate these unique but random numbers, coz whats bugging me is: WE would have to check for the keys already taken and 1) its v inefficient and 2) it could have problems with concurrency.
So I really need to guidelines from you people, I would definately appreciate this. Thank you.
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Why do people insist on this anti-pattern?
You will likely need to persist all the id's in a table, then just create random number, check for uniqueness on table, repeat if necessary, add newly created number. For concurrency, you will probably need to lock the table or something.
|
|
|
|
|
leppie wrote: Why do people insist on this anti-pattern? [Frown]
hmm didnt get that one! honestly.
now comming to the point. I really dont think locking a table would be a great idea from an ASP .NET app. I may be wrong. Do u think I can generate the random numbers from TSQL?
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
|
yea well I had that in mind too but how will I convert that to a six digit number?
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
Ohh sorry. I haven't noticed the 6 digit requirement. You need follow what leppie said then. It will tough to make it reliable.
|
|
|
|
|
no its ok, but I'm still perplexed about locking the table from this asp .net app. I think it has the potential of bring the whole application to its knees!.
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
It will only lock the table while generating the number, that should take 10ms, so that should work unless you need to do this 100 times a seconds. And in that case 6 digits wont cover uniqueness, you will run out in 10 minutes. That's why it is an anti-pattern (just wrong from the start).
|
|
|
|
|
ok so that explains it!,
thanks
just one more question: hope u can answer that. How can we lock the table from ASP .NET, I've been searching over that as well. Any tips?
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
The problem of generating non-repeating 6-digit numbers that appear random can be solved with cyclic groups:
Start with any 6-digit number. This is your first key. Pick a random prime number (any will work, but a 6-digit prime between 300000 and 700000 would be best).
Every time you add the prime number to the key (and truncate to six digits), you get the next key. The beauty of this approach is that you'll go through EVERY 6-digit number before it repeats.
|
|
|
|
|
Asp.Net with C# (2.0)
i am just novice user to this Gateway service,
i wants to make enable my user at my site to by items and pay through Visa or master card....
What should be the my first step ?
can you please help me .....
Thanks in advance...
Niraj
|
|
|
|
|
There is an article for a specific gateway on CodeProject, else I have seen an advert sometimes on the bottom of this site for one.
|
|
|
|
|
Find a gateway and set up an account with that bank. Or look into Paypal. IF you use Authorize, I have an article on the site that simplifies using it.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
I need to read a file from the bottom is it possible in c language ?
The exact requirement is
suppose having a file like
========================================
hi
how are you
exit 1
then
you
exit 1
and i can
make this
exit 0
===========================================
I need to read the file from bottom to search the last exit 1
and print the lines above it
the output will be
then
you
Can anybody help me ??
vineesh
|
|
|
|
|
Hello Vineesh,
Trh using the given code snippet. You need to import the namespace System.IO.
using System.IO;
BEGIN CODE
<br />
StreamReader sr = new StreamReader("C:\\Test.txt");<br />
String str;<br />
<br />
str = sr.ReadToEnd();<br />
<br />
int index= str.LastIndexOf("exit 1");<br />
<br />
TextBox1.Text=str.Substring(0,index);<br />
END CODE
I hope this will meet your requirement.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
hi,
File.ReadAllBytes returns a byte array which can be then used the way you want to play with it.
Regards.
Atif Ali Bhatti.
|
|
|
|
|
Thanks .. It works
vineesh
|
|
|
|
|
i have problems like this. i cannot close forms in tabpage when i clear tabpage. i found this code but it doesnt work absaloutly. that code close only forms in fisrt tabpage but not in others tabpages(for exmp. tabpage2, tabpage3, etc.)
code is that:
List<Form> forms = new List<Form>();
foreach (Form f in Application.OpenForms)
if (f.Handle != Form1.ActiveForm.Handle)
forms.Add(f);
foreach (Form f in forms)
f.Close();
|
|
|
|
|
You want to close forms that are embedded inside tabs ? Isn't that counterintuitive ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
to close all forms that embedded in tabpage more. how can i do?
i can close only one form but i want all form close which opened.
|
|
|
|
|
to close all forms that embedded in tabpage more. how can i do?
i can close only one form but i want all form close which opened.
|
|
|
|
|
I'm trying to develop a forumn page like code project's. The client-side expand and collapse function is what is attractive to me. I've noticed the main property that makes the client-side code work is that all hyperlink ID's are set to the name: id=DynMessLink.
The problem is that asp hyperlink IDs cannot be the same name but I need the databinding functionality for setting the text property.
Any ideas?
"Make it as simple as possible, but no simpler" Issac Newton
|
|
|
|