Class interaction
I'm a bit stuck:
How would I go about transferring Strings from an ActionListener class to another class and using those Strings as instance variables to create an object in the class I am transferring to.
It's a bit complicated to understand, but here is my code for part of the ActionListener class:
public void actionPerformed(ActionEvent event) {
if (event.getSource() == "addButton") {
getName = gui.getNameInfo();
getDisplay = gui.getDisplayInfo();
getWork = gui.getWorkInfo();
getHome = gui.getHomeInfo();
getMobile = gui.getMobileInfo();
}I've also got another class (a subclass of an abstract class) where I want these String variables to go and use themselves to create an object.
I think I know what you mean, but not entirely sure, so how about this:
In the constructor to your gui class where you capture the strings, pass in an ArrayList.
Then every time you create a new address object, add that object to the ArrayList.
Something like ArrayList.add(address);
Just note though - you must create the ArrayList outside your gui class, so that when you pass it in the constructor, it is already created. If you try to create a new one inside your constructor, you won't be able to see it from the class that calls your constructor.
so:
public class myGuiClass{
ArrayList arrayOfAddresses;
myGuiClass(ArrayList arrayOfAddresses){
this.arrayOfAddresses = arrayOfAddresses;
You can then use the ArrayList inside your GUI class, and when you exit the class and the class is destroyed, the ArrayList will still exist in the calling class.
And how to treat the names of the objects? If you wanted you could give each object a unique field - a name might be duplicated in a large address book, so consider giving them unique ids.
You might also want to read up on how to use HashMap to store your address objects.
Similar Messages
-
Making separate classes interact
For an AI program I am making I need to get two programs interacting - I am doing this by using sockets and a threads.
This program is a smaller version of th AI program. There are two of these programs - opposites i.e. where one says female the other says male and so on.
Ok this is what should happen:
-Program starts and background threads starts with it (always reading input).
-Command is issued by the other program ("mate").
-This triggers the connect() method which sends a command to the other program (action triggered) therefore they have interacted.
Please give me any hints as to why this does not work.
Thanks
John
import java.util.Scanner;
import java.util.Vector;
import java.util.Random;
import java.io.*;
import java.net.ConnectException;
import java.net.ServerSocket;
import java.net.Socket;
//set path="C:\Program Files\Java\jdk1.5.0_08\bin"
public class AIPetTest
public Socket socket = null;
public String command = "";
public static Vector<String> commands = null;
public String line = null;
public String start()
backgroundThread.start();
Scanner command = new Scanner(System.in);
String commandIssued = command.nextLine();
if(commandIssued.equals("mate"))
try
connect("mate");
catch(Exception e)
System.err.println("Caught Exception: " + e.getMessage());
return null;
public void connect(String update) throws Exception
System.out.println(update);
try
System.out.println("Connection made");
socket = new Socket("localhost", 1977); // throws Exception below, if no connection is possible
catch(ConnectException ce)
System.out.println("Connection lost");
socket = new ServerSocket(1977).accept();
// no connection was possible, so make app server
//socket = new ServerSocket(1977).accept();
// be aware that accept is blocking!
command = commands.remove(0); // Take the 1st object out
System.out.println("Command: " + command);
if(command.equals("updateMale")) // incoming
System.out.println("Mating");
socket.getOutputStream().write(("updateFemale").getBytes());
//socket.close();
Thread backgroundThread = new Thread(new Runnable() // reads all incoming messages and stores them in a vector
public void run()
System.out.println("Thread running");
commands = new Vector<String>();
try
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while(true)
line = in.readLine();
if(line == null)
break; // out of the while
commands.add(new String(line + '\n'));
in.close();
catch(IOException ioe)
System.err.println("Caught Exception: " + ioe.getMessage());
public static void main(String[] args)
AIPetTest pet = new AIPetTest();
pet.start();
}Both programs need to be a server and a client as
they need to interact each way i.e. "mate" can be
input in each program.
A socket connection always has a server and a client. The client must always connect to the server.
Once a connection exists you can send messages both ways.
You could create two connections but that sounds like an unlikely scenario.
I know a bit about socket programming in Java as I
have made a remote admin tool before.
I have to make each program always listen for
commands - can you tell me if the thread does this?A socket either sends or gets messages. When it gets a message it does something. That has nothing to do with how the connection is established though. -
Nested Classes and Static Methods
I was perusing the Java Tutorials on Nested Classes and I came across this...
[http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html|http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html]
I was reading the documentation and I read a slightly confusing statement. I was hoping some further discussion could clarify the matter. The documentation on "Nested Classes" says (I highlighted the two statements, in bold, I am having trouble piecing together.)
Static Nested Classes
As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class ? it can use them only through an object reference.
Note: A static nested class interacts with the instance members of its outer class (and other classes) just like any other top-level class. In effect, a static nested class is behaviorally a top-level class that has been nested in another top-level class for packaging convenience.
So this means a nested static inner class CANNOT refer to its own instanced variables, like a normal static method, but CAN refer to its outer class instanced variables?So this means a nested static inner class CANNOT refer to its own instanced variables, like a normal static method, but CAN refer to its outer class instanced variables?No, it means that a static nested class cannot refer to instance variables of its enclosing class. Example:public class Foo {
int i;
static class Bar {
int j = i; // WRONG! Bar class is static context
}~ -
Looking for information about AS3 sound classes in "audio" wrong places?
I'm looking for in depth information about ActionScript 3.0 sound classes. No matter where I search I continually encounter the same sort of kindergarten level descriptions, which never teach more than what we can readily glean from Adobe's documentation. Someone must know where there a discussion that really gets to the heart of the matter.
I've read Adobe's LiveDocs on the Sound, SoundChannel, SoundMixer, SoundTransform classes. Indeed, they provided me enough guidance to create my own streaming MP3 player, with volume, pan, my own custom mono mix, http request, a preloading animation, and peak meters ...
Here's an example (in the last statement of the following code) where I understand the end effect, but I fail to comprehend what happens at the compiler level:
var currentSoundSource:Sound = new Sound();
currentSoundSource.load(new URLRequest("http://www.mySite.com/myRecording.mp3"));
var audioChannel_01:SoundChannel = new SoundChannel();
audioChannel_01 = currentSoundSource.play();
Unfortunately the class definitions in LiveDocs are quite terse, and they're seemingly incomplete with respect to:
• advice on best practices
• a thorough coverage of class to class interactivity
• a description of exactly how audio streams/plays into channels
... and in certain cases it appears that Adobe's descriptions are not fully accurate.*
Regarding best practices, at first blush I'm sure everyone ponders over the fact that SoundChannel and SoundMixer have a stop method while the Sound class does not.
One assumes that this surprising design must bear some advantages. If so, what are they? Where are the analog sound mixer analogies? What would be the disadvantage of a sound class with a stop method ... particularly when they have their own play method?
Where are the discussion of these concepts? (Even if Adobe hired the wrong guy to write its sound classes, there should be some follow through that thoroughly explains the existing situation.)
Phrankie
* Here's an instance where the docs appear to be partially in error. (Is "and play" mistakenly included in the following?)
"The Sound class lets you lets you create a new Sound object [and] load and play an external MP3 file into that object."
... uh, mmmmmm ... we play an MP3 into a sound class object?
Wouldn't it be more accurate to say the following:
A soundChannel can receive the audio data from a sound class object. We can play a sound object into an SoundChannel and manipulate it by altering the SoundChannel's soundTransform property, and we can stop it with the SoundChannel's stop method.check everything you can find written by tinic uro. this will get you started: http://www.kaourantin.net/
-
[Solved] Python Tkinter Frame interaction
I am trying to have a form talk to another one as per exemple below. I cannot find a way to make this work. What am I doing wrong or missing
from tkinter import *
from tkinter import ttk
class FirstFrame():
def __init__(self,root):
self.root=root
self.frame=Frame(self.root)
self.PlaceLeftButton()
self.PlaceLabel()
def PlaceLeftButton(self):
self.btn=ttk.Button(self.root,text='Open Child Form',command=self.OpenChild)
self.btn.grid(column=0,row=0)
def PlaceLabel(self):
self.lbl=ttk.Label(self.root, text='At Start')
self.lbl.grid(column=1,row=0)
def OpenChild(self):
top=Toplevel(self.root)
self.child=ChildFrame(top)
class ChildFrame():
def __init__(self, root):
self.root=root
self.childframe=Frame(self.root)
self.PlaceLeftButton()
self.PlaceEntryField()
def PlaceLeftButton(self):
self.btn=Button(self.root,text='Reset parent form', command=self.SetParentValue)
self.btn.grid(column=0,row=0)
def PlaceEntryField(self):
self.entry=Entry(self.root)
self.entry.grid(column=0, row=1)
def SetParentValue(self):
self.root.lbl(text='Parent has been reset')
if __name__=='__main__':
root = Tk()
root.option_add('*font', ('verdana', 12, 'bold'))
root.title("Class Interaction")
display = FirstFrame(root)
root.mainloop()
I should add, it is the SetParentValue method I have no clue how to handle.
Last edited by marxav (2011-03-14 16:21:45)Got an answer here : http://bytes.com/topic/python/answers/9 … nteraction
-
Take your pick from six live, online training classes being offered this summer by North Pole Engineering. (Actually they’re only as far north as Minnesota, but still….)
Here’s North Pole Engineering’s summer online class lineup:
Class
Registration Cutoff
Start Date
Essentials of FPGA Design
6/29/2015
7/2/2015
Vivado Design Suite Advanced XDC and STA
7/7/2015
7/14/2015
Designing with the UltraScale Architecture
7/13/2015
7/20/2015
VHDL and Advanced VHDL, Condensed
7/22/2015
7/29/2015
Essentials of FPGA Design
8/17/2015
8/24/2015
Zynq SoC Training for Experienced FPGA Designers
8/19/2015
8/26/2015
These are live, fully interactive classes with 2-way video and audio and a low student/instructor ratio for more effective class interaction. There’s also post-training support via email.
For more detailed info or to register, click here or call North Pole Engineering at (612) 305-0440 x225.
Note: North Pole Engineering is a Xilinx authorized training provider.
Take your pick from six live, online training classes being offered this summer by North Pole Engineering. (Actually they’re only as far north as Minnesota, but still….)
Here’s North Pole Engineering’s summer online class lineup:
Class
Registration Cutoff
Start Date
Essentials of FPGA Design
6/29/2015
7/2/2015
Vivado Design Suite Advanced XDC and STA
7/7/2015
7/14/2015
Designing with the UltraScale Architecture
7/13/2015
7/20/2015
VHDL and Advanced VHDL, Condensed
7/22/2015
7/29/2015
Essentials of FPGA Design
8/17/2015
8/24/2015
Zynq SoC Training for Experienced FPGA Designers
8/19/2015
8/26/2015
These are live, fully interactive classes with 2-way video and audio and a low student/instructor ratio for more effective class interaction. There’s also post-training support via email.
For more detailed info or to register, click here or call North Pole Engineering at (612) 305-0440 x225.
Note: North Pole Engineering is a Xilinx authorized training provider.
-
Proper GUI classes decomposition
Hello,
I would ask for advice more experienced programmers how do you implement dependencies between business logic and GUI. In particular decomposition of GUI into classes - interactions between them, how it's everything connected with business logic.
Let's say I have couple of windows (panes) on which are placed text fields, buttons and other controls. For each one I create separate class - but what I should put into this class? Definition of controls, those appearance, placement on panes, resize behavior? Should I also in this class attach actions to those controls? Or should I create the separate class defining those actions?
Now about data model (MVC pattern) - I assume that it's a bridge between business logic and GUI, but how to connect it properly and attach to window? (Which class create which one, which one holds a reference to another and so on...)
As an example let's take a window with two text fields and one button. The content of one text field is defined somewhere in business logic - it's the output of some algorithm. Second text field is an input, and the button starts the algorithm. So it's something like:
public class BusinessLogic {
String algorithmInput;
String algorithmOutput;
String runAlgorithm(String iput) {
// something
}How should I write GUI for this? (classes decomposition and references between them)
Thanks in advance for all your advices and for patience for beginner programmer :)I generally go by this rule of thumb:
The middle tier objects usually have, at least, 2 layers in them--
layer 1 -- UI support, this includes all of the rules and structure to allow the data to be easily collected/viewed by the user--they are structured around the UI and how the users want to view their data.
layer 2 -- actual DB interface objects needed to facilitate data transfer to and from the DB and to make sure integerty is enforced.
These layers can be subdevided as needed and even other layers may be added depending on project requirments. -
Java.lang.VerifyError - Incompatible object argument for function call
Hi all,
I'm developing a JSP application (powered by Tomcat 4.0.1 in JDK 1.3, in Eclipse 3.3). Among other stuff I have 3 classes interacting with an Oracle database, covering 3 use cases - renaming, adding and deleting an database object. The renaming class simply updates the database with a String variable it receives from the request object, whereas the other two classes perform some calculations with the request data and update the database accordingly.
When the adding or deleting classes are executed, by performing the appropriate actions through the web application, Tomcat throws the following:
java.lang.VerifyError: (class: action/GliederungNewAction, method: insertNewNode signature: (Loracle/jdbc/driver/OracleConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V) Incompatible object argument for function call
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at action.ActionMapping.perform(ActionMapping.java:53)
at ControllerServlet.doResponse(ControllerServlet.java:92)
at ControllerServlet.doPost(ControllerServlet.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
...The renaming works fine though. I have checked mailing lists and forums as well as contacted the company's java support but everything I have tried out so far, from exchanging the xerces.jar files found in JDOM and Tomcat to rebuidling the project didn't help.
I just can't explain to myself why this error occurs and I don't see how some additional Java code in the other 2 classes could cause it?
I realize that the Tomcat and JDK versions I'm using are totally out of date, but that's company's current standard and I can't really change that.
Here's the source code. I moved parts of the business logic from Java to Oracle recently but I left the SQL statements that the Oracle stored procedures are executing if it helps someone.
package action;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import oracle.jdbc.driver.OracleConnection;
* This class enables the creation and insertion of a new catalogue node. A new node
* is always inserted as the last child of the selected parent node.
public class GliederungNewAction implements Action {
public String perform(ActionMapping mapping, HttpServletRequest request,
HttpServletResponse response) {
// fetch the necessary parameters from the JSP site
// the parent attribute is the selected attribute!
String parent_attribute = request.getParameter("attr");
String catalogue = request.getParameter("catalogue");
int parent_sequenceNr = Integer.parseInt(request.getParameter("sort_sequence"));
// connect to database
HttpSession session = request.getSession();
db.SessionConnection sessConn = (db.SessionConnection) session.getAttribute("connection");
if (sessConn != null) {
try {
sessConn.setAutoCommit(false);
OracleConnection connection = (OracleConnection)sessConn.getConnection();
int lastPosition = getLastNodePosition( getLastChildAttribute(connection, catalogue, parent_attribute) );
String newNodeAttribute = createNewNodeAttribute(parent_attribute, lastPosition);
// calculate the sequence number
int precedingSequenceNumber = getPrecedingSequenceNumber(connection, catalogue, parent_attribute);
if ( precedingSequenceNumber == -1 ) {
precedingSequenceNumber = parent_sequenceNr;
int sortSequence = precedingSequenceNumber + 1;
setSequenceNumbers(connection, catalogue, sortSequence);
// insert the new node into DB
insertNewNode(connection, catalogue, newNodeAttribute, parent_attribute, "Neuer Punkt", sortSequence);
connection.commit();
} catch(SQLException ex) {
ex.printStackTrace();
return mapping.getForward();
* Creates, fills and executes a prepared statement to insert a new entry into the specified table, representing
* a new node in the catalogue.
private void insertNewNode(OracleConnection connection, String catalogue, String attribute, String parent_attribute, String description, int sortSequence) {
try {
String callAddNode = "{ call fasi_lob.pack_gliederung.addNode(:1, :2, :3, :4, :5) }";
CallableStatement cst;
cst = connection.prepareCall(callAddNode);
cst.setString(1, catalogue);
cst.setString(2, attribute);
cst.setString(3, parent_attribute);
cst.setString(4, description);
cst.setInt(5, sortSequence);
cst.execute();
cst.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
// String insertNewNode = "INSERT INTO vstd_media_cat_attributes " +
// "(catalogue, attribute, parent_attr, description, sort_sequence) VALUES(:1, :2, :3, :4, :5)";
// PreparedStatement insertStmt;
// try {
// insertStmt = connection.prepareStatement(insertNewNode);
// insertStmt.setString(1, catalogue);
// insertStmt.setString(2, attribute);
// insertStmt.setString(3, parent_attribute);
// insertStmt.setString(4, description);
// insertStmt.setInt(5, sortSequence);
// insertStmt.execute();
// insertStmt.close();
// } catch (SQLException e) {
// e.printStackTrace();
* This method returns the attribute value of the last child of the parent under which
* we want to insert a new node. The result set is sorted in descending order and only the
* first result (that is, the last child under this parent) is fetched.
* If the parent node has no children, "parent_attr.0" is returned.
* @param connection
* @param catalogue
* @param parent_attribute
* @return attribute of the last child under this parent, or "parent_attr.0" if parent has no children
private String getLastChildAttribute(OracleConnection connection, String catalogue, String parent_attribute) {
String queryLastChild = "SELECT attribute FROM vstd_media_cat_attributes " +
"WHERE catalogue=:1 AND parent_attr=:2 ORDER BY sort_sequence DESC";
String lastChildAttribute;
PreparedStatement ps;
try {
ps = connection.prepareStatement(queryLastChild);
ps.setString(1, catalogue);
ps.setString(2, parent_attribute);
ResultSet rs = ps.executeQuery();
/* If a result is returned, the selected parent already has children.
* If not set the lastChildAttribute to parent_attr.0
if (rs.next()) {
lastChildAttribute = rs.getString("attribute");
} else {
lastChildAttribute = parent_attribute.concat(".0");
rs.close();
return lastChildAttribute;
} catch (SQLException e) {
e.printStackTrace();
return null;
* This helper method determines the position of the last node in the attribute.
* i.e for 3.5.2 it returns 2, for 2.1 it returns 1 etc.
* @param attribute
* @return position of last node in this attribute
private int getLastNodePosition(String attribute) {
StringTokenizer tokenizer = new StringTokenizer(attribute, ".");
String lastNodePosition = "0";
while( tokenizer.hasMoreTokens() ) {
lastNodePosition = tokenizer.nextToken();
return Integer.parseInt(lastNodePosition);
* This method calculates the attribute of a node being inserted
* by incrementing the last child position by 1 and attaching the
* incremented position to the parent.
* @param parent_attr
* @param lastPosition
* @return attribute of the new node
private String createNewNodeAttribute(String parent_attr, int lastPosition) {
String newPosition = new Integer(lastPosition + 1).toString();
return parent_attr.concat("." + newPosition);
* This method checks if the required sequence number for a new node is already in use and
* handles the sequence numbers accordingly.
* If the sequence number for a new node is NOT IN USE, the method doesn't do anything.
* If the sequence number for a new node is IN USE, the method searches for the next free
* sequence number by incrementing the number by one and repeating the query until no result
* is found. Then all the sequence numbers between the required number (including, >= relation)
* and the nearest found free number (not including, < relation) are incremented by 1, as to
* make space for the new node.
* @param connection
* @param catalogue
* @param newNodeSequenceNumber required sequence number for the new node
private void setSequenceNumbers(OracleConnection connection, String catalogue, int newNodeSequenceNumber) {
// 1. check if the new sequence number exists - if no do nothing
// if yes - increment by one and see if exists
// repeat until free sequence number exists
// when found increment all sequence numbers freeSeqNr > seqNr >= newSeqNr
String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
"WHERE catalogue=:1 AND sort_sequence=:2";
PreparedStatement ps;
try {
ps = connection.prepareStatement(query);
ps.setString(1, catalogue);
ps.setInt(2, newNodeSequenceNumber);
ResultSet rs = ps.executeQuery();
// if no result, the required sequence number is free - nothing to do
if( rs.next() ) {
int freeSequenceNumber = newNodeSequenceNumber;
do {
ps.setString(1, catalogue);
ps.setInt(2, freeSequenceNumber++);
rs = ps.executeQuery();
} while( rs.next() );
// increment sequence numbers - call stored procedure
String callUpdateSeqeunceNrs = "{ call fasi_lob.pack_gliederung.updateSeqNumbers(:1, :2, :3) }";
CallableStatement cst = connection.prepareCall(callUpdateSeqeunceNrs);
cst.setString(1, catalogue);
cst.setInt(2, newNodeSequenceNumber);
cst.setInt(3, freeSequenceNumber);
cst.execute();
cst.close();
// String query2 = "UPDATE vstd_media_cat_attributes " +
// "SET sort_sequence = (sort_sequence + 1 ) " +
// "WHERE catalogue=:1 sort_sequnce >=:2 AND sort_sequence <:3";
// PreparedStatement ps2;
// ps2 = connection.prepareStatement(query2);
// ps2.setString(1, catalogue);
// ps2.setInt(2, newNodeSequenceNumber);
// ps2.setInt(3, freeSequenceNumber);
// ps.executeUpdate();
// ps.close();
} // end of if block
rs.close();
} catch (SQLException e) {
e.printStackTrace();
* This method finds the last sequence number preceding the sequence number of a node
* that is going to be inserted. The preceding sequence number is required to calculate
* the sequence number of the new node.
* We perform a hierarchical query starting from the parent node: if a result is returned,
* we assign the parent's farthest descendant's node sequence number; if no result
* is returned, we assign the parent's sequence number.
* @param connection
* @param catalogue
* @param parent_attr parent attribute of the new node
* @return
private int getPrecedingSequenceNumber(OracleConnection connection, String catalogue, String parent_attr) {
int sequenceNumber = 0;
String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
"WHERE catalogue=:1 " +
"CONNECT BY PRIOR attribute = parent_attr START WITH parent_attr=:2 " +
"ORDER BY sort_sequence DESC";
try {
PreparedStatement ps = connection.prepareStatement(query);
ps.setString(1, catalogue);
ps.setString(2, parent_attr);
ResultSet rs = ps.executeQuery();
if ( rs.next() ) {
sequenceNumber = rs.getInt("sort_sequence");
} else {
// TODO: ggf fetch from request!
sequenceNumber = -1;
rs.close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
return sequenceNumber;
}After further googling I figured out what was causing the problem: in eclipse I was referring to external libraries located in eclipse/plugins directory, whereas Tomcat was referring to the same libraries (possibly older versions) in it's common/lib directory.
-
Business Activity in SAP CRM 7.0 WebUI
Hello SAP Experts,
In SAP CRM 7.0, under maintain activities, I have assigned categories to class interaction log, appointments and tasks.
The same categories have been assigned to some business activities. For example Category Sales Call (001) is assigned to Interaction Log. The sales call is in turn assigned to Transaction Type- Business Activity.
When I log on to web ui, I am able to see this business activity under Interaction Log and create the transaction.
In the same way, when I assign category u2013CX4 (Telephone Call) to class Phone Call to a Transaction Type-Sales Call (0001-business activity), I am not able to see the same in web ui.
The same holds good when categories are assigned to Class Miscellaneous, Letter, Meeting, E-mail etc, are in turn assigned to transaction types are visible in web ui.
Kindly clarify, whether all the business activities fall under APPOINTMENT, INTERACTION LOG, TASK, E-MAIL AND VISIT PLAN in WEB UI.
The other category class, apart from the above mentioned, where can they be used?
If yes, how do I do the customizing which would enable me to see all in WEB UI?
Thanks in advance
Regards,
Srinivasan.RHi Raghavendran,
I am facing the same problem. Other than Appointments,Tasks,Email and Interaction record I cannot create any other Activities.
I defined a new Transaction type assigned the category Misc but cannot create the Activity on WEBUI. As Raja suggested I have also assigned the Channel as WEBUI and ICWEBCLIENT but still does not work. Is there any Role specific customization that needs to be performed?
Please let me know if your issue is resolved and how you resolved it.
Any help will be greatly appreciated.
Thanks,
Pooja -
Help to troubleshoot a 3G connection.
Hello!
I need help to troubleshoot a 3G connection.
It's a CISCO2921/K9 with UC license and a 3G Interface.
I used the manual to make the configuration, step by step, I can send and receive SMS by 3G network, and connect, take a IP, DNS etc, but I don't able to ping or send and receive data with the 3G connection.
See the information:
show ip int br
Interface IP-Address OK? Method Status Protocol
Embedded-Service-Engine0/0 unassigned YES NVRAM administratively down down
GigabitEthernet0/0 192.168.50.1 YES NVRAM up up
GigabitEthernet0/1 192.168.6.253 YES DHCP up up
GigabitEthernet0/2 unassigned YES NVRAM administratively down down
Cellular0/0/0 unassigned YES NVRAM up up
Cellular0/0/1 unassigned YES unset down down
Dialer1 191.27.49.172 YES IPCP up up
NVI0 192.168.50.1 YES unset up up
I have a radio ISP connected on interface G0/1 and my internal network is connected in G0/0 on a Layer 3 Switch.
3G configuration:
chat-script hspa-R7 "" "AT!SCACT=1,1" TIMEOUT 60 "OK"
cellular 0/0/0 gsm profile create 1 zap.vivo.com.br PAP vivo vivo
interface Cellular0/0/0
ip address negotiated
ip nat outside
ip virtual-reassembly in
encapsulation slip
dialer persitent
dialer pool-member 1
async mode interactive
interface Dialer1
ip address negotiated
ip nat outside
ip virtual-reassembly in
encapsulation slip
dialer pool 1
dialer idle-timeout 0
dialer string hspa-R7
dialer persistent
dialer-group 99
ip nat inside source list 1 interface GigabitEthernet0/1 overload
ip nat inside source list 89 interface Cellular0/0/0 overload
ip nat inside source list 90 interface Dialer1 overload
access-list 1 permit any
access-list 89 permit any
access-list 90 permit any
ip route 0.0.0.0 0.0.0.0 Dialer1
ip route 0.0.0.0 0.0.0.0 192.168.6.1
access-list 1 permit any
access-list 89 permit any
access-list 90 permit any
line 0/0/0
exec-timeout 0 0
script dialer hspa-R7
modem InOut
no exec
transport input all
Dialer1 is up, line protocol is up (spoofing)
Hardware is Unknown
Internet address is 191.27.49.172/32
MTU 1500 bytes, BW 56 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation SLIP, loopback not set
Keepalive set (10 sec)
DTR is pulsed for 1 seconds on reset
Interface is bound to Ce0/0/0
Last input never, output never, output hang never
Last clearing of "show interface" counters 00:15:57
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes
508 packets output, 41923 bytes
Bound to:
Cellular0/0/0 is up, line protocol is up
Hardware is QuadBand HSPA+R7/HSPA/UMTS QuadBand EDGE/GPRS and GPS for AT&T
Description: PrimaryWANDesc_
Internet address will be assigned dynamically by the network
MTU 1500 bytes, BW 5760 Kbit/sec, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation SLIP, loopback not set
Keepalive not supported
Interface is bound to Di1 (Encapsulation SLIP)
Last input never, output never, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/10 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts (0 IP multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
508 packets output, 41923 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 output buffer failures, 0 output buffers swapped out
0 carrier transitions
DCD=up DSR=up DTR=up RTS=up CTS=up
Profile Information
====================
Profile password Encryption level: 7
Profile 1 = ACTIVE* **
PDP Type = IPv4
PDP address = 191.27.49.172
Access Point Name (APN) = zap.vivo.com.br
Authentication = PAP
Username: vivo
Password: 0870191E5D495746335B2E
Primary DNS address = 187.100.246.254
Secondary DNS address = 187.100.246.251
Profile 2 = INACTIVE
PDP Type = IPv4
Access Point Name (APN) = wap.cingular
Authentication = None
Username:
Password: 03
* - Default profile
Data Connection Information
===========================
Data Transmitted = 41923 bytes, Received = 0 bytes
Profile 1, Packet Session Status = ACTIVE
IP address = 191.27.49.172
Primary DNS address = 187.100.246.254
Secondary DNS address = 187.100.246.251
Negotiated QOS Parameters:
Precedence = Normal Priority, Delay = Class 2
Reliability = Unack GTP, LLC, Ack RLC, Protected data
Peak = 256 kB/sec, Mean = 50000 kB/hr
Traffic Class = Interactive
Uplink Max = 11.5Mbps, Guaranteed = Subscribed
Downlink Max = 42Mbps, Guaranteed = Subscribed
Max SDU size = 1500 bytes
SDU error ratio = 1E-4, BER = 1E-5
Profile 2, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 3, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 4, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 5, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 6, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 7, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 8, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 9, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 10, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 11, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 12, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 13, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 14, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 15, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Profile 16, Packet Session Status = INACTIVE
Inactivity Reason = Normal inactivate state
Network Information
===================
Current Service Status = Normal, Service Error = None
Current Service = Combined
Packet Service = HSPA+ (Attached)
Packet Session Status = Active
Current Roaming Status = Home
Network Selection Mode = Automatic
Country = BRA, Network = VIVO
Mobile Country Code (MCC) = 724
Mobile Network Code (MNC) = 23
Location Area Code (LAC) = 27135
Routing Area Code (RAC) = 4
Cell ID = 57743
Primary Scrambling Code = 115
PLMN Selection = Automatic
Registered PLMN = , Abbreviated =
Service Provider = VIVO
Radio Information
=================
Radio power mode = ON
Current Band = WCDMA 850, Channel Number = 4385
Current RSSI = -60 dBm
Band Selected = Auto
Number of nearby cells = 1
Cell 1
Primary Scrambling Code = 0x73
RSCP = -63 dBm, ECIO = -7 dBm
Modem Security Information
==========================
Card Holder Verification (CHV1) = Disabled
SIM Status = OK
SIM User Operation Required = None
Number of CHV1 Retries remaining = 3
Incoming Message Information
SMS stored in modem = 1
SMS archived since booting up = 0
Total SMS deleted since booting up = 0
Storage records allocated = 30
Storage records used = 1
Number of callbacks triggered by SMS = 0
Number of successful archive since booting up = 0
Number of failed archive since booting up = 0Refer this URL for how to configure the modem through serial port
http://docs.sun.com:80/ab2/coll.47.11/SYSADV2/@Ab2PageView/17395?DwebQuery=modem+configuration&Ab2Lang=C&Ab2Enc=iso-8859-1
Thanks,
Senthilkumar
Developer Technical Support
Sun Microsystems, Inc.
http://www.sun.com/developers/support -
Making a loaded external image into a button in Actionscript
My name is Steve Oatman I am a student at
AIO for a Web Design Diploma
class: Interactive Telecommunications IMD412 XA
Professors to bussy!
I have a flash web site that I am putting together. I am using AS to load some images from an external source. These images are being loaded into a movieclip. These images need to become buttons once they are loaded. The images will link to the particular menu category pages beef, chicken, etc.
The images are loading fine they just are not responding like a button or link.
I am getting two error referencing the buttonMode and usehandCursor. Below is just one image that I am working on till I get it to work.
I am getting these two Compiler error code:
1119: Access of possibly undefined property buttonMode through a reference with static type flash.display:Loader.
1119: Access of possibly undefined property useHandCursor through a reference with static type flash.display:Loader.
This is what I have.
var myLoader01:Loader = new Loader();
myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
addChild(myLoader01);
myLoader01.x = -269;
myLoader01.y = -164;
myLoader01.buttonMode = true;
myLoader01.useHandCursor = true;
myLoader01.addEventListener(MouseEvent.CLICK, beefClick);
function beefClick(event:MouseEvent):void{
gotoAndStop("beef");
From me searching online I thought the
name.buttonMode = true;
turned the element into a button!
I have included the fla file. This is in the menuItems_mc which is located in the pageContent_mc frame 40 layer page Image or of course the library.
I know this is a little in depth sorry and any help would be greatly appreciated.
Steve
713/742-3325Try something along the following lines:
var myLoader01:Loader = new Loader();
function addIt(evt:Event):void{
var aBtn:MovieClip = new MovieClip();
aBtn.x = -269;
aBtn.y = -164;
aBtn.buttonMode = true;
addChild(aBtn);
aBtn.addChild(myLoader01);
aBtn.addEventListener(MouseEvent.CLICK, beefClick);
myLoader01.contentLoaderInfo.addEventListener(Event.COMPLETE, addIt);
myLoader01.load(new URLRequest("entrees_images/beef/beef01.gif"));
function beefClick(event:MouseEvent):void{
gotoAndStop("beef"); -
Images disappearing / being painted over
Hi,
Not especially familiar with images and am having issues with images being painted over when ever I move or adjust the size of my GUI. I built a majority of the GUI using the Form Designer included with Netbeans.
Would really appreciate any advice, happy to include more detail if required.
Cheers,
Tim
GUIView
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import javax.imageio.ImageIO;
* GUIView.java
* Created on 22 April 2007, 21:25
* The GUIView class is responsible to display a graphical interface.
* This class interacts with the user and the GUIControl class allowing the user to operate the system.
* @author Tim
public class GUIView extends JFrame implements ActionListener {
// Declare method variables
private JTextField prodIDInput0;
private JLabel prodIDLabel0;
private JLabel prodIDLabel1;
private JLabel prodIDLabel2;
private JLabel prodNameLabel0;
private JLabel prodNameLabel1;
private JTextField amtRcvdInput0;
private JLabel amtRcvdLabel0;
private JButton cancelButton0;
private JMenu fileMenu0;
private JMenuItem exportXMLMenuItem;
private JMenuItem exitMenuItem;
private JButton findButton0;
private JLabel itemPrice0;
private JScrollPane jScrollPane1;
private JMenuBar menuBar0;
private JButton paymentButton0;
private JLabel prodDescLabel0;
private JLabel prodDescLabel1;
private JPanel prodImagePanel0;
private JPanel prodPanel0;
private JLabel qtyLabel0;
private JTextField qtyInput0;
private JLabel totalPrice0;
private JLabel totalPrice1;
private JList transList0;
private JPanel transPanel0;
private Vector listData;
private BufferedImage img;
private GUIControl guiCtl0;
/** Creates new form GUIView */
public GUIView (GUIControl guiCtl0) {
// reference guiCtl object
this.guiCtl0 = guiCtl0;
/** initilise gui object */
public void initGui () {
// initialise the GUI
initComponents ();
// paint image
paintImage ("images/transparent.gif");
// show the GUI
setVisible (true);
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
private void initComponents () {
// Instantiate GUI objects
prodIDLabel0 = new JLabel ();
prodIDLabel1 = new JLabel ();
prodNameLabel0 = new JLabel ();
prodNameLabel1 = new JLabel ();
prodDescLabel0 = new JLabel ();
prodDescLabel1 = new JLabel ();
prodImagePanel0 = new JPanel ();
itemPrice0 = new JLabel ();
totalPrice0 = new JLabel ();
totalPrice1 = new JLabel ();
prodPanel0 = new JPanel ();
prodIDLabel2 = new JLabel ();
prodIDInput0 = new JTextField ();
qtyInput0 = new JTextField ();
qtyLabel0 = new JLabel ();
findButton0 = new JButton ();
transPanel0 = new JPanel ();
paymentButton0 = new JButton ();
cancelButton0 = new JButton ();
amtRcvdInput0 = new JTextField ();
amtRcvdLabel0 = new JLabel ();
jScrollPane1 = new JScrollPane ();
transList0 = new JList ();
menuBar0 = new JMenuBar ();
fileMenu0 = new JMenu ();
listData = new Vector ();
// default close operation is to terminate the application
setDefaultCloseOperation (WindowConstants.EXIT_ON_CLOSE);
// title of the window
setTitle ("Supermarket Management System");
// centre the GUI on the screen
Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment ().getMaximumWindowBounds ();
rect.grow (-185,-100);
setBounds (rect);
// sets the minimum size the wonw can be shrunk to
setMinimumSize (new java.awt.Dimension (880, 480));
// sets the name of the frame
setName ("mainFrame");
// setup label to show Product ID:
prodIDLabel0.setFont (new java.awt.Font ("Tahoma", 1, 14));
prodIDLabel0.setText ("Product ID:");
// setup label to show the id of the latest product object
prodIDLabel1.setFont (new java.awt.Font ("Tahoma", 0, 14));
prodIDLabel1.setText ("");
prodIDLabel1.setToolTipText ("Product ID");
// setup label to show Name:
prodNameLabel0.setFont (new java.awt.Font ("Tahoma", 1, 14));
prodNameLabel0.setText ("Name:");
// setup label to show the name of the latest product object
prodNameLabel1.setFont (new java.awt.Font ("Tahoma", 0, 14));
prodNameLabel1.setText ("");
prodNameLabel1.setToolTipText ("Product Name");
// setup label to show Description:
prodDescLabel0.setFont (new java.awt.Font ("Tahoma", 1, 14));
prodDescLabel0.setText ("Description:");
// setup label to show the description of the latest product object
prodDescLabel1.setFont (new java.awt.Font ("Tahoma", 0, 14));
prodDescLabel1.setText ("");
prodDescLabel1.setToolTipText ("Product Description");
// align the prodDescLabel1 to TOP
prodDescLabel1.setVerticalAlignment (SwingConstants.TOP);
// setup panel to display image
prodImagePanel0.setBackground (new java.awt.Color (255, 255, 255));
prodImagePanel0.setBorder (javax.swing.BorderFactory.createEtchedBorder (javax.swing.border.EtchedBorder.RAISED));
org.jdesktop.layout.GroupLayout prodImagePanel0Layout = new org.jdesktop.layout.GroupLayout (prodImagePanel0);
prodImagePanel0.setLayout (prodImagePanel0Layout);
// specify how much the panel expands on the horizontal axis
prodImagePanel0Layout.setHorizontalGroup (
prodImagePanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (0, 304, Short.MAX_VALUE)
// specify how much the panel expands on the vertical axis
prodImagePanel0Layout.setVerticalGroup (
prodImagePanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (0, 255, Short.MAX_VALUE)
// setup item price label
itemPrice0.setFont (new java.awt.Font ("Tahoma", 1, 14));
itemPrice0.setText ("");
itemPrice0.setToolTipText ("Transaction Item Price information");
// setup label to display Total Price:
totalPrice0.setFont (new java.awt.Font ("Tahoma", 1, 18));
totalPrice0.setText ("Total Price:");
// setup label to display current transaction total price
totalPrice1.setFont (new java.awt.Font ("Tahoma", 0, 18));
totalPrice1.setText ("$0.00");
totalPrice1.setToolTipText ("Total cost of transaction");
// setup JPanel to contain product look up components
prodPanel0.setBorder (BorderFactory.createTitledBorder ("Enter Product"));
// setup label to display Product ID:
prodIDLabel2.setText ("Product ID:");
// setup label to display Quantity:
qtyLabel0.setText ("Quantity:");
// setup button and display FIND as the text
findButton0.setFont (new java.awt.Font ("Tahoma", 0, 14));
findButton0.setText ("FIND");
findButton0.setToolTipText ("Click to find product");
findButton0.addActionListener (this);
// create new GroupLayout for prodPanel0
org.jdesktop.layout.GroupLayout prodPanel0Layout = new org.jdesktop.layout.GroupLayout (prodPanel0);
prodPanel0.setLayout (prodPanel0Layout);
// set horizontal group
prodPanel0Layout.setHorizontalGroup (
prodPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (prodPanel0Layout.createSequentialGroup ()
.add (15, 15, 15)
.add (prodIDLabel2)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
// add prodIDInput0 JTextField to form
.add (prodIDInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 126, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (22, 22, 22)
.add (qtyLabel0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
// addd qtyInput0 JTextField to form
.add (qtyInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (22, 22, 22)
.add (findButton0)
.addContainerGap (org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
// set vertical group
prodPanel0Layout.setVerticalGroup (
prodPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (prodPanel0Layout.createSequentialGroup ()
.addContainerGap ()
.add (prodPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.BASELINE)
.add (prodIDLabel2)
// add prodIDInput0 JTextField to form
.add (prodIDInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (qtyLabel0)
// add qtyInput0 JTextField to form
.add (qtyInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (findButton0))
.addContainerGap (org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
// setup JPanel to contain finialise payment components
transPanel0.setBorder (BorderFactory.createTitledBorder ("Finalise Transaction"));
// setup button and display PAYMENT as the text
paymentButton0.setFont (new java.awt.Font ("Tahoma", 0, 14));
paymentButton0.setText ("PAYMENT");
paymentButton0.setToolTipText ("Click to finalise transaction");
// setup button and display CANCEL as the text
cancelButton0.setFont (new java.awt.Font ("Tahoma", 0, 14));
cancelButton0.setText ("CANCEL");
cancelButton0.setToolTipText ("Cancel the current transaction");
cancelButton0.addActionListener (this);
// setup label to display Amount received:
amtRcvdLabel0.setText ("Amount received:");
// create new GroupLayout for TransPanel0
org.jdesktop.layout.GroupLayout transPanel0Layout = new org.jdesktop.layout.GroupLayout (transPanel0);
transPanel0.setLayout (transPanel0Layout);
// set horizontal group
transPanel0Layout.setHorizontalGroup (
transPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (org.jdesktop.layout.GroupLayout.TRAILING, transPanel0Layout.createSequentialGroup ()
.addContainerGap (org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add (amtRcvdLabel0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
// add amtRcvdInput0 JTextField to form
.add (amtRcvdInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (22, 22, 22)
.add (paymentButton0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (cancelButton0)
.addContainerGap ())
// set vertical group
transPanel0Layout.setVerticalGroup (
transPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (transPanel0Layout.createSequentialGroup ()
.addContainerGap ()
.add (transPanel0Layout.createParallelGroup (org.jdesktop.layout.GroupLayout.BASELINE)
.add (cancelButton0)
.add (paymentButton0)
// add amtRcvdInput0 JTextField to form
.add (amtRcvdInput0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (amtRcvdLabel0))
.addContainerGap (org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
// setup JScrollPanel to display transaction items
transList0.setFont (new java.awt.Font ("Tahoma", 0, 14));
transList0.setListData (listData);
transList0.setToolTipText ("Items entered in the current transaction");
// specify scrollbars
jScrollPane1.setViewportView (transList0);
// setup the file menu
fileMenu0.setText ("File");
// add Export XML menu item to file menu
exportXMLMenuItem = new JMenuItem ("Export to XML");
exportXMLMenuItem.setToolTipText ("Export current product list to product.xml");
fileMenu0.add (exportXMLMenuItem);
// add menu seperator
fileMenu0.addSeparator ();
// add Exit menu item to file menu
exitMenuItem = new JMenuItem ("Exit");
exitMenuItem.setToolTipText ("Exit application");
fileMenu0.add (exitMenuItem);
// add the file menu to the menu bar
menuBar0.add (fileMenu0);
// set the menu bar to be menuBar0
setJMenuBar (menuBar0);
// layout remaining components onto JFrame
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout (getContentPane ());
getContentPane ().setLayout (layout);
// set horizontal group
layout.setHorizontalGroup (
layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (layout.createSequentialGroup ()
.addContainerGap ()
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (layout.createSequentialGroup ()
.add (prodIDLabel0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (prodIDLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 78, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (prodNameLabel0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (prodNameLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 164, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add (layout.createSequentialGroup ()
.add (prodDescLabel0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (prodDescLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 725, Short.MAX_VALUE))
.add (layout.createSequentialGroup ()
.add (prodImagePanel0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE))
.add (layout.createSequentialGroup ()
.add (itemPrice0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED, 441, Short.MAX_VALUE)
.add (totalPrice0)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (totalPrice1))
.add (layout.createSequentialGroup ()
.add (prodPanel0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (transPanel0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap ())
// set vertical group
layout.setVerticalGroup (
layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (layout.createSequentialGroup ()
.addContainerGap ()
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.BASELINE)
.add (prodIDLabel1)
.add (prodNameLabel1)
.add (prodNameLabel0)
.add (prodIDLabel0))
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.BASELINE)
.add (prodDescLabel0)
.add (prodDescLabel1))
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)
.add (prodImagePanel0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (itemPrice0)
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.BASELINE)
.add (totalPrice1)
.add (totalPrice0)))
.addPreferredGap (org.jdesktop.layout.LayoutStyle.RELATED)
.add (layout.createParallelGroup (org.jdesktop.layout.GroupLayout.LEADING)
.add (prodPanel0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add (transPanel0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap ())
// resize the frame to the minimum size needed to satisfy the preferred size of each of the components in the layout
pack ();
/** actionPerformed()
* handles events from components.
public void actionPerformed (ActionEvent e) {
if ( e.getSource () == findButton0 )
guiCtl0.findButtonAction (prodIDInput0.getText (), qtyInput0.getText ());
if ( e.getSource () == cancelButton0 )
guiCtl0.cancelButtonAction ();
/** showWelcomeMsg()
* Shows a welcome dialogue message to the user.
public void showWelcomeMsg (){
// Create a new dialogue box
JOptionPane welcomeMsg = new JOptionPane ();
// Show welcome dialogue box
welcomeMsg.showMessageDialog (null, "Welcome to the Supermarket Management System. Click OK to begin.", "Welcome", welcomeMsg.INFORMATION_MESSAGE);
/** showMsg()
* Shows a message to the user.
public void showErrorMsg (String s){
// Create a new dialogue box
JOptionPane errorMsg = new JOptionPane ();
// Show welcome dialogue box
errorMsg.showMessageDialog (null, s, "Message", errorMsg.ERROR_MESSAGE);
/** set prodIDInput0 text field */
public void setProdIDInput0 (String s){
prodIDInput0.setText (s);
/** set qtyInput0 text field */
public void setQtyInput0 (String s){
qtyInput0.setText (s);
/** set ProdDescLabel1 label */
public void setProdDescLabel1 (String s) {
prodDescLabel1.setText (s);
/** set prodIDLabel1 label */
public void setProdIDLabel1 (String s) {
prodIDLabel1.setText (s);
/** set prodNameLabel1 label */
public void setProdNameLabel1 (String s) {
prodNameLabel1.setText (s);
/** set totalPrice1 label */
public void setTotalPrice1 (String s) {
totalPrice1.setText (s);
/** populate transList0 with latest trans info */
public void setTransList0 (Vector v){
transList0.setListData (v);
/** set itemPrice0 label */
public void setItemPrice0 (String s) {
itemPrice0.setText (s);
/** draw prod images onto gui */
public void paintImage (String imagePath) {
// get Graphics
Graphics g = prodImagePanel0.getGraphics ();
// draw image into prodImagePanel0
img = null;
try {
img = ImageIO.read (new File (imagePath));
} catch (IOException e) {
System.err.println ("Caught IOException: "
+ e.getMessage ());
// draw the image on screen
g.drawImage (img, 2, 2, prodImagePanel0);
/** Change image */
public void updateImage (String imagePath){
// draw image into prodImagePanel0
img = null;
try {
img = ImageIO.read (new File (imagePath));
} catch (IOException e) {
System.err.println ("Caught IOException: "
+ e.getMessage ());
GUIControl
import javax.swing.*;
import java.text.*;
* GUIControl.java
* The GUIControl class is responsible to perform actions requested from the GUIView class.
* It also liaises with the TransControl and ProdControl objects to generate output to the
* gui and handle input from the gui.
* @author Tim
public class GUIControl {
// Declare object variables
private GUIView gui;
private ProdControl prodCtl0;
private TransControl transCtl0;
/** Creates a new instance of GUIControl */
public GUIControl (ProdControl prodCtl0, TransControl transCtl0) {
// make reference to prodCtl0, transCtl0 and gui objects
this.prodCtl0 = prodCtl0;
this.transCtl0 = transCtl0;
/** Set gui view object */
public void setGui (GUIView gui) {
this.gui = gui;
/** show the welcome dialouge */
public void showWelcome (){
// Call the showWelcomeMsg() method from gui to dispay welcome dialogue.
gui.showWelcomeMsg ();
/** find product */
public Product findProd (int prodId){
Product foundProd = prodCtl0.getProdByID (prodId);
return foundProd;
/** add product to transaction */
public String addProdToTrans (int prodId, double transQuantity){
// declare method variables
String status = "Product not added";
Product curProd0;
// find prodduct by ID
curProd0 = prodCtl0.getProdByID (prodId);
// 1. if product exists then add a new transaction item to the transaction list.
if (curProd0 != null) {
// 2. check quantity is a whole number for UPC Products
if (curProd0 instanceof UPCProd) {
// check if the result is a whole number
boolean isWhole = (Math.rint (transQuantity) == transQuantity);
// 3. if isWhole is false change status message.
if (isWhole == false) {
// return status as Product cannot be found.
status = "You must enter the quantity as a whole number for UPC products.";
return status;
} else {
// 4. check there is enough stock in the store
if (transQuantity > curProd0.getQuantity ()) {
// return status as there is not enough stock.
status = "There is currently not enough stock to fulfill this transaction. Please reduce the quantity." ;
return status;
} else {
} // end if 4.
} // end if 3.
} else {
} // end if 2.
// add curProd as new transItem
transCtl0.addTransItem (curProd0, transQuantity);
// return status as null to notify that the Product was added.
status = null;
return status;
} else {
// return status as Product cannot be found.
status = "Product " + prodId + " cannot be found.";
return status;
} // end if 1.
} // end addProdToTrans method
/** action Find button */
public void findButtonAction (String prodId0, String quantity0){
// status msg
String status;
// check prodId0 is not null
if (prodId0.equals ("")) {
// set status message to error and display error msg
status = "Please enter a valid Product ID.";
gui.showErrorMsg (status);
// check quantity0 is not null
} else if (quantity0.equals ("")) {
// set status message to error and display error msg
status = "Please enter a valid quantity.";
gui.showErrorMsg (status);
} else {
// parse String values into int and double
int prodId1 = Integer.parseInt (prodId0);
double quantity1 = Double.parseDouble (quantity0);
// reset prodIDInput0 and qtyInput0 text fields in the gui
gui.setProdIDInput0 ("");
gui.setQtyInput0 ("");
// add trans item and return result as a string
status = addProdToTrans (prodId1, quantity1);
if (status == null) {
updateProdTransView ();
} else {
// display msg to the user
gui.showErrorMsg (status);
} // end if
} // end if
} // end findButtonAction method
/** update product and transaction view on gui */
public void updateProdTransView (){
// get the last trans item added
TransItem lastTransItem0 = transCtl0.getLastTransItem ();
// find the product
Product p = findProd (lastTransItem0.getId ());
// update product info displayed in the gui
gui.setProdIDLabel1 (Integer.toString (p.getId ()));
gui.setProdNameLabel1 (p.getName ());
gui.setProdDescLabel1 (p.getDescription ());
// paint prod image
gui.paintImage (p.getImage ());
// update transaction info displayed in the gui
gui.setTransList0 (transCtl0.getTransItems ());
gui.setItemPrice0 (transCtl0.transItemPriceInfo (lastTransItem0));
// update total transaction cost displayed in the gui
gui.setTotalPrice1 ("$" + transCtl0.transTotal ());
} // end updateProdTransView method
/** action Cancel button */
public void cancelButtonAction (){
// cleat transaction items from transaction array list
transCtl0.clearTrans ();
// reset gui components
gui.setProdIDLabel1 ("");
gui.setProdNameLabel1 ("");
gui.setProdDescLabel1 ("");
gui.setTransList0 (transCtl0.getTransItems ());
gui.setItemPrice0 ("");
gui.setTotalPrice1 ("$0.00");
gui.paintImage ("images/transparent.gif");
}happy to include more detail if required.You've included too much detail.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.
And don't post code generated by NetBeans. It uses the GroupLayout which is not a standard layout manager until JDK6 and a lot of people don't use JDK6 yet so we won't be able to execute you code to see whats happening. -
AttachCurrentThread hangs after a few calls in a Apache2 PHP5 Extension
Hello everybody,
I have created a small C Library/API that calls with JNI a simple Java class with a few methods to work with a underlying Java Framework (Carrot2). That JVM/JNI code functions some kind like a bridge between C and Java. In a single-threaded environment I experienced no problems, the complete runtime flow works well, I get no crashes or other strange behaviour.
Now I have built an PHP5 extension that makes use of that JNI/C code, the extension is built as a class with constructor/destructor and has a few methods that call functions of my C library. The JNI/C side I have 2 data structs, one is for the JVM and its handle (JavaVM) as well as the Java class name and its path, the jclass object of that class, jvm options, classpath, etc. A second data struct is for the Java environment containing the JNIEnv pointer, the jobject of the Java class and a few more application related variables. The C code consists of JNI functions to work with the Java class to call its methods, a few JNI helper functions and some internal application code and data handling.
At module initialization (Apache startup) I use the PHP_MINIT and PHP_MSHUTDOWN functions to load and unload (on apache stop) the JVM. The JVM gets created and destroyed at these points.
I use the PHP constructor (inside the extension) to attach to the JVM, that is AttachCurrentThread with the class constructor, I create and object of the Java class and preload a few Java primitives that I need for my methods later on and after all this I can work with the Java class through JNI. On PHP5 class destruction (also in the extension), I detach from the JVM using 'DetachCurrentThread', free some resources and "delete" the JNIEnv pointer (set it to NULL).
The JVM data struct (containing the JVM object) is a static global in the PHP5 module since I think there is no need for thread safety. This data is only modified/used in module startup/shutdown. The JNI worker struct (data struct with the JNIEnv pointer and jobject, etc is safely handled by the Zend object store throughout the complete class, so this should be thread-safe. So I do not suspect any problem here.
Testing the PHP 5 extension with a small PHP5 script using that PHP class and a few methods in Apache debug mode (that is the -X switch for just one worker process) works like a charm, no problems, crashes or misbehaving situations, not up to now with my testing though. But running Apache in regular mode with multiple processes, I run in to problems. One major problem is, after a few reloads of the php script using the extension class (lets say 10-15 reloads; The request is handled by the same apache child process) the `AttachCurrentThread' call hangs and the child process remains in that state. Continuing reloading the script a new child process answers and also here, after 10-15 reloads of the script, I get the same problem. So I am not sure what is really happening here nor I do not know how to solve that issue. Is that a signal problem (I read, that there can be signal mask issues and the JVM hangs when a new thread tries to attach to it, for example, the Jakarta Tomcat JK JNI worker uses a signal hack because of this problem. But that does not help me.
Or is there some problem with the multi-threading itself (since the JVM is multithreaded too)? Another problem is, besides that hanging thread attach, that the processing sometimes stops in middle of a java call (I have one method that insert data (calling a add method in a for loop) with JNI into a Java list on the Java class side, there it can stop in middle of the insertion process.
So, for now, I have no idea how to continue. Like said, in a single threaded environment, as a process, the application runs fine without a flaw.
Some details of my development machines: Ubuntu Lucic 10.04 LTS (also another Ubuntu 8 LTS), Apache2 MPM Worker (multithreaded model) and also on another machine the prefork version, Java JRE 6.0.22, PHP 5.2.16 (compiled from source).
So any hints that can help me proceeding the development of this module for PHP would be great. Any help is appreciated. If there are questions or some unclear points, please let me know.
Andreasjschell wrote:
847069 wrote:
I use the PHP constructor (inside the extension) to attach to the JVM, that is AttachCurrentThread with the class constructor, I create and object of the Java class and preload a few Java primitives that I need for my methods later on and after all this I can work with the Java class through JNI. On PHP5 class destruction (also in the extension), I detach from the JVM using 'DetachCurrentThread', free some resources and "delete" the JNIEnv pointer (set it to NULL).
That is unclear.
I presume that you have a PHP class which is making JNI calls.
Presumably you have a single thread in the caller of the PHP class, specifically a single method, which creates the PHP class, interacts with it, and then destroys it.
Yes, programming PHP5 extensions in C or C++ let you implement a class or just flat functions that can be used in the PHP scripting language. I implemented a class. So my constructor attaches to the (already at Apache/Module startup created JVM). After that, I can use the methods I have implemented to use the carrot2 framework. To communicate with the Carrot2 library, I have written a simple Java Class containing static functions for adding documents, executing clustering algorithms and receiving the search results, so all pretty straightforward I think. When the PHP script exists (request finished) then the class destructor is called (also implemented in my PHP5 extension) to detach from the JVM and make some cleanup. This is generally how things work.
Most problems with JNI is caused by pointer problems or misusing the API (like not handling exceptions correctly.)
Other than that the Sun VM has a command line option that reports useful information when using JNI.I can compile and run my JNI code with some test data from command line and I pass to the JVM some debugging parameters (such as -Xcheck:jni, -verbose:jni and Xint) for testing and debugging. I get no exceptions, errors or warnings. Everything is executed cleanly, I see some JNI/JVM debugging output (such as Dynamic-linking native method messages) along my own debugging output and the program finishes normally. Most JNI calls are wrapped in special macros and I check for exceptions, describe and clear them and act with these situtions (if any), I also added a method to the Java Class where I am able to receive the Java backrace for further investigation and abort execution.
So for now I am out of ideas. This is why I don't understand these problems within the Apache/PHP process. Like stated above, Apache with one worker "-X" the complete code runs fine, even with consecutive calls all is fine, but then in regular multiprocess mode, I get the above problems like the AttachCurrentThread hangs or the execution of called methods of my Java class (inserting documents to a ArrayList or executing one of the clustering algorithms) hang and I have no other choice but to stop Apache.
One more thing, I valgrinded my C code as far as possible. It is not possible to valgrind C code that creates and executes a JVM. Valgrind will stop and report "Error occurred during initialization of VM". No wonder though, I do not expect valgrind to execute the JVM beast in its context. The PHP5 version i compiled from source is thread-safe (at least I compiled it with the proper flags for that).
So any other debugging hints or ideas are welcome.
Edited by: 847069 on Mar 24, 2011 10:31 PM
Edited by: 847069 on Mar 24, 2011 10:35 PM -
Qos for H323 Video tele conference traffic
Hi All,
I am using Tandberg video equipment(bridge MPS200, endpoint MPX2000, MPX6000). My WAN routers are Cisco 2800/3800 connecting to MPLS network.
Jitters are between 4ms - 20ms. Picture quality is not very good when I use the bridge calls out to 8 endpoints at 384Kbps.
would you put audio and video traffic into the same class and mark it as EF, or seperate them with marking RTP audio as EF and RTP video = Ip precedence 4?
thanks
PHJust for the record
The Cisco Enterprise QoS SRND reccomends putting Video AF41 in the PQ.
1st ref 3-12
policy-map WAN-EDGE
class Voice
priority percent 18 ! Voice gets 552 kbps of LLQ
class Interactive Video
priority percent 15 ! 384 kbps IP/VC needs 460 kbps of LLQ
class Call Signaling
bandwidth percent 5 ! BW guarantee for Call-Signaling
class Network Control
bandwidth percent 5 ! Routing and Network Management get min 5% BW
class Critical Data
bandwidth percent 27 ! Critical Data gets min 27% BW
random-detect dscp-based ! Enables DSCP-WRED for Critical-Data class
class Bulk Data
bandwidth percent 4 ! Bulk Data gets min 4% BW guarantee
www.cisco.com/go/srnd
When provisioning for Interactive Video (IP Videoconferencing) traffic, the following guidelines are
recommended:
? Interactive Video traffic should be marked to DSCP AF41; excess Interactive-Video traffic can be
marked down by a policer to AF42 or AF43.
? Loss should be no more than 1 %.
? One-way Latency should be no more than 150 ms.
? Jitter should be no more than 30 ms.
? Overprovision Interactive Video queues by 20% to accommodate bursts
Because IP Videoconferencing (IP/VC) includes a G.711 audio codec for voice, it has the same loss,
delay, and delay variation requirements as voice, but the traffic patterns of videoconferencing are
radically different from voice. -
HTML Article with YouTube iframe gets an error
I am coding the articles in the folio using HTML and CSS. When I upload the article to the folio producer I receive an error that the article is "Missing or unable to load layout." When I try and download the folio using the Adobe Viewer app I receive an error that I am unauthorized to view the folio. By deleting each element and re-uploading I was able to discern that this was the offending code:
<iframe class="no-print movie-frame" src="http://www.youtube.com/embed/xSKoL9DZj_k" frameborder="0"></iframe>
I have styled it according to other discussions, and I have used same code for other videos but only when I have completed the article within InDesign. The classes resize the element based on the viewport size and hides the element when printing, I have removed the classes and still receive the error.On a whim, the next action I tried worked.
I used the code straight from YouTubes embed tab, which removes the http: from the src.
<iframe class="interactive movie-frame" src="//www.youtube.com/embed/xSKoL9DZj_k" frameborder="0"></iframe>
Maybe you are looking for
-
Logic needed to print blank line in alv report
hi experts, can anyone please tell me the logic for this i want to logic one is 1) in alv report contains a set of data contains 100 (5 datas) and a set of data contain 200(5 datas) i want to have one coloum containing serial no ex for 100 i want to
-
.CR2 files won't open in CS3 on a new WIN7 'puter
I just got a new 'puter with WIN7 installed. I installed CS3 and updated ACR to 4.6, (removed the old .8bi, (or whatever it was), file first). I am shooting a Canon 40D BTW... I still can't open .CR2 files - I ge something like: "could not complete y
-
@font-face and font licenses
Hello, I'm working with a developer who has a licensed version of Adobe's "Univers" font. Can we use @font-face from CSS 3 to include this font in our website? Or, do we need to use a different type of font-embedding in order to work with the font's
-
To change payment block option in Propasal list(F110)
Hello, I need help about automatic payment transaction (F110 Tcode). In edit proposal payment screen it is only possibly to change payment block option in lines one by one according to vendor (and customer). We need to change multiple lines (by use
-
I wanted to change the default application proram to view .jpg files to Windows photo viewer. The default program is HP Photo Smart. I went to Tools Options, went to the Applications bar, and found the file type, attempted to change the program, but