Re: [ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread Bob Lynch
This function will only throw an exception if some other thread besides the current thread currently owns the lock. The owning thread can re-acquire the lock as often as it wishes (but needs to match acquisition with Exit() calls). I don't think that's what you intended, is it? Regards, Bob

Re: [ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-02 Thread Shawn A. Van Ness
Thanks Mattias -- you make a pretty strong case for option C, but I'm just not sure I'll feel 100% comfortable until somebody actually calls RegOpenKey on an IA64 machine, for me. ;) -S On Wed, 2 Apr 2003 20:59:56 +0200, Mattias =?iso-8859-1?Q?Sj=F6gren?= <[EMAIL PROTECTED]> wrote: >Shawn, >

Re: [ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-02 Thread Shawn A. Van Ness
>I would think that b (0x8001) would be the correct answer >because it seems that the High bit is set, not the 32nd bit, which is There is a certain logical elegance to that argument -- but I hope that's not it, because it would be a royal pita to construct properly in C#. >Another q

Re: [ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread Steve Johnson
> static void AssertIsLocked(object o) { > if (Monitor.TryEnter(o)) > throw new ProgrammerNegligentException(); > } The problem with this is that TryEnter will succeed regardless whether the thread currently owns the lock on o. It will only fail if *another* thread owns th

Re: [ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread Kamen Lilov
OUCH! That hurt :) I thing I'll have to take back my words that "I checked everywhere..." Thanks very much for the help! Kamen -Original Message- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson Sent: 02 Април 2003 г. 19:46 To: [E

Re: [ADVANCED-DOTNET] Base64 Encoding for Xml Documents

2003-04-02 Thread Scott Boston
Will Convert.ToBase64String(byte[]) do what you need? -- Scott -Original Message- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of jeff Hughes Sent: Tuesday, April 01, 2003 7:33 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Base64 Encoding f

Re: [ADVANCED-DOTNET] Connection Pool Timeout

2003-04-02 Thread Kamen Lilov
No. SqlConnection.Dispose() does NOT close the connection, just releases it back to the pool. Calling Close() when pooling is enabled also does not close the connection. The opposite has been stated publicly a few times by various (otherwise highly qualified) developers. Since it was contrary t

Re: [ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-02 Thread Mattias Sjögren
Shawn, WinReg.h defines HKEY_CURRENT_USER as (( HKEY ) (ULONG_PTR)((LONG)0x8001) ) And with _W64 defined, that expands to ((void*)(unsigned __int64)((long)0x8001)) Which of the following do we think this magic value might look like on IA64? a. 0x8001 b. 0x800

Re: [ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread John St. Clair
static void AssertIsLocked(object o) { if (Monitor.TryEnter(o)) throw new ProgrammerNegligentException(); } Compiles in Outlook... John John St. Clair Prosjekt- og teamleder Reaktor AS -Original Message- From: Moderated discussion of advanced .NET topics. [mailt

Re: [ADVANCED-DOTNET] Connection Pool Timeout

2003-04-02 Thread Beauchemin, Bob
Both Close and Dispose give the connection back to the pool. The only difference between them in the SqlClient provider is that Dispose also sets the connection string to null. Bob Beauchemin http://staff.develop.com/bobb -Original Message- From: Matthew [mailto:[EMAIL PROTECTED] Sent: T

Re: [ADVANCED-DOTNET] Base64 Encoding for Xml Documents

2003-04-02 Thread Craig Andera
If you define a web service param as byte[], it should be serialized as base64. If you want to do it by hand, you can use a string parameter and do Convert.ToBase64String() and Convert.FromBase64String(). Does that help? > -Original Message- > From: jeff Hughes [mailto:[EMAIL PROTECTED]

Re: [ADVANCED-DOTNET] Restricting a proxied type when its concrete type is available

2003-04-02 Thread Jim Sievert
Rick, I have a sample at [1] that does what you're looking to do. It uses proxies to tweak the ObjRef. I also have another sample [2] that does it by overriding CreateObjRef in MBRO. AFAIK, tweaking the TypeInfo in the ObjRef is the way to accomplish what you're after. I've never experienced t

Re: [ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread Steve Johnson
Use Monitor.Pulse(obj) If the current thread does not have obj locked, you'll get a SynchronizationLockException, which you can throw directly or translate into ProgrammerNegligentException. ;) > To avoid code bloat and performance hits, I want to avoid using the lock > statement in SomePrivat

Re: [ADVANCED-DOTNET] Base64 Encoding for Xml Documents

2003-04-02 Thread Marsh, Drew
jeff Hughes [mailto:[EMAIL PROTECTED] wrote: > How do I encode a binary object to base64 so I can pass it to > an XML document. Check out Convert.ToBase64String. It takes an array of bytes and, surprise, converts it to a base64 string. On the flip side, there's FromBase64String to convert back to

Re: [ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-02 Thread Akshay Arora
I would think that b (0x8001) would be the correct answer because it seems that the High bit is set, not the 32nd bit, which is why i think that in ia64, the high bit again will be set, not the 32 bit. I see no reason for backwards compatibility in that sense. Unless of course MS decide

Re: [ADVANCED-DOTNET] Connection Pool Timeout

2003-04-02 Thread Matthew
>> I recommend the following programming pattern when doing data >> access: SqlConnection conn = new SqlConnection(blah blah); try { >>// do whatever kind of data access you need here... >> } >> finally { >>conn.Dispose(); >> } I was under the impression that calling SqlConnection.Dispose(

[ADVANCED-DOTNET] Restricting a proxied type when its concrete type is available

2003-04-02 Thread Rick Byers
Hi, When GetType is called on a TransparentProxy, the CLR attempts to get the real type of the object being proxied by calling RemotingServices.GetType(TransparentProxy), loading assemblies as necessary. In a normal remoting scenario where the implementation assembly is unavailable, this will fail

[ADVANCED-DOTNET] Remoting client behind http proxy server doesn't work

2003-04-02 Thread Saurin Vasani
I'm trying to access a .NET remoting web server from a client that needs to go through an authenticating proxy server to access the internet. In doing so, I get - error: (407) Proxy Authentication Required. In going through the mailing lists, I found that version 1.0 of the Framework does not suppo

Re: [ADVANCED-DOTNET] is .net remoting reliable technology? it ca n hang up.

2003-04-02 Thread Sudhakar
What channel did you use? HTTP or TCP? Thanks, Sudhakar

[ADVANCED-DOTNET] .NET Remoting & COM InterOp

2003-04-02 Thread Ravi Pazhani
We have a requirement to access remoted objects from a COM client (asp application). We would like to use remoting framework over web services for various reasons. We did a sample implementation by using soapsuds to create the client side proxy class and annotated this class with interop attribute

Re: [ADVANCED-DOTNET] Remoting: Can we use both SOAP & Binary

2003-04-02 Thread Rick Byers
Hi, According to Ingo Rammer ("Advanced .Net remoting" page 106), the server side HttpChannel automatically uses both soap and binary formatters and detects which encoding has been chosen at the client side. I've never tried this myself, but it should just work :) Rick -Original Message

Re: [ADVANCED-DOTNET] .NET remoting security blues

2003-04-02 Thread Vladimir Tchalkov
Hi, I had the same problems about a year ago. I was developing a .NET Remoting project where over 200 computers were communicating with a server. When I had to choose the technology very quickly I discovered that I can make over 100 call per second if I am not using authentication, but only about

[ADVANCED-DOTNET] Solved: VS.NET: Adding controls to the Toolbox, programmatically

2003-04-02 Thread Shawn A. Van Ness
http://dotnetweblogs.com/SAVanNess/posts/4019.aspx It seems there's a bizarre bug, where you have to display the Properties window, before .NET usercontrols will "stick" to the toolbox. I suspect the true cause of the bug runs much deeper...? -S

[ADVANCED-DOTNET] Base64 Encoding for Xml Documents

2003-04-02 Thread jeff Hughes
I have been trying to figure out how to transport binary data through Xml to a web service that will upload this binary data to a sql server database. I am able to do this if I connect directly to the database from my web app and use executeNonQuery to send the binary data. What I am looking for i

Re: [ADVANCED-DOTNET] Setting keyboard hooks in C#

2003-04-02 Thread Michael Kaye
> ...We are writing epos software for tills, so we want to prevent > people from starting other packages. Further to my original question, is there a better/simpler way to do what we are trying to do? Or is there a method which is closer to the .NET way of doing things? Thanks. Michael ___

Re: [ADVANCED-DOTNET] 403 Forbidden for IIS Hosted Remote Object

2003-04-02 Thread Andy Knowles
I've managed to manually fix the problem by specifying the machineName property for the http channel in the config file. Still, I'm not really happy with having to do it manually (or even doing it programatically) - is there anyway to get remoting or IIS to simply use the same IP or address as the

Re: [ADVANCED-DOTNET] 403 Forbidden for IIS Hosted Remote Object

2003-04-02 Thread Andy Knowles
Ok, I finally managed to narrow this one down a bit. Retrieving a reference to a well-known object hosted by IIS and calling methods on it works fine. But as soon as it returns an object stuff starts to go wrong. Using Ingo Rammer's hint at http://www.ingorammer.com/RemotingFAQ/GETMARSHALBYREFOB

Re: [ADVANCED-DOTNET] Exception serialization Bug(?)

2003-04-02 Thread Robert J. van der Boon
On Thu, 27 Mar 2003 17:11:33 -0500, Sudhakar <[EMAIL PROTECTED]> wrote: >Can you please pass on the stack when the exception happens? >Thanks, Sudhakar Sudhakar, please have a look at http://home.hetnet.nl/~seeleboon/dotnet/ExceptionSerializationBug.html for all information I have got on this subj

[ADVANCED-DOTNET] Mensa workout: constructing magic-value IntPtr arguments for p/invoke on IA64

2003-04-02 Thread Shawn A. Van Ness
I'm p/invoking some registry functions, to get at some features not provided by Microsoft.Win32.RegistryKey (like change-notification). I'd like to learn how to properly construct the value of say, HKEY_CURRENT_USER, so that my code will someday work correctly on both 32- and 64-bit systems. Wi

[ADVANCED-DOTNET] re Re: Connection Pool Timeout

2003-04-02 Thread SteveC
Ranjan, if you completely separate your data access layer, you could wrap your business access layer in a while loop. If you get one kind of error (eg a blocking or other kind of "busy" error), the while loop continues, and if you get something unexpected you will break out of the loop and you can

[ADVANCED-DOTNET] Open Connection - When and how ?

2003-04-02 Thread Thái Trí Hùng
Hi , Thank for reply of Ayyappan Nair and Mark , it's very helpful ! ;> And further,Ayyappan Nair ,I see my question in your code , could you explain to me when could I open a connection . Can I open only one connection before start my main form (I really want to do that !) and close it when my

Re: [ADVANCED-DOTNET] Setting keyboard hooks in C#

2003-04-02 Thread Mattias Sjögren
Michael, This does the job, but after a varying number of keypresses - generally over 90 and less than 200 - we get a null reference exception. Most likely beacuse the callback delegate has been garbage collected. You must hold a reference to it to keep it alive as long as the hook is active. S

[ADVANCED-DOTNET] Lock ownership

2003-04-02 Thread Kamen Lilov
I am trying to do something pretty simple and can't find a way to do it. Lets say I have objects that may be accessed from multiple threads. I synchronize access to them using the C# lock statement, equvalent to calling System.Threading.Monitor.Enter / Exit: public void SomeHighLevelMethod() {

Re: [ADVANCED-DOTNET] .NET remoting security blues

2003-04-02 Thread Kamen Lilov
Seref, I am one of the guys in the "I'm not the only one suffering..." group :)) There are two main reasons for the speed decrease: the overhead of the authentication itself (which we can really do nothing about), and the very stu... OK, inefficient manner in which IIS authenticates requests. En