Wrtie unsigned char and unsigned int into a binary file

Hi, I need write some data into some specific file format (.ov2) for other applications to read.
Here is the requirement of the data:
First byte: An unsigned char value, always "2" means simple POI entry
Next 4 byte: An unsigned int value,
Next 4 byte: A signed integer value.
Next 4 byte: A signed integer value
then next : A zero-terminated Ascii string
Here is my code:
                   String name = "name";
                   byte type = 2;
                 int size = name.length() + 13 +1; //1+4+4+4 and there is a 0 at last
                 int a = 1;
                 int b =2;
                 ds.writeByte(type); //1 byte, need save it as unsigned char
                     ds.writeInt(size); //4 //need to be an unsignged int
                     ds.writeInt(ilont); //4 //signed int
                     ds.writeInt(ilatt); //4 //signed int
                     //write zero-terminated ascii string
                     for(int n=0; n<name.length(); n++){
                          ds.writeByte(name.charAt(n));
                     ds.writeByte(0);                    This code could not get the correct result and I think I must do some sign to unsign conversion, but I don't know how to do it. Any help?
Thanks for you attention.

You don't have to do anything special at all. What's in a int or a byte is what you, as a programmer, say it is. Java treats int's as signed but, in fact, with 2's complement arithmatic most operations are exactly the same. Load and store, add and subtract - it makes no difference whether a variable is signed or unsigned. It's only when you convert the number, for example to a wider type or to a string representation that you need to know the difference.
When you read an unsigned byte and you want to widen it to an integer you have to clip the top bytes of the integer e.g.
int len = input.get() & 0xff;This is because, since java sees a byte as signed it will extend the sign bit into the top bytes of the int. "& 0xff" forces them to zero.
Writing it, you don't have to do anything special at all - it will autmatically get clipped. The above is probably the only concesion you'll ever need to make to unsigned binary. (You'd need to do the same thing from unsigned int to long, but this almost never happens).
When I read ov2 files I used a mapped byte buffer, because it allows you to set either big-endian or little-endian and I wasn't sure which ov2 files used. (Sorry, I've forgotten).

Similar Messages

  • No warning when assigning to an unsigned char from unsigned int

    Is this an error in VC++, or am I missing something?  The following code should give two warnings for assigning to a smaller type, but only gives one: (compiled as 32 bit)
    unsigned
    char c;
    unsigned
    int i = 24;
    // 32 bit unsigned integer
    unsigned
    long L = 25;
    // Also a 32 bit unsigned integer
    c = L; // Warning C4244
    c = i; // no warning
    This happens in Visual Studios 2005, 2010, 2012, 2013 and 2015, at least.

    Is this an error in VC++, or am I missing something?  The following code should give two warnings for assigning to a smaller type, but only gives one: (compiled as 32 bit)
    unsigned
    char c;
    unsigned
    int i = 24;
    // 32 bit unsigned integer
    c = i; // no warning
    This happens in Visual Studios 2005, 2010, 2012, 2013 and 2015, at least.
    Have you tried it with Warning Level 4?
    In VC++ 2008 Express and W4 I get:
    Warning 2 warning C4244: '=' : conversion from 'unsigned int' to 'unsigned char', possible loss of data
    - Wayne

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • On Adobe Acrobat Pro, how do I take a PDF file and convert it into an excel file?

    I am not sure how to take a PDF file and change it into an excel file. I have Adobe Acrobat Pro. Thanks!

    Using Acrobat XI Pro.
    File - Save As Other - Spreadsheet - Microsoft Excel Workbook
    Be well...

  • Want to save the number -9999 into a binary file

    Hello:
    I have this function in which I save different numbers (integers or doubles) into a binary file (with another extension) but when i tried to convert -9999 into bytes and then save it in the file ; it saves -9960 not -9999 as it should. I do not know why.
    This is my function:
    public static void createFile(Double [][] Grid, String txtOutputFile, String[] gridInfoFile){
         Integer[][] intGrid = null ;
         File file = new File(Utils.ChangeFileExt(txtOutputFile, ".myExt"));
         try {
                   FileOutputStream file_out = new FileOutputStream(file);
                   DataOutputStream data_out = new DataOutputStream(file_out);
                   if(gridInfoFile[0].equalsIgnoreCase("1") || gridInfoFile[0].equalsIgnoreCase("1.0")){
                        intGrid = doubleToIntArray(Grid);
              for(int i = 0; i < Grid.length; i++){
                   for(int j = 0; j < Grid[0].length; j++){
                        if(gridInfoFile[0].equalsIgnoreCase("1") || gridInfoFile[0].equalsIgnoreCase("1.0")){
                             Byte byte1, byte2;                         
                             byte1 = new Integer (intGrid[i][j] / 256).byteValue();
                             byte2 = new Integer(intGrid[i][j] - (intGrid[i][j] / 256)).byteValue();
                             data_out.write(byte2);
                             data_out.write(byte1);
                        if(gridInfoFile[0].equalsIgnoreCase("2") || gridInfoFile[0].equalsIgnoreCase("2.0")){
                             ByteArrayOutputStream byte_out = new ByteArrayOutputStream ();
                             DataOutputStream data_out2 = new DataOutputStream (byte_out);
                             data_out2.writeFloat(Grid[i][j].floatValue());
                             byte[] bArray = byte_out.toByteArray();
                             data_out.write(bArray[3]);
                             data_out.write(bArray[2]);
                             data_out.write(bArray[1]);
                             data_out.write(bArray[0]);
              }//fin for
              data_out.close();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
    I had already tried data_out.writeFloat, write, writeInt, etc without any success.
    If someone knows the answer , please let me know, will appreciate that. Thank you for your help
    magnasound

    Since you are using DataOutputStream, why not use some of its more helpful methods, like writeInt?

  • Read multiple files and save all into one output file(AGAIN)

    Hi, guys
    I need your help for reading data from multiple files and save the results into one output file. When files are selected from file chooser, my program read the data line by line , do some calculations and save the result into the output. I made an array to store input files and it seems to be working fine, but when it comes to SaveFile() function, issues NullPointException message.
    public class FileReduction1 extends JFrame implements ActionListener
       // GUI definition and layout
        /* ACTION PERFORMED */
        public void actionPerformed(ActionEvent event) {
            if (event.getActionCommand().equals("Open File")) getFileName();
        /* OPEN THE FILE */
        private void getFileName() {
            // Display file dialog so user can select file to open
         JFileChooser fileChooser = new JFileChooser();
         fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fileChooser.setMultiSelectionEnabled(true);
         int result = fileChooser.showOpenDialog(this);
         // If cancel button selected return
         if (result == JFileChooser.CANCEL_OPTION) return;
            if (result == JFileChooser.APPROVE_OPTION)
             files = fileChooser.getSelectedFiles();
                textArea.setText("");
                if(files.length>0)
                    filelist="";
                    System.out.println("files length"+files.length);
                    for(int i=0;i<files.length;i++)
                         System.out.println(files.getName());
    filelist+=files[i].getName()+" ,";
    if (checkFileName(files[i]) )
    openButton.setEnabled(true);
    readButton.setEnabled(true);
    textArea.append("file "+files[i].getName()+"is a proper file"+"\n");
    readFile(files[i]);
    textfield.setText(filelist);
    else{JOptionPane.showMessageDialog(this,"Please select file(s)",
                    "Error 5: ",JOptionPane.ERROR_MESSAGE); }
         // Obtain selected file
    /* READ FILE */
    private void readFile(File fileName_in) {
    // Disable read button
    readButton.setEnabled(false);
    // Dimension data structure
         getNumberOfLines(fileName_in);
         data = new String[numLines][4];
         // Read file
         readTheFile(fileName_in);
         // Rnable open button
         openButton.setEnabled(true);
    /* GET NUMBER OF LINES */
    /* Get number of lines in file and prepare data structure. */
    private void getNumberOfLines(File fileName_in) {
    int counter = 0;
         // Open the file
         openFile(fileName_in);
         // Loop through file incrementing counter
         try {
         String line = fileInput.readLine();
         while (line != null) {
         counter++;
              System.out.println("(" + counter + ") " + line);
    line = fileInput.readLine();
         numLines = counter;
    closeFile(fileName_in);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error reading File",
                   "Error 5: ",JOptionPane.ERROR_MESSAGE);
         closeFile(fileName_in);
         System.exit(1);
    /* READ FILE */
    private void readTheFile(File fileName_in)
    // Open the file
    //int row=0;
    int col=0;
    openFile(fileName_in);
    System.out.println("Read the file");
    // Loop through file incrementing counter
    try
    String line = fileInput.readLine();
    while (line != null)
    boolean containsDoubles = false;
    double temp;
    String[] lineParts = line.split("\t");
    try
    for (col=0;col<lineParts.length;col++)
    temp=Double.parseDouble(lineParts[col]);
    data[row][col] = lineParts[col];
    containsDoubles = true;
    System.out.print("data["+row+"]["+col+"]="+lineParts[col]+" ");
    } catch (Exception e) {row=0; col=0; temp=0.0;}
    if (containsDoubles){ row++;}
    System.out.println();
    line = fileInput.readLine();
    catch(IOException ioException)
    JOptionPane.showMessageDialog(this,"Error reading File", "Error 5: ",JOptionPane.ERROR_MESSAGE);
    closeFile(fileName_in);
    System.exit(1);
    //System.out.println("length"+data.length);
    closeFile(fileName_in);
    process(fileName_in);
    /* CHECK FILE NAME */
    /* Return flase if selected file is a directory, access is denied or is
    not a file name. */
    private boolean checkFileName(File fileName_in) {
         if (fileName_in.exists()) {
         if (fileName_in.canRead()) {
              if (fileName_in.isFile()) return(true);
              else JOptionPane.showMessageDialog(null,
                        "ERROR 3: File is a directory");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 2: Access denied");
         else JOptionPane.showMessageDialog(null,
                        "ERROR 1: No such file!");
         // Return
         return(false);
    /* OPEN FILE */
    private void openFile(File fileName_in) {
         try {
         // Open file
         FileReader file = new FileReader(fileName_in);
         fileInput = new BufferedReader(file);
         catch(IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
         textArea.append("OPEN FILE\n---------\n");
         textArea.append(fileName_in.getPath());
         textArea.append("\n");
         //System.out.println("File opened successfully");
    /* CLOSE FILE */
    private void closeFile(File fileName_in) {
    if (fileInput != null) {
         try {
              fileInput.close();
         catch (IOException ioException) {
         JOptionPane.showMessageDialog(this,"Error Opening File",
                   "Error 4: ",JOptionPane.ERROR_MESSAGE);
    System.out.println("File closed");
    private void process(File fileName_in) {
    //getNumberOfLines();
         //data = new String[numLines][3];
         // Read file
    double temp,temp1;
         //readTheFile();
    //System.out.println("row:"+row);
    //int number=data.length;
    //System.out.println(number);
    for (int i=0; i<row; i++)
    temp=Double.parseDouble(data[i][1]);
    sumx+=temp;
    temp1=Double.parseDouble(data[i][3]);
    sumy+=temp1;
    multixy+=(temp*temp1);
    square_x_sum+=(temp*temp);
    square_y_sum+=(temp1*temp1);
    //System.out.println("Sum(x)="+sumx);
    double tempup=(row*multixy)-(sumx*sumy);
    double tempdown=(row*square_x_sum)-(sumx*sumx);
    slope=tempup/tempdown;
    double tempbup=sumy-(slope*sumx);
    intb=tempbup/row;
    double tempside=(row*square_y_sum)-(sumy*sumy);
    double cordown=Math.sqrt(tempdown*tempside);
    corr=tempup/cordown;
    r_sqrt=corr*corr;
         textArea.append("Data for file"+ fileName_in.getName()+" have been processed successfully.");
         textArea.append("\n");
         textArea.append("Please enter output file name including extension.");
    System.out.println("number"+row);
    System.out.println("slope(m)="+slope);
    System.out.println("intecept b="+intb);
    System.out.println("correlation="+corr);
    System.out.println("correlation="+r_sqrt);
    saveFile();
    private void saveFile()
    textArea.append("SAVE FILE\n---------\n");
    if (openFile1())
         try {
              outputToFile();
    catch (IOException ioException) {
              JOptionPane.showMessageDialog(this,"Error Writing to File",
                   "Error",JOptionPane.ERROR_MESSAGE);
    private boolean openFile1 ()
         // search for the file path
    StringBuffer stringpath;
    title=textfield1.getText().trim();
    int temp=fileName_in.getName().length();
    int temp_path=fileName_in.getPath().length();
    int startd=(temp_path-temp);
    stringpath=new StringBuffer(fileName_in.getPath());
    stringpath.delete(startd, temp_path+1);
    //System.out.println("file-path="+temp_path);
    //System.out.println("length-file="+temp);
    path=stringpath.toString();
    fileName_out = new File(path, title);
    //System.out.println(file_out.getName());
    if (fileName_out==null || fileName_out.getName().equals(""))
         JOptionPane.showMessageDialog(this,"Invalid File name",
                   "Invalid File name",JOptionPane.ERROR_MESSAGE);
         return(false);
         else
    try
    boolean created = fileName_out.createNewFile();
    if(created)
    fileOutput = new PrintWriter(new FileWriter(fileName_out));
    fileOutput.println("File Name"+"\t"+"Slope(m)"+"\t"+"y-intercept(b)"+"\t"+"Coefficient(r)"+"\t"+"Correlation(R-Squared)");
    return(true);
    else
    fileOutput = new PrintWriter(new FileWriter(fileName_out,true));
    return(true);
    catch (IOException exc)
    JOptionPane.showMessageDialog(this,"Please enter the file name","Error",JOptionPane.ERROR_MESSAGE);
    return(false);
    private void outputToFile() throws IOException
    // Initial output
         textArea.append("File name = " + fileName_out + "\n");
         // Test if data exists
         if (data != null)
         fileOutput.println(fileName_in.getName() +"\t"+ slope+"\t"+intb+"\t"+corr+"\t"+r_sqrt);
    textArea.append("File output complete\n\n");
         else
    textArea.append("No data\n\n");
         // End by closing file
    initialcomp();
         fileOutput.close();
    private void initialcomp()
    slope=0.0;
    intb=0.0;
    corr=0.0;
    r_sqrt=0.0;
    sumx=0.0; sumy=0.0; multixy=0.0; square_x_sum=0.0; square_y_sum=0.0;
    for(int i=0;i<data.length;i++)
    for(int j=0;j<data[i].length;j++)
    data[i][j]=null;
    /* MAIN METHOD */
    public static void main(String[] args) throws IOException
         // Create instance of class FileChooser
         FileReduction1 newFile = new FileReduction1("File Reduction Program");
         // Make window vissible
         newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         newFile.setSize(500,400);
    newFile.setVisible(true);
    Sorry about the long lines.
    As you can see, all input files saved in array called files, however when OpenFile1() function is called, it take input (fileName_in) as a single file not an array. I'm assuming this causes the exception.
    When there's muptiple inputs, program should take each file from getFileName() to outputToFile() sequentially.
    Does anybody have an idea to solve this?
    Thanks a lot!!

    you naming convention is confussing. you should follows Java naming convention..you have a getXXX but decalred the return type as "void"...get usully means to return something...
    your code is doing too much..and hard to follows..
    1. get the selected files
    for each selected file
    process the file and return the result
    write out the result.
    /** close the precious resource */
    public void closeResource(Reader in){
        if (in != null){
            try{ in.close(); }
            catch (Exception e){}
    /** get the total number of line in a file */
    public int getLineCount(File file) throws IOException{
        BufferedReader in = null;
        int lineCount = 0;
        try{
            in = new BufferedReader(new FileReader(file));
            while ((in.readLine() != null)
                lineCount++;
            return lineCount;
        finally{ closeResource (in);  }
    /** read the file */
    public void processFile(File inFile, File outFile) throws IOException{
        BufferedReader in = null;
        StringBuffer result = new StringBuffer();
        try{
            in = new BufferedReader(new FileReader(inFile));
            String line = null;
            while ((in.readLine() != null){
                .. do something with the line
                result.append(....);
            writeToFile(outFile, result.toString());
        finally{ closeResource (in);  }
    public void writeToFile(File outFile, String result) throws IOException{
        PrintWriter out = null;
        try{
            out = new PrintWriter(new FileWriter(outFile, true));  // true for appending to the end of the file
            out.println(result);
        finally{  if (out != null){ try{ out.close(); } catch (Exception e){} }  }
    }

  • Inserting filename and page numbers into multiple PDF files?

    Have since seen this thread, BUT still interested in the syntax of the code
    to insert filename and page # into multiple files:
    http://forums.adobe.com/thread/951925?tstart=0
    Good Evening (GMT!)
    I have approx 100 PDFs with one or two pages in each, they are English translations
    of Russian language test certificates and the formatting/feel of the originals is lost in
    the translations. The only real link between the two sources is the "_RUS" and "_ENG"
    filename suffixes and the common leading filenames otherwise. Thus I need to maintain
    a record of the filename in any page I print off, should there be a need to refer back to
    the original if the translation is open to artistic licence.
    I have a script (below) that happily adds a page x/y and filename into the active file,
    what I would like is to be able to do this insertion into multiple files as defined by a
    portfolio or a selection via a select files dialogue box
    I am quite out of my depth now as my past skirmishes with JavaScript have set
    cookies and tweaked a few other browser doodads in webauthoring
    Any help most appreciated on this one...
    Kind Regards
    Dr B
    Southampton
    UK
    NB the filename inserted may be corrupted as a result of my last tweakings
    will sort that one out ASAP....
    ================================
    // SetRemoveFooter
    // Modified as marked
    // Menu item generation
    app.addSubMenu({ cName: "Footer",cUser: "Set/Remove Complex Footer", cParent: "File", nPos: 20 });
    app.addMenuItem({ cName: "Set Filename", cParent: "Footer", cExec: "SetFooter(1)"});
    app.addMenuItem({ cName: " -> Set Date .... centered", cParent: "Footer", cExec: "SetFooter(2)"});
    app.addMenuItem({ cName: " -> Set Date .... right", cParent: "Footer", cExec: "SetFooter(3)"});
    //add page x of y
    app.addMenuItem({ cName: "Set Page ", cParent: "Footer", cExec: "SetFooter(4)"});
    app.addMenuItem({ cName: "Set Both", cParent: "Footer", cExec: "SetFooter(5)"});
    app.addMenuItem({ cName: "-------------------------------", cParent: "Footer",cExec: "{}"});
    app.addMenuItem({ cName: "Remove Both", cParent: "Footer", cExec: "RemoveFooter(5)"});
    app.addMenuItem({ cName: "Remove Date Time (Filename)", cParent: "Footer", cExec: "RemoveFooter(1)"});
    app.addMenuItem({ cName: "Remove Page", cParent: "Footer", cExec: "RemoveFooter(4)"});
    //=====================================================================================
    //Set/remove Footer
    function SetFooter(ARG)
    var re = /.*\/|\.pdf$/ig;
    var FileNM = + this.path.replace(re,"")+".pdf";
    var Path = this.path;
    var AcDate = new Date();
    var AcDateFormat = "dd/mm/yyyy"
    var Box2Width = 100
    for (var p = 0; p < this.numPages; p++)
    var aRect = this.getPageBox("Crop",p);
    var TotWidth = aRect[2] - aRect[0]
    if (ARG<=3 || ARG==5)
    {var fd = this.addField("xftDate", "text", p, [30,15, TotWidth-30-30,30]);
    //print output?
    fd.value = util.printd(AcDateFormat, AcDate) + " (" + FileNM +")";
    // TEXT SIZE SETTING
    fd.textSize=12; fd.readonly = true;
    if (ARG==1){ fd.alignment="left" };
    if (ARG==2){ fd.alignment="center" };
    if (ARG==3){ fd.alignment="right" };
    if (ARG==4 || ARG==5)
    {var bStart=(TotWidth/2)-(Box2Width/2)
    var bEnd=((TotWidth/2)+(Box2Width/2))
    var fp = this.addField(String("xftPage"+p+1), "text", p, [bStart,30,bEnd,15]);
    // print output?
    fp.value = "Page: " + String(p+1)+ "/" + this.numPages;
    // TEXT SIZE SETTING
    fp.textSize=12; fp.readonly = true;
    fp.alignment="center";
    //==========================================================================
    function RemoveFooter(ARG)
    if (ARG<=3 || ARG==5) {var x = this.removeField("xftDate");}
    if (ARG==2 || ARG==5) {for (var p = 0; p < this.numPages; p++)
    var x = this.removeField(String("xftPage"+p+1)); }
    will

    Putting this in a batch file within the automation function of Acrobat
    delivers the goods, I need to investigate the formatting of the output to
    get them to line up, have taken the middle ground and gone for a central
    position for the page x/y text...... some lines are redundant
    Dr B
    ===========================================
    var re = /.*\/|\.pdf$/ig;
    var FileNM = this.path.replace(re,"")+".pdf";
    var Path = this.path;
    var AcDate = new Date();
    var AcDateFormat = "yyyy/mmm/dd  HH:MM"
    var Box2Width = 50
    for (var p = 0; p < this.numPages; p++)
    var aRect = this.getPageBox("Crop",p);
    var TotWidth = aRect[2] - aRect[0]
           var fd = this.addField("xftDate", "text", p, [30,15,
    TotWidth-30-30,30]);
           fd.value =  FileNM;
           fd.textSize=12; fd.readonly = true;
           fd.alignment="left";
    var bStart=(0);
    var bEnd=(TotWidth);
           var fp = this.addField(String("xftPage"p1), "text", p,
           fp.value = "Page: " + String(p1) "/" + this.numPages;
           fp.textSize=12;  fp.readonly = true;
           fp.alignment="center";

  • Grabbing numbers from an array of type double and outputting them into a text file

    In a program im creating i need to save some coordinates of a micropositioner i have into a text file,
    I have the coordinates saved into an array that has 6 digits of precision (6 places after the decimal point).
    I use the number to string conversion and wire that into the write to text file function in labview.  When i open the file
    the numbers that are only displayed are the ones to the left of the decimal point.  I know the number to decimal string function
    rounds the values so if i were to input 3.111111 it would only output the string "3" instead of "3.111111" . 
    So to get all the digits onto the file without rounding i multiplied the number by 10^6 but the decimal point will be lost at that point.
    Is there anyway i can convert numbers into strings without labview rounding to the nearest whole number also without having to multiply by 10^6 and without having to expect the user to know that the coordinates saved in a file are multiplied by an order of magnitude of a million ? 

    ed oh i guess i just missed that function on the pallete after i saw that the function went from number to hex, octal, etc. i assumed that the rest on that row would be some sort of conversion to a different base number, haha thanks.

  • Can Media Encoder take an image sequence in the watch folder and turn it into a video file?

    I'm using OSX and Media Encoder 6 (from premier 6) and can't figure out how to make the watch folder take a .jpeg or .dpi sequence and turn it into a single video file.
    I tried copying all the stills into the watch folder, that made 60 individual video files (one for each image).
    I tried making a folder inside the watch folder, and copying all the images into it.. to which Media Encoder did nothing.
    What am I missing? Will Media Encoder take image sequences and render them out as a audio-less video for me?
    Thanks for any imput.

    Hi action_packed,
    This is from the documentation: http://helpx.adobe.com/media-encoder/using/add-items-encoding-queue.html
    Still Image Sequences are not supported as source footage through Watch Folders. If a set of still images is placed in the folder being watched, each individual still file will be added as a separate item to the Queue rather than than the entire sequence as a single piece of footage.
    Make a feature request for that here: http://adobe.ly/feature_request
    Thanks,
    Kevin

  • Extract data from Oracle Database and store it into a CSV file format

    Hello.
    I'm trying to export a table from an Oracle Database into CSV file format with any Oracle adaptor and store it into a HDFS system.
    How could I do it?
    Thanks in advance!

    Xavi wrote:
    HI Charles. Could I use.. Oracle Data Integrator Application Adapter for Hadoop? For this purpose?
    Thanks in advancePerhaps. I have to confess that I am not familiar enough with ODI to know if that is within its capabilities.
    You might see if there is a forum for ODI and post your question to that.
    Charles Lamb

  • Read data from db and write it into the txt file

    hi all
    could anyone please help me regarding the following:
    i would like to read the data from database using sql query and the write the data into a text file.
    I am able to connect the db, run the query, create file...but not knowing how to write the data into the file.
    could anyone please help me out.
    thanks in advance
    regards
    sasasa
    Edited by: sasasa on Sep 14, 2009 8:57 AM

    i would like to read the data from database using sql query and the write the data into a text file.
    I am able to connect the db, run the query, create file...but not knowing how to write the data into the file.
    There must be something that I am missing.
    How is it possible to be able to navigate JDBC, run a query and create a file but not know how to write to it?

  • Creating a list of names and putting them into a computer file

    I am trying to create a list of names which is generated by a swf file that contains buttons representing letters of the alphabet. The user generates a name by clicking on the letter buttons until the letters of the name have been spelled out and then clicking on a “Submit” button to add each name to the list. The names are generated inside the swf file but I want the list of names to be deposited in a file within a folder of the computer and remain there as a permanent record after the swf file has been closed. I can do the Actionscript 3 programming associated with the letter buttons but I would like to know how to send the names to the computer file.

    Here is some simplified code which illustrates the problem I am having. I have four buttons A2_btn thru D2_btn. These buttons can be clicked to put a sequence of letters into the input text window called requestedItem_txt. The button called submit_btn can be clicked to put the sequence of letters (preceded with a comma) into the window called requestedItemList_txt and append the sequence of letters (and comma) to whatever is already in the window. This part is working satisfactorily. I also want to write the contents of the requestedItemList_txt window into a file on my computer as a permanent record each time the submit_btn button is clicked. I get an error message for the flush statement and I don’t get any file written on my computer. This problem completely baffles me so I would appreciate any help you can provide.
    A2_btn.addEventListener(MouseEvent.CLICK, btnA2Press);
    function btnA2Press(event:MouseEvent):void
        requestedItem_txt.appendText("a");
    B2_btn.addEventListener(MouseEvent.CLICK, btnB2Press);
    function btnB2Press(event:MouseEvent):void
        requestedItem_txt.appendText("b");   
    C2_btn.addEventListener(MouseEvent.CLICK, btnC2Press);
    function btnC2Press(event:MouseEvent):void
        requestedItem_txt.appendText("c");
    D2_btn.addEventListener(MouseEvent.CLICK, btnD2Press);
    function btnD2Press(event:MouseEvent):void
        requestedItem_txt.appendText("d");
    var sharedOb:SharedObject = SharedObject.getLocal("savedData");
    var flushResult:Object = sharedOb.flush();
    submit_btn.addEventListener(MouseEvent.CLICK, submit_btnPress);
    function submit_btnPress(event:MouseEvent):void
        requestedItemList_txt.appendText(","+(requestedItem_txt.text));
        requestedItem_txt.text = ("");
        SharedObject.getLocal("savedData");
        trace(SharedObject.getLocal("savedData"));
        flush("requestedItemList_txt.text");
    stop();

  • How do I download a video and convert it into an flv file? In previous versions, all I had to do was pick the resolution and it was done automaticlly. I use DVDFLICK to burn my downloaded videos to DVD.

    In previous versions of Firefox, I was able to easily download and convert videos into .flv files. I was then able to burn DVDs of theses downloaded videos using DVDFLICK. I'm now unable to do this using Firefox6.0.2?

    Hello,
    There is a process by which you can produce a BluRay encode on a red laser DVD. See link below
    from Ken Stone site.
    http://www.kenstone.net/fcphomepage/burn_br_mac_superdrivestone.html
    Also this can be done in Toast 10 with the BluRay plugin, somewhat easier.
    Good Luck, Tom

  • Save digitizer and DIO waveforms into one spreadsheet file

    I am using attached mixedsignalscopeusingtclk.vi for data acquisition and would like to acquire 4-channel of data. My PXI-1042 system has PXI-5122 and PXI-6552, and I am using 2 channels of digitizer and 2 channels of digital I/O. I am using Labview 2010 SP1. The VI generated 1-D array of cluster for analog waveform and 1-D array of digital waveform. How do I save both waveforms to one spreadsheet file?
    Solved!
    Go to Solution.
    Attachments:
    mixedsignalscopeusingtclk.vi ‏258 KB

    Hi,
    You can use a Write to Measurement File express VI. Note that this is the easiest way however not the most efficient way to write to a file.
    Since you have the fetch VIs inside for loops, your output is a 1D array of waveforms. You will need to obtain the waveform element and convert it into a type that the express VI can read. If you unbundle the waveform and grab only the data and connect it straight to the express VI, LabVIEW will automatically place a "Convert to Dynamic Data" block in line to make it compatible. Same applies when you connect the boolean array to the Signals input of the express VI. And if you connect more than one signal to this input, LabVIEW will automatically place a "Merge Signals" block.
    If you reproduce the below code, you should be able to write the two channels to the same measurement file. If you have more than one channel of each type, you can grab multiple elements using the same Index Array block and take them through the same process shown below.
    Hope this helps.
    Tarek B
    Applications Engineer
    National Instruments

  • Reading the data from 2 files and writing it into the 3rd file?

    Hi,
    I am reading datas from 2 files Say,
    Example1.txt Example2.txt
    Ashok ^data1^data2^data3
    Babu ^data1^data2^data3
    Chenthil ^data1^data2^data3
    Danny ^data1^data2^data3
    I want those data's to be written in a 3rd file. Say,
    Example3.txt
    Ashok^ data1^data2^data3
    Babu^ data1^data2^data3
    Chenthil^ data1^data2^data3
    Danny^ data1^data2^data3
    So that i can tokenize it with a delimeter(^) and get the values. Here how to append the datas in this form in Example3.txt. Eventhough u use FileWriter with append "true" as a parameter how they will apend like the Example3.txt file? Please do provide an answer for this..Since this is very urgent to be delivered...Expecting postive response.
    Thanx,
    JavaCrazyLover

    import java.io.*;
    import java.util.*;
    public class en
    public static void main(String args[]) throws IOException     
    {int data,data1,offset,offset1;
              FileOutputStream fos1=new FileOutputStream("c:/example3.txt");
              FileInputStream fis=new FileInputStream("c:/example1.txt");
              FileInputStream fis1=new FileInputStream("c:/example2.txt");
    while((data=fis.read())!=-1) 
         fos1.write(data);
    while((data=fis1.read())!=-1) 
    fos1.write(data);
    fis.close();
    fis1.close();
    fos1.close();
    }first create those 3 files in c:

Maybe you are looking for