Generate event when stack changed
I have a task develop a class Stack that generate event when you add new element ? Develop a class Stack is not a problem, what means event that apears when a new element is added ?[
That about awt / swing ..or I can to apply listeners
to My Stack ?Sorry, I thought there were also non-GUI examples there. Apparently not.
It's probably the intention to implement the observer pattern into your code.
Here's a small demo of how this can be done:import java.util.List;
import java.util.ArrayList;
class Main {
public static void main(String[] args) {
MagazinePublisher publisher = new MagazinePublisher();
Subscriber carl = new Subscriber("Carl");
Subscriber pete = new Subscriber("Pete");
Subscriber zeke = new Subscriber("Zeke");
publisher.registerObservers(carl);
publisher.registerObservers(pete);
// whenever the state of the 'publisher' changes, it's
// subscribers should be notified
publisher.notifyObservers();
publisher.registerObservers(zeke);
publisher.notifyObservers();
publisher.removeObservers(pete);
publisher.removeObservers(carl);
publisher.notifyObservers();
interface MyObserver {
void update(int edition);
interface MySubject {
void registerObservers(MyObserver mo);
void removeObservers(MyObserver mo);
void notifyObservers();
class MagazinePublisher implements MySubject {
List<MyObserver> observers;
int edition;
public MagazinePublisher() {
observers = new ArrayList<MyObserver>();
edition = 1;
public void notifyObservers() {
for(MyObserver mo : observers) {
mo.update(edition);
edition++;
public void registerObservers(MyObserver mo) {
observers.add(mo);
public void removeObservers(MyObserver mo) {
observers.remove(mo);
class Subscriber implements MyObserver {
String name;
public Subscriber(String n) {
name = n;
public boolean equals(Object o) {
return this.name.equals(((Subscriber)o).name);
public void update(int e) {
System.out.println(name+" recieved a copy of the "+e+" edition!");
// hashCode() and other methods ...
}Details about this design pattern:
http://en.wikipedia.org/wiki/Observer_pattern
or Google, of course:
http://www.google.com/search?hl=en&q=Observer+pattern&btnG=Google+Search
Good luck!
Similar Messages
-
APP-FND-01926 The Custom Event WHEN-LOGON-CHANGED...
Hi,
After compiling and placing a 'custom' CUSTOM.pll (and plx) file on the server, when logging into Applications receiving ERROR:
APP-FND-01926 The custom event WHEN-LOGON-CHANGED raising unhandled exception: User Defined exception.
This is for R12.1.3
The code was moved to the original base version of the R12 CUSTOM.pll file...
I read many other Notes on this error, but most refer to an error related to a Program Unit Not found and requiring a regeneration of the JAR files.
Would this be the same situation?
When we place the original back in place the forms login works.
Any ideas?
Thanks,
Lamontecheck ur CLASSPATH environment variable ur Custom.plx library should visible on runtime to Classpath variable.
Baig,
[My Oracle Blog|http://baigsorcl.blogspot.com/] -
When login Apps, get APP-FND--01926: The custom event WHEN-LOGON-CHANGED ra
When login Apps, get APP-FND--01926: The custom event WHEN-LOGON-CHANGED raised unhandled exception: ORA-01403: no data found
Applied patch
6241631 11i.ATG_PF.H.delta.7 (RUP 7) and it's pre-requisite patches
Forms can not be launched successfully.
APP-FND--01926: The custom event WHEN-LOGON-CHANGED raised unhandled exception: ORA-01403: no data found
Followed
Note 391243.1: Unable to access forms - getting APP-FND-01926 error (Doc ID 391243.1)
Note 555409.1: Client Gets App-Fnd-01926 Every Time After Bounce Apps 11i Forms Service (Doc ID 555409.1)
these two notes, can not solve the issue.
Executed following action plans:
1. Backup custom.pll file on your issued instance(DEV instance).
2. Copy a custom.pll files from a working environments(i.e. PROD instance) to this issued instance(DEV instance).
3. Compile the new copied Library CUSTOM.pll manually by running the command:
f60gen module=CUSTOM.pll userid=APPS/APPS output_file=$AU_TOP/resource/CUSTOM.plx module_type=library batch=no compile_all=special4. The $FORMS60_PATH needs to be in sync with the the Context.xml specifically the s_f60path variable
i.e >/oracle/apps/test10appl/au/11.5.0/resource:/oracle/apps/test10appl/au/11.5.0/resource/stub</FORMS60_PATH>
5. Run Autoconfig instantiate the changes.
Issue still exists.
Please HELP~~
Thanks,
JackieHello Srini,
app11i@hpfsapp2> ls -ltra CUSTOM
-rwxr-xr-x 1 app11i dba 24576 Aug 29 2001 TMCUSTOM.pll
-rwxr-xr-x 1 app11i dba 20480 Mar 8 2006 CUSTOM.pll.backup
-rwxr-xr-x 1 app11i dba 24576 Feb 22 2007 CUSTOM.pll.20120215
-rwxr-xr-x 1 app11i dba 32768 Oct 4 2007 CHRM_CUSTOM.plx
-rw-r--r-- 1 app11i dba 36864 Oct 8 2007 CHRM_CUSTOM.pll
-rwxr-xr-x 1 app11i dba 20480 Feb 14 15:20 TMCUSTOM.plx
-rw-r--r-- 1 app11i dba 24576 Feb 15 09:22 CUSTOM.pll
-rwxr-xr-x 1 app11i dba 16384 Feb 15 09:23 CUSTOM.plx
I don't quite understand "only one copy of CUSTOM.plx in the PATH directories", what is PATH directories? How to check? You mean environment variable?
EBS version: 11.5.10.2
DB version: 9.2.0.8
OS: Linux x86
Thanks,
Jackie -
Generate event when file contents change
I should be informed (an event should be generated) when contents of a file changes .
How should I implement this using javaI did something along the lines in one of my projects. Basically it came down to the following:
Create a FileChangeMonitor class that can register listeners for changes in certain files. This class starts a thread that checks the timestamps of the registered files once in a while. When a change is detected, an event will be fired to the listener.
I can send you the code, but I first have to find the correct backup CD it is on...
Cheers,
--Arnout -
Why shared variable generates events when I write constant value?
Hello all,
I'm using LV 8.5 with DSC packet.
I modified "DSC Events Demo".vi and made a test. I noticed that only variable which work okay is double typed. Why this code generate events all the time when I write constant values to shared variables? Double is okay, but string and boolean types not work okay. Is there any other people how have noticed same symption?
Attachments:
modified_dsc_event_demo1.zip 391 KBYou may get an initial event on startup which is normal. Also make sure that you have not enabled timestamp change events.
-
Dev2k and event when tabpage changed ?
Hi !
Does Dev2k 5.0 generate an event when you press or change a
tabpage? I haven't succeded in finding one yet, but perhaps
someone knows about it or know of a workaround ?
Also there is a trigger called ON-DISPATCH-EVENT !! Does anyone
know what you can do with this ? or what it does ?
Thanks,
Kenneth ([email protected])
nullWhen you click on a tab in forms 5 and greater, it first
when-tab-page-changed. Note that this trigger only first when a
users explicitly clickes on a tab. If the application allows you
to navigate to an item on a different tab page, the trigger does
not fire, but the tabs do change to reflect the current tab.
Also, there are two system variable that are helpful; they are
:system.tab_new_page and :system.tab_previous_page. For some
reason, the help system only includes references to the tab
trigger and system tab variables on the FIND tab of the help
search. The INDEX tab page of help does not list them.
Good luck.
Brian
Kenneth Breit Bedsted (guest) wrote:
: Hi !
: Does Dev2k 5.0 generate an event when you press or change a
: tabpage? I haven't succeded in finding one yet, but perhaps
: someone knows about it or know of a workaround ?
: Also there is a trigger called ON-DISPATCH-EVENT !! Does anyone
: know what you can do with this ? or what it does ?
: Thanks,
: Kenneth ([email protected])
null -
Tigger event when user change iphone time
It is possible, we can trigger event if user change date and time of iphone.
Did you traced ICI, if any de-register events getting published when you close IE.
-
Best event when data changes via a user in a datagrid
How do I capture when data changes via a user in a datagrid?
change event?thanks mate but I'm not sure where to put it:
<mx:AdvancedDataGridColumn headerText="sell" dataField="sell" textAlign="right" editable="true">
<mx:itemEditor>
<fx:Component>
<s:MXAdvancedDataGridItemRenderer>
<s:TextInput width="100%" text="{data.sell}" fontWeight="bold" contentBackgroundColor="#eeeeff" color="#3333ff" textAlign="right" restrict=".0-9" maxChars="11">
</s:TextInput>
</s:MXAdvancedDataGridItemRenderer>
</fx:Component>
</mx:itemEditor>
</mx:AdvancedDataGridColumn> -
Possible bug - Missing click event when handling change event
Using Flex 4.5 SDK, I have a spark ComboBox and a Button next to it for applying a filter according to ComboBox selection.
I listen to both the ComboBox's change event & the Button's click event (for different functions).
When I manually delete the ComboBox text value from its TextInput (i.e. changing selected index to -1) and immediately click on the Button,
the click event-handler function is not being called and only the ComboBox's change event-handler function is executed.
(Selecting a value from the ComboBox's list and clicking on the button triggers both methods on the right order.)
There's also a state definition for the module, but it isn't being changed during these operations...
Is this a bug or a correct behavior? Am I missing something here?
Any workaround suggestions?
(I thought of listening also to mouse-down or mouse-up on the button instead, but haven't tried it yet...)
*** UPDATE ***
When using the Button's mouseDown event the behavior is as expected, so there's a simple workaround.
However, it seems to me like there's a bug with the Button's click event listener or something...
*** UPDATE #2 ***
I created a test application for that and couldn't reproduce the problem.
Then I figured out the problem and solved it.
It's a bit emmbarrasing, but I actually disabled the button (enabled=false) as in a child method of the change handling code...
(If there is no value, don't allow applying the filter - It makes sense! )
Anyway... No issue after all.
However, I choose to leave this post (and not delete it) as an example of identifying and resolving a strange behavior in a complex application.There's no need.
Please read the section UPDATE #2. -
Hello all,
I am trying to figure how to use an activex callback when the computers(windows 7) network connection changes.
I am able to access and use properties of the NETWORKLIST.INetworkListManager class but I am not able to get the Reg Event Callback to work for NETWORKLIST.INetworkListManager.NetworkConnectivityChanged.
Does anyone have experience with this class or more ActiveX knowledge to get this working?
Perhaps there is another more commonly used method to see network changes without polling?
I hope I have provided enough details to get some help. Thank you for your time.
Attachments:
Z_NetworkConnectivityChangedEvent.vi 15 KB
Z_NetworkCPropteryChangedEventCallback.vi 8 KBWandern wrote:
Hello all,
I am trying to figure how to use an activex callback when the computers(windows 7) network connection changes.
I am able to access and use properties of the NETWORKLIST.INetworkListManager class but I am not able to get the Reg Event Callback to work for NETWORKLIST.INetworkListManager.NetworkConnectivityChanged.
Does anyone have experience with this class or more ActiveX knowledge to get this working?
Perhaps there is another more commonly used method to see network changes without polling?
I hope I have provided enough details to get some help. Thank you for your time.
I cannot get this working in LabVIEW 2013 32-bit.
Not sure why.
I am able to get the callback to work in C# Express 2010. -
What is the proper event when i change an edit text
Hi Dear;
which event is when i an edit text value changes ?
regardsIf you want to catch changes in exittext, store his value to global variable or somewhere to other exittext (invisible) and play with event
pval.EventType = SAPbouiCOM.BoEventTypes.et_KEY_DOWN
and compare the values in edittext and invisible edittext. If the values are different, the edittext value changes. -
Hi!
In my GUI application I need to get the name of 'Sequence' when 'Sequence' of an Execution changes. Is there any event to get this change. Please help
Thankstsgy,
I couldn't find an event that would notify you of when the sequence of an execution changes, but you don't say why you are trying to use this information.
If you just want the name of the sequence for display reasons, then you can use any of the TestStand UI Controls, such as the Label. Then you can use ExecutionViewManager.ConnectCaption with the Caption Source of CaptionSource_CurrentSequence
Josh W.
Certified TestStand Architect
Formerly blue -
Catch events when documents change
Hi. We would like to do realtime indexing of content in our km engine. Is there a way to create a listener which is triggered anytime a document changes, so that we can inform our "TREX" (or a 3rd party search engine)?
Next step would be to also catch an event everytime permissions for a document change.
I would appreciate, if someone could elaborate on the possibilities.Hi Sebastian,
yes, you can implement an IEventReceiver an listen to certain events:
public class MyEventReceiver implements IResourceEventReceiver {
public MyEventReceiver() {
IResourceEventBroker broker = resource.getRepositoryManager().getEventBroker();
broker.register(this, IResourceEvent.RENAME_EVENT, IEventBroker.PRIO_MIN, true);
public void received(IEvent event) {
if( event instanceof IResourceEvent ) {
IResourceEvent resourceEvent = (IResourceEvent)event;
IResource resource = resourceEvent.getResource();
See JavaDoc here: https://media.sdn.sap.com/html/submitted_docs/nw_kmc/javadoc/com/sapportals/wcm/util/events/package-summary.html
KMC Developer Guide Eventing intro: https://media.sdn.sap.com/html/submitted_docs/nw_kmc/introduction/rf/concepts/rf_concepts.html#events
Regards,
Thilo -
Generate Events based on Cache size
Hi,
I have a use case where I need to generate events when the size of the cache has reached a specific value. The cache will be highly transactions (lot of inserts and deletes totaling to 6 million transactions per day). Also, I cannot limit the size of the cache as I don't want any data to be lost (trying to insert when cache size has reached its limit).
One of the ways I could do this is to use a MapListener to generate an event on every insert to the Cache, and then check for size each time to decide if the further processing needs to be done. With the nature of the traffic in the cache, the items in the cache are to be processed when the size threshold is reached and then deleted. But, I'm not sure how much of an overhead these events and listeners will have (with 6 million items going through the cache each day)
Is there any other more efficient way to do this? I have looked at Continuous Query cache which uses a filter based on a cache. But, I'm not able to figure out a way to get the size of the cache using a filter.
Any pointers are helpful
Thanks in advance
Regards
Vikas
Edited by: vikascv on Nov 17, 2009 8:48 AMHi Vikas,
Typically a size type calculation is the cumulative result of all storage enabled nodes, i.e. a Count aggregation. In your use case you want to be made aware of changes to an aggregation but as an aggregation is point in time of request opposed to continually being updated it does not fit your use case. One option is to create a MapEventTransformer that you register with the cache which increments a counters cache (on a separate service) using an EntryProcessor, i.e.
MapEventTransformer...
public class CounterMapEventTransformer implements MapEventTransformer, PortableObject
String m_cacheName;
public CounterMapEventTransformer()
public CounterMapEventTransformer(final String cacheName)
m_cacheName = cacheName;
public MapEvent transform(MapEvent event)
Long prevCount = null;
Long currentCount = null;
switch( event.getId() )
case( MapEvent.ENTRY_INSERTED ):
// perform counter++
currentCount = (Long) CacheFactory.getCache("counters").invoke(m_cacheName, new CounterOp(true));
break;
case( MapEvent.ENTRY_DELETED ):
// perform counter--
currentCount = (Long) CacheFactory.getCache("counters").invoke(m_cacheName, new CounterOp(false));
break;
MapEvent newEvent = new MapEvent(event.getMap(), event.getId(), event.getKey(), currentCount-1, currentCount);
return newEvent;
public void writeExternal(PofWriter out) throws IOException
out.writeString(0, m_cacheName);
public void readExternal(PofReader in) throws IOException
m_cacheName = in.readString(0);
}Incrementing EP...
public class CounterOp extends AbstractProcessor implements PortableObject
boolean m_increment;
public CounterOp()
public CounterOp(boolean increment)
m_increment = increment;
@Override
public Object process(Entry entry)
Long newVal = null;
if( !entry.isPresent() )
entry.setValue(newVal = Long.valueOf(1));
else
newVal = ((Long)entry.getValue()).longValue() + (isIncrement() ? 1 : -1);
entry.setValue( newVal );
return newVal;
protected boolean isIncrement()
return m_increment;
public void writeExternal(PofWriter out) throws IOException
out.writeBoolean(0, m_increment);
public void readExternal(PofReader in) throws IOException
m_increment = in.readBoolean(0);
}cache-config
<!--
| listener-cacheconfig.xml | | Copyright 2001-2009 by Oracle. All
rights reserved. | | Oracle is a registered trademarks of Oracle
Corporation and/or its | affiliates. | | This software is the
confidential and proprietary information of Oracle | Corporation. You
shall not disclose such confidential and proprietary | information and
shall use it only in accordance with the terms of the | license
agreement you entered into with Oracle. | | This notice may not be
removed or altered.
-->
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>dist-*</cache-name>
<scheme-name>distributed-scheme</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>counters</cache-name>
<scheme-name>counter-scheme</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<!--
Distributed caching schemes
-->
<distributed-scheme>
<scheme-name>distributed-scheme</scheme-name>
<service-name>DistributedCache</service-name>
<serializer>
<class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
<init-params>
<init-param>
<param-type>string</param-type>
<param-value>pof-config.xml</param-value>
</init-param>
</init-params>
</serializer>
<backing-map-scheme>
<local-scheme />
<!--
<read-write-backing-map-scheme> <internal-cache-scheme>
<local-scheme /> </internal-cache-scheme> <cachestore-scheme>
<class-scheme>
<class-name>com.oracle.coherence.cachecounter.store.CacheCounterStore</class-name>
</class-scheme> </cachestore-scheme>
</read-write-backing-map-scheme>
-->
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
<distributed-scheme>
<scheme-name>counter-scheme</scheme-name>
<service-name>CounterDistributedCache</service-name>
<serializer>
<class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
<init-params>
<init-param>
<param-type>string</param-type>
<param-value>pof-config.xml</param-value>
</init-param>
</init-params>
</serializer>
<backing-map-scheme>
<local-scheme />
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
</cache-config>pof-config...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pof-config SYSTEM "pof-config.dtd">
<pof-config>
<user-type-list>
<!-- include all of the standard Coherence type -->
<include>coherence-pof-config.xml</include>
<!-- our custom types (user types) 1000+ -->
<user-type>
<type-id>1000</type-id>
<class-name>com.oracle.coherence.cachecounter.event.CounterMapEventTransformer</class-name>
</user-type>
<user-type>
<type-id>1001</type-id>
<class-name>com.oracle.coherence.cachecounter.processors.CounterOp</class-name>
</user-type>
</user-type-list>
<allow-interfaces>true</allow-interfaces>
<allow-subclasses>true</allow-subclasses>
</pof-config>Test class
public class MapEventTransformerTest
public static final String m_cacheName = "dist-test1";
public static void setUp()
System.setProperty("tangosol.coherence.cacheconfig", "counter-cacheconfig.xml");
System.setProperty("tangosol.coherence.distributed.localstorage", "false");
public static void loadVals()
final NamedCache cache = CacheFactory.getCache(m_cacheName);
final int MAX_SIZE = 100;
for( int i=0; i<MAX_SIZE; i++ )
cache.put(i, "msg "+i);
public static void removeVals()
final NamedCache cache = CacheFactory.getCache(m_cacheName);
final int MAX_SIZE = 100;
for( int i=0; i<MAX_SIZE; i++ )
if( i%2==0 )
cache.remove(i);
public static void testTransformer()
final NamedCache cache = CacheFactory.getCache(m_cacheName);
cache.addMapListener(new CounterAwareListener(),
new MapEventTransformerFilter(AlwaysFilter.INSTANCE, new CounterMapEventTransformer(m_cacheName)),
false);
public static void main(String[] args) throws IOException
setUp();
testTransformer();
loadVals();
removeVals();
System.out.println("press a key to end...");
System.in.read();
public static class CounterAwareListener extends MultiplexingMapListener
@Override
protected void onMapEvent(MapEvent evt)
System.out.format( "# of items in cache: %d\n", evt.getNewValue() );
}Note: Events could be received out of order but for your use case where you are interested in a threshold you may not care! -- food for thought :)
--harvey -
Generate Email on Infotype Changes
Dear Guru's,
I have an issue in generating Email when some changes are done in the HR master. I have done it through Dynamic action and it is working fine. But my problem is that I dont want to generate a message when I perform an Hiring Action as I have done the Dynamic Action configuration for all the Infotypes and I have activated the Feature M0001 also. So when I perform an Action of Hiring I am getting atleast 15 mails.
So my issue now can I do some configuration in feature M0001 on the basis of T code that when an action is performed through PA40 mails will not be generated.
When I was reading the documentation for feature M0001, I found that in the feature return atributes 3 attributes as Name1, name2 and name3. Can any one help me as what is the return value these attributes.
Thanks in advance,
Regards,
Vijay.Hi,
Please refer to SAP explanation:
NAME1 - If the infotype that triggers the mail is not the
Organizational Assignment infotype (0001), then the feature
specified is read.
You can define distribution lists and recipients in
this feature. The standard SAP system contains the
feature RCIEV, which can be used as an example.
NAME2 - If the infotype that triggers the mail is the
Organizational Assignment infotype (0001),
then the feature specified will be read
using the new data contained in infotype 0001. New data
means data contained in an infotype record for infotype
0001 that has been changed after the mail was sent. You
can define a distribution list and a recipient in this
feature.
The standard SAP system contains the feature RCNEW,
which can be used as an example.
NAME3 - If the infotype that triggers the mail is the
Organizational Assignment infotype (0001),
then the feature specified here, will be
read using the old data contained in the infotype. Old
data means data prior to changing the infotype record that
triggered a mail to be sent. You can define distribution
lists and recipients in the feature. The standard SAP
system contains feature RCOLD, which can be used as an
example.
Cheers!
Maybe you are looking for
-
Twitter App. for 1st Gen. iPod Touch
I recently was having problems with the Twitter App. on my 1st Gen. iPod Touch and so decided to delete the app and re-download it again, like I had done a week earlier. During the download an error message popped up stating that I need ios 6 or late
-
I can't drag anything, files, folders, pictures, etc.
This is a problem within my Finder, and on my Desktop. I need help! I have tried to Sleep and Wake with no luck! I need help!
-
Can't connect to bluetooth device and wifi really por
Hi, I bought recently a Pavilion 15-p036tx and I can't connect to my bluetooth device as logitech audio adapter, toshiba bluetooth mose and phone HTC. I noticed as well that the wifi connection is realy por only 1strip. I have a old HP Pvilion I boug
-
HELP !!!! no wifi on 20" imac coreduo sole with Leapord
Just done a clean install of leapord (did this as the drive was full of crap) , came to the install screen where you can connect to wireless network, but it could not see any, not even mine where the router is sat in the same room, my macbook sees ab
-
[JS] Move a Guide that has a ScriptLabel
I am trying move a specific guide. The guide is on the master page and is named myGuide Here is what I currently trying, but it doesn't work. app.activeDocument.guides.item("myGuide").location = 2 Thanks in advanced for any help. Dan P.S. I will this