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
Similar Messages
-
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 -
Can i make a sequence to create a record number for each new record
Does anybody know if a field can be inserted to or a feature turned on to create a automatic numbering system for each incoming record
It's easier if you don't. You can do what you want using a template, but it will require some scripting. It's also easier to do than describe, but I'll try. Begin by creating the fields on a page in the locations you want, insert this page to the document, as the first page for example. You can then replace it with a blank page, which will leave the form fields behind. Then make this page a template and hide it. You can then run a script from the interactive JavaScript console that spawns the hidden template on the first page as an overlay, extracts the page that now has fields as a new document, and repeat for the rest of the pages. Here are links to documentation of some of the scripting that will be involved:
template.spawn: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1216.html
doc.extractPages: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.465.html
The process for making a page a template through Acrobat's UI depends on what version you're using, but it can be doen programmatically too: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.451.html -
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 -
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 -
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.
-
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);
} -
The NEW Thunderbird is looking up "CONTAINS" when attempting to write an email and not "BEGINS WITH" as it used to do before. I'm currently on 31.3.0 Thunderbird. Which version do I need to revert to, to get this function back for an employee on his PC??
Thank you in advance and I await your reply,
~MarioVersion 24
-
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.
-
Want to get sum/avg first 90% records in each grouped record set.
Hi Gurus,
Need your help or example query which help me to achieve sum/avg first 90% records in each grouped record set. Let me show you the basic query and output and proposed output.
select Pid, Sum(SalesAmt) TotalSaleAmt, Avg(SalesAmt) AvgSaleAmt, count(*) NoOfSales from ProductSales group by Pid;
PID TotalSaleAmt AvgSaleAmt NoOfSales
1 12000 100 120
2 24000 50 480
Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
I hope I am clear enough explain my requirement... I would appreciate if we have some Analytical function available..
Gurus Pls help me asap..
Thanks In adavance...
Srichan.Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
first 90% should mean first 90% by some order, so in this case, which 108 rows (of the 120) do you want to take into consideration?
with
the_sample as
(select 1 the_pid,10 the_sale,1 the_order from dual union all
select 1 the_pid,20 the_sale,2 the_order from dual union all
select 1 the_pid,15 the_sale,3 the_order from dual union all
select 1 the_pid,12 the_sale,4 the_order from dual union all
select 1 the_pid,12 the_sale,5 the_order from dual union all
select 1 the_pid,13 the_sale,6 the_order from dual union all
select 1 the_pid,19 the_sale,7 the_order from dual union all
select 1 the_pid,11 the_sale,8 the_order from dual union all
select 1 the_pid,15 the_sale,9 the_order from dual union all
select 1 the_pid,12 the_sale,10 the_order from dual union all
select 2 the_pid,25 the_sale,1 the_order from dual union all
select 2 the_pid,22 the_sale,2 the_order from dual union all
select 2 the_pid,22 the_sale,3 the_order from dual union all
select 2 the_pid,23 the_sale,4 the_order from dual union all
select 2 the_pid,29 the_sale,5 the_order from dual union all
select 2 the_pid,21 the_sale,6 the_order from dual union all
select 2 the_pid,25 the_sale,7 the_order from dual union all
select 2 the_pid,22 the_sale,8 the_order from dual
select the_pid,the_sum,the_avg
from (select the_pid,
sum(the_sale) over (partition by the_pid order by the_order) the_sum,
round(avg(the_sale) over (partition by the_pid order by the_order),2) the_avg,
the_order,
floor((0.9 * max(the_order) over (partition by the_pid))) to_pick
from the_sample
where the_order = to_pickRegards
Etbin -
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; -
Display each quarters record in a row
user aske me if I can display each quarters records in a separate row in the same report. will this possible without using PL/SqL
here is the desired out put.
in this case the user select quarter 1-3 the year is 2011 and they can not select more than one year at a time of running report.
If possible i would like to give the user to select any quarter they want when they run the reprot. please give me a clue how this can be done.
PROJECTAWARDED AWARDEDDOLLARAMOUNT NUMBEROFBIDDERS AVERAGENUMBEROFBIDDER
30 56,552,584 116 4
96 196,470,119 329 3
71 174,899,055 278 4
197 427,921,758 723 11
SELECT DISTINCT
COUNT (P.CPROJNUM) ProjectAwarded,
SUM (MIN (c.calcbtot)) AwardedDollarAmount,
SUM (COUNT (C.VENDOR)) NumberOfBidders,
(SUM (COUNT (C.VENDOR)) / (COUNT (P.CPROJNUM))) AverageNumberOfBidder
FROM BIDDERS C,
BIDLET B,
LETPROP L,
PROPOSAL P
WHERE C.LETTING = B.LETTING
AND P.CONTID = L.LCONTID
AND C.LETTING = L.LETTING
AND C.CALL = L.CALL
AND l.lcontid IN
(SELECT lcontid
FROM letprop c, PROPOSAL d
WHERE datestat IS NOT NULL
AND UPPER (letstat) <> 'R'
AND UPPER (letstat) <> 'B'
AND TRIM (UPPER (TIMELET)) = TRIM ('9:30 A.M.')
AND c.LCONTID = d.CONTID)
AND B.DATELET >= ADD_MONTHS(TRUNC(TO_DATE(:year,'YYYY'),'YYYY'),(:quarter - 1) * 3)
AND B.DATELET < ADD_MONTHS(TRUNC(TO_DATE(:year,'YYYY'),'YYYY'),:quarter * 3)
GROUP BY l.callSELECT DISTINCT
COUNT (P.CPROJNUM) ProjectAwarded,
SUM (MIN (c.calcbtot)) AwardedDollarAmount,
TRUNC (TO_CHAR(B.DATELET, 'Q')) ,------------------------Added this line and now it gives me an error ORA-00937: not a single-group group function
----I added the field in the group by clasue.
SUM (COUNT (C.VENDOR)) NumberOfBidders,
(SUM (COUNT (C.VENDOR)) / (COUNT (P.CPROJNUM))) AverageNumberOfBidder
FROM BIDDERS C,
BIDLET B,
LETPROP L,
PROPOSAL P
WHERE C.LETTING = B.LETTING
AND P.CONTID = L.LCONTID
AND C.LETTING = L.LETTING
AND C.CALL = L.CALL
AND l.lcontid IN
(SELECT lcontid
FROM letprop c, PROPOSAL d
WHERE datestat IS NOT NULL
AND UPPER (letstat) <> 'R'
AND UPPER (letstat) <> 'B'
AND TRIM (UPPER (TIMELET)) = TRIM ('9:30 A.M.')
AND c.LCONTID = d.CONTID)
AND B.DATELET >=
ADD_MONTHS (TRUNC(TO_DATE (:year, 'YYYY'), 'YYYY'),
(:from_quarter - 1) * 3)
AND B.DATELET <
ADD_MONTHS (TRUNC(TO_DATE (:year, 'YYYY'), 'YYYY'),
:to_quarter * 3)
GROUP BY TRUNC(TO_CHAR (B.DATELET, 'Q')), l.call -
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
Maybe you are looking for
-
Macbook Pro DVD player...
i cannot play some DVD's and once i manage to play a DVD it never plays again? is this some strange copy protection or a bug?
-
Problem recording sound w Radeon 9000
Help! Hopefully my system specs will be in the sig. When recording using ATI VCR the sound gets louder and softer. It "pumps" or "breaths". Also the max res the new computer can record without droping frames is 640 by 480 and to do that I've gotta tu
-
Just bought a 30 pin digital tv adapter. What other cords get attached to it besides the power cord to the iPad and the link between the tv and the adapter.? I have a hole for another cord.
-
hi every one, my requirement is If the transfer order is confirmed - i.e. VBUK-LVSTK (Overall WM status) is C, HU determination should be done using FM - HU_GET_HUS by passing delivery number in IS_OBJECTS. HU can be picked from table ET
-
No Delivery Failure notices using Exchange
When a delivery fails, I do not receive a failure notice in Mail.app. I do, however receive a notice when I check the same account using Entourage. Using Mail 2.1.1 on OS 10.4.8, accessing Exchange 2007 server.