Write a string of a perticular character
Please if any body know then tell me Is there any method in java which can write 1 character multiple times
For Ex.
something like
String someMethod( 'A',5)
should return "AAAAA"
You can use one of the fill methods in the Arrays class, and pass that array to String's constructor that takes a char[].
Similar Messages
-
HOW DO I WRITE A STRING TO FLAG WHEN A CELL HAS OR 17 CHARACTERS?
HOW DO I WRITE A STRING TO FLAG WHEN A CELL HAS < OR > 17 CHARACTERS?
Hi Tassytiger,
A "string" is just a string of characters. Examples are qwerty, 123abc, 43πbono. there are several ways to write one. A more precise description of your end goal might help answer "How do I write a string."
To the current version of your specific question:
What I actually need to achieve is a situation where, when I enter <17 Char. or >17 Char.
inadvertently then tab to the next cell, I get the following response in the active cell:
The cell immediately below "17 character ID" displays an error triangle. These are shown when the formula in a cell produces an error message. they are system generated and require two things to happen: The cell must contain a formula AND something must have happened to cause that formula to produce an error.
I don't wish to add any columns to my s/s but would like to apply the rule to the current column just as i would change the text or fill colour.
The difficulty there is that a cell may contain entered data, OR it may contain a formula. You want to enter data (a string of characters) and you want to produce an error triangle if that string has more or fewer than 17 characters. Evaluating the length of the string requires a formula. Getting the string into the cell requires direct entry (in your scenario). The two are not compatible within the content of a single cell.
Terry's example uses a formula in column B to measure the length of the string in column A. If the length is 17 characters, the IF statement produces the empty string ( "" ), and the cell in column B appears empty. If the string is not 17 characters long, the IF statement produces the string "Not 17 Chars!"
His formula is easily changed to produce an error triangle in place of "Not 17 Chars!":
B1: =IF(LEN(A1)=17, "",17/0)
In this version, if the length of the string in A1 is not 17 (characters), the formula will attempt to divide 17 by 0, and will produce a 'division by zero' error.
But, as with all of the other suggestions, this one will require a new column to provide space for the formula and it's result.
Changing the text or fill colour can be done using conditional formatting. Changing content of the cell (eg. choosing between the entered string of characters and the error triangle) cannot.
Conditional formatting rules compare the content of a the cell to be formatted with either a fixed value (written into the rule) or to the content of another cell. In my examples (and in Ian's examples) above the rules compared the content of the cell to be formattes to the number '17'. The number was generated by a formula which measured the length (in characters) of the text in the cell where the ID was entered, and reported that length as a number.
A way to show a red triangle using conditional formatting is to use Image fill as the default fill of the cell, then use a colour fill as the conditional fill to hide the trialngle when the conditions are met. Here's the same example as used above, with this technique applied to column B:
The same formula is used in column B as in my previous example. Type size is set to 1 point (note the black dot, visible in the green filled cell) to keep the numbers from obscuring the triangles. The triangles are shapes, inserted onto the canvas (not into the table) from the Shapes button in the tools. Their fill colour has been changed to red, a 12 point exclamation sign character ha been typed into the shape and its text colour set to white, and the triangle's size has been reduced as much as possible without triggering the overflow symbol (boxed plus sigh) to appear.
The triangle image (and some of its white background) was made into a png image file by taking a screen shot, and the image was inserted into all of the cells in the body rows of column B as an image fill, using the Graphic inspector. The conditional format rule below was then applied to the body row cells in column B.
Finally, you can apply conditional formatting to the cell containing the ID. This will still require another column to contain the values to which the content of the ID cell will be compared, but that column may be hidden, or may be located on a separate table.
The method requires an second cell for each cell contining an ID, and uses a formula that makes the contents of the second cell the same as that of the ID cell IF the ID cell contents are 17 characters long.
Here's a sample. Table 1 is column A of the same table as above. Table 2 is a single column table holding the comparison cells.
As in the example above, the cells on table 1 were given an image fill. The conditional format rule replaces that with a white colour fill when the cell contains the same text as its partner cell in Table 2.
This is the rule for cell A2. In A3, the cell reference is to Table 2::A3, and in A4, to Table 2::A4. The cell references in conditional format rules must be edited individually.
Regards,
Barry -
Error 5 occurred at Open/Create/Replace File in Write spreadsheet String.vi
Hi everyone,
can anyone help me with this problem?
"error 5 occurred at Open/Create/Replace File in Write spreadsheet String.vi "
I've been using this part of the program for over a year an suddenly this error occures. But not always, mainly at the very beginning of my tests when the file should not be open.
Info: I'm using a realtime PXI-System. Maybe the amount of data can cause the problem? (about 2MB)
Grüße
Meike
Attachments:
writeResults.jpg 345 KB
error5.jpg 52 KBHi Meike,
is the file opened by a different program? Do you try to access it by FTP in parallel to your VI?
You could use basic file functions instead of WriteSpreadsheetFile. That way you could open the file before starting the loop, keep it open all the time and close it once you're finished - with the added benefit of easier error handling…
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to read and write a string into a txt.file
Hi, I am now using BEA Workshop for Weblogic Platform version10. I am using J2EE is my programming language. The problem I encounter is as the above title; how to read and write a string into a txt.file with a specific root directory? Do you have any sample codes to reference?
I hope someone can answer my question as soon as possible
Thank you very much.Accessing the file system directly from a web app is a bad idea for several reasons. See http://weblogs.java.net/blog/simongbrown/archive/2003/10/file_access_in.html for a great discussion of the topic.
On Weblogic there seems to be two ways to access files. First, use a File T3 connector from the console. Second, use java.net.URL with the file: protocol. The T3File object has been deprecated and suggests:
Deprecated in WebLogic Server 6.1. Use java.net.URL.openConnection() instead.
Edited by: m0smith on Mar 12, 2008 5:18 PM -
Hi All,
I want to write a string into a file, and I wrote the following code.
package fileoperations;
import java.io.*;
class FileWriterDemo {
public static void main(String args[]) throws Exception {
String source = "Now is the time for all good men\n"
+ " to come to the aid of their country\n"
+ " and pay their due taxes.";
FileReader fr = new FileReader("./src/domparser/employee.xml");
FileWriter f0 = new FileWriter("./src/domparser/sample.txt");
BufferedReader br = new BufferedReader(fr);
int c=0;
while ((c=br.read())!=-1) {
System.out.print((char)c);
f0.write((char)c);
f0.close();
fr.close();
}The above specified code is running successfully and write the string in the specified file. If I comment the following
two lines
//f0.close()
//fr.close()
The string was not written in the specified file. I don't know what is the reason for that. Can any one give me the
reason for that.
Thanks and Regards,
D.Maheswaranf0.close();This is the critical line. FileWriter acts like a buffer and calling the close method causes the buffer to be flushed, ie push out all the data stored in the buffer. Otherwise your program can and has exited with data left in the buffer and not written out to the file.
-
Write a string at each beginning record
I save data in a file .txt with spreadsheet ....I record a cycle each hour.I have temperature ,pressure, time and date...I want to write a string at each beginning record......(e.g. A 125 256 ....the number of the process I save ) and the last record will be A 125 256.
Thank you for your help.You have to use write to spreadsheet in the string form, there used to be instructions on modifying it inside write to spreadsheet, but basically consists in changing input numeric arrays into string arrays. This way you can use string arrays with any stamp in the first column, but your data has to be a string too.
Hope this helps -
How to write multiline String in a JLabel
How can i write a string that is shown in many lines in a JLabel. Or is there any orher way to write them?
Also, similarly how to write tooltip text that spans across many lines. Not just one lineimport java.awt.*;
import javax.swing.*;
public class UseThisTheNextTimeYouFeelLikePostingEelops {
public static void main(String[] args) {
String str = "This is \nmy example \nof a multi-line \nJLabel";
JLabel strLabel = new JLabel (str);
display(strLabel, "Hmmm...");
public static void display(JComponent comp, String title) {
JFrame f = new JFrame(title);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(comp);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
} -
Cisco Works SNMP write community string Incorrect
Hi,
I have installed Cisco Works at my organisation. Under RME -> Inventory -> Import status -> Device Attribute Error: I am getting: Incorrect SNMP write community strings. Even though i know perfectly well the SNMP write community string is correct. To prove that, if I delete the device and then add the same device using the same SNMP write community string it works fine. then a couple of days later, it comes up with the same message "SNMP write community string is incorrect". I have increased the time and retries for the SNMP settings at the ANI server, still it has not resolved the issue.
Please helpI have sharched the CCO bug toolkit and according them, it was a know issue for verion 3.4 but it has been fixed for Ver RME 3.5. But we are currently running RME 3.5, therefore it does not make any sense.
-
Find Whether String Contain Sequence Of Character Or Not
<b>
hello friend,
I am to the new java. I need to findout whether the string contain sequence of character or not. I tried like this
personLastName.length()> 0
It will return true even my string contains space. Is there any other method in java to find out ?
ThanksThere are a few ways to do that. Check out the String class or Regex for one that suits but
myString.indexOf(whatIWantToFindString)is an old favorite. It returns -1 if the sequence is not there, or the starting index if it is. The javadocs are your friends.
regards -
XMLStreamException: Unable to write XML string which starts with the illegal XML char 0x0000
Hi,
I am trying to run a WebLogic 8.1 Workshop webservice using Tuxedo Controls. I
am running in to an XML error:
<faultcode>JWSError</faultcode>
<faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
the illegal XML char 0x0000</faultstring>
<detail>
If i look into the application server log file, It says:
<FML32Deserializer::deserializeInteger>
####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer> <ExecuteThread:
'11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
<000000> <Exception deserializing field BUFFERSIZE, exception: weblogic.jws.control.ControlException:
Error getting field BUFFERSIZE as a Integer, exception: 4 (FNOTPRES)>
####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer> <ExecuteThread:
'11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
<000000> <FML32Deserializer::deserializeField - Name=ROWID, type=class java.lang.String>
But these fields are in the field table class file generated using java weblogic.wtc.jatmi.mkfldclass32I am pasting the response i get while i try to run this web service using WebLogic
Workshop.
Anyones help would be much appreciated.
Thanks,
Deepak
Service Response
Submitted at Friday, December 19, 2003 1:25:00 PM CST
<error>
<faultcode>JWSError</faultcode>
<faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
the illegal XML char 0x0000</faultstring>
<detail>
com.bea.wlw.runtime.core.request.ResponseValidationException: com.bea.xml.marshal.XmlEncodingException:
Error writing XML stream: com.bea.xml.pure.XMLStreamException: Unable to write
XML string which starts with the illegal XML char 0x0000
at com.bea.wlw.runtime.jws.request.MimeXmlResponse.setReturnValue(MimeXmlResponse.java:35)
at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.runAsInvoke(BaseDispatcherBean.java:242)
at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.invoke(BaseDispatcherBean.java:54)
at com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(SyncDispatcherBean.java:159)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(SyncDispatcher_k1mrl8_EOImpl.java:100)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatcher.java:134)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.java:46)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.exploreExec(HttpServerHelper.java:253)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executeGetRequest(HttpServerHelper.java:570)
at com.bea.wlw.runtime.core.dispatcher.HttpServer.doGet(HttpServer.java:81)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6316)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
the illegal XML char 0x0000
at com.bea.xml.marshal.MarshalContext.error(MarshalContext.java:140)
at com.bea.xml.marshal.MarshalContext.writeCharacterData(MarshalContext.java:178)
at com.bea.xml.marshal.AtomicValueMPlan.marshal(AtomicValueMPlan.java:79)
at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:349)
at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:358)
at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:349)
at com.bea.xml.marshal.MethodMPlan.marshal(MethodMPlan.java:260)
at com.bea.wlw.runtime.core.dispatcher.DispMessage.marshalXml(DispMessage.java:386)
at com.bea.wlw.runtime.jws.request.MimeXmlResponse.writePart(MimeXmlResponse.java:105)
at com.bea.wlw.runtime.jws.request.MimeXmlResponse.writeOutputPart(MimeXmlResponse.java:97)
at com.bea.wlw.runtime.jws.request.MimeXmlResponse.setReturnValue(MimeXmlResponse.java:31)
... 22 more
</detail>
</error>
"Deepak" <[email protected]> wrote:
>
>
>
Hi,
I am trying to run a WebLogic 8.1 Workshop webservice using Tuxedo Controls.
I
am running in to an XML error:
<faultcode>JWSError</faultcode>
<faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing
XML stream:
com.bea.xml.pure.XMLStreamException: Unable to write XML string which
starts with
the illegal XML char 0x0000</faultstring>
<detail>
If i look into the application server log file, It says:
<FML32Deserializer::deserializeInteger>
####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer>
<ExecuteThread:
'11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
<000000> <Exception deserializing field BUFFERSIZE, exception: weblogic.jws.control.ControlException:
Error getting field BUFFERSIZE as a Integer, exception: 4 (FNOTPRES)>
####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer>
<ExecuteThread:
'11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
<000000> <FML32Deserializer::deserializeField - Name=ROWID, type=class
java.lang.String>
But these fields are in the field table class file generated using java
weblogic.wtc.jatmi.mkfldclass32 -
How can i write a string into a specified pos of a file?
How can i write a string into a specified pos of a file without read all file into ram and write the whole file again?
for example:
the content of file is:
name=123
state=456
i want to modify the value of name with 789
(write to file without read all file into ram)
How can i do it? thank youtake this as an idea. it actually does what i decribed above. you sure need to make some modifications so it works for your special need. If you use it and add any valuable code to it or find any bugs, please let me know.
import java.io.*;
import java.util.*;
* Copyright (c) 2002 Frank Fischer <[email protected]>
* All rights reserved. See the LICENSE for usage conditions
* ObjectProperties.java
* version 1.0, 2002-09-12
* author Frank Fischer <[email protected]>
public class ObjectProperties
// the seperator between the param-name and the value in the prooperties file
private static final String separator = "=";
// the vector where we put the arrays in
private Vector PropertiesSet;
// the array where we put the param/value pairs in
private String propvaluepair[][];
// the name of the object the properties file is for
public String ObjectPropertiesFileName;
// the path to the object'a properties file
public String ObjectPropertiesDir;
// reference to the properties file
public File PropertiesFile;
// sign for linebreak - depends on platforms
public static final String newline = System.getProperty("line.separator");
public ObjectProperties(String ObjectPropertiesFileName, String ObjectPropertiesDir, ObjectPropertiesManager ObjectPropertiesManager)
// System.out.println("Properties Objekt wird erzeugt: "+ObjectPropertiesFileName);
this.ObjectPropertiesFileName = ObjectPropertiesFileName;
this.ObjectPropertiesDir = ObjectPropertiesDir;
// reference to the properties file
PropertiesFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
// vector to put the param/value pair-array in
PropertiesSet = new Vector();
// System.out.println("Properties File Backup wird erzeugt: "+name);
backup();
// System.out.println("Properties File wird eingelesen: "+PropertiesFile);
try
//opening stream to file for read operations
FileInputStream FileInput = new FileInputStream(PropertiesFile);
DataInputStream DataInput = new DataInputStream(FileInput);
String line = "";
//reading line after line of the properties file
while ((line = DataInput.readLine()) != null)
//just making sure there are no whitespaces at the beginng or end of the line
line = cutSpaces(line);
if (line.length() > 0)
//$ indicates a param-name
if (line.startsWith("$"))
// array to store a param/value pair in
propvaluepair = new String[1][2];
//get the param-name
String parameter = line.substring(1, line.indexOf(separator)-1);
//just making sure there are no whitespaces at the beginng or end of the variable
parameter = cutSpaces(parameter);
//get the value
String value = line.substring(line.indexOf(separator)+1, line.length());
//just making sure there are no whitespaces at the beginng or end of the variable
value = cutSpaces(value);
//put the param-name and the value into an array
propvaluepair[0][0] = parameter;
propvaluepair[0][1] = value;
// System.out.println("["+ObjectPropertiesFileName+"] key/value gefunden:"+parameter+";"+value);
//and finaly put the array into the vector
PropertiesSet.addElement(propvaluepair);
// error handlig
catch (IOException e)
System.out.println("ERROR occured while reading property file for: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
// System.out.println("in ObjectProperties");
// function to be called to get the value of a specific paramater 'param'
// if the specific paramater is not found '-1' is returned to indicate that case
public String getParam(String param)
// the return value indicating that the param we are searching for is not found
String v = "-1";
// looking up the whole Vector
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in again
String s[][] = new String[1][2];
// trying to get out the array from the vector again
s = (String[][]) PropertiesSet.elementAt(i);
// comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
if (s[0][0].equals(param) == true)
//if the param-names are the same, we look up the value and write it in the return variable
v = s[0][1];
// making sure the for loop ends
i = PropertiesSet.size();
// giving the value back to the calling procedure
return v;
// function to be called to set the value of a specific paramater 'param'
public void setParam(String param, String value)
// looking up the whole Vector for the specific param if existing or not
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in again
String s[][] = (String[][]) PropertiesSet.elementAt(i);
// comparing the param-name we're looking for with the param-name in the array we took out the vector at position i
if (s[0][0].equals(param) == true)
//if the param-names are the same, we remove the param/value pair so we can add the new pair later in
PropertiesSet.removeElementAt(i);
// making sure the for loop ends
i = PropertiesSet.size();
// if we land here, there is no such param in the Vector, either there was none form the beginng
// or there was one but we took it out.
// create a string array to place the param/value pair in
String n[][] = new String[1][2];
// add the param/value par
n[0][0] = param;
n[0][1] = value;
// add the string array to the vector
PropertiesSet.addElement(n);
// function to save all data in the Vector to the properties file
// must be done because properties might be changing while runtime
// and changes are just hold in memory while runntime
public void store()
backup();
String outtofile = "# file created/modified on "+createDate("-")+" "+createTime("-")+newline+newline;
try
//opening stream to file for write operations
FileOutputStream PropertiesFileOuput = new FileOutputStream(PropertiesFile);
DataOutputStream PropertiesDataOutput = new DataOutputStream(PropertiesFileOuput);
// looping over all param/value pairs in the vector
for (int i=0; i<PropertiesSet.size(); i++)
//the String i want to read the values in
String s[][] = new String[1][2];
// trying to get out the array from the vector again
s = (String[][]) PropertiesSet.elementAt(i);
String param = "$"+s[0][0];
String value = s[0][1];
outtofile += param+" = "+value+newline;
outtofile += newline+"#end of file"+newline;
try
PropertiesDataOutput.writeBytes(outtofile);
catch (IOException e)
System.out.println("ERROR while writing to Properties File: "+e);
catch (IOException e)
System.out.println("ERROR occured while writing to the property file for: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
// sometimes before overwritting old value it's a good idea to backup old values
public void backup()
try
// reference to the original properties file
File OriginalFile = new File(ObjectPropertiesDir+ObjectPropertiesFileName);
File BackupFile = new File(ObjectPropertiesDir+"/backup/"+ObjectPropertiesFileName+".backup");
//opening stream to original file for read operations
FileInputStream OriginalFileInput = new FileInputStream(OriginalFile);
DataInputStream OriginalFileDataInput = new DataInputStream(OriginalFileInput);
//opening stream to backup file for write operations
FileOutputStream BackupFileOutput = new FileOutputStream(BackupFile);
DataOutputStream BackupFileDataOutput = new DataOutputStream(BackupFileOutput);
// String content = "";
String line = "";
// do till end of file
while ((line = OriginalFileDataInput.readLine()) != null)
BackupFileDataOutput.writeBytes(line+newline);
// error handlig
catch (IOException e)
System.out.println("ERROR occured while back up for property file: "+ObjectPropertiesFileName);
System.out.println("ERROR CODE: "+e);
System.out.println("this is a serious error - the server must be stopped");
private String cutSpaces(String s)
while (s.startsWith(" "))
s = s.substring(1, s.length());
while (s.endsWith(" "))
s = s.substring(0, s.length()-1);
return s;
public String createDate(String seperator)
Date datum = new Date();
String currentdatum = new String();
int year, month, date;
year = datum.getYear()+1900;
month = datum.getMonth()+1;
date = datum.getDate();
currentdatum = ""+year+seperator;
if (month < 10)
currentdatum = currentdatum+"0"+month+seperator;
else
currentdatum = currentdatum+month+seperator;
if (date < 10)
currentdatum = currentdatum+"0"+date;
else
currentdatum = currentdatum+date;
return currentdatum;
public String createTime(String seperator)
Date time = new Date();
String currenttime = new String();
int hours, minutes, seconds;
hours = time.getHours();
minutes = time.getMinutes();
seconds = time.getSeconds();
if (hours < 10)
currenttime = currenttime+"0"+hours+seperator;
else
currenttime = currenttime+hours+seperator;
if (minutes < 10)
currenttime = currenttime+"0"+minutes+seperator;
else
currenttime = currenttime+minutes+seperator;
if (seconds < 10)
currenttime = currenttime+"0"+seconds;
else
currenttime = currenttime+seconds;
return currenttime; -
Write a string to a v_path pointer
Hi,
Could anybody show me how to write a string to a v_path pointer of a vnode?
Below is what I want to do:
> 00000300245f53c0::print vnode_t v_path
v_path = 0x300128e5aa0 "/opt/bns/k2/V6.0/script"
> 0x300128e5aa0/W "new_path_name"
mdb: failed to dereference symbol: unknown symbol name
mdb: failed to write "new_path_name": failed to evaluate command
But it gave me error message.
Please help.
Thanks
AlexThere is no write string in mdb so need to do it char by char using ascii codes.
0x300123e8a80::print vnode_t v_path
v_path = 0x30007e56d68 "/usr/bin/vi"
0x30007e56d68,0t11/B
0x30007e56d68: 2f 75 73 72 2f 62 69 6e 2f 76 69
0x30007e56d68/v 2f 65 74 63
0x30007e56d68: 0x2f = 0x2f
0x30007e56d69: 0x75 = 0x65
0x30007e56d6a: 0x73 = 0x74
0x30007e56d6b: 0x72 = 0x63
0x300123e8a80::print vnode_t v_path
v_path = 0x30007e56d68 "/etc/bin/vi"
No idea why you would want too.
Edited by: .robv. on 10-Nov-2009 13:41 -
Using CLOB as a VARCHAR2 to write a string
Hello everyone:
I have this situation:
After a query, i need to order the query rows in a table. To do this, i write a string using HTML format. Then, i send the string (message) by email, and i save the same in a table (database).
The message, must be 32767 as a maximun number of characters. Because, the message is a VARCHAR2.
When the number of characters is greater than 32767, in can't use this way.
So, i trying to use a CLOB datatype, but i don't know how to write the string and then, send it by email.
I wrote this code:
xSGLOSA_UNO$ CLOB;
xSGLOSA_UNO$ := '<table border="1"><tr>FECHA DE PROCESOS CORRECTAS</tr>';
xSGLOSA_UNO$ := xSGLOSA_UNO$ || '<tr><td>Rut Operador</td><td>Nombre</td><td>Proceso</td><td>Fecha Proceso</td></tr>';
BEGIN
FOR CONSULTA_UNO IN(
SELECT
FPR_NRUTOPERADOR,
OPE_SNOMBRE,
FPR_SCODPROCESO,
FPR_DFHOPROCESO
FROM
FECHAS_PROCESO,
OPERADOR
WHERE
TRUNC(FPR_DFHOPROCESO) = TRUNC(SYSDATE)
LOOP
xSGLOSA_UNO$ := xSGLOSA_UNO$ || '<tr><td>' || CONSULTA_UNO.FPR_NRUTOPERADOR || '</td><td>' || CONSULTA_UNO.OPE_SNOMBRE || '</td><td>' || CONSULTA_UNO.FPR_SCODPROCESO || '</td><td>' || CONSULTA_UNO.FPR_DFHOPROCESO || '</td></tr>';
END LOOP;
xSGLOSA_UNO$ := xSGLOSA_UNO$ || '</table>';
EXCEPTION
WHEN OTHERS THEN
NUMERROR$ := SQLCODE;
MSJERROR$ := '[NES$FECHA_PROCESOS] FECHAS CORRECTAS (' || SQLERRM || ')';
RETURN;
END;
And i have this error:
[NUMERROR$:=-6502], [MSJERROR$:=[NES$FECHA_PROCESOS] FECHAS CORRECTAS (ORA-06502: PL/SQL: error numérico o de valor)]
Please, help me with this issue. I am new in Oracle, and i don't have idea the real reason for this.
Thank you for support.Now... when you do things like:
xSGLOSA_UNO$ := xSGLOSA_UNO$ || '</table>';
then you are concatenating a CLOB (xSGLOSA_UNO$) to a VARCHAR2 ('</table>') which can be done by either convert the clob to varchar2 or the varchar2 to clob before concatenating. || is a overloaded function which accepts two varchar2 or two clob parameters (amongst others). As the CLOB gets bigger than 32k you cannot just let oracle decide how to convert so, you should do:
xSGLOSA_UNO$ := xSGLOSA_UNO$ || TO_CLOB('</table>');
instead.
And this at every place where you concatenate
eg here too:
xSGLOSA_UNO$ := xSGLOSA_UNO$ || TO_CLOB('<tr><td>') || CONSULTA_UNO.FPR_NRUTOPERADOR || TO_CLOB('</td><td>') || CONSULTA_UNO.OPE_SNOMBRE || TO_CLOB('</td><td>') || CONSULTA_UNO.FPR_SCODPROCESO || TO_CLOB('</td><td>') || CONSULTA_UNO.FPR_DFHOPROCESO || TO_CLOB('</td></tr>');
I don't know the datatypes of CONSULTA_UNO.FPR_NRUTOPERADOR and the other components used...if they are VARCHAR then convert, if they are CLOB then let them like they are.
hth -
Replace hex character in a string with another hex character
Hi Guys,
Heres a problem scenario, hex character 92 looks very much like hex character 27 (apostrophe).
I need to write a program that can replace all hex character 92 to hex 27 in a string.
Being a novice on the regular expressions, I would appreciate if somebody can show
the exact syntax to to perform this replacement.
Many Thanks
-AnilI don't think you need to use regex to do this:
String s = something();
char a = 0x27;
char b = 0x92;
s.replace(a,b);
And don't forget that since Strings are immutable you need:
s = s.replace(a,b);to do anything useful. -
Offsetting String which contains Japanese Character. In the smartform
Hi,
I am having a problem with Japanese Character.
+ycomment(132) type c.+
+ycomment receives text from read text FM.+
+clear V_CHAR52.+
+V_CHAR52 = ycomment(52).+
Here are the scenarios.
* ycomment
= Pooulated in Japanese testing testing testing by Lore testing testing
v_char52(displayed in form)
= Pooulated in Japanese testing testing testing by Lor
* ycomment
= u308Fu305Fu304Fu306Eu540Du524Du306Fu5C0Fu5C71u5FB3u9053u3067u3059u79C1u306Eu540Du524Du306Fu5C0Fu5C71u5FB3u9053u3067u3059u308Fu305Fu304Fu306Eu540Du524Du306Fu5C0Fu5C71u5FB3u9053u3067
v_char52(displayed in form)
= u308Fu305Fu304Fu306Eu540Du524Du306Fu5C0Fu5C71u5FB3u9053u3067u3059u79C1u306Eu540Du5C0Fu524Du5C71u306Fu5FB3u5C0Fu9053u5C71u3067u5FB3u9053u3067u3059u308Fu305Fu304Fu306Eu540Du524Du306Fhi
this will give you clear picture about Byte processing and Character processing.
in case of byte processing
DATA : test TYPE X LENGTH 16, " here check length only 16
test1 TYPE Xstring.
test = '000102030405060708090A0B0C0D0E0F'. " but here passing string of 32
test1 = '00537'.
IF test byte-ca test1.
WRITE : test.
ENDIF.
In case of Char-String processing
DATA : test TYPE c LENGTH 32, " here check length only 32
test1 TYPE string.
test = '000102030405060708090A0B0C0D0E0F'. " but here passing string of 32
test1 = '00537'.
IF test ca test1.
WRITE : test.
ENDIF.
may be this comparison is helpfull for you.
Maybe you are looking for
-
Audio Output with firewire audio interface issue
Hi, i have a quick question that maybe someone here can answer for me. I originally posted this in the OS X forum but someone recommended that I may get better help here. I have a PowerPC G5 with Mac OS X 10.4.11. I do a lot of home recording and use
-
What are the different type of projects
i mean how many different type of projects are there in sap implementation.. what do you mean by, enhancement project rollout project development project support project is there any thing else other than this? please clear my doubt. points would be
-
What caddy do I need to remove data from a fusion drive?
my MacBook Pro has died due to water damage to the logic board and ssd I have the fusion drive removed and have been told I need a caddy to remove the data and put it on another machine, what am I looking for?
-
Is it necessary to have safari sync "on" to iCloud on my iPhone 4?
Is it necessary to have safari sync "on" to iCloud on my iPhone 4?
-
Hyperlinking Between Multiple InDesign-Generated PDFs
Hi all. Here's my scenario: Windows XP, InDesign CS3 We're working on a quarterly publication that contains an index. We want the index to be cumulative going forward. For example, the April 2008 issue will just have April 2008 articles listed in the