Concat strings from different subdiagram​s of a case structures
I am using a case structure, which has about 8-10 different case and each case has a string constant. I want to show the strings in a single indicator. Suppose if 3 cases runs first then second and then third. Then the indicator should show
" first case
second case
third case"
initially indicator should be empty then as soon as the first case runs indicator should show " first case"
after finishing the first case when second case runs then the indicator should show
"first case
second case"
and so on..Please help me.
Solved!
Go to Solution.
$agar wrote:
Here it is attached with 3 cases........
Well, that does not look very useful. Try to scale it to 10 booleans!
Here is a quick draft how it could be done. Modify as needed.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
ConcatenateCaseStrings.vi 9 KB
Similar Messages
-
How do I select different graphs to show using case structure?
Hello,
I am working on a piece of code where I am getting data from 6 different sources (reading temperature & pH on 6 different tanks)... I am using
1) a case structure
2) while loop
3) waveform chart
Now, I want to have it so, the User selects which graph he wants to see (tank 1, tank 2, tank 3, etc...). And then, program ONLY SHOWS the graph for THAT TANK...
So I have an Event Structure with the "Tank #" control, which is supposed to change the graph that is on display. However, right now, it is not working.
Let's say I start the program..., then I click "Tank 1"... it graphs Tank 1... then I click "Tank 2"... instead of COMPLETLY CHANGING the graph, it CONTINUES to graph the data from TANK 2 on the same graph. I.E.: it plots points 1 - 7 from TANK 1, then plots points 8 - 15 from TANK 2,.... on the same Graph.
I don't want that. I want it to change the graph. But if I put the graph in the Case Structure, it puts multiple graphs on the Front Panel... How can I do it?
NOTE: Ignore case 3. And each case should be corresponding to Tank #...
Thank your for reading--
Attachments:
GraphProblem_NI forum.vi 3166 KBthe easy answer is that you should clear your waveform graph before sending new data to it...
It's as easy as writing an empty array to it's property node Value...
But..
you've got much... much more cleaning up to do. Clearing the graph is just one thing.
Your code is unreadable. Why do you have 3 While Loops?
What does the bottom one do?
Why are you complicating things with cluster going into the queue? An enumerator would do the same trick.
Is this code going into a cRIO or cFieldpoint? If not, what's up with using Shared Variables? Are you planning to send data over the network?
Debugging this code will become a nightmare. Scalability will be worse..
I would recommend refactoring the code while it is still manageable. -
How to create session id from different string controls
how to create session id from different string controls
fais,
Please create the VI you are talking about and save some default data into all of the controls. Also on the front panel, place the session ID that should be generated by that data. Now, post your VI to a response so I can download it. I can then take this VI and help you create the functionality. (Please post what version of LabVIEW you are using.)
My guess it that you are going to need to use a good number of string concatenations as well as a few string indexes to get parts of strings out. As for the date, you can use a Property node with the Numeric Text.Text property to get the actual string displayed on the front panel for the date and parse out the parts that you want.
Randy Hoskin
Applications Engineer
National Instruments
h
ttp://www.ni.com/ask -
Join Nodes from different XML strings
Hi,
Please can you help me in joining 2 similar XML documents such that required nodes are appended.
Need to combine the nodes of XML (input source:String) A and B as below:
A:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
<ns0:Header>
<ns0:ProjectName>Services-1</ns0:ProjectName>
<ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
</ns0:Header>
<ns0:Body>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>0</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>48</ns0:CLS>
<ns0:COM>410</ns0:COM>
<ns0:SW>P</ns0:SW>
<ns0:ALT_ID> </ns0:ALT_ID>
<ns0:ACTV_CD>I</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>96</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>48</ns0:CLS>
<ns0:COM>935</ns0:COM>
<ns0:SW>D</ns0:SW>
<ns0:ALT_ID>F$</ns0:ALT_ID>
<ns0:ACTV_CD>A</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
</ns0:Body>
</ns0:MSG_Cont>B:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
<ns0:Header>
<ns0:ProjectName>Services-1</ns0:ProjectName>
<ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
</ns0:Header>
<ns0:Body>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>0</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>98</ns0:CLS>
<ns0:COM>910</ns0:COM>
<ns0:SW>P</ns0:SW>
<ns0:ALT_ID> </ns0:ALT_ID>
<ns0:ACTV_CD>I</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>96</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>98</ns0:CLS>
<ns0:COM>435</ns0:COM>
<ns0:SW>D</ns0:SW>
<ns0:ALT_ID>F$</ns0:ALT_ID>
<ns0:ACTV_CD>A</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
</ns0:Body>
</ns0:MSG_Cont>Combined (desired Output):
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MSG_Cont xmlns:ns0="http://xmlns.sample.xml.com/Xref">
<ns0:Header>
<ns0:ProjectName>Services-1</ns0:ProjectName>
<ns0:TimeStamp>11-05-2007 08:24:08</ns0:TimeStamp>
</ns0:Header>
<ns0:Body>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>0</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>48</ns0:CLS>
<ns0:COM>410</ns0:COM>
<ns0:SW>P</ns0:SW>
<ns0:ALT_ID> </ns0:ALT_ID>
<ns0:ACTV_CD>I</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>96</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>MGR</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>48</ns0:CLS>
<ns0:COM>935</ns0:COM>
<ns0:SW>D</ns0:SW>
<ns0:ALT_ID>F$</ns0:ALT_ID>
<ns0:ACTV_CD>A</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>0</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>BUY</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>INT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>98</ns0:CLS>
<ns0:COM>910</ns0:COM>
<ns0:SW>P</ns0:SW>
<ns0:ALT_ID> </ns0:ALT_ID>
<ns0:ACTV_CD>I</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
<ns0:MID_INTER_XREF>
<ns0:INT_ID>96</ns0:INT_ID>
<ns1:CDS_Person xmlns:ns1="http://xmlns.sample.xml.com/PXref">
<ns1:PERS_TITLE>TECH</ns1:PERS_TITLE>
<ns1:PERS_FIRST_NM>TEMP</ns1:PERS_FIRST_NM>
<ns1:PERS_LAST_NM>GRT</ns1:PERS_LAST_NM>
</ns1:CDS_Person>
<ns0:CLS>98</ns0:CLS>
<ns0:COM>435</ns0:COM>
<ns0:SW>D</ns0:SW>
<ns0:ALT_ID>F$</ns0:ALT_ID>
<ns0:ACTV_CD>A</ns0:ACTV_CD>
<ns0:LST_UPDT_DT>2006-01-30</ns0:LST_UPDT_DT>
</ns0:MID_INTER_XREF>
</ns0:Body>
</ns0:MSG_Cont>Trying to use the dom document.importNode() and appendChild(). But, looks like appendChild removes any already existing node (in this case - ns0:MID_INTER_XREF).
Any help appreciated.
TIA,
PraveenWell, the requirement was to have elements from different XML in a single master XML. The way we achieved this - read from each XML, append to a string buffer and construct the combined XML (which passes on for use elsewhere).
Hope this helps anyone with a similar requirement.
Many Thanks for looking. -
Is it possible to pass a string from an applet to the web site?
Hi, everybody!
Is it possible to pass a String from an applet to a web site (as a field value in a form, an ASP variable, or anything else). Basically, I have a pretty large String that is being edited by an applet. When a user clicks on the submit button, a different page will show up which has to display the modified string. The String is pretty large so it doesn't fit into the URL variable.
Please, help!
Thank you so much!Why do you want to do this in Java?
Javascript is the correct language for these type of situations.
for instance:
in the head of your html document:
<script language=javascript type="text/javascript">
createWindow(form){
if(form.text.value!=""){
newDoc = new document
newDoc.write(form.text.value)
newWin = window.open(document,'newWin','width=200;height=150')
</script>
in the body:
<form onSubmit="createWindow(this)">
<p>
Enter a String:<input type=text size=30 name="text">
</p><p>
<input type=submit value="submit">
<input type=reset value="reset">
</p>
</form> -
Udf to pass constant corrsponding to 2 file names from different location
if i have one source file, i m able to pass the file name directly to the target through the udf below:
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
But i have 2 files from different location. Now both files has dates at the end. how can i pass AAA for File1.txt and BBB for File2.txt. .
after the above code, i have included below code too, but not working(*-for date n timestamps):
if(ourSourceFileName.equals("ABC*.txt"))
return "FILE1";
else if(ourSourceFileName.equals("XYZ*.txt"))
return "FILE2";
please suggestHi Basker,
Error in activating object in IR - heres the total code i have used for this purpose. plz help in getting this.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
if(ourSourceFileName.equals("SOURCE_1*.txt"))
return "File1";
else if(ourSourceFileName.equals("SOURCE_2*.txt"))
return "File2";
Source code has syntax error: /usr/sap/DXI/DVEBMGS31/j2ee/cluster/server0/./temp/classpath_resolver/Map27461f402eff11e0898d00144f1e71f0/source/com/sap/xi/tf/_MM_UPDATE_.java:839: unreachable statement if(ourSourceFileName.equals("SOURCE1_*.txt")) ^ /usr/sap/DXI/DVEBMGS31/j2ee/cluster/server0/./temp/classpath_resolver/Map27461f402eff11e0898d00144f1e71f0/source/com/sap/xi/tf/_MM_UPDATE_.java:844: missing return statement } ^ 2 errors -
Java receive files from different station ??
Hi,
I would like that a station can receive files from different stations in the same time.
For that, I use multi-threading (with different socket TCP). I have just a problem, sometimes files received are empty or contains just the last line of file. I don't know why, I saw all datagrams on the network but at reception sometimes it reads just the end.
The class to receive file functions when it receives just one file, but when files comes at the same time there are some problem.
Is there a problem of thread ? (I start a thread but I don't know where stop it) or a problem in my class for receive file:
For sending a file:
while((len = fis.read(buffer,0,1024))!= -1)
os.write(buffer, 0, len);
new LogFile().writeLogFileError
For receiveing file:
while((len = is.read(buffer,0,1024))>=0)
fos.write(buffer, 0, len);
//when theres a problem, I receive -1 the first time, but I am sure data are sent to this station
Is someone had same problem ?
Thank you
MarylineMaryline,
its probably a better idea to use Stream Sockets, as opposed to datagrams, as the datagrams can be delivered in any order (hence end of file so soon possibly).
On the Server Station do the following:
import java.net.*;
import java.io.*;
private final int SERVER_PORT = 4567;
private final int SERVER_BACKLOG = 100
ServerSocket server = new ServerSocket( SERVER_PORT, SERVER_BACKLOG );
while (true) {
Socket s = server.accept();
//Start a new thread and pass the Socket s to it.
}You also need to create ObjectInputStreams and ObjectOutputStreams to read and write the data
ObjectInputStream input = new ObjectInputStream( s.getInputStream() );
ObjectOutputStream output = new ObjectOutputStream( s.getOutputStream() );
output.flush();On the client, you use
Socket s = new Socket( SERVER_MACHINE_NAME, SERVER_PORT )
ObjectOutputStream output = new ObjectOutputStream( s.getOutputStream
output.flush();
ObjectInputStream input = new ObjectInputStream( s.getInputStream() );
() );You can then use
output.writeObject( ANY_SERIALIZABLE_JAVA_OBJECT );to send the object, and
JAVA_OBJECT_TYPE myObject = (JAVA_OBJECT_TYPE) input.readObject();to recieve the object.
If its text data, you could read the data into a string field and send it
I hope this gives you some ideas to hepl towards your solution
Guy -
Compare two string in different line in textarea
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TextCounterPanel extends JPanel {
private JTextArea textInput;
private JLabel lineCountLabel;
public TextCounterPanel() {
setBackground(Color.DARK_GRAY);
textInput = new JTextArea();
textInput.setBackground(Color.WHITE);
JPanel south = new JPanel();
south.setBackground(Color.DARK_GRAY);
south.setLayout( new GridLayout(4,1,2,2) );
JButton countButton = new JButton("Process the Text");
countButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent evt) {
processInput();
south.add(countButton);
lineCountLabel = new JLabel(" Number of lines:");
lineCountLabel.setBackground(Color.WHITE);
lineCountLabel.setForeground(Color.BLUE);
lineCountLabel.setOpaque(true);
south.add(lineCountLabel);
setLayout( new BorderLayout(2,2) );
setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
JScrollPane scroller = new JScrollPane( textInput );
add(scroller, BorderLayout.CENTER);
add(south, BorderLayout.SOUTH);
public void processInput() {
String text,vin; // The user's input from the text area.
text = textInput.getText();
vin =text.substring(25,42);
lineCountLabel.setText(" vin: " + vin);
} // end class TextCounterPanel
How can I compare two string in different line in text areaimport java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TextCounterPanel extends JPanel {
private JTextArea textInput;
private JLabel lineCountLabel;
public TextCounterPanel() {
setBackground(Color.DARK_GRAY);
textInput = new JTextArea();
textInput.setBackground(Color.WHITE);
JPanel south = new JPanel();
south.setBackground(Color.DARK_GRAY);
south.setLayout( new GridLayout(4,1,2,2) );
JButton countButton = new JButton("Process the Text");
countButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent evt) {
processInput();
south.add(countButton);
lineCountLabel = new JLabel(" Number of lines:");
lineCountLabel.setBackground(Color.WHITE);
lineCountLabel.setForeground(Color.BLUE);
lineCountLabel.setOpaque(true);
south.add(lineCountLabel);
setLayout( new BorderLayout(2,2) );
setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY));
JScrollPane scroller = new JScrollPane( textInput );
add(scroller, BorderLayout.CENTER);
add(south, BorderLayout.SOUTH);
public void processInput() {
String text,vin; // The user's input from the text area.
text = textInput.getText();
vin =text.substring(25,42);
lineCountLabel.setText(" vin: " + vin);
} // end class TextCounterPanel -
How to parse from different website??
i want to write a code so that i can get info from different webapplication and display it on my page.. suppose user enters a name.. i would search that word in a particular page.. mybe on the homepage of sun site.. if that word appears there i would save it in my database.. and display 5 words following that word on my page.. How to do that.. can someone help??
Just open a java.net.URLConnection and get the content, then treat it as any other string or stream to search through.
-
Creating a String from an array of characters.
Hi,
i'm trying to make a string from an array of characters, this i've managed:
char data[] = new char[x];
String str = new String(data);My problem is this: Let's say the array of characters has space for 10 chars, but i only input 5, when i convert it to a string, the 5 characters show up fine, but the last remaining characters show up as little boxes ( [] [] [] [] [] ) .
It there a way to remove these?
Thanks in advance
Mikejverd wrote:
georgemc wrote:
String str = new String(data).trim();
Does the null character count as whitespace?Seems to. Actually, I'm getting different results depending on the compiler used.
public static void main(String[] args) {
char[] c = new char[10];
for(int i = 0; i < 5; i++) {
c[i] = (char) ('a' + i);
String first = new String(c);
System.err.println("[" + first + "]");
System.err.println(first.length());
String second = new String(c).trim();
System.err.println("[" + second + "]");
System.err.println(second.length());
}ECJ-compiled output:
>
[abcde
10
[abcde]
5
>
javac-compiled output:
>
[abcde]
10
[abcde]
5
>
Odd -
Logic for correcting strings with different barckets
can any one tell me the simple logic for correcting strings with different barckets
suppose say for eg.
(<{abc}>defgh) should evaluate to TRUE
(<{abc>} should evaluate to FALSE
Things to check is
1. number of opening brace and closing brace
2. Their position are correct or not
If the above two conditions are met than it is TRUE else FALSE
i guess string function with decode and lenght function or case should do but bit difficult to develop this logic in with sql
Thanks,
AAKHi,
Here is non REGEXP_REPLACE version ( Unfotunately dont have 10G to feel the power of REGEXP_REPLACE.
SQL> ed
Wrote file afiedt.buf
1 SELECT DECODE(SUM(CASE
2 WHEN Left = '(' AND Right =')' THEN 0+Count_Bracket
3 WHEN Left = '<' AND Right ='>' THEN 0+Count_Bracket
4 WHEN Left = '{' AND Right ='}' THEN 0+Count_Bracket
5 WHEN Left = '[' AND Right =']' THEN 0+Count_Bracket
6 ELSE
7 1
8 END
9 )
10 ,0,'Valid','Invalid')
11 FROM
12 (
13 SELECT SUBSTR(str,(len+1 - level),1) Left, SUBSTR(str,(len + level),1) Right, MOD(LENGTH(str),2)
14 FROM
15 (
16 SELECT
17 REPLACE(translate('&exp','abcdefgh',' '),' ') str,
18 LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
19 FROM DUAL
20 )
21 CONNECT BY LEVEL <= LEN
22* )
SQL> /
Enter value for exp: (<{abc>} )
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('(<{abc>} )','abcdefgh',' '),' ') str,
Enter value for exp: (<{abc>} )
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('(<{abc>} )','abcdefgh',' '),' '))/2 len
DECODE(
Invalid
SQL>
SQL> /
Enter value for exp: <{[()]}>
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('<{[()]}>','abcdefgh',' '),' ') str,
Enter value for exp: <{[()]}>
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('<{[()]}>','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL>
SQL> /
Enter value for exp: ([{<>}])
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('([{<>}])','abcdefgh',' '),' ') str,
Enter value for exp: ([{<>}])
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('([{<>}])','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL>
SQL> /
Enter value for exp: (<{abc}>defgh)
old 17: REPLACE(translate('&exp','abcdefgh',' '),' ') str,
new 17: REPLACE(translate('(<{abc}>defgh)','abcdefgh',' '),' ') str,
Enter value for exp: (<{abc}>defgh)
old 18: LENGTH(REPLACE(translate('&exp','abcdefgh',' '),' '))/2 len
new 18: LENGTH(REPLACE(translate('(<{abc}>defgh)','abcdefgh',' '),' '))/2 len
DECODE(
Valid
SQL> Note: Only thing needs to care is " translate('<{[()]}>','abcdefgh',' ') " if string has some additional characters please include here.
Regards -
How to get Time from Different Work Station on the Network
Hi,
How do I get time from different work station on the network using its ip:port etc.
Lets say, my main server-side Java application is running on a work station 123.12.123.1:1527,
the client-side applications are accessing it using above IP.
what I wanna do is, use the time of 123.12.123.1 machine throughout the application, not client local time.
Appreciated..Ok, this network service on IP:Port is working for me, I hope this is the best way of doing it.
In server application, I have this
package RenameItToYourOwnPackage;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.text.SimpleDateFormat;
public class ServerSocketExample implements Runnable {
private ServerSocket server;
private int port = 7777;
Socket socket;
public void run() {
try {
System.out.println("Waiting for client message");
server = new ServerSocket(port);
while (true) {
socket = server.accept();
// Read a message sent by client application
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
String clientMessage = (String) ois.readObject();
System.out.println("Message sent by client: " + clientMessage);
// send current datetime to client
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()));
ois.close();
oos.close();
socket.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}In the client application I have
package RenameItToYourOwnPackage;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
public class ClientSocketExample {
static String dateTimeString;
public ClientSocketExample() {
public static String getServerDateString() {
try {
// Create a connection to the server socket on the server application
InetAddress host = InetAddress.getByName("127.0.0.1");
Socket socket = new Socket(host.getHostName(), 7777);
// Send a message to the server application
ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
oos.writeObject("Send me today's timestamp as string");
// Read the response by server application
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
dateTimeString = (String) ois.readObject();
//System.out.println("Message sent by server: " + message);
ois.close();
oos.close();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
return dateTimeString;
}And I run the service on the server-side with
new Thread(new ServerSocketExample()).start();On the client-side I receive the date with
System.out.println("DateTime on Server : " + ClientSocketExample.getServerDateString());Edited by: nkamir on Sep 13, 2010 2:53 PM -
Breaking the string into different columns
Hi Guys,
I need to break the following string into different columns
'XXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007.'
I am trying to write it using instr and substr , but having some issues .
Is there any other way to do this. If not can someone help me , below is the query that i am working on
SELECT SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', 1, INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) - 1) col1,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1, 2)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', 1)
- 1
) col2,
SUBSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007',
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2) + 1,
INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 1)
- INSTR ('XXXXXX.0001.09011.0001.00002.03.0004.0005.0006.00007', '.', -1, 2)
- 1
) col3
from dual
It is very urgent.
Thanks in advance.npejavar wrote:
It is very urgent.
It doesn't look urgent, you could simply read the manuals for instr and substr or describe any issues or errors you are having, or post sample data so people could help you more easily, or format your code so it is more readable, but you don't bother to do any of those things so if it isn't important to you to extend any effort, why would it be important to us?
If it was really urgent it would be a violation of the conditions of use of these forums.
http://www.catb.org/esr/faqs/smart-questions.html#urgent
http://www.oracle.com/html/terms.html
>
4. Use of Community Services
Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle -
Getting all VARCHAR fields with string length different then x
Hello,
I am trying to get from a table all the rows which contain in a certain varchar field a string length different than x (5 i.e.):
varchar field
treds
fd <-
grgrt
sdfsdfsdf <-
fdsds
the marked rows will been given out.
Thanks!Term, the Oracle SQL manual contains documentation on the Oracle functions. Most of the functions can be classified as either character functions, number (math) functions, date functions, and conversion functions.
If you are going to work with Oracle you will benefit from looking on the list of available functions to become familiar with what is available.
HTH -- Mark D Powell -- -
Strange problem retreiving string from database
Hi,
I am receiving a very strange problem retreiving a string from a database. The database I am using is Access. I am using .getString(COLUMN_NAME) to get the data from the particular record in the result set. The problem is that sometimes it does not seem to get the entire information that is in the cell. I have found that it is completely random on when it will get the entire contents and when it will only get a portion. It seems like once it gets only a portion though, that every other retrieval of the same field on a different record in the result set will yield the same cut-off point. Of course to make my life even more difficult, it is not always the same cut-off point on a different result set.
Has anyone else experienced anything along these lines? Any help would be greatly appreciated as I am running out of ideas as to the cause.
Thank youI've printed out exactly what is being retrieved from the fields in question and that's how I narrowed it down to that it has to do with the retrieval of the information from the result set. I've found the exact line of code where I am suddenly receiving only part of the data. And all I'm doing there is just getting the data from the result set. Nothing fancy at all. So unless the result set is becomming corrupt somehow...not sure how that would happen though by just cycling through?
Maybe you are looking for
-
Hi, I am very new to visual composer. i have two issues. 1. I have an RFC to execute in Visual composer, the Input form of RFC to be shown as a first view, once he click on submit, i need to navigate to another view which will show the result as an
-
Problem LOV in Master-detail part I
JHeadstart 11.1.1 Technical Preview 2 Hello, I have a Master-Detail where I use a LOV on the detail view. If this VO exist of 1 EO I do not have any problems. The moment I add another EO to the VO and run the application I receive an error message "j
-
Anyone know how to customize email subject generated by Alerts from BPM
I'm generating Alerts from BPM. However, the Alerts generated this way has subject title with - Process and an id number like this 'Process 000000126930'. I want to create custom subject line / email title. I tried by creating and using container var
-
My photoshop CC 2014 wont open!
My photoshop CC wont open Help!! all it does in run a program titled 'Title' Windows 7 ultimate 32-bit emachines
-
Hi everyone, anyone knows about the support status of OAS4OS? Is it still an active product? I'm asking because there seems to be no support for Solaris 11. So it's not possible to migrate Solaris 10 servers which authenticate against OID (11) to Sol