There's got to be a better way to do this (RAM preview frustration)

I loaded a 1:20 second Full HD clip into after effects. I need to edit the video based on certain sounds in the video and see if I'm matching them up correctly by previewing it with sound.
The problem is i'm getting frustrated due to After effects not behaving like Premiere. First who thought it was a good idea not to incorporate sound into after effects? Second, I have an i7 sandy bridge processor, and 16 gbs of ram, yet it still takes time to render the ram preview (with no effects on it yet).
So ram preview is my only option for sound, but the problem is every time I hit ram preview it starts the video all the way from the beginning. This is frustrating as I want to start at a specific point. Imagine having a longer video where the editing needs to take place at the end.
There are people out there doing a lot more complicated professional projects, what do you guys do to get around this?
Why can't after effects do some basic things like premiere like render fast with sound? Is it due to Mercury engine and 64 bits?
This is one of the best products on the market, surely there is a better way to do this right?

but the problem is every time I hit ram preview it starts the video all the way from the beginning.
Window --> Preview, enable the "From current time" option
yet it still takes time to render the ram preview (with no effects on it yet).
There is no magic button. If it is compressed, naturally it needs to be decompressed and decoded first. This can consume resources even on fast machines. Furthermore, drive speed matters a lot in such cases. This might actualyl multiply, if you use multiprocessing, so for this kind of simple setup it's usually better to not use it. If your harddrives are fragmented or simply generally slow, frames cannot be loaded as fast and neither will AE be able to use the disk cache. Ergo, convert the footage and move it to the fastest drive in your system.
what do you guys do to get around this?
We preview at reduced compo resolution to extend RAM previews and place markers while the RAM preview plays using the * key on the numpad.
Mylenium

Similar Messages

  • I am having trouble transferring files from an old MacBook (2007) to a MacBook Air over a wireless network.  The connection was interrupted and the time was over 24 hours.  Is there a better way to do this?  I'm using Migration assistant.

    I am having trouble transferring files from an old MacBook (2007) to a MacBook Air over a wireless network.  The connection was interrupted and the time was over 24 hours.  Is there a better way to do this?  I'm using Migration assistant.  The lack of an ethernet port on MacBook air does not help.

    William ..
    Alternative data transfer methods suggested here > OS X: How to migrate data from another Mac using Mavericks

  • Better Way To Do This? Selector Operator...

    I'm currently writing the selection operator for the algorithm. The aim of it is
    to rate how the coursework block have been allocated and give there allocation
    a rating...
    How I have done it is have a method that searches through the one of the parent
    timetables. It looks for coursework time blocks. Once it finds one it notes
    this and looks at the next block along. If this is a coursework time block it
    notes this as well. I then perform an operation comparing these two coursework
    time blocks to find out if they are for the same Module. If they are not this
    is not a very effective coursework timetable strategy.
    Because of this I note in an array the the position of these two coursework time
    block and give them a fitness rating of 1000. I then go on to see if the next
    block is a coursework time block. If it is and its not of the same Module ID of
    the two previous then I not these 3 block down in an array and give them a
    fitness rating of 2000.
    My concern is that I am using allot of if and for loop's and the code is
    starting to look untidy at best. Is there any better way of doing this?
    Below Is my code:
          * @param parentOne
          * @param parentTwo
         public void selectionOperator(ArrayList parentOne, ArrayList parentTwo){
              // Store's the fitness rating of sections of the timetable...          
              ArrayList parentOneBlockFitnessRating = new ArrayList ();
              ArrayList parentTwoBlockFitnessRating = new ArrayList ();
              //Loops through the timetable's timeblocks...
              for (int i = 0; i < parentOne.size(); i++) {
                   //Checks to see if the current time block is of the class: CourseworkTimeBlock,
                   //if so it enters this statement...
                   if(parentOne.get(i).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                        //A temp store for the current CourseworkTimeBlock...
                        CourseworkTimeBlock tempBlockOne = (CourseworkTimeBlock) parentOne.get(i);
                        System.out.println("Got Here!, Module ID...: " + tempBlockOne.getModuleId());
                        //Checks to see if the next time block along is of the class: CourseworkTimeBlock,
                        //if so it enters this statement...
                        if(parentOne.get(i+1).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                             //A temp store for the next CourseworkTimeBlock...
                             CourseworkTimeBlock tempBlockTwo = (CourseworkTimeBlock) parentOne.get(i+1);
                             System.out.println("Got Here Aswell!");
                             //Checks to see if the current and next CourseworkTimeBlock module Id's
                             //are the same, if there arn't then this section is entered...
                             if(!tempBlockOne.getModuleId().equals(tempBlockTwo.getModuleId())){
                                  //Checks to see if the second time block along is of the class: CourseworkTimeBlock,
                                  //if so it enters this statement...
                                  if(parentTwo.get(i+2).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                                       //A temp store for the second CourseworkTimeBlock along...
                                       CourseworkTimeBlock tempBlockThree = (CourseworkTimeBlock) parentTwo.get(i+2);
                                       //Checks to see if all 3 of the Module Id's of the CourseworkTimeBlocks match,
                                       //if they don't match this statement is entered...
                                       if(! tempBlockOne.getModuleId().equals(tempBlockTwo.getModuleId()) && (tempBlockTwo.getModuleId().equals(tempBlockThree.getModuleId()))) {
                                            //ArrayList to store the fitness rating of the current block
                                            //selection...
                                            ArrayList <Integer> blockFitness = new ArrayList<Integer>();
                                            //Position of first block.
                                            blockFitness.add(i);
                                            //Position of second block.
                                            blockFitness.add(i+1);
                                            //Position of second block.
                                            blockFitness.add(i+2);
                                            //Fitness Value
                                            blockFitness.add(2000);
                                            //Add block rating to main rating ArrayList...
                                            parentOneBlockFitnessRating.add(blockFitness);
                                       else{
                                            //ArrayList to store the fitness rating of the current block
                                            //selection...
                                            ArrayList <Integer> blockFitness = new ArrayList<Integer>();
                                            //Position of first block.
                                            blockFitness.add(i);
                                            //Position of second block.
                                            blockFitness.add(i+1);
                                            //Fitness Value
                                            blockFitness.add(1000);
                                            //Add block rating to main rating ArrayList...
                                            parentOneBlockFitnessRating.add(blockFitness);
              for (int o = 0; o < parentTwo.size(); o++) {
                   if(parentTwo.get(o).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                        CourseworkTimeBlock tempBlockOne = (CourseworkTimeBlock) parentTwo.get(o);
                        System.out.println("Got Here!, Module ID...: " + tempBlockOne.getModuleId());
                        if(parentTwo.get(o+1).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                             CourseworkTimeBlock tempBlockTwo = (CourseworkTimeBlock) parentTwo.get(o+1);
                             System.out.println("Got Here Aswell!");
                             if(!tempBlockOne.getModuleId().equals(tempBlockTwo.getModuleId())){
                                  if(parentTwo.get(o+2).getClass().toString().equals("class Timetable.CourseworkTimeBlock")){
                                       CourseworkTimeBlock tempBlockThree = (CourseworkTimeBlock) parentTwo.get(o+2);
                                       if(! tempBlockOne.getModuleId().equals(tempBlockTwo.getModuleId()) && (tempBlockTwo.getModuleId().equals(tempBlockThree.getModuleId()))) {
                                            ArrayList <Integer> blockFitness = new ArrayList<Integer>();
                                            //Position of first block.
                                            blockFitness.add(o);
                                            //Position of second block.
                                            blockFitness.add(o+1);
                                            //Position of second block.
                                            blockFitness.add(o+2);
                                            //Fitness Value
                                            blockFitness.add(2000);
                                            //Add block rating to main rating ArrayList...
                                            parentTwoBlockFitnessRating.add(blockFitness);
                                       else{
                                            ArrayList <Integer> blockFitness = new ArrayList<Integer>();
                                            //Position of first block.
                                            blockFitness.add(o);
                                            //Position of second block.
                                            blockFitness.add(o+1);
                                            //Fitness Value
                                            blockFitness.add(1000);
                                            //Add block rating to main rating ArrayList...
                                            parentTwoBlockFitnessRating.add(blockFitness);
         }As you can see there are allot if statements and some bad coding practice to boot. But I don't know what other ways to do it....
    Any directions of other ways how to do this?
    Many Thanks
    Chris

    Unfortunately, I think you're stuck with a bunch of if-statements.
    Fortunately, I have some things that may help you.
    First, I usually make sure something is of x class via this
    if (someObject instanceof SomeClass) {So, I'd adjust your 'class checking' conditionals from this
    if(parentOne.get(i).getClass().toString().equals("class Timetable.CourseworkTimeBlock"))to this
    if (parentOne.get(i) instanceof Timetable.CourseworkTimeBlock) {Secondly, your code logic is kind of confusing.
    Why do you have a for-loop that iterates through every CourseworkTimeBlock, if you then (within each possible iteration) check iteration+1 and iteration+2? What happens if those throw an ArrayIndexOutOfBoundsException, or are null?

  • Better Way to do this loop.

    I know there is better ways to do this so that I can merely have it loop infinitely until it hits the max password. I would also like to keep the spot where it has the print Statements because I tend to set some other code in front of it.
    If anyone also has some Ideas so I can have it stop and start in particular positions.
    Like lets say ?!!!!? to ?~~~~?
    Thanks a ton. Below is the code.
       char[] password = new char[20];
       int current_last_letter = 0;
       int max_password = 3;
       while(current_last_letter < max_password)
       for(int counter_gamma = 32; counter_gamma <= 126; counter_gamma++)
           for(int counter_beta = 32; counter_beta <= 126; counter_beta++)
                for(int counter_alpha = 32; counter_alpha <= 126; counter_alpha++) //alpha = increase last character by one
                    password[current_last_letter] = (char)counter_alpha;
                    System.out.print(password);
                    System.out.println("::null");
                if(current_last_letter > 0)
                    password[current_last_letter-1] = (char)counter_beta;
                else
                    counter_beta = 127;
            if(current_last_letter > 1)
                password[current_last_letter-2] = (char)counter_gamma;
            else
                counter_gamma = 127;
       current_last_letter++;
                   

    If I interpreted your code right, you simply want to count in radix '~'-' '+1 (read this carefully).
    Given a password, and a lo/hi value for the character range, the following method returns the
    lexicographically next password. The method returns null if no such password exists --    char[] nextPassword(char[] pw, char lo, char hi) {
          for (int i= pw.lenght; --i >= 0;)
             if (pw[i] < hi) { // next character possible here?
                pw[i]++;
                return pw;
             else // * no, reset to first value and continue;
                pw= lo;
    return null; // all pw-chars reached their hi value
    So, if you initialize a password char array as follows --    char[] pw= new char[20];
       Arrays.fill(pw, ' '); the following fragment handles every possible password --    do {
          handlePassword(pw); // do something with pw
          pw= nextPassword(pw, ' ', '~');
       } while (pw != null); kind regards,
    Jos

  • Better way to do this

    When selecting into a variable, is there a better way to do this? I want to make sure I don't get an error if there are no rows found. I think it's inefficient to count the number of occurrences before selecting into the variable. Can I use %NOROWSFOUND or something similar? If so, can you please provide an example? Thanks, Margaret
    Tzi := null;
    SELECT count(BUSINESS_tz)
    INTO Tzi_cnt
    FROM BUSINESS O
    WHERE ID = Fac_id AND BUSINESS_type = 'Store' AND O.Business_seq = (SELECT Business_seq
    FROM Org_lookup
    WHERE Store_seq = 0);
    IF Tzi_cnt > 0
    THEN
    SELECT BUSINESS_tz
    INTO Tzi
    FROM BUSINESS O
    WHERE ID = Fac_id AND BUSINESS_type = 'Store' AND O.Business_seq = (SELECT Business_seq

    the proper way to do this is to use an exception block;
    so
    begin
    Tzi := null;
    SELECT BUSINESS_tz
    INTO Tzi_cnt
    FROM BUSINESS O
    WHERE ID = Fac_id AND BUSINESS_type = 'Store' AND O.Business_seq = (SELECT Business_seq
    FROM Org_lookup
    WHERE Store_seq = 0);
    exception
    when no_data_found
    then
       null;   -- put any code to execute here or raise exception
    end;you can also use sql%rowcount to find out how many rows your sql statement affected:
    eg directly after your sql and before any rollback or commit
    declare
    v_rowcount number;
    begin
    insert into <table_name>
    select * from <other_table>;
    v_rowcount := sql%rowcount;
    end;

  • How to create a function with dynamic sql or any better way to achieve this?

            Hello,
            I have created below SQL query which works fine however when scalar function created ,it
            throws an error "Only functions and extended stored procedures can be executed from within a
            function.". In below code First cursor reads all client database names and second cursor
            reads client locations.
                      DECLARE @clientLocation nvarchar(100),@locationClientPath nvarchar(Max);
                      DECLARE @ItemID int;
                      SET @locationClientPath = char(0);
                      SET @ItemID = 67480;
       --building dynamic sql to replace database name at runtime
             DECLARE @strSQL nvarchar(Max);
             DECLARE @DatabaseName nvarchar(100);
             DECLARE @localClientPath nvarchar(MAX) ;
                      Declare databaselist_cursor Cursor for select [DBName] from [DataBase].[dbo].
                      [tblOrganization] 
                      OPEN databaselist_cursor
                      FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                      WHILE @@FETCH_STATUS = 0
                      BEGIN       
       PRINT 'Processing DATABASE: ' + @DatabaseName;
        SET @strSQL = 'DECLARE organizationlist_cursor CURSOR
        FOR SELECT '+ @DatabaseName +'.[dbo].[usGetLocationPathByRID]
                                   ([LocationRID]) 
        FROM '+ @DatabaseName +'.[dbo].[tblItemLocationDetailOrg] where
                                   ItemId = '+ cast(@ItemID as nvarchar(20))  ;
         EXEC sp_executesql @strSQL;
        -- Open the cursor
        OPEN organizationlist_cursor
        SET @localClientPath = '';
        -- go through each Location path and return the 
         FETCH NEXT FROM organizationlist_cursor into @clientLocation
         WHILE @@FETCH_STATUS = 0
          BEGIN
           SELECT @localClientPath =  @clientLocation; 
           SELECT @locationClientPath =
    @locationClientPath + @clientLocation + ','
           FETCH NEXT FROM organizationlist_cursor INTO
    @clientLocation
          END
           PRINT 'current databse client location'+  @localClientPath;
         -- Close the Cursor
         CLOSE organizationlist_cursor;
         DEALLOCATE organizationlist_cursor;
         FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                    END
                    CLOSE databaselist_cursor;
                    DEALLOCATE databaselist_cursor;
                    -- Trim the last comma from the string
                   SELECT @locationClientPath = SUBSTRING(@locationClientPath,1,LEN(@locationClientPath)-  1);
                     PRINT @locationClientPath;
            I would like to create above query in function so that return value would be used in 
            another query select statement and I am using SQL 2005.
            I would like to know if there is a way to make this work as a function or any better way
            to  achieve this?
            Thanks,

    This very simple: We cannot use dynamic SQL from used-defined functions written in T-SQL. This is because you are not permitted do anything in a UDF that could change the database state (as the UDF may be invoked as part of a query). Since you can
    do anything from dynamic SQL, including updates, it is obvious why dynamic SQL is not permitted as per the microsoft..
    In SQL 2005 and later, we could implement your function as a CLR function. Recall that all data access from the CLR is dynamic SQL. (here you are safe-guarded, so that if you perform an update operation from your function, you will get caught.) A word of warning
    though: data access from scalar UDFs can often give performance problems and its not recommended too..
    Raju Rasagounder Sr MSSQL DBA
          Hi Raju,
           Can you help me writing CLR for my above function? I am newbie to SQL CLR programming.
           Thanks in advance!
           Satya
              

  • My iPhone 4s no longer displays photos or text in horizontal mode. Is there a reset option or a known way to have this functionality return?

    My iPhone 4s no longer displays photos or text in horizontal mode. Is there a reset option or a known way to have this functionality return?

    RRGarcia wrote:
    My iPhone 4s no longer displays photos or text in horizontal mode. ...
    It could be this... Orientation Lock
    Settings > General > Lock Rotation..
    Or...
    Double-press the home button...
    Swipe to the right until you get to the Portrait Orientation Button...

  • Is there a better way to do this function?

    Hi,
    I was just wondering if someone can suggest a better way of doing the function I have attached below. Basically, it is counting pulses (falling edges) over a 250ms time period and converting that to speed. There seems to be some cases where it counts lesser pulses for a longer period than 250ms which results in lower speeds, but physically the device doesnt run any slower. Or sometimes speed is higher. This code was written by someone else and I am trying to work it better.
    V
    P.S. There is an overall master While loop.
    I may not be perfect, but I'm all I got!
    Attachments:
    counter_wait.JPG ‏87 KB

    VeeJay wrote:
    @ yamaeda what do you mean by coercion dots? Can you explain in simpler terms.? Thanks!
    V
    coercion dots are those red dots on your arithmatic functions. That means you are dividing data of different types. For instance I32 and U8 would give you a coercion dot. What you will want to do is right click your constants, choose representation->[data type]. Either that, or you can go to the numeric-> conversion pallette (i think) thats where it is and convert numbers using the primitives there.
    CLA, LabVIEW Versions 2010-2013

  • Callouts and anchored objects - there must be a better way to do this

    I've spent a lot of time in the last six months rebuilding PDF files in InDesign. It's part of my ordinary responsibilities, but I'm doing a lot more of it for some reason. Because I'm sending the text of these rebuild documents out for translation, I like to keep all of the text in a single story. It really helps to have the text in "logical order," I think; when I'm prepping a trifold brochure, I try pretty hard to make sure that the order in which the readers will read the text is duplicated in the flow of the story throughout the ID document.
    So, I'm rebuilding a manual that has a 3-column format on lettersize paper, and it's full of callouts. Chock full of 'em. They're not pull quotes, either; each of these things has unique text. Keeping in mind that I'd like the text in these callouts to remain in the same position in the text once I've linked all the stories and exported an RTF for translation, what's the best way to handle them? What I've been doing is inserting an emptly stroked frame as an anchored object, sized and positioned to sit above the text that is supposed to be called out. When my translations come back, they're always longer than the source document, so as I crawl through the text, I resize the anchored frames to match the size and position of the newly expanded translated text, and then nudge them into place with the keyboard.
    There Has To Be a Better Way.
    There is a better way, right? I'm not actually too sure. If I want to actually fill those anchored frames with text, I can't thread them into the story. I suppose that I could just thread the callout frames and assign two RTFs for translation instead of one, but then the "logical order" of my text is thrown out the window. So, I'm down to asking myself "what's more important? reduction of formatting time or maintenance of the flow of the story?" If there's something I'm missing that would let me dodge this decision, I'd love to hear about it. The only thing I can think of would work like this:
    1) Duplicate callout text in the story with a custom swatch "Invisible"
    2) Create "CalloutText" parastyle with "Invisible" swatch and apply it to callout text
    3) Insert anchor for anchored frame immediately before the CalloutText content
    4) Send it out for translation
    5) While I'm waiting for it to come back, write a script that would (dunno if this is possible):
       a) Step through the main story looking for any instance of CalloutText
       b) Copy one continguous instance of that style to the clipboard
       c) Look back in the story for the first anchor preceeding the instance of CalloutText
       d) Fill the anchored object with the text from the clipboard (this is where I'm really clueless)
       e) Apply a new parastyle to the text in the callout
       f) Continue stepping through the story looking for further instances of CalloutText
    If this really is the only decent solution, I'll just head over to the Scripting forum for some help with d). Can any of you make other suggestions?

    In-Tools.com wrote:
    The use of Side Heads saves weeks of manual labor.
    Yup, Harbs, that is exactly what I was describing. If I use the Side Heads plugin to set up a job, will my clients get a missing plug-in warning when they open up the INDD? Will roundtripping through INX strip the plugin but leave the text in the callout? (My clients don't care if the logical flow of the story is broken; it's just me.)
    I'm just curious; seems like a pretty obvious purchase to me. I'll probably try to script a solution anyways, after I buy the plugin; that way I get to learn about handling anchored objects in scripts AND deliver the job on time!

  • Is there a better way to do this Update?

    Can you do the following in a better way, maybe by using some sort of join between table_a and table_b
    update
    table_a a
    set
    (column_1, column_2)
    =
    (select
    column_3, column_4
    from
    table_b b
    where
    b.column_5 = a.column_6)
    where
    a.column_7 = whatever

    First of all, i would like to ask "if all the rows presnet in table_a are also present in table_b (w.r.t some relation like b.column_5 = a.column_6 in your example ???" If your answer is no, then your query is WRONG...it will update all records of table_a (that have a.column_7 = whatever) irrespective of whether they exist in table_b or not. There are two ways to do that
    (1)
    update table_a a
    set (column_1,column_2)=(select column_3,column_4 from table_b b where a.column_5=b.column_6)
    where exists (select null from table_b c where a.column_5=c.column_6)
    and a.column_7 = whatever
    (2)
    update
    (select column_1,column_2,column_3,column_4
    from table_a a, table_b b
    where a.column_5=b.column_6
    and a.column_7=whatever
    set column_1=column_3, column_2=column_4
    the second method wouldn't run untill you have a P.K on table_b(column_6)

  • Is there a better way to do this projection/aggregate query?

    Hi,
    Summary:
    Can anyone offer advice on how best to use JDO to perform
    projection/aggregate queries? Is there a better way of doing what is
    described below?
    Details:
    The web application I'm developing includes a GUI for ad-hoc reports on
    JDO's. Unlike 3rd party tools that go straight to the database we can
    implement business rules that restrict access to objects (by adding extra
    predicates) and provide extra calculated fields (by adding extra get methods
    to our JDO's - no expression language yet). We're pleased with the results
    so far.
    Now I want to make it produce reports with aggregates and projections
    without instantiating JDO instances. Here is an example of the sort of thing
    I want it to be capable of doing:
    Each asset has one associated t.description and zero or one associated
    d.description.
    For every distinct combination of t.description and d.description (skip
    those for which there are no assets)
    calculate some aggregates over all the assets with these values.
    and here it is in SQL:
    select t.description type, d.description description, count(*) count,
    sum(a.purch_price) sumPurchPrice
    from assets a
    left outer join asset_descriptions d
    on a.adesc_no = d.adesc_no,
    asset_types t
    where a.atype_no = t.atype_no
    group by t.description, d.description
    order by t.description, d.description
    it takes <100ms to produce 5300 rows from 83000 assets.
    The nearest I have managed with JDO is (pseodo code):
    perform projection query to get t.description, d.description for every asset
    loop on results
    if this is first time we've had this combination of t.description,
    d.description
    perform aggregate query to get aggregates for this combination
    The java code is below. It takes about 16000ms (with debug/trace logging
    off, c.f. 100ms for SQL).
    If the inner query is commented out it takes about 1600ms (so the inner
    query is responsible for 9/10ths of the elapsed time).
    Timings exclude startup overheads like PersistenceManagerFactory creation
    and checking the meta data against the database (by looping 5 times and
    averaging only the last 4) but include PersistenceManager creation (which
    happens inside the loop).
    It would be too big a job for us to directly generate SQL from our generic
    ad-hoc report GUI, so that is not really an option.
    KodoQuery q1 = (KodoQuery) pm.newQuery(Asset.class);
    q1.setResult(
    "assetType.description, assetDescription.description");
    q1.setOrdering(
    "assetType.description ascending,
    assetDescription.description ascending");
    KodoQuery q2 = (KodoQuery) pm.newQuery(Asset.class);
    q2.setResult("count(purchPrice), sum(purchPrice)");
    q2.declareParameters(
    "String myAssetType, String myAssetDescription");
    q2.setFilter(
    "assetType.description == myAssetType &&
    assetDescription.description == myAssetDescription");
    q2.compile();
    Collection results = (Collection) q1.execute();
    Set distinct = new HashSet();
    for (Iterator i = results.iterator(); i.hasNext();) {
    Object[] cols = (Object[]) i.next();
    String assetType = (String) cols[0];
    String assetDescription = (String) cols[1];
    String type_description =
    assetDescription != null
    ? assetType + "~" + assetDescription
    : assetType;
    if (distinct.add(type_description)) {
    Object[] cols2 =
    (Object[]) q2.execute(assetType,
    assetDescription);
    // System.out.println(
    // "type "
    // + assetType
    // + ", description "
    // + assetDescription
    // + ", count "
    // + cols2[0]
    // + ", sum "
    // + cols2[1]);
    q2.closeAll();
    q1.closeAll();

    Neil,
    It sounds like the problem that you're running into is that Kodo doesn't
    yet support the JDO2 grouping constructs, so you're doing your own
    grouping in the Java code. Is that accurate?
    We do plan on adding direct grouping support to our aggregate/projection
    capabilities in the near future, but as you've noticed, those
    capabilities are not there yet.
    -Patrick
    Neil Bacon wrote:
    Hi,
    Summary:
    Can anyone offer advice on how best to use JDO to perform
    projection/aggregate queries? Is there a better way of doing what is
    described below?
    Details:
    The web application I'm developing includes a GUI for ad-hoc reports on
    JDO's. Unlike 3rd party tools that go straight to the database we can
    implement business rules that restrict access to objects (by adding extra
    predicates) and provide extra calculated fields (by adding extra get methods
    to our JDO's - no expression language yet). We're pleased with the results
    so far.
    Now I want to make it produce reports with aggregates and projections
    without instantiating JDO instances. Here is an example of the sort of thing
    I want it to be capable of doing:
    Each asset has one associated t.description and zero or one associated
    d.description.
    For every distinct combination of t.description and d.description (skip
    those for which there are no assets)
    calculate some aggregates over all the assets with these values.
    and here it is in SQL:
    select t.description type, d.description description, count(*) count,
    sum(a.purch_price) sumPurchPrice
    from assets a
    left outer join asset_descriptions d
    on a.adesc_no = d.adesc_no,
    asset_types t
    where a.atype_no = t.atype_no
    group by t.description, d.description
    order by t.description, d.description
    it takes <100ms to produce 5300 rows from 83000 assets.
    The nearest I have managed with JDO is (pseodo code):
    perform projection query to get t.description, d.description for every asset
    loop on results
    if this is first time we've had this combination of t.description,
    d.description
    perform aggregate query to get aggregates for this combination
    The java code is below. It takes about 16000ms (with debug/trace logging
    off, c.f. 100ms for SQL).
    If the inner query is commented out it takes about 1600ms (so the inner
    query is responsible for 9/10ths of the elapsed time).
    Timings exclude startup overheads like PersistenceManagerFactory creation
    and checking the meta data against the database (by looping 5 times and
    averaging only the last 4) but include PersistenceManager creation (which
    happens inside the loop).
    It would be too big a job for us to directly generate SQL from our generic
    ad-hoc report GUI, so that is not really an option.
    KodoQuery q1 = (KodoQuery) pm.newQuery(Asset.class);
    q1.setResult(
    "assetType.description, assetDescription.description");
    q1.setOrdering(
    "assetType.description ascending,
    assetDescription.description ascending");
    KodoQuery q2 = (KodoQuery) pm.newQuery(Asset.class);
    q2.setResult("count(purchPrice), sum(purchPrice)");
    q2.declareParameters(
    "String myAssetType, String myAssetDescription");
    q2.setFilter(
    "assetType.description == myAssetType &&
    assetDescription.description == myAssetDescription");
    q2.compile();
    Collection results = (Collection) q1.execute();
    Set distinct = new HashSet();
    for (Iterator i = results.iterator(); i.hasNext();) {
    Object[] cols = (Object[]) i.next();
    String assetType = (String) cols[0];
    String assetDescription = (String) cols[1];
    String type_description =
    assetDescription != null
    ? assetType + "~" + assetDescription
    : assetType;
    if (distinct.add(type_description)) {
    Object[] cols2 =
    (Object[]) q2.execute(assetType,
    assetDescription);
    // System.out.println(
    // "type "
    // + assetType
    // + ", description "
    // + assetDescription
    // + ", count "
    // + cols2[0]
    // + ", sum "
    // + cols2[1]);
    q2.closeAll();
    q1.closeAll();

  • Is there a better way to do this with Flash?

    I am new to Flash but am slowly teaching myself via Lynda.com etc
    I have an image that I have added to a website via a content management system and want to make certain areas of that image into links to other sites.
    I found this page that does the kind of thing I want to do, but it appears from looking at the source code that the person who has done this has cut the image up into several sections in order to fit it into a table: http://www3.imperial.ac.uk/staffdevelopment/postdocs1/guidance
    Is there a better way to achieve the same kind of effect using Flash by making ares of an image into links and keeping the image as a whole?

    There are ways to keep the image whole and have portions of it linking to different places both in HTML and in Flash.  In HTML you can use an image map.  In Flash, you can just lay invisible buttons atop the image and use those to link.

  • Is there a better way to do this?  CSS rules/Background image/tables

    Hi,
    I am designing a site and I have used a table for the banner.  Everytime a different page is displayed, the banner image changes.  I have created .html pages, and I have created a lot of css rules to change the background image.  I think there must be a more efficiant way to do this?
    http://www.taffyproductions.com/test/
    ALSO... I need to figure out how to make the links (hover/active states) work on all the pages... I figured it out on the index page, but I'm sure there is a better css rule?

    Put a div in the head section?  Surely you jest!
    But you do hint at the easy solution - just have an embedded stylesheet in the head of each page that changed the background image only on that page.  No need for any other complexities.
    In other words on page1, change this -
    <link href="outpost.css" rel="stylesheet" type="text/css" />
    </head>
    to this -
    <link href="outpost.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    table#banner { background-image:url(images/banner1.jpg); }
    </style>
    </head>
    and on page2 change it to this -
    <link href="outpost.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    table#banner { background-image:url(images/banner2.jpg); }
    </style>
    </head>
    etc.

  • Is there a better way of doing this?

    Finally managed to get navigation to work the way I want!!!
    But not being an expert at Oracle PL/SQL i'm sure this code could be written a better way.
    I'm currently looping through the sublinks twice, first time to get a count second time to display the actual links. the reason for this is the bottom link needs a different style. Anyway here is the code I am using:
    <oracle>
    declare
         x number;
         y number;
    begin
         x := 0;
         y := 0;
         for c1 in (
         select id, display_name, name
         from #owner#.WWSBR_ALL_FOLDERS
         where parent_id = #PAGE.PAGEID# and caid=1917 and DISPLAY_IN_PARENT_FOLDER = 1
         order by display_name
         loop
                   x := x+1;
         end loop;     
         htp.p('<tr><td id="sidenavtop"><strong>#TITLE#</strong></td></tr>');
         for c1 in (
         select id, display_name, name
         from #owner#.WWSBR_ALL_FOLDERS
         where parent_id = #PAGE.PAGEID# and caid=1917 and DISPLAY_IN_PARENT_FOLDER = 1
         order by display_name
         loop
                   y := y+1;
                   if x = y then
                        htp.p('<TR><TD id="sidenavbottom">'||c1.display_name||'</TD></TR>');
                   else
                        htp.p('<TR><TD id="sidenavitem">'||c1.display_name||'</TD></TR>');                    
                   end if;
         end loop;
    end;
    </oracle>

    Well, you could fetch the count into a local variable, e.g.
    SELECT count(*)
    INTO x
    FROM ...
    WHERE ...;
    and move on, but then you are doing two fetches. I'm really sleepy at the moment, so it's possible this is logically and syntactically fouled up, but another option may be:
    DECLARE
    CURSOR c1 IS
    select id, display_name, name
    from #owner#.WWSBR_ALL_FOLDERS
    where parent_id = #PAGE.PAGEID# and caid=1917 and DISPLAY_IN_PARENT_FOLDER = 1
    order by display_name;
    r1 c1%ROWTYPE;
    l_display_name wwsbr_all_folders.display_name%TYPE;
    BEGIN
    htp.p('<tr><td id="sidenavtop">#TITLE#</td></tr>');
    OPEN c1;
    FETCH c1 INTO r1;
    l_display_name := r1.display_name;
    --hang on to the display name
    WHILE c1%FOUND LOOP
    FETCH c1 INTO r1;
    --see if there's another row...
    IF c1%FOUND THEN
    --if so, ouput the current value of l_display_name as sidenavitem
    htp.p('<TR><TD id="sidenavitem">'|| l_display_name||'</TD></TR>');
    l_display_name := r1.display_name;
    ELSE
    --if not, output the current value of l_display_name as sidenavbottom
    htp.p('<TR><TD id="sidenavbottom">'|| l_display_name||'</TD></TR>');
    END IF;
    END LOOP;
    CLOSE c1;
    end;
    Hope this helps!
    -John
    Message was edited by:
    John Hopkins

  • Using empty interface -- is there a better way to do this?

    Hi,
    I have a set of classes in different projects that I'd like to be referenced together, although they have different methods depending on which project they're from. To do so, I've created an empty interface for each of these classes to implement, so I can return a similar type and then cast it however I need to based on which project I'm using.
    However, I feel the approach of creating an empty interface just isn't the best way to do this. I've looked into annotations, but I don't think they can solve my problem. I don't think I'm being too clear here, so let me give a brief example:
    Here is one of the interfaces I use:
    public interface IceClient {
         public IceOperations operations();
    }Here is the empty interface:
    public interface IceOperations {
    }I have a method which will return a type of IceOperations:
         public static synchronized IceOperations getOperations(String clientName) {
              if (clientMap.containsKey(clientName)) {
                   IceClient client = clientMap.get(clientName);
                   return client.operations();
              } else {
                   System.out.println("No client of that name is currently running.");
                   return null;
         }This is all fine and dandy. I need to instantiate a new IceOperations object in my client code as such, where operations is of type IceOperations:
    operations = new DiagOperations();And finally return it like this, where client.operations() returns a type of IceOperations:
         public DiagOperations operations() {
              return (DiagOperations)client.operations();
         }Anyway I hope that wasn't too confusing. I cannot think of a different way to do this. Is there some way I can do this with annotations? The only other thing I can think of is just returning Object, but that seems ... icky.
    If I need to be clearer, please let me know.
    Thanks

    JoachimSauer wrote:
    I didn't understand them to be trick questions, but rather serious invitations to question and verify your assumptions.
    It might be the fact that every current implementation implements Runnable for some reason (possibly because it starts a Thread on its own). But it's entirely possible that you can produce a completely different implementation that doesn't need the Runnable interface and still be conformant.
    If every implementation of X needs to implement Runnable, then it could be a sign of a slight design smell. Could you give an example where you think it's necessary?Every implementation of my "X" interface is basically a class that acts as a communicator/listener of sorts until it's stopped by the user, similar to a server socket. Sometimes, it has to sit there and wait for events, in which case it obviously must be in its own Thread. Other times it doesn't have to do this; however if I do not start it in its own Thread, I will have to continually stop and restart the communication to invoke operations on the server, which is inefficient.

Maybe you are looking for

  • In need of a Software Developer for a Photoshop Plugin / Extension

    I'm in need of a software developer that can create a plug-in or extension panel for Photoshop, according to my instruction.  Is there a list of developers available from Adobe?  Are you a software developer that can help?  Please let me know.

  • How do you make Nokia appreciate the need for Lumi...

    As much as I'm loving the new devices Nokia releases I can't help but feel they keeping getting the internal storage wrong on their higher end devices. An ideal world would offer decent internal memory (16GB minimum/32GB+ preferable) as well as micro

  • Ipad and laptop

    hi when i plug my ipad 2 to my laptop the ipad does not charge is that meant to happen and is there away the ipad can charge from my laptop? thanks shannon

  • Onchange attribute of h:inputText/ not rendered  in JSF 1.2.08 and above

    Hi! I am using Glassfish v2ur2, which is shipped with JSF 1.2.04. I have upgraded to 1.2.08 performing the steps in the release notes - basically overwriting GLASSFISH_HOME/lib/jsf-impl.jar and adding jsf-api.jar at the same location. It works, but I

  • Release code addition in an existing release strategy

    Dear All, Kindly let me know what are the implications when we have to add a release code in already working release strategy? Thanks, Sam