J2ME Writing in CSV file through file Connection API - file

I am creating an application in which i need to add a new column in the csv file and then entries for that particular column.
And I have tried OutputStream and PrintStream but the problem is that the data is being written in starting of the file but i want the data at random position according to my need.
And RandomAccessFile is not identified by the application.
For e.g.
My CSV is:
Name,any_date
A,
B,
c,
And after writing it will look like
Name,any_date
A,p
B,a
C,p
I am using file Connection API to read and write.Can anyone suggest me how to do that??
Thanks in advance.

i think you want to append data in the file.
you can try this
os = fconn.openOutputStream(fconn.fileSize());
os.write(data.getBytes());
This is a simple example to append data at last.

Related

UberEats System in C - File Handling

So, i have a school project to build the uberEats management system in C.
I have a csv file that contains the cities where the system is available and their respective code. Eg: 1, New York.
And i need to read that file, so when the user inserts one code, it associates to the specific city. Can anyone help me how to do that?
you could read the file and make a matrix of 2xno_cities, and when the user puts a number, you just do
array[input-given-by-user][1]
since the first [] would be for the row, and the second one for the column, which is where you save the cities,

How to view 'data' file which is included by .odb database file?

I am trying to extract the data from .odb database file. For this, at first I unzipped the .odb file and then tried to read 'data' file came from this unzipped. But I guess there is an encoding problem during the reading process. I get some meaningless symbols. As far I search, this file could be a binary file. By the way, I can not see the extension of the 'data' file. I wonder how to read file to exract data?
i'm brazilian, and i saw this question without a answer.
i'm python user and i did this:
try to open the file that contains database *.odb
___________________________a file.py________________________
import sys, zipfile
myfile = zipfile.ZipFile(yourfile.odb)
listoffiles = myfile.infolist()
for s in listoffiles:
if s.orig_filename == "database/data":
print(bh.decode("utf-8", "ignore"))
____________________________eof_________________________________
my table is very simple, but it may help.
I've found this jointing parts from several websites.
as you see, an odb file is simply a zipped file that contains a xml file that contains a table information "content.xml" but only table information.
the content of database is in database/data. the values are stored here. you can decode with decode on python.
thanks to http://www.linuxjournal.com/ too, were i found some scripts

Reading and writing to xls and doc files in c

I have this particular problem where i have to write a c program that reads numerical data from a text file. The data is tab delimited. Here is a sample from the text file.
1 23099 345565 345569
2 908 66766 66768
This is data for clients and each client has a row.Each column represents customer no.,previous balance,previous reading, current reading.Then i have to generate a doc. document
that summarizes all this information and calculates the balance I can write a function that does this but how do i create an xls document
and a word document where all the results are summarized using the program? The text document has only numerical data. Any ideas
The easiest way is to create a csv file and not a xls file.
Office can open those csv files with good results.
And it is way easier to create a ascii text file with commaseparated values,
than to create something into a closed format like the ms office formats.
The simplest way to create a spreadsheet that contains formulas and formatting, and can be opened by Excel, is to create an XML Spreadsheet file.

components of an SPSS project

I have given some data in an excel sheet to a 3rd party for SPSS data processing. After completion of the processing, what are the files that I should get back from them.
I have received one file with a ".sav" extension. I presume this file contains the imported data (from my excel file).
I have received documents (.rtf - rich text format) with the chart and graphs only. Is there something else I need to get so that I can use the files later on for further analysis.
Thanks in advance
V Karthick
Yes, the ".sav" extension is the data file. You should also request the syntax file(s), ".sps" extension. The syntax file is a record of all data transformations which have been performed and allows you to review their work. The syntax file can be opened with notepad or any text editor.
Arthur

Read a value from a .xls file using .bat files

I just want to know if there could be any way by which we can read a value from an .xls file using a .bat file.
For eg:If i have an .xls named test.xls which is having two columns
namely 'EID' and then 'mail ID'.Now when we give the input to the .xls the EID name.it should extract the mail id which corresponds to the EID and echo the result out.
**EID** **MailID**
E22222 MynameisA#company.com
E33333 MynameisB#company.com
...
...
So by the above table,when i give the input to the xls file using my .bat file as E22222,it should read the corresponding mail ID as MynameisA#company.com and it should echo the value.
So i hope i am able to present my doubt.Please get back to me for more clarifications.
Thanks and regards
Maddy
There is no facility to do this directly with traditional .bat files. However, you might investigate PowerShell, which is designed to be able to do this sort of thing. PowerShell integrates well with existing Windows applications (such as Excel) and may provide the tools you need to do this easily.
A quick search turned up this example of reading Excel files from PowerShell.
You can't do this directly from a batch file. Furthermore, to manipulate use Excel files in scripting you need Excel to be installed.
What you can do is wrap the Excel-specific stuff in a VBScript and call that from your batch.
You can do it with Alacon - command-line utility for Alasql database.
It works with Node.js, so you need to install Node.js and then Alasql package:
To take data from Excel file you can use the following command:
> node alacon "SELECT VALUE [mail ID] FROM XLS('mydata.xls', {headers:true})
WHERE EID = ?" "E2222"
Fist parameter is a SQL-expresion, which read data from XLSX file with header and search data
for second parameter value: "E22222". The command returns mail ID value.
This will be hard (very close to impossible) in BAT, especially when using the original XLS file, but even after an export to CSV it will be much easier to use a script/programming language (Perl, C, whatever) to do this.

Resources