Output changes although input doesn't
Hi guys, I have a query.
Firstly, I'm using JDK 1.3.1_02 and Forte for Java, Community Edition version 3 build 010925.
I have written a class with a method that reads a String of 2 characters. Being hexadecimals, I use a switch statement with the checking of each character. As with my normal practice, I would compile both source codes (my main calls this particular class), and run my execution.
The source codes below have worked before, even moments just before i commented out my method call in main. When I uncomment it next, it returns the wrong result. Checking each character of the string doesn't turn up any anomaly. Currently, it is churning out the right result again. However, it doesn't feel stable at all and this has me worried.
1) is this problem i face software related?
2) does it have anything to do with buffers?
3) is this problem code related?
4) are there any better practice i should add in?
how can i ensure the application i'm writing is stable? constantly testing it currently is slowing my progress alot. =(
public class errorMsg {
/** Creates new Message */
public errorMsg() {
public static void printErrorCode(String str) {
if (str.length() == 2)
{ StringBuffer strBuf = new StringBuffer();
String strErrMsg = new String();
strBuf.append(str).append(": ");
for (int n=0; n<str.length(); n++)
{ System.out.println(str.charAt(n));
switch (str.charAt(0))
{ case '0':
System.out.println("first char is '0'");
switch (str.charAt(1))
{ case '1': strErrMsg = "The radio modem has received an order from the network to stop all user traffic.";
break;
case '2': strErrMsg = "The radio modem has received an order from the network to resume user traffic.";
break;
case 'A': strErrMsg = "Reception buffer is full, i.e., the radio modem cannot receive more MPAKs from the network.";
break;
case 'B': strErrMsg = "Buffer/memory free, i.e., the radio modem starts to receive MPAKs from the network again.";
break;
} break;
case '1':
switch (str.charAt(1))
{ case '0': strErrMsg = "The radio modem returns an MPAK to the PC because it has received an order from the network to stop all user traffic.";
break;
case '3': strErrMsg = "The radio modem returns an MPAK to the PC because the transmission buffer is full.";
break;
case '6': strErrMsg = "Login Request denied, MAN already exists in the flexlist.";
break;
case '7': strErrMsg = "Login Request denied, the flexlist is full.";
break;
case '8': strErrMsg = "The MPAK's sender MAN is neither the TMAN(Terminal subscription MAN), nor in the flexlist.";
break;
} break;
case '5':
switch (str.charAt(1))
{ case '1': strErrMsg = "Invalid MPAK type, must not be transmitted.";
break;
case '2': strErrMsg = "Invalid MPAK state.";
break;
case '3': strErrMsg = "Invalid MPAK flags.";
break;
case '4': strErrMsg = "Invalid send list.";
break;
case '5': strErrMsg = "Invalid MPAK length.";
break;
case '6': strErrMsg = "Invalid addressee in MPAK.";
break;
} break;
case '6':
switch (str.charAt(1))
{ case '1': strErrMsg = "TEMP_DEFAULT_LIST received from PC is incorrect.";
break;
case '2': strErrMsg = "MPAK returned on command (frame F1 or F0).";
break;
case '3': strErrMsg = "User tries to change into already active mode (express/battery save).";
break;
case '5': strErrMsg = "Mode change already activated. The message will be sent if two equal mode change orders are given consecutively.";
break;
case '6': strErrMsg = "Invalid network ID.";
break;
case '7': strErrMsg = "Mode MPAK with invalid parameter.";
break;
} break;
case 'A':
if (str.charAt(1) == '0')
{ strErrMsg = "Transmission buffer is full, i.e., memory in buffer is not large enough for an MPAK of maximum length.";
break;
} break;
case 'E':
if (str.charAt(1) == '0')
{ strErrMsg = "Radio transmission has failed.";
break;
} break;
case 'F':
switch (str.charAt(1))
{ case '0': strErrMsg = "Transmit queue is full, i.e., number of MPAKs has reached the upper limit.";
break;
case 'D': strErrMsg = "Other error, the radio modem is not able to transmit any MPAKs.";
break;
} break;
default: strErrMsg = "Unidentifiable Error!";
break;
strBuf.append(strErrMsg);
System.out.println(strBuf);
else System.out.println("Incorrect Error Code Identifier!");
// in main, my method call
errorMsg.printErrorCode("0A");
it did not provide the proper result of 0x0A but instead, printed Unidentifiable Error! in the "Unidentifiable Error" case, it never went into the inner switch, but it prints 0A, then the only possible cause is the 0 and O confusion. Make sure 0 (zero) and O (letter O) not mixed when calling it in your main method.
Yet, better use a HEX parser method to get the error code in decimal and do a simple switch on all case.
--lichu
Similar Messages
-
i have the 2.5GHz i5 macbook pro that came out in june of 2012, i updated to OSX version 10.8.1 and now i am unable to change the 3.5mm headphone output into an input.
i have the 2.5GHz i5 macbook pro that came out in june of 2012, i updated to OSX version 10.8.1 and now i am unable to change the 3.5mm headphone output into an input.
-
How to change the input and output schema in BPEL process
hi',
Please tell me how to change the input and output schema in BPEL process after the process is made.
thanks
YatanIf your intention is just changing the content you are passing to bpel/returning from bpel
Here is another way
just update your default created xsd files with new elements, update wsdl elements in message definition and chnage bpel code to reflect new elements in activities
Regards,
Praveen -
Change output pins to input pins on Keil MCB2300
I have a Keil MCB2300 setup and successfully running w/ LV2010. I want to know how do I change the digital pins from outputs to inputs. LabVIEW defaults to 7 outputs and 1 input, but surely I can chan;ge these. The Keil schematics just label the pins as digital w/out designating input or output.
thanks,
jason
Attachments:
ss1.PNG 37 KB
ss2.PNG 243 KBJason,
I found a document that I think may be helpful in configuring your inputs/outputs. It details how to create new I/O items for ARM targets which is what I believe the Keil MCB2300 is. Try following the steps in this document.
http://zone.ni.com/reference/en-XX/help/372459C-01/lvarmhelp/arm_eio_creating/
Regards,
-Nick-
Nick C | Staff LabVIEW Platform Product Support Engineer | National Instruments -
Change screen output to HDMI input
I have inserted a HDMI cable into my laptop, and wish to use my laptop screen to display the content of the device on the other end of the HDMI cable. How can I do this?
Unfortunately, this isn't possible, as the HDMI connector on your laptop is an output, not an input.
-
I can't change my input on Logic to my Tascam US-1800
i Just bought the Tascam US-1800. I bought it to record myself singing and my guitar but when i try to change the input or output the audio interface doesn't show up so i cant change it. I set the interface as the input and output on my mac. On logic i can't change the input or output to the tascam so when i record something it records through the internal mic.
Please help!!Delete and sign in with another id.
-
Hi, I'm using a NI USB 6009 device. I am using the analog output to drive very small currents (less than 1 micro Amp) through a 1 MOhm resistor. I find that the output often changes significantly when I begin to acquire data, or if the computer is doing something, such as fitting data, or even if I am simply opening other files or programs. Any advice?
Thanks!
MicahHi, thanks for the responses.
I'm outputing a DC voltage with values typically ranging from 0.1 V to 1 V. The signal goes through a 1 MOhm resistor in series with a coil for producing very small magnetic fields applied to an atomic magnetometer. It appears that the output changes by tens of millivolts, as recorded by a yokogawa oscilloscope with input impedance of 1 MOhm. The coil and scope are both grounded. I am using only a single input channel on the USB6009, coming from an SRS voltage preamp with output impedance of 50 Ohms
I can also infer that there are changes in the current when the computer "does something" by looking at the signal in the atomic magnetometer.
Perhaps it would help if I shunted the output with some smaller resistor, say 10kOhm?
I will look at the document you mentioned.
Thanks again. -
Unicode Input doesn't work with some languages
Flash Player 10 - 10_0_12_36
WinXP
Steps to reproduce:
1. Open the "Languages" Tab
2. Check "Install files for complex..." checkbox
3. Press Apply, Windows may ask you to insert your Windows XP
Installation CD
4. Press on the "Details" button
5. Press the "Add" button
6. Choose the "Armenian" or select item from the first combo
box,
7. Press OK
8. Press the "Language Bar..." button
9. Check the "Show the Language bar on the desktop" checkbox
if it is not checked
Now try to write in Armenian language in the edit box, the
font is Sylfaen which is supporting Armenian.
You will see "?"-s instead of letters.
Now open the Notepad, select the Sylfaen font in
Format->Font menu item, write something in mentioned language,
you will see normal letters,
now copy them and pasete them to the edit box below, you will
see normal text, so, normal input doesn't working, copy-paste is
working.It looks like the syntax has changed slightly. I verified this works in Mavericks
Here is the new syntax:
defaults write com.apple.finder AppleShowAllFiles -boolean true
killall Finder
The reverse is
defaults delete com.apple.finder AppleShowAllFiles
killall Finder
Thanks to JaFaint:
https://discussions.apple.com/message/23629427#23629427 -
Opening terminal with applescript - changes default input language....
When I try to use Applescript to open terminal, it opens it but changes the input language to Japanese, so anything that I attempt to feed into terminal via applescript turns into nonsense Japanese. (The default language is English and kotoeri is set to romaji/roman alphabet by default)
How do i stop this?
ThanksSince my snow leopard MBP can't handle smb mounts, I've resorted to using sharity, except that its gui crashes the instant I try to mount a drive. But I can mount samba shares using sharity from the command line. I'd like to have it mount on startup which is supposedly something sharity can accomplish from its gui but since that doesn't work I would like to write an applescript and add it to the login items. I haven't been able mount it using do shell script as the sharity command line, unlike the normal samba mount command) doesn't seem to have an option of entering the password, so the mount fails:
sharity mount smb://user@address/folder
I thought if I open terminal via applescipt, then have it 'type' the command followed by a delay, then type the password, I could get around it but when I open terminal in applescipt, it starts in Japanese:
activate application terminal
tell application "System Events" to keystroke "sharity mount smb://user@address/folder"
tell application "System Events" to keystroke return
delay 2
tell application "System Events" to keystroke "password"
delay 2
tell application "Terminal"
quit
end tell
This almost does what I want it to but the input language has flipped to Japanese and sharityもうんtsmb://Sトラゲ-0165/けいthぱっすぉrd
is the result
Basically its all because of the samba bug in snow leopard (which I reported to apple and they confirmed its the same issue they know about) -
ProtocolException: Cannot write output after reading input
If I use the following code
this.conn is a database connection while urlConn is a HTTPUrlConnection
if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
{ this.conn.commit(); }
else
System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
throw new MppException(urlConn.getResponseMessage());
byteStream.writeTo(urlConn.getOutputStream());I get the following exception
ProtocolException: Cannot write output after reading input
if However I change the order and instead use
byteStream.writeTo(urlConn.getOutputStream());
if (String.valueOf(urlConn.getResponseCode()).trim().startsWith("2"))
{ this.conn.commit(); }
else
System.out.println("FAILED BECAUSE " + urlConn.getResponseMessage());
throw new MppException(urlConn.getResponseMessage());
It works fine but in that case there might be a deadloack on the server side since both the client and server in that case try to modify tables on the same db.
any work arounds???????HTTP is a request / Responce based protocole where all the data to be send to the server must be included in the request and then the server send all the data as the responce.
By the time you read the responce the request is already send and the server have finished processing it. So it is not posible to send more data to the same request. -
As I'm trying to watch tv shows I've bought from iTunes the sounds keep turning on and off.
I opened the sound preferences and found the output was switched to digital out- I cant even remember the last time I put headphones in!
Then, as I put my show on, right before my eyes the sound output changed from digital out to internal speakers (at which point I could hear my show once again) before it just as quickly changed to digital out without me doing anything at all!
How can I stop this?I don't think there is a real fix to the problem, there was a thread about this a while back and no one came up with anything, but to just get it to go back to built-in output, try plugging an 1/8th inch cable into the audio out jack, then either a) jiggle the plug in the jack (seems to have worked for other people) or b) adjust the computer volume (worked for me - I used the keyboard buttons rather than the sound preferences to do it, not sure if it makes a difference), then unplug it, and your sound output SHOULD change back to your internal speakers. Hopefully. Try both methods a couple of times if it doesn't.
-
How to change System Input Method ?
I tried to write multilingual program.
I have system input method and specific input method code (lib/ext).
How to change System Input Method from a code ?
or
How to handle an event when i chage system input method in the Windows.
(My OS is Windows XP).
I tried to do (for example):
java.awt.im.InputContext ic = this. getInputContext ();
ic.selectInputMethod(new Locale ("ru"));
It doesn't help.up
-
How can we change the input field on a view stop showing zeros
Hello,
To make screen look consistent with other character input field. How can we change the input field on the view stop displaying zeros even though the data type is NUMC and data type should not be change?
Edited by: sap_learner on Mar 25, 2010 5:44 PM
Edited by: sap_learner on Mar 25, 2010 5:49 PM
Edited by: sap_learner on Mar 25, 2010 5:55 PMhello Manas Dua,
Thanks for your help. I am able to resolve my problem.
My code will help the future comers to resolve this kind of issues.
*The code is applied to method WDDOINIT of the default view.
DATA lo_nd_terms_input TYPE REF TO if_wd_context_node.
DATA lo_nd_terms_input_i TYPE REF TO if_wd_context_node_info.
DATA lv_zeros TYPE wdy_attribute_format_prop.
lv_zeros-null_as_blank = 'X'.
lo_nd_terms_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
lo_nd_terms_input_i = lo_nd_terms_input->get_node_info( ).
lo_nd_terms_input_i->set_attribute_format_props(
EXPORTING
name = `ENTER THE ATTRIBUTE NAME`
format_properties = lv_zeros ).
Edited by: sap_learner on Mar 26, 2010 5:02 PM -
Trying to connect my panasonic viera TV to my new Apple TV with a dynex 1080p hdmi cable but the hdmi option won't show up on my tv when I try to change the input. Any suggestions welcome!
Your profile claims Apple TV 2. 1080p is only available withe the Apple TV 3. Apple TV 2 is maxed out at 720p.
Hope that helps -
Change the input parameter in Check Status screen
Hi,
I have a requirment to change the input parameter option in the check status screen. Currently when we search the SC using the date and staus from the extended search it picks the SC created date and displays the SC, my requirement is to make the date as the approved date insted of SC created date with the status as aprpoved.
Please suggest if this is possible with the help of any Badi.
Regards
GGLI managed to find the solution myself. If anyone is interested, just follow those steps here:
http://apple.stackexchange.com/questions/44913/make-a-custom-keyboard-layout-the -system-default-even-for-the-login-screen
(terminal skills required tho)
Maybe you are looking for
-
Oracle 11g ADR Purged trace file list
In Oracle 11g, how do I get list of files automatically purged by ADR ? Is there any data dictionary view or physical file which keeps track of trace files deleted by ADR ?
-
What on earth is iTunes 1 ?!?
I opened iTunes but it says iTunes 1 and there is nothing there! If I search for mp3 files in Finder I can find them but if I open them from Finder they play but in iTunes 1. They will then remain in the playlist in there. How do I get iTunes to open
-
Where is os maverick located that I may remove it?
I am trying to remove QS X MAVERICKS downloaded witout an APP I cannot use the advice on how to remove maverick by an APP It is not installed anywhere in files or APPLICATIONS MAVERICKS HAS RUINED MY MAC & hope somebody could help me remove it? date
-
Hi, We have a DMVPN with 2 hubs and many spokes. The traffic is tunneled to the hub\headends. I'm trying to create an access-list on one spoke router so the devices on that spoke can only reach a couple of devices via Remote Desktop at the Main Campu
-
I have an older G3 500mhz iMac and wondered if it would be possible to install a copy of OSX10.3 on it. I can't even get it to boot from the install disc.