Random from multiple arrays

I'm trying to generate a random picture half the time from
one array and half the time from another array.
I've get as far as this and it doesn't work. Any help would
be useful
var ranArrays: Array = new Array ("bluePixs", "redPixs");
var bluePixs:Array = new Array ("bluePix1.swf",
"bluePix2.swf", "bluePix3.swf");
var redPixs:Array = new Array ("redPix1.swf", "redPix2.swf",
"redPix3.swf");
function randomBackground(){
var randomArray = random (ranArrays.length);
var randomNumber = random (randomArray.length);
_root.pix.loadMovie (randomArray[randomNumber]);
randomBackground();

Hi,
Your SQL would be something like:
SELECT M.MONEY, DRINKS.NAME, DRINKS.PRICE, F1.PRODUCT, F1.PRICE, F2.PRODUCT, F2.PRICE, DESERT.PRODUCT, DESERT.PRICE
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEYThat may return multiple results - as there may be a number of combinations less than your MONEY value. You can restrict this to return just one:
SELECT M.MONEY, DRINKS.NAME, DRINKS.PRICE, F1.PRODUCT, F1.PRICE, F2.PRODUCT, F2.PRICE, DESERT.PRODUCT, DESERT.PRICE
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEY
AND ROWNUM = 1As you then only want to return a single string for display to the user, you will have to concatenate the items found into a single string:
SELECT DRINKS.NAME || ' ' || DRINKS.PRICE || ' ' || F1.PRODUCT || ' ' || F1.PRICE || ' ' || F2.PRODUCT || ' ' || F2.PRICE || ' ' || DESERT.PRODUCT || ' ' || DESERT.PRICE X
FROM MONEY M
CROSS JOIN DRINKS
CROSS JOIN F1
CROSS JOIN F2
CROSS JOIN DESERT
WHERE DRINKS.PRICE + F1.PRICE + F2.PRICE + DESERT.PRICE <= M.MONEY
AND ROWNUM = 1Obviously, you would want to replace the spaces (' ') with something more meaningful to the user
Andy

Similar Messages

  • Is there a way to import text into an inDesign layout randomly from multiple word docs?

    i'd like to start out by thanking everyone for the help with the text box or stroke around text/paragraph, the advise has definitely helped.. What i'm wondering now is, is there a way to take multiple docs "wether it be a word doc or an indesign doc" and have them import or insert into our main layout in inDesign randomly or by taking one paragraph from each individual doc 1 after the other till each paragraph is inserted..
    To give you an idea:
    say i hav 4 text docs each doc is a category so to say, each with anywhere from 25 to 100 paragraphs.. each paragraph is it's own item or description.. each of these descriptions or items so to say needs to be in our layout each week, but randomly.. Currently we are using the cut and paste method to achieve the randomness in our layout.. I'm hoping theres an easier way..
    -if this is something inDesign can't do, might there be an alternative.. say an external app. that might achieve this for us?

    well.. we've come up with some sort of solution that seams to work well for what we want.. we combined each doc into an excel doc with each paragraph on it's own line.. then added extra columns in excel to input random numbers and letters -that can be changed weekly, so we can use the sort feature in excel to reorder all the paragraphs.. next we copy and paste from excel to inDesign, because importing an excel doc seams to be more agravation than it's worth..
    -this seems like it will work well for what we need to do, though curiouse if anyone else might have an alternative solution?
    as always thxs..

  • Reading information from multiple arrays efficiently

    So I'm trying to make a flash application about number of felonies of different trafic violations from different years, example:
    In 2002 there was 9631 drunk drivers, 13481 driving without a license, 9863 speeders and 18862 who broke other laws
    In 2003 there was 8593 drunk drivers, 12785 driving without a license, 12217 speeders and 19196 who broke other laws
    The list goes on and I've made 5 different arrays, one for year, one for drunk drivers, one for driving without a license,
    I call them:
    var arTab:Array = new Array();
    arTab[0] = new Array(2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012);
    var promilleTab:Array = new Array();
    promilleTab[0] = new Array(9631, 8593, 8363, 8128, 8514, 8534, 8560, 8146, 8241, 8019, 8759);
    var forerkortTab:Array = new Array();
    forerkortTab[0] = new Array(13481, 12785, 12585, 12492, 13470, 14181, 14622, 14082, 14287, 13640, 14180);
    var hastighetTab:Array = new Array();
    hastighetTab[0] = new Array(9863, 12217, 14920, 14929, 15425, 18010, 15909, 14197, 13276, 11158, 12264);
    var trafikklovenTab:Array = new Array();
    trafikklovenTab[0] = new Array(18862, 19196, 20101, 20026, 21381, 21845, 20005, 19446, 20900, 19346, 20265);
    After that I added 2 comboboxes, one for the year and one to pick felony, but when I try to write out the information in a text box I have to add ALOT of code, example:
    function skrivUt(Event:MouseEvent)
           var arListe:int = arKombo.selectedItem.data;
           var bruddListe:int = bruddKombo.selectedItem.data;
           if(bruddListe == 1)
                if(arListe == 1)
                txtSvar.text = "I " + arTab[0][0] + " ble det anmeldt " + promilleTab[0][0] + " for promillekjøring";
                if(arListe == 2)
                txtSvar.text = "I " + arTab[0][1] + " ble det anmeldt " + promilleTab[0][1] + " for promillekjøring";
                if(arListe == 3)
                txtSvar.text = "I " + arTab[0][2] + " ble det anmeldt " + promilleTab[0][2] + " for promillekjøring";
    And I would have to make tons of almost the same line which works, but my question is:
    Is there any way I can write this in a more efficient way?

    You could look for a pattern that follows your current code.  For what you show already I see...
    function skrivUt(Event:MouseEvent)
           var arListe:int = arKombo.selectedItem.data;
           var bruddListe:int = bruddKombo.selectedItem.data;
           if(bruddListe == 1)
                txtSvar.text = "I " + arTab[0][arListe-1] + " ble det anmeldt " + promilleTab[0][arListe-1] + " for promillekjøring";

  • Obtain Array from an XML file with Multiple Arrays

    Hi,
    So I have been struggling with this program I am making for the last few months but I am almost there. I have a program that creates multiple arrays and place them one after another in an xml file and each array has its own unique name. Now I would like to create a VI that takes this XML file and when the user inputs the specific array name they are looking for it goes into the xml file finds the entire array under that name and displays it in an output indictor to be viewed on the VI. Attached is a sample of my xml file and the VI that creates this xml file.
    Thanks,
    dlovell
    Solved!
    Go to Solution.
    Attachments:
    I_Win.zip ‏20 KB

    Here is a slightly different version. The one above reads from a file. This is how you would read from an already loaded XML string.
    =====================
    LabVIEW 2012
    Attachments:
    Find Array.vi ‏18 KB

  • How to delete a random set of indizes from an array as fast as possible?

    Hello,
    My question sounds a bit like this thread but it isn't...    :-(
    http://forums.ni.com/ni/board/message?board.id=170​&message.id=129888&query.id=10689#M129888
    When sampling position/force/resistance data I use a time triggered sampling approach. For later analysis I need (among others) force (Y) over position (x).
    To get this I calculate the mean force from all time points with equal positions (as time is my common index). That works quite well but with arrays over 300000 points it becomes a bit too slow...
    These are my steps so far:
    1. Sort the position array
    2. Eliminate duplicates from the position array (no array reshape in loop)
    3. With the data from 2. get all indices where my original position array has a given value
    4. With the indices from 3. get the corresponding force values from the force raw data and calculate the mean
    In step 3 I need to search the whole raw position array as many times as there are different position values in itself.
    If I could delete all indizes I already found from the array to search that should (in theory) significantly improve performance. On the other hand such an operation would mean a lot of array reshape operations.
    What is the best approach to delete the found indizes?
    OR
    Is there no benefit in deleting the indizes as the array operations to do this need more time than they save?
    Thanks!
    Sören

    Now I'm getting a bit more confused about the app.  If you need a sampling rate higher than the encoder can provide, then then only way I can think of to accumulate multiple readings at the same position is if you have some type of bi-directional cyclical motion.  But if you originally used the encoder as a sampling clock, that seems to imply a unidirectional motion.  Is the motion cyclical or unidirectional?
    Knowing that I need to do some similar processing down the road, I did a bit of tinkering today.  The method I described earlier took ~350 msec to process (sort and then calculate averages force per unique position) on 350,000 data points.  A little more tinkering gave me a method that took <100 msec.  The machine was a pretty new test PC with a 2.8 GHz Pentium.  Here's an outline and perhaps I'll be able to scrub the code a bit to post soon.  Hopefully someone will have some even better ideas!
    The basic idea is essentially a histogram where each possible integer position value maps to a histogram bin.
    1. Based on knowledge of your test equipment, you can know the # of unique positions that can possibly be recorded.  Pre-initialize 2 arrays of this size before starting the main data acquisition.  Both should be full of floating-point 0's.  These will hold (a) count of entries and (b) sum of forces.  Call them the binning arrays.  My test used a size of 8000 possible positions.
    2. An auto-indexing For loop goes through the 350,000 integer positions and floating point forces.  The binning arrays enter this loop through shift registers.
    3. For each pair, use the integer position to map yourself to the appropriate index of the binning arrays.  Increment that element of the count array and add this iteration's force value to the sum array.
    4. After loop completes, divide sum array by count array.  These are your average forces.  (This is why the count is computed as a floating point value.  It was very costly to allow a type coercion from an integer count array into the division function.)  Note that unsampled positions should have 0 counts and produce a NaN result from the division.
    There are also ways to calculate a running average in the loop, but I haven't checked (yet) to see if it's faster.  The median you mentioned would need some extra post-loop steps.
    I'm sure that if this were a coding challenge, someone would cut the processing time at least in half...  Anyone out there?
    -Kevin P.

  • Display one div at a time from an array?

    I am trying to make a multiple choice quiz. I have each question and answer in a div. There are 20 divs. All are set to not display on the stage, and I want to call one randomly to display as the user answers that question.
    For the moment, I am trying to get even one question to display on the stage. Here is my code, which is at the top in the edgeActions.js file inside the first function.
    //Edge code
    (function($, Edge, compId){
    var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes
    //my code
    var divs = new Array( 'div.ques1', 'div.ques2', 'div.ques3', 'div.ques4', 'div.ques5', 'div.ques6', 'div.ques7', 'div.ques8', 'div.ques9', 'div.ques10', 'div.ques11', 'div.ques12', 'div.ques13', 'div.ques14', 'div.ques15', 'div.ques16', 'div.ques17', 'div.ques18', 'div.ques19', 'div.ques20' ), idx;
    var idx = Math.floor(Math.random()*divs.length);
    function getQuestion() {
    //the following commands do not work
                        $('idx').show();
                        $('idx').css('display','inline');
                        $('divs[idx]').appendTo(document.body);
                        $('sym.que2').show();
      $('que2').show();
                        $('div.ques1').show();
                        $('ques2').show();
    //these do work
                        alert("blah");
                        console.log('this is working');
                        console.log('id=%d', idx);
              getQuestion();
    Since the console is returning the random number from the array, I have a feeling Edge cannot distinguish the array number from the corresponding div. Converting them to symbols does nothing. I am starting to think it would have been easier to just hand code this rather than using Edge.

    Hi Elaine,
    Thank you for your response!
    Your new randomize line worked beautifully
    I have tried defining my array elements in every connotation I can think of, inlcuding changing them to symbols. I did figure out today that an element has to be displayed before it will even be hit by jQuery, [.show() will not work] and if autoplay is checked while they are off, they will show, and vice versa. Confusing, but it narrowed it down enough for me to see I really just needed to figure out how to call the elements, then figure out all the on/off/autoplay stuff from there.
    Here is my new code in its new location, the compositionReady panel:
    var divs = new Array( 'Symbol_1', 'Symbol_2', 'Symbol_3', 'Symbol_4', 'Symbol_5', 'Symbol_6', 'Symbol_7', 'Symbol_8', 'Symbol_9', 'Symbol_10', 'Symbol_11', 'Symbol_12', 'Symbol_13', 'Symbol_14', 'Symbol_15',
    'Symbol_16', 'Symbol_17', 'Symbol_18', 'Symbol_19', 'Symbol_20' );   // display is on for all symbols
    sym.setVariable("myArr", divs);
    var random = Math.floor(Math.random() * 100) % 20;
    console.log( divs );   //works
    console.log( "myArr" );   //works
    console.log( random );    //works
    function getQuestion() {
             sym.$("myArr").hide();  // doesn't work
             sym.$("myArr").hide();  //doesn't work
                        console.log('this is working');  //works
                        console.log('id=%d', random);   //works
    getQuestion();
    All of the questions are showing at once and I want to be able to hide all of them.
    Array[20] 
    0: "Symbol_1"
    1: "Symbol_2"
    2: "Symbol_3"
    3: "Symbol_4"
    4: "Symbol_5"
    5: "Symbol_6"
    6: "Symbol_7"
    7: "Symbol_8"
    8: "Symbol_9"
    9: "Symbol_10"
    10: "Symbol_11"
    11: "Symbol_12"
    12: "Symbol_13"
    13: "Symbol_14"
    14: "Symbol_15"
    15: "Symbol_16"
    16: "Symbol_17"
    17: "Symbol_18"
    18: "Symbol_19"
    19: "Symbol_20"
    length: 20
    myArr
    17
    this is working
    17

  • Loading external .swf from an array in  array order

    I was wondering if someone can help me out.  The code below demonstrates pulling in multiple .swf from an array and plays each one randomally when the "main .swf re-publishes each time.  I cant figure out how to play each .swf in the order that specifies in the array.
    example:  I want the main .swf to play 'clip0','clip1','clip2' in that specific order not random.
    Can someone assist me.
    stop();
    var movieArray:Array = ['clip0','clip1','clip2'];
    var loader:Loader = new Loader();
    var index:int = movieArray.length * Math.random();
    var url:String = movieArray[index] + '.swf';
    trace("Attempting to load", url);
    loader.load(new URLRequest(url));
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOError);
    addChild(loader);
    function loaderComplete(e:Event):void {
        trace("Successfully loaded", url);
    function loaderIOError(e:IOErrorEvent):void {
        trace("Failed to load", url);

    so replace:
    var index:int = movieArray.length * Math.random();
    with this:
    var index:int = 0;

  • Data acquisition from multiple channels.

    Hello
    Right now, I am able to acquire the signal from a single load cell and display it.But I would like to know of how to acquire  acquire signals from two load cells simultaneously.I am using Labview 6i and I am using AI S-Scan with AI config to acquire the waveform.It would be of great help if you could suggest a simple method to acquire the signals.
    PS: Please find the attached file used for acquisition from a single load cell.
    Looking forward for your reply.
    Manasa
    Attachments:
    test 4.vi ‏102 KB

    Hi Manasa,
    If I understand what you are trying to do, it is relatively
    straightforward to configure your application to acquire data on two channels.
    I was unable to run your vi as it was missing some of the subVI’s
    from your application.  However, your
    attachment was sufficient to see what you are trying to do. 
    Here is how to add channels:
    1.      
    In the I/O Channel Constant, you can add
    additional channels by using a comma or a semi-colon.  For example, to scan the first four channels
    you would put 0:3 in the constant (see attached screenshot ChannelConfig.jpg).  To scan the first and third channel you would
    put 0,2.
    2.      
    The AI Single Scan VI will now read from
    multiple channels.  Often it easiest to
    configure the output of this VI for viewing by first putting the data into an
    array using the Build Array VI.  It can
    then be plotted in a waveform graph. (see attached screenshot ReadtoGraph.jpg
    and WaveFormGraph.jpg)
    Just a few notes about “simultaneous” sampling:
    Most of the NI data acquisition cards have a multiplexer
    between the various input channels and the Analog to Digital (A/D) converter
    creating a very small delay between each channel (usually ms range or
    smaller).  NI does make several data acquisition
    cards that can perform true simultaneous sampling, meaning that there is an A/D
    converter for each channel.
    For the large majority of applications, the small delay
    between channels is negligible.
    Jared T.
    Attachments:
    ReadtoGraph.JPG ‏21 KB
    ChannelConfig.JPG ‏288 KB
    WaveFromChart.JPG ‏61 KB

  • Accessing the same object from multiple classes.

    For the life of me I can't workout how I can access things from classes that haven't created them.
    I don't want to have to use "new" multiple times in seperate classes as that would erase manipulated values.
    I want to be able to access and manipulate an array of objects from multiple classes without resetting the array object values. How do I create a new object then be able to use it from all classes rather than re-creating it?
    Also I need my GUI to recognize the changes my buttons are making to data and reload itself so they show up.
    All help is good help!
    regards,
    Luke Grainger

    As long as you have a headquarters it shouldn't be to painfull. You simply keep a refrence to your ShipDataBase and Arsenal and all your irrellevant stuff in Headquarters. So the start of your Headquarters class would look something like:
    public class Headquarters{
      public Arsenal arsenal;
      public ShipDatabase db;
    //constructor
      public Headquarters(){
        arsenal = new Arsenal(this, ....);
        db = new ShipDatabase(...);
    //The Arsenal class:
    public class Arsenal{
      public Headquarter hq;
      public Arsenal(Headquarter hq, ....){
        this.hq = hq;
        .Then in your ShipDatabase you should, as good programing goes, keep the arraylist as a private class variable, and then make simple public methods to access it. Methods like getShipList(), addToShipList(Ship ship)....
    So when you want to add a ship from arsenal you write:
    hq.db.addToShipList(ship);
    .Or you could of course use a more direct refrence:
    ShipDatabase db = hq.db;
    or even
    ShipList = hq.db.getShipList();
    but this requires that the shiplist in the DB is kept public....
    Hope it was comprehensive enough, and that I answered what you where wondering.
    Sjur
    PS: Initialise the array is what you do right here:
    //constructor
    shipList = new Ship[6];
    shipList[0] = new Ship("Sentry", 15, 10, "Scout");
    " " " "etc
    shipList[5] = new Ship("Sentry", 15, 10, "Scout");PPS: To make code snippets etc. more readable please read this article:
    http://forum.java.sun.com/faq.jsp#messageformat

  • Looking for a better way to determine string variable from multiple options

    Hi,
    I trying to figure out a better way to determine a string variable from multiple options.
    Say i have five pictures each with a different filename: img1 - img5...these file names could be named anything really but for this example i will keep them as img1, img2, img3, img4 and img5.
    I want to display a messagebox with the string depending on what a certain variable is.
    So for example, we have the number X, if X = 1 then i want the messagebox to show "img1" as the message
    Essentially the way I have been doing it so far is:
    Private Sub WhichImage()
    Dim ImageName As String = ""
    Dim i as integer
    If i = 0 Then
    ImageName = "img1"
    End If
    If i = 1 Then
    ImageName = "img2"
    End If
    If i = 2 Then
    ImageName = "img3"
    End If
    If i = 3 Then
    ImageName = "img4"
    End If
    If i = 4 Then
    ImageName = "img5"
    End If
    MessageBox.show(imagename, "Name of image", MsgBox.Style.OkOnly, MsgBoxResult.Ok)
    end
    Up until now, this has been fine, but what if I have 50 images, do I have to do this for all 50 images? or is there an easier way like putting the image names into a text file and have it read from the file depending on what the variable i equals? If so,
    how do I go about this? Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Please note that i know that i have declared "i" above in my code and not intialised it with anything, in reality "i" comes from somewhere else in the program so please ignore that part, it is not what I am concerned with.
    Thanks
    Mersec

    Does each image name go on a separate line? can it just be separated by a comma instead? or is there a better way?
    Arrays are useful for this.
    Dim imagenames() As String = {"img1", "img2", "img3", "img4", "img5"}
    Dim imagename As String = imagenames(i)
    MessageBox.Show(imagename, "Name of image")
    Any sort of collection will do instead of an array, and may be simpler to manage. There are many other options - the most suitable one probably depends on where the names originally come from.  For instance, if you are getting them from a folder
    using the FileSystem.GetFiles method, then they are already in a collection.
    If the files names never change then you may as well include them in the program code, using something like the code above.  If they can change, then you could use a text file, but that means you need a file update routine.  If that is required
    then the way you store the names will dictate how you access them.

  • Folder Comparison from multiple servers

    I need to compare folders from multiple servers which do not have direct connection so i was trying to generate a text file with command dir /b /s >c:\server1.txt and feed them to script to compare. 
    my desired output is csv file in the following format
    File name,Server1,server2,server3,is it missng file?
    File1,yes,yes,yes,No
    file2,Yes,Yes,No,Yes
    File3,Yes,No,Yes,Yes
    File4,No,Yes,Yes,Yes
    these folders contains few hundred thousand files and the script is taking 4 to 5 hours to run the comparison. i thought threads will help to run fast using parallel processng but did not help. i have no expreience with threads and after searching for examples
    and implementing it was even slower than normal. 
    i probably am doing something wrong. Any help is much appreciated. 
    The following is the script so far and it works fine but its taking long time.
    [array]$contentArray = @()
    [array]$allfileslist = @()
    [array]$uniquefileslist = @()
    [array]$allfilesSRVlist = @()
    [array]$srvlist = @()
    $FolderName = Split-Path -parent $MyInvocation.MyCommand.Definition
    $reportName = $FolderName + "\ComparisonReport3.csv"
    $ListOfFiles = get-childitem $FolderName
    $List = $ListOfFiles | where {$_.extension -ieq ".txt"}
    $list.count
    $index = 0
    foreach($listitem in $List){
    $listfilename = $listitem.FullName
    $listname = $listitem.Name
    $listname = $listname.replace(".txt","")
    $srvlist = $srvlist + $listname
    write-host $listfilename
    #$StrContent = get-content $listfilename
    $StrContent = [io.file]::ReadAllLines($listfilename)
    $contentArray += ,@($StrContent)
    $StrContent.count
    $contentArray[$index].count
    $index = $index + 1
    for($i = 0;$i -lt $index;$i++){
    $allfileslist = $allfileslist + $contentArray[$i]
    $allfileslist.count
    $uniquefileslist = $allfileslist | sort-object | get-unique
    $Stroutline = "File Name,"
    foreach($srvlistitem in $srvlist){
    $Stroutline = $Stroutline + $srvlistitem.ToUpper() + ","
    $Stroutline = $Stroutline + "Is it Missing file?"
    Write-Output $Stroutline | Out-File "$reportName" -Force
    foreach($uniquefileslistitem in $uniquefileslist){
    $Stroutline = ""
    $missingfile = "No"
    $Stroutline = $uniquefileslistitem + ","
    for($i=0;$i -lt $index;$i++){
    if($contentArray[$i] -contains $uniquefileslistitem){
    $Stroutline = $Stroutline + "Yes,"
    else{
    $Stroutline = $Stroutline + "No,"
    $missingfile = "Yes"
    $Stroutline = $Stroutline + $missingfile
    Write-Output $Stroutline | Out-File "$reportName" -Force -Append
    $j++
    Following is the script i modified using threads example. this is running even slower.
    [array]$contentArray = @()
    [array]$allfileslist = @()
    [array]$uniquefileslist = @()
    [array]$allfilesSRVlist = @()
    [array]$srvlist = @()
    $FolderName = Split-Path -parent $MyInvocation.MyCommand.Definition
    $reportName = $FolderName + "\ComparisonReport3.csv"
    $ListOfFiles = get-childitem $FolderName
    $List = $ListOfFiles | where {$_.extension -ieq ".txt"}
    $list.count
    $index = 0
    #$contentArray = New-Object 'object[,]' $xDim, $yDim
    foreach($listitem in $List){
    $listfilename = $listitem.FullName
    $listname = $listitem.Name
    $listname = $listname.replace(".txt","")
    $srvlist = $srvlist + $listname
    write-host $listfilename
    #$StrContent = get-content $listfilename
    $StrContent = [io.file]::ReadAllLines($listfilename)
    $contentArray += ,@($StrContent)
    $StrContent.count
    $contentArray[$index].count
    $index = $index + 1
    for($i = 0;$i -lt $index;$i++){
    $allfileslist = $allfileslist+ $contentArray[$i]
    $allfileslist.count
    #$uniquefileslist = $allfileslist | select –unique
    get-date
    $uniquefileslist = $allfileslist | sort-object | get-unique
    $uniquefileslist.count
    get-date
    $Stroutline = "File Name,"
    foreach($srvlistitem in $srvlist){
    $Stroutline = $Stroutline + $srvlistitem.ToUpper() + ","
    $Stroutline = $Stroutline + "Is it Missing file?"
    Write-Output $Stroutline | Out-File "$reportName" -Force
    $j = 1
    $count = $uniquefileslist.count
    $stroutput = ""
    $maxConcurrent = 50
    $results= ""
    $PauseTime = 1
    $uniquefileslist | %{
    while ((Get-Job -State Running).Count -ge $maxConcurrent) {Start-Sleep -seconds $PauseTime}
    $job = start-job -argumentList $_,$contentArray,$index -scriptblock {
    $StrArgFileName = $args[0]
    $ArgContentArray = $args[1]
    $ArgIndex = $args[2]
    $Stroutline = ""
    $missingfile = "No"
    $Stroutline = $StrArgFileName + ","
    for($i=0;$i -lt $ArgIndex;$i++){
    if($ArgContentArray[$i] -contains $StrArgFileName){
    $Stroutline = $Stroutline + "Yes,"
    else{
    $Stroutline = $Stroutline + "No,"
    $missingfile = "Yes"
    $Stroutline = $Stroutline + $missingfile
    $Stroutline
    While (Get-Job -State "Running")
    Start-Sleep 1
    $results = Get-Job | Receive-Job
    $results
    $stroutput = $stroutput + "`n" + $results
    Remove-Job *
    Write-Output $stroutput | Out-File "$reportName" -Force -Append
    Thank you very much!
    Vamsi.

    no i am not comparing the number of lines.. count i used was only for my information... it has nothing to do with the compare. here is the script with out count... 
    [array]$contentArray = @()
    [array]$allfileslist = @()
    [array]$uniquefileslist = @()
    [array]$allfilesSRVlist = @()
    [array]$srvlist = @()
    $FolderName = Split-Path -parent $MyInvocation.MyCommand.Definition
    $reportName = $FolderName + "\ComparisonReport3.csv"
    $ListOfFiles = get-childitem $FolderName
    $List = $ListOfFiles | where {$_.extension -ieq ".txt"}
    $index = 0
    foreach($listitem in $List){
    $listfilename = $listitem.FullName
    $listname = $listitem.Name
    $listname = $listname.replace(".txt","")
    $srvlist = $srvlist + $listname
    $StrContent = [io.file]::ReadAllLines($listfilename)
    $contentArray += ,@($StrContent)
    $index = $index + 1
    for($i = 0;$i -lt $index;$i++){
    $allfileslist = $allfileslist+ $contentArray[$i]
    $uniquefileslist = $allfileslist | sort-object | get-unique
    $strfinal = "File Name,"
    foreach($srvlistitem in $srvlist){
    $strfinal = $strfinal + $srvlistitem.ToUpper() + ","
    $strfinal = $strfinal + "Is it Missing file?"
    foreach($uniquefileslistitem in $uniquefileslist){
    $missingfile = "No"
    $Stroutline = $uniquefileslistitem + ","
    for($i=0;$i -lt $index;$i++){
    if($contentArray[$i] -contains $uniquefileslistitem){
    $Stroutline = $Stroutline + "Yes,"
    else{
    $Stroutline = $Stroutline + "No,"
    $missingfile = "Yes"
    $Stroutline = $Stroutline + $missingfile
    $strfinal = $strfinal + "`n" + $Stroutline
    Write-Output $strfinal | Out-File "$reportName" -Force -Append
    if you want to test it... just create two text files and put them in the same folder as the script. 
    server1.txt will have the following content
    filename1
    filename2
    filename3
    server2.txt will have the following content
    filename1
    filename2
    filename4
    it should generate the csv file ComparisonReport3.csv
    filename,server1,server2,Is it Missing file?
    filename1,yes,yes,no
    filename2,yes,yes,no
    filename3,yes,no,yes
    filename4,no,yes,yes

  • Playing random sound in array

    Hey guys,
    I'm new to AS3, still learning. I just read a little about arrays in the book I was learning from, and after looking at some online stuff, thought I'd try to do something simple with one.
    What I'm trying to do is save a bunch of sounds (different dog barks) in an array and then when I press the button, it plays a random sound from that array. Here's what I have so far :
    package
              import flash.media.Sound;
              import flash.media.SoundChannel;
              import flash.events.MouseEvent;
              import flash.display.MovieClip;
              public class Sound2 extends MovieClip
                        var bark1:Bark1;
                        var bark2:Bark2;
                        var bark3:Bark3;
                        var bark4:Bark4;
                        var bark5:Bark5;
                        var bark6:Bark6;
                        var soundChannel:SoundChannel;
                        var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                        public function Sound2()
                                  barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                                  bark1 = new Bark1();
                                  bark2 = new Bark2();
                                  bark3 = new Bark3();
                                  bark4 = new Bark4();
                                  bark5 = new Bark5();
                                  bark6 = new Bark6();
                                  soundChannel = new SoundChannel();
                                  function onBarkButtonClick(event:MouseEvent):void
                                            var barkNo = Math.round(Math.random() * 5);
                                            soundChannel = (barkArray[barkNo]).play();
    When I try to press the button, I get this error message :
    TypeError: Error #1006: play is not a function.
              at MethodInfo-22()
    I used trace and saw the numbers from barkNo were fine, I think it's just something about the array. I've also spent a few hours trying to do it different ways, but still nothing. How can I play a random sound from an array? And am I storing the information correctly? I'm not sure what I'm missing, any help would be great.
    Thanks

    First, never use nested and anonymous functions - you position yourself for a lot of trouble.
    Try this (I did not test it though):
    package
              import flash.media.Sound;
              import flash.media.SoundChannel;
              import flash.events.MouseEvent;
              import flash.display.MovieClip;
              public class Sound2 extends MovieClip
                        var sound:Sound;
                        var soundChannel:SoundChannel = new SoundChannel();
                        var barkArray:Array = [Bark1, Bark2, Bark3, Bark4, Bark5, Bark6];
                        public function Sound2()
                                  barkButton.addEventListener(MouseEvent.CLICK, onBarkButtonClick);
                        private function onBarkButtonClick(event:MouseEvent):void
                                  soundChannel.stop();
                                  sound = new barkArray[int(barkArray.length * Math.random())]();
                                  soundChannel = sound.play();

  • Random numbers in arrays

    i have been faced with a new problem, i have to generate a random number (between 0-63) of random numbers (between 0-63).
    Can i do this all in one array to randomly generate an array containing the random number of elementnts and set each of the elemnt to a random value.
    Random x = new Random();
    int j= x.nextInt(63);
    String [j] numbers;
    Random q = new Random();
    for(j=0, j<=numbers.length, j++)
       int f= q.nextInt(63);
      numbers[j] =f;
    } I had an idea of doing something like the code above can any see a better way to do it.

    I am getting this error
    java.lang.ArrayIndexOutOfBoundsException: 15
    from
    numbers[z] = rng.nextInt(63);i think this is because i am randomly calling the method, so it runs through it once but the second time it flags up the error.
    void Randm()
                         Random rng = new java.security.SecureRandom();
                    int o = rng.nextInt(63);//I hope you know this is zero to 63 exclusive, i.e., it can't return 63
                    int [] numbers = new int[o];
                    for(int z = 0 ; z <= numbers.length ; z++)
                        numbers[z] = rng.nextInt(63);// again, this will not return 63
                        System.out.println("ran gen "+numbers[z]);
    }I think it may be the way i am declaring the array, can anyone shed some light on the situation.

  • Sample PHP Service selecting from multiple tables

    Hi all!
    I have the following challange:
    How do I properly set up my PHP-service to insert, select, update and delete values from multiple tables?
    So far, the standard templates generated by Flash Builder is based on a single table.
    Example: I have 2 tables: [person] and [school]
    [person] has [person_id, first_name, last_name, birthdate]
    [school] has [school_id, person_id, school_name, city]
    One [person] can have multiple [schools]
    How should I define the selectByID function in PHP to be able to have
    First name: [TextInput /]
    Last name: [TextInput /]
    Birthdate: [DateField /]
    Schools:
    [TabBar: School1, School2, School3 /]
    [ViewStack1]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack1]]
    [ViewStack2]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack2]]
    [ViewStack3]
    School name: [TextInput /]
    Location name: [TextInput /]
    [/ViewStack3]]
    And even more interesting: How do I update all these fields back to the database?

    First, the relationship between school and person is many-to-many NOT one-to-many -- you will need to add a junction table.
    From the form you have given I would handle insertions like this:
    loop through all the schools and see if the school already exist in the DB. If so, then store the school_id. If not, then create a new record and store the id. You should have an array collection of store_ids by the end of the loop
    Check whether the student exists w/in the DB. If so, then you might consider aborting the operation or you could opt to do an update. If the student doesn't exist, then create a new student record and store the new student_id (mysql::insert_id)
    Loop through the school_id array and add new student_id/school_id records into the junction table.
    Retrieving records is much simpler -- it's just a join on the tables i.e. "SELECT * FROM student INNER JOIN school_student ON student.student_id = school_student.student_id INNER JOIN schools ON school_student.school_id = school.school_id WHERE student.first_name = 'John' AND student.last_name = 'Doe' (assuming there aren't more than one John Does of course!).
    - e

  • FFT from XY array

    Hi, i cant handle with FFT from 2d array. I am converting data from excel. In labview it is a 2 columns with 10000 rows array. Then i am plotting XY graph from this array(using 'build XY graph') and it is well plotted. Now i need to use FFT on this and i really cant figure it out. When i use spectral measurments it shows something like a noise, or other random **bleep**. How my VI looks like is attached below. Sorry for my english
    Solved!
    Go to Solution.
    Attachments:
    ni.png ‏13 KB

    Thanks for your reply. Ive attached my VI, and 2 screens with setup of my VI. For being clear, i am choosing my excel file, my VI is getting datas from excel into array, then i am plotting XY graph from columns: 2 and 3(attached screens). And after this i need to get FFT plot. Cant handle it.
    Attachments:
    war3 - Kopia.xlsx ‏403 KB
    excelortoIC10.vi ‏91 KB

Maybe you are looking for

  • Itunes 11.4 deleted my music

    I just updated my itunes to the newest version and found absolutely everything was removed from my itunes library. My movies, tv shows, and some songs were available to be re-downloaded from the icloud but hundreds of my songs are missing entirely. I

  • Premiere Pro has encountered an error message

    Hello, I keep getting this message everytime I try to open premiere pro cs5. It says Premiere Pro has encountered an error [/Scully64/shared/adobe/MediaCore/ASL/Foundation/Make/Mac/../..Src/DirectoryRegistry.cpp-2 83] Can anyone help me resolve this

  • Photos will not display properly in pdf

    I'm on Windows XP, just bought Adobe Presenter recently, so I should be all up to date. In PowerPoint, everything works fine when I play a slideshow - my animations show up, all my photos are there, everything's peachy. When I publish a pdf using Ado

  • Opening a form and displaying the first record

    Any ideas on what the easiest solution would be to show the first record on a form when the form is opened? I've tried some of the ideas discussed in the FAQ section, but without success!! Thanks........GD

  • SET AUTOTRACE ON..problems

    Hi everyone! I tried to set autotrace on with the following command. I got some errors . SQL> SET AUTOTRACE ON EXPLAIN STATISTICS SP2-0613: Unable to verify PLAN_TABLE format or existence SP2-0611: Error enabling EXPLAIN report SP2-0618: Cannot find