Best way to control and run multiple (up to 20) processes independantly in LV

Hi all, 
I'm trying to build an application in LV to independantly control and run multiple (up to 20) processes, ie, it should be able to start and stop any of the processes at any given time. What would the best way to code for this? Off the top of my head would be to use a unique notifier to control each of the process, but I'm thinking that the code upkeep may be a handful with this number of notifiers being defined. Are there better ways of doing this?
Appreciate any help and insight on this.Thanks a bunch in advance!
Solved!
Go to Solution.

I forgot some more important questions:
How large is your development group?
How much "discipline" do you want to program into the Process Commands framework? For instance, is it OK for any VI to command a process into a certain state, or should your program generate a broken wire or run-time error if a command is sent from a non-authorized source?
Where do your needs fall on this spectrum: simplicity that gets the job done and the product out the door and will probably not need much maintenance or upgrading, or flexible framework that will likely undergo multiple upgrades or fall into the hands of multiple developers?
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;}

Similar Messages

  • Best way to control and read data from multiple instruments?

    Hello,
    I'm building an application to test power supplies involving multiple pieces of equipment over a couple of different comm busses. The application will also send control instructions to some of the instruments, and read data from some of the instruments. The reading and control profiles will not run on the same schedule (variable length control steps, configurable read interval).
    I was thinking of using a queued statemachine (producer/consumer) for the control profile and another to read the data, but I got concerned that there would be collisions between sending control commands and read commands to the same machine. Is there a suggested design pattern for implementing something like this?
    Timing of the commands isn't critical down to the milisecond, but I need to collect reasonably accurate timestamps when the data is read. The same is true for the control commands.
    Here are the instruments I'm going to use, if the are control, read, or both, and the communication method
    Instrument Funtions Comm Method
    Power Supply Read data Communicates to PMBus Adapter
    PMBus to USB Adapter Read data USB (Non-Visa)
    Switch control relays USB (VISA)
    Power Dist. Unit read data/control outlets SNMP (Ethernet)
    Electronic Load read data/control load GPIB (VISA)
    Thermal Chamber read data/control temp Ethernet (VISA)
    Thanks,
    Simon

    Hello, there is a template in LV called "Continuous measurement and Logging".
    It can give you some idea how to properly decouple the "GUI Event handler" top loop (where your Event structure is) from the DAQ and other loops.
    You do not need to totally replicate the above example, but you can find there nice tricks which can help you at certain points.
    The second loop from the top is the "UI message loop". It handles the commands coming from the top loop, and regarding to the local state machine and other possible conditions and states, it can command the other loops below.
    During normal run, the different instrument loops just do the data reading, but if you send a control command from the top loop to a certain instrument loop (use a separate Queue for every instrument loops), that loop will Dequeue the control command, execute it, and goes back to data reading mode (in data reading mode the loop Dequeu itself with a "data read" command automatically). In this way the control and data read modes happen in serial not in parallel which you want to avoid (but I think some instrument drivers can even handle parallel access, it will not happen in really parallel...).
    In every instrument loop when you read a value, attach a TimeStamp to it, and send this timestamp/value couple to the DataLogging loop via a Queue. You can use a cluster including 3 items: Source(instrument)/timestamp/value. All the instrument loops can use the same "Data logging" Queue. In the Datalogging while loop, after Dequeue-ing, you can Unbundle the cluster and save the timestamp and data-value into the required channel (different channel for every instrument) of a TDMS file.
    (Important: NEVER use 2 Event structures in the same top level "main" VI!)

  • Best way to control audio over multiple slides-iMovie or QT Pro?

    I have a 30-slide presentation, and due to the horrendous handling of audio files by Keynote I need figure out the least painful way of controlling audio spanning multiple slides.
    My end goal is to have a Quicktime file to put on the web, and to burn to a CD or DVD for viewing on individual computers. There is audio spanning 3 slides (a Garageband mix with voiceover narration built in,)and different audio for background for different groups of slides.
    Least painful method to attempt this and get ACCURATE TIMING for the end product?

    Make a series of Keynote presentations, one for each complete audio track. Export each as a QuickTime DV (digital video) clip. Launch iMovie and import the clips into a single iMovie project; tweak each clip's audio, as necessary. Finally, export the assembled iMovie to your intended QuickTime format.

  • Best way to Export and Run a CS2 action/plug-in and save to a JPG?

    Can someone help me with this? I am new to actions and droplets and LR/CS2 for that matter. :) sorry if this is basic beginner questions.
    Please let me know if this is not correct?
    * My assumption is I will get the best quality if I Export as a PSD,16-bit,300ppi file and then run my CS2 Plug-in and action ... then save to a JPG?
    If this is true ... this is my question.
    1) In LRv1 ... how do I Export the file as a PSD 16-bit ... and have a Action/droplet that will ultimatly save a JPG for me ... in another folder labled JPG?
    (prefer not to have a bunch of psd files that I have to go back and delete.
    2) p.s. I also would like to know I can do the same thing ... but this time configur my Action/droplet to save a "minimize embedded metadata' sRGB, constrained to 800px ... "save for WEB" JPG ... in a folder named WEB.
    3) The key question here "I guess" is when Exporting from LRv1 .. and running a action on LR Export ... Do I have to Export the "Same" type/size of file I plan to End up with???
    * So, If I want to end (after the action/droplet) with a 800x600 sRGB I need to Export it that way ...then LR will Run my Plug-in,& Sharpening Action on a smaller , lower bit file?
    Thank you all, who have helped me on LR
    * I am "trying" to automate LR ... my hope is true time savings :)

    I've used JSmooth to make exe file from jar file, and it worked good. It was so along ago though I can't recall how to use it anymore.
    Here's an example how to make a jar file from command line
    http://forum.java.sun.com/thread.jspa?threadID=740310&messageID=4246794#4246794
    There are plenty of others that can be found by using the search.
    kari-matti
    Message was edited by:
    kari-matti

  • Best way to package and run java in exe

    I've made a java program (using swing) and I want people to use it, obviously not every one will compile it so what is the best way to turn my code into a .exe for example? so that anyone can run it

    I've used JSmooth to make exe file from jar file, and it worked good. It was so along ago though I can't recall how to use it anymore.
    Here's an example how to make a jar file from command line
    http://forum.java.sun.com/thread.jspa?threadID=740310&messageID=4246794#4246794
    There are plenty of others that can be found by using the search.
    kari-matti
    Message was edited by:
    kari-matti

  • Best way to backup and restore multiple iPhones??

    hi everyone,
    I am a pretty computer savvy person and I have a friend with an iPhone and a contact list who is having some problems with it... he wants me to backup and restore his phone on my mac as he has no computer of his own (his son set up his iPhone with music etc before and is back at school now)
    so I wonder what is the easiest way to create the backup of the contacts SMS etc?
    I have my mac with the latest iTunes running os x 10.5.6
    can iTunes create multiple backups of phones? should I look into a third part solution?
    thanks for any insight.

    You can sync multiple iPods and/or iPhones with iTunes on the same computer. iTunes will create a separate backup for each iPhone as long as each iPhone has a different name.
    In regards to iTunes content, an iPhone can be synced with an iTunes library on a single computer only. If you sync his iPhone with your iTunes content, the iTunes account logged in to with iTunes when syncing will be transferred to his iPhone - but not the password for the account. If he tries to access your iTunes account too many times with the incorrect password, your iTunes account will be placed on hold.
    You can create a backup of his iPhone when the iPhone is connected to iTunes. Control-click on the name of his iPhone in the iTunes source list under devices and select Back Up.
    You can restore the iPhone with iTunes on your computer from his iPhone's backup, but do not sync his iPhone with iTunes on your computer. This should restore the contact info from the backup. The backup includes data such as most iPhone settings, email account settings, contact info, SMS messages, recent calls, call favorites, photos available in the iPhone's Camera Roll, and 3rd party app settings and data created and stored by a 3rd party app.
    The backup does not includes iTunes content including apps, photos transferred from a computer to the iPhone, and calendar events.

  • [10g] Best way to populate and update multiple workday calendars?

    I would like to create multiple workday calendars, and be able to update them as needed. Each workday calendar would be for at most 5 years (right now), although it is possible that at some point in the future, I might want to extend that.
    A workday calendar can apply to a single resource or a group of resources. Each individual is part of a resource group. What I'm thinking is that if an individual resource has an associated workday calendar, that calendar gets used, but if it doesn't, it uses the calendar of it's resource group, and if the group doesn't have one, the default calendar gets used. Theoretically, each resource could have its own workday calendar, and there would be probably 500 resources at most. In practice, many resources will have the same or similar workday calendars.
    Each calendar will be based on one of 3 standards: all calendars days are work days, all days but weekends are workdays, or all days except weekends and holidays are workdays. (Weeks start on Sunday, and Saturday and Sunday are weekends.) The standard calendar would then be modified to create each unique calendar as needed. For example, if a resource was an employee, their calendar might be the standard of not working weekends or holidays, but could also include a one week vacation in February and a one week vacation July. I'm not sure what the best approach is for defining a calendar in the first place and then being able to update it as an employee decides on vacations (or whatever other situation might affect workdays).
    Furthermore, I'd really like to be able to incorporate work hours, which could vary by day, though would likely be fairly standard. I don't know if this information belongs in the workday table, or as something separate to be combined with the workday table.
    My ultimate purpose in doing all of this is to try to schedule a very large project amongst many resources.
    Here is some sample data illustrating where I'm at so far:
    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)     
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)     
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');I'm not sure if I should have a separate table to define a relationship between a resource or resource group and a calendar id (each resource or group would only be able to be assigned 1 unique calendar id, though multiple resources/groups could share the same calendar id), or if I should add an extra column to each of the above tables to assign the calendar id.
    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );cal_id     - refers to calendars table
    cal_date - the actual calendar date
    cal_year - the actual calendar year for the given calendar date
    work_day - workday in that work year (resets each year, starting at 1, is 0 if that calendar date is not a work day)
    work_date - if a work day, the calendar date, if not, the calendar date of the last work day (or in the first week of the calendar, the next work day)
    work_week - work week of the work date (numbered starting at 1 , reset each year at the first Sunday of the year, before first Sunday will have last week of previous year, and the first year of the calendar will have all days prior to Sunday included in the first week, so the first week of a calendar could be more than 7 days)
    work_year - year of the work date
    work_days - shop day of the work date (except in first week of the calendar, before first shop day is 0), starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    cal_days - calendar day of the work date, starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    Assuming the calendar starts on 1/1/2010 (these values are approximately correct--I just made my best guess to provide sample data):
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);I've tried googling workday calendars and similar things, but I can't seem to find anything that fits my situation. If anyone could even point me in the right direction, I'd appreciate it.
    I'm working in 10g (XE).
    Edited by: user11033437 on Jul 19, 2011 3:05 PM
    Also, I don't know if it would make more sense to just somehow store the days each resource/group doesn't work, and generate a workday calendar on the fly as needed, rather than trying to store possibly thousands of dates in the database??

    Hi,
    Interesting problem!
    I'm not sure exactly what you want, however. Are you looking for a way to answer questions such as "For resource A001, what are the first 6 work days on or after January 4, 2010?" or "How many work days does resource A001 have between January 4 and January 12, 2010?" Post a few examples of the questions you might ask, and the results you would want, given the sample data you posted.
    user11033437 wrote:
    I would like to create multiple workday calendars, and be able to update them as needed. Each workday calendar would be for at most 5 years (right now), although it is possible that at some point in the future, I might want to extend that.
    A workday calendar can apply to a single resource or a group of resources. Each individual is part of a resource group. Is a "resouce group" the same as a "work group"?
    if a resource moves from one resource group to another, do you need to keep track of the historical information? For example, if resource A001 does not havfe its own calendar, and is part of work_group A on Juanuary 1, 2010, but then moves to work_group B on July 1, 2010, will you need to answer questions like "How many work days did A001 have in 2010", where you have to remember that the work_group A calendar apllied during the first half of the year, but the work_group B calendar was in use for the second half?
    What I'm thinking is that if an individual resource has an associated workday calendar, that calendar gets used, but if it doesn't, it uses the calendar of it's resource group, and if the group doesn't have one, the default calendar gets used. Theoretically, each resource could have its own workday calendar, and there would be probably 500 resources at most. In practice, many resources will have the same or similar workday calendars.
    Each calendar will be based on one of 3 standards: all calendars days are work days, all days but weekends are workdays, or all days except weekends and holidays are workdays. (Weeks start on Sunday, and Saturday and Sunday are weekends.) The standard calendar would then be modified to create each unique calendar as needed. For example, if a resource was an employee, their calendar might be the standard of not working weekends or holidays, but could also include a one week vacation in February and a one week vacation July. I'm not sure what the best approach is for defining a calendar in the first place and then being able to update it as an employee decides on vacations (or whatever other situation might affect workdays).It seems like the simplest thing would be to record only the exceptions to the base calendar. That is, given that the employee normally abides by the "no weekends or holidays" schedule, just enter 5 rows for that particular employee to mark the 5 work days he'll miss in February. If the emplyoee is going to work Saturdays in June (in addition to his regular schedule), then enter one row for each Saturday in June.
    >
    Furthermore, I'd really like to be able to incorporate work hours, which could vary by day, though would likely be fairly standard. I don't know if this information belongs in the workday table, or as something separate to be combined with the workday table. That depends on exactly what you want. Post a couple opf examples of questions you would want to answer, and the actual answers, given the sample data you post.
    My ultimate purpose in doing all of this is to try to schedule a very large project amongst many resources.
    Here is some sample data illustrating where I'm at so far:
    CREATE TABLE     work_groups
    (     group_id     VARCHAR2(5)     NOT NULL
    ,     group_name     VARCHAR2(25)     
    ,     group_desc     VARCHAR2(200)
    ,     CONSTRAINT     work_groups_pk     PRIMARY KEY (group_id)
    INSERT INTO     work_groups
    VALUES     ('A','Group A','Group A description');
    INSERT INTO     work_groups
    VALUES     ('B','Group B','Group B description');
    INSERT INTO     work_groups
    VALUES     ('C','Group C','Group C description');
    INSERT INTO     work_groups
    VALUES     ('D','Group D','Group D description');
    CREATE TABLE     resources
    (     resource_id     VARCHAR2(20)     NOT NULL
    ,     type          VARCHAR2(1)
    ,     description     VARCHAR2(200)
    ,     group_id     VARCHAR2(5)     
    ,     CONSTRAINT     resources_pk     PRIMARY KEY (resource_id)
    ,     CONSTRAINT     group_id_fk     FOREIGN KEY (group_id)
                             REFERENCES  work_groups (group_id)
    INSERT INTO     resources
    VALUES     ('A001','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A002','M','text here','A');
    INSERT INTO     resources
    VALUES     ('A003','M','text here','A');
    INSERT INTO     resources
    VALUES     ('B001','M','text here','B');
    INSERT INTO     resources
    VALUES     ('B002','M','text here','B');
    INSERT INTO     resources
    VALUES     ('C001','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C002','M','text here','C');
    INSERT INTO     resources
    VALUES     ('C003','M','text here','C');
    INSERT INTO     resources
    VALUES     ('D001','M','text here','D');
    INSERT INTO     resources
    VALUES     ('12345','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12346','L','text here','A');
    INSERT INTO     resources
    VALUES     ('12347','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12348','L','text here','B');
    INSERT INTO     resources
    VALUES     ('12349','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12350','L','text here','C');
    INSERT INTO     resources
    VALUES     ('12351','L','text here','D');
    It looks like all the rows have the same description. if description matters in this problem, wouldn't it be better to illustrate how it matters, by having different descrioptions that appeared in different outputs? On the other hand, if description doesn't play any role in this problem, then why include in the sample data at all?
    I'm not sure if I should have a separate table to define a relationship between a resource or resource group and a calendar id (each resource or group would only be able to be assigned 1 unique calendar id, though multiple resources/groups could share the same calendar id), or if I should add an extra column to each of the above tables to assign the calendar id.
    CREATE TABLE     calendars
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_title     VARCHAR2(25)
    ,     cal_desc     VARCHAR2(200)
    ,     CONSTRAINT     calendars_pk     PRIMARY KEY (cal_id)
    INSERT INTO     calendars
    VALUES     (1,'Default','This is the default calendar to use for workdays');
    INSERT INTO     calendars
    VALUES     (2,'All Days','This calendar treats all days as workdays');
    INSERT INTO     calendars
    VALUES     (3,'Weekends Off','This calendar gives weekends off, but no holidays');
    INSERT INTO     calendars
    VALUES     (4,'Holidays Off','This calendar gives weekends and holidays off');
    What is is cal_id=1? How will it differ from the other three?
    CREATE TABLE     workdays
    (     cal_id          NUMBER(4)     NOT NULL
    ,     cal_date     DATE          NOT NULL
    ,     cal_year     NUMBER(4)
    ,     work_day     NUMBER(3)
    ,     work_date     DATE
    ,     work_week     NUMBER(2)
    ,     work_year     NUMBER(4)
    ,     work_days     NUMBER(5)
    ,     cal_days     NUMBER(6)
    ,     CONSTRAINT     workdays_pk     PRIMARY KEY (cal_id, cal_date)
    ,     CONSTRAINT     cal_id_fk     FOREIGN KEY (cal_id)
                             REFERENCES  calendars (cal_id)
    );I suspect there's a simpler way, especially if there's a regular order to day types (e.g., people who get holidays off normally get weekeneds, too).
    Perhaps you could have a table like this, that had one row per day:
    CREATE TABLE  days
    (       a_date      DATE     PRIMARY KEY
    ,     day_type    NUMBER (1)              -- 1=Weekend, 2=Holiday, 3=Other
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-01', 2) /* New Years Day */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-02', 1) /* Saturday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-03', 1) /* Sunday */;
    INSERT INTO days (a_date, day_type) VALUES (DATE '2010-01-04', 3) /* Monday - back to work */;
    ...Another table (I'll call it work_sched) shows what resources work when:
    CREATE TABLE  work_sched
    (       p_key          NUMEBR     PRIMARY KEY     -- Arbitrary Unique ID
    ,     group_id         VARCHAR2 (5)          -- Exactly one of the columns group_id or ...
    ,     resource_id      VARCHAR2 (20)          --     ... resource_id will always be NULL
    ,     a_date              DATE
    ,     works_on     NUMBER (1)          -- works when days.day_type >= this value
    ,     remarks          VARCHAR2 (40)
    );To indicate that work_group 'L' normally works on type 3 days only (that is, weekends or holidays):
    INSERT INTO work_sched (group_id, a_date, works_on) VALUES ('L', NULL, 3);(Let's assume that p_key is populated by a trigger.)
    The NULL in the a_date column indicates that this applies to all days, unless overridden by another row in the work_sched table. Instead of NULL, mabe some impossible date (such as Jan. 1, 1900) would be more convenient to indicate defaults.
    Exceptions to this schedule would be indicated by other rows in work_sched. For example, if '12345' is the employee who's on vacation for a week in February:
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-08', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-09', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-10', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-11', 4, 'Vacation');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-02-12', 4, 'Vacation');And if that same employee works Satudays in June:
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-05', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-12', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-19', 1, 'Fiscal year-end crunch');
    INSERT INTO work_sched (resource_id, a_date, works_on, remarks) VALUES ('12345', DATE '2010-06-26', 1, 'Fiscal year-end crunch');When finding the number of work days, we would join work_sched to days using both conditions:
    ON   work_sched.date           = days.a_date
    AND  work_sched.works_on  <= days.day_type
    cal_id     - refers to calendars table
    cal_date - the actual calendar date
    cal_year - the actual calendar year for the given calendar date
    work_day - workday in that work year (resets each year, starting at 1, is 0 if that calendar date is not a work day)
    work_date - if a work day, the calendar date, if not, the calendar date of the last work day (or in the first week of the calendar, the next work day)
    work_week - work week of the work date (numbered starting at 1 , reset each year at the first Sunday of the year, before first Sunday will have last week of previous year, and the first year of the calendar will have all days prior to Sunday included in the first week, so the first week of a calendar could be more than 7 days)
    work_year - year of the work date
    work_days - shop day of the work date (except in first week of the calendar, before first shop day is 0), starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)
    cal_days - calendar day of the work date, starts at 1 (at the beginning of the calendar), cummulative (does not reset each year)This is a lot of denormalized data. that is, you should be able to easily deduce cal_year from cal_date, but sometimes it is convenient to store denormalized data.
    Assuming the calendar starts on 1/1/2010 (these values are approximately correct--I just made my best guess to provide sample data):
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,1);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,2);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2010','mm/dd/yyyy'),2010,0,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,0,3);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/04/2010','mm/dd/yyyy'),2010,1,TO_DATE('01/04/2010','mm/dd/yyyy'),1,2010,1,4);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/05/2010','mm/dd/yyyy'),2010,2,TO_DATE('01/05/2010','mm/dd/yyyy'),1,2010,2,5);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/23/2010','mm/dd/yyyy'),2010,250,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,357);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('12/24/2010','mm/dd/yyyy'),2010,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,358);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/01/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),51,2010,250,366);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/02/2011','mm/dd/yyyy'),2011,0,TO_DATE('12/23/2010','mm/dd/yyyy'),1,2011,250,367);
    INSERT INTO     workdays
    VALUES     (3, TO_DATE('01/03/2011','mm/dd/yyyy'),2011,1,TO_DATE('01/03/2010','mm/dd/yyyy'),1,2011,251,368);I've tried googling workday calendars and similar things, but I can't seem to find anything that fits my situation. If anyone could even point me in the right direction, I'd appreciate it.
    I'm working in 10g (XE).
    Edited by: user11033437 on Jul 19, 2011 3:05 PM
    Also, I don't know if it would make more sense to just somehow store the days each resource/group doesn't work, and generate a workday calendar on the fly as needed, rather than trying to store possibly thousands of dates in the database??That's what I was thinking, too.
    Post some sample data (if it's not what you've already posted), a couple of sample questions, and the exact answers you want from each question given that sample data.

  • Plsql best way to store and run generated sql

    Oracle 11g
    I found a script on a web site that generates a bunch of sql to do basic data profiling on a set of tables (I've include 1 step in the script below that profile date columns ..see below). I'm currently having trouble with buffer overflows when I process a more than 5-10 tables. I'm looking for a better way to temporarily store the result set and execute the resulting sql. I don't have access to the server so using utl_file is not an option. Can I some how append the sql to a temporary clob varable? Any suggestions would be very helpful.
    declare
    t varchar2(2000);
    cursor c1 is select distinct owner,table_name from all_tab_columns
    where table_name in ('PS_F_BEGIN_BAL','PS_F_KK_ACTIVITY','PS_F_KK_ACT_FS','PS_F_KK_JOURNAL'
    ,'PS_F_KK_BUD_ASSOC','PS_F_KK_BALANCES','PS_F_KK_ENCUMRANCES','PS_F_KK_EXCEPTION'
    ,'PS_F_KK_FS_ALLOC','PS_F_KK_FS_RCVD','PS_F_KK_OVERRIDES','PS_F_KK_TRANS_LOG','PS_F_CLEDGER'
    ,'PS_F_FLOWS','PS_F_JOUNRAL','PS_F_LEDGER'
    begin
    t := 'INSERT INTO DATA_PROFILE_COL_SUM ';
    for i in c1 loop
    DBMS_OUTPUT.PUT_LINE(T);
    ----date
    FOR MYSQLTEXT IN (SELECT
    'select '
    || '''' || C.table_name || '''' || ' as tname, '
    || '''' || C.column_name || '''' || ' as cname, '
    || '''' || C.data_type || '''' || ' as data_type, '
    || '''' || nvl(c.data_length, 0) || '''' || ' as data_length, '
    || '''' || nvl(c.data_precision, 0) || '''' || ' as data_precision, '
    || '''' || nvl(c.data_scale, 0) || '''' || ' as data_scale, '
    || '''' || c.nullable || '''' || ' as nullable, '
    || '''' || nvl(c.num_distinct,0) || '''' || ' as num_distinct, '
    || '''' || nvl(c.density,0.0) || '''' || ' as density, '
    || '''' || nvl(c.num_nulls,0) || '''' || ' as num_nulls, '
    || '''' || nvl(c.char_col_decl_length,0) || '''' || ' as col_length, '
    || '''' || nvl(c.avg_col_len,0) || '''' || ' as avg_col_length, '
    || '''' || nvl(c.char_length,0) || '''' || ' as char_length, '
    || '''' || nvl(tblc.comments, 'NONE') || '''' || ' as table_comments, '
    || '''' || nvl(colc.comments, 'NONE') || '''' || ' as column_comments, '
    || ' count(*) as rcount, min('
    || c.column_name || ') as min_date, max('
    || c.column_name || ') as max_date, '
    || ' null as min_integer, null as max_integer, '
    || ' null as min_number, null as max_number, '
    || ' null as min_varchar2, null as max_varchar2, min(length('
    || c.column_name || ')) as min_len, max(length('
    || c.column_name || ')) as max_len, sysdate'
    || ' from '
    || C.owner || '.' || C.table_name
    || ' ' || CHR(13) || chr(10) || ' UNION ALL ' || chr(13) || chr(10) AS MYSQL
    from sys.all_tab_columns c
    inner join sys.all_tables t
    on c.table_name = t.table_name
    and c.owner = t.owner
    left outer join sys.all_tab_comments tblc
    on t.owner = tblc.owner
    and t.table_name = tblc.table_name
    left outer join sys.all_col_comments colc
    on c.owner = colc.owner
    and c.table_name = colc.table_name
    and c.column_name = colc.column_name
    where c.owner = I.OWNER
    and c.data_type = 'DATE'
    and c.table_name = I.TABLE_NAME
    LOOP
    -- utl_file.put_line(f,MYSQLTEXT.MYSQL);
    DBMS_OUTPUT.PUT_LINE(MYSQLTEXT.MYSQL);
    END LOOP;

    The buffer overflow id beacause of dbms_output. the max limit of the string is 255.
    It will not stop you from inserting or executing the sql dynamically.
    you can run dynamic sql by
    execute immediate 'your sql statement';if you want dbms_output to display allof it you have to use a loop. Look at the followinmg example
    DECLARE
       loopcntr       NUMBER := 1;
       vextend        NUMBER := 255;
       l_sql          VARCHAR2 (32767) := RPAD ( 'ORACLE', 1000, 'AB');
    BEGIN
       WHILE loopcntr < LENGTH (l_sql)
       LOOP
          DBMS_OUTPUT.PUT_LINE (SUBSTR ( l_sql, loopcntr, vextend));
          loopcntr    := loopcntr + vextend;
          vextend     := LEAST ( 255, LENGTH (l_sql) - vextend);
       END LOOP;
    END;G.

  • The best way to deploy and redploy of a multiple SOA application

    Hi all,
    I'm looking for the best way to deploy and redeploy a multiple SOA application.
    1) The multiple SOA application contains many projects. Some projects depend on another projects.
    2) WebLogic is in productive mode.
    I wound like automaticly deploy and redeploy my multiple SOA application.
    Does anyone have any experience of this?
    Many thanks
    PG

    We use ant scripts to automatically deploy and redeploy multiple composites.
    The ant scripts gets shipped along with the SOA installation. The ant script that is used for the deployment is:
    ${oracle.home}/bin/ant-sca-deploy.xml
    You can also use the same for your deployment.

  • What is the best way to secure and harden a Macbook Pro against unwanted surveillance?

    What is the best way to secure and harden a Macbook Pro against unwanted surveillance? Tor, VPN, Little Snitch, etc. This would be for that latest version of Mavericks.

    djbabybokchoy wrote:
    Nothing specific, just speaking in general. Ex-wives, governments, bad guys...anyone really. I'm just looking to make my Mac a bit more private and secure, especially when on public networks.
    Governments and ex's will/may have recourse to the legal process (or in the case of the Gov they can choose to ignore the legal system if they feel like it) when they want to see something of yours, good luck hardening your Mac against that. The best way to avoid the possibility of snooping over public networks is to avoid them but if you can't then Kappy's suggestion will help.
    Strong passwords (everywhere) and don't use the same password in multiple locations.
    If you really want to secure your home wireless use Mac address connection authentication, do not allow unknown Mac addresses to connect. It's much stronger than a WPA password alone.

  • What is the best way to control a mac mini with iphone 4s , prefer blue tooth

    Hi
    what is the best way to control a mac mini with iphone 4s , prefer blue tooth, or I can use the syncing cable as well. but no wifi.
    Basically to lanch an app and load a preset for that app.
    Thank you

    As V.K. noted, check out NetRestore's documentation http://www.bombich.com/software/docs/netrestore/English/index.html or visit the fourms at http://forums.bombich.com/

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • What is the best way to scan and sort old photos in iPhoto

    What is the best way to scan and sort old photos in iPhoto?  They do not have digital dates.

    Hey Chicago Sue,
    Once you scan them and have them on your desktop. You should use Automator and assign the common IPTC tags to the images, so that when you do import them into iPhoto, they get recorded.
    Here is an example of an action in Automator:

  • How is the best way to backup and organize Adobe layered .PSD files on iMac OSX maverick?

    How is the best way to organize and backup Adobe layered PSD files on iMac desktop OSX maverick?
    I lost all my Adobe Photoshop files + everything else on my IMAC when it crashed. They reinstalled Operating System.  But now i must install programs such as MS Word & Adobe indesign suite.
    Please help me determine what is the bestway to backup Adobe layered  PSD files? I believe these are my choices to be assured this doesn't ever hapen again. Please comment.
    Buy Apple Airport Time capsule $280.  But I am not sure if it can store PSD layers. Can it or do you have to have Apple Apperture  software to act be sure layers are saved
    I had had trouble getting Adobe Cloud to sync to save files and so just trusted my computer to not ever crash.  Any hints on this procedure
    Are there any hints on PhotoShop image organization for a current IMac usser ?
    Please help.
    Teann  ucreateit

    My backup plan is to use Time Machine to make a backup to an external disk drive plus I also do a clone of my system disk. So far between the bootable clone and the Time Machine backup this plan has covered all of my needs.
    Allan

  • HT1364 I just bought a new PC and now have ample space on my C drive to house my music Library which is currenlty installed on a external drive.  What is the best way to install and move the itunes library to my C Drive?

    I just bought a new PC and now have ample space on my C drive to house my music Library which is currenlty installed on a external drive.  What is the best way to install and move the itunes library to my C Drive?

    If the entire library is on the external drive then simply copy the iTunes folder into <User's Music> on the new computer, then install iTunes. If you've already installed iTunes you will want to remove the empty iTunes folder in <User's Music> first.
    If it turns out you only have the media folder on the external drive then take a look at this post...
    tt2

Maybe you are looking for

  • International characters in filenames on FAT32

    Hi folks, I have recently replaced nearly all the computers in my home office with a spiffy new iMac dual-booted to Windows Vista with Linux sitting in a Parallels space. In the course of doing this, I purchased two external WD 500 Gb drives, which a

  • Disk utilities reports different hard drive space

    I have a MacBook Pro early 2011 that's acting up.When I  repair the disk from disk utilities (separate drive and from recovery drive) it states that I have 100 GB available.  However, if I click on the first "Macintosh HD" that shows up in disk utili

  • ITunes 8 - my entire library has disappeared!

    I admit I am not very tech savvy, but I have successfully upgraded my iTunes in the past. However, when I downloaded iTunes 8, all of my music and podcasts and everything disappeared. My iTunes is empty. I found my iTunes Folder in my owner folder, b

  • File 2 RFC

    Hi, I wrote RFC Func. Module in R/3, with just a Remote Enabled func module and code i gave is Using SE37 Func Module Name: <b>ZDumpData</b> ZTakeData is the Table name in R/3. In Tables Tab: ITAB      LIKE    ZTakeData In Source Tab: insert ZTakeDat

  • Displaying HTML document?

    Hi. In my little program, output with simple formatting(HTML font and coloring) is produced. What I am currently doing now is to write the result with formatting into an Output.html and call the default browser to display the output file. It will be