Question about bluetooth communication between PC and mobile device
I am a newbie of bluetooth communication. This time I need to have connumication between PC and mobile device (mainly mobile phone) by sending strings. PC is acted as server and mobile device act as client.
For using bluetooth in PC, I use bluecove 2.0.1
I have already connected them successfully.
When I want to send strings between them, it is found that it can only do one cycle of communication (client -> server -> client).
For my design, they can communicate multiple times.
I simulate the core class of the system, the performance is fine.
Cound anyone help me to watch the code and give me some advices?
Server Side - ServerBox.java
public class ServerBox implements Runnable {
LocalDevice localDevice;
StreamConnectionNotifier notifier;
ServiceRecord record;
boolean isClosed;
ClientProcessor processor;
CMDProcessor cmd;
MainInterface midlet;
private static final UUID ECHO_SERVER_UUID = new UUID(
"F0E0D0C0B0A000908070605040302010", false);
public ServerBox(MainInterface midlet) {
this.midlet = midlet;
public void run() {
boolean isBTReady = false;
try {
localDevice = LocalDevice.getLocalDevice();
if (!localDevice.setDiscoverable(DiscoveryAgent.GIAC)) {
midlet.showInfo("Cannot set to discoverable");
return;
// prepare a URL to create a notifier
StringBuffer url = new StringBuffer("btspp://");
url.append("localhost").append(':');
url.append(ECHO_SERVER_UUID.toString());
url.append(";name=Echo Server");
url.append(";authorize=false");
// create notifier now
notifier = (StreamConnectionNotifier) Connector.open(url.toString());
record = localDevice.getRecord(notifier);
isBTReady = true;
} catch (Exception e) {
e.printStackTrace();
// nothing to do if no bluetooth available
if (isBTReady) {
midlet.showInfo("Initalization complete. Waiting for connection");
midlet.completeInitalization();
} else {
midlet.showInfo("Initalization fail. Exit.");
return;
// produce client processor
processor = new ClientProcessor();
cmd = new CMDProcessor();
// start accepting connections then
while (!isClosed) {
StreamConnection conn = null;
try {
conn = notifier.acceptAndOpen();
} catch (IOException e) {
// wrong client or interrupted - continue anyway
continue;
processor.addConnection(conn);
// activate the set up of process
public void publish() {
isClosed = false;
new Thread(this).start();
// stop the service
public void cancelService() {
isClosed = true;
midlet.showInfo("Service Terminate.");
midlet.completeTermination();
// inner private class for handling connection and activate connection handling
private class ClientProcessor implements Runnable {
private Thread processorThread;
private Vector queue = new Vector();
private boolean isOk = true;
ClientProcessor() {
processorThread = new Thread(this);
processorThread.start();
public void run() {
while (!isClosed) {
synchronized (this) {
if (queue.size() == 0) {
try {
// wait for new client
wait();
} catch (InterruptedException e) { }
StreamConnection conn;
synchronized (this) {
if (isClosed) {
return;
conn = (StreamConnection) queue.firstElement();
queue.removeElementAt(0);
processConnection(conn);
// add stream connection and notify the thread
void addConnection(StreamConnection conn) {
synchronized (this) {
queue.addElement(conn);
midlet.showInfo("A connection is added.");
notify(); // for wait() command in run()
// receive string
private String readInputString(StreamConnection conn) {
String inputString = null;
try {
DataInputStream dis = conn.openDataInputStream();
inputString = dis.readUTF();
dis.close();
} catch (Exception e) {
e.printStackTrace();
return inputString;
private void sendOutputData(String outputData, StreamConnection conn) {
try {
DataOutputStream dos = conn.openDataOutputStream();
dos.writeUTF(outputData);
dos.close();
} catch (IOException e) {
// process connecion
private void processConnection(StreamConnection conn) {
String inputString = readInputString(conn);
String outputString = cmd.reactionToCMD(inputString);
sendOutputData(outputString, conn);
/* try {
conn.close();
} catch (IOException e) {}*/
midlet.showInfo("Client input: " + inputString + ", successfully received.");
}For "CMDProcessor" , it is the class of message processing before feedback to client.
Client side - ClientBox.java
public class ClientBox implements Runnable, CommandListener{
StringItem result = new StringItem("","");
private DiscoveryAgent discoveryAgent;
private String connString;
private boolean isClosed = false;
private boolean boxReady = false;
StreamConnection conn;
private static final UUID ECHO_SERVER_UUID = new UUID( "F0E0D0C0B0A000908070605040302010", false);
Form process = new Form("Process");
ClientInterface midlet;
public ClientBox(ClientInterface mid){
this.midlet = mid;
process.append(result);
process.addCommand(new Command("Cancel",Command.CANCEL,1));
process.setCommandListener(this);
new Thread(this).start();
public void commandAction(Command arg0, Displayable arg1) {
if(arg0.getCommandType()==Command.CANCEL){
isClosed = true;
midlet.notifyDestroyed();
public synchronized void run() {
LocalDevice localDevice = null;
boolean isBTReady = false;
/* Process Gauge screen */
midlet.displayPage(process);
Gauge g=new Gauge(null,false,Gauge.INDEFINITE,Gauge.CONTINUOUS_RUNNING);
process.append(g);
showInfo("Initalization...");
System.gc();
try {
localDevice = LocalDevice.getLocalDevice();
discoveryAgent = localDevice.getDiscoveryAgent();
isBTReady = true;
} catch (Exception e) {
e.printStackTrace();
if (!isBTReady) {
showInfo("Bluetooth is not avaliable. Please check the device.");
return;
if(!isClosed){
try {
connString = discoveryAgent.selectService(ECHO_SERVER_UUID, ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
} catch (BluetoothStateException ex) {
ex.printStackTrace();
else return;
if (connString == null) {
showInfo("Cannot Find Server. Please check the device.");
return;
else showInfo("Can Find Server, stand by for request.");
boxReady = true;
/* True if the clientbox is ready */
public boolean getBoxReady(){
return boxReady;
/* True if the clientbox is closed in run() */
public boolean getIsClosed(){
return isClosed;
public String accessService(String input) {
String output = null;
try {
/* Connect to server */
StreamConnection conn = (StreamConnection) Connector.open(connString);
/* send string */
DataOutputStream dos = conn.openDataOutputStream();
dos.writeUTF(input);
dos.close();
/* receive string */
DataInputStream dis = conn.openDataInputStream();
output = dis.readUTF();
dis.close();
} catch (IOException ex){
showInfo("Fail connect to connect to server.");
return output;
private void showInfo(String s){
StringBuffer sb=new StringBuffer(result.getText());
if(sb.length()>0){ sb.append("\n"); }
sb.append(s);
result.setText(sb.toString());
}Client side - ClientInterface.java
public class ClientInterface extends MIDlet implements Runnable, CommandListener{
private ClientBox cb = new ClientBox(this);
private Form temp = new Form("Temp");
private Command select = new Command("Select", Command.OK, 1);
private Command back = new Command("Back", Command.BACK, 1);
Alert alert;
String[] element;
String out;
List list;
public void run(){
/* Send message and get reply */
out = cb.accessService("Proglist");
element = split(out,",");
/* Use the reply to make list */
list = createList(element[0], List.IMPLICIT, out);
list.addCommand(select);
list.addCommand(back);
list.setCommandListener(this);
Display.getDisplay(this).setCurrent(list);
public void startApp() {
System.gc();
waitForBoxSetUp(); /* Recursively check for clientbox status */
new Thread(this).start();
public void pauseApp() {
public void destroyApp(boolean unconditional) {
notifyDestroyed();
public void displayPage(Displayable d){
Display.getDisplay(this).setCurrent(d);
private void waitForBoxSetUp(){
while(!cb.getBoxReady()){
if(cb.getIsClosed())
notifyDestroyed();
public void commandAction(Command c, Displayable d){
if (c.getCommandType() == Command.OK){
if (d == list){
/* Send the choice to server */
out = cb.accessService(list.getString(list.getSelectedIndex()));
alert = new Alert("Output", "selected = "+out, null, AlertType.ALARM);
alert.setTimeout(2000);
Display.getDisplay(this).setCurrent(alert,list);
if (c.getCommandType() == Command.BACK){
notifyDestroyed();
public void showWarning(String title, String content){
alert = new Alert("Output", "selected = "+list.getString(list.getSelectedIndex()), null, AlertType.ALARM);
alert.setTimeout(3000);
Display.getDisplay(this).setCurrent(alert,list);
private List createList(String name, int type, String message){
List temp;
String[] source = split(message,",") ;
temp = new List(name, type, source, null);
return temp;
private static String[] split(String original,String regex)
int startIndex = 0;
Vector v = new Vector();
String[] str = null;
int index = 0;
startIndex = original.indexOf(regex);
while(startIndex < original.length() && startIndex != -1)
String temp = original.substring(index,startIndex);
v.addElement(temp);
index = startIndex + regex.length();
startIndex = original.indexOf(regex,startIndex + regex.length());
v.addElement(original.substring(index + 1 - regex.length()));
str = new String[v.size()];
for(int i=0;i<v.size();i++)
str[i] = (String)v.elementAt(i);
return str;
}
i haven't worked with devices but only with the toolkit emulators;
it definitely is possible...
u have to send the image as a bytestream and receive the image at the jsp end...
and then reconstruct the image.
the Stream classes in J2ME AND J2SE are all u will require.
also the Image class.
i have not done this but i have successfully sent an image frm a jsp and displayed it on the emulator.
Similar Messages
-
Question about the difference between HDDs and SSDs
Hi. I currently have a MacBook (Black one) that's overheating a lot for the past few months. I'm thinking about purchasing a MacBook Pro for school because it seems to be more stable. I have a question though. What is the difference between HDDs and SSDs? Which one is better? All I know is that with my MacBook and my iBook is that I had hard drive failures (iBook hard drive clicking, MacBook hard drive sounding loud and making my computer overheat). Are hard drive failures normal with Macs?
Thank youastoldbywesley wrote:
Is a 128GB Solid State Drive better than a 500GB Serial ATA Drive @ 5400 rpm or 500GB Serial ATA Drive @ 7200 rpm?
Depends what you mean by "better." Faster? Yes. The 500 has 3x more storage capacity.
Message was edited by: tjk -
Some questions about the integration between BIEE and EBS
Hi, dear,
I'm a new bie of BIEE. In these days, have a look about BIEE architecture and the BIEE components. In the next project, there are some work about BIEE development based on EBS application. I have some questions about the integration :
1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?
2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?
3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?
4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?
could anyone give some guide for me? I'm very appreciated if you can also give any other information.
Thanks in advance.1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?You, shud consider OBI Application here which uses OBIEE as a reporting tool with different pre-built modules. Both 10g & 11g comes with different versions of BI apps which supports sources like Siebel CRM, EBS, Peoplesoft, JD Edwards etc..
2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?Its independent of any soure. This is OBIEE modeling to create RPD with all the layers. If you build it from scratch then you will require to create all the layers else if BI Apps is used then you will get pre-built RPD along with other pre-built components.
3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?BI apps comes with pre-built ETL mapping to use with the tools majorly with Informatica. Only BI Apps 7.9.5.2 comes with ODI but oracle has plans to have only ODI for any further releases.
4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?User will still see old data because its good to turn on Cache and purge it after every load.
Refer..http://www.oracle.com/us/solutions/ent-performance-bi/bi-applications-066544.html
and many more docs on google
Hope this helps -
Questions about the differences between Arch and Chakra.
I'm trying to decide whether to install Arch or Chakra on my laptop. Currently, I'm running Arch on my desktop and Windows 7 on my laptop (which I plan to overwrite). My skill level with GNU/Linux is somewhat intermediate – noobs refer to me as an expert, experts refer to me as a noob. If it matters, I'm a KDE user and primarily use my computers for web browsing and python development. Anyway, I just wanted to get an objective opinion on the differences between Arch and Chakra. I have a few points that stand out to me, but I welcome any input.
-Stability
I started my journey into GNU/Linux with Debian back in 2009 due to it's stability. I really disliked Debian's ancient software and considered moving my system to Unstable. While doing some googling about Debian Unstable, I stumbled across Arch – it was love at first sight. I've been an Arch user ever since. I love the bleeding edge software, and haven't had any major problems since I originally installed it. However, every time I run a system update I cringe a little. While Arch hasn't broken on me yet, I've read plenty of horror stories and it makes me uneasy. I understand that Chakra is a mix between a point and rolling release model. Is it any more or less stable than Arch? I know there are other distrobutions out there, but I'm in love with the Arch philosophy.
-Security
Pretty self-explanatory, but is there any difference in security between the two?
-AUR
As much as I love Arch, I wouldn't be able to stand it if it weren't for the massive collection of software available in the AUR. While I'm perfectly capable of compiling software myself, I prefer to use a command like tool like yaourt to manage my software. I understand that Chakra doesn't officially support the AUR and that they have their own user repository. Seeing as Chakra is still relatively new, is it lacking? Will I miss the AUR as a Chakra user?
-Repositories
Is there much difference in the official repositories between the two distrobutions?avonin wrote:
I'm trying to decide whether to install Arch or Chakra on my laptop. ... I'm a KDE user ... I just wanted to get an objective opinion on the differences between Arch and Chakra..
-Stability...
-AUR...
-Repositories...
My take on Chakra is that it's the same as Arch with different developers. They use pacman. They have a different and rather nice build system for their developers. They're doing a good job, but I'd hate to give up the services of Allan McRae who must work full time keeping the Archlinux core and toolchain up to date. Chakra devs probably piggy-back off his work.
As for "semi" rolling: I don't see Chakra as having a stable core. A stable core sounds attractive, it would be like NetBSD which has a very stable core Unix operating system with apps added via pkgsrc. But Chakra's core and toolchain is at the same version levels as Archlinux most of the time and are no more tested and stabilized than ours. Their core packages are updated piecemeal just like ours; there is no stable core that is released as a unit (afaik). Today Chakra has gcc 4.7 / glibc 2.15 just like ours. Their kernel is a little more stable: they're using udev 181 / linux 3.2.8 while Arch is on udev 182 / linux 3.3.7. They are more conservative in upgrading xorg and the video drivers than Arch. For example, today they're on xorg-server 1.10.4 / intel video 2.17 while Arch is up-to-the-bleeding-edge-minute with xorg-server 1.12.1.902 and intel video 2.19. Yeah, I would consider Chakra to be a little more "stable" than Arch mainly because of their relaxed pace in changing the kernel and the xorg stuff.
Most of the patches that I look at for Arch packages (I build my system entirely from source and try to build monthly releases for myself) are needed because we use more recent core packages like glib2/glibc/gcc than the developers of higher level stuff like qt. Chakra is in the same situation. We're on the front of the wave
The Chakra CCR is compatible with the Arch AUR and mainly draws from AUR (an AUR buildscript will usually work fine on a Chakra system -- they just add one or two additional info fields.) With a little effort you could get any package installed on a Chakra system that is available on Arch.
Last edited by sitquietly (2012-05-24 20:43:58) -
Question about load balancing between Portal and ABAP
Hi,
I have the problem whit load balancing between Portal and ECC (ERC) ABAP
Exist two system:
1) ECC (ERP) ABAP = Backend Module = HR
2) EP (JAVA) = Frontend
The users (9000 users) logon in the EP and run query (data personal) in the ECC. The problem to all user connect in Central Instance and not in the Dialog Instance.
How can balancing the conecction HTTP (EP) to ECC (ABAP)??
I need balancing in the ECC to Dialog InstanceJco -> right. Another possibility is that you use iviews that point to the backend in this case you will need to use a load balanced entry for the backend system in the [system landscape|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/8c1e438d7017fce10000000a42189c/frameset.htm] -> SAP_R3_LoadBalancing
If you have ESS deployed on your portal, you will most probably need to do both.
Cheers Michael -
Question about the difference between MSPP and MSTP
Hell,
I wonder what is different between 15454 MSPP and SMTP.
Any answer will be appreciated.
ThanksMSPP and MSTP both use the same chassis. control and communication cards and software. The difference is that MSPP uses TDM (SONET and SDH) cards OCn, STMn, Cross connect, while MSTP is DWDM i.e transponders, ROADM, pre-amps e.t.c
-
A question about a difference between CS3 and CS6 (sorry if it's wrong addressed)
When I place in InDesign (both CS3 and CS6) a transparent tif image (CMYK) there is a difference between those created in Photoshop CS3 (correct) and CS6 (white background). Why?
EDIT: With the new InDesign CS6 update (8.1) Photoshop CS6 tifs with transparency import correctly now. Thank you
-
Communication between CRM and ERP for E-commerce scenario
Question more on lines of system architecture design.
We are planning to implement CRM E-commerce and wanted to find out more detail about the communication between CRM and ERP systems. Do they need to communicate in real time for this application, or is it mainly initial and delta loads? Is the amount of data exchanged huge ( necessitating both systems to be on the same network, or can they be on separate geographical locations )?
We also understand that E-commerce can also be done only using ERP. How does that differ from the CRM version?Hey Sanket,
Q 1 . Do CRM and ECC need to communicate in real time for Ecommerce application, or is it mainly initial and delta loads
Ans. CRM and ECC communicate using RFC connections which further uses TCP/IP as the protocol.The communication can be both real time { delta loads} or offline {initial download}.
Q2 .Is the amount of data exchanged huge ( necessitating both systems to be on the same network, or can they be on separate geographical locations )?
Ans. The amount of data can be huge hence its preferable that both systems to be on the same network.
Q 3. We also understand that E-commerce can also be done only using ERP. How does that differ from the CRM version
Ans.Theres no difference functionally but technically the application connects to the ECC system using JCO to execute all the RFC enabled function modules.
Warm Regards,
Sumit -
After Update of iPad and MacBookPro no communication between AppleTV and Devices
After Update of my iPad 2 with iOS 6.0 and OS to 10.8.2 there is no communication between AppleTV and these devices.
Start with this and follow all of the links and see it any of these suggestions work.
http://support.apple.com/kb/ts1368 -
Is in PI7.1 possible asynchronous communication between SOAP and ABAPProxy?
Hi,
when method execute_asynchronous has disapeared since XI/PI 7.1, is
there still way how to use ABAP proxy in asynchronous way?
We need to build asynchronous connection SOAP->PI->ABAP_Proxy.
In PI, both interfaces are defined as asynchronous (outbound for SOAP and
inbound for ABAP Proxy).
Despite of this fact, when message is sent, it is processed
synchronous way.
I have set breakpoint in my implementation of method for ABAP Proxy
message processing. When message is sent and breakpoint is reached,
whole connection stays open (between SOAP and PI and between PI and
ABAP Proxy) and waits for processing method (the breakpointed one) to
return. Only when processing method returns, is connection finelly
closed.
If i understand it correctly, this is synchronous behavior. In
asynchronous behavior, as i understand it, should be connection
between PI and ABAP Proxy of application server closed immediately
after message has been delivered. This mean before my processing
method is even called.
The same could be said about SOAP and PI communication. Connection
should be closed immediately after PI has received message. From
definition of asynchronous communication of PI is obvious, that PI
should receive message correctly and close connection to sender system
even when receiver is unreachable. It should deliver message later
when, receiver system is back on line. So why it keeps connection to
sender system open while it waits for receiver?
Why is this happening, when both interfaces are defined as
asynchronous? Could be the reason for this, if APPLICATION
ACKNOWLEDGEMENT is set on by default? If so, how can i change it
to SYSTEM ACKNOWLEDGEMENT, or disable it at all?
Or is this kind of asynchronous communication even possible since
XI/PI 7.1 ?
Processing of message we are sending can take some time, so we dont
want connection pending open while waiting for finish of
processing. Thats the reason why we have chose asynchronous model to
use.Quote from How to Use the J2EE SOAP Adapter:
"If you select Best Effort, the Web service client will receive a response
message in the SOAP body. Otherwise, the Web service client will not receive a
response message if no error occurs."
"if no error occurs" - that is the problem. In either case he still
waits if some error occure or not. I dont want it. Once PI has
received message, I want the connection with sender to be closed. If
there will be error in communication between PI and reciever, I want
to see it only in PI log. That mean no notification to sender to be
send about that error.
Is that possible? -
bluetooth connection between iphone and ipad no longer workers after upgrade to ver 8 - any help?
I'm trying to use the iphone as a remote with keynote, which again worked before the upgradeHi russellpaton,
Thanks for visiting Apple Support Communities.
If your iOS devices are not communicating with each other after updating to iOS 8, the troubleshooting steps in this article can help resolve this sitation as well:
If you can’t use a Bluetooth accessory or car kit
Cheers,
Jeremy -
Communication between jsp and abstractportalcomponent
Hello All
Communication between jsp and abstractPortalComponent.
jsp contains one input text field and one submit button.
when the user clicks on submit button it will call the component and that input value will
display in same jsp page.
how this communication will happen?
Rgrds
SriHi Srikanth,
In the JAVA File,
OnSubmit Event,
String inputvalue ;
InputField myInputField = (InputField) getComponentByName("Input_Field_ID");
if (myInputField != null) {
inputvalue = myInputField.getValueAsDataType().toString();
request.putValue("textvalue", inputvalue);
request is IPORTALCOMPONENTREQUEST Object.
In JSP File, to retreive the value,
<%
String textstring = (String) ComponentRequest.getValue("textvalue");
%>
In PORTALAPP.XML File,
<component name="component name">
<component-config>
<property name="ClassName" value="classname"/>
<property name="SafetyLevel" value="no_safety"/>
</component-config>
<component-profile>
<property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
</component-profile>
</component>
Using the code above, You can pass and read values between abstract portal component and Jsp Page.
Instead of this, I suggest you to use JSPDYNPAGE Component for Data Exchange.
Check the [Link|http://help.sap.com/saphelp_nw2004s/helpdata/de/ce/e0a341354ca309e10000000a155106/frameset.htm].
Hope this helps you.
Regards,
Eben Joyson -
Communication between : AP and WLAN controller
Hi,
The communication between AP and WLAN Controller is ( Data and Control ) UDP.
Source port 1024 and destination port 12222 and 12223. Actually which device listen to which port or both should listen as control and data can be generated from both the devices.
How does the user ( wireless client) traffic is switched - if user traffic is a TCP traffic. It will be sent to WLANC and then WLANC forwards it to respective VLAN or default gateway ( depending upon the destination in the packet ).
Please explain / share the experience.
any link on cisco.com
Thanka in advance
Subodh"the LWAPP Control and Data messages are encapsulated in UDP packets that are carried over the IP network. The only requirement is established IP connectivity between the access points and the WLC. The LWAPP tunnel uses the access point's IP address and the WLC's AP Manager interface IP address as endpoints. The AP Manager interface is explained in further detail in the
implementation section. On the access point side, both LWAPP Control and Data messages use an ephemeral port that is derived from a hash of the access point MAC address as the UDP port. On the WLC side, LWAPP Data messages always use UDP port 12222. On the WLC side, LWAPP Control messages always use UDP port 12223.
The mechanics and sequencing of Layer 3 LWAPP are similar to Layer 2 LWAPP except that the packets are carried in UDP packets instead of being encapsulated in Ethernet frames."
Taken from "Cisco 440X Series Wireless LAN Controllers Deployment Guide" -
COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET: US$20 AWARD FOR SOLUTION!
COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET PROBLEM (Easy Filter Java Applet) -
US$20 TO ANYONE WHO CAN RESOLVE THE PROBLEM
To forum visitors:
I am prepared to pay a standard shareware fee of US$20 to a user who can resolve this technical problem.
If your advice resolves the problem, I'll forward the payment to your postal address (include your
address with your reply, and also your email address)
I am attempting to enable a HTML button (using Javascript's onClick command) to directly input a number into one of the parameter text boxes in the Easy Filter Java applet (ie, enter a new color value number in the text field of the standard Colors Multiplicator Filter interface).
The applet is Freeware and can be downloaded at: http://www.javazoom.net/applets/easyfilter10/EasyFilter10.html
(It is a very effective bitmap display and editing utility)
To achieve this, I am trying to access the part of the applet that defines and sets the textbox. The text box is defined in the .class file by accessing the parameter details in the genericfilter.txt file (accompanies the .class files). I need to access 'private String appletInitialize()' and then one of the 'textFieldParameters' which sets the textbox.
I understand the basic syntax for referencing the applet:
document.appletname.setString("An example"). However, accessing the text fields in this applet is more complex!!
Please can you recommend the correct Javascript syntax to achieve communication with the applet.
Thank you for your kind assistance.
JM Graham
[email protected]
The Java source code for the applet: EasyFilter.class
# Easy Filter - E.B/JavaZOOM 1999 #
# Contact: [email protected] #
# http://javazoom.hypermart.net #
/* Originally compiled from EasyFilter.java */
import java.awt.*;
import java.io.*;
import java.net.*;
import java.applet.Applet;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.MemoryImageSource;
import java.awt.image.PixelGrabber;
import java.util.Vector;
public synchronized class EasyFilter extends Applet implements KeyListener
private String paramFileName;
private Color bgColor;
private Color fgColor;
private Color parColor;
private Color sepColor;
private Color titleColor;
private Color helpColor;
private int WinWidth;
private int WinHeight;
private String title;
private String logoFileName;
private String originalImageFileName;
private String filteredCaption;
private String originalCaption;
private Vector paramsName;
private Vector paramsValue;
private Vector paramsComment;
private Panel panelParameters[];
private Label labelParameters[];
private TextField textFieldParameters[];
private Label labelComments[];
private int nbParameters;
private ScrollPane scrollPaneParams;
private Panel panelParams;
private Image theLogo;
private Image theOriginalImage;
private Image theFilteredImage;
private int theOriginalPixelArray[];
private int logoWidth;
private int logoHeight;
private int imageWidth;
private int imageHeight;
private drawCanvas canvasTitle;
private Panel panelTitle;
private Label labelTitle;
private Panel panelImages;
private Panel panelOriginalImage;
private drawCanvas canvasOriginalImage;
private Label labelOriginalImage;
private Panel panelFilteredImage;
private drawCanvas canvasFilteredImage;
private Label labelFilteredImage;
private Panel panelHelp;
private Label labelHelp;
private int Yspc;
private FilterImplementation theFilter;
public void init()
String string = null;
string = appletInitialize();
setBackground(bgColor);
if (string != null)
removeAll();
setBackground(Color.white);
setForeground(Color.black);
Label label = new Label(new StringBuffer("Error: ").append(string).toString(), 1);
Panel panel = new Panel();
panel.add(label);
add(panel);
setLayout(new FlowLayout(1, 5, Yspc));
public void keyPressed(KeyEvent keyEvent)
panelHelp.removeAll();
boolean flag = true;
if (KeyEvent.getKeyText(keyEvent.getKeyCode()).equals("Enter"))
for (int i = 0; i < nbParameters; )
try
paramsValue.setElementAt(new Double(textFieldParameters.getText()), i);
i++;
catch (NumberFormatException e)
labelHelp.setText(labelParameters[i].getText() + ": Not a Number");
flag = false;
break;
if (flag == 1)
labelHelp.setText(" .... Running, please wait .... ");
labelHelp.setAlignment(1);
panelHelp.add(labelHelp);
panelHelp.doLayout();
theFilter.updateParameters(paramsValue);
theFilter.computeFilter();
theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
canvasFilteredImage.setImage(theFilteredImage);
canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
canvasFilteredImage.repaint();
panelHelp.removeAll();
labelHelp.setText("- Done -");
else
labelHelp.setText("- Press Enter to run the Filter -");
labelHelp.setAlignment(1);
panelHelp.add(labelHelp);
panelHelp.doLayout();
public void keyReleased(KeyEvent keyEvent)
public void keyTyped(KeyEvent keyEvent)
private String appletInitialize()
WinWidth = size().width;
WinHeight = size().height;
if (getParameter("bgcolor") == null)
bgColor = new Color(0, 0, 40);
else
bgColor = new Color(Integer.parseInt(getParameter("bgcolor"), 16));
if (getParameter("fgcolor") == null)
fgColor = new Color(255, 255, 255);
else
fgColor = new Color(Integer.parseInt(getParameter("fgcolor"), 16));
if (getParameter("sepcolor") == null)
sepColor = new Color(158, 128, 128);
else
sepColor = new Color(Integer.parseInt(getParameter("sepcolor"), 16));
if (getParameter("parcolor") == null)
parColor = new Color(24, 24, 24);
else
parColor = new Color(Integer.parseInt(getParameter("parcolor"), 16));
if (getParameter("titlecolor") == null)
titleColor = new Color(255, 255, 0);
else
titleColor = new Color(Integer.parseInt(getParameter("titlecolor"), 16));
if (getParameter("helpcolor") == null)
helpColor = new Color(0, 255, 255);
else
helpColor = new Color(Integer.parseInt(getParameter("helpcolor"), 16));
paramsName = new Vector();
paramsValue = new Vector();
paramsComment = new Vector();
paramFileName = getParameter("paramfile");
String string = readParams(paramFileName);
if (string != null)
return string;
MediaTracker mediaTracker = new MediaTracker(this);
theOriginalImage = getImage(getDocumentBase(), originalImageFileName);
mediaTracker.addImage(theOriginalImage, 0);
if (logoFileName != null)
theLogo = getImage(getDocumentBase(), logoFileName);
mediaTracker.addImage(theLogo, 1);
try
mediaTracker.waitForAll();
catch (InterruptedException e1)
return "Error while loading image";
if (mediaTracker.isErrorAny())
return "Error while loading image";
if (logoFileName != null)
logoWidth = theLogo.getWidth(this);
logoHeight = theLogo.getHeight(this);
imageWidth = theOriginalImage.getWidth(this);
imageHeight = theOriginalImage.getHeight(this);
theOriginalPixelArray = new int[imageWidth * imageHeight];
PixelGrabber pixelGrabber = new PixelGrabber(theOriginalImage, 0, 0, imageWidth, imageHeight, theOriginalPixelArray, 0, imageWidth);
try
pixelGrabber.grabPixels();
panelTitle = new Panel();
canvasTitle = new drawCanvas();
labelTitle = new Label();
panelTitle.setLayout(new FlowLayout(1, 10, Yspc));
add(panelTitle);
panelTitle.setBackground(bgColor);
panelTitle.add(canvasTitle);
canvasTitle.setImage(theLogo);
canvasTitle.setBounds(0, 0, logoWidth, logoHeight);
labelTitle.setText(title);
catch (InterruptedException e2)
return "Internal Error, Try RELOAD !";
if (title != null)
panelTitle.add(labelTitle);
labelTitle.setForeground(titleColor);
labelTitle.setFont(new Font("Dialog", 1, 14));
panelImages = new Panel();
panelOriginalImage = new Panel();
canvasOriginalImage = new drawCanvas();
labelOriginalImage = new Label();
panelFilteredImage = new Panel();
canvasFilteredImage = new drawCanvas();
labelFilteredImage = new Label();
panelImages.setLayout(new FlowLayout(1, 10, Yspc));
add(panelImages);
panelImages.setBackground(bgColor);
panelOriginalImage.setLayout(new BorderLayout(0, 2));
panelImages.add(panelOriginalImage);
panelOriginalImage.setBackground(Color.black);
panelOriginalImage.add("Center", canvasOriginalImage);
canvasOriginalImage.setImage(theOriginalImage);
canvasOriginalImage.setBounds(0, 0, imageWidth, imageHeight);
labelOriginalImage.setText(originalCaption);
labelOriginalImage.setAlignment(1);
panelOriginalImage.add("South", labelOriginalImage);
labelOriginalImage.setBackground(Color.lightGray);
labelOriginalImage.setForeground(Color.black);
labelOriginalImage.setFont(new Font("SansSerif", 0, 10));
panelFilteredImage.setLayout(new BorderLayout(0, 2));
panelImages.add(panelFilteredImage);
panelFilteredImage.setBackground(Color.black);
panelFilteredImage.add("Center", canvasFilteredImage);
theFilter = new FilterImplementation(paramsValue, theOriginalPixelArray, imageWidth, imageHeight);
theFilter.computeFilter();
theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
canvasFilteredImage.setImage(theFilteredImage);
canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
labelFilteredImage.setText(filteredCaption);
labelFilteredImage.setAlignment(1);
panelFilteredImage.add("South", labelFilteredImage);
labelFilteredImage.setBackground(Color.lightGray);
labelFilteredImage.setFont(new Font("SansSerif", 0, 10));
scrollPaneParams = new ScrollPane(0);
panelParams = new Panel();
nbParameters = paramsName.size();
int i = WinHeight - (33 + 7 * Yspc + logoHeight + imageHeight + 23);
if (i < Yspc + 2 + 24)
i = Yspc + 2 + 24;
scrollPaneParams.setBounds(0, 0, WinWidth - 10, i);
panelParams.setLayout(new GridLayout(nbParameters, 1, 5, Yspc / 2));
scrollPaneParams.add(panelParams);
panelParams.setBackground(sepColor);
panelParameters = new Panel[nbParameters];
labelParameters = new Label[nbParameters];
textFieldParameters = new TextField[nbParameters];
labelComments = new Label[nbParameters];
for (int j = 0; j < nbParameters; j++)
panelParameters[j] = new Panel();
panelParameters[j].setLayout(new FlowLayout(0, 5, 1));
panelParams.add(panelParameters[j]);
panelParameters[j].setBackground(parColor);
labelParameters[j] = new Label();
labelParameters[j].setText((String)paramsName.elementAt(j));
panelParameters[j].add(labelParameters[j]);
labelParameters[j].setForeground(fgColor);
labelParameters[j].setFont(new Font("Dialog", 1, 12));
textFieldParameters[j] = new TextField(8);
textFieldParameters[j].setText(paramsValue.elementAt(j).toString());
panelParameters[j].add(textFieldParameters[j]);
textFieldParameters[j].setBackground(fgColor);
textFieldParameters[j].addKeyListener(this);
labelComments[j] = new Label();
labelComments[j].setText((String)paramsComment.elementAt(j));
panelParameters[j].add(labelComments[j]);
labelComments[j].setForeground(fgColor);
add(scrollPaneParams);
panelHelp = new Panel();
labelHelp = new Label();
panelHelp.setLayout(new FlowLayout(1, 5, 0));
add(panelHelp);
panelHelp.setBackground(bgColor);
labelHelp.setText(" Change colour values and press enter ");
labelHelp.setAlignment(1);
panelHelp.add(labelHelp);
labelHelp.setForeground(helpColor);
return null;
private String readParams(String string1)
Object object1;
String string2;
if (string1 == null)
return "Filename of filter's parameters needed";
try
URL uRL = new URL(getDocumentBase(), string1);
URLConnection uRLConnection = uRL.openConnection();
uRLConnection.setDoInput(true);
uRLConnection.setUseCaches(false);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream()));
string2 = null;
catch ()
return object1.getMessage();
catch ()
return object1.getMessage();
catch ()
return object1.getMessage();
if (bufferedReader != null)
Object object2;
try
for (object2 = bufferedReader.readLine(); object2 != null && string2 == null; object2 = bufferedReader.readLine())
string2 = extractFormat(object2);
catch ()
string2 = object2.getMessage();
finally
bufferedReader.close();
if (string2 != null)
return string2;
else
return null;
private String extractFormat(String string1)
if (string1.length() == 0)
return null;
int i = 0;
int j = string1.indexOf(" ", i);
if (j == -1)
return "Bad format error (space missing)";
String string2 = string1.substring(i, j);
if (string2.equals("TITLE"))
i = j;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in TITLE missing)";
i = j + 1;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in TITLE missing)";
title = string1.substring(i, j);
return null;
if (string2.equals("ORIGINALCAPTION"))
i = j;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in ORIGINALCAPTION missing)";
i = j + 1;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in ORIGINALCAPTION missing)";
originalCaption = string1.substring(i, j);
return null;
if (string2.equals("FILTEREDCAPTION"))
i = j;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in FILTEREDCAPTION missing)";
i = j + 1;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in FILTEREDCAPTION missing)";
filteredCaption = string1.substring(i, j);
return null;
if (string2.equals("LOGO"))
i = j + 1;
j = string1.length();
logoFileName = string1.substring(i, j);
return null;
if (string2.equals("ORIGINALIMAGE"))
i = j + 1;
j = string1.length();
originalImageFileName = string1.substring(i, j);
return null;
if (!string2.equals("PARAM"))
return null;
i = j;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format in a PARAM line";
i = j + 1;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format in a PARAM line";
paramsName.addElement(string1.substring(i, j));
i = j + 2;
j = string1.indexOf(32, i);
if (j == -1)
return "Bad format in a PARAM line";
try
paramsValue.addElement(new Double(string1.substring(i, j)));
j = string1.indexOf(34, i);
catch (NumberFormatException e)
return "Bad format in a PARAM line";
if (j == -1)
return "Bad format (Double quote in PARAM comment missing)";
i = j + 1;
j = string1.indexOf(34, i);
if (j == -1)
return "Bad format (Double quote in PARAM comment missing)";
paramsComment.addElement(string1.substring(i, j));
return null;
public EasyFilter()
logoHeight = 33;
Yspc = 5;Addition to my above submission
To clarify, I'll offer the US$20 to the FIRST person who offers me a workable solution to the problem, not to everyone!!!
JMGRAHAM -
Communication between SAP and 3rd Party Systems using IDOC HTTP XML Interfa
Hi
i am try do
Communication between SAP and 3rd Party Systems using IDOC HTTP XML Interface
With The help of SDN Contribution
link----
( have look on it)
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4943f2b7-0a01-0010-37af-faff35b2f08c
I am getting error in
Partner system as HTTPLOG and "Execute" to check the results
Error is -- Port could not be created
RFC destination HTTPLOG Not specified for system HTTPLOG
any 1 have any idea if plzzzzzzzz...........
Thank u
RamHello .
we are also in process of implementing the same
could you share the knowledge pl?
1)is it a separate add on with ALE to saphr
or using ECC ??
2)can u share the configuration part ??
we are trying it on webas as addon 3.0 .
Maybe you are looking for
-
After years of playing Snood, w/o problems, I started getting this error message, on my iMac, OS 10.5.8, with 4 GB of memory when opening Snood: Not enough memory {Error # :: 0, in sound.cp@line 101 My MacBook Pro w. Mac OS 10.6.8 did not have this
-
Keyboard & Mouse Not Working (fresh install/open source ati driver)
As the title says, I have a fresh install of arch, installed and configured the xorg as the "Beginners Guide" suggested. my xorg.conf is as following: Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "C
-
Error when reading BLOB field from Oracle usin Toplink
We experience a very annoying problem when trying to read a BLOB field from Oracle 8.1.6.2.0 using TOPLink 3.6.3. I have attached the exception stack trace that is reported to the console. As far as I can judge a fault at oracle.sql.LobPlsqlUtil.plsq
-
I am trying to buy more iCloud memory and get an error message
I am trying to buy more iCloud memory and get an error message
-
Thread run() can't return an object?
I am using threads with Runtime.exec() to run system commands (like ps command on Unix) and I need to have the method return what the executed commands return e.g. the response from the ps command; however, the run() method in the Thread interface is