473,842 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delegates and Events confusion

I have a class (let's call it ClassA) that I've written which has events.
In another class (let's call it ClassB) I create a collection of ClassA
objects. In a third class (ClassC) I create a reference to some of the
ClassA objects created in ClassB. In ClassC I hook into the ClassA events
with a foreach loop so that I hook each object. The code is something like
this:
class ClassC {
void SomeMethod()
{
foreach (ClassA item in ClassACollectio n)
{
item.MyEvent += new EventHandler(it em_MyEvent);
}
}
}

Objects of type ClassC keep getting created and deleted, but the objects of
ClassA that it references stay in memory. Therefore, every time I load a
new instance of ClassC the event gets hooked again. What I'm seeing is that
I fire the event once but I end up getting it raised in the code that
responds to it (item_MyEvent method) for every time it was added when I only
want it to get caught once.

How can I be sure that I only add the handler to the event once for each
item? Since the code is in ClassC it's not allowed to inspect the
ClassA.MyEvent to see if something's already hooked to it.

I hope this makes sense. Creating a repro case wouldn't make sense here
because it's my application logic that's causing the problem.

Thanks.
Nov 16 '05 #1
15 2102
Are you unsubscribing the event when you remove the instances of Class C
from memory?

If you subscribe to an event and do not unsubscribe, the subscriber will be
held in memory until the event publisher (class A) is collected.

Here's why:
A delegate has a member called Target. Target is a reference to the
subscriber (Class C). When you add the event, the publisher holds a
reference to the delegate which in turn holds a reference to the subscriber,
so C is held in memory. The graph looks like this:

A ---> EventDelegate ---->C

So, the reason that you are getting multiple event fires is that you have
more instances of C in memory than you think that you do.

What you probably want to do is to keep track of all of the event
subscriptions that C makes and have C implement IDispose. When you are
ready to kill C, call its Dispose method. Inside the Dispose, unsubscribe
from all of the events that you are subscribed to.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:uV******** *****@TK2MSFTNG P09.phx.gbl...
I have a class (let's call it ClassA) that I've written which has events.
In another class (let's call it ClassB) I create a collection of ClassA
objects. In a third class (ClassC) I create a reference to some of the
ClassA objects created in ClassB. In ClassC I hook into the ClassA events
with a foreach loop so that I hook each object. The code is something like this:
class ClassC {
void SomeMethod()
{
foreach (ClassA item in ClassACollectio n)
{
item.MyEvent += new EventHandler(it em_MyEvent);
}
}
}

Objects of type ClassC keep getting created and deleted, but the objects of ClassA that it references stay in memory. Therefore, every time I load a
new instance of ClassC the event gets hooked again. What I'm seeing is that I fire the event once but I end up getting it raised in the code that
responds to it (item_MyEvent method) for every time it was added when I only want it to get caught once.

How can I be sure that I only add the handler to the event once for each
item? Since the code is in ClassC it's not allowed to inspect the
ClassA.MyEvent to see if something's already hooked to it.

I hope this makes sense. Creating a repro case wouldn't make sense here
because it's my application logic that's causing the problem.

Thanks.

Nov 16 '05 #2
Thanks. I figured that I needed to unsubscribe in some way but since I
wasn't storing an internal reference to the subscriber. I added the code
like the following and it solved the problem but I don't really understand
why:

item.MyEvent -= new EventHandler(it em_MyEvent);

This just seems really odd to me. If the += assignment adds a refernece to
a new event handler it seems that handler would be a different object than
the one created with the new operator in the -= assignment. I could see
something like this working:
EventHandler eh = new EventHandler (item_MyEvent);
item.MyEvent += eh;
....then later...
item.MyEvent -= eh;
I can see that working because it's the same object, but when I use the new
keyword twice don't I have two unique references?

- Rhy
"J.Marsch" <je****@ctcdeve loper.com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Are you unsubscribing the event when you remove the instances of Class C
from memory?

If you subscribe to an event and do not unsubscribe, the subscriber will
be
held in memory until the event publisher (class A) is collected.

Here's why:
A delegate has a member called Target. Target is a reference to the
subscriber (Class C). When you add the event, the publisher holds a
reference to the delegate which in turn holds a reference to the
subscriber,
so C is held in memory. The graph looks like this:

A ---> EventDelegate ---->C

So, the reason that you are getting multiple event fires is that you have
more instances of C in memory than you think that you do.

What you probably want to do is to keep track of all of the event
subscriptions that C makes and have C implement IDispose. When you are
ready to kill C, call its Dispose method. Inside the Dispose, unsubscribe
from all of the events that you are subscribed to.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:uV******** *****@TK2MSFTNG P09.phx.gbl...
I have a class (let's call it ClassA) that I've written which has events.
In another class (let's call it ClassB) I create a collection of ClassA
objects. In a third class (ClassC) I create a reference to some of the
ClassA objects created in ClassB. In ClassC I hook into the ClassA
events
with a foreach loop so that I hook each object. The code is something

like
this:
class ClassC {
void SomeMethod()
{
foreach (ClassA item in ClassACollectio n)
{
item.MyEvent += new EventHandler(it em_MyEvent);
}
}
}

Objects of type ClassC keep getting created and deleted, but the objects

of
ClassA that it references stay in memory. Therefore, every time I load a
new instance of ClassC the event gets hooked again. What I'm seeing is

that
I fire the event once but I end up getting it raised in the code that
responds to it (item_MyEvent method) for every time it was added when I

only
want it to get caught once.

How can I be sure that I only add the handler to the event once for each
item? Since the code is in ClassC it's not allowed to inspect the
ClassA.MyEvent to see if something's already hooked to it.

I hope this makes sense. Creating a repro case wouldn't make sense here
because it's my application logic that's causing the problem.

Thanks.


Nov 16 '05 #3
It IS confusing that you're *subtracting* a *new* object, but that IS the correct syntax. Remember that the 'new' event handler that you're subtracting is actually (in all probability) a reference to a specific instance's member function, so it's basically just saying 'this member function of this instance doesn't want to receive this event any more.' To tell the compiler that, all it needs is *ANY* object whose type is a delegate to that member function, and it will understand - presumably this was the least confusing (albeit more than slightly lateral) way of implementing this syntax.

Nov 16 '05 #4
Beeeeeeeeeeeeve s <Be************ **@discussions. microsoft.com> wrote:
It IS confusing that you're *subtracting* a *new* object, but that IS
the correct syntax. Remember that the 'new' event handler that you're
subtracting is actually (in all probability) a reference to a
specific instance's member function, so it's basically just saying
'this member function of this instance doesn't want to receive this
event any more.' To tell the compiler that, all it needs is *ANY*
object whose type is a delegate to that member function, and it
willunderstand - presumably this was the least confusing (albeit more
than slightly lateral) way of implementing this syntax.


Bear in mind, however, that there are two parts to a delegate - the
method itself, and the target object. So doing

Foo f = new Foo();
x.SomeEvent += new SomeDelegate(f. Something);
x.SomeEvent -= new SomeDelegate(f. Something);

will add and then remove the handler.

x.SomeEvent += new SomeDelegate (new Foo().Something );
x.SomeEvent -= new SomeDelegate (new Foo().Something );

will fail to remove the handler it's added, as the two delegates in
question aren't equal.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
To answer that question, we can fire up Reflector
http://www.aisto.com/roeder/dotnet/ and look at the definition of the
Delegate class. In it, we find that the the Equals() method has been
overridden. Two delegates are considered equal if they both target the same
object instance and the same method within that object instance.

So:
event1 = new EventHandler(it em_MyEvent);
event2 = new EventHandler(it em_MyEvent);

?event1.Equals( event2); // true

When you execute this:
item.MyEvent -= new EventHandler(it em_MyEvent);

The publisher goes looking for a delegate that it is holding that is equal
to the one that you passed, and it finds the one that you passed in the +=
statement.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:Os******** ******@TK2MSFTN GP12.phx.gbl...
Thanks. I figured that I needed to unsubscribe in some way but since I
wasn't storing an internal reference to the subscriber. I added the code
like the following and it solved the problem but I don't really understand
why:

item.MyEvent -= new EventHandler(it em_MyEvent);

This just seems really odd to me. If the += assignment adds a refernece to a new event handler it seems that handler would be a different object than
the one created with the new operator in the -= assignment. I could see
something like this working:
EventHandler eh = new EventHandler (item_MyEvent);
item.MyEvent += eh;
...then later...
item.MyEvent -= eh;
I can see that working because it's the same object, but when I use the new keyword twice don't I have two unique references?

- Rhy
"J.Marsch" <je****@ctcdeve loper.com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Are you unsubscribing the event when you remove the instances of Class C
from memory?

If you subscribe to an event and do not unsubscribe, the subscriber will
be
held in memory until the event publisher (class A) is collected.

Here's why:
A delegate has a member called Target. Target is a reference to the
subscriber (Class C). When you add the event, the publisher holds a
reference to the delegate which in turn holds a reference to the
subscriber,
so C is held in memory. The graph looks like this:

A ---> EventDelegate ---->C

So, the reason that you are getting multiple event fires is that you have more instances of C in memory than you think that you do.

What you probably want to do is to keep track of all of the event
subscriptions that C makes and have C implement IDispose. When you are
ready to kill C, call its Dispose method. Inside the Dispose, unsubscribe from all of the events that you are subscribed to.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:uV******** *****@TK2MSFTNG P09.phx.gbl...
I have a class (let's call it ClassA) that I've written which has events. In another class (let's call it ClassB) I create a collection of ClassA
objects. In a third class (ClassC) I create a reference to some of the
ClassA objects created in ClassB. In ClassC I hook into the ClassA
events
with a foreach loop so that I hook each object. The code is something

like
this:
class ClassC {
void SomeMethod()
{
foreach (ClassA item in ClassACollectio n)
{
item.MyEvent += new EventHandler(it em_MyEvent);
}
}
}

Objects of type ClassC keep getting created and deleted, but the objects
of
ClassA that it references stay in memory. Therefore, every time I load

a new instance of ClassC the event gets hooked again. What I'm seeing is

that
I fire the event once but I end up getting it raised in the code that
responds to it (item_MyEvent method) for every time it was added when I

only
want it to get caught once.

How can I be sure that I only add the handler to the event once for each item? Since the code is in ClassC it's not allowed to inspect the
ClassA.MyEvent to see if something's already hooked to it.

I hope this makes sense. Creating a repro case wouldn't make sense here because it's my application logic that's causing the problem.

Thanks.



Nov 16 '05 #6
Interesting. I was just playing around with the Equals function in the
snippet compiler (http://www.sliver.com/dotnet/SnippetCompiler/) , and I
think that I may have spotted a bug -- I don't want to jump to conclusions,
though.

Correct me if I'm wrong, but if you override Equals, you should also
override GetHashCode (you actually get a compiler warning if you don't -- I
know this part is right). Shouldn't the results of GetHashCode be
consistent with Equals -- two items that are "equal" should return the same
hash code, but two items that are not equal should return different hashes?

I was pretty sure that this is how it was supposed to work. Maybe I'm
wrong. What I find is that it is possible to have 2 delegates where
Equals() is false, but the Hashes returned from GetHashCode are the same.

This can happen if you have 2 different delegates pointing to the same
method name in 2 different object instances. In Reflector, it appears the
Equals() takes into account both the target and the method pointer, but
GetHashCode only takes into account the method pointer (which will be the
same for all instances of the same object, as only the fields are copied in
memory).

Below is a short but complete program to demo (.Net framework v 1.1):

using System;
using System.Collecti ons;

public class MyClass
{
public static void Main()
{
EventTarget handler1 = new EventTarget();
EventTarget handler2 = new EventTarget();
System.EventHan dler event1 = new System.EventHan dler(handler1.H andler);
System.EventHan dler event2 = new System.EventHan dler(handler2.H andler);

// first test equal -- should be false
WL("Event1.Equa ls(Event2): {0}", event1.Equals(e vent2));
// second test -- hashcode
int hash1 = event1.GetHashC ode();
int hash2 = event2.GetHashC ode();
WL("Event1 Hash: {0}, Event2 Hash: {1} Hash1 == Hash2: {2}", hash1, hash2,
hash1 == hash2);
RL();
}

private static void WL(string text, params object[] args)
{
Console.WriteLi ne(text, args);
}

private static void RL()
{
Console.ReadLin e();
}

private static void Break()
{
System.Diagnost ics.Debugger.Br eak();
}
}

public class EventTarget
{
public void Handler(object sender, System.EventArg s e)
{
}
}

"J.Marsch" <je****@ctcdeve loper.com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
To answer that question, we can fire up Reflector
http://www.aisto.com/roeder/dotnet/ and look at the definition of the
Delegate class. In it, we find that the the Equals() method has been
overridden. Two delegates are considered equal if they both target the same object instance and the same method within that object instance.

So:
event1 = new EventHandler(it em_MyEvent);
event2 = new EventHandler(it em_MyEvent);

?event1.Equals( event2); // true

When you execute this:
item.MyEvent -= new EventHandler(it em_MyEvent);

The publisher goes looking for a delegate that it is holding that is equal
to the one that you passed, and it finds the one that you passed in the +=
statement.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:Os******** ******@TK2MSFTN GP12.phx.gbl...
Thanks. I figured that I needed to unsubscribe in some way but since I
wasn't storing an internal reference to the subscriber. I added the code
like the following and it solved the problem but I don't really understand why:

item.MyEvent -= new EventHandler(it em_MyEvent);

This just seems really odd to me. If the += assignment adds a refernece to
a new event handler it seems that handler would be a different object than the one created with the new operator in the -= assignment. I could see
something like this working:
EventHandler eh = new EventHandler (item_MyEvent);
item.MyEvent += eh;
...then later...
item.MyEvent -= eh;
I can see that working because it's the same object, but when I use the

new
keyword twice don't I have two unique references?

- Rhy
"J.Marsch" <je****@ctcdeve loper.com> wrote in message
news:%2******** *******@TK2MSFT NGP12.phx.gbl.. .
Are you unsubscribing the event when you remove the instances of Class C from memory?

If you subscribe to an event and do not unsubscribe, the subscriber will be
held in memory until the event publisher (class A) is collected.

Here's why:
A delegate has a member called Target. Target is a reference to the
subscriber (Class C). When you add the event, the publisher holds a
reference to the delegate which in turn holds a reference to the
subscriber,
so C is held in memory. The graph looks like this:

A ---> EventDelegate ---->C

So, the reason that you are getting multiple event fires is that you

have more instances of C in memory than you think that you do.

What you probably want to do is to keep track of all of the event
subscriptions that C makes and have C implement IDispose. When you are ready to kill C, call its Dispose method. Inside the Dispose, unsubscribe from all of the events that you are subscribed to.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:uV******** *****@TK2MSFTNG P09.phx.gbl...
> I have a class (let's call it ClassA) that I've written which has events.> In another class (let's call it ClassB) I create a collection of ClassA> objects. In a third class (ClassC) I create a reference to some of the> ClassA objects created in ClassB. In ClassC I hook into the ClassA
> events
> with a foreach loop so that I hook each object. The code is something like
> this:
> class ClassC {
> void SomeMethod()
> {
> foreach (ClassA item in ClassACollectio n)
> {
> item.MyEvent += new EventHandler(it em_MyEvent);
> }
> }
> }
>
> Objects of type ClassC keep getting created and deleted, but the objects of
> ClassA that it references stay in memory. Therefore, every time I load a
> new instance of ClassC the event gets hooked again. What I'm seeing
is that
> I fire the event once but I end up getting it raised in the code that
> responds to it (item_MyEvent method) for every time it was added when I only
> want it to get caught once.
>
> How can I be sure that I only add the handler to the event once for

each> item? Since the code is in ClassC it's not allowed to inspect the
> ClassA.MyEvent to see if something's already hooked to it.
>
> I hope this makes sense. Creating a repro case wouldn't make sense here> because it's my application logic that's causing the problem.
>
> Thanks.
>
>



Nov 16 '05 #7
J.Marsch <je****@ctcdeve loper.com> wrote:
Interesting. I was just playing around with the Equals function in the
snippet compiler (http://www.sliver.com/dotnet/SnippetCompiler/) , and I
think that I may have spotted a bug -- I don't want to jump to conclusions,
though.

Correct me if I'm wrong, but if you override Equals, you should also
override GetHashCode (you actually get a compiler warning if you don't -- I
know this part is right). Shouldn't the results of GetHashCode be
consistent with Equals -- two items that are "equal" should return the same
hash code, but two items that are not equal should return different hashes?


No - two items which are equal should return the same hash code, but
two items which are not equal *may* return the same hash code.
Otherwise you couldn't *possibly* have a hash code for every string,
for instance.

Hash tables perform *better* if unequal objects return unequal hash
codes, but it's not necessary.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8
Well that clears it up. I'd much rather be wrong than have a bug.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
J.Marsch <je****@ctcdeve loper.com> wrote:
Interesting. I was just playing around with the Equals function in the
snippet compiler (http://www.sliver.com/dotnet/SnippetCompiler/) , and I
think that I may have spotted a bug -- I don't want to jump to conclusions, though.

Correct me if I'm wrong, but if you override Equals, you should also
override GetHashCode (you actually get a compiler warning if you don't -- I know this part is right). Shouldn't the results of GetHashCode be
consistent with Equals -- two items that are "equal" should return the same hash code, but two items that are not equal should return different
hashes?
No - two items which are equal should return the same hash code, but
two items which are not equal *may* return the same hash code.
Otherwise you couldn't *possibly* have a hash code for every string,
for instance.

Hash tables perform *better* if unequal objects return unequal hash
codes, but it's not necessary.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #9
No no no no no no, this is no reason to implement the IDisposable
interface!

When you implement the IDisposable interface, the design pattern
requires you to implement Finalize as well. The code inside Finalize
calls the Dispose method (it is in other words your failsafe in case
the client does not call Dispose). If you call Dispose manually,
GC.SuppressFina lization is called and the object is not placed in the
Finalization queue.

Now, not only do you not want to get into all this for every class
that subscribes to events, but implementing the Finalize method means
that every instance of that class is placed in the finalization list
of the GC so that it knows not to free up the memory that the object
is occupying before calling its Finalize method. Even if you do call
Dipose manually and you suppress the object's finalization, the
initial cost of placing the object in the finalization list is still
there.

The IDisposable interface should only be implemented when you are
dealing with unmanged resources, which if not freed would cause a
memory leak.

Regards,
Angelos Petropoulos

On Tue, 15 Jun 2004 18:21:05 -0500, "J.Marsch"
<je****@ctcdeve loper.com> wrote:
Are you unsubscribing the event when you remove the instances of Class C
from memory?

If you subscribe to an event and do not unsubscribe, the subscriber will be
held in memory until the event publisher (class A) is collected.

Here's why:
A delegate has a member called Target. Target is a reference to the
subscriber (Class C). When you add the event, the publisher holds a
reference to the delegate which in turn holds a reference to the subscriber,
so C is held in memory. The graph looks like this:

A ---> EventDelegate ---->C

So, the reason that you are getting multiple event fires is that you have
more instances of C in memory than you think that you do.

What you probably want to do is to keep track of all of the event
subscription s that C makes and have C implement IDispose. When you are
ready to kill C, call its Dispose method. Inside the Dispose, unsubscribe
from all of the events that you are subscribed to.

"Rhy Mednick" <rh*@rhy.com> wrote in message
news:uV******* ******@TK2MSFTN GP09.phx.gbl...
I have a class (let's call it ClassA) that I've written which has events.
In another class (let's call it ClassB) I create a collection of ClassA
objects. In a third class (ClassC) I create a reference to some of the
ClassA objects created in ClassB. In ClassC I hook into the ClassA events
with a foreach loop so that I hook each object. The code is something

like
this:
class ClassC {
void SomeMethod()
{
foreach (ClassA item in ClassACollectio n)
{
item.MyEvent += new EventHandler(it em_MyEvent);
}
}
}

Objects of type ClassC keep getting created and deleted, but the objects

of
ClassA that it references stay in memory. Therefore, every time I load a
new instance of ClassC the event gets hooked again. What I'm seeing is

that
I fire the event once but I end up getting it raised in the code that
responds to it (item_MyEvent method) for every time it was added when I

only
want it to get caught once.

How can I be sure that I only add the handler to the event once for each
item? Since the code is in ClassC it's not allowed to inspect the
ClassA.MyEvent to see if something's already hooked to it.

I hope this makes sense. Creating a repro case wouldn't make sense here
because it's my application logic that's causing the problem.

Thanks.


Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1789
by: Marty McDonald | last post by:
It is still unclear to me why we would use events when delegates seem to do just fine. People say that events make it so the publisher doesn't need to know about the listeners. What does that mean? Why are events better than delegates? Thanks
8
7402
by: STom | last post by:
I have a C# Winforms app that has 5 Winforms, lets say A through E. A: Data entry. When data is entered here in any field, values are updated on forms C, D, E.(Not B) B: Data entry form. When data is entered here in any field, values are updated on forms C, D, E (not A). I am considering using delegates to fire events from forms A & B. In forms C, D, E I will have functions with the same signature and even the same name that just...
3
397
by: Sam | last post by:
I’m just starting to learn delegates. I’m at the very beginning. If I understand correctly, delegates are for when you want to pass a function as a parameter. For example the client provides a custom function to be called in a provider class. My confusion is that you can already achieve this by interfaces and objects without delegates (which have a little more complicated syntax) Here is an example without delegates. class Class1 and...
4
22895
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on when to use one over another? If anyone could provide any additional info, your comments, best practices, any good articles, specific examples, etc. Thank you
4
5834
by: Tim | last post by:
There are a set of clients who need to be notified of certain events. I have used events and delegates (publisher-Subscriber model) for the notification mechanism. All the clients register with the event publisher and subscribe for the events that they are interested in. When a certain event happens, the subscribers are notified about it. I want the clients to return a value after their callback method is called. If any of the client...
30
3665
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment it seems to me that Microsoft has developed similar functionality via two keywords. I do understand that an event offers better encapsulation as the underlying delegate is private, but is that all ? -- Regards
2
2351
by: kristian.freed | last post by:
Hi, I currently work in a project written fully in C# where we make extensive use of delegates and events. We have a model where a "state", an object holding data but not much code but which fires events when the data changes, is often the central part. Connected to these states are various observers that act on changes in data, by altering the information presented to the user, executing code and so on, each observer with its own...
5
2404
by: raylopez99 | last post by:
I understand delegates (static and non-static) and I agree they are very useful, and that the "Forms" used in the Windows .NET API could not work without them. That said, I'm curious as to how many heavy duty pro programmers in this newsgroup have actually used a delegate in their code, say in the last year of coding. By "use" I mean constructed a delegate and using it in an Event Source class and an Event Receiver class. Interfaces...
7
3425
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that uses the "WithEvents" and events. There is another example on page 124 that shows how to use delegates to sort an array. I don't understand the difference between events and delegates. Are they redundant features? How do I decide which to use? ...
0
9872
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10945
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9453
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7858
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7038
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5696
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.