Semaphores and SubVIs

Okay gang, I'm trying to break my program down into 4 subVIs and running into a snag. In my main vi I create a semaphore, which is passed to a subVI where within this subVI the semaphore is both created and released.
It is not working properly. I read that you cannot used a created semaphore in more than one instance, so does that mean if I create the semaphore in my main VI, I can't lock and unlock it in the subVI code?
Thanks!
-- Jason Pugh

I assume you're referring to creating a semaphore control/indicator. The easiest way of creating a semaphore control is from the semaphore functions. Right-click on the "Acquire Semaphore" subVI's "semaphore" input and select "Create -> Control".
You can have the "main" VI try to acquire the semaphore as well as the subVIs. If you start with the example I mentioned previously, you can take the code of one of the subVI and place it right in the main VI. Then, just connect the semaphore wire to the loop's tunnel and run the main VI. Now there will be a fourth graph on the main VI that gets updated along with the three subVIs.

Similar Messages

  • What is the interaction between calling VIs and subVIs using VI Server?

    I'm studying for the CLAD and one of the lines in NI's preparation document here is this:
    What is the interaction between calling VIs and subVIs using VI Server?
    I know how to use the "Call By Reference" function to call a VI, but not necessarily a subVI. I thought a subVI is always loaded with the calling VI and has nothing to do with VI Server. What am I missing?
    Solved!
    Go to Solution.

    Hi Bmihura,
    I think this article will clear up how the VI Server works with subVIs called dynamically or statically.
    Calling a VI by Reference
    Best Regards,

  • Main and subvi question

    Hi All,
    I was wondering if there is any difference between the two codes I have attached. They are simple codes, but, I would like to understand main and subvi better. I saw this type of coding in one of the examples.
    Notice the second example has a 'while' loop but the STOP=TRUE. This means that it runs only once everytime. But, why should you specifically have a while loop with a STOP=TRUE? How is it different from the first one? Is it just good programming? THanks!
    V
    I may not be perfect, but I'm all I got!
    Attachments:
    main_sub_1.JPG ‏41 KB
    main_sub_2.JPG ‏47 KB

    Also note that there is no delay in the main while loops. This will cause a high CPU usage for no good reason.
    Use a "Wait(ms)" or "Wait Until Next ms Multiple" function to give the CPU time for other tasks.
    steve 
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

  • What is semaphore and shared memory

    Hello Gurus,
    what is Semaphores and shared memory. what is the use of setting the parameter
    SHMMAX
    SHMMIN
    SEMMIN while installing Oracle software in Linux
    Regards
    Hameed

    Hello,
    I would advise you to review Oracle Metalink Document: Semaphores and Shared Memory - An Overview : Doc ID: Note:153961.1.
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12007188755102069423::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,153961.1,1,1,1,helvetica
    Oracle Metalink Document: TECH: Unix Semaphores and Shared Memory Explained Doc ID: Note:15566.1.
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12007188755102069423::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,15566.1,1,1,1,helvetica
    Additionally you can review Oracle Metalink Document: Linux: How to Check Current Shared Memory, Semaphore Values Doc ID: Note:226209.1.
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:12007188755102069423::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,226209.1,1,1,1,helvetica
    Hope it helps.
    Adith

  • Semaphores and shared memory's classes

    Hi there,
    I looking for the classes used to deal with semaphores and shared memory. Does anyone know which are these classes?
    Thanks

    The file mapping capability added in 1.4 may result in shared memory but this is not guaranteed. You can use JNI to call some C code which allocates shared memory and then uses the NewDirectByteBuffer method to return a ByteBuffer representing that shared memory to the Java code.
    You would also need to use JNI to wrap system provided semaphore or mutex operations to provide cross process synchronization.
    However, do your communication needs really require performance in excess of that available using sockets? I can get at least 7MB/s between two processes on a rather modest machine.

  • How to find list of vis and subvis in an exe

    i have several LV exes, is it posisble to find out what vis and subvis and controls went into building it ?
    Thanks

    Supposedly, there are ways.  But none for mere mortals.  There were several threads in the last couple of weeks asking about this.  You should go look for those.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Semaphores and queue together. Is it necessary?

    Hello.
    I am using a State Machine driven by queue, using a For Loop to enqueue three States that have to be executed in sequence. The code is working fine but when I run it in Highlight Mode is possible to see that the "State 1" of the State Machine start running while the For Loop (which enqueue the elements) is still running. Is this kind of code safe?
    I mean, for this example everything is working fine, but if I have SubVIs running in the States of the State Machine, would not be safer to have the For Loop execution done, before start playing with the SubVIs of the State Machine? Would a semaphore help me with that? I found this thread that discussed similar things, but I still thing that would be safer to have the For Loop done and just after that start running the State Machine.
    What do you thing guys?
    Thanks
    Dan07
    Message Edited by dan07 on 04-17-2010 02:59 AM
    Attachments:
    Enqueue.vi ‏16 KB

    Good question dan!
    The code you are explaining is "SAFE".  and seems like a good implementation of a basic "Producer-comsumer archetecture"  Your UI stays responsive while the consumer loop does all the data manipilations.  A very positive point.
    I am a bit concerned about scaleability of the code since you have added a programatic "flush queue" in the consumer loop.  It does what you want today but, what if you add a state that enters from another event?  the flush queue tosses that element out too.  and you might really want to do what the operator asked.  I would do the time check in the producer loop (not much code to slow things down - just a timer call and a comparison right?) and determine if its correct to queue up the time based state(s).
    Then again- I'm struck with the need for a time enabled state-  will the operator expect the code to behave differently at different times?   It is possible but, questionable. 
    By-the way.
    you can exit the consumer loop based on the error out of the dequeue element.  it returns when the queue is destroyed or when there is an element.
    Message Edited by Jeff Bohrer on 04-17-2010 03:39 PM
    Message Edited by Jeff Bohrer on 04-17-2010 03:41 PM
    Jeff

  • Main VI and subvi indicator

    Hi,
    My sub-VI outputs 10 different things, 4 things at a time. It has a continue button that blinks when one set of output is finished, and the sub-VI will continue after the user clicks on this continue button. Right now I am writing a main VI that will control this sub-VI along with some other sub-VI. I have an input and output cluster in my main VI to send and receive info from the sub-VI. But I am having a problem with making this continue button works. In my output cluster in my Main VI, I have a continue button just like the one in my sub-VI. In my sub-VI, I have a "blink yet?" indicator to indicate when the program has finished taking a set of data. In my Main VI, I use get control value method to set the blinking property of
    the Main VI's continue button. This button blinks fine, but when it blinks, I cannot click on it to change its value, does anyone know why or know of a better way to do this?
    Thanks.

    Hi,
    It sounds like you almost want to use this continue button as both an indicator as well as control. Unfortunately, LabVIEW does not allow both. To work around your issue, use the continue button as an indicator and have it blink when the output of the subVI is finished. Then, use an event structure to take in when the user clicks on the button. When the continue button is pushed, then use a property node to then set the continue button to stop blinking.
    The following tutorial should be useful:
    Event-Driven Programming in LabVIEW
    Also, I have attached an example program that demonstrates using the event structure in LabVIEW with a boolean.
    Good luck!
    Kileen C.
    Applications Engineer
    National Instruments
    Attachments:
    booleanvaluechanged.vi ‏13 KB

  • 1-to-1 Relationship Between UI and subVI Data Cluster

    Discussion continued from here.
    In summary:
    JackDunaway wrote:
    Yes,
    I can see clear benefits in implementing this Idea - that is, if your
    underlying datatype elements have a 1:1 relationship with the UI
    elements.
    I will
    illustrate this point by showing some potential flaws in your example:
    "Profile Running" and "Profile Complete" are mutually exclusive, no?
    Wouldn't it be better to have a single enum named "Profile" with three
    elements "Idle, Running, and Complete" for the underlying datatype?
    Having two mutually exclusive pieces of data in an underlying datatype
    is among my favorite of code smell indicators.
    Also, the underlying datatype probably only needs "Forward Miles" and
    "Reverse Miles" since "Total Miles" is derived. Exclude "Total Miles"
    from the underlying cluster and just show the sum for display.
    Another
    argument against using a 1:1 relationship: the customer now wants to
    multiply speed by -1 if Direction==Reverse and not show the Direction
    enum on the UI. The data source (the VI that generates the data) would
    need to be updated using your 1:1 relationship. Using underlying data
    different from the display data, only the data client (the UI front
    panel) needs to change. I would be much more inclined to service the UI
    FP for a cosmetic upgrade rather than tracing the data source back
    through the HMI framework, through TCP, back to the RT, back to FPGA...
    Basically...
    I question a perfectly overlapped Venn Diagram where the set of data
    shown to the user equals the dataset used for underlying data
    processing/messaging/storing. The underlying datatype should be as
    stripped and streamlined as possible, while the display datatype can
    inherit all the flair and post-processing that Upper Management wants to
    see in a UI.
    LabBEAN wrote:
    <JackDunaway wrote
    I will illustrate this point by showing some potential flaws in your example...
    <LabBEAN response
    The data you see maps directly to tags on the PLC.
    <JackDunaway wrote
    Yes, I can see clear benefits in implementing this Idea - that is, if your underlying datatype elements have a 1:1 relationship with the UI elements.
    <LabBEAN response
    JackDunaway wrote:
    This is a good indicator that we're both aware at this point that I'm
    missing something... in all seriousness, could you reply to the 1:1
    argument? I really want to understand this Idea and learn how/if I need
    to apply it to my own style (our last back-and-forth turned out to be an enlightening and introspective exercise for me).
    ***EDIT: By all means, please start a discussion on the LabVIEW board so we're not hindered by the Exchange's interface. ***
    My long delayed response:
    The indicators you see map to tags on the PLC.  That is, we were connecting through OPC to an application on a PLC that was written ~15 years ago.  I have a VI where I read a bunch of SVs (Shared Variables).  Each SV is bound through OPC to a PLC tag.  In the interest of disclosure, two 16-bit tags are required to represent each 32-bit mileage number.  In the same subVI, I read each set of mileage tags, convert, and feed my subVI cluster indicator.  The same is true for wheel size:  three bits get converted to the enum.  Regardless, though, I have one subVI that reads SVs and outputs the same "underlying data" cluster that is seen on the UI.  The UI has a "Faults" cluster full of fault Booleans that follows the same logic.  When the user configures a profile of steps, they do so via an array of "step" clusters (although the cluster look is hidden for aesthetics).  It's the same thing as above except we write tags instead of reading them.
    In my case, each set of 16-bit tags is worthless as two 16-bit numbers.  They are only useful as a 32-bit mileage, so I don't pass around the raw 16-bit data.  The same is true for the wheel size bits. My software can just as easily (in fact, more easily) operate on the enum.  So, the underlying cluster from the subVI is programmatically useful and applicable to the UI.  I would guess that the same is true for a lot of RT applications, where the read VI can have some intelligence to process the data into useful / applicable clusters.
    There are going to be cases where "Upper Management" would like to see "flair and post-processing" as you say.  Your speed illustration is a good example of this.  There are also instances where the cluster works fine on the UI the way it is (like this one and many others that we've seen).
    <JackDunaway wrote
    "Profile Running" and "Profile Complete" are mutually exclusive, no?
    Wouldn't it be better to have a single enum named "Profile" with three
    elements "Idle, Running, and Complete" for the underlying datatype?
    <LabBEAN response
    Did you mean "not" mutually exclusive?  We combined 3 "dependent" (not mutually exclusive) Booleans into an enum for Wheel Size, as I mentioned above.  Not sure now why we went the other way with these two (this was 2 years ago).  In any event, with regard to UI representation, I still pass a cluster out of my read-raw-data-and-process-into-cluster subVI up to the applicable queued state machines and to the UI.
    <JackDunaway wrote
    Having two mutually exclusive pieces of data in an underlying datatype
    is among my favorite of code smell indicators.
    <LabBEAN response
    Working with applications written in ladder logic, it is not uncommon to see separate Booleans that indicate the same condition.  This seems to be especially true when safety is a concern.  That is, ladder Coil A ON and Coil B OFF == switch open.  Coil A OFF and Coil B ON == switch closed.  If you ever read OPC tags from Coil A and Coil B and the two are the same, you know the ladder is in transition (hasn't updated the tags).  Throw that point out and read again.
    I, too, appreciate our back-and-forths.  Good discussion.
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs

    Thanks for replying, Jason. Let me see if I can craft a coherent response after getting back up to speed...
    (...later)
    OK, let's go. I'm going to fully agree with you that LabVIEW imposes a strange constraint unique from most other languages where a Typedef defines two things: the underlying data structure, and also the view. A Strict Typedef should be more accurately deemed the Datatype-View-Definition, and a Typedef would be more accurately called the Datatype-Definition-and-View-Suggestion. And to be clear, there are two types of views: the programmer's view (a SubVI look and feel) and the UI view (what the user and Upper Management sees). (Finally, I admit I'm ignorant whether view or View is more a more appropriate term)
    Linking the programmer's view to the datatype is perfectly fine with me, and based on your original Idea I think we both agree that's OK. I think we run into a disagreement where you have loosely tied the concept of "Strict TD" to "UI View".
    Historically, I have used Strict Typedefs for the programmer's view (SubVIs), since I like to maintain a "functional UI" at the SubVI level. I don't use type definitions on User Interfaces - only Controls. That's the reason your Idea does not appeal to me, but perhaps if your Idea were implemented, it would appeal to me since View and Implementation would be divorced as separate entities within the Type Definition. (Does that classify as a Catch-22?) So, you're Idea is fundamentally suggesting that Type Definition .ctl files should be more accurately called "a container that holds both a Type Definition and any number of View Definitions as well".
    Fundamentally, I think I finally understand the gist of your Idea: "let's ditch this weird constraint where View and Datatype are inextricably defined together in one file", and for that, I'll give Kudos to the original Idea. I got really tied up with the example you used to present the Idea, and plus I'm still learning a lot.
    Additional thoughts:
    This Idea reminds me of another: Tag XControl as Class View
    We've still got some arguing to do on a 1:1 relationship between underlying datatype and UI presentation, so put your mean face back on: 
    Since our last conversation, interestingly, I have been on an anti-Typedef kick altogether.  Why don't you drop some feedback on my attempt at a completely typedef-free UI framework?
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • How best way to handle TaskCancellationException inside a Semaphore and Loop

    I'm having an issue using HttpCLient.GetStringAsync().
    I'm using a SemaphoreSlim to limit to one request by time... something like this:
    const int MAX_REQUESTS = 1;
    var semaphore = new SemaphoreSlim(MAX_REQUESTS);
    Func< IEnumerable<City>, Task > getDetailsAsync = async (cities) =>
    await semaphore.WaitAsync();
    try
    foreach (City c in cities)
    string result = null;
    string url = "MyUrl";
    try
    using (HttpClient client = new HttpClient() { Timeout = TimeSpan.FromSeconds(5) })
    Debug.WriteLine("Consulting: " + c.code);
    result = await client.GetStringAsync(url).ConfigureAwait(continueOnCapturedContext: false);
    catch (TaskCanceledException e)
    Debug.WriteLine("TaskCanceledException: " + e.Message);
    catch (Exception ex)
    Debug.WriteLine(ex.Message);
    if (result != null)
    // Save on local Database
    catch (Exception ex)
    Debug.WriteLine(ex);
    finally
    semaphore.Release();
    var tasks = cList.Select(m => getDetailsAsync(cities));
    await Task.WhenAll(tasks.ToArray()).ConfigureAwait(false);
    When the user clicks the button, it goes to this code above and gets the response from server.
    The problem is that sometimes "TaskCanceledException" is catch... and when this happens, the app has a strange behavior:
    apparently,
    it doesn't stop running... my indeterminate progress bar keeps running, but I can't interact with anything on screen, like button or pivot swipe.
    I made a search on internet and I believe that this may be deadlock.
    But how can I handle this exception, to continue the loop to the next city? 
    Thanks!!

    Hello,
    It seems you want to access web url one by one using HttpClient, but sometimes the app will throw TaskCanceledException and you don’t cancel it, is it right? Please correct if I have any misunderstanding.
    Can you submit a repro project for test? I have trouble to reproduce your problem. User your OneDrive and share a link here.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • User interaction on VI and subVI running simultaneously

    By using labview6.1 how can i create an application which hav some buttons on the vi (say parent VI) & on clicking on any of these buttons will pop another VI(say child VI) to execute.
    NOTE :: Any child VI's(subVI) "Diagram" is in a while loop i.e. it will not return and has to wait for the user interaction.
    PROBLEM :: Initially if i clicks on any button present on parent VI then
    the corresponding childVI pops up and start executing,thats fine...., but
    now if i clicks another button present on parent VI then the click event doesnt works i.e. one more child VI doen't comes up.
    The conclusion is that the Graphical user Interaction can be only on called
    SubVI(while in execution) but not on the main VI si
    multaneously.
    I hav searched examples for the similar kind of problem but didnt found any. Kindly help me for rectifying the above problem.

    You have partially answered the question yourself;
    "NOTE :: Any child VI's(subVI) "Diagram" is in a while loop i.e. it will not return and has to wait for the user interaction."
    The fact that the parent is halted until the sub-vi returns is in other words as it is supposed to be; it's data flow controlled execution...However you can put the sub-vi in another loop (that way only that loop will halt), or you can call it dynamically using an invoke node with the wait until finished set to false.
    MTO

  • Running a Front Pannel and SubVI on different monitors when using a DAQ

    I have developed a test rig monitoring system. Since there are a large number of transducers and thermocouples I have had to divide the monitoring system into two parts. An air system Front pannel, which is interactive,alloying me to start stop pause the program, and a fuel system SubVI which is purly for displaying information. When the front pannel is opened I would like the SubVI to be displayed as well. I dont mind waiting for it to be called by data being sent to it, but since data will be constantly sent to it I dont want it continnuously called. Basically I want it there running in the back ground so that I can acess it whenever I need it but I dont want it getting in the way. Does this make sense?
    Thanks

    They will be running on different monitors from the same PC. To allow us to view both at the same time. The problem that I am having right now is that the window is being continuously called through the data, so it will appear and disapear. If i select the close if originally closed option, and I open the subVI originally, then it will stay open for awhile then start to open and close again. I think this a labVIEW softwear issue as it happends at a different time each time I run the program. The other issue is that I need the Front Pannel to be the active Window, but not necesiarily on top.
    Hopefully this makes more sense, I can attach the program if you like, but it is pretty large and requires a number of subVI's and the keithley 2700 driver package

  • Upgrade labview project that has classes and subVi's

    We have a  LabVIEW  project in LV 8.5( freated by a different developer) that has classes, and various Vi's , subVi's.
    I am looking to upgrade it to LV 2014.  To be safe, I wanto to copy everthing into new classes( renamed from old ones), rename all the Vis( I hav ealready done that in Windows explorere, though not yet added them to project), and use them with renamed subVI's.
    The old classes and VI's should remain in the same folder. 
    What is best way to do that?
    I found something here
    https://lavag.org/topic/17741-the-nightmare-that-is-renaming-a-class-and-its-folder/
    but this basically suggests many methods, and then, would delete the old structure.
    Also, what happens to the "controls" that show up under "private" folder?
    I have never worked with LV classes, so pardon any lack of knowledge.
    sed_y

    4) All the subVI's that are being used and reside in different directories, will be made copy of into their own subdirectories, with the originals zipped.
    That's the one you need to be careful of. If you have any shared code or re-use libraries outside of the project folder then these will get loaded and saved in LV2014. Use the 'files' tab of the project folder to see which files aren't in your project subdirectory.
    Anything that is in user.lib you can copy from the 8.5 user.lib to the LV2014 user.lib folder and your project will automatically find them.
    There are some useful tips here about working with LabVIEW projects and keeping all of your code in sensible locations. Anything relating to your project should be within the project subfolder and any shared code should go in the respective user.lib/vi.lib of the appropriate LabVIEW version - this does mean that you have a copy of the VI for each version of LabVIEW so you will need to be careful about making sure if you change it in one version you change it in the other. Even better still is to make your shared code into VI packages - then you can install them for any LabVIEW version and it will automatically save/compile them for the appropriate version. We used to have all of our re-use code in user.lib but it made moving between LabVIEW versions a pain so we started using VI packages and haven't looked back.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How to use REFNUM to communicate between Tab Control Indicator panel and subVI without explicit connections?

    Hi! One of my test programs needs to show many readings on the fron panel. I used a 4 page Tab Control to separate
    different catagory readings and put them in the clusters. If I connect these indicator clusters to the subVI by refnum explicitly, the program runs too slow. So I am trying to make the subVI communicate with the front panel without explicite refnum connection. So far, the subVI can communicate with the clusters on the front panel but not on the Tab Controls. Is anyone can give me some ideas how to communicate/pass the data to the clustes on the
    Tab Control? Thanks,

    Hi Qian,
    If I understand the question correctly; you want to know if there is some other way to access the controls on the tab control without actually using a refnum from the VI that has the controls.
    To answer this question I would say that LabVIEW is a very powerful programming language and one of the very cool features is that it gives you access to all the controls on a VI into another VI without actually passing any data between them.
    The best way to do this would be using VI Server. The functions that you need to call would be Open VI reference to open a reference to your VI having all the controls. Then use a combination of Invoke nodes and Property node get access to the controls on the front panel of your VI.
    Do let me know if you have further questions.
    Ankita A.

  • VI and SubVI reentrant

    I developed some step types for TestStand in labview. Now I have an application where I need to use parallel process model. I guessed to set the step type as "reentrant". Here it is my issue. For setting a VI reentrant also its subvi have to be reentrant? This is a problem for me because the step type include a lot of VI.
    Is there an alternative solution in TestStand or in Labview?
    Thanks a lot.

    If you want to have complete concurrency, you have to set ALL VIs in the hierarchy to be reentrant.
    The default is non-reentrant because if you use shared resources (hardware interfaces, certain software interfaces/variables) setting the VIs to be reentrant, you will introduce race conditions.
    Race conditions do act "sporadic" and therefore are hard to debug, annoying if occurring and can lead to severe issues with the whole system.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

Maybe you are looking for

  • Multiple email accounts for iCal notifications

    I have multiple email accounts. I would like to be able to use the email account of my preference when sending a notification for a calendar (meeting) invitation. I would like to be able to select the preferred email account for every invitation I se

  • Converting a Color Cad file into a Black and White .pdf

    My company recently bought me Adobe Acrobat XI-Professional as an upgrade from Adobe Acrobat 9-Standard. As such, one of the tasks assigned to me was to take color CAD drawings (.DWG extension) created in AutoCAD 12 and then convert them into black-a

  • Qosmio F30-117: How to switch Bluetooth on?

    how to switch blue tooth on, on qosmio f30-117. As software is preinstalled for blue tooth. Message was edited by: jdukhi

  • XML Report HELP

    Hi I have made A rdf report and register it as a concurrent program, now My requirement is to make XML publisher report. I have changed the output as XML in the concurrent program definition now when I am running the report it is giving an error as M

  • How do you something not equal something else?

    how come the, "does not equal's" not work, and what is the proper way to do it so that I can have all the variables be different, but still be between 1 and 7? import javax.swing.*; import java.text.*; import java.util.*; import java.awt.*; import ja