Confused With A Class
I was helped by some people for this code and I'm a little lost. This code creates two zigzag lines that fall in a loop. I want to use bitmap data hittest with these lines, just to hit a simple object at the bottom of the screen, but I do not know how. I found the example of Mike Chambers but I do not know what to change to make it work for me. How can I apply it to my code?
bitmap data hittest example : http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detecti on/
import flash.display.Graphics;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
var objectSpawner: Timer;
var fallers: Array;
function initGame(): void {
fallers = [];
objectSpawner = new Timer(1000);
objectSpawner.addEventListener(TimerEvent.TIMER, createEnemy);
objectSpawner.start();
addEventListener(Event.ENTER_FRAME, dropEnemies);
function createEnemy(e: TimerEvent): void {
var enemy: Faller = new Faller();
enemy.y = -stage.stageHeight;
enemy.x = Math.random() * 380;
MovieClip(enemy).cacheAsBitmap = true;
addChild(enemy);
fallers.push(enemy);
drawConnectors();
function dropEnemies(e: Event): void {
trace(fallers.length);
for each(var mc: Faller in fallers) {
mc.y += 10;
if (mc.y > stage.stageHeight * 2) fallers.splice(fallers.indexOf(removeChild(mc)), 1);
drawConnectors();
function drawConnectors(): void {
if (fallers.length == 0) return;
var g: Graphics = this.graphics;
g.clear();
g.lineStyle(10,0xFFFFFF);
var mc: Faller = fallers[0];
g.moveTo(mc.x, mc.y);
for each(mc in fallers) g.lineTo(mc.x, mc.y);
init()
function init():void
var fallingThingsLeft:FallingThings = new FallingThings(stage.stageWidth / 2, stage.stageHeight);
var fallingThingsRight:FallingThings = new FallingThings(stage.stageWidth / 2, stage.stageHeight);
addChild(fallingThingsLeft);
addChild(fallingThingsRight);
fallingThingsRight.x = stage.stageWidth / 2;
I don't think you're going to be able to do this right now because your graphics object is in the same object that is the parent of everything else. Create a separate MovieClip/Sprite that contains all your enemies and preferably apply a Class to that that can handle the responsibility of managing the enemies, including drawing the lines. Now you just have to get the BitmapData from that MC/Sprite and hitTest against the BitmapDatas of your two FallingThings. But since you don't keep a reference to your FallingThings objects, you'll need to start keeping a reference to them before you can do any hit testing. I don't see any reference in your code to Touch1, so I have no idea where that "falls" in this scenario.
Similar Messages
-
We all know that all classes implements Object directly or indirectly. That is why we get all public methods available in Object class.
But as the definition says, if our class extends Object class indirectly and we are able to get public methods like notify(), notifyAll() etc why are we unable to get the protected method clone() of this class even our class extends Object class??
I mean to say either both type of methods must not be available or must be available.
Hope I am clear about my issue??
Can any of you guys explain it???
Regards.Your class needs to implement Cloneable interface.
For example this will throw an exception -
public class TestClone {
void foo() throws Exception {
clone();
public static void main(String args[]){
try {
new TestClone().foo();
}catch (Exception ex){
ex.printStackTrace();
This will not -
public class TestClone implements Cloneable{
void foo() throws Exception {
clone();
public static void main(String args[]){
try {
new TestClone().foo();
}catch (Exception ex){
ex.printStackTrace();
} -
Socket Programing in J2ME - Confused with Sun Sample Code
Hai Everybody,
I have confused with sample code provided by Sun Inc , for the demo of socket programming in J2ME. I found the code in the API specification of J2ME. The code look like :-
// Create the server listening socket for port 1234
ServerSocketConnection scn =(ServerSocketConnection) Connector.open("socket://:1234");
where Connector.open() method return an interface Connection which is the base interface of ServerSocketConnection. I have confused with this line , is it is possible to cast base class object to the derived class object?
Plese help me in this regards
Thanks in advance
SulfikkarThere is nothing to be confused about. The Connector factory creates an implementation of one of the extentions of the Connection interface and returns it.
For a serversocket "socket://<port>" it will return an implementation of the ServerSocketConnection interface. You don't need to know what the implementation looks like. You'll only need to cast the Connection to a ServerSocketConnection . -
Problems with abstract classes
I'm reading Java Wireless Blueprints and i'm confused with the functionality of abstract classes, especially in the next section:
public byte[] getPoster() throws ApplicationException {
if (poster == null) {
try {
poster =
ModelObjectLoader.getInstance().getMoviePoster(primaryKey);
} catch (ModelException me) {
throw new ApplicationException();
return poster;
This class invoque to the ModelObjectLoader class that is abstract and after invoque getInstance().getMoviePoster(primaryKey); method. The source code of the class is:
public abstract class ModelObjectLoader {
private static ModelObjectLoader instance = null;
protected ModelObjectLoader() {
instance = this;
return;
public static ModelObjectLoader getInstance() {
return instance;
public abstract TheaterSchedule getTheaterSchedule(Theater theater)
throws ModelException, ApplicationException;
public abstract Movie getMovie(String movieKey)
throws ModelException, ApplicationException;
public abstract Movie getMovie(Movie movie)
throws ModelException, ApplicationException;
public abstract byte[] getMoviePoster(String movieKey)
throws ModelException, ApplicationException;
public abstract int[][] getMovieShowTimes(String theaterKey, String movieKey)
throws ModelException, ApplicationException;
public abstract SeatingPlan getSeatingPlan(String theaterKey,
String movieKey,
int[] showTime) throws ModelException,
ApplicationException;
I don�t find where is the implementation of the getMoviePoster(primaryKey) method.
Can you help me to understand.
Thankspublic abstract byte[] getMoviePoster(String movieKey)It's an abstract method, which means that any concrete class that extends ModelObjectLoader must implement the method. If you really need to know (you might not), then call getInstance() and output the result of getClass().getName() on that object. That will tell you its type, and then you can go look at the source.
-
Confused with Extra options provided in J2EE Deployment wizard
HI,
When Iam packing Hello.JAR
Iam getting confusing beacause of few extra options provided in wizard screen and never getting deployed because of this proble i beleive
For Hello example..right now I have
1. HelloBean (EB Class)
2. HelloHime (Home Interface)
3. Hello (Remote Interface)
Here is one of the window:
1. A combo for Enterprise Bean class
Here I will select my Hello Bean Class
after this selection
There is a frame Named "LOCAL INTERFACES"
with 2 combos
a) Local Home Interface
b) Local Interface
Similarly there is another Freme Named "REMOTE INTERFACES"
a) Remote Home Interface
b) Remote Interface
In Each case it is not allowing me to move next with out selecting both a and b
So, Iam forced to specify a & b of first as "HelloHome.class" home Interface and a & b of second as "Hello.class" Remote Interface
However Jar gets created but while deploying using j2ee deploy tool it gives an error and terminates
Using verifier tool I found these failures
a) For [ HelloBean ]
Error: [ HelloHome ] does not properly extend the EJBLocalHome interface. All enterprise bean home interfaces must extend the EJBLocalHome interface. [ HelloHome ] is not a valid home interface.
b) For [ HelloBean ]
Error: [ Hello ] does not properly extend the EJBHome interface. All enterprise bean home interfaces must extend the EJBHome interface. [ Hello ] is not a valid home interface.
c) For [ HelloBean ]
Error: [ HelloHome ] does not properly extend the EJBObject interface. All enterprise bean remote interfaces must extend the EJBObject interface. [ HelloHome ] is not a valid remote interface within bean [ HelloBean ].
d) For [ HelloBean ]
For Local Interface [ javax.ejb.EJBHome ] method [ getHomeHandle ]
Error: No corresponding business method with matching arguments was found for method [ getHomeHandle ].
e) Error: No corresponding business method with matching exceptions was found for method [ getEJBMetaData ].
For Local Interface [ javax.ejb.EJBHome ] method [ getHomeHandle ]
Error: No corresponding business method with matching exceptions was found for method [ getHomeHandle ].
f) For [ HelloBean ]
For Local Interface [ javax.ejb.EJBHome ] method [ getHomeHandle ]
Error: No corresponding business method with matching return type was found for method [ getHomeHandle ].
g) Error: No create method exist within bean [ Hello ]
For [ HelloBean ]
Error: The create methods return type [ Hello ] is not equal to remote interface [ HelloHome ]
h) For [ HelloBean ]
For Home Interface [ Hello ]
Error: No create method was found in [ Hello ]
Can any body guide what can i do to select these combos never in any book specified these double options...unable to move further
Iam on Win 2000 with versions following of JAva
a) j2sdk1.4.0_01
b) j2sdkee1.3.1
It could be appreciable if anybody guide me in this regard
Thanks
ChakriYou need to populate only these two combo boxes with HelloHome.class and Hello.class respectively. Ignore the combo boxes under "LOcal Interface"
"REMOTE INTERFACES"
a) Remote Home Interface.....HelloHome.class
b) Remote Interface.......Hello.class -
Private, protected Access Modifiers with a class
Why cant we use private and protected access modifiers with a class?
Thanks.Matiz wrote:
>
Public access allows you to extend a parent class in some other package. If you only want users to extend your class rather than instantiate it directly, make the class abstract and design for extension.Agreed. However, would the same argument be not true for the default access at the class level? No. Default access would only allow you to extend a parent class in the same package (as opposed to some other package).
Now my confusion is why is a class allowed default access at the top level and not protected?Because protected for a top-level class makes no sense. The protected keyword provides member access to any other class in the same package and extending classes outside the package. A top-level class isn't a member of a class, by definition, so there's nothing that protected would do provide differently than public.
So, the two access modifiers for a top-level class are public and default. Public allows access to the class outside the package, whereas default restricts access to the class within the package.
~ -
Confusion with JDBC Optional Package for CDC.
I am somewhat confused as to where this optional package fits.
1. Is the implementation of this optional package to be COMPLETELY supplied by the database vendor(e.g. hsqdb, Oracle)?
OR
2. Is there an implementation available from Sun?
OR
3. Has Sun simply not released an implementation yet?
OR
4. Am I completely missing something here and losing my mind :)
OR
Is the JVM supposed to supply the implementation?
Thanks for any enlightenment.
JThe actual specification can be written without actually talking to a database (the spec is mostly interfaces). However, you are write in that along with these classes (which must pass the TCK) the database vendor must provide the rest. Unlike normal java.sql where there is a DriverManager class, that is not the case in JSR-169.
-
Please help with simple Classes understanding
Working further to understand Class formation, and basics.
At the Java Threads Tutorial site:
http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
Goal:
1)To take the following code, and make it into 2 seperate files.
Reminder.java
RemindTask.java
2)Error Free
Here is the original, functioning code:
import java.util.Timer;
import java.util.TimerTask;
* Simple demo that uses java.util.Timer to schedule a task
* to execute once 5 seconds have passed.
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class Reminder {
Timer timer;
public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
class RemindTask extends TimerTask {
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
public static void main(String args[]) {
new Reminder(5);
System.out.println("Task scheduled.");
}Here is what I tried to 2 so far, seperate into 2 seperate files:
Reminder.java
package threadspack; //added this
import java.util.Timer;
import java.util.TimerTask;
* Simple demo that uses java.util.Timer to schedule a task
* to execute once 5 seconds have passed.
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class Reminder {
Timer timer;
public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
public static void main(String args[]) {
new Reminder(5);
System.out.println("Task scheduled.");
}and into
RemindTask.java
package threadspack; //added this
import java.util.Timer;
import java.util.TimerTask;
import threadspack.Reminder; //added this
* http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
public class RemindTask extends TimerTask
Timer timer; /**here, I added this, because got a
"cannot resolve symbol" error if try to compile w/out it
but I thought using packages would have negated the need to do this....?*/
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
}After executing Reminder, the program does perform, even does the timing, however, a NullPointerException error is thrown in the RemindTask class because of this line:
timer.cancel(); //Terminate the timer thread
I am not sure of:
If I have packages/import statements setup correctly
If I have the "Timer" variable setup incorrectly/wrong spot.
...how to fix the problem(s)
Thank you!Hi there!
I understand that somehow the original "Timer" must
be referenced.
This is a major point of confusion for me....I
thought that when importing
Classes from the same package/other packages, you
would have directly
access to the variables within the imported Classes.I think you have one of the basic points of confussion. You are mixing up the concept of a "Class" with the concept of an "Object".
Now, first of all, you do not need packages at all for what you are trying to do, so my advice is you completely forget about packages for the moment, they will only mess you up more. Simply place both .class files (compiled .java files) in the same directory. Your program is executing fine, so that indicates that the directory in which you have your main class file is being included in your classpath, so the JVM will find any class file you place there.
As for Classes/Objects, think of the Class as the map in which the structure of a building is designed, and think of the Object as the building itself. Using the same technical map the architect defines, you could build as many buildings as you wanted. They could each have different colors, different types of doors, different window decorations, etc... but they would all have the same basic structure: the one defined in the technical map. So, the technical map is the Class, and each of the buildings is an object. In Java terminology, you would say that each of the buildings is an "Instance" of the Class.
Lets take a simpler example with a class representing icecreams. Imagine you code the following class:
public class Icecream{
String flavor;
boolean hasChocoChips;
}Ok, with this code, what you're doing is defining the "structure" of an icecream. You can see that we have two variables in our class: a String variable with the description of the icecream's flavor, and a boolean variable indicating whether or not the icecream has chocolate chips. However, with that code you are not actually CREATING those variables (that is, allocating memory space for that data). All you are doing is saying that EACH icecream which is created will have those two variables. As I mentioned before, in Java terminology, creating an icecream would be instantiating an Icrecream object from the Icecream class.
Ok, so lets make icrecream!!!
Ummm... Why would we want to make several icecreams? Well, lets assume we have an icecream store:
public class IcecreamStore{
}Now, we want to sell icecreams, so lets put icecreams in our icecream store:
public class IcecreamStore{
Icecream strawberryIcecream = new Icecream(); //This is an object, it's an instance of Class Icecream
Icecream lemonIcecream = new Icecream(); //This is another object, it's an instance of Class Icecream
}By creating the two Icecream objects you have actually created (allocated memory space) the String and boolean variable for EACH of those icecreams. So you have actually created two String variables and two boolean variables.
And how do we reference variables, objects, etc...?
Well, we're selling icecreams, so lets create an icecream salesman:
public class IcecreamSalesMan{
}Our icecream salesman wants to sell icecreams, so lets give him a store. Lets say that each icecream store can only hold 3 icecreams. We could then define the IcecreamStore class as follows:
public class IcecreamStore{
Icecream icecream1;
Icecream icecream2;
Icecream icecream3;
}Now lets modify our IcecreamSalesMan class to give the guy an icecream store:
public class IcecreamSalesMan{
IcecreamStore store = new IcecreamStore();
}Ok, so now we have within our IcecreamSalesMan class a variable, called "store" which is itself an object (an instance) of the calss IcecreamStore.
Now, as defined above, our IcecreamStore class will have three Icecream objects. Indirectly, our icecream salesman has now three icecreams, since he has an IcecreamStore object which in turn holds three Icecream objects.
On the other hand, our good old salesman wants the three icecreams in his store to be chocolate, strawberry, and orange flavored. And he wants the two first icecreams to have chocolate chips, but not the third one. Well, here's the whole thing in java language:
public class Icecream{ //define the Icecream class
String flavor;
boolean hasChocoChips;
public class IcecreamStore{ //define the IcecreamStore class
//Each icecream store will have three icecreams
Icecream icecream1 = new Icecream(); //Create an Icecream object
Icecream icecream2 = new Icecream(); //Create another Icecream object
Icecream icecream3 = new Icecream(); //Create another Icecream object
public class IcecreamSalesMan{ //this is our main (executable) class
IcecreamStore store; //Our class has a variable which is an IcecreamStore object
public void main(String args[]){
store = new IcecreamStore(); //Create the store object (which itself will have 3 Icecream objects)
/*Put the flavors and chocolate chips:*/
store.icecream1.flavor = "Chocolate"; //Variable "flavor" of variable "icecream1" of variable "store"
store.icecream2.flavor = "Strawberry"; //Variable "flavor" of variable "icecream2" of variable "store"
store.icecream3.flavor = "Orange";
store.icecream1.hasChocoChips = true;
store.icecream2.hasChocoChips = true;
store.icecream3.hasChocoChips = false;
}And, retaking your original question, each of these three classes (Icecream, IcecreamStore, and IcecreamSalesMan) could be in a different .java file, and the program would work just fine. No need for packages!
I'm sorry if you already knew all this and I just gave you a stupid lecture, but from your post I got the impression that you didn't have these concepts very clear. Otherwise, if you got the point, I'll let your extrapolate it to your own code. Should be a pice of cake! -
Confusion with Image/BufferedImage
Hello,
I'm trying to write an applet that displays and modifies local image files (gif). I'm running into some confusion with the different image APIs and drawing methods though.
I want to read the files, display them, and then create new images from sections of the original ones. I wrote an applet that succesfully loads and displays files as Image objects, but then I saw that BufferedImage has a method getSubImage() that I thought I could use to create the new images.
But my problem is that even without manipulating the images, I can't get them to display as BufferedImages. Here's the code, where I try to display the series of images twice, once as Image, once as BufferedImage, but the BI come out as black squares.
public class myapplet extends Applet
BufferedImage[] img = new BufferedImage[NUM_PICS];
Image[] im = new Image[NUM_PICS];
public void init()
Toolkit t = Toolkit.getDefaultToolkit();
Graphics2D bg;
MediaTracker tracker = new MediaTracker (this);
for(int i = 0;i<NUM_PICS;i++)
try
im[i] = t.getImage(gen.getLogo());
//the getLogo method is from a class I wrote -
//it returns a string with a filename
catch(Exception e)
System.out.println("ERROR: "+e.getMessage());
img[i] = new BufferedImage(70, 70,BufferedImage.TYPE_INT_RGB);
bg = img[i].createGraphics();
bg.drawImage(im[i],0,0,this);
public void paint(Graphics g)
Graphics2D g2 = (Graphics2D)g;
for(int i=0;i<NUM_PICS;i++)
g.drawImage(im[i],10,i*70,this);
g2.drawImage(img[i],null,80,i*70);
Any help would be great.You have to use the MediaTracker before drawing the image onto the BufferedImage:
try {
im[i] = t.getImage(gen.getLogo());
tracker.addImage(im[i], i);
tracker.waitForID(i); -
RE: (forte-users) Confusion with return event
Samer,
The return event is delivered to the calling task, which is the window in
your first test. It is not deliverd to the event loop of the service object
unless the call to the processor originated in the event loop, which is the
case in your second test. The output you get from the server is exactly as I
would expect.
You need the following code in you client:
event loop
postregister
SomeService1.StartImmediate();
when SomeService1.Proc.ProcessEvent_return do
task.Part.Logmgr.Putline('ProcessEvents_return');
when SomeService1.Proc.ProcessEvent_exception do
task.Part.Logmgr.Putline('ProcessEvents_exception');
end event;
Note that this logoutput will not be written to a logfile, but will appear
in the logwindow which is opened when you start a client application.
Pascal Rottier
Atos Origin Nederland (BAS/West End User Computing)
Tel. +31 (0)10-2661223
Fax. +31 (0)10-2661199
E-mail: Pascal.Rottiernl.origin-it.com
++++++++++++++++++++++++++++
Philip Morris (Afd. MIS)
Tel. +31 (0)164-295149
Fax. +31 (0)164-294444
E-mail: Rottier.Pascalpmintl.ch
-----Original Message-----
From: Samer Kanjo [mailto:skanjoyahoo.com]
Sent: Thursday, January 18, 2001 1:54 AM
To: ForteUsers
Subject: (forte-users) Confusion with return event
I have observed some odd behavior when attempting to
catch a return event for a method invoked using start
task. I provided the primary classes I used during my
test and some output produced by those classes at the
bottom of this message.
The SomeService1 class is used to create an
environment visible service object and the Processor
class is one of its members. The Processor class
starts processing when one of two things happens: the
SomeService1 timer ticks off 10 seconds or when
SomeService1.StartImmediate is called directly by
another entity. Either way StartImmediate is called to
start processing.
The provided output is the result of starting a test
application and invoking StartImmediate from another
object (I used a window) and then observing what
happens when the timer ticks. As you can see the
invocation from the window did not result in the
return event being received. However, the return event
was received when the timer ticked.
According to the Forte documentation a return event
will only be posted to the parent task's event queue.
Since I am making a cross partition call, the window
and service object are not really in the same task
(Unless my assumption is wrong). That would explain
why the window did not cause a return event to be
generated but was an event generated but not caught
and if so where did the event go?
In SomeService2 class I added an event StartProcessing
and moved the code from StartImmediate to the
StartProcessing event case in the event loop and
simply posted the StartProcessing event in
StartImmediate. I performed the same test I used when
testing SomeService1. The Traceback output is
identical for the window invocation but the return
event is received this time! Why?
It seems that to guarantee the receipt of a return
event an asynchronous task must be initiated from
within an event loop. Is this correct?
I do not understand this behavior does someone have
any thoughts on this? How can you guarantee the
receipt of a return event?
Samer Kanjo
OUTPUT FROM SOMESERVICE1
StartTaskTest_cl0: processing loop listening
StartTaskTest_cl0:
Traceback:
SomeService.StartImmediate at line 1
TestWin.Display at line 4
C++ Method(s)
UserApp.Run at offset 105
StartTaskTest_cl0:
StartTaskTest_cl0: Start processing...
StartTaskTest_cl0: Processing complete.
StartTaskTest_cl0:
Traceback:
SomeService.StartImmediate at line 1
SomeService.ProcessingLoop at line 9
StartTaskTest_cl0:
StartTaskTest_cl0: Start processing...
StartTaskTest_cl0: Processing complete.
StartTaskTest_cl0: ProcessEvents_return
OUTPUT FROM SOMESERVICE2
StartTaskTest_cl0: processing loop listening
StartTaskTest_cl0:
Traceback:
SomeService2.StartImmediate at line 1
TestWin.Display at line 4
C++ Method(s)
UserApp.Run at offset 105
StartTaskTest_cl0:
StartTaskTest_cl0: Start processing...
StartTaskTest_cl0: Processing complete.
StartTaskTest_cl0: ProcessEvents_return
StartTaskTest_cl0:
Traceback:
SomeService2.StartImmediate at line 1
SomeService2.ProcessingLoop at line 9
StartTaskTest_cl0:
StartTaskTest_cl0: Start processing...
StartTaskTest_cl0: Processing complete.
StartTaskTest_cl0: ProcessEvents_return
SOMESERVICE1 CLASS
begin CLASS;
class SomeService1 inherits from Framework.Object
has public attribute proc: StartTaskTest.Processor;
has public attribute processing: Framework.boolean;
has public method Init;
has public method ProcessingLoop;
has public method StartImmediate;
has property
shared=(allow=off, override=on);
transactional=(allow=off, override=on);
monitored=(allow=off, override=on);
distributed=(allow=on, override=on, default=off);
end class;
method SomeService1.Init
begin
super.Init();
processing = FALSE;
proc = new;
start task ProcessingLoop();
end method;
method SomeService1.ProcessingLoop
begin
timer : Timer = new;
timer.tickInterval = 10000;
event loop
task.part.logmgr.putline('processing loop
listening');
timer.isActive = TRUE;
when timer.tick do
StartImmediate();
when proc.ProcessEvents_return do
task.part.logmgr.putline('ProcessEvents_return');
processing = FALSE;
when proc.ProcessEvents_exception do
task.part.logmgr.putline('ProcessEvents_exception');
processing = FALSE;
when task.shutdown do
exit;
end event;
end method;
method SomeService1.StartImmediate
begin
task.part.logmgr.putline(task.traceBack());
processing = TRUE;
start task proc.ProcessEvents() where completion =
event;
end method;
end CLASS;
SOMESERVICE2 CLASS
begin CLASS;
class SomeService2 inherits from Framework.Object
has public attribute proc: StartTaskTest.Processor;
has public attribute processing: Framework.boolean;
has public event StartProcessing;
has public method Init;
has public method ProcessingLoop;
has public method StartImmediate;
has property
shared=(allow=off, override=on);
transactional=(allow=off, override=on);
monitored=(allow=off, override=on);
distributed=(allow=on, override=on, default=off);
end class;
method SomeService2.Init
begin
super.Init();
processing = FALSE;
proc = new;
start task ProcessingLoop();
end method;
method SomeService2.ProcessingLoop
begin
timer : Timer = new;
timer.tickInterval = 10000;
event loop
task.part.logmgr.putline('processing loop
listening');
timer.isActive = TRUE;
when timer.tick do
StartImmediate();
when self.StartProcessing do
processing = TRUE;
start task proc.ProcessEvents() where completion =
event;
when proc.ProcessEvents_return do
task.part.logmgr.putline('ProcessEvents_return');
processing = FALSE;
when proc.ProcessEvents_exception do
task.part.logmgr.putline('ProcessEvents_exception');
processing = FALSE;
when task.shutdown do
exit;
end event;
end method;
method SomeService2.StartImmediate
begin
task.part.logmgr.putline(task.traceBack());
post StartProcessing;
end method;
end CLASS;
PROCESSOR CLASS
begin CLASS;
class Processor inherits from Framework.Object
has public method Init;
has public method ProcessEvents where completion =
(return = ProcessEvents_return, exception =
ProcessEvents_exception);
has property
shared=(allow=off, override=on);
transactional=(allow=off, override=on);
monitored=(allow=off, override=on);
distributed=(allow=off, override=on);
end class;
method Processor.Init
begin
super.Init();
end method;
method Processor.ProcessEvents
begin
task.part.logmgr.putline('Start processing...');
task.Delay(msecs = 1500);
task.part.logmgr.putline('Processing complete.');
end method;
end CLASS;
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comYes, you're right. The return event is queued until the moment that you
actually enter an eventloop. I stand corrected.
Pascal Rottier
Atos Origin Nederland (BAS/West End User Computing)
Tel. +31 (0)10-2661223
Fax. +31 (0)10-2661199
E-mail: Pascal.Rottiernl.origin-it.com
++++++++++++++++++++++++++++
Philip Morris (Afd. MIS)
Tel. +31 (0)164-295149
Fax. +31 (0)164-294444
E-mail: Rottier.Pascalpmintl.ch
-----Original Message-----
From: Adamek, Zenon [mailto:ZAdamekpurolator.com]
Sent: Thursday, January 18, 2001 6:13 PM
To: Rottier, Pascal
Cc: 'forte-userslists.xpedior.com'
Subject: RE: (forte-users) Confusion with return event
I think it is always safe to use start task with where complition = event
clause before event loop. The reason is described in Forte Help in the
Complition Clause index:
"Requesting the return and exception events automatically registers the
events for the calling task. When the asynchronous method completes or
terminates, Forté adds the appropriate event to the calling task's event
queue.
This registration is unlike the event registration for the event statement.
In the event statement, the event is registered just before the event
statement is ready to process the event. In the start task statement, the
return and exception events are registered when the task is started, even
though it can be much later on that your application is prepared to wait for
those events. Therefore, only the "parent" task that executes the start task
statement is registered for the completion event of the started task."
and some comments from "Forte Performance and Patterns" page 18:
"When you use the where completion = event clause in the start task
statement, Forte automatically buffer the return event until you register
for it. Therefore, you do not need to worry about the child task completing
before you register for its return event".
Regards,
Zenon
-----Original Message-----
From: Rottier, Pascal [SMTP:Rottier.Pascalpmintl.ch]
Sent: Thursday, January 18, 2001 11:16 AM
To: 'Samer Kanjo'; ForteUsers
Subject: RE: (forte-users) Confusion with return event
Yes, if you want the eventloop of the service object to be informed when
the
method on the processor class is invoked, regardless of who invoked it,
then
you should simply post an event as the last statement inside the method on
the processor class.
The return events are only used to inform a partent task that a child-task
has completed. So, only the calling task receives the event, only if the
calling task is inside an event-loop at the moment the child-task
terminates
and only if there really is a child task (method started using "start task
Note, that the calling task doesn't have to be inside an event loop when
the
asynchronous call is made. It has to be inside an eventloop when the
asynchronous task terminates. The following piece of code works just as
well:
SomeService1.StartImmediate();
self.DoSomeOtherStuff();
event loop
when SomeService1.Proc.ProcessEvent_return do
task.Part.Logmgr.Putline('ProcessEvents_return');
when SomeService1.Proc.ProcessEvent_exception do
task.Part.Logmgr.Putline('ProcessEvents_exception');
end event;
However, if the asynchronous task started from within "StartImmediate"
finishes before the client gets a chance to enter its event loop, then
you're too late to catch the event. That's why it's safer to use the
"postregister" function, which makes sure a certain action is not started
untill all events from the event loop have been registered.
Pascal Rottier
Atos Origin Nederland (BAS/West End User Computing)
Tel. +31 (0)10-2661223
Fax. +31 (0)10-2661199
E-mail: Pascal.Rottiernl.origin-it.com
++++++++++++++++++++++++++++
Philip Morris (Afd. MIS)
Tel. +31 (0)164-295149
Fax. +31 (0)164-294444
E-mail: Rottier.Pascalpmintl.ch
-----Original Message-----
From: Samer Kanjo [mailto:skanjoyahoo.com]
Sent: Thursday, January 18, 2001 5:04 PM
To: ForteUsers
Subject: RE: (forte-users) Confusion with return event
Pascal,
So you are confirming that a return event can only be
received in an event loop if a task is started from
within that event loop.
After making your proposed changes I was able to
receive the return event in the window.
I originally wanted the SomeService event loop to
always receive the return event regardless of whether
or not StartImmediate is called by some other entity
or called when the timer ticks. It seems that the only
way to do this is with events. Is that correct?
Thank you for insight,
Samer Kanjo
--- "Rottier, Pascal" <Rottier.Pascalpmintl.ch>
wrote:
Samer,
The return event is delivered to the calling task,
which is the window in
your first test. It is not deliverd to the event
loop of the service object
unless the call to the processor originated in the
event loop, which is the
case in your second test. The output you get from
the server is exactly as I
would expect.
You need the following code in you client:
event loop
postregister
SomeService1.StartImmediate();
when SomeService1.Proc.ProcessEvent_return do
task.Part.Logmgr.Putline('ProcessEvents_return');
when SomeService1.Proc.ProcessEvent_exception do
task.Part.Logmgr.Putline('ProcessEvents_exception');
end event;
Note that this logoutput will not be written to a
logfile, but will appear
in the logwindow which is opened when you start a
client application.
Pascal Rottier
Atos Origin Nederland (BAS/West End User Computing)
Tel. +31 (0)10-2661223
Fax. +31 (0)10-2661199
E-mail: Pascal.Rottiernl.origin-it.com
++++++++++++++++++++++++++++
Philip Morris (Afd. MIS)
Tel. +31 (0)164-295149
Fax. +31 (0)164-294444
E-mail: Rottier.Pascalpmintl.ch--
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com -
how do i open a web page with VeriSign Class 3 Extended Validation SSL SGC SS CA ?
Hi
I am not suprised no one answered your questions, there are simply to many of them. Can I suggest you read the faq on 'how to get help quickly at - http://forums.adobe.com/thread/470404.
Especially the section Don't which says -
DON'T
Don't post a series of questions in a single post. Splitting them into separate threads increases your chances of a quick answer.
PZ
www.pziecina.com -
Control Animated Gif with ImageAnimator Class
Here is something I just found that some of you may like. You can use the
ImageAnimator Class to run Animated Gifs in vb.net.
Public Class Form9
Private animatedImage As Bitmap = Image.FromFile("C:\bitmaps\animated gifs\hopping rabbit 2 - animated.gif")
Private Sub Form9_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Button1.Text = "Start"
Me.BackColor = Color.Teal
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Button1.Text = "Stop" Then
ImageAnimator.StopAnimate(animatedImage, New EventHandler(AddressOf Me.OnFrameChanged))
Button1.Text = "Start"
Else
'Begin the animation.
ImageAnimator.Animate(animatedImage, New EventHandler(AddressOf Me.OnFrameChanged))
Button1.Text = "Stop"
End If
End Sub
Private Sub Form9_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
'Get the next frame ready for rendering.
ImageAnimator.UpdateFrames()
'Draw the next frame in the animation.
e.Graphics.DrawImage(Me.animatedImage, New Point(0, 0))
End Sub
Private Sub OnFrameChanged(ByVal o As Object, ByVal e As EventArgs)
'Force a call to the Paint event handler.
Me.Invalidate()
End Sub
End ClassHey Tom,
Yes the ImageAnimator is a handy class for showing animated Gif images. I looked at it when making the Playback panel on my Gif Creator program. I could not use it though because, i would of had to create the Gif image before i could play it back
and being my images are all single images i was stuck using a Timer to show each one.
I wish there was a way to use a list of single images with this class. It would have been much less work. 8)
If you say it can`t be done then i`ll try it
Yeah, I see that it is not enough for your Gif Creator.
I just did not know about it and was using the gif strip to manually make a list of all the gif frames and showing individually with a timer. This class does it and a couple other things much easier. -
Report of posted Deprecation with ASSET CLASS
Hi Gurus,
We require a depreciation simuation report with Asset class as mandatory one.
Could you please tell me path and t-code for the above said report.
Regards,
Praveen.Hi Praveen,
You mentined before you wanted to view depreciation simulation, for this RASIMU02 is the report to use.
However, if you want to see depreciation planned /and or posted you can use the Asset Balance RABEST_ALV01. If you click on the indicator "current book value" you will see the actually posted depreciation and current Netbook Value. Also in this report you can enter the Asset Class in the selection parameters.
Regarding viewing the note I forwarded to you previously: you can view it via the SAP Portal - http://help.sap.com/. If you go to SAP ERP tab, you will see on the right hand side pannel a link to SAP Notes. Here you can view any note.
I hope this helps further.
Kind regards,
Brigitte -
How can i erase an account with relationship with some class of tax
how can i erase an account with relationship with some class of tax
Hi Enrique,
I am not sure what you mean by this, can you please explain in more detail? You cannot erase accounts that already have transactions posted to it.
Hope it helps,
Adele -
Is Verizon going to end up with a Class Action Lawsuit regarding the Trade-In Scam?
I notice I'm not the first to report this issue. In fact, after reading the horror stories in the community, I'm questioning if going with Verizon Wireless and/or using their online trade-in program was the right thing to do. I see so many other people experiencing the same nightmare, I figure it's just a matter of time until there's a Class Action Lawsuit against them regarding their Trade-in Scam of 2014.
I was lured to Verizon by their promotion of receiving $200 for my iPhone 4s. I pre-ordered my iPhone 6 online on 9/12. Following the check-out, I was given the option to complete the online trade-in program. My iPhone 4s was in perfect condition as it was kept in a LifeProof case since day 1. Being in that condition made it eligible for the full $200 trade-in value.
My iPhone 6 arrived on time. I transferred my data from the iPhone 4s to the iPhone 6. Then ensured the 'find my phone' feature was turned off, all passwords unlocked and factory reset completed. Then I fully charged the phone and turned it off prior to packing into the provided trade-in program materials/envelope.
I was a little concerned about the trade-in program materials/envelope. The envelope itself was nothing more than a padded envelope. It was a pre-printed business reply envelope. No tracking number other than a bar code with my submission id on it and then stamped with the word PROMO. I was hesitant to drop it in a mailbox so I took it right into my local post office. That was on 9/23.
I started checking the trade-in status a week later but the status was 'Not Received'. Another week later, same thing. Finally, I reached out to the trade-in program via email on 10/11. I received a 'canned' response back on 10/16 that I should wait 4-6 weeks for my gift card. That time period includes a 2-3 for inspection and processing from the date of receipt at the warehouse.
On 10/25, I reached out again to the trade in program via email. On 10/26, I received the very same response... word for word. I reached out again on 11/7 and they didn't even reply. I tried calling but got no where by phone. They claim they'll escalate the issue but I never hear back.
I really feel scammed out of $200 by using this online trade-in program. The guideline stipulated that I must use the supplied packing materials and envelope or the promotion amount would not be guaranteed; however, without tracking there is no way to know where the phone is.
Come on Verizon... you lured me in, now do the right thing and send me the $200 gift card I was promised.I've gone through the same process as you've described with a different twist. They advised me that the screen on
my phone was cracked. They are sending me $36 instead of the Appraised Value of $200. I'm not an Attorney
but I would bet it would be an easy win over Verizon in a Class Action, because this whole process smells
bad. There must be tens of thousands of people getting ripped off and they're not all liars, which is what Verizon would have a judge believe. Contract or no contract, most states prohibit Agreements that would negate consumer protection
from fraudulent business practices.
Verizon may play hardball with it's disenchanted customers and there isn't much you can do as an individual.
This just happened with me on one phone and I'm waiting for news of a second phone that I sent at the same time.
In the meantime I will visit the Verizon Store and talk to the salesperson who sold me the two new iPhone 6's
and see what he can do. I will also contact my local Better Business Bureau office for their advice. If there's no satisfaction, I will keep the phones, stop paying my bill and get a new carrier. They can take me to court, but I will be there first in@ Small Claims Court. I'm retired so I have time to do this stuff, but most people can't, so the best bet is still a
good Lawyer with a Class Action Suit and lots of negative publicity in the papers and the internet.
Maybe you are looking for
-
Cannot send mail from my Iphone 4S ?! Please help ...
Hello, I am able to receive my mail on my Iphone 4S (hotmail account) but cannot send. I get a message : the mail server ''pop3 live.com'' is not responding. Verify that you have entered the correct account info in Mail settings. I have checked all i
-
PUT BACK THE MISSING THE SCREEN FUNCTION IN THE PRINT DIALOG BOX!!!!
Hello all... I am a creative director in the screen print (garment industry) for over 20 years. We have always used PS to directly print and control our halftone screens and angles through the screen function in the print dialog box. Now it has mir
-
How to set the height of a textarea dynamically
Hi, I have been trying to set the ui.textarea's height dynamically and I am not able to do it. This is what I am doing. <ui:textArea binding="#{assignment$EditResult.textArea2}" id="textArea2" style="height: 90%" text="#{currentRow.value['comments']}
-
Am trying to transfer my apps from my iPad to my new iMac computer
how do i transfer my ipad apps to my imac computer?
-
HCM Processes and forms - Inclusion of field in line structure.
Hi, My requirement is to include a "wage type % increase" (Custom field) in one of the processes i had configured for change in pay. In the existing process, When the manaer initiates the change in pay process for a subordinate, the form would defual