|
GUIDs are unique. Will they do?
Guid x = Guid.NewGuid();
From MSDN Library:
GUID represents a globally unique identifier.
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
|
|
|
|
|
Arjan Einbu wrote:
GUIDs are unique. Will they do?
My intent for this design is to remove any explicit token passing. I already have a session object which has to be passed accross to the remote object to identify the user. I wanted to avoid having to explicitly pass any extra variables, so I was hoping that the thread/context/appdomain might contain something I could use to uniquely identify the client.
E.g. Instead of:
public void SAO:PerformAction(token ClientIdentifier, int parameter)<br />
{<br />
CheckSecurity(ClientIdentifier);<br />
DoStuff(parameter);<br />
}
I could do:
public void SAO:PerformAction(int parameter)<br />
{<br />
CheckSecurity( GetUniqueTokenFromCallersContext() );<br />
DoStuff(parameter);<br />
}
I'm trying to make the remoting interfaces as seamless as possible and I personally hate having to have an identifier token passed to every SAO method.
Maybe I'm hoping for too much.
Dr Herbie.
Remember, half the people out there have below average IQs.
|
|
|
|
|
How can i tell what forms are currently open and how do i close a specific form?
My main form is an MDI parent with a toolbar. One button opens a form and when i click another button, i want to close the one that's open, but i'm having a hard time finding out what is open and how to close it.
Thanks for your help.
.gonad.
|
|
|
|
|
[ append from previous post ]
the only way i know how to do this is:
this.MDIChildren[0].Close();
this works for me since i only want one form open at a time, but i just want to know if there's another way to do this.
Thanks!
.gonad.
|
|
|
|
|
Form has a ActiveMDIChild property, this is the currently active child form.
You can use this property to close the topmost (active) child form.
Suhas
|
|
|
|
|
Hi,
I need to scroll on print preview control using key board ( the application does not have any mouse attached to it) but unfortunately there is no method avaialble to do that, worse the print preview control has a scroll bar which is not exposed in any manner.
Any help in this will be highly appreciated.
regards
|
|
|
|
|
Hi,
We have developed a POP3 client in C# . When we start this client on our local computer it is supposed to retrieve the email messages from a remote POP3 server automatically, and put these email messages(and any attachments) in the corresponding folders on our local machine. After retrieving the messages it deletes the downloaded messages from the remote server and then the POP3 client quits.
This POP3 client is (thread based) constantly running and attempts to reconnect to the server every 30 secs to automatically download the new emails that have arrived on the server. The problem is we are having is that the POP3 client is repeatedly having authentication problems. Somtimes it connects succesfully and sometimes it does not. Below is a log file that shows the log information generated by the POP3 client in 2 iterations. First it connects fine and retrieves an email successfully, and then it QUITS. After 30 secs it re-attempts to connect to check for more emails but as you can then see it then gives the error -ERR . We dont understand why this is happening since the same password was successful in the first attempt.
Thanks for any Help
================================FIRST ITERATION===================================
18 October 2003
Connecting to server...
Connected successfully...
Creating input / output streams
Stream created successfully..
+OK
Sending Command: USER enquiries@hotpop.com
Recieving Data...
Data Found: +OK
Sending Command: PASS abhcyshk
Recieving Data...
Data Found: +OK
Sending Command: STAT
Recieving Data...
Data Found: +OK 2 2119
Sending Command: RETR 1
Recieving Data...
Data Found: +OK 1065 octets
------------------------------To: enquiries@hotpop.com
------------------------------From: shooshoo@hotmail.com
------------------------------Subject: test 2 from cwazy
------------------------------ContentType: text/plain;charset=iso
Sending Command: DELE 1
Recieving Data...
Data Found: +OK
Sending Command: QUIT
==============================SECOND ITERATION =====================================
18 October 2003
Connecting to server...
Connected successfully...
Creating input / output streams
Stream created successfully..
+OK
Sending Command: USER enquiries@hotpop.com
Recieving Data...
Data Found: +OK
Sending Command: PASS abhcyshk
Recieving Data...
Data Found: -ERR
Sending Command: QUIT
Recieving Data...
Data Found:
================================================================================
hmmm?
|
|
|
|
|
Can you adjust stuff so that you get back the full text of the -ERR response?
I often see this kind of problem as a temporary issue at my ISP, and the error is normally not that my password is incorrect, but that they have a lock outstanding (receiving mail) or a temporary storage problem.
Steve S
|
|
|
|
|
have you tried longer pauses during two connections.
does the problem still occur when you set the wait-time to lets say two minutes ?
andi
|
|
|
|
|
I have been working on this for 3 hours straight. So far i've tried everything I could find on the net. This includes:
<br />
for(int i = 0; i < 40; ++i)<br />
{<br />
richTxt.AppendText("Some Text\r\n");<br />
}<br />
<br />
richTxt.SelectionStart = richTxt.TextLength;<br />
richTxt.Focus();<br />
richTxt.ScrollToCaret();<br />
And putting the above code (minus the loop) in an event handler for TextChanged. If someone could please help me with this I would be eternally greatful.
|
|
|
|
|
Hmmm.. I believe you have to set HideSelection to false. Then it should work fine.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Ah, apparently if I do this:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
and then override OnPaint , it should look something like this:
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaintBackground(pe);
base.OnPaint(pe);
...
}
The base.OnPaintBackground(pe) being key to a derived class (say, from a Panel) having its background updated properly. I wasn't aware of this before, and it explains some past frustrations with the WinForms.
Any feedback and better suggestions welcome.
|
|
|
|
|
Or just make UserPaint false, then u draw over the background The is also a PaintBackground option AFAIK.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hmm, I can't find the PaintBackground option. But anyway, I have UserPaint set to true because I want to use DoubleBuffer. It's not exactly clear to me what each other style (e.g. UserPaint, AllPaintingInWmPaint) enables when DoubleBuffer is on. Or, it's not exactly clear to me what I'd lose/gain by making UserPaint false when I have DoubleBuffer on.
|
|
|
|
|
Here you go, its called:
Opaque
If true, the control is drawn opaque and the background is not painted.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I'm working with the windows forms DataGrid and running into some problems. The DataGrid is bound to a DataView derived from a Dataset, filled by a SqlDataAdapter. I encounter two problems when I call SqlDataAdapter.Fill(dataSet, "Table"):
1) The DataGrid re-sorts based on the first column.
2) If the user had resized any rows, those rows are set back to the default size.
Basically, I don't want the appearance of the grid to change when I call Fill(). Is this possible, or do I need to manually manipulate the a dataset.
-- James --
|
|
|
|
|
Mmmm....
I have the same problem, but I haven't faced it yet ( now I'm still fixing bugs)... some ideas...
You can set the sorting column in the DataView( so it's supossed that the DataGrid has nothing to do then).
Before calling Fill, you can store in some temporary array or struct ( Memory DataTable with Display/Value columns would be fine , or maybe you can save it like a TableStyle )the pair values of Column Name / Column Width, and restore it after calling Fill...
to avoid ugly things or flickers, it must be possible to say the DataGrid, Hey ! don't draw now... and when all is done... Now you can refresh, but not sure how.
Good luck !
Braulio
|
|
|
|
|
Hi,
Could someone help me with a C# wrapper for a C++ DLL. I have the following function in C++ which needs to be wrapped.
VARIANT _stdcall retVariantArray(void) {
COleSafeArray saRet;
DWORD numElements[] = {10, 10}; // 10x10
// Create the safe-array...
saRet.Create(VT_R8, 2, numElements);
// Initialize it with values...
long index[2];
for(index[0]=0; index[0]<10; index[0]++) {
for(index[1]=0; index[1]<10; index[1]++) {
double val = index[0] + index[1]*10;
saRet.PutElement(index, &val);
}
}
// Return the safe-array encapsulated in a VARIANT...
return saRet.Detach();
}
|
|
|
|
|
Hi,
I want to have a permanent line on a form but the strange thing is that the live vanishes when another window comes over that area.
How can I create a permanent Line on a form ?
Thanks,
Paul
|
|
|
|
|
Try drawing the line in the public void OnPaint(object sender, EventArgs e) event...
|
|
|
|
|
Hi,
I created a typed dataset, but the whole idea is that i want to return the XML information from it. I am using the getXML. This part works fine. What is not working is that there are times when not all the columns would be assigned, and if it is not assigned, it is not returning those tags. Is there a way to declare a default value when a new row is crated in a typed dataset. Thanks,
|
|
|
|
|
I have serialized an object from a project(lets name it x). When i deserialize it from the same project,i am able to recover my object.However, when i try to deserilize that object when i am working in another project, i get an exception " Assembly or file X missing " ?? Could someone tell me why??
Thanks.
|
|
|
|
|
when you serialize an object some information about the object is also saved. This includes the assembly to which the class belongs, the version, culture, the namespace etc. This information is required to recreate the class.
In your case the serializing is done in one assembly & deserializing in another assembly. The type information doesnt match.
One work around is to keep the class you want to serialize in a common assembly. and reference this asssembly in your other projects.
HTH
Rak
|
|
|
|
|
Thanks a lot. That was helpful.
|
|
|
|
|
Does anyone know ANY way of creating a DIB section in C#? I've spent the last few days trying every possible way of creating one. Whenever I call ::CreateDIBSection from the Win32 library, it fails, saying there isn't enough memory. However, after experimentation I realised that it does actually create one, but I can never successfully set the Pixel Format for it, I'm trying to create a pixel format suitable for OpenGL drawing, but it just doesnt work.
I'm using the correct settings for the pixel format, does anyone have any ideas?
Thanks in advance,
Dave
Dave Kerr
focus_business@hotmail.com
http://www.codechamber.com
|
|
|
|