Format of /ByteRange array

I am trying to implement signing for pdf documents. As far as I understand - the digest must be calculated for everything except for the signature's /Content entry contents. The contents can be "isolated" by using /ByteRange array. I just wanted to confirm the format of said array. Is it [offset length offset length]? If so, can space for digest signature be longer that signature itself i.e. if signature is 40 bytes in length (sha1), can space for signature be more than 40 bytes?

Yes, that is correct for the ByteRange array.
The length in the array MUST match the length of the "hole" you leave for the Contents or the signature wont validate.
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Thu, 22 Sep 2011 00:05:02 -0700
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: Format of /ByteRange array
Format of /ByteRange array
created by Eimantas Vaiciunas<http://forums.adobe.com/people/Eimantas+Vaiciunas> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/3931182#3931182

Similar Messages

  • How to get formatted text into arrays

    Dear experts and helpers,
    For my project I import an RTF file and then read the data from it into 3 arrays. This works fine when just using the string contents of the paragraphs. However, the final script should be able to read and replace formatted text...
    Why use the intermediate arrays? Because otherwise I need to switch back and forth between two fm-documents (and one may be a book component).
    The imported file starts with a number of lines separated into two items by a TAB (» denotes a TAB, in FM \x08)
    [[Garneau, 1990 #12]]    »   [9]
    The right item may also be locally formatted text, e.g. [9]
    Then follow the same (or smaller) number of paragraphs with formatted text like this:
    [9] » D. Garneau, Ed., National Language Support Reference Manual (National language Information Design Guide. Toronto, CDN: IBM National Language Technical Centre, 1990.
    Is it possible to replace in the body of the function below the following piece
      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        gaBibliography.push(pgfText);
        pgf = pgf.NextPgfInFlow;
    with this
      while(pgf.ObjectValid()) {
        gaBibliography.push(pgf);
        pgf = pgf.NextPgfInFlow;
    Do I need a special declaration of the array gaBibliography ?
    And how to get the right part of the intro lines as formatted thingy into array gaFmtCitsFmt ?
    Currently I read into arrays only the 'strings' (function GetText not shown):
    var gaFmtCitsRaw  = [];                           // left column in processed RTF
    var gaFmtCitsFmt  = [];                           // right column in processed RTF
    var gaBibliography= [];                           // bibliography lines from processed RTF
    // filename is something like E:\_DDDprojects\FM+EN-escript\FM-testfiles\BibFM-collected-IEEE.rtf
    function ReadFileRTF (fileName) {
      var nCits=0, nBib = 0, openParams, openReturnParams, newDoc, pgf, pgfText ;
      var TAB = String.fromCharCode(8);               // FM has wrong ASCI for TAB
      var parts = [];
      openParams = GetOpenDefaultParams();
      openReturnParams =  new PropVals(); 
      newDoc = Open (fileName, openParams, openReturnParams); 
      pgf = newDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;  // get first pgf in flow
    // --- read the temp/formatted citations 
      while(pgf.ObjectValid()) {
        pgfText = GetText (pgf, newDoc);
        if (pgfText.substring (0,2) == "[[") {        // citation lines start with [[
          parts = pgfText.split(TAB);                 // get the two parts of the line
          gaFmtCitsRaw.push (parts[0]);               // Push the result onto the global array
          gaFmtCitsFmt.push (parts[1]);
          pgf = pgf.NextPgfInFlow;
        } else { break }
    // --- read the bibliography
      while(pgf.ObjectValid()) {                      // until end of doc
        pgfText = GetText (pgf, newDoc);
        gaBibliography.push(pgfText);
        pgf = pgf.NextPgfInFlow;
      newDoc.Close (Constants.FF_CLOSE_MODIFIED);
    } // --- end ReadFileRTF
    The next questions then will be how to modify Ian Proudfoot's FindAndReplace script to handle formatted text as replacement. IMHO i will need to use copy/paste ...

    Klaus,
    Working with text is about the most complicated thing to do within FrameMaker. It seems counter-intuitive, since it is about the easiest thing to do with the GUI. But alas, once you remove the ability to select with a mouse and type with a keyboard, text becomes a wild jungle of complexity.
    Text ranges are not too bad, once you get the general idea. It is just that... a range of text, like something you would select with a mouse. Like a mouse selection, it starts before some character in some paragraph and ends after some character in some paragraph. It may be the same paragraph, which is a selection within a paragraph. The character can even be the same, which is then just an insertion point (cursor) somewhere.
    So, a text range is a data structure that defines two paragraphs and two characters. In the jargon of scripting, the character is called an "offset." An offset is simply the number of characters past the beginning of said paragraph, where 0 is the beginning.
    For example, if you want to capture the first five characters of a paragraph as a text range, you can do this, where 'pgf' is some paragraph object:
    var textRange = new TextRange();
    textRange.beg.obj = pgf;
    textRange.beg.offset = 0;
    textRange.end.obj = pgf;
    textRange.end.offset = 5;
    If you want to capture a whole paragraph, change that last line to the number of characters in the pgf, or you can do this:
    textRange.end.offset = Constants.FV_OBJ_END_OFFSET;
    ...where that constant is just some built-in thing that means "get me to the end of whatever." It's a convenience of the interface.
    I'll also note that a text range is actually just an array of two text location structures, one named 'beg' and one named 'end.' If you think of a text location as defined by paragraph and an offset from the first character, maybe that will make more sense.
    Text item structures are a whole new mess of complexity. I can't possibly go into an explanation of them here.
    I think that many ES developers (definitely myself included) still use the FDK documentation because it is considerably more comprehensive. The two interfaces are largely parallel, but of course somewhat different in the language syntax. Consider that as a potential resource.
    Russ

  • Formatting a byte array

    Hi,
    Unfortunately I do not have a very specific question here; I'm looking for some direction.
    I have an application that is receiving a large buffer of bytes, 680x480 if I recall correctly, and I'm basically wondering how to format that buffer to display on the system outputstream.
    I've never actually done any work with bytes, and I knew that would one day catch up to me and haunt me.
    I looked in the Java tutorial here at Sun for methods of formatting and working with bytes, but I didn't find anything. I might have completely missed it though, so if that's the case, if I could get a link to the appropriate section I'd be grateful.
    Anyway, this is what I currently have:
    //this returns a large buffer of type byte[]
    //this should be 680x480
    byte[] image = imAq.acquireImage();
    System.out.println(image);Obviously outputting image does not give me anything useful.
    These bytes will eventually be transformed into an image, but all I want to do now is print each byte in the buffer to the system outputstream.
    I'd be very appreciative if someone can direct me to a tutorial or API doc or something that I can use to learn how to work with bytes and format them and such to perform tasks such as this.
    Thanks,
    Dan
    Message was edited by:
    Djaunl

    I can't see why this would be very useful ... but
    this will print the bytes to the console.
    DataInputStream dis = new DataInputStream(
    new
    FileInputStream("filename"));
    byte b = 0;
    while ( (b = (byte)dis.read() ) != -1 )
    System.out.print(b);
    t's really useless though. What do you really want to
    do?Thanks for the replies.
    The reason I want to print the array to the system outputstream is to make sure the image data is coming in correctly from the server, as it giving us some issues at the moment.
    What I really want to do is take this array of bytes and convert it into an image, but first we need to make sure the image is loading correctly from the server.
    Thanks for the advice and links guys, I'll check them out and put them to use, as they will certainly help me learn.

  • Exporting Dynamic data to a formatted excel-readable array

    Hi all,
    I am trying to export some data into an excel sheet (csv) by creating a new file in which the data is stored. With the current set up that i have, i keep on running into the following problems:
    1. After every iteration in a single run, a dialogue box pops up and asks me  where to save the data, after i have already specified a file name
    2. The data format in the excel file is not what i wasnt. The data is all displayed as one string while i would like it to store the data in different columns.
    Some background: In the section of the vi that i have attached, i use 2 DAQ assistants. The first is used to obtain the initial voltage value at the 2 piezos which is then fed into the rest of the vi, this needs to be done just once, at the beginning of the vi run. The second DAQ asst is used to monitor and save the voltage as it is gradually increased and applied to the piezos.
    A picture of the section of the vi im having trouble with is attached, along with the entire vi.
    I would appreciate any help you can give me on these problems.
    Thanks!
    Attachments:
    errorvi.JPG ‏50 KB
    Coordinate Writing V2.vi ‏166 KB

    I Cant run your vi at the moment but from what i can see.
    - use the file open vi from the file I/O pallette rather than the Express file open VI you have and supply it with a proper path, not a string.
    - I prefer to use .csv (Commas Seperated) instead of tab seperated as i find it easier to read in a string indicator or similar and is just as easy to open in excell.
    - How many Samples is your 2nd Express DAQ function doing?  If it is multiple you will need to seperate the samples by comma also (or average them out etc).
    - I rarely use dynamic data but i think you would be best to extract the actual data values out from the data type at least to get you up and running (It is coerced at the moment and may not be doing what you expect it to do).
    craigc
    Message Edited by craigc on 05-19-2009 03:24 AM
    LabVIEW 2012

  • How do I format 1D waveform array to output to intensity chart?

    I've tried to modify the "Cont Acq&Graph Voltage-Int Clk.vi" example vi to output to an intensity chart. The problem is the chart only accepts a 2D array of input data, while the DAQmx vis are giving me a 1D array of waveform data.  How do I fix this?
    Thanks in advance...

      Thanks!  Here's an example of the first few samples of the data I'm getting, plus the header:
    Channels 1 
    Samples 1000 
    Date 2006/07/24 
    Time 13:41:57.315999 
    Y_Unit_Label Volts 
    X_Dimension Time 
    X0 0.0000000000000000E+0 
    Delta_X 0.000100 
    ***End_of_Header***  
    X_Value Dev1/ai0 Comment
     0.068936
     0.028033
     0.038671
     0.047368
     0.053086
     0.052326
     0.039342

  • How can I restructure an unfavourable 2D array format to 1D?

    A surface profilometer we use produces data in text files with five columns with data point ordering by row first; i.e. if you have the following data sample;
    1      2      3      4      5
    6      7      8      9     10
    11    12    13    14    15
    Then the data order follows the number order here.  I want to chop up this annoying format into multiple arrays by row (depending on the number of rows = for loop?) then splice them back together as a single column (transpose these arrays then build array?). Help!
    Solved!
    Go to Solution.

    apg504 wrote:
    A surface profilometer we use produces data in text files with five columns with data point ordering by row first; i.e. if you have the following data sample;
    1      2      3      4      5
    6      7      8      9     10
    11    12    13    14    15
    Then the data order follows the number order here.  I want to chop up this annoying format into multiple arrays by row (depending on the number of rows = for loop?) then splice them back together as a single column (transpose these arrays then build array?). Help!
    Once you have a 1D array, the concept of rows and columns no longer exists.
    In any case, reshaping is the right thing. Here's what I would do:
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Reshaper.png ‏11 KB

  • Using an array within an array, and exporting to CSV

    I am gathering data about an AD user, including group membership and I want to output that to a CSV. Easy enough right? Not so much :) I am successfully generating 2 arrays, one has user data and the 2nd has group membership, but it's not exporting properly
    to CSV. I've tried the -notypeinformation but it's still showing up.
    My code is below, followed by contents of CSV file in text format.
    cls
    #declare array to use
    $user_main = @()
    $arrGroups = @()
    $user = Get-ADUser -Filter {samaccountname -eq "MyUserName"} -Properties *
    $temp_user.Name = $user.Name
    $temp_user.SAMname = $user.SamAccountName
    $temp_user.lastpwchange = $user.PasswordLastSet
    $temp_user.lastlogon = $user.LastLogonDate
    #get group membership
    $groups = $user.memberof
    foreach ($group in $groups)
    $temp1 = $group.Split(",")
    $group_name = $temp1[0].Substring(3, $temp1[0].Length -3)
    #$arrGroups += New-Object -TypeName psobject -Property $temp
    $arrGroups += $group_name
    $user_main += New-Object -TypeName psobject -Property $temp_user
    #$user_main | select * | Format-Table
    #$arrGroups
    $new = $user_main + $arrGroups
    Export-Csv -InputObject $new -Path c:\test\test.txt -NoTypeInformation -Encoding "utf8"
    Write-Host ""
    Write-Host "Done"
    The resulting text file contains:
    "Count","Length","LongLength","Rank","SyncRoot","IsReadOnly","IsFixedSize","IsSynchronized"
    "45","45","45","1","System.Object[]","False","True","False"
    So I have 2 issues. One is the "export-csv -notype" isn't working quite right, not sure why. And secondly, you can see the System.Object[] entry, which I believe is my array of groups. I need that to display the names of the groups the user belongs
    to.
    Any help is greatly appreciated!

    Hi Robert,
    I’m writing to just check in to see if the suggestions were helpful. If you need further help,
    please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards
    Anna
    TechNet Community Support

  • How to use multiple patterns for masking/format the input text

    Hi All,
    I am using Jdeveloper 11.1.1.5 and i have a requirement where i need to format my input Text value in these below patterns:-
    Format
    Example
    AA9A 9AA
    EC1A 1BB
    A9A 9AA
    W1A 1HQ
    A9 9AA
    M1 1AA
    B33 8TH
    A99 9AA
    AA9 9AA
    CR2 6XH
    DN55 1PT
    AA99 9AA
    For Example :-  If user puts value as EC1A1BB, it should automatically changed to EC1A 1BB
                                 if user puts value as W1A1HQ, it should be automatically changed to W1A 1HQ and so on..
    If it could have been one format , i might have followed this :- https://blogs.oracle.com/jdevotnharvest/entry/get_social_security_numbers_right
    But for multiple patterns i am not able to get through to the proper solution.
    Is there any way to achieve this ? Please suggest.
    Regards,
    Shah

    For the validation you should be able to use one regular expression where you add the logical or (|)  (check the doc http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html) between the groups. If none of the patterns matches you have an error.
    For the for formatting I'm not sure you can use only one expression.
    I suggest to write one method which does the checking on and the formatting may be using an array of patterns to check and iterate the patterns in a loop. Once you found a match you can read the needed format from another array (or an other dimension if you prefer to use a multidimensional array).
    Timo

  • Safely unmounting a Raid 5 array from Mac Pro Nehalem

    Forgive my ignorance but I am very green when it comes to Raid set-ups. I'm a editor and I'm in the process of setting up a RAID 5 as follows:
    Highpoint RocketRaid 4322 Controller card in top PCI slot,
    running mini SAS cable to,
    Proavio 8 drive Enclosure with 8 1TB Samsung drives.
    I've formatted the Raid array and mounted it on my desktop via DISK UTILITY. My question is when I want to turn my Raid drives off what is the procedure?
    Do I unmount the Raid Array via DISK UTILITY or is there a bit more to it than that. I tried finding concise info in the Raid Controller pdf but haven't found any concrete details. I haven't experimented with unmounting it yet because I have media on the Raid drives I don't want to lose.
    I'm sure it's probably a simple procedure but wanted to check with those in the know before doing anything.
    thanks

    Hi and Welcome to the Discussions!
    That's quite a set up. I envy you.
    I'm sorry I don't have an answer to your question, but I bet it's something simple to do also. Only thing I can think of for a fast and direct answer is somewhere buried here. Good Luck.
    http://www.hptmac.com/US/index.htm

  • Remove text field from Array via for loop

    Hi,
    i have a problem to remove text fields added via for loop.
    That im doing is, via for loop im dynamically creating menu with 10 buttons.
    Each button contain, dynamically created, background (shape) and text field.
    And everything is fine.
    But when im try to remove text fields then i got this error:
    - Im using button to remove text fields - lang_btn.addEventListener(MouseEvent.CLICK, clickHandler);
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
              at flash.display::DisplayObjectContainer/removeChild()
              at Loading_Img_fla::MainTimeline/xmlLoaded()
              at flash.events::EventDispatcher/dispatchEventFunction()
              at flash.events::EventDispatcher/dispatchEvent()
              at flash.net::URLLoader/onComplete()
    In the script bellow marked with red is what should remove text fields from an Array, instead giving me error.
    Here is my script
    // Create for loop
    for (var i:int = 0; i < 10; i++)
              for each (xml in listItems)
                        if (i == xml.attribute("Id"))
                                  // Add MovieClip to stage to hold the data
                                  addChild(lmHolder);
                                  lmHolder.x = 0;
                                  lmHolder.y = 0;
                                  // Create new MovieClip to hold buttons
                                  lmButtonsMCArray[i] = new MovieClip();
                                  lmButtonsMCArray[i].buttonMode = true;
                                  lmButtonsMCArray[i].mouseChildren = false;
                                  lmButtonsMCArray[i].x = 20;
                                  lmButtonsMCArray[i].y = 20 + btCount * buttonSpace;
                                  // Add each button MovieClip to lmHolder MovieClip
                                  lmHolder.addChild(lmButtonsMCArray[i]);
                                  // Create Background to buttons
                                  lmButtonsArray[i] = new Shape();
                                  lmButtonsArray[i].graphics.beginFill(lmBgColor0, 1);
                                  lmButtonsArray[i].graphics.drawRect(0, 0, 230, 85);
                                  lmButtonsArray[i].x = 0;
                                  lmButtonsArray[i].y = 0;
                                  // <<-- Add Background shape to the buttons MovieClips
                                  lmButtonsMCArray[i].addChild(lmButtonsArray[i]);
                                  // Create a new array to preserve data from XML List
                                  lmNameArrayEG = new Array();
                                  lmNameArrayUS = new Array();
                                  // Create local variable to hold
                                  var lmTxtFieldContentUS:String;
                                  var lmTxtFieldContentEG:String;
                                  var lmTxtContent:String;
                                  // If clicked button is EG then make array with Arabic text
                                  // If clicked button is US then make array with English text
                                  if (footer.lang_btn.langState == "EG")
                                            for each (var leftMenuName:XML in egLanguageList)
                                                      lmNameArrayEG.push(leftMenuName);
                                            lmTxtFieldContentEG = lmNameArrayEG[i];
                                            lmTxtContent = lmTxtFieldContentEG;
                                  else
                                            for each (var leftMenuNameUS:XML in usLanguageList)
                                                      lmNameArrayUS.push(leftMenuNameUS);
                                            lmTxtFieldContentUS = lmNameArrayUS[i];
                                            lmTxtContent = lmTxtFieldContentUS;
                                  // Setup new text field each time script is executed
                                  lmTxtFieldsArray[i] = new TextField();
                                  lmTxtFieldsArray[i].width = 110;
                                  lmTxtFieldsArray[i].border = false;
                                  lmTxtFieldsArray[i].wordWrap = true;
                                  lmTxtFieldsArray[i].multiline = true;
                                  lmTxtFieldsArray[i].selectable = false;
                                  lmTxtFieldsArray[i].embedFonts = true;
                                  lmTxtFieldsArray[i].antiAliasType = AntiAliasType.ADVANCED;
                                  lmTxtFieldsArray[i].autoSize = TextFieldAutoSize.CENTER;
                                  lmTxtFieldsArray[i].text = lmTxtContent.toUpperCase();
                                  lmTxtFieldsArray[i].x = 10;
                                  lmTxtFieldsArray[i].name = "lmTxtFieldName" + i;
                                  // <<-- Add Text fields to the Movie Clip
                                  lmButtonsMCArray[i].addChild(lmTxtFieldsArray[i]);
                                  // If clicked button is EG then set Arabic text format, and make array with Arabic text fields
                                  // If clicked button is US then set English text format, and make array with Egnlish text fields
                                  if (footer.lang_btn.langState == "EG")
                                            lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_eg);
                                            // Make array from text fields;
                                            pushEgTFintoArray.push(lmTxtFieldsArray[i]);
                                  else
                                            lmTxtFieldsArray[i].setTextFormat(txtFormat_lm_us);
                                            // Make array from text fields;
                                            pushUsTFintoArray.push(lmTxtFieldsArray[i]);
                                  // If clicked button is EG then loop thrue the for loop and remove English text fields from array
                                  // If clicked button is EG then loop thrue the for loop and remove Arabic text fields from array
                                  if (footer.lang_btn.langState == "EG")
                                            for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
                                                      //remove the text field array from the display
                                       removeChild(pushUsTFintoArray[rNr_us]);
                                            //clear the array
                                            pushUsTFintoArray = [];
                                  else
                                            for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
                                                      //remove the text field array from the display
                                       removeChild(pushEgTFintoArray[rNr_eg]);
                                            //clear the array
                                            pushEgTFintoArray = [];
              btCount++;

    it looks like those tf's are children of  lmButtonsMCArray[i], not the current scope.  use:
    if (footer.lang_btn.langState == "EG")
                                            for (var rNr_us:Number = 0; rNr_us < pushUsTFintoArray.length; rNr_us++)
                                                      //remove the text field array from the display
                                        lmButtonsMCArray[rNr_us].removeChild(pushUsTFintoArray[rNr_us]);
                                            //clear the array
                                            pushUsTFintoArray = [];
                                  else
                                            for (var rNr_eg:Number = 0; rNr_eg < pushEgTFintoArray.length; rNr_eg++)
                                                      //remove the text field array from the display
                                        lmButtonsMCArray[rNr_eg].removeChild(pushEgTFintoArray[rNr_eg]);
                                            //clear the array
                                            pushEgTFintoArray = [];

  • Need help optimizing the writing of a very large array and streaming it a file

    Hi,
    I have a very large array that I need to create and later write to a TDMS file. The array has 45 million entries, or 4.5x10^7 data points. These data points are of double format. The array is created by using a square pulse waveform generator and user-defined specifications of the delay, wait time, voltages, etc. 
    I'm not sure how to optimize the code so it doesn't take forever. It currently takes at least 40 minutes, and I'm still running it, to create and write this array. I know there needs to be a better way, as the array is large and consumes a lot of memory but it's not absurdly large. The computer I'm running this on is running Windows Vista 32-bit, and has 4GB RAM and an Intel Core 2 CPU @ 1.8Mhz. 
    I've read the "Managing Large Data Sets in LabVIEW" article (http://zone.ni.com/devzone/cda/tut/p/id/3625), but I'm unsure how to apply the principles here.  I believe the problem lies in making too many copies of the array, as creating and writing 1x10^6 values takes < 10 seconds, but writing 4x10^6 values, which should theoretically take < 40 seconds, takes minutes. 
    Is there a way to work with a reference of an array instead of a copy of an array?
    Attached is my current VI, Generate_Square_Pulse_With_TDMS_Stream.VI and it's two dependencies, although I doubt they are bottlenecking the program. 
    Any advice will be very much appreciated. 
    Thanks
    Attachments:
    Generate_Square_Pulse_With_TDMS_Stream.vi ‏13 KB
    Square_Pulse.vi ‏13 KB
    Write_TDMS_File.vi ‏27 KB

    Thanks Ravens Fan, using replace array subset and initializing the array beforehand sped up the process immensely. I can now generate an array of 45,000,000 doubles in about one second.
    However, when I try to write all of that out to TDMS at the end LV runs out of memory and crashes. Is it possible to write out the data in blocks and make sure memory is freed up before writing out the next block? I can use a simple loop to write out the blocks, but I'm unsure how to verify that memory has been cleared before proceeding.  Furthermore, is there a way to ensure that memory and all resources are freed up at the end of the waveform generation VI? 
    Attached is my new VI, and a refined TDMS write VI (I just disabled the file viewer at the end). Sorry that it's a tad bit messy at the moment, but most of that mess comes from doing some arithmetic to determine which indices to replace array subsets with. I currently have the TDMS write disabled.
    Just to clarify the above, I understand how to write out the data in blocks; my question is: how do I ensure that memory is freed up between subsequent writes, and how do I ensure that memory is freed up after execution of the VI?
    @Jeff: I'm generating the waveform here, not reading it. I guess I'm not generating a "waveform" but rather a set of doubles. However, converting that into an actual waveform can come later. 
    Thanks for the replies!
    Attachments:
    Generate_Square_Pulse_With_TDMS_Stream.vi ‏14 KB
    Write_TDMS_File.vi ‏27 KB

  • Formatting textfile for Combobox.dataProvider

    Can't seem to find any formatting rules for array
    construction through an external file.
    This is what i am trying to do:
    I've loaded vars into the _root this works fine. Splitted its
    value for constructing an array. This seems to work fine aswell.
    If I code the array within the fla in this format:
    my_dP= new Array(
    {label:"choose..."},
    {data:"
    http://www.myserver.com/netlabel/Johannes
    Lauxen.txt",label:"Johanes Lauxen"},
    {data:"
    http://www.myserver.com/netlabel/PQR1.txt",
    label:"PQR1"}
    and use this for the dataProvider for the combobox named
    my_cb like this:
    my_cb.dataProvider = my_dP;
    everything works fine.
    The problem is:
    But if I put this in the same formatting in the textfile for
    the array I create using split like I described above, the values
    for my labels in my_cb are this text, i mean it doesn't
    interpretate the loaded text as script, it just displays the code
    as labels.
    my textfile looks like this :
    &var2={label:"choose..."}#{data:"
    http://www.myserver.com/netla
    bel/Johannes Lauxen.txt",label:"Johanes
    Lauxen"}#{data:"
    http://www.myserver.com/netlabel/PQR1.txt",
    label:"PQR1"}&
    (O, the # is used for delimiter)
    How can i get this to work ? Or is it not the
    textfileformatting that causes the problem ?
    many thanks
    (flash8 b.t.w.)

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="450" height="350">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                [Bindable]
                private var types:Array = ['colors','numbers','shapes'];
                private var dataProviders:Object =
                    colors:['red','blue','green'],
                    numbers:['1','2','3'],
                    shapes:['circle', 'square','triangle']
                private function getItemDataProvider(type:Object):Array
                    return dataProviders[type] as Array;
            ]]>
        </mx:Script>
            <mx:ComboBox id="typeSelector" dataProvider="{types}"/>
            <mx:ComboBox id="itemSelector" dataProvider="{getItemDataProvider(typeSelector.selectedItem)}"/>
    </mx:Application>

  • Spreadsheet to array

    Hi,
    I am trying to read from a spreadsheet.
    PressDir=-1,1,-1,1
    how would I make this work?
    I think my conversion code is wrong. 
    But I have tried everything.
    Message Edited by krispiekream on 04-06-2010 11:13 AM
    Best regards,
    Krispiekream
    Solved!
    Go to Solution.

    TurboPhil wrote:
    Judging from your screencapture, it looks like you want your variable "PressDir" to be represented as an iteger. Therefore, I assume you want to be able to read in a spreadsheet string as a boolean array, and then format the boolean array into an integer. (i.e. the array [1,0,0,1] would translate to the number 1001 in binary, or 9 decimal).
    Many things don't make a lot of sense here. Why would you scan it as a DBL array since there are only integers? The original problem has 1 and -1, not 1,0, and we don't know what other possible value there are, maybe -1, 0, 1? I also would not reverse the array, else you get assignment problems if the length changes.
    Here'as one possible alternative, showing both how to make a -1, 1 array and a bit representation of it.
    Message Edited by altenbach on 04-06-2010 12:28 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    array.PNG ‏9 KB

  • Change the Format of a stream

    Hi!
    I'm transforming the video stream using some home made effects, but I don't like the standard Format that's used: an array of bytes, where each pixel is formed by three bytes, one for each color channel.
    If the byte in Java was unsigned, no problem. But it's not. The code gets pretty ugly because every time we have to chekc if the value in the pixel color channel is negative or notm and then correct it.
    I'd like to get data in the format of int array, where each position of the array is a pixel, and the color channels are stored in some bits of the integer (the convetional Format for everyone, I guess).
    - How can I do that? Did I have to use another Processor only to change the format before the stream gets into the Processor where I place my Filter Effects?
    - What Format class should I use? IndexedColorFormat? Does anyone has an example of how to construct it?
    - Where can I set this information? I was thinking about using the setFormat of the TrackControl. But this only tells the track wich will be the input format, isn't it?
    - I've being thinking, and one solution would be to constrcut an effect that force this change to me. It gets the format X and spit the format Y. Then I could write my filters in the format that I want. But then the rest of the graph upstream will be able to understand the changed format? Or I'll need to reconvert the stream??
    - Can I set the camera source to already produce the stream in the format that I desire?
    - Somebody else is working with effect filters? How do you deal with these inconvinience?
    Please, any answer is welcome!
    RGB

    Found the solution!
    I must set the Formats in the CODEC to get the Format that I want to play with! I was trying to complicate too much!
    The correct format class to is RGBFormat.
    RGB

  • GUI array information cycler help please

    I currently have a program that has 3 classes. Basically one class is the main and has some information hard coded that it submits to one of the other classes. The second class takes that information, formats it and sends it to the third class. The third class creates an array, takes the information from the second class and has a display method that the main can call to display the information.
    The program basically spews out all the information in the array in a specific format. The array elements contain strings, ints and doubles. The third class also calculates some things that are displayed with the display method in main.
    What I need to do is create a third class. This class needs to make a GUI to display the information. I currently have the programs display method display the information in a GUI but I need it to display each element one at a time with a NEXT and PREVIOUS button. The next button needs to go to the next array element and the previous button obviously needs to go back to the array element.
    Here is the code.
    //  Inventory Program
    //  Created June 20, 2007
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Inventory4 {
        public static void main(String[] args) {
            CD cd;
            Inventory inventory = new Inventory();
            cd = new CDWithGenre(16, "Disney Hits", 11, 13.01f, "Soundtrack");
            inventory.add(cd);
            cd = new CDWithGenre(12, "The Clash", 10, 19.99f, "Classic Rock");
            inventory.add(cd);
            cd = new CDWithGenre(45, "Dixie Chiks", 18, 10.87f, "Country");
            inventory.add(cd);
            cd = new CDWithGenre(32, "The Cure", 62, 25.76f, "Alternative");
            inventory.add(cd);
            cd = new CDWithGenre(18, "MS Office", 27, 99.27f, "None");
            inventory.add(cd);
            inventory.display();    
        } //End main method
    } //End Inventory4 class
         /* Defines data from main as CD data and formats it. Calculates value of a title multiplied by its stock.
          Creates compareTo method to be used by Arrays.sort when sorting in alphabetical order. */
    class CD implements Comparable{
        //Declares the variables as protected so only this class and subclasses can act on them
        protected int cdSku;        
        protected String cdName;               
        protected int cdCopies;
        protected double cdPrice;
        protected String genre;
        //Constructor
        CD(int cdSku, String cdName, int cdCopies, double cdPrice, String genre) {
            this.cdSku    = cdSku;
            this.cdName   = cdName;
            this.cdCopies = cdCopies;
            this.cdPrice  = cdPrice;
            this.genre = genre;
        // This method tells the sort method what is to be sorted     
        public int compareTo(Object o)
            return cdName.compareTo(((CD) o).getName());
        // Calculates the total value of the copies of a CD
        public double totalValue() {
            return cdCopies * cdPrice;
        // Tells the caller the title
        public String getName() {
            return cdName;       
        //Displays the information stored by the constructor
        public String toString() {
            return String.format("SKU=%2d   Name=%-20s   Stock=%3d   Price=$%6.2f   Value=$%,8.2f",
                                  cdSku, cdName, cdCopies, cdPrice, totalValue());
    } // end CD class    
         //Class used to add items to the inventory, display output for the inventory and sort the inventory
    class Inventory {
        private CD[] cds;
        private int nCount;
         // Creates array cds[] with 10 element spaces
        Inventory() {
            cds = new CD[10];
            nCount = 0;
         // Used by main to input a CD object into the array cds[]
        public void add(CD cd) {
            cds[nCount] = cd;
            ++nCount;
            sort();               
         //Displays the arrays contents element by element into a GUI pane
           public void display() {
            JTextArea textArea = new JTextArea();
            textArea.append("\nThere are " + nCount + " CD titles in the collection\n\n");
            for (int i = 0; i < nCount; i++)
                textArea.append(cds[i]+"\n");
            textArea.append("\nTotal value of the inventory is "+new java.text.DecimalFormat("$0.00").format(totalValue())+"\n\n");
            JFrame invFrame = new JFrame();
            invFrame.getContentPane().add(new JScrollPane(textArea));
            invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            invFrame.pack();
            invFrame.setLocationRelativeTo(null);
            invFrame.setVisible(true);
         // Steps through the array adding the totalValue for each CD to "total"
        public double totalValue() {
            double total = 0;
            double restock = 0;
            for (int i = 0; i < nCount; i++)
                total += cds.totalValue();                
    return total;
         //Method used to sort the array by the the name of the CD
    private void sort() {
         Arrays.sort(cds, 0, nCount);
    } // end Inventory class
    // Subclass of CD. Creates new output string to be used, adds a restocking fee calculation and genre catagory to be displayed.
    class CDWithGenre extends CD {
         String genre;
         CDWithGenre(int cdSku, String cdName, int cdCopies, double cdPrice, String genre) {
    super(cdSku, cdName, cdCopies, cdPrice, genre);
    this.cdName = cdName;
              this.cdCopies = cdCopies;
    this.cdPrice = cdPrice;
    this.genre = genre;
    // Calculates restocking fee based on previous data.
    public double restockFee() {
         double total = 0;
         double restock = 0;
         total = cdCopies * cdPrice;
         restock = total * .05;
    return restock;
    // New output method overrides superclass's output method with new data and format.
         public String toString() {
              return String.format("SKU: %2d     Genre: %-12s     Name: %-20s     \nPrice: $%6.2f Value: $%,8.2f Stock: %3d      Restocking Fee: $%6.2f\n",
    cdSku, genre , cdName, cdPrice, totalValue(), cdCopies, restockFee());
    }// Ends CDWithGenre class

    Hey Michael,
    I edited the code to add some more features but I am having some errors. Can you help again?
    Here is the code
    The additional buttons are for features I need to add. The commented part that says save need to save to a certain location.
    But the problem I am having is with the previous and next buttons. I need them to loop so when Next reaches the end of the array it needs to go to the first element again and keep on rolling thru. The previous needs to roll back from element 0 to the end again.
    This works when the program is not stopped on the last or first element. If I press the last button then press next, it errors. If I press the first button and press previous, it errors.
    I also need to add an icon
    Let me know what you think. Thanks a bunch
    class InventoryGUI
      Inventory inventory;
      int displayElement = 0;
      public InventoryGUI(Inventory inv)
        inventory = inv;
      public void buildGUI()
        final JTextArea textArea = new JTextArea(inventory.display(displayElement));
        final JButton prevBtn = new JButton("Previous"); 
        final JButton nextBtn = new JButton("Next");   
        final JButton lastBtn = new JButton("Last");
        final JButton firstBtn = new JButton("First");
        final JButton addBtn = new JButton("Add"); 
        final JButton modifyBtn = new JButton("Modify");   
        final JButton searchBtn = new JButton("Search");
        final JButton deleteBtn = new JButton("Delete");
        final JButton saveBtn = new JButton("Save");
        ImageIcon icon = new ImageIcon("images/icon.jpg");  
        JLabel label1 = new JLabel(icon);
        JPanel panel = new JPanel(new GridLayout(2,4));
        panel.add(firstBtn); panel.add(nextBtn); panel.add(prevBtn); panel.add(lastBtn);
        panel.add(addBtn); panel.add(modifyBtn); panel.add(searchBtn); panel.add(deleteBtn);
        //panel.add(saveBtn);
        JFrame invFrame = new JFrame();   
        invFrame.getContentPane().add(new JScrollPane(textArea),BorderLayout.CENTER);
        invFrame.getContentPane().add(panel,BorderLayout.SOUTH);
        invFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        invFrame.pack();
        invFrame.setSize(500,200);
        invFrame.setTitle("Inventory Manager");
        invFrame.setLocationRelativeTo(null);
        invFrame.setVisible(true);
        prevBtn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            nextBtn.setEnabled(true);
            displayElement--;
            textArea.setText(inventory.display(displayElement));
            if(displayElement <= 0) displayElement = 5;
        nextBtn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            prevBtn.setEnabled(true);
            displayElement++;
            textArea.setText(inventory.display(displayElement));
            if(displayElement >= inventory.nCount-1) displayElement = -1;
        firstBtn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            firstBtn.setEnabled(true);
            displayElement = 0;
            textArea.setText(inventory.display(displayElement));
        lastBtn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            lastBtn.setEnabled(true);
            displayElement = inventory.nCount-1;
            textArea.setText(inventory.display(displayElement));
    }

Maybe you are looking for

  • Saving a slide show when catalog runs from flash drive

    A little background - I manage two separate classes of students who use the same laptop with PSE8.  Each student has their own flash drive to save a custom catalog for the PSE8. Each time students open PSE8 they load their custom catalog.  All image

  • MRP - MD04 table details

    Hi, We are in the process of configuring MRP system .  While doing so, the users are asking for a customised reqport which can throw the details of Planned order, customer order, qty required , No. of Purchase req. raised and PO raised and the status

  • Adding image in the header?

    hi I would like to know how I could add an image in the report on the left hand side of the header section. And do I need to include the image in the path or where? Please help me out Thanks

  • Can I use the iPhone as external microphone for my iMac?

    My imac doesn't have a mic in, only a line in. Is it possible to use the iPhone as external mircrophone with some extra software maybe? I want to create video tutorials and the internal microphone isn't good enough for this.

  • WebDav Saving

    When saving to a WebDav server, I'm getting "The document could not be saved. This file is already open." Its done a "GET" but on the save it's doing a "GET" again instead of a "PUT".