|
ambedkar wrote: how to create a dll file.
Create a Class Library project
ambedkar wrote: where, and how it is used?
A DLL is, in .NET, a type of assembly that is usually a Class Library. Code behind for ASP.NET applications compile to DLL files.
It is used to hold libraries of code. For example, The business logic of an application may be put in a DLL in order to separate it from the user interface. A set of custom controls may be put in a DLL. Test fixtures are normally placed in a separate DLL from the set of classes that they test.
Basically, any code that is invoked from somewhere else.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Is anyone has an idea how do I generate 6 digits unique number for the same day. (Based on time ?!) The number should be milliseconds difference.
10x
TD
|
|
|
|
|
Ronent wrote: how do I generate 6 digits unique number for the same day
same day as what? To what is the day in comparison?
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
A quick check of the number of milliseconds in a day gives 86400000
TimeSpan ts = new TimeSpan(1,0,0,0,0);<br />
Console.WriteLine(ts.TotalMilliseconds);
So, first point you are not going to be able to generate a unique 6 digit number, that is millisecond different, based on the current millisecond in a given day.
Lets see how accurate it could be....
Max 6 digit number = 999999
Milliseconds in a day = 86400000
Spread = 86400000 / 999999 = 86.4ms (approx)
So every 86.4ms (thats 0.086 seconds) a new number would be generated, every call to generate a number within that timespan would create the same number.
Now, your choices
1) If your app will never make a call to generate this number as frequently as every 100ms, you are free to use the above solution. Just get the current number of miiliseconds since midnight, divide by (approx - do the math) 86.4, round to the nearest integer and you will have a 6 digit whole number.
2) If you DO actually need this accurate within 1ms (which i doubt) you can use a bigger number (Milliseconds is usually depicted as an int).
|
|
|
|
|
10x a lot
I guess that's very close to what I need
|
|
|
|
|
J4amieC hi,
I used your idea and by using Hexadecimal format,
I succeed to reduce it to 8 milisecond.
decimal i = (decimal)(new TimeSpan(1,0,0,0,0).TotalMilliseconds / 9999999);
DateTime d = DateTime.Now;
TimeSpan timeSpan = d.Subtract(new DateTime(d.Year, d.Month, d.Day));
double ml = timeSpan.TotalMilliseconds;
int ii = (int)((decimal)ml / i);
Console.WriteLine("ii=" + ii.ToString("X"));
10x
TD
|
|
|
|
|
You've done your math backwards. with 86.4M values generated/day and a need for only 1M values needed/day, you've got ~86 potential values for each needed one. .net timers aren't accurate to single ms values though, I saw (but don't recall where) a comparison chart of timing methods, which ranged from ~10-50ms precision.
|
|
|
|
|
The simple way to work this is to store the last number given and 'lie' a bit if the requests for numbers come too frequently:
x = timeInMS/100;
if( x== last )
++x;
last = x;
This gaurantees uniqueness but will occasionally give the wrong time in circumstances that cannot be avoided
Note that if the ++x is common then want you want is impossible anyway.
P.S. I haven't used hex encoding in this but why stop at base16? Use base64 and get greater precision
|
|
|
|
|
As in subject.
Thanks in advance.
Regards,
Nish
|
|
|
|
|
Yes, if the VC# compiler is to be believed. This code compiles fine on my machine
[assembly:CLSCompliant(true)]
namespace ConsoleApplication1
{
[CLSCompliantAttribute(true)]
public class Program
{
public void Method(params object[] x)
{
}
static void Main(string[] args) { }
}
}
[EDIT]
Brad Abrams[^] has this to say when discussing params ,
"Do not use the VarArgs calling convention, otherwise known as the ellipsis (…), exclusively because the Common Language Specification does not support it[3]."
So yes, params is CLS compliant. Interestingly, the params keyword simply seems to make the C# compiler wrap the arguments in an object array and pass it to the callee. In fact, the params thing just seems to generate an attribute for that parameter in IL, probably for use in reflection.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
-- modified at 7:44 Tuesday 6th December, 2005
|
|
|
|
|
Thanks Senthil.
S. Senthil Kumar wrote: Interestingly, the params keyword simply seems to make the C# compiler wrap the arguments in an object array and pass it to the callee. In fact, the params thing just seems to generate an attribute for that parameter in IL, probably for use in reflection.
Yep, that's what prompted my question. It's not directly supported in IL, and is implemented using a custom attribute on the parameter. And the calling code is always converted to using an array.
|
|
|
|
|
Hi to everybody.
My problem is simple how to make some label to be refresh every second?
bye best regards
|
|
|
|
|
papa1980 wrote: My problem is simple how to make some label to be refresh every second?
If this is a win forms application then you can drop a timer on to the form and create an event handler for its, if I remember, Tick event. In your tick event handler you can update the label.
If this is for a web application you would need some javascript to do this.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
|
but how to call to this timer???
|
|
|
|
|
|
I find it and make it but i don't know why when i refresh my screen is view some black line it is not look well how i can repair it???
|
|
|
|
|
papa1980 wrote: I find it and make it but i don't know why when i refresh my screen is view some black line it is not look well how i can repair it???
Thats a new one on me. I've never heard of that happening. Remember that the timer component is a non-visual component, so it won't show up on your form. Instead it will show up on your form designer in a separate area underneath the form - this will not affect how the form is displayed.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
No i mean that when i refresh some control in case label is happen some like vibrating i can't explain it exacly but when is refesh the screen you see some black line.May be the problem is that i give invaliddata() and i don't give some rectangle area????
|
|
|
|
|
1. Open new C# Windows project
2. Click Windows Forms palette
3. Drag and Drop Timer on your form
4. Drag and Drop Label on your form
5. Double click in Timer and write this code:
timer1.Enabled = true;
this.label1.Text = Convert.ToString(DateTime.Now);
|
|
|
|
|
can i pls get code for login page in c#
|
|
|
|
|
First add following to the declaration:
private Form2 LoginForm;
and set "IsMdiContainer" property of parent form to true
Now in page load of parent form:
this.LoginForm = new Form2();
LoginForm.MdiParent = this;
LoginForm.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade);
LoginForm.Show();
Then U can add ur logic to the Login button on the Login Form:
string Username = txtUserName.Text;
string Password = txtPassword.Text;
authenticateCustomer(Username,Password);
this.Close();
Regards,
Sandeep
+919891027854
|
|
|
|
|
What?!
The OP didn't supply nearly enough information to give an answer.
* He said login "page" - That implies that it is a web application.
* If it is a winforms application how do you know he is using (or wants) and MDI interface?
When a client gives you a vague specification like that do you go away and code for weeks to come back and have them say: No, that's not what I wanted at all.
Listen and understand - if not enough information is forthcoming then ask questions rather than blunder in. If you think you know what they mean then state the assumptions you've made: It isn't clear from what you wrote but I assume you meant X, Y and Z. If those are correct then this might be of use. If not then maybe you could fill in the details....
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
If that would have been ASP.NET problem, then he would have posted on ASP.NET forum. I think it is not an ASP.NET forum. That is why I had given answer in such way...........
If I had done any mistake.........
for that i feel sorry.......
Thanks,
Sandeep
+919891027854
|
|
|
|
|
MudkiSekhon wrote: If that would have been ASP.NET problem, then he would have posted on ASP.NET forum.
He "should" have posted in the ASP.NET forum, yes. But the forums overlap, often people post database questions here (that should go in the ADO.NET forum - but since they are programming in C# they don't see that, they think that C# == ADO.NET not realising one is a language and the other is a framework used by many languages), or ASP.NET questions for the same reasons. Also, many people post database questions in the ASP.NET forum because their thought is that they are developing a web application (rather than a data driven application).
Where these boundaries are fuzzy it is important to ask questions to clarify what a person actually means. Each person makes different assumptions on apparently the same data.
MudkiSekhon wrote: If I had done any mistake
No mistake, just you made a set of assumptions that may or may not be correct. A former collegue of mine used to say, almost daily, "assumption is the mother of all f*** ups". So, it is important to realise when you are making an assumption so that you can either ask a question to clarify it, or explain what your assuption is. That way there is no overall misunderstanding.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|